diff --git a/.bazelrc b/.bazelrc new file mode 100644 index 00000000..5ca85ce0 --- /dev/null +++ b/.bazelrc @@ -0,0 +1,40 @@ +# build --remote_cache=http://bazelcache.inc.alipay.net + +# specify java version +build --java_language_version=8 +#build --java_runtime_version=localjdk +#build --tool_java_runtime_version=localjdk +#build --extra_toolchains=@local_jdk//:all +#build --java_toolchain=//:default_toolchain + +# specify javac options +build --javacopt="-Aproject=org.example/sparrow-cli -source 8 -target 8" + +# verbose test failed message +build --verbose_failures +build --test_output=errors + +# for c +build --repo_env=CC=clang --repo_env=CXX=clang++ +build --action_env=BAZEL_CXXOPTS="-std=gnu++17" +build --cxxopt=-std=gnu++17 --host_cxxopt=-std=gnu++17 +build --features=-default_link_flags + +# For linux-specific configurations +build --enable_platform_specific_config +build:linux --linkopt=-fuse-ld=gold --host_linkopt=-fuse-ld=gold + +# Links all targets in mostly static mode. If -static is set in linkopts, targets will change to fully static. +build --dynamic_mode=off + +# build with optimization enabled and with assert() calls disabled +build --compilation_mode opt + +# for js +build --strategy=Genrule=standalone + +# for go +# set GOPROXY +test --action_env=GOPROXY=https://goproxy.cn +build --action_env=GOPROXY=https://goproxy.cn +run --action_env=GOPROXY=https://goproxy.cn diff --git a/.bazelversion b/.bazelversion new file mode 100644 index 00000000..7cbea073 --- /dev/null +++ b/.bazelversion @@ -0,0 +1 @@ +5.2.0 \ No newline at end of file diff --git a/.github/workflows/bazel_cli_build.yml b/.github/workflows/bazel_cli_build.yml new file mode 100644 index 00000000..f9b968ec --- /dev/null +++ b/.github/workflows/bazel_cli_build.yml @@ -0,0 +1,39 @@ +name: Bazel CLI Build (macOS) + +on: + push: + paths-ignore: + - 'doc/**' + - 'example/**' + - '**/*.md' + pull_request: + paths-ignore: + - 'doc/**' + - 'example/**' + - '**/*.md' + workflow_dispatch: + + +jobs: + build-macos: + runs-on: macos-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + submodules: true + - name: Install python3 + run: brew install python3 + - name: Set up Bazel + uses: bazel-contrib/setup-bazel@0.14.0 + with: + bazelisk-cache: true + disk-cache: ${{ github.workflow }} + repository-cache: true + - name: Build All + run: bazel build //... + - name: Upload sparrow-cli.tar.gz artifact + uses: actions/upload-artifact@v4 + with: + name: sparrow-cli + path: bazel-bin/sparrow-cli.tar.gz diff --git a/.github/workflows/godel_build.yml b/.github/workflows/godel_build.yml index efe613fb..727a3e9f 100644 --- a/.github/workflows/godel_build.yml +++ b/.github/workflows/godel_build.yml @@ -2,9 +2,13 @@ name: GodelScript Build on: push: - branches: [ main, lhk_dev ] + paths: + - godel-script/** pull_request: branches: [ main ] + paths: + - godel-script/** + workflow_dispatch: jobs: mac-aarch64-build: @@ -44,6 +48,9 @@ jobs: run: | git config --global user.name "$(git log -n 1 --pretty=format:%an)" git config --global user.email "$(git log -n 1 --pretty=format:%ae)" + - name: Install Package + run: | + sudo apt-get install sqlite3 libsqlite3-dev - name: Build run: | cd godel-script diff --git a/.gitignore b/.gitignore index 81174ae3..2c393632 100644 --- a/.gitignore +++ b/.gitignore @@ -40,3 +40,8 @@ bazel-bin bazel-CodeFuse-Query bazel-out bazel-testlogs + +__pycache__/ +*.pyc +*.pyo +*.pyd diff --git a/BUILD b/BUILD new file mode 100644 index 00000000..38096a42 --- /dev/null +++ b/BUILD @@ -0,0 +1,725 @@ +load("//:visibility.bzl", "PUBLIC_VISIBILITY") +load("@rules_pkg//pkg:tar.bzl", "pkg_tar") +load("@rules_pkg//pkg:mappings.bzl", "pkg_attributes", "pkg_files", "strip_prefix") + +# This rule is deprecated but useful to pack a directory from output of genrule +load("@bazel_tools//tools/build_defs/pkg:pkg.bzl", pkg_tar_old = "pkg_tar") +load("@com_github_bazelbuild_buildtools//buildifier:def.bzl", "buildifier") +load("@aspect_bazel_lib//lib:copy_to_bin.bzl", "copy_to_bin") +load("@aspect_bazel_lib//lib:copy_to_directory.bzl", "copy_to_directory") + +# By using select() in a configurable attribute, the attribute effectively adopts different values when different conditions hold. +config_setting( + name = "custom_build", + values = { + "define": "enable_swift_extractor=false", + }, +) + +# For convenience to use bazel run command (e.g. bazel run -- //:sparrow-cli-entrypoint database create) to execute sparrow-cli, +# so make this target as entrypoint for bazel run +genrule( + name = "sparrow-cli-entrypoint", + srcs = [":sparrow-cli"], + outs = ["dist/sparrow-cli/sparrow"], + cmd = """ + rm -rf $(RULEDIR)/dist + mkdir -p $(RULEDIR)/dist + tar -zxvf $(SRCS) -C $(RULEDIR)/dist + """, + executable = 1, +) + +# CLI executable +# Current pkg_tar/pkg_files rules can't pack a directory generated from genrule. +# To workaround this, use the deprecated pkg_tar rule instead +pkg_tar_old( + name = "sparrow-cli-pkg", + srcs = [ + "//cli:pyinstaller-sparrow-cli", + ], + mode = "0755", + package_dir = "cli", +) + +# Pack C family artifacts +# pkg_files( +# name = "coref-cfamily-lib-03-pkg", +# srcs = [ +# "//language/cfamily:lib-03", +# ], +# attributes = pkg_attributes( +# mode = "0644", +# ), +# prefix = "lib-03/coref/cfamily", +# strip_prefix = strip_prefix.from_pkg() + "lib-03", +# ) + +pkg_files( + name = "coref-cfamily-lib-script-pkg", + srcs = [ + "//language/cfamily:lib", + ], + attributes = pkg_attributes( + mode = "0644", + ), + prefix = "lib/coref/cfamily", + strip_prefix = strip_prefix.from_pkg() + "lib", +) + +# Current pkg_tar/pkg_files rules can't pack a directory generated from genrule. +# To workaround this, use the deprecated pkg_tar rule instead +pkg_tar_old( + name = "coref-cfamily-src-extractor-pkg", + srcs = [ + "//:generate-coref-cfamily-src-extractor-library", + ], + mode = "0755", + package_dir = "language/cfamily/extractor", + strip_prefix = "coref-cfamily-src-extractor", +) + +# TODO Shoud not use this script to change rpath. Should put dylib during linking to have correct rpath. +genrule( + name = "generate-coref-cfamily-src-extractor-library", + srcs = [ + "//language/cfamily/extractor:coref-cfamily-src-extractor", + "//:tool/build-utils/pack_libs.py", + "//language/cfamily/extractor:copy-clang-builtin-headers", + ], + # Normally outs of genrule should be a list of files, not just a directory, but don't see another way to workaround this + outs = [ + "coref-cfamily-src-extractor", + ], + cmd = """ + mkdir -p $@/usr/bin + cp $(location //language/cfamily/extractor:coref-cfamily-src-extractor) $@/usr/bin + python3 $(location //:tool/build-utils/pack_libs.py) $@/usr + cp -r $(location //language/cfamily/extractor:copy-clang-builtin-headers) $@/usr/lib + """, +) + +# Pack Go artifacts +# pkg_files( +# name = "coref-go-lib-03-pkg", +# srcs = [ +# "//language/go:lib-03", +# ], +# attributes = pkg_attributes( +# mode = "0644", +# ), +# prefix = "lib-03/coref/go", +# strip_prefix = strip_prefix.from_pkg() + "lib-03", +# ) + +# pkg_files( +# name = "coref-go-lib-script-pkg", +# srcs = [ +# "//language/go:lib", +# ], +# attributes = pkg_attributes( +# mode = "0644", +# ), +# prefix = "lib/coref/go", +# strip_prefix = strip_prefix.from_pkg() + "lib", +# ) + +# pkg_files( +# name = "coref-go-src-extractor-pkg", +# srcs = [ +# "//language/go/extractor/src/cli/auto-builder:coref-go-src-extractor", +# "//language/go/extractor/src/cli/auto-builder:generate-go-sdk", +# ], +# attributes = pkg_attributes( +# mode = "0755", +# ), +# prefix = "language/go/extractor", +# ) + +# Pack Java artifacts +# pkg_files( +# name = "coref-java-lib-03-pkg", +# srcs = [ +# "//language/java:lib-03", +# ], +# attributes = pkg_attributes( +# mode = "0644", +# ), +# prefix = "lib-03/coref/java", +# strip_prefix = strip_prefix.from_pkg() + "lib-03", +# ) + +pkg_files( + name = "coref-java-lib-script-pkg", + srcs = [ + "//language/java:lib", + ], + attributes = pkg_attributes( + mode = "0644", + ), + prefix = "lib/coref/java", + strip_prefix = strip_prefix.from_pkg() + "lib", +) + +pkg_files( + name = "coref-java-src-extractor-pkg", + srcs = [ + "//language/java/extractor:coref-java-src-extractor_deploy.jar", + ], + attributes = pkg_attributes( + mode = "0755", + ), + prefix = "language/java/extractor", +) + +# Pack JavaScript artifacts +# pkg_files( +# name = "coref-javascript-lib-03-pkg", +# srcs = [ +# "//language/javascript:lib-03", +# ], +# attributes = pkg_attributes( +# mode = "0644", +# ), +# prefix = "lib-03/coref/javascript", +# strip_prefix = strip_prefix.from_pkg() + "lib-03", +# ) + +pkg_files( + name = "coref-javascript-lib-script-pkg", + srcs = [ + "//language/javascript:lib", + ], + attributes = pkg_attributes( + mode = "0644", + ), + prefix = "lib/coref/javascript", + strip_prefix = strip_prefix.from_pkg() + "lib", +) + +pkg_files( + name = "coref-javascript-src-extractor-pkg", + srcs = [ + "//language/javascript/extractor:coref-javascript-src-extractor", + ], + attributes = pkg_attributes( + mode = "0755", + ), + prefix = "language/javascript/extractor", +) + +# Pack Python artifacts +# pkg_files( +# name = "coref-python-lib-03-pkg", +# srcs = [ +# "//language/python:lib-03", +# ], +# attributes = pkg_attributes( +# mode = "0644", +# ), +# prefix = "lib-03/coref/python", +# strip_prefix = strip_prefix.from_pkg() + "lib-03", +# ) + +pkg_files( + name = "coref-python-lib-script-pkg", + srcs = [ + "//language/python:lib", + ], + attributes = pkg_attributes( + mode = "0644", + ), + prefix = "lib/coref/python", + strip_prefix = strip_prefix.from_pkg() + "lib", +) + +pkg_files( + name = "coref-python-src-extractor-pkg", + srcs = [ + "//language/python/extractor:coref-python-extractor-bin", + ], + attributes = pkg_attributes( + mode = "0755", + ), + prefix = "language/python/extractor/", +) + +# Pack XML artifacts +# pkg_files( +# name = "coref-xml-lib-03-pkg", +# srcs = [ +# "//language/xml:lib-03", +# ], +# attributes = pkg_attributes( +# mode = "0644", +# ), +# prefix = "lib-03/coref/xml", +# strip_prefix = strip_prefix.from_pkg() + "lib-03", +# ) + +pkg_files( + name = "coref-xml-lib-script-pkg", + srcs = [ + "//language/xml:lib", + ], + attributes = pkg_attributes( + mode = "0644", + ), + prefix = "lib/coref/xml", + strip_prefix = strip_prefix.from_pkg() + "lib", +) + +pkg_files( + name = "coref-xml-extractor-pkg", + srcs = [ + "//language/xml/extractor:coref-xml-extractor_deploy.jar", + ], + attributes = pkg_attributes( + mode = "0755", + ), + prefix = "language/xml/extractor", +) + +# Pack Swift artifacts +# pkg_files( +# name = "coref-swift-lib-03-pkg", +# srcs = [ +# "//language/swift:lib-03", +# ], +# attributes = pkg_attributes( +# mode = "0644", +# ), +# prefix = "lib-03/coref/swift", +# strip_prefix = strip_prefix.from_pkg() + "lib-03", +# ) + +# pkg_files( +# name = "coref-swift-lib-script-pkg", +# srcs = [ +# "//language/swift:lib", +# ], +# attributes = pkg_attributes( +# mode = "0644", +# ), +# prefix = "lib/coref/swift", +# strip_prefix = strip_prefix.from_pkg() + "lib", +# ) + +# Pack SQL artifacts +# pkg_files( +# name = "coref-sql-lib-03-pkg", +# srcs = [ +# "//language/sql:lib-03", +# ], +# attributes = pkg_attributes( +# mode = "0644", +# ), +# prefix = "lib-03/coref/sql", +# strip_prefix = strip_prefix.from_pkg() + "lib-03", +# ) + +pkg_files( + name = "coref-sql-lib-script-pkg", + srcs = [ + "//language/sql:lib", + ], + attributes = pkg_attributes( + mode = "0644", + ), + prefix = "lib/coref/sql", + strip_prefix = strip_prefix.from_pkg() + "lib", +) + +pkg_files( + name = "coref-sql-src-extractor-pkg", + srcs = [ + "//language/sql/extractor:coref-sql-src-extractor_deploy.jar", + ], + attributes = pkg_attributes( + mode = "0755", + ), + prefix = "language/sql/extractor", +) + +# Pack Properties artifacts +# pkg_files( +# name = "coref-properties-lib-03-pkg", +# srcs = [ +# "//language/properties:lib-03", +# ], +# attributes = pkg_attributes( +# mode = "0644", +# ), +# prefix = "lib-03/coref/properties", +# strip_prefix = strip_prefix.from_pkg() + "lib-03", +# ) + +pkg_files( + name = "coref-properties-lib-script-pkg", + srcs = [ + "//language/properties:lib", + ], + attributes = pkg_attributes( + mode = "0644", + ), + prefix = "lib/coref/properties", + strip_prefix = strip_prefix.from_pkg() + "lib", +) + +pkg_files( + name = "coref-properties-extractor-pkg", + srcs = [ + "//language/properties/extractor:coref-properties-src-extractor_deploy.jar", + ], + attributes = pkg_attributes( + mode = "0755", + ), + prefix = "language/properties/extractor", +) + +# Pack ArkTs artifacts +pkg_files( + name = "coref-arkts-lib-script-pkg", + srcs = [ + "//language/arkts:lib", + ], + attributes = pkg_attributes( + mode = "0644", + ), + prefix = "lib/coref/arkts", + strip_prefix = strip_prefix.from_pkg() + "lib", +) + +pkg_files( + name = "coref-arkts-src-extractor-pkg", + srcs = [ + "//language/arkts/extractor:coref-arkts-src-extractor", + ], + attributes = pkg_attributes( + mode = "0755", + ), + prefix = "language/arkts/extractor", +) + +# Current pkg_tar/pkg_files rules can't pack a directory generated from genrule. +# To workaround this, use the deprecated pkg_tar rule instead +# pkg_tar_old( +# name = "coref-swift-src-extractor-pkg", +# srcs = [ +# "//:generate-coref-swift-src-extractor-library", +# ], +# mode = "0755", +# package_dir = "language/swift/extractor", +# strip_prefix = "coref-swift-src-extractor", +# ) + +# TODO Shoud not use this script to change rpath. Should put dylib during linking to have correct rpath. +# genrule( +# name = "generate-coref-swift-src-extractor-library", +# srcs = [ +# "//language/swift/extractor:coref-swift-src-extractor", +# "//:tool/build-utils/pack_libs.py", +# ], +# # Normally outs of genrule should be a list of files, not just a directory, but don't see another way to workaround this +# outs = [ +# "coref-swift-src-extractor", +# ], +# cmd = """ +# mkdir -p $@/usr/bin +# cp $(location //language/swift/extractor:coref-swift-src-extractor) $@/usr/bin +# python3 $(location //:tool/build-utils/pack_libs.py) $@/usr +# """, +# ) + +# Pack Godel 0.3 & script artifacts +# pkg_files( +# name = "godel-0.3-pkg", +# srcs = select({ +# "@bazel_tools//src/conditions:darwin": ["@osx_godel_0.3//:all"], +# "//conditions:default": ["@linux_godel_0.3//:all"], +# }), +# attributes = pkg_attributes( +# mode = "0755", +# ), +# prefix = "godel-0.3", +# strip_prefix = strip_prefix.from_pkg(), +# ) + +pkg_files( + name = "godel-script-pkg", + srcs = select({ + "@bazel_tools//src/conditions:darwin": ["@osx_godel_script//:all"], + "//conditions:default": ["@linux_godel_script//:all"], + }), + attributes = pkg_attributes( + mode = "0755", + ), + prefix = "godel-script", + strip_prefix = strip_prefix.from_pkg(), +) + +# copy file to sparrowHome, for local debug +copy_to_bin( + name = "copy-version-file", + srcs = [ + "version.txt", + ], + visibility = ["//visibility:public"], +) + +# copy_to_directory( +# name = "copy-godel-0.3-lib", +# srcs = [ +# "//language/cfamily:lib-03", +# "//language/go:lib-03", +# "//language/java:lib-03", +# "//language/javascript:lib-03", +# "//language/properties:lib-03", +# "//language/python:lib-03", +# "//language/sql:lib-03", +# "//language/xml:lib-03", +# ], +# out = "lib-03", +# visibility = ["//visibility:public"], +# ) + +# coref_lib_03_pkgs = [ +# ":coref-cfamily-lib-03-pkg", +# ":coref-go-lib-03-pkg", +# ":coref-sql-lib-03-pkg", +# ":coref-java-lib-03-pkg", +# ":coref-javascript-lib-03-pkg", +# ":coref-python-lib-03-pkg", +# ":coref-xml-lib-03-pkg", +# ":coref-properties-lib-03-pkg", +# ] + select({ +# ":custom_build": [], +# "//conditions:default": [":coref-swift-lib-03-pkg"], +# }) + +coref_lib_script_pkgs = [ + # ":coref-go-lib-script-pkg", + ":coref-java-lib-script-pkg", + ":coref-javascript-lib-script-pkg", + ":coref-python-lib-script-pkg", + ":coref-xml-lib-script-pkg", + ":coref-cfamily-lib-script-pkg", + ":coref-properties-lib-script-pkg", + ":coref-sql-lib-script-pkg", + ":coref-arkts-lib-script-pkg", +] + +coref_libscript_languages = [ + "java", + "javascript", + # "go", + "python", + "xml", + "cfamily", + "properties", + "sql", + # "swift", + "arkts", +] + +copy_to_directory( + name = "copy-godel-script", + srcs = select({ + "@bazel_tools//src/conditions:darwin": ["@osx_godel_script//:all"], + "//conditions:default": ["@linux_godel_script//:all"], + }), + out = "godel-script", + include_external_repositories = [ + "osx_godel_script", + "linux_godel_script", + ], + visibility = ["//visibility:public"], +) + +copy_to_directory( + name = "copy-java-lib-script", + srcs = [ + "//language/java:lib", + ], + out = "lib/coref/java", + replace_prefixes = {"language/java/lib": ""}, + visibility = ["//visibility:public"], +) + +copy_to_directory( + name = "copy-javascript-lib-script", + srcs = [ + "//language/javascript:lib", + ], + out = "lib/coref/javascript", + replace_prefixes = {"language/javascript/lib": ""}, + visibility = ["//visibility:public"], +) + +# copy_to_directory( +# name = "copy-go-lib-script", +# srcs = [ +# "//language/go:lib", +# ], +# out = "lib/coref/go", +# replace_prefixes = {"language/go/lib": ""}, +# visibility = ["//visibility:public"], +# ) + +copy_to_directory( + name = "copy-python-lib-script", + srcs = [ + "//language/python:lib", + ], + out = "lib/coref/python", + replace_prefixes = {"language/python/lib": ""}, + visibility = ["//visibility:public"], +) + +copy_to_directory( + name = "copy-xml-lib-script", + srcs = [ + "//language/xml:lib", + ], + out = "lib/coref/xml", + replace_prefixes = {"language/xml/lib": ""}, + visibility = ["//visibility:public"], +) + +copy_to_directory( + name = "copy-properties-lib-script", + srcs = [ + "//language/properties:lib", + ], + out = "lib/coref/properties", + replace_prefixes = {"language/properties/lib": ""}, + visibility = ["//visibility:public"], +) + +copy_to_directory( + name = "copy-sql-lib-script", + srcs = [ + "//language/sql:lib", + ], + out = "lib/coref/sql", + replace_prefixes = {"language/sql/lib": ""}, + visibility = ["//visibility:public"], +) + +copy_to_directory( + name = "copy-cfamily-lib-script", + srcs = [ + "//language/cfamily:lib", + ], + out = "lib/coref/cfamily", + replace_prefixes = {"language/cfamily/lib": ""}, + visibility = ["//visibility:public"], +) + +# copy_to_directory( +# name = "copy-swift-lib-script", +# srcs = [ +# "//language/swift:lib", +# ], +# out = "lib/coref/swift", +# replace_prefixes = {"language/swift/lib": ""}, +# visibility = ["//visibility:public"], +# ) + +copy_to_directory( + name = "copy-arkts-lib-script", + srcs = [ + "//language/arkts:lib", + ], + out = "lib/coref/arkts", + replace_prefixes = {"language/arkts/lib": ""}, + visibility = ["//visibility:public"], +) + +genrule( + name = "coref-lib-script-gen", + srcs = [ + "//cli:pyinstaller-sparrow-cli", + ":copy-godel-script", + ":copy-java-lib-script", + ":copy-javascript-lib-script", + # ":copy-go-lib-script", + ":copy-python-lib-script", + ":copy-xml-lib-script", + ":copy-properties-lib-script", + ":copy-sql-lib-script", + ":copy-cfamily-lib-script", + # ":copy-swift-lib-script", + ":copy-arkts-lib-script", + ], + outs = ["lib/coref/%s.gdl" % language for language in coref_libscript_languages], + cmd = """ + string="$(locations //cli:pyinstaller-sparrow-cli)" + # Remove everything before the last space character + result="$${string##* }" + echo "$$result" + $$result --sparrow-cli-internal $(@D) rebuild lib -lang all + """, + local = True, + visibility = ["//visibility:public"], +) + +pkg_files( + name = "coref-lib-pkg", + srcs = [ + ":coref-lib-script-gen", + ], + attributes = pkg_attributes( + mode = "0644", + ), + strip_prefix = strip_prefix.from_pkg(), +) + +# Pack final sparrow-cli package +pkg_tar( + name = "sparrow-cli", + srcs = [ + ":coref-lib-pkg", + ":coref-arkts-src-extractor-pkg", + # ":coref-go-src-extractor-pkg", + ":coref-sql-src-extractor-pkg", + ":coref-java-src-extractor-pkg", + ":coref-javascript-src-extractor-pkg", + ":coref-python-src-extractor-pkg", + ":coref-xml-extractor-pkg", + ":coref-properties-extractor-pkg", + # ":godel-0.3-pkg", + ":godel-script-pkg", + "//cli:sparrow", + "version.txt", + ] + coref_lib_script_pkgs, + extension = "tar.gz", + mode = "0755", + package_dir = "sparrow-cli", + strip_prefix = strip_prefix.from_pkg(), + visibility = ["//visibility:public"], + deps = [ + ":coref-cfamily-src-extractor-pkg", + ":sparrow-cli-pkg", + ], +) + +# buildifier( +# name = "buildifier", +# ) + +# load("@bazel_gazelle//:def.bzl", "gazelle") + +# # gazelle:prefix alipay.com/code_insight/coref-go-extractor +# gazelle(name = "gazelle") + +# gazelle( +# name = "gazelle-update-repos", +# args = [ +# "-from_file=language/go/extractor/go.mod", +# "-to_macro=deps.bzl%go_dependencies", +# "-prune", +# "-build_file_proto_mode=disable_global", +# ], +# command = "update-repos", +# ) diff --git a/README.md b/README.md index 24c979b8..893d585a 100644 --- a/README.md +++ b/README.md @@ -39,6 +39,13 @@ In the domain of large-scale software development, the demands for dynamic and m CodeFuse-Query reimagines code analysis as a data computation task, support scanning over 10 billion lines of code daily and more than 300 different tasks. It optimizes resource utilization, prioritizes data reusability, applies incremental code extraction, and introduces tasks types specially for Code Change, underscoring its domain-optimized design. The system's logic-oriented facet employs Datalog, utilizing a unique two-tiered schema, COREF, to convert source code into data facts. Through Godel, a distinctive language, CodeFuse-Query enables formulation of complex tasks as logical expressions, harnessing Datalog's declarative prowess. Overall, the CodeFuse-Query platform is divided into three main parts: code data model, code query DSL, and platform productization services. + +**News!!** A paper describing the data-centric and language-agnostic static analysis has been accepted by ICSE 2025: + +- Title: Datalog-Based Language-Agnostic Change Impact Analysis for Microservices + +- Authors: [Qingkai Shi](https://qingkaishi.github.io) (Nanjing University), Xiaoheng Xie (Ant Group), Xianjin Fu (Ant Group), Peng Di (Ant Group), Huawei Li (Alibaba Inc.), Ang Zhou (Ant Group), and Gang Fan (Ant Group) + ### Code Data Model: COREF We have defined a code data and standardization model: COREF, which requires all code to be converted to this model through various language extractors. COREF mainly contains the following information: @@ -80,36 +87,36 @@ Note: The maturity level of the language status is determined based on the types - [Installation, Configuration, and Running](./doc/3_install_and_run.en.md) - [GödelScript Query Language](./doc/4_godelscript_language.en.md) - [Developing Plugins (VSCode)](./doc/5_toolchain.en.md) -- [COREF API](https://codefuse-ai.github.io/CodeFuse-Query/godel-api/coref_library_reference.html) +- [COREF API](https://codefuse-ai.github.io/CodeFuse-Query) ## Tutorial - [Online Tutorial](./tutorial/README.en.md) -## Directory Structure Description -- `cli`: The entry point for the command-line tool, providing a unified command-line interface, calling other modules to complete specific functions -- `language`: Core data and data modeling (lib) for various languages. Regarding the degree of openness, please refer to the section "Some Notes on the Scope of Open Source" -- `doc`: Reference documents -- `examples`: Gödel query language examples -- `tutorial`:CodeFuse-Query Development Container Usage Tutorial - -## Some Notes on the Scope of Open Source -As of now, it is **not possible** to build an executable program from the source code because not all modules have been made open-source in this release, and missing modules will be released over the next year. Nevertheless, to ensure a complete experience, we have released **complete installation packages** for download, please see the Release page. -Regarding the openness of languages, you can refer to the table below: - -| Language | Data Modeling Open Source | Data Core Open Source | Maturity | -| --- | --- | --- | --- | -| Python | Y | Y | RELEASE | -| Java | Y | N | RELEASE | -| JavaScript | Y | N | RELEASE | -| Go | Y | N | RELEASE | -| XML | Y | N | RELEASE | -| Cfamily | N | N | BETA | -| SQL | N | N | BETA | -| Swift | N | N | BETA | -| Properties | N | N | BETA | + +## Related Paper + +Our work is described in the following paper: + +[**CodeFuse-Query: A Data-Centric Static Code Analysis System for Large-Scale Organizations**](https://arxiv.org/abs/2401.01571) + +## Citation + +If you find **CodeFuse-Query** useful in your research, please cite our paper: + +```bibtex +@misc{xie2024codefusequerydatacentricstaticcode, + title={CodeFuse-Query: A Data-Centric Static Code Analysis System for Large-Scale Organizations}, + author={Xiaoheng Xie and Gang Fan and Xiaojun Lin and Ang Zhou and Shijie Li and Xunjin Zheng and Yinan Liang and Yu Zhang and Na Yu and Haokun Li and Xinyu Chen and Yingzhuang Chen and Yi Zhen and Dejun Dong and Xianjin Fu and Jinzhou Su and Fuxiong Pan and Pengshuai Luo and Youzheng Feng and Ruoxiang Hu and Jing Fan and Jinguo Zhou and Xiao Xiao and Peng Di}, + year={2024}, + eprint={2401.01571}, + archivePrefix={arXiv}, + primaryClass={cs.SE}, + url={https://arxiv.org/abs/2401.01571}, +} +``` ## Contact Us ![WeChat User Group Image](./assets/wechat_qrcode.JPG) ## Star History -[![Star History Chart](https://api.star-history.com/svg?repos=codefuse-ai/CodeFuse-Query&type=Date)](https://star-history.com/#codefuse-ai/CodeFuse-Query&Date) \ No newline at end of file +[![Star History Chart](https://api.star-history.com/svg?repos=codefuse-ai/CodeFuse-Query&type=Date)](https://star-history.com/#codefuse-ai/CodeFuse-Query&Date) diff --git a/README_cn.md b/README_cn.md index 22a9e376..ebc4f252 100644 --- a/README_cn.md +++ b/README_cn.md @@ -79,33 +79,11 @@ CodeFuse-Query 包括**Sparrow CLI **和CodeFuse-Query**在线服务Query中心* - [安装、配置、运行](./doc/3_install_and_run.md) - [Gödel查询语言介绍](./doc/4_godelscript_language.md) - [VSCode开发插件](./doc/5_toolchain.md) -- [COREF API](https://codefuse-ai.github.io/CodeFuse-Query/godel-api/coref_library_reference.html) +- [COREF API](https://codefuse-ai.github.io/CodeFuse-Query) ## 教程 (tutorial) - [在线教程](./tutorial/README.md) -## 目录结构说明 -- `cli`:命令行工具的入口,提供统一的命令行接口,调用其他模块完成具体功能 -- `language`:各语言的数据化核心(extractor)和数据建模(lib)。关于开放度的问题,请参见《关于开源范围的一些说明》章节 -- `doc`:参考文档 -- `examples`:Gödel 查询语言示例 -- `tutorial`:CodeFuse-Query 开发容器使用教程 - -## 关于开源范围的一些说明 -截止目前,从源码**不能**构建出可执行的程序,原因在于本次开源并没有开放所有的模块,缺少的模块会在之后的一年陆续开源。尽管如此,为保障完整的体验,我们开放了**完整的安装包**下载,请见Release页面。 -关于语言的开放程度,可以查看下表: - -| 语言 | 数据建模开源 | 数据化核心开源 | 成熟度 | -| --- | --- | --- | --- | -| Python | Y | Y | RELEASE | -| Java | Y | N | RELEASE | -| JavaScript | Y | N | RELEASE | -| Go | Y | N | RELEASE | -| XML | Y | N | RELEASE | -| Cfamily | N | N | BETA | -| SQL | N | N | BETA | -| Swift | N | N | BETA | -| Properties | N | N | BETA | ## 联系我们 ![微信用户群图片](./assets/wechat_qrcode.JPG) diff --git a/WORKSPACE b/WORKSPACE new file mode 100644 index 00000000..20d9c68e --- /dev/null +++ b/WORKSPACE @@ -0,0 +1,579 @@ +load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") +load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe") +load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_file") +load("//:junit5.bzl", "junit_jupiter_java_repositories", "junit_platform_java_repositories") + +### c dependencies + +# SQLITE_VERSION "3.39.0" +SQLITE_BAZEL_COMMIT = "57ff3012abd4c832b40148aeb6ec1d5d0b4cc3f7" + +SQLITE_BAZEL_SHA = "95d9872a38f9162e0138de8b38b124af250b38719c5380f0ee863ad306d70573" + +http_archive( + name = "com_github_rockwotj_sqlite_bazel", + sha256 = SQLITE_BAZEL_SHA, + strip_prefix = "sqlite-bazel-" + SQLITE_BAZEL_COMMIT, + urls = ["https://github.com/rockwotj/sqlite-bazel/archive/%s.zip" % SQLITE_BAZEL_COMMIT], +) + +# LLVM +SKYLIB_VERSION = "1.3.0" + +http_archive( + name = "bazel_skylib", + sha256 = "74d544d96f4a5bb630d465ca8bbcfe231e3594e5aae57e1edbf17a6eb3ca2506", + urls = [ + "https://antsys-sparrow-data.cn-shanghai-alipay-office.oss-alipay.aliyuncs.com/sparrow/public/tools/bazel-skylib-{version}.tar.gz".format(version = SKYLIB_VERSION), + "https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/releases/download/{version}/bazel-skylib-{version}.tar.gz".format(version = SKYLIB_VERSION), + "https://github.com/bazelbuild/bazel-skylib/releases/download/{version}/bazel-skylib-{version}.tar.gz".format(version = SKYLIB_VERSION), + ], +) + +# LLVM 13.0.1 Release +# Replace with the LLVM commit you want to use. +LLVM_COMMIT = "75e33f71c2dae584b13a7d1186ae0a038ba98838" + +# The easiest way to calculate this for a new commit is to set it to empty and +# then run a bazel build and it will report the digest necessary to cache the +# archive and make the build reproducible. +LLVM_SHA256 = "9e2ef2fac7525a77220742a3384cafe7a35adc7e5c9750378b2cf25c2d2933f5" + +http_archive( + name = "llvm-raw", + build_file_content = "# empty", + sha256 = LLVM_SHA256, + strip_prefix = "llvm-project-" + LLVM_COMMIT, + urls = [ + "https://antsys-sparrow-data.cn-shanghai-alipay-office.oss-alipay.aliyuncs.com/sparrow/public/tools/llvm/{commit}.tar.gz".format(commit = LLVM_COMMIT), + "https://github.com/llvm/llvm-project/archive/{commit}.tar.gz".format(commit = LLVM_COMMIT), + ], +) + +http_archive( + name = "llvm-bazel", + sha256 = LLVM_SHA256, + strip_prefix = "llvm-project-{}/utils/bazel".format(LLVM_COMMIT), + urls = [ + "https://antsys-sparrow-data.cn-shanghai-alipay-office.oss-alipay.aliyuncs.com/sparrow/public/tools/llvm/{commit}.tar.gz".format(commit = LLVM_COMMIT), + "https://github.com/llvm/llvm-project/archive/{commit}.tar.gz".format(commit = LLVM_COMMIT), + ], +) + +load("@llvm-bazel//:configure.bzl", "llvm_configure", "llvm_disable_optional_support_deps") + +llvm_configure( + name = "llvm-project", + src_path = ".", + src_workspace = "@llvm-raw//:WORKSPACE", + targets = ["X86"], +) + +# Disables optional dependencies for Support like zlib and terminfo. You may +# instead want to configure them using the macros in the corresponding bzl +# files. +llvm_disable_optional_support_deps() + +### java dependencies +RULES_JVM_EXTERNAL_TAG = "4.2" + +RULES_JVM_EXTERNAL_SHA = "cd1a77b7b02e8e008439ca76fd34f5b07aecb8c752961f9640dea15e9e5ba1ca" + +JUNIT_JUPITER_VERSION = "5.9.1" + +JUNIT_PLATFORM_VERSION = "1.9.1" + +junit_jupiter_java_repositories( + version = JUNIT_JUPITER_VERSION, +) + +junit_platform_java_repositories( + version = JUNIT_PLATFORM_VERSION, +) + +http_archive( + name = "rules_jvm_external", + sha256 = RULES_JVM_EXTERNAL_SHA, + strip_prefix = "rules_jvm_external-%s" % RULES_JVM_EXTERNAL_TAG, + url = "https://github.com/bazelbuild/rules_jvm_external/archive/%s.zip" % RULES_JVM_EXTERNAL_TAG, + patches = ["//external/rules_jvm_external:versions.bzl.patch"], +) + +load("@rules_jvm_external//:repositories.bzl", "rules_jvm_external_deps") + +rules_jvm_external_deps() + +load("@rules_jvm_external//:setup.bzl", "rules_jvm_external_setup") + +rules_jvm_external_setup() + +load("@rules_jvm_external//:defs.bzl", "maven_install") + +maven_install( + artifacts = [ + "info.picocli:picocli-codegen:4.6.1", + "org.apache.commons:commons-compress:1.21", + "org.apache.commons:commons-lang3:3.12.0", + "commons-io:commons-io:2.8.0", + "commons-lang:commons-lang:2.4", + "org.slf4j:slf4j-api:1.7.21", + "org.slf4j:slf4j-log4j12:1.7.21", + "org.projectlombok:lombok:1.18.16", + "com.aliyun.oss:aliyun-sdk-oss:3.10.2", + "com.alibaba:fastjson:1.2.72_noneautotype", + "com.contrastsecurity:java-sarif:2.0", + "com.fasterxml.jackson.core:jackson-core:2.13.4", + "com.fasterxml.jackson.core:jackson-databind:2.13.4", + "com.fasterxml.jackson.core:jackson-annotations:2.13.4", + "org.powermock:powermock-module-junit4:2.0.9", + "org.powermock:powermock-api-mockito2:2.0.9", + "org.mybatis:mybatis:3.5.7", + "org.mybatis.dynamic-sql:mybatis-dynamic-sql:1.3.0", + "org.mybatis.generator:mybatis-generator-core:1.4.0", + "javax.annotation:javax.annotation-api:1.3.2", + "commons-codec:commons-codec:1.15", + "com.ibm.icu:icu4j:59.1", + "me.tongfei:progressbar:0.9.2", + "org.jetbrains:annotations:22.0.0", + "org.jetbrains.kotlin:kotlin-compiler-embeddable:1.5.21", + "org.jetbrains.kotlin:kotlin-reflect:1.5.21", + "org.jetbrains.kotlin:kotlin-script-runtime:1.5.21", + "org.jetbrains.kotlin:kotlin-stdlib:1.5.21", + "uk.com.robust-it:cloning:1.9.12", + "com.google.code.gson:gson:2.8.9", + "com.google.guava:guava:30.1.1-jre", + "org.hamcrest:hamcrest-all:1.3", + "com.google.re2j:re2j:1.6", + "net.java.dev.jna:jna:4.1.0", + "org.xerial:sqlite-jdbc:3.41.2.2", + "tk.mybatis:mapper:4.1.5", + "org.apache.logging.log4j:log4j-core:2.17.1", + "org.apache.logging.log4j:log4j-api:2.17.1", + "org.apache.logging.log4j:log4j-slf4j-impl:2.17.1", + "stax:stax-api:1.0.1", + "javax.persistence:javax.persistence-api:2.2", + "org.codehaus.woodstox:stax2-api:4.2.1", + "commons-collections:commons-collections:3.2.2", + "com.aliyun.oss:aliyun-sdk-oss:3.10.2", + "org.ini4j:ini4j:0.5.4", + "org.benf:cfr:0.151", + "org.jd:jd-core:1.1.3", + "com.alibaba:druid:1.2.12", + "net.java.dev.msv:msv-core:2013.6.1", + "net.java.dev.msv:xsdlib:2013.6.1", + "relaxngDatatype:relaxngDatatype:20020414", + "org.osgi:osgi.core:5.0.0", + "biz.aQute.bnd:biz.aQute.bnd.annotation:6.3.1", + "org.codehaus.jettison:jettison:1.5.4", + + ], + repositories = [ + # Private repositories are supported through HTTP Basic auth + "http://mvn.dev.alipay.net/artifactory/content/groups/public/", + "http://mvn.test.alipay.net/artifactory/content/groups/public", + "https://maven.aliyun.com/repository/public", + "https://repo1.maven.org/maven2", + ], +) + +### js dependencies +http_archive( + name = "build_bazel_rules_nodejs", + sha256 = "ee3280a7f58aa5c1caa45cb9e08cbb8f4d74300848c508374daf37314d5390d6", + urls = [ + "https://antsys-sparrow-data.cn-shanghai-alipay-office.oss-alipay.aliyuncs.com/sparrow/public/tools/rules_nodejs-5.5.1.tar.gz", + "https://github.com/bazelbuild/rules_nodejs/releases/download/5.5.1/rules_nodejs-5.5.1.tar.gz", + ], +) + +load("@build_bazel_rules_nodejs//:repositories.bzl", "build_bazel_rules_nodejs_dependencies") + +build_bazel_rules_nodejs_dependencies() + +# fetches nodejs and yarn +load("@build_bazel_rules_nodejs//:index.bzl", "node_repositories", "npm_install", "yarn_install") + +node_repositories( + node_urls = [ + "https://antsys-sparrow-data.cn-shanghai-alipay-office.oss-alipay.aliyuncs.com/sparrow/public/tools/node/v{version}/{filename}", + "https://nodejs.org/dist/v{version}/{filename}", + ], + node_version = "16.14.2", + yarn_releases = { + "1.22.11": ("yarn-v1.22.11.tar.gz", "yarn-v1.22.11", "2c320de14a6014f62d29c34fec78fdbb0bc71c9ccba48ed0668de452c1f5fe6c"), + }, + # yarn repository info + yarn_repository_name = "yarn", + yarn_urls = [ + "https://antsys-sparrow-data.cn-shanghai-alipay-office.oss-alipay.aliyuncs.com/sparrow/public/tools/yarn/v{version}/{filename}", + "https://github.com/yarnpkg/yarn/releases/download/v{version}/{filename}", + ], + yarn_version = "1.22.11", +) + +yarn_install( + name = "npm", + package_json = "//language/javascript/extractor:package.json", + symlink_node_modules = True, + use_global_yarn_cache = False, + yarn_lock = "//language/javascript/extractor:yarn.lock", +) + +http_archive( + name = "pkg_cache", + build_file = "//:tool/build_rule/pkg_cache.BUILD", + sha256 = "ee392cf2bfe0d0a5a493e073651fb70b03503dfe98e347ed61b91e9ef9ada122", + url = "https://antsys-sparrow-data.cn-shanghai-alipay-office.oss-alipay.aliyuncs.com/sparrow/public/tools/pkg-cache.tar.gz", +) + +http_archive( + name = "osx_godel_0.3", + build_file = "godel.BUILD", + sha256 = "1e7e0151f1acd1656f4079b7b16dfa4e5da607a1239149a88e9df3b543b23c30", + urls = [ + "https://antsys-sparrow-data.cn-shanghai-alipay-office.oss-alipay.aliyuncs.com/sparrow/public/osx-godel/godel-multipleinput-20221115.tar.gz", + "https://github.com/codefuse-ai/CodeFuse-Query/releases/download/godel_0.3_artifacts/godel-0.3.osx.multipleinput-20221115.tar.gz", + ], +) + +http_archive( + name = "linux_godel_0.3", + build_file = "godel.BUILD", + sha256 = "4dbc04677b9c785a00c127228368919ba6cee2a1f160e83e497d44fb4820dcd3", + urls = [ + "https://antsys-sparrow-data.cn-shanghai-alipay-office.oss-alipay.aliyuncs.com/sparrow/public/linux-godel/godel-multipleinput-20221115.tar.gz", + "https://github.com/codefuse-ai/CodeFuse-Query/releases/download/godel_0.3_artifacts/godel-0.3.linux.multipleinput-20221115.tar.gz", + ], +) + +http_archive( + name = "osx_godel_script", + build_file = "godel.BUILD", + sha256 = "4c4189320523ca63d9fb50e37aa0bcbd452109011a8d669d878b91492168e4e0", + urls = [ + "https://antsys-sparrow-data.cn-shanghai-alipay-office.oss-alipay.aliyuncs.com/sparrow/public/godel-script/osx/godel-script-osx-2ac5184520240812.tar.gz", + "https://github.com/codefuse-ai/CodeFuse-Query/releases/download/godel_0.3_artifacts/godel-script-osx-2ac5184520240812.tar.gz", + ], +) + +http_archive( + name = "linux_godel_script", + build_file = "godel.BUILD", + sha256 = "ac7c0d62b02cb3d7c673dac0c69079e347f727232a56053402ebbab655fd5649", + urls = [ + "https://antsys-sparrow-data.cn-shanghai-alipay-office.oss-alipay.aliyuncs.com/sparrow/public/godel-script/linux/godel-script-linux-2ac5184520240812.tar.gz", + "https://github.com/codefuse-ai/CodeFuse-Query/releases/download/godel_0.3_artifacts/godel-script-linux-2ac5184520240812.tar.gz", + ], +) + +# Setting up for bazel go dependency +http_archive( + name = "io_bazel_rules_go", + sha256 = "2b1641428dff9018f9e85c0384f03ec6c10660d935b750e3fa1492a281a53b0f", + urls = [ + "http://antsys-sparrow-data.cn-shanghai-alipay-office.oss-alipay.aliyuncs.com/sparrow/public/tools/rules_go-v0.29.0.zip", + "https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.29.0/rules_go-v0.29.0.zip", + "https://github.com/bazelbuild/rules_go/releases/download/v0.29.0/rules_go-v0.29.0.zip", + ], +) + +http_archive( + name = "bazel_gazelle", + sha256 = "62ca106be173579c0a167deb23358fdfe71ffa1e4cfdddf5582af26520f1c66f", + urls = [ + "http://antsys-sparrow-data.cn-shanghai-alipay-office.oss-alipay.aliyuncs.com/sparrow/public/tools/bazel-gazelle-v0.23.0.tar.gz", + "https://mirror.bazel.build/github.com/bazelbuild/bazel-gazelle/releases/download/v0.23.0/bazel-gazelle-v0.23.0.tar.gz", + "https://github.com/bazelbuild/bazel-gazelle/releases/download/v0.23.0/bazel-gazelle-v0.23.0.tar.gz", + ], +) + +load("@io_bazel_rules_go//go:deps.bzl", "go_download_sdk", "go_register_toolchains", "go_rules_dependencies") +load("@bazel_gazelle//:deps.bzl", "gazelle_dependencies") +load("//:deps.bzl", "go_dependencies") + +# gazelle:repository_macro deps.bzl%go_dependencies +go_dependencies() + +go_rules_dependencies() + +# fetch golang package from oss with first priority. +go_download_sdk( + name = "go_sdk", + sdks = { + # Avoid the dependency on the index file for the SHA-256 checksums. + # Filenames and checksums from https://go.dev/dl/ + "linux_amd64": ("go1.18.3.linux-amd64.tar.gz", "956f8507b302ab0bb747613695cdae10af99bbd39a90cae522b7c0302cc27245"), + "darwin_amd64": ("go1.18.3.darwin-amd64.tar.gz", "d9dcf8fc35da54c6f259be41954783a9f4984945a855d03a003a7fd6ea4c5ca1"), + "darwin_arm64": ("go1.18.3.darwin-arm64.tar.gz", "40ecd383c941cc9f0682e6a6f2a333539d58c7dea15c842434d03afafe2f7242"), + }, + urls = [ + "http://antsys-sparrow-data.cn-shanghai-alipay-office.oss-alipay.aliyuncs.com/sparrow/public/tools/golang/{}", + "https://dl.google.com/go/{}", + ], + version = "1.18.3", +) + +go_register_toolchains() + +# If you use WORKSPACE.bazel, use the following line instead of the bare gazelle_dependencies(): +# gazelle_dependencies(go_repository_default_config = "@//:WORKSPACE.bazel") +gazelle_dependencies() + +http_archive( + name = "com_google_protobuf", + sha256 = "3bd7828aa5af4b13b99c191e8b1e884ebfa9ad371b0ce264605d347f135d2568", + strip_prefix = "protobuf-3.19.4", + urls = [ + "http://antsys-sparrow-data.cn-shanghai-alipay-office.oss-alipay.aliyuncs.com/sparrow/public/tools/protobuf-3.19.4.tar.gz", + "https://github.com/protocolbuffers/protobuf/archive/v3.19.4.tar.gz", + ], +) + +load("@com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps") + +protobuf_deps() + +http_archive( + name = "com_github_bazelbuild_buildtools", + sha256 = "ae34c344514e08c23e90da0e2d6cb700fcd28e80c02e23e4d5715dddcb42f7b3", + strip_prefix = "buildtools-4.2.2", + urls = [ + "http://antsys-sparrow-data.cn-shanghai-alipay-office.oss-alipay.aliyuncs.com/sparrow/public/tools/buildtools-4.2.2.tar.gz", + "https://github.com/bazelbuild/buildtools/archive/refs/tags/4.2.2.tar.gz", + ], +) + +http_archive( + name = "rules_python", + sha256 = "a3a6e99f497be089f81ec082882e40246bfd435f52f4e82f37e89449b04573f6", + strip_prefix = "rules_python-0.10.2", + urls = [ + "https://antsys-sparrow-data.cn-shanghai-alipay-office.oss-alipay.aliyuncs.com/sparrow/public/tools/rules_python-0.10.2.tar.gz", + "https://github.com/bazelbuild/rules_python/archive/refs/tags/0.10.2.tar.gz", + ], + patches = ["//external/rules_python:repositories.bzl.patch"], +) + +load("@rules_python//python:repositories.bzl", "python_register_toolchains") + +python_register_toolchains( + name = "python3_10", + base_url = "https://antsys-sparrow-data.cn-shanghai-alipay-office.oss-alipay.aliyuncs.com/sparrow/public/tools/python/cpython", + # Available versions are listed in @rules_python//python:versions.bzl. + # We recommend using the same version your team is already standardized on. + python_version = "3.10.4", + tool_versions = { + "3.10.4": { + "url": "20220502/cpython-{python_version}%2B20220502-{platform}-{build}.tar.gz", + "sha256": { + "aarch64-apple-darwin": "2c99983d1e83e4b6e7411ed9334019f193fba626344a50c36fba6c25d4de78a2", + "aarch64-unknown-linux-gnu": "d8098c0c54546637e7516f93b13403b11f9db285def8d7abd825c31407a13d7e", + "x86_64-apple-darwin": "f2711eaffff3477826a401d09a013c6802f11c04c63ab3686aa72664f1216a05", + "x86_64-pc-windows-msvc": "bee24a3a5c83325215521d261d73a5207ab7060ef3481f76f69b4366744eb81d", + "x86_64-unknown-linux-gnu": "f6f871e53a7b1469c13f9bd7920ad98c4589e549acad8e5a1e14760fff3dd5c9", + }, + "strip_prefix": "python", + }, + }, +) + +load("@python3_10//:defs.bzl", "interpreter") +load("@rules_python//python:pip.bzl", "pip_install") + +# Create a central external repo, @deps, that contains Bazel targets for all the +# third-party packages specified in the requirements.txt file. +pip_install( + name = "deps", + python_interpreter_target = interpreter, + requirements = "//language/python/extractor:requirements.txt", +) + +pip_install( + name = "cli-deps", + python_interpreter_target = interpreter, + requirements = "//cli:requirements.txt", +) + +RULES_PKG_VERSION = "0.7.0" + +http_archive( + name = "rules_pkg", + sha256 = "8a298e832762eda1830597d64fe7db58178aa84cd5926d76d5b744d6558941c2", + urls = [ + "https://mirror.bazel.build/github.com/bazelbuild/rules_pkg/releases/download/%s/rules_pkg-%s.tar.gz" % (RULES_PKG_VERSION, RULES_PKG_VERSION), + "https://github.com/bazelbuild/rules_pkg/releases/download/%s/rules_pkg-%s.tar.gz" % (RULES_PKG_VERSION, RULES_PKG_VERSION), + ], +) + +load("@rules_pkg//:deps.bzl", "rules_pkg_dependencies") + +rules_pkg_dependencies() + +http_archive( + name = "aspect_bazel_lib", + sha256 = "0154b46f350c7941919eaa30a4f2284a0128ac13c706901a5c768a829af49e11", + strip_prefix = "bazel-lib-1.13.0", + url = "https://github.com/aspect-build/bazel-lib/archive/refs/tags/v1.13.0.tar.gz", +) + +load("@aspect_bazel_lib//lib:repositories.bzl", "aspect_bazel_lib_dependencies") + +aspect_bazel_lib_dependencies() + +# ### Swift dependencies +# # Introduce Swift Package Manager Rules for Bazel +# http_archive( +# name = "cgrindel_rules_spm", +# sha256 = "03718eb865a100ba4449ebcbca6d97bf6ea78fa17346ce6d55532312e8bf9aa8", +# strip_prefix = "rules_spm-0.11.0", +# urls = [ +# "https://antsys-sparrow-data.cn-shanghai-alipay-office.oss-alipay.aliyuncs.com/sparrow/public/tools/swift/v0.11.0.tar.gz", +# "http://github.com/cgrindel/rules_spm/archive/v0.11.0.tar.gz", +# ], +# ) + +# load( +# "@cgrindel_rules_spm//spm:deps.bzl", +# "spm_rules_dependencies", +# ) + +# spm_rules_dependencies() + +# load("@cgrindel_rules_spm//spm:defs.bzl", "spm_pkg", "spm_repositories") + +# spm_repositories( +# name = "swift_pkgs_darwin", +# dependencies = [ +# spm_pkg( +# "https://oauth:a12681eba8d14255a49a74cd1c2d5f8d@code.alipay.com/codeinsight_thirdparty/swift-argument-parser.git", +# from_version = "1.1.1", +# products = ["ArgumentParser"], +# ), +# spm_pkg( +# "https://oauth:d7ece9eda5bb4b438b3f5797321a5d2c@code.alipay.com/codeinsight_thirdparty/swift-log.git", +# from_version = "1.4.4", +# products = ["Logging"], +# ), +# spm_pkg( +# "https://oauth:07e4fc6a7ce14b41a4f71561208ca118@code.alipay.com/codeinsight_thirdparty/SQLite.swift.git", +# from_version = "0.13.3", +# products = ["SQLite"], +# ), +# ], +# ) + +# spm_repositories( +# name = "swift_pkgs_linux", +# dependencies = [ +# spm_pkg( +# "https://oauth:a12681eba8d14255a49a74cd1c2d5f8d@code.alipay.com/codeinsight_thirdparty/swift-argument-parser.git", +# from_version = "1.1.1", +# products = ["ArgumentParser"], +# ), +# spm_pkg( +# "https://oauth:d7ece9eda5bb4b438b3f5797321a5d2c@code.alipay.com/codeinsight_thirdparty/swift-log.git", +# from_version = "1.4.4", +# products = ["Logging"], +# ), +# # On Linux, this package relies on SQLite3 and it search for its system library /usr/include/sqlite3.h +# # which is outdated on CentOS, therefore causing linking failure. +# # So I fork this project and make my own patch to make it totally compiled from SQLite3 C source code +# spm_pkg( +# "https://oauth:07e4fc6a7ce14b41a4f71561208ca118@code.alipay.com/codeinsight_thirdparty/SQLite.swift.git", +# products = ["SQLite"], +# # Commit for 0.13.3-patch +# revision = "821d4cff02dfd9c0ac426bb3e4d67e40fef6c882", +# ), +# spm_pkg( +# name = "SwiftSyntax", +# exact_version = "0.50500.0", +# products = ["SwiftSyntax"], +# url = "https://oauth:e23f9a1ec4c94580a41d7fd761e7f172@code.alipay.com/codeinsight_thirdparty/swift-syntax.git", +# ), +# ], +# ) + +# # Introduce Apple Rules for Bazel depended by the rule @com_github_keith_swift_syntax +# http_archive( +# name = "build_bazel_rules_apple", +# sha256 = "90e3b5e8ff942be134e64a83499974203ea64797fd620eddeb71b3a8e1bff681", +# urls = [ +# "https://antsys-sparrow-data.cn-shanghai-alipay-office.oss-alipay.aliyuncs.com/sparrow/public/tools/swift/rules_apple.1.1.2.tar.gz", +# "https://github.com/bazelbuild/rules_apple/releases/download/1.1.2/rules_apple.1.1.2.tar.gz", +# ], +# ) + +# load( +# "@build_bazel_rules_apple//apple:repositories.bzl", +# "apple_rules_dependencies", +# ) + +# apple_rules_dependencies() + +# load( +# "@build_bazel_rules_swift//swift:repositories.bzl", +# "swift_rules_dependencies", +# ) + +# swift_rules_dependencies() + +# load( +# "@build_bazel_rules_swift//swift:extras.bzl", +# "swift_rules_extra_dependencies", +# ) + +# swift_rules_extra_dependencies() + +# load( +# "@build_bazel_apple_support//lib:repositories.bzl", +# "apple_support_dependencies", +# ) + +# apple_support_dependencies() + +# # This repo provides a bazel target for SwiftSyntax. Most importantly it handles vendoring lib_InternalSwiftSyntaxParser +# # as a static library so your tool doesn't depend on a specific Xcode.app path or version. +# # This release switched to using an actual static version of the framework produced here https://github.com/keith/StaticInternalSwiftSyntaxParser/releases/tag/5.5.2 +# # instead of managing a dylib. +# http_archive( +# name = "com_github_keith_swift_syntax_bazel", +# patch_args = ["-p1"], +# # Apply patch to make the rule to download StaticInternalSwiftSyntaxParser stored in OSS +# patches = ["//language/swift/extractor:bazel/swift-syntax-bazel.patch"], +# sha256 = "c05d0c21ccb4beb62428e49187a4bf2c3c8f2e0d46d53324180aff7cadf80be6", +# strip_prefix = "swift-syntax-bazel-13.2.1.13C100", +# urls = [ +# "https://antsys-sparrow-data.cn-shanghai-alipay-office.oss-alipay.aliyuncs.com/sparrow/public/tools/swift/13.2.1.13C100.tar.gz", +# "https://github.com/keith/swift-syntax-bazel/archive/refs/tags/13.2.1.13C100.tar.gz", +# ], +# ) + +# load("@com_github_keith_swift_syntax_bazel//:deps.bzl", "swift_syntax_deps") + +# swift_syntax_deps() + +# # Linux only. Download the prebuilt shared library to make the swift extractor executable self-contained +# # macOS don't need this thanks to the rule @com_github_keith_swift_syntax +# http_archive( +# name = "linux_lib_InternalSwiftSyntaxParser", +# build_file = "//:language/swift/extractor/bazel/lib_InternalSwiftSyntaxParser.BUILD", +# sha256 = "d4292d9b898a9d264c3e8ea58c83074a63d0c8d84602f4a85b9dbb1b4dcd52ad", +# urls = ["https://antsys-sparrow-data.cn-shanghai-alipay-office.oss-alipay.aliyuncs.com/sparrow/public/tools/swift/lib_InternalSwiftSyntaxParser/5.5.3-alios7/lib_InternalSwiftSyntaxParser.zip"], +# ) + + +# third_party_typescript 4.9.5-raw Release +# Replace with the third_party_typescript commit you want to use. +third_party_typescript_commit = "5bef9c4ec07035be8167d8190f6df47275b81058" +third_party_typescript_SHA256 = "e703a2ccb546e7fa78f0a0681cbc9569991b807247ff903bf6f0fe5304ec0fe9" + +http_archive( + name = "ohos_typescript_src", + sha256 = third_party_typescript_SHA256, + strip_prefix = "third_party_typescript-" + third_party_typescript_commit, + build_file = "//:external/rules_ohos_typescript/ohos_typescript.BUILD", + urls = [ + "https://gitee.com/openharmony/third_party_typescript/repository/archive/{commit}.zip".format(commit = third_party_typescript_commit), + "https://antsys-sparrow-data.cn-shanghai-alipay-office.oss-alipay.aliyuncs.com/sparrow/public/tools/ohos-typescript/third_party_typescript-{commit}.zip".format(commit = third_party_typescript_commit), + ], +) diff --git a/cli/BUILD.bazel b/cli/BUILD.bazel new file mode 100644 index 00000000..1eb9ad1e --- /dev/null +++ b/cli/BUILD.bazel @@ -0,0 +1,38 @@ +filegroup( + name = "source-code", + srcs = glob(["**/*.py"]), +) + +filegroup( + name = "requirements", + srcs = ["requirements.txt"], +) + +filegroup( + name = "pyinstaller-spec-file", + srcs = ["sparrow-cli.spec"], +) + +genrule( + name = "pyinstaller-sparrow-cli", + srcs = [ + ":source-code", + ":requirements", + ":pyinstaller-spec-file", + ], + outs = [ + "_internal", + "sparrow-cli", + ], + cmd = """ + chmod -R 755 $$(dirname $(PYTHON3))/../lib/python3.10/site-packages + $(PYTHON3) -m pip install -r cli/requirements.txt + $(PYTHON3) -m PyInstaller ./cli/sparrow-cli.spec --distpath $(RULEDIR) --workpath ./pyinstaller-build -y --clean + mv $(RULEDIR)/cli/* $(RULEDIR)/ + rmdir $(RULEDIR)/cli + """, + toolchains = ["@rules_python//python:current_py_toolchain"], + visibility = ["//visibility:public"], +) + +exports_files(["sparrow"]) diff --git a/cli/database/create.py b/cli/database/create.py index 30589ec0..cbc3e3d4 100644 --- a/cli/database/create.py +++ b/cli/database/create.py @@ -34,6 +34,9 @@ def memory_statistics(): # 获取总内存大小(以字节为单位) total_memory = memory.total + pod_memory_limit = get_pod_memory_limit() + if pod_memory_limit != 0: + total_memory = pod_memory_limit # 格式化内存大小 size_units = ["B", "KB", "MB", "GB", "TB"] @@ -45,17 +48,65 @@ def memory_statistics(): logging.info(f"final -Xmx is : {max(total_memory - 1, 6):.2f} {size_units[unit_index]}") +def is_valid_regex(pattern): + try: + re.compile(pattern) + return True + except re.error: + return False + + def conf_option_deal(args): options = dict() if args.extraction_config_file: try: with open(args.extraction_config_file, "r") as f: - options = json.load(f) + extract_options = json.load(f) + for conf in extract_options: + language = conf["extractor"] + # all 先不处理 + if language == "all": + continue + if language not in args.language: + logging.error("%s language will not be extracted and the configuration is invalid", language) + continue + for option in conf["extractor_options"]: + if "name" not in option: + logging.error("option language error: please check name not in this conf : %s", + json.dumps(option)) + return -1 + key = option["name"] + if "value" not in option: + logging.error("option value error: value not in this conf : %s", json.dumps(option)) + return -1 + if "config" not in option["value"]: + logging.error("option config error:config not in this conf[\"value\"]: %s", + json.dumps(option)) + return -1 + value = option["value"]["config"] + if "pattern" in option["value"]: + pattern = option["value"]["pattern"] + if is_valid_regex(pattern): + if re.search(pattern, value): + logging.warning("option pattern error: this conf will be ignore: %s", + json.dumps(option)) + continue + else: + logging.warning("option pattern error: this conf will be ignore: %s", + json.dumps(option)) + continue + if language not in options: + options[language] = dict() + if key in options[language]: + logging.error("in %s extract, %s redefine", language, key) + return -1 + options[language][key] = value except Exception as e: logging.error(e) return -1 for language in args.language: - options[language] = dict() + if language not in options: + options[language] = dict() if args.extraction_config: # 要求option必须是a.b=c的形式,a为语言名,若不是报错 pattern = r'^(.+)\.(.+)\=(.+)$' @@ -69,6 +120,9 @@ def conf_option_deal(args): if language not in args.language: logging.error("option language error: %s does not need to be extracted", language) return -1 + if key in options[language]: + logging.error("in %s extract, %s redefine", language, key) + return -1 options[language][key] = value else: logging.error("option format error: %s, it need like java.a=b", tmp) @@ -84,7 +138,6 @@ def database_create(args): if options == -1: logging.error("configuration error, Please check conf") raise ValueError("configuration error") - memory_statistics() timeout = args.timeout extractor_fail = list() for language in args.language: diff --git a/cli/extractor/extractor.py b/cli/extractor/extractor.py index 205efe6e..ff67e26f 100644 --- a/cli/extractor/extractor.py +++ b/cli/extractor/extractor.py @@ -1,7 +1,7 @@ import logging import psutil - +import shlex from run.runner import Runner from sparrow_schema.schema import sparrow @@ -17,6 +17,7 @@ class Extractor: sql_extractor = "" swift_extractor = "" xml_extractor = "" + arkts_extractor = "" def __init__(self): Extractor.cfamily_extractor = sparrow.home / "language" / "cfamily" / "extractor" / "usr" / "bin" / "coref-cfamily-src-extractor" @@ -28,6 +29,7 @@ def __init__(self): Extractor.sql_extractor = sparrow.home / "language" / "sql" / "extractor" / "coref-sql-src-extractor_deploy.jar" Extractor.swift_extractor = sparrow.home / "language" / "swift" / "extractor" / "usr" / "bin" / "coref-swift-src-extractor" Extractor.xml_extractor = sparrow.home / "language" / "xml" / "extractor" / "coref-xml-extractor_deploy.jar" + Extractor.arkts_extractor = sparrow.home / "language" / "arkts" / "extractor" / "coref-arkts-src-extractor" def cfamily_extractor_cmd(source_root, database, options): @@ -58,15 +60,19 @@ def go_extractor_cmd(source_root, database, options): def java_extractor_cmd(source_root, database, options): cmd = list() - cmd += jar_extractor_cmd(Extractor.java_extractor, source_root, database) + cmd += jar_extractor_cmd(Extractor.java_extractor, source_root, database, options) if options: + if "white-list" in options and "whiteList" in options: + logging.error("white-list and whiteList cannot be configured at the same time") + return -1 + if "cp" in options and "classpath" in options: + logging.error("cp and classpath cannot be configured at the same time") + return -1 for (key, value) in options.items(): if key == "white-list" or key == "whiteList": - cmd += ["-w=", value] - elif key == "cp": - cmd += ["-cp=", value] - elif key == "classpath": - cmd += ["--classpath=", value] + cmd += ["-w=" + value] + elif key == "cp" or key == "classpath": + cmd += ["-cp=" + value] elif key == "incremental": if value == "true": cmd += ["--incremental"] @@ -80,8 +86,9 @@ def java_extractor_cmd(source_root, database, options): logging.warning("java.incremental does not take effect, please use java.incremental=true") else: if key != "cache-dir" and key != "commit" and key != "remote-cache-type" and \ - key != "oss-bucket" and key != "oss-config-file" and key != "oss-path-prefix": - logging.warning("unsupported config name:%s for java extractor.", key) + key != "oss-bucket" and key != "oss-config-file" and key != "oss-path-prefix" and \ + key != "jvm_opts": + logging.warning("unsupported config name: %s for java extractor.", key) if "incremental" not in options or options["incremental"] != "true": cmd += ["--parallel"] return cmd @@ -124,7 +131,7 @@ def javascript_extractor_cmd(source_root, database, options): def properties_extractor_cmd(source_root, database, options): - cmd = jar_extractor_cmd(Extractor.properties_extractor, source_root, database) + cmd = jar_extractor_cmd(Extractor.properties_extractor, source_root, database, options) return cmd @@ -136,13 +143,13 @@ def python_extractor_cmd(source_root, database, options): def sql_extractor_cmd(source_root, database, options): cmd = list() - cmd += jar_extractor_cmd(Extractor.sql_extractor, source_root, database) + cmd += jar_extractor_cmd(Extractor.sql_extractor, source_root, database, options) if "sql-dialect-type" in options: cmd += ["--sql-dialect-type", options["sql-dialect-type"]] return cmd -def swift_extractor(source_root, database, options): +def swift_extractor_cmd(source_root, database, options): cmd = list() cmd += [str(Extractor.swift_extractor), str(source_root), str(database)] if options: @@ -156,20 +163,59 @@ def swift_extractor(source_root, database, options): def xml_extractor_cmd(source_root, database, options): - cmd = jar_extractor_cmd(Extractor.xml_extractor, source_root, database) + cmd = jar_extractor_cmd(Extractor.xml_extractor, source_root, database, options) return cmd -def jar_extractor_cmd(extractor_path, source_root, database): - # 获取内存信息 - mem = psutil.virtual_memory() - total_memory = mem.total - total_memory_gb = round(total_memory / (1024 ** 3)) - logging.info("current memory is : %s GB", total_memory_gb) - xmx = max(total_memory_gb - 1, 6) - logging.info("final -Xmx is: %s GB", xmx) +def arkts_extractor_cmd(source_root, database, options): + cmd = list() + cmd += [str(Extractor.arkts_extractor), "extract"] + \ + ["--extract-text", "-s", str(source_root)] + \ + ["-d", str(database / "coref_arkts_src.db")] + if options: + for (key, value) in options.items(): + if key == "blacklist" or key == "b": + cmd += ["--blacklist"] + value.split(",") + elif key == "use-gitignore": + cmd += ["--use-gitignore"] + elif key == "extract-text": + cmd += ["--extract-text"] + elif key == "extract-deps": + cmd += ["--extract-deps"] + elif key == "file-size-limit": + cmd += ["--file-size-limit", value] + elif key == "paths": + cmd += ["--paths", value] + else: + logging.warning("unsupported config name:%s for arkts extractor.", key) + return cmd + + +def jar_extractor_cmd(extractor_path, source_root, database, options): + jvm_opts = None + if options: + for (key, value) in options.items(): + if key == "jvm_opts": + # jvm_opts from user specified extract config + jvm_opts = value + + # if no jvm_opts from extract config, calculate xmx according to current memory. + if not jvm_opts: + mem = psutil.virtual_memory() + total_memory = mem.total + pod_memory_limit = get_pod_memory_limit() + if pod_memory_limit != 0: + total_memory = pod_memory_limit + total_memory_gb = round(total_memory / (1024 ** 3)) + total_memory_gb = min(total_memory_gb, 32) # limit to 32G + xmx = max(total_memory_gb - 1, 6) + logging.info("current memory is: %s GB, will use xmx: %s GB.", total_memory_gb, xmx) + jvm_opts = f"-Xmx{xmx}g" + + logging.info("extract jvm_opts is: %s .", jvm_opts) + cmd = list() - cmd += ["java", "-jar", "-Xmx" + str(xmx) + "g", str(extractor_path)] + cmd += ["java"] + shlex.split(jvm_opts) + ["-jar", str(extractor_path)] cmd += [str(source_root), str(database)] return cmd @@ -187,6 +233,22 @@ def extractor_run(language, source_root, database, timeout, options): tmp = Runner(cmd, timeout) return tmp.subrun() else: - logging.error("Not supported language: %s", language) + logging.error("Failed to obtain the %s extractor", language) return -1 +def get_pod_memory_limit(): + # cgroup 文件系统路径 + memory_limit_path = "/sys/fs/cgroup/memory/memory.limit_in_bytes" + memory_limit = 0 + try: + with open(memory_limit_path, 'r') as f: + memory_limit = int(f.read().strip()) + except FileNotFoundError: + pass + except PermissionError: + logging.error("Permission denied when accessing cgroup files.") + except IOError as e: + logging.error(f"IO error occurred when accessing cgroup files: {e}") + except Exception as e: + logging.error(f"An unexpected error occurred: {e}") + return memory_limit \ No newline at end of file diff --git a/cli/godel/godel_compiler.py b/cli/godel/godel_compiler.py index b8e853a4..78195db4 100644 --- a/cli/godel/godel_compiler.py +++ b/cli/godel/godel_compiler.py @@ -1,20 +1,25 @@ import logging -import tempfile -import time -from pathlib import Path +import re +import chardet from run.runner import Runner from sparrow_schema.schema import sparrow +def get_encoding(file_path): + with open(file_path, 'rb') as f: + result = chardet.detect(f.read()) + return result['encoding'] + + def godel_version_judge(path) -> str: # 判断脚本对应的godel编译器版本 - result = "script" + result = "0.3" try: - with open(path, "r") as f: + with open(path, "r", encoding=get_encoding(path)) as f: tmp = f.readline() - if "1.0" in tmp: - result = "1.0" + if re.match(r'//[ \t]*script', tmp): + result = "script" except Exception as e: logging.error(f"godel version judge error: {str(e)}") return result @@ -23,8 +28,8 @@ def godel_version_judge(path) -> str: def get_godel_compile(path): version = godel_version_judge(path) godel = "" - if version == "1.0": - godel = sparrow.godel_1_0 + if version == "0.3": + godel = sparrow.godel_0_3 elif version == "script": godel = sparrow.godel_script return godel @@ -35,7 +40,8 @@ def backend_execute(path, database, output, timeout, output_format, verbose): version = godel_version_judge(path) cmd = list() cmd += [str(godel), str(path), "--run-souffle-directly", "--package-path"] - cmd += [str(sparrow.lib_1_0)] + if version == "0.3": + cmd += [str(sparrow.lib_03)] if database is not None: cmd += ["--souffle-fact-dir", database] cmd += ["--souffle-output-format", output_format, "--souffle-output-path", output] @@ -45,23 +51,33 @@ def backend_execute(path, database, output, timeout, output_format, verbose): return tmp.subrun() +def precompiled(path, timeout): + cmd = [str(sparrow.godel_script), "-p", str(sparrow.lib_script), "--semantic-only", str(path)] + tmp = Runner(cmd, timeout) + status = tmp.subrun() + if status != 0: + return False + return True + + def execute(path, database, output, timeout, output_format, verbose): godel = get_godel_compile(path) version = godel_version_judge(path) cmd = list() if version == "script": - # godel-script两步编译,实际执行后端为1.0 - with tempfile.NamedTemporaryFile(suffix='.gdl') as temp_file: - cmd += [str(godel), str(path), "-p", str(sparrow.lib_1_0), "-o", temp_file.name] - if verbose: - cmd += ["--verbose"] - tmp = Runner(cmd, timeout) - start_time = time.time() - return_code = tmp.subrun() - if return_code != 0: - logging.error("%s compile error, please check it yourself", str(path)) - return -1 - logging.info("godel-script compile time: %.2fs", time.time() - start_time) - return backend_execute(Path(temp_file.name), database, output, timeout, output_format, verbose) + # godel-script 直接执行 + cmd += [str(godel), "-p", str(sparrow.lib_script), "-f", database] + cmd += ["-Of", "-r", str(path)] + if output_format == "sqlite": + cmd += ["--output-sqlite"] + elif output_format == "csv": + cmd += ["--output-csv"] + else: + cmd += ["--output-json"] + cmd += [output] + if verbose: + cmd += ["--verbose"] + tmp = Runner(cmd, timeout) + return tmp.subrun() else: return backend_execute(path, database, output, timeout, output_format, verbose) diff --git a/cli/package/__init__.py b/cli/package/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/cli/package/compile_and_run.py b/cli/package/compile_and_run.py new file mode 100644 index 00000000..0b2a770b --- /dev/null +++ b/cli/package/compile_and_run.py @@ -0,0 +1,134 @@ +import os +import subprocess + +from query.run import get_files +from sparrow_schema.schema import * + + +def compile_query_and_get_reference(compiler, library_directory, query, output_directory): + logging.info("Compile " + str(query) + " to " + output_directory + "/out.gdl") + arg = [ + compiler, "-p", library_directory, + str(query), "-u", "-o", output_directory + "/out.gdl" + ] + result = subprocess.run(arg, stdout=subprocess.PIPE) + + if result.returncode != 0: + logging.error("Compile " + str(query) + " failed") + return + + reference = result.stdout.decode() + reference = reference.split("\n") + reference.pop() + return reference + + +def create_compiled_library_directory(directory_path) -> bool: + if not os.path.exists(directory_path): + os.mkdir(directory_path) + return True + if not os.path.isdir(directory_path): + logging.error("\"" + directory_path + "\" is not a directory, failed to create") + return False + return True + + +def compile_referenced_library_files(compiler_path, library_directory, reference_list, output_directory): + compile_fail_count = 0 + for reference in reference_list: + # module name is the first word of the line + module_name = reference[:reference.find(" ")] + # library file path is after the space + library_file_path = reference[reference.find(" ") + 1:] + # output path is the module name with "::" replaced by "." + output_path = output_directory + "/lib/" + output_path += module_name.replace("::", ".") + ".gdl" + # compile the library file to the output path + result = subprocess.run([ + compiler_path, "-p", library_directory, library_file_path, "-o", output_path + ]) + # check if compilation failed + if result.returncode != 0: + compile_fail_count += 1 + logging.error("Failed to compile " + output_path) + else: + logging.info("Compile " + library_file_path + " to " + output_path) + + if compile_fail_count != 0: + return False + return True + + +def compile_and_run(compiler_path, + library_path, + query_file, + executable_path, + database_path="", + verbose_mode=False): + output_directory = "out" + output_file = output_directory + "/" + query_file.stem + ".json" + logging.info("Start executing " + str(query_file)) + if not create_compiled_library_directory(output_directory): + return + if not create_compiled_library_directory(output_directory + "/lib"): + return + reference_list = compile_query_and_get_reference( + compiler_path, + library_path, + query_file, + output_directory + ) + if type(reference_list) != list: + return + if not compile_referenced_library_files( + compiler_path, + library_path, + reference_list, + output_directory + ): + return + args = [ + executable_path, + output_directory + "/out.gdl", + "--package-path", + output_directory + "/lib", + "--run-souffle-directly", + "--souffle-output-format", + "json", + "--souffle-output-path", + output_file + ] + if type(database_path) == str and len(database_path) > 0: + args.append("--souffle-fact-dir") + args.append(database_path) + if verbose_mode: + args.append("--verbose") + result = subprocess.run(args) + logging.info("Excution exited with code " + str(result.returncode) + ". Check result in " + output_file) + + +def package_run(args): + verbose_flag = args.verbose + database_path = args.database + godel_path_list = [] + for godel_dir in args.godel_dir: + godel_path_list += get_files(godel_dir, ".gdl") + godel_path_list += get_files(godel_dir, ".gs") + if not godel_path_list: + logging.error("There is no godel script(ends with .gs or .gdl) in the specified directory," + "Please redefine the directory or file by --gdl or -gdl") + raise ValueError("path lib error") + if not os.path.exists("./godel_modules"): + logging.error("Expect godel_modules directory here, " + "use package create --install to install packages into godel_modules") + return + for godel_path in godel_path_list: + compile_and_run( + sparrow.godel_script, + "./godel_modules", + godel_path, + sparrow.godel_1_0, + database_path, + verbose_flag + ) + return diff --git a/cli/package/create.py b/cli/package/create.py new file mode 100644 index 00000000..e917f139 --- /dev/null +++ b/cli/package/create.py @@ -0,0 +1,11 @@ +import package.manifest as manifest +import package.pack as pack +import package.compile_and_run as cr + +def package_create(args): + if args.manifest: + manifest.manifest_create() + elif args.pack: + pack.pack_to_zip() + elif args.install: + pack.unpack_from_zip(args.install) \ No newline at end of file diff --git a/cli/package/manifest.py b/cli/package/manifest.py new file mode 100644 index 00000000..161dc9fc --- /dev/null +++ b/cli/package/manifest.py @@ -0,0 +1,58 @@ +import json +import os +import logging +from sparrow_schema.schema import * + +# manifest.json format example: +# { +# "name": "package_name", +# "version": "package_version", +# "compiler-version": "godel_compiler_version", +# "workspace": [ +# "path/of/godel/file.gdl", +# "path/of/godel/file.gdl" +# ], +# "dependency": { +# "package_name": "version_number", +# "package_name": "version_number", +# } +# } + +def manifest_create(): + if os.path.exists("manifest.json"): + logging.error("manifest.json exists in this directory") + return + manifest = {} + manifest["name"] = "" + manifest["version"] = "0.0.1" + manifest["compiler-version"] = "" + manifest["workspace"] = [] + manifest["dependency"] = {} + json.dump(manifest, open("manifest.json", "w")) + logging.info("Successfully generate manifest.json") + +def manifest_read(): + if not os.path.exists("manifest.json"): + return + return json.load(open("manifest.json")) + +def manifest_check(manifest_object) -> bool: + if type(manifest_object) != dict: + logging.error("There is no manifest.json file in this directory") + return False + if not "name" in manifest_object: + logging.error("There is no name field in the manifest.json file") + return False + if not "version" in manifest_object: + logging.error("There is no version field in the manifest.json file") + return False + if not "compiler-version" in manifest_object: + logging.error("There is no compiler-version field in the manifest.json file") + return False + if not "workspace" in manifest_object: + logging.error("There is no workspace field in the manifest.json file") + return False + if not "dependency" in manifest_object: + logging.error("There is no dependency field in the manifest.json file") + return False + return True diff --git a/cli/package/pack.py b/cli/package/pack.py new file mode 100644 index 00000000..41df74d4 --- /dev/null +++ b/cli/package/pack.py @@ -0,0 +1,35 @@ +import zipfile +import package.manifest as manifest +import os +import logging +from pathlib import Path + +def pack_to_zip(): + project = manifest.manifest_read() + if not manifest.manifest_check(project): + return + if len(project["name"]) == 0: + logging.error("Failed to pack, project name is empty.") + return + zipfile_name = project["name"] + ".zip" + output = zipfile.ZipFile(zipfile_name, "w") + for file in project["workspace"]: + if os.path.isdir(file): + for root, dirs, files in os.walk(file): + for f in files: + logging.info("Pack " + os.path.join(root, f)) + output.write(os.path.join(root, f)) + elif os.path.isfile(file): + logging.info("Pack " + file) + output.write(file) + output.write("manifest.json") + output.close() + logging.info("Successfully generate " + zipfile_name) + +def unpack_from_zip(zip_path): + if not os.path.exists(zip_path): + logging.error("Cannot find zip file \"" + zip_path + "\"") + return + name = Path(zip_path).stem + logging.info("Extract " + zip_path + " to godel_modules/" + name) + zipfile.ZipFile(zip_path).extractall("godel_modules/" + name) \ No newline at end of file diff --git a/cli/query/run.py b/cli/query/run.py index 392cc321..6ec24e00 100644 --- a/cli/query/run.py +++ b/cli/query/run.py @@ -1,8 +1,16 @@ +import json import logging +import os.path +import re +import shutil +import sqlite3 +import tempfile import time from pathlib import Path -from godel.godel_compiler import execute +from run.runner import Runner +from sparrow_schema.schema import sparrow +from godel.godel_compiler import execute, precompiled def get_files(target_path, suffix) -> list: @@ -22,21 +30,50 @@ def get_files(target_path, suffix) -> list: # 结果是否为空判断 def check_is_empty_query_result(output_path, output_format): query_result = "EMPTY" - try: - with open(output_path, "r") as f: - content = f.read() - if output_format == "json": - if not content.startswith("[]"): - query_result = "NOT-EMPTY" - elif output_format == "csv": - if content is not None: - query_result = "NOT-EMPTY" - except FileNotFoundError: - logging.warning("%s not exist, Please check the script to see if there is output", output_path) - except PermissionError as pe: - logging.warning(f"can not open output file: {str(pe)}") - except Exception as e: - logging.warning(f"can not get output: {str(e)}") + if output_format == "sqlite": + query_result = "NOT-EMPTY" + # # 连接到 SQLite 数据库 + # conn = sqlite3.connect(output_path) + # cursor = conn.cursor() + # # 构建 SQL 查询语句 + # try: + # # 执行查询 + # query = "SELECT name FROM sqlite_master WHERE type='table'" + # cursor.execute(query) + # tables = cursor.fetchall() + # cursor.execute(query) + # for table_name in tables: + # query = f"SELECT COUNT(*) FROM \"{table_name}\"" + # cursor.execute(query) + # result = cursor.fetchone() + # row_count = result[0] if result else 0 + # + # # 返回是否为空的布尔值 + # if row_count != 0: + # query_result = "NOT-EMPTY" + # except sqlite3.Error as e: + # print(f"An error occurred: {e}") + # return False # 如果表不存在,也可以返回 False 或处理异常 + # finally: + # # 关闭连接 + # cursor.close() + # conn.close() + else: + try: + with open(output_path, "r") as f: + content = f.read() + if output_format == "json": + if not content.startswith("[]"): + query_result = "NOT-EMPTY" + elif output_format == "csv": + if content is not None: + query_result = "NOT-EMPTY" + except FileNotFoundError: + logging.warning("%s not exist, Please check the script to see if there is output", output_path) + except PermissionError as pe: + logging.warning(f"can not open output file: {str(pe)}") + except Exception as e: + logging.warning(f"can not get output: {str(e)}") return query_result @@ -49,9 +86,13 @@ def conf_check(args): return False output_path = Path(args.output).expanduser().resolve() if not output_path.exists(): - logging.error("conf error: output directory %s does not exist, " - "Please redefine the directory or file by --output or -o", str(output_path)) - return False + logging.warning("%s not exists, it will be created", str(output_path)) + try: + output_path.mkdir(parents=True) + logging.info("%s success build", str(output_path)) + except Exception as e: + logging.error("can not to create output directory %s: %s", str(output_path), e) + return False if not output_path.is_dir(): logging.error("conf error: output need to be dir," "Please redefine the directory by --output or -o") @@ -89,6 +130,336 @@ def conf_check(args): return True +def get_lines_from_file(file_name, start_line, end_line): + content = "" + with open(file_name, 'r') as file: + for line_num, line in enumerate(file, start=1): + if start_line <= line_num <= end_line: + content += line + elif line_num > end_line: + break + return content + + +def compare_strings_ignore_whitespace(str1, str2): + # 移除空格、制表符和换行符 + pattern = r'\s+' + str1_clean = re.sub(pattern, '', str1) + str2_clean = re.sub(pattern, '', str2) + + # 进行比较 + return str1_clean == str2_clean + + +# 多脚本合并执行 +def merge_execute(args, gdl_list, timeout): + start_time = time.time() + # 各个脚本预编译 + for gdl in gdl_list: + if not precompiled(gdl, timeout - (time.time() - start_time)): + raise ValueError("precompiled error, Please check the script to determine syntax correctness and whether " + "it is a godel-script script") + # 脚本合并, 头文件和输出合并,重名函数,重名类仅会保留一份,若类接口函数不一致也仅会保留一份。不一致部分去除 + func_name = dict() + schema = dict() + import_set = set() + output = set() + out_map = dict() + with tempfile.NamedTemporaryFile(suffix='.gdl', mode="w+") as merge_file: + merge_file.writelines("// script\n") + merge_file_content = "" + for gdl in gdl_list: + with open(str(gdl), "r") as f: + pattern = r'use coref::(\w+)::\*' + for line in f: + if re.search(pattern, line): + if line not in import_set: + import_set.add(line) + with tempfile.NamedTemporaryFile(suffix='.json', mode="w+") as tmp_loc: + cmd = [str(sparrow.godel_script), str(gdl), "-l", str(tmp_loc.name)] + tmp = Runner(cmd, timeout - (time.time() - start_time)) + status = tmp.subrun() + if status != 0: + raise ValueError(gdl + " loc get error") + with open(str(tmp_loc.name), "r") as f: + loc_data = json.load(f) + for tmp in loc_data["schema"]: + schema_name = tmp["name"] + content = get_lines_from_file(gdl, tmp["location"]["begin_line"], + tmp["location"]["end_line"]) + "\n" + if schema_name not in schema: + schema[schema_name] = content + merge_file_content += content + else: + if not compare_strings_ignore_whitespace(content, schema[schema_name]): + logging.error("%s schema have different behaviors, please modify each function with the " + "same name yourself.", schema_name) + raise ValueError("merge error: same schema") + for tmp in loc_data["funcs"]: + if tmp["name"] == "main": + output_pattern = r'output\((\w+)\(\)\)' + main_content = get_lines_from_file(gdl, tmp["location"]["begin_line"], + tmp["location"]["end_line"]) + # 在 main 中查找 output(...) + output_matches = re.findall(output_pattern, main_content) + out_map[str(gdl)] = output_matches + for out in output_matches: + if out not in output: + output.add(out) + continue + hash_name = tmp["name"] + "#" + tmp["schema"] + content = get_lines_from_file(gdl, tmp["location"]["begin_line"], tmp["location"]["end_line"]) + if hash_name not in func_name: + func_name[hash_name] = content + if tmp["schema"] != "": + content = "impl " + tmp["schema"] + " {\n" + content + "\n}\n" + merge_file_content += content + else: + if not compare_strings_ignore_whitespace(content, func_name[hash_name]): + logging.error("%s function have different behaviors, please modify each function with the " + "same name yourself.", tmp["name"]) + raise ValueError("merge error: same function") + # 头文件合并 + for tmp in import_set: + merge_file_content = tmp + "\n" + merge_file_content + # 输出合并 + merge_file_content += "\nfn main() {\n" + for tmp in output: + merge_file_content += " output(" + tmp + "())\n" + merge_file_content += "}\n" + merge_file.write(merge_file_content) + merge_file.seek(0) + # 执行 + with tempfile.NamedTemporaryFile(suffix='.json', mode="w+") as output_file: + output = str(output_file.name) + if args.database: + database = str(Path(args.database).expanduser().resolve()) + return_code = execute(merge_file.name, database, output, args.timeout - (time.time() - start_time), + args.format, args.verbose) + else: + return_code = execute(merge_file.name, None, output, args.timeout - (time.time() - start_time), + args.format, args.verbose) + if return_code == 0: + query_result = check_is_empty_query_result(output, args.format) + logging.info("Task %s is %s, result is %s, execution time is %.2fs.", + "merge", "success", query_result, time.time() - start_time) + else: + logging.error("Task %s is %s, result is %s, execution time is %.2fs.", + "merge", "fail", "null", time.time() - start_time) + logging.error("%s execute error, please check by log", str(merge_file)) + if return_code == 0: + logging.info("run success") + else: + logging.error("run fail, There are scripts that cannot be executed among the scripts that need to be " + "executed. Please locate them based on the logs.") + raise RuntimeError("run fail") + # 输出处理: 根据各个文件的output进行分割,若后续添加注解进行输出此步骤需要修改。 + output_json = json.load(output_file) + if isinstance(output_json, list): + # 说明此时单文件单输出,gdl_list中只有一个文件 + for gdl in gdl_list: + if len(out_map[str(gdl)]) != 0: + output = str(Path(args.output).expanduser().resolve() / (gdl.stem + "." + args.format)) + shutil.copy2(output_file.name, output) + else: + # 单文件多输出或者多文件多输出: + for gdl in gdl_list: + if len(out_map[str(gdl)]) != 0: + output = str(Path(args.output).expanduser().resolve() / (gdl.stem + "." + args.format)) + with open(output, "w") as f: + if len(out_map[str(gdl)]) == 1: + content = output_json[out_map[str(gdl)][0]] + else: + content = dict() + for tmp in out_map[str(gdl)]: + content[tmp] = output_json[tmp] + f.write(json.dumps(content, indent=4)) + + +def json_to_sarif(sarif_data, json_data): + rules_dict = dict() + for bug in json_data: + # ruleName + if "ruleName" in bug: + rule_id = bug.get("ruleName") + else: + return False + # filePath + if "filePath" in bug: + file_path = bug.get("filePath") + else: + return False + # startLine + if "startLine" in bug: + start_line = bug.get("startLine") + else: + return False + # ruleDescription + if "ruleDescription" in bug: + rule_description = bug.get("ruleDescription") + else: + return False + # bug message + if "message" in bug: + message = bug.get("message") + else: + message = rule_description + level = "error" + if "level" in bug: + level = bug.get("level").lower() + if rule_id not in rules_dict: + rule_index = len(rules_dict) + rules_dict[rule_id] = rule_index + res = { + "id": rule_id, + "name": rule_id, + "shortDescription": { + "text": rule_description + }, + "fullDescription": { + "text": rule_description + }, + "defaultConfiguration": { + "level": level + } + } + sarif_data["runs"][0]["tool"]["driver"]["rules"].append(res) + else: + rule_index = rules_dict[rule_id] + thread_flow_locations = [] + thread_flow_locations.append({ + "location": { + "physicalLocation": { + "artifactLocation": { + "uri": file_path + }, + "region": { + "startLine": start_line, + "endLine": start_line, + "snippet": { + "text": "" + } + }, + "contextRegion": { + "startLine": start_line, + "endLine": start_line, + "snippet": { + "text": "" + } + } + }, + "message": { + "text": message + } + } + }) + sarif_data["runs"][0]["results"].append({ + "ruleId": rule_id, + "ruleIndex": rule_index, + "level": "error" if bug.get("Importance", "").lower() == "high" else "warning", + "message": { + "text": message + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": thread_flow_locations[0]["location"]["physicalLocation"]["artifactLocation"][ + "uri"] + }, + "region": { + "startLine": thread_flow_locations[0]["location"]["physicalLocation"]["region"][ + "startLine"], + "endLine": thread_flow_locations[0]["location"]["physicalLocation"]["region"][ + "startLine"], + "snippet": { + "text": "" + } + }, + "contextRegion": { + "startLine": thread_flow_locations[0]["location"]["physicalLocation"]["region"][ + "startLine"], + "endLine": thread_flow_locations[0]["location"]["physicalLocation"]["region"][ + "startLine"], + "snippet": { + "text": "" + } + } + }, + "message": { + "text": message + }, + } + ], + "codeFlows": [ + { + "threadFlows": [ + { + "locations": thread_flow_locations + } + ] + } + ] + }) + return True + + +def output_to_sarif(args): + # 脚本收集 + godel_path_list = list() + for godel_dir in args.godel_dir: + godel_path_list += get_files(godel_dir, ".gdl") + godel_path_list += get_files(godel_dir, ".gs") + sarif_data = { + "version": "2.1.0", + "$schema": "https://schemastore.azurewebsites.net/schemas/json/sarif-2.1.0.json", + "runs": [ + { + "tool": { + "driver": { + "name": "Custom Tool", + "informationUri": "https://example.com", + "rules": [] + } + }, + "results": [] + } + ] + } + # 获取脚本对应的结果并写入sarif报告中 + for godel_query_script in godel_path_list: + output = str(Path(args.output).expanduser().resolve() / (godel_query_script.stem + "." + args.format)) + if not os.path.exists(output): + logging.warning("%s does not exist, it seems that there is a problem with the %s, please check the script", + output, str(godel_query_script)) + continue + with open(output, "r") as f: + output_json = json.load(f) + # 脚本单输出直接转 + if isinstance(output_json, list): + status = json_to_sarif(sarif_data, output_json) + if not status: + logging.warning("The output of %s needs to include filePath, startLine, ruleName,ruleDescription. it " + "can not trans to sarif", godel_query_script) + else: + logging.info("%s trans to sarif success", godel_query_script) + # 脚本多输出分别转过去 + else: + trans = True + for key, value in output_json.items(): + status = json_to_sarif(sarif_data, value) + if not status: + logging.warning("The output of %s %s needs to include filePath, startLine, " + "ruleName,ruleDescription. it can not trans to sarif", godel_query_script, key) + trans = False + if trans: + logging.info("%s trans to sarif success", godel_query_script) + + output = str(Path(args.output).expanduser().resolve() / ("sparrow-cli-report.sarif")) + with open(output, "w") as f: + f.write(json.dumps(sarif_data, indent=4)) + + def query_run(args): # conf 检查 if not conf_check(args): @@ -103,11 +474,20 @@ def query_run(args): logging.error("There is no godel script(ends with .gs or .gdl) in the specified directory," "Please redefine the directory or file by --gdl or -gdl") raise ValueError("path lib error") + + # 不同执行选项: + if args.merge: + logging.warning("When merging execution, please make sure that single reservation of functions or classes " + "with the same name will not affect the execution results.") + merge_execute(args, godel_path_list, args.timeout) + if args.sarif: + output_to_sarif(args) + return status = 1 # 目前先各自执行: start_time = time.time() for godel_query_script in godel_path_list: - output = str(Path(args.output).expanduser().resolve()/(godel_query_script.stem + "." + args.format)) + output = str(Path(args.output).expanduser().resolve() / (godel_query_script.stem + "." + args.format)) if args.database: database = str(Path(args.database).expanduser().resolve()) return_code = execute(godel_query_script, database, output, args.timeout - (time.time() - start_time), @@ -117,16 +497,19 @@ def query_run(args): args.format, args.verbose) if return_code == 0: query_result = check_is_empty_query_result(output, args.format) - logging.info("Task %s is %s, result is %s, execution time is %.2fs.", + logging.info("Task %s is %s, result is %s, execution time is %.2fs.", str(godel_query_script), "success", query_result, time.time() - start_time) else: status = 0 - logging.error("Task %s is %s, result is %s, execution time is %.2fs.", + logging.error("Task %s is %s, result is %s, execution time is %.2fs.", str(godel_query_script), "fail", "null", time.time() - start_time) logging.error("%s execute error, please check by log", str(godel_query_script)) + if args.sarif: + output_to_sarif(args) if status == 1: logging.info("run success") else: - logging.error("run fail, please check by log") + logging.error("run fail, There are scripts that cannot be executed among the scripts that need to be " + "executed. Please locate them based on the logs.") raise RuntimeError("run fail") return diff --git a/cli/rebuild/lib.py b/cli/rebuild/lib.py index c8d9313f..9c1da42b 100644 --- a/cli/rebuild/lib.py +++ b/cli/rebuild/lib.py @@ -3,6 +3,7 @@ import shutil import tempfile import time +from pathlib import Path from query.run import get_files from run.runner import Runner @@ -11,9 +12,10 @@ file_list = dict() -# 目前仅开放下列5种语言的godel-script写法,后续根据开放的语言进行修改 +# lib库与抽取器分开,逻辑上可以有一个库只有lib库无抽取器。 def open_lib(): - return ["java", "javascript", "go", "xml", "python"] + lib = ["java", "javascript", "go", "xml", "python", "sql", "cfamily", "properties", "swift", "arkts"] + return lib def get_rebuild_lang(args): @@ -41,39 +43,51 @@ def line_replace(output, line, base): return output.replace(line, " " * (len(line) - len(str(actual_line))) + str(actual_line), 1) -# 日志输出修改:目前将lib和一进行编译,此处out通过行号将错误信息对应会原文件 -def log_out(stream): - global file_list - for line in iter(stream.readline, b''): - output = line.strip() - if output: - if "-->" in output: - match = re.search(r'-->\s*([^:]+):(\d+)', output) - if match: - file_name = match.group(1) - line = match.group(2) - num = 0 - for file in file_list: - num += file["lines"] - if int(line) <= num: - output = output.replace(file_name, str(file["name"]), 1) - output = line_replace(output, line, num - file["lines"]) - break - else: - line = extract_first_number(output) - if line is not None: - num = 0 - for file in file_list: - num += file["lines"] - if int(line) <= num: - output = line_replace(output, line, num - file["lines"]) - break - print(output) +def log_mapping(output): + result = output + if "-->" in output: + match = re.search(r'-->\s*([^:]+):(\d+)', output) + if match: + file_name = match.group(1) + line = match.group(2) + num = 0 + for file in file_list: + num += file["lines"] + if int(line) <= num: + result = output.replace(file_name, str(file["name"]), 1) + result = line_replace(result, line, num - file["lines"]) + break + else: + line = extract_first_number(output) + if line is not None: + num = 0 + for file in file_list: + num += file["lines"] + if int(line) <= num: + result = line_replace(output, line, num - file["lines"]) + break + return result + + +# 日志输出修改:目前将lib和一进行编译,此处out通过行号将错误信息对应回原文件 +def log_info(output): + if output: + output = log_mapping(output) + logging.info(output.strip()) + + +def log_error(output): + if output: + output = log_mapping(output) + logging.error(output.strip()) def rebuild_lang(lib, verbose): global file_list lib_path = sparrow.lib_script / "coref" / lib + if not Path(lib_path).exists(): + logging.warning("lib %s not exist, please check", str(lib_path)) + return file_list = list() gdl_list = get_files(lib_path, ".gs") gdl_list += get_files(lib_path, ".gdl") @@ -95,18 +109,17 @@ def rebuild_lang(lib, verbose): num += len(lines) output_file.seek(0) cmd = list() - with tempfile.NamedTemporaryFile(suffix='.gdl') as tmp_out: - cmd += [str(sparrow.godel_script), str(output_file.name), "-p", str(sparrow.lib_1_0), "-o", tmp_out.name] - if verbose: - cmd += ["--verbose"] - tmp = Runner(cmd, 3600) - start_time = time.time() - return_code = tmp.subrun(log_out) - if return_code != 0: - logging.error("%s lib compile error, please check it yourself", lib_path) - return -1 - shutil.copy2(tmp_out.name, sparrow.lib_1_0 / ("coref." + lib + ".gdl")) - logging.info("%s lib compile success time: %.2fs", lib_path, time.time() - start_time) + cmd += [str(sparrow.godel_script), "--semantic-only", str(output_file.name)] + if verbose: + cmd += ["--verbose"] + tmp = Runner(cmd, 3600) + start_time = time.time() + return_code = tmp.subrun(log_info, log_error) + if return_code != 0: + logging.error("%s lib compile error, please check it yourself", lib_path) + return -1 + shutil.copy2(output_file.name, sparrow.lib_script / "coref" / (lib + ".gdl")) + logging.info("%s lib compile success time: %.2fs", lib_path, time.time() - start_time) def rebuild_lib(args): diff --git a/cli/requirements.txt b/cli/requirements.txt index 63c468f0..5815679f 100644 --- a/cli/requirements.txt +++ b/cli/requirements.txt @@ -1 +1,3 @@ -psutil>=5.9.5 \ No newline at end of file +psutil==5.9.6 +pyinstaller==6.11.1 +chardet==5.2.0 \ No newline at end of file diff --git a/cli/run/__init__.py b/cli/run/__init__.py index 8b137891..e69de29b 100644 --- a/cli/run/__init__.py +++ b/cli/run/__init__.py @@ -1 +0,0 @@ - diff --git a/cli/run/runner.py b/cli/run/runner.py index 0226d7e3..fcbc98f8 100644 --- a/cli/run/runner.py +++ b/cli/run/runner.py @@ -1,14 +1,38 @@ +# -*-coding:utf-8-*- + import logging +import shlex import subprocess import threading -import shlex -def output_stream(stream): - for line in iter(stream.readline, b''): - output = line.strip() - if output: - print(output) +def stream_reader(stream, handler): + for line in iter(stream.readline, ''): + handler(line) + stream.close() + + +def log_info(message): + logging.info(message.strip()) + + +def log_error(message): + logging.error(message.strip()) + + +def terminate_process(proc, timeout, timers): + """终止进程并取消所有超时器""" + if proc.poll() is None: # 如果进程没有结束 + proc.kill() + proc.terminate() # 尝试终端 + logger = logging.getLogger() + for hdlr in logger.handlers: + hdlr.setFormatter(logging.Formatter('%(asctime)s %(levelname)s: %(message)s')) + logging.error("Execution timeout, You can add -t option to adjust timeout") + + # 取消所有定时器 + for timer in timers: + timer.cancel() class Runner: @@ -16,26 +40,53 @@ def __init__(self, cmd, timeout_seconds): self.cmd = cmd self.timeout_seconds = timeout_seconds - def subrun(self, output=None): + def subrun(self, info_out=None, error_out=None): logging.info("execute : %s", shlex.join(self.cmd)) + process = None + return_code = -1 try: - process = subprocess.Popen(self.cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, - encoding="utf-8") - if output is None: - output = output_stream - output_thread = threading.Thread(target=output, args=(process.stdout,)) - output_thread.daemon = True # 设置为守护线程 - output_thread.start() - - process.wait(timeout=self.timeout_seconds) - - if process.returncode is None: - # 超时处理 - process.kill() - logging.error("execute time > %s s, time out, You can add -t option to adjust timeout", - self.timeout_seconds) + process = subprocess.Popen( + self.cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, + encoding="utf-8", bufsize=1, text=True + ) + + logger = logging.getLogger() + for hdlr in logger.handlers: + hdlr.setFormatter(logging.Formatter('%(message)s')) + if not info_out: + info_out = log_info + if not error_out: + error_out = log_error + + # 为超时创建一个Timer并开始计时 + timeout_timer = threading.Timer(self.timeout_seconds, terminate_process, + [process, self.timeout_seconds, []]) + + stdout_thread = threading.Thread(target=stream_reader, args=(process.stdout, info_out)) + stderr_thread = threading.Thread(target=stream_reader, args=(process.stderr, error_out)) + + stdout_thread.start() + stderr_thread.start() + + timeout_timer.start() # 启动超时计时器 + + # 主线程等待子进程结束 + return_code = process.wait() + + # 子进程结束后取消超时计时器 + timeout_timer.cancel() + + # 等待读取子进程的输出/错误的线程可以正确结束 + stdout_thread.join() + stderr_thread.join() return_code = process.wait() - return return_code except Exception as e: logging.error("execute error: %s", e) return -1 + finally: + logger = logging.getLogger() + for hdlr in logger.handlers: + hdlr.setFormatter(logging.Formatter('%(asctime)s %(levelname)s: %(message)s')) + if process: + process.kill() + return return_code diff --git a/cli/sparrow b/cli/sparrow index 50c5f70d..1a2573bd 100644 --- a/cli/sparrow +++ b/cli/sparrow @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash # A convenient method to return the actual path even for non symlinks # and multi-level symlinks. @@ -12,16 +12,4 @@ function get_realpath() { echo "${previous}" } -PYTHON="" -if command -v python > /dev/null 2>&1; then - PYTHON="python" -elif command -v python2 > /dev/null 2>&1; then - PYTHON="python2" -elif command -v python3 > /dev/null 2>&1; then - PYTHON="python3" -else - echo "No python interpreter founded." - exit -1 -fi - -exec $PYTHON "$(dirname $(get_realpath "$0"))"/cli/sparrow-cli.zip --sparrow-cli-internal "$(dirname $(get_realpath "$0"))" "$@" +exec "$(dirname $(get_realpath "$0"))"/cli/sparrow-cli --sparrow-cli-internal "$(dirname $(get_realpath "$0"))" "$@" diff --git a/cli/sparrow-cli.py b/cli/sparrow-cli.py index 08fa6f2e..ce4935b5 100644 --- a/cli/sparrow-cli.py +++ b/cli/sparrow-cli.py @@ -9,10 +9,27 @@ from query.run import * from extractor.extractor import Extractor from database.create import database_create +from package.create import package_create +from package.compile_and_run import package_run SPARROW_HOME = os.path.abspath(os.path.join(os.path.join(sys.path[0], ".."))) +class ErrorFilter(logging.Filter): + def filter(self, record): + return record.levelno == logging.ERROR + + +class InfoFilter(logging.Filter): + def filter(self, record): + return record.levelno == logging.INFO + + +class WarningFilter(logging.Filter): + def filter(self, record): + return record.levelno == logging.WARNING + + def extractor_choices(): extractor_list = list() for name, value in vars(Extractor).items(): @@ -21,6 +38,18 @@ def extractor_choices(): return extractor_list +def sparrow_check(): + for name, value in vars(Extractor).items(): + if isinstance(value, Path): + if not value.exists(): + return False + for name, value in vars(sparrow).items(): + if isinstance(value, Path): + if not value.exists(): + return False + return True + + def parse_args(): global SPARROW_HOME parser = argparse.ArgumentParser(description='sparrow-cli', @@ -29,7 +58,6 @@ def parse_args(): parser.add_argument("--sparrow-home", "-sparrow-home", dest='sparrow_home', help='sparrow home, You can specify the sparrow location yourself') parser.add_argument('--sparrow-cli-internal', dest='sparrow_home_internal', help=argparse.SUPPRESS) - parser.add_argument('--verbose', action='store_true', help='Enable verbose mode') subparsers = parser.add_subparsers(title='subcommands', dest='subcommand') # 子命令query subparser_query = subparsers.add_parser('query', help='execute godel script') @@ -38,7 +66,7 @@ def parse_args(): # query的子命令run subparser_query_run = sub_subparser_query.add_parser('run', help='execute godel script') subparser_query_run.add_argument("--database", '-d', help='Directory to a godel database to query') - subparser_query_run.add_argument("--format", '-f', choices=['csv', 'json'], default='json', + subparser_query_run.add_argument("--format", '-f', choices=['csv', 'json', "sqlite"], default='json', help='Select output format. default output json') subparser_query_run.add_argument("--output", '-o', default=os.getcwd(), help='Select output dir, The output file will have the same name as the Godel ' @@ -48,7 +76,41 @@ def parse_args(): subparser_query_run.add_argument("--gdl", '-gdl', required=True, nargs="*", dest="godel_dir", help='The location of the godel script that needs to execute') subparser_query_run.add_argument('--verbose', action='store_true', help='Enable verbose mode') - + subparser_query_run.add_argument('--sarif', action='store_true', help='Turn on the sarif report option, all ' + 'outputs will be merged into one sarif, ' + 'and the output result will be ' + 'sparrow-cli-report.sarif in the output ' + 'directory. The original godel script ' + 'output must contain information such as ' + 'filePath, startLine, ruleName, ' + 'ruleDescription, etc.') + subparser_query_run.add_argument('--merge', '-m', action='store_true', help='Combined execution of multiple ' + 'scripts,Only one function and class ' + 'with the same name in the script ' + 'will be retained, and the output and ' + 'header files will be merged ' + 'together. and they must to be ' + 'godel-script query') + subparser_query_run.add_argument('--log-dir', help='Log storage dir') + # 子命令package + subparser_package = subparsers.add_parser('package', help='godel script package manager') + # 子命令package的子解析器 + sub_subparser_package = subparser_package.add_subparsers(title='package_subcommands', dest='package_subcommands') + # package的子命令create + subparser_package_create = sub_subparser_package.add_parser('create', help='create package or manifest.json') + subparser_package_create.add_argument("--manifest", '-m', help='Create a new manifest file in this directory', + action="store_true") + subparser_package_create.add_argument("--pack", '-p', help='Pack up project and generate zip file', + action="store_true") + subparser_package_create.add_argument("--install", '-i', help='Unpack zip file and install') + subparser_package_create.add_argument('--log-dir', help='Log storage dir') + # package的子命令run + subparser_package_run = sub_subparser_package.add_parser('run', help='execute godel script with packages') + subparser_package_run.add_argument("--database", '-d', help='Directory to a godel database to query') + subparser_package_run.add_argument("--gdl", '-gdl', required=True, nargs="*", dest="godel_dir", + help='The location of the godel script that needs to execute') + subparser_package_run.add_argument('--verbose', action='store_true', help='Enable verbose mode') + subparser_package_run.add_argument('--log-dir', help='Log storage dir') # 子命令database subparser_database = subparsers.add_parser('database', help='data extract') # 子命令database子解析器 @@ -67,6 +129,7 @@ def parse_args(): subparser_database_create.add_argument("--timeout", '-t', type=int, default=3600, help='Set extract timeout in seconds, default 3600') subparser_database_create.add_argument('--verbose', action='store_true', help='Enable verbose mode') + subparser_database_create.add_argument('--log-dir', help='Log storage dir') subparser_database_create.add_argument('--overwrite', action='store_true', help='whether to overwrite the database, Default not') subparser_database_create.add_argument('--extraction-config-file', @@ -89,12 +152,14 @@ def parse_args(): 'by whitespace. e.g. ' '-lang java xml') subparser_rebuild_lib.add_argument('--verbose', action='store_true', help='Enable verbose mode') + subparser_rebuild_lib.add_argument('--log-dir', help='Log storage dir') args = parser.parse_args() # 如果没有参数输入,直接回车,则显示帮助信息 if len(sys.argv) == 1: parser.print_help() - logging.warning("please give conf to start sparrow as help, it will not start") + logging.warning("please give conf to start sparrow as help, it will not start, You can use -h to view the " + "help list") return # 设置SPARROW_HOME @@ -107,34 +172,75 @@ def parse_args(): sparrow(SPARROW_HOME) Extractor() + # 暂不开启 + # if not sparrow_check(): + # logging.error("Please specify the sparrow-cli directory correctly") + # return # 查询版本号, 查找配置文件 if args.version: print(sparrow.version) return - if args.verbose: - log_level = logging.DEBUG - else: - log_level = logging.INFO - console_handler = logging.StreamHandler(sys.stdout) - console_handler.setLevel(level=log_level) - formatter = logging.Formatter('%(asctime)s %(levelname)s: %(message)s') - - console_handler.setFormatter(formatter) - logging.basicConfig(level=log_level, handlers=[console_handler]) logging.info("sparrow %s will start", sparrow.version) + if args.subcommand: + if args.verbose: + log_level = logging.DEBUG + else: + log_level = logging.INFO + logger = logging.getLogger() + logger.setLevel(log_level) + for hdlr in logger.handlers: + hdlr.setFormatter(logging.Formatter('%(asctime)s %(levelname)s: %(message)s')) + if args.log_dir: + log_format = '%(asctime)s %(levelname)s: %(message)s' + # error warning info 分开存储 + file_handler_error = logging.FileHandler(os.path.join(args.log_dir, 'sparrow-cli-error.log')) + formatter_error = logging.Formatter(log_format) + file_handler_error.setFormatter(formatter_error) + file_handler_error.addFilter(ErrorFilter()) + + file_handler_warning = logging.FileHandler(os.path.join(args.log_dir, 'sparrow-cli-warn.log')) + formatter_warning = logging.Formatter(log_format) + file_handler_warning.setFormatter(formatter_warning) + file_handler_warning.addFilter(WarningFilter()) + + file_handler_info = logging.FileHandler(os.path.join(args.log_dir, 'sparrow-cli-info.log')) + formatter_info = logging.Formatter(log_format) + file_handler_info.setFormatter(formatter_info) + file_handler_info.addFilter(InfoFilter()) + + logger.addHandler(file_handler_warning) + logger.addHandler(file_handler_info) + logger.addHandler(file_handler_error) + else: + parser.print_help() + logging.warning("please give conf to start sparrow as help, it will not start, You can use -h to view the " + "help list") + return if args.subcommand == "query": if args.query_subcommands == "run": query_run(args) + return elif args.subcommand == "database": if args.database_subcommands == "create": database_create(args) + return elif args.subcommand == "rebuild": if args.rebuild_subcommands == "lib": rebuild_lib(args) + else: + sub_subparser_rebuild.print_help() + return + elif args.subcommand == "package": + if args.package_subcommands == "create": + package_create(args) + elif args.package_subcommands == "run": + package_run(args) + return else: - logging.warning("please give conf to start sparrow, it will not start") - return + parser.print_help() + logging.warning("please give conf to start sparrow as help, it will not start, You can use -h to view the " + "help list") if __name__ == '__main__': diff --git a/cli/sparrow-cli.spec b/cli/sparrow-cli.spec new file mode 100644 index 00000000..489e6ff3 --- /dev/null +++ b/cli/sparrow-cli.spec @@ -0,0 +1,43 @@ +# -*- mode: python ; coding: utf-8 -*- + + +a = Analysis( + ['sparrow-cli.py'], + pathex=[], + binaries=[], + datas=[], + hiddenimports=[], + hookspath=[], + hooksconfig={}, + runtime_hooks=[], + excludes=[], + noarchive=False, +) +pyz = PYZ(a.pure) + +exe = EXE( + pyz, + a.scripts, + [], + exclude_binaries=True, + name='sparrow-cli', + debug=False, + bootloader_ignore_signals=False, + strip=False, + upx=True, + console=True, + disable_windowed_traceback=False, + argv_emulation=False, + target_arch=None, + codesign_identity=None, + entitlements_file=None, +) +coll = COLLECT( + exe, + a.binaries, + a.datas, + strip=False, + upx=True, + upx_exclude=[], + name='cli', +) diff --git a/cli/sparrow_schema/schema.py b/cli/sparrow_schema/schema.py index b8d0a402..34dbd601 100644 --- a/cli/sparrow_schema/schema.py +++ b/cli/sparrow_schema/schema.py @@ -4,28 +4,26 @@ class sparrow: home = "" - godel_1_0 = "" + godel_0_3 = "" godel_script = "" language = "" - lib = "" - lib_1_0 = "" + lib_03 = "" lib_script = "" version = "" def __init__(self, sparrow_home): sparrow.home = Path(sparrow_home).expanduser().resolve() - sparrow.godel_1_0 = sparrow.home/"godel-1.0"/"usr"/"bin"/"godel" + sparrow.godel_0_3 = sparrow.home/"godel-0.3"/"usr"/"bin"/"godel" sparrow.godel_script = sparrow.home/"godel-script"/"usr"/"bin"/"godel" sparrow.language = sparrow.home/"language" - sparrow.lib = sparrow.home/"lib" - sparrow.lib_1_0 = sparrow.home/"lib-1.0" - sparrow.lib_script = sparrow.home/"lib-script" + sparrow.lib_03 = sparrow.home/"lib-03" + sparrow.lib_script = sparrow.home/"lib" version_path = sparrow.home/"version.txt" if version_path.exists(): try: with open(version_path, "r") as f: content = f.read() - sparrow.version = content + sparrow.version = content.strip() except PermissionError as pe: sparrow.version = "no version file found!" logging.warning(f"can not open version.txt: {str(pe)}") diff --git a/deps.bzl b/deps.bzl new file mode 100644 index 00000000..f85e4fba --- /dev/null +++ b/deps.bzl @@ -0,0 +1,2083 @@ +load("@bazel_gazelle//:deps.bzl", "go_repository") + +def go_dependencies(): + go_repository( + name = "co_honnef_go_tools", + build_file_proto_mode = "disable_global", + importpath = "honnef.co/go/tools", + sum = "h1:UoveltGrhghAA7ePc+e+QYDHXrBps2PqFZiHkGR/xK8=", + version = "v0.0.1-2020.1.4", + ) + go_repository( + name = "com_github_alecthomas_template", + build_file_proto_mode = "disable_global", + importpath = "github.com/alecthomas/template", + sum = "h1:JYp7IbQjafoB+tBA3gMyHYHrpOtNuDiK/uB5uXxq5wM=", + version = "v0.0.0-20190718012654-fb15b899a751", + ) + go_repository( + name = "com_github_alecthomas_units", + build_file_proto_mode = "disable_global", + importpath = "github.com/alecthomas/units", + sum = "h1:UQZhZ2O0vMHr2cI+DC1Mbh0TJxzA3RcLoMsFw+aXw7E=", + version = "v0.0.0-20190924025748-f65c72e2690d", + ) + go_repository( + name = "com_github_alicebob_gopher_json", + build_file_proto_mode = "disable_global", + importpath = "github.com/alicebob/gopher-json", + sum = "h1:HbKu58rmZpUGpz5+4FfNmIU+FmZg2P3Xaj2v2bfNWmk=", + version = "v0.0.0-20200520072559-a9ecdc9d1d3a", + ) + go_repository( + name = "com_github_alicebob_miniredis_v2", + build_file_proto_mode = "disable_global", + importpath = "github.com/alicebob/miniredis/v2", + sum = "h1:+lwAJYjvvdIVg6doFHuotFjueJ/7KY10xo/vm3X3Scw=", + version = "v2.23.0", + ) + go_repository( + name = "com_github_antihax_optional", + build_file_proto_mode = "disable_global", + importpath = "github.com/antihax/optional", + sum = "h1:xK2lYat7ZLaVVcIuj82J8kIro4V6kDe0AUDFboUCwcg=", + version = "v1.0.0", + ) + go_repository( + name = "com_github_armon_go_socks5", + build_file_proto_mode = "disable_global", + importpath = "github.com/armon/go-socks5", + sum = "h1:0CwZNZbxp69SHPdPJAN/hZIm0C4OItdklCFmMRWYpio=", + version = "v0.0.0-20160902184237-e75332964ef5", + ) + go_repository( + name = "com_github_asaskevich_govalidator", + build_file_proto_mode = "disable_global", + importpath = "github.com/asaskevich/govalidator", + sum = "h1:idn718Q4B6AGu/h5Sxe66HYVdqdGu2l9Iebqhi/AEoA=", + version = "v0.0.0-20190424111038-f61b66f89f4a", + ) + go_repository( + name = "com_github_azure_go_autorest", + build_file_proto_mode = "disable_global", + importpath = "github.com/Azure/go-autorest", + sum = "h1:V5VMDjClD3GiElqLWO7mz2MxNAK/vTfRHdAubSIPRgs=", + version = "v14.2.0+incompatible", + ) + go_repository( + name = "com_github_azure_go_autorest_autorest", + build_file_proto_mode = "disable_global", + importpath = "github.com/Azure/go-autorest/autorest", + sum = "h1:F3R3q42aWytozkV8ihzcgMO4OA4cuqr3bNlsEuF6//A=", + version = "v0.11.27", + ) + go_repository( + name = "com_github_azure_go_autorest_autorest_adal", + build_file_proto_mode = "disable_global", + importpath = "github.com/Azure/go-autorest/autorest/adal", + sum = "h1:gJ3E98kMpFB1MFqQCvA1yFab8vthOeD4VlFRQULxahg=", + version = "v0.9.20", + ) + go_repository( + name = "com_github_azure_go_autorest_autorest_date", + build_file_proto_mode = "disable_global", + importpath = "github.com/Azure/go-autorest/autorest/date", + sum = "h1:7gUk1U5M/CQbp9WoqinNzJar+8KY+LPI6wiWrP/myHw=", + version = "v0.3.0", + ) + go_repository( + name = "com_github_azure_go_autorest_autorest_mocks", + build_file_proto_mode = "disable_global", + importpath = "github.com/Azure/go-autorest/autorest/mocks", + sum = "h1:K0laFcLE6VLTOwNgSxaGbUcLPuGXlNkbVvq4cW4nIHk=", + version = "v0.4.1", + ) + go_repository( + name = "com_github_azure_go_autorest_logger", + build_file_proto_mode = "disable_global", + importpath = "github.com/Azure/go-autorest/logger", + sum = "h1:IG7i4p/mDa2Ce4TRyAO8IHnVhAVF3RFU+ZtXWSmf4Tg=", + version = "v0.2.1", + ) + go_repository( + name = "com_github_azure_go_autorest_tracing", + build_file_proto_mode = "disable_global", + importpath = "github.com/Azure/go-autorest/tracing", + sum = "h1:TYi4+3m5t6K48TGI9AUdb+IzbnSxvnvUMfuitfgcfuo=", + version = "v0.6.0", + ) + go_repository( + name = "com_github_benbjohnson_clock", + build_file_proto_mode = "disable_global", + importpath = "github.com/benbjohnson/clock", + sum = "h1:Q92kusRqC1XV2MjkWETPvjJVqKetz1OzxZB7mHJLju8=", + version = "v1.1.0", + ) + go_repository( + name = "com_github_beorn7_perks", + build_file_proto_mode = "disable_global", + importpath = "github.com/beorn7/perks", + sum = "h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=", + version = "v1.0.1", + ) + go_repository( + name = "com_github_bkaradzic_go_lz4", + build_file_proto_mode = "disable_global", + importpath = "github.com/bkaradzic/go-lz4", + sum = "h1:RXc4wYsyz985CkXXeX04y4VnZFGG8Rd43pRaHsOXAKk=", + version = "v1.0.0", + ) + go_repository( + name = "com_github_burntsushi_toml", + build_file_proto_mode = "disable_global", + importpath = "github.com/BurntSushi/toml", + sum = "h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ=", + version = "v0.3.1", + ) + go_repository( + name = "com_github_burntsushi_xgb", + build_file_proto_mode = "disable_global", + importpath = "github.com/BurntSushi/xgb", + sum = "h1:1BDTz0u9nC3//pOCMdNH+CiXJVYJh5UQNCOBG7jbELc=", + version = "v0.0.0-20160522181843-27f122750802", + ) + go_repository( + name = "com_github_cenkalti_backoff_v4", + build_file_proto_mode = "disable_global", + importpath = "github.com/cenkalti/backoff/v4", + sum = "h1:cFAlzYUlVYDysBEH2T5hyJZMh3+5+WCBvSnK6Q8UtC4=", + version = "v4.1.3", + ) + go_repository( + name = "com_github_census_instrumentation_opencensus_proto", + build_file_proto_mode = "disable_global", + importpath = "github.com/census-instrumentation/opencensus-proto", + sum = "h1:glEXhBS5PSLLv4IXzLA5yPRVX4bilULVyxxbrfOtDAk=", + version = "v0.2.1", + ) + go_repository( + name = "com_github_cespare_xxhash", + build_file_proto_mode = "disable_global", + importpath = "github.com/cespare/xxhash", + sum = "h1:a6HrQnmkObjyL+Gs60czilIUGqrzKutQD6XZog3p+ko=", + version = "v1.1.0", + ) + go_repository( + name = "com_github_cespare_xxhash_v2", + build_file_proto_mode = "disable_global", + importpath = "github.com/cespare/xxhash/v2", + sum = "h1:YRXhKfTDauu4ajMg1TPgFO5jnlC2HCbmLXMcTG5cbYE=", + version = "v2.1.2", + ) + go_repository( + name = "com_github_chzyer_logex", + build_file_proto_mode = "disable_global", + importpath = "github.com/chzyer/logex", + sum = "h1:Swpa1K6QvQznwJRcfTfQJmTE72DqScAa40E+fbHEXEE=", + version = "v1.1.10", + ) + go_repository( + name = "com_github_chzyer_readline", + build_file_proto_mode = "disable_global", + importpath = "github.com/chzyer/readline", + sum = "h1:fY5BOSpyZCqRo5OhCuC+XN+r/bBCmeuuJtjz+bCNIf8=", + version = "v0.0.0-20180603132655-2972be24d48e", + ) + go_repository( + name = "com_github_chzyer_test", + build_file_proto_mode = "disable_global", + importpath = "github.com/chzyer/test", + sum = "h1:q763qf9huN11kDQavWsoZXJNW3xEE4JJyHa5Q25/sd8=", + version = "v0.0.0-20180213035817-a1ea475d72b1", + ) + go_repository( + name = "com_github_clickhouse_clickhouse_go", + build_file_proto_mode = "disable_global", + importpath = "github.com/ClickHouse/clickhouse-go", + sum = "h1:cKjXeYLNWVJIx2J1K6H2CqyRmfwVJVY1OV1coaaFcI0=", + version = "v1.5.4", + ) + go_repository( + name = "com_github_clickhouse_clickhouse_go_v2", + build_file_proto_mode = "disable_global", + importpath = "github.com/ClickHouse/clickhouse-go/v2", + sum = "h1:7HW+MXPaQfVyCzPGEn/LciMc8K6cG58FZMUc7DXQmro=", + version = "v2.0.14", + ) + go_repository( + name = "com_github_client9_misspell", + build_file_proto_mode = "disable_global", + importpath = "github.com/client9/misspell", + sum = "h1:ta993UF76GwbvJcIo3Y68y/M3WxlpEHPWIGDkJYwzJI=", + version = "v0.3.4", + ) + go_repository( + name = "com_github_cloudflare_golz4", + build_file_proto_mode = "disable_global", + importpath = "github.com/cloudflare/golz4", + sum = "h1:F1EaeKL/ta07PY/k9Os/UFtwERei2/XzGemhpGnBKNg=", + version = "v0.0.0-20150217214814-ef862a3cdc58", + ) + go_repository( + name = "com_github_cncf_udpa_go", + build_file_proto_mode = "disable_global", + importpath = "github.com/cncf/udpa/go", + sum = "h1:hzAQntlaYRkVSFEfj9OTWlVV1H155FMD8BTKktLv0QI=", + version = "v0.0.0-20210930031921-04548b0d99d4", + ) + go_repository( + name = "com_github_cncf_xds_go", + build_file_proto_mode = "disable_global", + importpath = "github.com/cncf/xds/go", + sum = "h1:zH8ljVhhq7yC0MIeUL/IviMtY8hx2mK8cN9wEYb8ggw=", + version = "v0.0.0-20211011173535-cb28da3451f1", + ) + go_repository( + name = "com_github_coreos_go_semver", + build_file_proto_mode = "disable_global", + importpath = "github.com/coreos/go-semver", + sum = "h1:wkHLiw0WNATZnSG7epLsujiMCgPAc9xhjJ4tgnAxmfM=", + version = "v0.3.0", + ) + go_repository( + name = "com_github_coreos_go_systemd_v22", + build_file_proto_mode = "disable_global", + importpath = "github.com/coreos/go-systemd/v22", + sum = "h1:D9/bQk5vlXQFZ6Kwuu6zaiXJ9oTPe68++AzAJc1DzSI=", + version = "v22.3.2", + ) + go_repository( + name = "com_github_cpuguy83_go_md2man_v2", + build_file_proto_mode = "disable_global", + importpath = "github.com/cpuguy83/go-md2man/v2", + sum = "h1:U+s90UTSYgptZMwQh2aRr3LuazLJIa+Pg3Kc1ylSYVY=", + version = "v2.0.0-20190314233015-f79a8a8ca69d", + ) + go_repository( + name = "com_github_creack_pty", + build_file_proto_mode = "disable_global", + importpath = "github.com/creack/pty", + sum = "h1:uDmaGzcdjhF4i/plgjmEsriH11Y0o7RKapEf/LDaM3w=", + version = "v1.1.9", + ) + go_repository( + name = "com_github_data_dog_go_sqlmock", + build_file_proto_mode = "disable_global", + importpath = "github.com/DATA-DOG/go-sqlmock", + sum = "h1:Shsta01QNfFxHCfpW6YH2STWB0MudeXXEWMr20OEh60=", + version = "v1.5.0", + ) + + go_repository( + name = "com_github_davecgh_go_spew", + build_file_proto_mode = "disable_global", + importpath = "github.com/davecgh/go-spew", + sum = "h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=", + version = "v1.1.1", + ) + go_repository( + name = "com_github_dgryski_go_rendezvous", + build_file_proto_mode = "disable_global", + importpath = "github.com/dgryski/go-rendezvous", + sum = "h1:lO4WD4F/rVNCu3HqELle0jiPLLBs70cWOduZpkS1E78=", + version = "v0.0.0-20200823014737-9f7001d12a5f", + ) + go_repository( + name = "com_github_docopt_docopt_go", + build_file_proto_mode = "disable_global", + importpath = "github.com/docopt/docopt-go", + sum = "h1:bWDMxwH3px2JBh6AyO7hdCn/PkvCZXii8TGj7sbtEbQ=", + version = "v0.0.0-20180111231733-ee0de3bc6815", + ) + + go_repository( + name = "com_github_dustin_go_humanize", + build_file_proto_mode = "disable_global", + importpath = "github.com/dustin/go-humanize", + sum = "h1:VSnTsYCnlFHaM2/igO1h6X3HA71jcobQuxemgkq4zYo=", + version = "v1.0.0", + ) + go_repository( + name = "com_github_eapache_go_resiliency", + build_file_proto_mode = "disable_global", + importpath = "github.com/eapache/go-resiliency", + sum = "h1:v7g92e/KSN71Rq7vSThKaWIq68fL4YHvWyiUKorFR1Q=", + version = "v1.2.0", + ) + go_repository( + name = "com_github_eapache_go_xerial_snappy", + build_file_proto_mode = "disable_global", + importpath = "github.com/eapache/go-xerial-snappy", + sum = "h1:YEetp8/yCZMuEPMUDHG0CW/brkkEp8mzqk2+ODEitlw=", + version = "v0.0.0-20180814174437-776d5712da21", + ) + go_repository( + name = "com_github_eapache_queue", + build_file_proto_mode = "disable_global", + importpath = "github.com/eapache/queue", + sum = "h1:YOEu7KNc61ntiQlcEeUIoDTJ2o8mQznoNvUhiigpIqc=", + version = "v1.1.0", + ) + go_repository( + name = "com_github_elazarl_goproxy", + build_file_proto_mode = "disable_global", + importpath = "github.com/elazarl/goproxy", + sum = "h1:yUdfgN0XgIJw7foRItutHYUIhlcKzcSf5vDpdhQAKTc=", + version = "v0.0.0-20180725130230-947c36da3153", + ) + go_repository( + name = "com_github_emicklei_go_restful", + build_file_proto_mode = "disable_global", + importpath = "github.com/emicklei/go-restful", + sum = "h1:H2pdYOb3KQ1/YsqVWoWNLQO+fusocsw354rqGTZtAgw=", + version = "v0.0.0-20170410110728-ff4f55a20633", + ) + go_repository( + name = "com_github_emicklei_go_restful_v3", + build_file_proto_mode = "disable_global", + importpath = "github.com/emicklei/go-restful/v3", + sum = "h1:eCZ8ulSerjdAiaNpF7GxXIE7ZCMo1moN1qX+S609eVw=", + version = "v3.8.0", + ) + go_repository( + name = "com_github_envoyproxy_go_control_plane", + build_file_proto_mode = "disable_global", + importpath = "github.com/envoyproxy/go-control-plane", + sum = "h1:xvqufLtNVwAhN8NMyWklVgxnWohi+wtMGQMhtxexlm0=", + version = "v0.10.2-0.20220325020618-49ff273808a1", + ) + go_repository( + name = "com_github_envoyproxy_protoc_gen_validate", + build_file_proto_mode = "disable_global", + importpath = "github.com/envoyproxy/protoc-gen-validate", + sum = "h1:EQciDnbrYxy13PgWoY8AqoxGiPrpgBZ1R8UNe3ddc+A=", + version = "v0.1.0", + ) + go_repository( + name = "com_github_evanphx_json_patch", + build_file_proto_mode = "disable_global", + importpath = "github.com/evanphx/json-patch", + sum = "h1:4onqiflcdA9EOZ4RxV643DvftH5pOlLGNtQ5lPWQu84=", + version = "v4.12.0+incompatible", + ) + go_repository( + name = "com_github_fatih_color", + build_file_proto_mode = "disable_global", + importpath = "github.com/fatih/color", + sum = "h1:8LOYc1KYPPmyKMuN8QV2DNRWNbLo6LZ0iLs8+mlH53w=", + version = "v1.13.0", + ) + go_repository( + name = "com_github_form3tech_oss_jwt_go", + build_file_proto_mode = "disable_global", + importpath = "github.com/form3tech-oss/jwt-go", + sum = "h1:7ZaBxOI7TMoYBfyA3cQHErNNyAWIKUMIwqxEtgHOs5c=", + version = "v3.2.3+incompatible", + ) + go_repository( + name = "com_github_fortytw2_leaktest", + build_file_proto_mode = "disable_global", + importpath = "github.com/fortytw2/leaktest", + sum = "h1:u8491cBMTQ8ft8aeV+adlcytMZylmA5nnwwkRZjI8vw=", + version = "v1.3.0", + ) + go_repository( + name = "com_github_frankban_quicktest", + build_file_proto_mode = "disable_global", + importpath = "github.com/frankban/quicktest", + sum = "h1:8sXhOn0uLys67V8EsXLc6eszDs8VXWxL3iRvebPhedY=", + version = "v1.11.3", + ) + go_repository( + name = "com_github_fsnotify_fsnotify", + build_file_proto_mode = "disable_global", + importpath = "github.com/fsnotify/fsnotify", + sum = "h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4=", + version = "v1.4.9", + ) + go_repository( + name = "com_github_fullstorydev_grpcurl", + build_file_proto_mode = "disable_global", + importpath = "github.com/fullstorydev/grpcurl", + sum = "h1:xJWosq3BQovQ4QrdPO72OrPiWuGgEsxY8ldYsJbPrqI=", + version = "v1.8.7", + ) + go_repository( + name = "com_github_ghodss_yaml", + build_file_proto_mode = "disable_global", + importpath = "github.com/ghodss/yaml", + sum = "h1:wQHKEahhL6wmXdzwWG11gIVCkOv05bNOh+Rxn0yngAk=", + version = "v1.0.0", + ) + + go_repository( + name = "com_github_glebarez_go_sqlite", + build_file_proto_mode = "disable_global", + importpath = "github.com/glebarez/go-sqlite", + sum = "h1:gyTyFr2RFFQd2gp6fOOdfnTvUn99zwvVOrQFHA4S+DY=", + version = "v1.17.2", + ) + go_repository( + name = "com_github_glebarez_sqlite", + build_file_proto_mode = "disable_global", + importpath = "github.com/glebarez/sqlite", + sum = "h1:oaJupO4X9iTn4sXRvP5Vs15BNvKh9dx5AQfciKlDvV4=", + version = "v1.4.5", + ) + go_repository( + name = "com_github_globalsign_mgo", + build_file_proto_mode = "disable_global", + importpath = "github.com/globalsign/mgo", + sum = "h1:DujepqpGd1hyOd7aW59XpK7Qymp8iy83xq74fLr21is=", + version = "v0.0.0-20181015135952-eeefdecb41b8", + ) + go_repository( + name = "com_github_go_gl_glfw", + build_file_proto_mode = "disable_global", + importpath = "github.com/go-gl/glfw", + sum = "h1:QbL/5oDUmRBzO9/Z7Seo6zf912W/a6Sr4Eu0G/3Jho0=", + version = "v0.0.0-20190409004039-e6da0acd62b1", + ) + go_repository( + name = "com_github_go_gl_glfw_v3_3_glfw", + build_file_proto_mode = "disable_global", + importpath = "github.com/go-gl/glfw/v3.3/glfw", + sum = "h1:WtGNWLvXpe6ZudgnXrq0barxBImvnnJoMEhXAzcbM0I=", + version = "v0.0.0-20200222043503-6f7a984d4dc4", + ) + go_repository( + name = "com_github_go_kit_kit", + build_file_proto_mode = "disable_global", + importpath = "github.com/go-kit/kit", + sum = "h1:wDJmvq38kDhkVxi50ni9ykkdUr1PKgqKOoi01fa0Mdk=", + version = "v0.9.0", + ) + go_repository( + name = "com_github_go_kit_log", + build_file_proto_mode = "disable_global", + importpath = "github.com/go-kit/log", + sum = "h1:7i2K3eKTos3Vc0enKCfnVcgHh2olr/MyfboYq7cAcFw=", + version = "v0.2.0", + ) + go_repository( + name = "com_github_go_logfmt_logfmt", + build_file_proto_mode = "disable_global", + importpath = "github.com/go-logfmt/logfmt", + sum = "h1:otpy5pqBCBZ1ng9RQ0dPu4PN7ba75Y/aA+UpowDyNVA=", + version = "v0.5.1", + ) + go_repository( + name = "com_github_go_logr_logr", + build_file_proto_mode = "disable_global", + importpath = "github.com/go-logr/logr", + sum = "h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0=", + version = "v1.2.3", + ) + go_repository( + name = "com_github_go_logr_stdr", + build_file_proto_mode = "disable_global", + importpath = "github.com/go-logr/stdr", + sum = "h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag=", + version = "v1.2.2", + ) + go_repository( + name = "com_github_go_ole_go_ole", + build_file_proto_mode = "disable_global", + importpath = "github.com/go-ole/go-ole", + sum = "h1:nNBDSCOigTSiarFpYE9J/KtEA1IOW4CNeqT9TQDqCxI=", + version = "v1.2.4", + ) + go_repository( + name = "com_github_go_openapi_jsonpointer", + build_file_proto_mode = "disable_global", + importpath = "github.com/go-openapi/jsonpointer", + sum = "h1:gZr+CIYByUqjcgeLXnQu2gHYQC9o73G2XUeOFYEICuY=", + version = "v0.19.5", + ) + go_repository( + name = "com_github_go_openapi_jsonreference", + build_file_proto_mode = "disable_global", + importpath = "github.com/go-openapi/jsonreference", + sum = "h1:1WJP/wi4OjB4iV8KVbH73rQaoialJrqv8gitZLxGLtM=", + version = "v0.19.5", + ) + go_repository( + name = "com_github_go_openapi_swag", + build_file_proto_mode = "disable_global", + importpath = "github.com/go-openapi/swag", + sum = "h1:gm3vOOXfiuw5i9p5N9xJvfjvuofpyvLA9Wr6QfK5Fng=", + version = "v0.19.14", + ) + go_repository( + name = "com_github_go_redis_redis_v8", + build_file_proto_mode = "disable_global", + importpath = "github.com/go-redis/redis/v8", + sum = "h1:AcZZR7igkdvfVmQTPnu9WE37LRrO/YrBH5zWyjDC0oI=", + version = "v8.11.5", + ) + go_repository( + name = "com_github_go_sql_driver_mysql", + build_file_proto_mode = "disable_global", + importpath = "github.com/go-sql-driver/mysql", + sum = "h1:BCTh4TKNUYmOmMUcQ3IipzF5prigylS7XXjEkfCHuOE=", + version = "v1.6.0", + ) + go_repository( + name = "com_github_go_stack_stack", + build_file_proto_mode = "disable_global", + importpath = "github.com/go-stack/stack", + sum = "h1:5SgMzNM5HxrEjV0ww2lTmX6E2Izsfxas4+YHWRs3Lsk=", + version = "v1.8.0", + ) + go_repository( + name = "com_github_go_task_slim_sprig", + build_file_proto_mode = "disable_global", + importpath = "github.com/go-task/slim-sprig", + sum = "h1:p104kn46Q8WdvHunIJ9dAyjPVtrBPhSr3KT2yUst43I=", + version = "v0.0.0-20210107165309-348f09dbbbc0", + ) + go_repository( + name = "com_github_godbus_dbus_v5", + build_file_proto_mode = "disable_global", + importpath = "github.com/godbus/dbus/v5", + sum = "h1:9349emZab16e7zQvpmsbtjc18ykshndd8y2PG3sgJbA=", + version = "v5.0.4", + ) + go_repository( + name = "com_github_gofrs_uuid", + build_file_proto_mode = "disable_global", + importpath = "github.com/gofrs/uuid", + sum = "h1:0/KbAdpx3UXAx1kEOWHJeOkpbgRFGHVgv+CFIY7dBJI=", + version = "v4.3.1+incompatible", + ) + go_repository( + name = "com_github_gogo_protobuf", + build_file_proto_mode = "disable_global", + importpath = "github.com/gogo/protobuf", + sum = "h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q=", + version = "v1.3.2", + ) + go_repository( + name = "com_github_golang_glog", + build_file_proto_mode = "disable_global", + importpath = "github.com/golang/glog", + sum = "h1:nfP3RFugxnNRyKgeWd4oI1nYvXpxrx8ck8ZrcizshdQ=", + version = "v1.0.0", + ) + go_repository( + name = "com_github_golang_groupcache", + build_file_proto_mode = "disable_global", + importpath = "github.com/golang/groupcache", + sum = "h1:oI5xCqsCo564l8iNU+DwB5epxmsaqB+rhGL0m5jtYqE=", + version = "v0.0.0-20210331224755-41bb18bfe9da", + ) + go_repository( + name = "com_github_golang_jwt_jwt_v4", + build_file_proto_mode = "disable_global", + importpath = "github.com/golang-jwt/jwt/v4", + sum = "h1:rcc4lwaZgFMCZ5jxF9ABolDcIHdBytAFgqFPbSJQAYs=", + version = "v4.4.2", + ) + go_repository( + name = "com_github_golang_mock", + build_file_proto_mode = "disable_global", + importpath = "github.com/golang/mock", + sum = "h1:ErTB+efbowRARo13NNdxyJji2egdxLGQhRaY+DUumQc=", + version = "v1.6.0", + ) + go_repository( + name = "com_github_golang_protobuf", + build_file_proto_mode = "disable_global", + importpath = "github.com/golang/protobuf", + sum = "h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw=", + version = "v1.5.2", + ) + go_repository( + name = "com_github_golang_snappy", + build_file_proto_mode = "disable_global", + importpath = "github.com/golang/snappy", + sum = "h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM=", + version = "v0.0.4", + ) + go_repository( + name = "com_github_google_btree", + build_file_proto_mode = "disable_global", + importpath = "github.com/google/btree", + sum = "h1:gK4Kx5IaGY9CD5sPJ36FHiBJ6ZXl0kilRiiCj+jdYp4=", + version = "v1.0.1", + ) + go_repository( + name = "com_github_google_gnostic", + build_file_proto_mode = "disable_global", + importpath = "github.com/google/gnostic", + sum = "h1:FhTMOKj2VhjpouxvWJAV1TL304uMlb9zcDqkl6cEI54=", + version = "v0.5.7-v3refs", + ) + + go_repository( + name = "com_github_google_go_cmp", + build_file_proto_mode = "disable_global", + importpath = "github.com/google/go-cmp", + sum = "h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg=", + version = "v0.5.8", + ) + go_repository( + name = "com_github_google_gofuzz", + build_file_proto_mode = "disable_global", + importpath = "github.com/google/gofuzz", + sum = "h1:xRy4A+RhZaiKjJ1bPfwQ8sedCA+YS2YcCHW6ec7JMi0=", + version = "v1.2.0", + ) + go_repository( + name = "com_github_google_martian", + build_file_proto_mode = "disable_global", + importpath = "github.com/google/martian", + sum = "h1:/CP5g8u/VJHijgedC/Legn3BAbAaWPgecwXBIDzw5no=", + version = "v2.1.0+incompatible", + ) + go_repository( + name = "com_github_google_martian_v3", + build_file_proto_mode = "disable_global", + importpath = "github.com/google/martian/v3", + sum = "h1:pMen7vLs8nvgEYhywH3KDWJIJTeEr2ULsVWHWYHQyBs=", + version = "v3.0.0", + ) + go_repository( + name = "com_github_google_pprof", + build_file_proto_mode = "disable_global", + importpath = "github.com/google/pprof", + sum = "h1:yAJXTCF9TqKcTiHJAE8dj7HMvPfh66eeA2JYW7eFpSE=", + version = "v0.0.0-20210407192527-94a9f03dee38", + ) + go_repository( + name = "com_github_google_renameio", + build_file_proto_mode = "disable_global", + importpath = "github.com/google/renameio", + sum = "h1:GOZbcHa3HfsPKPlmyPyN2KEohoMXOhdMbHrvbpl2QaA=", + version = "v0.1.0", + ) + + go_repository( + name = "com_github_google_uuid", + build_file_proto_mode = "disable_global", + importpath = "github.com/google/uuid", + sum = "h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I=", + version = "v1.3.0", + ) + go_repository( + name = "com_github_googleapis_gax_go_v2", + build_file_proto_mode = "disable_global", + importpath = "github.com/googleapis/gax-go/v2", + sum = "h1:sjZBwGj9Jlw33ImPtvFviGYvseOtDM7hkSKB7+Tv3SM=", + version = "v2.0.5", + ) + go_repository( + name = "com_github_googleapis_gnostic", + build_file_proto_mode = "disable_global", + importpath = "github.com/googleapis/gnostic", + sum = "h1:9fHAtK0uDfpveeqqo1hkEZJcFvYXAiCN3UutL8F9xHw=", + version = "v0.5.5", + ) + go_repository( + name = "com_github_gorilla_handlers", + build_file_proto_mode = "disable_global", + importpath = "github.com/gorilla/handlers", + sum = "h1:0QniY0USkHQ1RGCLfKxeNHK9bkDHGRYGNDFBCS+YARg=", + version = "v1.4.2", + ) + go_repository( + name = "com_github_gorilla_mux", + build_file_proto_mode = "disable_global", + importpath = "github.com/gorilla/mux", + sum = "h1:i40aqfkR1h2SlN9hojwV5ZA91wcXFOvkdNIeFDP5koI=", + version = "v1.8.0", + ) + go_repository( + name = "com_github_gorilla_securecookie", + build_file_proto_mode = "disable_global", + importpath = "github.com/gorilla/securecookie", + sum = "h1:miw7JPhV+b/lAHSXz4qd/nN9jRiAFV5FwjeKyCS8BvQ=", + version = "v1.1.1", + ) + go_repository( + name = "com_github_gorilla_sessions", + build_file_proto_mode = "disable_global", + importpath = "github.com/gorilla/sessions", + sum = "h1:DHd3rPN5lE3Ts3D8rKkQ8x/0kqfeNmBAaiSi+o7FsgI=", + version = "v1.2.1", + ) + go_repository( + name = "com_github_gorilla_websocket", + build_file_proto_mode = "disable_global", + importpath = "github.com/gorilla/websocket", + sum = "h1:+/TMaTYc4QFitKJxsQ7Yye35DkWvkdLcvGKqM+x0Ufc=", + version = "v1.4.2", + ) + go_repository( + name = "com_github_gregjones_httpcache", + build_file_proto_mode = "disable_global", + importpath = "github.com/gregjones/httpcache", + sum = "h1:pdN6V1QBWetyv/0+wjACpqVH+eVULgEjkurDLq3goeM=", + version = "v0.0.0-20180305231024-9cad4c3443a7", + ) + go_repository( + name = "com_github_grpc_ecosystem_go_grpc_prometheus", + build_file_proto_mode = "disable_global", + importpath = "github.com/grpc-ecosystem/go-grpc-prometheus", + sum = "h1:Ovs26xHkKqVztRpIrF/92BcuyuQ/YW4NSIpoGtfXNho=", + version = "v1.2.0", + ) + go_repository( + name = "com_github_grpc_ecosystem_grpc_gateway", + build_file_proto_mode = "disable_global", + importpath = "github.com/grpc-ecosystem/grpc-gateway", + sum = "h1:gmcG1KaJ57LophUzW0Hy8NmPhnMZb4M0+kPpLofRdBo=", + version = "v1.16.0", + ) + go_repository( + name = "com_github_grpc_ecosystem_grpc_gateway_v2", + build_file_proto_mode = "disable_global", + importpath = "github.com/grpc-ecosystem/grpc-gateway/v2", + sum = "h1:BZHcxBETFHIdVyhyEfOvn/RdU/QGdLI4y34qQGjGWO0=", + version = "v2.7.0", + ) + go_repository( + name = "com_github_h2non_parth", + build_file_proto_mode = "disable_global", + importpath = "github.com/h2non/parth", + sum = "h1:2VTzZjLZBgl62/EtslCrtky5vbi9dd7HrQPQIx6wqiw=", + version = "v0.0.0-20190131123155-b4df798d6542", + ) + go_repository( + name = "com_github_hashicorp_go_uuid", + build_file_proto_mode = "disable_global", + importpath = "github.com/hashicorp/go-uuid", + sum = "h1:cfejS+Tpcp13yd5nYHWDI6qVCny6wyX2Mt5SGur2IGE=", + version = "v1.0.2", + ) + go_repository( + name = "com_github_hashicorp_golang_lru", + build_file_proto_mode = "disable_global", + importpath = "github.com/hashicorp/golang-lru", + sum = "h1:0hERBMJE1eitiLkihrMvRVBYAkpHzc/J3QdDN+dAcgU=", + version = "v0.5.1", + ) + go_repository( + name = "com_github_hpcloud_tail", + build_file_proto_mode = "disable_global", + importpath = "github.com/hpcloud/tail", + sum = "h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI=", + version = "v1.0.0", + ) + go_repository( + name = "com_github_ianlancetaylor_demangle", + build_file_proto_mode = "disable_global", + importpath = "github.com/ianlancetaylor/demangle", + sum = "h1:mV02weKRL81bEnm8A0HT1/CAelMQDBuQIfLw8n+d6xI=", + version = "v0.0.0-20200824232613-28f6c0f3b639", + ) + go_repository( + name = "com_github_imdario_mergo", + build_file_proto_mode = "disable_global", + importpath = "github.com/imdario/mergo", + sum = "h1:xTNEAn+kxVO7dTZGu0CegyqKZmoWFI0rF8UxjlB2d28=", + version = "v0.3.6", + ) + go_repository( + name = "com_github_jcmturner_aescts_v2", + build_file_proto_mode = "disable_global", + importpath = "github.com/jcmturner/aescts/v2", + sum = "h1:9YKLH6ey7H4eDBXW8khjYslgyqG2xZikXP0EQFKrle8=", + version = "v2.0.0", + ) + go_repository( + name = "com_github_jcmturner_dnsutils_v2", + build_file_proto_mode = "disable_global", + importpath = "github.com/jcmturner/dnsutils/v2", + sum = "h1:lltnkeZGL0wILNvrNiVCR6Ro5PGU/SeBvVO/8c/iPbo=", + version = "v2.0.0", + ) + go_repository( + name = "com_github_jcmturner_gofork", + build_file_proto_mode = "disable_global", + importpath = "github.com/jcmturner/gofork", + sum = "h1:J7uCkflzTEhUZ64xqKnkDxq3kzc96ajM1Gli5ktUem8=", + version = "v1.0.0", + ) + go_repository( + name = "com_github_jcmturner_goidentity_v6", + build_file_proto_mode = "disable_global", + importpath = "github.com/jcmturner/goidentity/v6", + sum = "h1:VKnZd2oEIMorCTsFBnJWbExfNN7yZr3EhJAxwOkZg6o=", + version = "v6.0.1", + ) + go_repository( + name = "com_github_jcmturner_gokrb5_v8", + build_file_proto_mode = "disable_global", + importpath = "github.com/jcmturner/gokrb5/v8", + sum = "h1:6ZIM6b/JJN0X8UM43ZOM6Z4SJzla+a/u7scXFJzodkA=", + version = "v8.4.2", + ) + go_repository( + name = "com_github_jcmturner_rpc_v2", + build_file_proto_mode = "disable_global", + importpath = "github.com/jcmturner/rpc/v2", + sum = "h1:7FXXj8Ti1IaVFpSAziCZWNzbNuZmnvw/i6CqLNdWfZY=", + version = "v2.0.3", + ) + go_repository( + name = "com_github_jhump_gopoet", + build_file_proto_mode = "disable_global", + importpath = "github.com/jhump/gopoet", + sum = "h1:gYjOPnzHd2nzB37xYQZxj4EIQNpBrBskRqQQ3q4ZgSg=", + version = "v0.1.0", + ) + go_repository( + name = "com_github_jhump_goprotoc", + build_file_proto_mode = "disable_global", + importpath = "github.com/jhump/goprotoc", + sum = "h1:Y1UgUX+txUznfqcGdDef8ZOVlyQvnV0pKWZH08RmZuo=", + version = "v0.5.0", + ) + go_repository( + name = "com_github_jhump_protoreflect", + build_file_proto_mode = "disable_global", + importpath = "github.com/jhump/protoreflect", + sum = "h1:zrrZqa7JAc2YGgPSzZZkmUXJ5G6NRPdxOg/9t7ISImA=", + version = "v1.13.0", + ) + + go_repository( + name = "com_github_jinzhu_inflection", + build_file_proto_mode = "disable_global", + importpath = "github.com/jinzhu/inflection", + sum = "h1:K317FqzuhWc8YvSVlFMCCUb36O/S9MCKRDI7QkRKD/E=", + version = "v1.0.0", + ) + go_repository( + name = "com_github_jinzhu_now", + build_file_proto_mode = "disable_global", + importpath = "github.com/jinzhu/now", + sum = "h1:tHnRBy1i5F2Dh8BAFxqFzxKqqvezXrL2OW1TnX+Mlas=", + version = "v1.1.4", + ) + go_repository( + name = "com_github_jmoiron_sqlx", + build_file_proto_mode = "disable_global", + importpath = "github.com/jmoiron/sqlx", + sum = "h1:41Ip0zITnmWNR/vHV+S4m+VoUivnWY5E4OJfLZjCJMA=", + version = "v1.2.0", + ) + go_repository( + name = "com_github_josharian_intern", + build_file_proto_mode = "disable_global", + importpath = "github.com/josharian/intern", + sum = "h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY=", + version = "v1.0.0", + ) + go_repository( + name = "com_github_jpillora_backoff", + build_file_proto_mode = "disable_global", + importpath = "github.com/jpillora/backoff", + sum = "h1:uvFg412JmmHBHw7iwprIxkPMI+sGQ4kzOWsMeHnm2EA=", + version = "v1.0.0", + ) + go_repository( + name = "com_github_json_iterator_go", + build_file_proto_mode = "disable_global", + importpath = "github.com/json-iterator/go", + sum = "h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM=", + version = "v1.1.12", + ) + go_repository( + name = "com_github_jstemmer_go_junit_report", + build_file_proto_mode = "disable_global", + importpath = "github.com/jstemmer/go-junit-report", + sum = "h1:6QPYqodiu3GuPL+7mfx+NwDdp2eTkp9IfEUpgAwUN0o=", + version = "v0.9.1", + ) + go_repository( + name = "com_github_julienschmidt_httprouter", + build_file_proto_mode = "disable_global", + importpath = "github.com/julienschmidt/httprouter", + sum = "h1:U0609e9tgbseu3rBINet9P48AI/D3oJs4dN7jwJOQ1U=", + version = "v1.3.0", + ) + + go_repository( + name = "com_github_kballard_go_shellquote", + build_file_proto_mode = "disable_global", + importpath = "github.com/kballard/go-shellquote", + sum = "h1:Z9n2FFNUXsshfwJMBgNA0RU6/i7WVaAegv3PtuIHPMs=", + version = "v0.0.0-20180428030007-95032a82bc51", + ) + go_repository( + name = "com_github_kisielk_errcheck", + build_file_proto_mode = "disable_global", + importpath = "github.com/kisielk/errcheck", + sum = "h1:e8esj/e4R+SAOwFwN+n3zr0nYeCyeweozKfO23MvHzY=", + version = "v1.5.0", + ) + go_repository( + name = "com_github_kisielk_gotool", + build_file_proto_mode = "disable_global", + importpath = "github.com/kisielk/gotool", + sum = "h1:AV2c/EiW3KqPNT9ZKl07ehoAGi4C5/01Cfbblndcapg=", + version = "v1.0.0", + ) + go_repository( + name = "com_github_klauspost_compress", + build_file_proto_mode = "disable_global", + importpath = "github.com/klauspost/compress", + sum = "h1:P76CopJELS0TiO2mebmnzgWaajssP/EszplttgQxcgc=", + version = "v1.13.6", + ) + go_repository( + name = "com_github_konsorten_go_windows_terminal_sequences", + build_file_proto_mode = "disable_global", + importpath = "github.com/konsorten/go-windows-terminal-sequences", + sum = "h1:CE8S1cTafDpPvMhIxNJKvHsGVBgn1xWYf1NbHQhywc8=", + version = "v1.0.3", + ) + go_repository( + name = "com_github_kr_logfmt", + build_file_proto_mode = "disable_global", + importpath = "github.com/kr/logfmt", + sum = "h1:T+h1c/A9Gawja4Y9mFVWj2vyii2bbUNDw3kt9VxK2EY=", + version = "v0.0.0-20140226030751-b84e30acd515", + ) + go_repository( + name = "com_github_kr_pretty", + build_file_proto_mode = "disable_global", + importpath = "github.com/kr/pretty", + sum = "h1:Fmg33tUaq4/8ym9TJN1x7sLJnHVwhP33CNkpYV/7rwI=", + version = "v0.2.1", + ) + go_repository( + name = "com_github_kr_pty", + build_file_proto_mode = "disable_global", + importpath = "github.com/kr/pty", + sum = "h1:VkoXIwSboBpnk99O/KFauAEILuNHv5DVFKZMBN/gUgw=", + version = "v1.1.1", + ) + go_repository( + name = "com_github_kr_text", + build_file_proto_mode = "disable_global", + importpath = "github.com/kr/text", + sum = "h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=", + version = "v0.2.0", + ) + go_repository( + name = "com_github_lib_pq", + build_file_proto_mode = "disable_global", + importpath = "github.com/lib/pq", + sum = "h1:p7ZhMD+KsSRozJr34udlUrhboJwWAgCg34+/ZZNvZZw=", + version = "v1.10.7", + ) + go_repository( + name = "com_github_mailru_easyjson", + build_file_proto_mode = "disable_global", + importpath = "github.com/mailru/easyjson", + sum = "h1:8yTIVnZgCoiM1TgqoeTl+LfU5Jg6/xL3QhGQnimLYnA=", + version = "v0.7.6", + ) + go_repository( + name = "com_github_mattn_go_colorable", + build_file_proto_mode = "disable_global", + importpath = "github.com/mattn/go-colorable", + sum = "h1:sqDoxXbdeALODt0DAeJCVp38ps9ZogZEAXjus69YV3U=", + version = "v0.1.9", + ) + + go_repository( + name = "com_github_mattn_go_isatty", + build_file_proto_mode = "disable_global", + importpath = "github.com/mattn/go-isatty", + sum = "h1:bq3VjFmv/sOjHtdEhmkEV4x1AJtvUvOJ2PFAZ5+peKQ=", + version = "v0.0.16", + ) + go_repository( + name = "com_github_mattn_go_runewidth", + build_file_proto_mode = "disable_global", + importpath = "github.com/mattn/go-runewidth", + sum = "h1:lTGmDsbAYt5DmK6OnoV7EuIF1wEIFAcxld6ypU4OSgU=", + version = "v0.0.13", + ) + + go_repository( + name = "com_github_mattn_go_sqlite3", + build_file_proto_mode = "disable_global", + importpath = "github.com/mattn/go-sqlite3", + sum = "h1:TJ1bhYJPV44phC+IMu1u2K/i5RriLTPe+yc68XDJ1Z0=", + version = "v1.14.12", + ) + go_repository( + name = "com_github_matttproud_golang_protobuf_extensions", + build_file_proto_mode = "disable_global", + importpath = "github.com/matttproud/golang_protobuf_extensions", + sum = "h1:I0XW9+e1XWDxdcEniV4rQAIOPUGDq67JSCiRCgGCZLI=", + version = "v1.0.2-0.20181231171920-c182affec369", + ) + go_repository( + name = "com_github_mitchellh_mapstructure", + build_file_proto_mode = "disable_global", + importpath = "github.com/mitchellh/mapstructure", + sum = "h1:fmNYVwqnSfB9mZU6OS2O6GsXM+wcskZDuKQzvN1EDeE=", + version = "v1.1.2", + ) + go_repository( + name = "com_github_mkevac_debugcharts", + build_file_proto_mode = "disable_global", + importpath = "github.com/mkevac/debugcharts", + sum = "h1:/mD+ABZyXD39BzJI2XyRJlqdZG11gXFo0SSynL+OFeU=", + version = "v0.0.0-20191222103121-ae1c48aa8615", + ) + go_repository( + name = "com_github_moby_spdystream", + build_file_proto_mode = "disable_global", + importpath = "github.com/moby/spdystream", + sum = "h1:cjW1zVyyoiM0T7b6UoySUFqzXMoqRckQtXwGPiBhOM8=", + version = "v0.2.0", + ) + go_repository( + name = "com_github_modern_go_concurrent", + build_file_proto_mode = "disable_global", + importpath = "github.com/modern-go/concurrent", + sum = "h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg=", + version = "v0.0.0-20180306012644-bacd9c7ef1dd", + ) + go_repository( + name = "com_github_modern_go_reflect2", + build_file_proto_mode = "disable_global", + importpath = "github.com/modern-go/reflect2", + sum = "h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M=", + version = "v1.0.2", + ) + go_repository( + name = "com_github_montanaflynn_stats", + build_file_proto_mode = "disable_global", + importpath = "github.com/montanaflynn/stats", + sum = "h1:iruDEfMl2E6fbMZ9s0scYfZQ84/6SPL6zC8ACM2oIL0=", + version = "v0.0.0-20171201202039-1bf9dbcd8cbe", + ) + go_repository( + name = "com_github_munnerz_goautoneg", + build_file_proto_mode = "disable_global", + importpath = "github.com/munnerz/goautoneg", + sum = "h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA=", + version = "v0.0.0-20191010083416-a7dc8b61c822", + ) + go_repository( + name = "com_github_mwitkow_go_conntrack", + build_file_proto_mode = "disable_global", + importpath = "github.com/mwitkow/go-conntrack", + sum = "h1:KUppIJq7/+SVif2QVs3tOP0zanoHgBEVAwHxUSIzRqU=", + version = "v0.0.0-20190716064945-2f068394615f", + ) + go_repository( + name = "com_github_mxk_go_flowrate", + build_file_proto_mode = "disable_global", + importpath = "github.com/mxk/go-flowrate", + sum = "h1:y5//uYreIhSUg3J1GEMiLbxo1LJaP8RfCpH6pymGZus=", + version = "v0.0.0-20140419014527-cca7078d478f", + ) + go_repository( + name = "com_github_nbio_st", + build_file_proto_mode = "disable_global", + importpath = "github.com/nbio/st", + sum = "h1:W6apQkHrMkS0Muv8G/TipAy/FJl/rCYT0+EuS8+Z0z4=", + version = "v0.0.0-20140626010706-e9e8d9816f32", + ) + go_repository( + name = "com_github_niemeyer_pretty", + build_file_proto_mode = "disable_global", + importpath = "github.com/niemeyer/pretty", + sum = "h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs=", + version = "v0.0.0-20200227124842-a10e7caefd8e", + ) + go_repository( + name = "com_github_nxadm_tail", + build_file_proto_mode = "disable_global", + importpath = "github.com/nxadm/tail", + sum = "h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE=", + version = "v1.4.8", + ) + go_repository( + name = "com_github_nytimes_gziphandler", + build_file_proto_mode = "disable_global", + importpath = "github.com/NYTimes/gziphandler", + sum = "h1:lsxEuwrXEAokXB9qhlbKWPpo3KMLZQ5WB5WLQRW1uq0=", + version = "v0.0.0-20170623195520-56545f4a5d46", + ) + go_repository( + name = "com_github_olekukonko_tablewriter", + build_file_proto_mode = "disable_global", + importpath = "github.com/olekukonko/tablewriter", + sum = "h1:P2Ga83D34wi1o9J6Wh1mRuqd4mF/x/lgBS7N7AbDhec=", + version = "v0.0.5", + ) + go_repository( + name = "com_github_oneofone_xxhash", + build_file_proto_mode = "disable_global", + importpath = "github.com/OneOfOne/xxhash", + sum = "h1:KMrpdQIwFcEqXDklaen+P1axHaj9BSKzvpUUfnHldSE=", + version = "v1.2.2", + ) + go_repository( + name = "com_github_onsi_ginkgo", + build_file_proto_mode = "disable_global", + importpath = "github.com/onsi/ginkgo", + sum = "h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE=", + version = "v1.16.5", + ) + go_repository( + name = "com_github_onsi_ginkgo_v2", + build_file_proto_mode = "disable_global", + importpath = "github.com/onsi/ginkgo/v2", + sum = "h1:Fx2POJZfKRQcM1pH49qSZiYeu319wji004qX+GDovrU=", + version = "v2.1.6", + ) + go_repository( + name = "com_github_onsi_gomega", + build_file_proto_mode = "disable_global", + importpath = "github.com/onsi/gomega", + sum = "h1:PA/3qinGoukvymdIDV8pii6tiZgC8kbmJO6Z5+b002Q=", + version = "v1.20.1", + ) + go_repository( + name = "com_github_openzipkin_zipkin_go", + build_file_proto_mode = "disable_global", + importpath = "github.com/openzipkin/zipkin-go", + sum = "h1:CtfRrOVZtbDj8rt1WXjklw0kqqJQwICrCKmlfUuBUUw=", + version = "v0.4.0", + ) + go_repository( + name = "com_github_paulmach_orb", + build_file_proto_mode = "disable_global", + importpath = "github.com/paulmach/orb", + sum = "h1:sNhJV5ML+mv1F077ljOck/9inorF4ahDO8iNNpHbKHY=", + version = "v0.5.0", + ) + go_repository( + name = "com_github_paulmach_protoscan", + build_file_proto_mode = "disable_global", + importpath = "github.com/paulmach/protoscan", + sum = "h1:rM0FpcTjUMvPUNk2BhPJrreDKetq43ChnL+x1sRg8O8=", + version = "v0.2.1", + ) + go_repository( + name = "com_github_pelletier_go_toml_v2", + build_file_proto_mode = "disable_global", + importpath = "github.com/pelletier/go-toml/v2", + sum = "h1:ipoSadvV8oGUjnUbMub59IDPPwfxF694nG/jwbMiyQg=", + version = "v2.0.5", + ) + go_repository( + name = "com_github_peterbourgon_diskv", + build_file_proto_mode = "disable_global", + importpath = "github.com/peterbourgon/diskv", + sum = "h1:UBdAOUP5p4RWqPBg048CAvpKN+vxiaj6gdUUzhl4XmI=", + version = "v2.0.1+incompatible", + ) + go_repository( + name = "com_github_pierrec_lz4", + build_file_proto_mode = "disable_global", + importpath = "github.com/pierrec/lz4", + sum = "h1:9UY3+iC23yxF0UfGaYrGplQ+79Rg+h/q9FV9ix19jjM=", + version = "v2.6.1+incompatible", + ) + go_repository( + name = "com_github_pierrec_lz4_v4", + build_file_proto_mode = "disable_global", + importpath = "github.com/pierrec/lz4/v4", + sum = "h1:+fL8AQEZtz/ijeNnpduH0bROTu0O3NZAlPjQxGn8LwE=", + version = "v4.1.14", + ) + go_repository( + name = "com_github_pkg_errors", + build_file_proto_mode = "disable_global", + importpath = "github.com/pkg/errors", + sum = "h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=", + version = "v0.9.1", + ) + + go_repository( + name = "com_github_pmezard_go_difflib", + build_file_proto_mode = "disable_global", + importpath = "github.com/pmezard/go-difflib", + sum = "h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=", + version = "v1.0.0", + ) + go_repository( + name = "com_github_prashantv_gostub", + build_file_proto_mode = "disable_global", + importpath = "github.com/prashantv/gostub", + sum = "h1:BTyx3RfQjRHnUWaGF9oQos79AlQ5k8WNktv7VGvVH4g=", + version = "v1.1.0", + ) + go_repository( + name = "com_github_prometheus_client_golang", + build_file_proto_mode = "disable_global", + importpath = "github.com/prometheus/client_golang", + sum = "h1:b71QUfeo5M8gq2+evJdTPfZhYMAU0uKPkyPJ7TPsloU=", + version = "v1.13.0", + ) + go_repository( + name = "com_github_prometheus_client_model", + build_file_proto_mode = "disable_global", + importpath = "github.com/prometheus/client_model", + sum = "h1:uq5h0d+GuxiXLJLNABMgp2qUWDPiLvgCzz2dUR+/W/M=", + version = "v0.2.0", + ) + go_repository( + name = "com_github_prometheus_common", + build_file_proto_mode = "disable_global", + importpath = "github.com/prometheus/common", + sum = "h1:ccBbHCgIiT9uSoFY0vX8H3zsNR5eLt17/RQLUvn8pXE=", + version = "v0.37.0", + ) + go_repository( + name = "com_github_prometheus_procfs", + build_file_proto_mode = "disable_global", + importpath = "github.com/prometheus/procfs", + sum = "h1:ODq8ZFEaYeCaZOJlZZdJA2AbQR98dSHSM1KW/You5mo=", + version = "v0.8.0", + ) + go_repository( + name = "com_github_puerkitobio_purell", + build_file_proto_mode = "disable_global", + importpath = "github.com/PuerkitoBio/purell", + sum = "h1:WEQqlqaGbrPkxLJWfBwQmfEAE1Z7ONdDLqrN38tNFfI=", + version = "v1.1.1", + ) + go_repository( + name = "com_github_puerkitobio_urlesc", + build_file_proto_mode = "disable_global", + importpath = "github.com/PuerkitoBio/urlesc", + sum = "h1:d+Bc7a5rLufV/sSk/8dngufqelfh6jnri85riMAaF/M=", + version = "v0.0.0-20170810143723-de5bf2ad4578", + ) + go_repository( + name = "com_github_rabbitmq_amqp091_go", + build_file_proto_mode = "disable_global", + importpath = "github.com/rabbitmq/amqp091-go", + sum = "h1:qx8cGMJha71/5t31Z+LdPLdPrkj/BvD38cqC3Bi1pNI=", + version = "v1.1.0", + ) + go_repository( + name = "com_github_rcrowley_go_metrics", + build_file_proto_mode = "disable_global", + importpath = "github.com/rcrowley/go-metrics", + sum = "h1:N/ElC8H3+5XpJzTSTfLsJV/mx9Q9g7kxmchpfZyxgzM=", + version = "v0.0.0-20201227073835-cf1acfcdf475", + ) + + go_repository( + name = "com_github_remyoudompheng_bigfft", + build_file_proto_mode = "disable_global", + importpath = "github.com/remyoudompheng/bigfft", + sum = "h1:OdAsTTz6OkFY5QxjkYwrChwuRruF69c169dPK26NUlk=", + version = "v0.0.0-20200410134404-eec4a21b6bb0", + ) + go_repository( + name = "com_github_rivo_uniseg", + build_file_proto_mode = "disable_global", + importpath = "github.com/rivo/uniseg", + sum = "h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY=", + version = "v0.2.0", + ) + go_repository( + name = "com_github_rogpeppe_fastuuid", + build_file_proto_mode = "disable_global", + importpath = "github.com/rogpeppe/fastuuid", + sum = "h1:Ppwyp6VYCF1nvBTXL3trRso7mXMlRrw9ooo375wvi2s=", + version = "v1.2.0", + ) + go_repository( + name = "com_github_rogpeppe_go_internal", + build_file_proto_mode = "disable_global", + importpath = "github.com/rogpeppe/go-internal", + sum = "h1:RR9dF3JtopPvtkroDZuVD7qquD0bnHlKSqaQhgwt8yk=", + version = "v1.3.0", + ) + go_repository( + name = "com_github_russross_blackfriday_v2", + build_file_proto_mode = "disable_global", + importpath = "github.com/russross/blackfriday/v2", + sum = "h1:lPqVAte+HuHNfhJ/0LC98ESWRz8afy9tM/0RK8m9o+Q=", + version = "v2.0.1", + ) + go_repository( + name = "com_github_shirou_gopsutil", + build_file_proto_mode = "disable_global", + importpath = "github.com/shirou/gopsutil", + sum = "h1:+1+c1VGhc88SSonWP6foOcLhvnKlUeu/erjjvaPEYiI=", + version = "v3.21.11+incompatible", + ) + go_repository( + name = "com_github_shirou_w32", + build_file_proto_mode = "disable_global", + importpath = "github.com/shirou/w32", + sum = "h1:udFKJ0aHUL60LboW/A+DfgoHVedieIzIXE8uylPue0U=", + version = "v0.0.0-20160930032740-bb4de0191aa4", + ) + go_repository( + name = "com_github_shopify_sarama", + build_file_proto_mode = "disable_global", + importpath = "github.com/Shopify/sarama", + sum = "h1:TOZL6r37xJBDEMLx4yjB77jxbZYXPaDow08TSK6vIL0=", + version = "v1.30.0", + ) + go_repository( + name = "com_github_shopify_toxiproxy_v2", + build_file_proto_mode = "disable_global", + importpath = "github.com/Shopify/toxiproxy/v2", + sum = "h1:ePgznFqEG1v3AjMklnK8H7BSc++FDSo7xfK9K7Af+0Y=", + version = "v2.1.6-0.20210914104332-15ea381dcdae", + ) + go_repository( + name = "com_github_shopspring_decimal", + build_file_proto_mode = "disable_global", + importpath = "github.com/shopspring/decimal", + sum = "h1:2Usl1nmF/WZucqkFZhnfFYxxxu8LG21F6nPQBE5gKV8=", + version = "v1.3.1", + ) + go_repository( + name = "com_github_shurcool_sanitized_anchor_name", + build_file_proto_mode = "disable_global", + importpath = "github.com/shurcooL/sanitized_anchor_name", + sum = "h1:PdmoCO6wvbs+7yrJyMORt4/BmY5IYyJwS/kOiWx8mHo=", + version = "v1.0.0", + ) + go_repository( + name = "com_github_sirupsen_logrus", + build_file_proto_mode = "disable_global", + importpath = "github.com/sirupsen/logrus", + sum = "h1:dJKuHgqk1NNQlqoA6BTlM1Wf9DOH3NBjQyu0h9+AZZE=", + version = "v1.8.1", + ) + go_repository( + name = "com_github_spaolacci_murmur3", + build_file_proto_mode = "disable_global", + importpath = "github.com/spaolacci/murmur3", + sum = "h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI=", + version = "v1.1.0", + ) + go_repository( + name = "com_github_spf13_afero", + build_file_proto_mode = "disable_global", + importpath = "github.com/spf13/afero", + sum = "h1:5jhuqJyZCZf2JRofRvN/nIFgIWNzPa3/Vz8mYylgbWc=", + version = "v1.2.2", + ) + go_repository( + name = "com_github_spf13_pflag", + build_file_proto_mode = "disable_global", + importpath = "github.com/spf13/pflag", + sum = "h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=", + version = "v1.0.5", + ) + go_repository( + name = "com_github_stackexchange_wmi", + build_file_proto_mode = "disable_global", + importpath = "github.com/StackExchange/wmi", + sum = "h1:G0m3OIz70MZUWq3EgK3CesDbo8upS2Vm9/P3FtgI+Jk=", + version = "v0.0.0-20190523213315-cbe66965904d", + ) + go_repository( + name = "com_github_stoewer_go_strcase", + build_file_proto_mode = "disable_global", + importpath = "github.com/stoewer/go-strcase", + sum = "h1:Z2iHWqGXH00XYgqDmNgQbIBxf3wrNq0F3feEy0ainaU=", + version = "v1.2.0", + ) + + go_repository( + name = "com_github_stretchr_objx", + build_file_proto_mode = "disable_global", + importpath = "github.com/stretchr/objx", + sum = "h1:M2gUjqZET1qApGOWNSnZ49BAIMX4F/1plDv3+l31EJ4=", + version = "v0.4.0", + ) + go_repository( + name = "com_github_stretchr_testify", + build_file_proto_mode = "disable_global", + importpath = "github.com/stretchr/testify", + sum = "h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk=", + version = "v1.8.0", + ) + go_repository( + name = "com_github_tidwall_pretty", + build_file_proto_mode = "disable_global", + importpath = "github.com/tidwall/pretty", + sum = "h1:HsD+QiTn7sK6flMKIvNmpqz1qrpP3Ps6jOKIKMooyg4=", + version = "v1.0.0", + ) + go_repository( + name = "com_github_tklauser_go_sysconf", + build_file_proto_mode = "disable_global", + importpath = "github.com/tklauser/go-sysconf", + sum = "h1:IJ1AZGZRWbY8T5Vfk04D9WOA5WSejdflXxP03OUqALw=", + version = "v0.3.10", + ) + go_repository( + name = "com_github_tklauser_numcpus", + build_file_proto_mode = "disable_global", + importpath = "github.com/tklauser/numcpus", + sum = "h1:E53Dm1HjH1/R2/aoCtXtPgzmElmn51aOkhCFSuZq//o=", + version = "v0.4.0", + ) + go_repository( + name = "com_github_urfave_cli_v2", + build_file_proto_mode = "disable_global", + importpath = "github.com/urfave/cli/v2", + sum = "h1:qph92Y649prgesehzOrQjdWyxFOp/QVM+6imKHad91M=", + version = "v2.3.0", + ) + go_repository( + name = "com_github_xdg_go_pbkdf2", + build_file_proto_mode = "disable_global", + importpath = "github.com/xdg-go/pbkdf2", + sum = "h1:Su7DPu48wXMwC3bs7MCNG+z4FhcyEuz5dlvchbq0B0c=", + version = "v1.0.0", + ) + go_repository( + name = "com_github_xdg_go_scram", + build_file_proto_mode = "disable_global", + importpath = "github.com/xdg-go/scram", + sum = "h1:VOMT+81stJgXW3CpHyqHN3AXDYIMsx56mEFrB37Mb/E=", + version = "v1.1.1", + ) + go_repository( + name = "com_github_xdg_go_stringprep", + build_file_proto_mode = "disable_global", + importpath = "github.com/xdg-go/stringprep", + sum = "h1:kdwGpVNwPFtjs98xCGkHjQtGKh86rDcRZN17QEMCOIs=", + version = "v1.0.3", + ) + go_repository( + name = "com_github_youmark_pkcs8", + build_file_proto_mode = "disable_global", + importpath = "github.com/youmark/pkcs8", + sum = "h1:splanxYIlg+5LfHAM6xpdFEAYOk8iySO56hMFq6uLyA=", + version = "v0.0.0-20181117223130-1be2e3e5546d", + ) + + go_repository( + name = "com_github_yuin_goldmark", + build_file_proto_mode = "disable_global", + importpath = "github.com/yuin/goldmark", + sum = "h1:fVcFKWvrslecOb/tg+Cc05dkeYx540o0FuFt3nUVDoE=", + version = "v1.4.13", + ) + go_repository( + name = "com_github_yuin_gopher_lua", + build_file_proto_mode = "disable_global", + importpath = "github.com/yuin/gopher-lua", + sum = "h1:k/gmLsJDWwWqbLCur2yWnJzwQEKRcAHXo6seXGuSwWw=", + version = "v0.0.0-20210529063254-f4c35e4016d9", + ) + go_repository( + name = "com_github_zeromicro_go_zero", + build_file_proto_mode = "disable_global", + importpath = "github.com/zeromicro/go-zero", + sum = "h1:1P9TuzxONqxQG3Bvpk7r7vPOGEnfXn3lTX/4W5Y2GlQ=", + version = "v1.4.2", + ) + go_repository( + name = "com_google_cloud_go", + build_file_proto_mode = "disable_global", + importpath = "cloud.google.com/go", + sum = "h1:3DXvAyifywvq64LfkKaMOmkWPS1CikIQdMe2lY9vxU8=", + version = "v0.97.0", + ) + go_repository( + name = "com_google_cloud_go_bigquery", + build_file_proto_mode = "disable_global", + importpath = "cloud.google.com/go/bigquery", + sum = "h1:PQcPefKFdaIzjQFbiyOgAqyx8q5djaE7x9Sqe712DPA=", + version = "v1.8.0", + ) + go_repository( + name = "com_google_cloud_go_datastore", + build_file_proto_mode = "disable_global", + importpath = "cloud.google.com/go/datastore", + sum = "h1:/May9ojXjRkPBNVrq+oWLqmWCkr4OU5uRY29bu0mRyQ=", + version = "v1.1.0", + ) + go_repository( + name = "com_google_cloud_go_pubsub", + build_file_proto_mode = "disable_global", + importpath = "cloud.google.com/go/pubsub", + sum = "h1:ukjixP1wl0LpnZ6LWtZJ0mX5tBmjp1f8Sqer8Z2OMUU=", + version = "v1.3.1", + ) + go_repository( + name = "com_google_cloud_go_storage", + build_file_proto_mode = "disable_global", + importpath = "cloud.google.com/go/storage", + sum = "h1:STgFzyU5/8miMl0//zKh2aQeTyeaUH3WN9bSUiJ09bA=", + version = "v1.10.0", + ) + + go_repository( + name = "com_lukechampine_uint128", + build_file_proto_mode = "disable_global", + importpath = "lukechampine.com/uint128", + sum = "h1:pnxCASz787iMf+02ssImqk6OLt+Z5QHMoZyUXR4z6JU=", + version = "v1.1.1", + ) + go_repository( + name = "com_shuralyov_dmitri_gpu_mtl", + build_file_proto_mode = "disable_global", + importpath = "dmitri.shuralyov.com/gpu/mtl", + sum = "h1:VpgP7xuJadIUuKccphEpTJnWhS2jkQyMt6Y7pJCD7fY=", + version = "v0.0.0-20190408044501-666a987793e9", + ) + go_repository( + name = "in_gopkg_alecthomas_kingpin_v2", + build_file_proto_mode = "disable_global", + importpath = "gopkg.in/alecthomas/kingpin.v2", + sum = "h1:jMFz6MfLP0/4fUyZle81rXUoxOBFi19VUFKVDOQfozc=", + version = "v2.2.6", + ) + + go_repository( + name = "in_gopkg_check_v1", + build_file_proto_mode = "disable_global", + importpath = "gopkg.in/check.v1", + sum = "h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=", + version = "v1.0.0-20201130134442-10cb98267c6c", + ) + go_repository( + name = "in_gopkg_cheggaaa_pb_v1", + build_file_proto_mode = "disable_global", + importpath = "gopkg.in/cheggaaa/pb.v1", + sum = "h1:n1tBJnnK2r7g9OW2btFH91V92STTUevLXYFb8gy9EMk=", + version = "v1.0.28", + ) + go_repository( + name = "in_gopkg_errgo_v2", + build_file_proto_mode = "disable_global", + importpath = "gopkg.in/errgo.v2", + sum = "h1:0vLT13EuvQ0hNvakwLuFZ/jYrLp5F3kcWHXdRggjCE8=", + version = "v2.1.0", + ) + go_repository( + name = "in_gopkg_fsnotify_v1", + build_file_proto_mode = "disable_global", + importpath = "gopkg.in/fsnotify.v1", + sum = "h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4=", + version = "v1.4.7", + ) + go_repository( + name = "in_gopkg_h2non_gock_v1", + build_file_proto_mode = "disable_global", + importpath = "gopkg.in/h2non/gock.v1", + sum = "h1:jBbHXgGBK/AoPVfJh5x4r/WxIrElvbLel8TCZkkZJoY=", + version = "v1.1.2", + ) + go_repository( + name = "in_gopkg_inf_v0", + build_file_proto_mode = "disable_global", + importpath = "gopkg.in/inf.v0", + sum = "h1:73M5CoZyi3ZLMOyDlQh031Cx6N9NDJ2Vvfl76EDAgDc=", + version = "v0.9.1", + ) + go_repository( + name = "in_gopkg_tomb_v1", + build_file_proto_mode = "disable_global", + importpath = "gopkg.in/tomb.v1", + sum = "h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ=", + version = "v1.0.0-20141024135613-dd632973f1e7", + ) + go_repository( + name = "in_gopkg_yaml_v2", + build_file_proto_mode = "disable_global", + importpath = "gopkg.in/yaml.v2", + sum = "h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=", + version = "v2.4.0", + ) + + go_repository( + name = "in_gopkg_yaml_v3", + build_file_proto_mode = "disable_global", + importpath = "gopkg.in/yaml.v3", + sum = "h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=", + version = "v3.0.1", + ) + go_repository( + name = "io_etcd_go_etcd_api_v3", + build_file_proto_mode = "disable_global", + importpath = "go.etcd.io/etcd/api/v3", + sum = "h1:BX4JIbQ7hl7+jL+g+2j5UAr0o1bctCm6/Ct+ArBGkf0=", + version = "v3.5.5", + ) + go_repository( + name = "io_etcd_go_etcd_client_pkg_v3", + build_file_proto_mode = "disable_global", + importpath = "go.etcd.io/etcd/client/pkg/v3", + sum = "h1:9S0JUVvmrVl7wCF39iTQthdaaNIiAaQbmK75ogO6GU8=", + version = "v3.5.5", + ) + go_repository( + name = "io_etcd_go_etcd_client_v3", + build_file_proto_mode = "disable_global", + importpath = "go.etcd.io/etcd/client/v3", + sum = "h1:q++2WTJbUgpQu4B6hCuT7VkdwaTP7Qz6Daak3WzbrlI=", + version = "v3.5.5", + ) + + go_repository( + name = "io_gorm_gorm", + build_file_proto_mode = "disable_global", + importpath = "gorm.io/gorm", + sum = "h1:TnlF26wScKSvknUC/Rn8t0NLLM22fypYBlvj1+aH6dM=", + version = "v1.23.5", + ) + go_repository( + name = "io_k8s_api", + build_file_proto_mode = "disable_global", + importpath = "k8s.io/api", + sum = "h1:3YO8J4RtmG7elEgaWMb4HgmpS2CfY1QlaOz9nwB+ZSs=", + version = "v0.25.4", + ) + go_repository( + name = "io_k8s_apimachinery", + build_file_proto_mode = "disable_global", + importpath = "k8s.io/apimachinery", + sum = "h1:CtXsuaitMESSu339tfhVXhQrPET+EiWnIY1rcurKnAc=", + version = "v0.25.4", + ) + go_repository( + name = "io_k8s_client_go", + build_file_proto_mode = "disable_global", + importpath = "k8s.io/client-go", + sum = "h1:3RNRDffAkNU56M/a7gUfXaEzdhZlYhoW8dgViGy5fn8=", + version = "v0.25.4", + ) + go_repository( + name = "io_k8s_gengo", + build_file_proto_mode = "disable_global", + importpath = "k8s.io/gengo", + sum = "h1:sAvhNk5RRuc6FNYGqe7Ygz3PSo/2wGWbulskmzRX8Vs=", + version = "v0.0.0-20200413195148-3a45101e95ac", + ) + go_repository( + name = "io_k8s_klog_v2", + build_file_proto_mode = "disable_global", + importpath = "k8s.io/klog/v2", + sum = "h1:7aaoSdahviPmR+XkS7FyxlkkXs6tHISSG03RxleQAVQ=", + version = "v2.70.1", + ) + go_repository( + name = "io_k8s_kube_openapi", + build_file_proto_mode = "disable_global", + importpath = "k8s.io/kube-openapi", + sum = "h1:MQ8BAZPZlWk3S9K4a9NCkIFQtZShWqoha7snGixVgEA=", + version = "v0.0.0-20220803162953-67bda5d908f1", + ) + go_repository( + name = "io_k8s_sigs_json", + build_file_proto_mode = "disable_global", + importpath = "sigs.k8s.io/json", + sum = "h1:iXTIw73aPyC+oRdyqqvVJuloN1p0AC/kzH07hu3NE+k=", + version = "v0.0.0-20220713155537-f223a00ba0e2", + ) + go_repository( + name = "io_k8s_sigs_structured_merge_diff_v4", + build_file_proto_mode = "disable_global", + importpath = "sigs.k8s.io/structured-merge-diff/v4", + sum = "h1:PRbqxJClWWYMNV1dhaG4NsibJbArud9kFxnAMREiWFE=", + version = "v4.2.3", + ) + go_repository( + name = "io_k8s_sigs_yaml", + build_file_proto_mode = "disable_global", + importpath = "sigs.k8s.io/yaml", + sum = "h1:kr/MCeFWJWTwyaHoR9c8EjH9OumOmoF9YGiZd7lFm/Q=", + version = "v1.2.0", + ) + go_repository( + name = "io_k8s_utils", + build_file_proto_mode = "disable_global", + importpath = "k8s.io/utils", + sum = "h1:jAne/RjBTyawwAy0utX5eqigAwz/lQhTmy+Hr/Cpue4=", + version = "v0.0.0-20220728103510-ee6ede2d64ed", + ) + go_repository( + name = "io_opencensus_go", + build_file_proto_mode = "disable_global", + importpath = "go.opencensus.io", + sum = "h1:LYy1Hy3MJdrCdMwwzxA/dRok4ejH+RwNGbuoD9fCjto=", + version = "v0.22.4", + ) + go_repository( + name = "io_opentelemetry_go_otel", + build_file_proto_mode = "disable_global", + importpath = "go.opentelemetry.io/otel", + sum = "h1:kfToEGMDq6TrVrJ9Vht84Y8y9enykSZzDDZglV0kIEk=", + version = "v1.11.0", + ) + go_repository( + name = "io_opentelemetry_go_otel_exporters_jaeger", + build_file_proto_mode = "disable_global", + importpath = "go.opentelemetry.io/otel/exporters/jaeger", + sum = "h1:Sv2valcFfMlfu6g8USSS+ZUN5vwbuGj1aY/CFtMG33w=", + version = "v1.11.0", + ) + go_repository( + name = "io_opentelemetry_go_otel_exporters_otlp_internal_retry", + build_file_proto_mode = "disable_global", + importpath = "go.opentelemetry.io/otel/exporters/otlp/internal/retry", + sum = "h1:0dly5et1i/6Th3WHn0M6kYiJfFNzhhxanrJ0bOfnjEo=", + version = "v1.11.0", + ) + go_repository( + name = "io_opentelemetry_go_otel_exporters_otlp_otlptrace", + build_file_proto_mode = "disable_global", + importpath = "go.opentelemetry.io/otel/exporters/otlp/otlptrace", + sum = "h1:eyJ6njZmH16h9dOKCi7lMswAnGsSOwgTqWzfxqcuNr8=", + version = "v1.11.0", + ) + go_repository( + name = "io_opentelemetry_go_otel_exporters_otlp_otlptrace_otlptracegrpc", + build_file_proto_mode = "disable_global", + importpath = "go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc", + sum = "h1:j2RFV0Qdt38XQ2Jvi4WIsQ56w8T7eSirYbMw19VXRDg=", + version = "v1.11.0", + ) + go_repository( + name = "io_opentelemetry_go_otel_exporters_zipkin", + build_file_proto_mode = "disable_global", + importpath = "go.opentelemetry.io/otel/exporters/zipkin", + sum = "h1:v/Abo5REOWrCj4zcEIUHFZtXpsCVjrwZj28iyX2rHXE=", + version = "v1.11.0", + ) + go_repository( + name = "io_opentelemetry_go_otel_sdk", + build_file_proto_mode = "disable_global", + importpath = "go.opentelemetry.io/otel/sdk", + sum = "h1:ZnKIL9V9Ztaq+ME43IUi/eo22mNsb6a7tGfzaOWB5fo=", + version = "v1.11.0", + ) + go_repository( + name = "io_opentelemetry_go_otel_trace", + build_file_proto_mode = "disable_global", + importpath = "go.opentelemetry.io/otel/trace", + sum = "h1:20U/Vj42SX+mASlXLmSGBg6jpI1jQtv682lZtTAOVFI=", + version = "v1.11.0", + ) + go_repository( + name = "io_opentelemetry_go_proto_otlp", + build_file_proto_mode = "disable_global", + importpath = "go.opentelemetry.io/proto/otlp", + sum = "h1:IVN6GR+mhC4s5yfcTbmzHYODqvWAp3ZedA2SJPI1Nnw=", + version = "v0.19.0", + ) + go_repository( + name = "io_rsc_binaryregexp", + build_file_proto_mode = "disable_global", + importpath = "rsc.io/binaryregexp", + sum = "h1:HfqmD5MEmC0zvwBuF187nq9mdnXjXsSivRiXN7SmRkE=", + version = "v0.2.0", + ) + go_repository( + name = "io_rsc_quote_v3", + build_file_proto_mode = "disable_global", + importpath = "rsc.io/quote/v3", + sum = "h1:9JKUTTIUgS6kzR9mK1YuGKv6Nl+DijDNIc0ghT58FaY=", + version = "v3.1.0", + ) + go_repository( + name = "io_rsc_sampler", + build_file_proto_mode = "disable_global", + importpath = "rsc.io/sampler", + sum = "h1:7uVkIFmeBqHfdjD+gZwtXXI+RODJ2Wc4O7MPEh/QiW4=", + version = "v1.3.0", + ) + go_repository( + name = "org_golang_google_api", + build_file_proto_mode = "disable_global", + importpath = "google.golang.org/api", + sum = "h1:yfrXXP61wVuLb0vBcG6qaOoIoqYEzOQS8jum51jkv2w=", + version = "v0.30.0", + ) + go_repository( + name = "org_golang_google_appengine", + build_file_proto_mode = "disable_global", + importpath = "google.golang.org/appengine", + sum = "h1:FZR1q0exgwxzPzp/aF+VccGrSfxfPpkBqjIIEq3ru6c=", + version = "v1.6.7", + ) + go_repository( + name = "org_golang_google_genproto", + build_file_proto_mode = "disable_global", + importpath = "google.golang.org/genproto", + sum = "h1:qRu95HZ148xXw+XeZ3dvqe85PxH4X8+jIo0iRPKcEnM=", + version = "v0.0.0-20220602131408-e326c6e8e9c8", + ) + go_repository( + name = "org_golang_google_grpc", + build_file_proto_mode = "disable_global", + importpath = "google.golang.org/grpc", + sum = "h1:E1eGv1FTqoLIdnBCZufiSHgKjlqG6fKFf6pPWtMTh8U=", + version = "v1.51.0", + ) + go_repository( + name = "org_golang_google_protobuf", + build_file_proto_mode = "disable_global", + importpath = "google.golang.org/protobuf", + sum = "h1:d0NfwRgPtno5B1Wa6L2DAG+KivqkdutMf1UhdNx175w=", + version = "v1.28.1", + ) + + go_repository( + name = "org_golang_x_crypto", + build_file_proto_mode = "disable_global", + importpath = "golang.org/x/crypto", + sum = "h1:sK3txAijHtOK88l68nt020reeT1ZdKLIYetKl95FzVY=", + version = "v0.0.0-20220622213112-05595931fe9d", + ) + go_repository( + name = "org_golang_x_exp", + build_file_proto_mode = "disable_global", + importpath = "golang.org/x/exp", + sum = "h1:QE6XYQK6naiK1EPAe1g/ILLxN5RBoH5xkJk3CqlMI/Y=", + version = "v0.0.0-20200224162631-6cc2880d07d6", + ) + go_repository( + name = "org_golang_x_image", + build_file_proto_mode = "disable_global", + importpath = "golang.org/x/image", + sum = "h1:+qEpEAPhDZ1o0x3tHzZTQDArnOixOzGD9HUJfcg0mb4=", + version = "v0.0.0-20190802002840-cff245a6509b", + ) + go_repository( + name = "org_golang_x_lint", + build_file_proto_mode = "disable_global", + importpath = "golang.org/x/lint", + sum = "h1:VLliZ0d+/avPrXXH+OakdXhpJuEoBZuwh1m2j7U6Iug=", + version = "v0.0.0-20210508222113-6edffad5e616", + ) + go_repository( + name = "org_golang_x_mobile", + build_file_proto_mode = "disable_global", + importpath = "golang.org/x/mobile", + sum = "h1:4+4C/Iv2U4fMZBiMCc98MG1In4gJY5YRhtpDNeDeHWs=", + version = "v0.0.0-20190719004257-d2bd2a29d028", + ) + + go_repository( + name = "org_golang_x_mod", + build_file_proto_mode = "disable_global", + importpath = "golang.org/x/mod", + sum = "h1:LapD9S96VoQRhi/GrNTqeBJFrUjs5UHCAtTlgwA5oZA=", + version = "v0.7.0", + ) + go_repository( + name = "org_golang_x_net", + build_file_proto_mode = "disable_global", + importpath = "golang.org/x/net", + sum = "h1:VWL6FNY2bEEmsGVKabSlHu5Irp34xmMRoqb/9lF9lxk=", + version = "v0.3.0", + ) + go_repository( + name = "org_golang_x_oauth2", + build_file_proto_mode = "disable_global", + importpath = "golang.org/x/oauth2", + sum = "h1:clP8eMhB30EHdc0bd2Twtq6kgU7yl5ub2cQLSdrv1Dg=", + version = "v0.0.0-20220223155221-ee480838109b", + ) + + go_repository( + name = "org_golang_x_sync", + build_file_proto_mode = "disable_global", + importpath = "golang.org/x/sync", + sum = "h1:wsuoTGHzEhffawBOhz5CYhcrV4IdKZbEyZjBMuTp12o=", + version = "v0.1.0", + ) + go_repository( + name = "org_golang_x_sys", + build_file_proto_mode = "disable_global", + importpath = "golang.org/x/sys", + sum = "h1:w8ZOecv6NaNa/zC8944JTU3vz4u6Lagfk4RPQxv92NQ=", + version = "v0.3.0", + ) + go_repository( + name = "org_golang_x_term", + build_file_proto_mode = "disable_global", + importpath = "golang.org/x/term", + sum = "h1:qoo4akIqOcDME5bhc/NgxUdovd6BSS2uMsVjB56q1xI=", + version = "v0.3.0", + ) + + go_repository( + name = "org_golang_x_text", + build_file_proto_mode = "disable_global", + importpath = "golang.org/x/text", + sum = "h1:OLmvp0KP+FVG99Ct/qFiL/Fhk4zp4QQnZ7b2U+5piUM=", + version = "v0.5.0", + ) + go_repository( + name = "org_golang_x_time", + build_file_proto_mode = "disable_global", + importpath = "golang.org/x/time", + sum = "h1:+gHMid33q6pen7kv9xvT+JRinntgeXO2AeZVd0AWD3w=", + version = "v0.0.0-20220411224347-583f2d630306", + ) + + go_repository( + name = "org_golang_x_tools", + build_file_proto_mode = "disable_global", + importpath = "golang.org/x/tools", + sum = "h1:7mTAgkunk3fr4GAloyyCasadO6h9zSsQZbwvcaIciV4=", + version = "v0.4.0", + ) + go_repository( + name = "org_golang_x_xerrors", + build_file_proto_mode = "disable_global", + importpath = "golang.org/x/xerrors", + sum = "h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE=", + version = "v0.0.0-20200804184101-5ec99f83aff1", + ) + go_repository( + name = "org_modernc_cc_v3", + build_file_proto_mode = "disable_global", + importpath = "modernc.org/cc/v3", + sum = "h1:0kmRkTmqNidmu3c7BNDSdVHCxXCkWLmWmCIVX4LUboo=", + version = "v3.36.0", + ) + go_repository( + name = "org_modernc_ccgo_v3", + build_file_proto_mode = "disable_global", + importpath = "modernc.org/ccgo/v3", + sum = "h1:3l18poV+iUemQ98O3X5OMr97LOqlzis+ytivU4NqGhA=", + version = "v3.16.6", + ) + go_repository( + name = "org_modernc_ccorpus", + build_file_proto_mode = "disable_global", + importpath = "modernc.org/ccorpus", + sum = "h1:J16RXiiqiCgua6+ZvQot4yUuUy8zxgqbqEEUuGPlISk=", + version = "v1.11.6", + ) + go_repository( + name = "org_modernc_httpfs", + build_file_proto_mode = "disable_global", + importpath = "modernc.org/httpfs", + sum = "h1:AAgIpFZRXuYnkjftxTAZwMIiwEqAfk8aVB2/oA6nAeM=", + version = "v1.0.6", + ) + go_repository( + name = "org_modernc_libc", + build_file_proto_mode = "disable_global", + importpath = "modernc.org/libc", + sum = "h1:Ux98PaOMvolgoFX/YwusFOHBnanXdGRmWgI8ciI2z4o=", + version = "v1.16.8", + ) + go_repository( + name = "org_modernc_mathutil", + build_file_proto_mode = "disable_global", + importpath = "modernc.org/mathutil", + sum = "h1:ij3fYGe8zBF4Vu+g0oT7mB06r8sqGWKuJu1yXeR4by8=", + version = "v1.4.1", + ) + go_repository( + name = "org_modernc_memory", + build_file_proto_mode = "disable_global", + importpath = "modernc.org/memory", + sum = "h1:bDOL0DIDLQv7bWhP3gMvIrnoFw+Eo6F7a2QK9HPDiFU=", + version = "v1.1.1", + ) + go_repository( + name = "org_modernc_opt", + build_file_proto_mode = "disable_global", + importpath = "modernc.org/opt", + sum = "h1:/0RX92k9vwVeDXj+Xn23DKp2VJubL7k8qNffND6qn3A=", + version = "v0.1.1", + ) + go_repository( + name = "org_modernc_sqlite", + build_file_proto_mode = "disable_global", + importpath = "modernc.org/sqlite", + sum = "h1:TjmF36Wi5QcPYqRoAacV1cAyJ7xB/CD0ExpVUEMebnw=", + version = "v1.17.2", + ) + go_repository( + name = "org_modernc_strutil", + build_file_proto_mode = "disable_global", + importpath = "modernc.org/strutil", + sum = "h1:xv+J1BXY3Opl2ALrBwyfEikFAj8pmqcpnfmuwUwcozs=", + version = "v1.1.1", + ) + go_repository( + name = "org_modernc_tcl", + build_file_proto_mode = "disable_global", + importpath = "modernc.org/tcl", + sum = "h1:npxzTwFTZYM8ghWicVIX1cRWzj7Nd8i6AqqX2p+IYao=", + version = "v1.13.1", + ) + go_repository( + name = "org_modernc_token", + build_file_proto_mode = "disable_global", + importpath = "modernc.org/token", + sum = "h1:a0jaWiNMDhDUtqOj09wvjWWAqd3q7WpBulmL9H2egsk=", + version = "v1.0.0", + ) + go_repository( + name = "org_modernc_z", + build_file_proto_mode = "disable_global", + importpath = "modernc.org/z", + sum = "h1:RTNHdsrOpeoSeOF4FbzTo8gBYByaJ5xT7NgZ9ZqRiJM=", + version = "v1.5.1", + ) + go_repository( + name = "org_mongodb_go_mongo_driver", + build_file_proto_mode = "disable_global", + importpath = "go.mongodb.org/mongo-driver", + sum = "h1:XDQEvmh6z1EUsXuIkXE9TaVeqHw6SwS1uf93jFs0HBA=", + version = "v1.10.3", + ) + go_repository( + name = "org_uber_go_atomic", + build_file_proto_mode = "disable_global", + importpath = "go.uber.org/atomic", + sum = "h1:ECmE8Bn/WFTYwEW/bpKD3M8VtR/zQVbavAoalC1PYyE=", + version = "v1.9.0", + ) + go_repository( + name = "org_uber_go_automaxprocs", + build_file_proto_mode = "disable_global", + importpath = "go.uber.org/automaxprocs", + sum = "h1:e1YG66Lrk73dn4qhg8WFSvhF0JuFQF0ERIp4rpuV8Qk=", + version = "v1.5.1", + ) + go_repository( + name = "org_uber_go_goleak", + build_file_proto_mode = "disable_global", + importpath = "go.uber.org/goleak", + sum = "h1:xqgm/S+aQvhWFTtR0XK3Jvg7z8kGV8P4X14IzwN3Eqk=", + version = "v1.2.0", + ) + go_repository( + name = "org_uber_go_multierr", + build_file_proto_mode = "disable_global", + importpath = "go.uber.org/multierr", + sum = "h1:dg6GjLku4EH+249NNmoIciG9N/jURbDG+pFlTkhzIC8=", + version = "v1.8.0", + ) + go_repository( + name = "org_uber_go_zap", + build_file_proto_mode = "disable_global", + importpath = "go.uber.org/zap", + sum = "h1:WefMeulhovoZ2sYXz7st6K0sLj7bBhpiFaud4r4zST8=", + version = "v1.21.0", + ) + go_repository( + name = "com_github_deckarep_golang_set", + build_file_proto_mode = "disable_global", + importpath = "github.com/deckarep/golang-set", + sum = "h1:sk9/l/KqpunDwP7pSjUg0keiOOLEnOBHzykLrsPppp4=", + version = "v1.8.0", + ) diff --git a/doc/4_godelscript_language.en.md b/doc/4_godelscript_language.en.md index 02b90462..7f6425d9 100644 --- a/doc/4_godelscript_language.en.md +++ b/doc/4_godelscript_language.en.md @@ -1172,10 +1172,18 @@ fn default_java_db() -> JavaDB { return JavaDB::load("coref_java_src.db") } +fn usedMethod(m: Method) -> bool { + for(c in CallableBinding(default_java_db())) { + if (c.getCallee().key_eq(m)) { + return true + } + } +} + // find unused methods fn unused_method(unused: string) -> bool { - for(c in Callable(default_java_db()), method in Callable(default_java_db()), caller in method.getCaller()) { - if (c != caller && unused = method.getSignature()) { + for(m in Method(default_java_db())) { + if (!usedMethod(m) && unused = m.getSignature()) { return true } } diff --git a/doc/4_godelscript_language.md b/doc/4_godelscript_language.md index 9e24a3c4..8d73cad0 100644 --- a/doc/4_godelscript_language.md +++ b/doc/4_godelscript_language.md @@ -1172,10 +1172,18 @@ fn default_java_db() -> JavaDB { return JavaDB::load("coref_java_src.db") } +fn usedMethod(m: Method) -> bool { + for(c in CallableBinding(default_java_db())) { + if (c.getCallee().key_eq(m)) { + return true + } + } +} + // find unused methods fn unused_method(unused: string) -> bool { - for(c in Callable(default_java_db()), method in Callable(default_java_db()), caller in method.getCaller()) { - if (c != caller && unused = method.getSignature()) { + for(m in Method(default_java_db())) { + if (!usedMethod(m) && unused = m.getSignature()) { return true } } diff --git a/doc/index.md b/doc/index.md index 779bb822..8a214a45 100644 --- a/doc/index.md +++ b/doc/index.md @@ -3,6 +3,16 @@ title: Home layout: default nav_order: 1 --- -## 文档 (Documentation) +# 文档 (Documentation) -请见[仓库首页](https://github.com/codefuse-ai/CodeFuse-Query) +* 请见[仓库首页](https://github.com/codefuse-ai/CodeFuse-Query) + +# COREF Library Reference + +* [coref::cfamily](./godel-api/cfamily/reference.html) +* [coref::go](./godel-api/go/reference.html) +* [coref::java](./godel-api/java/reference.html) +* [coref::javascript](./godel-api/javascript/reference.html) +* [coref::properties](./godel-api/properties/reference.html) +* [coref::python](./godel-api/python/reference.html) +* [coref::xml](./godel-api/xml/reference.html) diff --git a/doc/tools/build.py b/doc/tools/build.py index d661ba8b..24280c51 100644 --- a/doc/tools/build.py +++ b/doc/tools/build.py @@ -4,7 +4,7 @@ subprocess.run([ "curl", "-L", - "https://github.com/codefuse-ai/CodeFuse-Query/releases/download/2.0.2/sparrow-cli-2.0.2.linux.tar.gz", + "https://github.com/codefuse-ai/CodeFuse-Query/releases/download/2.1.0/sparrow-cli-2.1.0.linux.tar.gz", "-o", "sparrow-cli.tar.gz" ]) @@ -18,4 +18,4 @@ print("Concat coref library from ../language into ./.coref-api-build") subprocess.run(["python3", "tools/generate_coref_library.py", "../language"]) print("Generate markdown documents into ./godel-api") -subprocess.run(["python3", "tools/generate_markdown.py", "./sparrow-cli/godel-script/usr/bin/godel"]) \ No newline at end of file +subprocess.run(["python3", "tools/generate_markdown.py", "./sparrow-cli/godel-script/usr/bin/godel"]) diff --git a/doc/tools/generate_coref_library.py b/doc/tools/generate_coref_library.py index 1fd9ad5c..f588548f 100644 --- a/doc/tools/generate_coref_library.py +++ b/doc/tools/generate_coref_library.py @@ -11,14 +11,19 @@ if not os.path.exists("./.coref-api-build"): os.mkdir("./.coref-api-build") +# merge library files into one file mapper = { + "coref.cfamily.gdl": input_language_dir + "/cfamily/lib", "coref.go.gdl": input_language_dir + "/go/lib", "coref.java.gdl": input_language_dir + "/java/lib", "coref.javascript.gdl": input_language_dir + "/javascript/lib", + "coref.properties.gdl": input_language_dir + "/properties/lib", "coref.python.gdl": input_language_dir + "/python/lib", + # "coref.sql.gdl": input_language_dir + "/sql/lib", "coref.xml.gdl": input_language_dir + "/xml/lib", } +# store merged files into .coref-api-build for key in mapper.keys(): output_file = "./.coref-api-build/" + key result = "" diff --git a/doc/tools/generate_markdown.py b/doc/tools/generate_markdown.py index 9169ddcb..ab104ada 100644 --- a/doc/tools/generate_markdown.py +++ b/doc/tools/generate_markdown.py @@ -92,9 +92,12 @@ def dump_database(database) -> str: result += "[*" + table["type"]["name"] + "](./schema/" + table["type"]["name"] + ".html)\n" return result -def dump_schema(comment_list, schema) -> str: +def dump_schema(comment_list, schema, library_name) -> str: result = "---\n" result += "layout: default\n" + result += "title: " + schema["name"] + "\n" + result += "parent: \"schema of coref::" + library_name + "\"\n" + result += "grand_parent: \"coref::" + library_name + "\"\n" result += "---\n\n" result += "# " + schema["name"] + "\n\n" comment_of_schema = match_schema_comment(comment_list, schema) @@ -199,7 +202,7 @@ def dump_schema_tree_view(schema_list) -> str: "coref.javascript.gdl": "javascript", "coref.properties.gdl": "properties", "coref.python.gdl": "python", - "coref.sql.gdl": "sql", + # "coref.sql.gdl": "sql", "coref.xml.gdl": "xml" } @@ -216,22 +219,6 @@ def dump_schema_tree_view(schema_list) -> str: continue semantic_dict[file["name"]] = result.stdout.decode("utf-8") -def dump_reference_main_doc(): - output_file_path = markdown_output_path + "/coref_library_reference.md" - output_data = "---\n" - output_data += "title: \"COREF Library Reference\"\n" - output_data += "layout: default\n" - output_data += "nav_order: 2\n" - output_data += "has_children: true\n" - output_data += "---\n\n" - output_data += "# COREF Library Reference\n\n" - for file in input_file_list: - output_data += "* [coref::" + name_mapper[file["name"]] + "]" - output_data += "(./" + name_mapper[file["name"]] + "/reference.html)\n" - open(output_file_path, "w").write(output_data) - -dump_reference_main_doc() - assets_count = 0 for file in input_file_list: @@ -245,8 +232,8 @@ def dump_reference_main_doc(): output_data = "---\n" output_data += "title: \"coref::" + name_mapper[file["name"]] + "\"\n" output_data += "layout: default\n" + output_data += "nav_order: 2\n" output_data += "has_children: true\n" - output_data += "parent: \"COREF Library Reference\"\n" output_data += "---\n" output_data += "# COREF Library Reference for " + name_mapper[file["name"]] + "\n\n" output_data += "* coref::" + name_mapper[file["name"]] + " [database](./database.html)\n" @@ -259,8 +246,8 @@ def dump_reference_main_doc(): output_data = "---\n" output_data += "title: \"database\"\n" output_data += "layout: default\n" + output_data += "nav_order: 3\n" output_data += "parent: \"coref::" + name_mapper[file["name"]] + "\"\n" - output_data += "grand_parent: \"COREF Library Reference\"\n" output_data += "---\n" output_data += "# Database of " + file["name"] + "\n\n" database_list = semantic_info["semantic"]["database"] @@ -277,8 +264,8 @@ def dump_reference_main_doc(): output_data = "---\n" output_data += "title: \"function\"\n" output_data += "layout: default\n" + output_data += "nav_order: 3\n" output_data += "parent: \"coref::" + name_mapper[file["name"]] + "\"\n" - output_data += "grand_parent: \"COREF Library Reference\"\n" output_data += "---\n" output_data += "# Global Function of " + file["name"] + "\n\n" for function in function_list: @@ -303,17 +290,18 @@ def dump_reference_main_doc(): assets_count += len(schema_list) print("Generate schema documents for", file_full_path, ":", len(schema_list)) for schema in schema_list: - output_data = dump_schema(comment_list, schema) + output_data = dump_schema(comment_list, schema, name_mapper[file["name"]]) output_file_path = markdown_output_path + "/" + name_mapper[file["name"]] + "/schema/" + schema["name"] + ".md" open(output_file_path, "w").write(output_data) # generate schema hierarchy document assets_count += 1 output_data = "---\n" - output_data += "title: \"schema\"\n" + output_data += "title: \"schema of coref::" + name_mapper[file["name"]] + "\"\n" output_data += "layout: default\n" output_data += "parent: \"coref::" + name_mapper[file["name"]] + "\"\n" - output_data += "grand_parent: \"COREF Library Reference\"\n" + output_data += "nav_order: 3\n" + output_data += "has_children: true\n" output_data += "---\n" output_data += "# Schema of " + file["name"] + "\n\n" output_data += dump_schema_tree_view(schema_list) diff --git a/example/icse25/Keymap/FindAllReleasedHttpAPI.gdl b/example/icse25/Keymap/FindAllReleasedHttpAPI.gdl new file mode 100644 index 00000000..b29585fe --- /dev/null +++ b/example/icse25/Keymap/FindAllReleasedHttpAPI.gdl @@ -0,0 +1,1339 @@ +// script +use coref::xml::* +use coref::java::* +@inline +pub fn trim(n: string, m: string) -> bool { + let (xml_db = default_xml_db()) { + let (java_db = default_java_db()) { + for (i in int::__undetermined_all__(), + i1 in int::__undetermined_all__(), + temp in string::__undetermined_all__()) { + if (i = n.len()) { + if (tmp_0(n)) { + if (temp = n.substr(1,i - 2)) { + if (i1 = temp.len()) { + if (tmp_1(temp)) { + if (m = temp.substr(1,i1 - 2)) { + return true + } + } + if (!(tmp_1(temp))) { + if (tmp_2(temp)) { + if (m = temp.substr(2,i1 - 4)) { + return true + } + } + if (!(tmp_2(temp))) { + if (m = temp) { + return true + } + } + } + } + } + } + if (!(tmp_0(n))) { + if (tmp_3(n)) { + if (m = n.substr(1,i - 2)) { + return true + } + } + if (!(tmp_3(n))) { + if (tmp_4(n)) { + if (m = n.substr(2,i - 4)) { + return true + } + } + if (!(tmp_4(n))) { + if (m = n) { + return true + } + } + } + } + } + } + } + } +} +@inline +pub fn contact(a: string, b: string, c: string) -> bool { + let (xml_db = default_xml_db()) { + let (java_db = default_java_db()) { + for (i in int::__undetermined_all__(), + temp in string::__undetermined_all__()) { + if (i = a.len()) { + if (tmp_5(i)) { + if (tmp_6(b, a)) { + if (c = b) { + return true + } + } + if (!(tmp_6(b, a))) { + if (c = a + b) { + return true + } + } + } + if (!(tmp_5(i))) { + if (tmp_7(b, i, a)) { + if (temp = a.substr(1,i - 1)) { + if (c = a + b) { + return true + } + } + } + if (!(tmp_7(b, i, a))) { + if (tmp_8(b, i, a)) { + if (c = a + "/" + b) { + return true + } + } + if (!(tmp_8(b, i, a))) { + if (c = a + b) { + return true + } + } + } + } + } + } + } + } +} +schema HttpMethodType extends AnnotationAccessArgument { + +} + +impl HttpMethodType { + + @data_constraint + @inline + pub fn __all__(db: JavaDB) -> *HttpMethodType { + for (tmp in AnnotationAccessArgument(db)) { + if (tmp.getAnnotationArgumentName() = "method") { + yield HttpMethodType { + id : tmp.id + } + } + } + } + + pub fn getType(self) -> string { + for (t in string::__undetermined_all__()) { + for (a in AnnotationArrayInitializer(__all_data__)) { + if (self.getArgumentValueHashId() = a.element_hash_id) { + for (i in Identifier(__all_data__), + r in ReferenceExpression(__all_data__)) { + if (a.key_eq(r.getParent())) { + if (r.key_eq(i.getParent())) { + if (t = i.getName()) { + return t + } + } + } + } + } + } + for (i in Identifier(__all_data__)) { + if (self.getArgumentValueHashId() = i.getParent().id) { + if (t = i.getName()) { + return t + } + } + } + } + } + + +} + +pub fn getMethodType(a: Annotation, t: string) -> bool { + let (xml_db = default_xml_db()) { + let (java_db = default_java_db()) { + for (m in Method(java_db), + h in HttpMethodType(java_db)) { + for (auto_tmp1 in m.getAnnotation()) { + if (a = auto_tmp1) { + if (tmp_9(a)) { + if (t = "POST") { + return true + } + } + if (!(tmp_9(a))) { + if (tmp_10(a)) { + if (t = "GET") { + return true + } + } + if (!(tmp_10(a))) { + if (tmp_11(a)) { + if (t = "PUT") { + return true + } + } + if (!(tmp_11(a))) { + if (tmp_12(a)) { + if (t = "DELETE") { + return true + } + } + if (!(tmp_12(a))) { + if (tmp_13(a)) { + if (t = "PATCH") { + return true + } + } + if (!(tmp_13(a))) { + for (auto_tmp2 in a.getAnnotationArgument()) { + if (h.key_eq(auto_tmp2)) { + if (t = h.getType()) { + return true + } + } + } + } + } + } + } + } + } + } + } + } + } +} +pub fn existsValueArgument(a: Annotation) -> bool { + let (xml_db = default_xml_db()) { + let (java_db = default_java_db()) { + for (temp in AnnotationAccessArgument(java_db)) { + for (auto_tmp1 in a.getAnnotationArgument()) { + if (temp = auto_tmp1) { + if (temp.getAnnotationArgumentName() = "value") { + return true + } + } + } + } + } + } +} +pub fn getSubUri(a: Annotation, sub: string) -> bool { + let (xml_db = default_xml_db()) { + let (java_db = default_java_db()) { + for (n in string::__undetermined_all__()) { + if (n = a.getName()) { + if (n.matches(".*Mapping")) { + if (tmp_14(a)) { + for (s in string::__undetermined_all__()) { + for (temp in AnnotationAccessArgument(java_db), + e in Expression(java_db)) { + for (auto_tmp1 in a.getAnnotationArgument()) { + if (temp = auto_tmp1) { + if (temp.getAnnotationArgumentName() = "value") { + if (tmp_15(e, temp)) { + if (sub = connectStr(e)) { + return true + } + } + if (!(tmp_15(e, temp))) { + if (s = temp.getAnnotationArgumentValue()) { + if (trim(s, sub)) { + return true + } + } + } + } + } + } + } + } + } + if (!(tmp_14(a))) { + if (sub = "") { + return true + } + } + } + } + } + for (b in Annotation(java_db)) { + if (a.getAnnotatedMethod() = b.getAnnotatedMethod()) { + if (a.getName() = "POST") { + if (b.getName() = "Path") { + if (tmp_16(b)) { + for (s in string::__undetermined_all__()) { + for (temp in AnnotationAccessArgument(java_db), + e in Expression(java_db)) { + for (auto_tmp2 in b.getAnnotationArgument()) { + if (temp = auto_tmp2) { + if (temp.getAnnotationArgumentName() = "value") { + if (tmp_17(e, temp)) { + if (sub = connectStr(e)) { + return true + } + } + if (!(tmp_17(e, temp))) { + if (s = temp.getAnnotationArgumentValue()) { + if (trim(s, sub)) { + return true + } + } + } + } + } + } + } + } + } + if (!(tmp_16(b))) { + if (sub = "") { + return true + } + } + } + } + if (a.getName() = "GET") { + if (b.getName() = "Path") { + if (tmp_16(b)) { + for (s in string::__undetermined_all__()) { + for (temp in AnnotationAccessArgument(java_db), + e in Expression(java_db)) { + for (auto_tmp2 in b.getAnnotationArgument()) { + if (temp = auto_tmp2) { + if (temp.getAnnotationArgumentName() = "value") { + if (tmp_17(e, temp)) { + if (sub = connectStr(e)) { + return true + } + } + if (!(tmp_17(e, temp))) { + if (s = temp.getAnnotationArgumentValue()) { + if (trim(s, sub)) { + return true + } + } + } + } + } + } + } + } + } + if (!(tmp_16(b))) { + if (sub = "") { + return true + } + } + } + } + } + } + } + } +} +pub fn getSubUri1(a: Annotation, sub: string) -> bool { + let (xml_db = default_xml_db()) { + let (java_db = default_java_db()) { + if ("Path" = a.getName()) { + if (tmp_18(a)) { + for (s in string::__undetermined_all__()) { + for (temp in AnnotationAccessArgument(java_db), + e in Expression(java_db)) { + for (auto_tmp1 in a.getAnnotationArgument()) { + if (temp = auto_tmp1) { + if (temp.getAnnotationArgumentName() = "value") { + if (tmp_19(e, temp)) { + if (sub = connectStr(e)) { + return true + } + } + if (!(tmp_19(e, temp))) { + if (s = temp.getAnnotationArgumentValue()) { + if (trim(s, sub)) { + return true + } + } + } + } + } + } + } + } + } + if (!(tmp_18(a))) { + if (sub = "") { + return true + } + } + } + } + } +} +pub fn getUri(c: ClassOrInterface, m: Method, uri1: string) -> bool { + let (xml_db = default_xml_db()) { + let (java_db = default_java_db()) { + for (l1 in string::__undetermined_all__(), + l2 in string::__undetermined_all__(), + uri in string::__undetermined_all__(), + n in string::__undetermined_all__()) { + for (a in Annotation(java_db), + a1 in Annotation(java_db)) { + if (c = m.getParent()) { + for (auto_tmp1 in m.getAnnotation()) { + if (a = auto_tmp1) { + for (auto_tmp2 in c.getAnnotation()) { + if (a1 = auto_tmp2) { + if (n = a.getName()) { + if (tmp_21(c)) { + for (temp1 in string::__undetermined_all__(), + temp2 in string::__undetermined_all__()) { + if (getSubUri1(a1, temp1)) { + if (getSubUri(a, temp2)) { + if (contact(temp1, temp2, uri)) { + if (contactUri(uri, uri1)) { + return true + } + } + } + } + } + } + if (!(tmp_21(c))) { + if (tmp_23(c)) { + if (getSubUri(a, uri)) { + if (contactUri(uri, uri1)) { + return true + } + } + } + if (!(tmp_23(c))) { + if (tmp_25(a)) { + if (tmp_26(n)) { + if (getSubUri(a1, uri)) { + if (contactUri(uri, uri1)) { + return true + } + } + } + if (!(tmp_26(n))) { + if (getSubUri(a, l1)) { + if (getSubUri(a1, l2)) { + if (contact(l2, l1, uri)) { + if (contactUri(uri, uri1)) { + return true + } + } + } + } + } + } + if (!(tmp_25(a))) { + if (a1.getName() = "RequestMapping") { + if (getSubUri(a, l1)) { + if (getSubUri(a1, l2)) { + if (contact(l2, l1, uri)) { + if (contactUri(uri, uri1)) { + return true + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } +} +pub fn resolve(r: ReferenceExpression, rr: string) -> bool { + let (xml_db = default_xml_db()) { + let (java_db = default_java_db()) { + for (temp in string::__undetermined_all__()) { + for (e in Expression(java_db)) { + if (e.getParent() = r.getDefinition()) { + if (temp = e.getPrintableText()) { + if (trim(temp, rr)) { + return true + } + } + } + } + } + } + } +} +pub fn facts(a: Expression, i: int, value: string) -> bool { + let (xml_db = default_xml_db()) { + let (java_db = default_java_db()) { + for (p in PolyadicExpression(java_db)) { + if (a.key_eq(p)) { + for (temp in string::__undetermined_all__()) { + for (e in Expression(java_db)) { + if (tmp_27(a)) { + if (resolve(ReferenceExpression(java_db).find(a), value)) { + if (i = 0) { + return true + } + } + } + if (!(tmp_27(a))) { + if (a.key_eq(e.getParent())) { + if (i = e.getIndex()) { + if (tmp_28(e)) { + if (resolve(ReferenceExpression(java_db).find(e), value)) { + return true + } + } + if (!(tmp_28(e))) { + if (temp = e.getPrintableText()) { + if (trim(temp, value)) { + return true + } + } + } + } + } + } + } + } + } + } + for (p in BinaryExpression(java_db)) { + if (a.key_eq(p)) { + for (temp in string::__undetermined_all__()) { + for (e in Expression(java_db)) { + if (tmp_27(a)) { + if (resolve(ReferenceExpression(java_db).find(a), value)) { + if (i = 0) { + return true + } + } + } + if (!(tmp_27(a))) { + if (a.key_eq(e.getParent())) { + if (i = e.getIndex()) { + if (tmp_28(e)) { + if (resolve(ReferenceExpression(java_db).find(e), value)) { + return true + } + } + if (!(tmp_28(e))) { + if (temp = e.getPrintableText()) { + if (trim(temp, value)) { + return true + } + } + } + } + } + } + } + } + } + } + for (p in ReferenceExpression(java_db)) { + if (a.key_eq(p)) { + for (temp in string::__undetermined_all__()) { + for (e in Expression(java_db)) { + if (tmp_27(a)) { + if (resolve(ReferenceExpression(java_db).find(a), value)) { + if (i = 0) { + return true + } + } + } + if (!(tmp_27(a))) { + if (a.key_eq(e.getParent())) { + if (i = e.getIndex()) { + if (tmp_28(e)) { + if (resolve(ReferenceExpression(java_db).find(e), value)) { + return true + } + } + if (!(tmp_28(e))) { + if (temp = e.getPrintableText()) { + if (trim(temp, value)) { + return true + } + } + } + } + } + } + } + } + } + } + } + } +} +pub fn connectStrBase(ID: Expression, index: int, res: string) -> bool { + let (xml_db = default_xml_db()) { + let (java_db = default_java_db()) { + for (total in int::__undetermined_all__(), + reStr in string::__undetermined_all__(), + currStr in string::__undetermined_all__()) { + if (total = tmp_29(ID).len()) { + if (tmp_31(index)) { + if (facts(Expression(java_db).find(ID), index, currStr)) { + if (res = currStr) { + return true + } + } + } + if (!(tmp_31(index))) { + if (index > 0) { + if (connectStrBase(ID, index - 1, reStr)) { + if (facts(Expression(java_db).find(ID), index, currStr)) { + if (res = reStr + currStr) { + return true + } + } + } + } + } + } + } + } + } +} +pub fn connectStr(ID: Expression) -> string { + let (xml_db = default_xml_db()) { + let (java_db = default_java_db()) { + for (c in int::__undetermined_all__(), + res in string::__undetermined_all__()) { + if (c = tmp_32(ID).len()) { + if (connectStrBase(ID, c - 1, res)) { + return res + } + } + } + } + } +} +pub fn findReleasedHttpAPI(m: Method, c: ClassOrInterface, path: string, uri: string, type: string) -> bool { + let (xml_db = default_xml_db()) { + let (java_db = default_java_db()) { + for (temp1 in string::__undetermined_all__(), + temp2 in string::__undetermined_all__(), + uri1 in string::__undetermined_all__(), + temp3 in string::__undetermined_all__()) { + for (w in Folder(java_db), + f in Folder(java_db)) { + if (findReleasedHttpAPI1(m, c, uri1, type)) { + if (tmp_34(w)) { + for (ww in WebFolder(java_db)) { + if (ww.key_eq(w)) { + if (path = ww.getRelativePath()) { + if (f = c.getLocation().getFile().getBelongedFolder()) { + if (temp1 = f.getRelativePath()) { + if (temp2 = path + "/") { + if (temp1.contains(temp2)) { + if (temp3 = ww.getModuleName()) { + if (uri = temp3 + uri1) { + return true + } + } + } + } + } + } + } + } + } + } + if (!(tmp_34(w))) { + if (path = "null") { + if (uri = uri1) { + return true + } + } + } + } + } + } + } + } +} +pub fn existsWebFolder(f: Folder) -> bool { + let (xml_db = default_xml_db()) { + let (java_db = default_java_db()) { + for (w in WebFolder(java_db)) { + if (f.key_eq(w)) { + return true + } + } + } + } +} +pub fn findReleasedHttpAPI1(m: Method, c: ClassOrInterface, uri1: string, type: string) -> bool { + let (xml_db = default_xml_db()) { + let (java_db = default_java_db()) { + for (n in string::__undetermined_all__()) { + for (a in Annotation(java_db)) { + if (getUri(c, m, uri1)) { + for (auto_tmp1 in m.getAnnotation()) { + if (a = auto_tmp1) { + if (n = a.getName()) { + if (n.matches(".*Mapping")) { + if (tmp_37(a)) { + if (type = "PUT") { + return true + } + if (type = "POST") { + return true + } + if (type = "OPTIONS") { + return true + } + if (type = "PATCH") { + return true + } + if (type = "HEAD") { + return true + } + if (type = "DELETE") { + return true + } + if (type = "GET") { + return true + } + } + if (!(tmp_37(a))) { + if (getMethodType(a, type)) { + return true + } + } + } + } + if (a.getName() = "POST") { + if (type = "POST") { + return true + } + } + if (a.getName() = "GET") { + if (type = "GET") { + return true + } + } + } + } + } + } + } + } + } +} +@inline +pub fn contactUri(n: string, m: string) -> bool { + let (xml_db = default_xml_db()) { + let (java_db = default_java_db()) { + for (temp in string::__undetermined_all__()) { + if (temp = n.substr(0,1)) { + if (tmp_38(temp)) { + if (m = n) { + return true + } + } + if (!(tmp_38(temp))) { + if (m = "/" + n) { + return true + } + } + } + } + } + } +} +schema WebFolder extends Folder { + +} + +impl WebFolder { + + @data_constraint + @inline + pub fn __all__(db: JavaDB) -> *WebFolder { + for (tmp in Folder(db)) { + for (n in string::__undetermined_all__()) { + if (findReleasedArtifact(n, __all_data__)) { + if (tmp.getRelativePath() = n) { + yield WebFolder { + element_hash_id : tmp.element_hash_id, + qualified_name : tmp.qualified_name, + name : tmp.name, + parent_hash_id : tmp.parent_hash_id + } + } + } + } + } + } + + pub fn getModuleName(self) -> string { + for (name in string::__undetermined_all__(), + temp1 in string::__undetermined_all__(), + temp2 in string::__undetermined_all__()) { + if (temp1 = self.getRelativePath()) { + if (tmp_39(temp1)) { + if (temp2 = self.getName()) { + if (name = "/" + temp2) { + return name + } + } + } + if (!(tmp_39(temp1))) { + if (name = "") { + return name + } + } + } + } + } + + +} + +pub fn findReleasedArtifact(moduleName: string, moduleId: string) -> bool { + let (xml_db = default_xml_db()) { + let (java_db = default_java_db()) { + for (f in PomFile(xml_db), + m in ModuleXmlElement(xml_db)) { + if (f.key_eq(m.getLocation().getFile())) { + for (auto_tmp1 in m.getCharacter()) { + if (moduleName = auto_tmp1.getText()) { + for (pa in string::__undetermined_all__(), + id in string::__undetermined_all__()) { + for (e in PomFile(xml_db), + a in ArtifactXmlElement(xml_db), + g in GroupXmlElement(xml_db), + r in RootXmlElement(xml_db)) { + if (moduleName + "/pom.xml" = e.getRelativePath()) { + if (e.key_eq(a.getLocation().getFile())) { + if (e.key_eq(g.getLocation().getFile())) { + if (r.key_eq(a.getParent())) { + for (auto_tmp2 in a.getCharacter()) { + if (id = auto_tmp2.getText()) { + if (g.getParent().getName() = "parent") { + for (auto_tmp3 in g.getCharacter()) { + if (pa = auto_tmp3.getText()) { + if (moduleId = pa + ":" + id) { + return true + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } +} +pub fn real_output(className: string, methodSignature: string, uri: string, type: string, moduleName: string, moduleId: string) -> bool { + let (xml_db = default_xml_db()) { + let (java_db = default_java_db()) { + for (c in ClassOrInterface(java_db), + m in Method(java_db)) { + if (tmp_40()) { + if (findReleasedArtifact(moduleName, moduleId)) { + if (findReleasedHttpAPI(m, c, moduleName, uri, type)) { + if (className = c.getName()) { + if (methodSignature = m.getName()) { + return true + } + } + } + } + } + if (!(tmp_40())) { + if (findReleasedHttpAPI(m, c, __all_data__, uri, type)) { + if (moduleName = "null") { + if (moduleId = "null") { + if (className = c.getName()) { + if (methodSignature = m.getName()) { + return true + } + } + } + } + } + } + } + } + } +} + + +fn default_xml_db() -> XmlDB { + return XmlDB::load("coref_xml_src.db") +} + +fn default_java_db() -> JavaDB { + return JavaDB::load("coref_java_src.db") +} + +fn tmp_0(n: string) -> bool { + let (xml_db = default_xml_db()) { + let (java_db = default_java_db()) { + if (n.substr(0,1) = "{") { + return true + } + } + } +} + +fn tmp_1(temp: string) -> bool { + let (xml_db = default_xml_db()) { + let (java_db = default_java_db()) { + if (temp.substr(0,1) = "\"") { + return true + } + } + } +} + +fn tmp_2(temp: string) -> bool { + let (xml_db = default_xml_db()) { + let (java_db = default_java_db()) { + if (temp.substr(1,1) = "\"") { + return true + } + } + } +} + +fn tmp_3(n: string) -> bool { + let (xml_db = default_xml_db()) { + let (java_db = default_java_db()) { + if (n.substr(0,1) = "\"") { + return true + } + } + } +} + +fn tmp_4(n: string) -> bool { + let (xml_db = default_xml_db()) { + let (java_db = default_java_db()) { + if (n.substr(1,1) = "\"") { + return true + } + } + } +} + +fn tmp_5(i: int) -> bool { + let (xml_db = default_xml_db()) { + let (java_db = default_java_db()) { + if (i = 1) { + return true + } + } + } +} + +fn tmp_6(b: string, a: string) -> bool { + let (xml_db = default_xml_db()) { + let (java_db = default_java_db()) { + if (a.substr(0,1) = "/") { + if (b.substr(0,1) = "/") { + return true + } + } + } + } +} + +@inline +fn tmp_7(b: string, i: int, a: string) -> bool { + let (xml_db = default_xml_db()) { + let (java_db = default_java_db()) { + if (a.substr(i - 1,i - 1) = "/") { + if (b.substr(0,1) = "/") { + return true + } + } + } + } +} + +@inline +fn tmp_8(b: string, i: int, a: string) -> bool { + let (xml_db = default_xml_db()) { + let (java_db = default_java_db()) { + if (a.substr(i - 1,i - 1) != "/") { + if (b.substr(0,1) != "/") { + return true + } + } + } + } +} + +fn tmp_9(a: Annotation) -> bool { + let (xml_db = default_xml_db()) { + let (java_db = default_java_db()) { + if (a.getName() = "PostMapping") { + return true + } + } + } +} + +fn tmp_10(a: Annotation) -> bool { + let (xml_db = default_xml_db()) { + let (java_db = default_java_db()) { + if (a.getName() = "GetMapping") { + return true + } + } + } +} + +fn tmp_11(a: Annotation) -> bool { + let (xml_db = default_xml_db()) { + let (java_db = default_java_db()) { + if (a.getName() = "PutMapping") { + return true + } + } + } +} + +fn tmp_12(a: Annotation) -> bool { + let (xml_db = default_xml_db()) { + let (java_db = default_java_db()) { + if (a.getName() = "DeleteMapping") { + return true + } + } + } +} + +fn tmp_13(a: Annotation) -> bool { + let (xml_db = default_xml_db()) { + let (java_db = default_java_db()) { + if (a.getName() = "PatchMapping") { + return true + } + } + } +} + +fn tmp_14(a: Annotation) -> bool { + let (xml_db = default_xml_db()) { + let (java_db = default_java_db()) { + if (existsValueArgument(a)) { + return true + } + } + } +} + +fn tmp_15(e: Expression, temp: AnnotationAccessArgument) -> bool { + let (xml_db = default_xml_db()) { + let (java_db = default_java_db()) { + if (temp.key_eq(e.getParent())) { + if (facts(e, __all_data__, __all_data__)) { + return true + } + } + } + } +} + +fn tmp_16(b: Annotation) -> bool { + let (xml_db = default_xml_db()) { + let (java_db = default_java_db()) { + if (existsValueArgument(b)) { + return true + } + } + } +} + +fn tmp_17(e: Expression, temp: AnnotationAccessArgument) -> bool { + let (xml_db = default_xml_db()) { + let (java_db = default_java_db()) { + if (temp.key_eq(e.getParent())) { + if (facts(e, __all_data__, __all_data__)) { + return true + } + } + } + } +} + +fn tmp_18(a: Annotation) -> bool { + let (xml_db = default_xml_db()) { + let (java_db = default_java_db()) { + if (existsValueArgument(a)) { + return true + } + } + } +} + +fn tmp_19(e: Expression, temp: AnnotationAccessArgument) -> bool { + let (xml_db = default_xml_db()) { + let (java_db = default_java_db()) { + if (temp.key_eq(e.getParent())) { + if (facts(e, __all_data__, __all_data__)) { + return true + } + } + } + } +} + +fn tmp_20(c: ClassOrInterface) -> *Annotation { + let (xml_db = default_xml_db()) { + let (java_db = default_java_db()) { + for (b in Annotation(java_db)) { + for (auto_tmp3 in c.getAnnotation()) { + if (b = auto_tmp3) { + if (b.getName() = "Path") { + yield b + } + } + } + } + } + } +} + +fn tmp_21(c: ClassOrInterface) -> bool { + let (xml_db = default_xml_db()) { + let (java_db = default_java_db()) { + if (tmp_20(c).len() = 1) { + return true + } + } + } +} + +fn tmp_22(c: ClassOrInterface) -> *Annotation { + let (xml_db = default_xml_db()) { + let (java_db = default_java_db()) { + for (b in Annotation(java_db)) { + for (auto_tmp4 in c.getAnnotation()) { + if (b = auto_tmp4) { + if (b.getName() = "RequestMapping") { + yield b + } + } + } + } + } + } +} + +fn tmp_23(c: ClassOrInterface) -> bool { + let (xml_db = default_xml_db()) { + let (java_db = default_java_db()) { + if (tmp_22(c).len() = 0) { + return true + } + } + } +} + +fn tmp_24(a: Annotation) -> *AnnotationAccessArgument { + let (xml_db = default_xml_db()) { + let (java_db = default_java_db()) { + for (b in AnnotationAccessArgument(java_db)) { + for (auto_tmp5 in a.getAnnotationArgument()) { + if (b = auto_tmp5) { + if (b.getAnnotationArgumentName() = "value") { + yield b + } + } + } + } + } + } +} + +fn tmp_25(a: Annotation) -> bool { + let (xml_db = default_xml_db()) { + let (java_db = default_java_db()) { + if (tmp_24(a).len() = 0) { + return true + } + } + } +} + +fn tmp_26(n: string) -> bool { + let (xml_db = default_xml_db()) { + let (java_db = default_java_db()) { + if (n.matches(".*Mapping")) { + return true + } + } + } +} + +fn tmp_27(a: Expression) -> bool { + let (xml_db = default_xml_db()) { + let (java_db = default_java_db()) { + if (resolve(ReferenceExpression(java_db).find(a), __all_data__)) { + return true + } + } + } +} + +fn tmp_28(e: Expression) -> bool { + let (xml_db = default_xml_db()) { + let (java_db = default_java_db()) { + if (resolve(ReferenceExpression(java_db).find(e), __all_data__)) { + return true + } + } + } +} + +fn tmp_29(ID: Expression) -> *auto_tmp_30 { + let (xml_db = default_xml_db()) { + let (java_db = default_java_db()) { + for (auto_tmp_var_0 in int::__undetermined_all__(), + auto_tmp_var_1 in string::__undetermined_all__()) { + if (facts(Expression(java_db).find(ID), auto_tmp_var_0, auto_tmp_var_1)) { + yield auto_tmp_30 { + auto_tmp_var_0 : auto_tmp_var_0, + auto_tmp_var_1 : auto_tmp_var_1 + } + } + } + } + } +} + +schema auto_tmp_30 { + auto_tmp_var_0 : int, + auto_tmp_var_1 : string +} + +fn tmp_31(index: int) -> bool { + let (xml_db = default_xml_db()) { + let (java_db = default_java_db()) { + if (index = 0) { + return true + } + } + } +} + +fn tmp_32(ID: Expression) -> *auto_tmp_33 { + let (xml_db = default_xml_db()) { + let (java_db = default_java_db()) { + for (auto_tmp_var_0 in int::__undetermined_all__(), + auto_tmp_var_1 in string::__undetermined_all__()) { + if (facts(Expression(java_db).find(ID), auto_tmp_var_0, auto_tmp_var_1)) { + yield auto_tmp_33 { + auto_tmp_var_0 : auto_tmp_var_0, + auto_tmp_var_1 : auto_tmp_var_1 + } + } + } + } + } +} + +schema auto_tmp_33 { + auto_tmp_var_0 : int, + auto_tmp_var_1 : string +} + +fn tmp_34(w: Folder) -> bool { + let (xml_db = default_xml_db()) { + let (java_db = default_java_db()) { + if (existsWebFolder(w)) { + return true + } + } + } +} + +fn tmp_35(a: Annotation) -> *auto_tmp_36 { + let (xml_db = default_xml_db()) { + let (java_db = default_java_db()) { + for (auto_tmp_var_0 in string::__undetermined_all__()) { + if (getMethodType(a, auto_tmp_var_0)) { + yield auto_tmp_36 { + auto_tmp_var_0 : auto_tmp_var_0 + } + } + } + } + } +} + +schema auto_tmp_36 { + auto_tmp_var_0 : string +} + +fn tmp_37(a: Annotation) -> bool { + let (xml_db = default_xml_db()) { + let (java_db = default_java_db()) { + if (tmp_35(a).len() = 0) { + return true + } + } + } +} + +fn tmp_38(temp: string) -> bool { + let (xml_db = default_xml_db()) { + let (java_db = default_java_db()) { + if (temp = "/") { + return true + } + } + } +} + +fn tmp_39(temp1: string) -> bool { + let (xml_db = default_xml_db()) { + let (java_db = default_java_db()) { + if (temp1.contains("app/web/")) { + if (temp1 != "app/web/home") { + return true + } + } + } + } +} + +fn tmp_40() -> bool { + let (xml_db = default_xml_db()) { + let (java_db = default_java_db()) { + if (findReleasedArtifact(__all_data__, __all_data__)) { + return true + } + } + } +} + +fn main() { + output(real_output()) +} \ No newline at end of file diff --git a/example/icse25/Keymap/FindAllReleasedTrAPI.gdl b/example/icse25/Keymap/FindAllReleasedTrAPI.gdl new file mode 100644 index 00000000..e9a6bf4f --- /dev/null +++ b/example/icse25/Keymap/FindAllReleasedTrAPI.gdl @@ -0,0 +1,695 @@ +// script +use coref::java::* +use coref::xml::* +schema SofaService extends Annotation { + +} + +impl SofaService { + + @data_constraint + @inline + pub fn __all__(db: JavaDB) -> *SofaService { + for (tmp in Annotation(db)) { + if (tmp.getName() = "SofaService") { + yield SofaService { + id : tmp.id + } + } + } + } + + pub fn getService(self) -> Interface { + for (value in string::__undetermined_all__()) { + for (i in Interface(__all_data__), + argus in AnnotationAccessArgument(__all_data__)) { + for (auto_tmp1 in self.getAnnotationArgument()) { + if (argus = auto_tmp1) { + if (argus.getAnnotationArgumentName() = "interfaceType") { + if (value = argus.getAnnotationArgumentValue()) { + if (i.getQualifiedName() = value) { + return i + } + } + } + } + } + } + } + } + + @inline + pub fn getBinding(self) -> SofaServiceBinding { + for (b in SofaServiceBinding(__all_data__), + argus in AnnotationAccessArgument(__all_data__)) { + for (auto_tmp1 in self.getAnnotationArgument()) { + if (argus = auto_tmp1) { + if (argus.getAnnotationArgumentName() = "bindings") { + if (b.key_eq(argus.getArgumentAnnotation())) { + return b + } + if (argus.key_eq(b.getParent())) { + return b + } + } + } + } + } + } + + @inline + pub fn getUniqueId(self) -> string { + for (uniqueId in string::__undetermined_all__()) { + for (anno in Annotation(__all_data__)) { + if (self.key_eq(anno)) { + if (tmp_2(anno)) { + for (argus in AnnotationAccessArgument(__all_data__)) { + for (auto_tmp1 in anno.getAnnotationArgument()) { + if (argus = auto_tmp1) { + if (argus.getAnnotationArgumentName() = "uniqueId") { + if (uniqueId = argus.getAnnotationArgumentValue()) { + return uniqueId + } + } + } + } + } + } + if (!(tmp_2(anno))) { + if (uniqueId = "null") { + return uniqueId + } + } + } + } + } + } + + +} + +pub fn uniqueArgument(anno: Annotation) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (argus in AnnotationAccessArgument(java_db)) { + for (auto_tmp1 in anno.getAnnotationArgument()) { + if (argus = auto_tmp1) { + if (argus.getAnnotationArgumentName() = "uniqueId") { + return true + } + } + } + } + } + } +} +schema SofaServiceBinding extends Annotation { + +} + +impl SofaServiceBinding { + + @data_constraint + @inline + pub fn __all__(db: JavaDB) -> *SofaServiceBinding { + for (tmp in Annotation(db)) { + if (tmp.getName() = "SofaServiceBinding") { + yield SofaServiceBinding { + id : tmp.id + } + } + } + } + + pub fn getType(self) -> string { + for (value in string::__undetermined_all__()) { + for (argus in AnnotationAccessArgument(__all_data__)) { + for (auto_tmp1 in self.getAnnotationArgument()) { + if (argus = auto_tmp1) { + if (argus.getAnnotationArgumentName() = "bindingType") { + if (value = argus.getAnnotationArgumentValue()) { + return value + } + } + } + } + } + } + } + + +} + +pub fn javaOutput(classname: string, name: string, uniqueId: string, type: string) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (value in string::__undetermined_all__()) { + for (s in SofaService(java_db), + c in Class(java_db), + b in SofaServiceBinding(java_db), + i in Interface(java_db)) { + if (b = s.getBinding()) { + if (value = b.getType()) { + if (value.contains("tr")) { + if (type = "tr") { + for (auto_tmp1 in c.getAnnotation()) { + if (s.key_eq(auto_tmp1)) { + if (classname = c.getQualifiedName()) { + for (auto_tmp2 in c.getImplementsInterface()) { + if (i = auto_tmp2) { + if (name = i.getQualifiedName()) { + if (uniqueId = s.getUniqueId()) { + return true + } + } + } + } + if (i = s.getService()) { + if (name = i.getQualifiedName()) { + if (uniqueId = s.getUniqueId()) { + return true + } + } + } + } + } + } + } + } + } + } + } + } + } + } +} + +pub fn xmlOutput(bindingType: string, uniqueId: string, className: string, interfaceName: string) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (temp in string::__undetermined_all__()) { + for (s in SofaServiceXmlElement(xml_db), + b in BeanXmlElement(xml_db), + t in TagXmlElement(xml_db)) { + if (s.key_eq(t.getParent())) { + if (s.getRef() = b.getId()) { + if (interfaceName = s.getInterfaceName()) { + if (className = b.getClass()) { + if (uniqueId = s.getUniqueId()) { + if (bindingType = s.getBindingType()) { + if (temp = b.getLocation().getFile().getRelativePath()) { + if (!temp.contains("src/test/resources")) { + return true + } + } + } + } + } + } + } + } + } + } + } + } +} +pub fn annoOutput(bindingType: string, uniqueId: string, className: string, interfaceName: string) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (v in string::__undetermined_all__(), + k in string::__undetermined_all__()) { + for (s in SofaServiceXmlElement(xml_db), + b in Class(java_db), + t in TagXmlElement(xml_db), + a in Annotation(java_db)) { + if (s.key_eq(t.getParent())) { + if (v = s.getRef()) { + if (interfaceName = s.getInterfaceName()) { + if (uniqueId = s.getUniqueId()) { + if (bindingType = s.getBindingType()) { + for (auto_tmp1 in b.getAnnotation()) { + if (a = auto_tmp1) { + if (a.getName() = k) { + if (getTrAnnotationName(k)) { + for (auto_tmp2 in a.getAnnotationArgument()) { + if (auto_tmp2.getAnnotationArgumentValue() = "\"" + v + "\"") { + if (className = b.getQualifiedName()) { + return true + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } +} +pub fn getTrAnnotationName(a: string) -> bool { + [ + {"Service"}, + {"Component"}, + {"Scope"}, + {"Repository"}, + {"Controller"}, + {"RestController"}, + {"RequestMapping"}, + {"PathVariable"}, + {"ResponseBody"}, + {"bean"} + ] +} +pub fn output1(className: string, interfaceName: string, uniqueId: string, bindingType: string) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + if (xmlOutput(bindingType, uniqueId, className, interfaceName)) { + return true + } + if (javaOutput(className, interfaceName, uniqueId, bindingType)) { + return true + } + if (annoOutput(bindingType, uniqueId, className, interfaceName)) { + return true + } + } + } +} +pub fn isSelfDefinedInterface(name: string) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (i in Interface(java_db)) { + if (name = i.getQualifiedName()) { + return true + } + } + } + } +} +schema PublicMethod extends Method { + +} + +impl PublicMethod { + + @data_constraint + @inline + pub fn __all__(db: JavaDB) -> *PublicMethod { + for (tmp in Method(db)) { + for (m in Modifier(db)) { + for (auto_tmp1 in tmp.getModifier()) { + if (m = auto_tmp1) { + if (m.getName() = "public") { + if (!isSetOrGetMethod(tmp)) { + yield PublicMethod { + element_hash_id : tmp.element_hash_id, + name : tmp.name, + signature : tmp.signature, + type_hash_id : tmp.type_hash_id, + parent_hash_id : tmp.parent_hash_id, + location_hash_id : tmp.location_hash_id, + definition_body : tmp.definition_body + } + } + } + } + } + } + } + } + + +} + +pub fn isBooleanTypeField(f: Field, p: string, q: string) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (i in int::__undetermined_all__(), + n in string::__undetermined_all__(), + tmp1 in string::__undetermined_all__(), + tmp2 in string::__undetermined_all__(), + l in string::__undetermined_all__(), + j in string::__undetermined_all__()) { + if (n = f.getName()) { + if (i = n.len()) { + if (tmp_7(n)) { + if (tmp1 = n.substr(2,i)) { + if (l = n.substr(2,1)) { + if (tmp2 = n.substr(3,i)) { + if (q = n) { + if (p = "set" + tmp1) { + return true + } + } + if (q = "get" + l + tmp2) { + if (p = "set" + tmp1) { + return true + } + } + } + } + } + } + if (!(tmp_7(n))) { + if (l = n.substr(0,1)) { + if (tmp2 = n.substr(1,i)) { + if (lowerToUpper(l, j)) { + if (p = "set" + j + tmp2) { + if (q = "is" + j + tmp2) { + return true + } + if (q = "get" + j + tmp2) { + return true + } + } + if (p = "set" + n) { + if (q = "is" + j + tmp2) { + return true + } + if (q = "get" + j + tmp2) { + return true + } + } + } + } + } + } + } + } + } + } + } +} +pub fn isSetOrGetMethod(m: Method) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (i in int::__undetermined_all__(), + p in string::__undetermined_all__(), + q in string::__undetermined_all__(), + n in string::__undetermined_all__(), + l in string::__undetermined_all__(), + j in string::__undetermined_all__(), + tmp in string::__undetermined_all__(), + t in string::__undetermined_all__()) { + for (f in Field(java_db)) { + if (n = f.getName()) { + if (i = n.len()) { + if (f.getParent() = m.getParent()) { + if (p = m.getName()) { + if (t = f.getTypeElement().getPrintableText()) { + if (tmp_8(t)) { + if (isBooleanTypeField(f, p, q)) { + return true + } + } + if (!(tmp_8(t))) { + if (l = n.substr(0,1)) { + if (tmp = n.substr(1,i)) { + if (lowerToUpper(l, j)) { + if (p = "set" + j + tmp) { + if (q = "get" + j + tmp) { + return true + } + if (q = "get" + n) { + return true + } + } + if (p = "set" + n) { + if (q = "get" + j + tmp) { + return true + } + if (q = "get" + n) { + return true + } + } + } + } + } + } + } + } + if (q = m.getName()) { + if (t = f.getTypeElement().getPrintableText()) { + if (tmp_8(t)) { + if (isBooleanTypeField(f, p, q)) { + return true + } + } + if (!(tmp_8(t))) { + if (l = n.substr(0,1)) { + if (tmp = n.substr(1,i)) { + if (lowerToUpper(l, j)) { + if (p = "set" + j + tmp) { + if (q = "get" + j + tmp) { + return true + } + if (q = "get" + n) { + return true + } + } + if (p = "set" + n) { + if (q = "get" + j + tmp) { + return true + } + if (q = "get" + n) { + return true + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } +} +pub fn findReleasedTrAPI(interfaceName: string, className: string, methodName: string, tag: string) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (i in Interface(java_db), + c in Class(java_db)) { + if (output1(className, interfaceName, __all_data__, __all_data__)) { + if (tmp_9(interfaceName)) { + if (interfaceName = i.getQualifiedName()) { + for (m in Method(java_db)) { + if (i.key_eq(m.getParent())) { + if (methodName = m.getSignature()) { + if (tag = "Self") { + return true + } + } + } + } + } + } + if (!(tmp_9(interfaceName))) { + if (className = c.getQualifiedName()) { + for (n in PublicMethod(java_db)) { + if (c.key_eq(n.getParent())) { + if (methodName = n.getSignature()) { + if (tag = "External") { + return true + } + } + } + } + } + } + } + } + } + } +} +pub fn findReleasedArtifact(moduleName: string, moduleId: string) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (f in PomFile(xml_db), + m in ModuleXmlElement(xml_db)) { + if (f.key_eq(m.getLocation().getFile())) { + for (auto_tmp1 in m.getCharacter()) { + if (moduleName = auto_tmp1.getText()) { + for (pa in string::__undetermined_all__(), + id in string::__undetermined_all__()) { + for (e in PomFile(xml_db), + a in ArtifactXmlElement(xml_db), + g in GroupXmlElement(xml_db), + r in RootXmlElement(xml_db)) { + if (moduleName + "/pom.xml" = e.getRelativePath()) { + if (e.key_eq(a.getLocation().getFile())) { + if (e.key_eq(g.getLocation().getFile())) { + if (r.key_eq(a.getParent())) { + for (auto_tmp2 in a.getCharacter()) { + if (id = auto_tmp2.getText()) { + if (g.getParent().getName() = "parent") { + for (auto_tmp3 in g.getCharacter()) { + if (pa = auto_tmp3.getText()) { + if (moduleId = pa + ":" + id) { + return true + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } +} +pub fn real_output(interfaceName: string, className: string, methodName: string, tag: string, moduleName: string, moduleId: string) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (temp1 in string::__undetermined_all__(), + temp2 in string::__undetermined_all__()) { + for (c in Class(java_db), + f in Folder(java_db)) { + if (c.getQualifiedName() = className) { + if (findReleasedTrAPI(interfaceName, className, methodName, tag)) { + if (findReleasedArtifact(moduleName, moduleId)) { + if (f = c.getLocation().getFile().getBelongedFolder()) { + if (temp1 = f.getRelativePath()) { + if (temp2 = moduleName + "/") { + if (temp1.contains(temp2)) { + return true + } + } + } + } + } + } + } + } + } + } + } +} + + +fn default_java_db() -> JavaDB { + return JavaDB::load("coref_java_src.db") +} + +fn default_xml_db() -> XmlDB { + return XmlDB::load("coref_xml_src.db") +} + +fn tmp_0(anno: Annotation) -> *auto_tmp_1 { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + if (uniqueArgument(anno)) { + yield auto_tmp_1 { + + } + } + } + } +} + +schema auto_tmp_1 { + +} + +fn tmp_2(anno: Annotation) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + if (tmp_0(anno).len() = 1) { + return true + } + } + } +} + +fn tmp_3(x: SofaServiceXmlElement) -> *auto_tmp_4 { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + if (hasUniqueIdAttribute(XmlElement(__all_data__).find(x))) { + yield auto_tmp_4 { + + } + } + } + } +} + +schema auto_tmp_4 { + +} + +fn tmp_5(x: SofaServiceXmlElement) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + if (tmp_3(x).len() = 1) { + return true + } + } + } +} + +fn tmp_6(auto_replace_var: SofaServiceXmlElement) -> *TagXmlElement { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (t in TagXmlElement(__all_data__)) { + if (auto_replace_var.key_eq(t.getParent())) { + yield t + } + } + } + } +} + +fn tmp_7(n: string) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + if (n.matches("is.*")) { + return true + } + } + } +} + +fn tmp_8(t: string) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + if (t = "boolean") { + return true + } + if (t = "Boolean") { + return true + } + } + } +} + +fn tmp_9(interfaceName: string) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + if (isSelfDefinedInterface(interfaceName)) { + return true + } + } + } +} + +fn main() { + output(real_output()) +} \ No newline at end of file diff --git a/example/icse25/motivation example.md b/example/icse25/motivation example.md new file mode 100644 index 00000000..a78182f9 --- /dev/null +++ b/example/icse25/motivation example.md @@ -0,0 +1,127 @@ +# Motivation Example + +## Relation + +### Java + +``` +field(id, tid, name, locId) +method(id, tid, name) +parent(id1, id2) +class(id, name) +interface(id, name) +type(id, n) +javaLoc(locId, s, e, path) +``` + +### XML + +``` +xmlEle() +xmlAttri() +``` + +### JS/TS + +``` +enclose(exprId, methodId) +callExpr(exprId, methodId, argExprId, callSiteId) +reference(refId, defId) +service(id, appId, locId) +jsLoc(locId, s, e, path) +app(id, name) +api(id, apiName, apiSignature, appId) +functionLikeDeclaration(id, name) +parent(id1, id2) +class(id, name) +``` + +## Rule + +### Java + +``` +changedField(fid) :- ( + field(fid, _, _, locId), + loc(locId, s, e, path), + changedSet(line, path), + line >= s, + line <= e +). +fieldInClassType(fName, tName) :- ( + field(fid, _, fName), + parent(fid, cid), + class(cid, tName), + type(tid, tName) +). + +fieldInDescendantClassType(fName, tName) :- fieldInClassType(fName, tName). +fieldInDescendantClassType(fName, tName) :- fieldInClassType(fName, tName1), fieldInDescendantClassType(tName1, tName). + +changedMethodInInterface(fid, mid, iid) :- ( + changedField(fid), + field(fid, _, fName, _), + fieldInDescendantClassType(fName, tName), + type(tid, tName), + method(mid, tid, _), + parent(mid, iid), + interface(iid, _) +). +``` + +### Java, XML + +参考原论文 + +``` +getChangedTrAPI(trInterfaceName, trMethodName) :- ( + changedMethodInInterface(fid, mid, iid), + method(mid, _, trMethodName), + interface(iid, trInterfaceName), + service(bid, cid), + in(iid, cid) +). +``` + +### JS + +``` +getAppFacade(appName, proxyFacadeName, facadeQualifiedName) :- ( + service(id, appId, locId), + jsLoc(locId, _, _, path), + path = "config/proxy.js", + app(appId, appName), + api(_, proxyFacadeName, facadeQualifiedName, appId) +). +getInfluencedTrAPI(appName, proxyFacadeName, facadeQualifiedName, trMethodName) :- ( + getChangedTrAPI(facadeQualifiedName, trMethodName), + getAppFacade(appName, proxyFacadeName, facadeQualifiedName) +). +``` + +### TS + +``` +getInfluencedTrAPICall(appName, proxyFacadeName, callExprId) :- ( + getInfluencedTrAPI(appName, proxyFacadeName, facadeQualifiedName, trMethodName), + callExpr(callExprId, mid, _, callSiteId), + reference(callSiteId, defId), + api(defId, proxyFacadeName, _, _) +). + +getInfluencedFrontEndAPI(rpcName, trFuncName) :- ( + getInfluencedTrAPICall(_, _, callExprId), + enclose(callExprId, methodId), + functionLikeDeclaration(mid, trFuncName), + parent(mid, cid), + class(cid, rpcName) +). +``` + +## Workflow + +1. 根据变更行号,识别出变更内容为新增某一个Field f。 +2. 通过影响面分析,得出有一个 Interface 的函数 m 的返回类型为包含这个新增字段的类 c。 +3. 通过结合xml配置分析,这个函数 m 所在的 Interface i 实际为一个对外发布的 rpc 接口。 +4. 通过分析 bff 应用的配置 proxy.js 文件,发现 该应用 配置了 变更的 rpc 接口。 +5. 通过分析 bff 应用里所有的 函数调用,发现有使用了 该变更的 rpc 接口,并且 调用函数所在类也是对前端开放的服务接口,由于调用函数的传参与变更后的不一致,导致查询失败,使用该接口的前端服务全部崩溃。 \ No newline at end of file diff --git a/example/icse25/procedure.md b/example/icse25/procedure.md new file mode 100644 index 00000000..dc6c0e31 --- /dev/null +++ b/example/icse25/procedure.md @@ -0,0 +1,27 @@ +实验步骤: + +1. 运行gitdiff脚本,识别出两个commit之间的所有变更文件名和行号 +2. 运行rule1.gdl,将变更文件名和行号转换为对应的java ecg node id。 +3. 运行rule5.gdl,将变更文件名和行号转换为对应的xml ecg node id。 +4. 运行rule4.gdl,输入为rule1找到的java ecg node,输出为这些ecg node影响到的发布的http request函数。 +4. 运行rule2.gdl,输入为rule1找到的java ecg node,输出为这些ecg node影响到的http response函数。 +5. 运行rule6.gdl,输入为rule1和rule5找到的所有ecg node,输出为这些ecg node是否为发布的tr接口。 +6. 运行rule7.gdl,输入为rule5找到的xml ecg node,输出为这些node对应的mybatis 框架下的java源码,字段或函数。 +7. 运行rule8.gdl,输入为rule1和rule7找到的所有ecg node,输出为这些ecg node 影响到的发布的tr接口。 +8. 运行rule13.gdl,输入为变更行和行号,输出为本次变更的变更影响调用链路的调用根节点的函数签名(默认为baseline)。 +9. 比较rule13与rule4,rule6的结果。 +10. rule17 仓库地址:{unknown} +11. 运行rule17, 输入为rule1找到的java ecg node,输出为本次变更影响到的tr接口和函数名。 +12. BFF为私仓,本地下好。 +13. 运行rule18, 输入为rule17找到的tr接口全名和函数名,输出为BFF应用使用到的appname配置,tr接口和函数名。 +14. 运行rule19,输入为rule18找到的appname配置,tr接口和函数名,输出为使用到这些tr接口的rpc接口和函数 + +update 版本 +1. 运行gitdiff脚本,识别出两个commit之间的所有变更文件名和行号 +2. 运行rule_ecg.gdl,输入为变更行和行号,输出为本次变更的tr接口和http接口信息。 +3. 运行rule_1_5.gdl,输入为变更行和行号,输出为本次变更的ecg node。 +4. 运行rule_6_8.gdl,输入为变更行和行号,输出为本次变更的tr接口。 +5. 运行rule_1_4.gdl,输入为变更行和行号,输出为本次变更的http接口。 +3. 运行rule13.gdl,输入为变更行和行号,输出为本次变更的变更影响调用链路的调用根节点的函数签名(默认为baseline)。 +4. 运行rule9 输出为查询到该应用发布的所有http request接口,用于与rule_1_4的结果进行比较。 +5. 运行rule12.gdl,输出为该应用发布的所有tr接口、实现类和对应的具体函数信息,用于与rule6_8结果进行比较。 diff --git a/example/icse25/rules/ecg.gdl b/example/icse25/rules/ecg.gdl new file mode 100644 index 00000000..2ffcd138 --- /dev/null +++ b/example/icse25/rules/ecg.gdl @@ -0,0 +1,711 @@ +// script +use coref::java::* + +schema ECGNode extends ElementParent {} + +impl ECGNode { + pub fn __all__(db: JavaDB) -> *ECGNode { + for (tmp in ElementParent(db)) { + for (m in Method(db)) { + if (tmp.key_eq(m)) { + yield ECGNode { + id : tmp.id + } + } + } + for (m in Variable(db)) { + if (tmp.key_eq(m)) { + yield ECGNode { + id : tmp.id + } + } + } + for (m in Expression(db)) { + if (tmp.key_eq(m)) { + yield ECGNode { + id : tmp.id + } + } + } + } + } + + pub fn getType(self) -> string { + for (t in string::__undetermined_all__()) { + for (m in Method(__all_data__)) { + if (self.key_eq(m)) { + if (t = "Method") { + return t + } + } + } + for (m in LocalVariable(__all_data__)) { + if (self.key_eq(m)) { + if (t = "LocalVariable") { + return t + } + } + } + for (m in Parameter(__all_data__)) { + if (self.key_eq(m)) { + if (t = "Parameter") { + return t + } + } + } + for (m in Field(__all_data__)) { + if (self.key_eq(m)) { + if (t = "Field") { + return t + } + } + } + for (m in EnumConstant(__all_data__)) { + if (self.key_eq(m)) { + if (t = "EnumConstant") { + return t + } + } + } + for (m in Expression(__all_data__)) { + if (self.key_eq(m)) { + if (t = m.getType()) { + return t + } + } + } + } + } + + pub fn getDDNode(self, type: string, direction: string) -> ECGNode { + for (e1 in ECGNode(__all_data__)) { + for (e in Parameter(__all_data__), + c in Method(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + for (auto_tmp1 in c.getParameter()) { + if (e = auto_tmp1) { + if (direction = "Depended") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + for (r in ReturnStatement(__all_data__), + c in Method(__all_data__), + e in Expression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (c.key_eq(r.getEnclosingCallable())) { + if (e = r.getResult()) { + if (direction = "Depends") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + for (c in Callable(__all_data__), + e in Field(__all_data__), + r in ReferenceExpression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (c = r.getEnclosingCallable()) { + if (e.key_eq(r.getDefinition())) { + if (direction = "Depended") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + for (c in Callable(__all_data__), + e in EnumConstant(__all_data__), + r in ReferenceExpression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (c = r.getEnclosingCallable()) { + if (e.key_eq(r.getDefinition())) { + if (direction = "Depended") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + for (e in Callable(__all_data__), + c in Field(__all_data__), + r in ReferenceExpression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (c.key_eq(r.getDefinition())) { + if (e = r.getEnclosingCallable()) { + if (direction = "Depends") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + for (e in Callable(__all_data__), + c in EnumConstant(__all_data__), + r in ReferenceExpression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (c.key_eq(r.getDefinition())) { + if (e = r.getEnclosingCallable()) { + if (direction = "Depends") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + for (c in Callable(__all_data__), + e in CallExpression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (c = e.getEnclosingCallable()) { + for (m in Method(__all_data__)) { + if (m = e.getMethod()) { + if (!isDirectCall(e)) { + if (direction = "Depended") { + if (type = "DD") { + return e1 + } + } + } + } + } + for (f in LombokField(__all_data__)) { + if (f = e.getLombokField()) { + if (!isDirectCall(e)) { + if (direction = "Depended") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + } + } + for (n in string::__undetermined_all__()) { + for (e in LombokField(__all_data__), + c in CallExpression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (e = c.getLombokField()) { + let (tmp_find = CallExpression(__all_data__).find(e)) { + if (!isDirectCall(tmp_find)) { + if (n = c.getMethodName()) { + if (Self::tmp_0(n)) { + if (direction = "Depended") { + if (type = "DD") { + return e1 + } + } + } + if (!Self::tmp_0(n)) { + if (direction = "Depends") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + } + } + } + } + for (e in Variable(__all_data__), + c in CallExpression(__all_data__), + r in ReferenceExpression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (!isDirectCall(c)) { + for (auto_tmp2 in c.getArguments()) { + if (r.key_eq(auto_tmp2)) { + if (e.key_eq(r.getDefinition())) { + if (direction = "Depended") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + } + } + for (e in CallExpression(__all_data__), + c in CallExpression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (!isDirectCall(c)) { + for (auto_tmp3 in c.getArguments()) { + if (e.key_eq(auto_tmp3)) { + if (direction = "Depended") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + } + for (e in CallExpression(__all_data__), + c in CallExpression(__all_data__), + s in CallExpression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (!isDirectCall(c)) { + for (auto_tmp4 in c.getAnAncestor()) { + if (s.getReference().key_eq(auto_tmp4)) { + for (auto_tmp5 in s.getArguments()) { + if (auto_tmp5.key_eq(e)) { + if (direction = "Depended") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + } + } + } + } + } + + pub fn getAnAncestorDDNode(self, type: string, direction: string) -> ECGNode { + for (e in ECGNode(__all_data__)) { + if (type = "DD") { + if (e = self.getDDNode(type, direction)) { + return e + } + if (e = self.getAnAncestorDDNode(__all_data__, __all_data__).getDDNode(type, direction)) { + return e + } + } + } + } + + pub fn getCDNode(self, type: string, direction: string) -> ECGNode { + for (e in ECGNode(__all_data__), + c in Callable(__all_data__), + r in ReferenceExpression(__all_data__)) { + if (self.key_eq(c)) { + if (type = "CD") { + for (e1 in Method(__all_data__)) { + for (auto_tmp1 in c.getCallee()) { + if (e1.key_eq(auto_tmp1)) { + if (direction = "Depends") { + if (e.key_eq(e1)) { + return e + } + } + } + } + } + for (e2 in Method(__all_data__)) { + for (auto_tmp2 in c.getCaller()) { + if (e2.key_eq(auto_tmp2)) { + if (direction = "Depended") { + if (e.key_eq(e2)) { + return e + } + } + } + } + } + } + } + if (self.key_eq(r.getDefinition())) { + if (c = r.getEnclosingCallable()) { + if (type = "CD") { + for (e1 in Method(__all_data__)) { + for (auto_tmp1 in c.getCallee()) { + if (e1.key_eq(auto_tmp1)) { + if (direction = "Depends") { + if (e.key_eq(e1)) { + return e + } + } + } + } + } + for (e2 in Method(__all_data__)) { + for (auto_tmp2 in c.getCaller()) { + if (e2.key_eq(auto_tmp2)) { + if (direction = "Depended") { + if (e.key_eq(e2)) { + return e + } + } + } + } + } + } + } + } + } + } + + pub fn getAnAncestorCDNode(self, type: string, direction: string) -> ECGNode { + for (e in ECGNode(__all_data__), + c in Callable(__all_data__), + r in ReferenceExpression(__all_data__)) { + if (type = "CD") { + if (self.key_eq(c)) { + for (e1 in Method(__all_data__)) { + for (auto_tmp1 in c.getAnAncestorCallee()) { + if (e1.key_eq(auto_tmp1)) { + if (direction = "Depends") { + if (e.key_eq(e1)) { + return e + } + } + } + } + } + for (e2 in Method(__all_data__)) { + for (auto_tmp2 in c.getAnAncestorCaller()) { + if (e2.key_eq(auto_tmp2)) { + if (direction = "Depended") { + if (e.key_eq(e2)) { + return e + } + } + } + } + } + } + if (self.key_eq(r.getDefinition())) { + if (c = r.getEnclosingCallable()) { + for (e1 in Method(__all_data__)) { + for (auto_tmp1 in c.getAnAncestorCallee()) { + if (e1.key_eq(auto_tmp1)) { + if (direction = "Depends") { + if (e.key_eq(e1)) { + return e + } + } + } + } + } + for (e2 in Method(__all_data__)) { + for (auto_tmp2 in c.getAnAncestorCaller()) { + if (e2.key_eq(auto_tmp2)) { + if (direction = "Depended") { + if (e.key_eq(e2)) { + return e + } + } + } + } + } + } + } + } + } + } + + pub fn getECGNode(self, type: string, direction: string) -> ECGNode { + for (e in ECGNode(__all_data__)) { + if (e = self.getCDNode(type, direction)) { + return e + } + if (e = self.getDDNode(type, direction)) { + return e + } + } + } + + pub fn getAnAncestorECGNode(self, type: string, direction: string) -> ECGNode { + for (e in ECGNode(__all_data__), tmp in ECGNode(__all_data__)) { + if (tmp = self.getAnAncestorCDNode(__all_data__, __all_data__)) { + if (e = tmp.getECGNode(type, direction)) { + return e + } + } + } + } + + pub fn getAnAncestorCDDependedNode(self, type: string, direction: string) -> ECGNode { + for (e in ECGNode(__all_data__), c in Callable(__all_data__), r in ReferenceExpression(__all_data__)) { + if (type = "CD") { + if (self.key_eq(c) || (self.key_eq(r.getDefinition()) && r.getEnclosingCallable() = c)) { + for (e2 in Method(__all_data__), c_caller in c.getAnAncestorCaller()) { + if (e2.key_eq(c_caller) && direction = "Depended" && e.key_eq(e2)) { + return e + } + } + } + } + } + } + + pub fn getECGDependsNode(self, type: string, direction: string) -> ECGNode { + for (e in ECGNode(__all_data__)) { + if (e = self.getCDDependsNode(type, direction)) { + return e + } + if (e = self.getDDDependsNode(type, direction)) { + return e + } + } + } + + pub fn getCDDependsNode(self, type: string, direction: string) -> ECGNode { + for (e in ECGNode(__all_data__), + c in Callable(__all_data__), + r in ReferenceExpression(__all_data__)) { + if (self.key_eq(c)) { + if (type = "CD") { + for (e1 in c.getCallee()) { + if (direction = "Depends") { + if (e.key_eq(e1)) { + return e + } + } + } + } + } + for (v in Variable(__all_data__)) { + if (self.key_eq(v)) { + if (v.key_eq(r.getDefinition())) { + if (c = r.getEnclosingCallable()) { + if (type = "CD") { + for (e1 in c.getCallee()) { + if (direction = "Depends") { + if (e.key_eq(e1)) { + return e + } + } + } + } + } + } + } + } + } + } + + pub fn getDDDependsNode(self, type: string, direction: string) -> ECGNode { + for (e1 in ECGNode(__all_data__)) { + for (r in ReturnStatement(__all_data__), + c in Method(__all_data__), + e in Expression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (c.key_eq(r.getEnclosingCallable())) { + if (e = r.getResult()) { + if (direction = "Depends") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + for (e in Callable(__all_data__), + c in Field(__all_data__), + r in ReferenceExpression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (c.key_eq(r.getDefinition())) { + if (e = r.getEnclosingCallable()) { + if (direction = "Depends") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + for (e in Callable(__all_data__), + c in EnumConstant(__all_data__), + r in ReferenceExpression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (c.key_eq(r.getDefinition())) { + if (e = r.getEnclosingCallable()) { + if (direction = "Depends") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + for (n in string::__undetermined_all__()) { + for (e in LombokField(__all_data__), + c in CallExpression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (e = c.getLombokField()) { + let (tmp = CallExpression(__all_data__).find(e)) { + if (!isDirectCall(tmp)) { + if (n = c.getMethodName()) { + if (!n.matches("get.*")) { + if (direction = "Depends") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + } + } + } + } + } + } + + pub fn getAnAncestorCDDependsNode(self, type: string, direction: string) -> ECGNode { + for (e in ECGNode(__all_data__), + c in Callable(__all_data__), + r in ReferenceExpression(__all_data__)) { + if (type = "CD") { + if (self.key_eq(c)) { + for (e1 in c.getAnAncestorCallee()) { + if (direction = "Depends") { + if (e.key_eq(e1)) { + return e + } + } + } + } + if (self.key_eq(r.getDefinition())) { + if (c = r.getEnclosingCallable()) { + for (e1 in c.getAnAncestorCallee()) { + if (direction = "Depends") { + if (e.key_eq(e1)) { + return e + } + } + } + } + } + } + } + } + + pub fn getPath(self) -> string { + for (line in int::__undetermined_all__(), + t in string::__undetermined_all__(), + path in string::__undetermined_all__(), + info in string::__undetermined_all__()) { + for (l in coref::java::Location(__all_data__)) { + if (l = self.getLocation()) { + if (path = l.getFile().getRelativePath()) { + if (line = l.getStartLineNumber()) { + if (t = line.to_string()) { + if (info = path + ":" + t) { + return info + } + } + } + } + } + } + } + } + + fn tmp_0(n: string) -> bool { + if (n.matches("get.*")) { + return true + } + } +} + +pub fn getNode(node: int) -> bool { + [ + // {-6062664004747450091}, + // {-8976777526123968441}, + // {-7423165299222302626} + ] +} + +pub fn temp(a: ECGNode, b: ECGNode, c: ECGNode, edgeType: string, direction: string) -> bool { + let (java_db = default_java_db()) { + if (getNode(a.id)) { + if (b = a.getAnAncestorCDNode(__all_data__, __all_data__)) { + if (c = b.getECGNode(edgeType, direction)) { + return true + } + } + if (b = a) { + if (c = b.getECGNode(edgeType, direction)) { + return true + } + } + } + } +} + +pub fn real_output(m: ECGNode, nodeType1: string, nodeText1: string, n: ECGNode, nodeType2: string, nodeText2: string, edgeType: string, direction: string) -> bool { + let (java_db = default_java_db()) { + for (e in ECGNode(java_db)) { + if (temp(e, m, n, edgeType, direction)) { + if (nodeType1 = m.getType()) { + if (nodeText1 = m.print()) { + if (nodeText2 = n.print()) { + if (nodeType2 = n.getType()) { + return true + } + } + } + } + } + } + } +} + + +fn default_java_db() -> JavaDB { + return JavaDB::load("coref_java_src.db") +} + +fn main() { + output(real_output()) +} \ No newline at end of file diff --git a/example/icse25/rules/ecgformybatis.gdl b/example/icse25/rules/ecgformybatis.gdl new file mode 100644 index 00000000..f13eb58e --- /dev/null +++ b/example/icse25/rules/ecgformybatis.gdl @@ -0,0 +1,54 @@ +// script +use coref::xml::* + +schema SqlIncludeElement extends XmlElement {} + +impl SqlIncludeElement { + pub fn __all__(db: XmlDB) -> *SqlIncludeElement { + for (tmp in XmlElement(db)) { + if (tmp.getName() = "include") { + yield SqlIncludeElement { + id : tmp.id, + parent_id : tmp.parent_id, + index_order : tmp.index_order, + location_id : tmp.location_id + } + } + } + } +} + +pub fn real_output(id: string, type: string, table: string, columns: string) -> bool { + let (xml_db = default_xml_db()) { + for (d in DalXmlElement(xml_db)) { + if (id = d.getValueByAttributeName("id")) { + if (type = d.getValueByAttributeName("parameterType")) { + for (auto_tmp1 in d.getTableName()) { + if (table = auto_tmp1) { + if (columns = d.getColumnLists()) { + return true + } + } + } + } + } + } + } +} + + +fn default_xml_db() -> XmlDB { + return XmlDB::load("coref_xml_src.db") +} + +fn tmp_0(temp1: string) -> bool { + let (xml_db = default_xml_db()) { + if (temp1.len() > 0) { + return true + } + } +} + +fn main() { + output(real_output()) +} \ No newline at end of file diff --git a/example/icse25/rules/ecgforpom.gdl b/example/icse25/rules/ecgforpom.gdl new file mode 100644 index 00000000..a4957186 --- /dev/null +++ b/example/icse25/rules/ecgforpom.gdl @@ -0,0 +1,292 @@ +// script +use coref::xml::* +schema ECGXmlNode { + @primary id: int +} + +impl ECGXmlNode { + pub fn __all__(db: XmlDB) -> *ECGXmlNode { + for (e in XmlElement(db)) { + yield ECGXmlNode {id : e.id} + } + for (e in XmlAttribute(db)) { + yield ECGXmlNode {id : e.id} + } + for (e in XmlCharacter(db)) { + yield ECGXmlNode {id : e.id} + } + } + + pub fn getLocation(self) -> Location { + for (l in Location(__all_data__)) { + for (e in XmlElement(__all_data__)) { + if (self.key_eq(e)) { + if (l = e.getLocation()) { + return l + } + } + } + for (e in XmlAttribute(__all_data__)) { + if (self.key_eq(e)) { + if (l = e.getLocation()) { + return l + } + } + } + for (e in XmlCharacter(__all_data__)) { + if (self.key_eq(e)) { + if (l = e.getLocation()) { + return l + } + } + } + } + } + + pub fn getType(self) -> string { + for (t in string::__undetermined_all__()) { + for (e in XmlElement(__all_data__)) { + if (self.key_eq(e)) { + if (t = "XmlElement") { + return t + } + } + } + for (e in XmlAttribute(__all_data__)) { + if (self.key_eq(e)) { + if (t = "XmlAttribute") { + return t + } + } + } + for (e in XmlCharacter(__all_data__)) { + if (self.key_eq(e)) { + if (t = "XmlCharacter") { + return t + } + } + } + } + } +} + +schema DependencyElement extends XmlElement {} + +impl DependencyElement { + pub fn __all__(db: XmlDB) -> *DependencyElement { + for (tmp in XmlElement(db)) { + if (tmp.getElementName() = "dependency") { + yield DependencyElement { + id : tmp.id, + parent_id : tmp.parent_id, + index_order : tmp.index_order, + location_id : tmp.location_id + } + } + } + } +} + +schema GroupElement extends XmlElement {} + +impl GroupElement { + pub fn __all__(db: XmlDB) -> *GroupElement { + for (tmp in XmlElement(db)) { + if (tmp.getElementName() = "groupId") { + yield GroupElement { + id : tmp.id, + parent_id : tmp.parent_id, + index_order : tmp.index_order, + location_id : tmp.location_id + } + } + } + } +} + +schema VersionElement extends XmlElement {} + +impl VersionElement { + pub fn __all__(db: XmlDB) -> *VersionElement { + for (tmp in XmlElement(db)) { + if (tmp.getElementName() = "version") { + yield VersionElement { + id : tmp.id, + parent_id : tmp.parent_id, + index_order : tmp.index_order, + location_id : tmp.location_id + } + } + } + } + + pub fn getLineNo(self) -> int { + for (lineNo in int::__undetermined_all__()) { + if (lineNo = self.getLocation().getStartLineNumber()) { + return lineNo + } + } + } + + pub fn getVersion(self) -> string { + for (version in string::__undetermined_all__(), + dependencyCharacterText in string::__undetermined_all__()) { + for (dependencyCharacter in XmlCharacter(__all_data__)) { + if (dependencyCharacter.getBelongedElement().key_eq(self)) { + if (dependencyCharacterText = dependencyCharacter.getText()) { + if (tmp_0(dependencyCharacterText)) { + for (propertyCharacterText in string::__undetermined_all__()) { + for (property in PropertyElement(__all_data__), + propertyCharacter in XmlCharacter(__all_data__)) { + if (propertyCharacter.getBelongedElement().key_eq(property)) { + if (propertyCharacterText = property.getElementName()) { + if (dependencyCharacterText.contains(propertyCharacterText)) { + if (version = propertyCharacter.getText()) { + return version + } + } + } + } + } + } + } + if (!(tmp_0(dependencyCharacterText))) { + if (version = dependencyCharacter.getText()) { + return version + } + } + } + } + } + } + } +} + +schema PropertyElement extends XmlElement { + +} + +impl PropertyElement { + + @data_constraint + @inline + pub fn __all__(db: XmlDB) -> *PropertyElement { + for (tmp in XmlElement(db)) { + if (tmp.getParent().getElementName() = "properties") { + yield PropertyElement { + id : tmp.id, + parent_id : tmp.parent_id, + index_order : tmp.index_order, + location_id : tmp.location_id + } + } + } + } + + +} + +schema ArtifactElement extends XmlElement { + +} + +impl ArtifactElement { + + @data_constraint + @inline + pub fn __all__(db: XmlDB) -> *ArtifactElement { + for (tmp in XmlElement(db)) { + if (tmp.getElementName() = "artifactId") { + yield ArtifactElement { + id : tmp.id, + parent_id : tmp.parent_id, + index_order : tmp.index_order, + location_id : tmp.location_id + } + } + } + } + + +} + +pub fn existVersion(p: DependencyElement) -> bool { + let (xml_db = default_xml_db()) { + for (v in VersionElement(xml_db)) { + if (p.key_eq(v.getParent())) { + return true + } + } + } +} +pub fn real_output(fileName: string, groupId: string, artifactId: string, version: string) -> bool { + let (xml_db = default_xml_db()) { + for (f in PomFile(xml_db), + e1 in GroupElement(xml_db), + e2 in VersionElement(xml_db), + e3 in ArtifactElement(xml_db), + c1 in XmlCharacter(xml_db), + c2 in XmlCharacter(xml_db), + p in DependencyElement(xml_db)) { + if (f.key_eq(p.getLocation().getFile())) { + if (fileName = f.getRelativePath()) { + if (p.key_eq(e1.getParent())) { + if (e1.key_eq(c1.getBelongedElement())) { + if (groupId = c1.getText()) { + if (tmp_1(p)) { + if (p.key_eq(e2.getParent())) { + if (version = e2.getVersion()) { + if (p.key_eq(e3.getParent())) { + if (e3.key_eq(c2.getBelongedElement())) { + if (artifactId = c2.getText()) { + return true + } + } + } + } + } + } + if (!(tmp_1(p))) { + if (version = "") { + if (p.key_eq(e3.getParent())) { + if (e3.key_eq(c2.getBelongedElement())) { + if (artifactId = c2.getText()) { + return true + } + } + } + } + } + } + } + } + } + } + } + } +} + + +fn default_xml_db() -> XmlDB { + return XmlDB::load("coref_xml_src.db") +} + +fn tmp_0(dependencyCharacterText: string) -> bool { + let (xml_db = default_xml_db()) { + if (dependencyCharacterText.contains("${")) { + return true + } + } +} + +fn tmp_1(p: DependencyElement) -> bool { + let (xml_db = default_xml_db()) { + if (existVersion(p)) { + return true + } + } +} + +fn main() { + output(real_output()) +} \ No newline at end of file diff --git a/example/icse25/rules/ecgforspring.gdl b/example/icse25/rules/ecgforspring.gdl new file mode 100644 index 00000000..e2263b7f --- /dev/null +++ b/example/icse25/rules/ecgforspring.gdl @@ -0,0 +1,184 @@ +// script +use coref::xml::* +schema BeanElement extends XmlElement { + +} + +impl BeanElement { + + @data_constraint + @inline + pub fn __all__(db: XmlDB) -> *BeanElement { + for (tmp in XmlElement(db)) { + if (tmp.getName() = "bean") { + yield BeanElement { + id : tmp.id, + parent_id : tmp.parent_id, + index_order : tmp.index_order, + location_id : tmp.location_id + } + } + } + } + + pub fn getProperty(self) -> PropertyElement { + for (e in PropertyElement(__all_data__)) { + if (self.key_eq(e.getParent())) { + return e + } + } + } + + +} + +schema ImportElement extends XmlElement { + +} + +impl ImportElement { + + @data_constraint + @inline + pub fn __all__(db: XmlDB) -> *ImportElement { + for (tmp in XmlElement(db)) { + if (tmp.getName() = "import") { + yield ImportElement { + id : tmp.id, + parent_id : tmp.parent_id, + index_order : tmp.index_order, + location_id : tmp.location_id + } + } + } + } + + +} + +schema MapElement extends XmlElement { + +} + +impl MapElement { + + @data_constraint + @inline + pub fn __all__(db: XmlDB) -> *MapElement { + for (tmp in XmlElement(db)) { + if (tmp.getName() = "map") { + yield MapElement { + id : tmp.id, + parent_id : tmp.parent_id, + index_order : tmp.index_order, + location_id : tmp.location_id + } + } + } + } + + +} + +schema EntryElement extends XmlElement { + +} + +impl EntryElement { + + @data_constraint + @inline + pub fn __all__(db: XmlDB) -> *EntryElement { + for (tmp in XmlElement(db)) { + if (tmp.getName() = "entry") { + yield EntryElement { + id : tmp.id, + parent_id : tmp.parent_id, + index_order : tmp.index_order, + location_id : tmp.location_id + } + } + } + } + + +} + +schema ValueElement extends XmlElement { + +} + +impl ValueElement { + + @data_constraint + @inline + pub fn __all__(db: XmlDB) -> *ValueElement { + for (tmp in XmlElement(db)) { + if (tmp.getName() = "value") { + yield ValueElement { + id : tmp.id, + parent_id : tmp.parent_id, + index_order : tmp.index_order, + location_id : tmp.location_id + } + } + } + } + + +} + +schema PropertyElement extends XmlElement { + +} + +impl PropertyElement { + + @data_constraint + @inline + pub fn __all__(db: XmlDB) -> *PropertyElement { + for (tmp in XmlElement(db)) { + if (tmp.getName() = "property") { + yield PropertyElement { + id : tmp.id, + parent_id : tmp.parent_id, + index_order : tmp.index_order, + location_id : tmp.location_id + } + } + } + } + + pub fn getValueByPropertyName(self, name: string) -> string { + for (value in string::__undetermined_all__()) { + if (name = self.getValueByAttributeName("name")) { + if (value = self.getValueByAttributeName("value")) { + return value + } + } + } + } + + +} + +pub fn real_output(id: string, pClass: string) -> bool { + let (xml_db = default_xml_db()) { + for (b in BeanElement(xml_db)) { + if (id = b.getValueByAttributeName("id")) { + if (pClass = b.getValueByAttributeName("class")) { + return true + } + } + } + } +} + + +fn default_xml_db() -> XmlDB { + return XmlDB::load("coref_xml_src.db") +} + +fn main() { + output(real_output()) +} \ No newline at end of file diff --git a/example/icse25/rules/ecgxml.gdl b/example/icse25/rules/ecgxml.gdl new file mode 100644 index 00000000..b168bfc5 --- /dev/null +++ b/example/icse25/rules/ecgxml.gdl @@ -0,0 +1,489 @@ +// script +use coref::xml::* +schema BeanElement extends XmlElement { + +} + +impl BeanElement { + + @data_constraint + @inline + pub fn __all__(db: XmlDB) -> *BeanElement { + for (tmp in XmlElement(db)) { + if (tmp.getName() = "bean") { + yield BeanElement { + id : tmp.id, + parent_id : tmp.parent_id, + index_order : tmp.index_order, + location_id : tmp.location_id + } + } + } + } + + pub fn getProperty(self) -> PropertyElement { + for (e in PropertyElement(__all_data__)) { + if (self.key_eq(e.getParent())) { + return e + } + } + } + + +} + +schema ImportElement extends XmlElement { + +} + +impl ImportElement { + + @data_constraint + @inline + pub fn __all__(db: XmlDB) -> *ImportElement { + for (tmp in XmlElement(db)) { + if (tmp.getName() = "import") { + yield ImportElement { + id : tmp.id, + parent_id : tmp.parent_id, + index_order : tmp.index_order, + location_id : tmp.location_id + } + } + } + } + + +} + +schema MapElement extends XmlElement { + +} + +impl MapElement { + + @data_constraint + @inline + pub fn __all__(db: XmlDB) -> *MapElement { + for (tmp in XmlElement(db)) { + if (tmp.getName() = "map") { + yield MapElement { + id : tmp.id, + parent_id : tmp.parent_id, + index_order : tmp.index_order, + location_id : tmp.location_id + } + } + } + } + + +} + +schema EntryElement extends XmlElement { + +} + +impl EntryElement { + + @data_constraint + @inline + pub fn __all__(db: XmlDB) -> *EntryElement { + for (tmp in XmlElement(db)) { + if (tmp.getName() = "entry") { + yield EntryElement { + id : tmp.id, + parent_id : tmp.parent_id, + index_order : tmp.index_order, + location_id : tmp.location_id + } + } + } + } + + +} + +schema ValueElement extends XmlElement { + +} + +impl ValueElement { + + @data_constraint + @inline + pub fn __all__(db: XmlDB) -> *ValueElement { + for (tmp in XmlElement(db)) { + if (tmp.getName() = "value") { + yield ValueElement { + id : tmp.id, + parent_id : tmp.parent_id, + index_order : tmp.index_order, + location_id : tmp.location_id + } + } + } + } + + +} + +schema PropertyElement extends XmlElement { + +} + +impl PropertyElement { + + @data_constraint + @inline + pub fn __all__(db: XmlDB) -> *PropertyElement { + for (tmp in XmlElement(db)) { + if (tmp.getName() = "property") { + yield PropertyElement { + id : tmp.id, + parent_id : tmp.parent_id, + index_order : tmp.index_order, + location_id : tmp.location_id + } + } + } + } + + pub fn getValueByPropertyName(self, name: string) -> string { + for (value in string::__undetermined_all__()) { + if (name = self.getValueByAttributeName("name")) { + if (value = self.getValueByAttributeName("value")) { + return value + } + } + } + } + + +} + +schema DependencyElement extends XmlElement { + +} + +impl DependencyElement { + + @data_constraint + @inline + pub fn __all__(db: XmlDB) -> *DependencyElement { + for (tmp in XmlElement(db)) { + if (tmp.getElementName() = "dependency") { + yield DependencyElement { + id : tmp.id, + parent_id : tmp.parent_id, + index_order : tmp.index_order, + location_id : tmp.location_id + } + } + } + } + + +} + +schema GroupElement extends XmlElement { + +} + +impl GroupElement { + + @data_constraint + @inline + pub fn __all__(db: XmlDB) -> *GroupElement { + for (tmp in XmlElement(db)) { + if (tmp.getElementName() = "groupId") { + yield GroupElement { + id : tmp.id, + parent_id : tmp.parent_id, + index_order : tmp.index_order, + location_id : tmp.location_id + } + } + } + } + + +} + +schema VersionElement extends XmlElement { + +} + +impl VersionElement { + + @data_constraint + @inline + pub fn __all__(db: XmlDB) -> *VersionElement { + for (tmp in XmlElement(db)) { + if (tmp.getElementName() = "version") { + yield VersionElement { + id : tmp.id, + parent_id : tmp.parent_id, + index_order : tmp.index_order, + location_id : tmp.location_id + } + } + } + } + + pub fn getLineNo(self) -> int { + for (lineNo in int::__undetermined_all__()) { + if (lineNo = self.getLocation().getStartLineNumber()) { + return lineNo + } + } + } + + pub fn getVersion(self) -> string { + for (version in string::__undetermined_all__(), + dependencyCharacterText in string::__undetermined_all__()) { + for (dependencyCharacter in XmlCharacter(__all_data__)) { + if (dependencyCharacter.getBelongedElement().key_eq(self)) { + if (dependencyCharacterText = dependencyCharacter.getText()) { + if (Self::tmp_0(dependencyCharacterText)) { + for (propertyCharacterText in string::__undetermined_all__()) { + for (property in PropertyElement(__all_data__), + propertyCharacter in XmlCharacter(__all_data__)) { + if (propertyCharacter.getBelongedElement().key_eq(property)) { + if (propertyCharacterText = property.getElementName()) { + if (dependencyCharacterText.contains(propertyCharacterText)) { + if (version = propertyCharacter.getText()) { + return version + } + } + } + } + } + } + } + if (!Self::tmp_0(dependencyCharacterText)) { + if (version = dependencyCharacter.getText()) { + return version + } + } + } + } + } + } + } + + fn tmp_0(dependencyCharacterText: string) -> bool { + if (dependencyCharacterText.contains("${")) { + return true + } + } +} + +schema PropertyInPomElement extends XmlElement { + +} + +impl PropertyInPomElement { + + @data_constraint + @inline + pub fn __all__(db: XmlDB) -> *PropertyInPomElement { + for (tmp in XmlElement(db)) { + if (tmp.getParent().getElementName() = "properties") { + yield PropertyInPomElement { + id : tmp.id, + parent_id : tmp.parent_id, + index_order : tmp.index_order, + location_id : tmp.location_id + } + } + } + } + + +} + +schema ArtifactElement extends XmlElement { + +} + +impl ArtifactElement { + + @data_constraint + @inline + pub fn __all__(db: XmlDB) -> *ArtifactElement { + for (tmp in XmlElement(db)) { + if (tmp.getElementName() = "artifactId") { + yield ArtifactElement { + id : tmp.id, + parent_id : tmp.parent_id, + index_order : tmp.index_order, + location_id : tmp.location_id + } + } + } + } + + +} + +schema ECGXmlNode { + @primary id: int +} + +impl ECGXmlNode { + pub fn __all__(db: XmlDB) -> *ECGXmlNode { + for (e in XmlPomElement(db)) { + yield ECGXmlNode {id : e.id} + } + for (e in XmlSpringElement(db)) { + yield ECGXmlNode {id : e.id} + } + for (e in XmlCharacter(db)) { + yield ECGXmlNode {id : e.id} + } + for (e in XmlAttribute(db)) { + yield ECGXmlNode {id : e.id} + } + } + + pub fn getLocation(self) -> Location { + for (l in Location(__all_data__)) { + for (e in XmlElement(__all_data__)) { + if (self.key_eq(e)) { + if (l = e.getLocation()) { + return l + } + } + } + for (e in XmlAttribute(__all_data__)) { + if (self.key_eq(e)) { + if (l = e.getLocation()) { + return l + } + } + } + for (e in XmlCharacter(__all_data__)) { + if (self.key_eq(e)) { + if (l = e.getLocation()) { + return l + } + } + } + } + } + + pub fn getType(self) -> string { + for (t in string::__undetermined_all__()) { + for (e in XmlElement(__all_data__)) { + if (self.key_eq(e)) { + if (t = "XmlElement") { + return t + } + } + } + for (e in XmlAttribute(__all_data__)) { + if (self.key_eq(e)) { + if (t = "XmlAttribute") { + return t + } + } + } + for (e in XmlCharacter(__all_data__)) { + if (self.key_eq(e)) { + if (t = "XmlCharacter") { + return t + } + } + } + } + } + + pub fn getText(self) -> string { + for (e in XmlElement(__all_data__)) { + if (self.key_eq(e)) { + return e.getName() + } + } + for (e in XmlAttribute(__all_data__)) { + if (self.key_eq(e)) { + return e.getName() + " = " + e.getValue() + } + } + for (e in XmlCharacter(__all_data__)) { + if (self.key_eq(e)) { + return e.getText() + } + } + } + + pub fn getEnclosingECGXmlNode(self) -> ECGXmlNode { + for (e in XmlElement(__all_data__)) { + if (self.key_eq(e)) { + return e.to() + } + } + for (e in XmlAttribute(__all_data__)) { + if (self.key_eq(e)) { + return e.getXmlElement().to() + } + } + for (e in XmlCharacter(__all_data__)) { + if (self.key_eq(e)) { + return e.getBelongedElement().to() + } + } + } +} + +pub fn gitdiff(filePath: string, lineNo: int) -> bool { + [ + {"pom.xml", 27}, + {"pom.xml", 612}, + {"pom.xml", 613}, + {"pom.xml", 614}, + {"pom.xml", 615}, + {"pom.xml", 616}, + {"pom.xml", 617}, + {"pom.xml", 649} + ] +} +pub fn transfertofile(f: XmlFile, filename: string, lineNumber: int) -> bool { + let (xml_db = default_xml_db()) { + if (gitdiff(filename, lineNumber)) { + if (filename = f.getRelativePath()) { + return true + } + } + } +} +pub fn real_output(filename: string, lineNumber: int, c: ECGXmlNode, typeInAST: string, e: int, s1: int) -> bool { + let (xml_db = default_xml_db()) { + for (f in XmlFile(xml_db)) { + if (transfertofile(f, filename, lineNumber)) { + if (c.getLocation().getFile() = f) { + if (s1 = c.getLocation().getStartLineNumber()) { + if (e = c.getLocation().getEndLineNumber()) { + if (lineNumber > s1 - 1) { + if (lineNumber < e + 1) { + if (typeInAST = c.getType()) { + return true + } + } + } + } + } + } + } + } + } +} + + +fn default_xml_db() -> XmlDB { + return XmlDB::load("coref_xml_src.db") +} + +fn main() { + output(real_output()) +} \ No newline at end of file diff --git a/example/icse25/rules/rule1.gdl b/example/icse25/rules/rule1.gdl new file mode 100644 index 00000000..66b177a3 --- /dev/null +++ b/example/icse25/rules/rule1.gdl @@ -0,0 +1,998 @@ +// script +use coref::java::* + +schema ECGNode extends ElementParent {} + +impl ECGNode { + pub fn __all__(db: JavaDB) -> *ECGNode { + for (tmp in ElementParent(db)) { + for (m in Method(db)) { + if (tmp.key_eq(m)) { + yield ECGNode { + id : tmp.id + } + } + } + for (m in Variable(db)) { + if (tmp.key_eq(m)) { + yield ECGNode { + id : tmp.id + } + } + } + for (m in Expression(db)) { + if (tmp.key_eq(m)) { + yield ECGNode { + id : tmp.id + } + } + } + } + } + + pub fn getType(self) -> string { + for (t in string::__undetermined_all__()) { + for (m in Method(__all_data__)) { + if (self.key_eq(m)) { + if (t = "Method") { + return t + } + } + } + for (m in LocalVariable(__all_data__)) { + if (self.key_eq(m)) { + if (t = "LocalVariable") { + return t + } + } + } + for (m in Parameter(__all_data__)) { + if (self.key_eq(m)) { + if (t = "Parameter") { + return t + } + } + } + for (m in Field(__all_data__)) { + if (self.key_eq(m)) { + if (t = "Field") { + return t + } + } + } + for (m in EnumConstant(__all_data__)) { + if (self.key_eq(m)) { + if (t = "EnumConstant") { + return t + } + } + } + for (m in Expression(__all_data__)) { + if (self.key_eq(m)) { + if (t = m.getType()) { + return t + } + } + } + } + } + + pub fn getDDNode(self, type: string, direction: string) -> ECGNode { + for (e1 in ECGNode(__all_data__)) { + for (e in Parameter(__all_data__), + c in Method(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + for (auto_tmp1 in c.getParameter()) { + if (e = auto_tmp1) { + if (direction = "Depended") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + for (r in ReturnStatement(__all_data__), + c in Method(__all_data__), + e in Expression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (c.key_eq(r.getEnclosingCallable())) { + if (e = r.getResult()) { + if (direction = "Depends") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + for (c in Callable(__all_data__), + e in Field(__all_data__), + r in ReferenceExpression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (c = r.getEnclosingCallable()) { + if (e.key_eq(r.getDefinition())) { + if (direction = "Depended") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + for (c in Callable(__all_data__), + e in EnumConstant(__all_data__), + r in ReferenceExpression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (c = r.getEnclosingCallable()) { + if (e.key_eq(r.getDefinition())) { + if (direction = "Depended") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + for (e in Callable(__all_data__), + c in Field(__all_data__), + r in ReferenceExpression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (c.key_eq(r.getDefinition())) { + if (e = r.getEnclosingCallable()) { + if (direction = "Depends") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + for (e in Callable(__all_data__), + c in EnumConstant(__all_data__), + r in ReferenceExpression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (c.key_eq(r.getDefinition())) { + if (e = r.getEnclosingCallable()) { + if (direction = "Depends") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + for (c in Callable(__all_data__), + e in CallExpression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (c = e.getEnclosingCallable()) { + for (m in Method(__all_data__)) { + if (m = e.getMethod()) { + if (!isDirectCall(e)) { + if (direction = "Depended") { + if (type = "DD") { + return e1 + } + } + } + } + } + for (f in LombokField(__all_data__)) { + if (f = e.getLombokField()) { + if (!isDirectCall(e)) { + if (direction = "Depended") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + } + } + for (n in string::__undetermined_all__()) { + for (e in LombokField(__all_data__), + c in CallExpression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (e = c.getLombokField()) { + let (tmp_find = CallExpression(__all_data__).find(e)) { + if (!isDirectCall(tmp_find)) { + if (n = c.getMethodName()) { + if (Self::tmp_0(n)) { + if (direction = "Depended") { + if (type = "DD") { + return e1 + } + } + } + if (!Self::tmp_0(n)) { + if (direction = "Depends") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + } + } + } + } + for (e in Variable(__all_data__), + c in CallExpression(__all_data__), + r in ReferenceExpression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (!isDirectCall(c)) { + for (auto_tmp2 in c.getArguments()) { + if (r.key_eq(auto_tmp2)) { + if (e.key_eq(r.getDefinition())) { + if (direction = "Depended") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + } + } + for (e in CallExpression(__all_data__), + c in CallExpression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (!isDirectCall(c)) { + for (auto_tmp3 in c.getArguments()) { + if (e.key_eq(auto_tmp3)) { + if (direction = "Depended") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + } + for (e in CallExpression(__all_data__), + c in CallExpression(__all_data__), + s in CallExpression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (!isDirectCall(c)) { + for (auto_tmp4 in c.getAnAncestor()) { + if (s.getReference().key_eq(auto_tmp4)) { + for (auto_tmp5 in s.getArguments()) { + if (auto_tmp5.key_eq(e)) { + if (direction = "Depended") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + } + } + } + } + } + + pub fn getAnAncestorDDNode(self, type: string, direction: string) -> ECGNode { + for (e in ECGNode(__all_data__)) { + if (type = "DD") { + if (e = self.getDDNode(type, direction)) { + return e + } + if (e = self.getAnAncestorDDNode(__all_data__, __all_data__).getDDNode(type, direction)) { + return e + } + } + } + } + + pub fn getCDNode(self, type: string, direction: string) -> ECGNode { + for (e in ECGNode(__all_data__), + c in Callable(__all_data__), + r in ReferenceExpression(__all_data__)) { + if (self.key_eq(c)) { + if (type = "CD") { + for (e1 in Method(__all_data__)) { + for (auto_tmp1 in c.getCallee()) { + if (e1.key_eq(auto_tmp1)) { + if (direction = "Depends") { + if (e.key_eq(e1)) { + return e + } + } + } + } + } + for (e2 in Method(__all_data__)) { + for (auto_tmp2 in c.getCaller()) { + if (e2.key_eq(auto_tmp2)) { + if (direction = "Depended") { + if (e.key_eq(e2)) { + return e + } + } + } + } + } + } + } + if (self.key_eq(r.getDefinition())) { + if (c = r.getEnclosingCallable()) { + if (type = "CD") { + for (e1 in Method(__all_data__)) { + for (auto_tmp1 in c.getCallee()) { + if (e1.key_eq(auto_tmp1)) { + if (direction = "Depends") { + if (e.key_eq(e1)) { + return e + } + } + } + } + } + for (e2 in Method(__all_data__)) { + for (auto_tmp2 in c.getCaller()) { + if (e2.key_eq(auto_tmp2)) { + if (direction = "Depended") { + if (e.key_eq(e2)) { + return e + } + } + } + } + } + } + } + } + } + } + + pub fn getAnAncestorCDNode(self, type: string, direction: string) -> ECGNode { + for (e in ECGNode(__all_data__), + c in Callable(__all_data__), + r in ReferenceExpression(__all_data__)) { + if (type = "CD") { + if (self.key_eq(c)) { + for (e1 in Method(__all_data__)) { + for (auto_tmp1 in c.getAnAncestorCallee()) { + if (e1.key_eq(auto_tmp1)) { + if (direction = "Depends") { + if (e.key_eq(e1)) { + return e + } + } + } + } + } + for (e2 in Method(__all_data__)) { + for (auto_tmp2 in c.getAnAncestorCaller()) { + if (e2.key_eq(auto_tmp2)) { + if (direction = "Depended") { + if (e.key_eq(e2)) { + return e + } + } + } + } + } + } + if (self.key_eq(r.getDefinition())) { + if (c = r.getEnclosingCallable()) { + for (e1 in Method(__all_data__)) { + for (auto_tmp1 in c.getAnAncestorCallee()) { + if (e1.key_eq(auto_tmp1)) { + if (direction = "Depends") { + if (e.key_eq(e1)) { + return e + } + } + } + } + } + for (e2 in Method(__all_data__)) { + for (auto_tmp2 in c.getAnAncestorCaller()) { + if (e2.key_eq(auto_tmp2)) { + if (direction = "Depended") { + if (e.key_eq(e2)) { + return e + } + } + } + } + } + } + } + } + } + } + + pub fn getECGNode(self, type: string, direction: string) -> ECGNode { + for (e in ECGNode(__all_data__)) { + if (e = self.getCDNode(type, direction)) { + return e + } + if (e = self.getDDNode(type, direction)) { + return e + } + } + } + + pub fn getAnAncestorECGNode(self, type: string, direction: string) -> ECGNode { + for (e in ECGNode(__all_data__), tmp in ECGNode(__all_data__)) { + if (tmp = self.getAnAncestorCDNode(__all_data__, __all_data__)) { + if (e = tmp.getECGNode(type, direction)) { + return e + } + } + } + } + + pub fn getAnAncestorCDDependedNode(self, type: string, direction: string) -> ECGNode { + for (e in ECGNode(__all_data__), c in Callable(__all_data__), r in ReferenceExpression(__all_data__)) { + if (type = "CD") { + if (self.key_eq(c) || (self.key_eq(r.getDefinition()) && r.getEnclosingCallable() = c)) { + for (e2 in Method(__all_data__), c_caller in c.getAnAncestorCaller()) { + if (e2.key_eq(c_caller) && direction = "Depended" && e.key_eq(e2)) { + return e + } + } + } + } + } + } + + pub fn getECGDependsNode(self, type: string, direction: string) -> ECGNode { + for (e in ECGNode(__all_data__)) { + if (e = self.getCDDependsNode(type, direction)) { + return e + } + if (e = self.getDDDependsNode(type, direction)) { + return e + } + } + } + + pub fn getCDDependsNode(self, type: string, direction: string) -> ECGNode { + for (e in ECGNode(__all_data__), + c in Callable(__all_data__), + r in ReferenceExpression(__all_data__)) { + if (self.key_eq(c)) { + if (type = "CD") { + for (e1 in c.getCallee()) { + if (direction = "Depends") { + if (e.key_eq(e1)) { + return e + } + } + } + } + } + for (v in Variable(__all_data__)) { + if (self.key_eq(v)) { + if (v.key_eq(r.getDefinition())) { + if (c = r.getEnclosingCallable()) { + if (type = "CD") { + for (e1 in c.getCallee()) { + if (direction = "Depends") { + if (e.key_eq(e1)) { + return e + } + } + } + } + } + } + } + } + } + } + + pub fn getDDDependsNode(self, type: string, direction: string) -> ECGNode { + for (e1 in ECGNode(__all_data__)) { + for (r in ReturnStatement(__all_data__), + c in Method(__all_data__), + e in Expression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (c.key_eq(r.getEnclosingCallable())) { + if (e = r.getResult()) { + if (direction = "Depends") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + for (e in Callable(__all_data__), + c in Field(__all_data__), + r in ReferenceExpression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (c.key_eq(r.getDefinition())) { + if (e = r.getEnclosingCallable()) { + if (direction = "Depends") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + for (e in Callable(__all_data__), + c in EnumConstant(__all_data__), + r in ReferenceExpression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (c.key_eq(r.getDefinition())) { + if (e = r.getEnclosingCallable()) { + if (direction = "Depends") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + for (n in string::__undetermined_all__()) { + for (e in LombokField(__all_data__), + c in CallExpression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (e = c.getLombokField()) { + let (tmp = CallExpression(__all_data__).find(e)) { + if (!isDirectCall(tmp)) { + if (n = c.getMethodName()) { + if (!n.matches("get.*")) { + if (direction = "Depends") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + } + } + } + } + } + } + + pub fn getAnAncestorCDDependsNode(self, type: string, direction: string) -> ECGNode { + for (e in ECGNode(__all_data__), + c in Callable(__all_data__), + r in ReferenceExpression(__all_data__)) { + if (type = "CD") { + if (self.key_eq(c)) { + for (e1 in c.getAnAncestorCallee()) { + if (direction = "Depends") { + if (e.key_eq(e1)) { + return e + } + } + } + } + if (self.key_eq(r.getDefinition())) { + if (c = r.getEnclosingCallable()) { + for (e1 in c.getAnAncestorCallee()) { + if (direction = "Depends") { + if (e.key_eq(e1)) { + return e + } + } + } + } + } + } + } + } + + pub fn getPath(self) -> string { + for (line in int::__undetermined_all__(), + t in string::__undetermined_all__(), + path in string::__undetermined_all__(), + info in string::__undetermined_all__()) { + for (l in coref::java::Location(__all_data__)) { + if (l = self.getLocation()) { + if (path = l.getFile().getRelativePath()) { + if (line = l.getStartLineNumber()) { + if (t = line.to_string()) { + if (info = path + ":" + t) { + return info + } + } + } + } + } + } + } + } + + fn tmp_0(n: string) -> bool { + if (n.matches("get.*")) { + return true + } + } +} + +pub fn gitdiff(filePath: string, lineNo: int) -> bool { + //python替换 + // $gitdiff + // example + [ {"test", 1111}] +} +pub fn transfertofile1(f: File, filename: string, lineNumber: int) -> bool { + let (java_db = default_java_db()) { + if (gitdiff(filename, lineNumber)) { + if (!filename.contains("src/test/java")) { + if (filename = f.getRelativePath()) { + if (isCodeLine(f, filename, lineNumber)) { + return true + } + } + } + } + } +} +pub fn transfertofile(f: File, filename: string, lineNumber: int) -> bool { + let (java_db = default_java_db()) { + if (transfertofile1(f, filename, lineNumber)) { + if (!findSpecialCodeType(filename, lineNumber, __all_data__)) { + return true + } + } + } +} +pub fn isComment(filename: string, lineNumber: int) -> bool { + let (java_db = default_java_db()) { + for (f in File(java_db)) { + if (transfertofile1(f, filename, lineNumber)) { + for (e in int::__undetermined_all__(), + s1 in int::__undetermined_all__()) { + for (c in Comment(java_db)) { + if (c.getLocation().getFile() = f) { + if (s1 = c.getLocation().getStartLineNumber()) { + if (e = c.getLocation().getEndLineNumber()) { + if (lineNumber > s1 - 1) { + if (lineNumber < e + 1) { + return true + } + } + } + } + } + } + } + for (e in int::__undetermined_all__(), + s1 in int::__undetermined_all__()) { + for (c in JavadocComment(java_db)) { + if (c.getLocation().getFile() = f) { + if (s1 = c.getLocation().getStartLineNumber()) { + if (e = c.getLocation().getEndLineNumber()) { + if (lineNumber > s1 - 1) { + if (lineNumber < e + 1) { + return true + } + } + } + } + } + } + } + } + } + } +} +pub fn isAnnotation(filename: string, lineNumber: int) -> bool { + let (java_db = default_java_db()) { + for (f in File(java_db)) { + if (transfertofile1(f, filename, lineNumber)) { + for (e in int::__undetermined_all__(), + s1 in int::__undetermined_all__()) { + for (c in Annotation(java_db)) { + if (c.getLocation().getFile() = f) { + if (s1 = c.getLocation().getStartLineNumber()) { + if (e = c.getLocation().getEndLineNumber()) { + if (lineNumber > s1 - 1) { + if (lineNumber < e + 1) { + return true + } + } + } + } + } + } + } + } + } + } +} +pub fn isCodeLine(f: File, filename: string, lineNumber: int) -> bool { + let (java_db = default_java_db()) { + if (gitdiff(filename, lineNumber)) { + if (f.getRelativePath() = filename) { + for (e in int::__undetermined_all__(), + s1 in int::__undetermined_all__()) { + for (l in Location(java_db)) { + if (l.getFile() = f) { + if (s1 = l.getStartLineNumber()) { + if (e = l.getEndLineNumber()) { + if (lineNumber > s1 - 1) { + if (lineNumber < e + 1) { + return true + } + } + } + } + } + } + } + } + } + } +} +pub fn isLog(filename: string, lineNumber: int) -> bool { + let (java_db = default_java_db()) { + for (f in File(java_db)) { + if (transfertofile1(f, filename, lineNumber)) { + for (e in int::__undetermined_all__(), + s1 in int::__undetermined_all__(), + text in string::__undetermined_all__()) { + for (c in Expression(java_db)) { + if (c.getLocation().getFile() = f) { + if (s1 = c.getLocation().getStartLineNumber()) { + if (e = c.getLocation().getEndLineNumber()) { + if (lineNumber > s1 - 1) { + if (lineNumber < e + 1) { + if (text = c.getPrintableText()) { + if (text.matches("^logger\\..*")) { + return true + } + } + } + } + } + } + } + } + } + } + } + } +} +pub fn getTypeInAST(filename: string, lineNumber: int, typeInAST: string) -> bool { + let (java_db = default_java_db()) { + for (f in File(java_db)) { + if (transfertofile(f, filename, lineNumber)) { + for (e in int::__undetermined_all__(), + s1 in int::__undetermined_all__()) { + for (c in ElementParent(java_db)) { + if (c.getLocation().getFile() = f) { + if (s1 = c.getLocation().getStartLineNumber()) { + if (e = c.getLocation().getEndLineNumber()) { + if (s1 = e) { + if (lineNumber > s1 - 1) { + if (lineNumber < e + 1) { + if (typeInAST = c.getType()) { + return true + } + } + } + } + } + } + } + } + } + } + } + } +} +pub fn getTypeInECG(filename: string, lineNumber: int, typeInAST: string, n: ECGNode) -> bool { + let (java_db = default_java_db()) { + for (f in File(java_db)) { + if (transfertofile(f, filename, lineNumber)) { + if (tmp_0(filename, lineNumber)) { + if (typeInAST = "Callable") { + if (getBelongedCallable(filename, lineNumber, Callable(java_db).find(n))) { + return true + } + } + } + if (!(tmp_0(filename, lineNumber))) { + for (e in int::__undetermined_all__(), + s1 in int::__undetermined_all__()) { + if (n.getLocation().getFile() = f) { + if (s1 = n.getLocation().getStartLineNumber()) { + if (e = n.getLocation().getEndLineNumber()) { + if (lineNumber > s1 - 1) { + if (lineNumber < e + 1) { + if (typeInAST = n.getType()) { + if (isFieldOrEnum(ECGNode(java_db).find(n))) { + return true + } + } + } + } + } + } + } + } + } + } + } + } +} +pub fn isFieldOrEnum(c: ECGNode) -> bool { + let (java_db = default_java_db()) { + for (f in Field(java_db)) { + if (f.key_eq(c)) { + return true + } + } + for (e in EnumConstant(java_db)) { + if (e.key_eq(c)) { + return true + } + } + } +} +pub fn findSpecialCodeType(filename: string, lineNumber: int, type: string) -> bool { + let (java_db = default_java_db()) { + if (isComment(filename, lineNumber)) { + if (type = "comment") { + return true + } + } + if (isAnnotation(filename, lineNumber)) { + if (type = "annotation") { + return true + } + } + if (isLog(filename, lineNumber)) { + if (type = "log") { + return true + } + } + } +} +pub fn getBelongedCallable(filename: string, lineNumber: int, c: Callable) -> bool { + let (java_db = default_java_db()) { + for (f in File(java_db)) { + if (transfertofile(f, filename, lineNumber)) { + for (l1 in int::__undetermined_all__(), + l2 in int::__undetermined_all__()) { + for (i in Identifier(java_db)) { + if (f = c.getLocation().getFile()) { + if (c.key_eq(i.getParent())) { + if (l1 = i.getLocation().getStartLineNumber()) { + if (l2 = c.getLocation().getEndLineNumber()) { + if (lineNumber > l1 - 1) { + if (lineNumber < l2 + 1) { + return true + } + } + } + } + } + } + } + } + } + } + } +} +pub fn getBelongedCallableSignature(filename: string, lineNumber: int, belongedCallable: string) -> bool { + let (java_db = default_java_db()) { + for (i in int::__undetermined_all__()) { + for (c in Callable(java_db)) { + if (transfertofile(__all_data__, filename, lineNumber)) { + if (i = tmp_1().len()) { + if (tmp_2(i)) { + if (belongedCallable = "") { + return true + } + } + if (!(tmp_2(i))) { + if (getBelongedCallable(filename, lineNumber, c)) { + if (belongedCallable = c.getSignature()) { + return true + } + } + } + } + } + } + } + } +} +pub fn real_output(n: ECGNode, belongedCallable: string, typeInAST: string) -> bool { + let (java_db = default_java_db()) { + for (lineNumber in int::__undetermined_all__(), + filename in string::__undetermined_all__()) { + if (transfertofile(__all_data__, filename, lineNumber)) { + if (getBelongedCallableSignature(filename, lineNumber, belongedCallable)) { + if (getTypeInECG(filename, lineNumber, typeInAST, n)) { + return true + } + } + } + } + } +} + + +fn default_java_db() -> JavaDB { + return JavaDB::load("coref_java_src.db") +} + +fn tmp_0(filename: string, lineNumber: int) -> bool { + let (java_db = default_java_db()) { + if (getBelongedCallable(filename, lineNumber, __all_data__)) { + return true + } + } +} + +fn tmp_1() -> *string { + for (filename in string::__undetermined_all__(), lineNumber in int::__undetermined_all__()) { + if (getBelongedCallable(filename, lineNumber, __all_data__)) { + yield filename + } + } +} + +fn tmp_2(i: int) -> bool { + let (java_db = default_java_db()) { + if (i = 0) { + return true + } + } +} + +fn main() { + output(real_output()) +} \ No newline at end of file diff --git a/example/icse25/rules/rule10.gdl b/example/icse25/rules/rule10.gdl new file mode 100644 index 00000000..d60ca373 --- /dev/null +++ b/example/icse25/rules/rule10.gdl @@ -0,0 +1,1227 @@ +// script +use coref::java::* +use coref::xml::* + +schema ECGNode extends ElementParent {} + +impl ECGNode { + pub fn __all__(db: JavaDB) -> *ECGNode { + for (tmp in ElementParent(db)) { + for (m in Method(db)) { + if (tmp.key_eq(m)) { + yield ECGNode { + id : tmp.id + } + } + } + for (m in Variable(db)) { + if (tmp.key_eq(m)) { + yield ECGNode { + id : tmp.id + } + } + } + for (m in Expression(db)) { + if (tmp.key_eq(m)) { + yield ECGNode { + id : tmp.id + } + } + } + } + } + + pub fn getType(self) -> string { + for (t in string::__undetermined_all__()) { + for (m in Method(__all_data__)) { + if (self.key_eq(m)) { + if (t = "Method") { + return t + } + } + } + for (m in LocalVariable(__all_data__)) { + if (self.key_eq(m)) { + if (t = "LocalVariable") { + return t + } + } + } + for (m in Parameter(__all_data__)) { + if (self.key_eq(m)) { + if (t = "Parameter") { + return t + } + } + } + for (m in Field(__all_data__)) { + if (self.key_eq(m)) { + if (t = "Field") { + return t + } + } + } + for (m in EnumConstant(__all_data__)) { + if (self.key_eq(m)) { + if (t = "EnumConstant") { + return t + } + } + } + for (m in Expression(__all_data__)) { + if (self.key_eq(m)) { + if (t = m.getType()) { + return t + } + } + } + } + } + + pub fn getDDNode(self, type: string, direction: string) -> ECGNode { + for (e1 in ECGNode(__all_data__)) { + for (e in Parameter(__all_data__), + c in Method(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + for (auto_tmp1 in c.getParameter()) { + if (e = auto_tmp1) { + if (direction = "Depended") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + for (r in ReturnStatement(__all_data__), + c in Method(__all_data__), + e in Expression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (c.key_eq(r.getEnclosingCallable())) { + if (e = r.getResult()) { + if (direction = "Depends") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + for (c in Callable(__all_data__), + e in Field(__all_data__), + r in ReferenceExpression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (c = r.getEnclosingCallable()) { + if (e.key_eq(r.getDefinition())) { + if (direction = "Depended") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + for (c in Callable(__all_data__), + e in EnumConstant(__all_data__), + r in ReferenceExpression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (c = r.getEnclosingCallable()) { + if (e.key_eq(r.getDefinition())) { + if (direction = "Depended") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + for (e in Callable(__all_data__), + c in Field(__all_data__), + r in ReferenceExpression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (c.key_eq(r.getDefinition())) { + if (e = r.getEnclosingCallable()) { + if (direction = "Depends") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + for (e in Callable(__all_data__), + c in EnumConstant(__all_data__), + r in ReferenceExpression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (c.key_eq(r.getDefinition())) { + if (e = r.getEnclosingCallable()) { + if (direction = "Depends") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + for (c in Callable(__all_data__), + e in CallExpression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (c = e.getEnclosingCallable()) { + for (m in Method(__all_data__)) { + if (m = e.getMethod()) { + if (!isDirectCall(e)) { + if (direction = "Depended") { + if (type = "DD") { + return e1 + } + } + } + } + } + for (f in LombokField(__all_data__)) { + if (f = e.getLombokField()) { + if (!isDirectCall(e)) { + if (direction = "Depended") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + } + } + for (n in string::__undetermined_all__()) { + for (e in LombokField(__all_data__), + c in CallExpression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (e = c.getLombokField()) { + let (tmp_find = CallExpression(__all_data__).find(e)) { + if (!isDirectCall(tmp_find)) { + if (n = c.getMethodName()) { + if (Self::tmp_0(n)) { + if (direction = "Depended") { + if (type = "DD") { + return e1 + } + } + } + if (!Self::tmp_0(n)) { + if (direction = "Depends") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + } + } + } + } + for (e in Variable(__all_data__), + c in CallExpression(__all_data__), + r in ReferenceExpression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (!isDirectCall(c)) { + for (auto_tmp2 in c.getArguments()) { + if (r.key_eq(auto_tmp2)) { + if (e.key_eq(r.getDefinition())) { + if (direction = "Depended") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + } + } + for (e in CallExpression(__all_data__), + c in CallExpression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (!isDirectCall(c)) { + for (auto_tmp3 in c.getArguments()) { + if (e.key_eq(auto_tmp3)) { + if (direction = "Depended") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + } + for (e in CallExpression(__all_data__), + c in CallExpression(__all_data__), + s in CallExpression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (!isDirectCall(c)) { + for (auto_tmp4 in c.getAnAncestor()) { + if (s.getReference().key_eq(auto_tmp4)) { + for (auto_tmp5 in s.getArguments()) { + if (auto_tmp5.key_eq(e)) { + if (direction = "Depended") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + } + } + } + } + } + + pub fn getAnAncestorDDNode(self, type: string, direction: string) -> ECGNode { + for (e in ECGNode(__all_data__)) { + if (type = "DD") { + if (e = self.getDDNode(type, direction)) { + return e + } + if (e = self.getAnAncestorDDNode(__all_data__, __all_data__).getDDNode(type, direction)) { + return e + } + } + } + } + + pub fn getCDNode(self, type: string, direction: string) -> ECGNode { + for (e in ECGNode(__all_data__), + c in Callable(__all_data__), + r in ReferenceExpression(__all_data__)) { + if (self.key_eq(c)) { + if (type = "CD") { + for (e1 in Method(__all_data__)) { + for (auto_tmp1 in c.getCallee()) { + if (e1.key_eq(auto_tmp1)) { + if (direction = "Depends") { + if (e.key_eq(e1)) { + return e + } + } + } + } + } + for (e2 in Method(__all_data__)) { + for (auto_tmp2 in c.getCaller()) { + if (e2.key_eq(auto_tmp2)) { + if (direction = "Depended") { + if (e.key_eq(e2)) { + return e + } + } + } + } + } + } + } + if (self.key_eq(r.getDefinition())) { + if (c = r.getEnclosingCallable()) { + if (type = "CD") { + for (e1 in Method(__all_data__)) { + for (auto_tmp1 in c.getCallee()) { + if (e1.key_eq(auto_tmp1)) { + if (direction = "Depends") { + if (e.key_eq(e1)) { + return e + } + } + } + } + } + for (e2 in Method(__all_data__)) { + for (auto_tmp2 in c.getCaller()) { + if (e2.key_eq(auto_tmp2)) { + if (direction = "Depended") { + if (e.key_eq(e2)) { + return e + } + } + } + } + } + } + } + } + } + } + + pub fn getAnAncestorCDNode(self, type: string, direction: string) -> ECGNode { + for (e in ECGNode(__all_data__), + c in Callable(__all_data__), + r in ReferenceExpression(__all_data__)) { + if (type = "CD") { + if (self.key_eq(c)) { + for (e1 in Method(__all_data__)) { + for (auto_tmp1 in c.getAnAncestorCallee()) { + if (e1.key_eq(auto_tmp1)) { + if (direction = "Depends") { + if (e.key_eq(e1)) { + return e + } + } + } + } + } + for (e2 in Method(__all_data__)) { + for (auto_tmp2 in c.getAnAncestorCaller()) { + if (e2.key_eq(auto_tmp2)) { + if (direction = "Depended") { + if (e.key_eq(e2)) { + return e + } + } + } + } + } + } + if (self.key_eq(r.getDefinition())) { + if (c = r.getEnclosingCallable()) { + for (e1 in Method(__all_data__)) { + for (auto_tmp1 in c.getAnAncestorCallee()) { + if (e1.key_eq(auto_tmp1)) { + if (direction = "Depends") { + if (e.key_eq(e1)) { + return e + } + } + } + } + } + for (e2 in Method(__all_data__)) { + for (auto_tmp2 in c.getAnAncestorCaller()) { + if (e2.key_eq(auto_tmp2)) { + if (direction = "Depended") { + if (e.key_eq(e2)) { + return e + } + } + } + } + } + } + } + } + } + } + + pub fn getECGNode(self, type: string, direction: string) -> ECGNode { + for (e in ECGNode(__all_data__)) { + if (e = self.getCDNode(type, direction)) { + return e + } + if (e = self.getDDNode(type, direction)) { + return e + } + } + } + + pub fn getAnAncestorECGNode(self, type: string, direction: string) -> ECGNode { + for (e in ECGNode(__all_data__), tmp in ECGNode(__all_data__)) { + if (tmp = self.getAnAncestorCDNode(__all_data__, __all_data__)) { + if (e = tmp.getECGNode(type, direction)) { + return e + } + } + } + } + + pub fn getAnAncestorCDDependedNode(self, type: string, direction: string) -> ECGNode { + for (e in ECGNode(__all_data__), c in Callable(__all_data__), r in ReferenceExpression(__all_data__)) { + if (type = "CD") { + if (self.key_eq(c) || (self.key_eq(r.getDefinition()) && r.getEnclosingCallable() = c)) { + for (e2 in Method(__all_data__), c_caller in c.getAnAncestorCaller()) { + if (e2.key_eq(c_caller) && direction = "Depended" && e.key_eq(e2)) { + return e + } + } + } + } + } + } + + pub fn getECGDependsNode(self, type: string, direction: string) -> ECGNode { + for (e in ECGNode(__all_data__)) { + if (e = self.getCDDependsNode(type, direction)) { + return e + } + if (e = self.getDDDependsNode(type, direction)) { + return e + } + } + } + + pub fn getCDDependsNode(self, type: string, direction: string) -> ECGNode { + for (e in ECGNode(__all_data__), + c in Callable(__all_data__), + r in ReferenceExpression(__all_data__)) { + if (self.key_eq(c)) { + if (type = "CD") { + for (e1 in c.getCallee()) { + if (direction = "Depends") { + if (e.key_eq(e1)) { + return e + } + } + } + } + } + for (v in Variable(__all_data__)) { + if (self.key_eq(v)) { + if (v.key_eq(r.getDefinition())) { + if (c = r.getEnclosingCallable()) { + if (type = "CD") { + for (e1 in c.getCallee()) { + if (direction = "Depends") { + if (e.key_eq(e1)) { + return e + } + } + } + } + } + } + } + } + } + } + + pub fn getDDDependsNode(self, type: string, direction: string) -> ECGNode { + for (e1 in ECGNode(__all_data__)) { + for (r in ReturnStatement(__all_data__), + c in Method(__all_data__), + e in Expression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (c.key_eq(r.getEnclosingCallable())) { + if (e = r.getResult()) { + if (direction = "Depends") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + for (e in Callable(__all_data__), + c in Field(__all_data__), + r in ReferenceExpression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (c.key_eq(r.getDefinition())) { + if (e = r.getEnclosingCallable()) { + if (direction = "Depends") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + for (e in Callable(__all_data__), + c in EnumConstant(__all_data__), + r in ReferenceExpression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (c.key_eq(r.getDefinition())) { + if (e = r.getEnclosingCallable()) { + if (direction = "Depends") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + for (n in string::__undetermined_all__()) { + for (e in LombokField(__all_data__), + c in CallExpression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (e = c.getLombokField()) { + let (tmp = CallExpression(__all_data__).find(e)) { + if (!isDirectCall(tmp)) { + if (n = c.getMethodName()) { + if (!n.matches("get.*")) { + if (direction = "Depends") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + } + } + } + } + } + } + + pub fn getAnAncestorCDDependsNode(self, type: string, direction: string) -> ECGNode { + for (e in ECGNode(__all_data__), + c in Callable(__all_data__), + r in ReferenceExpression(__all_data__)) { + if (type = "CD") { + if (self.key_eq(c)) { + for (e1 in c.getAnAncestorCallee()) { + if (direction = "Depends") { + if (e.key_eq(e1)) { + return e + } + } + } + } + if (self.key_eq(r.getDefinition())) { + if (c = r.getEnclosingCallable()) { + for (e1 in c.getAnAncestorCallee()) { + if (direction = "Depends") { + if (e.key_eq(e1)) { + return e + } + } + } + } + } + } + } + } + + pub fn getPath(self) -> string { + for (line in int::__undetermined_all__(), + t in string::__undetermined_all__(), + path in string::__undetermined_all__(), + info in string::__undetermined_all__()) { + for (l in coref::java::Location(__all_data__)) { + if (l = self.getLocation()) { + if (path = l.getFile().getRelativePath()) { + if (line = l.getStartLineNumber()) { + if (t = line.to_string()) { + if (info = path + ":" + t) { + return info + } + } + } + } + } + } + } + } + + fn tmp_0(n: string) -> bool { + if (n.matches("get.*")) { + return true + } + } +} + +schema ECGXmlNode { + @primary id: int +} + +impl ECGXmlNode { + pub fn __all__(db: XmlDB) -> *ECGXmlNode { + for (e in XmlPomElement(db)) { + yield ECGXmlNode {id : e.id} + } + for (e in XmlSpringElement(db)) { + yield ECGXmlNode {id : e.id} + } + for (e in XmlCharacter(db)) { + yield ECGXmlNode {id : e.id} + } + for (e in XmlAttribute(db)) { + yield ECGXmlNode {id : e.id} + } + } + + pub fn getLocation(self) -> coref::xml::Location { + for (l in coref::xml::Location(__all_data__)) { + for (e in XmlElement(__all_data__)) { + if (self.key_eq(e)) { + if (l = e.getLocation()) { + return l + } + } + } + for (e in XmlAttribute(__all_data__)) { + if (self.key_eq(e)) { + if (l = e.getLocation()) { + return l + } + } + } + for (e in XmlCharacter(__all_data__)) { + if (self.key_eq(e)) { + if (l = e.getLocation()) { + return l + } + } + } + } + } + + pub fn getType(self) -> string { + for (t in string::__undetermined_all__()) { + for (e in XmlElement(__all_data__)) { + if (self.key_eq(e)) { + if (t = "XmlElement") { + return t + } + } + } + for (e in XmlAttribute(__all_data__)) { + if (self.key_eq(e)) { + if (t = "XmlAttribute") { + return t + } + } + } + for (e in XmlCharacter(__all_data__)) { + if (self.key_eq(e)) { + if (t = "XmlCharacter") { + return t + } + } + } + } + } + + pub fn getText(self) -> string { + for (e in XmlElement(__all_data__)) { + if (self.key_eq(e)) { + return e.getName() + } + } + for (e in XmlAttribute(__all_data__)) { + if (self.key_eq(e)) { + return e.getName() + " = " + e.getValue() + } + } + for (e in XmlCharacter(__all_data__)) { + if (self.key_eq(e)) { + return e.getText() + } + } + } + + pub fn getEnclosingECGXmlNode(self) -> ECGXmlNode { + for (e in XmlElement(__all_data__)) { + if (self.key_eq(e)) { + return e.to() + } + } + for (e in XmlAttribute(__all_data__)) { + if (self.key_eq(e)) { + return e.getXmlElement().to() + } + } + for (e in XmlCharacter(__all_data__)) { + if (self.key_eq(e)) { + return e.getBelongedElement().to() + } + } + } +} + +pub fn xmlOutput(bindingType: string, interfaceName: string, uniqueId: string) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (s in SofaReferenceXmlElement(xml_db), + t in TrTagXmlElement(xml_db)) { + if (s.key_eq(t.getParent())) { + if (interfaceName = s.getInterfaceName()) { + if (uniqueId = s.getUniqueId()) { + if (bindingType = "tr") { + return true + } + } + } + } + } + } + } +} +pub fn getXMLInterfaceName(s: string) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + if (xmlOutput(__all_data__, s, __all_data__)) { + return true + } + } + } +} +pub fn exclude(n: string) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (c in Class(java_db)) { + if (n = c.getQualifiedName()) { + return true + } + } + for (i in Interface(java_db)) { + if (n = i.getQualifiedName()) { + return true + } + } + } + } +} +schema TrInterface1 extends Import { + +} + +impl TrInterface1 { + + @data_constraint + @inline + pub fn __all__(db: JavaDB) -> *TrInterface1 { + for (tmp in Import(db)) { + for (s in string::__undetermined_all__()) { + if (s = tmp.getName()) { + if (getXMLInterfaceName(s)) { + if (!exclude(s)) { + yield TrInterface1 { + element_hash_id : tmp.element_hash_id, + reference_hash_id : tmp.reference_hash_id, + name : tmp.name, + parent_hash_id : tmp.parent_hash_id, + location_hash_id : tmp.location_hash_id, + is_foreign_import : tmp.is_foreign_import + } + } + } + } + } + } + } + + +} + +pub fn output2(n: string, m: string, i: Identifier, r: ReferenceExpression) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (s in int::__undetermined_all__()) { + for (t in TrInterface1(java_db)) { + if (i.getParent() = r.getParent()) { + if (s = r.getLocation().getFile().element_hash_id) { + if (s = t.getContainingFile().element_hash_id) { + if (n = t.getName()) { + if (t.getTargetName() = r.getPrintableText()) { + if (m = i.getName()) { + return true + } + } + } + } + } + } + } + } + } + } +} +pub fn matachField(im: TrInterface1, f: Field) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (t in int::__undetermined_all__(), + s in string::__undetermined_all__()) { + if (t = f.getLocation().getFile().element_hash_id) { + if (f.getType().getName() = s) { + if (s = im.getTargetName()) { + if (t = im.getContainingFile().element_hash_id) { + return true + } + } + } + } + } + } + } +} +pub fn matchMethod(im: TrInterface1, f: Method) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (t in int::__undetermined_all__(), + s in string::__undetermined_all__()) { + if (t = f.getLocation().getFile().element_hash_id) { + if (f.getType().getName() = s) { + if (s = im.getTargetName()) { + if (t = im.getContainingFile().element_hash_id) { + return true + } + } + } + } + } + } + } +} +pub fn matchLocalVariable(im: TrInterface1, f: LocalVariable) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (t in int::__undetermined_all__(), + s in string::__undetermined_all__()) { + if (t = f.getLocation().getFile().element_hash_id) { + if (f.getType().getName() = s) { + if (s = im.getTargetName()) { + if (im.getContainingFile().element_hash_id = t) { + return true + } + } + } + } + } + } + } +} +pub fn matchParameter(im: TrInterface1, f: Parameter) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (t in int::__undetermined_all__(), + s in string::__undetermined_all__()) { + if (f.getType().getName() = s) { + if (s = im.getTargetName()) { + if (t = f.getLocation().getFile().element_hash_id) { + if (im.getContainingFile().element_hash_id = t) { + return true + } + } + } + } + } + } + } +} +pub fn output3(id: string, m: string, iden: Identifier, r1: Expression) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (r in ReferenceExpression(java_db), + im in TrInterface1(java_db)) { + if (r.key_eq(r1)) { + if (r.getParent() = iden.getParent()) { + for (f in Field(java_db)) { + if (f.key_eq(r.getDefinition())) { + if (matachField(im, f)) { + if (id = im.getName()) { + if (m = iden.getName()) { + return true + } + } + } + } + } + for (l in LocalVariable(java_db)) { + if (l.key_eq(r.getDefinition())) { + if (matchLocalVariable(im, l)) { + if (id = im.getName()) { + if (m = iden.getName()) { + return true + } + } + } + } + } + for (l in Parameter(java_db)) { + if (l.key_eq(r.getDefinition())) { + if (matchParameter(im, l)) { + if (id = im.getName()) { + if (m = iden.getName()) { + return true + } + } + } + } + } + } + } + } + for (r in MethodAccessExpression(java_db), + im in TrInterface1(java_db)) { + if (r.key_eq(r1)) { + if (r.getParent() = iden.getParent()) { + for (l in Method(java_db)) { + if (l = r.getMethod()) { + if (matchMethod(im, l)) { + if (id = im.getName()) { + if (m = iden.getName()) { + return true + } + } + } + } + } + } + } + } + if (output2(id, m, iden, ReferenceExpression(java_db).find(r1))) { + return true + } + } + } +} +pub fn importOutput(className: string, methodName: string, fileName: string, lineNumber: int, c: Callable) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (t in TrInterface1(java_db), + r in Expression(java_db)) { + if (className = t.getName()) { + if (getXMLInterfaceName(className)) { + if (!exclude(className)) { + if (tmp_0(className)) { + if (output3(className, methodName, __all_data__, r)) { + if (fileName = r.getLocation().getFile().getRelativePath()) { + if (lineNumber = r.getLocation().getStartLineNumber()) { + if (c = r.getEnclosingCallable()) { + return true + } + } + } + } + } + if (!(tmp_0(className))) { + if (methodName = "null") { + if (fileName = "null") { + if (lineNumber = 0) { + if (c.id = 0) { + return true + } + } + } + } + } + } + } + } + } + } + } +} +schema TrInterface extends Interface { + +} + +impl TrInterface { + + @data_constraint + @inline + pub fn __all__(db: JavaDB) -> *TrInterface { + for (tmp in Interface(db)) { + for (s in string::__undetermined_all__()) { + if (s = tmp.getQualifiedName()) { + if (getXMLInterfaceName(s)) { + yield TrInterface { + element_hash_id : tmp.element_hash_id, + qualified_name : tmp.qualified_name, + identifier_hash_id : tmp.identifier_hash_id, + location_hash_id : tmp.location_hash_id, + parent_hash_id : tmp.parent_hash_id + } + } + } + } + } + } + + pub fn getCallable(self) -> Callable { + for (m in Callable(__all_data__)) { + if (self.key_eq(m.getBelongedInterface())) { + return m + } + } + } + + pub fn getCallSite(self, d: Callable) -> Expression { + for (c1 in Expression(__all_data__)) { + if (d = self.getCallable()) { + for (c in MethodAccessExpression(__all_data__)) { + if (c.key_eq(c1)) { + if (d.key_eq(c.getMethod())) { + return c1 + } + } + } + for (c in MethodReferenceExpression(__all_data__)) { + if (c.key_eq(c1)) { + if (d.key_eq(c.getMethod())) { + return c1 + } + } + } + } + } + } + + +} + +pub fn getCallers(c: Callable) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (m in Callable(java_db)) { + for (auto_tmp1 in c.getCaller()) { + if (m = auto_tmp1) { + return true + } + } + } + } + } +} +pub fn selfDefineOutput(interfaceName: string, methodName: string, fileName: string, lineNumber: int, c: Callable) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (i in TrInterface(java_db)) { + if (c = i.getCallable()) { + if (interfaceName = i.getQualifiedName()) { + if (methodName = c.getName()) { + if (tmp_1(c)) { + for (e in Expression(java_db)) { + if (e = i.getCallSite(c)) { + if (fileName = e.getLocation().getFile().getRelativePath()) { + if (lineNumber = e.getLocation().getStartLineNumber()) { + if (c.id = e.getEnclosingCallable().id) { + return true + } + } + } + } + } + } + if (!(tmp_1(c))) { + if (fileName = "null") { + if (lineNumber = 0) { + if (c.id = 0) { + return true + } + } + } + } + } + } + } + } + } + } +} +pub fn getJavaECGNode(id: int) -> bool { + // #javaecgnode + // example + [ {1111} ] +} +pub fn getDependsECGNode(id: Callable, c: ECGNode) -> bool { + let (java_db = default_java_db()) { + for (e in Callable(java_db)) { + if (getJavaECGNode(c.id) && e.key_eq(c)) { + if (id in e.getAnAncestorCallee()) { + return true + } + if (id.key_eq(c)) { + return true + } + } + } + } +} +pub fn real_output(bindingType: string, uniqueId: string, interfaceName: string, methodName: string, filePath: string, lineNumber: int, ecgNodeId: ECGNode) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (m in Callable(java_db)) { + if (xmlOutput(bindingType, interfaceName, uniqueId)) { + if (selfDefineOutput(interfaceName, methodName, filePath, lineNumber, m)) { + if (!filePath.contains("src/test/java")) { + if (getDependsECGNode(m, ecgNodeId)) { + return true + } + } + } + if (importOutput(interfaceName, methodName, filePath, lineNumber, m)) { + if (!filePath.contains("src/test/java")) { + if (getDependsECGNode(m, ecgNodeId)) { + return true + } + } + } + } + } + } + } +} + + +fn default_java_db() -> JavaDB { + return JavaDB::load("coref_java_src.db") +} + +fn default_xml_db() -> XmlDB { + return XmlDB::load("coref_xml_src.db") +} + +fn tmp_0(className: string) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + if (output3(className, __all_data__, __all_data__, __all_data__)) { + return true + } + } + } +} + +fn tmp_1(c: Callable) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + if (getCallers(Callable(java_db).find(c))) { + return true + } + } + } +} + +fn main() { + output(real_output()) +} \ No newline at end of file diff --git a/example/icse25/rules/rule11.gdl b/example/icse25/rules/rule11.gdl new file mode 100644 index 00000000..668dff08 --- /dev/null +++ b/example/icse25/rules/rule11.gdl @@ -0,0 +1,430 @@ +// script +use coref::java::* +use coref::xml::* +pub fn xmlOutput(bindingType: string, interfaceName: string, uniqueId: string) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (s in SofaReferenceXmlElement(xml_db), + t in TrTagXmlElement(xml_db)) { + if (s.key_eq(t.getParent())) { + if (interfaceName = s.getInterfaceName()) { + if (uniqueId = s.getUniqueId()) { + if (bindingType = "tr") { + return true + } + } + } + } + } + } + } +} +pub fn getXMLInterfaceName(s: string) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + if (xmlOutput(__all_data__, s, __all_data__)) { + return true + } + } + } +} +pub fn exclude(n: string) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (c in Class(java_db)) { + if (n = c.getQualifiedName()) { + return true + } + } + for (i in Interface(java_db)) { + if (n = i.getQualifiedName()) { + return true + } + } + } + } +} +schema TrInterface1 extends Import { + +} + +impl TrInterface1 { + + @data_constraint + @inline + pub fn __all__(db: JavaDB) -> *TrInterface1 { + for (tmp in Import(db)) { + for (s in string::__undetermined_all__()) { + if (s = tmp.getName()) { + if (getXMLInterfaceName(s)) { + if (!exclude(s)) { + yield TrInterface1 { + element_hash_id : tmp.element_hash_id, + reference_hash_id : tmp.reference_hash_id, + name : tmp.name, + parent_hash_id : tmp.parent_hash_id, + location_hash_id : tmp.location_hash_id, + is_foreign_import : tmp.is_foreign_import + } + } + } + } + } + } + } + + +} + +pub fn output2(n: string, m: string, i: Identifier, r: ReferenceExpression) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (s in int::__undetermined_all__()) { + for (t in TrInterface1(java_db)) { + if (i.getParent() = r.getParent()) { + if (s = r.getLocation().getFile().element_hash_id) { + if (s = t.getContainingFile().element_hash_id) { + if (n = t.getName()) { + if (t.getTargetName() = r.getPrintableText()) { + if (m = i.getName()) { + return true + } + } + } + } + } + } + } + } + } + } +} +pub fn matachField(im: TrInterface1, f: Field) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (t in int::__undetermined_all__(), + s in string::__undetermined_all__()) { + if (t = f.getLocation().getFile().element_hash_id) { + if (f.getType().getName() = s) { + if (s = im.getTargetName()) { + if (t = im.getContainingFile().element_hash_id) { + return true + } + } + } + } + } + } + } +} +pub fn matchMethod(im: TrInterface1, f: Method) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (t in int::__undetermined_all__(), + s in string::__undetermined_all__()) { + if (t = f.getLocation().getFile().element_hash_id) { + if (f.getType().getName() = s) { + if (s = im.getTargetName()) { + if (t = im.getContainingFile().element_hash_id) { + return true + } + } + } + } + } + } + } +} +pub fn matchLocalVariable(im: TrInterface1, f: LocalVariable) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (t in int::__undetermined_all__(), + s in string::__undetermined_all__()) { + if (t = f.getLocation().getFile().element_hash_id) { + if (f.getType().getName() = s) { + if (s = im.getTargetName()) { + if (im.getContainingFile().element_hash_id = t) { + return true + } + } + } + } + } + } + } +} +pub fn matchParameter(im: TrInterface1, f: Parameter) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (t in int::__undetermined_all__(), + s in string::__undetermined_all__()) { + if (f.getType().getName() = s) { + if (s = im.getTargetName()) { + if (t = f.getLocation().getFile().element_hash_id) { + if (im.getContainingFile().element_hash_id = t) { + return true + } + } + } + } + } + } + } +} +pub fn output3(id: string, m: string, iden: Identifier, r1: Expression) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (r in ReferenceExpression(java_db), + im in TrInterface1(java_db)) { + if (r.key_eq(r1)) { + if (r.getParent() = iden.getParent()) { + for (f in Field(java_db)) { + if (f.key_eq(r.getDefinition())) { + if (matachField(im, f)) { + if (id = im.getName()) { + if (m = iden.getName()) { + return true + } + } + } + } + } + for (l in LocalVariable(java_db)) { + if (l.key_eq(r.getDefinition())) { + if (matchLocalVariable(im, l)) { + if (id = im.getName()) { + if (m = iden.getName()) { + return true + } + } + } + } + } + for (l in Parameter(java_db)) { + if (l.key_eq(r.getDefinition())) { + if (matchParameter(im, l)) { + if (id = im.getName()) { + if (m = iden.getName()) { + return true + } + } + } + } + } + } + } + } + for (r in MethodAccessExpression(java_db), + im in TrInterface1(java_db)) { + if (r.key_eq(r1)) { + if (r.getParent() = iden.getParent()) { + for (l in Method(java_db)) { + if (l = r.getMethod()) { + if (matchMethod(im, l)) { + if (id = im.getName()) { + if (m = iden.getName()) { + return true + } + } + } + } + } + } + } + } + if (output2(id, m, iden, ReferenceExpression(java_db).find(r1))) { + return true + } + } + } +} +pub fn importOutput(className: string, methodName: string, tag: string, filePath: string) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (t in TrInterface1(java_db), + r in Expression(java_db)) { + if (className = t.getName()) { + if (getXMLInterfaceName(className)) { + if (!exclude(className)) { + if (tmp_0(className)) { + if (output3(className, methodName, __all_data__, r)) { + if (tag = "External") { + if (filePath = r.getLocation().getFile().getRelativePath()) { + return true + } + } + } + } + if (!(tmp_0(className))) { + if (methodName = "null") { + if (tag = "External") { + if (filePath = "null") { + return true + } + } + } + } + } + } + } + } + } + } +} +schema TrInterface extends Interface { + +} + +impl TrInterface { + + @data_constraint + @inline + pub fn __all__(db: JavaDB) -> *TrInterface { + for (tmp in Interface(db)) { + for (s in string::__undetermined_all__()) { + if (s = tmp.getQualifiedName()) { + if (getXMLInterfaceName(s)) { + yield TrInterface { + element_hash_id : tmp.element_hash_id, + qualified_name : tmp.qualified_name, + identifier_hash_id : tmp.identifier_hash_id, + location_hash_id : tmp.location_hash_id, + parent_hash_id : tmp.parent_hash_id + } + } + } + } + } + } + + pub fn getCallable(self) -> Callable { + for (m in Callable(__all_data__)) { + if (self.key_eq(m.getBelongedInterface())) { + return m + } + } + } + + pub fn getCallSite(self, d: Callable) -> Expression { + for (c1 in Expression(__all_data__)) { + if (d = self.getCallable()) { + for (c in MethodAccessExpression(__all_data__)) { + if (c.key_eq(c1)) { + if (d.key_eq(c.getMethod())) { + return c1 + } + } + } + for (c in MethodReferenceExpression(__all_data__)) { + if (c.key_eq(c1)) { + if (d.key_eq(c.getMethod())) { + return c1 + } + } + } + } + } + } + + +} + +pub fn getCallers(c: Callable) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (m in Callable(java_db)) { + for (auto_tmp1 in c.getCaller()) { + if (m = auto_tmp1) { + return true + } + } + } + } + } +} +pub fn selfDefineOutput(interfaceName: string, methodName: string, tag: string, filePath: string) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (i in TrInterface(java_db), + c in Callable(java_db)) { + if (c = i.getCallable()) { + if (interfaceName = i.getQualifiedName()) { + if (methodName = c.getName()) { + if (tmp_1(c)) { + for (e in Expression(java_db)) { + if (e = i.getCallSite(c)) { + if (tag = "Self") { + if (filePath = e.getLocation().getFile().getRelativePath()) { + return true + } + } + } + } + } + if (!(tmp_1(c))) { + if (filePath = "null") { + if (tag = "Self") { + return true + } + } + } + } + } + } + } + } + } +} +pub fn real_output(bindingType: string, uniqueId: string, interfaceName: string, methodName: string, tag: string) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (filePath in string::__undetermined_all__()) { + if (xmlOutput(bindingType, interfaceName, uniqueId)) { + if (selfDefineOutput(interfaceName, methodName, tag, filePath)) { + if (!filePath.contains("src/test/java")) { + return true + } + } + if (importOutput(interfaceName, methodName, tag, filePath)) { + if (!filePath.contains("src/test/java")) { + return true + } + } + } + } + } + } +} + + +fn default_java_db() -> JavaDB { + return JavaDB::load("coref_java_src.db") +} + +fn default_xml_db() -> XmlDB { + return XmlDB::load("coref_xml_src.db") +} + +fn tmp_0(className: string) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + if (output3(className, __all_data__, __all_data__, __all_data__)) { + return true + } + } + } +} + +fn tmp_1(c: Callable) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + if (getCallers(c)) { + return true + } + } + } +} + +fn main() { + output(real_output()) +} \ No newline at end of file diff --git a/example/icse25/rules/rule12.gdl b/example/icse25/rules/rule12.gdl new file mode 100644 index 00000000..75b1c352 --- /dev/null +++ b/example/icse25/rules/rule12.gdl @@ -0,0 +1,570 @@ +// script +use coref::java::* +use coref::xml::* +schema SofaService extends Annotation { + +} + +impl SofaService { + + @data_constraint + @inline + pub fn __all__(db: JavaDB) -> *SofaService { + for (tmp in Annotation(db)) { + if (tmp.getName() = "SofaService") { + yield SofaService { + id : tmp.id + } + } + } + } + + pub fn getService(self) -> ClassOrInterface { + for (value in string::__undetermined_all__()) { + for (i in ClassOrInterface(__all_data__), + argus in AnnotationAccessArgument(__all_data__)) { + for (auto_tmp1 in self.getAnnotationArgument()) { + if (argus = auto_tmp1) { + if (argus.getAnnotationArgumentName() = "interfaceType") { + if (value = argus.getAnnotationArgumentValue()) { + if (i.getQualifiedName() = value) { + return i + } + } + } + } + } + } + } + } + + @inline + pub fn getBinding(self) -> SofaServiceBinding { + for (b in SofaServiceBinding(__all_data__), + argus in AnnotationAccessArgument(__all_data__)) { + for (auto_tmp1 in self.getAnnotationArgument()) { + if (argus = auto_tmp1) { + if (argus.getAnnotationArgumentName() = "bindings") { + if (b.key_eq(argus.getArgumentAnnotation())) { + return b + } + if (argus.key_eq(b.getParent())) { + return b + } + } + } + } + } + } + + @inline + pub fn getUniqueId(self) -> string { + for (uniqueId in string::__undetermined_all__()) { + for (anno in Annotation(__all_data__)) { + if (self.key_eq(anno)) { + if (tmp_2(anno)) { + for (argus in AnnotationAccessArgument(__all_data__)) { + for (auto_tmp1 in anno.getAnnotationArgument()) { + if (argus = auto_tmp1) { + if (argus.getAnnotationArgumentName() = "uniqueId") { + if (uniqueId = argus.getAnnotationArgumentValue()) { + return uniqueId + } + } + } + } + } + } + if (!(tmp_2(anno))) { + if (uniqueId = "null") { + return uniqueId + } + } + } + } + } + } + + +} + +pub fn uniqueArgument(anno: Annotation) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (argus in AnnotationAccessArgument(java_db)) { + for (auto_tmp1 in anno.getAnnotationArgument()) { + if (argus = auto_tmp1) { + if (argus.getAnnotationArgumentName() = "uniqueId") { + return true + } + } + } + } + } + } +} +schema SofaServiceBinding extends Annotation { + +} + +impl SofaServiceBinding { + + @data_constraint + @inline + pub fn __all__(db: JavaDB) -> *SofaServiceBinding { + for (tmp in Annotation(db)) { + if (tmp.getName() = "SofaServiceBinding") { + yield SofaServiceBinding { + id : tmp.id + } + } + } + } + + pub fn getType(self) -> string { + for (value in string::__undetermined_all__()) { + for (argus in AnnotationAccessArgument(__all_data__)) { + for (auto_tmp1 in self.getAnnotationArgument()) { + if (argus = auto_tmp1) { + if (argus.getAnnotationArgumentName() = "bindingType") { + if (value = argus.getAnnotationArgumentValue()) { + return value + } + } + } + } + } + } + } + + +} + +pub fn javaOutput(classname: string, name: string) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (s in SofaService(java_db), + c in Class(java_db), + i in ClassOrInterface(java_db)) { + for (auto_tmp1 in c.getAnnotation()) { + if (s.key_eq(auto_tmp1)) { + if (classname = c.getQualifiedName()) { + for (auto_tmp2 in c.getImplementsInterface()) { + if (i.key_eq(auto_tmp2)) { + if (name = i.getQualifiedName()) { + return true + } + } + } + if (i = s.getService()) { + if (name = i.getQualifiedName()) { + return true + } + } + } + } + } + } + } + } +} +pub fn xmlOutput(className: string, interfaceName: string) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (temp in string::__undetermined_all__()) { + for (s in SofaServiceXmlElement(xml_db), + b in BeanXmlElement(xml_db)) { + if (s.getRef() = b.getId()) { + if (interfaceName = s.getInterfaceName()) { + if (className = b.getClass()) { + if (temp = b.getLocation().getFile().getRelativePath()) { + if (!temp.contains("src/test/resources")) { + return true + } + } + } + } + } + } + } + } + } +} +pub fn annoOutput(className: string, interfaceName: string) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (v in string::__undetermined_all__(), + k in string::__undetermined_all__()) { + for (s in SofaServiceXmlElement(xml_db), + b in Class(java_db), + t in TagXmlElement(xml_db), + a in Annotation(java_db)) { + if (s.key_eq(t.getParent())) { + if (v = s.getRef()) { + if (interfaceName = s.getInterfaceName()) { + for (auto_tmp1 in b.getAnnotation()) { + if (a = auto_tmp1) { + if (a.getName() = k) { + if (getTrAnnotationName(k)) { + for (auto_tmp2 in a.getAnnotationArgument()) { + if (auto_tmp2.getAnnotationArgumentValue() = "\"" + v + "\"") { + if (className = b.getQualifiedName()) { + return true + } + } + } + } + } + } + } + } + } + } + } + } + } + } +} +pub fn getTrAnnotationName(a: string) -> bool { + [ + {"Service"}, + {"Component"}, + {"Scope"}, + {"Repository"}, + {"Controller"}, + {"RestController"}, + {"RequestMapping"}, + {"PathVariable"}, + {"ResponseBody"}, + {"bean"} + ] +} +pub fn output1(className: string, interfaceName: string) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + if (xmlOutput(className, interfaceName)) { + return true + } + if (javaOutput(className, interfaceName)) { + return true + } + if (annoOutput(className, interfaceName)) { + return true + } + } + } +} +pub fn isSelfDefinedInterface(name: string) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (i in Interface(java_db)) { + if (name = i.getQualifiedName()) { + return true + } + } + } + } +} +pub fn isSelfDefinedClass(name: string) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (i in Class(java_db)) { + if (name = i.getQualifiedName()) { + return true + } + } + } + } +} +schema PublicMethod extends Method { + +} + +impl PublicMethod { + + @data_constraint + @inline + pub fn __all__(db: JavaDB) -> *PublicMethod { + for (tmp in Method(db)) { + for (m in Modifier(db)) { + for (auto_tmp1 in tmp.getModifier()) { + if (m = auto_tmp1) { + if (m.getName() = "public") { + if (!isSetOrGetMethod(tmp)) { + yield PublicMethod { + element_hash_id : tmp.element_hash_id, + name : tmp.name, + signature : tmp.signature, + type_hash_id : tmp.type_hash_id, + parent_hash_id : tmp.parent_hash_id, + location_hash_id : tmp.location_hash_id, + definition_body : tmp.definition_body + } + } + } + } + } + } + } + } + + +} + +pub fn isBooleanTypeField(f: Field, p: string, q: string) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (i in int::__undetermined_all__(), + n in string::__undetermined_all__(), + tmp1 in string::__undetermined_all__(), + tmp2 in string::__undetermined_all__(), + l in string::__undetermined_all__(), + j in string::__undetermined_all__()) { + if (n = f.getName()) { + if (i = n.len()) { + if (tmp_3(n)) { + if (tmp1 = n.substr(2,i)) { + if (l = n.substr(2,1)) { + if (tmp2 = n.substr(3,i)) { + if (q = n) { + if (p = "set" + tmp1) { + return true + } + } + if (q = "get" + l + tmp2) { + if (p = "set" + tmp1) { + return true + } + } + } + } + } + } + if (!(tmp_3(n))) { + if (l = n.substr(0,1)) { + if (tmp2 = n.substr(1,i)) { + if (lowerToUpper(l, j)) { + if (p = "set" + j + tmp2) { + if (q = "is" + j + tmp2) { + return true + } + if (q = "get" + j + tmp2) { + return true + } + } + if (p = "set" + n) { + if (q = "is" + j + tmp2) { + return true + } + if (q = "get" + j + tmp2) { + return true + } + } + } + } + } + } + } + } + } + } + } +} +pub fn isSetOrGetMethod(m: Method) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (i in int::__undetermined_all__(), + p in string::__undetermined_all__(), + q in string::__undetermined_all__(), + n in string::__undetermined_all__(), + l in string::__undetermined_all__(), + j in string::__undetermined_all__(), + tmp in string::__undetermined_all__(), + t in string::__undetermined_all__()) { + for (f in Field(java_db)) { + if (n = f.getName()) { + if (i = n.len()) { + if (f.getParent() = m.getParent()) { + if (p = m.getName()) { + if (t = f.getTypeElement().getPrintableText()) { + if (tmp_4(t)) { + if (isBooleanTypeField(f, p, q)) { + return true + } + } + if (!(tmp_4(t))) { + if (l = n.substr(0,1)) { + if (tmp = n.substr(1,i)) { + if (lowerToUpper(l, j)) { + if (p = "set" + j + tmp) { + if (q = "get" + j + tmp) { + return true + } + if (q = "get" + n) { + return true + } + } + if (p = "set" + n) { + if (q = "get" + j + tmp) { + return true + } + if (q = "get" + n) { + return true + } + } + } + } + } + } + } + } + if (q = m.getName()) { + if (t = f.getTypeElement().getPrintableText()) { + if (tmp_4(t)) { + if (isBooleanTypeField(f, p, q)) { + return true + } + } + if (!(tmp_4(t))) { + if (l = n.substr(0,1)) { + if (tmp = n.substr(1,i)) { + if (lowerToUpper(l, j)) { + if (p = "set" + j + tmp) { + if (q = "get" + j + tmp) { + return true + } + if (q = "get" + n) { + return true + } + } + if (p = "set" + n) { + if (q = "get" + j + tmp) { + return true + } + if (q = "get" + n) { + return true + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } +} +pub fn real_output(interfaceName: string, className: string, methodName: string, tag: string) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (i in Interface(java_db), + c in Class(java_db)) { + if (output1(className, interfaceName)) { + if (tmp_5(interfaceName)) { + if (interfaceName = i.getQualifiedName()) { + for (m in Method(java_db)) { + if (i.key_eq(m.getParent())) { + if (methodName = m.getSignature()) { + if (tag = "Self") { + return true + } + } + } + } + } + } + if (!(tmp_5(interfaceName))) { + if (className = c.getQualifiedName()) { + for (n in PublicMethod(java_db)) { + if (c.key_eq(n.getParent())) { + if (methodName = n.getSignature()) { + if (tag = "External") { + return true + } + } + } + } + } + } + } + } + } + } +} + + +fn default_java_db() -> JavaDB { + return JavaDB::load("coref_java_src.db") +} + +fn default_xml_db() -> XmlDB { + return XmlDB::load("coref_xml_src.db") +} + +fn tmp_0(anno: Annotation) -> *auto_tmp_1 { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + if (uniqueArgument(anno)) { + yield auto_tmp_1 { + + } + } + } + } +} + +schema auto_tmp_1 { + +} + +fn tmp_2(anno: Annotation) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + if (tmp_0(anno).len() = 1) { + return true + } + } + } +} + +fn tmp_3(n: string) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + if (n.matches("is.*")) { + return true + } + } + } +} + +fn tmp_4(t: string) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + if (t = "boolean") { + return true + } + if (t = "Boolean") { + return true + } + } + } +} + +fn tmp_5(interfaceName: string) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + if (isSelfDefinedInterface(interfaceName)) { + return true + } + } + } +} + +fn main() { + output(real_output()) +} \ No newline at end of file diff --git a/example/icse25/rules/rule13.gdl b/example/icse25/rules/rule13.gdl new file mode 100644 index 00000000..f6084a38 --- /dev/null +++ b/example/icse25/rules/rule13.gdl @@ -0,0 +1,588 @@ +// script +use coref::java::* +use coref::xml::* +pub fn gitdiff(filename: string, lineNumber: int) -> bool { + //python替换 + // $gitdiff + // example + [ {"test", 1111} ] +} +pub fn transfertofile(f: File, filename: string, lineNumber: int) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + if (gitdiff(filename, lineNumber)) { + if (filename = f.getRelativePath()) { + if (!filename.contains("src/test")) { + return true + } + } + } + } + } +} +pub fn findModifiedLineInClass(f: File, filename: string, lineNumber: int) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (j in int::__undetermined_all__()) { + if (transfertofile(f, filename, lineNumber)) { + for (c in Class(java_db)) { + if (f = c.getLocation().getFile()) { + if (j = c.getLocation().getStartLineNumber()) { + if (lineNumber > j) { + return true + } + } + } + } + for (c in Interface(java_db)) { + if (f = c.getLocation().getFile()) { + if (j = c.getLocation().getStartLineNumber()) { + if (lineNumber > j) { + return true + } + } + } + } + } + } + } + } +} +schema PublicMethod extends Method { + +} + +impl PublicMethod { + + @data_constraint + @inline + pub fn __all__(db: JavaDB) -> *PublicMethod { + for (tmp in Method(db)) { + for (m in Modifier(db)) { + for (auto_tmp1 in tmp.getModifier()) { + if (m = auto_tmp1) { + if (m.getName() = "public") { + if (!isSetOrGetMethod(tmp)) { + yield PublicMethod { + element_hash_id : tmp.element_hash_id, + name : tmp.name, + signature : tmp.signature, + type_hash_id : tmp.type_hash_id, + parent_hash_id : tmp.parent_hash_id, + location_hash_id : tmp.location_hash_id, + definition_body : tmp.definition_body + } + } + } + } + } + } + } + } + + +} + +pub fn isBooleanTypeField(f: Field, p: string, q: string) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (i in int::__undetermined_all__(), + n in string::__undetermined_all__(), + tmp1 in string::__undetermined_all__(), + tmp2 in string::__undetermined_all__(), + l in string::__undetermined_all__(), + j in string::__undetermined_all__()) { + if (n = f.getName()) { + if (i = n.len()) { + if (tmp_0(n)) { + if (tmp1 = n.substr(2,i)) { + if (l = n.substr(2,1)) { + if (tmp2 = n.substr(3,i)) { + if (q = n) { + if (p = "set" + tmp1) { + return true + } + } + if (q = "get" + l + tmp2) { + if (p = "set" + tmp1) { + return true + } + } + } + } + } + } + if (!(tmp_0(n))) { + if (l = n.substr(0,1)) { + if (tmp2 = n.substr(1,i)) { + if (lowerToUpper(l, j)) { + if (p = "set" + j + tmp2) { + if (q = "is" + j + tmp2) { + return true + } + if (q = "get" + j + tmp2) { + return true + } + } + if (p = "set" + n) { + if (q = "is" + j + tmp2) { + return true + } + if (q = "get" + j + tmp2) { + return true + } + } + } + } + } + } + } + } + } + } + } +} +pub fn isSetOrGetMethod(m: Method) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (i in int::__undetermined_all__(), + p in string::__undetermined_all__(), + q in string::__undetermined_all__(), + n in string::__undetermined_all__(), + l in string::__undetermined_all__(), + j in string::__undetermined_all__(), + tmp in string::__undetermined_all__(), + t in string::__undetermined_all__()) { + for (f in Field(java_db)) { + if (n = f.getName()) { + if (i = n.len()) { + if (f.getParent() = m.getParent()) { + if (p = m.getName()) { + if (t = f.getTypeElement().getPrintableText()) { + if (tmp_1(t)) { + if (isBooleanTypeField(f, p, q)) { + return true + } + } + if (!(tmp_1(t))) { + if (l = n.substr(0,1)) { + if (tmp = n.substr(1,i)) { + if (lowerToUpper(l, j)) { + if (p = "set" + j + tmp) { + if (q = "get" + j + tmp) { + return true + } + if (q = "get" + n) { + return true + } + } + if (p = "set" + n) { + if (q = "get" + j + tmp) { + return true + } + if (q = "get" + n) { + return true + } + } + } + } + } + } + } + } + if (q = m.getName()) { + if (t = f.getTypeElement().getPrintableText()) { + if (tmp_1(t)) { + if (isBooleanTypeField(f, p, q)) { + return true + } + } + if (!(tmp_1(t))) { + if (l = n.substr(0,1)) { + if (tmp = n.substr(1,i)) { + if (lowerToUpper(l, j)) { + if (p = "set" + j + tmp) { + if (q = "get" + j + tmp) { + return true + } + if (q = "get" + n) { + return true + } + } + if (p = "set" + n) { + if (q = "get" + j + tmp) { + return true + } + if (q = "get" + n) { + return true + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } +} +pub fn isComment(lineNumber: int, filename: string, f: File) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + if (findModifiedLineInClass(f, filename, lineNumber)) { + for (e in int::__undetermined_all__(), + s1 in int::__undetermined_all__()) { + for (c in Comment(java_db)) { + if (c.getLocation().getFile() = f) { + if (s1 = c.getLocation().getStartLineNumber()) { + if (e = c.getLocation().getEndLineNumber()) { + if (lineNumber > s1 - 1) { + if (lineNumber < e + 1) { + return true + } + } + } + } + } + } + } + for (e in int::__undetermined_all__(), + s1 in int::__undetermined_all__()) { + for (c in JavadocComment(java_db)) { + if (c.getLocation().getFile() = f) { + if (s1 = c.getLocation().getStartLineNumber()) { + if (e = c.getLocation().getEndLineNumber()) { + if (lineNumber > s1 - 1) { + if (lineNumber < e + 1) { + return true + } + } + } + } + } + } + } + } + } + } +} +pub fn findModifiedCallable(c: Callable) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (lineNumber in int::__undetermined_all__(), + filename in string::__undetermined_all__()) { + for (f in File(java_db)) { + if (findModifiedLineInClass(f, filename, lineNumber)) { + if (!isComment(lineNumber, filename, f)) { + for (s1 in int::__undetermined_all__(), + e in int::__undetermined_all__()) { + if (c.getLocation().getFile() = f) { + if (s1 = c.getLocation().getStartLineNumber()) { + if (lineNumber > s1 - 1) { + if (e = c.getLocation().getEndLineNumber()) { + if (lineNumber < e + 1) { + return true + } + } + } + } + } + } + } + } + } + } + } + } +} +schema ModifiedCallable extends Callable { + +} + +impl ModifiedCallable { + + @data_constraint + @inline + pub fn __all__(db: JavaDB) -> *ModifiedCallable { + for (tmp in Callable(db)) { + if (findModifiedCallable(tmp)) { + yield ModifiedCallable { + id : tmp.id + } + } + } + } + + pub fn getAnAncestorCallerByIndex(self, index: int) -> Callable { + for (f in Callable(__all_data__)) { + for (auto_tmp1 in self.getCaller()) { + if (f = auto_tmp1) { + if (index = 1) { + return f + } + } + } + for (temp in int::__undetermined_all__(), + total in int::__undetermined_all__()) { + if (total = self.getTotalCaller()) { + if (index < total + 1) { + if (index = temp + 1) { + if (temp > 0) { + for (auto_tmp2 in self.getAnAncestorCallerByIndex(temp).getCaller()) { + if (f = auto_tmp2) { + return f + } + } + } + } + } + } + } + } + } + + pub fn getTotalCaller(self) -> int { + for (total in int::__undetermined_all__()) { + for (c in Callable(__all_data__)) { + if (self.key_eq(c)) { + if (total = tmp_2(c).len()) { + return total + } + } + } + } + } + + pub fn getRootCaller(self) -> CallableNew { + for (f in CallableNew(__all_data__)) { + for (auto_tmp1 in self.getAnAncestorCaller()) { + if (f.key_eq(auto_tmp1)) { + if (!getAnyCaller(f)) { + return f + } + } + } + } + } + + +} + +pub fn getAnyCaller(c: CallableNew) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (a in CallableNew(java_db)) { + for (auto_tmp1 in c.getCaller()) { + if (a.key_eq(auto_tmp1)) { + return true + } + } + } + } + } +} +pub fn getTotalCallerSet(s: ModifiedCallable, index: int, f: Callable) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + if (f = s.getAnAncestorCallerByIndex(index)) { + return true + } + } + } +} +pub fn hasCaller(a: CallableNew) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (b in CallableNew(java_db)) { + for (auto_tmp1 in a.getCaller()) { + if (b.key_eq(auto_tmp1)) { + return true + } + } + } + } + } +} + +schema CallableNew extends Callable { + +} + +impl CallableNew { + + @data_constraint + @inline + pub fn __all__(db: JavaDB) -> *CallableNew { + for (tmp in Callable(db)) { + for (n in string::__undetermined_all__()) { + if (n = tmp.getLocation().getFile().getRelativePath()) { + if (!n.contains("src/test/java")) { + yield CallableNew { + id : tmp.id + } + } + } + } + } + } + + pub fn getEnclosingCallable(self) -> Callable { + for (c in Callable(__all_data__), + e in Expression(__all_data__)) { + if (e.key_eq(self.getBelongedClass().getParent())) { + if (c = e.getEnclosingCallable()) { + return c + } + } + } + } + + pub fn getNonAnonymousEnclosingCallable(self) -> Callable { + for (c in Callable(__all_data__), + temp in Callable(__all_data__)) { + if (temp = self.getEnclosingCallable()) { + if (tmp_3(temp)) { + for (m in AnonymousMethod(__all_data__)) { + if (m.key_eq(temp)) { + if (c = m.getEnclosingCallable()) { + return c + } + } + } + } + if (!(tmp_3(temp))) { + if (c = temp) { + return c + } + } + } + } + } + + pub fn getRootCaller(self) -> CallableNew { + for (f in CallableNew(__all_data__)) { + for (auto_tmp1 in self.getAnAncestorCaller()) { + if (f.key_eq(auto_tmp1)) { + if (!getAnyCaller(f)) { + return f + } + } + } + } + } + + +} + +pub fn real_output(rootSignature: string, className: string) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (n in ModifiedCallable(java_db), + a in CallableNew(java_db), + b in CallableNew(java_db), + c in CallableNew(java_db)) { + for (auto_tmp1 in n.getAnAncestorCaller()) { + if (a.key_eq(auto_tmp1)) { + if (tmp_4(a)) { + if (b.key_eq(a.getNonAnonymousEnclosingCallable())) { + if (c = b.getRootCaller()) { + if (rootSignature = c.getSignature()) { + if (className = c.getBelongedClass().getQualifiedName()) { + return true + } + } + } + } + } + if (!(tmp_4(a))) { + if (b = a) { + if (c = b.getRootCaller()) { + if (rootSignature = c.getSignature()) { + if (className = c.getBelongedClass().getQualifiedName()) { + return true + } + } + } + } + } + } + } + } + } + } +} + + +fn default_java_db() -> JavaDB { + return JavaDB::load("coref_java_src.db") +} + +fn default_xml_db() -> XmlDB { + return XmlDB::load("coref_xml_src.db") +} + +fn tmp_0(n: string) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + if (n.matches("is.*")) { + return true + } + } + } +} + +fn tmp_1(t: string) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + if (t = "boolean") { + return true + } + if (t = "Boolean") { + return true + } + } + } +} + +fn tmp_2(c: Callable) -> *Callable { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (a in Callable(__all_data__)) { + for (auto_tmp1 in c.getAnAncestorCaller()) { + if (a = auto_tmp1) { + yield a + } + } + } + } + } +} + +fn tmp_3(temp: Callable) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + if (isAnonymousMethod(temp)) { + return true + } + } + } +} + +fn tmp_4(a: CallableNew) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + if (isAnonymousMethod(Callable(java_db).find(a))) { + return true + } + } + } +} + +fn main() { + output(real_output()) +} \ No newline at end of file diff --git a/example/icse25/rules/rule14.gdl b/example/icse25/rules/rule14.gdl new file mode 100644 index 00000000..bb7932f3 --- /dev/null +++ b/example/icse25/rules/rule14.gdl @@ -0,0 +1,389 @@ +// script +use coref::javascript::* + +pub fn rpcNameControllerFunctionIdentifier(rpcName: string, controllerFunctionIdentifier: Expression) -> bool { + let (javascript_db = default_javascript_db()) { + for (callExpression in CallExpression(javascript_db)) { + for (routerFile in File(javascript_db)) { + for (routerPath in string::__undetermined_all__()) { + if (routerPath = routerFile.getRelativePath()) { + if (routerPath.matches("app/router(\\.[jt]s|/.+\\.[jt]s)")) { + if (callExpression.getLocation().getFile() = routerFile) { + for (accessExpression in AccessExpression(javascript_db), + property in Expression(javascript_db)) { + if (accessExpression.key_eq(callExpression.getExpression())) { + if (property = accessExpression.getPropertyExpression()) { + if (property.getText() = "rpc") { + for (rpcNameStringLiteral in StringLiteral(javascript_db)) { + if (rpcNameStringLiteral.key_eq(callExpression.getArgument(0))) { + if (rpcName = rpcNameStringLiteral.getValue()) { + let (argumentCount = callExpression.getArgumentCount()) { + if (controllerFunctionIdentifier = callExpression.getArgument(argumentCount - 1)) { + return true + } + } + } + } + } + } + if (property.getText() = "rpcAndGet") { + for (rpcNameStringLiteral in StringLiteral(javascript_db)) { + if (rpcNameStringLiteral.key_eq(callExpression.getArgument(0))) { + if (rpcName = rpcNameStringLiteral.getValue()) { + let (argumentCount = callExpression.getArgumentCount()) { + if (controllerFunctionIdentifier = callExpression.getArgument(argumentCount - 1)) { + return true + } + } + } + } + } + } + if (property.getText() = "rpcAndPost") { + for (rpcNameStringLiteral in StringLiteral(javascript_db)) { + if (rpcNameStringLiteral.key_eq(callExpression.getArgument(0))) { + if (rpcName = rpcNameStringLiteral.getValue()) { + let (argumentCount = callExpression.getArgumentCount()) { + if (controllerFunctionIdentifier = callExpression.getArgument(argumentCount - 1)) { + return true + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } +} +pub fn rpcNameControllerFunction(rpcName: string, controllerFunction: FunctionLikeDeclaration) -> bool { + let (javascript_db = default_javascript_db()) { + for (controllerFunctionIdentifier in Expression(javascript_db)) { + if (rpcNameControllerFunctionIdentifier(rpcName, controllerFunctionIdentifier)) { + for (symbol in Symbol(javascript_db)) { + if (symbol = controllerFunctionIdentifier.getSymbol()) { + if (controllerFunction.getSymbol() = symbol) { + return true + } + for (variableDeclaration in VariableDeclaration(javascript_db)) { + if (variableDeclaration.getSymbol() = symbol) { + if (controllerFunction.key_eq(variableDeclaration.getInitializer())) { + return true + } + } + } + for (propertyDeclaration in PropertyDeclaration(javascript_db)) { + if (propertyDeclaration.getSymbol() = symbol) { + if (controllerFunction.key_eq(propertyDeclaration.getInitializer())) { + return true + } + } + } + } + } + } + } + } +} +pub fn controllerReturnField(controllerFunc: FunctionLikeDeclaration, fieldName: string) -> bool { + let (javascript_db = default_javascript_db()) { + for (simpleAssignmentExpression in SimpleAssignmentExpression(javascript_db)) { + for (auto_tmp1 in simpleAssignmentExpression.getAnAncestorEnclosingFunction()) { + if (auto_tmp1 = controllerFunc) { + for (leftOperandText in string::__undetermined_all__()) { + for (leftOperand in Expression(javascript_db)) { + if (leftOperand = simpleAssignmentExpression.getLeftOperand()) { + if (leftOperandText = leftOperand.getText()) { + if (leftOperandText.matches("(this\\.|ctx\\.|this\\.ctx\\.)?body")) { + for (object in ObjectLiteralExpression(javascript_db), + objectElement in ObjectLiteralElement(javascript_db)) { + if (object.key_eq(simpleAssignmentExpression.getRightOperand())) { + if (objectElement = object.getPropertyByName(fieldName)) { + return true + } + } + } + } + } + } + } + } + } + } + } + } +} +pub fn serviceCallSite(serviceCaller: CallExpression, serviceFunction: FunctionLikeDeclaration) -> bool { + let (javascript_db = default_javascript_db()) { + for (expressionText in string::__undetermined_all__()) { + for (expression in PropertyAccessExpression(javascript_db)) { + if (expression.key_eq(serviceCaller.getExpression())) { + if (expressionText = expression.getText()) { + if (expressionText.matches("(this\\.|ctx\\.|this\\.ctx\\.)?service\\.(.+)")) { + if (serviceFunction = serviceCaller.getCallee()) { + return true + } + } + } + } + } + } + } +} +pub fn getAnDescendantServiceCallee(serviceCaller: CallExpression, descendantServiceCallee: FunctionLikeDeclaration) -> bool { + let (javascript_db = default_javascript_db()) { + if (serviceCallSite(serviceCaller, descendantServiceCallee)) { + return true + } + for (serviceCallee in FunctionLikeDeclaration(javascript_db), + childServiceCaller in CallExpression(javascript_db)) { + if (serviceCallSite(serviceCaller, serviceCallee)) { + for (auto_tmp1 in childServiceCaller.getAnAncestorEnclosingFunction()) { + if (auto_tmp1 = serviceCallee) { + if (getAnDescendantServiceCallee(childServiceCaller, descendantServiceCallee)) { + return true + } + } + } + } + } + } +} +pub fn proxyCallerDesc(proxyCaller: CallExpression, facadeName: string, trFuncName: string) -> bool { + let (javascript_db = default_javascript_db()) { + for (expression in PropertyAccessExpression(javascript_db)) { + if (expression.key_eq(proxyCaller.getExpression())) { + for (facadeExpressionText in string::__undetermined_all__()) { + for (facadeExpression in LeftHandSideExpression(javascript_db)) { + for (leftHandSideExpression in LeftHandSideExpression(javascript_db)) { + if (leftHandSideExpression = expression.getExpression()) { + for (callExpression in CallExpression(javascript_db)) { + if (callExpression.key_eq(leftHandSideExpression)) { + for (usingExpression in PropertyAccessExpression(javascript_db)) { + if (usingExpression.key_eq(callExpression.getExpression())) { + if (facadeExpression = usingExpression.getExpression()) { + if (facadeExpressionText = facadeExpression.getText()) { + if (facadeName = facadeExpressionText.get_regex_match_result("(this\\.|ctx\\.|this\\.ctx\\.)?proxy\\.(.+)", 2)) { + if (facadeName != "") { + for (serviceFuncIdentifier in Identifier(javascript_db)) { + if (serviceFuncIdentifier.key_eq(expression.getProperty())) { + if (trFuncName = serviceFuncIdentifier.getText()) { + if (trFuncName != "using") { + return true + } + } + } + } + } + } + } + } + } + } + } + } + if (isPropertyAccessExpression(Node(javascript_db).find(leftHandSideExpression))) { + if (facadeExpression = leftHandSideExpression) { + if (facadeExpressionText = facadeExpression.getText()) { + if (facadeName = facadeExpressionText.get_regex_match_result("(this\\.|ctx\\.|this\\.ctx\\.)?proxy\\.(.+)", 2)) { + if (facadeName != "") { + for (serviceFuncIdentifier in Identifier(javascript_db)) { + if (serviceFuncIdentifier.key_eq(expression.getProperty())) { + if (trFuncName = serviceFuncIdentifier.getText()) { + if (trFuncName != "using") { + return true + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } +} +pub fn getAppFacade(appName: string, proxyFacadeName: string, facadeQualifiedName: string) -> bool { + let (javascript_db = default_javascript_db()) { + for (objectLiteralExpression in ObjectLiteralExpression(javascript_db)) { + for (proxyPath in string::__undetermined_all__()) { + for (file in File(javascript_db), + location in Location(javascript_db), + servicePropertyAssignment in PropertyAssignment(javascript_db), + arrayLiteralExpression in ArrayLiteralExpression(javascript_db)) { + if (proxyPath = file.getRelativePath()) { + if (proxyPath.matches("config/proxy\\.[jt]s")) { + if (location.getFile() = file) { + if (servicePropertyAssignment.getLocation() = location) { + if (servicePropertyAssignment.getName() = "services") { + if (arrayLiteralExpression.key_eq(servicePropertyAssignment.getInitializer())) { + for (auto_tmp1 in arrayLiteralExpression.getAElement()) { + if (objectLiteralExpression.key_eq(auto_tmp1)) { + for (appNamePropertyAssignment in PropertyAssignment(javascript_db), + appNameString in StringLiteral(javascript_db)) { + if (appNamePropertyAssignment = objectLiteralExpression.getPropertyAssignmentByName("appname")) { + if (appNameString.key_eq(appNamePropertyAssignment.getInitializer())) { + if (appName = appNameString.getValue()) { + for (apiPropertyAssignment in PropertyAssignment(javascript_db), + apiObject in ObjectLiteralExpression(javascript_db), + facadePropertyAssignment in PropertyAssignment(javascript_db)) { + if (apiPropertyAssignment = objectLiteralExpression.getPropertyAssignmentByName("api")) { + if (apiObject.key_eq(apiPropertyAssignment.getInitializer())) { + for (auto_tmp2 in apiObject.getAProperty()) { + if (facadePropertyAssignment.key_eq(auto_tmp2)) { + if (proxyFacadeName = facadePropertyAssignment.getName()) { + for (facadeStringLiteral in StringLiteral(javascript_db)) { + if (facadeStringLiteral.key_eq(facadePropertyAssignment.getInitializer())) { + if (facadeQualifiedName = facadeStringLiteral.getValue()) { + return true + } + } + for (facadeObject in ObjectLiteralExpression(javascript_db), + interfaceNamePropertyAssignment in PropertyAssignment(javascript_db)) { + if (facadeObject.key_eq(facadePropertyAssignment.getInitializer())) { + if (interfaceNamePropertyAssignment = facadeObject.getPropertyAssignmentByName("interfaceName")) { + if (facadeStringLiteral.key_eq(interfaceNamePropertyAssignment.getInitializer())) { + if (facadeQualifiedName = facadeStringLiteral.getValue()) { + return true + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } +} +pub fn real_output(rpcName: string, facadeName: string, trFuncName: string, rpcFieldName: string, trFieldName: string) -> bool { + let (javascript_db = default_javascript_db()) { + for (controllerFunc in FunctionLikeDeclaration(javascript_db), + serviceCaller in CallExpression(javascript_db), + serviceCallee in MethodDeclaration(javascript_db), + proxyCaller in CallExpression(javascript_db)) { + if (rpcNameControllerFunction(rpcName, controllerFunc)) { + if (controllerReturnField(controllerFunc, rpcFieldName)) { + if (trFieldName = rpcFieldName) { + for (auto_tmp1 in serviceCaller.getAnAncestorEnclosingFunction()) { + if (auto_tmp1 = controllerFunc) { + if (getAnDescendantServiceCallee(serviceCaller, FunctionLikeDeclaration(javascript_db).find(serviceCallee))) { + for (auto_tmp2 in proxyCaller.getAnAncestorEnclosingFunction()) { + if (auto_tmp2 = controllerFunc) { + for (facadeProxyName in string::__undetermined_all__()) { + if (proxyCallerDesc(proxyCaller, facadeProxyName, trFuncName)) { + if (getAppFacade(__all_data__, facadeProxyName, facadeName)) { + return true + } + } + } + } + } + for (auto_tmp3 in proxyCaller.getAnAncestorEnclosingFunction()) { + if (auto_tmp3.key_eq(serviceCallee)) { + for (facadeProxyName in string::__undetermined_all__()) { + if (proxyCallerDesc(proxyCaller, facadeProxyName, trFuncName)) { + if (getAppFacade(__all_data__, facadeProxyName, facadeName)) { + return true + } + } + } + } + } + } + } + } + } + } + if (tmp_0(controllerFunc).len() = 0) { + if (rpcFieldName = "") { + if (trFieldName = rpcFieldName) { + for (auto_tmp1 in serviceCaller.getAnAncestorEnclosingFunction()) { + if (auto_tmp1 = controllerFunc) { + if (getAnDescendantServiceCallee(serviceCaller, FunctionLikeDeclaration(javascript_db).find(serviceCallee))) { + for (auto_tmp2 in proxyCaller.getAnAncestorEnclosingFunction()) { + if (auto_tmp2 = controllerFunc) { + for (facadeProxyName in string::__undetermined_all__()) { + if (proxyCallerDesc(proxyCaller, facadeProxyName, trFuncName)) { + if (getAppFacade(__all_data__, facadeProxyName, facadeName)) { + return true + } + } + } + } + } + for (auto_tmp3 in proxyCaller.getAnAncestorEnclosingFunction()) { + if (auto_tmp3.key_eq(serviceCallee)) { + for (facadeProxyName in string::__undetermined_all__()) { + if (proxyCallerDesc(proxyCaller, facadeProxyName, trFuncName)) { + if (getAppFacade(__all_data__, facadeProxyName, facadeName)) { + return true + } + } + } + } + } + } + } + } + } + } + } + } + } + } +} + + +fn default_javascript_db() -> JavascriptDB { + return JavascriptDB::load("coref_javascript_src.db") +} + +fn tmp_0(controllerFunc: FunctionLikeDeclaration) -> *FunctionLikeDeclaration { + let (javascript_db = default_javascript_db()) { + for (_ in string::__undetermined_all__()) { + for (func in FunctionLikeDeclaration(javascript_db)) { + if (func = controllerFunc) { + if (controllerReturnField(func, __all_data__)) { + yield func + } + } + } + } + } +} + +fn main() { + output(real_output()) +} \ No newline at end of file diff --git a/example/icse25/rules/rule15.gdl b/example/icse25/rules/rule15.gdl new file mode 100644 index 00000000..214e005f --- /dev/null +++ b/example/icse25/rules/rule15.gdl @@ -0,0 +1,168 @@ +// script +use coref::java::* +pub fn getAField(aClass: Class, aField: Field, fieldName: string, isList: string) -> bool { + let (java_db = default_java_db()) { + for (fieldTypeQualifiedName in string::__undetermined_all__()) { + for (fieldType in Type(java_db)) { + for (auto_tmp1 in aClass.getAllFields()) { + if (aField = auto_tmp1) { + if (fieldName = aField.getName()) { + if (fieldType = aField.getType()) { + if (fieldTypeQualifiedName = fieldType.getQualifiedName()) { + if (tmp_0(fieldTypeQualifiedName)) { + if (isList = "Y") { + return true + } + } + if (!(tmp_0(fieldTypeQualifiedName))) { + if (isList = "N") { + return true + } + } + } + } + } + } + } + } + } + } +} +pub fn getFieldClass(aField: Field, fieldClass: Class) -> bool { + let (java_db = default_java_db()) { + for (fieldTypeQualifiedName in string::__undetermined_all__(), + isList in string::__undetermined_all__()) { + for (fieldType in Type(java_db)) { + if (fieldType = aField.getType()) { + if (fieldTypeQualifiedName = fieldType.getQualifiedName()) { + if (tmp_1(fieldTypeQualifiedName)) { + if (isList = "Y") { + for (fieldTypeClassQualifiedName in string::__undetermined_all__()) { + if (fieldTypeClassQualifiedName = fieldTypeQualifiedName.get_regex_match_result(".*List<(.+)>", 1)) { + if (fieldClass.getQualifiedName() = fieldTypeClassQualifiedName) { + return true + } + } + } + } + } + if (!(tmp_1(fieldTypeQualifiedName))) { + if (isList = "N") { + if (fieldClass.getQualifiedName() = fieldTypeQualifiedName) { + return true + } + } + } + } + } + } + } + } +} +pub fn getADescendantField(rootField: Field, outerField: Field, aField: Field, fieldName: string, isList: string) -> bool { + let (java_db = default_java_db()) { + for (fieldClass in Class(java_db)) { + if (getFieldClass(rootField, fieldClass)) { + if (outerField = rootField) { + if (getAField(fieldClass, aField, fieldName, isList)) { + return true + } + } + for (childField in Field(java_db)) { + if (getAField(fieldClass, childField, __all_data__, __all_data__)) { + if (getADescendantField(childField, outerField, aField, fieldName, isList)) { + return true + } + } + } + } + } + } +} +pub fn facadeMethod(facadeQualifiedName: string, trMethodName: string) -> bool { + [ + {"com.xxx.filtered.BlockFacade", "using"}, + {"com.xxx.filtered.BlockFacade", "batchLoad"}, + {"com.xxx.filtered.LayoutFacade", "using"}, + {"com.xxx.filtered.LayoutFacade", "loadLayoutData"}, + {"com.xxx.filtered.FpcQueryFacade", "using"}, + {"com.xxx.filtered.FpcQueryFacade", "queryGroupByProduct"}, + {"com.xxx.filtered.FpcQueryFacade", "queryGroupByProductObject"}, + {"com.xxx.filtered.FpcFeaturedListQueryFacade", "using"}, + {"com.xxx.filtered.FpcFundManagerQueryFacade", "queryProfile"}, + {"com.xxx.filtered.FpcFundManagerQueryFacade", "queryProfileExt"}, + {"com.xxx.filtered.FpcGoldFundQueryFacade", "queryTrackDetail"}, + {"com.xxx.filtered.FpcGoldFundQueryFacade", "queryGoldFundCurve"}, + {"com.xxx.filtered.FpcIndexQueryFacade", "queryInfo"}, + {"com.xxx.filtered.FpcIndustryQueryFacade", "queryInfo"}, + {"com.xxx.filtered.FpcYieldLineQueryFacade", "queryProdTimingAbility"}, + {"com.xxx.filtered.FpcManagerQueryFacade", "using"} + ] +} +pub fn real_output(facadeQualifiedName: string, trMethodName: string, outerFieldId: int, fieldId: int, fieldName: string, isList: string) -> bool { + let (java_db = default_java_db()) { + for (returnType in Type(java_db), + returnClass in Class(java_db)) { + for (facadeInterface in Interface(java_db), + trMethod in Method(java_db)) { + if (facadeMethod(facadeQualifiedName, trMethodName)) { + if (facadeInterface.getQualifiedName() = facadeQualifiedName) { + if (trMethod.getParent().key_eq(facadeInterface)) { + if (trMethod.getName() = trMethodName) { + if (returnType = trMethod.getType()) { + if (returnClass.getQualifiedName() = returnType.getQualifiedName()) { + if (fieldName != "serialVersionUID") { + for (aField in Field(java_db)) { + if (getAField(returnClass, aField, fieldName, isList)) { + if (outerFieldId = 0) { + if (fieldId = aField.element_hash_id) { + return true + } + } + } + for (rootField in Field(java_db), outerField in Field(java_db)) { + if (getAField(returnClass, rootField, __all_data__, __all_data__) && outerField.element_hash_id = outerFieldId) { + if (getADescendantField(rootField, outerField, aField, fieldName, isList)) { + if (fieldId = aField.element_hash_id) { + return true + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } +} + + +fn default_java_db() -> JavaDB { + return JavaDB::load("coref_java_src.db") +} + +fn tmp_0(fieldTypeQualifiedName: string) -> bool { + let (java_db = default_java_db()) { + if (fieldTypeQualifiedName.matches(".*List<.+>")) { + return true + } + } +} + +fn tmp_1(fieldTypeQualifiedName: string) -> bool { + let (java_db = default_java_db()) { + if (fieldTypeQualifiedName.matches(".*List<.+>")) { + return true + } + } +} + +fn main() { + output(real_output()) +} \ No newline at end of file diff --git a/example/icse25/rules/rule16.gdl b/example/icse25/rules/rule16.gdl new file mode 100644 index 00000000..44acd3da --- /dev/null +++ b/example/icse25/rules/rule16.gdl @@ -0,0 +1,149 @@ +// script +use coref::javascript::* +pub fn getAppFacade(appName: string, proxyFacadeName: string, facadeQualifiedName: string) -> bool { + let (javascript_db = default_javascript_db()) { + for (objectLiteralExpression in ObjectLiteralExpression(javascript_db)) { + for (file in File(javascript_db), + location in Location(javascript_db), + servicePropertyAssignment in PropertyAssignment(javascript_db), + arrayLiteralExpression in ArrayLiteralExpression(javascript_db)) { + if (file.getRelativePath() = "config/proxy.js") { + if (location.getFile() = file) { + if (servicePropertyAssignment.getLocation() = location) { + if (servicePropertyAssignment.getName() = "services") { + if (arrayLiteralExpression.key_eq(servicePropertyAssignment.getInitializer())) { + for (auto_tmp1 in arrayLiteralExpression.getAElement()) { + if (objectLiteralExpression.key_eq(auto_tmp1)) { + for (appNamePropertyAssignment in PropertyAssignment(javascript_db), + appNameString in StringLiteral(javascript_db)) { + if (appNamePropertyAssignment = objectLiteralExpression.getPropertyAssignmentByName("appname")) { + if (appNameString.key_eq(appNamePropertyAssignment.getInitializer())) { + if (appName = appNameString.getValue()) { + for (apiPropertyAssignment in PropertyAssignment(javascript_db), + apiObject in ObjectLiteralExpression(javascript_db), + facadePropertyAssignment in PropertyAssignment(javascript_db)) { + if (apiPropertyAssignment = objectLiteralExpression.getPropertyAssignmentByName("api")) { + if (apiObject.key_eq(apiPropertyAssignment.getInitializer())) { + for (auto_tmp2 in apiObject.getAProperty()) { + if (facadePropertyAssignment.key_eq(auto_tmp2)) { + if (proxyFacadeName = facadePropertyAssignment.getName()) { + for (facadeStringLiteral in StringLiteral(javascript_db)) { + if (facadeStringLiteral.key_eq(facadePropertyAssignment.getInitializer())) { + if (facadeQualifiedName = facadeStringLiteral.getValue()) { + return true + } + } + for (facadeObject in ObjectLiteralExpression(javascript_db), + interfaceNamePropertyAssignment in PropertyAssignment(javascript_db)) { + if (facadeObject.key_eq(facadePropertyAssignment.getInitializer())) { + if (interfaceNamePropertyAssignment = facadeObject.getPropertyAssignmentByName("interfaceName")) { + if (facadeStringLiteral.key_eq(interfaceNamePropertyAssignment.getInitializer())) { + if (facadeQualifiedName = facadeStringLiteral.getValue()) { + return true + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } +} +pub fn proxyCallerDesc(proxyCaller: CallExpression, facadeName: string, trFuncName: string) -> bool { + let (javascript_db = default_javascript_db()) { + for (expression in PropertyAccessExpression(javascript_db)) { + if (expression.key_eq(proxyCaller.getExpression())) { + for (facadeExpressionText in string::__undetermined_all__()) { + for (facadeExpression in LeftHandSideExpression(javascript_db)) { + for (leftHandSideExpression in LeftHandSideExpression(javascript_db)) { + if (leftHandSideExpression = expression.getExpression()) { + for (callExpression in CallExpression(javascript_db)) { + if (callExpression.key_eq(leftHandSideExpression)) { + for (usingExpression in PropertyAccessExpression(javascript_db)) { + if (usingExpression.key_eq(callExpression.getExpression())) { + if (facadeExpression = usingExpression.getExpression()) { + if (facadeExpressionText = facadeExpression.getText()) { + if (facadeName = facadeExpressionText.get_regex_match_result("(this\\.|ctx\\.|this\\.ctx\\.)?proxy\\.(.+)", 2)) { + if (facadeName != "") { + for (serviceFuncIdentifier in Identifier(javascript_db)) { + if (serviceFuncIdentifier.key_eq(expression.getProperty())) { + if (trFuncName = serviceFuncIdentifier.getText()) { + if (trFuncName != "using") { + return true + } + } + } + } + } + } + } + } + } + } + } + } + if (isPropertyAccessExpression(Node(javascript_db).find(leftHandSideExpression))) { + if (facadeExpression = leftHandSideExpression) { + if (facadeExpressionText = facadeExpression.getText()) { + if (facadeName = facadeExpressionText.get_regex_match_result("(this\\.|ctx\\.|this\\.ctx\\.)?proxy\\.(.+)", 2)) { + if (facadeName != "") { + for (serviceFuncIdentifier in Identifier(javascript_db)) { + if (serviceFuncIdentifier.key_eq(expression.getProperty())) { + if (trFuncName = serviceFuncIdentifier.getText()) { + if (trFuncName != "using") { + return true + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } +} +pub fn real_output(appName: string, facadeQualifiedName: string, trMethodName: string) -> bool { + let (javascript_db = default_javascript_db()) { + for (facadeName in string::__undetermined_all__()) { + if (proxyCallerDesc(__all_data__, facadeName, trMethodName)) { + if (getAppFacade(appName, facadeName, facadeQualifiedName)) { + return true + } + } + } + } +} + + +fn default_javascript_db() -> JavascriptDB { + return JavascriptDB::load("coref_javascript_src.db") +} + +fn main() { + output(real_output()) +} \ No newline at end of file diff --git a/example/icse25/rules/rule17.gdl b/example/icse25/rules/rule17.gdl new file mode 100644 index 00000000..1ce105c6 --- /dev/null +++ b/example/icse25/rules/rule17.gdl @@ -0,0 +1,766 @@ +// script +use coref::java::* +use coref::xml::* +pub fn getJavaECGNode(id: int) -> bool { + // #javaecgnode + // example + [ {1111} ] +} +pub fn getAField(aClass: Class, aField: Field, fieldName: string, isList: string) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (fieldTypeQualifiedName in string::__undetermined_all__()) { + for (fieldType in Type(java_db)) { + for (auto_tmp1 in aClass.getAllFields()) { + if (aField = auto_tmp1) { + if (fieldName = aField.getName()) { + if (fieldType = aField.getType()) { + if (fieldTypeQualifiedName = fieldType.getQualifiedName()) { + if (tmp_0(fieldTypeQualifiedName)) { + if (isList = "Y") { + return true + } + } + if (!(tmp_0(fieldTypeQualifiedName))) { + if (isList = "N") { + return true + } + } + } + } + } + } + } + } + } + } + } +} +pub fn getFieldClass(aField: Field, fieldClass: Class) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (fieldTypeQualifiedName in string::__undetermined_all__(), + isList in string::__undetermined_all__()) { + for (fieldType in Type(java_db)) { + if (fieldType = aField.getType()) { + if (fieldTypeQualifiedName = fieldType.getQualifiedName()) { + if (tmp_1(fieldTypeQualifiedName)) { + if (isList = "Y") { + for (fieldTypeClassQualifiedName in string::__undetermined_all__()) { + if (fieldTypeClassQualifiedName = fieldTypeQualifiedName.get_regex_match_result(".*List<(.+)>", 1)) { + if (fieldClass.getQualifiedName() = fieldTypeClassQualifiedName) { + return true + } + } + } + } + } + if (!(tmp_1(fieldTypeQualifiedName))) { + if (isList = "N") { + if (fieldClass.getQualifiedName() = fieldTypeQualifiedName) { + return true + } + } + } + } + } + } + } + } + } +} +pub fn getADescendantField(rootField: Field, outerField: Field, aField: Field, fieldName: string, isList: string) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (fieldClass in Class(java_db)) { + if (getFieldClass(rootField, fieldClass)) { + if (outerField = rootField) { + if (getAField(fieldClass, aField, fieldName, isList)) { + return true + } + } + for (childField in Field(java_db)) { + if (getAField(fieldClass, childField, __all_data__, __all_data__)) { + if (getADescendantField(childField, outerField, aField, fieldName, isList)) { + return true + } + } + } + } + } + } + } +} +schema SofaService extends Annotation { + +} + +impl SofaService { + + @data_constraint + @inline + pub fn __all__(db: JavaDB) -> *SofaService { + for (tmp in Annotation(db)) { + if (tmp.getName() = "SofaService") { + yield SofaService { + id : tmp.id + } + } + } + } + + pub fn getService(self) -> Interface { + for (value in string::__undetermined_all__()) { + for (i in Interface(__all_data__), + argus in AnnotationAccessArgument(__all_data__)) { + for (auto_tmp1 in self.getAnnotationArgument()) { + if (argus = auto_tmp1) { + if (argus.getAnnotationArgumentName() = "interfaceType") { + if (value = argus.getAnnotationArgumentValue()) { + if (i.getQualifiedName() = value) { + return i + } + } + } + } + } + } + } + } + + @inline + pub fn getBinding(self) -> SofaServiceBinding { + for (b in SofaServiceBinding(__all_data__), + argus in AnnotationAccessArgument(__all_data__)) { + for (auto_tmp1 in self.getAnnotationArgument()) { + if (argus = auto_tmp1) { + if (argus.getAnnotationArgumentName() = "bindings") { + if (b.key_eq(argus.getArgumentAnnotation())) { + return b + } + if (argus.key_eq(b.getParent())) { + return b + } + } + } + } + } + } + + @inline + pub fn getUniqueId(self) -> string { + for (uniqueId in string::__undetermined_all__()) { + for (anno in Annotation(__all_data__)) { + if (self.key_eq(anno)) { + if (tmp_4(anno)) { + for (argus in AnnotationAccessArgument(__all_data__)) { + for (auto_tmp1 in anno.getAnnotationArgument()) { + if (argus = auto_tmp1) { + if (argus.getAnnotationArgumentName() = "uniqueId") { + if (uniqueId = argus.getAnnotationArgumentValue()) { + return uniqueId + } + } + } + } + } + } + if (!(tmp_4(anno))) { + if (uniqueId = "null") { + return uniqueId + } + } + } + } + } + } + + +} + +pub fn uniqueArgument(anno: Annotation) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (argus in AnnotationAccessArgument(java_db)) { + for (auto_tmp1 in anno.getAnnotationArgument()) { + if (argus = auto_tmp1) { + if (argus.getAnnotationArgumentName() = "uniqueId") { + return true + } + } + } + } + } + } +} +schema SofaServiceBinding extends Annotation { + +} + +impl SofaServiceBinding { + + @data_constraint + @inline + pub fn __all__(db: JavaDB) -> *SofaServiceBinding { + for (tmp in Annotation(db)) { + if (tmp.getName() = "SofaServiceBinding") { + yield SofaServiceBinding { + id : tmp.id + } + } + } + } + + pub fn getType(self) -> string { + for (value in string::__undetermined_all__()) { + for (argus in AnnotationAccessArgument(__all_data__)) { + for (auto_tmp1 in self.getAnnotationArgument()) { + if (argus = auto_tmp1) { + if (argus.getAnnotationArgumentName() = "bindingType") { + if (value = argus.getAnnotationArgumentValue()) { + return value + } + } + } + } + } + } + } + + +} + +pub fn javaOutput(classname: string, name: string, uniqueId: string, type: string) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (value in string::__undetermined_all__()) { + for (s in SofaService(java_db), + c in Class(java_db), + b in SofaServiceBinding(java_db), + i in Interface(java_db)) { + if (b = s.getBinding()) { + if (value = b.getType()) { + if (value.contains("tr")) { + if (type = "tr") { + for (auto_tmp1 in c.getAnnotation()) { + if (s.key_eq(auto_tmp1)) { + if (classname = c.getQualifiedName()) { + for (auto_tmp2 in c.getImplementsInterface()) { + if (i = auto_tmp2) { + if (name = i.getQualifiedName()) { + if (uniqueId = s.getUniqueId()) { + return true + } + } + } + } + if (i = s.getService()) { + if (name = i.getQualifiedName()) { + if (uniqueId = s.getUniqueId()) { + return true + } + } + } + } + } + } + } + } + } + } + } + } + } + } +} +pub fn xmlOutput(bindingType: string, uniqueId: string, className: string, interfaceName: string) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (temp in string::__undetermined_all__()) { + for (s in SofaServiceXmlElement(xml_db), + b in BeanXmlElement(xml_db), + t in TagXmlElement(xml_db)) { + if (s.key_eq(t.getParent())) { + if (s.getRef() = b.getId()) { + if (interfaceName = s.getInterfaceName()) { + if (className = b.getClass()) { + if (uniqueId = s.getUniqueId()) { + if (bindingType = s.getBindingType()) { + if (temp = b.getLocation().getFile().getRelativePath()) { + if (!temp.contains("src/test/resources")) { + return true + } + } + } + } + } + } + } + } + } + } + } + } +} +pub fn annoOutput(bindingType: string, uniqueId: string, className: string, interfaceName: string) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (v in string::__undetermined_all__(), + k in string::__undetermined_all__()) { + for (s in SofaServiceXmlElement(xml_db), + b in Class(java_db), + t in TagXmlElement(xml_db), + a in Annotation(java_db)) { + if (s.key_eq(t.getParent())) { + if (v = s.getRef()) { + if (interfaceName = s.getInterfaceName()) { + if (uniqueId = s.getUniqueId()) { + if (bindingType = s.getBindingType()) { + for (auto_tmp1 in b.getAnnotation()) { + if (a = auto_tmp1) { + if (a.getName() = k) { + if (getTrAnnotationName(k)) { + for (auto_tmp2 in a.getAnnotationArgument()) { + if (auto_tmp2.getAnnotationArgumentValue() = "\"" + v + "\"") { + if (className = b.getQualifiedName()) { + return true + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } +} +pub fn getTrAnnotationName(a: string) -> bool { + [ + {"Service"}, + {"Component"}, + {"Scope"}, + {"Repository"}, + {"Controller"}, + {"RestController"}, + {"RequestMapping"}, + {"PathVariable"}, + {"ResponseBody"}, + {"bean"} + ] +} +pub fn output1(className: string, interfaceName: string, uniqueId: string, bindingType: string) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + if (xmlOutput(bindingType, uniqueId, className, interfaceName)) { + return true + } + if (javaOutput(className, interfaceName, uniqueId, bindingType)) { + return true + } + if (annoOutput(bindingType, uniqueId, className, interfaceName)) { + return true + } + } + } +} +pub fn isSelfDefinedInterface(name: string) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (i in Interface(java_db)) { + if (name = i.getQualifiedName()) { + return true + } + } + } + } +} +schema PublicMethod extends Method { + +} + +impl PublicMethod { + + @data_constraint + @inline + pub fn __all__(db: JavaDB) -> *PublicMethod { + for (tmp in Method(db)) { + for (m in Modifier(db)) { + for (auto_tmp1 in tmp.getModifier()) { + if (m = auto_tmp1) { + if (m.getName() = "public") { + if (!isSetOrGetMethod(tmp)) { + yield PublicMethod { + element_hash_id : tmp.element_hash_id, + name : tmp.name, + signature : tmp.signature, + type_hash_id : tmp.type_hash_id, + parent_hash_id : tmp.parent_hash_id, + location_hash_id : tmp.location_hash_id, + definition_body : tmp.definition_body + } + } + } + } + } + } + } + } + + +} + +pub fn isBooleanTypeField(f: Field, p: string, q: string) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (i in int::__undetermined_all__(), + n in string::__undetermined_all__(), + tmp1 in string::__undetermined_all__(), + tmp2 in string::__undetermined_all__(), + l in string::__undetermined_all__(), + j in string::__undetermined_all__()) { + if (n = f.getName()) { + if (i = n.len()) { + if (tmp_5(n)) { + if (tmp1 = n.substr(2,i)) { + if (l = n.substr(2,1)) { + if (tmp2 = n.substr(3,i)) { + if (q = n) { + if (p = "set" + tmp1) { + return true + } + } + if (q = "get" + l + tmp2) { + if (p = "set" + tmp1) { + return true + } + } + } + } + } + } + if (!(tmp_5(n))) { + if (l = n.substr(0,1)) { + if (tmp2 = n.substr(1,i)) { + if (lowerToUpper(l, j)) { + if (p = "set" + j + tmp2) { + if (q = "is" + j + tmp2) { + return true + } + if (q = "get" + j + tmp2) { + return true + } + } + if (p = "set" + n) { + if (q = "is" + j + tmp2) { + return true + } + if (q = "get" + j + tmp2) { + return true + } + } + } + } + } + } + } + } + } + } + } +} +pub fn isSetOrGetMethod(m: Method) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (i in int::__undetermined_all__(), + p in string::__undetermined_all__(), + q in string::__undetermined_all__(), + n in string::__undetermined_all__(), + l in string::__undetermined_all__(), + j in string::__undetermined_all__(), + tmp in string::__undetermined_all__(), + t in string::__undetermined_all__()) { + for (f in Field(java_db)) { + if (n = f.getName()) { + if (i = n.len()) { + if (f.getParent() = m.getParent()) { + if (p = m.getName()) { + if (t = f.getTypeElement().getPrintableText()) { + if (tmp_6(t)) { + if (isBooleanTypeField(f, p, q)) { + return true + } + } + if (!(tmp_6(t))) { + if (l = n.substr(0,1)) { + if (tmp = n.substr(1,i)) { + if (lowerToUpper(l, j)) { + if (p = "set" + j + tmp) { + if (q = "get" + j + tmp) { + return true + } + if (q = "get" + n) { + return true + } + } + if (p = "set" + n) { + if (q = "get" + j + tmp) { + return true + } + if (q = "get" + n) { + return true + } + } + } + } + } + } + } + } + if (q = m.getName()) { + if (t = f.getTypeElement().getPrintableText()) { + if (tmp_6(t)) { + if (isBooleanTypeField(f, p, q)) { + return true + } + } + if (!(tmp_6(t))) { + if (l = n.substr(0,1)) { + if (tmp = n.substr(1,i)) { + if (lowerToUpper(l, j)) { + if (p = "set" + j + tmp) { + if (q = "get" + j + tmp) { + return true + } + if (q = "get" + n) { + return true + } + } + if (p = "set" + n) { + if (q = "get" + j + tmp) { + return true + } + if (q = "get" + n) { + return true + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } +} +pub fn facadeMethod(interfaceName: string, methodName: string) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (className in string::__undetermined_all__(), + tag in string::__undetermined_all__()) { + for (i in Interface(java_db), + c in Class(java_db)) { + if (output1(className, interfaceName, __all_data__, __all_data__)) { + if (tmp_7(interfaceName)) { + if (interfaceName = i.getQualifiedName()) { + for (m in Method(java_db)) { + if (i.key_eq(m.getParent())) { + if (methodName = m.getName()) { + if (tag = "Self") { + return true + } + } + } + } + } + } + if (!(tmp_7(interfaceName))) { + if (className = c.getQualifiedName()) { + for (n in PublicMethod(java_db)) { + if (c.key_eq(n.getParent())) { + if (methodName = n.getName()) { + if (tag = "External") { + return true + } + } + } + } + } + } + } + } + } + } + } +} +pub fn real_output(facadeQualifiedName: string, trMethodName: string) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (outerFieldId in int::__undetermined_all__(), + fieldId in int::__undetermined_all__(), + fieldName in string::__undetermined_all__(), + isList in string::__undetermined_all__()) { + for (returnType in Type(java_db), + returnClass in Class(java_db)) { + for (aField in Field(java_db)) { + if (getJavaECGNode(aField.element_hash_id)) { + if (getAField(returnClass, aField, fieldName, isList)) { + if (outerFieldId = 0) { + if (fieldId = aField.element_hash_id) { + for (facadeInterface in Interface(java_db), + trMethod in Method(java_db)) { + if (facadeMethod(facadeQualifiedName, trMethodName)) { + if (facadeInterface.getQualifiedName() = facadeQualifiedName) { + if (trMethod.getParent().key_eq(facadeInterface)) { + if (trMethod.getName() = trMethodName) { + if (returnType = trMethod.getType()) { + if (returnClass.getQualifiedName() = returnType.getQualifiedName()) { + if (fieldName != "serialVersionUID") { + return true + } + } + } + } + } + } + } + } + } + } + } + for (rootField in Field(java_db), outerField in Field(java_db)) { + if (getAField(returnClass, rootField, __all_data__, __all_data__) && outerField.element_hash_id = outerFieldId) { + if (getADescendantField(rootField, outerField, aField, fieldName, isList)) { + if (fieldId = aField.element_hash_id) { + for (facadeInterface in Interface(java_db), + trMethod in Method(java_db)) { + if (facadeMethod(facadeQualifiedName, trMethodName)) { + if (facadeInterface.getQualifiedName() = facadeQualifiedName) { + if (trMethod.getParent().key_eq(facadeInterface)) { + if (trMethod.getName() = trMethodName) { + if (returnType = trMethod.getType()) { + if (returnClass.getQualifiedName() = returnType.getQualifiedName()) { + if (fieldName != "serialVersionUID") { + return true + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } +} + + +fn default_java_db() -> JavaDB { + return JavaDB::load("coref_java_src.db") +} + +fn default_xml_db() -> XmlDB { + return XmlDB::load("coref_xml_src.db") +} + +fn tmp_0(fieldTypeQualifiedName: string) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + if (fieldTypeQualifiedName.matches(".*List<.+>")) { + return true + } + } + } +} + +fn tmp_1(fieldTypeQualifiedName: string) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + if (fieldTypeQualifiedName.matches(".*List<.+>")) { + return true + } + } + } +} + +fn tmp_2(anno: Annotation) -> *auto_tmp_3 { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + if (uniqueArgument(anno)) { + yield auto_tmp_3 { + + } + } + } + } +} + +schema auto_tmp_3 { + +} + +fn tmp_4(anno: Annotation) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + if (tmp_2(anno).len() = 1) { + return true + } + } + } +} + +fn tmp_5(n: string) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + if (n.matches("is.*")) { + return true + } + } + } +} + +fn tmp_6(t: string) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + if (t = "boolean") { + return true + } + if (t = "Boolean") { + return true + } + } + } +} + +fn tmp_7(interfaceName: string) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + if (isSelfDefinedInterface(interfaceName)) { + return true + } + } + } +} + +fn main() { + output(real_output()) +} \ No newline at end of file diff --git a/example/icse25/rules/rule18.gdl b/example/icse25/rules/rule18.gdl new file mode 100644 index 00000000..15609136 --- /dev/null +++ b/example/icse25/rules/rule18.gdl @@ -0,0 +1,160 @@ +// script +use coref::javascript::* +pub fn getInfluencedTrAPI(interfaceName: string, methodName: string) -> bool { + // #rule17的结果 + // example + [ + {"com.xxx.filtered.BlockFacade", "load"}, + {"com.xxx.filtered.BlockFacade", "batchLoad"}, + {"com.xxx.filtered.LayoutFacade", "getLayoutDef"} + ] +} +pub fn getAppFacade(appName: string, proxyFacadeName: string, facadeQualifiedName: string) -> bool { + let (javascript_db = default_javascript_db()) { + for (objectLiteralExpression in ObjectLiteralExpression(javascript_db)) { + for (file in File(javascript_db), + location in Location(javascript_db), + servicePropertyAssignment in PropertyAssignment(javascript_db), + arrayLiteralExpression in ArrayLiteralExpression(javascript_db)) { + if (file.getRelativePath() = "config/proxy.js") { + if (location.getFile() = file) { + if (servicePropertyAssignment.getLocation() = location) { + if (servicePropertyAssignment.getName() = "services") { + if (arrayLiteralExpression.key_eq(servicePropertyAssignment.getInitializer())) { + for (auto_tmp1 in arrayLiteralExpression.getAElement()) { + if (objectLiteralExpression.key_eq(auto_tmp1)) { + for (appNamePropertyAssignment in PropertyAssignment(javascript_db), + appNameString in StringLiteral(javascript_db)) { + if (appNamePropertyAssignment = objectLiteralExpression.getPropertyAssignmentByName("appname")) { + if (appNameString.key_eq(appNamePropertyAssignment.getInitializer())) { + if (appName = appNameString.getValue()) { + for (apiPropertyAssignment in PropertyAssignment(javascript_db), + apiObject in ObjectLiteralExpression(javascript_db), + facadePropertyAssignment in PropertyAssignment(javascript_db)) { + if (apiPropertyAssignment = objectLiteralExpression.getPropertyAssignmentByName("api")) { + if (apiObject.key_eq(apiPropertyAssignment.getInitializer())) { + for (auto_tmp2 in apiObject.getAProperty()) { + if (facadePropertyAssignment.key_eq(auto_tmp2)) { + if (proxyFacadeName = facadePropertyAssignment.getName()) { + for (facadeStringLiteral in StringLiteral(javascript_db)) { + if (facadeStringLiteral.key_eq(facadePropertyAssignment.getInitializer())) { + if (facadeQualifiedName = facadeStringLiteral.getValue()) { + return true + } + } + for (facadeObject in ObjectLiteralExpression(javascript_db), + interfaceNamePropertyAssignment in PropertyAssignment(javascript_db)) { + if (facadeObject.key_eq(facadePropertyAssignment.getInitializer())) { + if (interfaceNamePropertyAssignment = facadeObject.getPropertyAssignmentByName("interfaceName")) { + if (facadeStringLiteral.key_eq(interfaceNamePropertyAssignment.getInitializer())) { + if (facadeQualifiedName = facadeStringLiteral.getValue()) { + return true + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } +} +pub fn proxyCallerDesc(proxyCaller: CallExpression, facadeName: string, trFuncName: string) -> bool { + let (javascript_db = default_javascript_db()) { + for (expression in PropertyAccessExpression(javascript_db)) { + if (expression.key_eq(proxyCaller.getExpression())) { + for (facadeExpressionText in string::__undetermined_all__()) { + for (facadeExpression in LeftHandSideExpression(javascript_db)) { + for (leftHandSideExpression in LeftHandSideExpression(javascript_db)) { + if (leftHandSideExpression = expression.getExpression()) { + for (callExpression in CallExpression(javascript_db)) { + if (callExpression.key_eq(leftHandSideExpression)) { + for (usingExpression in PropertyAccessExpression(javascript_db)) { + if (usingExpression.key_eq(callExpression.getExpression())) { + if (facadeExpression = usingExpression.getExpression()) { + if (facadeExpressionText = facadeExpression.getText()) { + if (facadeName = facadeExpressionText.get_regex_match_result("(this\\.|ctx\\.|this\\.ctx\\.)?proxy\\.(.+)", 2)) { + if (facadeName != "") { + for (serviceFuncIdentifier in Identifier(javascript_db)) { + if (serviceFuncIdentifier.key_eq(expression.getProperty())) { + if (trFuncName = serviceFuncIdentifier.getText()) { + if (trFuncName != "using") { + return true + } + } + } + } + } + } + } + } + } + } + } + } + if (isPropertyAccessExpression(Node(javascript_db).find(leftHandSideExpression))) { + if (facadeExpression = leftHandSideExpression) { + if (facadeExpressionText = facadeExpression.getText()) { + if (facadeName = facadeExpressionText.get_regex_match_result("(this\\.|ctx\\.|this\\.ctx\\.)?proxy\\.(.+)", 2)) { + if (facadeName != "") { + for (serviceFuncIdentifier in Identifier(javascript_db)) { + if (serviceFuncIdentifier.key_eq(expression.getProperty())) { + if (trFuncName = serviceFuncIdentifier.getText()) { + if (trFuncName != "using") { + return true + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } +} +pub fn real_output(appName: string, facadeQualifiedName: string, trMethodName: string) -> bool { + let (javascript_db = default_javascript_db()) { + for (facadeName in string::__undetermined_all__()) { + if (getInfluencedTrAPI(facadeQualifiedName, trMethodName)) { + if (proxyCallerDesc(__all_data__, facadeName, trMethodName)) { + if (getAppFacade(appName, facadeName, facadeQualifiedName)) { + return true + } + } + } + } + } +} + + +fn default_javascript_db() -> JavascriptDB { + return JavascriptDB::load("coref_javascript_src.db") +} + +fn main() { + output(real_output()) +} \ No newline at end of file diff --git a/example/icse25/rules/rule19.gdl b/example/icse25/rules/rule19.gdl new file mode 100644 index 00000000..440ed3e0 --- /dev/null +++ b/example/icse25/rules/rule19.gdl @@ -0,0 +1,381 @@ +// script +use coref::javascript::* + +pub fn getInfluencedTrAPI(appName: string, facadeQualifiedName: string, trMethodName: string) -> bool { + // #rule18结果 + // example + [ + {"finpdcenter", "com.xxx.filtered.BlockFacade", "load"}, + {"finpdcenter", "com.xxx.filtered.BlockFacade", "batchLoad"} + ] +} +pub fn rpcNameControllerFunctionIdentifier(rpcName: string, controllerFunctionIdentifier: Expression) -> bool { + let (javascript_db = default_javascript_db()) { + for (callExpression in CallExpression(javascript_db)) { + for (routerFile in File(javascript_db)) { + for (routerPath in string::__undetermined_all__()) { + if (routerPath = routerFile.getRelativePath()) { + if (routerPath.matches("app/router(\\.[jt]s|/.+\\.[jt]s)")) { + if (callExpression.getLocation().getFile() = routerFile) { + for (accessExpression in AccessExpression(javascript_db), + property in Expression(javascript_db)) { + if (accessExpression.key_eq(callExpression.getExpression())) { + if (property = accessExpression.getPropertyExpression()) { + if (property.getText() = "rpc") { + for (rpcNameStringLiteral in StringLiteral(javascript_db)) { + if (rpcNameStringLiteral.key_eq(callExpression.getArgument(0))) { + if (rpcName = rpcNameStringLiteral.getValue()) { + let (argumentCount = callExpression.getArgumentCount()) { + if (controllerFunctionIdentifier = callExpression.getArgument(argumentCount - 1)) { + return true + } + } + } + } + } + } + if (property.getText() = "rpcAndGet") { + for (rpcNameStringLiteral in StringLiteral(javascript_db)) { + if (rpcNameStringLiteral.key_eq(callExpression.getArgument(0))) { + if (rpcName = rpcNameStringLiteral.getValue()) { + let (argumentCount = callExpression.getArgumentCount()) { + if (controllerFunctionIdentifier = callExpression.getArgument(argumentCount - 1)) { + return true + } + } + } + } + } + } + if (property.getText() = "rpcAndPost") { + for (rpcNameStringLiteral in StringLiteral(javascript_db)) { + if (rpcNameStringLiteral.key_eq(callExpression.getArgument(0))) { + if (rpcName = rpcNameStringLiteral.getValue()) { + let (argumentCount = callExpression.getArgumentCount()) { + if (controllerFunctionIdentifier = callExpression.getArgument(argumentCount - 1)) { + return true + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } +} +pub fn rpcNameControllerFunction(rpcName: string, controllerFunction: FunctionLikeDeclaration) -> bool { + let (javascript_db = default_javascript_db()) { + for (controllerFunctionIdentifier in Expression(javascript_db)) { + if (rpcNameControllerFunctionIdentifier(rpcName, controllerFunctionIdentifier)) { + for (symbol in Symbol(javascript_db)) { + if (symbol = controllerFunctionIdentifier.getSymbol()) { + if (controllerFunction.getSymbol() = symbol) { + return true + } + for (variableDeclaration in VariableDeclaration(javascript_db)) { + if (variableDeclaration.getSymbol() = symbol) { + if (controllerFunction.key_eq(variableDeclaration.getInitializer())) { + return true + } + } + } + for (propertyDeclaration in PropertyDeclaration(javascript_db)) { + if (propertyDeclaration.getSymbol() = symbol) { + if (controllerFunction.key_eq(propertyDeclaration.getInitializer())) { + return true + } + } + } + } + } + } + } + } +} +pub fn controllerReturnField(controllerFunc: FunctionLikeDeclaration, fieldName: string) -> bool { + let (javascript_db = default_javascript_db()) { + for (simpleAssignmentExpression in SimpleAssignmentExpression(javascript_db)) { + for (auto_tmp1 in simpleAssignmentExpression.getAnAncestorEnclosingFunction()) { + if (auto_tmp1 = controllerFunc) { + for (leftOperandText in string::__undetermined_all__()) { + for (leftOperand in Expression(javascript_db)) { + if (leftOperand = simpleAssignmentExpression.getLeftOperand()) { + if (leftOperandText = leftOperand.getText()) { + if (leftOperandText.matches("(this\\.|ctx\\.|this\\.ctx\\.)?body")) { + for (object in ObjectLiteralExpression(javascript_db), + objectElement in ObjectLiteralElement(javascript_db)) { + if (object.key_eq(simpleAssignmentExpression.getRightOperand())) { + if (objectElement = object.getPropertyByName(fieldName)) { + return true + } + } + } + } + } + } + } + } + } + } + } + } +} +pub fn serviceCallSite(serviceCaller: CallExpression, serviceFunction: FunctionLikeDeclaration) -> bool { + let (javascript_db = default_javascript_db()) { + for (expressionText in string::__undetermined_all__()) { + for (expression in PropertyAccessExpression(javascript_db)) { + if (expression.key_eq(serviceCaller.getExpression())) { + if (expressionText = expression.getText()) { + if (expressionText.matches("(this\\.|ctx\\.|this\\.ctx\\.)?service\\.(.+)")) { + if (serviceFunction = serviceCaller.getCallee()) { + return true + } + } + } + } + } + } + } +} +pub fn getAnDescendantServiceCallee(serviceCaller: CallExpression, descendantServiceCallee: FunctionLikeDeclaration) -> bool { + let (javascript_db = default_javascript_db()) { + if (serviceCallSite(serviceCaller, descendantServiceCallee)) { + return true + } + for (serviceCallee in FunctionLikeDeclaration(javascript_db), + childServiceCaller in CallExpression(javascript_db)) { + if (serviceCallSite(serviceCaller, serviceCallee)) { + for (auto_tmp1 in childServiceCaller.getAnAncestorEnclosingFunction()) { + if (auto_tmp1 = serviceCallee) { + if (getAnDescendantServiceCallee(childServiceCaller, descendantServiceCallee)) { + return true + } + } + } + } + } + } +} +pub fn proxyCallerDesc(proxyCaller: CallExpression, facadeName: string, trFuncName: string) -> bool { + let (javascript_db = default_javascript_db()) { + for (expression in PropertyAccessExpression(javascript_db)) { + if (expression.key_eq(proxyCaller.getExpression())) { + for (facadeExpressionText in string::__undetermined_all__()) { + for (facadeExpression in LeftHandSideExpression(javascript_db)) { + for (leftHandSideExpression in LeftHandSideExpression(javascript_db)) { + if (leftHandSideExpression = expression.getExpression()) { + for (callExpression in CallExpression(javascript_db)) { + if (callExpression.key_eq(leftHandSideExpression)) { + for (usingExpression in PropertyAccessExpression(javascript_db)) { + if (usingExpression.key_eq(callExpression.getExpression())) { + if (facadeExpression = usingExpression.getExpression()) { + if (facadeExpressionText = facadeExpression.getText()) { + if (facadeName = facadeExpressionText.get_regex_match_result("(this\\.|ctx\\.|this\\.ctx\\.)?proxy\\.(.+)", 2)) { + if (facadeName != "") { + for (serviceFuncIdentifier in Identifier(javascript_db)) { + if (serviceFuncIdentifier.key_eq(expression.getProperty())) { + if (trFuncName = serviceFuncIdentifier.getText()) { + if (trFuncName != "using") { + return true + } + } + } + } + } + } + } + } + } + } + } + } + if (isPropertyAccessExpression(Node(javascript_db).find(leftHandSideExpression))) { + if (facadeExpression = leftHandSideExpression) { + if (facadeExpressionText = facadeExpression.getText()) { + if (facadeName = facadeExpressionText.get_regex_match_result("(this\\.|ctx\\.|this\\.ctx\\.)?proxy\\.(.+)", 2)) { + if (facadeName != "") { + for (serviceFuncIdentifier in Identifier(javascript_db)) { + if (serviceFuncIdentifier.key_eq(expression.getProperty())) { + if (trFuncName = serviceFuncIdentifier.getText()) { + if (trFuncName != "using") { + return true + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } +} +pub fn getAppFacade(appName: string, proxyFacadeName: string, facadeQualifiedName: string) -> bool { + let (javascript_db = default_javascript_db()) { + for (objectLiteralExpression in ObjectLiteralExpression(javascript_db)) { + for (proxyPath in string::__undetermined_all__()) { + for (file in File(javascript_db), + location in Location(javascript_db), + servicePropertyAssignment in PropertyAssignment(javascript_db), + arrayLiteralExpression in ArrayLiteralExpression(javascript_db)) { + if (proxyPath = file.getRelativePath()) { + if (proxyPath.matches("config/proxy\\.[jt]s")) { + if (location.getFile() = file) { + if (servicePropertyAssignment.getLocation() = location) { + if (servicePropertyAssignment.getName() = "services") { + if (arrayLiteralExpression.key_eq(servicePropertyAssignment.getInitializer())) { + for (auto_tmp1 in arrayLiteralExpression.getAElement()) { + if (objectLiteralExpression.key_eq(auto_tmp1)) { + for (appNamePropertyAssignment in PropertyAssignment(javascript_db), + appNameString in StringLiteral(javascript_db)) { + if (appNamePropertyAssignment = objectLiteralExpression.getPropertyAssignmentByName("appname")) { + if (appNameString.key_eq(appNamePropertyAssignment.getInitializer())) { + if (appName = appNameString.getValue()) { + for (apiPropertyAssignment in PropertyAssignment(javascript_db), + apiObject in ObjectLiteralExpression(javascript_db), + facadePropertyAssignment in PropertyAssignment(javascript_db)) { + if (apiPropertyAssignment = objectLiteralExpression.getPropertyAssignmentByName("api")) { + if (apiObject.key_eq(apiPropertyAssignment.getInitializer())) { + for (auto_tmp2 in apiObject.getAProperty()) { + if (facadePropertyAssignment.key_eq(auto_tmp2)) { + if (proxyFacadeName = facadePropertyAssignment.getName()) { + for (facadeStringLiteral in StringLiteral(javascript_db)) { + if (facadeStringLiteral.key_eq(facadePropertyAssignment.getInitializer())) { + if (facadeQualifiedName = facadeStringLiteral.getValue()) { + return true + } + } + for (facadeObject in ObjectLiteralExpression(javascript_db), + interfaceNamePropertyAssignment in PropertyAssignment(javascript_db)) { + if (facadeObject.key_eq(facadePropertyAssignment.getInitializer())) { + if (interfaceNamePropertyAssignment = facadeObject.getPropertyAssignmentByName("interfaceName")) { + if (facadeStringLiteral.key_eq(interfaceNamePropertyAssignment.getInitializer())) { + if (facadeQualifiedName = facadeStringLiteral.getValue()) { + return true + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } +} +pub fn real_output(rpcName: string, facadeName: string, trFuncName: string, rpcFieldName: string, trFieldName: string) -> bool { + let (javascript_db = default_javascript_db()) { + for (controllerFunc in FunctionLikeDeclaration(javascript_db), + serviceCaller in CallExpression(javascript_db), + serviceCallee in MethodDeclaration(javascript_db), + proxyCaller in CallExpression(javascript_db)) { + for (facadeProxyName in string::__undetermined_all__()) { + if (getInfluencedTrAPI(__all_data__, facadeName, trFuncName)) { + if (proxyCallerDesc(proxyCaller, facadeProxyName, trFuncName)) { + if (getAppFacade(__all_data__, facadeProxyName, facadeName)) { + if (rpcNameControllerFunction(rpcName, controllerFunc)) { + if (controllerReturnField(controllerFunc, rpcFieldName)) { + if (trFieldName = rpcFieldName) { + for (auto_tmp1 in serviceCaller.getAnAncestorEnclosingFunction()) { + if (auto_tmp1 = controllerFunc) { + if (getAnDescendantServiceCallee(serviceCaller, FunctionLikeDeclaration(javascript_db).find(serviceCallee))) { + for (auto_tmp2 in proxyCaller.getAnAncestorEnclosingFunction()) { + if (auto_tmp2 = controllerFunc) { + return true + } + } + for (auto_tmp3 in proxyCaller.getAnAncestorEnclosingFunction()) { + if (auto_tmp3.key_eq(serviceCallee)) { + return true + } + } + } + } + } + } + } + if (tmp_0(controllerFunc).len() = 0) { + if (rpcFieldName = "") { + if (trFieldName = rpcFieldName) { + for (auto_tmp1 in serviceCaller.getAnAncestorEnclosingFunction()) { + if (auto_tmp1 = controllerFunc) { + if (getAnDescendantServiceCallee(serviceCaller, FunctionLikeDeclaration(javascript_db).find(serviceCallee))) { + for (auto_tmp2 in proxyCaller.getAnAncestorEnclosingFunction()) { + if (auto_tmp2 = controllerFunc) { + return true + } + } + for (auto_tmp3 in proxyCaller.getAnAncestorEnclosingFunction()) { + if (auto_tmp3.key_eq(serviceCallee)) { + return true + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } +} + + +fn default_javascript_db() -> JavascriptDB { + return JavascriptDB::load("coref_javascript_src.db") +} + +fn tmp_0(controllerFunc: FunctionLikeDeclaration) -> *FunctionLikeDeclaration { + let (javascript_db = default_javascript_db()) { + for (_ in string::__undetermined_all__()) { + for (func in FunctionLikeDeclaration(javascript_db)) { + if (func = controllerFunc) { + if (controllerReturnField(func, __all_data__)) { + yield func + } + } + } + } + } +} + +fn main() { + output(real_output()) +} \ No newline at end of file diff --git a/example/icse25/rules/rule1_4.gdl b/example/icse25/rules/rule1_4.gdl new file mode 100644 index 00000000..43d817df --- /dev/null +++ b/example/icse25/rules/rule1_4.gdl @@ -0,0 +1,1920 @@ +// script +use coref::java::* + +schema ECGNode extends ElementParent {} + +impl ECGNode { + pub fn __all__(db: JavaDB) -> *ECGNode { + for (tmp in ElementParent(db)) { + for (m in Method(db)) { + if (tmp.key_eq(m)) { + yield ECGNode { + id : tmp.id + } + } + } + for (m in Variable(db)) { + if (tmp.key_eq(m)) { + yield ECGNode { + id : tmp.id + } + } + } + for (m in Expression(db)) { + if (tmp.key_eq(m)) { + yield ECGNode { + id : tmp.id + } + } + } + } + } + + pub fn getType(self) -> string { + for (t in string::__undetermined_all__()) { + for (m in Method(__all_data__)) { + if (self.key_eq(m)) { + if (t = "Method") { + return t + } + } + } + for (m in LocalVariable(__all_data__)) { + if (self.key_eq(m)) { + if (t = "LocalVariable") { + return t + } + } + } + for (m in Parameter(__all_data__)) { + if (self.key_eq(m)) { + if (t = "Parameter") { + return t + } + } + } + for (m in Field(__all_data__)) { + if (self.key_eq(m)) { + if (t = "Field") { + return t + } + } + } + for (m in EnumConstant(__all_data__)) { + if (self.key_eq(m)) { + if (t = "EnumConstant") { + return t + } + } + } + for (m in Expression(__all_data__)) { + if (self.key_eq(m)) { + if (t = m.getType()) { + return t + } + } + } + } + } + + pub fn getDDNode(self, type: string, direction: string) -> ECGNode { + for (e1 in ECGNode(__all_data__)) { + for (e in Parameter(__all_data__), + c in Method(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + for (auto_tmp1 in c.getParameter()) { + if (e = auto_tmp1) { + if (direction = "Depended") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + for (r in ReturnStatement(__all_data__), + c in Method(__all_data__), + e in Expression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (c.key_eq(r.getEnclosingCallable())) { + if (e = r.getResult()) { + if (direction = "Depends") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + for (c in Callable(__all_data__), + e in Field(__all_data__), + r in ReferenceExpression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (c = r.getEnclosingCallable()) { + if (e.key_eq(r.getDefinition())) { + if (direction = "Depended") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + for (c in Callable(__all_data__), + e in EnumConstant(__all_data__), + r in ReferenceExpression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (c = r.getEnclosingCallable()) { + if (e.key_eq(r.getDefinition())) { + if (direction = "Depended") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + for (e in Callable(__all_data__), + c in Field(__all_data__), + r in ReferenceExpression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (c.key_eq(r.getDefinition())) { + if (e = r.getEnclosingCallable()) { + if (direction = "Depends") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + for (e in Callable(__all_data__), + c in EnumConstant(__all_data__), + r in ReferenceExpression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (c.key_eq(r.getDefinition())) { + if (e = r.getEnclosingCallable()) { + if (direction = "Depends") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + for (c in Callable(__all_data__), + e in CallExpression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (c = e.getEnclosingCallable()) { + for (m in Method(__all_data__)) { + if (m = e.getMethod()) { + if (!isDirectCall(e)) { + if (direction = "Depended") { + if (type = "DD") { + return e1 + } + } + } + } + } + for (f in LombokField(__all_data__)) { + if (f = e.getLombokField()) { + if (!isDirectCall(e)) { + if (direction = "Depended") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + } + } + for (n in string::__undetermined_all__()) { + for (e in LombokField(__all_data__), + c in CallExpression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (e = c.getLombokField()) { + let (tmp_find = CallExpression(__all_data__).find(e)) { + if (!isDirectCall(tmp_find)) { + if (n = c.getMethodName()) { + if (Self::tmp_0(n)) { + if (direction = "Depended") { + if (type = "DD") { + return e1 + } + } + } + if (!Self::tmp_0(n)) { + if (direction = "Depends") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + } + } + } + } + for (e in Variable(__all_data__), + c in CallExpression(__all_data__), + r in ReferenceExpression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (!isDirectCall(c)) { + for (auto_tmp2 in c.getArguments()) { + if (r.key_eq(auto_tmp2)) { + if (e.key_eq(r.getDefinition())) { + if (direction = "Depended") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + } + } + for (e in CallExpression(__all_data__), + c in CallExpression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (!isDirectCall(c)) { + for (auto_tmp3 in c.getArguments()) { + if (e.key_eq(auto_tmp3)) { + if (direction = "Depended") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + } + for (e in CallExpression(__all_data__), + c in CallExpression(__all_data__), + s in CallExpression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (!isDirectCall(c)) { + for (auto_tmp4 in c.getAnAncestor()) { + if (s.getReference().key_eq(auto_tmp4)) { + for (auto_tmp5 in s.getArguments()) { + if (auto_tmp5.key_eq(e)) { + if (direction = "Depended") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + } + } + } + } + } + + pub fn getAnAncestorDDNode(self, type: string, direction: string) -> ECGNode { + for (e in ECGNode(__all_data__)) { + if (type = "DD") { + if (e = self.getDDNode(type, direction)) { + return e + } + if (e = self.getAnAncestorDDNode(__all_data__, __all_data__).getDDNode(type, direction)) { + return e + } + } + } + } + + pub fn getCDNode(self, type: string, direction: string) -> ECGNode { + for (e in ECGNode(__all_data__), + c in Callable(__all_data__), + r in ReferenceExpression(__all_data__)) { + if (self.key_eq(c)) { + if (type = "CD") { + for (e1 in Method(__all_data__)) { + for (auto_tmp1 in c.getCallee()) { + if (e1.key_eq(auto_tmp1)) { + if (direction = "Depends") { + if (e.key_eq(e1)) { + return e + } + } + } + } + } + for (e2 in Method(__all_data__)) { + for (auto_tmp2 in c.getCaller()) { + if (e2.key_eq(auto_tmp2)) { + if (direction = "Depended") { + if (e.key_eq(e2)) { + return e + } + } + } + } + } + } + } + if (self.key_eq(r.getDefinition())) { + if (c = r.getEnclosingCallable()) { + if (type = "CD") { + for (e1 in Method(__all_data__)) { + for (auto_tmp1 in c.getCallee()) { + if (e1.key_eq(auto_tmp1)) { + if (direction = "Depends") { + if (e.key_eq(e1)) { + return e + } + } + } + } + } + for (e2 in Method(__all_data__)) { + for (auto_tmp2 in c.getCaller()) { + if (e2.key_eq(auto_tmp2)) { + if (direction = "Depended") { + if (e.key_eq(e2)) { + return e + } + } + } + } + } + } + } + } + } + } + + pub fn getAnAncestorCDNode(self, type: string, direction: string) -> ECGNode { + for (e in ECGNode(__all_data__), + c in Callable(__all_data__), + r in ReferenceExpression(__all_data__)) { + if (type = "CD") { + if (self.key_eq(c)) { + for (e1 in Method(__all_data__)) { + for (auto_tmp1 in c.getAnAncestorCallee()) { + if (e1.key_eq(auto_tmp1)) { + if (direction = "Depends") { + if (e.key_eq(e1)) { + return e + } + } + } + } + } + for (e2 in Method(__all_data__)) { + for (auto_tmp2 in c.getAnAncestorCaller()) { + if (e2.key_eq(auto_tmp2)) { + if (direction = "Depended") { + if (e.key_eq(e2)) { + return e + } + } + } + } + } + } + if (self.key_eq(r.getDefinition())) { + if (c = r.getEnclosingCallable()) { + for (e1 in Method(__all_data__)) { + for (auto_tmp1 in c.getAnAncestorCallee()) { + if (e1.key_eq(auto_tmp1)) { + if (direction = "Depends") { + if (e.key_eq(e1)) { + return e + } + } + } + } + } + for (e2 in Method(__all_data__)) { + for (auto_tmp2 in c.getAnAncestorCaller()) { + if (e2.key_eq(auto_tmp2)) { + if (direction = "Depended") { + if (e.key_eq(e2)) { + return e + } + } + } + } + } + } + } + } + } + } + + pub fn getECGNode(self, type: string, direction: string) -> ECGNode { + for (e in ECGNode(__all_data__)) { + if (e = self.getCDNode(type, direction)) { + return e + } + if (e = self.getDDNode(type, direction)) { + return e + } + } + } + + pub fn getAnAncestorECGNode(self, type: string, direction: string) -> ECGNode { + for (e in ECGNode(__all_data__), tmp in ECGNode(__all_data__)) { + if (tmp = self.getAnAncestorCDNode(__all_data__, __all_data__)) { + if (e = tmp.getECGNode(type, direction)) { + return e + } + } + } + } + + pub fn getAnAncestorCDDependedNode(self, type: string, direction: string) -> ECGNode { + for (e in ECGNode(__all_data__), c in Callable(__all_data__), r in ReferenceExpression(__all_data__)) { + if (type = "CD") { + if (self.key_eq(c) || (self.key_eq(r.getDefinition()) && r.getEnclosingCallable() = c)) { + for (e2 in Method(__all_data__), c_caller in c.getAnAncestorCaller()) { + if (e2.key_eq(c_caller) && direction = "Depended" && e.key_eq(e2)) { + return e + } + } + } + } + } + } + + pub fn getECGDependsNode(self, type: string, direction: string) -> ECGNode { + for (e in ECGNode(__all_data__)) { + if (e = self.getCDDependsNode(type, direction)) { + return e + } + if (e = self.getDDDependsNode(type, direction)) { + return e + } + } + } + + pub fn getCDDependsNode(self, type: string, direction: string) -> ECGNode { + for (e in ECGNode(__all_data__), + c in Callable(__all_data__), + r in ReferenceExpression(__all_data__)) { + if (self.key_eq(c)) { + if (type = "CD") { + for (e1 in c.getCallee()) { + if (direction = "Depends") { + if (e.key_eq(e1)) { + return e + } + } + } + } + } + for (v in Variable(__all_data__)) { + if (self.key_eq(v)) { + if (v.key_eq(r.getDefinition())) { + if (c = r.getEnclosingCallable()) { + if (type = "CD") { + for (e1 in c.getCallee()) { + if (direction = "Depends") { + if (e.key_eq(e1)) { + return e + } + } + } + } + } + } + } + } + } + } + + pub fn getDDDependsNode(self, type: string, direction: string) -> ECGNode { + for (e1 in ECGNode(__all_data__)) { + for (r in ReturnStatement(__all_data__), + c in Method(__all_data__), + e in Expression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (c.key_eq(r.getEnclosingCallable())) { + if (e = r.getResult()) { + if (direction = "Depends") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + for (e in Callable(__all_data__), + c in Field(__all_data__), + r in ReferenceExpression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (c.key_eq(r.getDefinition())) { + if (e = r.getEnclosingCallable()) { + if (direction = "Depends") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + for (e in Callable(__all_data__), + c in EnumConstant(__all_data__), + r in ReferenceExpression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (c.key_eq(r.getDefinition())) { + if (e = r.getEnclosingCallable()) { + if (direction = "Depends") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + for (n in string::__undetermined_all__()) { + for (e in LombokField(__all_data__), + c in CallExpression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (e = c.getLombokField()) { + let (tmp = CallExpression(__all_data__).find(e)) { + if (!isDirectCall(tmp)) { + if (n = c.getMethodName()) { + if (!n.matches("get.*")) { + if (direction = "Depends") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + } + } + } + } + } + } + + pub fn getAnAncestorCDDependsNode(self, type: string, direction: string) -> ECGNode { + for (e in ECGNode(__all_data__), + c in Callable(__all_data__), + r in ReferenceExpression(__all_data__)) { + if (type = "CD") { + if (self.key_eq(c)) { + for (e1 in c.getAnAncestorCallee()) { + if (direction = "Depends") { + if (e.key_eq(e1)) { + return e + } + } + } + } + if (self.key_eq(r.getDefinition())) { + if (c = r.getEnclosingCallable()) { + for (e1 in c.getAnAncestorCallee()) { + if (direction = "Depends") { + if (e.key_eq(e1)) { + return e + } + } + } + } + } + } + } + } + + pub fn getPath(self) -> string { + for (line in int::__undetermined_all__(), + t in string::__undetermined_all__(), + path in string::__undetermined_all__(), + info in string::__undetermined_all__()) { + for (l in coref::java::Location(__all_data__)) { + if (l = self.getLocation()) { + if (path = l.getFile().getRelativePath()) { + if (line = l.getStartLineNumber()) { + if (t = line.to_string()) { + if (info = path + ":" + t) { + return info + } + } + } + } + } + } + } + } + + fn tmp_0(n: string) -> bool { + if (n.matches("get.*")) { + return true + } + } +} + +pub fn gitdiff(filePath: string, lineNo: int) -> bool { + //python替换 + // $gitdiff + // example + [ {"test", 1111} ] +} +pub fn transfertofile1(f: File, filename: string, lineNumber: int) -> bool { + let (java_db = default_java_db()) { + if (gitdiff(filename, lineNumber)) { + if (!filename.contains("src/test/java")) { + if (filename = f.getRelativePath()) { + if (isCodeLine(f, filename, lineNumber)) { + return true + } + } + } + } + } +} +pub fn transfertofile(f: File, filename: string, lineNumber: int) -> bool { + let (java_db = default_java_db()) { + if (transfertofile1(f, filename, lineNumber)) { + if (!findSpecialCodeType(filename, lineNumber, __all_data__)) { + return true + } + } + } +} +pub fn isComment(filename: string, lineNumber: int) -> bool { + let (java_db = default_java_db()) { + for (f in File(java_db)) { + if (transfertofile1(f, filename, lineNumber)) { + for (e in int::__undetermined_all__(), + s1 in int::__undetermined_all__()) { + for (c in Comment(java_db)) { + if (c.getLocation().getFile() = f) { + if (s1 = c.getLocation().getStartLineNumber()) { + if (e = c.getLocation().getEndLineNumber()) { + if (lineNumber > s1 - 1) { + if (lineNumber < e + 1) { + return true + } + } + } + } + } + } + } + for (e in int::__undetermined_all__(), + s1 in int::__undetermined_all__()) { + for (c in JavadocComment(java_db)) { + if (c.getLocation().getFile() = f) { + if (s1 = c.getLocation().getStartLineNumber()) { + if (e = c.getLocation().getEndLineNumber()) { + if (lineNumber > s1 - 1) { + if (lineNumber < e + 1) { + return true + } + } + } + } + } + } + } + } + } + } +} +pub fn isAnnotation(filename: string, lineNumber: int) -> bool { + let (java_db = default_java_db()) { + for (f in File(java_db)) { + if (transfertofile1(f, filename, lineNumber)) { + for (e in int::__undetermined_all__(), + s1 in int::__undetermined_all__()) { + for (c in Annotation(java_db)) { + if (c.getLocation().getFile() = f) { + if (s1 = c.getLocation().getStartLineNumber()) { + if (e = c.getLocation().getEndLineNumber()) { + if (lineNumber > s1 - 1) { + if (lineNumber < e + 1) { + return true + } + } + } + } + } + } + } + } + } + } +} +pub fn isCodeLine(f: File, filename: string, lineNumber: int) -> bool { + let (java_db = default_java_db()) { + if (gitdiff(filename, lineNumber)) { + if (f.getRelativePath() = filename) { + for (e in int::__undetermined_all__(), + s1 in int::__undetermined_all__()) { + for (l in Location(java_db)) { + if (l.getFile() = f) { + if (s1 = l.getStartLineNumber()) { + if (e = l.getEndLineNumber()) { + if (lineNumber > s1 - 1) { + if (lineNumber < e + 1) { + return true + } + } + } + } + } + } + } + } + } + } +} +pub fn isLog(filename: string, lineNumber: int) -> bool { + let (java_db = default_java_db()) { + for (f in File(java_db)) { + if (transfertofile1(f, filename, lineNumber)) { + for (e in int::__undetermined_all__(), + s1 in int::__undetermined_all__(), + text in string::__undetermined_all__()) { + for (c in Expression(java_db)) { + if (c.getLocation().getFile() = f) { + if (s1 = c.getLocation().getStartLineNumber()) { + if (e = c.getLocation().getEndLineNumber()) { + if (lineNumber > s1 - 1) { + if (lineNumber < e + 1) { + if (text = c.getPrintableText()) { + if (text.matches("^logger\\..*")) { + return true + } + } + } + } + } + } + } + } + } + } + } + } +} +pub fn getTypeInAST(filename: string, lineNumber: int, typeInAST: string) -> bool { + let (java_db = default_java_db()) { + for (f in File(java_db)) { + if (transfertofile(f, filename, lineNumber)) { + for (e in int::__undetermined_all__(), + s1 in int::__undetermined_all__()) { + for (c in ElementParent(java_db)) { + if (c.getLocation().getFile() = f) { + if (s1 = c.getLocation().getStartLineNumber()) { + if (e = c.getLocation().getEndLineNumber()) { + if (s1 = e) { + if (lineNumber > s1 - 1) { + if (lineNumber < e + 1) { + if (typeInAST = c.getType()) { + return true + } + } + } + } + } + } + } + } + } + } + } + } +} +pub fn getTypeInECG(filename: string, lineNumber: int, typeInAST: string, n: ECGNode) -> bool { + let (java_db = default_java_db()) { + for (f in File(java_db)) { + if (transfertofile(f, filename, lineNumber)) { + if (tmp_0(filename, lineNumber)) { + if (typeInAST = "Callable") { + if (getBelongedCallable(filename, lineNumber, Callable(java_db).find(n))) { + return true + } + } + } + if (!(tmp_0(filename, lineNumber))) { + for (e in int::__undetermined_all__(), + s1 in int::__undetermined_all__()) { + if (n.getLocation().getFile() = f) { + if (s1 = n.getLocation().getStartLineNumber()) { + if (e = n.getLocation().getEndLineNumber()) { + if (lineNumber > s1 - 1) { + if (lineNumber < e + 1) { + if (typeInAST = n.getType()) { + if (isFieldOrEnum(ECGNode(java_db).find(n))) { + return true + } + } + } + } + } + } + } + } + } + } + } + } +} +pub fn isFieldOrEnum(c: ECGNode) -> bool { + let (java_db = default_java_db()) { + for (f in Field(java_db)) { + if (f.key_eq(c)) { + return true + } + } + for (e in EnumConstant(java_db)) { + if (e.key_eq(c)) { + return true + } + } + } +} +pub fn findSpecialCodeType(filename: string, lineNumber: int, type: string) -> bool { + let (java_db = default_java_db()) { + if (isComment(filename, lineNumber)) { + if (type = "comment") { + return true + } + } + if (isAnnotation(filename, lineNumber)) { + if (type = "annotation") { + return true + } + } + if (isLog(filename, lineNumber)) { + if (type = "log") { + return true + } + } + } +} +pub fn getBelongedCallable(filename: string, lineNumber: int, c: Callable) -> bool { + let (java_db = default_java_db()) { + for (f in File(java_db)) { + if (transfertofile(f, filename, lineNumber)) { + for (l1 in int::__undetermined_all__(), + l2 in int::__undetermined_all__()) { + for (i in Identifier(java_db)) { + if (f = c.getLocation().getFile()) { + if (c.key_eq(i.getParent())) { + if (l1 = i.getLocation().getStartLineNumber()) { + if (l2 = c.getLocation().getEndLineNumber()) { + if (lineNumber > l1 - 1) { + if (lineNumber < l2 + 1) { + return true + } + } + } + } + } + } + } + } + } + } + } +} +pub fn getBelongedCallableSignature(filename: string, lineNumber: int, belongedCallable: string) -> bool { + let (java_db = default_java_db()) { + for (i in int::__undetermined_all__()) { + for (c in Callable(java_db)) { + if (transfertofile(__all_data__, filename, lineNumber)) { + if (i = tmp_1().len()) { + if (tmp_2(i)) { + if (belongedCallable = "") { + return true + } + } + if (!(tmp_2(i))) { + if (getBelongedCallable(filename, lineNumber, c)) { + if (belongedCallable = c.getSignature()) { + return true + } + } + } + } + } + } + } + } +} +pub fn getJavaECGNode(n: ECGNode) -> bool { + let (java_db = default_java_db()) { + for (lineNumber in int::__undetermined_all__(), + filename in string::__undetermined_all__(), + typeInAST in string::__undetermined_all__(), + belongedCallable in string::__undetermined_all__()) { + if (transfertofile(__all_data__, filename, lineNumber)) { + if (getBelongedCallableSignature(filename, lineNumber, belongedCallable)) { + if (getTypeInECG(filename, lineNumber, typeInAST, n)) { + return true + } + } + } + } + } +} +@inline +pub fn trim(n: string, m: string) -> bool { + let (java_db = default_java_db()) { + for (i in int::__undetermined_all__()) { + if (i = n.len()) { + if (tmp_3(n)) { + if (m = n.substr(1,i - 2)) { + return true + } + } + if (!(tmp_3(n))) { + if (m = n) { + return true + } + } + } + } + } +} +@inline +pub fn contact(a: string, b: string, c: string) -> bool { + let (java_db = default_java_db()) { + for (i in int::__undetermined_all__(), + temp in string::__undetermined_all__()) { + if (i = a.len()) { + if (tmp_4(i)) { + if (tmp_5(a, b)) { + if (c = b) { + return true + } + } + if (!(tmp_5(a, b))) { + if (c = a + b) { + return true + } + } + } + if (!(tmp_4(i))) { + if (tmp_6(a, i, b)) { + if (temp = a.substr(1,i - 1)) { + if (c = a + b) { + return true + } + } + } + if (!(tmp_6(a, i, b))) { + if (tmp_7(a, i, b)) { + if (c = a + "/" + b) { + return true + } + } + if (!(tmp_7(a, i, b))) { + if (c = a + b) { + return true + } + } + } + } + } + } + } +} +schema HttpMethodType extends AnnotationAccessArgument { + +} + +impl HttpMethodType { + + @data_constraint + @inline + pub fn __all__(db: JavaDB) -> *HttpMethodType { + for (tmp in AnnotationAccessArgument(db)) { + if (tmp.getAnnotationArgumentName() = "method") { + yield HttpMethodType { + id : tmp.id + } + } + } + } + + pub fn getType(self) -> string { + for (t in string::__undetermined_all__()) { + for (a in AnnotationArrayInitializer(__all_data__)) { + if (self.getArgumentValueHashId() = a.getParent().id) { + for (i in Identifier(__all_data__)) { + if (a.key_eq(i.getParent())) { + if (t = i.getName()) { + return t + } + } + } + } + } + for (i in Identifier(__all_data__)) { + if (self.getArgumentValueHashId() = i.getParent().id) { + if (t = i.getName()) { + return t + } + } + } + } + } + + +} + +pub fn getMethodType(a: Annotation, t: string) -> bool { + let (java_db = default_java_db()) { + for (m in Method(java_db), + h in HttpMethodType(java_db)) { + for (auto_tmp1 in m.getAnnotation()) { + if (a = auto_tmp1) { + if (tmp_8(a)) { + if (t = "POST") { + return true + } + } + if (!(tmp_8(a))) { + if (tmp_9(a)) { + if (t = "GET") { + return true + } + } + if (!(tmp_9(a))) { + if (tmp_10(a)) { + if (t = "PUT") { + return true + } + } + if (!(tmp_10(a))) { + if (tmp_11(a)) { + if (t = "DELETE") { + return true + } + } + if (!(tmp_11(a))) { + if (tmp_12(a)) { + if (t = "PATCH") { + return true + } + } + if (!(tmp_12(a))) { + for (auto_tmp2 in a.getAnnotationArgument()) { + if (h.key_eq(auto_tmp2)) { + if (t = h.getType()) { + return true + } + } + } + } + } + } + } + } + } + } + } + } +} +pub fn getSubUri(a: Annotation, sub: string) -> bool { + let (java_db = default_java_db()) { + for (s in string::__undetermined_all__(), + n in string::__undetermined_all__()) { + for (temp in AnnotationAccessArgument(java_db), + e in Expression(java_db)) { + if (n = a.getName()) { + if (n.matches(".*Mapping")) { + for (auto_tmp1 in a.getAnnotationArgument()) { + if (temp = auto_tmp1) { + if (temp.getAnnotationArgumentName() = "value") { + if (temp.key_eq(e.getParent())) { + if (tmp_13(e)) { + if (sub = connectStr(e)) { + return true + } + } + if (!(tmp_13(e))) { + if (s = temp.getAnnotationArgumentValue()) { + if (trim(s, sub)) { + return true + } + } + } + } + } + } + } + } + } + } + } + } +} +pub fn getUri(c: Class, m: Method, uri1: string) -> bool { + let (java_db = default_java_db()) { + for (l1 in string::__undetermined_all__(), + l2 in string::__undetermined_all__(), + uri in string::__undetermined_all__(), + n in string::__undetermined_all__()) { + for (a in Annotation(java_db), + a1 in Annotation(java_db)) { + if (c = m.getBelongedClass()) { + for (auto_tmp1 in m.getAnnotation()) { + if (a = auto_tmp1) { + for (auto_tmp2 in c.getAnnotation()) { + if (a1 = auto_tmp2) { + if (n = a.getName()) { + if (tmp_15(c)) { + if (n = a.getName()) { + if (n.matches(".*Mapping")) { + if (getSubUri(a, uri)) { + for (tt in string::__undetermined_all__()) { + for (w in WebFolder(java_db), + cc in WebCarClass(java_db)) { + if (tmp_19(w)) { + if (uri1 = uri) { + return true + } + } + if (!(tmp_19(w))) { + if (cc.key_eq(c)) { + if (tt = cc.getWebFolder().getName()) { + if (uri1 = "/" + tt + uri) { + return true + } + } + } + } + } + } + } + } + } + } + if (!(tmp_15(c))) { + if (tmp_17(a)) { + if (n.matches(".*Mapping")) { + if (getSubUri(a1, uri)) { + for (tt in string::__undetermined_all__()) { + for (w in WebFolder(java_db), + cc in WebCarClass(java_db)) { + if (tmp_19(w)) { + if (uri1 = uri) { + return true + } + } + if (!(tmp_19(w))) { + if (cc.key_eq(c)) { + if (tt = cc.getWebFolder().getName()) { + if (uri1 = "/" + tt + uri) { + return true + } + } + } + } + } + } + } + } + } + if (!(tmp_17(a))) { + if (a1.getName() = "RequestMapping") { + if (n.matches(".*Mapping")) { + if (getSubUri(a, l1)) { + if (getSubUri(a1, l2)) { + if (contact(l2, l1, uri)) { + for (tt in string::__undetermined_all__()) { + for (w in WebFolder(java_db), + cc in WebCarClass(java_db)) { + if (tmp_19(w)) { + if (uri1 = uri) { + return true + } + } + if (!(tmp_19(w))) { + if (cc.key_eq(c)) { + if (tt = cc.getWebFolder().getName()) { + if (uri1 = "/" + tt + uri) { + return true + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } +} +schema WebFolder extends Folder { + +} + +impl WebFolder { + + @data_constraint + @inline + pub fn __all__(db: JavaDB) -> *WebFolder { + for (tmp in Folder(db)) { + yield WebFolder { + element_hash_id : tmp.element_hash_id, + qualified_name : tmp.qualified_name, + name : tmp.name, + parent_hash_id : tmp.parent_hash_id + } + } + } + + pub fn getChild(self) -> Folder { + for (f in Folder(__all_data__)) { + if (self.element_hash_id = f.getParentHashId()) { + return f + } + } + } + + +} + +schema WebCarFolder extends Folder { + +} + +impl WebCarFolder { + + @data_constraint + @inline + pub fn __all__(db: JavaDB) -> *WebCarFolder { + for (tmp in Folder(db)) { + yield WebCarFolder { + element_hash_id : tmp.element_hash_id, + qualified_name : tmp.qualified_name, + name : tmp.name, + parent_hash_id : tmp.parent_hash_id + } + } + } + + pub fn getBelongedFolder(self) -> WebCarFolder { + for (f in WebCarFolder(__all_data__)) { + if (f.element_hash_id = self.getParentHashId()) { + return f + } + } + } + + pub fn getAnAncestorFolder(self) -> WebCarFolder { + for (f in WebCarFolder(__all_data__)) { + if (f = self.getBelongedFolder()) { + return f + } + if (f = self.getBelongedFolder().getAnAncestorFolder()) { + return f + } + } + } + + +} + +schema WebCarClass extends Class { + +} + +impl WebCarClass { + + @data_constraint + @inline + pub fn __all__(db: JavaDB) -> *WebCarClass { + for (tmp in Class(db)) { + for (f in WebCarFolder(db), + w in WebFolder(db)) { + if (f.key_eq(tmp.getContainingFile().getBelongedFolder())) { + if (f.getAnAncestorFolder().key_eq(w)) { + yield WebCarClass { + element_hash_id : tmp.element_hash_id, + qualified_name : tmp.qualified_name, + identifier_hash_id : tmp.identifier_hash_id, + location_hash_id : tmp.location_hash_id, + parent_hash_id : tmp.parent_hash_id + } + } + } + } + } + } + + pub fn getWebFolder(self) -> WebCarFolder { + for (c in WebCarFolder(__all_data__)) { + for (f in WebCarFolder(__all_data__), + w in WebFolder(__all_data__)) { + if (f.key_eq(self.getContainingFile().getBelongedFolder())) { + if (f.getAnAncestorFolder() = c) { + if (c.key_eq(w.getChild())) { + return c + } + } + } + } + } + } + + +} + +pub fn resolve(r: ReferenceExpression, rr: string) -> bool { + let (java_db = default_java_db()) { + for (temp in string::__undetermined_all__()) { + for (e in Expression(java_db)) { + if (e.getParent() = r.getDefinition()) { + if (temp = e.getPrintableText()) { + if (trim(temp, rr)) { + return true + } + } + } + } + } + } +} +pub fn facts(a: Expression, i: int, value: string) -> bool { + let (java_db = default_java_db()) { + for (p in PolyadicExpression(java_db)) { + if (a.key_eq(p)) { + for (temp in string::__undetermined_all__()) { + for (e in Expression(java_db)) { + if (tmp_20(a)) { + if (resolve(ReferenceExpression(java_db).find(a), value)) { + if (i = 0) { + return true + } + } + } + if (!(tmp_20(a))) { + if (a.key_eq(e.getParent())) { + if (i = e.getIndex()) { + if (tmp_21(e)) { + if (resolve(ReferenceExpression(java_db).find(e), value)) { + return true + } + } + if (!(tmp_21(e))) { + if (temp = e.getPrintableText()) { + if (trim(temp, value)) { + return true + } + } + } + } + } + } + } + } + } + } + for (p in BinaryExpression(java_db)) { + if (a.key_eq(p)) { + for (temp in string::__undetermined_all__()) { + for (e in Expression(java_db)) { + if (tmp_20(a)) { + if (resolve(ReferenceExpression(java_db).find(a), value)) { + if (i = 0) { + return true + } + } + } + if (!(tmp_20(a))) { + if (a.key_eq(e.getParent())) { + if (i = e.getIndex()) { + if (tmp_21(e)) { + if (resolve(ReferenceExpression(java_db).find(e), value)) { + return true + } + } + if (!(tmp_21(e))) { + if (temp = e.getPrintableText()) { + if (trim(temp, value)) { + return true + } + } + } + } + } + } + } + } + } + } + for (p in ReferenceExpression(java_db)) { + if (a.key_eq(p)) { + for (temp in string::__undetermined_all__()) { + for (e in Expression(java_db)) { + if (tmp_20(a)) { + if (resolve(ReferenceExpression(java_db).find(a), value)) { + if (i = 0) { + return true + } + } + } + if (!(tmp_20(a))) { + if (a.key_eq(e.getParent())) { + if (i = e.getIndex()) { + if (tmp_21(e)) { + if (resolve(ReferenceExpression(java_db).find(e), value)) { + return true + } + } + if (!(tmp_21(e))) { + if (temp = e.getPrintableText()) { + if (trim(temp, value)) { + return true + } + } + } + } + } + } + } + } + } + } + } +} +pub fn connectStrBase(ID: Expression, index: int, res: string) -> bool { + let (java_db = default_java_db()) { + for (total in int::__undetermined_all__(), + reStr in string::__undetermined_all__(), + currStr in string::__undetermined_all__()) { + if (total = tmp_22(ID).len()) { + if (tmp_24(index)) { + if (facts(Expression(java_db).find(ID), index, currStr)) { + if (res = currStr) { + return true + } + } + } + if (!(tmp_24(index))) { + if (index > 0) { + if (connectStrBase(ID, index - 1, reStr)) { + if (facts(Expression(java_db).find(ID), index, currStr)) { + if (res = reStr + currStr) { + return true + } + } + } + } + } + } + } + } +} +pub fn connectStr(ID: Expression) -> string { + let (java_db = default_java_db()) { + for (c in int::__undetermined_all__(), res in string::__undetermined_all__()) { + if (c = tmp_25(ID).len()) { + if (connectStrBase(ID, c - 1, res)) { + return res + } + } + } + } +} +pub fn getHttpMethod(m: Method) -> bool { + let (java_db = default_java_db()) { + for (n in string::__undetermined_all__(), + className in string::__undetermined_all__(), + methodSignature in string::__undetermined_all__(), + uri in string::__undetermined_all__(), + type in string::__undetermined_all__()) { + for (c in Class(java_db), + a in Annotation(java_db)) { + if (getUri(c, m, uri)) { + if (className = c.getQualifiedName()) { + if (methodSignature = m.getSignature()) { + for (auto_tmp1 in m.getAnnotation()) { + if (a = auto_tmp1) { + if (n = a.getName()) { + if (n.matches(".*Mapping")) { + if (tmp_29(a)) { + if (type = "EMPTY") { + return true + } + } + if (!(tmp_29(a))) { + if (getMethodType(a, type)) { + return true + } + } + } + } + } + } + } + } + } + } + } + } +} +pub fn real_output(nodeText: string, path: string) -> bool { + let (java_db = default_java_db()) { + for (direction in string::__undetermined_all__(), + edgeType in string::__undetermined_all__()) { + for (m in ECGNode(java_db), + a in ECGNode(java_db), + b in ECGNode(java_db), + c in ECGNode(java_db)) { + if (getJavaECGNode(a)) { + if (getHttpMethod(Method(java_db).find(m))) { + if (b = m.getAnAncestorCDDependsNode(__all_data__, __all_data__)) { + if (c = a.getAnAncestorCDDependedNode(__all_data__, __all_data__)) { + if (c = b.getECGDependsNode(edgeType, direction)) { + if (b != c) { + if (nodeText = m.print()) { + if (path = m.getPath()) { + return true + } + } + } + } + } + if (c = a) { + if (c = b.getECGDependsNode(edgeType, direction)) { + if (b != c) { + if (nodeText = m.print()) { + if (path = m.getPath()) { + return true + } + } + } + } + } + } + if (b = m) { + if (c = a.getAnAncestorCDDependedNode(__all_data__, __all_data__)) { + if (c = b.getECGDependsNode(edgeType, direction)) { + if (b != c) { + if (nodeText = m.print()) { + if (path = m.getPath()) { + return true + } + } + } + } + } + if (c = a) { + if (c = b.getECGDependsNode(edgeType, direction)) { + if (b != c) { + if (nodeText = m.print()) { + if (path = m.getPath()) { + return true + } + } + } + } + } + } + } + } + } + } + } +} + + +fn default_java_db() -> JavaDB { + return JavaDB::load("coref_java_src.db") +} + +fn tmp_0(filename: string, lineNumber: int) -> bool { + let (java_db = default_java_db()) { + if (getBelongedCallable(filename, lineNumber, __all_data__)) { + return true + } + } +} + +fn tmp_1() -> *string { + for (filename in string::__undetermined_all__(), lineNumber in int::__undetermined_all__()) { + if (getBelongedCallable(filename, lineNumber, __all_data__)) { + yield filename + } + } +} + +fn tmp_2(i: int) -> bool { + let (java_db = default_java_db()) { + if (i = 0) { + return true + } + } +} + +fn tmp_3(n: string) -> bool { + let (java_db = default_java_db()) { + if (n.substr(0,1) = "\"") { + return true + } + } +} + +fn tmp_4(i: int) -> bool { + let (java_db = default_java_db()) { + if (i = 1) { + return true + } + } +} + +fn tmp_5(a: string, b: string) -> bool { + let (java_db = default_java_db()) { + if (a.substr(0,1) = "/") { + if (b.substr(0,1) = "/") { + return true + } + } + } +} + +@inline +fn tmp_6(a: string, i: int, b: string) -> bool { + let (java_db = default_java_db()) { + if (a.substr(i - 1,i - 1) = "/") { + if (b.substr(0,1) = "/") { + return true + } + } + } +} + +@inline +fn tmp_7(a: string, i: int, b: string) -> bool { + let (java_db = default_java_db()) { + if (a.substr(i - 1,i - 1) != "/") { + if (b.substr(0,1) != "/") { + return true + } + } + } +} + +fn tmp_8(a: Annotation) -> bool { + let (java_db = default_java_db()) { + if (a.getName() = "PostMapping") { + return true + } + } +} + +fn tmp_9(a: Annotation) -> bool { + let (java_db = default_java_db()) { + if (a.getName() = "GetMapping") { + return true + } + } +} + +fn tmp_10(a: Annotation) -> bool { + let (java_db = default_java_db()) { + if (a.getName() = "PutMapping") { + return true + } + } +} + +fn tmp_11(a: Annotation) -> bool { + let (java_db = default_java_db()) { + if (a.getName() = "DeleteMapping") { + return true + } + } +} + +fn tmp_12(a: Annotation) -> bool { + let (java_db = default_java_db()) { + if (a.getName() = "PatchMapping") { + return true + } + } +} + +fn tmp_13(e: Expression) -> bool { + let (java_db = default_java_db()) { + if (facts(e, __all_data__, __all_data__)) { + return true + } + } +} + +fn tmp_14(c: Class) -> *Annotation { + let (java_db = default_java_db()) { + for (b in Annotation(java_db)) { + for (auto_tmp3 in c.getAnnotation()) { + if (b = auto_tmp3) { + if (b.getName() = "RequestMapping") { + yield b + } + } + } + } + } +} + +fn tmp_15(c: Class) -> bool { + let (java_db = default_java_db()) { + if (tmp_14(c).len() = 0) { + return true + } + } +} + +fn tmp_16(a: Annotation) -> *AnnotationAccessArgument { + let (java_db = default_java_db()) { + for (b in AnnotationAccessArgument(java_db)) { + for (auto_tmp4 in a.getAnnotationArgument()) { + if (b = auto_tmp4) { + if (b.getAnnotationArgumentName() = "value") { + yield b + } + } + } + } + } +} + +fn tmp_17(a: Annotation) -> bool { + let (java_db = default_java_db()) { + if (tmp_16(a).len() = 0) { + return true + } + } +} + +fn tmp_18(w: WebFolder) -> *Folder { + let (java_db = default_java_db()) { + for (f in Folder(java_db)) { + if (f = w.getChild()) { + yield f + } + } + } +} + +fn tmp_19(w: WebFolder) -> bool { + let (java_db = default_java_db()) { + if (tmp_18(w).len() = 1) { + return true + } + } +} + +fn tmp_20(a: Expression) -> bool { + let (java_db = default_java_db()) { + if (resolve(ReferenceExpression(java_db).find(a), __all_data__)) { + return true + } + } +} + +fn tmp_21(e: Expression) -> bool { + let (java_db = default_java_db()) { + if (resolve(ReferenceExpression(java_db).find(e), __all_data__)) { + return true + } + } +} + +fn tmp_22(ID: Expression) -> *auto_tmp_23 { + let (java_db = default_java_db()) { + for (auto_tmp_var_0 in int::__undetermined_all__(), + auto_tmp_var_1 in string::__undetermined_all__()) { + if (facts(Expression(java_db).find(ID), auto_tmp_var_0, auto_tmp_var_1)) { + yield auto_tmp_23 { + auto_tmp_var_0 : auto_tmp_var_0, + auto_tmp_var_1 : auto_tmp_var_1 + } + } + } + } +} + +schema auto_tmp_23 { + auto_tmp_var_0 : int, + auto_tmp_var_1 : string +} + +fn tmp_24(index: int) -> bool { + let (java_db = default_java_db()) { + if (index = 0) { + return true + } + } +} + +fn tmp_25(ID: Expression) -> *auto_tmp_26 { + let (java_db = default_java_db()) { + for (auto_tmp_var_0 in int::__undetermined_all__(), + auto_tmp_var_1 in string::__undetermined_all__()) { + if (facts(Expression(java_db).find(ID), auto_tmp_var_0, auto_tmp_var_1)) { + yield auto_tmp_26 { + auto_tmp_var_0 : auto_tmp_var_0, + auto_tmp_var_1 : auto_tmp_var_1 + } + } + } + } +} + +schema auto_tmp_26 { + auto_tmp_var_0 : int, + auto_tmp_var_1 : string +} + +fn tmp_27(a: Annotation) -> *auto_tmp_28 { + let (java_db = default_java_db()) { + for (auto_tmp_var_0 in string::__undetermined_all__()) { + if (getMethodType(a, auto_tmp_var_0)) { + yield auto_tmp_28 { + auto_tmp_var_0 : auto_tmp_var_0 + } + } + } + } +} + +schema auto_tmp_28 { + auto_tmp_var_0 : string +} + +fn tmp_29(a: Annotation) -> bool { + let (java_db = default_java_db()) { + if (tmp_27(a).len() = 0) { + return true + } + } +} + +fn main() { + output(real_output()) +} \ No newline at end of file diff --git a/example/icse25/rules/rule1_5.gdl b/example/icse25/rules/rule1_5.gdl new file mode 100644 index 00000000..9fd36886 --- /dev/null +++ b/example/icse25/rules/rule1_5.gdl @@ -0,0 +1,1210 @@ +// script +use coref::java::* +use coref::xml::* + +schema ECGNode extends ElementParent {} + +impl ECGNode { + pub fn __all__(db: JavaDB) -> *ECGNode { + for (tmp in ElementParent(db)) { + for (m in Method(db)) { + if (tmp.key_eq(m)) { + yield ECGNode { + id : tmp.id + } + } + } + for (m in Variable(db)) { + if (tmp.key_eq(m)) { + yield ECGNode { + id : tmp.id + } + } + } + for (m in Expression(db)) { + if (tmp.key_eq(m)) { + yield ECGNode { + id : tmp.id + } + } + } + } + } + + pub fn getType(self) -> string { + for (t in string::__undetermined_all__()) { + for (m in Method(__all_data__)) { + if (self.key_eq(m)) { + if (t = "Method") { + return t + } + } + } + for (m in LocalVariable(__all_data__)) { + if (self.key_eq(m)) { + if (t = "LocalVariable") { + return t + } + } + } + for (m in Parameter(__all_data__)) { + if (self.key_eq(m)) { + if (t = "Parameter") { + return t + } + } + } + for (m in Field(__all_data__)) { + if (self.key_eq(m)) { + if (t = "Field") { + return t + } + } + } + for (m in EnumConstant(__all_data__)) { + if (self.key_eq(m)) { + if (t = "EnumConstant") { + return t + } + } + } + for (m in Expression(__all_data__)) { + if (self.key_eq(m)) { + if (t = m.getType()) { + return t + } + } + } + } + } + + pub fn getDDNode(self, type: string, direction: string) -> ECGNode { + for (e1 in ECGNode(__all_data__)) { + for (e in Parameter(__all_data__), + c in Method(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + for (auto_tmp1 in c.getParameter()) { + if (e = auto_tmp1) { + if (direction = "Depended") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + for (r in ReturnStatement(__all_data__), + c in Method(__all_data__), + e in Expression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (c.key_eq(r.getEnclosingCallable())) { + if (e = r.getResult()) { + if (direction = "Depends") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + for (c in Callable(__all_data__), + e in Field(__all_data__), + r in ReferenceExpression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (c = r.getEnclosingCallable()) { + if (e.key_eq(r.getDefinition())) { + if (direction = "Depended") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + for (c in Callable(__all_data__), + e in EnumConstant(__all_data__), + r in ReferenceExpression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (c = r.getEnclosingCallable()) { + if (e.key_eq(r.getDefinition())) { + if (direction = "Depended") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + for (e in Callable(__all_data__), + c in Field(__all_data__), + r in ReferenceExpression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (c.key_eq(r.getDefinition())) { + if (e = r.getEnclosingCallable()) { + if (direction = "Depends") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + for (e in Callable(__all_data__), + c in EnumConstant(__all_data__), + r in ReferenceExpression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (c.key_eq(r.getDefinition())) { + if (e = r.getEnclosingCallable()) { + if (direction = "Depends") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + for (c in Callable(__all_data__), + e in CallExpression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (c = e.getEnclosingCallable()) { + for (m in Method(__all_data__)) { + if (m = e.getMethod()) { + if (!isDirectCall(e)) { + if (direction = "Depended") { + if (type = "DD") { + return e1 + } + } + } + } + } + for (f in LombokField(__all_data__)) { + if (f = e.getLombokField()) { + if (!isDirectCall(e)) { + if (direction = "Depended") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + } + } + for (n in string::__undetermined_all__()) { + for (e in LombokField(__all_data__), + c in CallExpression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (e = c.getLombokField()) { + let (tmp_find = CallExpression(__all_data__).find(e)) { + if (!isDirectCall(tmp_find)) { + if (n = c.getMethodName()) { + if (Self::tmp_0(n)) { + if (direction = "Depended") { + if (type = "DD") { + return e1 + } + } + } + if (!Self::tmp_0(n)) { + if (direction = "Depends") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + } + } + } + } + for (e in Variable(__all_data__), + c in CallExpression(__all_data__), + r in ReferenceExpression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (!isDirectCall(c)) { + for (auto_tmp2 in c.getArguments()) { + if (r.key_eq(auto_tmp2)) { + if (e.key_eq(r.getDefinition())) { + if (direction = "Depended") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + } + } + for (e in CallExpression(__all_data__), + c in CallExpression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (!isDirectCall(c)) { + for (auto_tmp3 in c.getArguments()) { + if (e.key_eq(auto_tmp3)) { + if (direction = "Depended") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + } + for (e in CallExpression(__all_data__), + c in CallExpression(__all_data__), + s in CallExpression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (!isDirectCall(c)) { + for (auto_tmp4 in c.getAnAncestor()) { + if (s.getReference().key_eq(auto_tmp4)) { + for (auto_tmp5 in s.getArguments()) { + if (auto_tmp5.key_eq(e)) { + if (direction = "Depended") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + } + } + } + } + } + + pub fn getAnAncestorDDNode(self, type: string, direction: string) -> ECGNode { + for (e in ECGNode(__all_data__)) { + if (type = "DD") { + if (e = self.getDDNode(type, direction)) { + return e + } + if (e = self.getAnAncestorDDNode(__all_data__, __all_data__).getDDNode(type, direction)) { + return e + } + } + } + } + + pub fn getCDNode(self, type: string, direction: string) -> ECGNode { + for (e in ECGNode(__all_data__), + c in Callable(__all_data__), + r in ReferenceExpression(__all_data__)) { + if (self.key_eq(c)) { + if (type = "CD") { + for (e1 in Method(__all_data__)) { + for (auto_tmp1 in c.getCallee()) { + if (e1.key_eq(auto_tmp1)) { + if (direction = "Depends") { + if (e.key_eq(e1)) { + return e + } + } + } + } + } + for (e2 in Method(__all_data__)) { + for (auto_tmp2 in c.getCaller()) { + if (e2.key_eq(auto_tmp2)) { + if (direction = "Depended") { + if (e.key_eq(e2)) { + return e + } + } + } + } + } + } + } + if (self.key_eq(r.getDefinition())) { + if (c = r.getEnclosingCallable()) { + if (type = "CD") { + for (e1 in Method(__all_data__)) { + for (auto_tmp1 in c.getCallee()) { + if (e1.key_eq(auto_tmp1)) { + if (direction = "Depends") { + if (e.key_eq(e1)) { + return e + } + } + } + } + } + for (e2 in Method(__all_data__)) { + for (auto_tmp2 in c.getCaller()) { + if (e2.key_eq(auto_tmp2)) { + if (direction = "Depended") { + if (e.key_eq(e2)) { + return e + } + } + } + } + } + } + } + } + } + } + + pub fn getAnAncestorCDNode(self, type: string, direction: string) -> ECGNode { + for (e in ECGNode(__all_data__), + c in Callable(__all_data__), + r in ReferenceExpression(__all_data__)) { + if (type = "CD") { + if (self.key_eq(c)) { + for (e1 in Method(__all_data__)) { + for (auto_tmp1 in c.getAnAncestorCallee()) { + if (e1.key_eq(auto_tmp1)) { + if (direction = "Depends") { + if (e.key_eq(e1)) { + return e + } + } + } + } + } + for (e2 in Method(__all_data__)) { + for (auto_tmp2 in c.getAnAncestorCaller()) { + if (e2.key_eq(auto_tmp2)) { + if (direction = "Depended") { + if (e.key_eq(e2)) { + return e + } + } + } + } + } + } + if (self.key_eq(r.getDefinition())) { + if (c = r.getEnclosingCallable()) { + for (e1 in Method(__all_data__)) { + for (auto_tmp1 in c.getAnAncestorCallee()) { + if (e1.key_eq(auto_tmp1)) { + if (direction = "Depends") { + if (e.key_eq(e1)) { + return e + } + } + } + } + } + for (e2 in Method(__all_data__)) { + for (auto_tmp2 in c.getAnAncestorCaller()) { + if (e2.key_eq(auto_tmp2)) { + if (direction = "Depended") { + if (e.key_eq(e2)) { + return e + } + } + } + } + } + } + } + } + } + } + + pub fn getECGNode(self, type: string, direction: string) -> ECGNode { + for (e in ECGNode(__all_data__)) { + if (e = self.getCDNode(type, direction)) { + return e + } + if (e = self.getDDNode(type, direction)) { + return e + } + } + } + + pub fn getAnAncestorECGNode(self, type: string, direction: string) -> ECGNode { + for (e in ECGNode(__all_data__), tmp in ECGNode(__all_data__)) { + if (tmp = self.getAnAncestorCDNode(__all_data__, __all_data__)) { + if (e = tmp.getECGNode(type, direction)) { + return e + } + } + } + } + + pub fn getAnAncestorCDDependedNode(self, type: string, direction: string) -> ECGNode { + for (e in ECGNode(__all_data__), c in Callable(__all_data__), r in ReferenceExpression(__all_data__)) { + if (type = "CD") { + if (self.key_eq(c) || (self.key_eq(r.getDefinition()) && r.getEnclosingCallable() = c)) { + for (e2 in Method(__all_data__), c_caller in c.getAnAncestorCaller()) { + if (e2.key_eq(c_caller) && direction = "Depended" && e.key_eq(e2)) { + return e + } + } + } + } + } + } + + pub fn getECGDependsNode(self, type: string, direction: string) -> ECGNode { + for (e in ECGNode(__all_data__)) { + if (e = self.getCDDependsNode(type, direction)) { + return e + } + if (e = self.getDDDependsNode(type, direction)) { + return e + } + } + } + + pub fn getCDDependsNode(self, type: string, direction: string) -> ECGNode { + for (e in ECGNode(__all_data__), + c in Callable(__all_data__), + r in ReferenceExpression(__all_data__)) { + if (self.key_eq(c)) { + if (type = "CD") { + for (e1 in c.getCallee()) { + if (direction = "Depends") { + if (e.key_eq(e1)) { + return e + } + } + } + } + } + for (v in Variable(__all_data__)) { + if (self.key_eq(v)) { + if (v.key_eq(r.getDefinition())) { + if (c = r.getEnclosingCallable()) { + if (type = "CD") { + for (e1 in c.getCallee()) { + if (direction = "Depends") { + if (e.key_eq(e1)) { + return e + } + } + } + } + } + } + } + } + } + } + + pub fn getDDDependsNode(self, type: string, direction: string) -> ECGNode { + for (e1 in ECGNode(__all_data__)) { + for (r in ReturnStatement(__all_data__), + c in Method(__all_data__), + e in Expression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (c.key_eq(r.getEnclosingCallable())) { + if (e = r.getResult()) { + if (direction = "Depends") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + for (e in Callable(__all_data__), + c in Field(__all_data__), + r in ReferenceExpression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (c.key_eq(r.getDefinition())) { + if (e = r.getEnclosingCallable()) { + if (direction = "Depends") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + for (e in Callable(__all_data__), + c in EnumConstant(__all_data__), + r in ReferenceExpression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (c.key_eq(r.getDefinition())) { + if (e = r.getEnclosingCallable()) { + if (direction = "Depends") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + for (n in string::__undetermined_all__()) { + for (e in LombokField(__all_data__), + c in CallExpression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (e = c.getLombokField()) { + let (tmp = CallExpression(__all_data__).find(e)) { + if (!isDirectCall(tmp)) { + if (n = c.getMethodName()) { + if (!n.matches("get.*")) { + if (direction = "Depends") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + } + } + } + } + } + } + + pub fn getAnAncestorCDDependsNode(self, type: string, direction: string) -> ECGNode { + for (e in ECGNode(__all_data__), + c in Callable(__all_data__), + r in ReferenceExpression(__all_data__)) { + if (type = "CD") { + if (self.key_eq(c)) { + for (e1 in c.getAnAncestorCallee()) { + if (direction = "Depends") { + if (e.key_eq(e1)) { + return e + } + } + } + } + if (self.key_eq(r.getDefinition())) { + if (c = r.getEnclosingCallable()) { + for (e1 in c.getAnAncestorCallee()) { + if (direction = "Depends") { + if (e.key_eq(e1)) { + return e + } + } + } + } + } + } + } + } + + pub fn getPath(self) -> string { + for (line in int::__undetermined_all__(), + t in string::__undetermined_all__(), + path in string::__undetermined_all__(), + info in string::__undetermined_all__()) { + for (l in coref::java::Location(__all_data__)) { + if (l = self.getLocation()) { + if (path = l.getFile().getRelativePath()) { + if (line = l.getStartLineNumber()) { + if (t = line.to_string()) { + if (info = path + ":" + t) { + return info + } + } + } + } + } + } + } + } + + fn tmp_0(n: string) -> bool { + if (n.matches("get.*")) { + return true + } + } +} + +schema ECGXmlNode { + @primary id: int +} + +impl ECGXmlNode { + pub fn __all__(db: XmlDB) -> *ECGXmlNode { + for (e in XmlPomElement(db)) { + yield ECGXmlNode {id : e.id} + } + for (e in XmlSpringElement(db)) { + yield ECGXmlNode {id : e.id} + } + for (e in XmlCharacter(db)) { + yield ECGXmlNode {id : e.id} + } + for (e in XmlAttribute(db)) { + yield ECGXmlNode {id : e.id} + } + } + + pub fn getLocation(self) -> coref::xml::Location { + for (l in coref::xml::Location(__all_data__)) { + for (e in XmlElement(__all_data__)) { + if (self.key_eq(e)) { + if (l = e.getLocation()) { + return l + } + } + } + for (e in XmlAttribute(__all_data__)) { + if (self.key_eq(e)) { + if (l = e.getLocation()) { + return l + } + } + } + for (e in XmlCharacter(__all_data__)) { + if (self.key_eq(e)) { + if (l = e.getLocation()) { + return l + } + } + } + } + } + + pub fn getType(self) -> string { + for (t in string::__undetermined_all__()) { + for (e in XmlElement(__all_data__)) { + if (self.key_eq(e)) { + if (t = "XmlElement") { + return t + } + } + } + for (e in XmlAttribute(__all_data__)) { + if (self.key_eq(e)) { + if (t = "XmlAttribute") { + return t + } + } + } + for (e in XmlCharacter(__all_data__)) { + if (self.key_eq(e)) { + if (t = "XmlCharacter") { + return t + } + } + } + } + } + + pub fn getText(self) -> string { + for (e in XmlElement(__all_data__)) { + if (self.key_eq(e)) { + return e.getName() + } + } + for (e in XmlAttribute(__all_data__)) { + if (self.key_eq(e)) { + return e.getName() + " = " + e.getValue() + } + } + for (e in XmlCharacter(__all_data__)) { + if (self.key_eq(e)) { + return e.getText() + } + } + } + + pub fn getEnclosingECGXmlNode(self) -> ECGXmlNode { + for (e in XmlElement(__all_data__)) { + if (self.key_eq(e)) { + return e.to() + } + } + for (e in XmlAttribute(__all_data__)) { + if (self.key_eq(e)) { + return e.getXmlElement().to() + } + } + for (e in XmlCharacter(__all_data__)) { + if (self.key_eq(e)) { + return e.getBelongedElement().to() + } + } + } +} + +pub fn gitdiff(filePath: string, lineNo: int) -> bool { + //python替换 + // $gitdiff + // example + [ {"test", 1111} ] +} +pub fn transfertofile1(f: File, filename: string, lineNumber: int) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + if (gitdiff(filename, lineNumber)) { + if (!filename.contains("src/test/java")) { + if (filename = f.getRelativePath()) { + if (isCodeLine(f, filename, lineNumber)) { + return true + } + } + } + } + } + } +} +pub fn transfertofile(f: File, filename: string, lineNumber: int) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + if (transfertofile1(f, filename, lineNumber)) { + if (!findSpecialCodeType(filename, lineNumber, __all_data__)) { + return true + } + } + } + } +} +pub fn isComment(filename: string, lineNumber: int) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (f in File(java_db)) { + if (transfertofile1(f, filename, lineNumber)) { + for (e in int::__undetermined_all__(), + s1 in int::__undetermined_all__()) { + for (c in Comment(java_db)) { + if (c.getLocation().getFile() = f) { + if (s1 = c.getLocation().getStartLineNumber()) { + if (e = c.getLocation().getEndLineNumber()) { + if (lineNumber > s1 - 1) { + if (lineNumber < e + 1) { + return true + } + } + } + } + } + } + } + for (e in int::__undetermined_all__(), + s1 in int::__undetermined_all__()) { + for (c in JavadocComment(java_db)) { + if (c.getLocation().getFile() = f) { + if (s1 = c.getLocation().getStartLineNumber()) { + if (e = c.getLocation().getEndLineNumber()) { + if (lineNumber > s1 - 1) { + if (lineNumber < e + 1) { + return true + } + } + } + } + } + } + } + } + } + } + } +} +pub fn isAnnotation(filename: string, lineNumber: int) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (f in File(java_db)) { + if (transfertofile1(f, filename, lineNumber)) { + for (e in int::__undetermined_all__(), + s1 in int::__undetermined_all__()) { + for (c in Annotation(java_db)) { + if (c.getLocation().getFile() = f) { + if (s1 = c.getLocation().getStartLineNumber()) { + if (e = c.getLocation().getEndLineNumber()) { + if (lineNumber > s1 - 1) { + if (lineNumber < e + 1) { + return true + } + } + } + } + } + } + } + } + } + } + } +} +pub fn isCodeLine(f: File, filename: string, lineNumber: int) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + if (gitdiff(filename, lineNumber)) { + if (f.getRelativePath() = filename) { + for (e in int::__undetermined_all__(), + s1 in int::__undetermined_all__()) { + for (l in coref::java::Location(java_db)) { + if (l.getFile() = f) { + if (s1 = l.getStartLineNumber()) { + if (e = l.getEndLineNumber()) { + if (lineNumber > s1 - 1) { + if (lineNumber < e + 1) { + return true + } + } + } + } + } + } + } + } + } + } + } +} +pub fn isLog(filename: string, lineNumber: int) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (f in File(java_db)) { + if (transfertofile1(f, filename, lineNumber)) { + for (e in int::__undetermined_all__(), + s1 in int::__undetermined_all__(), + text in string::__undetermined_all__()) { + for (c in Expression(java_db)) { + if (c.getLocation().getFile() = f) { + if (s1 = c.getLocation().getStartLineNumber()) { + if (e = c.getLocation().getEndLineNumber()) { + if (lineNumber > s1 - 1) { + if (lineNumber < e + 1) { + if (text = c.getPrintableText()) { + if (text.matches("^logger\\..*")) { + return true + } + } + } + } + } + } + } + } + } + } + } + } + } +} +pub fn getTypeInAST(filename: string, lineNumber: int, typeInAST: string) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (f in File(java_db)) { + if (transfertofile(f, filename, lineNumber)) { + for (e in int::__undetermined_all__(), + s1 in int::__undetermined_all__()) { + for (c in ElementParent(java_db)) { + if (c.getLocation().getFile() = f) { + if (s1 = c.getLocation().getStartLineNumber()) { + if (e = c.getLocation().getEndLineNumber()) { + if (s1 = e) { + if (lineNumber > s1 - 1) { + if (lineNumber < e + 1) { + if (typeInAST = c.getType()) { + return true + } + } + } + } + } + } + } + } + } + } + } + } + } +} +pub fn getTypeInECG(filename: string, lineNumber: int, typeInAST: string, n: ECGNode) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (f in File(java_db)) { + if (transfertofile(f, filename, lineNumber)) { + if (tmp_0(lineNumber, filename)) { + if (typeInAST = "Callable") { + if (getBelongedCallable(filename, lineNumber, Callable(java_db).find(n))) { + return true + } + } + } + if (!(tmp_0(lineNumber, filename))) { + for (e in int::__undetermined_all__(), + s1 in int::__undetermined_all__()) { + if (n.getLocation().getFile() = f) { + if (s1 = n.getLocation().getStartLineNumber()) { + if (e = n.getLocation().getEndLineNumber()) { + if (lineNumber > s1 - 1) { + if (lineNumber < e + 1) { + if (typeInAST = n.getType()) { + if (isFieldOrEnum(ECGNode(java_db).find(n))) { + return true + } + } + } + } + } + } + } + } + } + } + } + } + } +} +pub fn isFieldOrEnum(c: ECGNode) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (f in Field(java_db)) { + if (f.key_eq(c)) { + return true + } + } + for (e in EnumConstant(java_db)) { + if (e.key_eq(c)) { + return true + } + } + } + } +} +pub fn findSpecialCodeType(filename: string, lineNumber: int, type: string) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + if (isComment(filename, lineNumber)) { + if (type = "comment") { + return true + } + } + if (isAnnotation(filename, lineNumber)) { + if (type = "annotation") { + return true + } + } + if (isLog(filename, lineNumber)) { + if (type = "log") { + return true + } + } + } + } +} +pub fn getBelongedCallable(filename: string, lineNumber: int, c: Callable) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (f in File(java_db)) { + if (transfertofile(f, filename, lineNumber)) { + for (l1 in int::__undetermined_all__(), + l2 in int::__undetermined_all__()) { + for (i in Identifier(java_db)) { + if (f = c.getLocation().getFile()) { + if (c.key_eq(i.getParent())) { + if (l1 = i.getLocation().getStartLineNumber()) { + if (l2 = c.getLocation().getEndLineNumber()) { + if (lineNumber > l1 - 1) { + if (lineNumber < l2 + 1) { + return true + } + } + } + } + } + } + } + } + } + } + } + } +} +pub fn getBelongedCallableSignature(filename: string, lineNumber: int, belongedCallable: string) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (i in int::__undetermined_all__()) { + for (c in Callable(java_db)) { + if (transfertofile(__all_data__, filename, lineNumber)) { + if (i = tmp_1().len()) { + if (tmp_2(i)) { + if (belongedCallable = "") { + return true + } + } + if (!(tmp_2(i))) { + if (getBelongedCallable(filename, lineNumber, c)) { + if (belongedCallable = c.getSignature()) { + return true + } + } + } + } + } + } + } + } + } +} +pub fn getJavaECGNode(n: ECGNode) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (lineNumber in int::__undetermined_all__(), + filename in string::__undetermined_all__(), + typeInAST in string::__undetermined_all__(), + belongedCallable in string::__undetermined_all__()) { + if (transfertofile(__all_data__, filename, lineNumber)) { + if (getBelongedCallableSignature(filename, lineNumber, belongedCallable)) { + if (getTypeInECG(filename, lineNumber, typeInAST, n)) { + return true + } + } + } + } + } + } +} +pub fn transfertoXmlfile(f: XmlFile, filename: string, lineNumber: int) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + if (gitdiff(filename, lineNumber)) { + if (filename = f.getRelativePath()) { + return true + } + } + } + } +} +pub fn getXmlECGNode(n: ECGXmlNode) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (lineNumber in int::__undetermined_all__(), + e in int::__undetermined_all__(), + s1 in int::__undetermined_all__(), + filename in string::__undetermined_all__(), + typeInAST in string::__undetermined_all__(), + text in string::__undetermined_all__()) { + for (f in XmlFile(xml_db), + o in ECGXmlNode(xml_db)) { + if (transfertoXmlfile(f, filename, lineNumber)) { + if (n.getLocation().getFile() = f) { + if (s1 = n.getLocation().getStartLineNumber()) { + if (e = n.getLocation().getEndLineNumber()) { + if (lineNumber > s1 - 1) { + if (lineNumber < e + 1) { + if (typeInAST = n.getType()) { + if (text = n.getText()) { + if (o = n.getEnclosingECGXmlNode()) { + return true + } + } + } + } + } + } + } + } + } + } + } + } + } +} +pub fn real_output(i: int) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (e1 in ECGNode(java_db)) { + if (getJavaECGNode(e1)) { + if (i = e1.id) { + return true + } + } + } + for (e2 in ECGXmlNode(xml_db)) { + if (getXmlECGNode(e2)) { + if (i = e2.id) { + return true + } + } + } + } + } +} + + +fn default_java_db() -> JavaDB { + return JavaDB::load("coref_java_src.db") +} + +fn default_xml_db() -> XmlDB { + return XmlDB::load("coref_xml_src.db") +} + +fn tmp_0(lineNumber: int, filename: string) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + if (getBelongedCallable(filename, lineNumber, __all_data__)) { + return true + } + } + } +} + +fn tmp_1() -> *string { + for (filename in string::__undetermined_all__(), lineNumber in int::__undetermined_all__()) { + if (getBelongedCallable(filename, lineNumber, __all_data__)) { + yield filename + } + } +} + +fn tmp_2(i: int) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + if (i = 0) { + return true + } + } + } +} + +fn main() { + output(real_output()) +} \ No newline at end of file diff --git a/example/icse25/rules/rule1_5_6.gdl b/example/icse25/rules/rule1_5_6.gdl new file mode 100644 index 00000000..eb69e884 --- /dev/null +++ b/example/icse25/rules/rule1_5_6.gdl @@ -0,0 +1,1423 @@ +// script +use coref::java::* +use coref::xml::* + +schema ECGNode extends ElementParent {} + +impl ECGNode { + pub fn __all__(db: JavaDB) -> *ECGNode { + for (tmp in ElementParent(db)) { + for (m in Method(db)) { + if (tmp.key_eq(m)) { + yield ECGNode { + id : tmp.id + } + } + } + for (m in Variable(db)) { + if (tmp.key_eq(m)) { + yield ECGNode { + id : tmp.id + } + } + } + for (m in Expression(db)) { + if (tmp.key_eq(m)) { + yield ECGNode { + id : tmp.id + } + } + } + } + } + + pub fn getType(self) -> string { + for (t in string::__undetermined_all__()) { + for (m in Method(__all_data__)) { + if (self.key_eq(m)) { + if (t = "Method") { + return t + } + } + } + for (m in LocalVariable(__all_data__)) { + if (self.key_eq(m)) { + if (t = "LocalVariable") { + return t + } + } + } + for (m in Parameter(__all_data__)) { + if (self.key_eq(m)) { + if (t = "Parameter") { + return t + } + } + } + for (m in Field(__all_data__)) { + if (self.key_eq(m)) { + if (t = "Field") { + return t + } + } + } + for (m in EnumConstant(__all_data__)) { + if (self.key_eq(m)) { + if (t = "EnumConstant") { + return t + } + } + } + for (m in Expression(__all_data__)) { + if (self.key_eq(m)) { + if (t = m.getType()) { + return t + } + } + } + } + } + + pub fn getDDNode(self, type: string, direction: string) -> ECGNode { + for (e1 in ECGNode(__all_data__)) { + for (e in Parameter(__all_data__), + c in Method(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + for (auto_tmp1 in c.getParameter()) { + if (e = auto_tmp1) { + if (direction = "Depended") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + for (r in ReturnStatement(__all_data__), + c in Method(__all_data__), + e in Expression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (c.key_eq(r.getEnclosingCallable())) { + if (e = r.getResult()) { + if (direction = "Depends") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + for (c in Callable(__all_data__), + e in Field(__all_data__), + r in ReferenceExpression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (c = r.getEnclosingCallable()) { + if (e.key_eq(r.getDefinition())) { + if (direction = "Depended") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + for (c in Callable(__all_data__), + e in EnumConstant(__all_data__), + r in ReferenceExpression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (c = r.getEnclosingCallable()) { + if (e.key_eq(r.getDefinition())) { + if (direction = "Depended") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + for (e in Callable(__all_data__), + c in Field(__all_data__), + r in ReferenceExpression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (c.key_eq(r.getDefinition())) { + if (e = r.getEnclosingCallable()) { + if (direction = "Depends") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + for (e in Callable(__all_data__), + c in EnumConstant(__all_data__), + r in ReferenceExpression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (c.key_eq(r.getDefinition())) { + if (e = r.getEnclosingCallable()) { + if (direction = "Depends") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + for (c in Callable(__all_data__), + e in CallExpression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (c = e.getEnclosingCallable()) { + for (m in Method(__all_data__)) { + if (m = e.getMethod()) { + if (!isDirectCall(e)) { + if (direction = "Depended") { + if (type = "DD") { + return e1 + } + } + } + } + } + for (f in LombokField(__all_data__)) { + if (f = e.getLombokField()) { + if (!isDirectCall(e)) { + if (direction = "Depended") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + } + } + for (n in string::__undetermined_all__()) { + for (e in LombokField(__all_data__), + c in CallExpression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (e = c.getLombokField()) { + let (tmp_find = CallExpression(__all_data__).find(e)) { + if (!isDirectCall(tmp_find)) { + if (n = c.getMethodName()) { + if (Self::tmp_0(n)) { + if (direction = "Depended") { + if (type = "DD") { + return e1 + } + } + } + if (!Self::tmp_0(n)) { + if (direction = "Depends") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + } + } + } + } + for (e in Variable(__all_data__), + c in CallExpression(__all_data__), + r in ReferenceExpression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (!isDirectCall(c)) { + for (auto_tmp2 in c.getArguments()) { + if (r.key_eq(auto_tmp2)) { + if (e.key_eq(r.getDefinition())) { + if (direction = "Depended") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + } + } + for (e in CallExpression(__all_data__), + c in CallExpression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (!isDirectCall(c)) { + for (auto_tmp3 in c.getArguments()) { + if (e.key_eq(auto_tmp3)) { + if (direction = "Depended") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + } + for (e in CallExpression(__all_data__), + c in CallExpression(__all_data__), + s in CallExpression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (!isDirectCall(c)) { + for (auto_tmp4 in c.getAnAncestor()) { + if (s.getReference().key_eq(auto_tmp4)) { + for (auto_tmp5 in s.getArguments()) { + if (auto_tmp5.key_eq(e)) { + if (direction = "Depended") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + } + } + } + } + } + + pub fn getAnAncestorDDNode(self, type: string, direction: string) -> ECGNode { + for (e in ECGNode(__all_data__)) { + if (type = "DD") { + if (e = self.getDDNode(type, direction)) { + return e + } + if (e = self.getAnAncestorDDNode(__all_data__, __all_data__).getDDNode(type, direction)) { + return e + } + } + } + } + + pub fn getCDNode(self, type: string, direction: string) -> ECGNode { + for (e in ECGNode(__all_data__), + c in Callable(__all_data__), + r in ReferenceExpression(__all_data__)) { + if (self.key_eq(c)) { + if (type = "CD") { + for (e1 in Method(__all_data__)) { + for (auto_tmp1 in c.getCallee()) { + if (e1.key_eq(auto_tmp1)) { + if (direction = "Depends") { + if (e.key_eq(e1)) { + return e + } + } + } + } + } + for (e2 in Method(__all_data__)) { + for (auto_tmp2 in c.getCaller()) { + if (e2.key_eq(auto_tmp2)) { + if (direction = "Depended") { + if (e.key_eq(e2)) { + return e + } + } + } + } + } + } + } + if (self.key_eq(r.getDefinition())) { + if (c = r.getEnclosingCallable()) { + if (type = "CD") { + for (e1 in Method(__all_data__)) { + for (auto_tmp1 in c.getCallee()) { + if (e1.key_eq(auto_tmp1)) { + if (direction = "Depends") { + if (e.key_eq(e1)) { + return e + } + } + } + } + } + for (e2 in Method(__all_data__)) { + for (auto_tmp2 in c.getCaller()) { + if (e2.key_eq(auto_tmp2)) { + if (direction = "Depended") { + if (e.key_eq(e2)) { + return e + } + } + } + } + } + } + } + } + } + } + + pub fn getAnAncestorCDNode(self, type: string, direction: string) -> ECGNode { + for (e in ECGNode(__all_data__), + c in Callable(__all_data__), + r in ReferenceExpression(__all_data__)) { + if (type = "CD") { + if (self.key_eq(c)) { + for (e1 in Method(__all_data__)) { + for (auto_tmp1 in c.getAnAncestorCallee()) { + if (e1.key_eq(auto_tmp1)) { + if (direction = "Depends") { + if (e.key_eq(e1)) { + return e + } + } + } + } + } + for (e2 in Method(__all_data__)) { + for (auto_tmp2 in c.getAnAncestorCaller()) { + if (e2.key_eq(auto_tmp2)) { + if (direction = "Depended") { + if (e.key_eq(e2)) { + return e + } + } + } + } + } + } + if (self.key_eq(r.getDefinition())) { + if (c = r.getEnclosingCallable()) { + for (e1 in Method(__all_data__)) { + for (auto_tmp1 in c.getAnAncestorCallee()) { + if (e1.key_eq(auto_tmp1)) { + if (direction = "Depends") { + if (e.key_eq(e1)) { + return e + } + } + } + } + } + for (e2 in Method(__all_data__)) { + for (auto_tmp2 in c.getAnAncestorCaller()) { + if (e2.key_eq(auto_tmp2)) { + if (direction = "Depended") { + if (e.key_eq(e2)) { + return e + } + } + } + } + } + } + } + } + } + } + + pub fn getECGNode(self, type: string, direction: string) -> ECGNode { + for (e in ECGNode(__all_data__)) { + if (e = self.getCDNode(type, direction)) { + return e + } + if (e = self.getDDNode(type, direction)) { + return e + } + } + } + + pub fn getAnAncestorECGNode(self, type: string, direction: string) -> ECGNode { + for (e in ECGNode(__all_data__), tmp in ECGNode(__all_data__)) { + if (tmp = self.getAnAncestorCDNode(__all_data__, __all_data__)) { + if (e = tmp.getECGNode(type, direction)) { + return e + } + } + } + } + + fn tmp_0(n: string) -> bool { + if (n.matches("get.*")) { + return true + } + } +} + +schema ECGXmlNode { + @primary id: int +} + +impl ECGXmlNode { + pub fn __all__(db: XmlDB) -> *ECGXmlNode { + for (e in XmlPomElement(db)) { + yield ECGXmlNode {id : e.id} + } + for (e in XmlSpringElement(db)) { + yield ECGXmlNode {id : e.id} + } + for (e in XmlCharacter(db)) { + yield ECGXmlNode {id : e.id} + } + for (e in XmlAttribute(db)) { + yield ECGXmlNode {id : e.id} + } + } + + pub fn getLocation(self) -> coref::xml::Location { + for (l in coref::xml::Location(__all_data__)) { + for (e in XmlElement(__all_data__)) { + if (self.key_eq(e)) { + if (l = e.getLocation()) { + return l + } + } + } + for (e in XmlAttribute(__all_data__)) { + if (self.key_eq(e)) { + if (l = e.getLocation()) { + return l + } + } + } + for (e in XmlCharacter(__all_data__)) { + if (self.key_eq(e)) { + if (l = e.getLocation()) { + return l + } + } + } + } + } + + pub fn getType(self) -> string { + for (t in string::__undetermined_all__()) { + for (e in XmlElement(__all_data__)) { + if (self.key_eq(e)) { + if (t = "XmlElement") { + return t + } + } + } + for (e in XmlAttribute(__all_data__)) { + if (self.key_eq(e)) { + if (t = "XmlAttribute") { + return t + } + } + } + for (e in XmlCharacter(__all_data__)) { + if (self.key_eq(e)) { + if (t = "XmlCharacter") { + return t + } + } + } + } + } + + pub fn getText(self) -> string { + for (e in XmlElement(__all_data__)) { + if (self.key_eq(e)) { + return e.getName() + } + } + for (e in XmlAttribute(__all_data__)) { + if (self.key_eq(e)) { + return e.getName() + " = " + e.getValue() + } + } + for (e in XmlCharacter(__all_data__)) { + if (self.key_eq(e)) { + return e.getText() + } + } + } + + pub fn getEnclosingECGXmlNode(self) -> ECGXmlNode { + for (e in XmlElement(__all_data__)) { + if (self.key_eq(e)) { + return e.to() + } + } + for (e in XmlAttribute(__all_data__)) { + if (self.key_eq(e)) { + return e.getXmlElement().to() + } + } + for (e in XmlCharacter(__all_data__)) { + if (self.key_eq(e)) { + return e.getBelongedElement().to() + } + } + } +} + +pub fn gitdiff(filePath: string, lineNo: int) -> bool { + //python替换 + // $gitdiff + // example + [ {"test", 1111} ] +} +pub fn transfertofile1(f: File, filename: string, lineNumber: int) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + if (gitdiff(filename, lineNumber)) { + if (!filename.contains("src/test/java")) { + if (filename = f.getRelativePath()) { + if (isCodeLine(f, filename, lineNumber)) { + return true + } + } + } + } + } + } +} +pub fn transfertofile(f: File, filename: string, lineNumber: int) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + if (transfertofile1(f, filename, lineNumber)) { + if (!findSpecialCodeType(filename, lineNumber, __all_data__)) { + return true + } + } + } + } +} +pub fn isComment(filename: string, lineNumber: int) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (f in File(java_db)) { + if (transfertofile1(f, filename, lineNumber)) { + for (e in int::__undetermined_all__(), + s1 in int::__undetermined_all__()) { + for (c in Comment(java_db)) { + if (c.getLocation().getFile() = f) { + if (s1 = c.getLocation().getStartLineNumber()) { + if (e = c.getLocation().getEndLineNumber()) { + if (lineNumber > s1 - 1) { + if (lineNumber < e + 1) { + return true + } + } + } + } + } + } + } + for (e in int::__undetermined_all__(), + s1 in int::__undetermined_all__()) { + for (c in JavadocComment(java_db)) { + if (c.getLocation().getFile() = f) { + if (s1 = c.getLocation().getStartLineNumber()) { + if (e = c.getLocation().getEndLineNumber()) { + if (lineNumber > s1 - 1) { + if (lineNumber < e + 1) { + return true + } + } + } + } + } + } + } + } + } + } + } +} +pub fn isAnnotation(filename: string, lineNumber: int) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (f in File(java_db)) { + if (transfertofile1(f, filename, lineNumber)) { + for (e in int::__undetermined_all__(), + s1 in int::__undetermined_all__()) { + for (c in Annotation(java_db)) { + if (c.getLocation().getFile() = f) { + if (s1 = c.getLocation().getStartLineNumber()) { + if (e = c.getLocation().getEndLineNumber()) { + if (lineNumber > s1 - 1) { + if (lineNumber < e + 1) { + return true + } + } + } + } + } + } + } + } + } + } + } +} +pub fn isCodeLine(f: File, filename: string, lineNumber: int) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + if (gitdiff(filename, lineNumber)) { + if (f.getRelativePath() = filename) { + for (e in int::__undetermined_all__(), + s1 in int::__undetermined_all__()) { + for (l in coref::java::Location(java_db)) { + if (l.getFile() = f) { + if (s1 = l.getStartLineNumber()) { + if (e = l.getEndLineNumber()) { + if (lineNumber > s1 - 1) { + if (lineNumber < e + 1) { + return true + } + } + } + } + } + } + } + } + } + } + } +} +pub fn isLog(filename: string, lineNumber: int) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (f in File(java_db)) { + if (transfertofile1(f, filename, lineNumber)) { + for (e in int::__undetermined_all__(), + s1 in int::__undetermined_all__(), + text in string::__undetermined_all__()) { + for (c in Expression(java_db)) { + if (c.getLocation().getFile() = f) { + if (s1 = c.getLocation().getStartLineNumber()) { + if (e = c.getLocation().getEndLineNumber()) { + if (lineNumber > s1 - 1) { + if (lineNumber < e + 1) { + if (text = c.getPrintableText()) { + if (text.matches("^logger\\..*")) { + return true + } + } + } + } + } + } + } + } + } + } + } + } + } +} +pub fn getTypeInAST(filename: string, lineNumber: int, typeInAST: string) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (f in File(java_db)) { + if (transfertofile(f, filename, lineNumber)) { + for (e in int::__undetermined_all__(), + s1 in int::__undetermined_all__()) { + for (c in ElementParent(java_db)) { + if (c.getLocation().getFile() = f) { + if (s1 = c.getLocation().getStartLineNumber()) { + if (e = c.getLocation().getEndLineNumber()) { + if (s1 = e) { + if (lineNumber > s1 - 1) { + if (lineNumber < e + 1) { + if (typeInAST = c.getType()) { + return true + } + } + } + } + } + } + } + } + } + } + } + } + } +} +pub fn getTypeInECG(filename: string, lineNumber: int, typeInAST: string, n: ECGNode) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (f in File(java_db)) { + if (transfertofile(f, filename, lineNumber)) { + if (tmp_0(filename, lineNumber)) { + if (typeInAST = "Callable") { + if (getBelongedCallable(filename, lineNumber, Callable(java_db).find(n))) { + return true + } + } + } + if (!(tmp_0(filename, lineNumber))) { + for (e in int::__undetermined_all__(), + s1 in int::__undetermined_all__()) { + if (n.getLocation().getFile() = f) { + if (s1 = n.getLocation().getStartLineNumber()) { + if (e = n.getLocation().getEndLineNumber()) { + if (lineNumber > s1 - 1) { + if (lineNumber < e + 1) { + if (typeInAST = n.getType()) { + if (isFieldOrEnum(ECGNode(java_db).find(n))) { + return true + } + } + } + } + } + } + } + } + } + } + } + } + } +} +pub fn isFieldOrEnum(c: ECGNode) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (f in Field(java_db)) { + if (f.key_eq(c)) { + return true + } + } + for (e in EnumConstant(java_db)) { + if (e.key_eq(c)) { + return true + } + } + } + } +} +pub fn findSpecialCodeType(filename: string, lineNumber: int, type: string) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + if (isComment(filename, lineNumber)) { + if (type = "comment") { + return true + } + } + if (isAnnotation(filename, lineNumber)) { + if (type = "annotation") { + return true + } + } + if (isLog(filename, lineNumber)) { + if (type = "log") { + return true + } + } + } + } +} +pub fn getBelongedCallable(filename: string, lineNumber: int, c: Callable) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (f in File(java_db)) { + if (transfertofile(f, filename, lineNumber)) { + for (l1 in int::__undetermined_all__(), + l2 in int::__undetermined_all__()) { + for (i in Identifier(java_db)) { + if (f = c.getLocation().getFile()) { + if (c.key_eq(i.getParent())) { + if (l1 = i.getLocation().getStartLineNumber()) { + if (l2 = c.getLocation().getEndLineNumber()) { + if (lineNumber > l1 - 1) { + if (lineNumber < l2 + 1) { + return true + } + } + } + } + } + } + } + } + } + } + } + } +} +pub fn getBelongedCallableSignature(filename: string, lineNumber: int, belongedCallable: string) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (i in int::__undetermined_all__()) { + for (c in Callable(java_db)) { + if (transfertofile(__all_data__, filename, lineNumber)) { + if (i = tmp_1().len()) { + if (tmp_2(i)) { + if (belongedCallable = "") { + return true + } + } + if (!(tmp_2(i))) { + if (getBelongedCallable(filename, lineNumber, c)) { + if (belongedCallable = c.getSignature()) { + return true + } + } + } + } + } + } + } + } + } +} +pub fn getJavaECGNode(n: ECGNode) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (lineNumber in int::__undetermined_all__(), + filename in string::__undetermined_all__(), + typeInAST in string::__undetermined_all__(), + belongedCallable in string::__undetermined_all__()) { + if (transfertofile(__all_data__, filename, lineNumber)) { + if (getBelongedCallableSignature(filename, lineNumber, belongedCallable)) { + if (getTypeInECG(filename, lineNumber, typeInAST, n)) { + return true + } + } + } + } + } + } +} +pub fn transfertoXmlfile(f: XmlFile, filename: string, lineNumber: int) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + if (gitdiff(filename, lineNumber)) { + if (filename = f.getRelativePath()) { + return true + } + } + } + } +} +pub fn getXmlECGNode(n: ECGXmlNode) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (lineNumber in int::__undetermined_all__(), + e in int::__undetermined_all__(), + s1 in int::__undetermined_all__(), + filename in string::__undetermined_all__(), + typeInAST in string::__undetermined_all__(), + text in string::__undetermined_all__()) { + for (f in XmlFile(xml_db), + o in ECGXmlNode(xml_db)) { + if (transfertoXmlfile(f, filename, lineNumber)) { + if (n.getLocation().getFile() = f) { + if (s1 = n.getLocation().getStartLineNumber()) { + if (e = n.getLocation().getEndLineNumber()) { + if (lineNumber > s1 - 1) { + if (lineNumber < e + 1) { + if (typeInAST = n.getType()) { + if (text = n.getText()) { + if (o = n.getEnclosingECGXmlNode()) { + return true + } + } + } + } + } + } + } + } + } + } + } + } + } +} +schema SofaService extends Annotation { + +} + +impl SofaService { + + @data_constraint + @inline + pub fn __all__(db: JavaDB) -> *SofaService { + for (tmp in Annotation(db)) { + if (tmp.getName() = "SofaService") { + yield SofaService { + id : tmp.id + } + } + } + } + + pub fn getService(self) -> ClassOrInterface { + for (value in string::__undetermined_all__()) { + for (i in ClassOrInterface(__all_data__), + argus in AnnotationAccessArgument(__all_data__)) { + for (auto_tmp1 in self.getAnnotationArgument()) { + if (argus = auto_tmp1) { + if (argus.getAnnotationArgumentName() = "interfaceType") { + if (value = argus.getAnnotationArgumentValue()) { + if (i.getQualifiedName() = value) { + return i + } + } + } + } + } + } + } + } + + @inline + pub fn getBinding(self) -> SofaServiceBinding { + for (b in SofaServiceBinding(__all_data__), + argus in AnnotationAccessArgument(__all_data__)) { + for (auto_tmp1 in self.getAnnotationArgument()) { + if (argus = auto_tmp1) { + if (argus.getAnnotationArgumentName() = "bindings") { + if (b.key_eq(argus.getArgumentAnnotation())) { + return b + } + if (argus.key_eq(b.getParent())) { + return b + } + } + } + } + } + } + + @inline + pub fn getUniqueId(self) -> string { + for (uniqueId in string::__undetermined_all__()) { + for (anno in Annotation(__all_data__)) { + if (self.key_eq(anno)) { + if (tmp_5(anno)) { + for (argus in AnnotationAccessArgument(__all_data__)) { + for (auto_tmp1 in anno.getAnnotationArgument()) { + if (argus = auto_tmp1) { + if (argus.getAnnotationArgumentName() = "uniqueId") { + if (uniqueId = argus.getAnnotationArgumentValue()) { + return uniqueId + } + } + } + } + } + } + if (!(tmp_5(anno))) { + if (uniqueId = "null") { + return uniqueId + } + } + } + } + } + } + + +} + +pub fn uniqueArgument(anno: Annotation) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (argus in AnnotationAccessArgument(java_db)) { + for (auto_tmp1 in anno.getAnnotationArgument()) { + if (argus = auto_tmp1) { + if (argus.getAnnotationArgumentName() = "uniqueId") { + return true + } + } + } + } + } + } +} +schema SofaServiceBinding extends Annotation { + +} + +impl SofaServiceBinding { + + @data_constraint + @inline + pub fn __all__(db: JavaDB) -> *SofaServiceBinding { + for (tmp in Annotation(db)) { + if (tmp.getName() = "SofaServiceBinding") { + yield SofaServiceBinding { + id : tmp.id + } + } + } + } + + pub fn getType(self) -> string { + for (value in string::__undetermined_all__()) { + for (argus in AnnotationAccessArgument(__all_data__)) { + for (auto_tmp1 in self.getAnnotationArgument()) { + if (argus = auto_tmp1) { + if (argus.getAnnotationArgumentName() = "bindingType") { + if (value = argus.getAnnotationArgumentValue()) { + return value + } + } + } + } + } + } + } + + +} + +pub fn javaOutput(classname: string, name: string) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (s in SofaService(java_db), + c in Class(java_db), + i in ClassOrInterface(java_db)) { + for (auto_tmp1 in c.getAnnotation()) { + if (s.key_eq(auto_tmp1)) { + if (classname = c.getQualifiedName()) { + for (auto_tmp2 in c.getImplementsInterface()) { + if (i.key_eq(auto_tmp2)) { + if (name = i.getQualifiedName()) { + return true + } + } + } + if (i = s.getService()) { + if (name = i.getQualifiedName()) { + return true + } + } + } + } + } + } + } + } +} +pub fn xmlOutput(className: string, interfaceName: string) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (temp in string::__undetermined_all__()) { + for (s in SofaServiceXmlElement(xml_db), + b in BeanXmlElement(xml_db)) { + if (s.getRef() = b.getId()) { + if (interfaceName = s.getInterfaceName()) { + if (className = b.getClass()) { + if (temp = b.getLocation().getFile().getRelativePath()) { + if (!temp.contains("src/test/resources")) { + return true + } + } + } + } + } + } + } + } + } +} +pub fn annoOutput(className: string, interfaceName: string) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (v in string::__undetermined_all__(), + k in string::__undetermined_all__()) { + for (s in SofaServiceXmlElement(xml_db), + b in Class(java_db), + t in TagXmlElement(xml_db), + a in Annotation(java_db)) { + if (s.key_eq(t.getParent())) { + if (v = s.getRef()) { + if (interfaceName = s.getInterfaceName()) { + for (auto_tmp1 in b.getAnnotation()) { + if (a = auto_tmp1) { + if (a.getName() = k) { + if (getTrAnnotationName(k)) { + for (auto_tmp2 in a.getAnnotationArgument()) { + if (auto_tmp2.getAnnotationArgumentValue() = "\"" + v + "\"") { + if (className = b.getQualifiedName()) { + return true + } + } + } + } + } + } + } + } + } + } + } + } + } + } +} +pub fn getTrAnnotationName(a: string) -> bool { + [ + {"Service"}, + {"Component"}, + {"Scope"}, + {"Repository"}, + {"Controller"}, + {"RestController"}, + {"RequestMapping"}, + {"PathVariable"}, + {"ResponseBody"}, + {"bean"} + ] +} +pub fn real_output(className: string, interfaceName: string, id: int, name: string, tag: string) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (i in int::__undetermined_all__(), + j in int::__undetermined_all__()) { + if (xmlOutput(className, interfaceName)) { + for (temp in string::__undetermined_all__()) { + for (e1 in ECGNode(java_db), + e2 in ECGXmlNode(xml_db), + c in ClassOrInterface(java_db)) { + if (getJavaECGNode(e1)) { + if (getXmlECGNode(e2)) { + if (c.key_eq(e1.getElementParent())) { + if (temp = c.getQualifiedName()) { + if (id = e1.id) { + if (temp = className) { + if (name = e1.print()) { + if (tag = "Java") { + return true + } + } + } + if (temp = interfaceName) { + if (name = e1.print()) { + if (tag = "Java") { + return true + } + } + } + } + if (e2.id = i) { + if (id = e2.id) { + if (name = e2.getText()) { + if (tag = "xml") { + return true + } + } + } + } + if (e2.id = j) { + if (id = e2.id) { + if (name = e2.getText()) { + if (tag = "xml") { + return true + } + } + } + } + } + } + } + } + } + } + } + if (javaOutput(className, interfaceName)) { + for (temp in string::__undetermined_all__()) { + for (e1 in ECGNode(java_db), + e2 in ECGXmlNode(xml_db), + c in ClassOrInterface(java_db)) { + if (getJavaECGNode(e1)) { + if (getXmlECGNode(e2)) { + if (c.key_eq(e1.getElementParent())) { + if (temp = c.getQualifiedName()) { + if (id = e1.id) { + if (temp = className) { + if (name = e1.print()) { + if (tag = "Java") { + return true + } + } + } + if (temp = interfaceName) { + if (name = e1.print()) { + if (tag = "Java") { + return true + } + } + } + } + if (e2.id = i) { + if (id = e2.id) { + if (name = e2.getText()) { + if (tag = "xml") { + return true + } + } + } + } + if (e2.id = j) { + if (id = e2.id) { + if (name = e2.getText()) { + if (tag = "xml") { + return true + } + } + } + } + } + } + } + } + } + } + } + if (annoOutput(className, interfaceName)) { + for (temp in string::__undetermined_all__()) { + for (e1 in ECGNode(java_db), + e2 in ECGXmlNode(xml_db), + c in ClassOrInterface(java_db)) { + if (getJavaECGNode(e1)) { + if (getXmlECGNode(e2)) { + if (c.key_eq(e1.getElementParent())) { + if (temp = c.getQualifiedName()) { + if (id = e1.id) { + if (temp = className) { + if (name = e1.print()) { + if (tag = "Java") { + return true + } + } + } + if (temp = interfaceName) { + if (name = e1.print()) { + if (tag = "Java") { + return true + } + } + } + } + if (e2.id = i) { + if (id = e2.id) { + if (name = e2.getText()) { + if (tag = "xml") { + return true + } + } + } + } + if (e2.id = j) { + if (id = e2.id) { + if (name = e2.getText()) { + if (tag = "xml") { + return true + } + } + } + } + } + } + } + } + } + } + } + } + } + } +} + + +fn default_java_db() -> JavaDB { + return JavaDB::load("coref_java_src.db") +} + +fn default_xml_db() -> XmlDB { + return XmlDB::load("coref_xml_src.db") +} + +fn tmp_0(filename: string, lineNumber: int) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + if (getBelongedCallable(filename, lineNumber, __all_data__)) { + return true + } + } + } +} + +fn tmp_1() -> *string { + for (filename in string::__undetermined_all__(), lineNumber in int::__undetermined_all__()) { + if (getBelongedCallable(filename, lineNumber, __all_data__)) { + yield filename + } + } +} + +fn tmp_2(i: int) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + if (i = 0) { + return true + } + } + } +} + +fn tmp_3(anno: Annotation) -> *auto_tmp_4 { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + if (uniqueArgument(anno)) { + yield auto_tmp_4 { + + } + } + } + } +} + +schema auto_tmp_4 { + +} + +fn tmp_5(anno: Annotation) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + if (tmp_3(anno).len() = 1) { + return true + } + } + } +} + +fn main() { + output(real_output()) +} \ No newline at end of file diff --git a/example/icse25/rules/rule1_7_8.gdl b/example/icse25/rules/rule1_7_8.gdl new file mode 100644 index 00000000..7fa92884 --- /dev/null +++ b/example/icse25/rules/rule1_7_8.gdl @@ -0,0 +1,1663 @@ +// script +use coref::java::* +use coref::xml::* + +schema ECGNode extends ElementParent {} + +impl ECGNode { + pub fn __all__(db: JavaDB) -> *ECGNode { + for (tmp in ElementParent(db)) { + for (m in Method(db)) { + if (tmp.key_eq(m)) { + yield ECGNode { + id : tmp.id + } + } + } + for (m in Variable(db)) { + if (tmp.key_eq(m)) { + yield ECGNode { + id : tmp.id + } + } + } + for (m in Expression(db)) { + if (tmp.key_eq(m)) { + yield ECGNode { + id : tmp.id + } + } + } + } + } + + pub fn getType(self) -> string { + for (t in string::__undetermined_all__()) { + for (m in Method(__all_data__)) { + if (self.key_eq(m)) { + if (t = "Method") { + return t + } + } + } + for (m in LocalVariable(__all_data__)) { + if (self.key_eq(m)) { + if (t = "LocalVariable") { + return t + } + } + } + for (m in Parameter(__all_data__)) { + if (self.key_eq(m)) { + if (t = "Parameter") { + return t + } + } + } + for (m in Field(__all_data__)) { + if (self.key_eq(m)) { + if (t = "Field") { + return t + } + } + } + for (m in EnumConstant(__all_data__)) { + if (self.key_eq(m)) { + if (t = "EnumConstant") { + return t + } + } + } + for (m in Expression(__all_data__)) { + if (self.key_eq(m)) { + if (t = m.getType()) { + return t + } + } + } + } + } + + pub fn getDDNode(self, type: string, direction: string) -> ECGNode { + for (e1 in ECGNode(__all_data__)) { + for (e in Parameter(__all_data__), + c in Method(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + for (auto_tmp1 in c.getParameter()) { + if (e = auto_tmp1) { + if (direction = "Depended") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + for (r in ReturnStatement(__all_data__), + c in Method(__all_data__), + e in Expression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (c.key_eq(r.getEnclosingCallable())) { + if (e = r.getResult()) { + if (direction = "Depends") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + for (c in Callable(__all_data__), + e in Field(__all_data__), + r in ReferenceExpression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (c = r.getEnclosingCallable()) { + if (e.key_eq(r.getDefinition())) { + if (direction = "Depended") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + for (c in Callable(__all_data__), + e in EnumConstant(__all_data__), + r in ReferenceExpression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (c = r.getEnclosingCallable()) { + if (e.key_eq(r.getDefinition())) { + if (direction = "Depended") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + for (e in Callable(__all_data__), + c in Field(__all_data__), + r in ReferenceExpression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (c.key_eq(r.getDefinition())) { + if (e = r.getEnclosingCallable()) { + if (direction = "Depends") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + for (e in Callable(__all_data__), + c in EnumConstant(__all_data__), + r in ReferenceExpression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (c.key_eq(r.getDefinition())) { + if (e = r.getEnclosingCallable()) { + if (direction = "Depends") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + for (c in Callable(__all_data__), + e in CallExpression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (c = e.getEnclosingCallable()) { + for (m in Method(__all_data__)) { + if (m = e.getMethod()) { + if (!isDirectCall(e)) { + if (direction = "Depended") { + if (type = "DD") { + return e1 + } + } + } + } + } + for (f in LombokField(__all_data__)) { + if (f = e.getLombokField()) { + if (!isDirectCall(e)) { + if (direction = "Depended") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + } + } + for (n in string::__undetermined_all__()) { + for (e in LombokField(__all_data__), + c in CallExpression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (e = c.getLombokField()) { + let (tmp_find = CallExpression(__all_data__).find(e)) { + if (!isDirectCall(tmp_find)) { + if (n = c.getMethodName()) { + if (Self::tmp_0(n)) { + if (direction = "Depended") { + if (type = "DD") { + return e1 + } + } + } + if (!Self::tmp_0(n)) { + if (direction = "Depends") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + } + } + } + } + for (e in Variable(__all_data__), + c in CallExpression(__all_data__), + r in ReferenceExpression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (!isDirectCall(c)) { + for (auto_tmp2 in c.getArguments()) { + if (r.key_eq(auto_tmp2)) { + if (e.key_eq(r.getDefinition())) { + if (direction = "Depended") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + } + } + for (e in CallExpression(__all_data__), + c in CallExpression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (!isDirectCall(c)) { + for (auto_tmp3 in c.getArguments()) { + if (e.key_eq(auto_tmp3)) { + if (direction = "Depended") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + } + for (e in CallExpression(__all_data__), + c in CallExpression(__all_data__), + s in CallExpression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (!isDirectCall(c)) { + for (auto_tmp4 in c.getAnAncestor()) { + if (s.getReference().key_eq(auto_tmp4)) { + for (auto_tmp5 in s.getArguments()) { + if (auto_tmp5.key_eq(e)) { + if (direction = "Depended") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + } + } + } + } + } + + pub fn getAnAncestorDDNode(self, type: string, direction: string) -> ECGNode { + for (e in ECGNode(__all_data__)) { + if (type = "DD") { + if (e = self.getDDNode(type, direction)) { + return e + } + if (e = self.getAnAncestorDDNode(__all_data__, __all_data__).getDDNode(type, direction)) { + return e + } + } + } + } + + pub fn getCDNode(self, type: string, direction: string) -> ECGNode { + for (e in ECGNode(__all_data__), + c in Callable(__all_data__), + r in ReferenceExpression(__all_data__)) { + if (self.key_eq(c)) { + if (type = "CD") { + for (e1 in Method(__all_data__)) { + for (auto_tmp1 in c.getCallee()) { + if (e1.key_eq(auto_tmp1)) { + if (direction = "Depends") { + if (e.key_eq(e1)) { + return e + } + } + } + } + } + for (e2 in Method(__all_data__)) { + for (auto_tmp2 in c.getCaller()) { + if (e2.key_eq(auto_tmp2)) { + if (direction = "Depended") { + if (e.key_eq(e2)) { + return e + } + } + } + } + } + } + } + if (self.key_eq(r.getDefinition())) { + if (c = r.getEnclosingCallable()) { + if (type = "CD") { + for (e1 in Method(__all_data__)) { + for (auto_tmp1 in c.getCallee()) { + if (e1.key_eq(auto_tmp1)) { + if (direction = "Depends") { + if (e.key_eq(e1)) { + return e + } + } + } + } + } + for (e2 in Method(__all_data__)) { + for (auto_tmp2 in c.getCaller()) { + if (e2.key_eq(auto_tmp2)) { + if (direction = "Depended") { + if (e.key_eq(e2)) { + return e + } + } + } + } + } + } + } + } + } + } + + pub fn getAnAncestorCDNode(self, type: string, direction: string) -> ECGNode { + for (e in ECGNode(__all_data__), + c in Callable(__all_data__), + r in ReferenceExpression(__all_data__)) { + if (type = "CD") { + if (self.key_eq(c)) { + for (e1 in Method(__all_data__)) { + for (auto_tmp1 in c.getAnAncestorCallee()) { + if (e1.key_eq(auto_tmp1)) { + if (direction = "Depends") { + if (e.key_eq(e1)) { + return e + } + } + } + } + } + for (e2 in Method(__all_data__)) { + for (auto_tmp2 in c.getAnAncestorCaller()) { + if (e2.key_eq(auto_tmp2)) { + if (direction = "Depended") { + if (e.key_eq(e2)) { + return e + } + } + } + } + } + } + if (self.key_eq(r.getDefinition())) { + if (c = r.getEnclosingCallable()) { + for (e1 in Method(__all_data__)) { + for (auto_tmp1 in c.getAnAncestorCallee()) { + if (e1.key_eq(auto_tmp1)) { + if (direction = "Depends") { + if (e.key_eq(e1)) { + return e + } + } + } + } + } + for (e2 in Method(__all_data__)) { + for (auto_tmp2 in c.getAnAncestorCaller()) { + if (e2.key_eq(auto_tmp2)) { + if (direction = "Depended") { + if (e.key_eq(e2)) { + return e + } + } + } + } + } + } + } + } + } + } + + pub fn getECGNode(self, type: string, direction: string) -> ECGNode { + for (e in ECGNode(__all_data__)) { + if (e = self.getCDNode(type, direction)) { + return e + } + if (e = self.getDDNode(type, direction)) { + return e + } + } + } + + pub fn getAnAncestorECGNode(self, type: string, direction: string) -> ECGNode { + for (e in ECGNode(__all_data__), tmp in ECGNode(__all_data__)) { + if (tmp = self.getAnAncestorCDNode(__all_data__, __all_data__)) { + if (e = tmp.getECGNode(type, direction)) { + return e + } + } + } + } + + pub fn getAnAncestorCDDependedNode(self, type: string, direction: string) -> ECGNode { + for (e in ECGNode(__all_data__), c in Callable(__all_data__), r in ReferenceExpression(__all_data__)) { + if (type = "CD") { + if (self.key_eq(c) || (self.key_eq(r.getDefinition()) && r.getEnclosingCallable() = c)) { + for (e2 in Method(__all_data__), c_caller in c.getAnAncestorCaller()) { + if (e2.key_eq(c_caller) && direction = "Depended" && e.key_eq(e2)) { + return e + } + } + } + } + } + } + + pub fn getECGDependsNode(self, type: string, direction: string) -> ECGNode { + for (e in ECGNode(__all_data__)) { + if (e = self.getCDDependsNode(type, direction)) { + return e + } + if (e = self.getDDDependsNode(type, direction)) { + return e + } + } + } + + pub fn getCDDependsNode(self, type: string, direction: string) -> ECGNode { + for (e in ECGNode(__all_data__), + c in Callable(__all_data__), + r in ReferenceExpression(__all_data__)) { + if (self.key_eq(c)) { + if (type = "CD") { + for (e1 in c.getCallee()) { + if (direction = "Depends") { + if (e.key_eq(e1)) { + return e + } + } + } + } + } + for (v in Variable(__all_data__)) { + if (self.key_eq(v)) { + if (v.key_eq(r.getDefinition())) { + if (c = r.getEnclosingCallable()) { + if (type = "CD") { + for (e1 in c.getCallee()) { + if (direction = "Depends") { + if (e.key_eq(e1)) { + return e + } + } + } + } + } + } + } + } + } + } + + pub fn getDDDependsNode(self, type: string, direction: string) -> ECGNode { + for (e1 in ECGNode(__all_data__)) { + for (r in ReturnStatement(__all_data__), + c in Method(__all_data__), + e in Expression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (c.key_eq(r.getEnclosingCallable())) { + if (e = r.getResult()) { + if (direction = "Depends") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + for (e in Callable(__all_data__), + c in Field(__all_data__), + r in ReferenceExpression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (c.key_eq(r.getDefinition())) { + if (e = r.getEnclosingCallable()) { + if (direction = "Depends") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + for (e in Callable(__all_data__), + c in EnumConstant(__all_data__), + r in ReferenceExpression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (c.key_eq(r.getDefinition())) { + if (e = r.getEnclosingCallable()) { + if (direction = "Depends") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + for (n in string::__undetermined_all__()) { + for (e in LombokField(__all_data__), + c in CallExpression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (e = c.getLombokField()) { + let (tmp = CallExpression(__all_data__).find(e)) { + if (!isDirectCall(tmp)) { + if (n = c.getMethodName()) { + if (!n.matches("get.*")) { + if (direction = "Depends") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + } + } + } + } + } + } + + pub fn getAnAncestorCDDependsNode(self, type: string, direction: string) -> ECGNode { + for (e in ECGNode(__all_data__), + c in Callable(__all_data__), + r in ReferenceExpression(__all_data__)) { + if (type = "CD") { + if (self.key_eq(c)) { + for (e1 in c.getAnAncestorCallee()) { + if (direction = "Depends") { + if (e.key_eq(e1)) { + return e + } + } + } + } + if (self.key_eq(r.getDefinition())) { + if (c = r.getEnclosingCallable()) { + for (e1 in c.getAnAncestorCallee()) { + if (direction = "Depends") { + if (e.key_eq(e1)) { + return e + } + } + } + } + } + } + } + } + + pub fn getPath(self) -> string { + for (line in int::__undetermined_all__(), + t in string::__undetermined_all__(), + path in string::__undetermined_all__(), + info in string::__undetermined_all__()) { + for (l in coref::java::Location(__all_data__)) { + if (l = self.getLocation()) { + if (path = l.getFile().getRelativePath()) { + if (line = l.getStartLineNumber()) { + if (t = line.to_string()) { + if (info = path + ":" + t) { + return info + } + } + } + } + } + } + } + } + + fn tmp_0(n: string) -> bool { + if (n.matches("get.*")) { + return true + } + } +} + +schema ECGXmlNode { + @primary id: int +} + +impl ECGXmlNode { + pub fn __all__(db: XmlDB) -> *ECGXmlNode { + for (e in XmlPomElement(db)) { + yield ECGXmlNode {id : e.id} + } + for (e in XmlSpringElement(db)) { + yield ECGXmlNode {id : e.id} + } + for (e in XmlCharacter(db)) { + yield ECGXmlNode {id : e.id} + } + for (e in XmlAttribute(db)) { + yield ECGXmlNode {id : e.id} + } + } + + pub fn getLocation(self) -> coref::xml::Location { + for (l in coref::xml::Location(__all_data__)) { + for (e in XmlElement(__all_data__)) { + if (self.key_eq(e)) { + if (l = e.getLocation()) { + return l + } + } + } + for (e in XmlAttribute(__all_data__)) { + if (self.key_eq(e)) { + if (l = e.getLocation()) { + return l + } + } + } + for (e in XmlCharacter(__all_data__)) { + if (self.key_eq(e)) { + if (l = e.getLocation()) { + return l + } + } + } + } + } + + pub fn getType(self) -> string { + for (t in string::__undetermined_all__()) { + for (e in XmlElement(__all_data__)) { + if (self.key_eq(e)) { + if (t = "XmlElement") { + return t + } + } + } + for (e in XmlAttribute(__all_data__)) { + if (self.key_eq(e)) { + if (t = "XmlAttribute") { + return t + } + } + } + for (e in XmlCharacter(__all_data__)) { + if (self.key_eq(e)) { + if (t = "XmlCharacter") { + return t + } + } + } + } + } + + pub fn getText(self) -> string { + for (e in XmlElement(__all_data__)) { + if (self.key_eq(e)) { + return e.getName() + } + } + for (e in XmlAttribute(__all_data__)) { + if (self.key_eq(e)) { + return e.getName() + " = " + e.getValue() + } + } + for (e in XmlCharacter(__all_data__)) { + if (self.key_eq(e)) { + return e.getText() + } + } + } + + pub fn getEnclosingECGXmlNode(self) -> ECGXmlNode { + for (e in XmlElement(__all_data__)) { + if (self.key_eq(e)) { + return e.to() + } + } + for (e in XmlAttribute(__all_data__)) { + if (self.key_eq(e)) { + return e.getXmlElement().to() + } + } + for (e in XmlCharacter(__all_data__)) { + if (self.key_eq(e)) { + return e.getBelongedElement().to() + } + } + } +} + +pub fn gitdiff(filePath: string, lineNo: int) -> bool { + // #changeinfo + // example + [ {"test", 1111}] +} +pub fn transfertofile1(f: File, filename: string, lineNumber: int) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + if (gitdiff(filename, lineNumber)) { + if (!filename.contains("src/test/java")) { + if (filename = f.getRelativePath()) { + if (isCodeLine(f, filename, lineNumber)) { + return true + } + } + } + } + } + } +} +pub fn transfertofile(f: File, filename: string, lineNumber: int) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + if (transfertofile1(f, filename, lineNumber)) { + if (!findSpecialCodeType(filename, lineNumber, __all_data__)) { + return true + } + } + } + } +} +pub fn isComment(filename: string, lineNumber: int) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (f in File(java_db)) { + if (transfertofile1(f, filename, lineNumber)) { + for (e in int::__undetermined_all__(), + s1 in int::__undetermined_all__()) { + for (c in Comment(java_db)) { + if (c.getLocation().getFile() = f) { + if (s1 = c.getLocation().getStartLineNumber()) { + if (e = c.getLocation().getEndLineNumber()) { + if (lineNumber > s1 - 1) { + if (lineNumber < e + 1) { + return true + } + } + } + } + } + } + } + for (e in int::__undetermined_all__(), + s1 in int::__undetermined_all__()) { + for (c in JavadocComment(java_db)) { + if (c.getLocation().getFile() = f) { + if (s1 = c.getLocation().getStartLineNumber()) { + if (e = c.getLocation().getEndLineNumber()) { + if (lineNumber > s1 - 1) { + if (lineNumber < e + 1) { + return true + } + } + } + } + } + } + } + } + } + } + } +} +pub fn isAnnotation(filename: string, lineNumber: int) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (f in File(java_db)) { + if (transfertofile1(f, filename, lineNumber)) { + for (e in int::__undetermined_all__(), + s1 in int::__undetermined_all__()) { + for (c in Annotation(java_db)) { + if (c.getLocation().getFile() = f) { + if (s1 = c.getLocation().getStartLineNumber()) { + if (e = c.getLocation().getEndLineNumber()) { + if (lineNumber > s1 - 1) { + if (lineNumber < e + 1) { + return true + } + } + } + } + } + } + } + } + } + } + } +} +pub fn isCodeLine(f: File, filename: string, lineNumber: int) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + if (gitdiff(filename, lineNumber)) { + if (f.getRelativePath() = filename) { + for (e in int::__undetermined_all__(), + s1 in int::__undetermined_all__()) { + for (l in coref::java::Location(java_db)) { + if (l.getFile() = f) { + if (s1 = l.getStartLineNumber()) { + if (e = l.getEndLineNumber()) { + if (lineNumber > s1 - 1) { + if (lineNumber < e + 1) { + return true + } + } + } + } + } + } + } + } + } + } + } +} +pub fn isLog(filename: string, lineNumber: int) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (f in File(java_db)) { + if (transfertofile1(f, filename, lineNumber)) { + for (e in int::__undetermined_all__(), + s1 in int::__undetermined_all__(), + text in string::__undetermined_all__()) { + for (c in Expression(java_db)) { + if (c.getLocation().getFile() = f) { + if (s1 = c.getLocation().getStartLineNumber()) { + if (e = c.getLocation().getEndLineNumber()) { + if (lineNumber > s1 - 1) { + if (lineNumber < e + 1) { + if (text = c.getPrintableText()) { + if (text.matches("^logger\\..*")) { + return true + } + } + } + } + } + } + } + } + } + } + } + } + } +} +pub fn getTypeInAST(filename: string, lineNumber: int, typeInAST: string) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (f in File(java_db)) { + if (transfertofile(f, filename, lineNumber)) { + for (e in int::__undetermined_all__(), + s1 in int::__undetermined_all__()) { + for (c in ElementParent(java_db)) { + if (c.getLocation().getFile() = f) { + if (s1 = c.getLocation().getStartLineNumber()) { + if (e = c.getLocation().getEndLineNumber()) { + if (s1 = e) { + if (lineNumber > s1 - 1) { + if (lineNumber < e + 1) { + if (typeInAST = c.getType()) { + return true + } + } + } + } + } + } + } + } + } + } + } + } + } +} +pub fn getTypeInECG(filename: string, lineNumber: int, typeInAST: string, n: ECGNode) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (f in File(java_db)) { + if (transfertofile(f, filename, lineNumber)) { + if (tmp_0(filename, lineNumber)) { + if (typeInAST = "Callable") { + if (getBelongedCallable(filename, lineNumber, Callable(java_db).find(n))) { + return true + } + } + } + if (!(tmp_0(filename, lineNumber))) { + for (e in int::__undetermined_all__(), + s1 in int::__undetermined_all__()) { + if (n.getLocation().getFile() = f) { + if (s1 = n.getLocation().getStartLineNumber()) { + if (e = n.getLocation().getEndLineNumber()) { + if (lineNumber > s1 - 1) { + if (lineNumber < e + 1) { + if (typeInAST = n.getType()) { + if (isFieldOrEnum(ECGNode(java_db).find(n))) { + return true + } + } + } + } + } + } + } + } + } + } + } + } + } +} +pub fn isFieldOrEnum(c: ECGNode) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (f in Field(java_db)) { + if (f.key_eq(c)) { + return true + } + } + for (e in EnumConstant(java_db)) { + if (e.key_eq(c)) { + return true + } + } + } + } +} +pub fn findSpecialCodeType(filename: string, lineNumber: int, type: string) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + if (isComment(filename, lineNumber)) { + if (type = "comment") { + return true + } + } + if (isAnnotation(filename, lineNumber)) { + if (type = "annotation") { + return true + } + } + if (isLog(filename, lineNumber)) { + if (type = "log") { + return true + } + } + } + } +} +pub fn getBelongedCallable(filename: string, lineNumber: int, c: Callable) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (f in File(java_db)) { + if (transfertofile(f, filename, lineNumber)) { + for (l1 in int::__undetermined_all__(), + l2 in int::__undetermined_all__()) { + for (i in Identifier(java_db)) { + if (f = c.getLocation().getFile()) { + if (c.key_eq(i.getParent())) { + if (l1 = i.getLocation().getStartLineNumber()) { + if (l2 = c.getLocation().getEndLineNumber()) { + if (lineNumber > l1 - 1) { + if (lineNumber < l2 + 1) { + return true + } + } + } + } + } + } + } + } + } + } + } + } +} +pub fn getBelongedCallableSignature(filename: string, lineNumber: int, belongedCallable: string) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (i in int::__undetermined_all__()) { + for (c in Callable(java_db)) { + if (transfertofile(__all_data__, filename, lineNumber)) { + if (i = tmp_1().len()) { + if (tmp_2(i)) { + if (belongedCallable = "") { + return true + } + } + if (!(tmp_2(i))) { + if (getBelongedCallable(filename, lineNumber, c)) { + if (belongedCallable = c.getSignature()) { + return true + } + } + } + } + } + } + } + } + } +} +pub fn getJavaECGNode(n: ECGNode) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (lineNumber in int::__undetermined_all__(), + filename in string::__undetermined_all__(), + typeInAST in string::__undetermined_all__(), + belongedCallable in string::__undetermined_all__()) { + if (transfertofile(__all_data__, filename, lineNumber)) { + if (getBelongedCallableSignature(filename, lineNumber, belongedCallable)) { + if (getTypeInECG(filename, lineNumber, typeInAST, n)) { + return true + } + } + } + } + } + } +} +pub fn transfertoXmlfile(f: XmlFile, filename: string, lineNumber: int) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + if (gitdiff(filename, lineNumber)) { + if (filename = f.getRelativePath()) { + return true + } + } + } + } +} +pub fn getXmlECGNode1(n: ECGXmlNode) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (lineNumber in int::__undetermined_all__(), + e in int::__undetermined_all__(), + s1 in int::__undetermined_all__(), + filename in string::__undetermined_all__(), + typeInAST in string::__undetermined_all__(), + text in string::__undetermined_all__()) { + for (f in XmlFile(xml_db), + o in ECGXmlNode(xml_db)) { + if (transfertoXmlfile(f, filename, lineNumber)) { + if (n.getLocation().getFile() = f) { + if (s1 = n.getLocation().getStartLineNumber()) { + if (e = n.getLocation().getEndLineNumber()) { + if (lineNumber > s1 - 1) { + if (lineNumber < e + 1) { + if (typeInAST = n.getType()) { + if (text = n.getText()) { + if (o = n.getEnclosingECGXmlNode()) { + return true + } + } + } + } + } + } + } + } + } + } + } + } + } +} +@inline +pub fn trim(n: string, m: string) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (i in int::__undetermined_all__()) { + if (i = n.len()) { + if (tmp_3(n)) { + if (m = n.substr(1,i - 2)) { + return true + } + } + if (!(tmp_3(n))) { + if (m = n) { + return true + } + } + } + } + } + } +} +pub fn getXmlECGNode(f: ECGNode) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (c in ClassOrInterface(java_db), + n in string::__undetermined_all__(), + m in string::__undetermined_all__()) { + for (r in ECGXmlNode(xml_db)) { + if (getXmlECGNode1(r)) { + if (getChangeSetByDalXmlElement(r, c, Method(java_db).find(f), n, m)) { + return true + } + if (getChangeSetByResultXmlElement(r, c, Field(java_db).find(f), n, m)) { + return true + } + } + } + } + } + } +} +pub fn getChangeSetByResultXmlElement(r1: ECGXmlNode, c: ClassOrInterface, f: Field, n: string, m: string) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (r in ResultXmlElement(xml_db)) { + if (r.key_eq(r1)) { + if (getXmlECGNode1(ECGXmlNode(xml_db).find(r))) { + if (n = r.getBelongedMapXmlElement().getMappingClassName()) { + if (n = c.getQualifiedName()) { + if (c = f.getParent()) { + if (r.getValueByAttributeName("property") = f.getName()) { + if (m = f.getName()) { + return true + } + } + } + } + } + } + } + } + } + } +} +pub fn getChangeSetByDalXmlElement(d1: ECGXmlNode, c: ClassOrInterface, m: Method, className: string, methodName: string) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (i in int::__undetermined_all__(), + temp in string::__undetermined_all__(), + temp1 in string::__undetermined_all__(), + n in string::__undetermined_all__()) { + for (d in DalXmlElement(xml_db), + cc in XmlComment(xml_db), + l in Literal(java_db)) { + if (d.key_eq(d1)) { + if (getXmlECGNode1(ECGXmlNode(xml_db).find(d))) { + if (d.getLocation().getFile() = cc.getLocation().getFile()) { + if (cc.getLocation().getEndLineNumber() = i) { + if (i + 1 = d.getLocation().getStartLineNumber()) { + if (temp = cc.getText()) { + if (c.getName() = temp.get_regex_match_result("[\\s\\S]*mapped statement for[ \\t]+(\\w+)[\\s\\S]*", 1)) { + if (n = d.getValueByAttributeName("id")) { + if (c.key_eq(m.getBelongedClass())) { + if (m.key_eq(l.getEnclosingCallable())) { + if (temp1 = l.getValue()) { + if (trim(temp1, n)) { + if (className = c.getQualifiedName()) { + if (methodName = m.getSignature()) { + return true + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } +} +schema SofaService extends Annotation { + +} + +impl SofaService { + + @data_constraint + @inline + pub fn __all__(db: JavaDB) -> *SofaService { + for (tmp in Annotation(db)) { + if (tmp.getName() = "SofaService") { + yield SofaService { + id : tmp.id + } + } + } + } + + pub fn getService(self) -> ClassOrInterface { + for (value in string::__undetermined_all__()) { + for (i in ClassOrInterface(__all_data__), + argus in AnnotationAccessArgument(__all_data__)) { + for (auto_tmp1 in self.getAnnotationArgument()) { + if (argus = auto_tmp1) { + if (argus.getAnnotationArgumentName() = "interfaceType") { + if (value = argus.getAnnotationArgumentValue()) { + if (i.getQualifiedName() = value) { + return i + } + } + } + } + } + } + } + } + + @inline + pub fn getBinding(self) -> SofaServiceBinding { + for (b in SofaServiceBinding(__all_data__), + argus in AnnotationAccessArgument(__all_data__)) { + for (auto_tmp1 in self.getAnnotationArgument()) { + if (argus = auto_tmp1) { + if (argus.getAnnotationArgumentName() = "bindings") { + if (b.key_eq(argus.getArgumentAnnotation())) { + return b + } + if (argus.key_eq(b.getParent())) { + return b + } + } + } + } + } + } + + @inline + pub fn getUniqueId(self) -> string { + for (uniqueId in string::__undetermined_all__()) { + for (anno in Annotation(__all_data__)) { + if (self.key_eq(anno)) { + if (tmp_6(anno)) { + for (argus in AnnotationAccessArgument(__all_data__)) { + for (auto_tmp1 in anno.getAnnotationArgument()) { + if (argus = auto_tmp1) { + if (argus.getAnnotationArgumentName() = "uniqueId") { + if (uniqueId = argus.getAnnotationArgumentValue()) { + return uniqueId + } + } + } + } + } + } + if (!(tmp_6(anno))) { + if (uniqueId = "null") { + return uniqueId + } + } + } + } + } + } + + +} + +pub fn uniqueArgument(anno: Annotation) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (argus in AnnotationAccessArgument(java_db)) { + for (auto_tmp1 in anno.getAnnotationArgument()) { + if (argus = auto_tmp1) { + if (argus.getAnnotationArgumentName() = "uniqueId") { + return true + } + } + } + } + } + } +} +schema SofaServiceBinding extends Annotation { + +} + +impl SofaServiceBinding { + + @data_constraint + @inline + pub fn __all__(db: JavaDB) -> *SofaServiceBinding { + for (tmp in Annotation(db)) { + if (tmp.getName() = "SofaServiceBinding") { + yield SofaServiceBinding { + id : tmp.id + } + } + } + } + + pub fn getType(self) -> string { + for (value in string::__undetermined_all__()) { + for (argus in AnnotationAccessArgument(__all_data__)) { + for (auto_tmp1 in self.getAnnotationArgument()) { + if (argus = auto_tmp1) { + if (argus.getAnnotationArgumentName() = "bindingType") { + if (value = argus.getAnnotationArgumentValue()) { + return value + } + } + } + } + } + } + } + + +} + +pub fn javaOutput(classname: string, name: string) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (s in SofaService(java_db), + c in Class(java_db), + i in ClassOrInterface(java_db)) { + for (auto_tmp1 in c.getAnnotation()) { + if (s.key_eq(auto_tmp1)) { + if (classname = c.getQualifiedName()) { + for (auto_tmp2 in c.getImplementsInterface()) { + if (i.key_eq(auto_tmp2)) { + if (name = i.getQualifiedName()) { + return true + } + } + } + if (i = s.getService()) { + if (name = i.getQualifiedName()) { + return true + } + } + } + } + } + } + } + } +} +pub fn xmlOutput(className: string, interfaceName: string) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (temp in string::__undetermined_all__()) { + for (s in SofaServiceXmlElement(xml_db), + b in BeanXmlElement(xml_db)) { + if (s.getRef() = b.getId()) { + if (interfaceName = s.getInterfaceName()) { + if (className = b.getClass()) { + if (temp = b.getLocation().getFile().getRelativePath()) { + if (!temp.contains("src/test/resources")) { + return true + } + } + } + } + } + } + } + } + } +} +pub fn annoOutput(className: string, interfaceName: string) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (v in string::__undetermined_all__(), + k in string::__undetermined_all__()) { + for (s in SofaServiceXmlElement(xml_db), + b in Class(java_db), + t in TagXmlElement(xml_db), + a in Annotation(java_db)) { + if (s.key_eq(t.getParent())) { + if (v = s.getRef()) { + if (interfaceName = s.getInterfaceName()) { + for (auto_tmp1 in b.getAnnotation()) { + if (a = auto_tmp1) { + if (a.getName() = k) { + if (getTrAnnotationName(k)) { + for (auto_tmp2 in a.getAnnotationArgument()) { + if (auto_tmp2.getAnnotationArgumentValue() = "\"" + v + "\"") { + if (className = b.getQualifiedName()) { + return true + } + } + } + } + } + } + } + } + } + } + } + } + } + } +} +pub fn getTrAnnotationName(a: string) -> bool { + [ + {"Service"}, + {"Component"}, + {"Scope"}, + {"Repository"}, + {"Controller"}, + {"RestController"}, + {"RequestMapping"}, + {"PathVariable"}, + {"ResponseBody"}, + {"bean"} + ] +} +pub fn getPublishTr(c: ClassOrInterface) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (className in string::__undetermined_all__(), + interfaceName in string::__undetermined_all__()) { + if (xmlOutput(className, interfaceName)) { + if (interfaceName = c.getQualifiedName()) { + return true + } + } + if (javaOutput(className, interfaceName)) { + if (interfaceName = c.getQualifiedName()) { + return true + } + } + if (annoOutput(className, interfaceName)) { + if (interfaceName = c.getQualifiedName()) { + return true + } + } + } + } + } +} +pub fn real_output(c: ClassOrInterface, n: ECGNode, interfaceName: string, nodeName: string) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (m in ECGNode(java_db)) { + if (getJavaECGNode(m)) { + if (getPublishTr(c)) { + for (t in Method(java_db)) { + if (n.key_eq(t)) { + if (c = t.getParent()) { + if (n = m.getAnAncestorCDDependedNode(__all_data__, __all_data__)) { + if (interfaceName = c.getQualifiedName()) { + if (nodeName = n.print()) { + return true + } + } + } + } + } + } + for (f in Field(java_db)) { + if (n.key_eq(f)) { + if (c = f.getParent()) { + if (n = m.getAnAncestorCDDependedNode(__all_data__, __all_data__)) { + if (interfaceName = c.getQualifiedName()) { + if (nodeName = n.print()) { + return true + } + } + } + } + } + } + } + } + if (getXmlECGNode(m)) { + if (getPublishTr(c)) { + for (t in Method(java_db)) { + if (n.key_eq(t)) { + if (c = t.getParent()) { + if (n = m.getAnAncestorCDDependedNode(__all_data__, __all_data__)) { + if (interfaceName = c.getQualifiedName()) { + if (nodeName = n.print()) { + return true + } + } + } + } + } + } + for (f in Field(java_db)) { + if (n.key_eq(f)) { + if (c = f.getParent()) { + if (n = m.getAnAncestorCDDependedNode(__all_data__, __all_data__)) { + if (interfaceName = c.getQualifiedName()) { + if (nodeName = n.print()) { + return true + } + } + } + } + } + } + } + } + } + } + } +} + + +fn default_java_db() -> JavaDB { + return JavaDB::load("coref_java_src.db") +} + +fn default_xml_db() -> XmlDB { + return XmlDB::load("coref_xml_src.db") +} + +fn tmp_0(filename: string, lineNumber: int) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + if (getBelongedCallable(filename, lineNumber, __all_data__)) { + return true + } + } + } +} + +fn tmp_1() -> *string { + for (filename in string::__undetermined_all__(), lineNumber in int::__undetermined_all__()) { + if (getBelongedCallable(filename, lineNumber, __all_data__)) { + yield filename + } + } +} + +fn tmp_2(i: int) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + if (i = 0) { + return true + } + } + } +} + +fn tmp_3(n: string) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + if (n.substr(0,1) = "\"") { + return true + } + } + } +} + +fn tmp_4(anno: Annotation) -> *auto_tmp_5 { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + if (uniqueArgument(anno)) { + yield auto_tmp_5 { + + } + } + } + } +} + +schema auto_tmp_5 { + +} + +fn tmp_6(anno: Annotation) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + if (tmp_4(anno).len() = 1) { + return true + } + } + } +} + +fn main() { + output(real_output()) +} \ No newline at end of file diff --git a/example/icse25/rules/rule2.gdl b/example/icse25/rules/rule2.gdl new file mode 100644 index 00000000..65dc1de1 --- /dev/null +++ b/example/icse25/rules/rule2.gdl @@ -0,0 +1,838 @@ +// script +use coref::java::* + +schema ECGNode extends ElementParent {} + +impl ECGNode { + pub fn __all__(db: JavaDB) -> *ECGNode { + for (tmp in ElementParent(db)) { + for (m in Method(db)) { + if (tmp.key_eq(m)) { + yield ECGNode { + id : tmp.id + } + } + } + for (m in Variable(db)) { + if (tmp.key_eq(m)) { + yield ECGNode { + id : tmp.id + } + } + } + for (m in Expression(db)) { + if (tmp.key_eq(m)) { + yield ECGNode { + id : tmp.id + } + } + } + } + } + + pub fn getType(self) -> string { + for (t in string::__undetermined_all__()) { + for (m in Method(__all_data__)) { + if (self.key_eq(m)) { + if (t = "Method") { + return t + } + } + } + for (m in LocalVariable(__all_data__)) { + if (self.key_eq(m)) { + if (t = "LocalVariable") { + return t + } + } + } + for (m in Parameter(__all_data__)) { + if (self.key_eq(m)) { + if (t = "Parameter") { + return t + } + } + } + for (m in Field(__all_data__)) { + if (self.key_eq(m)) { + if (t = "Field") { + return t + } + } + } + for (m in EnumConstant(__all_data__)) { + if (self.key_eq(m)) { + if (t = "EnumConstant") { + return t + } + } + } + for (m in Expression(__all_data__)) { + if (self.key_eq(m)) { + if (t = m.getType()) { + return t + } + } + } + } + } + + pub fn getDDNode(self, type: string, direction: string) -> ECGNode { + for (e1 in ECGNode(__all_data__)) { + for (e in Parameter(__all_data__), + c in Method(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + for (auto_tmp1 in c.getParameter()) { + if (e = auto_tmp1) { + if (direction = "Depended") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + for (r in ReturnStatement(__all_data__), + c in Method(__all_data__), + e in Expression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (c.key_eq(r.getEnclosingCallable())) { + if (e = r.getResult()) { + if (direction = "Depends") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + for (c in Callable(__all_data__), + e in Field(__all_data__), + r in ReferenceExpression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (c = r.getEnclosingCallable()) { + if (e.key_eq(r.getDefinition())) { + if (direction = "Depended") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + for (c in Callable(__all_data__), + e in EnumConstant(__all_data__), + r in ReferenceExpression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (c = r.getEnclosingCallable()) { + if (e.key_eq(r.getDefinition())) { + if (direction = "Depended") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + for (e in Callable(__all_data__), + c in Field(__all_data__), + r in ReferenceExpression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (c.key_eq(r.getDefinition())) { + if (e = r.getEnclosingCallable()) { + if (direction = "Depends") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + for (e in Callable(__all_data__), + c in EnumConstant(__all_data__), + r in ReferenceExpression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (c.key_eq(r.getDefinition())) { + if (e = r.getEnclosingCallable()) { + if (direction = "Depends") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + for (c in Callable(__all_data__), + e in CallExpression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (c = e.getEnclosingCallable()) { + for (m in Method(__all_data__)) { + if (m = e.getMethod()) { + if (!isDirectCall(e)) { + if (direction = "Depended") { + if (type = "DD") { + return e1 + } + } + } + } + } + for (f in LombokField(__all_data__)) { + if (f = e.getLombokField()) { + if (!isDirectCall(e)) { + if (direction = "Depended") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + } + } + for (n in string::__undetermined_all__()) { + for (e in LombokField(__all_data__), + c in CallExpression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (e = c.getLombokField()) { + let (tmp_find = CallExpression(__all_data__).find(e)) { + if (!isDirectCall(tmp_find)) { + if (n = c.getMethodName()) { + if (Self::tmp_0(n)) { + if (direction = "Depended") { + if (type = "DD") { + return e1 + } + } + } + if (!Self::tmp_0(n)) { + if (direction = "Depends") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + } + } + } + } + for (e in Variable(__all_data__), + c in CallExpression(__all_data__), + r in ReferenceExpression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (!isDirectCall(c)) { + for (auto_tmp2 in c.getArguments()) { + if (r.key_eq(auto_tmp2)) { + if (e.key_eq(r.getDefinition())) { + if (direction = "Depended") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + } + } + for (e in CallExpression(__all_data__), + c in CallExpression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (!isDirectCall(c)) { + for (auto_tmp3 in c.getArguments()) { + if (e.key_eq(auto_tmp3)) { + if (direction = "Depended") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + } + for (e in CallExpression(__all_data__), + c in CallExpression(__all_data__), + s in CallExpression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (!isDirectCall(c)) { + for (auto_tmp4 in c.getAnAncestor()) { + if (s.getReference().key_eq(auto_tmp4)) { + for (auto_tmp5 in s.getArguments()) { + if (auto_tmp5.key_eq(e)) { + if (direction = "Depended") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + } + } + } + } + } + + pub fn getAnAncestorDDNode(self, type: string, direction: string) -> ECGNode { + for (e in ECGNode(__all_data__)) { + if (type = "DD") { + if (e = self.getDDNode(type, direction)) { + return e + } + if (e = self.getAnAncestorDDNode(__all_data__, __all_data__).getDDNode(type, direction)) { + return e + } + } + } + } + + pub fn getCDNode(self, type: string, direction: string) -> ECGNode { + for (e in ECGNode(__all_data__), + c in Callable(__all_data__), + r in ReferenceExpression(__all_data__)) { + if (self.key_eq(c)) { + if (type = "CD") { + for (e1 in Method(__all_data__)) { + for (auto_tmp1 in c.getCallee()) { + if (e1.key_eq(auto_tmp1)) { + if (direction = "Depends") { + if (e.key_eq(e1)) { + return e + } + } + } + } + } + for (e2 in Method(__all_data__)) { + for (auto_tmp2 in c.getCaller()) { + if (e2.key_eq(auto_tmp2)) { + if (direction = "Depended") { + if (e.key_eq(e2)) { + return e + } + } + } + } + } + } + } + if (self.key_eq(r.getDefinition())) { + if (c = r.getEnclosingCallable()) { + if (type = "CD") { + for (e1 in Method(__all_data__)) { + for (auto_tmp1 in c.getCallee()) { + if (e1.key_eq(auto_tmp1)) { + if (direction = "Depends") { + if (e.key_eq(e1)) { + return e + } + } + } + } + } + for (e2 in Method(__all_data__)) { + for (auto_tmp2 in c.getCaller()) { + if (e2.key_eq(auto_tmp2)) { + if (direction = "Depended") { + if (e.key_eq(e2)) { + return e + } + } + } + } + } + } + } + } + } + } + + pub fn getAnAncestorCDNode(self, type: string, direction: string) -> ECGNode { + for (e in ECGNode(__all_data__), + c in Callable(__all_data__), + r in ReferenceExpression(__all_data__)) { + if (type = "CD") { + if (self.key_eq(c)) { + for (e1 in Method(__all_data__)) { + for (auto_tmp1 in c.getAnAncestorCallee()) { + if (e1.key_eq(auto_tmp1)) { + if (direction = "Depends") { + if (e.key_eq(e1)) { + return e + } + } + } + } + } + for (e2 in Method(__all_data__)) { + for (auto_tmp2 in c.getAnAncestorCaller()) { + if (e2.key_eq(auto_tmp2)) { + if (direction = "Depended") { + if (e.key_eq(e2)) { + return e + } + } + } + } + } + } + if (self.key_eq(r.getDefinition())) { + if (c = r.getEnclosingCallable()) { + for (e1 in Method(__all_data__)) { + for (auto_tmp1 in c.getAnAncestorCallee()) { + if (e1.key_eq(auto_tmp1)) { + if (direction = "Depends") { + if (e.key_eq(e1)) { + return e + } + } + } + } + } + for (e2 in Method(__all_data__)) { + for (auto_tmp2 in c.getAnAncestorCaller()) { + if (e2.key_eq(auto_tmp2)) { + if (direction = "Depended") { + if (e.key_eq(e2)) { + return e + } + } + } + } + } + } + } + } + } + } + + pub fn getECGNode(self, type: string, direction: string) -> ECGNode { + for (e in ECGNode(__all_data__)) { + if (e = self.getCDNode(type, direction)) { + return e + } + if (e = self.getDDNode(type, direction)) { + return e + } + } + } + + pub fn getAnAncestorECGNode(self, type: string, direction: string) -> ECGNode { + for (e in ECGNode(__all_data__), tmp in ECGNode(__all_data__)) { + if (tmp = self.getAnAncestorCDNode(__all_data__, __all_data__)) { + if (e = tmp.getECGNode(type, direction)) { + return e + } + } + } + } + + pub fn getAnAncestorCDDependedNode(self, type: string, direction: string) -> ECGNode { + for (e in ECGNode(__all_data__), c in Callable(__all_data__), r in ReferenceExpression(__all_data__)) { + if (type = "CD") { + if (self.key_eq(c) || (self.key_eq(r.getDefinition()) && r.getEnclosingCallable() = c)) { + for (e2 in Method(__all_data__), c_caller in c.getAnAncestorCaller()) { + if (e2.key_eq(c_caller) && direction = "Depended" && e.key_eq(e2)) { + return e + } + } + } + } + } + } + + pub fn getECGDependsNode(self, type: string, direction: string) -> ECGNode { + for (e in ECGNode(__all_data__)) { + if (e = self.getCDDependsNode(type, direction)) { + return e + } + if (e = self.getDDDependsNode(type, direction)) { + return e + } + } + } + + pub fn getCDDependsNode(self, type: string, direction: string) -> ECGNode { + for (e in ECGNode(__all_data__), + c in Callable(__all_data__), + r in ReferenceExpression(__all_data__)) { + if (self.key_eq(c)) { + if (type = "CD") { + for (e1 in c.getCallee()) { + if (direction = "Depends") { + if (e.key_eq(e1)) { + return e + } + } + } + } + } + for (v in Variable(__all_data__)) { + if (self.key_eq(v)) { + if (v.key_eq(r.getDefinition())) { + if (c = r.getEnclosingCallable()) { + if (type = "CD") { + for (e1 in c.getCallee()) { + if (direction = "Depends") { + if (e.key_eq(e1)) { + return e + } + } + } + } + } + } + } + } + } + } + + pub fn getDDDependsNode(self, type: string, direction: string) -> ECGNode { + for (e1 in ECGNode(__all_data__)) { + for (r in ReturnStatement(__all_data__), + c in Method(__all_data__), + e in Expression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (c.key_eq(r.getEnclosingCallable())) { + if (e = r.getResult()) { + if (direction = "Depends") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + for (e in Callable(__all_data__), + c in Field(__all_data__), + r in ReferenceExpression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (c.key_eq(r.getDefinition())) { + if (e = r.getEnclosingCallable()) { + if (direction = "Depends") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + for (e in Callable(__all_data__), + c in EnumConstant(__all_data__), + r in ReferenceExpression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (c.key_eq(r.getDefinition())) { + if (e = r.getEnclosingCallable()) { + if (direction = "Depends") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + for (n in string::__undetermined_all__()) { + for (e in LombokField(__all_data__), + c in CallExpression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (e = c.getLombokField()) { + let (tmp = CallExpression(__all_data__).find(e)) { + if (!isDirectCall(tmp)) { + if (n = c.getMethodName()) { + if (!n.matches("get.*")) { + if (direction = "Depends") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + } + } + } + } + } + } + + pub fn getAnAncestorCDDependsNode(self, type: string, direction: string) -> ECGNode { + for (e in ECGNode(__all_data__), + c in Callable(__all_data__), + r in ReferenceExpression(__all_data__)) { + if (type = "CD") { + if (self.key_eq(c)) { + for (e1 in c.getAnAncestorCallee()) { + if (direction = "Depends") { + if (e.key_eq(e1)) { + return e + } + } + } + } + if (self.key_eq(r.getDefinition())) { + if (c = r.getEnclosingCallable()) { + for (e1 in c.getAnAncestorCallee()) { + if (direction = "Depends") { + if (e.key_eq(e1)) { + return e + } + } + } + } + } + } + } + } + + pub fn getPath(self) -> string { + for (line in int::__undetermined_all__(), + t in string::__undetermined_all__(), + path in string::__undetermined_all__(), + info in string::__undetermined_all__()) { + for (l in coref::java::Location(__all_data__)) { + if (l = self.getLocation()) { + if (path = l.getFile().getRelativePath()) { + if (line = l.getStartLineNumber()) { + if (t = line.to_string()) { + if (info = path + ":" + t) { + return info + } + } + } + } + } + } + } + } + + fn tmp_0(n: string) -> bool { + if (n.matches("get.*")) { + return true + } + } +} + +pub fn getJavaECGNode(node: int) -> bool { + // #javaecgnode + // example + [ {1111} ] +} +pub fn getResponseType(t: ReferenceType) -> bool { + let (java_db = default_java_db()) { + for (r in string::__undetermined_all__()) { + for (i in ClassOrInterface(java_db), + c in ClassOrInterface(java_db)) { + if (r in c.getImplementsList()) { + if (r = "implements Response") { + for (auto_tmp1 in i.getAnAscentantClassOrInterface()) { + if (c = auto_tmp1) { + if (t.getQualifiedName() = i.getQualifiedName()) { + return true + } + } + } + if (c = i) { + if (t.getQualifiedName() = i.getQualifiedName()) { + return true + } + } + } + } + if (c.getName() = "BaseResponse") { + for (auto_tmp1 in i.getAnAscentantClassOrInterface()) { + if (c = auto_tmp1) { + if (t.getQualifiedName() = i.getQualifiedName()) { + return true + } + } + } + if (c = i) { + if (t.getQualifiedName() = i.getQualifiedName()) { + return true + } + } + } + if (c.getName() = "HttpResponse") { + for (auto_tmp1 in i.getAnAscentantClassOrInterface()) { + if (c = auto_tmp1) { + if (t.getQualifiedName() = i.getQualifiedName()) { + return true + } + } + } + if (c = i) { + if (t.getQualifiedName() = i.getQualifiedName()) { + return true + } + } + } + } + } + } +} +pub fn getResponseMethod(m: Method) -> bool { + let (java_db = default_java_db()) { + for (a in string::__undetermined_all__(), + b in string::__undetermined_all__(), + l in string::__undetermined_all__()) { + for (t in ReferenceType(java_db)) { + if (getResponseType(t)) { + if (m.getType().key_eq(t)) { + if (l = m.getLocation().getFile().getRelativePath()) { + if (!l.contains("src/test/java")) { + return true + } + } + } + if (b = m.getType().getName()) { + if (a = t.getName()) { + if (b.contains(a)) { + if (l = m.getLocation().getFile().getRelativePath()) { + if (!l.contains("src/test/java")) { + return true + } + } + } + } + } + } + } + } + } +} +pub fn temp(a: ECGNode, b: ECGNode, c: ECGNode, edgeType: string, direction: string) -> bool { + let (java_db = default_java_db()) { + if (getJavaECGNode(a.id)) { + if (b = a.getAnAncestorCDNode(__all_data__, __all_data__)) { + if (c = b.getECGNode(edgeType, direction)) { + if (b != c) { + return true + } + } + } + if (b = a) { + if (c = b.getECGNode(edgeType, direction)) { + if (b != c) { + return true + } + } + } + } + } +} +pub fn temp1(c: Callable) -> bool { + let (java_db = default_java_db()) { + for (a in Callable(java_db)) { + if (getResponseMethod(Method(java_db).find(a))) { + for (auto_tmp1 in a.getAnAncestorCaller()) { + if (c = auto_tmp1) { + return true + } + } + if (c = a) { + return true + } + } + } + } +} +pub fn temp2(a: ECGNode, b: ECGNode, c: ECGNode, direction: string, edgeType: string) -> bool { + let (java_db = default_java_db()) { + if (getJavaECGNode(a.id)) { + if (b = a.getAnAncestorCDNode(__all_data__, "Depended")) { + if (c = b.getECGNode(edgeType, "Depended")) { + if (temp1(Callable(java_db).find(c))) { + if (b != c) { + if (direction = "Depended") { + return true + } + } + } + } + } + if (b = a) { + if (c = b.getECGNode(edgeType, "Depended")) { + if (temp1(Callable(java_db).find(c))) { + if (b != c) { + if (direction = "Depended") { + return true + } + } + } + } + } + } + } +} +pub fn real_output(m: ECGNode, nodeType1: string, nodeText1: string, n: ECGNode, nodeType2: string, nodeText2: string, edgeType: string, direction: string) -> bool { + let (java_db = default_java_db()) { + for (e in ECGNode(java_db)) { + if (temp2(e, m, n, edgeType, direction)) { + if (nodeType1 = m.getType()) { + if (nodeText1 = m.print()) { + if (nodeText2 = n.print()) { + if (nodeType2 = n.getType()) { + return true + } + } + } + } + } + } + } +} + + +fn default_java_db() -> JavaDB { + return JavaDB::load("coref_java_src.db") +} + +fn main() { + output(real_output()) +} \ No newline at end of file diff --git a/example/icse25/rules/rule3.gdl b/example/icse25/rules/rule3.gdl new file mode 100644 index 00000000..3a25f795 --- /dev/null +++ b/example/icse25/rules/rule3.gdl @@ -0,0 +1,715 @@ +// script +use coref::java::* + +schema ECGNode extends ElementParent {} + +impl ECGNode { + pub fn __all__(db: JavaDB) -> *ECGNode { + for (tmp in ElementParent(db)) { + for (m in Method(db)) { + if (tmp.key_eq(m)) { + yield ECGNode { + id : tmp.id + } + } + } + for (m in Variable(db)) { + if (tmp.key_eq(m)) { + yield ECGNode { + id : tmp.id + } + } + } + for (m in Expression(db)) { + if (tmp.key_eq(m)) { + yield ECGNode { + id : tmp.id + } + } + } + } + } + + pub fn getType(self) -> string { + for (t in string::__undetermined_all__()) { + for (m in Method(__all_data__)) { + if (self.key_eq(m)) { + if (t = "Method") { + return t + } + } + } + for (m in LocalVariable(__all_data__)) { + if (self.key_eq(m)) { + if (t = "LocalVariable") { + return t + } + } + } + for (m in Parameter(__all_data__)) { + if (self.key_eq(m)) { + if (t = "Parameter") { + return t + } + } + } + for (m in Field(__all_data__)) { + if (self.key_eq(m)) { + if (t = "Field") { + return t + } + } + } + for (m in EnumConstant(__all_data__)) { + if (self.key_eq(m)) { + if (t = "EnumConstant") { + return t + } + } + } + for (m in Expression(__all_data__)) { + if (self.key_eq(m)) { + if (t = m.getType()) { + return t + } + } + } + } + } + + pub fn getDDNode(self, type: string, direction: string) -> ECGNode { + for (e1 in ECGNode(__all_data__)) { + for (e in Parameter(__all_data__), + c in Method(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + for (auto_tmp1 in c.getParameter()) { + if (e = auto_tmp1) { + if (direction = "Depended") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + for (r in ReturnStatement(__all_data__), + c in Method(__all_data__), + e in Expression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (c.key_eq(r.getEnclosingCallable())) { + if (e = r.getResult()) { + if (direction = "Depends") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + for (c in Callable(__all_data__), + e in Field(__all_data__), + r in ReferenceExpression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (c = r.getEnclosingCallable()) { + if (e.key_eq(r.getDefinition())) { + if (direction = "Depended") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + for (c in Callable(__all_data__), + e in EnumConstant(__all_data__), + r in ReferenceExpression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (c = r.getEnclosingCallable()) { + if (e.key_eq(r.getDefinition())) { + if (direction = "Depended") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + for (e in Callable(__all_data__), + c in Field(__all_data__), + r in ReferenceExpression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (c.key_eq(r.getDefinition())) { + if (e = r.getEnclosingCallable()) { + if (direction = "Depends") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + for (e in Callable(__all_data__), + c in EnumConstant(__all_data__), + r in ReferenceExpression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (c.key_eq(r.getDefinition())) { + if (e = r.getEnclosingCallable()) { + if (direction = "Depends") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + for (c in Callable(__all_data__), + e in CallExpression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (c = e.getEnclosingCallable()) { + for (m in Method(__all_data__)) { + if (m = e.getMethod()) { + if (!isDirectCall(e)) { + if (direction = "Depended") { + if (type = "DD") { + return e1 + } + } + } + } + } + for (f in LombokField(__all_data__)) { + if (f = e.getLombokField()) { + if (!isDirectCall(e)) { + if (direction = "Depended") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + } + } + for (n in string::__undetermined_all__()) { + for (e in LombokField(__all_data__), + c in CallExpression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (e = c.getLombokField()) { + let (tmp_find = CallExpression(__all_data__).find(e)) { + if (!isDirectCall(tmp_find)) { + if (n = c.getMethodName()) { + if (Self::tmp_0(n)) { + if (direction = "Depended") { + if (type = "DD") { + return e1 + } + } + } + if (!Self::tmp_0(n)) { + if (direction = "Depends") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + } + } + } + } + for (e in Variable(__all_data__), + c in CallExpression(__all_data__), + r in ReferenceExpression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (!isDirectCall(c)) { + for (auto_tmp2 in c.getArguments()) { + if (r.key_eq(auto_tmp2)) { + if (e.key_eq(r.getDefinition())) { + if (direction = "Depended") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + } + } + for (e in CallExpression(__all_data__), + c in CallExpression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (!isDirectCall(c)) { + for (auto_tmp3 in c.getArguments()) { + if (e.key_eq(auto_tmp3)) { + if (direction = "Depended") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + } + for (e in CallExpression(__all_data__), + c in CallExpression(__all_data__), + s in CallExpression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (!isDirectCall(c)) { + for (auto_tmp4 in c.getAnAncestor()) { + if (s.getReference().key_eq(auto_tmp4)) { + for (auto_tmp5 in s.getArguments()) { + if (auto_tmp5.key_eq(e)) { + if (direction = "Depended") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + } + } + } + } + } + + pub fn getAnAncestorDDNode(self, type: string, direction: string) -> ECGNode { + for (e in ECGNode(__all_data__)) { + if (type = "DD") { + if (e = self.getDDNode(type, direction)) { + return e + } + if (e = self.getAnAncestorDDNode(__all_data__, __all_data__).getDDNode(type, direction)) { + return e + } + } + } + } + + pub fn getCDNode(self, type: string, direction: string) -> ECGNode { + for (e in ECGNode(__all_data__), + c in Callable(__all_data__), + r in ReferenceExpression(__all_data__)) { + if (self.key_eq(c)) { + if (type = "CD") { + for (e1 in Method(__all_data__)) { + for (auto_tmp1 in c.getCallee()) { + if (e1.key_eq(auto_tmp1)) { + if (direction = "Depends") { + if (e.key_eq(e1)) { + return e + } + } + } + } + } + for (e2 in Method(__all_data__)) { + for (auto_tmp2 in c.getCaller()) { + if (e2.key_eq(auto_tmp2)) { + if (direction = "Depended") { + if (e.key_eq(e2)) { + return e + } + } + } + } + } + } + } + if (self.key_eq(r.getDefinition())) { + if (c = r.getEnclosingCallable()) { + if (type = "CD") { + for (e1 in Method(__all_data__)) { + for (auto_tmp1 in c.getCallee()) { + if (e1.key_eq(auto_tmp1)) { + if (direction = "Depends") { + if (e.key_eq(e1)) { + return e + } + } + } + } + } + for (e2 in Method(__all_data__)) { + for (auto_tmp2 in c.getCaller()) { + if (e2.key_eq(auto_tmp2)) { + if (direction = "Depended") { + if (e.key_eq(e2)) { + return e + } + } + } + } + } + } + } + } + } + } + + pub fn getAnAncestorCDNode(self, type: string, direction: string) -> ECGNode { + for (e in ECGNode(__all_data__), + c in Callable(__all_data__), + r in ReferenceExpression(__all_data__)) { + if (type = "CD") { + if (self.key_eq(c)) { + for (e1 in Method(__all_data__)) { + for (auto_tmp1 in c.getAnAncestorCallee()) { + if (e1.key_eq(auto_tmp1)) { + if (direction = "Depends") { + if (e.key_eq(e1)) { + return e + } + } + } + } + } + for (e2 in Method(__all_data__)) { + for (auto_tmp2 in c.getAnAncestorCaller()) { + if (e2.key_eq(auto_tmp2)) { + if (direction = "Depended") { + if (e.key_eq(e2)) { + return e + } + } + } + } + } + } + if (self.key_eq(r.getDefinition())) { + if (c = r.getEnclosingCallable()) { + for (e1 in Method(__all_data__)) { + for (auto_tmp1 in c.getAnAncestorCallee()) { + if (e1.key_eq(auto_tmp1)) { + if (direction = "Depends") { + if (e.key_eq(e1)) { + return e + } + } + } + } + } + for (e2 in Method(__all_data__)) { + for (auto_tmp2 in c.getAnAncestorCaller()) { + if (e2.key_eq(auto_tmp2)) { + if (direction = "Depended") { + if (e.key_eq(e2)) { + return e + } + } + } + } + } + } + } + } + } + } + + pub fn getECGNode(self, type: string, direction: string) -> ECGNode { + for (e in ECGNode(__all_data__)) { + if (e = self.getCDNode(type, direction)) { + return e + } + if (e = self.getDDNode(type, direction)) { + return e + } + } + } + + pub fn getAnAncestorECGNode(self, type: string, direction: string) -> ECGNode { + for (e in ECGNode(__all_data__), tmp in ECGNode(__all_data__)) { + if (tmp = self.getAnAncestorCDNode(__all_data__, __all_data__)) { + if (e = tmp.getECGNode(type, direction)) { + return e + } + } + } + } + + pub fn getAnAncestorCDDependedNode(self, type: string, direction: string) -> ECGNode { + for (e in ECGNode(__all_data__), c in Callable(__all_data__), r in ReferenceExpression(__all_data__)) { + if (type = "CD") { + if (self.key_eq(c) || (self.key_eq(r.getDefinition()) && r.getEnclosingCallable() = c)) { + for (e2 in Method(__all_data__), c_caller in c.getAnAncestorCaller()) { + if (e2.key_eq(c_caller) && direction = "Depended" && e.key_eq(e2)) { + return e + } + } + } + } + } + } + + pub fn getECGDependsNode(self, type: string, direction: string) -> ECGNode { + for (e in ECGNode(__all_data__)) { + if (e = self.getCDDependsNode(type, direction)) { + return e + } + if (e = self.getDDDependsNode(type, direction)) { + return e + } + } + } + + pub fn getCDDependsNode(self, type: string, direction: string) -> ECGNode { + for (e in ECGNode(__all_data__), + c in Callable(__all_data__), + r in ReferenceExpression(__all_data__)) { + if (self.key_eq(c)) { + if (type = "CD") { + for (e1 in c.getCallee()) { + if (direction = "Depends") { + if (e.key_eq(e1)) { + return e + } + } + } + } + } + for (v in Variable(__all_data__)) { + if (self.key_eq(v)) { + if (v.key_eq(r.getDefinition())) { + if (c = r.getEnclosingCallable()) { + if (type = "CD") { + for (e1 in c.getCallee()) { + if (direction = "Depends") { + if (e.key_eq(e1)) { + return e + } + } + } + } + } + } + } + } + } + } + + pub fn getDDDependsNode(self, type: string, direction: string) -> ECGNode { + for (e1 in ECGNode(__all_data__)) { + for (r in ReturnStatement(__all_data__), + c in Method(__all_data__), + e in Expression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (c.key_eq(r.getEnclosingCallable())) { + if (e = r.getResult()) { + if (direction = "Depends") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + for (e in Callable(__all_data__), + c in Field(__all_data__), + r in ReferenceExpression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (c.key_eq(r.getDefinition())) { + if (e = r.getEnclosingCallable()) { + if (direction = "Depends") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + for (e in Callable(__all_data__), + c in EnumConstant(__all_data__), + r in ReferenceExpression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (c.key_eq(r.getDefinition())) { + if (e = r.getEnclosingCallable()) { + if (direction = "Depends") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + for (n in string::__undetermined_all__()) { + for (e in LombokField(__all_data__), + c in CallExpression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (e = c.getLombokField()) { + let (tmp = CallExpression(__all_data__).find(e)) { + if (!isDirectCall(tmp)) { + if (n = c.getMethodName()) { + if (!n.matches("get.*")) { + if (direction = "Depends") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + } + } + } + } + } + } + + pub fn getAnAncestorCDDependsNode(self, type: string, direction: string) -> ECGNode { + for (e in ECGNode(__all_data__), + c in Callable(__all_data__), + r in ReferenceExpression(__all_data__)) { + if (type = "CD") { + if (self.key_eq(c)) { + for (e1 in c.getAnAncestorCallee()) { + if (direction = "Depends") { + if (e.key_eq(e1)) { + return e + } + } + } + } + if (self.key_eq(r.getDefinition())) { + if (c = r.getEnclosingCallable()) { + for (e1 in c.getAnAncestorCallee()) { + if (direction = "Depends") { + if (e.key_eq(e1)) { + return e + } + } + } + } + } + } + } + } + + pub fn getPath(self) -> string { + for (line in int::__undetermined_all__(), + t in string::__undetermined_all__(), + path in string::__undetermined_all__(), + info in string::__undetermined_all__()) { + for (l in coref::java::Location(__all_data__)) { + if (l = self.getLocation()) { + if (path = l.getFile().getRelativePath()) { + if (line = l.getStartLineNumber()) { + if (t = line.to_string()) { + if (info = path + ":" + t) { + return info + } + } + } + } + } + } + } + } + + fn tmp_0(n: string) -> bool { + if (n.matches("get.*")) { + return true + } + } +} + +pub fn getNode(node: int) -> bool { + // #javaecgnode + // example + [ {1111} ] +} +pub fn temp(a: Callable, b: Callable, c: Callable) -> bool { + let (java_db = default_java_db()) { + if (getNode(a.id)) { + for (auto_tmp1 in a.getAnAncestorCaller()) { + if (c = auto_tmp1) { + for (auto_tmp2 in c.getCaller()) { + if (b = auto_tmp2) { + return true + } + } + } + } + if (c = a) { + for (auto_tmp2 in c.getCaller()) { + if (b = auto_tmp2) { + return true + } + } + } + } + } +} +pub fn real_output(b: ECGNode, nodeText1: string, c: ECGNode, nodeText2: string) -> bool { + let (java_db = default_java_db()) { + for (a in Callable(java_db), + b1 in Callable(java_db), + c1 in Callable(java_db)) { + if (b.key_eq(b1)) { + if (c.key_eq(c1)) { + if (temp(a, b1, c1)) { + if (nodeText1 = b1.getSignature()) { + if (nodeText2 = c1.getSignature()) { + return true + } + } + } + } + } + } + } +} + + +fn default_java_db() -> JavaDB { + return JavaDB::load("coref_java_src.db") +} + +fn main() { + output(real_output()) +} \ No newline at end of file diff --git a/example/icse25/rules/rule4.gdl b/example/icse25/rules/rule4.gdl new file mode 100644 index 00000000..0cea2103 --- /dev/null +++ b/example/icse25/rules/rule4.gdl @@ -0,0 +1,1596 @@ +// script +use coref::java::* + +schema ECGNode extends ElementParent {} + +impl ECGNode { + pub fn __all__(db: JavaDB) -> *ECGNode { + for (tmp in ElementParent(db)) { + for (m in Method(db)) { + if (tmp.key_eq(m)) { + yield ECGNode { + id : tmp.id + } + } + } + for (m in Variable(db)) { + if (tmp.key_eq(m)) { + yield ECGNode { + id : tmp.id + } + } + } + for (m in Expression(db)) { + if (tmp.key_eq(m)) { + yield ECGNode { + id : tmp.id + } + } + } + } + } + + pub fn getType(self) -> string { + for (t in string::__undetermined_all__()) { + for (m in Method(__all_data__)) { + if (self.key_eq(m)) { + if (t = "Method") { + return t + } + } + } + for (m in LocalVariable(__all_data__)) { + if (self.key_eq(m)) { + if (t = "LocalVariable") { + return t + } + } + } + for (m in Parameter(__all_data__)) { + if (self.key_eq(m)) { + if (t = "Parameter") { + return t + } + } + } + for (m in Field(__all_data__)) { + if (self.key_eq(m)) { + if (t = "Field") { + return t + } + } + } + for (m in EnumConstant(__all_data__)) { + if (self.key_eq(m)) { + if (t = "EnumConstant") { + return t + } + } + } + for (m in Expression(__all_data__)) { + if (self.key_eq(m)) { + if (t = m.getType()) { + return t + } + } + } + } + } + + pub fn getDDNode(self, type: string, direction: string) -> ECGNode { + for (e1 in ECGNode(__all_data__)) { + for (e in Parameter(__all_data__), + c in Method(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + for (auto_tmp1 in c.getParameter()) { + if (e = auto_tmp1) { + if (direction = "Depended") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + for (r in ReturnStatement(__all_data__), + c in Method(__all_data__), + e in Expression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (c.key_eq(r.getEnclosingCallable())) { + if (e = r.getResult()) { + if (direction = "Depends") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + for (c in Callable(__all_data__), + e in Field(__all_data__), + r in ReferenceExpression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (c = r.getEnclosingCallable()) { + if (e.key_eq(r.getDefinition())) { + if (direction = "Depended") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + for (c in Callable(__all_data__), + e in EnumConstant(__all_data__), + r in ReferenceExpression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (c = r.getEnclosingCallable()) { + if (e.key_eq(r.getDefinition())) { + if (direction = "Depended") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + for (e in Callable(__all_data__), + c in Field(__all_data__), + r in ReferenceExpression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (c.key_eq(r.getDefinition())) { + if (e = r.getEnclosingCallable()) { + if (direction = "Depends") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + for (e in Callable(__all_data__), + c in EnumConstant(__all_data__), + r in ReferenceExpression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (c.key_eq(r.getDefinition())) { + if (e = r.getEnclosingCallable()) { + if (direction = "Depends") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + for (c in Callable(__all_data__), + e in CallExpression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (c = e.getEnclosingCallable()) { + for (m in Method(__all_data__)) { + if (m = e.getMethod()) { + if (!isDirectCall(e)) { + if (direction = "Depended") { + if (type = "DD") { + return e1 + } + } + } + } + } + for (f in LombokField(__all_data__)) { + if (f = e.getLombokField()) { + if (!isDirectCall(e)) { + if (direction = "Depended") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + } + } + for (n in string::__undetermined_all__()) { + for (e in LombokField(__all_data__), + c in CallExpression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (e = c.getLombokField()) { + let (tmp_find = CallExpression(__all_data__).find(e)) { + if (!isDirectCall(tmp_find)) { + if (n = c.getMethodName()) { + if (Self::tmp_0(n)) { + if (direction = "Depended") { + if (type = "DD") { + return e1 + } + } + } + if (!Self::tmp_0(n)) { + if (direction = "Depends") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + } + } + } + } + for (e in Variable(__all_data__), + c in CallExpression(__all_data__), + r in ReferenceExpression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (!isDirectCall(c)) { + for (auto_tmp2 in c.getArguments()) { + if (r.key_eq(auto_tmp2)) { + if (e.key_eq(r.getDefinition())) { + if (direction = "Depended") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + } + } + for (e in CallExpression(__all_data__), + c in CallExpression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (!isDirectCall(c)) { + for (auto_tmp3 in c.getArguments()) { + if (e.key_eq(auto_tmp3)) { + if (direction = "Depended") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + } + for (e in CallExpression(__all_data__), + c in CallExpression(__all_data__), + s in CallExpression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (!isDirectCall(c)) { + for (auto_tmp4 in c.getAnAncestor()) { + if (s.getReference().key_eq(auto_tmp4)) { + for (auto_tmp5 in s.getArguments()) { + if (auto_tmp5.key_eq(e)) { + if (direction = "Depended") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + } + } + } + } + } + + pub fn getAnAncestorDDNode(self, type: string, direction: string) -> ECGNode { + for (e in ECGNode(__all_data__)) { + if (type = "DD") { + if (e = self.getDDNode(type, direction)) { + return e + } + if (e = self.getAnAncestorDDNode(__all_data__, __all_data__).getDDNode(type, direction)) { + return e + } + } + } + } + + pub fn getCDNode(self, type: string, direction: string) -> ECGNode { + for (e in ECGNode(__all_data__), + c in Callable(__all_data__), + r in ReferenceExpression(__all_data__)) { + if (self.key_eq(c)) { + if (type = "CD") { + for (e1 in Method(__all_data__)) { + for (auto_tmp1 in c.getCallee()) { + if (e1.key_eq(auto_tmp1)) { + if (direction = "Depends") { + if (e.key_eq(e1)) { + return e + } + } + } + } + } + for (e2 in Method(__all_data__)) { + for (auto_tmp2 in c.getCaller()) { + if (e2.key_eq(auto_tmp2)) { + if (direction = "Depended") { + if (e.key_eq(e2)) { + return e + } + } + } + } + } + } + } + if (self.key_eq(r.getDefinition())) { + if (c = r.getEnclosingCallable()) { + if (type = "CD") { + for (e1 in Method(__all_data__)) { + for (auto_tmp1 in c.getCallee()) { + if (e1.key_eq(auto_tmp1)) { + if (direction = "Depends") { + if (e.key_eq(e1)) { + return e + } + } + } + } + } + for (e2 in Method(__all_data__)) { + for (auto_tmp2 in c.getCaller()) { + if (e2.key_eq(auto_tmp2)) { + if (direction = "Depended") { + if (e.key_eq(e2)) { + return e + } + } + } + } + } + } + } + } + } + } + + pub fn getAnAncestorCDNode(self, type: string, direction: string) -> ECGNode { + for (e in ECGNode(__all_data__), + c in Callable(__all_data__), + r in ReferenceExpression(__all_data__)) { + if (type = "CD") { + if (self.key_eq(c)) { + for (e1 in Method(__all_data__)) { + for (auto_tmp1 in c.getAnAncestorCallee()) { + if (e1.key_eq(auto_tmp1)) { + if (direction = "Depends") { + if (e.key_eq(e1)) { + return e + } + } + } + } + } + for (e2 in Method(__all_data__)) { + for (auto_tmp2 in c.getAnAncestorCaller()) { + if (e2.key_eq(auto_tmp2)) { + if (direction = "Depended") { + if (e.key_eq(e2)) { + return e + } + } + } + } + } + } + if (self.key_eq(r.getDefinition())) { + if (c = r.getEnclosingCallable()) { + for (e1 in Method(__all_data__)) { + for (auto_tmp1 in c.getAnAncestorCallee()) { + if (e1.key_eq(auto_tmp1)) { + if (direction = "Depends") { + if (e.key_eq(e1)) { + return e + } + } + } + } + } + for (e2 in Method(__all_data__)) { + for (auto_tmp2 in c.getAnAncestorCaller()) { + if (e2.key_eq(auto_tmp2)) { + if (direction = "Depended") { + if (e.key_eq(e2)) { + return e + } + } + } + } + } + } + } + } + } + } + + pub fn getECGNode(self, type: string, direction: string) -> ECGNode { + for (e in ECGNode(__all_data__)) { + if (e = self.getCDNode(type, direction)) { + return e + } + if (e = self.getDDNode(type, direction)) { + return e + } + } + } + + pub fn getAnAncestorECGNode(self, type: string, direction: string) -> ECGNode { + for (e in ECGNode(__all_data__), tmp in ECGNode(__all_data__)) { + if (tmp = self.getAnAncestorCDNode(__all_data__, __all_data__)) { + if (e = tmp.getECGNode(type, direction)) { + return e + } + } + } + } + + pub fn getAnAncestorCDDependedNode(self, type: string, direction: string) -> ECGNode { + for (e in ECGNode(__all_data__), c in Callable(__all_data__), r in ReferenceExpression(__all_data__)) { + if (type = "CD") { + if (self.key_eq(c) || (self.key_eq(r.getDefinition()) && r.getEnclosingCallable() = c)) { + for (e2 in Method(__all_data__), c_caller in c.getAnAncestorCaller()) { + if (e2.key_eq(c_caller) && direction = "Depended" && e.key_eq(e2)) { + return e + } + } + } + } + } + } + + pub fn getECGDependsNode(self, type: string, direction: string) -> ECGNode { + for (e in ECGNode(__all_data__)) { + if (e = self.getCDDependsNode(type, direction)) { + return e + } + if (e = self.getDDDependsNode(type, direction)) { + return e + } + } + } + + pub fn getCDDependsNode(self, type: string, direction: string) -> ECGNode { + for (e in ECGNode(__all_data__), + c in Callable(__all_data__), + r in ReferenceExpression(__all_data__)) { + if (self.key_eq(c)) { + if (type = "CD") { + for (e1 in c.getCallee()) { + if (direction = "Depends") { + if (e.key_eq(e1)) { + return e + } + } + } + } + } + for (v in Variable(__all_data__)) { + if (self.key_eq(v)) { + if (v.key_eq(r.getDefinition())) { + if (c = r.getEnclosingCallable()) { + if (type = "CD") { + for (e1 in c.getCallee()) { + if (direction = "Depends") { + if (e.key_eq(e1)) { + return e + } + } + } + } + } + } + } + } + } + } + + pub fn getDDDependsNode(self, type: string, direction: string) -> ECGNode { + for (e1 in ECGNode(__all_data__)) { + for (r in ReturnStatement(__all_data__), + c in Method(__all_data__), + e in Expression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (c.key_eq(r.getEnclosingCallable())) { + if (e = r.getResult()) { + if (direction = "Depends") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + for (e in Callable(__all_data__), + c in Field(__all_data__), + r in ReferenceExpression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (c.key_eq(r.getDefinition())) { + if (e = r.getEnclosingCallable()) { + if (direction = "Depends") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + for (e in Callable(__all_data__), + c in EnumConstant(__all_data__), + r in ReferenceExpression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (c.key_eq(r.getDefinition())) { + if (e = r.getEnclosingCallable()) { + if (direction = "Depends") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + for (n in string::__undetermined_all__()) { + for (e in LombokField(__all_data__), + c in CallExpression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (e = c.getLombokField()) { + let (tmp = CallExpression(__all_data__).find(e)) { + if (!isDirectCall(tmp)) { + if (n = c.getMethodName()) { + if (!n.matches("get.*")) { + if (direction = "Depends") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + } + } + } + } + } + } + + pub fn getAnAncestorCDDependsNode(self, type: string, direction: string) -> ECGNode { + for (e in ECGNode(__all_data__), + c in Callable(__all_data__), + r in ReferenceExpression(__all_data__)) { + if (type = "CD") { + if (self.key_eq(c)) { + for (e1 in c.getAnAncestorCallee()) { + if (direction = "Depends") { + if (e.key_eq(e1)) { + return e + } + } + } + } + if (self.key_eq(r.getDefinition())) { + if (c = r.getEnclosingCallable()) { + for (e1 in c.getAnAncestorCallee()) { + if (direction = "Depends") { + if (e.key_eq(e1)) { + return e + } + } + } + } + } + } + } + } + + pub fn getPath(self) -> string { + for (line in int::__undetermined_all__(), + t in string::__undetermined_all__(), + path in string::__undetermined_all__(), + info in string::__undetermined_all__()) { + for (l in coref::java::Location(__all_data__)) { + if (l = self.getLocation()) { + if (path = l.getFile().getRelativePath()) { + if (line = l.getStartLineNumber()) { + if (t = line.to_string()) { + if (info = path + ":" + t) { + return info + } + } + } + } + } + } + } + } + + fn tmp_0(n: string) -> bool { + if (n.matches("get.*")) { + return true + } + } +} + +pub fn getJavaECGNode(node: int) -> bool { + // #javaecgnode + // example + [ {1111} ] +} +@inline +pub fn trim(n: string, m: string) -> bool { + let (java_db = default_java_db()) { + for (i in int::__undetermined_all__()) { + if (i = n.len()) { + if (tmp_0(n)) { + if (m = n.substr(1,i - 2)) { + return true + } + } + if (!(tmp_0(n))) { + if (m = n) { + return true + } + } + } + } + } +} +@inline +pub fn contact(a: string, b: string, c: string) -> bool { + let (java_db = default_java_db()) { + for (i in int::__undetermined_all__(), + temp in string::__undetermined_all__()) { + if (i = a.len()) { + if (tmp_1(i)) { + if (tmp_2(a, b)) { + if (c = b) { + return true + } + } + if (!(tmp_2(a, b))) { + if (c = a + b) { + return true + } + } + } + if (!(tmp_1(i))) { + if (tmp_3(a, b, i)) { + if (temp = a.substr(1,i - 1)) { + if (c = a + b) { + return true + } + } + } + if (!(tmp_3(a, b, i))) { + if (tmp_4(a, b, i)) { + if (c = a + "/" + b) { + return true + } + } + if (!(tmp_4(a, b, i))) { + if (c = a + b) { + return true + } + } + } + } + } + } + } +} +schema HttpMethodType extends AnnotationAccessArgument { + +} + +impl HttpMethodType { + + @data_constraint + @inline + pub fn __all__(db: JavaDB) -> *HttpMethodType { + for (tmp in AnnotationAccessArgument(db)) { + if (tmp.getAnnotationArgumentName() = "method") { + yield HttpMethodType { + id : tmp.id + } + } + } + } + + pub fn getType(self) -> string { + for (t in string::__undetermined_all__()) { + for (a in AnnotationArrayInitializer(__all_data__)) { + if (self.getArgumentValueHashId() = a.getParent().id) { + for (i in Identifier(__all_data__)) { + if (a.key_eq(i.getParent())) { + if (t = i.getName()) { + return t + } + } + } + } + } + for (i in Identifier(__all_data__)) { + if (self.getArgumentValueHashId() = i.getParent().id) { + if (t = i.getName()) { + return t + } + } + } + } + } + + +} + +pub fn getMethodType(a: Annotation, t: string) -> bool { + let (java_db = default_java_db()) { + for (m in Method(java_db), + h in HttpMethodType(java_db)) { + for (auto_tmp1 in m.getAnnotation()) { + if (a = auto_tmp1) { + if (tmp_5(a)) { + if (t = "POST") { + return true + } + } + if (!(tmp_5(a))) { + if (tmp_6(a)) { + if (t = "GET") { + return true + } + } + if (!(tmp_6(a))) { + if (tmp_7(a)) { + if (t = "PUT") { + return true + } + } + if (!(tmp_7(a))) { + if (tmp_8(a)) { + if (t = "DELETE") { + return true + } + } + if (!(tmp_8(a))) { + if (tmp_9(a)) { + if (t = "PATCH") { + return true + } + } + if (!(tmp_9(a))) { + for (auto_tmp2 in a.getAnnotationArgument()) { + if (h.key_eq(auto_tmp2)) { + if (t = h.getType()) { + return true + } + } + } + } + } + } + } + } + } + } + } + } +} +pub fn getSubUri(a: Annotation, sub: string) -> bool { + let (java_db = default_java_db()) { + for (s in string::__undetermined_all__(), + n in string::__undetermined_all__()) { + for (temp in AnnotationAccessArgument(java_db), + e in Expression(java_db)) { + if (n = a.getName()) { + if (n.matches(".*Mapping")) { + for (auto_tmp1 in a.getAnnotationArgument()) { + if (temp = auto_tmp1) { + if (temp.getAnnotationArgumentName() = "value") { + if (temp.key_eq(e.getParent())) { + if (tmp_10(e)) { + if (sub = connectStr(e)) { + return true + } + } + if (!(tmp_10(e))) { + if (s = temp.getAnnotationArgumentValue()) { + if (trim(s, sub)) { + return true + } + } + } + } + } + } + } + } + } + } + } + } +} +pub fn getUri(c: Class, m: Method, uri1: string) -> bool { + let (java_db = default_java_db()) { + for (l1 in string::__undetermined_all__(), + l2 in string::__undetermined_all__(), + uri in string::__undetermined_all__(), + n in string::__undetermined_all__()) { + for (a in Annotation(java_db), + a1 in Annotation(java_db)) { + if (c = m.getBelongedClass()) { + for (auto_tmp1 in m.getAnnotation()) { + if (a = auto_tmp1) { + for (auto_tmp2 in c.getAnnotation()) { + if (a1 = auto_tmp2) { + if (n = a.getName()) { + if (tmp_12(c)) { + if (n = a.getName()) { + if (n.matches(".*Mapping")) { + if (getSubUri(a, uri)) { + for (tt in string::__undetermined_all__()) { + for (w in WebFolder(java_db), + cc in WebCarClass(java_db)) { + if (tmp_16(w)) { + if (uri1 = uri) { + return true + } + } + if (!(tmp_16(w))) { + if (cc.key_eq(c)) { + if (tt = cc.getWebFolder().getName()) { + if (uri1 = "/" + tt + uri) { + return true + } + } + } + } + } + } + } + } + } + } + if (!(tmp_12(c))) { + if (tmp_14(a)) { + if (n.matches(".*Mapping")) { + if (getSubUri(a1, uri)) { + for (tt in string::__undetermined_all__()) { + for (w in WebFolder(java_db), + cc in WebCarClass(java_db)) { + if (tmp_16(w)) { + if (uri1 = uri) { + return true + } + } + if (!(tmp_16(w))) { + if (cc.key_eq(c)) { + if (tt = cc.getWebFolder().getName()) { + if (uri1 = "/" + tt + uri) { + return true + } + } + } + } + } + } + } + } + } + if (!(tmp_14(a))) { + if (a1.getName() = "RequestMapping") { + if (n.matches(".*Mapping")) { + if (getSubUri(a, l1)) { + if (getSubUri(a1, l2)) { + if (contact(l2, l1, uri)) { + for (tt in string::__undetermined_all__()) { + for (w in WebFolder(java_db), + cc in WebCarClass(java_db)) { + if (tmp_16(w)) { + if (uri1 = uri) { + return true + } + } + if (!(tmp_16(w))) { + if (cc.key_eq(c)) { + if (tt = cc.getWebFolder().getName()) { + if (uri1 = "/" + tt + uri) { + return true + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } +} +schema WebFolder extends Folder { + +} + +impl WebFolder { + + @data_constraint + @inline + pub fn __all__(db: JavaDB) -> *WebFolder { + for (tmp in Folder(db)) { + if (tmp.getRelativePath() = "app/web") { + yield WebFolder { + element_hash_id : tmp.element_hash_id, + qualified_name : tmp.qualified_name, + name : tmp.name, + parent_hash_id : tmp.parent_hash_id + } + } + } + } + + pub fn getChild(self) -> Folder { + for (f in Folder(__all_data__)) { + if (self.element_hash_id = f.getParentHashId()) { + return f + } + } + } + + +} + +schema WebCarFolder extends Folder { + +} + +impl WebCarFolder { + + @data_constraint + @inline + pub fn __all__(db: JavaDB) -> *WebCarFolder { + for (tmp in Folder(db)) { + yield WebCarFolder { + element_hash_id : tmp.element_hash_id, + qualified_name : tmp.qualified_name, + name : tmp.name, + parent_hash_id : tmp.parent_hash_id + } + } + } + + pub fn getBelongedFolder(self) -> WebCarFolder { + for (f in WebCarFolder(__all_data__)) { + if (f.element_hash_id = self.getParentHashId()) { + return f + } + } + } + + pub fn getAnAncestorFolder(self) -> WebCarFolder { + for (f in WebCarFolder(__all_data__)) { + if (f = self.getBelongedFolder()) { + return f + } + if (f = self.getBelongedFolder().getAnAncestorFolder()) { + return f + } + } + } + + +} + +schema WebCarClass extends Class { + +} + +impl WebCarClass { + + @data_constraint + @inline + pub fn __all__(db: JavaDB) -> *WebCarClass { + for (tmp in Class(db)) { + for (f in WebCarFolder(db), + w in WebFolder(db)) { + if (f.key_eq(tmp.getContainingFile().getBelongedFolder())) { + if (f.getAnAncestorFolder().key_eq(w)) { + yield WebCarClass { + element_hash_id : tmp.element_hash_id, + qualified_name : tmp.qualified_name, + identifier_hash_id : tmp.identifier_hash_id, + location_hash_id : tmp.location_hash_id, + parent_hash_id : tmp.parent_hash_id + } + } + } + } + } + } + + pub fn getWebFolder(self) -> WebCarFolder { + for (c in WebCarFolder(__all_data__)) { + for (f in WebCarFolder(__all_data__), + w in WebFolder(__all_data__)) { + if (f.key_eq(self.getContainingFile().getBelongedFolder())) { + if (f.getAnAncestorFolder() = c) { + if (c.key_eq(w.getChild())) { + return c + } + } + } + } + } + } + + +} + +pub fn resolve(r: ReferenceExpression, rr: string) -> bool { + let (java_db = default_java_db()) { + for (temp in string::__undetermined_all__()) { + for (e in Expression(java_db)) { + if (e.getParent() = r.getDefinition()) { + if (temp = e.getPrintableText()) { + if (trim(temp, rr)) { + return true + } + } + } + } + } + } +} +pub fn facts(a: Expression, i: int, value: string) -> bool { + let (java_db = default_java_db()) { + for (p in PolyadicExpression(java_db)) { + if (a.key_eq(p)) { + for (temp in string::__undetermined_all__()) { + for (e in Expression(java_db)) { + if (tmp_17(a)) { + if (resolve(ReferenceExpression(java_db).find(a), value)) { + if (i = 0) { + return true + } + } + } + if (!(tmp_17(a))) { + if (a.key_eq(e.getParent())) { + if (i = e.getIndex()) { + if (tmp_18(e)) { + if (resolve(ReferenceExpression(java_db).find(e), value)) { + return true + } + } + if (!(tmp_18(e))) { + if (temp = e.getPrintableText()) { + if (trim(temp, value)) { + return true + } + } + } + } + } + } + } + } + } + } + for (p in BinaryExpression(java_db)) { + if (a.key_eq(p)) { + for (temp in string::__undetermined_all__()) { + for (e in Expression(java_db)) { + if (tmp_17(a)) { + if (resolve(ReferenceExpression(java_db).find(a), value)) { + if (i = 0) { + return true + } + } + } + if (!(tmp_17(a))) { + if (a.key_eq(e.getParent())) { + if (i = e.getIndex()) { + if (tmp_18(e)) { + if (resolve(ReferenceExpression(java_db).find(e), value)) { + return true + } + } + if (!(tmp_18(e))) { + if (temp = e.getPrintableText()) { + if (trim(temp, value)) { + return true + } + } + } + } + } + } + } + } + } + } + for (p in ReferenceExpression(java_db)) { + if (a.key_eq(p)) { + for (temp in string::__undetermined_all__()) { + for (e in Expression(java_db)) { + if (tmp_17(a)) { + if (resolve(ReferenceExpression(java_db).find(a), value)) { + if (i = 0) { + return true + } + } + } + if (!(tmp_17(a))) { + if (a.key_eq(e.getParent())) { + if (i = e.getIndex()) { + if (tmp_18(e)) { + if (resolve(ReferenceExpression(java_db).find(e), value)) { + return true + } + } + if (!(tmp_18(e))) { + if (temp = e.getPrintableText()) { + if (trim(temp, value)) { + return true + } + } + } + } + } + } + } + } + } + } + } +} +pub fn connectStrBase(ID: Expression, index: int, res: string) -> bool { + let (java_db = default_java_db()) { + for (total in int::__undetermined_all__(), + reStr in string::__undetermined_all__(), + currStr in string::__undetermined_all__()) { + if (total = tmp_19(ID).len()) { + if (tmp_21(index)) { + if (facts(Expression(java_db).find(ID), index, currStr)) { + if (res = currStr) { + return true + } + } + } + if (!(tmp_21(index))) { + if (index > 0) { + if (connectStrBase(ID, index - 1, reStr)) { + if (facts(Expression(java_db).find(ID), index, currStr)) { + if (res = reStr + currStr) { + return true + } + } + } + } + } + } + } + } +} +pub fn connectStr(ID: Expression) -> string { + let (java_db = default_java_db()) { + for (c in int::__undetermined_all__(), res in string::__undetermined_all__()) { + if (c = tmp_22(ID).len()) { + if (connectStrBase(ID, c - 1, res)) { + return res + } + } + } + } +} +pub fn getHttpMethod(m: Method) -> bool { + let (java_db = default_java_db()) { + for (n in string::__undetermined_all__(), + className in string::__undetermined_all__(), + methodSignature in string::__undetermined_all__(), + uri in string::__undetermined_all__(), + type in string::__undetermined_all__()) { + for (c in Class(java_db), + a in Annotation(java_db)) { + if (getUri(c, m, uri)) { + if (className = c.getQualifiedName()) { + if (methodSignature = m.getSignature()) { + for (auto_tmp1 in m.getAnnotation()) { + if (a = auto_tmp1) { + if (n = a.getName()) { + if (n.matches(".*Mapping")) { + if (tmp_26(a)) { + if (type = "EMPTY") { + return true + } + } + if (!(tmp_26(a))) { + if (getMethodType(a, type)) { + return true + } + } + } + } + } + } + } + } + } + } + } + } +} +pub fn real_output(nodeText: string, path: string) -> bool { + let (java_db = default_java_db()) { + for (direction in string::__undetermined_all__(), + edgeType in string::__undetermined_all__()) { + for (m in ECGNode(java_db), + a in ECGNode(java_db), + b in ECGNode(java_db), + c in ECGNode(java_db)) { + if (getJavaECGNode(a.id)) { + if (getHttpMethod(Method(java_db).find(m))) { + if (b = m.getAnAncestorCDDependsNode(__all_data__, __all_data__)) { + if (c = a.getAnAncestorCDDependedNode(__all_data__, __all_data__)) { + if (c = b.getECGDependsNode(edgeType, direction)) { + if (b != c) { + if (nodeText = m.print()) { + if (path = m.getPath()) { + return true + } + } + } + } + } + if (c = a) { + if (c = b.getECGDependsNode(edgeType, direction)) { + if (b != c) { + if (nodeText = m.print()) { + if (path = m.getPath()) { + return true + } + } + } + } + } + } + if (b = m) { + if (c = a.getAnAncestorCDDependedNode(__all_data__, __all_data__)) { + if (c = b.getECGDependsNode(edgeType, direction)) { + if (b != c) { + if (nodeText = m.print()) { + if (path = m.getPath()) { + return true + } + } + } + } + } + if (c = a) { + if (c = b.getECGDependsNode(edgeType, direction)) { + if (b != c) { + if (nodeText = m.print()) { + if (path = m.getPath()) { + return true + } + } + } + } + } + } + } + } + } + } + } +} + + +fn default_java_db() -> JavaDB { + return JavaDB::load("coref_java_src.db") +} + +fn tmp_0(n: string) -> bool { + let (java_db = default_java_db()) { + if (n.substr(0,1) = "\"") { + return true + } + } +} + +fn tmp_1(i: int) -> bool { + let (java_db = default_java_db()) { + if (i = 1) { + return true + } + } +} + +fn tmp_2(a: string, b: string) -> bool { + let (java_db = default_java_db()) { + if (a.substr(0,1) = "/") { + if (b.substr(0,1) = "/") { + return true + } + } + } +} + +@inline +fn tmp_3(a: string, b: string, i: int) -> bool { + let (java_db = default_java_db()) { + if (a.substr(i - 1,i - 1) = "/") { + if (b.substr(0,1) = "/") { + return true + } + } + } +} + +@inline +fn tmp_4(a: string, b: string, i: int) -> bool { + let (java_db = default_java_db()) { + if (a.substr(i - 1,i - 1) != "/") { + if (b.substr(0,1) != "/") { + return true + } + } + } +} + +fn tmp_5(a: Annotation) -> bool { + let (java_db = default_java_db()) { + if (a.getName() = "PostMapping") { + return true + } + } +} + +fn tmp_6(a: Annotation) -> bool { + let (java_db = default_java_db()) { + if (a.getName() = "GetMapping") { + return true + } + } +} + +fn tmp_7(a: Annotation) -> bool { + let (java_db = default_java_db()) { + if (a.getName() = "PutMapping") { + return true + } + } +} + +fn tmp_8(a: Annotation) -> bool { + let (java_db = default_java_db()) { + if (a.getName() = "DeleteMapping") { + return true + } + } +} + +fn tmp_9(a: Annotation) -> bool { + let (java_db = default_java_db()) { + if (a.getName() = "PatchMapping") { + return true + } + } +} + +fn tmp_10(e: Expression) -> bool { + let (java_db = default_java_db()) { + if (facts(e, __all_data__, __all_data__)) { + return true + } + } +} + +fn tmp_11(c: Class) -> *Annotation { + let (java_db = default_java_db()) { + for (b in Annotation(java_db)) { + for (auto_tmp3 in c.getAnnotation()) { + if (b = auto_tmp3) { + if (b.getName() = "RequestMapping") { + yield b + } + } + } + } + } +} + +fn tmp_12(c: Class) -> bool { + let (java_db = default_java_db()) { + if (tmp_11(c).len() = 0) { + return true + } + } +} + +fn tmp_13(a: Annotation) -> *AnnotationAccessArgument { + let (java_db = default_java_db()) { + for (b in AnnotationAccessArgument(java_db)) { + for (auto_tmp4 in a.getAnnotationArgument()) { + if (b = auto_tmp4) { + if (b.getAnnotationArgumentName() = "value") { + yield b + } + } + } + } + } +} + +fn tmp_14(a: Annotation) -> bool { + let (java_db = default_java_db()) { + if (tmp_13(a).len() = 0) { + return true + } + } +} + +fn tmp_15(w: WebFolder) -> *Folder { + let (java_db = default_java_db()) { + for (f in Folder(java_db)) { + if (f = w.getChild()) { + yield f + } + } + } +} + +fn tmp_16(w: WebFolder) -> bool { + let (java_db = default_java_db()) { + if (tmp_15(w).len() = 1) { + return true + } + } +} + +fn tmp_17(a: Expression) -> bool { + let (java_db = default_java_db()) { + if (resolve(ReferenceExpression(java_db).find(a), __all_data__)) { + return true + } + } +} + +fn tmp_18(e: Expression) -> bool { + let (java_db = default_java_db()) { + if (resolve(ReferenceExpression(java_db).find(e), __all_data__)) { + return true + } + } +} + +fn tmp_19(ID: Expression) -> *auto_tmp_20 { + let (java_db = default_java_db()) { + for (auto_tmp_var_0 in int::__undetermined_all__(), + auto_tmp_var_1 in string::__undetermined_all__()) { + if (facts(ID, auto_tmp_var_0, auto_tmp_var_1)) { + yield auto_tmp_20 { + auto_tmp_var_0 : auto_tmp_var_0, + auto_tmp_var_1 : auto_tmp_var_1 + } + } + } + } +} + +schema auto_tmp_20 { + auto_tmp_var_0 : int, + auto_tmp_var_1 : string +} + +fn tmp_21(index: int) -> bool { + let (java_db = default_java_db()) { + if (index = 0) { + return true + } + } +} + +fn tmp_22(ID: Expression) -> *auto_tmp_23 { + let (java_db = default_java_db()) { + for (auto_tmp_var_0 in int::__undetermined_all__(), + auto_tmp_var_1 in string::__undetermined_all__()) { + if (facts(ID, auto_tmp_var_0, auto_tmp_var_1)) { + yield auto_tmp_23 { + auto_tmp_var_0 : auto_tmp_var_0, + auto_tmp_var_1 : auto_tmp_var_1 + } + } + } + } +} + +schema auto_tmp_23 { + auto_tmp_var_0 : int, + auto_tmp_var_1 : string +} + +fn tmp_24(a: Annotation) -> *auto_tmp_25 { + let (java_db = default_java_db()) { + for (auto_tmp_var_0 in string::__undetermined_all__()) { + if (getMethodType(a, auto_tmp_var_0)) { + yield auto_tmp_25 { + auto_tmp_var_0 : auto_tmp_var_0 + } + } + } + } +} + +schema auto_tmp_25 { + auto_tmp_var_0 : string +} + +fn tmp_26(a: Annotation) -> bool { + let (java_db = default_java_db()) { + if (tmp_24(a).len() = 0) { + return true + } + } +} + +fn main() { + output(real_output()) +} \ No newline at end of file diff --git a/example/icse25/rules/rule5.gdl b/example/icse25/rules/rule5.gdl new file mode 100644 index 00000000..a0667289 --- /dev/null +++ b/example/icse25/rules/rule5.gdl @@ -0,0 +1,168 @@ +// script +use coref::xml::* + +schema ECGXmlNode { + @primary id: int +} + +impl ECGXmlNode { + pub fn __all__(db: XmlDB) -> *ECGXmlNode { + for (e in XmlPomElement(db)) { + yield ECGXmlNode {id : e.id} + } + for (e in XmlSpringElement(db)) { + yield ECGXmlNode {id : e.id} + } + for (e in XmlCharacter(db)) { + yield ECGXmlNode {id : e.id} + } + for (e in XmlAttribute(db)) { + yield ECGXmlNode {id : e.id} + } + } + + pub fn getLocation(self) -> coref::xml::Location { + for (l in coref::xml::Location(__all_data__)) { + for (e in XmlElement(__all_data__)) { + if (self.key_eq(e)) { + if (l = e.getLocation()) { + return l + } + } + } + for (e in XmlAttribute(__all_data__)) { + if (self.key_eq(e)) { + if (l = e.getLocation()) { + return l + } + } + } + for (e in XmlCharacter(__all_data__)) { + if (self.key_eq(e)) { + if (l = e.getLocation()) { + return l + } + } + } + } + } + + pub fn getType(self) -> string { + for (t in string::__undetermined_all__()) { + for (e in XmlElement(__all_data__)) { + if (self.key_eq(e)) { + if (t = "XmlElement") { + return t + } + } + } + for (e in XmlAttribute(__all_data__)) { + if (self.key_eq(e)) { + if (t = "XmlAttribute") { + return t + } + } + } + for (e in XmlCharacter(__all_data__)) { + if (self.key_eq(e)) { + if (t = "XmlCharacter") { + return t + } + } + } + } + } + + pub fn getText(self) -> string { + for (e in XmlElement(__all_data__)) { + if (self.key_eq(e)) { + return e.getName() + } + } + for (e in XmlAttribute(__all_data__)) { + if (self.key_eq(e)) { + return e.getName() + " = " + e.getValue() + } + } + for (e in XmlCharacter(__all_data__)) { + if (self.key_eq(e)) { + return e.getText() + } + } + } + + pub fn getEnclosingECGXmlNode(self) -> ECGXmlNode { + for (e in XmlElement(__all_data__)) { + if (self.key_eq(e)) { + return e.to() + } + } + for (e in XmlAttribute(__all_data__)) { + if (self.key_eq(e)) { + return e.getXmlElement().to() + } + } + for (e in XmlCharacter(__all_data__)) { + if (self.key_eq(e)) { + return e.getBelongedElement().to() + } + } + } +} + +pub fn gitdiff(filePath: string, lineNo: int) -> bool { + // #changeinfo + // example + [ {"test", 1111} ] +} +pub fn transfertofile(f: XmlFile, filename: string, lineNumber: int) -> bool { + let (xml_db = default_xml_db()) { + if (gitdiff(filename, lineNumber)) { + if (filename = f.getRelativePath()) { + return true + } + } + } +} +pub fn real_output(n: ECGXmlNode) -> bool { + let (xml_db = default_xml_db()) { + for (lineNumber in int::__undetermined_all__(), + e in int::__undetermined_all__(), + s1 in int::__undetermined_all__(), + filename in string::__undetermined_all__(), + typeInAST in string::__undetermined_all__(), + text in string::__undetermined_all__()) { + for (f in XmlFile(xml_db), + o in ECGXmlNode(xml_db)) { + if (transfertofile(f, filename, lineNumber)) { + if (n.getLocation().getFile() = f) { + if (s1 = n.getLocation().getStartLineNumber()) { + if (e = n.getLocation().getEndLineNumber()) { + if (lineNumber > s1 - 1) { + if (lineNumber < e + 1) { + if (typeInAST = n.getType()) { + if (text = n.getText()) { + if (o = n.getEnclosingECGXmlNode()) { + return true + } + } + } + } + } + } + } + } + } + } + } + } +} + + +fn default_xml_db() -> XmlDB { + return XmlDB::load("coref_xml_src.db") +} + +fn main() { + output(real_output()) +} \ No newline at end of file diff --git a/example/icse25/rules/rule6.gdl b/example/icse25/rules/rule6.gdl new file mode 100644 index 00000000..d3b7feae --- /dev/null +++ b/example/icse25/rules/rule6.gdl @@ -0,0 +1,1216 @@ +// script +use coref::java::* +use coref::xml::* + +schema ECGNode extends ElementParent {} + +impl ECGNode { + pub fn __all__(db: JavaDB) -> *ECGNode { + for (tmp in ElementParent(db)) { + for (m in Method(db)) { + if (tmp.key_eq(m)) { + yield ECGNode { + id : tmp.id + } + } + } + for (m in Variable(db)) { + if (tmp.key_eq(m)) { + yield ECGNode { + id : tmp.id + } + } + } + for (m in Expression(db)) { + if (tmp.key_eq(m)) { + yield ECGNode { + id : tmp.id + } + } + } + } + } + + pub fn getType(self) -> string { + for (t in string::__undetermined_all__()) { + for (m in Method(__all_data__)) { + if (self.key_eq(m)) { + if (t = "Method") { + return t + } + } + } + for (m in LocalVariable(__all_data__)) { + if (self.key_eq(m)) { + if (t = "LocalVariable") { + return t + } + } + } + for (m in Parameter(__all_data__)) { + if (self.key_eq(m)) { + if (t = "Parameter") { + return t + } + } + } + for (m in Field(__all_data__)) { + if (self.key_eq(m)) { + if (t = "Field") { + return t + } + } + } + for (m in EnumConstant(__all_data__)) { + if (self.key_eq(m)) { + if (t = "EnumConstant") { + return t + } + } + } + for (m in Expression(__all_data__)) { + if (self.key_eq(m)) { + if (t = m.getType()) { + return t + } + } + } + } + } + + pub fn getDDNode(self, type: string, direction: string) -> ECGNode { + for (e1 in ECGNode(__all_data__)) { + for (e in Parameter(__all_data__), + c in Method(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + for (auto_tmp1 in c.getParameter()) { + if (e = auto_tmp1) { + if (direction = "Depended") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + for (r in ReturnStatement(__all_data__), + c in Method(__all_data__), + e in Expression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (c.key_eq(r.getEnclosingCallable())) { + if (e = r.getResult()) { + if (direction = "Depends") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + for (c in Callable(__all_data__), + e in Field(__all_data__), + r in ReferenceExpression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (c = r.getEnclosingCallable()) { + if (e.key_eq(r.getDefinition())) { + if (direction = "Depended") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + for (c in Callable(__all_data__), + e in EnumConstant(__all_data__), + r in ReferenceExpression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (c = r.getEnclosingCallable()) { + if (e.key_eq(r.getDefinition())) { + if (direction = "Depended") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + for (e in Callable(__all_data__), + c in Field(__all_data__), + r in ReferenceExpression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (c.key_eq(r.getDefinition())) { + if (e = r.getEnclosingCallable()) { + if (direction = "Depends") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + for (e in Callable(__all_data__), + c in EnumConstant(__all_data__), + r in ReferenceExpression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (c.key_eq(r.getDefinition())) { + if (e = r.getEnclosingCallable()) { + if (direction = "Depends") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + for (c in Callable(__all_data__), + e in CallExpression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (c = e.getEnclosingCallable()) { + for (m in Method(__all_data__)) { + if (m = e.getMethod()) { + if (!isDirectCall(e)) { + if (direction = "Depended") { + if (type = "DD") { + return e1 + } + } + } + } + } + for (f in LombokField(__all_data__)) { + if (f = e.getLombokField()) { + if (!isDirectCall(e)) { + if (direction = "Depended") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + } + } + for (n in string::__undetermined_all__()) { + for (e in LombokField(__all_data__), + c in CallExpression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (e = c.getLombokField()) { + let (tmp_find = CallExpression(__all_data__).find(e)) { + if (!isDirectCall(tmp_find)) { + if (n = c.getMethodName()) { + if (Self::tmp_0(n)) { + if (direction = "Depended") { + if (type = "DD") { + return e1 + } + } + } + if (!Self::tmp_0(n)) { + if (direction = "Depends") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + } + } + } + } + for (e in Variable(__all_data__), + c in CallExpression(__all_data__), + r in ReferenceExpression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (!isDirectCall(c)) { + for (auto_tmp2 in c.getArguments()) { + if (r.key_eq(auto_tmp2)) { + if (e.key_eq(r.getDefinition())) { + if (direction = "Depended") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + } + } + for (e in CallExpression(__all_data__), + c in CallExpression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (!isDirectCall(c)) { + for (auto_tmp3 in c.getArguments()) { + if (e.key_eq(auto_tmp3)) { + if (direction = "Depended") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + } + for (e in CallExpression(__all_data__), + c in CallExpression(__all_data__), + s in CallExpression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (!isDirectCall(c)) { + for (auto_tmp4 in c.getAnAncestor()) { + if (s.getReference().key_eq(auto_tmp4)) { + for (auto_tmp5 in s.getArguments()) { + if (auto_tmp5.key_eq(e)) { + if (direction = "Depended") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + } + } + } + } + } + + pub fn getAnAncestorDDNode(self, type: string, direction: string) -> ECGNode { + for (e in ECGNode(__all_data__)) { + if (type = "DD") { + if (e = self.getDDNode(type, direction)) { + return e + } + if (e = self.getAnAncestorDDNode(__all_data__, __all_data__).getDDNode(type, direction)) { + return e + } + } + } + } + + pub fn getCDNode(self, type: string, direction: string) -> ECGNode { + for (e in ECGNode(__all_data__), + c in Callable(__all_data__), + r in ReferenceExpression(__all_data__)) { + if (self.key_eq(c)) { + if (type = "CD") { + for (e1 in Method(__all_data__)) { + for (auto_tmp1 in c.getCallee()) { + if (e1.key_eq(auto_tmp1)) { + if (direction = "Depends") { + if (e.key_eq(e1)) { + return e + } + } + } + } + } + for (e2 in Method(__all_data__)) { + for (auto_tmp2 in c.getCaller()) { + if (e2.key_eq(auto_tmp2)) { + if (direction = "Depended") { + if (e.key_eq(e2)) { + return e + } + } + } + } + } + } + } + if (self.key_eq(r.getDefinition())) { + if (c = r.getEnclosingCallable()) { + if (type = "CD") { + for (e1 in Method(__all_data__)) { + for (auto_tmp1 in c.getCallee()) { + if (e1.key_eq(auto_tmp1)) { + if (direction = "Depends") { + if (e.key_eq(e1)) { + return e + } + } + } + } + } + for (e2 in Method(__all_data__)) { + for (auto_tmp2 in c.getCaller()) { + if (e2.key_eq(auto_tmp2)) { + if (direction = "Depended") { + if (e.key_eq(e2)) { + return e + } + } + } + } + } + } + } + } + } + } + + pub fn getAnAncestorCDNode(self, type: string, direction: string) -> ECGNode { + for (e in ECGNode(__all_data__), + c in Callable(__all_data__), + r in ReferenceExpression(__all_data__)) { + if (type = "CD") { + if (self.key_eq(c)) { + for (e1 in Method(__all_data__)) { + for (auto_tmp1 in c.getAnAncestorCallee()) { + if (e1.key_eq(auto_tmp1)) { + if (direction = "Depends") { + if (e.key_eq(e1)) { + return e + } + } + } + } + } + for (e2 in Method(__all_data__)) { + for (auto_tmp2 in c.getAnAncestorCaller()) { + if (e2.key_eq(auto_tmp2)) { + if (direction = "Depended") { + if (e.key_eq(e2)) { + return e + } + } + } + } + } + } + if (self.key_eq(r.getDefinition())) { + if (c = r.getEnclosingCallable()) { + for (e1 in Method(__all_data__)) { + for (auto_tmp1 in c.getAnAncestorCallee()) { + if (e1.key_eq(auto_tmp1)) { + if (direction = "Depends") { + if (e.key_eq(e1)) { + return e + } + } + } + } + } + for (e2 in Method(__all_data__)) { + for (auto_tmp2 in c.getAnAncestorCaller()) { + if (e2.key_eq(auto_tmp2)) { + if (direction = "Depended") { + if (e.key_eq(e2)) { + return e + } + } + } + } + } + } + } + } + } + } + + pub fn getECGNode(self, type: string, direction: string) -> ECGNode { + for (e in ECGNode(__all_data__)) { + if (e = self.getCDNode(type, direction)) { + return e + } + if (e = self.getDDNode(type, direction)) { + return e + } + } + } + + pub fn getAnAncestorECGNode(self, type: string, direction: string) -> ECGNode { + for (e in ECGNode(__all_data__), tmp in ECGNode(__all_data__)) { + if (tmp = self.getAnAncestorCDNode(__all_data__, __all_data__)) { + if (e = tmp.getECGNode(type, direction)) { + return e + } + } + } + } + + pub fn getAnAncestorCDDependedNode(self, type: string, direction: string) -> ECGNode { + for (e in ECGNode(__all_data__), c in Callable(__all_data__), r in ReferenceExpression(__all_data__)) { + if (type = "CD") { + if (self.key_eq(c) || (self.key_eq(r.getDefinition()) && r.getEnclosingCallable() = c)) { + for (e2 in Method(__all_data__), c_caller in c.getAnAncestorCaller()) { + if (e2.key_eq(c_caller) && direction = "Depended" && e.key_eq(e2)) { + return e + } + } + } + } + } + } + + pub fn getECGDependsNode(self, type: string, direction: string) -> ECGNode { + for (e in ECGNode(__all_data__)) { + if (e = self.getCDDependsNode(type, direction)) { + return e + } + if (e = self.getDDDependsNode(type, direction)) { + return e + } + } + } + + pub fn getCDDependsNode(self, type: string, direction: string) -> ECGNode { + for (e in ECGNode(__all_data__), + c in Callable(__all_data__), + r in ReferenceExpression(__all_data__)) { + if (self.key_eq(c)) { + if (type = "CD") { + for (e1 in c.getCallee()) { + if (direction = "Depends") { + if (e.key_eq(e1)) { + return e + } + } + } + } + } + for (v in Variable(__all_data__)) { + if (self.key_eq(v)) { + if (v.key_eq(r.getDefinition())) { + if (c = r.getEnclosingCallable()) { + if (type = "CD") { + for (e1 in c.getCallee()) { + if (direction = "Depends") { + if (e.key_eq(e1)) { + return e + } + } + } + } + } + } + } + } + } + } + + pub fn getDDDependsNode(self, type: string, direction: string) -> ECGNode { + for (e1 in ECGNode(__all_data__)) { + for (r in ReturnStatement(__all_data__), + c in Method(__all_data__), + e in Expression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (c.key_eq(r.getEnclosingCallable())) { + if (e = r.getResult()) { + if (direction = "Depends") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + for (e in Callable(__all_data__), + c in Field(__all_data__), + r in ReferenceExpression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (c.key_eq(r.getDefinition())) { + if (e = r.getEnclosingCallable()) { + if (direction = "Depends") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + for (e in Callable(__all_data__), + c in EnumConstant(__all_data__), + r in ReferenceExpression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (c.key_eq(r.getDefinition())) { + if (e = r.getEnclosingCallable()) { + if (direction = "Depends") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + for (n in string::__undetermined_all__()) { + for (e in LombokField(__all_data__), + c in CallExpression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (e = c.getLombokField()) { + let (tmp = CallExpression(__all_data__).find(e)) { + if (!isDirectCall(tmp)) { + if (n = c.getMethodName()) { + if (!n.matches("get.*")) { + if (direction = "Depends") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + } + } + } + } + } + } + + pub fn getAnAncestorCDDependsNode(self, type: string, direction: string) -> ECGNode { + for (e in ECGNode(__all_data__), + c in Callable(__all_data__), + r in ReferenceExpression(__all_data__)) { + if (type = "CD") { + if (self.key_eq(c)) { + for (e1 in c.getAnAncestorCallee()) { + if (direction = "Depends") { + if (e.key_eq(e1)) { + return e + } + } + } + } + if (self.key_eq(r.getDefinition())) { + if (c = r.getEnclosingCallable()) { + for (e1 in c.getAnAncestorCallee()) { + if (direction = "Depends") { + if (e.key_eq(e1)) { + return e + } + } + } + } + } + } + } + } + + pub fn getPath(self) -> string { + for (line in int::__undetermined_all__(), + t in string::__undetermined_all__(), + path in string::__undetermined_all__(), + info in string::__undetermined_all__()) { + for (l in coref::java::Location(__all_data__)) { + if (l = self.getLocation()) { + if (path = l.getFile().getRelativePath()) { + if (line = l.getStartLineNumber()) { + if (t = line.to_string()) { + if (info = path + ":" + t) { + return info + } + } + } + } + } + } + } + } + + fn tmp_0(n: string) -> bool { + if (n.matches("get.*")) { + return true + } + } +} + +schema ECGXmlNode { + @primary id: int +} + +impl ECGXmlNode { + pub fn __all__(db: XmlDB) -> *ECGXmlNode { + for (e in XmlPomElement(db)) { + yield ECGXmlNode {id : e.id} + } + for (e in XmlSpringElement(db)) { + yield ECGXmlNode {id : e.id} + } + for (e in XmlCharacter(db)) { + yield ECGXmlNode {id : e.id} + } + for (e in XmlAttribute(db)) { + yield ECGXmlNode {id : e.id} + } + } + + pub fn getLocation(self) -> coref::xml::Location { + for (l in coref::xml::Location(__all_data__)) { + for (e in XmlElement(__all_data__)) { + if (self.key_eq(e)) { + if (l = e.getLocation()) { + return l + } + } + } + for (e in XmlAttribute(__all_data__)) { + if (self.key_eq(e)) { + if (l = e.getLocation()) { + return l + } + } + } + for (e in XmlCharacter(__all_data__)) { + if (self.key_eq(e)) { + if (l = e.getLocation()) { + return l + } + } + } + } + } + + pub fn getType(self) -> string { + for (t in string::__undetermined_all__()) { + for (e in XmlElement(__all_data__)) { + if (self.key_eq(e)) { + if (t = "XmlElement") { + return t + } + } + } + for (e in XmlAttribute(__all_data__)) { + if (self.key_eq(e)) { + if (t = "XmlAttribute") { + return t + } + } + } + for (e in XmlCharacter(__all_data__)) { + if (self.key_eq(e)) { + if (t = "XmlCharacter") { + return t + } + } + } + } + } + + pub fn getText(self) -> string { + for (e in XmlElement(__all_data__)) { + if (self.key_eq(e)) { + return e.getName() + } + } + for (e in XmlAttribute(__all_data__)) { + if (self.key_eq(e)) { + return e.getName() + " = " + e.getValue() + } + } + for (e in XmlCharacter(__all_data__)) { + if (self.key_eq(e)) { + return e.getText() + } + } + } + + pub fn getEnclosingECGXmlNode(self) -> ECGXmlNode { + for (e in XmlElement(__all_data__)) { + if (self.key_eq(e)) { + return e.to() + } + } + for (e in XmlAttribute(__all_data__)) { + if (self.key_eq(e)) { + return e.getXmlElement().to() + } + } + for (e in XmlCharacter(__all_data__)) { + if (self.key_eq(e)) { + return e.getBelongedElement().to() + } + } + } +} + +pub fn getJavaECGNode(id: int) -> bool { + // #javaxmlnode + // example + [ {1111} ] +} +pub fn getXmlECGNode(id: int) -> bool { + // #xmlecgnode + // example + [ {1111} ] +} +schema SofaService extends Annotation { + +} + +impl SofaService { + + @data_constraint + @inline + pub fn __all__(db: JavaDB) -> *SofaService { + for (tmp in Annotation(db)) { + if (tmp.getName() = "SofaService") { + yield SofaService { + id : tmp.id + } + } + } + } + + pub fn getService(self) -> ClassOrInterface { + for (value in string::__undetermined_all__()) { + for (i in ClassOrInterface(__all_data__), + argus in AnnotationAccessArgument(__all_data__)) { + for (auto_tmp1 in self.getAnnotationArgument()) { + if (argus = auto_tmp1) { + if (argus.getAnnotationArgumentName() = "interfaceType") { + if (value = argus.getAnnotationArgumentValue()) { + if (i.getQualifiedName() = value) { + return i + } + } + } + } + } + } + } + } + + @inline + pub fn getBinding(self) -> SofaServiceBinding { + for (b in SofaServiceBinding(__all_data__), + argus in AnnotationAccessArgument(__all_data__)) { + for (auto_tmp1 in self.getAnnotationArgument()) { + if (argus = auto_tmp1) { + if (argus.getAnnotationArgumentName() = "bindings") { + if (b.key_eq(argus.getArgumentAnnotation())) { + return b + } + if (argus.key_eq(b.getParent())) { + return b + } + } + } + } + } + } + + @inline + pub fn getUniqueId(self) -> string { + for (uniqueId in string::__undetermined_all__()) { + for (anno in Annotation(__all_data__)) { + if (self.key_eq(anno)) { + if (tmp_2(anno)) { + for (argus in AnnotationAccessArgument(__all_data__)) { + for (auto_tmp1 in anno.getAnnotationArgument()) { + if (argus = auto_tmp1) { + if (argus.getAnnotationArgumentName() = "uniqueId") { + if (uniqueId = argus.getAnnotationArgumentValue()) { + return uniqueId + } + } + } + } + } + } + if (!(tmp_2(anno))) { + if (uniqueId = "null") { + return uniqueId + } + } + } + } + } + } + + +} + +pub fn uniqueArgument(anno: Annotation) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (argus in AnnotationAccessArgument(java_db)) { + for (auto_tmp1 in anno.getAnnotationArgument()) { + if (argus = auto_tmp1) { + if (argus.getAnnotationArgumentName() = "uniqueId") { + return true + } + } + } + } + } + } +} +schema SofaServiceBinding extends Annotation { + +} + +impl SofaServiceBinding { + + @data_constraint + @inline + pub fn __all__(db: JavaDB) -> *SofaServiceBinding { + for (tmp in Annotation(db)) { + if (tmp.getName() = "SofaServiceBinding") { + yield SofaServiceBinding { + id : tmp.id + } + } + } + } + + pub fn getType(self) -> string { + for (value in string::__undetermined_all__()) { + for (argus in AnnotationAccessArgument(__all_data__)) { + for (auto_tmp1 in self.getAnnotationArgument()) { + if (argus = auto_tmp1) { + if (argus.getAnnotationArgumentName() = "bindingType") { + if (value = argus.getAnnotationArgumentValue()) { + return value + } + } + } + } + } + } + } + + +} + +pub fn javaOutput(classname: string, name: string) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (s in SofaService(java_db), + c in Class(java_db), + i in ClassOrInterface(java_db)) { + for (auto_tmp1 in c.getAnnotation()) { + if (s.key_eq(auto_tmp1)) { + if (classname = c.getQualifiedName()) { + for (auto_tmp2 in c.getImplementsInterface()) { + if (i.key_eq(auto_tmp2)) { + if (name = i.getQualifiedName()) { + return true + } + } + } + if (i = s.getService()) { + if (name = i.getQualifiedName()) { + return true + } + } + } + } + } + } + } + } +} +pub fn xmlOutput(className: string, interfaceName: string) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (temp in string::__undetermined_all__()) { + for (s in SofaServiceXmlElement(xml_db), + b in BeanXmlElement(xml_db)) { + if (s.getRef() = b.getId()) { + if (interfaceName = s.getInterfaceName()) { + if (className = b.getClass()) { + if (temp = b.getLocation().getFile().getRelativePath()) { + if (!temp.contains("src/test/resources")) { + return true + } + } + } + } + } + } + } + } + } +} +pub fn annoOutput(className: string, interfaceName: string) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (v in string::__undetermined_all__(), + k in string::__undetermined_all__()) { + for (s in SofaServiceXmlElement(xml_db), + b in Class(java_db), + t in TagXmlElement(xml_db), + a in Annotation(java_db)) { + if (s.key_eq(t.getParent())) { + if (v = s.getRef()) { + if (interfaceName = s.getInterfaceName()) { + for (auto_tmp1 in b.getAnnotation()) { + if (a = auto_tmp1) { + if (a.getName() = k) { + if (getTrAnnotationName(k)) { + for (auto_tmp2 in a.getAnnotationArgument()) { + if (auto_tmp2.getAnnotationArgumentValue() = "\"" + v + "\"") { + if (className = b.getQualifiedName()) { + return true + } + } + } + } + } + } + } + } + } + } + } + } + } + } +} +pub fn getTrAnnotationName(a: string) -> bool { + [ + {"Service"}, + {"Component"}, + {"Scope"}, + {"Repository"}, + {"Controller"}, + {"RestController"}, + {"RequestMapping"}, + {"PathVariable"}, + {"ResponseBody"}, + {"bean"} + ] +} +pub fn real_output(className: string, interfaceName: string, id: int, name: string, tag: string) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (i in int::__undetermined_all__(), + j in int::__undetermined_all__()) { + if (xmlOutput(className, interfaceName)) { + for (temp in string::__undetermined_all__()) { + for (e1 in ECGNode(java_db), + e2 in ECGXmlNode(xml_db), + c in ClassOrInterface(java_db)) { + if (getJavaECGNode(e1.id)) { + if (getXmlECGNode(e2.id)) { + if (c.key_eq(e1.getElementParent())) { + if (temp = c.getQualifiedName()) { + if (id = e1.id) { + if (temp = className) { + if (name = e1.print()) { + if (tag = "Java") { + return true + } + } + } + if (temp = interfaceName) { + if (name = e1.print()) { + if (tag = "Java") { + return true + } + } + } + } + if (e2.id = i) { + if (id = e2.id) { + if (name = e2.getText()) { + if (tag = "xml") { + return true + } + } + } + } + if (e2.id = j) { + if (id = e2.id) { + if (name = e2.getText()) { + if (tag = "xml") { + return true + } + } + } + } + } + } + } + } + } + } + } + if (javaOutput(className, interfaceName)) { + for (temp in string::__undetermined_all__()) { + for (e1 in ECGNode(java_db), + e2 in ECGXmlNode(xml_db), + c in ClassOrInterface(java_db)) { + if (getJavaECGNode(e1.id)) { + if (getXmlECGNode(e2.id)) { + if (c.key_eq(e1.getElementParent())) { + if (temp = c.getQualifiedName()) { + if (id = e1.id) { + if (temp = className) { + if (name = e1.print()) { + if (tag = "Java") { + return true + } + } + } + if (temp = interfaceName) { + if (name = e1.print()) { + if (tag = "Java") { + return true + } + } + } + } + if (e2.id = i) { + if (id = e2.id) { + if (name = e2.getText()) { + if (tag = "xml") { + return true + } + } + } + } + if (e2.id = j) { + if (id = e2.id) { + if (name = e2.getText()) { + if (tag = "xml") { + return true + } + } + } + } + } + } + } + } + } + } + } + if (annoOutput(className, interfaceName)) { + for (temp in string::__undetermined_all__()) { + for (e1 in ECGNode(java_db), + e2 in ECGXmlNode(xml_db), + c in ClassOrInterface(java_db)) { + if (getJavaECGNode(e1.id)) { + if (getXmlECGNode(e2.id)) { + if (c.key_eq(e1.getElementParent())) { + if (temp = c.getQualifiedName()) { + if (id = e1.id) { + if (temp = className) { + if (name = e1.print()) { + if (tag = "Java") { + return true + } + } + } + if (temp = interfaceName) { + if (name = e1.print()) { + if (tag = "Java") { + return true + } + } + } + } + if (e2.id = i) { + if (id = e2.id) { + if (name = e2.getText()) { + if (tag = "xml") { + return true + } + } + } + } + if (e2.id = j) { + if (id = e2.id) { + if (name = e2.getText()) { + if (tag = "xml") { + return true + } + } + } + } + } + } + } + } + } + } + } + } + } + } +} + + +fn default_java_db() -> JavaDB { + return JavaDB::load("coref_java_src.db") +} + +fn default_xml_db() -> XmlDB { + return XmlDB::load("coref_xml_src.db") +} + +fn tmp_0(anno: Annotation) -> *auto_tmp_1 { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + if (uniqueArgument(anno)) { + yield auto_tmp_1 { + + } + } + } + } +} + +schema auto_tmp_1 { + +} + +fn tmp_2(anno: Annotation) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + if (tmp_0(anno).len() = 1) { + return true + } + } + } +} + +fn main() { + output(real_output()) +} \ No newline at end of file diff --git a/example/icse25/rules/rule6_8_no_xml.gdl b/example/icse25/rules/rule6_8_no_xml.gdl new file mode 100644 index 00000000..3ceac036 --- /dev/null +++ b/example/icse25/rules/rule6_8_no_xml.gdl @@ -0,0 +1,1780 @@ +// script +use coref::java::* +use coref::xml::* + +schema ECGNode extends ElementParent {} + +impl ECGNode { + pub fn __all__(db: JavaDB) -> *ECGNode { + for (tmp in ElementParent(db)) { + for (m in Method(db)) { + if (tmp.key_eq(m)) { + yield ECGNode { + id : tmp.id + } + } + } + for (m in Variable(db)) { + if (tmp.key_eq(m)) { + yield ECGNode { + id : tmp.id + } + } + } + for (m in Expression(db)) { + if (tmp.key_eq(m)) { + yield ECGNode { + id : tmp.id + } + } + } + } + } + + pub fn getType(self) -> string { + for (t in string::__undetermined_all__()) { + for (m in Method(__all_data__)) { + if (self.key_eq(m)) { + if (t = "Method") { + return t + } + } + } + for (m in LocalVariable(__all_data__)) { + if (self.key_eq(m)) { + if (t = "LocalVariable") { + return t + } + } + } + for (m in Parameter(__all_data__)) { + if (self.key_eq(m)) { + if (t = "Parameter") { + return t + } + } + } + for (m in Field(__all_data__)) { + if (self.key_eq(m)) { + if (t = "Field") { + return t + } + } + } + for (m in EnumConstant(__all_data__)) { + if (self.key_eq(m)) { + if (t = "EnumConstant") { + return t + } + } + } + for (m in Expression(__all_data__)) { + if (self.key_eq(m)) { + if (t = m.getType()) { + return t + } + } + } + } + } + + pub fn getDDNode(self, type: string, direction: string) -> ECGNode { + for (e1 in ECGNode(__all_data__)) { + for (e in Parameter(__all_data__), + c in Method(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + for (auto_tmp1 in c.getParameter()) { + if (e = auto_tmp1) { + if (direction = "Depended") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + for (r in ReturnStatement(__all_data__), + c in Method(__all_data__), + e in Expression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (c.key_eq(r.getEnclosingCallable())) { + if (e = r.getResult()) { + if (direction = "Depends") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + for (c in Callable(__all_data__), + e in Field(__all_data__), + r in ReferenceExpression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (c = r.getEnclosingCallable()) { + if (e.key_eq(r.getDefinition())) { + if (direction = "Depended") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + for (c in Callable(__all_data__), + e in EnumConstant(__all_data__), + r in ReferenceExpression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (c = r.getEnclosingCallable()) { + if (e.key_eq(r.getDefinition())) { + if (direction = "Depended") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + for (e in Callable(__all_data__), + c in Field(__all_data__), + r in ReferenceExpression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (c.key_eq(r.getDefinition())) { + if (e = r.getEnclosingCallable()) { + if (direction = "Depends") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + for (e in Callable(__all_data__), + c in EnumConstant(__all_data__), + r in ReferenceExpression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (c.key_eq(r.getDefinition())) { + if (e = r.getEnclosingCallable()) { + if (direction = "Depends") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + for (c in Callable(__all_data__), + e in CallExpression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (c = e.getEnclosingCallable()) { + for (m in Method(__all_data__)) { + if (m = e.getMethod()) { + if (!isDirectCall(e)) { + if (direction = "Depended") { + if (type = "DD") { + return e1 + } + } + } + } + } + for (f in LombokField(__all_data__)) { + if (f = e.getLombokField()) { + if (!isDirectCall(e)) { + if (direction = "Depended") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + } + } + for (n in string::__undetermined_all__()) { + for (e in LombokField(__all_data__), + c in CallExpression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (e = c.getLombokField()) { + let (tmp_find = CallExpression(__all_data__).find(e)) { + if (!isDirectCall(tmp_find)) { + if (n = c.getMethodName()) { + if (Self::tmp_0(n)) { + if (direction = "Depended") { + if (type = "DD") { + return e1 + } + } + } + if (!Self::tmp_0(n)) { + if (direction = "Depends") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + } + } + } + } + for (e in Variable(__all_data__), + c in CallExpression(__all_data__), + r in ReferenceExpression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (!isDirectCall(c)) { + for (auto_tmp2 in c.getArguments()) { + if (r.key_eq(auto_tmp2)) { + if (e.key_eq(r.getDefinition())) { + if (direction = "Depended") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + } + } + for (e in CallExpression(__all_data__), + c in CallExpression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (!isDirectCall(c)) { + for (auto_tmp3 in c.getArguments()) { + if (e.key_eq(auto_tmp3)) { + if (direction = "Depended") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + } + for (e in CallExpression(__all_data__), + c in CallExpression(__all_data__), + s in CallExpression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (!isDirectCall(c)) { + for (auto_tmp4 in c.getAnAncestor()) { + if (s.getReference().key_eq(auto_tmp4)) { + for (auto_tmp5 in s.getArguments()) { + if (auto_tmp5.key_eq(e)) { + if (direction = "Depended") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + } + } + } + } + } + + pub fn getAnAncestorDDNode(self, type: string, direction: string) -> ECGNode { + for (e in ECGNode(__all_data__)) { + if (type = "DD") { + if (e = self.getDDNode(type, direction)) { + return e + } + if (e = self.getAnAncestorDDNode(__all_data__, __all_data__).getDDNode(type, direction)) { + return e + } + } + } + } + + pub fn getCDNode(self, type: string, direction: string) -> ECGNode { + for (e in ECGNode(__all_data__), + c in Callable(__all_data__), + r in ReferenceExpression(__all_data__)) { + if (self.key_eq(c)) { + if (type = "CD") { + for (e1 in Method(__all_data__)) { + for (auto_tmp1 in c.getCallee()) { + if (e1.key_eq(auto_tmp1)) { + if (direction = "Depends") { + if (e.key_eq(e1)) { + return e + } + } + } + } + } + for (e2 in Method(__all_data__)) { + for (auto_tmp2 in c.getCaller()) { + if (e2.key_eq(auto_tmp2)) { + if (direction = "Depended") { + if (e.key_eq(e2)) { + return e + } + } + } + } + } + } + } + if (self.key_eq(r.getDefinition())) { + if (c = r.getEnclosingCallable()) { + if (type = "CD") { + for (e1 in Method(__all_data__)) { + for (auto_tmp1 in c.getCallee()) { + if (e1.key_eq(auto_tmp1)) { + if (direction = "Depends") { + if (e.key_eq(e1)) { + return e + } + } + } + } + } + for (e2 in Method(__all_data__)) { + for (auto_tmp2 in c.getCaller()) { + if (e2.key_eq(auto_tmp2)) { + if (direction = "Depended") { + if (e.key_eq(e2)) { + return e + } + } + } + } + } + } + } + } + } + } + + pub fn getAnAncestorCDNode(self, type: string, direction: string) -> ECGNode { + for (e in ECGNode(__all_data__), + c in Callable(__all_data__), + r in ReferenceExpression(__all_data__)) { + if (type = "CD") { + if (self.key_eq(c)) { + for (e1 in Method(__all_data__)) { + for (auto_tmp1 in c.getAnAncestorCallee()) { + if (e1.key_eq(auto_tmp1)) { + if (direction = "Depends") { + if (e.key_eq(e1)) { + return e + } + } + } + } + } + for (e2 in Method(__all_data__)) { + for (auto_tmp2 in c.getAnAncestorCaller()) { + if (e2.key_eq(auto_tmp2)) { + if (direction = "Depended") { + if (e.key_eq(e2)) { + return e + } + } + } + } + } + } + if (self.key_eq(r.getDefinition())) { + if (c = r.getEnclosingCallable()) { + for (e1 in Method(__all_data__)) { + for (auto_tmp1 in c.getAnAncestorCallee()) { + if (e1.key_eq(auto_tmp1)) { + if (direction = "Depends") { + if (e.key_eq(e1)) { + return e + } + } + } + } + } + for (e2 in Method(__all_data__)) { + for (auto_tmp2 in c.getAnAncestorCaller()) { + if (e2.key_eq(auto_tmp2)) { + if (direction = "Depended") { + if (e.key_eq(e2)) { + return e + } + } + } + } + } + } + } + } + } + } + + pub fn getECGNode(self, type: string, direction: string) -> ECGNode { + for (e in ECGNode(__all_data__)) { + if (e = self.getCDNode(type, direction)) { + return e + } + if (e = self.getDDNode(type, direction)) { + return e + } + } + } + + pub fn getAnAncestorECGNode(self, type: string, direction: string) -> ECGNode { + for (e in ECGNode(__all_data__), tmp in ECGNode(__all_data__)) { + if (tmp = self.getAnAncestorCDNode(__all_data__, __all_data__)) { + if (e = tmp.getECGNode(type, direction)) { + return e + } + } + } + } + + pub fn getAnAncestorCDDependedNode(self, type: string, direction: string) -> ECGNode { + for (e in ECGNode(__all_data__), c in Callable(__all_data__), r in ReferenceExpression(__all_data__)) { + if (type = "CD") { + if (self.key_eq(c) || (self.key_eq(r.getDefinition()) && r.getEnclosingCallable() = c)) { + for (e2 in Method(__all_data__), c_caller in c.getAnAncestorCaller()) { + if (e2.key_eq(c_caller) && direction = "Depended" && e.key_eq(e2)) { + return e + } + } + } + } + } + } + + pub fn getECGDependsNode(self, type: string, direction: string) -> ECGNode { + for (e in ECGNode(__all_data__)) { + if (e = self.getCDDependsNode(type, direction)) { + return e + } + if (e = self.getDDDependsNode(type, direction)) { + return e + } + } + } + + pub fn getCDDependsNode(self, type: string, direction: string) -> ECGNode { + for (e in ECGNode(__all_data__), + c in Callable(__all_data__), + r in ReferenceExpression(__all_data__)) { + if (self.key_eq(c)) { + if (type = "CD") { + for (e1 in c.getCallee()) { + if (direction = "Depends") { + if (e.key_eq(e1)) { + return e + } + } + } + } + } + for (v in Variable(__all_data__)) { + if (self.key_eq(v)) { + if (v.key_eq(r.getDefinition())) { + if (c = r.getEnclosingCallable()) { + if (type = "CD") { + for (e1 in c.getCallee()) { + if (direction = "Depends") { + if (e.key_eq(e1)) { + return e + } + } + } + } + } + } + } + } + } + } + + pub fn getDDDependsNode(self, type: string, direction: string) -> ECGNode { + for (e1 in ECGNode(__all_data__)) { + for (r in ReturnStatement(__all_data__), + c in Method(__all_data__), + e in Expression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (c.key_eq(r.getEnclosingCallable())) { + if (e = r.getResult()) { + if (direction = "Depends") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + for (e in Callable(__all_data__), + c in Field(__all_data__), + r in ReferenceExpression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (c.key_eq(r.getDefinition())) { + if (e = r.getEnclosingCallable()) { + if (direction = "Depends") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + for (e in Callable(__all_data__), + c in EnumConstant(__all_data__), + r in ReferenceExpression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (c.key_eq(r.getDefinition())) { + if (e = r.getEnclosingCallable()) { + if (direction = "Depends") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + for (n in string::__undetermined_all__()) { + for (e in LombokField(__all_data__), + c in CallExpression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (e = c.getLombokField()) { + let (tmp = CallExpression(__all_data__).find(e)) { + if (!isDirectCall(tmp)) { + if (n = c.getMethodName()) { + if (!n.matches("get.*")) { + if (direction = "Depends") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + } + } + } + } + } + } + + pub fn getAnAncestorCDDependsNode(self, type: string, direction: string) -> ECGNode { + for (e in ECGNode(__all_data__), + c in Callable(__all_data__), + r in ReferenceExpression(__all_data__)) { + if (type = "CD") { + if (self.key_eq(c)) { + for (e1 in c.getAnAncestorCallee()) { + if (direction = "Depends") { + if (e.key_eq(e1)) { + return e + } + } + } + } + if (self.key_eq(r.getDefinition())) { + if (c = r.getEnclosingCallable()) { + for (e1 in c.getAnAncestorCallee()) { + if (direction = "Depends") { + if (e.key_eq(e1)) { + return e + } + } + } + } + } + } + } + } + + pub fn getPath(self) -> string { + for (line in int::__undetermined_all__(), + t in string::__undetermined_all__(), + path in string::__undetermined_all__(), + info in string::__undetermined_all__()) { + for (l in coref::java::Location(__all_data__)) { + if (l = self.getLocation()) { + if (path = l.getFile().getRelativePath()) { + if (line = l.getStartLineNumber()) { + if (t = line.to_string()) { + if (info = path + ":" + t) { + return info + } + } + } + } + } + } + } + } + + fn tmp_0(n: string) -> bool { + if (n.matches("get.*")) { + return true + } + } +} + +schema ECGXmlNode { + @primary id: int +} + +impl ECGXmlNode { + pub fn __all__(db: XmlDB) -> *ECGXmlNode { + for (e in XmlPomElement(db)) { + yield ECGXmlNode {id : e.id} + } + for (e in XmlSpringElement(db)) { + yield ECGXmlNode {id : e.id} + } + for (e in XmlCharacter(db)) { + yield ECGXmlNode {id : e.id} + } + for (e in XmlAttribute(db)) { + yield ECGXmlNode {id : e.id} + } + } + + pub fn getLocation(self) -> coref::xml::Location { + for (l in coref::xml::Location(__all_data__)) { + for (e in XmlElement(__all_data__)) { + if (self.key_eq(e)) { + if (l = e.getLocation()) { + return l + } + } + } + for (e in XmlAttribute(__all_data__)) { + if (self.key_eq(e)) { + if (l = e.getLocation()) { + return l + } + } + } + for (e in XmlCharacter(__all_data__)) { + if (self.key_eq(e)) { + if (l = e.getLocation()) { + return l + } + } + } + } + } + + pub fn getType(self) -> string { + for (t in string::__undetermined_all__()) { + for (e in XmlElement(__all_data__)) { + if (self.key_eq(e)) { + if (t = "XmlElement") { + return t + } + } + } + for (e in XmlAttribute(__all_data__)) { + if (self.key_eq(e)) { + if (t = "XmlAttribute") { + return t + } + } + } + for (e in XmlCharacter(__all_data__)) { + if (self.key_eq(e)) { + if (t = "XmlCharacter") { + return t + } + } + } + } + } + + pub fn getText(self) -> string { + for (e in XmlElement(__all_data__)) { + if (self.key_eq(e)) { + return e.getName() + } + } + for (e in XmlAttribute(__all_data__)) { + if (self.key_eq(e)) { + return e.getName() + " = " + e.getValue() + } + } + for (e in XmlCharacter(__all_data__)) { + if (self.key_eq(e)) { + return e.getText() + } + } + } + + pub fn getEnclosingECGXmlNode(self) -> ECGXmlNode { + for (e in XmlElement(__all_data__)) { + if (self.key_eq(e)) { + return e.to() + } + } + for (e in XmlAttribute(__all_data__)) { + if (self.key_eq(e)) { + return e.getXmlElement().to() + } + } + for (e in XmlCharacter(__all_data__)) { + if (self.key_eq(e)) { + return e.getBelongedElement().to() + } + } + } +} + +pub fn gitdiff(filePath: string, lineNo: int) -> bool { + // #changeinfo + // example + [ {"test", 1111} ] +} +pub fn transfertofile1(f: File, filename: string, lineNumber: int) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + if (gitdiff(filename, lineNumber)) { + if (!filename.contains("src/test/java")) { + if (filename = f.getRelativePath()) { + if (isCodeLine(f, filename, lineNumber)) { + return true + } + } + } + } + } + } +} +pub fn transfertofile(f: File, filename: string, lineNumber: int) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + if (transfertofile1(f, filename, lineNumber)) { + if (!findSpecialCodeType(filename, lineNumber, __all_data__)) { + return true + } + } + } + } +} +pub fn isComment(filename: string, lineNumber: int) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (f in File(java_db)) { + if (transfertofile1(f, filename, lineNumber)) { + for (e in int::__undetermined_all__(), + s1 in int::__undetermined_all__()) { + for (c in Comment(java_db)) { + if (c.getLocation().getFile() = f) { + if (s1 = c.getLocation().getStartLineNumber()) { + if (e = c.getLocation().getEndLineNumber()) { + if (lineNumber > s1 - 1) { + if (lineNumber < e + 1) { + return true + } + } + } + } + } + } + } + for (e in int::__undetermined_all__(), + s1 in int::__undetermined_all__()) { + for (c in JavadocComment(java_db)) { + if (c.getLocation().getFile() = f) { + if (s1 = c.getLocation().getStartLineNumber()) { + if (e = c.getLocation().getEndLineNumber()) { + if (lineNumber > s1 - 1) { + if (lineNumber < e + 1) { + return true + } + } + } + } + } + } + } + } + } + } + } +} +pub fn isAnnotation(filename: string, lineNumber: int) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (f in File(java_db)) { + if (transfertofile1(f, filename, lineNumber)) { + for (e in int::__undetermined_all__(), + s1 in int::__undetermined_all__()) { + for (c in Annotation(java_db)) { + if (c.getLocation().getFile() = f) { + if (s1 = c.getLocation().getStartLineNumber()) { + if (e = c.getLocation().getEndLineNumber()) { + if (lineNumber > s1 - 1) { + if (lineNumber < e + 1) { + return true + } + } + } + } + } + } + } + } + } + } + } +} +pub fn isCodeLine(f: File, filename: string, lineNumber: int) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + if (gitdiff(filename, lineNumber)) { + if (f.getRelativePath() = filename) { + for (e in int::__undetermined_all__(), + s1 in int::__undetermined_all__()) { + for (l in coref::java::Location(java_db)) { + if (l.getFile() = f) { + if (s1 = l.getStartLineNumber()) { + if (e = l.getEndLineNumber()) { + if (lineNumber > s1 - 1) { + if (lineNumber < e + 1) { + return true + } + } + } + } + } + } + } + } + } + } + } +} +pub fn isLog(filename: string, lineNumber: int) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (f in File(java_db)) { + if (transfertofile1(f, filename, lineNumber)) { + for (e in int::__undetermined_all__(), + s1 in int::__undetermined_all__(), + text in string::__undetermined_all__()) { + for (c in Expression(java_db)) { + if (c.getLocation().getFile() = f) { + if (s1 = c.getLocation().getStartLineNumber()) { + if (e = c.getLocation().getEndLineNumber()) { + if (lineNumber > s1 - 1) { + if (lineNumber < e + 1) { + if (text = c.getPrintableText()) { + if (text.matches("^logger\\..*")) { + return true + } + } + } + } + } + } + } + } + } + } + } + } + } +} +pub fn getTypeInAST(filename: string, lineNumber: int, typeInAST: string) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (f in File(java_db)) { + if (transfertofile(f, filename, lineNumber)) { + for (e in int::__undetermined_all__(), + s1 in int::__undetermined_all__()) { + for (c in ElementParent(java_db)) { + if (c.getLocation().getFile() = f) { + if (s1 = c.getLocation().getStartLineNumber()) { + if (e = c.getLocation().getEndLineNumber()) { + if (s1 = e) { + if (lineNumber > s1 - 1) { + if (lineNumber < e + 1) { + if (typeInAST = c.getType()) { + return true + } + } + } + } + } + } + } + } + } + } + } + } + } +} +pub fn getTypeInECG(filename: string, lineNumber: int, typeInAST: string, n: ECGNode) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (f in File(java_db)) { + if (transfertofile(f, filename, lineNumber)) { + if (tmp_0(filename, lineNumber)) { + if (typeInAST = "Callable") { + if (getBelongedCallable(filename, lineNumber, Callable(java_db).find(n))) { + return true + } + } + } + if (!(tmp_0(filename, lineNumber))) { + for (e in int::__undetermined_all__(), + s1 in int::__undetermined_all__()) { + if (n.getLocation().getFile() = f) { + if (s1 = n.getLocation().getStartLineNumber()) { + if (e = n.getLocation().getEndLineNumber()) { + if (lineNumber > s1 - 1) { + if (lineNumber < e + 1) { + if (typeInAST = n.getType()) { + if (isFieldOrEnum(ECGNode(java_db).find(n))) { + return true + } + } + } + } + } + } + } + } + } + } + } + } + } +} +pub fn isFieldOrEnum(c: ECGNode) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (f in Field(java_db)) { + if (f.key_eq(c)) { + return true + } + } + for (e in EnumConstant(java_db)) { + if (e.key_eq(c)) { + return true + } + } + } + } +} +pub fn findSpecialCodeType(filename: string, lineNumber: int, type: string) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + if (isComment(filename, lineNumber)) { + if (type = "comment") { + return true + } + } + if (isAnnotation(filename, lineNumber)) { + if (type = "annotation") { + return true + } + } + if (isLog(filename, lineNumber)) { + if (type = "log") { + return true + } + } + } + } +} +pub fn getBelongedCallable(filename: string, lineNumber: int, c: Callable) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (f in File(java_db)) { + if (transfertofile(f, filename, lineNumber)) { + for (l1 in int::__undetermined_all__(), + l2 in int::__undetermined_all__()) { + for (i in Identifier(java_db)) { + if (f = c.getLocation().getFile()) { + if (c.key_eq(i.getParent())) { + if (l1 = i.getLocation().getStartLineNumber()) { + if (l2 = c.getLocation().getEndLineNumber()) { + if (lineNumber > l1 - 1) { + if (lineNumber < l2 + 1) { + return true + } + } + } + } + } + } + } + } + } + } + } + } +} +pub fn getBelongedCallableSignature(filename: string, lineNumber: int, belongedCallable: string) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (i in int::__undetermined_all__()) { + for (c in Callable(java_db)) { + if (transfertofile(__all_data__, filename, lineNumber)) { + if (i = tmp_1().len()) { + if (tmp_2(i)) { + if (belongedCallable = "") { + return true + } + } + if (!(tmp_2(i))) { + if (getBelongedCallable(filename, lineNumber, c)) { + if (belongedCallable = c.getSignature()) { + return true + } + } + } + } + } + } + } + } + } +} +pub fn getJavaECGNode(n: ECGNode) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (lineNumber in int::__undetermined_all__(), + filename in string::__undetermined_all__(), + typeInAST in string::__undetermined_all__(), + belongedCallable in string::__undetermined_all__()) { + if (transfertofile(__all_data__, filename, lineNumber)) { + if (getBelongedCallableSignature(filename, lineNumber, belongedCallable)) { + if (getTypeInECG(filename, lineNumber, typeInAST, n)) { + return true + } + } + } + } + } + } +} +pub fn transfertoXmlfile(f: XmlFile, filename: string, lineNumber: int) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + if (gitdiff(filename, lineNumber)) { + if (filename = f.getRelativePath()) { + return true + } + } + } + } +} +pub fn getXmlECGNode1(n: ECGXmlNode) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (lineNumber in int::__undetermined_all__(), + e in int::__undetermined_all__(), + s1 in int::__undetermined_all__(), + filename in string::__undetermined_all__(), + typeInAST in string::__undetermined_all__(), + text in string::__undetermined_all__()) { + for (f in XmlFile(xml_db), + o in ECGXmlNode(xml_db)) { + if (transfertoXmlfile(f, filename, lineNumber)) { + if (n.getLocation().getFile() = f) { + if (s1 = n.getLocation().getStartLineNumber()) { + if (e = n.getLocation().getEndLineNumber()) { + if (lineNumber > s1 - 1) { + if (lineNumber < e + 1) { + if (typeInAST = n.getType()) { + if (text = n.getText()) { + if (o = n.getEnclosingECGXmlNode()) { + return true + } + } + } + } + } + } + } + } + } + } + } + } + } +} +@inline +pub fn trim(n: string, m: string) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (i in int::__undetermined_all__()) { + if (i = n.len()) { + if (tmp_3(n)) { + if (m = n.substr(1,i - 2)) { + return true + } + } + if (!(tmp_3(n))) { + if (m = n) { + return true + } + } + } + } + } + } +} +pub fn getXmlECGNode(f: ECGNode) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (c in ClassOrInterface(java_db), + n in string::__undetermined_all__(), + m in string::__undetermined_all__()) { + for (r in ECGXmlNode(xml_db)) { + if (getXmlECGNode1(r)) { + if (getChangeSetByDalXmlElement(r, c, Method(java_db).find(f), n, m)) { + return true + } + if (getChangeSetByResultXmlElement(r, c, Field(java_db).find(f), n, m)) { + return true + } + } + } + } + } + } +} +pub fn getChangeSetByResultXmlElement(r1: ECGXmlNode, c: ClassOrInterface, f: Field, n: string, m: string) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (r in ResultXmlElement(xml_db)) { + if (r.key_eq(r1)) { + if (getXmlECGNode1(ECGXmlNode(xml_db).find(r))) { + if (n = r.getBelongedMapXmlElement().getMappingClassName()) { + if (n = c.getQualifiedName()) { + if (c = f.getParent()) { + if (r.getValueByAttributeName("property") = f.getName()) { + if (m = f.getName()) { + return true + } + } + } + } + } + } + } + } + } + } +} +pub fn getChangeSetByDalXmlElement(d1: ECGXmlNode, c: ClassOrInterface, m: Method, className: string, methodName: string) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (i in int::__undetermined_all__(), + temp in string::__undetermined_all__(), + temp1 in string::__undetermined_all__(), + n in string::__undetermined_all__()) { + for (d in DalXmlElement(xml_db), + cc in XmlComment(xml_db), + l in Literal(java_db)) { + if (d.key_eq(d1)) { + if (getXmlECGNode1(ECGXmlNode(xml_db).find(d))) { + if (d.getLocation().getFile() = cc.getLocation().getFile()) { + if (cc.getLocation().getEndLineNumber() = i) { + if (i + 1 = d.getLocation().getStartLineNumber()) { + if (temp = cc.getText()) { + if (c.getName() = temp.get_regex_match_result("[\\s\\S]*mapped statement for[ \\t]+(\\w+)[\\s\\S]*", 1)) { + if (n = d.getValueByAttributeName("id")) { + if (c.key_eq(m.getBelongedClass())) { + if (m.key_eq(l.getEnclosingCallable())) { + if (temp1 = l.getValue()) { + if (trim(temp1, n)) { + if (className = c.getQualifiedName()) { + if (methodName = m.getSignature()) { + return true + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } +} +schema SofaServiceBinding extends Annotation { + +} + +impl SofaServiceBinding { + + @data_constraint + @inline + pub fn __all__(db: JavaDB) -> *SofaServiceBinding { + for (tmp in Annotation(db)) { + if (tmp.getName() = "SofaServiceBinding") { + yield SofaServiceBinding { + id : tmp.id + } + } + } + } + + pub fn getType(self) -> string { + for (value in string::__undetermined_all__()) { + for (argus in AnnotationAccessArgument(__all_data__)) { + for (auto_tmp1 in self.getAnnotationArgument()) { + if (argus = auto_tmp1) { + if (argus.getAnnotationArgumentName() = "bindingType") { + if (value = argus.getAnnotationArgumentValue()) { + return value + } + } + } + } + } + } + } + + +} + +pub fn javaOutput(classname: string, name: string) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (s in SofaService(java_db), + c in Class(java_db), + i in ClassOrInterface(java_db)) { + for (auto_tmp1 in c.getAnnotation()) { + if (s.key_eq(auto_tmp1)) { + if (classname = c.getQualifiedName()) { + for (auto_tmp2 in c.getImplementsInterface()) { + if (i.key_eq(auto_tmp2)) { + if (name = i.getQualifiedName()) { + return true + } + } + } + if (i = s.getService()) { + if (name = i.getQualifiedName()) { + return true + } + } + } + } + } + } + } + } +} +pub fn xmlOutput(className: string, interfaceName: string) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (temp in string::__undetermined_all__()) { + for (s in SofaServiceXmlElement(xml_db), + b in BeanXmlElement(xml_db)) { + if (s.getRef() = b.getId()) { + if (interfaceName = s.getInterfaceName()) { + if (className = b.getClass()) { + if (temp = b.getLocation().getFile().getRelativePath()) { + if (!temp.contains("src/test/resources")) { + return true + } + } + } + } + } + } + } + } + } +} +pub fn annoOutput(className: string, interfaceName: string) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (v in string::__undetermined_all__(), + k in string::__undetermined_all__()) { + for (s in SofaServiceXmlElement(xml_db), + b in Class(java_db), + t in TagXmlElement(xml_db), + a in Annotation(java_db)) { + if (s.key_eq(t.getParent())) { + if (v = s.getRef()) { + if (interfaceName = s.getInterfaceName()) { + for (auto_tmp1 in b.getAnnotation()) { + if (a = auto_tmp1) { + if (a.getName() = k) { + if (getTrAnnotationName(k)) { + for (auto_tmp2 in a.getAnnotationArgument()) { + if (auto_tmp2.getAnnotationArgumentValue() = "\"" + v + "\"") { + if (className = b.getQualifiedName()) { + return true + } + } + } + } + } + } + } + } + } + } + } + } + } + } +} +pub fn getTrAnnotationName(a: string) -> bool { + [ + {"Service"}, + {"Component"}, + {"Scope"}, + {"Repository"}, + {"Controller"}, + {"RestController"}, + {"RequestMapping"}, + {"PathVariable"}, + {"ResponseBody"}, + {"bean"} + ] +} +pub fn getPublishTr(c: ClassOrInterface) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (className in string::__undetermined_all__(), + interfaceName in string::__undetermined_all__()) { + if (xmlOutput(className, interfaceName)) { + if (interfaceName = c.getQualifiedName()) { + return true + } + } + if (javaOutput(className, interfaceName)) { + if (interfaceName = c.getQualifiedName()) { + return true + } + } + if (annoOutput(className, interfaceName)) { + if (interfaceName = c.getQualifiedName()) { + return true + } + } + } + } + } +} +schema SofaService extends Annotation { + +} + +impl SofaService { + + @data_constraint + @inline + pub fn __all__(db: JavaDB) -> *SofaService { + for (tmp in Annotation(db)) { + if (tmp.getName() = "SofaService") { + yield SofaService { + id : tmp.id + } + } + } + } + + pub fn getService(self) -> ClassOrInterface { + for (value in string::__undetermined_all__()) { + for (i in ClassOrInterface(__all_data__), + argus in AnnotationAccessArgument(__all_data__)) { + for (auto_tmp1 in self.getAnnotationArgument()) { + if (argus = auto_tmp1) { + if (argus.getAnnotationArgumentName() = "interfaceType") { + if (value = argus.getAnnotationArgumentValue()) { + if (i.getQualifiedName() = value) { + return i + } + } + } + } + } + } + } + } + + @inline + pub fn getBinding(self) -> SofaServiceBinding { + for (b in SofaServiceBinding(__all_data__), + argus in AnnotationAccessArgument(__all_data__)) { + for (auto_tmp1 in self.getAnnotationArgument()) { + if (argus = auto_tmp1) { + if (argus.getAnnotationArgumentName() = "bindings") { + if (b.key_eq(argus.getArgumentAnnotation())) { + return b + } + if (argus.key_eq(b.getParent())) { + return b + } + } + } + } + } + } + + @inline + pub fn getUniqueId(self) -> string { + for (uniqueId in string::__undetermined_all__()) { + for (anno in Annotation(__all_data__)) { + if (self.key_eq(anno)) { + if (tmp_6(anno)) { + for (argus in AnnotationAccessArgument(__all_data__)) { + for (auto_tmp1 in anno.getAnnotationArgument()) { + if (argus = auto_tmp1) { + if (argus.getAnnotationArgumentName() = "uniqueId") { + if (uniqueId = argus.getAnnotationArgumentValue()) { + return uniqueId + } + } + } + } + } + } + if (!(tmp_6(anno))) { + if (uniqueId = "null") { + return uniqueId + } + } + } + } + } + } + + +} + +pub fn uniqueArgument(anno: Annotation) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (argus in AnnotationAccessArgument(java_db)) { + for (auto_tmp1 in anno.getAnnotationArgument()) { + if (argus = auto_tmp1) { + if (argus.getAnnotationArgumentName() = "uniqueId") { + return true + } + } + } + } + } + } +} +pub fn output1(c: ClassOrInterface, interfaceName: string, id: int) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (i in int::__undetermined_all__(), + j in int::__undetermined_all__(), + className in string::__undetermined_all__()) { + if (xmlOutput(className, interfaceName)) { + for (temp in string::__undetermined_all__()) { + for (e1 in ECGNode(java_db), + e2 in ECGXmlNode(xml_db)) { + if (getJavaECGNode(e1)) { + if (getXmlECGNode1(e2)) { + if (c.key_eq(e1.getElementParent())) { + if (temp = c.getQualifiedName()) { + if (id = e1.id) { + if (temp = className) { + return true + } + if (temp = interfaceName) { + return true + } + } + if (e2.id = i) { + if (id = e2.id) { + return true + } + } + if (e2.id = j) { + if (id = e2.id) { + return true + } + } + } + } + } + } + } + } + } + if (javaOutput(className, interfaceName)) { + for (temp in string::__undetermined_all__()) { + for (e1 in ECGNode(java_db), + e2 in ECGXmlNode(xml_db)) { + if (getJavaECGNode(e1)) { + if (getXmlECGNode1(e2)) { + if (c.key_eq(e1.getElementParent())) { + if (temp = c.getQualifiedName()) { + if (id = e1.id) { + if (temp = className) { + return true + } + if (temp = interfaceName) { + return true + } + } + if (e2.id = i) { + if (id = e2.id) { + return true + } + } + if (e2.id = j) { + if (id = e2.id) { + return true + } + } + } + } + } + } + } + } + } + if (annoOutput(className, interfaceName)) { + for (temp in string::__undetermined_all__()) { + for (e1 in ECGNode(java_db), + e2 in ECGXmlNode(xml_db)) { + if (getJavaECGNode(e1)) { + if (getXmlECGNode1(e2)) { + if (c.key_eq(e1.getElementParent())) { + if (temp = c.getQualifiedName()) { + if (id = e1.id) { + if (temp = className) { + return true + } + if (temp = interfaceName) { + return true + } + } + if (e2.id = i) { + if (id = e2.id) { + return true + } + } + if (e2.id = j) { + if (id = e2.id) { + return true + } + } + } + } + } + } + } + } + } + } + } + } +} +pub fn output2(c: ClassOrInterface, interfaceName: string, n: ECGNode) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (m in ECGNode(java_db)) { + if (getJavaECGNode(m)) { + if (getPublishTr(c)) { + for (t in Method(java_db)) { + if (n.key_eq(t)) { + if (c = t.getParent()) { + if (n = m.getAnAncestorCDDependedNode(__all_data__, __all_data__)) { + if (interfaceName = c.getQualifiedName()) { + return true + } + } + } + } + } + for (f in Field(java_db)) { + if (n.key_eq(f)) { + if (c = f.getParent()) { + if (n = m.getAnAncestorCDDependedNode(__all_data__, __all_data__)) { + if (interfaceName = c.getQualifiedName()) { + return true + } + } + } + } + } + } + } + if (getXmlECGNode(m)) { + if (getPublishTr(c)) { + for (t in Method(java_db)) { + if (n.key_eq(t)) { + if (c = t.getParent()) { + if (n = m.getAnAncestorCDDependedNode(__all_data__, __all_data__)) { + if (interfaceName = c.getQualifiedName()) { + return true + } + } + } + } + } + for (f in Field(java_db)) { + if (n.key_eq(f)) { + if (c = f.getParent()) { + if (n = m.getAnAncestorCDDependedNode(__all_data__, __all_data__)) { + if (interfaceName = c.getQualifiedName()) { + return true + } + } + } + } + } + } + } + } + } + } +} +pub fn real_output(interfaceName: string) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (n in ECGNode(java_db)) { + for (c in ClassOrInterface(java_db)) { + if (output2(c, interfaceName, n)) { + return true + } + if (output1(c, interfaceName, n.id)) { + return true + } + } + } + } + } +} + + +fn default_java_db() -> JavaDB { + return JavaDB::load("coref_java_src.db") +} + +fn default_xml_db() -> XmlDB { + return XmlDB::load("coref_xml_src.db") +} + +fn tmp_0(filename: string, lineNumber: int) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + if (getBelongedCallable(filename, lineNumber, __all_data__)) { + return true + } + } + } +} + +fn tmp_1() -> *string { + for (filename in string::__undetermined_all__(), lineNumber in int::__undetermined_all__()) { + if (getBelongedCallable(filename, lineNumber, __all_data__)) { + yield filename + } + } +} + +fn tmp_2(i: int) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + if (i = 0) { + return true + } + } + } +} + +fn tmp_3(n: string) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + if (n.substr(0,1) = "\"") { + return true + } + } + } +} + +fn tmp_4(anno: Annotation) -> *auto_tmp_5 { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + if (uniqueArgument(anno)) { + yield auto_tmp_5 { + + } + } + } + } +} + +schema auto_tmp_5 { + +} + +fn tmp_6(anno: Annotation) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + if (tmp_4(anno).len() = 1) { + return true + } + } + } +} + +fn main() { + output(real_output()) +} \ No newline at end of file diff --git a/example/icse25/rules/rule6_8_spring.gdl b/example/icse25/rules/rule6_8_spring.gdl new file mode 100644 index 00000000..64462821 --- /dev/null +++ b/example/icse25/rules/rule6_8_spring.gdl @@ -0,0 +1,1573 @@ +// script +use coref::java::* +use coref::xml::* + +schema ECGNode extends ElementParent {} + +impl ECGNode { + pub fn __all__(db: JavaDB) -> *ECGNode { + for (tmp in ElementParent(db)) { + for (m in Method(db)) { + if (tmp.key_eq(m)) { + yield ECGNode { + id : tmp.id + } + } + } + for (m in Variable(db)) { + if (tmp.key_eq(m)) { + yield ECGNode { + id : tmp.id + } + } + } + for (m in Expression(db)) { + if (tmp.key_eq(m)) { + yield ECGNode { + id : tmp.id + } + } + } + } + } + + pub fn getType(self) -> string { + for (t in string::__undetermined_all__()) { + for (m in Method(__all_data__)) { + if (self.key_eq(m)) { + if (t = "Method") { + return t + } + } + } + for (m in LocalVariable(__all_data__)) { + if (self.key_eq(m)) { + if (t = "LocalVariable") { + return t + } + } + } + for (m in Parameter(__all_data__)) { + if (self.key_eq(m)) { + if (t = "Parameter") { + return t + } + } + } + for (m in Field(__all_data__)) { + if (self.key_eq(m)) { + if (t = "Field") { + return t + } + } + } + for (m in EnumConstant(__all_data__)) { + if (self.key_eq(m)) { + if (t = "EnumConstant") { + return t + } + } + } + for (m in Expression(__all_data__)) { + if (self.key_eq(m)) { + if (t = m.getType()) { + return t + } + } + } + } + } + + pub fn getDDNode(self, type: string, direction: string) -> ECGNode { + for (e1 in ECGNode(__all_data__)) { + for (e in Parameter(__all_data__), + c in Method(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + for (auto_tmp1 in c.getParameter()) { + if (e = auto_tmp1) { + if (direction = "Depended") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + for (r in ReturnStatement(__all_data__), + c in Method(__all_data__), + e in Expression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (c.key_eq(r.getEnclosingCallable())) { + if (e = r.getResult()) { + if (direction = "Depends") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + for (c in Callable(__all_data__), + e in Field(__all_data__), + r in ReferenceExpression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (c = r.getEnclosingCallable()) { + if (e.key_eq(r.getDefinition())) { + if (direction = "Depended") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + for (c in Callable(__all_data__), + e in EnumConstant(__all_data__), + r in ReferenceExpression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (c = r.getEnclosingCallable()) { + if (e.key_eq(r.getDefinition())) { + if (direction = "Depended") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + for (e in Callable(__all_data__), + c in Field(__all_data__), + r in ReferenceExpression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (c.key_eq(r.getDefinition())) { + if (e = r.getEnclosingCallable()) { + if (direction = "Depends") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + for (e in Callable(__all_data__), + c in EnumConstant(__all_data__), + r in ReferenceExpression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (c.key_eq(r.getDefinition())) { + if (e = r.getEnclosingCallable()) { + if (direction = "Depends") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + for (c in Callable(__all_data__), + e in CallExpression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (c = e.getEnclosingCallable()) { + for (m in Method(__all_data__)) { + if (m = e.getMethod()) { + if (!isDirectCall(e)) { + if (direction = "Depended") { + if (type = "DD") { + return e1 + } + } + } + } + } + for (f in LombokField(__all_data__)) { + if (f = e.getLombokField()) { + if (!isDirectCall(e)) { + if (direction = "Depended") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + } + } + for (n in string::__undetermined_all__()) { + for (e in LombokField(__all_data__), + c in CallExpression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (e = c.getLombokField()) { + let (tmp_find = CallExpression(__all_data__).find(e)) { + if (!isDirectCall(tmp_find)) { + if (n = c.getMethodName()) { + if (Self::tmp_0(n)) { + if (direction = "Depended") { + if (type = "DD") { + return e1 + } + } + } + if (!Self::tmp_0(n)) { + if (direction = "Depends") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + } + } + } + } + for (e in Variable(__all_data__), + c in CallExpression(__all_data__), + r in ReferenceExpression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (!isDirectCall(c)) { + for (auto_tmp2 in c.getArguments()) { + if (r.key_eq(auto_tmp2)) { + if (e.key_eq(r.getDefinition())) { + if (direction = "Depended") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + } + } + for (e in CallExpression(__all_data__), + c in CallExpression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (!isDirectCall(c)) { + for (auto_tmp3 in c.getArguments()) { + if (e.key_eq(auto_tmp3)) { + if (direction = "Depended") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + } + for (e in CallExpression(__all_data__), + c in CallExpression(__all_data__), + s in CallExpression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (!isDirectCall(c)) { + for (auto_tmp4 in c.getAnAncestor()) { + if (s.getReference().key_eq(auto_tmp4)) { + for (auto_tmp5 in s.getArguments()) { + if (auto_tmp5.key_eq(e)) { + if (direction = "Depended") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + } + } + } + } + } + + pub fn getAnAncestorDDNode(self, type: string, direction: string) -> ECGNode { + for (e in ECGNode(__all_data__)) { + if (type = "DD") { + if (e = self.getDDNode(type, direction)) { + return e + } + if (e = self.getAnAncestorDDNode(__all_data__, __all_data__).getDDNode(type, direction)) { + return e + } + } + } + } + + pub fn getCDNode(self, type: string, direction: string) -> ECGNode { + for (e in ECGNode(__all_data__), + c in Callable(__all_data__), + r in ReferenceExpression(__all_data__)) { + if (self.key_eq(c)) { + if (type = "CD") { + for (e1 in Method(__all_data__)) { + for (auto_tmp1 in c.getCallee()) { + if (e1.key_eq(auto_tmp1)) { + if (direction = "Depends") { + if (e.key_eq(e1)) { + return e + } + } + } + } + } + for (e2 in Method(__all_data__)) { + for (auto_tmp2 in c.getCaller()) { + if (e2.key_eq(auto_tmp2)) { + if (direction = "Depended") { + if (e.key_eq(e2)) { + return e + } + } + } + } + } + } + } + if (self.key_eq(r.getDefinition())) { + if (c = r.getEnclosingCallable()) { + if (type = "CD") { + for (e1 in Method(__all_data__)) { + for (auto_tmp1 in c.getCallee()) { + if (e1.key_eq(auto_tmp1)) { + if (direction = "Depends") { + if (e.key_eq(e1)) { + return e + } + } + } + } + } + for (e2 in Method(__all_data__)) { + for (auto_tmp2 in c.getCaller()) { + if (e2.key_eq(auto_tmp2)) { + if (direction = "Depended") { + if (e.key_eq(e2)) { + return e + } + } + } + } + } + } + } + } + } + } + + pub fn getAnAncestorCDNode(self, type: string, direction: string) -> ECGNode { + for (e in ECGNode(__all_data__), + c in Callable(__all_data__), + r in ReferenceExpression(__all_data__)) { + if (type = "CD") { + if (self.key_eq(c)) { + for (e1 in Method(__all_data__)) { + for (auto_tmp1 in c.getAnAncestorCallee()) { + if (e1.key_eq(auto_tmp1)) { + if (direction = "Depends") { + if (e.key_eq(e1)) { + return e + } + } + } + } + } + for (e2 in Method(__all_data__)) { + for (auto_tmp2 in c.getAnAncestorCaller()) { + if (e2.key_eq(auto_tmp2)) { + if (direction = "Depended") { + if (e.key_eq(e2)) { + return e + } + } + } + } + } + } + if (self.key_eq(r.getDefinition())) { + if (c = r.getEnclosingCallable()) { + for (e1 in Method(__all_data__)) { + for (auto_tmp1 in c.getAnAncestorCallee()) { + if (e1.key_eq(auto_tmp1)) { + if (direction = "Depends") { + if (e.key_eq(e1)) { + return e + } + } + } + } + } + for (e2 in Method(__all_data__)) { + for (auto_tmp2 in c.getAnAncestorCaller()) { + if (e2.key_eq(auto_tmp2)) { + if (direction = "Depended") { + if (e.key_eq(e2)) { + return e + } + } + } + } + } + } + } + } + } + } + + pub fn getECGNode(self, type: string, direction: string) -> ECGNode { + for (e in ECGNode(__all_data__)) { + if (e = self.getCDNode(type, direction)) { + return e + } + if (e = self.getDDNode(type, direction)) { + return e + } + } + } + + pub fn getAnAncestorECGNode(self, type: string, direction: string) -> ECGNode { + for (e in ECGNode(__all_data__), tmp in ECGNode(__all_data__)) { + if (tmp = self.getAnAncestorCDNode(__all_data__, __all_data__)) { + if (e = tmp.getECGNode(type, direction)) { + return e + } + } + } + } + + pub fn getAnAncestorCDDependedNode(self, type: string, direction: string) -> ECGNode { + for (e in ECGNode(__all_data__), c in Callable(__all_data__), r in ReferenceExpression(__all_data__)) { + if (type = "CD") { + if (self.key_eq(c) || (self.key_eq(r.getDefinition()) && r.getEnclosingCallable() = c)) { + for (e2 in Method(__all_data__), c_caller in c.getAnAncestorCaller()) { + if (e2.key_eq(c_caller) && direction = "Depended" && e.key_eq(e2)) { + return e + } + } + } + } + } + } + + pub fn getECGDependsNode(self, type: string, direction: string) -> ECGNode { + for (e in ECGNode(__all_data__)) { + if (e = self.getCDDependsNode(type, direction)) { + return e + } + if (e = self.getDDDependsNode(type, direction)) { + return e + } + } + } + + pub fn getCDDependsNode(self, type: string, direction: string) -> ECGNode { + for (e in ECGNode(__all_data__), + c in Callable(__all_data__), + r in ReferenceExpression(__all_data__)) { + if (self.key_eq(c)) { + if (type = "CD") { + for (e1 in c.getCallee()) { + if (direction = "Depends") { + if (e.key_eq(e1)) { + return e + } + } + } + } + } + for (v in Variable(__all_data__)) { + if (self.key_eq(v)) { + if (v.key_eq(r.getDefinition())) { + if (c = r.getEnclosingCallable()) { + if (type = "CD") { + for (e1 in c.getCallee()) { + if (direction = "Depends") { + if (e.key_eq(e1)) { + return e + } + } + } + } + } + } + } + } + } + } + + pub fn getDDDependsNode(self, type: string, direction: string) -> ECGNode { + for (e1 in ECGNode(__all_data__)) { + for (r in ReturnStatement(__all_data__), + c in Method(__all_data__), + e in Expression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (c.key_eq(r.getEnclosingCallable())) { + if (e = r.getResult()) { + if (direction = "Depends") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + for (e in Callable(__all_data__), + c in Field(__all_data__), + r in ReferenceExpression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (c.key_eq(r.getDefinition())) { + if (e = r.getEnclosingCallable()) { + if (direction = "Depends") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + for (e in Callable(__all_data__), + c in EnumConstant(__all_data__), + r in ReferenceExpression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (c.key_eq(r.getDefinition())) { + if (e = r.getEnclosingCallable()) { + if (direction = "Depends") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + for (n in string::__undetermined_all__()) { + for (e in LombokField(__all_data__), + c in CallExpression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (e = c.getLombokField()) { + let (tmp = CallExpression(__all_data__).find(e)) { + if (!isDirectCall(tmp)) { + if (n = c.getMethodName()) { + if (!n.matches("get.*")) { + if (direction = "Depends") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + } + } + } + } + } + } + + pub fn getAnAncestorCDDependsNode(self, type: string, direction: string) -> ECGNode { + for (e in ECGNode(__all_data__), + c in Callable(__all_data__), + r in ReferenceExpression(__all_data__)) { + if (type = "CD") { + if (self.key_eq(c)) { + for (e1 in c.getAnAncestorCallee()) { + if (direction = "Depends") { + if (e.key_eq(e1)) { + return e + } + } + } + } + if (self.key_eq(r.getDefinition())) { + if (c = r.getEnclosingCallable()) { + for (e1 in c.getAnAncestorCallee()) { + if (direction = "Depends") { + if (e.key_eq(e1)) { + return e + } + } + } + } + } + } + } + } + + pub fn getPath(self) -> string { + for (line in int::__undetermined_all__(), + t in string::__undetermined_all__(), + path in string::__undetermined_all__(), + info in string::__undetermined_all__()) { + for (l in coref::java::Location(__all_data__)) { + if (l = self.getLocation()) { + if (path = l.getFile().getRelativePath()) { + if (line = l.getStartLineNumber()) { + if (t = line.to_string()) { + if (info = path + ":" + t) { + return info + } + } + } + } + } + } + } + } + + fn tmp_0(n: string) -> bool { + if (n.matches("get.*")) { + return true + } + } +} + +schema ECGXmlNode { + @primary id: int +} + +impl ECGXmlNode { + pub fn __all__(db: XmlDB) -> *ECGXmlNode { + for (e in XmlPomElement(db)) { + yield ECGXmlNode {id : e.id} + } + for (e in XmlSpringElement(db)) { + yield ECGXmlNode {id : e.id} + } + for (e in XmlCharacter(db)) { + yield ECGXmlNode {id : e.id} + } + for (e in XmlAttribute(db)) { + yield ECGXmlNode {id : e.id} + } + } + + pub fn getLocation(self) -> coref::xml::Location { + for (l in coref::xml::Location(__all_data__)) { + for (e in XmlElement(__all_data__)) { + if (self.key_eq(e)) { + if (l = e.getLocation()) { + return l + } + } + } + for (e in XmlAttribute(__all_data__)) { + if (self.key_eq(e)) { + if (l = e.getLocation()) { + return l + } + } + } + for (e in XmlCharacter(__all_data__)) { + if (self.key_eq(e)) { + if (l = e.getLocation()) { + return l + } + } + } + } + } + + pub fn getType(self) -> string { + for (t in string::__undetermined_all__()) { + for (e in XmlElement(__all_data__)) { + if (self.key_eq(e)) { + if (t = "XmlElement") { + return t + } + } + } + for (e in XmlAttribute(__all_data__)) { + if (self.key_eq(e)) { + if (t = "XmlAttribute") { + return t + } + } + } + for (e in XmlCharacter(__all_data__)) { + if (self.key_eq(e)) { + if (t = "XmlCharacter") { + return t + } + } + } + } + } + + pub fn getText(self) -> string { + for (e in XmlElement(__all_data__)) { + if (self.key_eq(e)) { + return e.getName() + } + } + for (e in XmlAttribute(__all_data__)) { + if (self.key_eq(e)) { + return e.getName() + " = " + e.getValue() + } + } + for (e in XmlCharacter(__all_data__)) { + if (self.key_eq(e)) { + return e.getText() + } + } + } + + pub fn getEnclosingECGXmlNode(self) -> ECGXmlNode { + for (e in XmlElement(__all_data__)) { + if (self.key_eq(e)) { + return e.to() + } + } + for (e in XmlAttribute(__all_data__)) { + if (self.key_eq(e)) { + return e.getXmlElement().to() + } + } + for (e in XmlCharacter(__all_data__)) { + if (self.key_eq(e)) { + return e.getBelongedElement().to() + } + } + } +} + +pub fn gitdiff(filePath: string, lineNo: int) -> bool { + // #changeinfo + // example + [ {"test", 1111} ] +} +pub fn transfertofile1(f: File, filename: string, lineNumber: int) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + if (gitdiff(filename, lineNumber)) { + if (!filename.contains("src/test/java")) { + if (filename = f.getRelativePath()) { + if (isCodeLine(f, filename, lineNumber)) { + return true + } + } + } + } + } + } +} +pub fn transfertofile(f: File, filename: string, lineNumber: int) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + if (transfertofile1(f, filename, lineNumber)) { + if (!findSpecialCodeType(filename, lineNumber, __all_data__)) { + return true + } + } + } + } +} +pub fn isComment(filename: string, lineNumber: int) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (f in File(java_db)) { + if (transfertofile1(f, filename, lineNumber)) { + for (e in int::__undetermined_all__(), + s1 in int::__undetermined_all__()) { + for (c in Comment(java_db)) { + if (c.getLocation().getFile() = f) { + if (s1 = c.getLocation().getStartLineNumber()) { + if (e = c.getLocation().getEndLineNumber()) { + if (lineNumber > s1 - 1) { + if (lineNumber < e + 1) { + return true + } + } + } + } + } + } + } + for (e in int::__undetermined_all__(), + s1 in int::__undetermined_all__()) { + for (c in JavadocComment(java_db)) { + if (c.getLocation().getFile() = f) { + if (s1 = c.getLocation().getStartLineNumber()) { + if (e = c.getLocation().getEndLineNumber()) { + if (lineNumber > s1 - 1) { + if (lineNumber < e + 1) { + return true + } + } + } + } + } + } + } + } + } + } + } +} +pub fn isAnnotation(filename: string, lineNumber: int) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (f in File(java_db)) { + if (transfertofile1(f, filename, lineNumber)) { + for (e in int::__undetermined_all__(), + s1 in int::__undetermined_all__()) { + for (c in Annotation(java_db)) { + if (c.getLocation().getFile() = f) { + if (s1 = c.getLocation().getStartLineNumber()) { + if (e = c.getLocation().getEndLineNumber()) { + if (lineNumber > s1 - 1) { + if (lineNumber < e + 1) { + return true + } + } + } + } + } + } + } + } + } + } + } +} +pub fn isCodeLine(f: File, filename: string, lineNumber: int) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + if (gitdiff(filename, lineNumber)) { + if (f.getRelativePath() = filename) { + for (e in int::__undetermined_all__(), + s1 in int::__undetermined_all__()) { + for (l in coref::java::Location(java_db)) { + if (l.getFile() = f) { + if (s1 = l.getStartLineNumber()) { + if (e = l.getEndLineNumber()) { + if (lineNumber > s1 - 1) { + if (lineNumber < e + 1) { + return true + } + } + } + } + } + } + } + } + } + } + } +} +pub fn isLog(filename: string, lineNumber: int) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (f in File(java_db)) { + if (transfertofile1(f, filename, lineNumber)) { + for (e in int::__undetermined_all__(), + s1 in int::__undetermined_all__(), + text in string::__undetermined_all__()) { + for (c in Expression(java_db)) { + if (c.getLocation().getFile() = f) { + if (s1 = c.getLocation().getStartLineNumber()) { + if (e = c.getLocation().getEndLineNumber()) { + if (lineNumber > s1 - 1) { + if (lineNumber < e + 1) { + if (text = c.getPrintableText()) { + if (text.matches("^logger\\..*")) { + return true + } + } + } + } + } + } + } + } + } + } + } + } + } +} +pub fn getTypeInAST(filename: string, lineNumber: int, typeInAST: string) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (f in File(java_db)) { + if (transfertofile(f, filename, lineNumber)) { + for (e in int::__undetermined_all__(), + s1 in int::__undetermined_all__()) { + for (c in ElementParent(java_db)) { + if (c.getLocation().getFile() = f) { + if (s1 = c.getLocation().getStartLineNumber()) { + if (e = c.getLocation().getEndLineNumber()) { + if (s1 = e) { + if (lineNumber > s1 - 1) { + if (lineNumber < e + 1) { + if (typeInAST = c.getType()) { + return true + } + } + } + } + } + } + } + } + } + } + } + } + } +} +pub fn getTypeInECG(filename: string, lineNumber: int, typeInAST: string, n: ECGNode) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (f in File(java_db)) { + if (transfertofile(f, filename, lineNumber)) { + if (tmp_0(filename, lineNumber)) { + if (typeInAST = "Callable") { + if (getBelongedCallable(filename, lineNumber, Callable(java_db).find(n))) { + return true + } + } + } + if (!(tmp_0(filename, lineNumber))) { + for (e in int::__undetermined_all__(), + s1 in int::__undetermined_all__()) { + if (n.getLocation().getFile() = f) { + if (s1 = n.getLocation().getStartLineNumber()) { + if (e = n.getLocation().getEndLineNumber()) { + if (lineNumber > s1 - 1) { + if (lineNumber < e + 1) { + if (typeInAST = n.getType()) { + if (isFieldOrEnum(ECGNode(java_db).find(n))) { + return true + } + } + } + } + } + } + } + } + } + } + } + } + } +} +pub fn isFieldOrEnum(c: ECGNode) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (f in Field(java_db)) { + if (f.key_eq(c)) { + return true + } + } + for (e in EnumConstant(java_db)) { + if (e.key_eq(c)) { + return true + } + } + } + } +} +pub fn findSpecialCodeType(filename: string, lineNumber: int, type: string) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + if (isComment(filename, lineNumber)) { + if (type = "comment") { + return true + } + } + if (isAnnotation(filename, lineNumber)) { + if (type = "annotation") { + return true + } + } + if (isLog(filename, lineNumber)) { + if (type = "log") { + return true + } + } + } + } +} +pub fn getBelongedCallable(filename: string, lineNumber: int, c: Callable) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (f in File(java_db)) { + if (transfertofile(f, filename, lineNumber)) { + for (l1 in int::__undetermined_all__(), + l2 in int::__undetermined_all__()) { + for (i in Identifier(java_db)) { + if (f = c.getLocation().getFile()) { + if (c.key_eq(i.getParent())) { + if (l1 = i.getLocation().getStartLineNumber()) { + if (l2 = c.getLocation().getEndLineNumber()) { + if (lineNumber > l1 - 1) { + if (lineNumber < l2 + 1) { + return true + } + } + } + } + } + } + } + } + } + } + } + } +} +pub fn getBelongedCallableSignature(filename: string, lineNumber: int, belongedCallable: string) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (i in int::__undetermined_all__()) { + for (c in Callable(java_db)) { + if (transfertofile(__all_data__, filename, lineNumber)) { + if (i = tmp_1().len()) { + if (tmp_2(i)) { + if (belongedCallable = "") { + return true + } + } + if (!(tmp_2(i))) { + if (getBelongedCallable(filename, lineNumber, c)) { + if (belongedCallable = c.getSignature()) { + return true + } + } + } + } + } + } + } + } + } +} +pub fn getJavaECGNode(n: ECGNode) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (lineNumber in int::__undetermined_all__(), + filename in string::__undetermined_all__(), + typeInAST in string::__undetermined_all__(), + belongedCallable in string::__undetermined_all__()) { + if (transfertofile(__all_data__, filename, lineNumber)) { + if (getBelongedCallableSignature(filename, lineNumber, belongedCallable)) { + if (getTypeInECG(filename, lineNumber, typeInAST, n)) { + return true + } + } + } + } + } + } +} +pub fn transfertoXmlfile(f: XmlFile, filename: string, lineNumber: int) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + if (gitdiff(filename, lineNumber)) { + if (filename = f.getRelativePath()) { + return true + } + } + } + } +} +pub fn getXmlECGNode1(n: ECGXmlNode) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (lineNumber in int::__undetermined_all__(), + e in int::__undetermined_all__(), + s1 in int::__undetermined_all__(), + filename in string::__undetermined_all__(), + typeInAST in string::__undetermined_all__(), + text in string::__undetermined_all__()) { + for (f in XmlFile(xml_db), + o in ECGXmlNode(xml_db)) { + if (transfertoXmlfile(f, filename, lineNumber)) { + if (n.getLocation().getFile() = f) { + if (s1 = n.getLocation().getStartLineNumber()) { + if (e = n.getLocation().getEndLineNumber()) { + if (lineNumber > s1 - 1) { + if (lineNumber < e + 1) { + if (typeInAST = n.getType()) { + if (text = n.getText()) { + if (o = n.getEnclosingECGXmlNode()) { + return true + } + } + } + } + } + } + } + } + } + } + } + } + } +} +@inline +pub fn trim(n: string, m: string) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (i in int::__undetermined_all__()) { + if (i = n.len()) { + if (tmp_3(n)) { + if (m = n.substr(1,i - 2)) { + return true + } + } + if (!(tmp_3(n))) { + if (m = n) { + return true + } + } + } + } + } + } +} +pub fn getXmlECGNode(f: ECGNode) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (c in ClassOrInterface(java_db), + n in string::__undetermined_all__(), + m in string::__undetermined_all__()) { + for (r in ECGXmlNode(xml_db)) { + if (getXmlECGNode1(r)) { + if (getChangeSetByDalXmlElement(r, c, Method(java_db).find(f), n, m)) { + return true + } + if (getChangeSetByResultXmlElement(r, c, Field(java_db).find(f), n, m)) { + return true + } + } + } + } + } + } +} +pub fn getChangeSetByResultXmlElement(r1: ECGXmlNode, c: ClassOrInterface, f: Field, n: string, m: string) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (r in ResultXmlElement(xml_db)) { + if (r.key_eq(r1)) { + if (getXmlECGNode1(ECGXmlNode(xml_db).find(r))) { + if (n = r.getBelongedMapXmlElement().getMappingClassName()) { + if (n = c.getQualifiedName()) { + if (c = f.getParent()) { + if (r.getValueByAttributeName("property") = f.getName()) { + if (m = f.getName()) { + return true + } + } + } + } + } + } + } + } + } + } +} +pub fn getChangeSetByDalXmlElement(d1: ECGXmlNode, c: ClassOrInterface, m: Method, className: string, methodName: string) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (i in int::__undetermined_all__(), + temp in string::__undetermined_all__(), + temp1 in string::__undetermined_all__(), + n in string::__undetermined_all__()) { + for (d in DalXmlElement(xml_db), + cc in XmlComment(xml_db), + l in Literal(java_db)) { + if (d.key_eq(d1)) { + if (getXmlECGNode1(ECGXmlNode(xml_db).find(d))) { + if (d.getLocation().getFile() = cc.getLocation().getFile()) { + if (cc.getLocation().getEndLineNumber() = i) { + if (i + 1 = d.getLocation().getStartLineNumber()) { + if (temp = cc.getText()) { + if (c.getName() = temp.get_regex_match_result("[\\s\\S]*mapped statement for[ \\t]+(\\w+)[\\s\\S]*", 1)) { + if (n = d.getValueByAttributeName("id")) { + if (c.key_eq(m.getBelongedClass())) { + if (m.key_eq(l.getEnclosingCallable())) { + if (temp1 = l.getValue()) { + if (trim(temp1, n)) { + if (className = c.getQualifiedName()) { + if (methodName = m.getSignature()) { + return true + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } +} +pub fn javaOutput(classname: string, name: string) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (s in SofaService(java_db), + c in Class(java_db), + i in ClassOrInterface(java_db)) { + for (auto_tmp1 in c.getAnnotation()) { + if (s.key_eq(auto_tmp1)) { + if (classname = c.getQualifiedName()) { + for (auto_tmp2 in c.getImplementsInterface()) { + if (i.key_eq(auto_tmp2)) { + if (name = i.getQualifiedName()) { + return true + } + } + } + if (i.key_eq(c)) { + if (name = classname) { + return true + } + } + } + } + } + } + } + } +} +pub fn xmlOutput(className: string, interfaceName: string) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (temp in string::__undetermined_all__()) { + for (s in ClassOrInterface(java_db), + b in BeanXmlElement(xml_db)) { + if (s.getQualifiedName() = b.getClass()) { + if (className = s.getQualifiedName()) { + if (className = interfaceName) { + if (temp = b.getLocation().getFile().getRelativePath()) { + if (!temp.contains("src/test/resources")) { + return true + } + } + } + } + } + } + } + } + } +} +pub fn getTrAnnotationName(a: string) -> bool { + [ + {"Service"}, + {"Component"}, + {"Scope"}, + {"Repository"}, + {"Controller"}, + {"RestController"}, + {"RequestMapping"}, + {"PathVariable"}, + {"ResponseBody"}, + {"bean"} + ] +} +pub fn getTrAnnotationName1(a: string) -> bool { + [ + {"Service"}, + {"Component"}, + {"Scope"}, + {"Configuration"}, + {"Repository"}, + {"RestController"}, + {"bean"} + ] +} +pub fn getPublishTr(c: ClassOrInterface) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (className in string::__undetermined_all__(), + interfaceName in string::__undetermined_all__()) { + if (javaOutput(className, interfaceName)) { + if (interfaceName = c.getQualifiedName()) { + return true + } + } + } + } + } +} +schema SofaService extends Annotation { + +} + +impl SofaService { + + @data_constraint + @inline + pub fn __all__(db: JavaDB) -> *SofaService { + for (tmp in Annotation(db)) { + for (n in string::__undetermined_all__()) { + if (n = tmp.getName()) { + if (getTrAnnotationName1(n)) { + yield SofaService { + id : tmp.id + } + } + } + } + } + } + + +} + +pub fn output1(c: ClassOrInterface, interfaceName: string, id: int) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (i in int::__undetermined_all__(), + j in int::__undetermined_all__(), + className in string::__undetermined_all__()) { + if (xmlOutput(className, interfaceName)) { + for (temp in string::__undetermined_all__()) { + for (e1 in ECGNode(java_db), + e2 in ECGXmlNode(xml_db)) { + if (getJavaECGNode(e1)) { + if (getXmlECGNode1(e2)) { + if (c.key_eq(e1.getElementParent())) { + if (temp = c.getQualifiedName()) { + if (id = e1.id) { + if (temp = className) { + return true + } + if (temp = interfaceName) { + return true + } + } + if (e2.id = i) { + if (id = e2.id) { + return true + } + } + if (e2.id = j) { + if (id = e2.id) { + return true + } + } + } + } + } + } + } + } + } + if (javaOutput(className, interfaceName)) { + for (temp in string::__undetermined_all__()) { + for (e1 in ECGNode(java_db), + e2 in ECGXmlNode(xml_db)) { + if (getJavaECGNode(e1)) { + if (getXmlECGNode1(e2)) { + if (c.key_eq(e1.getElementParent())) { + if (temp = c.getQualifiedName()) { + if (id = e1.id) { + if (temp = className) { + return true + } + if (temp = interfaceName) { + return true + } + } + if (e2.id = i) { + if (id = e2.id) { + return true + } + } + if (e2.id = j) { + if (id = e2.id) { + return true + } + } + } + } + } + } + } + } + } + } + } + } +} +pub fn output2(c: ClassOrInterface, interfaceName: string, n: ECGNode) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (m in ECGNode(java_db)) { + if (getJavaECGNode(m)) { + if (getPublishTr(c)) { + for (t in Method(java_db)) { + if (n.key_eq(t)) { + if (c = t.getParent()) { + if (n = m.getAnAncestorCDDependedNode(__all_data__, __all_data__)) { + if (interfaceName = c.getQualifiedName()) { + return true + } + } + } + } + } + for (f in Field(java_db)) { + if (n.key_eq(f)) { + if (c = f.getParent()) { + if (n = m.getAnAncestorCDDependedNode(__all_data__, __all_data__)) { + if (interfaceName = c.getQualifiedName()) { + return true + } + } + } + } + } + } + } + if (getXmlECGNode(m)) { + if (getPublishTr(c)) { + for (t in Method(java_db)) { + if (n.key_eq(t)) { + if (c = t.getParent()) { + if (n = m.getAnAncestorCDDependedNode(__all_data__, __all_data__)) { + if (interfaceName = c.getQualifiedName()) { + return true + } + } + } + } + } + for (f in Field(java_db)) { + if (n.key_eq(f)) { + if (c = f.getParent()) { + if (n = m.getAnAncestorCDDependedNode(__all_data__, __all_data__)) { + if (interfaceName = c.getQualifiedName()) { + return true + } + } + } + } + } + } + } + } + } + } +} +pub fn real_output(interfaceName: string) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (n in ECGNode(java_db)) { + for (c in ClassOrInterface(java_db)) { + if (output2(c, interfaceName, n)) { + return true + } + if (output1(c, interfaceName, n.id)) { + return true + } + } + } + } + } +} + + +fn default_java_db() -> JavaDB { + return JavaDB::load("coref_java_src.db") +} + +fn default_xml_db() -> XmlDB { + return XmlDB::load("coref_xml_src.db") +} + +fn tmp_0(filename: string, lineNumber: int) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + if (getBelongedCallable(filename, lineNumber, __all_data__)) { + return true + } + } + } +} + +fn tmp_1() -> *string { + for (filename in string::__undetermined_all__(), lineNumber in int::__undetermined_all__()) { + if (getBelongedCallable(filename, lineNumber, __all_data__)) { + yield filename + } + } +} + +fn tmp_2(i: int) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + if (i = 0) { + return true + } + } + } +} + +fn tmp_3(n: string) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + if (n.substr(0,1) = "\"") { + return true + } + } + } +} + +fn main() { + output(real_output()) +} \ No newline at end of file diff --git a/example/icse25/rules/rule7.gdl b/example/icse25/rules/rule7.gdl new file mode 100644 index 00000000..73c3b785 --- /dev/null +++ b/example/icse25/rules/rule7.gdl @@ -0,0 +1,243 @@ +// script +use coref::java::* +use coref::xml::* + +schema ECGXmlNode { + @primary id: int +} + +impl ECGXmlNode { + pub fn __all__(db: XmlDB) -> *ECGXmlNode { + for (e in XmlPomElement(db)) { + yield ECGXmlNode {id : e.id} + } + for (e in XmlSpringElement(db)) { + yield ECGXmlNode {id : e.id} + } + for (e in XmlCharacter(db)) { + yield ECGXmlNode {id : e.id} + } + for (e in XmlAttribute(db)) { + yield ECGXmlNode {id : e.id} + } + } + + pub fn getLocation(self) -> coref::xml::Location { + for (l in coref::xml::Location(__all_data__)) { + for (e in XmlElement(__all_data__)) { + if (self.key_eq(e)) { + if (l = e.getLocation()) { + return l + } + } + } + for (e in XmlAttribute(__all_data__)) { + if (self.key_eq(e)) { + if (l = e.getLocation()) { + return l + } + } + } + for (e in XmlCharacter(__all_data__)) { + if (self.key_eq(e)) { + if (l = e.getLocation()) { + return l + } + } + } + } + } + + pub fn getType(self) -> string { + for (t in string::__undetermined_all__()) { + for (e in XmlElement(__all_data__)) { + if (self.key_eq(e)) { + if (t = "XmlElement") { + return t + } + } + } + for (e in XmlAttribute(__all_data__)) { + if (self.key_eq(e)) { + if (t = "XmlAttribute") { + return t + } + } + } + for (e in XmlCharacter(__all_data__)) { + if (self.key_eq(e)) { + if (t = "XmlCharacter") { + return t + } + } + } + } + } + + pub fn getText(self) -> string { + for (e in XmlElement(__all_data__)) { + if (self.key_eq(e)) { + return e.getName() + } + } + for (e in XmlAttribute(__all_data__)) { + if (self.key_eq(e)) { + return e.getName() + " = " + e.getValue() + } + } + for (e in XmlCharacter(__all_data__)) { + if (self.key_eq(e)) { + return e.getText() + } + } + } + + pub fn getEnclosingECGXmlNode(self) -> ECGXmlNode { + for (e in XmlElement(__all_data__)) { + if (self.key_eq(e)) { + return e.to() + } + } + for (e in XmlAttribute(__all_data__)) { + if (self.key_eq(e)) { + return e.getXmlElement().to() + } + } + for (e in XmlCharacter(__all_data__)) { + if (self.key_eq(e)) { + return e.getBelongedElement().to() + } + } + } +} + +pub fn getXmlECGNode(i: int) -> bool { + // #xmlecgnode + // example + [ {1111} ] +} +@inline +pub fn trim(n: string, m: string) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (i in int::__undetermined_all__()) { + if (i = n.len()) { + if (tmp_0(n)) { + if (m = n.substr(1,i - 2)) { + return true + } + } + if (!(tmp_0(n))) { + if (m = n) { + return true + } + } + } + } + } + } +} +pub fn real_output(r: ECGXmlNode, c: ClassOrInterface, f: ElementParent, n: string, m: string) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + if (getXmlECGNode(r.id)) { + if (getChangeSetByDalXmlElement(r, c, Method(java_db).find(f), n, m)) { + return true + } + if (getChangeSetByResultXmlElement(r, c, Field(java_db).find(f), n, m)) { + return true + } + } + } + } +} +pub fn getChangeSetByResultXmlElement(r1: ECGXmlNode, c: ClassOrInterface, f: Field, n: string, m: string) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (r in ResultXmlElement(xml_db)) { + if (r.key_eq(r1)) { + if (getXmlECGNode(r.id)) { + if (n = r.getBelongedMapXmlElement().getMappingClassName()) { + if (n = c.getQualifiedName()) { + if (c = f.getParent()) { + if (r.getValueByAttributeName("property") = f.getName()) { + if (m = f.getName()) { + return true + } + } + } + } + } + } + } + } + } + } +} +pub fn getChangeSetByDalXmlElement(d1: ECGXmlNode, c: ClassOrInterface, m: Method, className: string, methodName: string) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (i in int::__undetermined_all__(), + temp in string::__undetermined_all__(), + temp1 in string::__undetermined_all__(), + n in string::__undetermined_all__()) { + for (d in DalXmlElement(xml_db), + cc in XmlComment(xml_db), + l in Literal(java_db)) { + if (d.key_eq(d1)) { + if (getXmlECGNode(d.id)) { + if (d.getLocation().getFile() = cc.getLocation().getFile()) { + if (cc.getLocation().getEndLineNumber() = i) { + if (i + 1 = d.getLocation().getStartLineNumber()) { + if (temp = cc.getText()) { + if (c.getName() = temp.get_regex_match_result("[\\s\\S]*mapped statement for[ \\t]+(\\w+)[\\s\\S]*", 1)) { + if (n = d.getValueByAttributeName("id")) { + if (c.key_eq(m.getBelongedClass())) { + if (m.key_eq(l.getEnclosingCallable())) { + if (temp1 = l.getValue()) { + if (trim(temp1, n)) { + if (className = c.getQualifiedName()) { + if (methodName = m.getSignature()) { + return true + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } +} + + +fn default_java_db() -> JavaDB { + return JavaDB::load("coref_java_src.db") +} + +fn default_xml_db() -> XmlDB { + return XmlDB::load("coref_xml_src.db") +} + +fn tmp_0(n: string) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + if (n.substr(0,1) = "\"") { + return true + } + } + } +} + +fn main() { + output(real_output()) +} \ No newline at end of file diff --git a/example/icse25/rules/rule8.gdl b/example/icse25/rules/rule8.gdl new file mode 100644 index 00000000..dac7d2ff --- /dev/null +++ b/example/icse25/rules/rule8.gdl @@ -0,0 +1,1149 @@ +// script +use coref::java::* +use coref::xml::* + +schema ECGNode extends ElementParent {} + +impl ECGNode { + pub fn __all__(db: JavaDB) -> *ECGNode { + for (tmp in ElementParent(db)) { + for (m in Method(db)) { + if (tmp.key_eq(m)) { + yield ECGNode { + id : tmp.id + } + } + } + for (m in Variable(db)) { + if (tmp.key_eq(m)) { + yield ECGNode { + id : tmp.id + } + } + } + for (m in Expression(db)) { + if (tmp.key_eq(m)) { + yield ECGNode { + id : tmp.id + } + } + } + } + } + + pub fn getType(self) -> string { + for (t in string::__undetermined_all__()) { + for (m in Method(__all_data__)) { + if (self.key_eq(m)) { + if (t = "Method") { + return t + } + } + } + for (m in LocalVariable(__all_data__)) { + if (self.key_eq(m)) { + if (t = "LocalVariable") { + return t + } + } + } + for (m in Parameter(__all_data__)) { + if (self.key_eq(m)) { + if (t = "Parameter") { + return t + } + } + } + for (m in Field(__all_data__)) { + if (self.key_eq(m)) { + if (t = "Field") { + return t + } + } + } + for (m in EnumConstant(__all_data__)) { + if (self.key_eq(m)) { + if (t = "EnumConstant") { + return t + } + } + } + for (m in Expression(__all_data__)) { + if (self.key_eq(m)) { + if (t = m.getType()) { + return t + } + } + } + } + } + + pub fn getDDNode(self, type: string, direction: string) -> ECGNode { + for (e1 in ECGNode(__all_data__)) { + for (e in Parameter(__all_data__), + c in Method(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + for (auto_tmp1 in c.getParameter()) { + if (e = auto_tmp1) { + if (direction = "Depended") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + for (r in ReturnStatement(__all_data__), + c in Method(__all_data__), + e in Expression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (c.key_eq(r.getEnclosingCallable())) { + if (e = r.getResult()) { + if (direction = "Depends") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + for (c in Callable(__all_data__), + e in Field(__all_data__), + r in ReferenceExpression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (c = r.getEnclosingCallable()) { + if (e.key_eq(r.getDefinition())) { + if (direction = "Depended") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + for (c in Callable(__all_data__), + e in EnumConstant(__all_data__), + r in ReferenceExpression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (c = r.getEnclosingCallable()) { + if (e.key_eq(r.getDefinition())) { + if (direction = "Depended") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + for (e in Callable(__all_data__), + c in Field(__all_data__), + r in ReferenceExpression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (c.key_eq(r.getDefinition())) { + if (e = r.getEnclosingCallable()) { + if (direction = "Depends") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + for (e in Callable(__all_data__), + c in EnumConstant(__all_data__), + r in ReferenceExpression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (c.key_eq(r.getDefinition())) { + if (e = r.getEnclosingCallable()) { + if (direction = "Depends") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + for (c in Callable(__all_data__), + e in CallExpression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (c = e.getEnclosingCallable()) { + for (m in Method(__all_data__)) { + if (m = e.getMethod()) { + if (!isDirectCall(e)) { + if (direction = "Depended") { + if (type = "DD") { + return e1 + } + } + } + } + } + for (f in LombokField(__all_data__)) { + if (f = e.getLombokField()) { + if (!isDirectCall(e)) { + if (direction = "Depended") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + } + } + for (n in string::__undetermined_all__()) { + for (e in LombokField(__all_data__), + c in CallExpression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (e = c.getLombokField()) { + let (tmp_find = CallExpression(__all_data__).find(e)) { + if (!isDirectCall(tmp_find)) { + if (n = c.getMethodName()) { + if (Self::tmp_0(n)) { + if (direction = "Depended") { + if (type = "DD") { + return e1 + } + } + } + if (!Self::tmp_0(n)) { + if (direction = "Depends") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + } + } + } + } + for (e in Variable(__all_data__), + c in CallExpression(__all_data__), + r in ReferenceExpression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (!isDirectCall(c)) { + for (auto_tmp2 in c.getArguments()) { + if (r.key_eq(auto_tmp2)) { + if (e.key_eq(r.getDefinition())) { + if (direction = "Depended") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + } + } + for (e in CallExpression(__all_data__), + c in CallExpression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (!isDirectCall(c)) { + for (auto_tmp3 in c.getArguments()) { + if (e.key_eq(auto_tmp3)) { + if (direction = "Depended") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + } + for (e in CallExpression(__all_data__), + c in CallExpression(__all_data__), + s in CallExpression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (!isDirectCall(c)) { + for (auto_tmp4 in c.getAnAncestor()) { + if (s.getReference().key_eq(auto_tmp4)) { + for (auto_tmp5 in s.getArguments()) { + if (auto_tmp5.key_eq(e)) { + if (direction = "Depended") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + } + } + } + } + } + + pub fn getAnAncestorDDNode(self, type: string, direction: string) -> ECGNode { + for (e in ECGNode(__all_data__)) { + if (type = "DD") { + if (e = self.getDDNode(type, direction)) { + return e + } + if (e = self.getAnAncestorDDNode(__all_data__, __all_data__).getDDNode(type, direction)) { + return e + } + } + } + } + + pub fn getCDNode(self, type: string, direction: string) -> ECGNode { + for (e in ECGNode(__all_data__), + c in Callable(__all_data__), + r in ReferenceExpression(__all_data__)) { + if (self.key_eq(c)) { + if (type = "CD") { + for (e1 in Method(__all_data__)) { + for (auto_tmp1 in c.getCallee()) { + if (e1.key_eq(auto_tmp1)) { + if (direction = "Depends") { + if (e.key_eq(e1)) { + return e + } + } + } + } + } + for (e2 in Method(__all_data__)) { + for (auto_tmp2 in c.getCaller()) { + if (e2.key_eq(auto_tmp2)) { + if (direction = "Depended") { + if (e.key_eq(e2)) { + return e + } + } + } + } + } + } + } + if (self.key_eq(r.getDefinition())) { + if (c = r.getEnclosingCallable()) { + if (type = "CD") { + for (e1 in Method(__all_data__)) { + for (auto_tmp1 in c.getCallee()) { + if (e1.key_eq(auto_tmp1)) { + if (direction = "Depends") { + if (e.key_eq(e1)) { + return e + } + } + } + } + } + for (e2 in Method(__all_data__)) { + for (auto_tmp2 in c.getCaller()) { + if (e2.key_eq(auto_tmp2)) { + if (direction = "Depended") { + if (e.key_eq(e2)) { + return e + } + } + } + } + } + } + } + } + } + } + + pub fn getAnAncestorCDNode(self, type: string, direction: string) -> ECGNode { + for (e in ECGNode(__all_data__), + c in Callable(__all_data__), + r in ReferenceExpression(__all_data__)) { + if (type = "CD") { + if (self.key_eq(c)) { + for (e1 in Method(__all_data__)) { + for (auto_tmp1 in c.getAnAncestorCallee()) { + if (e1.key_eq(auto_tmp1)) { + if (direction = "Depends") { + if (e.key_eq(e1)) { + return e + } + } + } + } + } + for (e2 in Method(__all_data__)) { + for (auto_tmp2 in c.getAnAncestorCaller()) { + if (e2.key_eq(auto_tmp2)) { + if (direction = "Depended") { + if (e.key_eq(e2)) { + return e + } + } + } + } + } + } + if (self.key_eq(r.getDefinition())) { + if (c = r.getEnclosingCallable()) { + for (e1 in Method(__all_data__)) { + for (auto_tmp1 in c.getAnAncestorCallee()) { + if (e1.key_eq(auto_tmp1)) { + if (direction = "Depends") { + if (e.key_eq(e1)) { + return e + } + } + } + } + } + for (e2 in Method(__all_data__)) { + for (auto_tmp2 in c.getAnAncestorCaller()) { + if (e2.key_eq(auto_tmp2)) { + if (direction = "Depended") { + if (e.key_eq(e2)) { + return e + } + } + } + } + } + } + } + } + } + } + + pub fn getECGNode(self, type: string, direction: string) -> ECGNode { + for (e in ECGNode(__all_data__)) { + if (e = self.getCDNode(type, direction)) { + return e + } + if (e = self.getDDNode(type, direction)) { + return e + } + } + } + + pub fn getAnAncestorECGNode(self, type: string, direction: string) -> ECGNode { + for (e in ECGNode(__all_data__), tmp in ECGNode(__all_data__)) { + if (tmp = self.getAnAncestorCDNode(__all_data__, __all_data__)) { + if (e = tmp.getECGNode(type, direction)) { + return e + } + } + } + } + + pub fn getAnAncestorCDDependedNode(self, type: string, direction: string) -> ECGNode { + for (e in ECGNode(__all_data__), c in Callable(__all_data__), r in ReferenceExpression(__all_data__)) { + if (type = "CD") { + if (self.key_eq(c) || (self.key_eq(r.getDefinition()) && r.getEnclosingCallable() = c)) { + for (e2 in Method(__all_data__), c_caller in c.getAnAncestorCaller()) { + if (e2.key_eq(c_caller) && direction = "Depended" && e.key_eq(e2)) { + return e + } + } + } + } + } + } + + pub fn getECGDependsNode(self, type: string, direction: string) -> ECGNode { + for (e in ECGNode(__all_data__)) { + if (e = self.getCDDependsNode(type, direction)) { + return e + } + if (e = self.getDDDependsNode(type, direction)) { + return e + } + } + } + + pub fn getCDDependsNode(self, type: string, direction: string) -> ECGNode { + for (e in ECGNode(__all_data__), + c in Callable(__all_data__), + r in ReferenceExpression(__all_data__)) { + if (self.key_eq(c)) { + if (type = "CD") { + for (e1 in c.getCallee()) { + if (direction = "Depends") { + if (e.key_eq(e1)) { + return e + } + } + } + } + } + for (v in Variable(__all_data__)) { + if (self.key_eq(v)) { + if (v.key_eq(r.getDefinition())) { + if (c = r.getEnclosingCallable()) { + if (type = "CD") { + for (e1 in c.getCallee()) { + if (direction = "Depends") { + if (e.key_eq(e1)) { + return e + } + } + } + } + } + } + } + } + } + } + + pub fn getDDDependsNode(self, type: string, direction: string) -> ECGNode { + for (e1 in ECGNode(__all_data__)) { + for (r in ReturnStatement(__all_data__), + c in Method(__all_data__), + e in Expression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (c.key_eq(r.getEnclosingCallable())) { + if (e = r.getResult()) { + if (direction = "Depends") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + for (e in Callable(__all_data__), + c in Field(__all_data__), + r in ReferenceExpression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (c.key_eq(r.getDefinition())) { + if (e = r.getEnclosingCallable()) { + if (direction = "Depends") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + for (e in Callable(__all_data__), + c in EnumConstant(__all_data__), + r in ReferenceExpression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (c.key_eq(r.getDefinition())) { + if (e = r.getEnclosingCallable()) { + if (direction = "Depends") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + for (n in string::__undetermined_all__()) { + for (e in LombokField(__all_data__), + c in CallExpression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (e = c.getLombokField()) { + let (tmp = CallExpression(__all_data__).find(e)) { + if (!isDirectCall(tmp)) { + if (n = c.getMethodName()) { + if (!n.matches("get.*")) { + if (direction = "Depends") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + } + } + } + } + } + } + + pub fn getAnAncestorCDDependsNode(self, type: string, direction: string) -> ECGNode { + for (e in ECGNode(__all_data__), + c in Callable(__all_data__), + r in ReferenceExpression(__all_data__)) { + if (type = "CD") { + if (self.key_eq(c)) { + for (e1 in c.getAnAncestorCallee()) { + if (direction = "Depends") { + if (e.key_eq(e1)) { + return e + } + } + } + } + if (self.key_eq(r.getDefinition())) { + if (c = r.getEnclosingCallable()) { + for (e1 in c.getAnAncestorCallee()) { + if (direction = "Depends") { + if (e.key_eq(e1)) { + return e + } + } + } + } + } + } + } + } + + pub fn getPath(self) -> string { + for (line in int::__undetermined_all__(), + t in string::__undetermined_all__(), + path in string::__undetermined_all__(), + info in string::__undetermined_all__()) { + for (l in coref::java::Location(__all_data__)) { + if (l = self.getLocation()) { + if (path = l.getFile().getRelativePath()) { + if (line = l.getStartLineNumber()) { + if (t = line.to_string()) { + if (info = path + ":" + t) { + return info + } + } + } + } + } + } + } + } + + fn tmp_0(n: string) -> bool { + if (n.matches("get.*")) { + return true + } + } +} + +schema ECGXmlNode { + @primary id: int +} + +impl ECGXmlNode { + pub fn __all__(db: XmlDB) -> *ECGXmlNode { + for (e in XmlPomElement(db)) { + yield ECGXmlNode {id : e.id} + } + for (e in XmlSpringElement(db)) { + yield ECGXmlNode {id : e.id} + } + for (e in XmlCharacter(db)) { + yield ECGXmlNode {id : e.id} + } + for (e in XmlAttribute(db)) { + yield ECGXmlNode {id : e.id} + } + } + + pub fn getLocation(self) -> coref::xml::Location { + for (l in coref::xml::Location(__all_data__)) { + for (e in XmlElement(__all_data__)) { + if (self.key_eq(e)) { + if (l = e.getLocation()) { + return l + } + } + } + for (e in XmlAttribute(__all_data__)) { + if (self.key_eq(e)) { + if (l = e.getLocation()) { + return l + } + } + } + for (e in XmlCharacter(__all_data__)) { + if (self.key_eq(e)) { + if (l = e.getLocation()) { + return l + } + } + } + } + } + + pub fn getType(self) -> string { + for (t in string::__undetermined_all__()) { + for (e in XmlElement(__all_data__)) { + if (self.key_eq(e)) { + if (t = "XmlElement") { + return t + } + } + } + for (e in XmlAttribute(__all_data__)) { + if (self.key_eq(e)) { + if (t = "XmlAttribute") { + return t + } + } + } + for (e in XmlCharacter(__all_data__)) { + if (self.key_eq(e)) { + if (t = "XmlCharacter") { + return t + } + } + } + } + } + + pub fn getText(self) -> string { + for (e in XmlElement(__all_data__)) { + if (self.key_eq(e)) { + return e.getName() + } + } + for (e in XmlAttribute(__all_data__)) { + if (self.key_eq(e)) { + return e.getName() + " = " + e.getValue() + } + } + for (e in XmlCharacter(__all_data__)) { + if (self.key_eq(e)) { + return e.getText() + } + } + } + + pub fn getEnclosingECGXmlNode(self) -> ECGXmlNode { + for (e in XmlElement(__all_data__)) { + if (self.key_eq(e)) { + return e.to() + } + } + for (e in XmlAttribute(__all_data__)) { + if (self.key_eq(e)) { + return e.getXmlElement().to() + } + } + for (e in XmlCharacter(__all_data__)) { + if (self.key_eq(e)) { + return e.getBelongedElement().to() + } + } + } +} + +pub fn getJavaECGNode(id: int) -> bool { + // #javaecgnode + // example + [ {1111} ] +} +pub fn getXmlECGNode(id: int) -> bool { + // #xmlimpactedecgnode + // example + [ {1111} ] +} +schema SofaService extends Annotation { + +} + +impl SofaService { + + @data_constraint + @inline + pub fn __all__(db: JavaDB) -> *SofaService { + for (tmp in Annotation(db)) { + if (tmp.getName() = "SofaService") { + yield SofaService { + id : tmp.id + } + } + } + } + + pub fn getService(self) -> ClassOrInterface { + for (value in string::__undetermined_all__()) { + for (i in ClassOrInterface(__all_data__), + argus in AnnotationAccessArgument(__all_data__)) { + for (auto_tmp1 in self.getAnnotationArgument()) { + if (argus = auto_tmp1) { + if (argus.getAnnotationArgumentName() = "interfaceType") { + if (value = argus.getAnnotationArgumentValue()) { + if (i.getQualifiedName() = value) { + return i + } + } + } + } + } + } + } + } + + @inline + pub fn getBinding(self) -> SofaServiceBinding { + for (b in SofaServiceBinding(__all_data__), + argus in AnnotationAccessArgument(__all_data__)) { + for (auto_tmp1 in self.getAnnotationArgument()) { + if (argus = auto_tmp1) { + if (argus.getAnnotationArgumentName() = "bindings") { + if (b.key_eq(argus.getArgumentAnnotation())) { + return b + } + if (argus.key_eq(b.getParent())) { + return b + } + } + } + } + } + } + + @inline + pub fn getUniqueId(self) -> string { + for (uniqueId in string::__undetermined_all__()) { + for (anno in Annotation(__all_data__)) { + if (self.key_eq(anno)) { + if (tmp_2(anno)) { + for (argus in AnnotationAccessArgument(__all_data__)) { + for (auto_tmp1 in anno.getAnnotationArgument()) { + if (argus = auto_tmp1) { + if (argus.getAnnotationArgumentName() = "uniqueId") { + if (uniqueId = argus.getAnnotationArgumentValue()) { + return uniqueId + } + } + } + } + } + } + if (!(tmp_2(anno))) { + if (uniqueId = "null") { + return uniqueId + } + } + } + } + } + } + + +} + +pub fn uniqueArgument(anno: Annotation) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (argus in AnnotationAccessArgument(java_db)) { + for (auto_tmp1 in anno.getAnnotationArgument()) { + if (argus = auto_tmp1) { + if (argus.getAnnotationArgumentName() = "uniqueId") { + return true + } + } + } + } + } + } +} +schema SofaServiceBinding extends Annotation { + +} + +impl SofaServiceBinding { + + @data_constraint + @inline + pub fn __all__(db: JavaDB) -> *SofaServiceBinding { + for (tmp in Annotation(db)) { + if (tmp.getName() = "SofaServiceBinding") { + yield SofaServiceBinding { + id : tmp.id + } + } + } + } + + pub fn getType(self) -> string { + for (value in string::__undetermined_all__()) { + for (argus in AnnotationAccessArgument(__all_data__)) { + for (auto_tmp1 in self.getAnnotationArgument()) { + if (argus = auto_tmp1) { + if (argus.getAnnotationArgumentName() = "bindingType") { + if (value = argus.getAnnotationArgumentValue()) { + return value + } + } + } + } + } + } + } + + +} + +pub fn javaOutput(classname: string, name: string) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (s in SofaService(java_db), + c in Class(java_db), + i in ClassOrInterface(java_db)) { + for (auto_tmp1 in c.getAnnotation()) { + if (s.key_eq(auto_tmp1)) { + if (classname = c.getQualifiedName()) { + for (auto_tmp2 in c.getImplementsInterface()) { + if (i.key_eq(auto_tmp2)) { + if (name = i.getQualifiedName()) { + return true + } + } + } + if (i = s.getService()) { + if (name = i.getQualifiedName()) { + return true + } + } + } + } + } + } + } + } +} +pub fn xmlOutput(className: string, interfaceName: string) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (temp in string::__undetermined_all__()) { + for (s in SofaServiceXmlElement(xml_db), + b in BeanXmlElement(xml_db)) { + if (s.getRef() = b.getId()) { + if (interfaceName = s.getInterfaceName()) { + if (className = b.getClass()) { + if (temp = b.getLocation().getFile().getRelativePath()) { + if (!temp.contains("src/test/resources")) { + return true + } + } + } + } + } + } + } + } + } +} +pub fn annoOutput(className: string, interfaceName: string) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (v in string::__undetermined_all__(), + k in string::__undetermined_all__()) { + for (s in SofaServiceXmlElement(xml_db), + b in Class(java_db), + t in TagXmlElement(xml_db), + a in Annotation(java_db)) { + if (s.key_eq(t.getParent())) { + if (v = s.getRef()) { + if (interfaceName = s.getInterfaceName()) { + for (auto_tmp1 in b.getAnnotation()) { + if (a = auto_tmp1) { + if (a.getName() = k) { + if (getTrAnnotationName(k)) { + for (auto_tmp2 in a.getAnnotationArgument()) { + if (auto_tmp2.getAnnotationArgumentValue() = "\"" + v + "\"") { + if (className = b.getQualifiedName()) { + return true + } + } + } + } + } + } + } + } + } + } + } + } + } + } +} +pub fn getTrAnnotationName(a: string) -> bool { + [ + {"Service"}, + {"Component"}, + {"Scope"}, + {"Repository"}, + {"Controller"}, + {"RestController"}, + {"RequestMapping"}, + {"PathVariable"}, + {"ResponseBody"}, + {"bean"} + ] +} +pub fn getPublishTr(c: ClassOrInterface) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (className in string::__undetermined_all__(), + interfaceName in string::__undetermined_all__()) { + if (xmlOutput(className, interfaceName)) { + if (interfaceName = c.getQualifiedName()) { + return true + } + } + if (javaOutput(className, interfaceName)) { + if (interfaceName = c.getQualifiedName()) { + return true + } + } + if (annoOutput(className, interfaceName)) { + if (interfaceName = c.getQualifiedName()) { + return true + } + } + } + } + } +} +pub fn real_output(c: ClassOrInterface, n: ECGNode, interfaceName: string, nodeName: string) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (m in ECGNode(java_db)) { + if (getJavaECGNode(m.id)) { + if (getPublishTr(c)) { + for (t in Method(java_db)) { + if (n.key_eq(t)) { + if (c = t.getParent()) { + if (n = m.getAnAncestorCDDependedNode(__all_data__, __all_data__)) { + if (interfaceName = c.getQualifiedName()) { + if (nodeName = n.print()) { + return true + } + } + } + } + } + } + for (f in Field(java_db)) { + if (n.key_eq(f)) { + if (c = f.getParent()) { + if (n = m.getAnAncestorCDDependedNode(__all_data__, __all_data__)) { + if (interfaceName = c.getQualifiedName()) { + if (nodeName = n.print()) { + return true + } + } + } + } + } + } + } + } + if (getXmlECGNode(m.id)) { + if (getPublishTr(c)) { + for (t in Method(java_db)) { + if (n.key_eq(t)) { + if (c = t.getParent()) { + if (n = m.getAnAncestorCDDependedNode(__all_data__, __all_data__)) { + if (interfaceName = c.getQualifiedName()) { + if (nodeName = n.print()) { + return true + } + } + } + } + } + } + for (f in Field(java_db)) { + if (n.key_eq(f)) { + if (c = f.getParent()) { + if (n = m.getAnAncestorCDDependedNode(__all_data__, __all_data__)) { + if (interfaceName = c.getQualifiedName()) { + if (nodeName = n.print()) { + return true + } + } + } + } + } + } + } + } + } + } + } +} + + +fn default_java_db() -> JavaDB { + return JavaDB::load("coref_java_src.db") +} + +fn default_xml_db() -> XmlDB { + return XmlDB::load("coref_xml_src.db") +} + +fn tmp_0(anno: Annotation) -> *auto_tmp_1 { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + if (uniqueArgument(anno)) { + yield auto_tmp_1 { + + } + } + } + } +} + +schema auto_tmp_1 { + +} + +fn tmp_2(anno: Annotation) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + if (tmp_0(anno).len() = 1) { + return true + } + } + } +} + +fn main() { + output(real_output()) +} \ No newline at end of file diff --git a/example/icse25/rules/rule9.gdl b/example/icse25/rules/rule9.gdl new file mode 100644 index 00000000..78e2c268 --- /dev/null +++ b/example/icse25/rules/rule9.gdl @@ -0,0 +1,873 @@ +// script +use coref::java::* +@inline +pub fn trim(n: string, m: string) -> bool { + let (java_db = default_java_db()) { + for (i in int::__undetermined_all__()) { + if (i = n.len()) { + if (tmp_0(n)) { + if (m = n.substr(1,i - 2)) { + return true + } + } + if (!(tmp_0(n))) { + if (m = n) { + return true + } + } + } + } + } +} +@inline +pub fn contact(a: string, b: string, c: string) -> bool { + let (java_db = default_java_db()) { + for (i in int::__undetermined_all__(), + temp in string::__undetermined_all__()) { + if (i = a.len()) { + if (tmp_1(i)) { + if (tmp_2(a, b)) { + if (c = b) { + return true + } + } + if (!(tmp_2(a, b))) { + if (c = a + b) { + return true + } + } + } + if (!(tmp_1(i))) { + if (tmp_3(i, b, a)) { + if (temp = a.substr(1,i - 1)) { + if (c = a + b) { + return true + } + } + } + if (!(tmp_3(i, b, a))) { + if (tmp_4(i, b, a)) { + if (c = a + "/" + b) { + return true + } + } + if (!(tmp_4(i, b, a))) { + if (c = a + b) { + return true + } + } + } + } + } + } + } +} +schema HttpMethodType extends AnnotationAccessArgument { + +} + +impl HttpMethodType { + + @data_constraint + @inline + pub fn __all__(db: JavaDB) -> *HttpMethodType { + for (tmp in AnnotationAccessArgument(db)) { + if (tmp.getAnnotationArgumentName() = "method") { + yield HttpMethodType { + id : tmp.id + } + } + } + } + + pub fn getType(self) -> string { + for (t in string::__undetermined_all__()) { + for (a in AnnotationArrayInitializer(__all_data__)) { + if (self.getArgumentValueHashId() = a.getParent().id) { + for (i in Identifier(__all_data__)) { + if (a.key_eq(i.getParent())) { + if (t = i.getName()) { + return t + } + } + } + } + } + for (i in Identifier(__all_data__)) { + if (self.getArgumentValueHashId() = i.getParent().id) { + if (t = i.getName()) { + return t + } + } + } + } + } + + +} + +pub fn getMethodType(a: Annotation, t: string) -> bool { + let (java_db = default_java_db()) { + for (m in Method(java_db), + h in HttpMethodType(java_db)) { + for (auto_tmp1 in m.getAnnotation()) { + if (a = auto_tmp1) { + if (tmp_5(a)) { + if (t = "POST") { + return true + } + } + if (!(tmp_5(a))) { + if (tmp_6(a)) { + if (t = "GET") { + return true + } + } + if (!(tmp_6(a))) { + if (tmp_7(a)) { + if (t = "PUT") { + return true + } + } + if (!(tmp_7(a))) { + if (tmp_8(a)) { + if (t = "DELETE") { + return true + } + } + if (!(tmp_8(a))) { + if (tmp_9(a)) { + if (t = "PATCH") { + return true + } + } + if (!(tmp_9(a))) { + for (auto_tmp2 in a.getAnnotationArgument()) { + if (h.key_eq(auto_tmp2)) { + if (t = h.getType()) { + return true + } + } + } + } + } + } + } + } + } + } + } + } +} +pub fn getSubUri(a: Annotation, sub: string) -> bool { + let (java_db = default_java_db()) { + for (s in string::__undetermined_all__(), + n in string::__undetermined_all__()) { + for (temp in AnnotationAccessArgument(java_db), + e in Expression(java_db)) { + if (n = a.getName()) { + if (n.matches(".*Mapping")) { + for (auto_tmp1 in a.getAnnotationArgument()) { + if (temp = auto_tmp1) { + if (temp.getAnnotationArgumentName() = "value") { + if (temp.key_eq(e.getParent())) { + if (tmp_10(e)) { + if (sub = connectStr(e)) { + return true + } + } + if (!(tmp_10(e))) { + if (s = temp.getAnnotationArgumentValue()) { + if (trim(s, sub)) { + return true + } + } + } + } + } + } + } + } + } + } + } + } +} +pub fn getUri(c: Class, m: Method, uri1: string) -> bool { + let (java_db = default_java_db()) { + for (l1 in string::__undetermined_all__(), + l2 in string::__undetermined_all__(), + uri in string::__undetermined_all__(), + n in string::__undetermined_all__()) { + for (a in Annotation(java_db), + a1 in Annotation(java_db)) { + if (c = m.getBelongedClass()) { + for (auto_tmp1 in m.getAnnotation()) { + if (a = auto_tmp1) { + for (auto_tmp2 in c.getAnnotation()) { + if (a1 = auto_tmp2) { + if (n = a.getName()) { + if (tmp_12(c)) { + if (n = a.getName()) { + if (n.matches(".*Mapping")) { + if (getSubUri(a, uri)) { + for (tt in string::__undetermined_all__()) { + for (w in WebFolder(java_db), + cc in WebCarClass(java_db)) { + if (tmp_16(w)) { + if (uri1 = uri) { + return true + } + } + if (!(tmp_16(w))) { + if (cc.key_eq(c)) { + if (tt = cc.getWebFolder().getName()) { + if (uri1 = "/" + tt + uri) { + return true + } + } + } + } + } + } + } + } + } + } + if (!(tmp_12(c))) { + if (tmp_14(a)) { + if (n.matches(".*Mapping")) { + if (getSubUri(a1, uri)) { + for (tt in string::__undetermined_all__()) { + for (w in WebFolder(java_db), + cc in WebCarClass(java_db)) { + if (tmp_16(w)) { + if (uri1 = uri) { + return true + } + } + if (!(tmp_16(w))) { + if (cc.key_eq(c)) { + if (tt = cc.getWebFolder().getName()) { + if (uri1 = "/" + tt + uri) { + return true + } + } + } + } + } + } + } + } + } + if (!(tmp_14(a))) { + if (a1.getName() = "RequestMapping") { + if (n.matches(".*Mapping")) { + if (getSubUri(a, l1)) { + if (getSubUri(a1, l2)) { + if (contact(l2, l1, uri)) { + for (tt in string::__undetermined_all__()) { + for (w in WebFolder(java_db), + cc in WebCarClass(java_db)) { + if (tmp_16(w)) { + if (uri1 = uri) { + return true + } + } + if (!(tmp_16(w))) { + if (cc.key_eq(c)) { + if (tt = cc.getWebFolder().getName()) { + if (uri1 = "/" + tt + uri) { + return true + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } +} +schema WebFolder extends Folder { + +} + +impl WebFolder { + + @data_constraint + @inline + pub fn __all__(db: JavaDB) -> *WebFolder { + for (tmp in Folder(db)) { + yield WebFolder { + element_hash_id : tmp.element_hash_id, + qualified_name : tmp.qualified_name, + name : tmp.name, + parent_hash_id : tmp.parent_hash_id + } + } + } + + pub fn getChild(self) -> Folder { + for (f in Folder(__all_data__)) { + if (self.element_hash_id = f.getParentHashId()) { + return f + } + } + } + + +} + +schema WebCarFolder extends Folder { + +} + +impl WebCarFolder { + + @data_constraint + @inline + pub fn __all__(db: JavaDB) -> *WebCarFolder { + for (tmp in Folder(db)) { + yield WebCarFolder { + element_hash_id : tmp.element_hash_id, + qualified_name : tmp.qualified_name, + name : tmp.name, + parent_hash_id : tmp.parent_hash_id + } + } + } + + pub fn getBelongedFolder(self) -> WebCarFolder { + for (f in WebCarFolder(__all_data__)) { + if (f.element_hash_id = self.getParentHashId()) { + return f + } + } + } + + pub fn getAnAncestorFolder(self) -> WebCarFolder { + for (f in WebCarFolder(__all_data__)) { + if (f = self.getBelongedFolder()) { + return f + } + if (f = self.getBelongedFolder().getAnAncestorFolder()) { + return f + } + } + } + + +} + +schema WebCarClass extends Class { + +} + +impl WebCarClass { + + @data_constraint + @inline + pub fn __all__(db: JavaDB) -> *WebCarClass { + for (tmp in Class(db)) { + for (f in WebCarFolder(db), + w in WebFolder(db)) { + if (f.key_eq(tmp.getContainingFile().getBelongedFolder())) { + if (f.getAnAncestorFolder().key_eq(w)) { + yield WebCarClass { + element_hash_id : tmp.element_hash_id, + qualified_name : tmp.qualified_name, + identifier_hash_id : tmp.identifier_hash_id, + location_hash_id : tmp.location_hash_id, + parent_hash_id : tmp.parent_hash_id + } + } + } + } + } + } + + pub fn getWebFolder(self) -> WebCarFolder { + for (c in WebCarFolder(__all_data__)) { + for (f in WebCarFolder(__all_data__), + w in WebFolder(__all_data__)) { + if (f.key_eq(self.getContainingFile().getBelongedFolder())) { + if (f.getAnAncestorFolder() = c) { + if (c.key_eq(w.getChild())) { + return c + } + } + } + } + } + } + + +} + +pub fn resolve(r: ReferenceExpression, rr: string) -> bool { + let (java_db = default_java_db()) { + for (temp in string::__undetermined_all__()) { + for (e in Expression(java_db)) { + if (e.getParent() = r.getDefinition()) { + if (temp = e.getPrintableText()) { + if (trim(temp, rr)) { + return true + } + } + } + } + } + } +} +pub fn facts(a: Expression, i: int, value: string) -> bool { + let (java_db = default_java_db()) { + for (p in PolyadicExpression(java_db)) { + if (a.key_eq(p)) { + for (temp in string::__undetermined_all__()) { + for (e in Expression(java_db)) { + if (tmp_17(a)) { + if (resolve(ReferenceExpression(java_db).find(a), value)) { + if (i = 0) { + return true + } + } + } + if (!(tmp_17(a))) { + if (a.key_eq(e.getParent())) { + if (i = e.getIndex()) { + if (tmp_18(e)) { + if (resolve(ReferenceExpression(java_db).find(e), value)) { + return true + } + } + if (!(tmp_18(e))) { + if (temp = e.getPrintableText()) { + if (trim(temp, value)) { + return true + } + } + } + } + } + } + } + } + } + } + for (p in BinaryExpression(java_db)) { + if (a.key_eq(p)) { + for (temp in string::__undetermined_all__()) { + for (e in Expression(java_db)) { + if (tmp_17(a)) { + if (resolve(ReferenceExpression(java_db).find(a), value)) { + if (i = 0) { + return true + } + } + } + if (!(tmp_17(a))) { + if (a.key_eq(e.getParent())) { + if (i = e.getIndex()) { + if (tmp_18(e)) { + if (resolve(ReferenceExpression(java_db).find(e), value)) { + return true + } + } + if (!(tmp_18(e))) { + if (temp = e.getPrintableText()) { + if (trim(temp, value)) { + return true + } + } + } + } + } + } + } + } + } + } + for (p in ReferenceExpression(java_db)) { + if (a.key_eq(p)) { + for (temp in string::__undetermined_all__()) { + for (e in Expression(java_db)) { + if (tmp_17(a)) { + if (resolve(ReferenceExpression(java_db).find(a), value)) { + if (i = 0) { + return true + } + } + } + if (!(tmp_17(a))) { + if (a.key_eq(e.getParent())) { + if (i = e.getIndex()) { + if (tmp_18(e)) { + if (resolve(ReferenceExpression(java_db).find(e), value)) { + return true + } + } + if (!(tmp_18(e))) { + if (temp = e.getPrintableText()) { + if (trim(temp, value)) { + return true + } + } + } + } + } + } + } + } + } + } + } +} +pub fn connectStrBase(ID: Expression, index: int, res: string) -> bool { + let (java_db = default_java_db()) { + for (total in int::__undetermined_all__(), + reStr in string::__undetermined_all__(), + currStr in string::__undetermined_all__()) { + if (total = tmp_19(ID).len()) { + if (tmp_21(index)) { + if (facts(Expression(java_db).find(ID), index, currStr)) { + if (res = currStr) { + return true + } + } + } + if (!(tmp_21(index))) { + if (index > 0) { + if (connectStrBase(ID, index - 1, reStr)) { + if (facts(Expression(java_db).find(ID), index, currStr)) { + if (res = reStr + currStr) { + return true + } + } + } + } + } + } + } + } +} +pub fn connectStr(ID: Expression) -> string { + let (java_db = default_java_db()) { + for (c in int::__undetermined_all__(), res in string::__undetermined_all__()) { + if (c = tmp_22(ID).len()) { + if (connectStrBase(ID, c - 1, res)) { + return res + } + } + } + } +} +pub fn real_output(m: Method, className: string, methodSignature: string, type: string) -> bool { + let (java_db = default_java_db()) { + for (n in string::__undetermined_all__(), + uri in string::__undetermined_all__(), + path in string::__undetermined_all__()) { + for (c in Class(java_db), + a in Annotation(java_db)) { + if (getUri(c, m, uri)) { + if (className = c.getQualifiedName()) { + if (methodSignature = m.getSignature()) { + for (auto_tmp1 in m.getAnnotation()) { + if (a = auto_tmp1) { + if (n = a.getName()) { + if (n.matches(".*Mapping")) { + if (tmp_26(a)) { + if (type = "EMPTY") { + if (path = m.getLocation().getFile().getRelativePath()) { + if (!path.contains("src/test/java")) { + return true + } + } + } + } + if (!(tmp_26(a))) { + if (getMethodType(a, type)) { + if (path = m.getLocation().getFile().getRelativePath()) { + if (!path.contains("src/test/java")) { + return true + } + } + } + } + } + } + } + } + } + } + } + } + } + } +} + + +fn default_java_db() -> JavaDB { + return JavaDB::load("coref_java_src.db") +} + +fn tmp_0(n: string) -> bool { + let (java_db = default_java_db()) { + if (n.substr(0,1) = "\"") { + return true + } + } +} + +fn tmp_1(i: int) -> bool { + let (java_db = default_java_db()) { + if (i = 1) { + return true + } + } +} + +fn tmp_2(a: string, b: string) -> bool { + let (java_db = default_java_db()) { + if (a.substr(0,1) = "/") { + if (b.substr(0,1) = "/") { + return true + } + } + } +} + +@inline +fn tmp_3(i: int, b: string, a: string) -> bool { + let (java_db = default_java_db()) { + if (a.substr(i - 1,i - 1) = "/") { + if (b.substr(0,1) = "/") { + return true + } + } + } +} + +@inline +fn tmp_4(i: int, b: string, a: string) -> bool { + let (java_db = default_java_db()) { + if (a.substr(i - 1,i - 1) != "/") { + if (b.substr(0,1) != "/") { + return true + } + } + } +} + +fn tmp_5(a: Annotation) -> bool { + let (java_db = default_java_db()) { + if (a.getName() = "PostMapping") { + return true + } + } +} + +fn tmp_6(a: Annotation) -> bool { + let (java_db = default_java_db()) { + if (a.getName() = "GetMapping") { + return true + } + } +} + +fn tmp_7(a: Annotation) -> bool { + let (java_db = default_java_db()) { + if (a.getName() = "PutMapping") { + return true + } + } +} + +fn tmp_8(a: Annotation) -> bool { + let (java_db = default_java_db()) { + if (a.getName() = "DeleteMapping") { + return true + } + } +} + +fn tmp_9(a: Annotation) -> bool { + let (java_db = default_java_db()) { + if (a.getName() = "PatchMapping") { + return true + } + } +} + +fn tmp_10(e: Expression) -> bool { + let (java_db = default_java_db()) { + if (facts(e, __all_data__, __all_data__)) { + return true + } + } +} + +fn tmp_11(c: Class) -> *Annotation { + let (java_db = default_java_db()) { + for (b in Annotation(java_db)) { + for (auto_tmp3 in c.getAnnotation()) { + if (b = auto_tmp3) { + if (b.getName() = "RequestMapping") { + yield b + } + } + } + } + } +} + +fn tmp_12(c: Class) -> bool { + let (java_db = default_java_db()) { + if (tmp_11(c).len() = 0) { + return true + } + } +} + +fn tmp_13(a: Annotation) -> *AnnotationAccessArgument { + let (java_db = default_java_db()) { + for (b in AnnotationAccessArgument(java_db)) { + for (auto_tmp4 in a.getAnnotationArgument()) { + if (b = auto_tmp4) { + if (b.getAnnotationArgumentName() = "value") { + yield b + } + } + } + } + } +} + +fn tmp_14(a: Annotation) -> bool { + let (java_db = default_java_db()) { + if (tmp_13(a).len() = 0) { + return true + } + } +} + +fn tmp_15(w: WebFolder) -> *Folder { + let (java_db = default_java_db()) { + for (f in Folder(java_db)) { + if (f = w.getChild()) { + yield f + } + } + } +} + +fn tmp_16(w: WebFolder) -> bool { + let (java_db = default_java_db()) { + if (tmp_15(w).len() = 1) { + return true + } + } +} + +fn tmp_17(a: Expression) -> bool { + let (java_db = default_java_db()) { + if (resolve(ReferenceExpression(java_db).find(a), __all_data__)) { + return true + } + } +} + +fn tmp_18(e: Expression) -> bool { + let (java_db = default_java_db()) { + if (resolve(ReferenceExpression(java_db).find(e), __all_data__)) { + return true + } + } +} + +fn tmp_19(ID: Expression) -> *auto_tmp_20 { + let (java_db = default_java_db()) { + for (auto_tmp_var_0 in int::__undetermined_all__(), + auto_tmp_var_1 in string::__undetermined_all__()) { + if (facts(Expression(java_db).find(ID), auto_tmp_var_0, auto_tmp_var_1)) { + yield auto_tmp_20 { + auto_tmp_var_0 : auto_tmp_var_0, + auto_tmp_var_1 : auto_tmp_var_1 + } + } + } + } +} + +schema auto_tmp_20 { + auto_tmp_var_0 : int, + auto_tmp_var_1 : string +} + +fn tmp_21(index: int) -> bool { + let (java_db = default_java_db()) { + if (index = 0) { + return true + } + } +} + +fn tmp_22(ID: Expression) -> *auto_tmp_23 { + let (java_db = default_java_db()) { + for (auto_tmp_var_0 in int::__undetermined_all__(), + auto_tmp_var_1 in string::__undetermined_all__()) { + if (facts(Expression(java_db).find(ID), auto_tmp_var_0, auto_tmp_var_1)) { + yield auto_tmp_23 { + auto_tmp_var_0 : auto_tmp_var_0, + auto_tmp_var_1 : auto_tmp_var_1 + } + } + } + } +} + +schema auto_tmp_23 { + auto_tmp_var_0 : int, + auto_tmp_var_1 : string +} + +fn tmp_24(a: Annotation) -> *auto_tmp_25 { + let (java_db = default_java_db()) { + for (auto_tmp_var_0 in string::__undetermined_all__()) { + if (getMethodType(a, auto_tmp_var_0)) { + yield auto_tmp_25 { + auto_tmp_var_0 : auto_tmp_var_0 + } + } + } + } +} + +schema auto_tmp_25 { + auto_tmp_var_0 : string +} + +fn tmp_26(a: Annotation) -> bool { + let (java_db = default_java_db()) { + if (tmp_24(a).len() = 0) { + return true + } + } +} + +fn main() { + output(real_output()) +} \ No newline at end of file diff --git a/example/icse25/rules/rule_ecg.gdl b/example/icse25/rules/rule_ecg.gdl new file mode 100644 index 00000000..d4bd39b9 --- /dev/null +++ b/example/icse25/rules/rule_ecg.gdl @@ -0,0 +1,2545 @@ +// script +use coref::java::* +use coref::xml::* + +schema ECGNode extends ElementParent {} + +impl ECGNode { + pub fn __all__(db: JavaDB) -> *ECGNode { + for (tmp in ElementParent(db)) { + for (m in Method(db)) { + if (tmp.key_eq(m)) { + yield ECGNode { + id : tmp.id + } + } + } + for (m in Variable(db)) { + if (tmp.key_eq(m)) { + yield ECGNode { + id : tmp.id + } + } + } + for (m in Expression(db)) { + if (tmp.key_eq(m)) { + yield ECGNode { + id : tmp.id + } + } + } + } + } + + pub fn getType(self) -> string { + for (t in string::__undetermined_all__()) { + for (m in Method(__all_data__)) { + if (self.key_eq(m)) { + if (t = "Method") { + return t + } + } + } + for (m in LocalVariable(__all_data__)) { + if (self.key_eq(m)) { + if (t = "LocalVariable") { + return t + } + } + } + for (m in Parameter(__all_data__)) { + if (self.key_eq(m)) { + if (t = "Parameter") { + return t + } + } + } + for (m in Field(__all_data__)) { + if (self.key_eq(m)) { + if (t = "Field") { + return t + } + } + } + for (m in EnumConstant(__all_data__)) { + if (self.key_eq(m)) { + if (t = "EnumConstant") { + return t + } + } + } + for (m in Expression(__all_data__)) { + if (self.key_eq(m)) { + if (t = m.getType()) { + return t + } + } + } + } + } + + pub fn getDDNode(self, type: string, direction: string) -> ECGNode { + for (e1 in ECGNode(__all_data__)) { + for (e in Parameter(__all_data__), + c in Method(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + for (auto_tmp1 in c.getParameter()) { + if (e = auto_tmp1) { + if (direction = "Depended") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + for (r in ReturnStatement(__all_data__), + c in Method(__all_data__), + e in Expression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (c.key_eq(r.getEnclosingCallable())) { + if (e = r.getResult()) { + if (direction = "Depends") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + for (c in Callable(__all_data__), + e in Field(__all_data__), + r in ReferenceExpression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (c = r.getEnclosingCallable()) { + if (e.key_eq(r.getDefinition())) { + if (direction = "Depended") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + for (c in Callable(__all_data__), + e in EnumConstant(__all_data__), + r in ReferenceExpression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (c = r.getEnclosingCallable()) { + if (e.key_eq(r.getDefinition())) { + if (direction = "Depended") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + for (e in Callable(__all_data__), + c in Field(__all_data__), + r in ReferenceExpression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (c.key_eq(r.getDefinition())) { + if (e = r.getEnclosingCallable()) { + if (direction = "Depends") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + for (e in Callable(__all_data__), + c in EnumConstant(__all_data__), + r in ReferenceExpression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (c.key_eq(r.getDefinition())) { + if (e = r.getEnclosingCallable()) { + if (direction = "Depends") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + for (c in Callable(__all_data__), + e in CallExpression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (c = e.getEnclosingCallable()) { + for (m in Method(__all_data__)) { + if (m = e.getMethod()) { + if (!isDirectCall(e)) { + if (direction = "Depended") { + if (type = "DD") { + return e1 + } + } + } + } + } + for (f in LombokField(__all_data__)) { + if (f = e.getLombokField()) { + if (!isDirectCall(e)) { + if (direction = "Depended") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + } + } + for (n in string::__undetermined_all__()) { + for (e in LombokField(__all_data__), + c in CallExpression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (e = c.getLombokField()) { + let (tmp_find = CallExpression(__all_data__).find(e)) { + if (!isDirectCall(tmp_find)) { + if (n = c.getMethodName()) { + if (Self::tmp_0(n)) { + if (direction = "Depended") { + if (type = "DD") { + return e1 + } + } + } + if (!Self::tmp_0(n)) { + if (direction = "Depends") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + } + } + } + } + for (e in Variable(__all_data__), + c in CallExpression(__all_data__), + r in ReferenceExpression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (!isDirectCall(c)) { + for (auto_tmp2 in c.getArguments()) { + if (r.key_eq(auto_tmp2)) { + if (e.key_eq(r.getDefinition())) { + if (direction = "Depended") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + } + } + for (e in CallExpression(__all_data__), + c in CallExpression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (!isDirectCall(c)) { + for (auto_tmp3 in c.getArguments()) { + if (e.key_eq(auto_tmp3)) { + if (direction = "Depended") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + } + for (e in CallExpression(__all_data__), + c in CallExpression(__all_data__), + s in CallExpression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (!isDirectCall(c)) { + for (auto_tmp4 in c.getAnAncestor()) { + if (s.getReference().key_eq(auto_tmp4)) { + for (auto_tmp5 in s.getArguments()) { + if (auto_tmp5.key_eq(e)) { + if (direction = "Depended") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + } + } + } + } + } + + pub fn getAnAncestorDDNode(self, type: string, direction: string) -> ECGNode { + for (e in ECGNode(__all_data__)) { + if (type = "DD") { + if (e = self.getDDNode(type, direction)) { + return e + } + if (e = self.getAnAncestorDDNode(__all_data__, __all_data__).getDDNode(type, direction)) { + return e + } + } + } + } + + pub fn getCDNode(self, type: string, direction: string) -> ECGNode { + for (e in ECGNode(__all_data__), + c in Callable(__all_data__), + r in ReferenceExpression(__all_data__)) { + if (self.key_eq(c)) { + if (type = "CD") { + for (e1 in Method(__all_data__)) { + for (auto_tmp1 in c.getCallee()) { + if (e1.key_eq(auto_tmp1)) { + if (direction = "Depends") { + if (e.key_eq(e1)) { + return e + } + } + } + } + } + for (e2 in Method(__all_data__)) { + for (auto_tmp2 in c.getCaller()) { + if (e2.key_eq(auto_tmp2)) { + if (direction = "Depended") { + if (e.key_eq(e2)) { + return e + } + } + } + } + } + } + } + if (self.key_eq(r.getDefinition())) { + if (c = r.getEnclosingCallable()) { + if (type = "CD") { + for (e1 in Method(__all_data__)) { + for (auto_tmp1 in c.getCallee()) { + if (e1.key_eq(auto_tmp1)) { + if (direction = "Depends") { + if (e.key_eq(e1)) { + return e + } + } + } + } + } + for (e2 in Method(__all_data__)) { + for (auto_tmp2 in c.getCaller()) { + if (e2.key_eq(auto_tmp2)) { + if (direction = "Depended") { + if (e.key_eq(e2)) { + return e + } + } + } + } + } + } + } + } + } + } + + pub fn getAnAncestorCDNode(self, type: string, direction: string) -> ECGNode { + for (e in ECGNode(__all_data__), + c in Callable(__all_data__), + r in ReferenceExpression(__all_data__)) { + if (type = "CD") { + if (self.key_eq(c)) { + for (e1 in Method(__all_data__)) { + for (auto_tmp1 in c.getAnAncestorCallee()) { + if (e1.key_eq(auto_tmp1)) { + if (direction = "Depends") { + if (e.key_eq(e1)) { + return e + } + } + } + } + } + for (e2 in Method(__all_data__)) { + for (auto_tmp2 in c.getAnAncestorCaller()) { + if (e2.key_eq(auto_tmp2)) { + if (direction = "Depended") { + if (e.key_eq(e2)) { + return e + } + } + } + } + } + } + if (self.key_eq(r.getDefinition())) { + if (c = r.getEnclosingCallable()) { + for (e1 in Method(__all_data__)) { + for (auto_tmp1 in c.getAnAncestorCallee()) { + if (e1.key_eq(auto_tmp1)) { + if (direction = "Depends") { + if (e.key_eq(e1)) { + return e + } + } + } + } + } + for (e2 in Method(__all_data__)) { + for (auto_tmp2 in c.getAnAncestorCaller()) { + if (e2.key_eq(auto_tmp2)) { + if (direction = "Depended") { + if (e.key_eq(e2)) { + return e + } + } + } + } + } + } + } + } + } + } + + pub fn getECGNode(self, type: string, direction: string) -> ECGNode { + for (e in ECGNode(__all_data__)) { + if (e = self.getCDNode(type, direction)) { + return e + } + if (e = self.getDDNode(type, direction)) { + return e + } + } + } + + pub fn getAnAncestorECGNode(self, type: string, direction: string) -> ECGNode { + for (e in ECGNode(__all_data__), tmp in ECGNode(__all_data__)) { + if (tmp = self.getAnAncestorCDNode(__all_data__, __all_data__)) { + if (e = tmp.getECGNode(type, direction)) { + return e + } + } + } + } + + pub fn getAnAncestorCDDependedNode(self, type: string, direction: string) -> ECGNode { + for (e in ECGNode(__all_data__), c in Callable(__all_data__), r in ReferenceExpression(__all_data__)) { + if (type = "CD") { + if (self.key_eq(c) || (self.key_eq(r.getDefinition()) && r.getEnclosingCallable() = c)) { + for (e2 in Method(__all_data__), c_caller in c.getAnAncestorCaller()) { + if (e2.key_eq(c_caller) && direction = "Depended" && e.key_eq(e2)) { + return e + } + } + } + } + } + } + + pub fn getECGDependsNode(self, type: string, direction: string) -> ECGNode { + for (e in ECGNode(__all_data__)) { + if (e = self.getCDDependsNode(type, direction)) { + return e + } + if (e = self.getDDDependsNode(type, direction)) { + return e + } + } + } + + pub fn getCDDependsNode(self, type: string, direction: string) -> ECGNode { + for (e in ECGNode(__all_data__), + c in Callable(__all_data__), + r in ReferenceExpression(__all_data__)) { + if (self.key_eq(c)) { + if (type = "CD") { + for (e1 in c.getCallee()) { + if (direction = "Depends") { + if (e.key_eq(e1)) { + return e + } + } + } + } + } + for (v in Variable(__all_data__)) { + if (self.key_eq(v)) { + if (v.key_eq(r.getDefinition())) { + if (c = r.getEnclosingCallable()) { + if (type = "CD") { + for (e1 in c.getCallee()) { + if (direction = "Depends") { + if (e.key_eq(e1)) { + return e + } + } + } + } + } + } + } + } + } + } + + pub fn getDDDependsNode(self, type: string, direction: string) -> ECGNode { + for (e1 in ECGNode(__all_data__)) { + for (r in ReturnStatement(__all_data__), + c in Method(__all_data__), + e in Expression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (c.key_eq(r.getEnclosingCallable())) { + if (e = r.getResult()) { + if (direction = "Depends") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + for (e in Callable(__all_data__), + c in Field(__all_data__), + r in ReferenceExpression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (c.key_eq(r.getDefinition())) { + if (e = r.getEnclosingCallable()) { + if (direction = "Depends") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + for (e in Callable(__all_data__), + c in EnumConstant(__all_data__), + r in ReferenceExpression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (c.key_eq(r.getDefinition())) { + if (e = r.getEnclosingCallable()) { + if (direction = "Depends") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + for (n in string::__undetermined_all__()) { + for (e in LombokField(__all_data__), + c in CallExpression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (e = c.getLombokField()) { + let (tmp = CallExpression(__all_data__).find(e)) { + if (!isDirectCall(tmp)) { + if (n = c.getMethodName()) { + if (!n.matches("get.*")) { + if (direction = "Depends") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + } + } + } + } + } + } + + pub fn getAnAncestorCDDependsNode(self, type: string, direction: string) -> ECGNode { + for (e in ECGNode(__all_data__), + c in Callable(__all_data__), + r in ReferenceExpression(__all_data__)) { + if (type = "CD") { + if (self.key_eq(c)) { + for (e1 in c.getAnAncestorCallee()) { + if (direction = "Depends") { + if (e.key_eq(e1)) { + return e + } + } + } + } + if (self.key_eq(r.getDefinition())) { + if (c = r.getEnclosingCallable()) { + for (e1 in c.getAnAncestorCallee()) { + if (direction = "Depends") { + if (e.key_eq(e1)) { + return e + } + } + } + } + } + } + } + } + + pub fn getPath(self) -> string { + for (line in int::__undetermined_all__(), + t in string::__undetermined_all__(), + path in string::__undetermined_all__(), + info in string::__undetermined_all__()) { + for (l in coref::java::Location(__all_data__)) { + if (l = self.getLocation()) { + if (path = l.getFile().getRelativePath()) { + if (line = l.getStartLineNumber()) { + if (t = line.to_string()) { + if (info = path + ":" + t) { + return info + } + } + } + } + } + } + } + } + + fn tmp_0(n: string) -> bool { + if (n.matches("get.*")) { + return true + } + } +} + +schema ECGXmlNode { + @primary id: int +} + +impl ECGXmlNode { + pub fn __all__(db: XmlDB) -> *ECGXmlNode { + for (e in XmlPomElement(db)) { + yield ECGXmlNode {id : e.id} + } + for (e in XmlSpringElement(db)) { + yield ECGXmlNode {id : e.id} + } + for (e in XmlCharacter(db)) { + yield ECGXmlNode {id : e.id} + } + for (e in XmlAttribute(db)) { + yield ECGXmlNode {id : e.id} + } + } + + pub fn getLocation(self) -> coref::xml::Location { + for (l in coref::xml::Location(__all_data__)) { + for (e in XmlElement(__all_data__)) { + if (self.key_eq(e)) { + if (l = e.getLocation()) { + return l + } + } + } + for (e in XmlAttribute(__all_data__)) { + if (self.key_eq(e)) { + if (l = e.getLocation()) { + return l + } + } + } + for (e in XmlCharacter(__all_data__)) { + if (self.key_eq(e)) { + if (l = e.getLocation()) { + return l + } + } + } + } + } + + pub fn getType(self) -> string { + for (t in string::__undetermined_all__()) { + for (e in XmlElement(__all_data__)) { + if (self.key_eq(e)) { + if (t = "XmlElement") { + return t + } + } + } + for (e in XmlAttribute(__all_data__)) { + if (self.key_eq(e)) { + if (t = "XmlAttribute") { + return t + } + } + } + for (e in XmlCharacter(__all_data__)) { + if (self.key_eq(e)) { + if (t = "XmlCharacter") { + return t + } + } + } + } + } + + pub fn getText(self) -> string { + for (e in XmlElement(__all_data__)) { + if (self.key_eq(e)) { + return e.getName() + } + } + for (e in XmlAttribute(__all_data__)) { + if (self.key_eq(e)) { + return e.getName() + " = " + e.getValue() + } + } + for (e in XmlCharacter(__all_data__)) { + if (self.key_eq(e)) { + return e.getText() + } + } + } + + pub fn getEnclosingECGXmlNode(self) -> ECGXmlNode { + for (e in XmlElement(__all_data__)) { + if (self.key_eq(e)) { + return e.to() + } + } + for (e in XmlAttribute(__all_data__)) { + if (self.key_eq(e)) { + return e.getXmlElement().to() + } + } + for (e in XmlCharacter(__all_data__)) { + if (self.key_eq(e)) { + return e.getBelongedElement().to() + } + } + } +} + +pub fn gitdiff(filePath: string, lineNo: int) -> bool { + // #changeinfo + // example + [ {"test", 1111} ] +} + +pub fn transfertofile1(f: File, filename: string, lineNumber: int) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + if (gitdiff(filename, lineNumber)) { + if (!filename.contains("src/test/java")) { + if (filename = f.getRelativePath()) { + if (isCodeLine(f, filename, lineNumber)) { + return true + } + } + } + } + } + } +} +pub fn transfertofile(f: File, filename: string, lineNumber: int) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + if (transfertofile1(f, filename, lineNumber)) { + if (!findSpecialCodeType(filename, lineNumber, __all_data__)) { + return true + } + } + } + } +} +pub fn isComment(filename: string, lineNumber: int) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (f in File(java_db)) { + if (transfertofile1(f, filename, lineNumber)) { + for (e in int::__undetermined_all__(), + s1 in int::__undetermined_all__()) { + for (c in Comment(java_db)) { + if (c.getLocation().getFile() = f) { + if (s1 = c.getLocation().getStartLineNumber()) { + if (e = c.getLocation().getEndLineNumber()) { + if (lineNumber > s1 - 1) { + if (lineNumber < e + 1) { + return true + } + } + } + } + } + } + } + for (e in int::__undetermined_all__(), + s1 in int::__undetermined_all__()) { + for (c in JavadocComment(java_db)) { + if (c.getLocation().getFile() = f) { + if (s1 = c.getLocation().getStartLineNumber()) { + if (e = c.getLocation().getEndLineNumber()) { + if (lineNumber > s1 - 1) { + if (lineNumber < e + 1) { + return true + } + } + } + } + } + } + } + } + } + } + } +} +pub fn isAnnotation(filename: string, lineNumber: int) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (f in File(java_db)) { + if (transfertofile1(f, filename, lineNumber)) { + for (e in int::__undetermined_all__(), + s1 in int::__undetermined_all__()) { + for (c in Annotation(java_db)) { + if (c.getLocation().getFile() = f) { + if (s1 = c.getLocation().getStartLineNumber()) { + if (e = c.getLocation().getEndLineNumber()) { + if (lineNumber > s1 - 1) { + if (lineNumber < e + 1) { + return true + } + } + } + } + } + } + } + } + } + } + } +} +pub fn isCodeLine(f: File, filename: string, lineNumber: int) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + if (gitdiff(filename, lineNumber)) { + if (f.getRelativePath() = filename) { + for (e in int::__undetermined_all__(), + s1 in int::__undetermined_all__()) { + for (l in coref::java::Location(java_db)) { + if (l.getFile() = f) { + if (s1 = l.getStartLineNumber()) { + if (e = l.getEndLineNumber()) { + if (lineNumber > s1 - 1) { + if (lineNumber < e + 1) { + return true + } + } + } + } + } + } + } + } + } + } + } +} +pub fn isLog(filename: string, lineNumber: int) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (f in File(java_db)) { + if (transfertofile1(f, filename, lineNumber)) { + for (e in int::__undetermined_all__(), + s1 in int::__undetermined_all__(), + text in string::__undetermined_all__()) { + for (c in Expression(java_db)) { + if (c.getLocation().getFile() = f) { + if (s1 = c.getLocation().getStartLineNumber()) { + if (e = c.getLocation().getEndLineNumber()) { + if (lineNumber > s1 - 1) { + if (lineNumber < e + 1) { + if (text = c.getPrintableText()) { + if (text.matches("^logger\\..*")) { + return true + } + } + } + } + } + } + } + } + } + } + } + } + } +} +pub fn getTypeInAST(filename: string, lineNumber: int, typeInAST: string) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (f in File(java_db)) { + if (transfertofile(f, filename, lineNumber)) { + for (e in int::__undetermined_all__(), + s1 in int::__undetermined_all__()) { + for (c in ElementParent(java_db)) { + if (c.getLocation().getFile() = f) { + if (s1 = c.getLocation().getStartLineNumber()) { + if (e = c.getLocation().getEndLineNumber()) { + if (s1 = e) { + if (lineNumber > s1 - 1) { + if (lineNumber < e + 1) { + if (typeInAST = c.getType()) { + return true + } + } + } + } + } + } + } + } + } + } + } + } + } +} +pub fn getTypeInECG(filename: string, lineNumber: int, typeInAST: string, n: ECGNode) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (f in File(java_db)) { + if (transfertofile(f, filename, lineNumber)) { + if (tmp_0(lineNumber, filename)) { + if (typeInAST = "Callable") { + if (getBelongedCallable(filename, lineNumber, Callable(java_db).find(n))) { + return true + } + } + } + if (!(tmp_0(lineNumber, filename))) { + for (e in int::__undetermined_all__(), + s1 in int::__undetermined_all__()) { + if (n.getLocation().getFile() = f) { + if (s1 = n.getLocation().getStartLineNumber()) { + if (e = n.getLocation().getEndLineNumber()) { + if (lineNumber > s1 - 1) { + if (lineNumber < e + 1) { + if (typeInAST = n.getType()) { + if (isFieldOrEnum(ECGNode(java_db).find(n))) { + return true + } + } + } + } + } + } + } + } + } + } + } + } + } +} +pub fn isFieldOrEnum(c: ECGNode) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (f in Field(java_db)) { + if (f.key_eq(c)) { + return true + } + } + for (e in EnumConstant(java_db)) { + if (e.key_eq(c)) { + return true + } + } + } + } +} +pub fn findSpecialCodeType(filename: string, lineNumber: int, type: string) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + if (isComment(filename, lineNumber)) { + if (type = "comment") { + return true + } + } + if (isAnnotation(filename, lineNumber)) { + if (type = "annotation") { + return true + } + } + if (isLog(filename, lineNumber)) { + if (type = "log") { + return true + } + } + } + } +} +pub fn getBelongedCallable(filename: string, lineNumber: int, c: Callable) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (f in File(java_db)) { + if (transfertofile(f, filename, lineNumber)) { + for (l1 in int::__undetermined_all__(), + l2 in int::__undetermined_all__()) { + for (i in Identifier(java_db)) { + if (f = c.getLocation().getFile()) { + if (c.key_eq(i.getParent())) { + if (l1 = i.getLocation().getStartLineNumber()) { + if (l2 = c.getLocation().getEndLineNumber()) { + if (lineNumber > l1 - 1) { + if (lineNumber < l2 + 1) { + return true + } + } + } + } + } + } + } + } + } + } + } + } +} +pub fn getBelongedCallableSignature(filename: string, lineNumber: int, belongedCallable: string) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (i in int::__undetermined_all__()) { + for (c in Callable(java_db)) { + if (transfertofile(__all_data__, filename, lineNumber)) { + if (i = tmp_1().len()) { + if (tmp_2(i)) { + if (belongedCallable = "") { + return true + } + } + if (!(tmp_2(i))) { + if (getBelongedCallable(filename, lineNumber, c)) { + if (belongedCallable = c.getSignature()) { + return true + } + } + } + } + } + } + } + } + } +} +pub fn getJavaECGNode(n: ECGNode) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (lineNumber in int::__undetermined_all__(), + filename in string::__undetermined_all__(), + typeInAST in string::__undetermined_all__(), + belongedCallable in string::__undetermined_all__()) { + if (transfertofile(__all_data__, filename, lineNumber)) { + if (getBelongedCallableSignature(filename, lineNumber, belongedCallable)) { + if (getTypeInECG(filename, lineNumber, typeInAST, n)) { + return true + } + } + } + } + } + } +} +pub fn transfertoXmlfile(f: XmlFile, filename: string, lineNumber: int) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + if (gitdiff(filename, lineNumber)) { + if (filename = f.getRelativePath()) { + return true + } + } + } + } +} +pub fn getXmlECGNode1(n: ECGXmlNode) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (lineNumber in int::__undetermined_all__(), + e in int::__undetermined_all__(), + s1 in int::__undetermined_all__(), + filename in string::__undetermined_all__(), + typeInAST in string::__undetermined_all__(), + text in string::__undetermined_all__()) { + for (f in XmlFile(xml_db), + o in ECGXmlNode(xml_db)) { + if (transfertoXmlfile(f, filename, lineNumber)) { + if (n.getLocation().getFile() = f) { + if (s1 = n.getLocation().getStartLineNumber()) { + if (e = n.getLocation().getEndLineNumber()) { + if (lineNumber > s1 - 1) { + if (lineNumber < e + 1) { + if (typeInAST = n.getType()) { + if (text = n.getText()) { + if (o = n.getEnclosingECGXmlNode()) { + return true + } + } + } + } + } + } + } + } + } + } + } + } + } +} +@inline +pub fn trim(n: string, m: string) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (i in int::__undetermined_all__()) { + if (i = n.len()) { + if (tmp_3(n)) { + if (m = n.substr(1,i - 2)) { + return true + } + } + if (!(tmp_3(n))) { + if (m = n) { + return true + } + } + } + } + } + } +} +pub fn getXmlECGNode(f: ECGNode) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (c in ClassOrInterface(java_db), + n in string::__undetermined_all__(), + m in string::__undetermined_all__()) { + for (r in ECGXmlNode(xml_db)) { + if (getXmlECGNode1(r)) { + if (getChangeSetByDalXmlElement(r, c, Method(java_db).find(f), n, m)) { + return true + } + if (getChangeSetByResultXmlElement(r, c, Field(java_db).find(f), n, m)) { + return true + } + } + } + } + } + } +} +pub fn getChangeSetByResultXmlElement(r1: ECGXmlNode, c: ClassOrInterface, f: Field, n: string, m: string) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (r in ResultXmlElement(xml_db)) { + if (r.key_eq(r1)) { + if (getXmlECGNode1(ECGXmlNode(xml_db).find(r))) { + if (n = r.getBelongedMapXmlElement().getMappingClassName()) { + if (n = c.getQualifiedName()) { + if (c = f.getParent()) { + if (r.getValueByAttributeName("property") = f.getName()) { + if (m = f.getName()) { + return true + } + } + } + } + } + } + } + } + } + } +} +pub fn getChangeSetByDalXmlElement(d1: ECGXmlNode, c: ClassOrInterface, m: Method, className: string, methodName: string) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (i in int::__undetermined_all__(), + temp in string::__undetermined_all__(), + temp1 in string::__undetermined_all__(), + n in string::__undetermined_all__()) { + for (d in DalXmlElement(xml_db), + cc in XmlComment(xml_db), + l in Literal(java_db)) { + if (d.key_eq(d1)) { + if (getXmlECGNode1(ECGXmlNode(xml_db).find(d))) { + if (d.getLocation().getFile() = cc.getLocation().getFile()) { + if (cc.getLocation().getEndLineNumber() = i) { + if (i + 1 = d.getLocation().getStartLineNumber()) { + if (temp = cc.getText()) { + if (c.getName() = temp.get_regex_match_result("[\\s\\S]*mapped statement for[ \\t]+(\\w+)[\\s\\S]*", 1)) { + if (n = d.getValueByAttributeName("id")) { + if (c.key_eq(m.getBelongedClass())) { + if (m.key_eq(l.getEnclosingCallable())) { + if (temp1 = l.getValue()) { + if (trim(temp1, n)) { + if (className = c.getQualifiedName()) { + if (methodName = m.getSignature()) { + return true + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } +} +pub fn javaOutput(classname: string, name: string) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (s in SofaService(java_db), + c in Class(java_db), + i in ClassOrInterface(java_db)) { + for (auto_tmp1 in c.getAnnotation()) { + if (s.key_eq(auto_tmp1)) { + if (classname = c.getQualifiedName()) { + for (auto_tmp2 in c.getImplementsInterface()) { + if (i.key_eq(auto_tmp2)) { + if (name = i.getQualifiedName()) { + return true + } + } + } + if (i.key_eq(c)) { + if (name = classname) { + return true + } + } + } + } + } + } + } + } +} +pub fn xmlOutput(className: string, interfaceName: string) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (temp in string::__undetermined_all__()) { + for (s in ClassOrInterface(java_db), + b in BeanXmlElement(xml_db)) { + if (s.getQualifiedName() = b.getClass()) { + if (className = s.getQualifiedName()) { + if (className = interfaceName) { + if (temp = b.getLocation().getFile().getRelativePath()) { + if (!temp.contains("src/test/resources")) { + return true + } + } + } + } + } + } + } + } + } +} +pub fn getTrAnnotationName(a: string) -> bool { + [ + {"Service"}, + {"Component"}, + {"Scope"}, + {"Repository"}, + {"Controller"}, + {"RestController"}, + {"RequestMapping"}, + {"PathVariable"}, + {"ResponseBody"}, + {"bean"} + ] +} +pub fn getTrAnnotationName1(a: string) -> bool { + [ + {"Service"}, + {"Component"}, + {"Scope"}, + {"Configuration"}, + {"Repository"}, + {"RestController"}, + {"bean"} + ] +} +pub fn getPublishTr(c: ClassOrInterface) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (className in string::__undetermined_all__(), + interfaceName in string::__undetermined_all__()) { + if (xmlOutput(className, interfaceName)) { + if (interfaceName = c.getQualifiedName()) { + return true + } + } + if (javaOutput(className, interfaceName)) { + if (interfaceName = c.getQualifiedName()) { + return true + } + } + } + } + } +} +schema SofaService extends Annotation { + +} + +impl SofaService { + + @data_constraint + @inline + pub fn __all__(db: JavaDB) -> *SofaService { + for (tmp in Annotation(db)) { + for (n in string::__undetermined_all__()) { + if (n = tmp.getName()) { + if (getTrAnnotationName1(n)) { + yield SofaService { + id : tmp.id + } + } + } + } + } + } + + +} + +pub fn output1(c: ClassOrInterface, interfaceName: string, id: int) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (i in int::__undetermined_all__(), + j in int::__undetermined_all__(), + className in string::__undetermined_all__()) { + if (xmlOutput(className, interfaceName)) { + for (temp in string::__undetermined_all__()) { + for (e1 in ECGNode(java_db), + e2 in ECGXmlNode(xml_db)) { + if (getJavaECGNode(e1)) { + if (getXmlECGNode1(e2)) { + if (c.key_eq(e1.getElementParent())) { + if (temp = c.getQualifiedName()) { + if (id = e1.id) { + if (temp = className) { + return true + } + if (temp = interfaceName) { + return true + } + } + if (e2.id = i) { + if (id = e2.id) { + return true + } + } + if (e2.id = j) { + if (id = e2.id) { + return true + } + } + } + } + } + } + } + } + } + if (javaOutput(className, interfaceName)) { + for (temp in string::__undetermined_all__()) { + for (e1 in ECGNode(java_db), + e2 in ECGXmlNode(xml_db)) { + if (getJavaECGNode(e1)) { + if (getXmlECGNode1(e2)) { + if (c.key_eq(e1.getElementParent())) { + if (temp = c.getQualifiedName()) { + if (id = e1.id) { + if (temp = className) { + return true + } + if (temp = interfaceName) { + return true + } + } + if (e2.id = i) { + if (id = e2.id) { + return true + } + } + if (e2.id = j) { + if (id = e2.id) { + return true + } + } + } + } + } + } + } + } + } + } + } + } +} +pub fn output2(c: ClassOrInterface, interfaceName: string, n: ECGNode) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (m in ECGNode(java_db)) { + if (getJavaECGNode(m)) { + if (getPublishTr(c)) { + for (t in Method(java_db)) { + if (n.key_eq(t)) { + if (c = t.getParent()) { + if (n = m.getAnAncestorCDDependedNode(__all_data__, __all_data__)) { + if (interfaceName = c.getQualifiedName()) { + return true + } + } + } + } + } + for (f in Field(java_db)) { + if (n.key_eq(f)) { + if (c = f.getParent()) { + if (n = m.getAnAncestorCDDependedNode(__all_data__, __all_data__)) { + if (interfaceName = c.getQualifiedName()) { + return true + } + } + } + } + } + } + } + if (getXmlECGNode(m)) { + if (getPublishTr(c)) { + for (t in Method(java_db)) { + if (n.key_eq(t)) { + if (c = t.getParent()) { + if (n = m.getAnAncestorCDDependedNode(__all_data__, __all_data__)) { + if (interfaceName = c.getQualifiedName()) { + return true + } + } + } + } + } + for (f in Field(java_db)) { + if (n.key_eq(f)) { + if (c = f.getParent()) { + if (n = m.getAnAncestorCDDependedNode(__all_data__, __all_data__)) { + if (interfaceName = c.getQualifiedName()) { + return true + } + } + } + } + } + } + } + } + } + } +} +@inline +pub fn contact(a: string, b: string, c: string) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (i in int::__undetermined_all__(), + temp in string::__undetermined_all__()) { + if (i = a.len()) { + if (tmp_4(i)) { + if (tmp_5(a, b)) { + if (c = b) { + return true + } + } + if (!(tmp_5(a, b))) { + if (c = a + b) { + return true + } + } + } + if (!(tmp_4(i))) { + if (tmp_6(a, i, b)) { + if (temp = a.substr(1,i - 1)) { + if (c = a + b) { + return true + } + } + } + if (!(tmp_6(a, i, b))) { + if (tmp_7(a, i, b)) { + if (c = a + "/" + b) { + return true + } + } + if (!(tmp_7(a, i, b))) { + if (c = a + b) { + return true + } + } + } + } + } + } + } + } +} +schema HttpMethodType extends AnnotationAccessArgument { + +} + +impl HttpMethodType { + + @data_constraint + @inline + pub fn __all__(db: JavaDB) -> *HttpMethodType { + for (tmp in AnnotationAccessArgument(db)) { + if (tmp.getAnnotationArgumentName() = "method") { + yield HttpMethodType { + id : tmp.id + } + } + } + } + + pub fn getType(self) -> string { + for (t in string::__undetermined_all__()) { + for (a in AnnotationArrayInitializer(__all_data__)) { + if (self.getArgumentValueHashId() = a.getParent().id) { + for (i in Identifier(__all_data__)) { + if (a.key_eq(i.getParent())) { + if (t = i.getName()) { + return t + } + } + } + } + } + for (i in Identifier(__all_data__)) { + if (self.getArgumentValueHashId() = i.getParent().id) { + if (t = i.getName()) { + return t + } + } + } + } + } + + +} + +pub fn getMethodType(a: Annotation, t: string) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (m in Method(java_db), + h in HttpMethodType(java_db)) { + for (auto_tmp1 in m.getAnnotation()) { + if (a = auto_tmp1) { + if (tmp_8(a)) { + if (t = "POST") { + return true + } + } + if (!(tmp_8(a))) { + if (tmp_9(a)) { + if (t = "GET") { + return true + } + } + if (!(tmp_9(a))) { + if (tmp_10(a)) { + if (t = "PUT") { + return true + } + } + if (!(tmp_10(a))) { + if (tmp_11(a)) { + if (t = "DELETE") { + return true + } + } + if (!(tmp_11(a))) { + if (tmp_12(a)) { + if (t = "PATCH") { + return true + } + } + if (!(tmp_12(a))) { + for (auto_tmp2 in a.getAnnotationArgument()) { + if (h.key_eq(auto_tmp2)) { + if (t = h.getType()) { + return true + } + } + } + } + } + } + } + } + } + } + } + } + } +} +pub fn getSubUri(a: Annotation, sub: string) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (s in string::__undetermined_all__(), + n in string::__undetermined_all__()) { + for (temp in AnnotationAccessArgument(java_db), + e in Expression(java_db)) { + if (n = a.getName()) { + if (n.matches(".*Mapping")) { + for (auto_tmp1 in a.getAnnotationArgument()) { + if (temp = auto_tmp1) { + if (temp.getAnnotationArgumentName() = "value") { + if (temp.key_eq(e.getParent())) { + if (tmp_13(e)) { + if (sub = connectStr(e)) { + return true + } + } + if (!(tmp_13(e))) { + if (s = temp.getAnnotationArgumentValue()) { + if (trim(s, sub)) { + return true + } + } + } + } + } + } + } + } + } + } + } + } + } +} +pub fn getUri(c: Class, m: Method, uri1: string) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (l1 in string::__undetermined_all__(), + l2 in string::__undetermined_all__(), + uri in string::__undetermined_all__(), + n in string::__undetermined_all__()) { + for (a in Annotation(java_db), + a1 in Annotation(java_db)) { + if (c = m.getBelongedClass()) { + for (auto_tmp1 in m.getAnnotation()) { + if (a = auto_tmp1) { + for (auto_tmp2 in c.getAnnotation()) { + if (a1 = auto_tmp2) { + if (n = a.getName()) { + if (tmp_15(c)) { + if (n = a.getName()) { + if (n.matches(".*Mapping")) { + if (getSubUri(a, uri)) { + for (tt in string::__undetermined_all__()) { + for (w in WebFolder(java_db), + cc in WebCarClass(java_db)) { + if (tmp_19(w)) { + if (uri1 = uri) { + return true + } + } + if (!(tmp_19(w))) { + if (cc.key_eq(c)) { + if (tt = cc.getWebFolder().getName()) { + if (uri1 = "/" + tt + uri) { + return true + } + } + } + } + } + } + } + } + } + } + if (!(tmp_15(c))) { + if (tmp_17(a)) { + if (n.matches(".*Mapping")) { + if (getSubUri(a1, uri)) { + for (tt in string::__undetermined_all__()) { + for (w in WebFolder(java_db), + cc in WebCarClass(java_db)) { + if (tmp_19(w)) { + if (uri1 = uri) { + return true + } + } + if (!(tmp_19(w))) { + if (cc.key_eq(c)) { + if (tt = cc.getWebFolder().getName()) { + if (uri1 = "/" + tt + uri) { + return true + } + } + } + } + } + } + } + } + } + if (!(tmp_17(a))) { + if (a1.getName() = "RequestMapping") { + if (n.matches(".*Mapping")) { + if (getSubUri(a, l1)) { + if (getSubUri(a1, l2)) { + if (contact(l2, l1, uri)) { + for (tt in string::__undetermined_all__()) { + for (w in WebFolder(java_db), + cc in WebCarClass(java_db)) { + if (tmp_19(w)) { + if (uri1 = uri) { + return true + } + } + if (!(tmp_19(w))) { + if (cc.key_eq(c)) { + if (tt = cc.getWebFolder().getName()) { + if (uri1 = "/" + tt + uri) { + return true + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } +} +schema WebFolder extends Folder { + +} + +impl WebFolder { + + @data_constraint + @inline + pub fn __all__(db: JavaDB) -> *WebFolder { + for (tmp in Folder(db)) { + yield WebFolder { + element_hash_id : tmp.element_hash_id, + qualified_name : tmp.qualified_name, + name : tmp.name, + parent_hash_id : tmp.parent_hash_id + } + } + } + + pub fn getChild(self) -> Folder { + for (f in Folder(__all_data__)) { + if (self.element_hash_id = f.getParentHashId()) { + return f + } + } + } + + +} + +schema WebCarFolder extends Folder { + +} + +impl WebCarFolder { + + @data_constraint + @inline + pub fn __all__(db: JavaDB) -> *WebCarFolder { + for (tmp in Folder(db)) { + yield WebCarFolder { + element_hash_id : tmp.element_hash_id, + qualified_name : tmp.qualified_name, + name : tmp.name, + parent_hash_id : tmp.parent_hash_id + } + } + } + + pub fn getBelongedFolder(self) -> WebCarFolder { + for (f in WebCarFolder(__all_data__)) { + if (f.element_hash_id = self.getParentHashId()) { + return f + } + } + } + + pub fn getAnAncestorFolder(self) -> WebCarFolder { + for (f in WebCarFolder(__all_data__)) { + if (f = self.getBelongedFolder()) { + return f + } + if (f = self.getBelongedFolder().getAnAncestorFolder()) { + return f + } + } + } + + +} + +schema WebCarClass extends Class { + +} + +impl WebCarClass { + + @data_constraint + @inline + pub fn __all__(db: JavaDB) -> *WebCarClass { + for (tmp in Class(db)) { + for (f in WebCarFolder(db), + w in WebFolder(db)) { + if (f.key_eq(tmp.getContainingFile().getBelongedFolder())) { + if (f.getAnAncestorFolder().key_eq(w)) { + yield WebCarClass { + element_hash_id : tmp.element_hash_id, + qualified_name : tmp.qualified_name, + identifier_hash_id : tmp.identifier_hash_id, + location_hash_id : tmp.location_hash_id, + parent_hash_id : tmp.parent_hash_id + } + } + } + } + } + } + + pub fn getWebFolder(self) -> WebCarFolder { + for (c in WebCarFolder(__all_data__)) { + for (f in WebCarFolder(__all_data__), + w in WebFolder(__all_data__)) { + if (f.key_eq(self.getContainingFile().getBelongedFolder())) { + if (f.getAnAncestorFolder() = c) { + if (c.key_eq(w.getChild())) { + return c + } + } + } + } + } + } + + +} + +pub fn resolve(r: ReferenceExpression, rr: string) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (temp in string::__undetermined_all__()) { + for (e in Expression(java_db)) { + if (e.getParent() = r.getDefinition()) { + if (temp = e.getPrintableText()) { + if (trim(temp, rr)) { + return true + } + } + } + } + } + } + } +} +pub fn facts(a: Expression, i: int, value: string) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (p in PolyadicExpression(java_db)) { + if (a.key_eq(p)) { + for (temp in string::__undetermined_all__()) { + for (e in Expression(java_db)) { + if (tmp_20(a)) { + if (resolve(ReferenceExpression(java_db).find(a), value)) { + if (i = 0) { + return true + } + } + } + if (!(tmp_20(a))) { + if (a.key_eq(e.getParent())) { + if (i = e.getIndex()) { + if (tmp_21(e)) { + if (resolve(ReferenceExpression(java_db).find(e), value)) { + return true + } + } + if (!(tmp_21(e))) { + if (temp = e.getPrintableText()) { + if (trim(temp, value)) { + return true + } + } + } + } + } + } + } + } + } + } + for (p in BinaryExpression(java_db)) { + if (a.key_eq(p)) { + for (temp in string::__undetermined_all__()) { + for (e in Expression(java_db)) { + if (tmp_20(a)) { + if (resolve(ReferenceExpression(java_db).find(a), value)) { + if (i = 0) { + return true + } + } + } + if (!(tmp_20(a))) { + if (a.key_eq(e.getParent())) { + if (i = e.getIndex()) { + if (tmp_21(e)) { + if (resolve(ReferenceExpression(java_db).find(e), value)) { + return true + } + } + if (!(tmp_21(e))) { + if (temp = e.getPrintableText()) { + if (trim(temp, value)) { + return true + } + } + } + } + } + } + } + } + } + } + for (p in ReferenceExpression(java_db)) { + if (a.key_eq(p)) { + for (temp in string::__undetermined_all__()) { + for (e in Expression(java_db)) { + if (tmp_20(a)) { + if (resolve(ReferenceExpression(java_db).find(a), value)) { + if (i = 0) { + return true + } + } + } + if (!(tmp_20(a))) { + if (a.key_eq(e.getParent())) { + if (i = e.getIndex()) { + if (tmp_21(e)) { + if (resolve(ReferenceExpression(java_db).find(e), value)) { + return true + } + } + if (!(tmp_21(e))) { + if (temp = e.getPrintableText()) { + if (trim(temp, value)) { + return true + } + } + } + } + } + } + } + } + } + } + } + } +} +pub fn connectStrBase(ID: Expression, index: int, res: string) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (total in int::__undetermined_all__(), + reStr in string::__undetermined_all__(), + currStr in string::__undetermined_all__()) { + if (total = tmp_22(ID).len()) { + if (tmp_24(index)) { + if (facts(Expression(java_db).find(ID), index, currStr)) { + if (res = currStr) { + return true + } + } + } + if (!(tmp_24(index))) { + if (index > 0) { + if (connectStrBase(ID, index - 1, reStr)) { + if (facts(Expression(java_db).find(ID), index, currStr)) { + if (res = reStr + currStr) { + return true + } + } + } + } + } + } + } + } + } +} +pub fn connectStr(ID: Expression) -> string { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (c in int::__undetermined_all__(), res in string::__undetermined_all__()) { + if (c = tmp_25(ID).len()) { + if (connectStrBase(ID, c - 1, res)) { + return res + } + } + } + } + } +} +pub fn getHttpMethod(m: Method) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (n in string::__undetermined_all__(), + className in string::__undetermined_all__(), + methodSignature in string::__undetermined_all__(), + uri in string::__undetermined_all__(), + type in string::__undetermined_all__()) { + for (c in Class(java_db), + a in Annotation(java_db)) { + if (getUri(c, m, uri)) { + if (className = c.getQualifiedName()) { + if (methodSignature = m.getSignature()) { + for (auto_tmp1 in m.getAnnotation()) { + if (a = auto_tmp1) { + if (n = a.getName()) { + if (n.matches(".*Mapping")) { + if (tmp_29(a)) { + if (type = "EMPTY") { + return true + } + } + if (!(tmp_29(a))) { + if (getMethodType(a, type)) { + return true + } + } + } + } + } + } + } + } + } + } + } + } + } +} +pub fn output3(nodeText: string, path: string, m: ECGNode) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (direction in string::__undetermined_all__(), + edgeType in string::__undetermined_all__()) { + for (a in ECGNode(java_db), + b in ECGNode(java_db), + c in ECGNode(java_db)) { + if (getJavaECGNode(a)) { + if (getHttpMethod(Method(java_db).find(m))) { + if (b = m.getAnAncestorCDDependsNode(__all_data__, __all_data__)) { + if (c = a.getAnAncestorCDDependedNode(__all_data__, __all_data__)) { + if (c = b.getECGDependsNode(edgeType, direction)) { + if (b != c) { + if (nodeText = m.print()) { + if (path = m.getPath()) { + return true + } + } + } + } + } + if (c = a) { + if (c = b.getECGDependsNode(edgeType, direction)) { + if (b != c) { + if (nodeText = m.print()) { + if (path = m.getPath()) { + return true + } + } + } + } + } + } + if (b = m) { + if (c = a.getAnAncestorCDDependedNode(__all_data__, __all_data__)) { + if (c = b.getECGDependsNode(edgeType, direction)) { + if (b != c) { + if (nodeText = m.print()) { + if (path = m.getPath()) { + return true + } + } + } + } + } + if (c = a) { + if (c = b.getECGDependsNode(edgeType, direction)) { + if (b != c) { + if (nodeText = m.print()) { + if (path = m.getPath()) { + return true + } + } + } + } + } + } + } + } + } + } + } + } +} +pub fn real_output(nodeText: string, interfaceName: string) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (c in ClassOrInterface(java_db), + n in ECGNode(java_db)) { + if (output2(c, interfaceName, n)) { + if (nodeText = c.getQualifiedName()) { + return true + } + } + if (output1(c, interfaceName, n.id)) { + if (nodeText = c.getQualifiedName()) { + return true + } + } + } + for (n in ECGNode(java_db)) { + if (output3(nodeText, interfaceName, n)) { + return true + } + } + } + } +} + + +fn default_java_db() -> JavaDB { + return JavaDB::load("coref_java_src.db") +} + +fn default_xml_db() -> XmlDB { + return XmlDB::load("coref_xml_src.db") +} + +fn tmp_0(lineNumber: int, filename: string) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + if (getBelongedCallable(filename, lineNumber, __all_data__)) { + return true + } + } + } +} + +fn tmp_1() -> *string { + for (filename in string::__undetermined_all__(), lineNumber in int::__undetermined_all__()) { + if (getBelongedCallable(filename, lineNumber, __all_data__)) { + yield filename + } + } +} + +fn tmp_2(i: int) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + if (i = 0) { + return true + } + } + } +} + +fn tmp_3(n: string) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + if (n.substr(0,1) = "\"") { + return true + } + } + } +} + +fn tmp_4(i: int) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + if (i = 1) { + return true + } + } + } +} + +fn tmp_5(a: string, b: string) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + if (a.substr(0,1) = "/") { + if (b.substr(0,1) = "/") { + return true + } + } + } + } +} + +@inline +fn tmp_6(a: string, i: int, b: string) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + if (a.substr(i - 1,i - 1) = "/") { + if (b.substr(0,1) = "/") { + return true + } + } + } + } +} + +@inline +fn tmp_7(a: string, i: int, b: string) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + if (a.substr(i - 1,i - 1) != "/") { + if (b.substr(0,1) != "/") { + return true + } + } + } + } +} + +fn tmp_8(a: Annotation) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + if (a.getName() = "PostMapping") { + return true + } + } + } +} + +fn tmp_9(a: Annotation) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + if (a.getName() = "GetMapping") { + return true + } + } + } +} + +fn tmp_10(a: Annotation) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + if (a.getName() = "PutMapping") { + return true + } + } + } +} + +fn tmp_11(a: Annotation) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + if (a.getName() = "DeleteMapping") { + return true + } + } + } +} + +fn tmp_12(a: Annotation) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + if (a.getName() = "PatchMapping") { + return true + } + } + } +} + +fn tmp_13(e: Expression) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + if (facts(e, __all_data__, __all_data__)) { + return true + } + } + } +} + +fn tmp_14(c: Class) -> *Annotation { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (b in Annotation(java_db)) { + for (auto_tmp3 in c.getAnnotation()) { + if (b = auto_tmp3) { + if (b.getName() = "RequestMapping") { + yield b + } + } + } + } + } + } +} + +fn tmp_15(c: Class) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + if (tmp_14(c).len() = 0) { + return true + } + } + } +} + +fn tmp_16(a: Annotation) -> *AnnotationAccessArgument { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (b in AnnotationAccessArgument(java_db)) { + for (auto_tmp4 in a.getAnnotationArgument()) { + if (b = auto_tmp4) { + if (b.getAnnotationArgumentName() = "value") { + yield b + } + } + } + } + } + } +} + +fn tmp_17(a: Annotation) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + if (tmp_16(a).len() = 0) { + return true + } + } + } +} + +fn tmp_18(w: WebFolder) -> *Folder { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (f in Folder(java_db)) { + if (f = w.getChild()) { + yield f + } + } + } + } +} + +fn tmp_19(w: WebFolder) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + if (tmp_18(w).len() = 1) { + return true + } + } + } +} + +fn tmp_20(a: Expression) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + if (resolve(ReferenceExpression(java_db).find(a), __all_data__)) { + return true + } + } + } +} + +fn tmp_21(e: Expression) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + if (resolve(ReferenceExpression(java_db).find(e), __all_data__)) { + return true + } + } + } +} + +fn tmp_22(ID: Expression) -> *auto_tmp_23 { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (auto_tmp_var_0 in int::__undetermined_all__(), + auto_tmp_var_1 in string::__undetermined_all__()) { + if (facts(Expression(java_db).find(ID), auto_tmp_var_0, auto_tmp_var_1)) { + yield auto_tmp_23 { + auto_tmp_var_0 : auto_tmp_var_0, + auto_tmp_var_1 : auto_tmp_var_1 + } + } + } + } + } +} + +schema auto_tmp_23 { + auto_tmp_var_0 : int, + auto_tmp_var_1 : string +} + +fn tmp_24(index: int) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + if (index = 0) { + return true + } + } + } +} + +fn tmp_25(ID: Expression) -> *auto_tmp_26 { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (auto_tmp_var_0 in int::__undetermined_all__(), + auto_tmp_var_1 in string::__undetermined_all__()) { + if (facts(Expression(java_db).find(ID), auto_tmp_var_0, auto_tmp_var_1)) { + yield auto_tmp_26 { + auto_tmp_var_0 : auto_tmp_var_0, + auto_tmp_var_1 : auto_tmp_var_1 + } + } + } + } + } +} + +schema auto_tmp_26 { + auto_tmp_var_0 : int, + auto_tmp_var_1 : string +} + +fn tmp_27(a: Annotation) -> *auto_tmp_28 { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (auto_tmp_var_0 in string::__undetermined_all__()) { + if (getMethodType(a, auto_tmp_var_0)) { + yield auto_tmp_28 { + auto_tmp_var_0 : auto_tmp_var_0 + } + } + } + } + } +} + +schema auto_tmp_28 { + auto_tmp_var_0 : string +} + +fn tmp_29(a: Annotation) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + if (tmp_27(a).len() = 0) { + return true + } + } + } +} + +fn main() { + output(real_output()) +} \ No newline at end of file diff --git a/example/icse25/rules/rule_spring.gdl b/example/icse25/rules/rule_spring.gdl new file mode 100644 index 00000000..cb24b118 --- /dev/null +++ b/example/icse25/rules/rule_spring.gdl @@ -0,0 +1,411 @@ +// script +use coref::java::* +use coref::xml::* +schema SofaService extends Annotation { + +} + +impl SofaService { + + @data_constraint + @inline + pub fn __all__(db: JavaDB) -> *SofaService { + for (tmp in Annotation(db)) { + for (n in string::__undetermined_all__()) { + if (n = tmp.getName()) { + if (getTrAnnotationName1(n)) { + yield SofaService { + id : tmp.id + } + } + } + } + } + } + + +} + +pub fn javaOutput(classname: string, name: string) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (s in SofaService(java_db), + c in Class(java_db), + i in ClassOrInterface(java_db)) { + for (auto_tmp1 in c.getAnnotation()) { + if (s.key_eq(auto_tmp1)) { + if (classname = c.getQualifiedName()) { + for (auto_tmp2 in c.getImplementsInterface()) { + if (i.key_eq(auto_tmp2)) { + if (name = i.getQualifiedName()) { + return true + } + } + } + if (i.key_eq(c)) { + if (name = classname) { + return true + } + } + } + } + } + } + } + } +} +pub fn xmlOutput(className: string, interfaceName: string) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (temp in string::__undetermined_all__()) { + for (s in ClassOrInterface(java_db), + b in BeanXmlElement(xml_db)) { + if (s.getQualifiedName() = b.getClass()) { + if (className = s.getQualifiedName()) { + if (className = interfaceName) { + if (temp = b.getLocation().getFile().getRelativePath()) { + if (!temp.contains("src/test/resources")) { + return true + } + } + } + } + } + } + } + } + } +} +pub fn getTrAnnotationName(a: string) -> bool { + [ + {"Service"}, + {"Component"}, + {"Scope"}, + {"Repository"}, + {"Controller"}, + {"RestController"}, + {"RequestMapping"}, + {"PathVariable"}, + {"ResponseBody"}, + {"bean"} + ] +} +pub fn getTrAnnotationName1(a: string) -> bool { + [ + {"Service"}, + {"Component"}, + {"Scope"}, + {"Configuration"}, + {"Repository"}, + {"bean"} + ] +} +pub fn output1(className: string, interfaceName: string) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + if (javaOutput(className, interfaceName)) { + return true + } + } + } +} +pub fn isSelfDefinedInterface(name: string) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (i in Interface(java_db)) { + if (name = i.getQualifiedName()) { + return true + } + } + } + } +} +pub fn isSelfDefinedClass(name: string) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (i in Class(java_db)) { + if (name = i.getQualifiedName()) { + return true + } + } + } + } +} +schema PublicMethod extends Method { + +} + +impl PublicMethod { + + @data_constraint + @inline + pub fn __all__(db: JavaDB) -> *PublicMethod { + for (tmp in Method(db)) { + for (m in Modifier(db)) { + for (auto_tmp1 in tmp.getModifier()) { + if (m = auto_tmp1) { + if (m.getName() = "public") { + if (!isSetOrGetMethod(tmp)) { + yield PublicMethod { + element_hash_id : tmp.element_hash_id, + name : tmp.name, + signature : tmp.signature, + type_hash_id : tmp.type_hash_id, + parent_hash_id : tmp.parent_hash_id, + location_hash_id : tmp.location_hash_id, + definition_body : tmp.definition_body + } + } + } + } + } + } + } + } + + +} + +pub fn isBooleanTypeField(f: Field, p: string, q: string) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (i in int::__undetermined_all__(), + n in string::__undetermined_all__(), + tmp1 in string::__undetermined_all__(), + tmp2 in string::__undetermined_all__(), + l in string::__undetermined_all__(), + j in string::__undetermined_all__()) { + if (n = f.getName()) { + if (i = n.len()) { + if (tmp_0(n)) { + if (tmp1 = n.substr(2,i)) { + if (l = n.substr(2,1)) { + if (tmp2 = n.substr(3,i)) { + if (q = n) { + if (p = "set" + tmp1) { + return true + } + } + if (q = "get" + l + tmp2) { + if (p = "set" + tmp1) { + return true + } + } + } + } + } + } + if (!(tmp_0(n))) { + if (l = n.substr(0,1)) { + if (tmp2 = n.substr(1,i)) { + if (lowerToUpper(l, j)) { + if (p = "set" + j + tmp2) { + if (q = "is" + j + tmp2) { + return true + } + if (q = "get" + j + tmp2) { + return true + } + } + if (p = "set" + n) { + if (q = "is" + j + tmp2) { + return true + } + if (q = "get" + j + tmp2) { + return true + } + } + } + } + } + } + } + } + } + } + } +} +pub fn isSetOrGetMethod(m: Method) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (i in int::__undetermined_all__(), + p in string::__undetermined_all__(), + q in string::__undetermined_all__(), + n in string::__undetermined_all__(), + l in string::__undetermined_all__(), + j in string::__undetermined_all__(), + tmp in string::__undetermined_all__(), + t in string::__undetermined_all__()) { + for (f in Field(java_db)) { + if (n = f.getName()) { + if (i = n.len()) { + if (f.getParent() = m.getParent()) { + if (p = m.getName()) { + if (t = f.getTypeElement().getPrintableText()) { + if (tmp_1(t)) { + if (isBooleanTypeField(f, p, q)) { + return true + } + } + if (!(tmp_1(t))) { + if (l = n.substr(0,1)) { + if (tmp = n.substr(1,i)) { + if (lowerToUpper(l, j)) { + if (p = "set" + j + tmp) { + if (q = "get" + j + tmp) { + return true + } + if (q = "get" + n) { + return true + } + } + if (p = "set" + n) { + if (q = "get" + j + tmp) { + return true + } + if (q = "get" + n) { + return true + } + } + } + } + } + } + } + } + if (q = m.getName()) { + if (t = f.getTypeElement().getPrintableText()) { + if (tmp_1(t)) { + if (isBooleanTypeField(f, p, q)) { + return true + } + } + if (!(tmp_1(t))) { + if (l = n.substr(0,1)) { + if (tmp = n.substr(1,i)) { + if (lowerToUpper(l, j)) { + if (p = "set" + j + tmp) { + if (q = "get" + j + tmp) { + return true + } + if (q = "get" + n) { + return true + } + } + if (p = "set" + n) { + if (q = "get" + j + tmp) { + return true + } + if (q = "get" + n) { + return true + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } +} +pub fn real_output(methodName: string, tag: string) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (interfaceName in string::__undetermined_all__(), + className in string::__undetermined_all__(), + path in string::__undetermined_all__()) { + for (i in Interface(java_db), + c in Class(java_db)) { + if (output1(className, interfaceName)) { + if (tmp_2(interfaceName)) { + if (interfaceName = i.getQualifiedName()) { + for (m in Method(java_db)) { + if (i.key_eq(m.getParent())) { + if (methodName = m.getSignature()) { + if (tag = "Self") { + if (path = m.getLocation().getFile().getRelativePath()) { + if (!path.contains("src/test/java")) { + return true + } + } + } + } + } + } + } + } + if (!(tmp_2(interfaceName))) { + if (className = c.getQualifiedName()) { + for (n in PublicMethod(java_db)) { + if (c.key_eq(n.getParent())) { + if (methodName = n.getSignature()) { + if (tag = "External") { + if (path = n.getLocation().getFile().getRelativePath()) { + if (!path.contains("src/test/java")) { + return true + } + } + } + } + } + } + } + } + } + } + } + } + } +} + + +fn default_java_db() -> JavaDB { + return JavaDB::load("coref_java_src.db") +} + +fn default_xml_db() -> XmlDB { + return XmlDB::load("coref_xml_src.db") +} + +fn tmp_0(n: string) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + if (n.matches("is.*")) { + return true + } + } + } +} + +fn tmp_1(t: string) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + if (t = "boolean") { + return true + } + if (t = "Boolean") { + return true + } + } + } +} + +fn tmp_2(interfaceName: string) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + if (isSelfDefinedInterface(interfaceName)) { + return true + } + } + } +} + +fn main() { + output(real_output()) +} \ No newline at end of file diff --git a/example/icse25/rules/test.gdl b/example/icse25/rules/test.gdl new file mode 100644 index 00000000..f1d551e2 --- /dev/null +++ b/example/icse25/rules/test.gdl @@ -0,0 +1,867 @@ +// script +use coref::java::* +use coref::xml::* + +schema ECGNode extends ElementParent {} + +impl ECGNode { + pub fn __all__(db: JavaDB) -> *ECGNode { + for (tmp in ElementParent(db)) { + for (m in Method(db)) { + if (tmp.key_eq(m)) { + yield ECGNode { + id : tmp.id + } + } + } + for (m in Variable(db)) { + if (tmp.key_eq(m)) { + yield ECGNode { + id : tmp.id + } + } + } + for (m in Expression(db)) { + if (tmp.key_eq(m)) { + yield ECGNode { + id : tmp.id + } + } + } + } + } + + pub fn getType(self) -> string { + for (t in string::__undetermined_all__()) { + for (m in Method(__all_data__)) { + if (self.key_eq(m)) { + if (t = "Method") { + return t + } + } + } + for (m in LocalVariable(__all_data__)) { + if (self.key_eq(m)) { + if (t = "LocalVariable") { + return t + } + } + } + for (m in Parameter(__all_data__)) { + if (self.key_eq(m)) { + if (t = "Parameter") { + return t + } + } + } + for (m in Field(__all_data__)) { + if (self.key_eq(m)) { + if (t = "Field") { + return t + } + } + } + for (m in EnumConstant(__all_data__)) { + if (self.key_eq(m)) { + if (t = "EnumConstant") { + return t + } + } + } + for (m in Expression(__all_data__)) { + if (self.key_eq(m)) { + if (t = m.getType()) { + return t + } + } + } + } + } + + pub fn getDDNode(self, type: string, direction: string) -> ECGNode { + for (e1 in ECGNode(__all_data__)) { + for (e in Parameter(__all_data__), + c in Method(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + for (auto_tmp1 in c.getParameter()) { + if (e = auto_tmp1) { + if (direction = "Depended") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + for (r in ReturnStatement(__all_data__), + c in Method(__all_data__), + e in Expression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (c.key_eq(r.getEnclosingCallable())) { + if (e = r.getResult()) { + if (direction = "Depends") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + for (c in Callable(__all_data__), + e in Field(__all_data__), + r in ReferenceExpression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (c = r.getEnclosingCallable()) { + if (e.key_eq(r.getDefinition())) { + if (direction = "Depended") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + for (c in Callable(__all_data__), + e in EnumConstant(__all_data__), + r in ReferenceExpression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (c = r.getEnclosingCallable()) { + if (e.key_eq(r.getDefinition())) { + if (direction = "Depended") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + for (e in Callable(__all_data__), + c in Field(__all_data__), + r in ReferenceExpression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (c.key_eq(r.getDefinition())) { + if (e = r.getEnclosingCallable()) { + if (direction = "Depends") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + for (e in Callable(__all_data__), + c in EnumConstant(__all_data__), + r in ReferenceExpression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (c.key_eq(r.getDefinition())) { + if (e = r.getEnclosingCallable()) { + if (direction = "Depends") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + for (c in Callable(__all_data__), + e in CallExpression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (c = e.getEnclosingCallable()) { + for (m in Method(__all_data__)) { + if (m = e.getMethod()) { + if (!isDirectCall(e)) { + if (direction = "Depended") { + if (type = "DD") { + return e1 + } + } + } + } + } + for (f in LombokField(__all_data__)) { + if (f = e.getLombokField()) { + if (!isDirectCall(e)) { + if (direction = "Depended") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + } + } + for (n in string::__undetermined_all__()) { + for (e in LombokField(__all_data__), + c in CallExpression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (e = c.getLombokField()) { + let (tmp_find = CallExpression(__all_data__).find(e)) { + if (!isDirectCall(tmp_find)) { + if (n = c.getMethodName()) { + if (Self::tmp_0(n)) { + if (direction = "Depended") { + if (type = "DD") { + return e1 + } + } + } + if (!Self::tmp_0(n)) { + if (direction = "Depends") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + } + } + } + } + for (e in Variable(__all_data__), + c in CallExpression(__all_data__), + r in ReferenceExpression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (!isDirectCall(c)) { + for (auto_tmp2 in c.getArguments()) { + if (r.key_eq(auto_tmp2)) { + if (e.key_eq(r.getDefinition())) { + if (direction = "Depended") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + } + } + for (e in CallExpression(__all_data__), + c in CallExpression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (!isDirectCall(c)) { + for (auto_tmp3 in c.getArguments()) { + if (e.key_eq(auto_tmp3)) { + if (direction = "Depended") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + } + for (e in CallExpression(__all_data__), + c in CallExpression(__all_data__), + s in CallExpression(__all_data__)) { + if (e.key_eq(e1)) { + if (self.key_eq(c)) { + if (!isDirectCall(c)) { + for (auto_tmp4 in c.getAnAncestor()) { + if (s.getReference().key_eq(auto_tmp4)) { + for (auto_tmp5 in s.getArguments()) { + if (auto_tmp5.key_eq(e)) { + if (direction = "Depended") { + if (type = "DD") { + return e1 + } + } + } + } + } + } + } + } + } + } + } + } + + pub fn getAnAncestorDDNode(self, type: string, direction: string) -> ECGNode { + for (e in ECGNode(__all_data__)) { + if (type = "DD") { + if (e = self.getDDNode(type, direction)) { + return e + } + if (e = self.getAnAncestorDDNode(__all_data__, __all_data__).getDDNode(type, direction)) { + return e + } + } + } + } + + pub fn getCDNode(self, type: string, direction: string) -> ECGNode { + for (e in ECGNode(__all_data__), + c in Callable(__all_data__), + r in ReferenceExpression(__all_data__)) { + if (self.key_eq(c)) { + if (type = "CD") { + for (e1 in Method(__all_data__)) { + for (auto_tmp1 in c.getCallee()) { + if (e1.key_eq(auto_tmp1)) { + if (direction = "Depends") { + if (e.key_eq(e1)) { + return e + } + } + } + } + } + for (e2 in Method(__all_data__)) { + for (auto_tmp2 in c.getCaller()) { + if (e2.key_eq(auto_tmp2)) { + if (direction = "Depended") { + if (e.key_eq(e2)) { + return e + } + } + } + } + } + } + } + if (self.key_eq(r.getDefinition())) { + if (c = r.getEnclosingCallable()) { + if (type = "CD") { + for (e1 in Method(__all_data__)) { + for (auto_tmp1 in c.getCallee()) { + if (e1.key_eq(auto_tmp1)) { + if (direction = "Depends") { + if (e.key_eq(e1)) { + return e + } + } + } + } + } + for (e2 in Method(__all_data__)) { + for (auto_tmp2 in c.getCaller()) { + if (e2.key_eq(auto_tmp2)) { + if (direction = "Depended") { + if (e.key_eq(e2)) { + return e + } + } + } + } + } + } + } + } + } + } + + pub fn getAnAncestorCDNode(self, type: string, direction: string) -> ECGNode { + for (e in ECGNode(__all_data__), + c in Callable(__all_data__), + r in ReferenceExpression(__all_data__)) { + if (type = "CD") { + if (self.key_eq(c)) { + for (e1 in Method(__all_data__)) { + for (auto_tmp1 in c.getAnAncestorCallee()) { + if (e1.key_eq(auto_tmp1)) { + if (direction = "Depends") { + if (e.key_eq(e1)) { + return e + } + } + } + } + } + for (e2 in Method(__all_data__)) { + for (auto_tmp2 in c.getAnAncestorCaller()) { + if (e2.key_eq(auto_tmp2)) { + if (direction = "Depended") { + if (e.key_eq(e2)) { + return e + } + } + } + } + } + } + if (self.key_eq(r.getDefinition())) { + if (c = r.getEnclosingCallable()) { + for (e1 in Method(__all_data__)) { + for (auto_tmp1 in c.getAnAncestorCallee()) { + if (e1.key_eq(auto_tmp1)) { + if (direction = "Depends") { + if (e.key_eq(e1)) { + return e + } + } + } + } + } + for (e2 in Method(__all_data__)) { + for (auto_tmp2 in c.getAnAncestorCaller()) { + if (e2.key_eq(auto_tmp2)) { + if (direction = "Depended") { + if (e.key_eq(e2)) { + return e + } + } + } + } + } + } + } + } + } + } + + pub fn getECGNode(self, type: string, direction: string) -> ECGNode { + for (e in ECGNode(__all_data__)) { + if (e = self.getCDNode(type, direction)) { + return e + } + if (e = self.getDDNode(type, direction)) { + return e + } + } + } + + pub fn getAnAncestorECGNode(self, type: string, direction: string) -> ECGNode { + for (e in ECGNode(__all_data__), tmp in ECGNode(__all_data__)) { + if (tmp = self.getAnAncestorCDNode(__all_data__, __all_data__)) { + if (e = tmp.getECGNode(type, direction)) { + return e + } + } + } + } + + pub fn getAnAncestorCDDependedNode(self, type: string, direction: string) -> ECGNode { + for (e in ECGNode(__all_data__), c in Callable(__all_data__), r in ReferenceExpression(__all_data__)) { + if (type = "CD") { + if (self.key_eq(c) || (self.key_eq(r.getDefinition()) && r.getEnclosingCallable() = c)) { + for (e2 in Method(__all_data__), c_caller in c.getAnAncestorCaller()) { + if (e2.key_eq(c_caller) && direction = "Depended" && e.key_eq(e2)) { + return e + } + } + } + } + } + } + + fn tmp_0(n: string) -> bool { + if (n.matches("get.*")) { + return true + } + } +} + +pub fn getJavaECGNode(id: int) -> bool { + [ + // {-2697619382280646740}, + // {-2697619382280646740}, + {5305694462395891450}, + {5305694462395891450} + ] +} +pub fn getXmlECGNode(id: int) -> bool { + [ + // {-1} + ] +} +schema SofaService extends Annotation { + +} + +impl SofaService { + + @data_constraint + @inline + pub fn __all__(db: JavaDB) -> *SofaService { + for (tmp in Annotation(db)) { + if (tmp.getName() = "SofaService") { + yield SofaService { + id : tmp.id + } + } + } + } + + pub fn getService(self) -> ClassOrInterface { + for (value in string::__undetermined_all__()) { + for (i in ClassOrInterface(__all_data__), + argus in AnnotationAccessArgument(__all_data__)) { + for (auto_tmp1 in self.getAnnotationArgument()) { + if (argus = auto_tmp1) { + if (argus.getAnnotationArgumentName() = "interfaceType") { + if (value = argus.getAnnotationArgumentValue()) { + if (i.getQualifiedName() = value) { + return i + } + } + } + } + } + } + } + } + + @inline + pub fn getBinding(self) -> SofaServiceBinding { + for (b in SofaServiceBinding(__all_data__), + argus in AnnotationAccessArgument(__all_data__)) { + for (auto_tmp1 in self.getAnnotationArgument()) { + if (argus = auto_tmp1) { + if (argus.getAnnotationArgumentName() = "bindings") { + if (b.key_eq(argus.getArgumentAnnotation())) { + return b + } + if (argus.key_eq(b.getParent())) { + return b + } + } + } + } + } + } + + @inline + pub fn getUniqueId(self) -> string { + for (uniqueId in string::__undetermined_all__()) { + for (anno in Annotation(__all_data__)) { + if (self.key_eq(anno)) { + if (tmp_2(anno)) { + for (argus in AnnotationAccessArgument(__all_data__)) { + for (auto_tmp1 in anno.getAnnotationArgument()) { + if (argus = auto_tmp1) { + if (argus.getAnnotationArgumentName() = "uniqueId") { + if (uniqueId = argus.getAnnotationArgumentValue()) { + return uniqueId + } + } + } + } + } + } + if (!(tmp_2(anno))) { + if (uniqueId = "null") { + return uniqueId + } + } + } + } + } + } + + +} + +pub fn uniqueArgument(anno: Annotation) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (argus in AnnotationAccessArgument(java_db)) { + for (auto_tmp1 in anno.getAnnotationArgument()) { + if (argus = auto_tmp1) { + if (argus.getAnnotationArgumentName() = "uniqueId") { + return true + } + } + } + } + } + } +} +schema SofaServiceBinding extends Annotation { + +} + +impl SofaServiceBinding { + + @data_constraint + @inline + pub fn __all__(db: JavaDB) -> *SofaServiceBinding { + for (tmp in Annotation(db)) { + if (tmp.getName() = "SofaServiceBinding") { + yield SofaServiceBinding { + id : tmp.id + } + } + } + } + + pub fn getType(self) -> string { + for (value in string::__undetermined_all__()) { + for (argus in AnnotationAccessArgument(__all_data__)) { + for (auto_tmp1 in self.getAnnotationArgument()) { + if (argus = auto_tmp1) { + if (argus.getAnnotationArgumentName() = "bindingType") { + if (value = argus.getAnnotationArgumentValue()) { + return value + } + } + } + } + } + } + } + + +} + +pub fn javaOutput(classname: string, name: string) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (s in SofaService(java_db), + c in Class(java_db), + i in ClassOrInterface(java_db)) { + for (auto_tmp1 in c.getAnnotation()) { + if (s.key_eq(auto_tmp1)) { + if (classname = c.getQualifiedName()) { + for (auto_tmp2 in c.getImplementsInterface()) { + if (i.key_eq(auto_tmp2)) { + if (name = i.getQualifiedName()) { + return true + } + } + } + if (i = s.getService()) { + if (name = i.getQualifiedName()) { + return true + } + } + } + } + } + } + } + } +} +pub fn xmlOutput(className: string, interfaceName: string) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (temp in string::__undetermined_all__()) { + for (s in SofaServiceXmlElement(xml_db), + b in BeanXmlElement(xml_db)) { + if (s.getRef() = b.getId()) { + if (interfaceName = s.getInterfaceName()) { + if (className = b.getClass()) { + if (temp = b.getLocation().getFile().getRelativePath()) { + if (!temp.contains("src/test/resources")) { + return true + } + } + } + } + } + } + } + } + } +} +pub fn annoOutput(className: string, interfaceName: string) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (v in string::__undetermined_all__(), + k in string::__undetermined_all__()) { + for (s in SofaServiceXmlElement(xml_db), + b in Class(java_db), + t in TagXmlElement(xml_db), + a in Annotation(java_db)) { + if (s.key_eq(t.getParent())) { + if (v = s.getRef()) { + if (interfaceName = s.getInterfaceName()) { + for (auto_tmp1 in b.getAnnotation()) { + if (a = auto_tmp1) { + if (a.getName() = k) { + if (getTrAnnotationName(k)) { + for (auto_tmp2 in a.getAnnotationArgument()) { + if (auto_tmp2.getAnnotationArgumentValue() = "\"" + v + "\"") { + if (className = b.getQualifiedName()) { + return true + } + } + } + } + } + } + } + } + } + } + } + } + } + } +} +pub fn getTrAnnotationName(a: string) -> bool { + [ + {"Service"}, + {"Component"}, + {"Scope"}, + {"Repository"}, + {"Controller"}, + {"RestController"}, + {"RequestMapping"}, + {"PathVariable"}, + {"ResponseBody"}, + {"bean"} + ] +} +pub fn getPublishTr(c: ClassOrInterface) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (className in string::__undetermined_all__(), + interfaceName in string::__undetermined_all__()) { + if (xmlOutput(className, interfaceName)) { + if (interfaceName = c.getQualifiedName()) { + return true + } + } + if (javaOutput(className, interfaceName)) { + if (interfaceName = c.getQualifiedName()) { + return true + } + } + if (annoOutput(className, interfaceName)) { + if (interfaceName = c.getQualifiedName()) { + return true + } + } + } + } + } +} +pub fn real_output(c: ClassOrInterface, n: ECGNode, interfaceName: string, nodeName: string) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + for (m in ECGNode(java_db)) { + if (getJavaECGNode(m.id)) { + if (getPublishTr(c)) { + for (t in Method(java_db)) { + if (n.key_eq(t)) { + if (c = t.getParent()) { + if (n = m.getAnAncestorCDDependedNode(__all_data__, __all_data__)) { + if (interfaceName = c.getQualifiedName()) { + if (nodeName = n.print()) { + return true + } + } + } + } + } + } + for (f in Field(java_db)) { + if (n.key_eq(f)) { + if (c = f.getParent()) { + if (n = m.getAnAncestorCDDependedNode(__all_data__, __all_data__)) { + if (interfaceName = c.getQualifiedName()) { + if (nodeName = n.print()) { + return true + } + } + } + } + } + } + } + } + if (getXmlECGNode(m.id)) { + if (getPublishTr(c)) { + for (t in Method(java_db)) { + if (n.key_eq(t)) { + if (c = t.getParent()) { + if (n = m.getAnAncestorCDDependedNode(__all_data__, __all_data__)) { + if (interfaceName = c.getQualifiedName()) { + if (nodeName = n.print()) { + return true + } + } + } + } + } + } + for (f in Field(java_db)) { + if (n.key_eq(f)) { + if (c = f.getParent()) { + if (n = m.getAnAncestorCDDependedNode(__all_data__, __all_data__)) { + if (interfaceName = c.getQualifiedName()) { + if (nodeName = n.print()) { + return true + } + } + } + } + } + } + } + } + } + } + } +} + + +fn default_java_db() -> JavaDB { + return JavaDB::load("coref_java_src.db") +} + +fn default_xml_db() -> XmlDB { + return XmlDB::load("coref_xml_src.db") +} + +fn tmp_0(anno: Annotation) -> *auto_tmp_1 { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + if (uniqueArgument(anno)) { + yield auto_tmp_1 { + + } + } + } + } +} + +schema auto_tmp_1 { + +} + +fn tmp_2(anno: Annotation) -> bool { + let (java_db = default_java_db()) { + let (xml_db = default_xml_db()) { + if (tmp_0(anno).len() = 1) { + return true + } + } + } +} + +fn main() { + output(real_output()) +} \ No newline at end of file diff --git a/example/java/CallChainWithPathFilter.gdl b/example/java/CallChainWithPathFilter.gdl new file mode 100644 index 00000000..46f91711 --- /dev/null +++ b/example/java/CallChainWithPathFilter.gdl @@ -0,0 +1,55 @@ +// script +use coref::java::* + +pub fn default_java_db() -> JavaDB { + return JavaDB::load("coref_java_src.db") +} + +//过滤用文件夹名,可修改 +pub fn FOLDERNAMES(n: string) -> bool { + [ + {"/ibatis/"}, + {"/dao/"}, + {"/test/"} + ] +} + +//用文件夹名进行过滤 +pub fn filterByFolderNames(d: File) -> bool { + for (m in string::__undetermined_all__(), + n in string::__undetermined_all__()) { + if (n = d.getRelativePath() && FOLDERNAMES(m) && n.contains(m)) { + return true + } + } +} + +pub fn getIndirectEdges(b: Callable, c: Callable) -> bool { + if (b in c.getAnAncestorCaller()) { + return true + } +} + +pub fn getDirectEdges(b: Callable, c: Callable) -> bool { + if (c in b.getCallee()) { + return true + } +} + +// 基于路径过滤的调用关系输出 +pub fn output_signature(caller: string, callee: string) -> bool { + for(b in Callable(default_java_db()), c in Callable(default_java_db())) { + let (b_file = b.getLocation().getFile(), c_file = c.getLocation().getFile()) { + if (!filterByFolderNames(b_file) && !filterByFolderNames(c_file)) { + if (getIndirectEdges(b, c) || getDirectEdges(b, c)) { + return caller = b.getSignature() && callee = c.getSignature() + } + } + } + } +} + +pub fn main() { + // 输出按路径过滤后的调用链 + output(output_signature()) +} \ No newline at end of file diff --git a/example/java/CallChainWithSignature.gdl b/example/java/CallChainWithSignature.gdl new file mode 100644 index 00000000..a9fc58a1 --- /dev/null +++ b/example/java/CallChainWithSignature.gdl @@ -0,0 +1,89 @@ +// script +use coref::java::* + +fn default_java_db() -> JavaDB { + return JavaDB::load("coref_java_src.db") +} + +// Given one or more function signatures, only one is given in the current example, which can be modified +// signature +fn isChecked(signature: string) -> bool { + [ + {"HelloWorld.test2:void()"}, + ] +} + +// You can view the signature, line number, and file location of each callable by outputting the following function: +fn signature_name(signature: string, line: int, fileName: string) -> bool { + for (callable in Callable(default_java_db())) { + if (signature = callable.getSignature() && + fileName = callable.getLocation().getFile().getName() && + line = callable.getLocation().getStartLineNumber()) { + return true + } + } +} + +// Determine whether it is a callable corresponding to the function signature +fn checkCallable(c: Callable) -> bool { + if (isChecked(c.getSignature())) { + return true + } +} + + +// Do an upward search +fn getAncestorCallerEndWithLimit(c: Callable) -> *Callable { + // Get the calling function of the current function + yield c.getCaller() + // The current node is multiple layers above, and recursive calls are required to obtain all calling functions + for (tmp in c.getCaller()) { + yield getAncestorCallerEndWithLimit(tmp) + } +} + +fn getAllLimitedCallable(c: Callable) -> *Callable { + yield c + yield getAncestorCallerEndWithLimit(c) +} + +// At the same time, output the class corresponding to callable +fn getCallGraph(callMethodName: string, + callClassName: string, + calleeMethodName: string, + calleeClassName: string) -> bool { + let (db = default_java_db()) { + for (callable in Callable(db)) { + if (checkCallable(callable)) { + for (call in getAllLimitedCallable(callable), callee in getAllLimitedCallable(callable)) { + if (call != callee && callee in call.getCallee()) { + // Get the method corresponding to the callable + // But be aware that the callable is mixed with method and constructor + // So this call graph may not contain constructor + for (callMethod in Method(db), calleeMethod in Method(db)) { + if (callMethod.key_eq(call) && calleeMethod.key_eq(callee)) { + if (callMethodName = callMethod.getName() && + callClassName = callMethod.getBelongedClass().getQualifiedName() && + calleeMethodName = callee.getName() && + // Also, method's getBelongedClass will get Class, + // but some of methods are belonged to interface. + // So this call graph may not contain methods in interfaces. + // If you want to get methods in interfaces, you can use the following code: + // calleeClassName = calleeMethod.getParent().getQualifiedName() + calleeClassName = calleeMethod.getBelongedClass().getQualifiedName()) { + return true + } + } + } + } + } + } + } + } +} + +fn main() { + output(getCallGraph()) + // If you want to see the signature in the output add the following line back + // output(signature_name()) +} \ No newline at end of file diff --git a/example/java/GetMybatisDOClass.gdl b/example/java/GetMybatisDOClass.gdl new file mode 100644 index 00000000..dc7f4cd9 --- /dev/null +++ b/example/java/GetMybatisDOClass.gdl @@ -0,0 +1,42 @@ +// script +use coref::java::* +use coref::xml::* + +fn default_xml_db() -> XmlDB { return XmlDB::load("coref_xml_src.db") } +fn default_java_db() -> JavaDB { return JavaDB::load("coref_java_src.db") } + +schema DBElement extends XmlElement {} + +impl DBElement { + // find XmlElement with name "resultMap" + pub fn __all__(db: XmlDB) -> *Self { + for (x in XmlElement(db)) { + if (x.getElementName() = "resultMap") { + yield DBElement { ..x } + } + } + } + + // get attribute "type" from XmlElement "resultMap" + pub fn getType(self) -> string { + for (a in self.getAttribute()) { + if (a.getName() = "type") { + return a.getValue() + } + } + } +} + +// if DBElement's type name equals to Java Class name, then collect this Class info +fn getDOClassFromResultMap() -> *Class { + for (c in Class(default_java_db()), e in DBElement(default_xml_db())) { + if (c.getQualifiedName() = e.getType()) { + yield c + } + } +} + +// example query, just get the class name, you could do other queries +query do_class +from c in getDOClassFromResultMap() +select c.getQualifiedName() as do_class_name diff --git a/example/java/GetSignature.gdl b/example/java/GetSignature.gdl new file mode 100644 index 00000000..14e9a9ea --- /dev/null +++ b/example/java/GetSignature.gdl @@ -0,0 +1,11 @@ +// script +use coref::java::* + +fn default_db() -> JavaDB { + return JavaDB::load("coref_java_src.db") +} + +query getSignature from + c in Callable(default_db()) +select + c.getSignature() as signature \ No newline at end of file diff --git a/example/python/ASTPrint.gdl b/example/python/ASTPrint.gdl new file mode 100644 index 00000000..7dff8d2b --- /dev/null +++ b/example/python/ASTPrint.gdl @@ -0,0 +1,90 @@ +// script +use coref::python::* + +fn default_db() -> PythonDB { + return PythonDB::load("coref_python_src.db") +} + +// 递归查找以a为起点的语法树边,b 和 c 组成一条有向边,b 为父节点,c 为子节点,index 为这条边在树中距离 root 的层级 +fn searchEdge(a: CombineElement, b: CombineElement, c: CombineElement, index: int) -> bool { + if (a = b.getAnAncestorForIndex(index) || (b = a && index = 0)) { + if (b = c.getParent()) { + return true + } + } +} + +// 获取位置信息,如果该节点在 ast parser 中不存在位置信息,则会递归展示该节点的父节点的位置信息, +// 例如 Comprehension,Arguments,Withitem, DocstringComment 等类型 +fn getLoc(p: CombineElement, line: int, col: int) -> bool { + return line = p.getLocation().getStartLineNumber() && + col = p.getLocation().getStartColumnNumber() +} + +// 输出AST语法树的有向边,以及点的代码片段 +// 第一列是层数,从0开始 +// 第二列是当前边的父节点 +// 第三列是父节点的节点类型 +// 第四列是父节点的代码片段 +// 第五列是父节点起始行号 +// 第六列是父节点起始列号 +// 第七列是当前边的子节点 +// 第八列是子节点的节点类型 +// 第九列是子节点的代码片段 +// 第十列是子节点起始行号 +// 第十一列是子节点起始列号 +@output +fn out(filePath: string, + depth: int, + parent: CombineElement, + parentKind: string, + parentContent: string, + parentLine: int, + parentColumn: int, + child: CombineElement, + childKind: string, + childContent: string, + childLine: int, + childColumn: int) -> bool { + for (a in File(default_db())) { + if (filePath = a.getRelativePath() && + searchEdge(CombineElement(default_db()).find(a), parent, child, depth) && + childContent = child.print() && // 输出子节点的内容 + shortPrint(parent, parentContent) && // 优化输出父节点内容 + parentKind = parent.getType() && + childKind = child.getType() && + getLoc(parent, parentLine, parentColumn) && + getLoc(child, childLine, childColumn)) { + return true + } + } +} + +// 找到长度在 5 行以上的Expression, 可以调整 +fn isLongExpression(s: CombineElement) -> bool { + return Expression(default_db()).find(s).getSize().getNumberOfTotalLines() > 4 +} + +// 优化输出父节点 +fn shortPrint(p: CombineElement, n: string) -> bool { + if (isStatement(p)) { + return n = p.getType() + } + if (!isStatement(p)) { + if (isLongExpression(p)) { + return n = p.getType() + } + if (!isLongExpression(p)) { + return n = p.print() + } + } +} + +// 找到属于Statement的节点 +fn isStatement(s: CombineElement) -> bool { + for (b in Statement(default_db())) { + if (b.key_eq(s)) { + return true + } + } +} diff --git a/example/xml/GetBean.gdl b/example/xml/GetBean.gdl index 87de2614..be479498 100644 --- a/example/xml/GetBean.gdl +++ b/example/xml/GetBean.gdl @@ -1,62 +1,6 @@ // script use coref::xml::* -schema BeanXmlElement extends XmlElement {} - -impl BeanXmlElement { - @data_constraint - pub fn __all__(db: XmlDB) -> *BeanXmlElement { - for (e in XmlElement(db)) { - let (path = e.getLocation().getFile().getRelativePath()) { - if (!path.contains("target") && e.getName() = "bean") { - yield BeanXmlElement { - id: e.id, - location_id: e.location_id, - parent_id: e.parent_id, - index_order: e.index_order - } - } - } - } - } -} - -schema EntryXmlElement extends XmlElement {} - -impl EntryXmlElement { - @data_constraint - fn __all__(db: XmlDB) -> *EntryXmlElement { - for (e in XmlElement(db)) { - if (e.getName() = "entry") { - yield EntryXmlElement { - id: e.id, - location_id: e.location_id, - parent_id: e.parent_id, - index_order: e.index_order - } - } - } - } -} - -schema PropertyXmlElement extends XmlElement {} - -impl PropertyXmlElement { - @data_constraint - fn __all__(db: XmlDB) -> *PropertyXmlElement { - for (e in XmlElement(db)) { - if (e.getName() = "property") { - yield PropertyXmlElement { - id: e.id, - location_id: e.location_id, - parent_id: e.parent_id, - index_order: e.index_order - } - } - } - } -} - fn default_db() -> XmlDB { return XmlDB::load("coref_xml_src.db") } diff --git a/example/xml/POM.gdl b/example/xml/POM.gdl index 9c7779a2..636258ed 100644 --- a/example/xml/POM.gdl +++ b/example/xml/POM.gdl @@ -73,23 +73,6 @@ impl ArtifactElement { } } -schema PomFile extends XmlFile {} - -impl PomFile { - @data_constraint - pub fn __all__(db: XmlDB) -> *PomFile { - for(f in XmlFile(db)) { - if (f.getFileName() = "pom.xml") { - yield PomFile { - id: f.id, - file_name: f.file_name, - relative_path: f.relative_path - } - } - } - } -} - // output relative path of the file, referenced jar name and version fn out(fileName: string, m1: string, m2: string, m3: string) -> bool { let (db = XmlDB::load("coref_xml_src.db")) { diff --git a/external/godel.BUILD b/external/godel.BUILD new file mode 100644 index 00000000..1e9e12ea --- /dev/null +++ b/external/godel.BUILD @@ -0,0 +1,5 @@ +filegroup( + name = "all", + srcs = glob(["usr/**/*"]) + ["version.txt"], + visibility = ["//visibility:public"], +) diff --git a/external/rules_jvm_external/BUILD b/external/rules_jvm_external/BUILD new file mode 100644 index 00000000..e69de29b diff --git a/external/rules_jvm_external/versions.bzl.patch b/external/rules_jvm_external/versions.bzl.patch new file mode 100644 index 00000000..ddc28db9 --- /dev/null +++ b/external/rules_jvm_external/versions.bzl.patch @@ -0,0 +1,32 @@ +diff --git private/versions.bzl private/versions.bzl +--- private/versions.bzl ++++ private/versions.bzl +@@ -1,23 +1,24 @@ + _COURSIER_CLI_VERSION = "v2.0.16" + + COURSIER_CLI_HTTP_FILE_NAME = ("coursier_cli_" + _COURSIER_CLI_VERSION).replace(".", "_").replace("-", "_") +-COURSIER_CLI_GITHUB_ASSET_URL = "https://github.com/coursier/coursier/releases/download/{COURSIER_CLI_VERSION}/coursier.jar".format(COURSIER_CLI_VERSION = _COURSIER_CLI_VERSION) + ++COURSIER_CLI_GITHUB_ASSET_URL = "https://antsys-sparrow-data.cn-shanghai-alipay-office.oss-alipay.aliyuncs.com/sparrow/public/tools/java/coursier/{COURSIER_CLI_VERSION}/coursier.jar".format(COURSIER_CLI_VERSION = _COURSIER_CLI_VERSION) ++ + # Run 'bazel run //:mirror_coursier' to upload a copy of the jar to the Bazel mirror. + COURSIER_CLI_BAZEL_MIRROR_URL = "https://mirror.bazel.build/coursier_cli/" + COURSIER_CLI_HTTP_FILE_NAME + ".jar" + COURSIER_CLI_SHA256 = "076de041cbebc0a1272b84f1e69f6da5df4961847850b95cb3dfa3f776145225" + + JQ_VERSIONS = { + "linux": struct( +- url = "https://github.com/stedolan/jq/releases/download/jq-1.6/jq-linux64", ++ url = "https://antsys-sparrow-data.cn-shanghai-alipay-office.oss-alipay.aliyuncs.com/sparrow/public/tools/java/jq/1.6/jq-linux64", + sha256 = "af986793a515d500ab2d35f8d2aecd656e764504b789b66d7e1a0b727a124c44", + ), + "macos": struct( +- url = "https://github.com/stedolan/jq/releases/download/jq-1.6/jq-osx-amd64", ++ url = "https://antsys-sparrow-data.cn-shanghai-alipay-office.oss-alipay.aliyuncs.com/sparrow/public/tools/java/jq/1.6/jq-osx-amd64", + sha256 = "5c0a0a3ea600f302ee458b30317425dd9632d1ad8882259fcaf4e9b868b2b1ef", + ), + "windows": struct( +- url = "https://github.com/stedolan/jq/releases/download/jq-1.6/jq-win64.exe", ++ url = "https://antsys-sparrow-data.cn-shanghai-alipay-office.oss-alipay.aliyuncs.com/sparrow/public/tools/java/jq/1.6/jq-win64.exe", + sha256 = "a51d36968dcbdeabb3142c6f5cf9b401a65dc3a095f3144bd0c118d5bb192753", + ), + } diff --git a/external/rules_ohos_typescript/ohos_typescript.BUILD b/external/rules_ohos_typescript/ohos_typescript.BUILD new file mode 100644 index 00000000..4a89461a --- /dev/null +++ b/external/rules_ohos_typescript/ohos_typescript.BUILD @@ -0,0 +1,13 @@ +filegroup( + name = "ohos_typescript", + srcs = glob(["**/*"]), + visibility = ["//visibility:public"], +) + +filegroup( + name = "compile_typescript", + srcs = [ + "compile_typescript.py", + ], + visibility = ["//visibility:public"], +) diff --git a/external/rules_python/BUILD b/external/rules_python/BUILD new file mode 100644 index 00000000..e69de29b diff --git a/external/rules_python/repositories.bzl.patch b/external/rules_python/repositories.bzl.patch new file mode 100644 index 00000000..f1a2be9b --- /dev/null +++ b/external/rules_python/repositories.bzl.patch @@ -0,0 +1,51 @@ +diff --git python/pip_install/repositories.bzl python/pip_install/repositories.bzl +--- python/pip_install/repositories.bzl ++++ python/pip_install/repositories.bzl +@@ -9,12 +9,12 @@ _RULE_DEPS = [ + _RULE_DEPS = [ + ( + "pypi__click", +- "https://files.pythonhosted.org/packages/76/0a/b6c5f311e32aeb3b406e03c079ade51e905ea630fc19d1262a46249c1c86/click-8.0.1-py3-none-any.whl", ++ "https://antsys-sparrow-data.cn-shanghai-alipay-office.oss-alipay.aliyuncs.com/sparrow/public/tools/python/pip_deps/click-8.0.1-py3-none-any.whl", + "fba402a4a47334742d782209a7c79bc448911afe1149d07bdabdf480b3e2f4b6", + ), + ( + "pypi__colorama", +- "https://files.pythonhosted.org/packages/44/98/5b86278fbbf250d239ae0ecb724f8572af1c91f4a11edf4d36a206189440/colorama-0.4.4-py2.py3-none-any.whl", ++ "https://antsys-sparrow-data.cn-shanghai-alipay-office.oss-alipay.aliyuncs.com/sparrow/public/tools/python/pip_deps/colorama-0.4.4-py2.py3-none-any.whl", + "9f47eda37229f68eee03b24b9748937c7dc3868f906e8ba69fbcbdd3bc5dc3e2", + ), + ( +@@ -29,27 +29,27 @@ _RULE_DEPS = [ + ), + ( + "pypi__pip", +- "https://files.pythonhosted.org/packages/96/2f/caec18213f6a67852f6997fb0673ae08d2e93d1b81573edb93ba4ef06970/pip-22.1.2-py3-none-any.whl", ++ "https://antsys-sparrow-data.cn-shanghai-alipay-office.oss-alipay.aliyuncs.com/sparrow/public/tools/python/pip_deps/pip-22.1.2-py3-none-any.whl", + "a3edacb89022ef5258bf61852728bf866632a394da837ca49eb4303635835f17", + ), + ( + "pypi__pip_tools", +- "https://files.pythonhosted.org/packages/fe/5c/8995799b0ccf832906b4968b4eb2045beb9b3de79e96e6b1a6e4fc4e6974/pip_tools-6.6.2-py3-none-any.whl", ++ "https://antsys-sparrow-data.cn-shanghai-alipay-office.oss-alipay.aliyuncs.com/sparrow/public/tools/python/pip_deps/pip_tools-6.6.2-py3-none-any.whl", + "6b486548e5a139e30e4c4a225b3b7c2d46942a9f6d1a91143c21b1de4d02fd9b", + ), + ( + "pypi__setuptools", +- "https://files.pythonhosted.org/packages/7c/5b/3d92b9f0f7ca1645cba48c080b54fe7d8b1033a4e5720091d1631c4266db/setuptools-60.10.0-py3-none-any.whl", ++ "https://antsys-sparrow-data.cn-shanghai-alipay-office.oss-alipay.aliyuncs.com/sparrow/public/tools/python/pip_deps/setuptools-60.10.0-py3-none-any.whl", + "782ef48d58982ddb49920c11a0c5c9c0b02e7d7d1c2ad0aa44e1a1e133051c96", + ), + ( + "pypi__tomli", +- "https://files.pythonhosted.org/packages/97/75/10a9ebee3fd790d20926a90a2547f0bf78f371b2f13aa822c759680ca7b9/tomli-2.0.1-py3-none-any.whl", ++ "https://antsys-sparrow-data.cn-shanghai-alipay-office.oss-alipay.aliyuncs.com/sparrow/public/tools/python/pip_deps/tomli-2.0.1-py3-none-any.whl", + "939de3e7a6161af0c887ef91b7d41a53e7c5a1ca976325f429cb46ea9bc30ecc", + ), + ( + "pypi__wheel", +- "https://files.pythonhosted.org/packages/27/d6/003e593296a85fd6ed616ed962795b2f87709c3eee2bca4f6d0fe55c6d00/wheel-0.37.1-py2.py3-none-any.whl", ++ "https://antsys-sparrow-data.cn-shanghai-alipay-office.oss-alipay.aliyuncs.com/sparrow/public/tools/python/pip_deps/wheel-0.37.1-py2.py3-none-any.whl", + "4bdcd7d840138086126cd09254dc6195fb4fc6f01c050a1d7236f2630db1d22a", + ), + ] diff --git a/godel-script/.gitignore b/godel-script/.gitignore index 38202cac..969e188c 100644 --- a/godel-script/.gitignore +++ b/godel-script/.gitignore @@ -1,3 +1,3 @@ # build directory build -cmake-build \ No newline at end of file +cmake-build diff --git a/godel-script/CMakeLists.txt b/godel-script/CMakeLists.txt index 84109426..35f2a787 100644 --- a/godel-script/CMakeLists.txt +++ b/godel-script/CMakeLists.txt @@ -20,6 +20,7 @@ set(GODEL_FRONTEND_HDR_FILES godel-frontend/src/semantic.h godel-frontend/src/symbol.h godel-frontend/src/ir/aggregator_inline_remark.h + godel-frontend/src/ir/call_graph.h godel-frontend/src/ir/flatten_block.h godel-frontend/src/ir/ir_gen.h godel-frontend/src/ir/ir_context.h @@ -29,6 +30,7 @@ set(GODEL_FRONTEND_HDR_FILES godel-frontend/src/ir/pass.h godel-frontend/src/ir/pass_manager.h godel-frontend/src/ir/remove_unused.h + godel-frontend/src/ir/reorder.h godel-frontend/src/error/error.h godel-frontend/src/ast/ast_node.h godel-frontend/src/ast/ast_root.h @@ -60,6 +62,7 @@ set(GODEL_FRONTEND_SRC_FILES godel-frontend/src/semantic.cpp godel-frontend/src/symbol.cpp godel-frontend/src/ir/aggregator_inline_remark.cpp + godel-frontend/src/ir/call_graph.cpp godel-frontend/src/ir/flatten_block.cpp godel-frontend/src/ir/ir_gen.cpp godel-frontend/src/ir/ir_context.cpp @@ -69,6 +72,7 @@ set(GODEL_FRONTEND_SRC_FILES godel-frontend/src/ir/pass.cpp godel-frontend/src/ir/pass_manager.cpp godel-frontend/src/ir/remove_unused.cpp + godel-frontend/src/ir/reorder.cpp godel-frontend/src/error/error.cpp godel-frontend/src/ast/ast_visitor.cpp godel-frontend/src/ast/ast_root.cpp diff --git a/godel-script/README.md b/godel-script/README.md index 1087a50a..1dd6a0e0 100644 --- a/godel-script/README.md +++ b/godel-script/README.md @@ -52,24 +52,39 @@ Structure of this project: +-- src godel-frontend source code ``` +### Environment + Need C++ standard at least `-std=c++17`. +On Ubuntu, you are expected to install the following packages before compiling. + +```bash +sudo apt install -y git build-essential libffi-dev m4 cmake libsqlite3-dev zlib1g-dev +``` + +For convenience, we recommend directly using the [Dev Container plugin](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers) of VSCode. The configuration files are in `godel-script/.devcontainer/`. + + ### Apply Patch On Soufflé Submodule -GödelScript uses a self-modified soufflé from a much older branch of public soufflé, -now we use patch to make sure it could be built successfully. +GödelScript uses a self-modified soufflé from a much older branch of public soufflé. Use these commands to clone. -Use this command to apply patch: +```bash +git submodule init +git submodule update --recursive +``` + +Now we use patch to make sure it could be built successfully. Use these commands to apply patch: ```bash -cd souffle -git am ../../0001-init-self-used-souffle-from-public-souffle.patch +cd godel-backend/souffle +git am ../0001-init-self-used-souffle-from-public-souffle.patch ``` Use these commands to revert: ```bash -cd souffle +cd godel-backend/souffle git apply -R ../0001-init-self-used-souffle-from-public-souffle.patch git reset HEAD~ ``` @@ -79,10 +94,9 @@ git reset HEAD~ Use command below: ```bash -mkdir build -cd build -cmake .. -make -j +mkdir build && cd build +cmake .. -DCMAKE_BUILD_TYPE:STRING=Release +cmake --build . ``` After building, you'll find `build/godel` in the `build` folder. @@ -91,20 +105,18 @@ After building, you'll find `build/godel` in the `build` folder. Use this command for help: -> ./build/godel -h +> godel -h -### Compile Target Soufflé +### Compile GödelScript to Target Soufflé -> ./build/godel -p {godel library directory} {input file} -s {soufflé output file} -Of +> godel -p {godel library directory} {input file} -s {soufflé output file} -O2 -`-Of` is an optimization for join order, we suggest to switch it on. +We suggest to use `-O2` for stable optimizations. -### Directly Run Soufflé +### Directly Run GödelScript -> ./build/godel -p {godel library directory} {input file} -r -Of -f {database directory} +> godel -p {godel library directory} {input file} -r -O2 -f {database directory} -`-Of` is an optimization for join order, we suggest to switch it on. +We suggest to use `-O2` for stable optimizations. `-r` means directly run soufflé. - -`-v` could be used for getting verbose info. diff --git a/godel-script/docs/language-reference/databases.md b/godel-script/docs/language-reference/databases.md index 609384e6..f477a7b4 100644 --- a/godel-script/docs/language-reference/databases.md +++ b/godel-script/docs/language-reference/databases.md @@ -47,4 +47,4 @@ impl Student { } ``` -Back to [README.md](../../README.md#documents) \ No newline at end of file +Back to [README.md](../../README.md#documents) diff --git a/godel-script/docs/language-reference/program.md b/godel-script/docs/language-reference/program.md index 0bd5c77d..022d1bba 100644 --- a/godel-script/docs/language-reference/program.md +++ b/godel-script/docs/language-reference/program.md @@ -108,4 +108,4 @@ fn main() { } ``` -Back to [README.md](../../README.md#documents) \ No newline at end of file +Back to [README.md](../../README.md#documents) diff --git a/godel-script/docs/language-reference/schemas.md b/godel-script/docs/language-reference/schemas.md index f45fe6e0..86bb38d2 100644 --- a/godel-script/docs/language-reference/schemas.md +++ b/godel-script/docs/language-reference/schemas.md @@ -205,4 +205,4 @@ Judge if this schema instance in universal set of another schema, duck type chec stmt.is() ``` -Back to [README.md](../../README.md#documents) \ No newline at end of file +Back to [README.md](../../README.md#documents) diff --git a/godel-script/docs/language-reference/type.md b/godel-script/docs/language-reference/type.md index 5f097686..0cdab631 100644 --- a/godel-script/docs/language-reference/type.md +++ b/godel-script/docs/language-reference/type.md @@ -109,4 +109,4 @@ fn max(self: *int) -> int; fn find(self: *T0, instance: T1) -> T0; ``` -Back to [README.md](../../README.md#documents) \ No newline at end of file +Back to [README.md](../../README.md#documents) diff --git a/godel-script/godel-backend/0001-init-self-used-souffle-from-public-souffle.patch b/godel-script/godel-backend/0001-init-self-used-souffle-from-public-souffle.patch index 0ca2b88a..6cc998a2 100644 --- a/godel-script/godel-backend/0001-init-self-used-souffle-from-public-souffle.patch +++ b/godel-script/godel-backend/0001-init-self-used-souffle-from-public-souffle.patch @@ -1,16 +1,9 @@ -From 9cd9cafbc050f6a2ce04a2aaf7ed3267f32cc2db Mon Sep 17 00:00:00 2001 +From 5ef4e439424421214071cf8b9bb5b413534fe582 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=81=95=E5=B1=B1?= -Date: Mon, 24 Jun 2024 16:55:26 +0800 -Subject: [PATCH] init self-used souffle from public souffle +Date: Fri, 13 Dec 2024 18:02:01 +0800 +Subject: [PATCH] init self used souffle from public souffle --- - .github/actions/cmake-test/action.yml | 2 +- - .github/actions/set-test-ids/action.yml | 2 +- - .github/images/arch-linux/entrypoint.sh | 2 +- - .github/scripts/updatePPA.sh | 8 +- - .github/workflows/CI-Tests.yml | 67 +- - .github/workflows/VS-CI-Tests.yml | 20 +- - .github/workflows/create-packages.yml | 28 +- CMakeLists.txt | 29 +- README.md | 6 +- choco-packages.config | 5 +- @@ -22,15 +15,15 @@ Subject: [PATCH] init self-used souffle from public souffle sh/checkStyle.sh | 4 +- sh/check_os.sh | 2 +- src/CMakeLists.txt | 104 +- - src/DynamicLibrary.cpp | 72 + - src/ExtraConfig.h | 24 + + src/DynamicLibrary.cpp | 84 + + src/ExtraConfig.h | 36 + src/FunctorOps.cpp | 4 - src/FunctorOps.h | 5 - src/Global.cpp | 6 +- src/Global.h | 11 +- src/GraphUtils.h | 76 +- src/LogStatement.h | 31 +- - src/MainEntry.cpp | 5 + + src/MainEntry.cpp | 17 + src/RelationTag.h | 2 + src/TranslationUnitBase.h | 22 +- src/ast/Aggregator.cpp | 29 +- @@ -233,7 +226,7 @@ Subject: [PATCH] init self-used souffle from public souffle src/include/souffle/io/ReadStreamSQLite.h | 26 +- src/include/souffle/io/SerialisationStream.h | 2 +- src/include/souffle/io/WriteStream.h | 2 +- - src/include/souffle/io/WriteStreamSQLite.h | 30 +- + src/include/souffle/io/WriteStreamSQLite.h | 50 +- src/include/souffle/profile/Cell.h | 16 +- src/include/souffle/profile/CellInterface.h | 2 +- src/include/souffle/profile/Cli.h | 17 +- @@ -261,7 +254,7 @@ Subject: [PATCH] init self-used souffle from public souffle src/interpreter/BTreeDeleteIndex.cpp | 18 +- src/interpreter/BTreeIndex.cpp | 19 +- src/interpreter/Context.h | 9 - - src/interpreter/Engine.cpp | 564 +++--- + src/interpreter/Engine.cpp | 620 +++--- src/interpreter/Engine.h | 45 +- src/interpreter/EqrelIndex.cpp | 3 +- src/interpreter/Generator.cpp | 144 +- @@ -423,7 +416,7 @@ Subject: [PATCH] init self-used souffle from public souffle tests/syntactic/syntax5/syntax5.err | 2 +- tests/syntactic/syntax6/syntax6.err | 2 +- tests/syntactic/syntax8/syntax8.err | 2 +- - 419 files changed, 7762 insertions(+), 9621 deletions(-) + 412 files changed, 7824 insertions(+), 9542 deletions(-) create mode 100644 src/DynamicLibrary.cpp create mode 100644 src/ExtraConfig.h create mode 100644 src/MainEntry.cpp @@ -435,372 +428,6 @@ Subject: [PATCH] init self-used souffle from public souffle create mode 100644 src/parser/Helper.h create mode 100644 src/ram/CountUniqueKeys.h -diff --git a/.github/actions/cmake-test/action.yml b/.github/actions/cmake-test/action.yml -index 90ddfab..460a1ab 100644 ---- a/.github/actions/cmake-test/action.yml -+++ b/.github/actions/cmake-test/action.yml -@@ -14,7 +14,7 @@ runs: - using: "composite" - steps: - - name: checkout -- uses: actions/checkout@v4 -+ uses: actions/checkout@v2 - - - name: setup-env - run: | -diff --git a/.github/actions/set-test-ids/action.yml b/.github/actions/set-test-ids/action.yml -index 2cc54e6..d87f49f 100644 ---- a/.github/actions/set-test-ids/action.yml -+++ b/.github/actions/set-test-ids/action.yml -@@ -13,5 +13,5 @@ runs: - - id: set-test-ids - run: | - CHUNKS=$(python3 -c "print(list(range(${{ inputs.n-chunks }})))") -- echo "chunks=${CHUNKS}" >> $GITHUB_OUTPUT -+ echo "::set-output name=chunks::${CHUNKS}" - shell: bash -diff --git a/.github/images/arch-linux/entrypoint.sh b/.github/images/arch-linux/entrypoint.sh -index 7aa8d7a..751c90b 100755 ---- a/.github/images/arch-linux/entrypoint.sh -+++ b/.github/images/arch-linux/entrypoint.sh -@@ -3,6 +3,6 @@ - set -e - set -x - --envsubst '${RELEASE_TAG},${REPO_OWNER}' < PKGBUILD.in > PKGBUILD -+envsubst '${RELEASE_TAG}' < PKGBUILD.in > PKGBUILD - makepkg - makepkg --printsrcinfo > .SRCINFO -diff --git a/.github/scripts/updatePPA.sh b/.github/scripts/updatePPA.sh -index 5eeb9f8..d4588f3 100755 ---- a/.github/scripts/updatePPA.sh -+++ b/.github/scripts/updatePPA.sh -@@ -46,17 +46,17 @@ sudo apt-get install createrepo rpm - echo "%_gpg_name Bot\n%__gpg_sign_cmd %{__gpg} gpg --force-v3-sigs --batch --verbose --no-armor --no-secmem-warning -u \"%{_gpg_name}\" -sbo %{__signature_filename} --digest-algo sha256 %{__plaintext_filename}'" > ~/.rpmmacros - - ## Fedora --mkdir -p $TMPDIR/ppa/fedora/39/x86_64 -+mkdir -p $TMPDIR/ppa/fedora/34/x86_64 - cd $TMPDIR/ppa/fedora - --for i in $DEBPATH/*fedora-39*/*rpm -+for i in $DEBPATH/*fedora-34*/*rpm - do - rpm --addsign $i - done - --cp $DEBPATH/*fedora-39*/*rpm 39/x86_64/ -+cp $DEBPATH/*fedora-34*/*rpm 34/x86_64/ - --createrepo 39/x86_64 -+createrepo 34/x86_64 - - git add . - git commit -m "Added fedora rpm files for $SOUFFLE_TAG" -diff --git a/.github/workflows/CI-Tests.yml b/.github/workflows/CI-Tests.yml -index f8b865f..0eda992 100644 ---- a/.github/workflows/CI-Tests.yml -+++ b/.github/workflows/CI-Tests.yml -@@ -3,9 +3,6 @@ on: - pull_request: - types: [opened, synchronize] - workflow_dispatch: -- push: -- branches: -- - 'master' - - jobs: - Code-Style: -@@ -13,7 +10,7 @@ jobs: - - steps: - - name: checkout -- uses: actions/checkout@v4 -+ uses: actions/checkout@v2 - with: - fetch-depth: 2 - -@@ -31,7 +28,7 @@ jobs: - chunks: ${{ steps.set-test-ids.outputs.chunks }} - steps: - - name: checkout -- uses: actions/checkout@v4 -+ uses: actions/checkout@v2 - - id: set-test-ids - uses: ./.github/actions/set-test-ids - with: -@@ -54,7 +51,7 @@ jobs: - - steps: - - name: checkout -- uses: actions/checkout@v4 -+ uses: actions/checkout@v2 - - - name: install-lcov - if: ${{ matrix.domain == '32bit' }} -@@ -97,7 +94,7 @@ jobs: - - - name: upload-coverage-artifact - if: ${{ matrix.domain == '32bit' }} -- uses: actions/upload-artifact@v4 -+ uses: actions/upload-artifact@v2 - with: - name: coverage-${{ matrix.domain }}-${{ matrix.chunk }} - path: coverage.info -@@ -113,17 +110,11 @@ jobs: - matrix: - chunk: ${{ fromJSON(needs.Test-Setup.outputs.chunks) }} - -- runs-on: macos-12 -+ runs-on: macos-latest - - steps: -- - name: Select XCode version -- uses: maxim-lobanov/setup-xcode@v1 -- with: -- # Pending https://github.com/actions/runner-images/issues/6350 -- xcode-version: '13.4' -- - - name: checkout -- uses: actions/checkout@v4 -+ uses: actions/checkout@v2 - - - name: install-deps - run: sh/setup/install_macos_deps.sh -@@ -135,39 +126,6 @@ jobs: - n-chunks: ${{ needs.Test-Setup.outputs.n-chunks }} - chunk: ${{ matrix.chunk }} - -- AppleM-CMake: -- needs: Test-Setup -- timeout-minutes: 150 -- -- name: AppleM-CMake (chunk ${{ matrix.chunk }}) -- -- strategy: -- fail-fast: false -- matrix: -- chunk: ${{ fromJSON(needs.Test-Setup.outputs.chunks) }} -- -- runs-on: macos-14 -- -- steps: -- - name: Select XCode version -- uses: maxim-lobanov/setup-xcode@v1 -- with: -- xcode-version: '15.2' -- -- - name: checkout -- uses: actions/checkout@v4 -- -- - name: install-deps -- run: sh/setup/install_macos_arm_deps.sh -- -- - name: cmake-test-64bit -- uses: ./.github/actions/cmake-test -- with: -- # disable openmp on ARM architecture, see souffle-lang/souffle#2476 -- cmake-flags: -DSOUFFLE_DOMAIN_64BIT=ON -DSOUFFLE_USE_OPENMP=OFF -- n-chunks: ${{ needs.Test-Setup.outputs.n-chunks }} -- chunk: ${{ matrix.chunk }} -- - Memory-Check: - needs: Test-Setup - timeout-minutes: 150 -@@ -183,16 +141,11 @@ jobs: - - steps: - - name: checkout -- uses: actions/checkout@v4 -+ uses: actions/checkout@v2 - - - name: install-deps - run: sudo sh/setup/install_ubuntu_deps.sh - -- - name: fix mmap_rnd_bits -- # issue with ubuntu:latest runner and ASAN -- # https://github.com/actions/runner-images/issues/9491 -- run: sudo sysctl vm.mmap_rnd_bits=28 -- - - name: cmake-test-32bit - uses: ./.github/actions/cmake-test - with: -@@ -208,7 +161,7 @@ jobs: - - steps: - - name: checkout -- uses: actions/checkout@v4 -+ uses: actions/checkout@v2 - with: - fetch-depth: 0 - -@@ -216,13 +169,13 @@ jobs: - run: sudo apt-get update && sudo apt-get install lcov - - - name: download-coverage-artifacts -- uses: actions/download-artifact@v4 -+ uses: actions/download-artifact@v2 - - - name: merge-coverage-report - run: lcov $(for i in coverage-*-*/coverage.info; do echo -a $i; done) --output-file coverage.info - - - name: upload-coverage-report -- uses: codecov/codecov-action@v4 -+ uses: codecov/codecov-action@v2 - with: - token: ${{ secrets.CODECOV_TOKEN }} - files: coverage.info -diff --git a/.github/workflows/VS-CI-Tests.yml b/.github/workflows/VS-CI-Tests.yml -index 3955a6f..3ba0030 100644 ---- a/.github/workflows/VS-CI-Tests.yml -+++ b/.github/workflows/VS-CI-Tests.yml -@@ -4,9 +4,6 @@ on: - pull_request: - types: [opened, synchronize] - workflow_dispatch: -- push: -- branches: -- - 'master' - - env: - CHOCO_CACHE_DIR: "${{ github.workspace }}/choco-cache" -@@ -16,10 +13,10 @@ jobs: - Windows-CMake-MSVC: - runs-on: windows-2019 - steps: -- - uses: actions/checkout@v4 -+ - uses: actions/checkout@v2 - - - name: Dependencies Cache -- uses: actions/cache@v3 -+ uses: actions/cache@v2 - env: - cache-name: cache-chocolatey - with: -@@ -32,18 +29,19 @@ jobs: - - name: Binary Dependencies (Chocolatey) - run: | - choco config set cacheLocation ${{ env.CHOCO_CACHE_DIR }} -- choco install choco-packages.config --no-progress --installargs 'ADD_CMAKE_TO_PATH=System' -+ choco install choco-packages.config --no-progress --installargs 'ADD_CMAKE_TO_PATH=""System""' - - # Use vcpkg to install devel library dependencies. - - name: Library Dependencies (vcpkg) -- uses: lukka/run-vcpkg@v11 -+ uses: lukka/run-vcpkg@v7 - with: -- vcpkgGitCommitId: '56954f1db97f38635782d5ad7cdfd45d2731c854' -+ vcpkgGitCommitId: 'af2287382b1991dbdcb7e5112d236f3323b9dd7a' -+ vcpkgTriplet: x64-windows -+ vcpkgArguments: 'sqlite3 zlib libffi' - - - name: Create Build Directory - working-directory: ${{github.workspace}} -- run: | -- mkdir build -+ run: mkdir build - - - name: Configure Build - working-directory: ${{github.workspace}} -@@ -51,7 +49,7 @@ jobs: - $env:ChocolateyInstall = Convert-Path "$((Get-Command choco).Path)\..\.." - Import-Module "$env:ChocolateyInstall\helpers\chocolateyProfile.psm1" - refreshenv -- cmake -S . -B build -G "Visual Studio 16 2019" -A x64 "-DCMAKE_TOOLCHAIN_FILE=${{env.VCPKG_ROOT}}/scripts/buildsystems/vcpkg.cmake" -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS=/bigobj -DSOUFFLE_DOMAIN_64BIT=ON -DCMAKE_FIND_LIBRARY_PREFIXES=";lib" -DCMAKE_FIND_LIBRARY_SUFFIXES=".lib;.dll" -DSOUFFLE_USE_CURSES=OFF -DSOUFFLE_USE_ZLIB=ON -DSOUFFLE_USE_SQLITE=ON -DCMAKE_FIND_DEBUG_MODE=FALSE -DSOUFFLE_BASH_COMPLETION=OFF -+ cmake -S . -B build -G "Visual Studio 16 2019" -A x64 "-DCMAKE_TOOLCHAIN_FILE=${{env.VCPKG_ROOT}}/scripts/buildsystems/vcpkg.cmake" -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS=/bigobj -DSOUFFLE_DOMAIN_64BIT=ON -DCMAKE_FIND_LIBRARY_PREFIXES=";lib" -DCMAKE_FIND_LIBRARY_SUFFIXES=".lib;.dll" -DSOUFFLE_USE_CURSES=OFF -DSOUFFLE_USE_ZLIB=ON -DCMAKE_FIND_DEBUG_MODE=FALSE -DSOUFFLE_BASH_COMPLETION=OFF - - - name: Build - working-directory: ${{github.workspace}} -diff --git a/.github/workflows/create-packages.yml b/.github/workflows/create-packages.yml -index 35531db..46f76c4 100644 ---- a/.github/workflows/create-packages.yml -+++ b/.github/workflows/create-packages.yml -@@ -15,14 +15,18 @@ jobs: - - release: oraclelinux-8 - extension: ".rpm" - OS-name: "el/8" -- - release: fedora-39 -+ - release: fedora-34 - extension: ".rpm" -- OS-name: "fedora/39" -+ OS-name: "fedora/34" -+ # build issue on fedora 35 -+ # - release: fedora-35 -+ # extension: ".rpm" -+ # OS-name: "fedora/35" - - runs-on: ubuntu-latest - steps: - - name: Checkout -- uses: actions/checkout@v4 -+ uses: actions/checkout@v2 - with: - fetch-depth: 0 - -@@ -37,14 +41,14 @@ jobs: - run: |- - docker cp container:/souffle/build/ . && - cd build && -- echo "pkg_name=$(ls *${{ matrix.extension }} | head -n1)" >> $GITHUB_OUTPUT -- echo "artifact_name=x86_64-${{ matrix.release }}-$(ls *${{ matrix.extension }} | head -n1)" >> $GITHUB_OUTPUT -+ echo "::set-output name=pkg_name::$(ls *${{ matrix.extension }} | head -n1)" -+ echo "::set-output name=artifact_name::x86_64-${{ matrix.release }}-$(ls *${{ matrix.extension }} | head -n1)" - - - name: Naming Artifact - run: cp build/${{ steps.extract_pkg.outputs.pkg_name }} build/${{ steps.extract_pkg.outputs.artifact_name }} - - - name: Upload Artifact -- uses: actions/upload-artifact@v3 -+ uses: actions/upload-artifact@v2 - with: - name: ${{ steps.extract_pkg.outputs.artifact_name }} - path: build/${{ steps.extract_pkg.outputs.artifact_name }} -@@ -53,14 +57,14 @@ jobs: - runs-on: ubuntu-latest - steps: - - name: Checkout -- uses: actions/checkout@v4 -+ uses: actions/checkout@v2 - with: - fetch-depth: 0 - - - name: Prepare - id: prepare - run: |- -- echo "release_tag=$(git describe --tags --always | sed "s/-.*$//")" >> $GITHUB_OUTPUT -+ echo "::set-output name=release_tag::$(git describe --tags --always | sed "s/-.*$//")" - - - name: Build Container - run: docker build ./.github/images/arch-linux/ -t package_builder -@@ -105,7 +109,7 @@ jobs: - runs-on: ubuntu-latest - steps: - - name: Download All Artifacts -- uses: actions/download-artifact@v3 -+ uses: actions/download-artifact@v2 - with: - path: ./downloads - -@@ -126,16 +130,16 @@ jobs: - needs: CPack-Package-Build - if: ${{ always() }} - -- runs-on: ubuntu-latest -+ runs-on: ubuntu-18.04 - steps: - - name: Checkout -- uses: actions/checkout@v4 -+ uses: actions/checkout@v2 - with: - fetch-depth: 0 - clean: false - - - name: Download All Artifacts -- uses: actions/download-artifact@v3 -+ uses: actions/download-artifact@v2 - with: - path: ./downloads - diff --git a/CMakeLists.txt b/CMakeLists.txt index 5ab514d..1204593 100644 --- a/CMakeLists.txt @@ -1447,10 +1074,22 @@ index c2ce37b..5c07576 100644 set(SOUFFLE_COMPILED_LINK_OPTIONS "/link ${SOUFFLE_COMPILED_LINK_OPTIONS}") diff --git a/src/DynamicLibrary.cpp b/src/DynamicLibrary.cpp new file mode 100644 -index 0000000..aeea973 +index 0000000..28be988 --- /dev/null +++ b/src/DynamicLibrary.cpp -@@ -0,0 +1,72 @@ +@@ -0,0 +1,84 @@ ++// Copyright (c), 2016-present, Sourcebrella, Inc Ltd - All rights reserved. ++// Unauthorized copying, using, modifying of this file, via any medium is strictly prohibited. ++// Proprietary and confidential. ++// ++// Alipay.com Inc. ++// Copyright (c) 2004 All Rights Reserved. ++// ++// Author: 冰莲 (lyn249877@antfin.com) ++// File Description: ++// Creation Date: 2022-01-28 ++// Modification History: ++ +#include +#include + @@ -1525,10 +1164,22 @@ index 0000000..aeea973 +} diff --git a/src/ExtraConfig.h b/src/ExtraConfig.h new file mode 100644 -index 0000000..24bdd29 +index 0000000..961a3aa --- /dev/null +++ b/src/ExtraConfig.h -@@ -0,0 +1,24 @@ +@@ -0,0 +1,36 @@ ++// Copyright (c), 2016-present, Sourcebrella, Inc Ltd - All rights reserved. ++// Unauthorized copying, using, modifying of this file, via any medium is strictly prohibited. ++// Proprietary and confidential. ++// ++// Alipay.com Inc. ++// Copyright (c) 2004 All Rights Reserved. ++// ++// Author: 冰莲 (lyn249877@antfin.com) ++// File Description: ++// Creation Date: 2022-01-28 ++// Modification History: ++ +#pragma once + +#ifndef GODEL_EXTRACONFIG_H @@ -1870,10 +1521,22 @@ index 1a84c08..498d9d8 100644 line << ";"; diff --git a/src/MainEntry.cpp b/src/MainEntry.cpp new file mode 100644 -index 0000000..948655e +index 0000000..a5a6416 --- /dev/null +++ b/src/MainEntry.cpp -@@ -0,0 +1,5 @@ +@@ -0,0 +1,17 @@ ++// Copyright (c), 2016-present, Sourcebrella, Inc Ltd - All rights reserved. ++// Unauthorized copying, using, modifying of this file, via any medium is strictly prohibited. ++// Proprietary and confidential. ++// ++// Alipay.com Inc. ++// Copyright (c) 2004 All Rights Reserved. ++// ++// Author: 冰莲 (lyn249877@antfin.com) ++// File Description: ++// Creation Date: 2021-09-15 ++// Modification History: ++ +namespace souffle { int main(int argc, char **argv); } + +int main(int argc, char** argv) { @@ -15436,10 +15099,10 @@ index 555ce8a..06449cd 100644 } } diff --git a/src/include/souffle/io/WriteStreamSQLite.h b/src/include/souffle/io/WriteStreamSQLite.h -index 240b6da..09f9218 100644 +index 240b6da..c51a180 100644 --- a/src/include/souffle/io/WriteStreamSQLite.h +++ b/src/include/souffle/io/WriteStreamSQLite.h -@@ -58,20 +58,30 @@ protected: +@@ -58,20 +58,27 @@ protected: void writeNextTuple(const RamDomain* tuple) override { for (std::size_t i = 0; i < arity; i++) { RamDomain value = 0; // Silence warning @@ -15447,10 +15110,7 @@ index 240b6da..09f9218 100644 switch (typeAttributes.at(i)[0]) { - case 's': value = getSymbolTableID(tuple[i]); break; -+ case 's': -+ value = getSymbolTableID(tuple[i]); -+ symvalue = symbolTable.decode(tuple[i]).c_str(); -+ break; ++ case 's': symvalue = symbolTable.decode(tuple[i]).c_str(); break; default: value = tuple[i]; break; } - @@ -15477,28 +15137,65 @@ index 240b6da..09f9218 100644 } } if (sqlite3_step(insertStatement) != SQLITE_DONE) { -@@ -192,18 +202,18 @@ private: +@@ -153,8 +160,8 @@ private: + + void prepareStatements() { + prepareInsertStatement(); +- prepareSymbolInsertStatement(); +- prepareSymbolSelectStatement(); ++ // prepareSymbolInsertStatement(); ++ // prepareSymbolSelectStatement(); + } + void prepareSymbolInsertStatement() { + std::stringstream insertSQL; +@@ -178,7 +185,7 @@ private: + + void prepareInsertStatement() { + std::stringstream insertSQL; +- insertSQL << "INSERT INTO '_" << relationName << "' VALUES "; ++ insertSQL << "INSERT INTO '" << relationName << "' VALUES "; + insertSQL << "(@V0"; + for (unsigned int i = 1; i < arity; i++) { + insertSQL << ",@V" << i; +@@ -192,23 +199,30 @@ private: void createTables() { createRelationTable(); - createRelationView(); - createSymbolTable(); -+ createRelationView(); +- createSymbolTable(); ++ // createSymbolTable(); ++ // createRelationView(); } void createRelationTable() { ++ const auto columnNames = params["relation"]["params"].array_items(); ++ std::stringstream createTableText; - createTableText << "CREATE TABLE IF NOT EXISTS '_" << relationName << "' ("; +- createTableText << "CREATE TABLE IF NOT EXISTS '_" << relationName << "' ("; ++ createTableText << "CREATE TABLE IF NOT EXISTS '" << relationName << "' ("; if (arity > 0) { - createTableText << "'0' INTEGER"; -+ createTableText << "'0' " << (typeAttributes.at(0)[0] == 's'? "TEXT":"INTEGER"); - for (unsigned int i = 1; i < arity; i++) { - createTableText << ",'" << std::to_string(i) << "' "; +- for (unsigned int i = 1; i < arity; i++) { +- createTableText << ",'" << std::to_string(i) << "' "; - createTableText << "INTEGER"; ++ for (unsigned int i = 0; i < arity; i++) { ++ const std::string tableColumnName = std::to_string(i); ++ const auto& realColumnName = ++ (columnNames[i].is_string() ? columnNames[i].string_value() : tableColumnName); ++ if (i) { ++ createTableText << ","; ++ } ++ createTableText << "'" << realColumnName << "' "; + createTableText << (typeAttributes.at(i)[0] == 's'? "TEXT":"INTEGER"); } } createTableText << ");"; + executeSQL(createTableText.str(), db); +- executeSQL("DELETE FROM '_" + relationName + "';", db); ++ executeSQL("DELETE FROM '" + relationName + "';", db); + } + + void createRelationView() { diff --git a/src/include/souffle/profile/Cell.h b/src/include/souffle/profile/Cell.h index 0ebd83e..a759495 100644 --- a/src/include/souffle/profile/Cell.h @@ -17006,7 +16703,7 @@ index 6b9a0fd..efba119 100644 } // namespace souffle::interpreter diff --git a/src/interpreter/Engine.cpp b/src/interpreter/Engine.cpp -index 41683d3..cb38b9f 100644 +index 41683d3..f46ba08 100644 --- a/src/interpreter/Engine.cpp +++ b/src/interpreter/Engine.cpp @@ -23,18 +23,16 @@ @@ -17117,7 +16814,7 @@ index 41683d3..cb38b9f 100644 RecordTable& Engine::getRecordTable() { return recordTable; } -@@ -339,6 +314,37 @@ ram::TranslationUnit& Engine::getTranslationUnit() { +@@ -339,6 +314,86 @@ ram::TranslationUnit& Engine::getTranslationUnit() { return tUnit; } @@ -17151,24 +16848,80 @@ index 41683d3..cb38b9f 100644 + } + return ""; +} ++ ++static const char* godel_lang_builtin_string_to_upper(const char *self) { ++ auto buffer = new char[strlen(self) + 1](); ++ std::transform(self, self + strlen(self), buffer, toupper); ++ return buffer; ++} ++ ++static const char* godel_lang_builtin_string_to_lower(const char *self) { ++ auto buffer = new char[strlen(self) + 1](); ++ std::transform(self, self + strlen(self), buffer, tolower); ++ return buffer; ++} ++ ++static const char* godel_lang_builtin_string_replace_all(const char *self, const char *pattern, const char* replacement) { ++ std::regex re(pattern); ++ std::stringstream ss; ++ std::regex_replace(std::ostreambuf_iterator(ss), self, self + strlen(self), re, replacement); ++ ++ const auto& res = ss.str(); ++ auto buffer = new char[res.length() + 1](); ++ std::strncpy(buffer, res.c_str(), res.length()); ++ buffer[res.length()] = 0; ++ return buffer; ++} ++ ++static const char* godel_lang_builtin_string_replace_once(const char *self, const char *pattern, const char* replacement, int index) { ++ std::regex re(pattern); ++ std::string result = self; ++ ++ std::string temp = result; ++ std::smatch match; ++ ++ size_t offset = 0; ++ size_t matched_index = 0; ++ while (std::regex_search(temp, match, re)) { ++ if (matched_index == static_cast(index)) { ++ result.replace(offset + match.position(), match.length(), replacement); ++ break; ++ } ++ ++matched_index; ++ offset += match.position() + match.length(); ++ temp = match.suffix().str(); ++ } ++ ++ auto buffer = new char[result.length() + 1](); ++ std::strncpy(buffer, result.c_str(), result.length()); ++ buffer[result.length()] = 0; ++ return buffer; ++} + void* Engine::getMethodHandle(const std::string& method) { for (void* libHandle : dll) { auto* methodHandle = dlsym(libHandle, method.c_str()); -@@ -346,6 +352,12 @@ void* Engine::getMethodHandle(const std::string& method) { +@@ -346,6 +401,19 @@ void* Engine::getMethodHandle(const std::string& method) { return methodHandle; } } ++ + // TODO: Given from Gödel -+ if (method == "get_field_by_index") { -+ return reinterpret_cast(get_field_by_index); -+ } else if (method == "godel_lang_builtin_string_getMatchResult") { -+ return reinterpret_cast(godel_lang_builtin_string_getMatchResult); ++ static std::unordered_map mapper = { ++ {"get_field_by_index", reinterpret_cast(get_field_by_index)}, ++ {"godel_lang_builtin_string_getMatchResult", reinterpret_cast(godel_lang_builtin_string_getMatchResult)}, ++ {"godel_lang_builtin_string_to_upper", reinterpret_cast(godel_lang_builtin_string_to_upper)}, ++ {"godel_lang_builtin_string_to_lower", reinterpret_cast(godel_lang_builtin_string_to_lower)}, ++ {"godel_lang_builtin_string_replace_all", reinterpret_cast(godel_lang_builtin_string_replace_all)}, ++ {"godel_lang_builtin_string_replace_once", reinterpret_cast(godel_lang_builtin_string_replace_once)} ++ }; ++ if (mapper.count(method)) { ++ return mapper.at(method); + } return nullptr; } -@@ -359,13 +371,13 @@ void Engine::createRelation(const ram::Relation& id, const std::size_t idx) { +@@ -359,13 +427,13 @@ void Engine::createRelation(const ram::Relation& id, const std::size_t idx) { } RelationHandle res; @@ -17186,7 +16939,7 @@ index 41683d3..cb38b9f 100644 } else { res = createBTreeRelation(id, isa.getIndexSelection(id.getName())); } -@@ -377,19 +389,19 @@ const std::vector& Engine::loadDLL() { +@@ -377,19 +445,19 @@ const std::vector& Engine::loadDLL() { return dll; } @@ -17212,7 +16965,7 @@ index 41683d3..cb38b9f 100644 // Set up our paths to have a library appended for (std::string& path : paths) { if (path.back() != pathSeparator) { -@@ -406,11 +418,7 @@ const std::vector& Engine::loadDLL() { +@@ -406,11 +474,7 @@ const std::vector& Engine::loadDLL() { void* tmp = nullptr; for (const std::string& path : paths) { std::string fullpath = path + "lib" + library + dynamicLibSuffix; @@ -17224,7 +16977,7 @@ index 41683d3..cb38b9f 100644 if (tmp != nullptr) { dll.push_back(tmp); break; -@@ -424,18 +432,16 @@ const std::vector& Engine::loadDLL() { +@@ -424,18 +488,16 @@ const std::vector& Engine::loadDLL() { std::size_t Engine::getIterationNumber() const { return iteration; } @@ -17244,7 +16997,7 @@ index 41683d3..cb38b9f 100644 SignalHandler::instance()->enableLogging(); } -@@ -450,7 +456,7 @@ void Engine::executeMain() { +@@ -450,7 +512,7 @@ void Engine::executeMain() { Context ctxt; execute(main.get(), ctxt); } else { @@ -17253,7 +17006,7 @@ index 41683d3..cb38b9f 100644 // Prepare the frequency table for threaded use const ram::Program& program = tUnit.getProgram(); visit(program, [&](const ram::TupleOperation& node) { -@@ -463,7 +469,7 @@ void Engine::executeMain() { +@@ -463,7 +525,7 @@ void Engine::executeMain() { ProfileEventSingleton::instance().startTimer(); ProfileEventSingleton::instance().makeTimeEvent("@time;starttime"); // Store configuration @@ -17262,7 +17015,7 @@ index 41683d3..cb38b9f 100644 for (auto&& v : vs) ProfileEventSingleton::instance().makeConfigRecord(k, v); -@@ -482,8 +488,6 @@ void Engine::executeMain() { +@@ -482,8 +544,6 @@ void Engine::executeMain() { visit(program, [&](const ram::Query&) { ++ruleCount; }); ProfileEventSingleton::instance().makeConfigRecord("ruleCount", std::to_string(ruleCount)); @@ -17271,7 +17024,7 @@ index 41683d3..cb38b9f 100644 Context ctxt; execute(main.get(), ctxt); ProfileEventSingleton::instance().stopTimer(); -@@ -506,7 +510,7 @@ void Engine::generateIR() { +@@ -506,7 +566,7 @@ void Engine::generateIR() { NodeGenerator generator(*this); if (subroutine.empty()) { for (const auto& sub : program.getSubroutines()) { @@ -17280,7 +17033,7 @@ index 41683d3..cb38b9f 100644 } } if (main == nullptr) { -@@ -520,7 +524,10 @@ void Engine::executeSubroutine( +@@ -520,7 +580,10 @@ void Engine::executeSubroutine( ctxt.setReturnValues(ret); ctxt.setArguments(args); generateIR(); @@ -17292,7 +17045,7 @@ index 41683d3..cb38b9f 100644 } RamDomain Engine::execute(const Node* node, Context& ctxt) { -@@ -531,9 +538,9 @@ RamDomain Engine::execute(const Node* node, Context& ctxt) { +@@ -531,9 +594,9 @@ RamDomain Engine::execute(const Node* node, Context& ctxt) { // Overload CASE based on number of arguments. // CASE(Kind) -> BASE_CASE(Kind) @@ -17305,7 +17058,7 @@ index 41683d3..cb38b9f 100644 #define BASE_CASE(Kind) \ case (I_##Kind): { \ -@@ -541,12 +548,12 @@ RamDomain Engine::execute(const Node* node, Context& ctxt) { +@@ -541,12 +604,12 @@ RamDomain Engine::execute(const Node* node, Context& ctxt) { [[maybe_unused]] const auto& shadow = *static_cast(node); \ [[maybe_unused]] const auto& cur = *static_cast(node->getShadow()); // EXTEND_CASE also defer the relation type @@ -17321,7 +17074,7 @@ index 41683d3..cb38b9f 100644 #define ESAC(Kind) \ } \ (); \ -@@ -580,10 +587,6 @@ RamDomain Engine::execute(const Node* node, Context& ctxt) { +@@ -580,10 +643,6 @@ RamDomain Engine::execute(const Node* node, Context& ctxt) { return cur.getConstant(); ESAC(NumericConstant) @@ -17332,7 +17085,7 @@ index 41683d3..cb38b9f 100644 CASE(StringConstant) return shadow.getConstant(); ESAC(StringConstant) -@@ -597,7 +600,7 @@ RamDomain Engine::execute(const Node* node, Context& ctxt) { +@@ -597,7 +656,7 @@ RamDomain Engine::execute(const Node* node, Context& ctxt) { ESAC(AutoIncrement) CASE(IntrinsicOperator) @@ -17341,7 +17094,7 @@ index 41683d3..cb38b9f 100644 #define BINARY_OP_TYPED(ty, op) return ramBitCast(static_cast(EVAL_CHILD(ty, 0) op EVAL_CHILD(ty, 1))) #define BINARY_OP_LOGICAL(opcode, op) BINARY_OP_INTEGRAL(opcode, op) -@@ -618,7 +621,7 @@ RamDomain Engine::execute(const Node* node, Context& ctxt) { +@@ -618,7 +677,7 @@ RamDomain Engine::execute(const Node* node, Context& ctxt) { { \ auto result = EVAL_CHILD(RamDomain, 0); \ auto* result_val = &getSymbolTable().decode(result); \ @@ -17350,7 +17103,7 @@ index 41683d3..cb38b9f 100644 auto alt = EVAL_CHILD(RamDomain, i); \ if (alt == result) continue; \ \ -@@ -633,7 +636,7 @@ RamDomain Engine::execute(const Node* node, Context& ctxt) { +@@ -633,7 +692,7 @@ RamDomain Engine::execute(const Node* node, Context& ctxt) { #define MINMAX_OP(ty, op) \ { \ auto result = EVAL_CHILD(ty, 0); \ @@ -17359,7 +17112,7 @@ index 41683d3..cb38b9f 100644 result = op(result, EVAL_CHILD(ty, i)); \ } \ return ramBitCast(result); \ -@@ -655,7 +658,7 @@ RamDomain Engine::execute(const Node* node, Context& ctxt) { +@@ -655,7 +714,7 @@ RamDomain Engine::execute(const Node* node, Context& ctxt) { getSymbolTable().decode(EVAL_CHILD(RamDomain, 0)))); // clang-format on @@ -17368,7 +17121,7 @@ index 41683d3..cb38b9f 100644 switch (cur.getOperator()) { /** Unary Functor Operators */ case FunctorOp::ORD: return execute(shadow.getChild(0), ctxt); -@@ -763,7 +766,7 @@ RamDomain Engine::execute(const Node* node, Context& ctxt) { +@@ -763,7 +822,7 @@ RamDomain Engine::execute(const Node* node, Context& ctxt) { case FunctorOp::CAT: { std::stringstream ss; @@ -17377,7 +17130,7 @@ index 41683d3..cb38b9f 100644 ss << getSymbolTable().decode(execute(shadow.getChild(i), ctxt)); } return getSymbolTable().encode(ss.str()); -@@ -777,7 +780,7 @@ RamDomain Engine::execute(const Node* node, Context& ctxt) { +@@ -777,7 +836,7 @@ RamDomain Engine::execute(const Node* node, Context& ctxt) { std::string sub_str; try { sub_str = str.substr(idx, len); @@ -17386,7 +17139,7 @@ index 41683d3..cb38b9f 100644 std::cerr << "warning: wrong index position provided by substr(\""; std::cerr << str << "\"," << (int32_t)idx << "," << (int32_t)len << ") functor.\n"; } -@@ -788,17 +791,9 @@ RamDomain Engine::execute(const Node* node, Context& ctxt) { +@@ -788,17 +847,9 @@ RamDomain Engine::execute(const Node* node, Context& ctxt) { case FunctorOp::URANGE: case FunctorOp::FRANGE: fatal("ICE: functor `%s` must map onto `NestedIntrinsicOperator`", cur.getOperator()); @@ -17405,7 +17158,7 @@ index 41683d3..cb38b9f 100644 #undef BINARY_OP_LOGICAL #undef BINARY_OP_INTEGRAL -@@ -814,8 +809,8 @@ RamDomain Engine::execute(const Node* node, Context& ctxt) { +@@ -814,8 +865,8 @@ RamDomain Engine::execute(const Node* node, Context& ctxt) { ESAC(IntrinsicOperator) CASE(NestedIntrinsicOperator) @@ -17416,7 +17169,7 @@ index 41683d3..cb38b9f 100644 ctxt[cur.getTupleId()] = tuple.data(); execute(shadow.getChild(numArgs), ctxt); }; -@@ -832,7 +827,7 @@ RamDomain Engine::execute(const Node* node, Context& ctxt) { +@@ -832,7 +883,7 @@ RamDomain Engine::execute(const Node* node, Context& ctxt) { case ram::NestedIntrinsicOp::FRANGE: return RUN_RANGE(RamFloat); } @@ -17425,7 +17178,7 @@ index 41683d3..cb38b9f 100644 #undef RUN_RANGE ESAC(NestedIntrinsicOperator) -@@ -841,7 +836,7 @@ RamDomain Engine::execute(const Node* node, Context& ctxt) { +@@ -841,7 +892,7 @@ RamDomain Engine::execute(const Node* node, Context& ctxt) { auto userFunctor = reinterpret_cast(shadow.getFunctionPointer()); if (userFunctor == nullptr) fatal("cannot find user-defined operator `%s`", name); @@ -17434,7 +17187,7 @@ index 41683d3..cb38b9f 100644 if (cur.isStateful()) { auto exec = std::bind(&Engine::execute, this, std::placeholders::_1, std::placeholders::_2); -@@ -961,7 +956,8 @@ RamDomain Engine::execute(const Node* node, Context& ctxt) { +@@ -961,7 +1012,8 @@ RamDomain Engine::execute(const Node* node, Context& ctxt) { ESAC(UserDefinedOperator) CASE(PackRecord) @@ -17444,7 +17197,7 @@ index 41683d3..cb38b9f 100644 std::unique_ptr data = std::make_unique(arity); for (std::size_t i = 0; i < arity; ++i) { data[i] = execute(shadow.getChild(i), ctxt); -@@ -989,8 +985,8 @@ RamDomain Engine::execute(const Node* node, Context& ctxt) { +@@ -989,8 +1041,8 @@ RamDomain Engine::execute(const Node* node, Context& ctxt) { return !execute(shadow.getChild(), ctxt); ESAC(Negation) @@ -17455,7 +17208,7 @@ index 41683d3..cb38b9f 100644 const auto& rel = *static_cast(shadow.getRelation()); \ return rel.empty(); \ ESAC(EmptinessCheck) -@@ -998,8 +994,8 @@ RamDomain Engine::execute(const Node* node, Context& ctxt) { +@@ -998,8 +1050,8 @@ RamDomain Engine::execute(const Node* node, Context& ctxt) { FOR_EACH(EMPTINESS_CHECK) #undef EMPTINESS_CHECK @@ -17466,7 +17219,7 @@ index 41683d3..cb38b9f 100644 const auto& rel = *static_cast(shadow.getRelation()); \ return rel.size(); \ ESAC(RelationSize) -@@ -1007,17 +1003,17 @@ RamDomain Engine::execute(const Node* node, Context& ctxt) { +@@ -1007,17 +1059,17 @@ RamDomain Engine::execute(const Node* node, Context& ctxt) { FOR_EACH(RELATION_SIZE) #undef RELATION_SIZE @@ -17490,7 +17243,7 @@ index 41683d3..cb38b9f 100644 ESAC(ProvenanceExistenceCheck) FOR_EACH_PROVENANCE(PROVENANCE_EXISTENCE_CHECK) -@@ -1049,53 +1045,30 @@ RamDomain Engine::execute(const Node* node, Context& ctxt) { +@@ -1049,53 +1101,30 @@ RamDomain Engine::execute(const Node* node, Context& ctxt) { COMPARE(GE, >=) case BinaryConstraintOp::MATCH: { @@ -17560,7 +17313,7 @@ index 41683d3..cb38b9f 100644 } return result; } -@@ -1115,7 +1088,7 @@ RamDomain Engine::execute(const Node* node, Context& ctxt) { +@@ -1115,7 +1144,7 @@ RamDomain Engine::execute(const Node* node, Context& ctxt) { } } @@ -17569,7 +17322,7 @@ index 41683d3..cb38b9f 100644 #undef COMPARE_NUMERIC #undef COMPARE_STRING -@@ -1138,8 +1111,8 @@ RamDomain Engine::execute(const Node* node, Context& ctxt) { +@@ -1138,8 +1167,8 @@ RamDomain Engine::execute(const Node* node, Context& ctxt) { return result; ESAC(TupleOperation) @@ -17580,7 +17333,7 @@ index 41683d3..cb38b9f 100644 const auto& rel = *static_cast(shadow.getRelation()); \ return evalScan(rel, cur, shadow, ctxt); \ ESAC(Scan) -@@ -1147,24 +1120,24 @@ RamDomain Engine::execute(const Node* node, Context& ctxt) { +@@ -1147,24 +1176,24 @@ RamDomain Engine::execute(const Node* node, Context& ctxt) { FOR_EACH(SCAN) #undef SCAN @@ -17611,7 +17364,7 @@ index 41683d3..cb38b9f 100644 const auto& rel = *static_cast(shadow.getRelation()); \ return evalParallelIndexScan(rel, cur, shadow, ctxt); \ ESAC(ParallelIndexScan) -@@ -1172,8 +1145,8 @@ RamDomain Engine::execute(const Node* node, Context& ctxt) { +@@ -1172,8 +1201,8 @@ RamDomain Engine::execute(const Node* node, Context& ctxt) { FOR_EACH(PARALLEL_INDEX_SCAN) #undef PARALLEL_INDEX_SCAN @@ -17622,7 +17375,7 @@ index 41683d3..cb38b9f 100644 const auto& rel = *static_cast(shadow.getRelation()); \ return evalIfExists(rel, cur, shadow, ctxt); \ ESAC(IfExists) -@@ -1181,8 +1154,8 @@ RamDomain Engine::execute(const Node* node, Context& ctxt) { +@@ -1181,8 +1210,8 @@ RamDomain Engine::execute(const Node* node, Context& ctxt) { FOR_EACH(IFEXISTS) #undef IFEXISTS @@ -17633,7 +17386,7 @@ index 41683d3..cb38b9f 100644 const auto& rel = *static_cast(shadow.getRelation()); \ return evalParallelIfExists(rel, cur, shadow, ctxt); \ ESAC(ParallelIfExists) -@@ -1190,16 +1163,16 @@ RamDomain Engine::execute(const Node* node, Context& ctxt) { +@@ -1190,16 +1219,16 @@ RamDomain Engine::execute(const Node* node, Context& ctxt) { FOR_EACH(PARALLEL_IFEXISTS) #undef PARALLEL_IFEXISTS @@ -17654,7 +17407,7 @@ index 41683d3..cb38b9f 100644 const auto& rel = *static_cast(shadow.getRelation()); \ return evalParallelIndexIfExists(rel, cur, shadow, ctxt); \ ESAC(ParallelIndexIfExists) -@@ -1226,8 +1199,8 @@ RamDomain Engine::execute(const Node* node, Context& ctxt) { +@@ -1226,8 +1255,8 @@ RamDomain Engine::execute(const Node* node, Context& ctxt) { return execute(shadow.getNestedOperation(), ctxt); ESAC(UnpackRecord) @@ -17665,7 +17418,7 @@ index 41683d3..cb38b9f 100644 const auto& rel = *static_cast(shadow.getRelation()); \ return evalParallelAggregate(rel, cur, shadow, ctxt); \ ESAC(ParallelAggregate) -@@ -1235,25 +1208,26 @@ RamDomain Engine::execute(const Node* node, Context& ctxt) { +@@ -1235,25 +1264,26 @@ RamDomain Engine::execute(const Node* node, Context& ctxt) { FOR_EACH(PARALLEL_AGGREGATE) #undef PARALLEL_AGGREGATE @@ -17701,7 +17454,7 @@ index 41683d3..cb38b9f 100644 return evalIndexAggregate(cur, shadow, ctxt); \ ESAC(IndexAggregate) -@@ -1286,8 +1260,8 @@ RamDomain Engine::execute(const Node* node, Context& ctxt) { +@@ -1286,8 +1316,8 @@ RamDomain Engine::execute(const Node* node, Context& ctxt) { return result; ESAC(Filter) @@ -17712,7 +17465,7 @@ index 41683d3..cb38b9f 100644 auto& rel = *static_cast(shadow.getRelation()); \ return evalGuardedInsert(rel, shadow, ctxt); \ ESAC(GuardedInsert) -@@ -1295,8 +1269,8 @@ RamDomain Engine::execute(const Node* node, Context& ctxt) { +@@ -1295,8 +1325,8 @@ RamDomain Engine::execute(const Node* node, Context& ctxt) { FOR_EACH(GUARDED_INSERT) #undef GUARDED_INSERT @@ -17723,7 +17476,7 @@ index 41683d3..cb38b9f 100644 auto& rel = *static_cast(shadow.getRelation()); \ return evalInsert(rel, shadow, ctxt); \ ESAC(Insert) -@@ -1304,18 +1278,18 @@ RamDomain Engine::execute(const Node* node, Context& ctxt) { +@@ -1304,18 +1334,18 @@ RamDomain Engine::execute(const Node* node, Context& ctxt) { FOR_EACH(INSERT) #undef INSERT @@ -17748,7 +17501,7 @@ index 41683d3..cb38b9f 100644 if (shadow.getChild(i) == nullptr) { ctxt.addReturnValue(0); } else { -@@ -1345,11 +1319,9 @@ RamDomain Engine::execute(const Node* node, Context& ctxt) { +@@ -1345,11 +1375,9 @@ RamDomain Engine::execute(const Node* node, Context& ctxt) { CASE(Loop) resetIterationNumber(); @@ -17760,7 +17513,7 @@ index 41683d3..cb38b9f 100644 resetIterationNumber(); return true; ESAC(Loop) -@@ -1374,23 +1346,27 @@ RamDomain Engine::execute(const Node* node, Context& ctxt) { +@@ -1374,23 +1402,27 @@ RamDomain Engine::execute(const Node* node, Context& ctxt) { return execute(shadow.getChild(), ctxt); ESAC(DebugInfo) @@ -17775,12 +17528,12 @@ index 41683d3..cb38b9f 100644 + rel.__purge(); \ + return true; \ + ESAC(Clear) ++ ++ FOR_EACH(CLEAR) ++#undef CLEAR -#define ESTIMATEJOINSIZE(Structure, Arity, AuxiliaryArity, ...) \ - CASE(EstimateJoinSize, Structure, Arity, AuxiliaryArity) \ -+ FOR_EACH(CLEAR) -+#undef CLEAR -+ +#define COUNTUNIQUEKEYS(Structure, Arity, ...) \ + CASE(CountUniqueKeys, Structure, Arity) \ const auto& rel = *static_cast(shadow.getRelation()); \ @@ -17800,7 +17553,7 @@ index 41683d3..cb38b9f 100644 return true; ESAC(Call) -@@ -1413,7 +1389,6 @@ RamDomain Engine::execute(const Node* node, Context& ctxt) { +@@ -1413,7 +1445,6 @@ RamDomain Engine::execute(const Node* node, Context& ctxt) { ->readAll(rel); } catch (std::exception& e) { std::cerr << "Error loading " << rel.getName() << " data: " << e.what() << "\n"; @@ -17808,7 +17561,7 @@ index 41683d3..cb38b9f 100644 } return true; } else if (op == "output" || op == "printsize") { -@@ -1481,13 +1456,6 @@ RamDomain Engine::execute(const Node* node, Context& ctxt) { +@@ -1481,13 +1512,6 @@ RamDomain Engine::execute(const Node* node, Context& ctxt) { swapRelation(shadow.getSourceId(), shadow.getTargetId()); return true; ESAC(Swap) @@ -17822,7 +17575,7 @@ index 41683d3..cb38b9f 100644 } UNREACHABLE_BAD_CASE_ANALYSIS -@@ -1602,7 +1570,7 @@ RamDomain Engine::evalParallelScan( +@@ -1602,7 +1626,7 @@ RamDomain Engine::evalParallelScan( const Rel& rel, const ram::ParallelScan& cur, const ParallelScan& shadow, Context& ctxt) { auto viewContext = shadow.getViewContext(); @@ -17831,7 +17584,7 @@ index 41683d3..cb38b9f 100644 PARALLEL_START Context newCtxt(ctxt); -@@ -1630,8 +1598,8 @@ RamDomain Engine::evalParallelScan( +@@ -1630,8 +1654,8 @@ RamDomain Engine::evalParallelScan( } template @@ -17842,7 +17595,7 @@ index 41683d3..cb38b9f 100644 (void)ctxt; constexpr std::size_t Arity = Rel::Arity; bool onlyConstants = true; -@@ -1681,8 +1649,8 @@ RamDomain Engine::evalEstimateJoinSize( +@@ -1681,8 +1705,8 @@ RamDomain Engine::evalEstimateJoinSize( // ensure range is non-empty auto* index = rel.getIndex(indexPos); // initial values @@ -17853,7 +17606,7 @@ index 41683d3..cb38b9f 100644 if (!index->scan().empty()) { // assign first tuple as prev as a dummy -@@ -1710,14 +1678,14 @@ RamDomain Engine::evalEstimateJoinSize( +@@ -1710,14 +1734,14 @@ RamDomain Engine::evalEstimateJoinSize( ++total; } } @@ -17870,7 +17623,7 @@ index 41683d3..cb38b9f 100644 bool first = true; for (auto& [k, constant] : cur.getConstantsMap()) { if (first) { -@@ -1727,18 +1695,18 @@ RamDomain Engine::evalEstimateJoinSize( +@@ -1727,18 +1751,18 @@ RamDomain Engine::evalEstimateJoinSize( } constantsStream << k << "->" << *constant; } @@ -17894,7 +17647,7 @@ index 41683d3..cb38b9f 100644 } return true; } -@@ -1777,7 +1745,7 @@ RamDomain Engine::evalParallelIndexScan( +@@ -1777,7 +1801,7 @@ RamDomain Engine::evalParallelIndexScan( CAL_SEARCH_BOUND(superInfo, low, high); std::size_t indexPos = shadow.getViewId(); @@ -17903,7 +17656,7 @@ index 41683d3..cb38b9f 100644 PARALLEL_START Context newCtxt(ctxt); auto viewInfo = viewContext->getViewInfoForNested(); -@@ -1822,7 +1790,7 @@ RamDomain Engine::evalParallelIfExists( +@@ -1822,7 +1846,7 @@ RamDomain Engine::evalParallelIfExists( const Rel& rel, const ram::ParallelIfExists& cur, const ParallelIfExists& shadow, Context& ctxt) { auto viewContext = shadow.getViewContext(); @@ -17912,7 +17665,7 @@ index 41683d3..cb38b9f 100644 auto viewInfo = viewContext->getViewInfoForNested(); PARALLEL_START Context newCtxt(ctxt); -@@ -1886,7 +1854,7 @@ RamDomain Engine::evalParallelIndexIfExists(const Rel& rel, const ram::ParallelI +@@ -1886,7 +1910,7 @@ RamDomain Engine::evalParallelIndexIfExists(const Rel& rel, const ram::ParallelI CAL_SEARCH_BOUND(superInfo, low, high); std::size_t indexPos = shadow.getViewId(); @@ -17921,7 +17674,7 @@ index 41683d3..cb38b9f 100644 PARALLEL_START Context newCtxt(ctxt); -@@ -1914,68 +1882,49 @@ RamDomain Engine::evalParallelIndexIfExists(const Rel& rel, const ram::ParallelI +@@ -1914,68 +1938,49 @@ RamDomain Engine::evalParallelIndexIfExists(const Rel& rel, const ram::ParallelI return true; } @@ -18026,7 +17779,7 @@ index 41683d3..cb38b9f 100644 for (const auto& tuple : ranges) { ctxt[aggregate.getTupleId()] = tuple.data(); -@@ -1986,11 +1935,8 @@ RamDomain Engine::evalAggregate( +@@ -1986,11 +1991,8 @@ RamDomain Engine::evalAggregate( shouldRunNested = true; @@ -18039,7 +17792,7 @@ index 41683d3..cb38b9f 100644 ++res; continue; } -@@ -1999,56 +1945,43 @@ RamDomain Engine::evalAggregate( +@@ -1999,56 +2001,43 @@ RamDomain Engine::evalAggregate( assert(expression); // only case where this is null is `COUNT` RamDomain val = execute(expression, ctxt); @@ -18126,7 +17879,7 @@ index 41683d3..cb38b9f 100644 // write result to environment souffle::Tuple tuple; -@@ -2072,7 +2005,8 @@ RamDomain Engine::evalParallelAggregate( +@@ -2072,7 +2061,8 @@ RamDomain Engine::evalParallelAggregate( for (const auto& info : viewInfo) { newCtxt.createView(*getRelationHandle(info[0]), info[1], info[2]); } @@ -18136,7 +17889,7 @@ index 41683d3..cb38b9f 100644 } template -@@ -2097,7 +2031,8 @@ RamDomain Engine::evalParallelIndexAggregate( +@@ -2097,7 +2087,8 @@ RamDomain Engine::evalParallelIndexAggregate( std::size_t viewId = shadow.getViewId(); auto view = Rel::castView(newCtxt.getView(viewId)); @@ -18146,7 +17899,7 @@ index 41683d3..cb38b9f 100644 } template -@@ -2113,7 +2048,8 @@ RamDomain Engine::evalIndexAggregate( +@@ -2113,7 +2104,8 @@ RamDomain Engine::evalIndexAggregate( std::size_t viewId = shadow.getViewId(); auto view = Rel::castView(ctxt.getView(viewId)); diff --git a/godel-script/godel-frontend/src/ast/expr.h b/godel-script/godel-frontend/src/ast/expr.h index 3f61de6f..4bd5a3b2 100644 --- a/godel-script/godel-frontend/src/ast/expr.h +++ b/godel-script/godel-frontend/src/ast/expr.h @@ -306,8 +306,9 @@ class call_head: public expr { func_call* call; initializer* ini; +private: // mark schema(xxx) is schema::__all__(xxx) - bool schema_loader; + bool flag_is_schema_loader; private: void check_call_and_init() { @@ -321,20 +322,22 @@ class call_head: public expr { call_head(const span& location): expr(ast_class::ac_call_head, location), first(nullptr), call(nullptr), ini(nullptr), - schema_loader(false) {} + flag_is_schema_loader(false) {} ~call_head() override; void set_first_expression(expr* node) { first = node; } void set_func_call(func_call* node) { call = node; check_call_and_init(); } void set_initializer(initializer* node) { ini = node; check_call_and_init(); } - void set_is_schema_loader() { schema_loader = true; } + void set_is_schema_loader() { flag_is_schema_loader = true; } +public: expr* get_first_expression() { return first; } bool has_func_call() const { return call!=nullptr; } func_call* get_func_call() { return call; } bool is_initializer() const { return ini!=nullptr; } initializer* get_initializer() { return ini; } - bool is_schema_loader() const { return schema_loader; } + bool is_schema_loader() const { return flag_is_schema_loader; } +public: void accept(ast_visitor* visitor) override; }; diff --git a/godel-script/godel-frontend/src/cli.cpp b/godel-script/godel-frontend/src/cli.cpp index 2e7709f8..ba91f0fc 100644 --- a/godel-script/godel-frontend/src/cli.cpp +++ b/godel-script/godel-frontend/src/cli.cpp @@ -42,10 +42,12 @@ std::ostream& help(std::ostream& out) { << reset << "\nUsage: ./godel " << green << "[options] \n\n" << reset << "Compile options:\n" + << green << " -### " + << reset << "Print detailed compilation commands (not run).\n" << green << " -s, --souffle " << reset << "Output generated souffle to file.\n" << green << " -r, --run-souffle " - << reset << "Run compiled godel script program directly.\n" + << reset << "Run compiled godel script program.\n" << green << " -p, --package-path " << reset << "Give godelscript package root path.\n" << green << " -f, --fact " @@ -53,7 +55,7 @@ std::ostream& help(std::ostream& out) { << green << " -e, --extract-template " << reset << "Extract probable script template.\n" << green << " -l, --location-extract " - << reset << "Extract all functions and methods location into json.\n"; + << reset << "Extract function and method location into json.\n"; out << reset << "\nInformation dump options:\n" << green << " -h, --help " @@ -81,7 +83,9 @@ std::ostream& help(std::ostream& out) { << green << " --dump-lsp " << reset << "Show semantic result in json format.\n" << green << " --lsp-dump-use-indexed-file " - << reset << "Use file index instead of string.\n"; + << reset << "Use file index instead of string.\n" + << green << " --lsp-dump-only-schema " + << reset << "Only dump schema without location.\n"; out << reset << "\nLexical analysis dump options:\n" << green << " --lexer-dump-token " @@ -93,25 +97,33 @@ std::ostream& help(std::ostream& out) { << green << " --semantic-only " << reset << "Only do semantic analysis and exit.\n" << green << " --semantic-pub-check " - << reset << "Enable semantic public access authority checker.\n" - << green << " --semantic-no-else " - << reset << "Enable semantic no else branch checker.\n"; + << reset << "Enable semantic public access authority checker.\n"; out << reset << "\nSouffle code generation options:\n" + << green << " -O1 " + << reset << "Enable souffle code generator optimizer, level 1.\n" + << green << " -O2 " + << reset << "Enable souffle code generator optimizer, level 2.\n" + << green << " -O3 " + << reset << "Enable souffle code generator optimizer, level 3.\n" << green << " -Of, --opt-for " << reset << "Enable souffle code generator for statement optimizer.\n" << green << " -Ol, --opt-let " << reset << "Enable souffle code generator let statement optimizer(not suggested).\n" - << green << " -Oim, --opt-ir-merge " - << reset << "Enable souffle inst combine pass (Experimental).\n" << green << " -Osc, --opt-self-constraint " << reset << "Enable self data constraint optimizer in souffle code generator.\n" + << green << " -Ojr, --opt-join-reorder " + << reset << "Enable join reorder optimizer(experimental).\n" + << green << " --disable-inst-combine " + << reset << "Disable instruction combine pass.\n" << green << " --disable-remove-unused " << reset << "Disable unused method deletion pass.\n" << green << " --disable-do-schema-opt " << reset << "Disable DO Schema data constraint __all__ method optimization.\n" << green << " --souffle-debug " - << reset << "Dump generated souffle code by stdout.\n" + << reset << "Dump generated souffle code by stdout.\n"; + out + << reset << "\nSouffle execution options:\n" << green << " --souffle-slow-transformers " << reset << "Enable Souffle slow transformers.\n" << green << " --enable-souffle-profiling " @@ -125,7 +137,9 @@ std::ostream& help(std::ostream& out) { << green << " --output-csv " << reset << "Redirect stdout souffle execution result into csv.\n" << green << " --output-sqlite " - << reset << "Redirect stdout souffle execution result into sqlite.\n"; + << reset << "Redirect stdout souffle execution result into sqlite.\n" + << green << " -Drs, --directly-run-souffle " + << reset << "Directly run input souffle source.\n"; out << "\n"; return out; @@ -168,9 +182,53 @@ void report_invalid_argument(const std::string& arg) { report::error().fatal(info); } +void dump_configure(const configure& conf) { + if (conf.empty()) { + return; + } + + std::unordered_map mapper = { + {option::cli_executable_path, "executable"}, + {option::cli_input_path, "input-script"} + }; + + for(const auto& i : settings) { + if (mapper.count(i.second.command_type) && + mapper.at(i.second.command_type).length()>i.first.length()) { + continue; + } + mapper[i.second.command_type] = i.first; + } + for(const auto& i : options) { + if (mapper.count(i.second) && + mapper.at(i.second).length()>i.first.length()) { + continue; + } + mapper[i.second] = i.first; + } + + std::clog << conf.at(option::cli_executable_path) << " "; + std::clog << conf.at(option::cli_input_path); + for(const auto& i : mapper) { + if (i.first == option::cli_executable_path || + i.first == option::cli_input_path) { + continue; + } + if (!conf.count(i.first)) { + continue; + } + std::clog << " " << i.second; + if (conf.at(i.first).length()) { + std::clog << " " << conf.at(i.first); + } + } + std::clog << "\n\n"; +} + configure process_args(const std::vector& vec) { configure config = { - {option::cli_executable_path, vec[0]} // load executable path here + // load executable path here + { option::cli_executable_path, vec[0] } }; report::error err; @@ -178,6 +236,10 @@ configure process_args(const std::vector& vec) { const auto& arg = vec[i]; if (options.count(arg)) { config[options.at(arg)] = ""; + } else if (multi_options.count(arg)) { + for(auto o : multi_options.at(arg)) { + config[o] = ""; + } } else if (settings.count(arg)) { ++i; if (i>=vec.size() || vec[i][0]=='-') { @@ -213,6 +275,11 @@ configure process_args(const std::vector& vec) { err.fatal("input file is required."); } + if (config.count(option::cli_show_real_cmd_args)) { + dump_configure(config); + std::exit(0); + } + return config; } diff --git a/godel-script/godel-frontend/src/cli.h b/godel-script/godel-frontend/src/cli.h index 041be21d..a39287d7 100644 --- a/godel-script/godel-frontend/src/cli.h +++ b/godel-script/godel-frontend/src/cli.h @@ -18,6 +18,7 @@ enum class option { cli_run_souffle, // generate souffle and run cli_dump_souffle_file, // generate souffle and dump + /* information dump */ cli_help, // get help cli_verbose, // verbose output information cli_version, // get version @@ -29,29 +30,45 @@ enum class option { cli_dump_global, // get global symbol information cli_dump_local, // get local variables' information + /* language server */ cli_dump_lsp, // get godel frontend json dump cli_dump_lsp_file_indexed, // use indexed file name in json dump + cli_dump_lsp_only_schema, // only dump schema - cli_lexer_dump_token, // dump tokens - cli_lexer_dump_comment, // dump comments - cli_semantic_only, // only do semantic analysis and exit - cli_semantic_pub_check, // switch pub-access check on - cli_semantic_no_else, // switch no-else check on + /* lexer */ + cli_lexer_dump_token, // dump tokens + cli_lexer_dump_comment, // dump comments + /* semantic analysis */ + cli_semantic_only, // only do semantic analysis and exit + cli_semantic_pub_check, // switch pub-access check on + + /* optimization */ cli_enable_for_opt, // switch for optimization on cli_enable_let_opt, // switch let optimization on - cli_enable_ir_merge, // switch ir merge on cli_enable_self_constraint_opt, // switch self constraint optimization on + cli_enable_join_reorder, // switch join reorder optimization on + cli_disable_inst_combine, // switch inst combine off cli_disable_remove_unused, // switch unused method deletion off cli_disable_do_schema_opt, // switch do schema optimization off cli_souffle_debug_dump, // switch souffle debug mode on cli_souffle_slow_transformers, // switch souffle slow transformers on - cli_enable_souffle_cache, // switch souffle cache on - cli_clean_souffle_cache, // switch clean souffle cache on cli_enable_souffle_profiling, // switch souffle profiling on + + /* souffle cache */ + cli_enable_souffle_cache, // switch souffle cache on + cli_clean_souffle_cache, // switch clean souffle cache on + + /* souffle output redirection */ cli_souffle_json_output, // switch souffle json output on cli_souffle_csv_output, // switch souffle csv output on - cli_souffle_sqlite_output // switch souffle sqlite output on + cli_souffle_sqlite_output, // switch souffle sqlite output on + + /* directly run souffle */ + cli_directly_run_souffle, // run souffle directly + + /* special debug info */ + cli_show_real_cmd_args }; struct info_setting { @@ -94,27 +111,40 @@ const std::unordered_map options = { {"--dump-local", option::cli_dump_local}, {"--dump-lsp", option::cli_dump_lsp}, {"--lsp-dump-use-indexed-file", option::cli_dump_lsp_file_indexed}, + {"--lsp-dump-only-schema", option::cli_dump_lsp_only_schema}, {"--color-off", option::cli_color_off}, {"--lexer-dump-token", option::cli_lexer_dump_token}, {"--lexer-dump-comment", option::cli_lexer_dump_comment}, {"--semantic-only", option::cli_semantic_only}, {"--semantic-pub-check", option::cli_semantic_pub_check}, - {"--semantic-no-else", option::cli_semantic_no_else}, {"--opt-for", option::cli_enable_for_opt}, {"-Of", option::cli_enable_for_opt}, {"--opt-let", option::cli_enable_let_opt}, {"-Ol", option::cli_enable_let_opt}, - {"--opt-ir-merge", option::cli_enable_ir_merge}, - {"-Oim", option::cli_enable_ir_merge}, {"--opt-self-constraint", option::cli_enable_self_constraint_opt}, {"-Osc", option::cli_enable_self_constraint_opt}, + {"--opt-join-reorder", option::cli_enable_join_reorder}, + {"-Ojr", option::cli_enable_join_reorder}, + {"--disable-inst-combine", option::cli_disable_inst_combine}, {"--disable-remove-unused", option::cli_disable_remove_unused}, {"--disable-do-schema-opt", option::cli_disable_do_schema_opt}, {"--souffle-debug", option::cli_souffle_debug_dump}, {"--souffle-slow-transformers", option::cli_souffle_slow_transformers}, {"--enable-souffle-profiling", option::cli_enable_souffle_profiling}, {"--enable-souffle-cache", option::cli_enable_souffle_cache}, - {"--clean-souffle-cache", option::cli_clean_souffle_cache} + {"--clean-souffle-cache", option::cli_clean_souffle_cache}, + {"-Drs", option::cli_directly_run_souffle}, + {"--directly-run-souffle", option::cli_directly_run_souffle}, + {"-###", option::cli_show_real_cmd_args} +}; + +const std::unordered_map> multi_options = { + {"-O1", {option::cli_enable_for_opt}}, + {"-O2", {option::cli_enable_for_opt, + option::cli_enable_self_constraint_opt}}, + {"-O3", {option::cli_enable_for_opt, + option::cli_enable_self_constraint_opt, + option::cli_enable_join_reorder}} }; typedef std::unordered_map configure; @@ -123,6 +153,7 @@ std::ostream& welcome(std::ostream&); std::ostream& version(std::ostream&); std::ostream& help(std::ostream&); void report_invalid_argument(const std::string&); +void dump_configure(const configure&); configure process_args(const std::vector&); } diff --git a/godel-script/godel-frontend/src/engine.cpp b/godel-script/godel-frontend/src/engine.cpp index ad995112..461fde86 100644 --- a/godel-script/godel-frontend/src/engine.cpp +++ b/godel-script/godel-frontend/src/engine.cpp @@ -9,6 +9,7 @@ #include #include +#include #include #include #include @@ -214,6 +215,23 @@ std::string engine::dump_json_used_files() const { return res + "]"; } +void engine::dump_json_only_schema_without_loc(std::ostream& out) const { + out << "{\"semantic\":{\"schema\":["; + std::string res = ""; + for(const auto& i : name_space()) { + if (i.second!=symbol_kind::schema) { + continue; + } + res += global().get_schema(mapper().at(i.first)).to_json(false); + res += ","; + } + if (res.back()==',') { + res.pop_back(); + } + out << res; + out << "]}}"; +} + void engine::dump_json(std::ostream& out) const { out << "{"; @@ -263,7 +281,11 @@ bool engine::language_server_dump(const configure& config) { if (config.count(option::cli_dump_lsp_file_indexed)) { span::set_flag_lsp_dump_use_file_index(true); } - dump_json(std::cout); + if (config.count(option::cli_dump_lsp_only_schema)) { + dump_json_only_schema_without_loc(std::cout); + } else { + dump_json(std::cout); + } error::json_output_stderr(); return true; } @@ -333,9 +355,27 @@ void engine::template_extract() { return; } -void engine::run_souffle(const configure& config) { +void engine::run_souffle_from_file(const configure& config) { + const auto& path = config.at(option::cli_input_path); + if (!std::filesystem::exists(path)) { + err.fatal("file <" + path + "> does not exist."); + } else if (!std::filesystem::is_regular_file(path)) { + err.fatal("file <" + path + "> is not regular file."); + } + std::ifstream in(path, std::ios::binary); + std::stringstream ss; + ss << in.rdbuf(); + const auto souffle_content = ss.str(); + run_souffle(souffle_content, config); +} + +void engine::run_souffle_from_generated(const configure& config) { const auto souffle_content = ir_gen::get_mutable_context().str_output(config); + run_souffle(souffle_content, config); +} +void engine::run_souffle(const std::string& souffle_content, + const configure& config) { // extra arguments to be passed to souffle std::vector argv = {}; @@ -357,8 +397,12 @@ void engine::run_souffle(const configure& config) { if (config.count(option::cli_enable_souffle_profiling)) { argv.push_back("--profile=souffle.prof.log"); argv.push_back("--profile-frequency"); + argv.push_back("--index-stats"); } + // enable souffle auto schedule, for experimental use only + // argv.push_back("--auto-schedule=souffle.prof.log"); + // null terminator argv.push_back(nullptr); @@ -429,6 +473,11 @@ const error& engine::run(const configure& config) { return err; } + if (config.count(option::cli_directly_run_souffle)) { + run_souffle_from_file(config); + return err; + } + if (config.count(option::cli_dump_lsp)) { report::error::set_json_out(); } @@ -538,7 +587,7 @@ const error& engine::run(const configure& config) { // directly run souffle program if (config.count(option::cli_run_souffle)) { - run_souffle(config); + run_souffle_from_generated(config); } return err; } diff --git a/godel-script/godel-frontend/src/engine.h b/godel-script/godel-frontend/src/engine.h index 4ab06fd0..02600788 100644 --- a/godel-script/godel-frontend/src/engine.h +++ b/godel-script/godel-frontend/src/engine.h @@ -99,6 +99,7 @@ class engine { std::string dump_json_local() const; std::string dump_json_infer() const; std::string dump_json_used_files() const; + void dump_json_only_schema_without_loc(std::ostream&) const; void dump_json(std::ostream&) const; void dump_used_modules() const; bool language_server_dump(const configure&); @@ -110,7 +111,13 @@ class engine { void do_semantic_analysis(const configure&); void ast_structure_dump(); void template_extract(); - void run_souffle(const configure&); + +private: + // run souffle code from source file + void run_souffle_from_file(const configure&); + // run generated souffle code + void run_souffle_from_generated(const configure&); + void run_souffle(const std::string&, const configure&); public: const auto& name_space() const { return semantic_analyser.get_context().this_name_space; } diff --git a/godel-script/godel-frontend/src/error/error.cpp b/godel-script/godel-frontend/src/error/error.cpp index e3a69bd9..c94a2d48 100644 --- a/godel-script/godel-frontend/src/error/error.cpp +++ b/godel-script/godel-frontend/src/error/error.cpp @@ -6,6 +6,7 @@ #include #include #include +#include namespace report { @@ -217,23 +218,26 @@ void error::report_context(const span& loc, } } -void error::warn_report_ignored_DO_schema(const std::vector>& vec) { +void error::warn_ignored_DO_schema(const std::unordered_set& vec) { if (json_output) { return; } + // report head auto info = std::to_string(vec.size()); info += " \"__all__\" methods of DO schemas are ignored:"; report_head_info(info, false); + + // report ignored schema size_t ignored_count = 0; for(const auto& i : vec) { ++ignored_count; - if (ignored_count > 4) { + if (ignored_count > 8) { break; } - report_context(i.second, false, ""); + std::clog << reset << " " << i << "\n"; } - if (vec.size() > 4) { - std::clog << cyan << " --> " << reset << "...(" << vec.size()-4 << ")\n"; + if (vec.size() > 8) { + std::clog << reset << " ...(" << vec.size() - 8 << ")\n"; } std::clog << std::endl; } diff --git a/godel-script/godel-frontend/src/error/error.h b/godel-script/godel-frontend/src/error/error.h index 1199cc7c..9c0f47b2 100644 --- a/godel-script/godel-frontend/src/error/error.h +++ b/godel-script/godel-frontend/src/error/error.h @@ -5,6 +5,7 @@ #include #include #include +#include #include namespace report { @@ -124,7 +125,7 @@ class error { void report_context(const span&, bool, const std::string&); public: - void warn_report_ignored_DO_schema(const std::vector>&); + void warn_ignored_DO_schema(const std::unordered_set&); public: void load(const std::string&); diff --git a/godel-script/godel-frontend/src/ir/aggregator_inline_remark.cpp b/godel-script/godel-frontend/src/ir/aggregator_inline_remark.cpp index 1733c276..bb4eacd2 100644 --- a/godel-script/godel-frontend/src/ir/aggregator_inline_remark.cpp +++ b/godel-script/godel-frontend/src/ir/aggregator_inline_remark.cpp @@ -3,27 +3,43 @@ namespace godel { void aggregator_inline_remark::visit_call(lir::call* node) { + // if this call is not used in aggregator, skip if (!in_aggregator) { return; } + + // no need to remark intrinsics + switch(node->get_func_kind()) { + case lir::call::kind::database_load: + case lir::call::kind::find: + case lir::call::kind::key_cmp: + case lir::call::kind::to_set: + case lir::call::kind::basic_method: + case lir::call::kind::basic_static: return; + default: break; + } + + const auto mangled_rule_name = node->get_mangled_name(); switch(node->get_func_kind()) { case lir::call::kind::function: case lir::call::kind::method: - if (inline_rules.count(replace_colon(node->get_function_name()))) { + if (inline_rules.count(mangled_rule_name) && + !inline_rules.at(mangled_rule_name)->is_inherited()) { err.warn(node->get_location(), "inline function \"" + node->get_function_name() + "\" used in aggregator.", - "will generate as a normal function." + "will generate as non-inline to avoid ungrounded error." ); } - need_remark.insert(replace_colon(node->get_function_name())); + need_remark.insert(mangled_rule_name); break; default: break; } } void aggregator_inline_remark::visit_aggregator(lir::aggregator* node) { + // this should be unreachable, used to check if codegen works correctly if (in_aggregator) { err.err(node->get_location(), "detect nested aggregator, please check generated code." @@ -37,12 +53,14 @@ void aggregator_inline_remark::visit_aggregator(lir::aggregator* node) { } bool aggregator_inline_remark::run() { + // load inline rules from declarations for(const auto& decl : ctx->rule_decls) { if (decl->is_inline()) { - inline_rules.insert(replace_colon(decl->get_rule_raw_name())); + inline_rules.insert({ decl->get_mangled_name(), decl }); } } + // visit all rule impls' block to find matched cases for(auto impl : ctx->rule_impls) { impl->get_block()->accept(this); } @@ -56,13 +74,14 @@ bool aggregator_inline_remark::run() { impl->get_block()->accept(this); } + // if error is reported during this pass, return false if (err.get_error()) { return false; } // remark inline to false for(auto& decl : ctx->rule_decls) { - if (need_remark.count(replace_colon(decl->get_rule_raw_name()))) { + if (need_remark.count(decl->get_mangled_name())) { decl->set_is_inline_rule(false); } } diff --git a/godel-script/godel-frontend/src/ir/aggregator_inline_remark.h b/godel-script/godel-frontend/src/ir/aggregator_inline_remark.h index fd349797..abe33fc7 100644 --- a/godel-script/godel-frontend/src/ir/aggregator_inline_remark.h +++ b/godel-script/godel-frontend/src/ir/aggregator_inline_remark.h @@ -4,13 +4,19 @@ #include #include +#include #include namespace godel { +// Soufflé does not allow inline predicates used in aggregators. +// This pass will add a remark to the predicates to indicate that +// they should not be inlined. +// And after this pass these predicates' inline attribute will be +// set to false. class aggregator_inline_remark: public pass { private: - std::unordered_set inline_rules; + std::unordered_map inline_rules; std::unordered_set need_remark; bool in_aggregator = false; diff --git a/godel-script/godel-frontend/src/ir/call_graph.cpp b/godel-script/godel-frontend/src/ir/call_graph.cpp new file mode 100644 index 00000000..67b407dd --- /dev/null +++ b/godel-script/godel-frontend/src/ir/call_graph.cpp @@ -0,0 +1,100 @@ +#include "godel-frontend/src/ir/call_graph.h" + +namespace godel { + +void call_graph_generator::scan_ir_call(lir::call* node, callee_dict& dict) const { + switch(node->get_func_kind()) { + case lir::call::kind::database_load: + case lir::call::kind::find: + case lir::call::kind::key_cmp: + case lir::call::kind::to_set: + case lir::call::kind::basic_method: + case lir::call::kind::basic_static: return; + default: break; + } + + // only need user-defined rules + dict.insert(node->get_mangled_name()); + return; +} + +void call_graph_generator::scan_call(souffle_rule_impl* impl, + callee_dict& dict) const { + // recursively search used rules + // but we use bfs queue to avoid stack overflow + // so visitor(dfs) is not needed here + std::queue bfs; + bfs.push(impl->get_block()); + + while(!bfs.empty()) { + auto block = bfs.front(); + bfs.pop(); + for(auto stmt : block->get_content()) { + switch(stmt->get_kind()) { + case lir::inst_kind::inst_call: + scan_ir_call((lir::call*)stmt, dict); + break; + case lir::inst_kind::inst_ctor: + dict.insert(((lir::constructor*)stmt)->get_mangled_name()); + break; + case lir::inst_kind::inst_block: + bfs.push((lir::block*)stmt); + break; + case lir::inst_kind::inst_not: + bfs.push(((lir::not_operand*)stmt)->get_body()); + break; + case lir::inst_kind::inst_and: + bfs.push(((lir::and_operand*)stmt)->get_left_block()); + bfs.push(((lir::and_operand*)stmt)->get_right_block()); + break; + case lir::inst_kind::inst_or: + bfs.push(((lir::or_operand*)stmt)->get_left_block()); + bfs.push(((lir::or_operand*)stmt)->get_right_block()); + break; + case lir::inst_kind::inst_aggr: + bfs.push(((lir::aggregator*)stmt)->get_body()); + default: break; + } + } + } +} + +void call_graph_generator::initialize_call_graph( + const std::vector& impls, call_graph& cg) const { + for(auto i : impls) { + const auto name = i->get_mangled_name(); + if (!cg.count(name)) { + cg.insert({name, {}}); + } + // construct the call graph and mark all used rules + scan_call(i, cg.at(name)); + } +} + +const call_graph& call_graph_generator::apply(const ir_context& ctx) { + cg.clear(); + + // initialize call graph root + for(const auto& i : ctx.souffle_output) { + const auto name = rule_mangle(i); + if (!cg.count(name)) { + cg.insert({name, {}}); + } + } + for(const auto& i : ctx.annotated_output) { + const auto name = i.get_mangled_name(); + if (!cg.count(name)) { + cg.insert({name, {}}); + } + } + + // construct call graph by scanning the IR + initialize_call_graph(ctx.rule_impls, cg); + initialize_call_graph(ctx.database_get_table, cg); + initialize_call_graph(ctx.schema_get_field, cg); + initialize_call_graph(ctx.schema_data_constraint_impls, cg); + + return cg; +} + +} \ No newline at end of file diff --git a/godel-script/godel-frontend/src/ir/call_graph.h b/godel-script/godel-frontend/src/ir/call_graph.h new file mode 100644 index 00000000..3c76a716 --- /dev/null +++ b/godel-script/godel-frontend/src/ir/call_graph.h @@ -0,0 +1,31 @@ +#pragma once + +#include "godel-frontend/src/ir/ir_context.h" +#include "godel-frontend/src/ir/lir.h" + +#include +#include +#include +#include +#include + +namespace godel { + +typedef std::unordered_set callee_dict; +typedef std::unordered_map call_graph; + +class call_graph_generator { +private: + call_graph cg; + +private: + void scan_ir_call(lir::call*, callee_dict&) const; + void scan_call(souffle_rule_impl*, callee_dict&) const; + void initialize_call_graph(const std::vector&, + call_graph&) const; + +public: + const call_graph& apply(const ir_context&); +}; + +} \ No newline at end of file diff --git a/godel-script/godel-frontend/src/ir/inst_combine.cpp b/godel-script/godel-frontend/src/ir/inst_combine.cpp index 426d7bc7..6b12c6d1 100644 --- a/godel-script/godel-frontend/src/ir/inst_combine.cpp +++ b/godel-script/godel-frontend/src/ir/inst_combine.cpp @@ -6,13 +6,13 @@ namespace godel { void inst_combine_pass::visit_store(lir::store* s) { const auto& src = s->get_source(); - const auto& dst = s->get_destination(); + const auto& tgt = s->get_target(); // record this case: // // ( // ssa_temp_0 = a, - // b = ssa_temp_1, + // ssa_temp_1 = b, // call(ssa_temp_2, ssa_temp_0, ssa_temp_1) // ) // @@ -20,10 +20,10 @@ void inst_combine_pass::visit_store(lir::store* s) { // // (call(ssa_temp_2, a, b)) // - if (dst.kind==lir::inst_value_kind::variable && + if (tgt.kind==lir::inst_value_kind::variable && src.kind==lir::inst_value_kind::variable) { - variable_reference_graph[dst.content].insert({src.content, s}); - variable_reference_graph[src.content].insert({dst.content, s}); + variable_reference_graph[tgt.content].insert({src.content, s}); + variable_reference_graph[src.content].insert({tgt.content, s}); } // record this case: @@ -38,9 +38,9 @@ void inst_combine_pass::visit_store(lir::store* s) { // // (call(ssa_temp_2, 1, 2)) // - if (dst.kind==lir::inst_value_kind::variable && + if (tgt.kind==lir::inst_value_kind::variable && src.kind==lir::inst_value_kind::literal) { - variable_reference_graph[dst.content].insert({src.content, s}); + variable_reference_graph[tgt.content].insert({src.content, s}); } } @@ -86,26 +86,67 @@ void inst_combine_pass::visit_compare(lir::compare* c) { } } +void inst_combine_pass::visit_call(lir::call* c) { + if (c->get_func_kind() != lir::call::kind::key_cmp) { + return; + } + if (c->get_function_name() != "key_eq") { + return; + } + + const auto& left = c->get_arguments()[0]; + const auto& right = c->get_arguments()[1]; + + // record this case: + // + // a.key_eq(b.getParent()) + // --> + // ( + // getParent(ssa_temp_0, b), + // a = ssa_temp_0 + // ) + // + // and optimize this case to: + // + // getParent(a, b) + // + if (left.kind==lir::inst_value_kind::variable && + right.kind==lir::inst_value_kind::variable) { + variable_reference_graph[left.content].insert({right.content, c}); + variable_reference_graph[right.content].insert({left.content, c}); + } +} + bool inst_combine_pass::run() { - for(auto impl : ctx->rule_impls) { - scan(impl); - inst_elimination_worker().copy(impl); + for (auto impl : ctx->rule_impls) { + run_on_single_impl(impl); } - for(auto impl : ctx->database_get_table) { - scan(impl); - inst_elimination_worker().copy(impl); + for (auto impl : ctx->database_get_table) { + run_on_single_impl(impl); } - for(auto impl : ctx->schema_get_field) { - scan(impl); - inst_elimination_worker().copy(impl); + for (auto impl : ctx->schema_get_field) { + run_on_single_impl(impl); } - for(auto impl : ctx->schema_data_constraint_impls) { - scan(impl); - inst_elimination_worker().copy(impl); + for (auto impl : ctx->schema_data_constraint_impls) { + run_on_single_impl(impl); } return true; } +void inst_combine_pass::run_on_single_impl(souffle_rule_impl* b) { + auto worker = inst_elimination_worker(); + size_t pass_run_count = 0; + const size_t max_pass_run_count = 16; + scan(b); + worker.copy(b); + ++ pass_run_count; + while (worker.get_eliminated_count() && pass_run_count < max_pass_run_count) { + scan(b); + worker.copy(b); + ++ pass_run_count; + } +} + void inst_combine_pass::scan(souffle_rule_impl* b) { variable_reference_graph.clear(); b->get_block()->accept(this); @@ -143,18 +184,26 @@ void inst_combine_pass::scan(souffle_rule_impl* b) { // for(const auto& i : variable_reference_graph) { const auto& name = i.first; - if (i.second.size()!=1) { + // if alias variables' count > 1, even if there's a circle, still skip it. + if (i.second.size() != 1) { continue; } + // alias variable's name const auto& to = i.second.begin()->first; if (!variable_reference_graph.count(to)) { continue; } - if (variable_reference_graph.at(to).size()!=1) { + // this variable's alias count should be 1 + if (variable_reference_graph.at(to).size() != 1) { continue; } + // get `to`'s alias variable's name, this name should be equal to `name` const auto& from = variable_reference_graph.at(to).begin()->first; - if (from==name && to.find("ssa_temp")==0 && from.find("ssa_temp")==0) { + // means there's a circle like this: + // `to` <--> `from`(aka `name`) + // after clear(), `to`'s alias count should be 0: + // `to` <--- `from`(aka `name`) + if (from == name && to.find("ssa_temp") == 0 && from.find("ssa_temp") == 0) { variable_reference_graph.at(to).clear(); } } @@ -216,19 +265,28 @@ void combine_worker::visit_record(lir::record* node) { } void combine_worker::visit_unary(lir::unary* node) { - const auto& dst = node->get_destination(); - if (is_single_ref_ssa_temp(dst.content)) { - const auto& ref = get_single_ref(dst.content); - node->get_mutable_destination().content = ref.first; + const auto& tgt = node->get_target(); + if (is_single_ref_ssa_temp(tgt.content)) { + const auto& ref = get_single_ref(tgt.content); + node->get_mutable_target().content = ref.first; ref.second->set_flag_eliminated(true); } } void combine_worker::visit_binary(lir::binary* node) { - const auto& dst = node->get_destination(); - if (is_single_ref_ssa_temp(dst.content)) { - const auto& ref = get_single_ref(dst.content); - node->get_mutable_destination().content = ref.first; + const auto& tgt = node->get_target(); + if (is_single_ref_ssa_temp(tgt.content)) { + const auto& ref = get_single_ref(tgt.content); + node->get_mutable_target().content = ref.first; + ref.second->set_flag_eliminated(true); + } +} + +void combine_worker::visit_aggregator(lir::aggregator* node) { + const auto& tgt = node->get_target(); + if (is_single_ref_ssa_temp(tgt.content)) { + const auto& ref = get_single_ref(tgt.content); + node->get_mutable_target().content = ref.first; ref.second->set_flag_eliminated(true); } } @@ -248,6 +306,7 @@ void inst_elimination_worker::visit_block(lir::block* node) { for(auto i : node->get_content()) { // skip eliminated instruction if (i->get_flag_eliminated()) { + ++ eliminated_count; continue; } @@ -321,6 +380,8 @@ void inst_elimination_worker::visit_aggregator(lir::aggregator* node) { } void inst_elimination_worker::copy(souffle_rule_impl* impl) { + eliminated_count = 0; + blk.clear(); auto impl_blk = new lir::block(impl->get_block()->get_location()); blk.push_back(impl_blk); @@ -337,4 +398,69 @@ void inst_elimination_worker::copy(souffle_rule_impl* impl) { delete impl_blk; } +void replace_find_call::visit_block(lir::block* node) { + bool has_find_call = false; + for (auto i : node->get_content()) { + if (i->get_kind() != lir::inst_kind::inst_call) { + continue; + } + auto call = reinterpret_cast(i); + if (call->get_func_kind() == lir::call::kind::find && + call->get_function_name() == "find") { + has_find_call = true; + break; + } + } + + if (has_find_call) { + std::vector new_content; + for (auto i : node->get_content()) { + if (i->get_kind() != lir::inst_kind::inst_call) { + new_content.push_back(i); + continue; + } + + auto call = reinterpret_cast(i); + if (call->get_func_kind() != lir::call::kind::find || + call->get_function_name() != "find") { + new_content.push_back(i); + continue; + } + + auto dst = call->get_return(); + auto arg0 = call->get_arguments()[0]; + auto arg1 = call->get_arguments()[1]; + auto new_block = new lir::block(call->get_location()); + new_block->set_use_comma(); + new_content.push_back(new_block); + + new_block->add_new_content(new lir::store(arg0, dst, call->get_location())); + new_block->add_new_content(new lir::store(arg1, arg0, call->get_location())); + + delete i; + } + node->get_mutable_content().swap(new_content); + } else { + for (auto i : node->get_content()) { + i->accept(this); + } + } +} + +bool replace_find_call::run() { + for (auto impl : ctx->rule_impls) { + impl->get_block()->accept(this); + } + for (auto impl : ctx->database_get_table) { + impl->get_block()->accept(this); + } + for (auto impl : ctx->schema_get_field) { + impl->get_block()->accept(this); + } + for (auto impl : ctx->schema_data_constraint_impls) { + impl->get_block()->accept(this); + } + return true; +} + } \ No newline at end of file diff --git a/godel-script/godel-frontend/src/ir/inst_combine.h b/godel-script/godel-frontend/src/ir/inst_combine.h index e14abc7c..80e68b74 100644 --- a/godel-script/godel-frontend/src/ir/inst_combine.h +++ b/godel-script/godel-frontend/src/ir/inst_combine.h @@ -20,9 +20,11 @@ class inst_combine_pass: public pass { private: void visit_store(lir::store*) override; void visit_compare(lir::compare*) override; + void visit_call(lir::call*) override; private: void scan(souffle_rule_impl*); + void run_on_single_impl(souffle_rule_impl*); public: inst_combine_pass(ir_context& c): pass(pass_kind::ps_inst_combine, c) {} @@ -53,6 +55,7 @@ class combine_worker: public lir::inst_visitor { void visit_record(lir::record*) override; void visit_unary(lir::unary*) override; void visit_binary(lir::binary*) override; + void visit_aggregator(lir::aggregator*) override; public: combine_worker(const inst_combine_pass::ref_graph& g): vg(g) {} @@ -64,6 +67,7 @@ class combine_worker: public lir::inst_visitor { class inst_elimination_worker: public lir::inst_visitor { private: std::vector blk; + size_t eliminated_count = 0; private: void visit_boolean(lir::boolean* node) override { @@ -110,6 +114,21 @@ class inst_elimination_worker: public lir::inst_visitor { public: void copy(souffle_rule_impl*); + auto get_eliminated_count() const { + return eliminated_count; + } +}; + +class replace_find_call: public pass { +private: + void visit_block(lir::block*) override; + +public: + replace_find_call(ir_context& c): pass(pass_kind::ps_replace_find_call, c) {} + const char* get_name() const override { + return "[Transform] Replace Find Call"; + } + bool run() override; }; } \ No newline at end of file diff --git a/godel-script/godel-frontend/src/ir/ir_context.cpp b/godel-script/godel-frontend/src/ir/ir_context.cpp index 2a7618d4..ca712d24 100644 --- a/godel-script/godel-frontend/src/ir/ir_context.cpp +++ b/godel-script/godel-frontend/src/ir/ir_context.cpp @@ -2,6 +2,7 @@ #include "godel-frontend/src/ir/pass_manager.h" #include "godel-frontend/src/ir/remove_unused.h" #include "godel-frontend/src/ir/inst_combine.h" +#include "godel-frontend/src/ir/name_mangling.h" #include #include @@ -22,13 +23,13 @@ void souffle_type_alias::dump(std::ostream& out) const { } void souffle_schema::dump(std::ostream& out) const { - out << ".decl schema_" << replace_colon(name) << "("; - out << "result: " << replace_colon(name) << ", db_id: DBIndex"; + out << ".decl " << get_mangled_name() << "("; + out << "result: " << type_mangle(name) << ", db_id: DBIndex"; if (fields.size()) { out << ", "; } for(const auto& i : fields) { - out << i.first << ": " << replace_colon(i.second); + out << i.first << ": " << type_mangle(i.second); if (i!=fields.back()) { out << ", "; } @@ -39,7 +40,7 @@ void souffle_schema::dump(std::ostream& out) const { void souffle_input_decl::dump(std::ostream& os) const { os << ".decl " << decl_name << "("; for(const auto& i : fields) { - os << i.first << ": " << replace_colon(i.second); + os << i.first << ": " << type_mangle(i.second); if (i!=fields.back()) { os << ", "; } @@ -54,15 +55,15 @@ void souffle_input_impl::dump(std::ostream& os) const { } void souffle_rule_decl::dump(std::ostream& out) const { - out << ".decl " << replace_colon(name) << "("; + out << ".decl " << get_mangled_name() << "("; if (return_type.length() && return_type!="bool") { - out << "result: " << replace_colon(return_type); + out << "result: " << type_mangle(return_type); if (params.size()) { out << ", "; } } for(const auto& i : params) { - out << i.first << ": " << replace_colon(i.second); + out << i.first << ": " << type_mangle(i.second); if (i!=params.back()) { out << ", "; } @@ -71,11 +72,14 @@ void souffle_rule_decl::dump(std::ostream& out) const { if (flag_is_inline_rule) { out << " inline"; } + if (flag_is_inherited_rule) { + out << " // inherited"; + } out << "\n"; } void souffle_rule_impl::dump(std::ostream& out) const { - out << replace_colon(func_name) << "("; + out << get_mangled_name() << "("; if (!params.empty()) { auto it = params.begin(); out << *it++; @@ -170,10 +174,12 @@ bool ir_context::cache_input_impl(std::ostream& out, const std::string& fn) cons if (!enable_souffle_cache || !std::filesystem::exists(tempfile)) { return false; } + + // sqlite-cache reader will not convert empty string to "n/a" if (check_cache_table_exists(fn)) { out << ".input " << fn; out << "(IO=\"sqlite-cache\", dbname=\"" << tempfile.string() << "\", "; - out << "name=\"_" << fn << "\")\n"; + out << "name=\"" << fn << "\")\n"; return true; } return false; @@ -182,7 +188,7 @@ bool ir_context::cache_input_impl(std::ostream& out, const std::string& fn) cons void ir_context::dump_rule_impls(std::ostream& out, const std::unordered_set& cache_decl) const { for(auto i : rule_impls) { - const auto name = replace_colon(i->get_func_name()); + const auto name = i->get_mangled_name(); // cache input if (cache_decl.count(name) && cache_input_impl(out, name)) { continue; @@ -244,7 +250,7 @@ void ir_context::dump_souffle_annotated_input(std::ostream& out) const { return; } for(const auto& i : annotated_input) { - out << ".input " << replace_colon(i.rule_name); + out << ".input " << i.get_mangled_name(); if (i.format=="\"json\"") { out << "(IO=\"jsonfile\", filename="; out << i.file_path << ", format=\"object\")"; @@ -268,7 +274,7 @@ void ir_context::dump_souffle_multi_json_output(std::ostream& out) const { // dump output rules for(const auto& i : souffle_output) { const auto temp_file = temp / ("godel_script_" + i + ".json"); - out << ".output " << replace_colon(i); + out << ".output " << rule_mangle(i); out << "(IO=\"jsonfile\", filename=\""; out << temp_file.string() << "\", format=\"object\")" << "\n"; } @@ -277,7 +283,7 @@ void ir_context::dump_souffle_multi_json_output(std::ostream& out) const { } } -void ir_context::dump_souffle_output(std::ostream& out) const { +void ir_context::dump_souffle_redirect_output(std::ostream& out) const { if (souffle_output.empty()) { return; } @@ -305,7 +311,7 @@ void ir_context::dump_souffle_output(std::ostream& out) const { } // dump output rules for(const auto& i : souffle_output) { - out << ".output " << replace_colon(i) << io_format << "\n"; + out << ".output " << rule_mangle(i) << io_format << "\n"; } if (souffle_output.size()) { out << "\n"; @@ -317,7 +323,7 @@ void ir_context::dump_souffle_annotated_output(std::ostream& out) const { return; } for(const auto& i : annotated_output) { - out << ".output " << replace_colon(i.rule_name); + out << ".output " << i.get_mangled_name(); if (i.format=="\"json\"") { out << "(IO=\"jsonfile\", filename="; out << i.file_path << ", format=\"object\")"; @@ -345,10 +351,10 @@ void ir_context::dump(std::ostream& out, const cli::configure& conf) { std::unordered_set cache_decl; for(auto i : rule_decls) { if (i->is_inline()) { - inline_decl.insert(replace_colon(i->get_rule_raw_name())); + inline_decl.insert(i->get_mangled_name()); } if (i->need_cache()) { - cache_decl.insert(replace_colon(i->get_rule_raw_name())); + cache_decl.insert(i->get_mangled_name()); } } @@ -385,7 +391,7 @@ void ir_context::dump(std::ostream& out, const cli::configure& conf) { dump_input_impls(out); dump_souffle_annotated_input(out); // dump souffle output - dump_souffle_output(out); + dump_souffle_redirect_output(out); dump_souffle_annotated_output(out); if (enable_souffle_cache) { @@ -406,7 +412,7 @@ bool ir_context::check_cache_table_exists(const std::string& rule) const { } auto cmd = std::string("SELECT name FROM sqlite_master WHERE type='table'"); - cmd += " AND name='_" + rule + "';"; + cmd += " AND name='" + rule + "';"; sqlite3_stmt* stmt = nullptr; const char* tail = nullptr; diff --git a/godel-script/godel-frontend/src/ir/ir_context.h b/godel-script/godel-frontend/src/ir/ir_context.h index ce98629a..c2bfea07 100644 --- a/godel-script/godel-frontend/src/ir/ir_context.h +++ b/godel-script/godel-frontend/src/ir/ir_context.h @@ -3,6 +3,7 @@ #include "godel-frontend/src/ir/lir.h" #include "godel-frontend/src/sema/context.h" #include "godel-frontend/src/cli.h" +#include "godel-frontend/src/ir/name_mangling.h" #include #include @@ -32,14 +33,19 @@ struct souffle_type_alias { void dump(std::ostream&) const; }; +// generate rule begin with `schema_` struct souffle_schema { std::string name; std::vector> fields; + auto get_mangled_name() const { + return rule_mangle("schema_" + name); + } void dump(std::ostream&) const; }; // declaration of database input +// generate rule begin with `input_` struct souffle_input_decl { std::string database_name; std::string table_type; @@ -54,15 +60,17 @@ struct souffle_input_decl { const std::string& tt, uint64_t lt): database_name(dbn), table_type(tt), load_times(lt) { - decl_name = "input_" + replace_colon(database_name) + "_" + - replace_colon(table_type) + "_" + - std::to_string(load_times); + decl_name = "input_" + database_name + + "_" + table_type + + "_" + std::to_string(load_times); + decl_name = rule_mangle(decl_name); } void dump(std::ostream&) const; - const auto& get_decl_name() const { return decl_name; } + const auto& get_mangled_name() const { return decl_name; } }; // implementation of database input +// generate rule begin with `input_` struct souffle_input_impl { std::string name; std::string table_name; @@ -81,14 +89,16 @@ struct souffle_input_impl { const std::string& idb): name(n), table_name(tn), table_type(tt), path_id(pid), input_db_path(idb) { - decl_name = "input_" + replace_colon(name) + "_" + - replace_colon(table_type) + "_" + - std::to_string(path_id); + decl_name = "input_" + name + + "_" + table_type + + "_" + std::to_string(path_id); + decl_name = rule_mangle(decl_name); } void dump(std::ostream&) const; - const auto& get_decl_name() const { return decl_name; } + const auto& get_mangled_name() const { return decl_name; } }; +// generate rule begin with `rule_` class souffle_rule_decl { private: std::string name; @@ -98,34 +108,40 @@ class souffle_rule_decl { private: bool flag_is_inline_rule; bool flag_need_cache; + bool flag_is_inherited_rule; public: souffle_rule_decl(const std::string& n): name(n), return_type(""), flag_is_inline_rule(false), - flag_need_cache(false) {} + flag_need_cache(false), + flag_is_inherited_rule(false) {} void dump(std::ostream&) const; public: void set_return_type(const std::string& t) { return_type = t; } void set_is_inline_rule(bool flag) { flag_is_inline_rule = flag; } void set_need_cache(bool flag) { flag_need_cache = flag; } + void set_is_inherited_rule(bool flag) { flag_is_inherited_rule = flag; } void add_param(const std::string& pn, const std::string& pt) { params.push_back({pn, pt}); } public: const auto& get_rule_raw_name() const { return name; } + auto get_mangled_name() const { return rule_mangle(name); } const auto& get_params() const { return params; } const auto& get_return_type() const { return return_type; } auto is_inline() const { return flag_is_inline_rule; } auto need_cache() const { return flag_need_cache;} + auto is_inherited() const { return flag_is_inherited_rule; } }; +// generate rule begin with `rule_` class souffle_rule_impl { private: std::string func_name; - std::vector params; + std::vector params; lir::block block; public: @@ -133,12 +149,20 @@ class souffle_rule_impl { func_name(c), block(loc) { block.set_use_semicolon(); } - void add_param(const std::string& p) { - params.push_back(p); + +public: + void add_param_variable(const std::string& var) { + params.push_back(lir::inst_value_t::variable(var)); + } + void add_param_literal(const std::string& lit) { + params.push_back(lir::inst_value_t::literal(lit)); } + +public: auto get_block() { return █ } const auto& get_params() const { return params; } const auto& get_func_name() const { return func_name; } + auto get_mangled_name() const { return rule_mangle(func_name); } void dump(std::ostream&) const; }; @@ -147,6 +171,8 @@ struct souffle_annotated_file_output { std::string format; std::string file_path; std::string rule_name; + + auto get_mangled_name() const { return rule_mangle(rule_name); } }; // alias to annotated_file_output @@ -156,8 +182,9 @@ struct ir_context { std::vector functors; std::vector type_alias; - // souffle stdout output, can be redirected to file output + // rules' name for souffle stdout output, can be redirected to file output std::vector souffle_output; + // mapper stores real name of mangled output rule, // used for merging output files into one file std::unordered_map souffle_output_real_name; @@ -214,7 +241,7 @@ struct ir_context { void dump_input_impls(std::ostream&) const; void dump_souffle_annotated_input(std::ostream&) const; void dump_souffle_multi_json_output(std::ostream&) const; - void dump_souffle_output(std::ostream&) const; + void dump_souffle_redirect_output(std::ostream&) const; void dump_souffle_annotated_output(std::ostream&) const; void dump(std::ostream&, const cli::configure&); diff --git a/godel-script/godel-frontend/src/ir/ir_gen.cpp b/godel-script/godel-frontend/src/ir/ir_gen.cpp index b813ab43..09ae8fc7 100644 --- a/godel-script/godel-frontend/src/ir/ir_gen.cpp +++ b/godel-script/godel-frontend/src/ir/ir_gen.cpp @@ -28,7 +28,7 @@ void ir_gen::emit_type_alias_for_database() { .type_name = sc.second.name, .type_loc = sc.second.location }; - const auto name = replace_colon(sym.full_path_name()); + const auto name = type_mangle(sym.full_path_name()); // insert type alias into the context // for example: @@ -63,8 +63,8 @@ void ir_gen::emit_type_alias_for_schema_with_primary_key(const schema& sc) { // .type Example = int // irc.type_alias.push_back(souffle_type_alias { - .alias = replace_colon(sym.full_path_name()), - .real = replace_colon(real_type.full_path_name_without_set()), + .alias = type_mangle(sym.full_path_name()), + .real = type_mangle(real_type.full_path_name_without_set()), .structure_type_list = {} }); } @@ -82,7 +82,7 @@ void ir_gen::emit_type_alias_for_schema_without_primary_key(const schema& sc) { for(const auto& i : sc.ordered_fields) { real += i + ": "; const auto& type = sc.fields.at(i); - const auto name = replace_colon(type.full_path_name_without_set()); + const auto name = type_mangle(type.full_path_name_without_set()); real += name + ", "; structure_type_list.push_back(name); } @@ -99,7 +99,7 @@ void ir_gen::emit_type_alias_for_schema_without_primary_key(const schema& sc) { // .type Example = [id: int, name: string] // irc.type_alias.push_back(souffle_type_alias { - .alias = replace_colon(sym.full_path_name()), + .alias = type_mangle(sym.full_path_name()), .real = real, .structure_type_list = structure_type_list }); @@ -126,7 +126,7 @@ void ir_gen::emit_type_alias_for_enum() { .type_loc = e.second.location }; irc.type_alias.push_back(souffle_type_alias { - .alias = replace_colon(sym.full_path_name()), + .alias = type_mangle(sym.full_path_name()), .real = "int", .structure_type_list = {} }); @@ -160,8 +160,8 @@ void ir_gen::emit_used_database_get_table_impl(const std::string& db_type_name, "get_table_" + db_type_name + "_" + table_name, report::span::null() ); - get_table_impl->add_param("result"); - get_table_impl->add_param(db_id); + get_table_impl->add_param_variable("ret?result"); + get_table_impl->add_param_literal(db_id); get_table_impl->get_block()->set_use_comma(); // generate input call @@ -175,7 +175,7 @@ void ir_gen::emit_used_database_get_table_impl(const std::string& db_type_name, // only need primary key for(const auto& f : sc.ordered_fields) { input_call->add_arg(sc.fields.at(f).primary? - lir::inst_value_t::variable("result"): + lir::inst_value_t::variable("ret?result"): lir::inst_value_t::default_value() ); } @@ -200,7 +200,7 @@ void ir_gen::emit_used_database_get_table_impl(const std::string& db_type_name, // generate result = [ f1, f2, ...] get_table_impl->get_block()->add_new_content(new lir::store( lir::inst_value_t::literal(literal), - lir::inst_value_t::variable("result"), + lir::inst_value_t::variable("ret?result"), report::span::null() )); } @@ -220,19 +220,19 @@ void ir_gen::emit_schema_data_constraint_impl(const std::string& db_type_name, ); // load parameter + // schema with primary key, just set the result = primary key + // schema without primary key, need to generate result = [...] if (sc.has_primary_key()) { - // schema with primary key, just set the result = primary key - input_to_schema->add_param(sc.get_primary_key()); + input_to_schema->add_param_variable(sc.get_primary_key()); } else { - // schema without primary key, need to generate result = [...] - input_to_schema->add_param("result"); + input_to_schema->add_param_variable("ret?result"); } - // database index - input_to_schema->add_param(db_id); + // database index, literal + input_to_schema->add_param_literal(db_id); // schema field for(const auto& field : sc.ordered_fields) { - input_to_schema->add_param(field); + input_to_schema->add_param_variable(field); } // load result, generate result = [...] @@ -247,7 +247,7 @@ void ir_gen::emit_schema_data_constraint_impl(const std::string& db_type_name, literal += "]"; input_to_schema->get_block()->add_new_content(new lir::store( lir::inst_value_t::literal(literal), - lir::inst_value_t::variable("result"), + lir::inst_value_t::variable("ret?result"), report::span::null() )); } @@ -398,6 +398,7 @@ void ir_gen::emit_schema_method_decl(const function& method, method.has_annotation("@inline") || method.inherit ); + method_decl->set_is_inherited_rule(method.inherit); // load parameters of the method for(const auto& arg_name : method.ordered_parameter_list) { @@ -428,11 +429,11 @@ void ir_gen::emit_schema_inherit_method(const schema& sc, if (method.return_type!=symbol::null() && method.return_type!=symbol::boolean()) { - impl->add_param("result"); - call->add_arg(lir::inst_value_t::variable("result")); + impl->add_param_variable("ret?result"); + call->add_arg(lir::inst_value_t::variable("ret?result")); } for(auto& arg : method.ordered_parameter_list) { - impl->add_param(arg); + impl->add_param_variable(arg); call->add_arg(lir::inst_value_t::variable(arg)); } irc.rule_impls.push_back(impl); @@ -468,7 +469,7 @@ void ir_gen::emit_schema_type_check_impl(const symbol& sym, const schema& sc) { "typecheck_" + sym.full_path_name(), report::span::null() ); - typecheck_impl->add_param("self"); + typecheck_impl->add_param_variable("self"); // generate inner data constraint call auto data_constraint_call = new lir::call( @@ -499,6 +500,7 @@ void ir_gen::emit_schema_get_field() { }; for(const auto& field : sc.second.ordered_fields) { + // generate get field method name auto name = "get_field_" + sym.full_path_name() + "_" + field; auto rule = new souffle_rule_decl(name); rule->set_return_type( @@ -512,15 +514,15 @@ void ir_gen::emit_schema_get_field() { // implementation of get field method auto rule_impl = new souffle_rule_impl(name, report::span::null()); - rule_impl->add_param("result"); - rule_impl->add_param("self"); + rule_impl->add_param_variable("ret?result"); + rule_impl->add_param_variable("self"); // necessary optimization, if the field is primary key, // we can directly store self in result to avoid extra join if (sc.second.fields.at(field).primary) { auto assign = new lir::store( lir::inst_value_t::variable("self"), - lir::inst_value_t::variable("result"), + lir::inst_value_t::variable("ret?result"), report::span::null() ); rule_impl->get_block()->add_new_content(assign); @@ -538,7 +540,7 @@ void ir_gen::emit_schema_get_field() { call->add_arg(lir::inst_value_t::default_value()); for(const auto& f : sc.second.ordered_fields) { call->add_arg(f==field? - lir::inst_value_t::variable("result"): + lir::inst_value_t::variable("ret?result"): lir::inst_value_t::default_value() ); } @@ -569,21 +571,20 @@ void ir_gen::emit_DO_schema_default_constructor() { // generate this method as a rule implementation: // rule_name(result, ...) :- schema_name(result, db, ...). - const auto function_name = replace_colon(sym.full_path_name() + "::__all__"); auto func_impl = new souffle_rule_impl( - "rule_" + function_name, + "rule_" + sym.full_path_name() + "::__all__", report::span::null() ); - func_impl->add_param("result"); - func_impl->add_param("db"); + func_impl->add_param_variable("ret?result"); + func_impl->add_param_variable("db"); irc.rule_impls.push_back(func_impl); auto call = new lir::call( - "schema_" + replace_colon(sym.full_path_name()), + "schema_" + sym.full_path_name(), report::span::null() ); func_impl->get_block()->add_new_content(call); - call->add_arg(lir::inst_value_t::variable("result")); + call->add_arg(lir::inst_value_t::variable("ret?result")); call->add_arg(lir::inst_value_t::variable("db")); for(size_t i = 0; iadd_arg(lir::inst_value_t::default_value()); @@ -813,6 +814,7 @@ void ir_gen::get_field_from_schema(call_expr* node) { const auto index = ctx->global.get_index(name); const auto& sch = ctx->global.get_schema(index); if (sch.fields.count(node->get_field_name()->get_name())) { + // generate get field method call auto lir_call = new lir::call( "get_field_" + name + "_" + node->get_field_name()->get_name(), node->get_location() @@ -1097,7 +1099,7 @@ void ir_gen::report_ignored_DO_schema_data_constraint() { if (ignored_DO_schema.empty()) { return; } - err.warn_report_ignored_DO_schema(ignored_DO_schema); + err.warn_ignored_DO_schema(ignored_DO_schema); } bool ir_gen::visit_number_literal(number_literal* node) { @@ -1426,10 +1428,10 @@ void ir_gen::not_data_constraint_func_decl(const std::string& function_name, ); if (node->has_return_value() && node->get_return_type()->get_full_name()!="bool") { - current_rule->add_param("result"); + current_rule->add_param_variable("ret?result"); } for(auto i : node->get_parameter_list()) { - current_rule->add_param(i->get_var_name()->get_name()); + current_rule->add_param_variable(i->get_var_name()->get_name()); } irc.rule_impls.push_back(current_rule); @@ -1502,27 +1504,23 @@ void ir_gen::data_constraint_func_decl(const std::string& function_name, if (sc.referenced_by_database_table && flag_ignore_do_schema_data_constraint) { // DO schema's __all__ does not need to be generated to data constraint - ignored_DO_schema.push_back({ - impl_schema_name, - node->get_name()->get_location() - }); + ignored_DO_schema.insert(impl_schema_name); } else { current_rule = new souffle_rule_impl( "schema_" + impl_schema_name, node->get_location() ); - current_rule->add_param("result"); + current_rule->add_param_variable("ret?result"); // add database name into parameter - current_rule->add_param( - database_param_name.empty()? - "[-1, -1]": - database_param_name - ); + if (database_param_name.empty()) { + current_rule->add_param_literal("[-1, -1]"); + } else { + current_rule->add_param_variable(database_param_name); + } // add field name into parameter, doing mangling for(const auto& f : sc.ordered_fields) { - const auto type = sc.fields.at(f); - const auto name_mangled_field = field_name_mangling(f, type); - current_rule->add_param(name_mangled_field); + const auto name_mangled_field = field_mangle(f); + current_rule->add_param_variable(name_mangled_field); } irc.rule_impls.push_back(current_rule); @@ -1558,13 +1556,13 @@ void ir_gen::data_constraint_func_decl(const std::string& function_name, "rule_" + function_name, node->get_location() ); - fn_impl->add_param("result"); + fn_impl->add_param_variable("ret?result"); for(auto i : node->get_parameter_list()) { - fn_impl->add_param(i->get_var_name()->get_name()); + fn_impl->add_param_variable(i->get_var_name()->get_name()); } auto call = new lir::call("schema_" + impl_schema_name, node->get_location()); fn_impl->get_block()->add_new_content(call); - call->add_arg(lir::inst_value_t::variable("result")); + call->add_arg(lir::inst_value_t::variable("ret?result")); call->add_arg(database_param_name.empty()? lir::inst_value_t::default_value(): lir::inst_value_t::variable(database_param_name) @@ -1645,7 +1643,7 @@ bool ir_gen::visit_query_decl(query_decl* node) { node->get_location() ); for(const auto& i : query_self.ordered_output_list) { - query_impl->add_param(i); + query_impl->add_param_variable(i); } query_impl->get_block()->set_use_comma(); blocks.push_back(query_impl->get_block()); @@ -1891,7 +1889,7 @@ bool ir_gen::visit_ret_stmt(ret_stmt* node) { if (value_stack.size()) { blocks.back()->add_new_content(new lir::store( value_stack.back().to_inst_value(), - lir::inst_value_t::variable("result"), + lir::inst_value_t::variable("ret?result"), node->get_return_value()->get_location() )); value_stack.pop_back(); @@ -1924,7 +1922,12 @@ bool ir_gen::visit_fact_data(fact_data* node) { } // inst_value_t here should be inst_value_t::variable - new_fact->add_pair(params[c], value_stack.back().to_inst_value()); + new_fact->add_pair( + params[c].content, + value_stack.back().to_inst_value() + ); + + // pop value stack value_stack.pop_back(); c++; } @@ -2233,7 +2236,7 @@ bool ir_gen::visit_func_call(func_call* node) { if (func_stack.back().kind==func_kind::schema_to) { auto schema_to_block = new lir::block(node->get_location()); auto typecheck_call = new lir::call( - "typecheck_" + replace_colon(func_stack.back().generic_type), + "typecheck_" + func_stack.back().generic_type, node->get_location() ); const auto source = value_stack.back(); @@ -2264,7 +2267,7 @@ bool ir_gen::visit_func_call(func_call* node) { // if (func_stack.back().kind==func_kind::schema_is) { auto typecheck_call = new lir::call( - "typecheck_" + replace_colon(func_stack.back().generic_type), + "typecheck_" + func_stack.back().generic_type, node->get_location() ); const auto source = value_stack.back(); @@ -2332,6 +2335,7 @@ void ir_gen::generate_spread_expr( const auto& infer_schema = ctx->global.get_schema(index); for(const auto& field : infer_schema.ordered_fields) { + // generate get field method name const auto name = "get_field_" + full_name + "_" + field; // generate call @@ -2397,7 +2401,7 @@ bool ir_gen::visit_initializer(initializer* node) { } else { // generate construct code in data constraint block for(const auto& f : sc.ordered_fields) { - const auto name_mangled_field = field_name_mangling(f, sc.fields.at(f)); + const auto name_mangled_field = field_mangle(f); blocks.back()->add_new_content(new lir::store( fields.at(f).to_inst_value(), lir::inst_value_t::variable(name_mangled_field), @@ -2407,15 +2411,15 @@ bool ir_gen::visit_initializer(initializer* node) { // generate result variable if (sc.has_primary_key()) { const auto& key = sc.get_primary_key(); - const auto name_mangled_field = field_name_mangling(key, sc.fields.at(key)); + const auto name_mangled_field = field_mangle(key); blocks.back()->add_new_content(new lir::store( lir::inst_value_t::variable(name_mangled_field), - lir::inst_value_t::variable("result"), + lir::inst_value_t::variable("ret?result"), node->get_location() )); } else { auto record = new lir::record( - lir::inst_value_t::variable("result"), + lir::inst_value_t::variable("ret?result"), node->get_location() ); blocks.back()->add_new_content(record); diff --git a/godel-script/godel-frontend/src/ir/ir_gen.h b/godel-script/godel-frontend/src/ir/ir_gen.h index a647ccda..814e6203 100644 --- a/godel-script/godel-frontend/src/ir/ir_gen.h +++ b/godel-script/godel-frontend/src/ir/ir_gen.h @@ -200,7 +200,7 @@ class ir_gen: public ast_visitor { void generate_method_call(func_call*, lir::call*); private: - std::vector> ignored_DO_schema; + std::unordered_set ignored_DO_schema; void report_ignored_DO_schema_data_constraint(); private: @@ -226,9 +226,14 @@ class ir_gen: public ast_visitor { std::vector&, bool); bool visit_for_stmt(for_stmt*) override; + // adjust order of generated IR, to change the join order, make it running faster + // for statement often uses a large set, so this optimization is useful in most cases void optimized_for_stmt_gen(for_stmt*); void unoptimized_for_stmt_gen(for_stmt*); bool visit_let_stmt(let_stmt*) override; + // adjust order of generated IR, to change the join order, make it running faster + // let statement often uses single value or a small set + // so this optimization is not very useful, or even harmful void optimized_let_stmt_gen(let_stmt*); void unoptimized_let_stmt_gen(let_stmt*); diff --git a/godel-script/godel-frontend/src/ir/lir.cpp b/godel-script/godel-frontend/src/ir/lir.cpp index e9e36245..5e43efa6 100644 --- a/godel-script/godel-frontend/src/ir/lir.cpp +++ b/godel-script/godel-frontend/src/ir/lir.cpp @@ -1,21 +1,11 @@ #include "godel-frontend/src/ir/lir.h" +#include "godel-frontend/src/ir/name_mangling.h" #include #include #include namespace godel { - -std::string replace_colon(const std::string& input) { - auto result = input; - auto colon_pos = result.find(':'); - while(colon_pos!=std::string::npos) { - result.replace(colon_pos, 1, "_"); - colon_pos = result.find(':', colon_pos+1); - } - return result; -} - namespace lir { std::ostream& operator<<(std::ostream& os, const inst_value_t& ivt) { @@ -52,7 +42,7 @@ void boolean::dump(std::ostream& os, const std::string& indent) const { } void store::dump(std::ostream& os, const std::string& indent) const { - os << indent << destination << " = " << source; + os << indent << target << " = " << source; } void call::generate_key_cmp(std::ostream& os) const { @@ -222,7 +212,7 @@ void call::generate_find(std::ostream& os) const { // class_instance_set = class_or_interface_instance // ) // - if (function_name=="find") { + if (function_name == "find") { os << "(" << destination << " = " << arguments[0] << ", "; os << arguments[0] << " = " << arguments[1] << ")"; return; @@ -246,7 +236,7 @@ void call::dump(std::ostream& os, const std::string& indent) const { } // normal function and method call - os << replace_colon(function_name) << "("; + os << get_mangled_name() << "("; if (destination.content.size()) { os << destination << (arguments.size()? ", ":""); } @@ -263,7 +253,7 @@ void call::dump(std::ostream& os, const std::string& indent) const { } void constructor::dump(std::ostream& os, const std::string& indent) const { - os << indent << "schema_" << replace_colon(schema_name); + os << indent << get_mangled_name(); os << "(" << destination << ", _" << (fields_value.size()? ", ":""); size_t s = fields_value.size(); @@ -294,7 +284,7 @@ void record::dump(std::ostream& os, const std::string& indent) const { } void unary::dump(std::ostream& os, const std::string& indent) const { - os << indent << destination << " = "; + os << indent << target << " = "; switch(operand) { case kind::op_neg: os << "-"; break; default: assert(false && "unreachable"); break; @@ -303,7 +293,7 @@ void unary::dump(std::ostream& os, const std::string& indent) const { } void binary::dump(std::ostream& os, const std::string& indent) const { - os << indent<< destination << " = "; + os << indent << target << " = "; os << left << " "; switch(operator_kind) { case kind::op_add: os << "+"; break; @@ -369,7 +359,19 @@ void not_operand::dump(std::ostream& os, const std::string& indent) const { // only one statement in the block if (body->get_content().size()==1) { os << indent << "!("; - body->get_content()[0]->dump(os, ""); + switch(body->get_content()[0]->get_kind()) { + case inst_kind::inst_not: + case inst_kind::inst_and: + case inst_kind::inst_or: + case inst_kind::inst_aggr: + os << "\n"; + body->get_content()[0]->dump(os, indent + " "); + os << "\n" << indent; + break; + default: + body->get_content()[0]->dump(os, ""); + break; + } os << ")"; return; } diff --git a/godel-script/godel-frontend/src/ir/lir.h b/godel-script/godel-frontend/src/ir/lir.h index 02dc66dd..8cb2e8c5 100644 --- a/godel-script/godel-frontend/src/ir/lir.h +++ b/godel-script/godel-frontend/src/ir/lir.h @@ -1,6 +1,7 @@ #pragma once #include "godel-frontend/src/error/error.h" +#include "godel-frontend/src/ir/name_mangling.h" #include #include @@ -8,9 +9,6 @@ #include namespace godel { - -std::string replace_colon(const std::string&); - namespace lir { enum class inst_value_kind { @@ -150,16 +148,16 @@ class boolean: public inst { class store: public inst { private: inst_value_t source; - inst_value_t destination; + inst_value_t target; public: store(const inst_value_t& src, - const inst_value_t& dst, + const inst_value_t& tgt, const report::span& loc): - inst(inst_kind::inst_store, loc), source(src), destination(dst) {} + inst(inst_kind::inst_store, loc), source(src), target(tgt) {} store(const store& s): inst(inst_kind::inst_store, s.get_location()), - source(s.source), destination(s.destination) {} + source(s.source), target(s.target) {} ~store() override = default; void dump(std::ostream&, const std::string&) const override; void accept(inst_visitor* v) override { @@ -167,7 +165,7 @@ class store: public inst { } const auto& get_source() const { return source; } - const auto& get_destination() const { return destination; } + const auto& get_target() const { return target; } }; class call: public inst { @@ -185,6 +183,7 @@ class call: public inst { basic_static, // basic static method (static call) }; +public: // native method for int type enum class int_method_kind { int_add, @@ -208,7 +207,7 @@ class call: public inst { int_to_set }; // mapper for method name -> int method kind - std::unordered_map int_basic_methods = { + const std::unordered_map int_basic_methods = { {"int::add", int_method_kind::int_add}, {"int::sub", int_method_kind::int_sub}, {"int::div", int_method_kind::int_div}, @@ -248,7 +247,7 @@ class call: public inst { string_replace_once }; // mapper for method name -> string method kind - std::unordered_map string_basic_methods = { + const std::unordered_map string_basic_methods = { {"string::substr", string_method_kind::string_substr}, {"string::get_regex_match_result", string_method_kind::string_get_regex_match_result}, {"string::matches", string_method_kind::string_matches}, @@ -300,6 +299,11 @@ class call: public inst { generic_type(c.generic_type) {} ~call() override = default; void dump(std::ostream&, const std::string&) const override; + void accept(inst_visitor* v) override { + v->visit_call(this); + } + +public: void add_arg(const inst_value_t& arg) { arguments.push_back(arg); } void set_return(const inst_value_t& dst) { destination = dst; } void set_call_type(kind t) { type = t; } @@ -307,14 +311,26 @@ class call: public inst { const auto& get_generic_type() const { return generic_type; } const auto& get_function_name() const { return function_name; } auto get_func_kind() const { return type; } - void accept(inst_visitor* v) override { - v->visit_call(this); - } - const auto& get_arguments() const { return arguments; } const auto& get_return() const { return destination; } auto& get_mutable_arguments() { return arguments; } auto& get_mutable_result() { return destination; } + +public: + // get mangled function name, may fail in some cases + // if failed to mangle, return raw function name directly + auto get_mangled_name() const { + switch(get_func_kind()) { + case lir::call::kind::database_load: + case lir::call::kind::find: + case lir::call::kind::key_cmp: + case lir::call::kind::to_set: + case lir::call::kind::basic_method: + case lir::call::kind::basic_static: return get_function_name(); + default: break; + } + return rule_mangle(get_function_name()); + } }; class constructor: public inst { @@ -340,6 +356,7 @@ class constructor: public inst { fields_value.push_back(source); } const auto& get_fields() const { return fields_value; } + const auto& get_result() const { return destination; } const auto& get_schema_name() const { return schema_name; } void accept(inst_visitor* v) override { v->visit_constructor(this); @@ -347,8 +364,18 @@ class constructor: public inst { auto& get_mutable_fields() { return fields_value; } auto& get_mutable_result() { return destination; } + +public: + // get mangled constructor name + auto get_mangled_name() const { + return rule_mangle("schema_" + schema_name); + } }; +// souffle record type, for example: +// res = [1, "str", -1.0] +// res type is [number, string, float] +// class record: public inst { private: std::vector fields_value; @@ -363,11 +390,14 @@ class record: public inst { fields_value(c.fields_value), destination(c.destination) {} ~record() override = default; + +public: void dump(std::ostream&, const std::string&) const override; void add_field(const inst_value_t& source) { fields_value.push_back(source); } const auto& get_fields() const { return fields_value; } + const auto& get_result() const { return destination; } void accept(inst_visitor* v) override { v->visit_record(this); } @@ -385,23 +415,24 @@ class unary: public inst { private: kind operand; inst_value_t source; - inst_value_t destination; + inst_value_t target; public: unary(const kind op, const inst_value_t& src, - const inst_value_t& dst, + const inst_value_t& tgt, const report::span& loc): inst(inst_kind::inst_unary, loc), operand(op), - source(src), destination(dst) {} + source(src), target(tgt) {} unary(const unary& u): inst(inst_kind::inst_unary, u.get_location()), operand(u.operand), - source(u.source), destination(u.destination) {} + source(u.source), target(u.target) {} ~unary() override = default; public: - const auto& get_destination() const { return destination; } - auto& get_mutable_destination() { return destination; } + const auto& get_source() const { return source; } + const auto& get_target() const { return target; } + auto& get_mutable_target() { return target; } public: void dump(std::ostream&, const std::string&) const override; @@ -422,21 +453,21 @@ class binary: public inst { private: inst_value_t left; inst_value_t right; - inst_value_t destination; + inst_value_t target; kind operator_kind; public: binary(const inst_value_t& l, const inst_value_t& r, - const inst_value_t& dst, + const inst_value_t& tgt, const kind op, const report::span& loc): inst(inst_kind::inst_binary, loc), left(l), right(r), - destination(dst), operator_kind(op) {} + target(tgt), operator_kind(op) {} binary(const binary& b): inst(inst_kind::inst_binary, b.get_location()), left(b.left), right(b.right), - destination(b.destination), operator_kind(b.operator_kind) {} + target(b.target), operator_kind(b.operator_kind) {} ~binary() override = default; public: @@ -449,8 +480,8 @@ class binary: public inst { auto get_operator() const { return operator_kind; } const auto& get_left() const { return left; } const auto& get_right() const { return right; } - const auto& get_destination() const { return destination; } - auto& get_mutable_destination() { return destination; } + const auto& get_target() const { return target; } + auto& get_mutable_target() { return target; } }; class compare: public inst { @@ -536,6 +567,9 @@ class fact: public inst { void add_pair(const std::string& name, const inst_value_t& literal) { literals.push_back({name, literal}); } + +public: + const auto& get_pairs() const { return literals; } void dump(std::ostream&, const std::string&) const override; void accept(inst_visitor* v) override { v->visit_fact(this); @@ -632,6 +666,10 @@ class aggregator: public inst { void accept(inst_visitor* v) override { v->visit_aggregator(this); } + +public: + const auto& get_target() const { return destination; } + auto& get_mutable_target() { return destination; } }; } diff --git a/godel-script/godel-frontend/src/ir/name_mangling.cpp b/godel-script/godel-frontend/src/ir/name_mangling.cpp index 377aae75..8a221ba8 100644 --- a/godel-script/godel-frontend/src/ir/name_mangling.cpp +++ b/godel-script/godel-frontend/src/ir/name_mangling.cpp @@ -1,8 +1,18 @@ #include "godel-frontend/src/ir/name_mangling.h" +#include +#include +#include +#include +#include + namespace godel { -std::string field_name_mangling(const std::string& name, const symbol& type) { +bool starts_with(const std::string& str, const std::string& prefix) { + return str.compare(0, prefix.size(), prefix) == 0; +} + +std::string field_mangle(const std::string& name) { // by field name mangling, we try to avoid variable name conflictions // for example: here's a schema `schema test {a: int}` // @@ -25,17 +35,108 @@ std::string field_name_mangling(const std::string& name, const symbol& type) { // and this will cause `ungrounded error` or `empty result`. // but if we do the name mangling, then it will be like this: // - // schema_test(result, [-1, -1], field_0x6669656c64_a_int) :- ( - // field_0x6669656c64_a_int = a, - // ^^^^^^^^^^^^^^^^^^^^^^^^ this is the field of test: `test.a` - // ^ this is the variable `a` - // result = [field_0x6669656c64_a_int], + // schema_test(result, [-1, -1], fld?a) :- ( + // fld?a = a, + // ^^^^^^^^^^ this is the field of test: `test.a` + // ^ this is the variable `a` + // result = [fld?a], // a = range(0, 10) // ). // - return "field_0x6669656c64_" + name + "_" + replace_colon( - type.full_path_name_without_set() - ); + // souffle identifier can use `?`, so we use it here. + // souffle identifier ll: [\?a-zA-Z]|[_\?a-zA-Z][_\?a-zA-Z0-9]+ + return "fld?" + name; +} + +std::string mangle(const std::string& name) { + static std::unordered_map cache = {}; + if (cache.count(name)) { + return cache.at(name); + } + + std::vector vec = {}; + size_t last = 0; + size_t pos = name.find("::", 0); + while(pos!=std::string::npos) { + if (pos>last) { + vec.push_back(name.substr(last, pos-last)); + } + last = pos + 2; + pos = name.find("::", last); + } + if (last!=name.length()) { + vec.push_back(name.substr(last)); + } + + auto tmp = std::string(""); + for(const auto& i : vec) { + tmp += std::to_string(i.length()) + i; + } + cache.insert({name, tmp}); + return tmp; +} + +std::string type_mangle(const std::string& name) { + static std::unordered_map cache = { + {"number", "number"}, + {"int", "int"}, + {"string", "string"}, + {"symbol", "symbol"}, + {"float", "float"}, + {"bool", "bool"}, + {"DBIndex", "DBIndex"} + }; + if (cache.count(name)) { + return cache.at(name); + } + + const auto res = "T_" + mangle(name); + cache.insert({name, res}); + return res; +} + +std::string rule_mangle(const std::string& name) { + static std::unordered_map cache = { + {"all_data_DBIndex", "all_data_DBIndex"} + }; + if (cache.count(name)) { + return cache.at(name); + } + + auto temp = std::string(""); + auto prefix = std::string(""); + if (starts_with(name, "rule_")) { + // rule_xxx -> R_xxx + temp = name.substr(5); + prefix = "R_"; + } else if (starts_with(name, "schema_")) { + // schema_xxx -> S_xxx + temp = name.substr(7); + prefix = "S_"; + } else if (starts_with(name, "input_")) { + // input_xxx -> I_xxx + temp = name.substr(6); + prefix = "I_"; + } else if (starts_with(name, "get_field_")) { + // get_field_xxx -> GF_xxx + temp = name.substr(10); + prefix = "GF_"; + } else if (starts_with(name, "get_table_")) { + // get_table_xxx -> GT_xxx + temp = name.substr(10); + prefix = "GT_"; + } else if (starts_with(name, "typecheck_")) { + // typecheck_xxx -> TC_xxx + temp = name.substr(10); + prefix = "TC_"; + } else { + // std::cerr << "unknown rule name: " << name << std::endl; + assert(false && "unknown rule name"); + } + + const auto res = prefix + mangle(temp); + cache.insert({name, res}); + return res; } } \ No newline at end of file diff --git a/godel-script/godel-frontend/src/ir/name_mangling.h b/godel-script/godel-frontend/src/ir/name_mangling.h index 466c03d9..a162d25a 100644 --- a/godel-script/godel-frontend/src/ir/name_mangling.h +++ b/godel-script/godel-frontend/src/ir/name_mangling.h @@ -1,11 +1,15 @@ #pragma once -#include "godel-frontend/src/ir/ir_context.h" -#include "godel-frontend/src/ir/lir.h" -#include "godel-frontend/src/symbol.h" +#include +#include namespace godel { -std::string field_name_mangling(const std::string&, const symbol&); +bool starts_with(const std::string&, const std::string&); + +std::string mangle(const std::string&); +std::string field_mangle(const std::string&); +std::string type_mangle(const std::string&); +std::string rule_mangle(const std::string&); } \ No newline at end of file diff --git a/godel-script/godel-frontend/src/ir/pass.h b/godel-script/godel-frontend/src/ir/pass.h index 4ff43e3a..49316aae 100644 --- a/godel-script/godel-frontend/src/ir/pass.h +++ b/godel-script/godel-frontend/src/ir/pass.h @@ -13,8 +13,11 @@ enum class pass_kind { ps_remove_unused, ps_remove_unused_type, ps_inst_combine, + ps_replace_find_call, ps_flatten_nested_block, - ps_aggregator_inline_remark + ps_aggregator_inline_remark, + ps_ungrounded_check, + ps_join_reorder }; // there are three types of passes: diff --git a/godel-script/godel-frontend/src/ir/pass_manager.cpp b/godel-script/godel-frontend/src/ir/pass_manager.cpp index 0c4bcf16..da063788 100644 --- a/godel-script/godel-frontend/src/ir/pass_manager.cpp +++ b/godel-script/godel-frontend/src/ir/pass_manager.cpp @@ -3,6 +3,9 @@ #include "godel-frontend/src/ir/remove_unused.h" #include "godel-frontend/src/ir/flatten_block.h" #include "godel-frontend/src/ir/aggregator_inline_remark.h" +#include "godel-frontend/src/ir/reorder.h" + +#include "godel-frontend/src/util/util.h" namespace godel { @@ -25,20 +28,24 @@ void pass_manager::run(ir_context& ctx, const cli::configure& conf) { ordered_pass_list.push_back(new unused_remove_pass(ctx)); ordered_pass_list.push_back(new unused_type_alias_remove_pass(ctx)); } - if (conf.count(cli::option::cli_enable_ir_merge)) { + if (!conf.count(cli::option::cli_disable_inst_combine)) { + ordered_pass_list.push_back(new replace_find_call(ctx)); ordered_pass_list.push_back(new inst_combine_pass(ctx)); } ordered_pass_list.push_back(new flatten_nested_block(ctx)); ordered_pass_list.push_back(new aggregator_inline_remark(ctx)); + if (conf.count(cli::option::cli_enable_join_reorder)) { + ordered_pass_list.push_back(new join_reorder(ctx)); + } bool verbose_info = conf.count(cli::option::cli_verbose); + util::time_stamp tsp; // must run in order, stop on first failure for(auto p : ordered_pass_list) { // print info if (verbose_info) { - std::clog << "IR Pass Running: "; - std::clog << p->get_name() << "\n"; + tsp.stamp(); } // run pass @@ -46,6 +53,11 @@ void pass_manager::run(ir_context& ctx, const cli::configure& conf) { err.err("failed to run pass: " + std::string(p->get_name())); break; } + + if (verbose_info) { + std::clog << util::format_time(tsp.duration()) << " "; + std::clog << p->get_name() << "\n"; + } } if (verbose_info) { diff --git a/godel-script/godel-frontend/src/ir/remove_unused.cpp b/godel-script/godel-frontend/src/ir/remove_unused.cpp index 00d5584e..9b91bde1 100644 --- a/godel-script/godel-frontend/src/ir/remove_unused.cpp +++ b/godel-script/godel-frontend/src/ir/remove_unused.cpp @@ -1,102 +1,12 @@ #include "godel-frontend/src/ir/remove_unused.h" +#include "godel-frontend/src/ir/name_mangling.h" namespace godel { -void call_graph_generator::check_inst(lir::inst* stmt, - std::queue& bfs, - used_dict& dict) const { - switch(stmt->get_kind()) { - case lir::inst_kind::inst_call: - dict.insert(replace_colon( - reinterpret_cast(stmt)->get_function_name() - )); - break; - case lir::inst_kind::inst_ctor: - dict.insert(replace_colon( - "schema_" + - reinterpret_cast(stmt)->get_schema_name() - )); - break; - case lir::inst_kind::inst_block: - bfs.push(reinterpret_cast(stmt)); - break; - case lir::inst_kind::inst_not: - bfs.push(reinterpret_cast(stmt)->get_body()); - break; - case lir::inst_kind::inst_and: - bfs.push(reinterpret_cast(stmt)->get_left_block()); - bfs.push(reinterpret_cast(stmt)->get_right_block()); - break; - case lir::inst_kind::inst_or: - bfs.push(reinterpret_cast(stmt)->get_left_block()); - bfs.push(reinterpret_cast(stmt)->get_right_block()); - break; - case lir::inst_kind::inst_aggr: - bfs.push(reinterpret_cast(stmt)->get_body()); - default: break; - } -} - -void call_graph_generator::scan_call(souffle_rule_impl* impl, - used_dict& dict) const { - // recursively search used rules - // but we use bfs queue to avoid stack overflow - // so visitor(dfs) is not needed here - std::queue bfs; - bfs.push(impl->get_block()); - while(!bfs.empty()) { - auto block = bfs.front(); - bfs.pop(); - for(auto stmt : block->get_content()) { - check_inst(stmt, bfs, dict); - } - } -} - -void call_graph_generator::initialize_call_graph_root(const std::vector& output, - call_graph& cg) const { - for(const auto& i : output) { - const auto name = replace_colon(i); - if (!cg.count(name)) { - cg.insert({name, {}}); - } - } -} - -void call_graph_generator::initialize_call_graph_root( - const std::vector& output, - call_graph& cg) const { - for(const auto& i : output) { - const auto name = replace_colon(i.rule_name); - if (!cg.count(name)) { - cg.insert({name, {}}); - } - } -} - -void call_graph_generator::initialize_call_graph(const std::vector& impls, - call_graph& cg) const { - for(auto i : impls) { - const auto name = replace_colon(i->get_func_name()); - if (!cg.count(name)) { - cg.insert({name, {}}); - } - // construct the call graph and mark all used rules - scan_call(i, cg.at(name)); - } -} - -const used_dict& call_graph_generator::apply(const ir_context& ctx) { +const callee_dict& unused_remove_pass::used_finder::apply(const ir_context& ctx) { // create call graph data structure - call_graph cg; - - // construct call graph by scanning the IR - initialize_call_graph_root(ctx.souffle_output, cg); - initialize_call_graph_root(ctx.annotated_output, cg); - initialize_call_graph(ctx.rule_impls, cg); - initialize_call_graph(ctx.database_get_table, cg); - initialize_call_graph(ctx.schema_get_field, cg); - initialize_call_graph(ctx.schema_data_constraint_impls, cg); + call_graph_generator cgg; + const auto& cg = cgg.apply(ctx); // use bfs to find all used rules std::queue bfs; @@ -106,12 +16,14 @@ const used_dict& call_graph_generator::apply(const ir_context& ctx) { used.insert("all_data_DBIndex"); // start from souffle output, the root of call graph for(const auto& i : ctx.souffle_output) { - bfs.push(replace_colon(i)); - used.insert(replace_colon(i)); + const auto mangled_name = rule_mangle(i); + bfs.push(mangled_name); + used.insert(mangled_name); } for(const auto& i : ctx.annotated_output) { - bfs.push(replace_colon(i.rule_name)); - used.insert(replace_colon(i.rule_name)); + const auto mangled_name = i.get_mangled_name(); + bfs.push(mangled_name); + used.insert(mangled_name); } // use bfs to find all used rules @@ -137,20 +49,22 @@ const used_dict& call_graph_generator::apply(const ir_context& ctx) { return used; } -void unused_remove_pass::remove_unused_schema_data_constraint_decl(const used_dict& used_rule) { +void unused_remove_pass::remove_unused_schema_data_constraint_decl( + const callee_dict& used_rule) { std::vector used; for(const auto& i : ctx->schema_data_constraint_decls) { - if (used_rule.count("schema_" + replace_colon(i.name))) { + if (used_rule.count(i.get_mangled_name())) { used.push_back(i); } } ctx->schema_data_constraint_decls = used; } -void unused_remove_pass::remove_unused_schema_data_constraint_impl(const used_dict& used_rule) { +void unused_remove_pass::remove_unused_schema_data_constraint_impl( + const callee_dict& used_rule) { std::vector used; for(auto i : ctx->schema_data_constraint_impls) { - if (used_rule.count(replace_colon(i->get_func_name()))) { + if (used_rule.count(i->get_mangled_name())) { used.push_back(i); } else { delete i; @@ -159,10 +73,11 @@ void unused_remove_pass::remove_unused_schema_data_constraint_impl(const used_di ctx->schema_data_constraint_impls = used; } -void unused_remove_pass::remove_unused_schema_get_field(const used_dict& used_rule) { +void unused_remove_pass::remove_unused_schema_get_field( + const callee_dict& used_rule) { std::vector used; for(auto i : ctx->schema_get_field) { - if (used_rule.count(replace_colon(i->get_func_name()))) { + if (used_rule.count(i->get_mangled_name())) { used.push_back(i); } else { delete i; @@ -171,10 +86,11 @@ void unused_remove_pass::remove_unused_schema_get_field(const used_dict& used_ru ctx->schema_get_field = used; } -void unused_remove_pass::remove_unused_rule_decl(const used_dict& used_rule) { +void unused_remove_pass::remove_unused_rule_decl( + const callee_dict& used_rule) { std::vector used; for(auto i : ctx->rule_decls) { - if (used_rule.count(replace_colon(i->get_rule_raw_name()))) { + if (used_rule.count(i->get_mangled_name())) { used.push_back(i); } else { delete i; @@ -183,10 +99,10 @@ void unused_remove_pass::remove_unused_rule_decl(const used_dict& used_rule) { ctx->rule_decls = used; } -void unused_remove_pass::remove_unused_rule_impl(const used_dict& used_rule) { +void unused_remove_pass::remove_unused_rule_impl(const callee_dict& used_rule) { std::vector used; for(auto i : ctx->rule_impls) { - if (used_rule.count(replace_colon(i->get_func_name()))) { + if (used_rule.count(i->get_mangled_name())) { used.push_back(i); } else { delete i; @@ -195,40 +111,42 @@ void unused_remove_pass::remove_unused_rule_impl(const used_dict& used_rule) { ctx->rule_impls = used; } -void unused_remove_pass::remove_unused_input_decl(const used_dict& used_rule) { +void unused_remove_pass::remove_unused_input_decl(const callee_dict& used_rule) { std::vector used; for(const auto& i : ctx->input_decls) { - if (used_rule.count(i.get_decl_name())) { + if (used_rule.count(i.get_mangled_name())) { used.push_back(i); } } ctx->input_decls = used; } -void unused_remove_pass::remove_unused_input_impl(const used_dict& used_rule) { +void unused_remove_pass::remove_unused_input_impl(const callee_dict& used_rule) { std::vector used; for(const auto& i : ctx->input_impls) { - if (used_rule.count(i.get_decl_name())) { + if (used_rule.count(i.get_mangled_name())) { used.push_back(i); } } ctx->input_impls = used; } -void unused_remove_pass::remove_unused_annotated_input(const used_dict& used_rule) { +void unused_remove_pass::remove_unused_annotated_input( + const callee_dict& used_rule) { std::vector used; for(const auto& i : ctx->annotated_input) { - if (used_rule.count(i.rule_name)) { + if (used_rule.count(i.get_mangled_name())) { used.push_back(i); } } ctx->annotated_input = used; } -void unused_remove_pass::remove_unused_database_get_table(const used_dict& used_rule) { +void unused_remove_pass::remove_unused_database_get_table( + const callee_dict& used_rule) { std::vector used; for(auto i : ctx->database_get_table) { - if (used_rule.count(replace_colon(i->get_func_name()))) { + if (used_rule.count(i->get_mangled_name())) { used.push_back(i); } else { delete i; @@ -238,8 +156,8 @@ void unused_remove_pass::remove_unused_database_get_table(const used_dict& used_ } bool unused_remove_pass::run() { - call_graph_generator cgg; - const auto& used_rule = cgg.apply(*ctx); + used_finder uf; + const auto& used_rule = uf.apply(*ctx); remove_unused_schema_data_constraint_decl(used_rule); remove_unused_schema_data_constraint_impl(used_rule); remove_unused_schema_get_field(used_rule); @@ -253,22 +171,22 @@ bool unused_remove_pass::run() { } bool unused_type_alias_remove_pass::run() { - std::unordered_set used_type = {"int", "string"}; + std::unordered_set used_type = {"int", "string", "float"}; for(const auto& i : ctx->schema_data_constraint_decls) { for(const auto& field : i.fields) { - used_type.insert(replace_colon(field.second)); + used_type.insert(type_mangle(field.second)); } } for(const auto& i : ctx->input_decls) { for(const auto& field : i.fields) { - used_type.insert(replace_colon(field.second)); + used_type.insert(type_mangle(field.second)); } } for(auto i : ctx->rule_decls) { for(const auto& param : i->get_params()) { - used_type.insert(replace_colon(param.second)); + used_type.insert(type_mangle(param.second)); } - used_type.insert(replace_colon(i->get_return_type())); + used_type.insert(type_mangle(i->get_return_type())); } // add their real type into the used type too for(const auto& i : ctx->type_alias) { diff --git a/godel-script/godel-frontend/src/ir/remove_unused.h b/godel-script/godel-frontend/src/ir/remove_unused.h index 220b6d86..80d68065 100644 --- a/godel-script/godel-frontend/src/ir/remove_unused.h +++ b/godel-script/godel-frontend/src/ir/remove_unused.h @@ -3,47 +3,34 @@ #include "godel-frontend/src/ir/lir.h" #include "godel-frontend/src/ir/ir_context.h" #include "godel-frontend/src/ir/pass.h" +#include "godel-frontend/src/ir/call_graph.h" #include #include #include -#include -#include namespace godel { -typedef std::unordered_set used_dict; -typedef std::unordered_map call_graph; - -class call_graph_generator { +class unused_remove_pass: public pass { private: - used_dict used; + class used_finder { + private: + callee_dict used; -private: - void check_inst(lir::inst*, std::queue&, used_dict&) const; - void scan_call(souffle_rule_impl*, used_dict&) const; - void initialize_call_graph_root(const std::vector&, - call_graph&) const; - void initialize_call_graph_root(const std::vector&, - call_graph&) const; - void initialize_call_graph(const std::vector&, - call_graph&) const; + public: + const callee_dict& apply(const ir_context&); + }; -public: - const used_dict& apply(const ir_context&); -}; - -class unused_remove_pass: public pass { private: - void remove_unused_schema_data_constraint_decl(const used_dict&); - void remove_unused_schema_data_constraint_impl(const used_dict&); - void remove_unused_schema_get_field(const used_dict&); - void remove_unused_rule_decl(const used_dict&); - void remove_unused_rule_impl(const used_dict&); - void remove_unused_input_decl(const used_dict&); - void remove_unused_input_impl(const used_dict&); - void remove_unused_annotated_input(const used_dict&); - void remove_unused_database_get_table(const used_dict&); + void remove_unused_schema_data_constraint_decl(const callee_dict&); + void remove_unused_schema_data_constraint_impl(const callee_dict&); + void remove_unused_schema_get_field(const callee_dict&); + void remove_unused_rule_decl(const callee_dict&); + void remove_unused_rule_impl(const callee_dict&); + void remove_unused_input_decl(const callee_dict&); + void remove_unused_input_impl(const callee_dict&); + void remove_unused_annotated_input(const callee_dict&); + void remove_unused_database_get_table(const callee_dict&); public: unused_remove_pass(ir_context& c): pass(pass_kind::ps_remove_unused, c) {} diff --git a/godel-script/godel-frontend/src/ir/reorder.cpp b/godel-script/godel-frontend/src/ir/reorder.cpp new file mode 100644 index 00000000..fad7f1c3 --- /dev/null +++ b/godel-script/godel-frontend/src/ir/reorder.cpp @@ -0,0 +1,545 @@ +#include "godel-frontend/src/ir/reorder.h" +#include "godel-frontend/src/ir/call_graph.h" + +#include + +namespace godel { +namespace reorder { + +void cost_analysis::tarjan(const std::string& node, const call_graph& cg) { + // init visit time stamp + DFN[node] = LOW[node] = ++index; + + // push stack + in_stack[node] = true; + Stap.push_back(node); + + // search next node + for(const auto& succ : cg.at(node)) { + if (!cg.count(succ)) { + continue; + } + if (!DFN.at(succ)) { + tarjan(succ, cg); + LOW[node] = std::min(LOW[node], LOW[succ]); + } else if (in_stack[succ]) { + LOW[node] = std::min(LOW[node], DFN[succ]); + } + } + if (DFN[node]==LOW[node]) { + std::vector res = {}; + + // get result from stack + auto top = std::string(""); + while(top!=node) { + top = Stap.back(); + Stap.pop_back(); + in_stack[top] = false; + res.push_back(top); + } + + // get self-circle + if (res.size()==1 && cg.at(node).count(node)) { + in_circle_rule_set.insert(node); + } + // get strongly connected components + if (res.size()>1) { + for(const auto& i : res) { + in_circle_rule_set.insert(i); + } + } + } +} + +void cost_analysis::solve_circle(const call_graph& cg) { + Stap = {}; + index = 0; + for(const auto& i : cg) { + DFN[i.first] = 0; + LOW[i.first] = 0; + in_stack[i.first] = false; + } + for(const auto& i : cg) { + if (!DFN.at(i.first)) { + tarjan(i.first, cg); + } + } +} + +void cost_analysis::topo_delete_leaf( + const std::unordered_set& set, call_graph& cg) { + // delete scanned nodes + for(const auto& i : set) { + cg.erase(i); + } + // and delete references of these nodes + for(auto& i : cg) { + for(const auto& j : set) { + if (i.second.count(j)) { + i.second.erase(j); + } + } + } +} + +void cost_analysis::topo_scan(call_graph& copy) { + topo_sort_result.push_back({}); + for(const auto& i : copy) { + // reference list is empty + if (i.second.empty()) { + topo_sort_result.back().insert(i.first); + } + // in circle, self-circle also included + if (i.second.size()) { + bool flag_all_ref_in_circle = true; + for(const auto& j : i.second) { + if (!in_circle_rule_set.count(j)) { + flag_all_ref_in_circle = false; + break; + } + } + if (flag_all_ref_in_circle) { + topo_sort_result.back().insert(i.first); + } + } + } + // delete reference + topo_delete_leaf(topo_sort_result.back(), copy); +} + +void cost_analysis::topo_sort(const call_graph& cg) { + // detect self-circle and circle using tarjan algorithm. + solve_circle(cg); + + // init leaf node + topo_sort_result = {{}}; + // leaf node include all kinds of input rules + for(const auto& i : ctx->annotated_input) { + topo_sort_result.back().insert(i.get_mangled_name()); + } + for(const auto& i : ctx->input_impls) { + topo_sort_result.back().insert(i.get_mangled_name()); + } + // all_data_DBIndex is generated automatically, so we add it here + topo_sort_result.back().insert("all_data_DBIndex"); + + // do a copy of call graph + auto copy = cg; + + // delete native functions like: key_eq, key_neq + // otherwise topological sort will loop forever + // because these native functions will never be found in the call graph + for(auto& i : copy) { + std::unordered_set need_delete; + for(auto& j : i.second) { + if (!mapper.count(j) && j!="all_data_DBIndex") { + need_delete.insert(j); + } + } + for(const auto& j : need_delete) { + i.second.erase(j); + } + } + + // delete initialized leaves + topo_delete_leaf(topo_sort_result.back(), copy); + + while(copy.size()) { + topo_scan(copy); + if (topo_sort_result.back().empty()) { + // should be unreachable, but it may encounter an error + // if logic is changed in future changes + // so we add this branch for defence + break; + } + } +} + +void cost_analysis::visit_store(lir::store* node) { + auto res = 0; + if (node->get_source().kind==lir::inst_value_kind::variable) { + res += var_grounded.count(node->get_source().content)? 0:1; + // source of store is not always grounded + } + if (node->get_target().kind==lir::inst_value_kind::variable) { + res += var_grounded.count(node->get_target().content)? 0:1; + // target is grounded if source is grounded + if (var_grounded.count(node->get_source().content)) { + add_var_grounded(node->get_target().content); + } + } + block_cost_frame.back() *= res; +} + +void cost_analysis::visit_call(lir::call* node) { + // do not analyse intrinsic functions + switch(node->get_func_kind()) { + case lir::call::kind::database_load: + case lir::call::kind::find: + case lir::call::kind::key_cmp: + case lir::call::kind::to_set: + case lir::call::kind::basic_method: + case lir::call::kind::basic_static: return; + default: break; + } + + const auto name = node->get_mangled_name(); + if (rule_cost.count(name)) { + block_cost_frame.back() *= rule_cost.at(name); + } + + // check if argument is grounded + auto res = 0; + for(const auto& i : node->get_arguments()) { + if (i.kind!=lir::inst_value_kind::variable) { + continue; + } + res += var_grounded.count(i.content)? 0:1; + add_var_grounded(i.content); + } + block_cost_frame.back() *= res; + + // rules in circle have more cost + if (in_circle_rule_set.count(name)) { + block_cost_frame.back() *= 2; + } +} + +void cost_analysis::visit_constructor(lir::constructor* node) { + const auto name = node->get_mangled_name(); + if (rule_cost.count(name)) { + block_cost_frame.back() *= rule_cost.at(name); + } + + // check if argument is grounded + auto res = 0; + for(const auto& i : node->get_fields()) { + if (i.kind!=lir::inst_value_kind::variable) { + continue; + } + res += var_grounded.count(i.content)? 0:1; + add_var_grounded(i.content); + } + block_cost_frame.back() *= res; + + // rules in circle have more cost + if (in_circle_rule_set.count(name)) { + block_cost_frame.back() *= 2; + } +} + +void cost_analysis::visit_record(lir::record* node) { + // check if argument is grounded + // if fact variables used in record must be grounded + auto res = 0; + for(const auto& i : node->get_fields()) { + if (i.kind!=lir::inst_value_kind::variable) { + continue; + } + res += var_grounded.count(i.content)? 0:1; + // variable used in record is a variable-call + // so we do not add it to var_grounded + } + + add_var_grounded(node->get_result().content); + block_cost_frame.back() *= res; +} + +void cost_analysis::visit_unary(lir::unary* node) { + auto res = 0; + if (node->get_source().kind==lir::inst_value_kind::variable) { + res += var_grounded.count(node->get_source().content)? 0:1; + } + if (node->get_target().kind==lir::inst_value_kind::variable) { + res += var_grounded.count(node->get_target().content)? 0:1; + add_var_grounded(node->get_target().content); + } + block_cost_frame.back() *= res; +} + +void cost_analysis::visit_binary(lir::binary* node) { + auto res = 0; + if (node->get_left().kind==lir::inst_value_kind::variable) { + res += var_grounded.count(node->get_left().content)? 0:1; + } + if (node->get_right().kind==lir::inst_value_kind::variable) { + res += var_grounded.count(node->get_right().content)? 0:1; + } + if (node->get_target().kind==lir::inst_value_kind::variable) { + res += var_grounded.count(node->get_target().content)? 0:1; + add_var_grounded(node->get_target().content); + } + block_cost_frame.back() *= res; +} + +void cost_analysis::visit_compare(lir::compare* node) { + auto res = 0; + if (node->get_left().kind==lir::inst_value_kind::variable) { + res += var_grounded.count(node->get_left().content)? 0:1; + add_var_grounded(node->get_left().content); + } + if (node->get_right().kind==lir::inst_value_kind::variable) { + res += var_grounded.count(node->get_right().content)? 0:1; + } + block_cost_frame.back() *= res; +} + +void cost_analysis::visit_block(lir::block* node) { + push_var_frame(); + + for(auto i : node->get_content()) { + block_cost_frame.push_back(1); + i->accept(this); + + // use `,` means `and`, otherwise means `or` + // use cost::operator* if in `and` block + // use cost::operator+ if in `or` block + auto res = block_cost_frame.back(); + block_cost_frame.pop_back(); + if (node->get_use_comma()) { + block_cost_frame.back() *= res; + } else { + block_cost_frame.back() += res; + } + } + + pop_var_frame(); +} + +void cost_analysis::visit_fact(lir::fact* node) { + block_cost_frame.back() += node->get_pairs().size(); +} + +void cost_analysis::visit_not_operand(lir::not_operand* node) { + // push new cost frame + block_cost_frame.push_back(1); + // push new var frame + push_var_frame(); + + node->get_body()->accept(this); + + // get cost frame result + const auto res = block_cost_frame.back(); + block_cost_frame.pop_back(); + // pop var frame + pop_var_frame(); + + block_cost_frame.back() *= res; +} + +void cost_analysis::visit_and_operand(lir::and_operand* node) { + // push new cost frame + block_cost_frame.push_back(1); + // push new var frame + push_var_frame(); + + node->get_left_block()->accept(this); + + // get cost frame result + const auto res_left = block_cost_frame.back(); + block_cost_frame.pop_back(); + // pop var frame + pop_var_frame(); + + // push new cost frame + block_cost_frame.push_back(1); + // push new var frame + push_var_frame(); + + node->get_right_block()->accept(this); + + // get cost frame result + const auto res_right = block_cost_frame.back(); + block_cost_frame.pop_back(); + // pop var frame + pop_var_frame(); + + block_cost_frame.back() *= res_left * res_right; +} + +void cost_analysis::visit_or_operand(lir::or_operand* node) { + // push new cost frame + block_cost_frame.push_back(1); + // push new var frame + push_var_frame(); + + node->get_left_block()->accept(this); + + // get cost frame result + const auto res_left = block_cost_frame.back(); + block_cost_frame.pop_back(); + // pop var frame + pop_var_frame(); + + // push new cost frame + block_cost_frame.push_back(1); + // push new var frame + push_var_frame(); + + node->get_right_block()->accept(this); + + // get cost frame result + const auto res_right = block_cost_frame.back(); + block_cost_frame.pop_back(); + // pop var frame + pop_var_frame(); + + block_cost_frame.back() *= res_left + res_right; +} + +void cost_analysis::visit_aggregator(lir::aggregator* node) { + // push new var frame + push_var_frame(); + + node->get_body()->accept(this); + + // pop var frame + pop_var_frame(); + + block_cost_frame.back() *= 1; +} + +std::unordered_map cost_analysis::run() { + // init rule name -> impl* mapper + mapper.clear(); + for(auto i : ctx->rule_impls) { + mapper[i->get_mangled_name()].push_back(i); + } + for(auto i : ctx->database_get_table) { + mapper[i->get_mangled_name()].push_back(i); + } + for(auto i : ctx->schema_get_field) { + mapper[i->get_mangled_name()].push_back(i); + } + for(auto i : ctx->schema_data_constraint_impls) { + mapper[i->get_mangled_name()].push_back(i); + } + + // toposort + call_graph_generator cgg; + const auto& cg = cgg.apply(*ctx); + topo_sort(cg); + + // calculate cost + rule_cost = {}; + for(const auto& level : topo_sort_result) { + for(const auto& i : level) { + // input rules & database constraints' cost should be initialized + if (!mapper.count(i) && !rule_cost.count(i)) { + rule_cost[i] = (i=="all_data_DBIndex"? 1:100); + } + if (mapper.count(i) && !rule_cost.count(i)) { + rule_cost[i] = 0; + for(const auto& j : mapper.at(i)) { + // push new cost frame + block_cost_frame.push_back(1); + + // do calculation + j->get_block()->accept(this); + + // get cost result + rule_cost[i] += block_cost_frame.back(); + block_cost_frame.pop_back(); + } + } + } + } + + std::unordered_map cost_map; + for(const auto& i : rule_cost) { + cost_map.insert({i.first, i.second.num}); + } + + return cost_map; +} + +} + +void join_reorder::visit_block(lir::block* node) { + // use semicolon means this is `or statement`, so we don't need to reorder + if (node->get_use_semicolon()) { + for(auto i : node->get_content()) { + i->accept(this); + } + return; + } + + // temp is used to store the insts which don't need to be reordered + std::vector temp; + // store the rules or constructors which need to be reordered + std::vector> need_reorder_inst; + + // find rules or constructors which need to be reordered + // and push them to need_reorder_inst + for(auto i : node->get_content()) { + if (i->get_kind()==lir::inst_kind::inst_call) { + auto call = reinterpret_cast(i); + const auto name = call->get_mangled_name(); + if (cost_map.count(name) && cost_map.at(name)>3000) { + need_reorder_inst.push_back({name, i}); + } else if (name.find("__all__")!=std::string::npos) { + need_reorder_inst.push_back({name, i}); + } else { + temp.push_back(i); + } + } else if (i->get_kind()==lir::inst_kind::inst_ctor) { + auto ctor = reinterpret_cast(i); + const auto name = ctor->get_mangled_name(); + if (cost_map.count(name) && cost_map.at(name)>3000) { + need_reorder_inst.push_back({name, i}); + } else if (name.find("__all__")!=std::string::npos) { + need_reorder_inst.push_back({name, i}); + } else { + temp.push_back(i); + } + } else { + temp.push_back(i); + } + i->accept(this); + } + + // TODO: algorithem should be rewritten later + // sort with costs, but this is not a good way of reordering + // because rules's cost is not only based on the cost of the rule + // but also based on the natural joins + // if the natural joins are not reordered, the cost of the rules + // will be higher than before. + std::sort(need_reorder_inst.begin(), need_reorder_inst.end(), + [&](const auto& a, const auto& b) { + return cost_map.at(a.first) < cost_map.at(b.first); + } + ); + + node->get_mutable_content().clear(); + for(auto i : temp) { + node->add_new_content(i); + } + for(auto& i : need_reorder_inst) { + node->add_new_content(i.second); + } +} + +bool join_reorder::run() { + cost_map = reorder::cost_analysis(ctx).run(); + // for(const auto& i : cost_map) { + // if (i.second < 3000) { + // continue; + // } + // std::cout << i.first << " " << i.second << "\n"; + // } + for(auto i : ctx->rule_impls) { + i->get_block()->accept(this); + } + for(auto i : ctx->database_get_table) { + i->get_block()->accept(this); + } + for(auto i : ctx->schema_get_field) { + i->get_block()->accept(this); + } + for(auto i : ctx->schema_data_constraint_impls) { + i->get_block()->accept(this); + } + return true; +} + +} diff --git a/godel-script/godel-frontend/src/ir/reorder.h b/godel-script/godel-frontend/src/ir/reorder.h new file mode 100644 index 00000000..c3ba53e9 --- /dev/null +++ b/godel-script/godel-frontend/src/ir/reorder.h @@ -0,0 +1,153 @@ +#pragma once + +#include "godel-frontend/src/ir/lir.h" +#include "godel-frontend/src/ir/ir_context.h" +#include "godel-frontend/src/ir/pass.h" +#include "godel-frontend/src/ir/call_graph.h" + +#include + +namespace godel { +namespace reorder { + +// cost type, for rule cost calculation +struct cost { +private: + static size_t quick_multiply(size_t a, size_t b) { + size_t res = 0; + while(b) { + if (b & 1) { + size_t tmp = res + a; + if (tmp < std::max(res, a)) { + return SIZE_MAX; + } + res = tmp; + } + a <<= 1; + b >>= 1; + } + return res; + } + +public: + size_t num; + + cost(size_t n = 0): num(n) {} + + // * is in fact get sum value + // if overflow, use the max value to mark as INF + cost operator*(const cost& other) const { + return cost { quick_multiply(num, other.num) }; + } + + // + is in fact get max value + cost operator+(const cost& other) const { + const size_t res = num + other.num; + if (res < std::max(num, other.num)) { + return cost { SIZE_MAX }; + } + return cost { res }; + } + + cost& operator*=(const cost& other) { + *this = *this * other; + return *this; + } + + cost& operator+=(const cost& other) { + *this = *this + other; + return *this; + } +}; + +class cost_analysis: public lir::inst_visitor { +// check rule call circle before doing topological sort +private: + std::unordered_set in_circle_rule_set; + + std::unordered_map DFN; + std::unordered_map LOW; + std::unordered_map in_stack; + size_t index; + std::vector Stap; + void tarjan(const std::string&, const call_graph&); + void solve_circle(const call_graph&); + +// do topological sort +private: + std::vector> topo_sort_result; + + void topo_delete_leaf(const std::unordered_set&, call_graph&); + void topo_scan(call_graph&); + void topo_sort(const call_graph&); + +// rule cost calculation +private: + std::unordered_map> mapper; + std::unordered_map rule_cost; + std::vector block_cost_frame; + + // need to check variable grounding + // if rules call with some already grounded variables + // these variables will do natural join instead of join + // this will affect the cost calculation + // so we need to record the variable that has been grounded + std::unordered_set var_grounded; + std::vector> var_grounded_frame; + void push_var_frame() { var_grounded_frame.push_back({}); } + void add_var_grounded(const std::string& var) { + if (var_grounded.count(var)) { + return; + } + var_grounded.insert(var); + var_grounded_frame.back().insert(var); + } + void pop_var_frame() { + for(const auto& i : var_grounded_frame.back()) { + var_grounded.erase(i); + } + var_grounded_frame.pop_back(); + } + +private: + void visit_store(lir::store*) override; + void visit_call(lir::call*) override; + void visit_constructor(lir::constructor*) override; + void visit_record(lir::record*) override; + void visit_unary(lir::unary*) override; + void visit_binary(lir::binary*) override; + void visit_compare(lir::compare*) override; + void visit_block(lir::block*) override; + void visit_fact(lir::fact*) override; + void visit_not_operand(lir::not_operand*) override; + void visit_and_operand(lir::and_operand*) override; + void visit_or_operand(lir::or_operand*) override; + void visit_aggregator(lir::aggregator*) override; + +private: + ir_context* ctx; + +public: + cost_analysis(ir_context* c): ctx(c) {} + std::unordered_map run(); +}; + +} + +// reorder join order pass, used to optimize execution time +class join_reorder: public pass { +private: + std::unordered_map cost_map; + +private: + void visit_block(lir::block*) override; + +public: + join_reorder(ir_context& c): pass(pass_kind::ps_join_reorder, c) {} + const char* get_name() const override { + return "[Transform] Join Reorder"; + } + bool run() override; +}; + +} diff --git a/godel-script/godel-frontend/src/sema/context.h b/godel-script/godel-frontend/src/sema/context.h index 1161e45b..67ac8a4e 100644 --- a/godel-script/godel-frontend/src/sema/context.h +++ b/godel-script/godel-frontend/src/sema/context.h @@ -39,7 +39,7 @@ struct context { // store variable names that should not be used const std::unordered_set invalid_variable_name = { "Self", "self", "count", "sum", "output", - "input", "max", "min", "result" + "input", "max", "min" }; public: diff --git a/godel-script/godel-frontend/src/sema/function_declaration.h b/godel-script/godel-frontend/src/sema/function_declaration.h index 756afbec..06411da0 100644 --- a/godel-script/godel-frontend/src/sema/function_declaration.h +++ b/godel-script/godel-frontend/src/sema/function_declaration.h @@ -20,7 +20,7 @@ class function_generator { // not the same as ctx.invalid_variable_name, this allows `self` const std::unordered_set invalid_parameter_name = { "Self", "count", "sum", "output", - "input", "max", "min", "result" + "input", "max", "min" }; bool flag_in_impl = false; std::string self_type_name = ""; diff --git a/godel-script/godel-frontend/src/sema/symbol_import.cpp b/godel-script/godel-frontend/src/sema/symbol_import.cpp index 7050b66f..407035fb 100644 --- a/godel-script/godel-frontend/src/sema/symbol_import.cpp +++ b/godel-script/godel-frontend/src/sema/symbol_import.cpp @@ -53,7 +53,6 @@ configure symbol_import::inherit_config(const std::string& filename) { // executable path, for souffle arguments option::cli_executable_path, // semantic check options - option::cli_semantic_no_else, option::cli_semantic_pub_check, // verbose info dump option::cli_verbose, diff --git a/godel-script/godel-frontend/src/sema/ungrounded_checker.cpp b/godel-script/godel-frontend/src/sema/ungrounded_checker.cpp index e2f5410e..5a9e1d30 100644 --- a/godel-script/godel-frontend/src/sema/ungrounded_checker.cpp +++ b/godel-script/godel-frontend/src/sema/ungrounded_checker.cpp @@ -4,7 +4,7 @@ namespace godel { bool return_ungrounded_checker::visit_in_block_expr(in_block_expr* node) { err->err(node->get_location(), - "require a return statement, but get an expression.", + "require return statement, but get expression.", "return value is ungrounded." ); return true; @@ -15,7 +15,7 @@ bool return_ungrounded_checker::visit_let_stmt(let_stmt* node) { node->get_code_block()->accept(this); } else { err->err(node->get_location(), - "require a return statement in this statement.", + "require return statement in this statement.", "return value is ungrounded." ); } @@ -27,7 +27,7 @@ bool return_ungrounded_checker::visit_if_stmt(if_stmt* node) { node->get_code_block()->accept(this); } else { err->err(node->get_location(), - "require a return statement in this statement.", + "require return statement in this statement.", "return value is ungrounded." ); } @@ -39,7 +39,7 @@ bool return_ungrounded_checker::visit_for_stmt(for_stmt* node) { node->get_code_block()->accept(this); } else { err->err(node->get_location(), - "require a return statement in this statement.", + "require return statement in this statement.", "return value is ungrounded." ); } @@ -62,8 +62,8 @@ bool return_ungrounded_checker::visit_match_stmt(match_stmt* node) { bool return_ungrounded_checker::visit_block_stmt(block_stmt* node) { if (node->get_statement().empty()) { err->err(node->get_location(), - "require a return statement in this block.", - "otherwise the return value is ungrounded." + "require return statement in this block.", + "return value is ungrounded." ); } for(auto i : node->get_statement()) { @@ -77,7 +77,7 @@ bool return_ungrounded_checker::visit_block_stmt(block_stmt* node) { case ast_class::ac_in_block_expr: i->accept(this); break; default: err->err(i->get_location(), - "require a return statement in this statement.", + "require return statement in this statement.", "return value is ungrounded." ); } @@ -90,6 +90,7 @@ bool return_ungrounded_checker::visit_function_decl(function_decl* func) { if (!func->has_return_value() || !func->implemented()) { return true; } + // do not check predicate if (func->get_return_type()->get_resolve().type==symbol::boolean()) { return true; @@ -100,7 +101,88 @@ bool return_ungrounded_checker::visit_function_decl(function_decl* func) { return true; } -bool negative_expression_ungrounded_checker::visit_call_expr(call_expr* node) { +bool undetermined_checker::match_undetermined_call(call_root* node) { + // undetermined call in souffle is in fact an ungrounded error + // if variables assigned by undetermined call is not bound, + // it will cause ungrounded error. + // undetermined call in godel script is like: + // + // int::__undetermined_all__() + // string::__undetermined_all__() + // + + // call head should be identifier `int` or `string`, without function call. + auto head = node->get_call_head(); + if (head->has_func_call() || head->is_initializer()) { + return false; + } + auto first = head->get_first_expression(); + // check call head is in fact an identifier + if (first->get_ast_class()!=ast_class::ac_identifier) { + return false; + } + // identifier must be `int` or `string` + const auto& name = reinterpret_cast(first)->get_name(); + if (name!="int" && name!="string") { + return false; + } + + if (node->get_call_chain().empty()) { + return false; + } + + // first call expression should be get path + auto first_call = node->get_call_chain()[0]; + if (first_call->get_call_type()!=call_expr::type::get_path) { + return false; + } + auto field = first_call->get_field_name(); + // `__undetermined_all__` is a special function. + if (field->get_name()!="__undetermined_all__") { + return false; + } + if (!first_call->has_func_call()) { + return false; + } + + return true; +} + +bool undetermined_checker::visit_call_root(call_root* node) { + if (match_undetermined_call(node)) { + if (node->get_call_chain().size()>1) { + err->err(node->get_location(), + "ungrounded value cannot be used in call chain." + ); + } else if (!in_for_initialization_level) { + err->warn(node->get_location(), + "undetermined value used outside for-initialization.", + "will cause ungrounded error." + ); + } + } + + node->get_call_head()->accept(this); + for(auto i : node->get_call_chain()) { + i->accept(this); + } + return true; +} + +bool undetermined_checker::visit_for_stmt(for_stmt* node) { + ++in_for_initialization_level; + for(auto i : node->get_symbols()) { + i->accept(this); + } + --in_for_initialization_level; + + if (node->has_statement()) { + node->get_code_block()->accept(this); + } + return true; +} + +bool neg_expr_ungrounded_checker::visit_call_expr(call_expr* node) { if (in_logical_negative_expression_level) { if (node->is_aggregator_find()) { err->err(node->get_field_name()->get_location(), @@ -132,6 +214,13 @@ bool negative_expression_ungrounded_checker::visit_call_expr(call_expr* node) { "will cause ungrounded error." ); } + if (node->has_func_call() && + node->get_func_call()->get_resolve().type!=symbol::boolean()) { + err->warn(node->get_location(), + "non-boolean return value in logical negative expression.", + "will produce temporary variables, causing ungrounded error." + ); + } } node->get_field_name()->accept(this); if (node->is_generic()) { @@ -146,7 +235,7 @@ bool negative_expression_ungrounded_checker::visit_call_expr(call_expr* node) { return true; } -bool negative_expression_ungrounded_checker::visit_initializer(initializer* node) { +bool neg_expr_ungrounded_checker::visit_initializer(initializer* node) { if (in_logical_negative_expression_level) { err->err(node->get_location(), "object construction is not allowed in logical negative expression.", @@ -159,31 +248,40 @@ bool negative_expression_ungrounded_checker::visit_initializer(initializer* node return true; } -bool negative_expression_ungrounded_checker::visit_unary_operator(unary_operator* node) { - bool is_logical_negative = ( - node->get_operator_type()==unary_operator::type::logical_negation - ); - if (is_logical_negative) { +bool neg_expr_ungrounded_checker::visit_unary_operator(unary_operator* node) { + if (node->get_operator_type()==unary_operator::type::logical_negation) { in_logical_negative_expression_level++; } node->get_child()->accept(this); - if (is_logical_negative) { + if (node->get_operator_type()==unary_operator::type::logical_negation) { in_logical_negative_expression_level--; } return true; } -void ungrounded_parameter_checker::unused_parameter_check(const report::span& stmt_loc) { +bool neg_expr_ungrounded_checker::visit_binary_operator(binary_operator* node) { + if (in_logical_negative_expression_level && !in_binary_operator_level) { + err->warn(node->get_location(), + "binary expression used in logical negative expression.", + "will produce temporary variables, causing ungrounded error." + ); + } + ++in_binary_operator_level; + node->get_left()->accept(this); + node->get_right()->accept(this); + --in_binary_operator_level; + return true; +} + +void ungrounded_parameter_checker::report_unused_parameter(const report::span& stmt_loc) { // do not check inline function & check if need to check constraint for self bool flag_is_self_typecheck_free = false; - if (func_node->get_annotations().size()) { - for(auto i : func_node->get_annotations()) { - if (i->get_annotation()=="@inline") { - return; - } - if (i->get_annotation()=="@self_typecheck_free") { - flag_is_self_typecheck_free = true; - } + for(auto i : func_node->get_annotations()) { + if (i->get_annotation()=="@inline") { + return; + } + if (i->get_annotation()=="@self_typecheck_free") { + flag_is_self_typecheck_free = true; } } @@ -195,7 +293,7 @@ void ungrounded_parameter_checker::unused_parameter_check(const report::span& st bool flag_self_ungrounded = false; // start checking - for(const auto& i : func->ordered_parameter_list) { + for (const auto& i : func->ordered_parameter_list) { // if variable is not a parameter or already used, do not report if (!record.count(i) || record.at(i)) { continue; @@ -214,14 +312,15 @@ void ungrounded_parameter_checker::unused_parameter_check(const report::span& st // unused int/float/string and "self" parameter is marked as ungrounded // set of int/float/string are not considered as ungrounded - if ((type == symbol::i64() || type == symbol::f64() || type == symbol::str()) && - !record_is_set_flag.at(i)) { + if (is_native_type(type) && !record_is_set_flag.at(i)) { ungrounded_params += ungrounded_params.length()? ", ":""; ungrounded_params += i; - } else if (i!="self") { + } else if (i != "self") { unused_params += unused_params.length()? ", ":""; unused_params += i; } else { + // unused self, mark it as ungrounded + // so self constraint will be generated to protect this parameter flag_self_ungrounded = true; } } @@ -229,17 +328,14 @@ void ungrounded_parameter_checker::unused_parameter_check(const report::span& st // unused warning report if (unused_params.length()) { err->warn(stmt_loc, - "unused parameter \"" + unused_params + - "\" in this statement branch.", - "may cause empty result." + "\"" + unused_params + "\" is unused in this branch." ); } // ungrounded error report if (ungrounded_params.length()) { err->err(stmt_loc, - "ungrounded parameter \"" + ungrounded_params + - "\" in this statement branch." + "\"" + ungrounded_params + "\" is ungrounded in this branch." ); } @@ -249,8 +345,8 @@ void ungrounded_parameter_checker::unused_parameter_check(const report::span& st } if (flag_self_ungrounded && flag_is_self_typecheck_free) { err->err(stmt_loc, - "ungrounded parameter \"self\" in this statement branch.", - "need to constraint this parameter, otherwise it causes ungrounded error." + "ungrounded \"self\" in this branch.", + "constraint \"self\" to avoid ungrounded error." ); } } @@ -262,7 +358,7 @@ bool ungrounded_parameter_checker::visit_identifier(identifier* node) { const auto& name = node->get_name(); if (record.count(name) && !used_variable.back().count(name)) { // if this table's size is not zero - // this means in progress of analysing logical or expression + // this means in progress of analysing logical `or` expression if (logical_or_variable_used.size()) { logical_or_variable_used.back().insert(name); return true; @@ -273,6 +369,57 @@ bool ungrounded_parameter_checker::visit_identifier(identifier* node) { return true; } +bool ungrounded_parameter_checker::check_directly_call_identifier(expr* node) { + if (node->get_ast_class() != ast_class::ac_call_root) { + return false; + } + + auto real = static_cast(node); + if (real->get_call_head()->has_func_call() || + real->get_call_head()->is_initializer()) { + return false; + } + if (real->get_call_head()->get_first_expression()->get_ast_class() + != ast_class::ac_identifier) { + return false; + } + // schema instance getting primary key equals to directly using this instance + // e.g. `a.id` in fact equals to `a` itself, so we see this as direct call id + if (is_schema_get_primary_key(real)) { + return true; + } + if (!real->get_call_chain().empty()) { + return false; + } + + return true; +} + +bool ungrounded_parameter_checker::check_non_binding_binary_operator(binary_operator* node) { + // binary expressions like: + // a - 1, a + 1, a * 1, a / 1 + // are used as condition, + // variables directly called in the expression will not be marked as grounded + + // both lhs and rhs are not directly called identifier, + // this is definitely not a binding binary operator, + // and we do not need to ignore checkings on both sides + if (!check_directly_call_identifier(node->get_left()) && + !check_directly_call_identifier(node->get_right())) { + return false; + } + + return node->get_operator_type() == binary_operator::type::add || + node->get_operator_type() == binary_operator::type::sub || + node->get_operator_type() == binary_operator::type::mult || + node->get_operator_type() == binary_operator::type::div || + node->get_operator_type() == binary_operator::type::compare_not_equal || + node->get_operator_type() == binary_operator::type::compare_less || + node->get_operator_type() == binary_operator::type::compare_less_equal || + node->get_operator_type() == binary_operator::type::compare_great || + node->get_operator_type() == binary_operator::type::compare_great_equal; +} + bool ungrounded_parameter_checker::visit_call_expr(call_expr* node) { // do not visit field name and generic type here // because they include identifier nodes, which may @@ -304,12 +451,34 @@ bool ungrounded_parameter_checker::visit_unary_operator(unary_operator* node) { bool ungrounded_parameter_checker::visit_binary_operator(binary_operator* node) { // not in logical or expression, just visit and exit if (!logical_or_variable_used.size()) { + // e.g. `a + 1`, we do not check `a` + // e.g. `a + f(a)`, we do not check `a` but we check `f(a)` + if (check_non_binding_binary_operator(node)) { + if (!check_directly_call_identifier(node->get_left())) { + node->get_left()->accept(this); + } + if (!check_directly_call_identifier(node->get_right())) { + node->get_right()->accept(this); + } + return true; + } node->get_left()->accept(this); node->get_right()->accept(this); return true; } - if (node->get_operator_type()!=binary_operator::type::logical_or) { + if (node->get_operator_type() != binary_operator::type::logical_or) { + // e.g. `a + 1`, we do not check `a` + // e.g. `a + f(a)`, we do not check `a` but we check `f(a)` + if (check_non_binding_binary_operator(node)) { + if (!check_directly_call_identifier(node->get_left())) { + node->get_left()->accept(this); + } + if (!check_directly_call_identifier(node->get_right())) { + node->get_right()->accept(this); + } + return true; + } node->get_left()->accept(this); node->get_right()->accept(this); return true; @@ -347,7 +516,7 @@ bool ungrounded_parameter_checker::visit_for_stmt(for_stmt* node) { if (node->has_statement()) { node->get_code_block()->accept(this); } else { - unused_parameter_check(node->get_location()); + report_unused_parameter(node->get_location()); } pop_used_variable_mark_scope(); return true; @@ -361,7 +530,7 @@ bool ungrounded_parameter_checker::visit_let_stmt(let_stmt* node) { if (node->has_statement()) { node->get_code_block()->accept(this); } else { - unused_parameter_check(node->get_location()); + report_unused_parameter(node->get_location()); } pop_used_variable_mark_scope(); return true; @@ -390,7 +559,7 @@ bool ungrounded_parameter_checker::visit_if_stmt(if_stmt* node) { if (node->has_statement()) { node->get_code_block()->accept(this); } else { - unused_parameter_check(node->get_location()); + report_unused_parameter(node->get_location()); } pop_used_variable_mark_scope(); return true; @@ -447,7 +616,7 @@ bool ungrounded_parameter_checker::visit_ret_stmt(ret_stmt* node) { // pop table logical_or_variable_used.pop_back(); } - unused_parameter_check(node->get_location()); + report_unused_parameter(node->get_location()); pop_used_variable_mark_scope(); return true; } @@ -455,7 +624,7 @@ bool ungrounded_parameter_checker::visit_ret_stmt(ret_stmt* node) { bool ungrounded_parameter_checker::visit_in_block_expr(in_block_expr* node) { new_used_variable_mark_scope(); node->get_expr()->accept(this); - unused_parameter_check(node->get_location()); + report_unused_parameter(node->get_location()); pop_used_variable_mark_scope(); return true; } @@ -463,7 +632,7 @@ bool ungrounded_parameter_checker::visit_in_block_expr(in_block_expr* node) { bool ungrounded_parameter_checker::visit_block_stmt(block_stmt* node) { // if having no statement in it, check unused parameter directly if (!node->get_statement().size()) { - unused_parameter_check(node->get_location()); + report_unused_parameter(node->get_location()); return true; } for(auto i : node->get_statement()) { @@ -484,38 +653,66 @@ bool ungrounded_parameter_checker::visit_call_head(call_head* node) { } bool ungrounded_parameter_checker::is_schema_get_primary_key(call_root* node) { - if (node->get_call_head()->get_first_expression()->get_ast_class()!=ast_class::ac_identifier) { + auto head = node->get_call_head(); + // should call a variable + if (head->get_first_expression()->get_ast_class() != ast_class::ac_identifier) { return false; } - const auto& head_type = node->get_call_head()->get_resolve(); + + const auto& head_type = head->get_resolve(); + // head type should not be global symbol or data-set type if (head_type.is_global || head_type.type.is_set) { return false; } - if (node->get_call_chain().size()!=1) { + + // schema get primary key pattern may be: + // 1. schema.primary_key + // 2. schema.primary_key.other_calls() + // so size should be >= 1 + if (node->get_call_chain().size()<1) { return false; } + + // get type full path name const auto name = head_type.type.full_path_name_without_set(); const auto index = ctx->global.get_index(name); - if (index==global_symbol_table::npos) { + if (index == global_symbol_table::npos) { return false; } - if (ctx->global.get_kind(index)!=symbol_kind::schema) { + if (ctx->global.get_kind(index) != symbol_kind::schema) { return false; } + const auto& sc = ctx->global.get_schema(index); - if (node->get_call_chain()[0]->get_call_type()!=call_expr::type::get_field || + if (node->get_call_chain()[0]->get_call_type() != call_expr::type::get_field || node->get_call_chain()[0]->has_func_call()) { return false; } const auto key = node->get_call_chain()[0]->get_field_name()->get_name(); + // check if the field is primary key return sc.fields.count(key) && sc.fields.at(key).primary; } bool ungrounded_parameter_checker::visit_call_root(call_root* node) { + // we see schema get primary key as call schema itself + // because in generated souffle: + // schema.primary_key = schema + // if schema is not grounded, the primary key is not grounded too + // but we add type constraint for each schema, so mark this as grounded + // except this call is: + // self.primary_key + // self is not always constraint, if marked as grounded + // self will be ungrounded in generated souffle if (is_schema_get_primary_key(node)) { + auto first = node->get_call_head()->get_first_expression(); + if (reinterpret_cast(first)->get_name() != "self") { + node->get_call_head()->accept(this); + } return true; } for(auto i : node->get_call_chain()) { + // if souffle aggregator is used in the call chain, + // all variables used in this call is not grounded if (i->is_aggregator() && !i->is_aggregator_find()) { return true; } diff --git a/godel-script/godel-frontend/src/sema/ungrounded_checker.h b/godel-script/godel-frontend/src/sema/ungrounded_checker.h index 96864713..22cf2ab7 100644 --- a/godel-script/godel-frontend/src/sema/ungrounded_checker.h +++ b/godel-script/godel-frontend/src/sema/ungrounded_checker.h @@ -33,19 +33,42 @@ class return_ungrounded_checker: public ast_visitor { } }; -class negative_expression_ungrounded_checker: public ast_visitor { +class neg_expr_ungrounded_checker: public ast_visitor { private: report::error* err; size_t in_logical_negative_expression_level; + size_t in_binary_operator_level; private: bool visit_call_expr(call_expr*) override; bool visit_initializer(initializer*) override; bool visit_unary_operator(unary_operator*) override; + bool visit_binary_operator(binary_operator*) override; public: - negative_expression_ungrounded_checker(report::error* err_ptr): - err(err_ptr), in_logical_negative_expression_level(0) {} + neg_expr_ungrounded_checker(report::error* e): + err(e), in_logical_negative_expression_level(0), + in_binary_operator_level(0) {} + void check(ast_root* root) { + root->accept(this); + } +}; + +class undetermined_checker: public ast_visitor { +private: + report::error* err; + size_t in_for_initialization_level; + +private: + bool match_undetermined_call(call_root*); + +private: + bool visit_call_root(call_root*) override; + bool visit_for_stmt(for_stmt*) override; + +public: + undetermined_checker(report::error* e): + err(e), in_for_initialization_level(0) {} void check(ast_root* root) { root->accept(this); } @@ -102,7 +125,20 @@ class ungrounded_parameter_checker: public ast_visitor { } private: - void unused_parameter_check(const report::span&); + bool is_native_type(const godel::symbol& sym) const { + return sym == symbol::i64() || + sym == symbol::f64() || + sym == symbol::str(); + } + void report_unused_parameter(const report::span&); + bool check_directly_return_self(ret_stmt*); + // check expression is call_root node, and only contains identifier call + bool check_directly_call_identifier(expr*); + // check identifier call in binary expression is semanticly a condition, not binding + // e.g. `a - 1` is a condition (`a` ungrounded), but `a = 1` is binding (`a` grounded) + bool check_non_binding_binary_operator(binary_operator*); + +private: bool visit_identifier(identifier*) override; bool visit_call_expr(call_expr*) override; bool visit_unary_operator(unary_operator*) override; @@ -111,7 +147,6 @@ class ungrounded_parameter_checker: public ast_visitor { bool visit_let_stmt(let_stmt*) override; bool visit_if_stmt(if_stmt*) override; bool visit_match_stmt(match_stmt*) override; - bool check_directly_return_self(ret_stmt*); bool visit_ret_stmt(ret_stmt*) override; bool visit_in_block_expr(in_block_expr*) override; bool visit_block_stmt(block_stmt*) override; diff --git a/godel-script/godel-frontend/src/semantic.cpp b/godel-script/godel-frontend/src/semantic.cpp index ac97286d..4e2e8abd 100644 --- a/godel-script/godel-frontend/src/semantic.cpp +++ b/godel-script/godel-frontend/src/semantic.cpp @@ -575,9 +575,7 @@ void semantic::cond_stmt_check(cond_stmt* node, const function& func) { if_stmt_check(node->get_if_stmt(), func); // check if having else branches when switch is on - if (flag_check_no_else_branch && ( - node->get_elsif_stmt().size() || - node->has_else_stmt())) { + if (node->get_elsif_stmt().size() || node->has_else_stmt()) { err.err(node->get_location(), "else branches are not allowed.", "may cause fatal ungrounded error." @@ -877,17 +875,31 @@ infer semantic::in_expr(binary_operator* node) { ); return infer::boolean(); } + + // left hand side value should not be value set if (left_type.is_set) { err.err(node->get_left()->get_location(), - "should be single value but get value set \"" + + "expect single value but get set \"" + left_type.full_path_name() + "\"." ); return infer::boolean(); } - if (left_type!=right_type || !right_type.is_set) { + + // right hand side value must be value set + if (!right_type.is_set) { + err.err(node->get_right()->get_location(), + "expect \"*" + left_type.full_path_name() + + "\", but get single value \"" + right_type.full_path_name() + + "\"." + ); + return infer::boolean(); + } + + // type should be the same + if (left_type!=right_type) { err.err(node->get_right()->get_location(), - "should be a value set, expect \"*" + left_type.full_path_name() + - "\", but get a single value \"" + right_type.full_path_name() + + "expect \"*" + left_type.full_path_name() + + "\", but get \"" + right_type.full_path_name() + "\"." ); return infer::boolean(); @@ -3008,7 +3020,6 @@ const error& semantic::analyse(const configure& config, ast_root* root) { // stage 1: initialize impl_schema_name = ""; flag_check_access_authority = config.count(option::cli_semantic_pub_check); - flag_check_no_else_branch = config.count(option::cli_semantic_no_else); ctx.this_file_name = root->get_file(); // stage 2: @@ -3066,7 +3077,8 @@ const error& semantic::analyse(const configure& config, ast_root* root) { // stage 7: all function implemention block check all_function_block_check(root); return_ungrounded_checker(&err).check(root); - negative_expression_ungrounded_checker(&err).check(root); + undetermined_checker(&err).check(root); + neg_expr_ungrounded_checker(&err).check(root); if (err.get_error()) { return err; } diff --git a/godel-script/godel-frontend/src/semantic.h b/godel-script/godel-frontend/src/semantic.h index 93d51c01..6ab940af 100644 --- a/godel-script/godel-frontend/src/semantic.h +++ b/godel-script/godel-frontend/src/semantic.h @@ -60,9 +60,6 @@ class semantic { // switch of public access authority checker bool flag_check_access_authority = false; - // switch of condition statements having else branch checker - bool flag_check_no_else_branch = false; - private: // generate output used functions and methods void generate_output_used_function_name(); diff --git a/godel-script/godel-frontend/src/symbol.cpp b/godel-script/godel-frontend/src/symbol.cpp index f17063ee..ff577442 100644 --- a/godel-script/godel-frontend/src/symbol.cpp +++ b/godel-script/godel-frontend/src/symbol.cpp @@ -29,11 +29,13 @@ function function::build_native(const std::string& name, return native_function; } -std::string function::to_json() const { +std::string function::to_json(bool with_location) const { std::string res = "{\"name\":\"" + name; res += has_generic? "\",":"\","; - res += "\"location\":" + location.to_json() + ","; - res += "\"return\":" + return_type.to_json() + ","; + if (with_location) { + res += "\"location\":" + location.to_json() + ","; + } + res += "\"return\":" + return_type.to_json(with_location) + ","; res += "\"is_public\":"; res += public_access_authority? "\"true\",":"\"false\","; res += "\"is_inherited\":"; @@ -41,7 +43,7 @@ std::string function::to_json() const { res += "\"parameter\":["; for(const auto& i : ordered_parameter_list) { res += "{\"name\":\"" + i + "\",\"type\":"; - res += parameter_list.at(i).to_json() + "},"; + res += parameter_list.at(i).to_json(with_location) + "},"; } if (res.back()==',') { res.pop_back(); @@ -108,14 +110,16 @@ std::string enumerate::fuzzy_search(const std::string& id) const { return fuzzy_search_name; } -std::string schema::to_json() const { +std::string schema::to_json(bool with_location) const { std::string res = "{\"name\":\"" + name + "\","; - res += "\"location\":" + location.to_json() + ","; + if (with_location) { + res += "\"location\":" + location.to_json() + ","; + } res += "\"parent\": \"" + std::string(parent? parent->name:"") + "\","; res += "\"fields\":["; for(const auto& i : ordered_fields) { const auto& type = fields.at(i); - res += "{\"name\":\"" + i + "\",\"type\":" + type.to_json(); + res += "{\"name\":\"" + i + "\",\"type\":" + type.to_json(with_location); res += ",\"primary\":"; res += type.primary? "\"true\"":"\"false\""; res += ",\"is_inherited\":"; @@ -131,10 +135,10 @@ std::string schema::to_json() const { } res += "],\"methods\":["; for(const auto& i : methods) { - res += i.second.to_json() + ","; + res += i.second.to_json(with_location) + ","; } for(const auto& i : natives) { - res += i.second.to_json() + ","; + res += i.second.to_json(with_location) + ","; } if (res.back()==',') { res.pop_back(); diff --git a/godel-script/godel-frontend/src/symbol.h b/godel-script/godel-frontend/src/symbol.h index f0d2f393..ee28c0b7 100644 --- a/godel-script/godel-frontend/src/symbol.h +++ b/godel-script/godel-frontend/src/symbol.h @@ -85,10 +85,14 @@ struct symbol { return out; } - std::string to_json() const { - return "{\"name\":\"" + type_name + - "\",\"is_set\":\"" + (is_set? "true":"false") + - "\",\"type_loc\":" + type_loc.to_json() + "}"; + std::string to_json(bool with_location = true) const { + auto res = "{\"name\":\"" + type_name + + "\",\"is_set\":\"" + (is_set? "true":"false") + "\""; + if (with_location) { + res += ",\"type_loc\":" + type_loc.to_json(); + } + res += "}"; + return res; } // get full path name of the symbol @@ -249,9 +253,12 @@ struct function { // for aggregator to check input set type std::vector aggregator_set_type; - + + // mark it is implemented bool implemented = false; + // mark it is inherited method bool inherit = false; + // mark it is native method bool builtin = false; // default private bool public_access_authority = false; @@ -323,7 +330,7 @@ struct function { return out; } - std::string to_json() const; + std::string to_json(bool with_location = true) const; }; struct basic { @@ -445,7 +452,7 @@ struct schema { return out; } - std::string to_json() const; + std::string to_json(bool with_location = true) const; std::string fuzzy_search(const std::string&) const; bool has_primary_key() const { diff --git a/junit5.bzl b/junit5.bzl new file mode 100644 index 00000000..7063ab6d --- /dev/null +++ b/junit5.bzl @@ -0,0 +1,107 @@ +"""External dependencies & java_junit5_test rule""" + +load("@bazel_tools//tools/build_defs/repo:jvm.bzl", "jvm_maven_import_external") + +JUNIT_JUPITER_GROUP_ID = "org.junit.jupiter" +JUNIT_JUPITER_ARTIFACT_ID_LIST = [ + "junit-jupiter-api", + "junit-jupiter-engine", + "junit-jupiter-params", +] + +JUNIT_PLATFORM_GROUP_ID = "org.junit.platform" +JUNIT_PLATFORM_ARTIFACT_ID_LIST = [ + "junit-platform-commons", + "junit-platform-console", + "junit-platform-engine", + "junit-platform-launcher", + "junit-platform-suite-api", +] + +JUNIT_EXTRA_DEPENDENCIES = [ + ("org.apiguardian", "apiguardian-api", "1.0.0"), + ("org.opentest4j", "opentest4j", "1.1.1"), +] + +def junit_jupiter_java_repositories( + version = "5.9.1"): + """Imports dependencies for JUnit Jupiter""" + for artifact_id in JUNIT_JUPITER_ARTIFACT_ID_LIST: + jvm_maven_import_external( + name = _format_maven_jar_name(JUNIT_JUPITER_GROUP_ID, artifact_id), + artifact = "%s:%s:%s" % ( + JUNIT_JUPITER_GROUP_ID, + artifact_id, + version, + ), + server_urls = ["https://repo1.maven.org/maven2"], + licenses = ["notice"], # EPL 2.0 License + ) + + for t in JUNIT_EXTRA_DEPENDENCIES: + jvm_maven_import_external( + name = _format_maven_jar_name(t[0], t[1]), + artifact = "%s:%s:%s" % t, + server_urls = ["https://repo1.maven.org/maven2"], + licenses = ["notice"], # EPL 2.0 License + ) + +def junit_platform_java_repositories( + version = "1.9.1"): + """Imports dependencies for JUnit Platform""" + for artifact_id in JUNIT_PLATFORM_ARTIFACT_ID_LIST: + jvm_maven_import_external( + name = _format_maven_jar_name(JUNIT_PLATFORM_GROUP_ID, artifact_id), + artifact = "%s:%s:%s" % ( + JUNIT_PLATFORM_GROUP_ID, + artifact_id, + version, + ), + server_urls = ["https://repo1.maven.org/maven2"], + licenses = ["notice"], # EPL 2.0 License + ) + +def java_junit5_test(name, srcs, test_package, deps = [], runtime_deps = [], **kwargs): + FILTER_KWARGS = [ + "main_class", + "use_testrunner", + "args", + ] + + for arg in FILTER_KWARGS: + if arg in kwargs.keys(): + kwargs.pop(arg) + + junit_console_args = [] + if test_package: + junit_console_args += ["--select-package", test_package] + else: + fail("must specify 'test_package'") + + native.java_test( + name = name, + srcs = srcs, + use_testrunner = False, + main_class = "org.junit.platform.console.ConsoleLauncher", + args = junit_console_args, + deps = deps + [ + _format_maven_jar_dep_name(JUNIT_JUPITER_GROUP_ID, artifact_id) + for artifact_id in JUNIT_JUPITER_ARTIFACT_ID_LIST + ] + [ + _format_maven_jar_dep_name(JUNIT_PLATFORM_GROUP_ID, "junit-platform-suite-api"), + ] + [ + _format_maven_jar_dep_name(t[0], t[1]) + for t in JUNIT_EXTRA_DEPENDENCIES + ], + runtime_deps = runtime_deps + [ + _format_maven_jar_dep_name(JUNIT_PLATFORM_GROUP_ID, artifact_id) + for artifact_id in JUNIT_PLATFORM_ARTIFACT_ID_LIST + ], + **kwargs + ) + +def _format_maven_jar_name(group_id, artifact_id): + return ("%s_%s" % (group_id, artifact_id)).replace(".", "_").replace("-", "_") + +def _format_maven_jar_dep_name(group_id, artifact_id): + return "@%s//jar" % _format_maven_jar_name(group_id, artifact_id) diff --git a/language/BUILD b/language/BUILD new file mode 100644 index 00000000..9906a0a4 --- /dev/null +++ b/language/BUILD @@ -0,0 +1,6 @@ +package(default_visibility = ["//visibility:public"]) + +package_group( + name = "default_visibility", + packages = ["//language/..."], +) diff --git a/language/arkts/BUILD b/language/arkts/BUILD new file mode 100644 index 00000000..d359da7c --- /dev/null +++ b/language/arkts/BUILD @@ -0,0 +1,11 @@ +load("//:visibility.bzl", "PUBLIC_VISIBILITY") + +# Using filegroup is encouraged instead of referencing directories directly. The latter is unsound. +# When combined with glob, filegroup can ensure that all files are explicitly known to the build system. + +# Only one level of depth is matched, and the templates in the resource directory under lib-gen will not be matched. +filegroup( + name = "lib", + srcs = glob(["lib/*"]), + visibility = ["//visibility:public"], +) diff --git a/language/arkts/extractor/.gitignore b/language/arkts/extractor/.gitignore new file mode 100644 index 00000000..395a8f03 --- /dev/null +++ b/language/arkts/extractor/.gitignore @@ -0,0 +1,26 @@ +# IDEs +.vscode +.idea + +# Dependency directory +node_modules/ + +# Build +dist/ +out/ + +# Bazel +bazel-* + +# SQLite +*.db +*.db-journal + +# Coverage reports +coverage + +# API keys and secrets +.env + +# OS metadata +.DS_Store diff --git a/language/arkts/extractor/BUILD b/language/arkts/extractor/BUILD new file mode 100644 index 00000000..1bb85ee0 --- /dev/null +++ b/language/arkts/extractor/BUILD @@ -0,0 +1,62 @@ +load("//:visibility.bzl", "PUBLIC_VISIBILITY") + +genrule( + name = "ohos_typescript_compile", + srcs = [], + tools = [ + "@ohos_typescript_src//:compile_typescript" + ], + outs = ["ohos-typescript"], + cmd = """ + export OHOS_TYPESCRIPT_SRC=$$(dirname $$(pwd)/$(execpath @ohos_typescript_src//:compile_typescript)) + export OUTPUT_DIR=$$(dirname $$(pwd)/$@) + export OHOS_TYPESCRIPT_SRC_CP=$$OUTPUT_DIR/ohos_typescript_src + cp -r $$OHOS_TYPESCRIPT_SRC $$OUTPUT_DIR + mkdir $(OUTS) + # must change dir to src, then execute compile script + cd $$OHOS_TYPESCRIPT_SRC_CP + python3 compile_typescript.py . $$OUTPUT_DIR/ohos-typescript + echo ohos_typescript build success: $$OUTPUT_DIR/ohos-typescript + """, +) + +genrule( + name = "build-coref-arkts-src-extractor", + srcs = glob(["src/**/*.ts"]) + glob(["sdk/**/*"]) + [ + "schema.prisma", + "package.json", + "package-lock.json", + "paths.json", + "tsconfig.json", + "@pkg_cache//:node-bin", + ] + [":ohos_typescript_compile"], + tools = [ + "@nodejs_host//:npm_bin", + ], + outs = [ + "coref-arkts-src-extractor", + ], + cmd = """ + NPM_PATH="$$(pwd)/$(execpath @nodejs_host//:npm_bin)" + echo NPM_PATH: $$NPM_PATH + + export PKG_CACHE_PATH=$$(dirname $$(dirname $$(pwd)/$(execpath @pkg_cache//:node-bin))) + echo PKG_CACHE_PATH: $$PKG_CACHE_PATH + + OUT_PATH="$$(pwd)/$@" + echo OUT_PATH: $$OUT_PATH + + # 注意在下面cd前对需要拷贝的typescript进行路径确认 + export THIRD_TYPESCIRPT_PATH=$$(pwd)/$(location :ohos_typescript_compile) + echo THIRD_TYPESCIRPT_PATH: $$THIRD_TYPESCIRPT_PATH + + cd language/arkts/extractor + + $$NPM_PATH i + cp -rf $$THIRD_TYPESCIRPT_PATH ./node_modules/ + $$NPM_PATH run pkg + mv coref-arkts-src-extractor $$OUT_PATH + """, + executable = 1, + visibility = ["//visibility:public"], +) diff --git a/language/arkts/extractor/er.puml b/language/arkts/extractor/er.puml new file mode 100644 index 00000000..50014647 --- /dev/null +++ b/language/arkts/extractor/er.puml @@ -0,0 +1,3269 @@ +@startuml +' https://plantuml.com/ie-diagram + +left to right direction + +' Location table +entity location { + id: int <> + file_id: int file + start: int + start_line: int + start_column: int + end: int + end_line: int + end_column: int +} + +' Text data is optional. It is stored separately to ensure the performance of location table. +entity text { + id: int <> location + text: text +} + +text ||--|| location + + +' Number of lines table +entity number_of_lines { + id: int <> location + lines: int + code_lines: int + comment_lines: int +} + +number_of_lines ||--|| location + +entity file { + id: int <> + location_id: int location + parent_id: int Directory + name: text + extension: text + relative_path: text +} + +file ||--o| location +location }|--|| file + +enum Directory { + root_directory + non_root_directory +} + +enum FileOrNonRootDirectory { + file + non_root_directory +} + +Directory ||--o{ FileOrNonRootDirectory + +entity root_directory { + id: int <> + relative_path: text +} + +entity non_root_directory { + id: int <> + name: text + relative_path: text + parent_id: int Directory +} + +' +' AST Nodes +' +entity ast_node { + id: int <> + kind: int + parent_id: int ast_node + parent_kind: int + index: int + location_id: int location +} + +' ==== Tokens ==== +' Punctuations + +' DotToken +entity dot_token extends ast_node { + id: int <> +} + +' DotDotDotToken +entity dot_dot_dot_token extends ast_node { + id: int <> +} + +' CommaToken +entity comma_token extends ast_node { + id: int <> +} + +' QuestionDotToken +entity question_dot_token extends ast_node { + id: int <> +} + +' LessThanToken +entity less_than_token extends ast_node { + id: int <> +} + +' GreaterThanToken +entity greater_than_token extends ast_node { + id: int <> +} + +' LessThanEqualsToken +entity less_than_equals_token extends ast_node { + id: int <> +} + +' GreaterThanEqualsToken +entity greater_than_equals_token extends ast_node { + id: int <> +} + +' EqualsEqualsToken +entity equals_equals_token extends ast_node { + id: int <> +} + +' ExclamationEqualsToken +entity exclamation_equals_token extends ast_node { + id: int <> +} + +' EqualsEqualsEqualsToken +entity equals_equals_equals_token extends ast_node { + id: int <> +} + +' ExclamationEqualsEqualsToken +entity exclamation_equals_equals_token extends ast_node { + id: int <> +} + +' EqualsGreaterThanToken +entity equals_greater_than_token extends ast_node { + id: int <> +} + +' PlusToken +entity plus_token extends ast_node { + id: int <> +} + +' MinusToken +entity minus_token extends ast_node { + id: int <> +} + +' AsteriskToken +entity asterisk_token extends ast_node { + id: int <> +} + +' AsteriskAsteriskToken +entity asterisk_asterisk_token extends ast_node { + id: int <> +} + +' SlashToken +entity slash_token extends ast_node { + id: int <> +} + +' PercentToken +entity percent_token extends ast_node { + id: int <> +} + +' PlusPlusToken +entity plus_plus_token extends ast_node { + id: int <> +} + +' MinusMinusToken +entity minus_minus_token extends ast_node { + id: int <> +} + +' LessThanLessThanToken +entity less_than_less_than_token extends ast_node { + id: int <> +} + +' GreaterThanGreaterThanToken +entity greater_than_greater_than_token extends ast_node { + id: int <> +} + +' GreaterThanGreaterThanGreaterThanToken +entity greater_than_greater_than_greater_than_token extends ast_node { + id: int <> +} + +' AmpersandToken +entity ampersand_token extends ast_node { + id: int <> +} + +' BarToken +entity bar_token extends ast_node { + id: int <> +} + +' CaretToken +entity caret_token extends ast_node { + id: int <> +} + +' ExclamationToken +entity exclamation_token extends ast_node { + id: int <> +} + +' TildeToken +entity tilde_token extends ast_node { + id: int <> +} + +' AmpersandAmpersandToken +entity ampersand_ampersand_token extends ast_node { + id: int <> +} + +' BarBarToken +entity bar_bar_token extends ast_node { + id: int <> +} + +' QuestionToken +entity question_token extends ast_node { + id: int <> +} + +' ColonToken +entity colon_token extends ast_node { + id: int <> +} + +' QuestionQuestionToken +entity question_question_token extends ast_node { + id: int <> +} + +' EqualsToken +entity equals_token extends ast_node { + id: int <> +} + +' PlusEqualsToken +entity plus_equals_token extends ast_node { + id: int <> +} + +' MinusEqualsToken +entity minus_equals_token extends ast_node { + id: int <> +} + +' AsteriskEqualsToken +entity asterisk_equals_token extends ast_node { + id: int <> +} + +' AsteriskAsteriskEqualsToken +entity asterisk_asterisk_equals_token extends ast_node { + id: int <> +} + +' SlashEqualsToken +entity slash_equals_token extends ast_node { + id: int <> +} + +' PercentEqualsToken +entity percent_equals_token extends ast_node { + id: int <> +} + +' LessThanLessThanEqualsToken +entity less_than_less_than_equals_token extends ast_node { + id: int <> +} + +' GreaterThanGreaterThanEqualsToken +entity greater_than_greater_than_equals_token extends ast_node { + id: int <> +} + +' GreaterThanGreaterThanGreaterThanEqualsToken +entity greater_than_greater_than_greater_than_equals_token extends ast_node { + id: int <> +} + +' AmpersandEqualsToken +entity ampersand_equals_token extends ast_node { + id: int <> +} + +' BarEqualsToken +entity bar_equals_token extends ast_node { + id: int <> +} + +' BarBarEqualsToken +entity bar_bar_equals_token extends ast_node { + id: int <> +} + +' AmpersandAmpersandEqualsToken +entity ampersand_ampersand_equals_token extends ast_node { + id: int <> +} + +' QuestionQuestionEqualsToken +entity question_question_equals_token extends ast_node { + id: int <> +} + +' CaretEqualsToken +entity caret_equals_token extends ast_node { + id: int <> +} + + +' Keywords + +' ConstKeyword +entity const_keyword extends ast_node { + id: int <> +} + +' DefaultKeyword +entity default_keyword extends ast_node { + id: int <> +} + +'ExportKeyword +entity export_keyword extends ast_node { + id: int <> +} + +' ExtendsKeyword +entity extends_keyword extends ast_node { + id: int <> +} + +' ImportKeyword +entity import_keyword extends ast_node { + id: int <> +} + +' InKeyword +entity in_keyword extends ast_node { + id: int <> +} + +' InstanceOfKeyword +entity instance_of_keyword extends ast_node { + id: int <> +} + +' NewKeyword +entity new_keyword extends ast_node { + id: int <> +} + +' ImplementsKeyword +entity implements_keyword extends ast_node { + id: int <> +} + +' PrivateKeyword +entity private_keyword extends ast_node { + id: int <> +} + +' ProtectedKeyword +entity protected_keyword extends ast_node { + id: int <> +} + +' PublicKeyword +entity public_keyword extends ast_node { + id: int <> +} + +' StaticKeyword +entity static_keyword extends ast_node { + id: int <> +} + +' AbstractKeyword +entity abstract_keyword extends ast_node { + id: int <> +} + +' AccessorKeyword +entity accessor_keyword extends ast_node { + id: int <> +} + +' AssertsKeyword +entity asserts_keyword extends ast_node { + id: int <> +} + +' AssertKeyword +entity assert_keyword extends ast_node { + id: int <> +} + +' AsyncKeyword +entity async_keyword extends ast_node { + id: int <> +} + +' AwaitKeyword +entity await_keyword extends ast_node { + id: int <> +} + +' DeclareKeyword +entity declare_keyword extends ast_node { + id: int <> +} + +' KeyOfKeyword +entity key_of_keyword extends ast_node { + id: int <> +} + +' OutKeyword +entity out_keyword extends ast_node { + id: int <> +} + +' ReadonlyKeyword +entity readonly_keyword extends ast_node { + id: int <> +} + +' UniqueKeyword +entity unique_keyword extends ast_node { + id: int <> +} + +' OverrideKeyword +entity override_keyword extends ast_node { + id: int <> +} + +' ==== End of Tokens ==== + +' ==== Declaration ==== + +' Declaration +entity declaration extends ast_node { + id: int <> + kind: int +} + +enum StringLiteralLike { + string_literal + no_substitution_template_literal +} + +enum DeclarationName extends StringLiteralLike, BindingPattern { + identifier + private_identifier + numeric_literal + computed_property_name + element_access_expression + property_access_expression +} + +entity declaration_name_node { + declaration_id: int <> declaration + name_node_id: int DeclarationName +} + +declaration ||--o| declaration_name_node +DeclarationName ||--o| declaration_name_node + +' ==== End of Declaration ==== + +' ==== Expression Base Entities ==== +' Expression +entity expression extends ast_node { + id: int <> + kind: int +} + +' UnaryExpression +entity unary_expression extends expression { + id: int <> + kind: int +} + +' UpdateExpression +entity update_expression extends unary_expression { + id: int <> + kind: int +} + +' LeftHandSideExpression +entity left_hand_side_expression extends update_expression { + id: int <> + kind: int +} + +' MemberExpression +entity member_expression extends left_hand_side_expression { + id: int <> + kind: int +} + +' PrimaryExpression +entity primary_expression extends member_expression { + id: int <> + kind: int +} + +' ==== End of Expression Base Entities ==== + +' ==== Literals ==== + +' NullLiteral +entity null_literal extends primary_expression { + id: int <> +} + +' TrueLiteral +entity true_literal extends primary_expression { + id: int <> +} + +' FalseLiteral +entity false_literal extends primary_expression { + id: int <> +} + +enum BooleanLiteral { + true_literal + false_literal +} + + +' LiteralLikeNode. Including: +' NumericLiteral, +' BigIntLiteral, +' StringLiteral, +' RegularExpressionLiteral, +' TemplateLiteralLikeNode +entity literal_like_node extends ast_node { + id: int <> + kind: int + value: text +} + +entity literal_expression extends literal_like_node, primary_expression { + id: int <> + kind: int +} + +' NumericLiteral +entity numeric_literal extends literal_expression, declaration { + id: int <> + flags: int +} + +' BigIntLiteral +entity big_int_literal extends literal_expression { + id: int <> +} + +' StringLiteral +entity string_literal extends literal_expression, declaration { + id: int <> + single_quote: boolean +} + +' RegularExpressionLiteral +entity regular_expression_literal extends literal_expression { + id: int <> +} + +' TemplateLiteralLikeNode. Including: +' NoSubstitutionTemplateLiteral, +' TemplateHead, +' TemplateMiddle, +' TemplateTail +entity template_literal_like_node extends literal_like_node { + id: int <> + kind: int + raw_text: text +} + +' NoSubstitutionTemplateLiteral +entity no_substitution_template_literal extends literal_expression, template_literal_like_node, declaration { + id: int <> +} + +' TemplateHead +entity template_head extends template_literal_like_node { + id: int <> +} + +' TemplateMiddle +entity template_middle extends template_literal_like_node { + id: int <> +} + +' TemplateTail +entity template_tail extends template_literal_like_node { + id: int <> +} + +enum TemplateMiddleOrTail { + template_middle + template_tail +} + +' TemplateSpan +entity template_span extends ast_node { + id: int <> + parent_id: int template_expression + index: int + expression_id: int expression + literal_id: int TemplateMiddleOrTail +} + +template_span |o--|| expression +template_span |o--|| TemplateMiddleOrTail + +' ==== End of Literals ==== + +' ==== Modifiers ==== + +enum HasModifiersNode { + type_parameter + parameter + constructor_type + property_signature + property_declaration + method_signature + method_declaration + constructor + get_accessor + set_accessor + index_signature + function_expression + arrow_function + class_expression + variable_statement + function_declaration + class_declaration + struct_declaration + interface_declaration + type_alias_declaration + enum_declaration + module_declaration + import_equals_declaration + import_declaration + export_assignment + export_declaration +} + +entity modifier extends ast_node { + id: int <> + kind: int + parent_id: int HasModifiersNode + parent_kind: int + index: int +} + +HasModifiersNode |o--o{ modifier + +' ==== End of Modifiers ==== + +' ==== Names ==== + +' Identifier +entity identifier extends primary_expression, declaration { + id: int <> + name: text +} + +' PrivateIdentifier +entity private_identifier extends primary_expression { + id: int <> + name: text +} + +' QualifiedName +entity qualified_name extends ast_node { + id: int <> + left_id: int EntityName + right_id: int identifier +} + +qualified_name |o--|| EntityName +qualified_name |o--|| identifier + +' ComputedPropertyName +entity computed_property_name extends ast_node { + id: int <> + expression_id: int expression +} + +computed_property_name |o--|| expression + +enum EntityName { + identifier + qualified_name +} + +enum PropertyName { + identifier + string_literal + numeric_literal + computed_property_name + private_identifier +} + +enum MemberName { + identifier + private_identifier +} + +' ==== End of Names ==== + +' ==== Type Nodes ==== +' TypeNode +' kind: AnyKeyword | BigIntKeyword | BooleanKeyword | IntrinsicKeyword | NeverKeyword | NumberKeyword | ObjectKeyword | StringKeyword | SymbolKeyword | UndefinedKeyword | UnknownKeyword | VoidKeyword | TypePredicate | TypeReference | FunctionType | ConstructorType | TypeQuery | TypeLiteral | ArrayType | TupleType | NamedTupleMember | OptionalType | RestType | UnionType | IntersectionType | ConditionalType | InferType | ParenthesizedType | ThisType | TypeOperator | IndexedAccessType | MappedType | LiteralType | TemplateLiteralType | TemplateLiteralTypeSpan | ImportType | ExpressionWithTypeArguments | JSDocTypeExpression | JSDocAllType | JSDocUnknownType | JSDocNonNullableType | JSDocNullableType | JSDocOptionalType | JSDocFunctionType | JSDocVariadicType | JSDocNamepathType | JSDocSignature | JSDocTypeLiteral +entity type_node extends ast_node { + id: int <> + kind: int +} + +' AnyType +entity any_type extends type_node { + id: int <> +} + +' BigIntType +entity big_int_type extends type_node { + id: int <> +} + +' BooleanType +entity boolean_type extends type_node { + id: int <> +} + +' IntrinsicType +entity intrinsic_type extends type_node { + id: int <> +} + +' NeverType +entity never_type extends type_node { + id: int <> +} + +' NumberType +entity number_type extends type_node { + id: int <> +} + +' ObjectType +entity object_type extends type_node { + id: int <> +} + +' StringType +entity string_type extends type_node { + id: int <> +} + +' SymbolType +entity symbol_type extends type_node { + id: int <> +} + +' UndefinedType +entity undefined_type extends type_node { + id: int <> +} + +' UnknownType +entity unknown_type extends type_node { + id: int <> +} + +' VoidType +entity void_type extends type_node { + id: int <> +} + +' ==== Type Nodes to be Continued ==== + +' ==== Signature Elements ==== + +' TypeParameter +entity type_parameter extends declaration { + id: int <> + ' modifiers modifier + name_node_id: int identifier +} + +type_parameter |o--o{ modifier +type_parameter ||--|| identifier + +entity type_parameter_constraint { + type_parameter_id: int <> type_parameter + constraint_id: int type_node +} + +type_parameter |o--|| type_parameter_constraint +type_node ||--o| type_parameter_constraint + +entity type_parameter_default { + type_parameter_id: int <> type_parameter + default_id: int type_node +} + +type_parameter |o--|| type_parameter_default +type_node ||--o| type_parameter_default + +' BindingName +enum BindingName extends BindingPattern { + identifier +} + +' Parameter +entity parameter extends declaration { + id: int <> + ' modifiers modifier + name_node_id: int BindingName +} + +parameter |o--o{ modifier +parameter ||--|| BindingName + +entity parameter_dot_dot_dot_token { + parameter_id: int <> parameter + dot_dot_dot_token_id: int dot_dot_dot_token +} + +parameter ||--o| parameter_dot_dot_dot_token +dot_dot_dot_token ||--o| parameter_dot_dot_dot_token + +entity parameter_question_token { + parameter_id: int <> parameter + question_token_id: int question_token +} + +parameter ||--o| parameter_question_token +question_token ||--o| parameter_question_token + +entity parameter_type_node { + parameter_id: int <> parameter + type_node_id: int type_node +} + +parameter ||--o| parameter_type_node +type_node ||--o| parameter_type_node + +entity parameter_initializer { + parameter_id: int <> parameter + initializer_id: int expression +} + +parameter ||--o| parameter_initializer +expression ||--o| parameter_initializer + +' Decorator +entity decorator extends ast_node { + id: int <> + expression_id: int expression +} + +decorator |o--|| expression + +' ==== End of Signature Elements ==== + +' ==== Members ==== + +' ObjectLiteralElement +' kind: +' | PropertyAssignment +' | ShorthandPropertyAssignment +' | SpreadAssignment +' | MethodDeclaration +' | GetAccessor +' | SetAccessor +entity object_literal_element extends declaration { + id: int <> + kind: int +} + +entity object_literal_element_name_node { + object_literal_element_id: int <> object_literal_element + name_node_id: int PropertyName +} + +object_literal_element ||-o| object_literal_element_name_node +PropertyName ||--o| object_literal_element_name_node + +' ClassElement +' kind: +' | PropertyDeclaration +' | MethodDeclaration +' | Constructor +' | SemicolonClassElement +' | GetAccessor +' | SetAccessor +' | IndexSignature +' | ClassStaticBlockDeclaration +entity class_element extends declaration { + id: int <> + kind: int +} + +entity class_element_name_node { + class_element_id: int <> class_element + name_node_id: int PropertyName +} + +class_element ||-o| class_element_name_node +PropertyName ||-o| class_element_name_node + +' TypeElement +' kind: +' | CallSignature +' | ConstructSignature +' | PropertySignature +' | MethodSignature +' | GetAccessor +' | SetAccessor +' | IndexSignature +entity type_element extends declaration { + id: int <> + kind: int +} + +entity type_element_name_node { + type_element_id: int <> type_element + name_node_id: int PropertyName +} + +entity type_element_question_token { + type_element_id: int <> type_element + question_token_id: int question_token +} + +type_element ||-o| type_element_name_node +PropertyName ||-o| type_element_name_node +type_element ||-o| type_element_question_token +question_token ||-o| type_element_question_token + +' PropertySignature +entity property_signature extends type_element { + id: int <> + ' modifiers modifier + name_node_id: int PropertyName +} + +property_signature |o--o{ modifier +property_signature |o--|| PropertyName + +entity property_signature_question_token { + property_signature_id: int <> property_signature + question_token_id: int question_token +} + +property_signature ||--o| property_signature_question_token +question_token ||--o| property_signature_question_token + +entity property_signature_type_node { + property_signature_id: int <> property_signature + type_node_id: int type_node +} + +property_signature ||--o| property_signature_type_node +type_node ||--o| property_signature_type_node + +' PropertyDeclaration +entity property_declaration extends class_element { + id: int <> + ' modifiers modifier + name_node_id: int PropertyName +} + +property_declaration |o--o{ modifier +property_declaration |o--|| PropertyName + +entity property_declaration_question_token { + property_declaration_id: int <> property_declaration + question_token_id: int question_token +} + +property_declaration ||--o| property_declaration_question_token +question_token ||--o| property_declaration_question_token + +entity property_declaration_exclamation_token { + property_declaration_id: int <> property_declaration + exclamation_token_id: int exclamation_token +} + +property_declaration ||--o| property_declaration_exclamation_token +exclamation_token ||--o| property_declaration_exclamation_token + +entity property_declaration_type_node { + property_declaration_id: int <> property_declaration + type_node_id: int type_node +} + +property_declaration ||--o| property_declaration_type_node +type_node ||--o| property_declaration_type_node + +entity property_declaration_initializer { + property_declaration_id: int <> property_declaration + initializer_id: int expression +} + +property_declaration ||--o| property_declaration_initializer +expression ||--o| property_declaration_initializer + +' SignatureDeclaration +entity signature_declaration extends declaration { + id: int <> + kind: int +} + +' MethodSignature +entity method_signature extends signature_declaration, type_element { + id: int <> + ' modifiers modifier + name_node_id: int PropertyName +} + +method_signature |o--o{ modifier +method_signature |o--|| PropertyName + +' MethodDeclaration +entity method_declaration extends function_like_declaration, class_element, object_literal_element { + id: int <> + ' modifiers modifier + name_node_id: int PropertyName +} + +method_declaration |o--o{ modifier +method_declaration |o--|| PropertyName + +entity method_declaration_body { + method_declaration_id: int <> method_declaration + body_id: int block +} + +method_declaration ||--o| method_declaration_body + +' ClassStaticBlockDeclaration +entity class_static_block_declaration extends class_element { + id: int <> + body_id: int block +} + +' Constructor +entity constructor extends function_like_declaration, class_element { + id: int <> + ' modifiers modifier +} + +constructor |o--o{ modifier + +entity constructor_body { + constructor_id: int <> + body_id: int block +} + +constructor ||--o| constructor_body + +' GetAccessor +entity get_accessor extends function_like_declaration, class_element, type_element, object_literal_element { + id: int <> + ' modifiers modifier + name_node_id: int PropertyName +} + +get_accessor |o--o{ modifier +get_accessor ||--o| PropertyName + +entity get_accessor_body { + get_accessor_id: int <> get_accessor + body_id: int block +} + +get_accessor ||--o| get_accessor_body + +' SetAccessor +entity set_accessor extends function_like_declaration, class_element, type_element, object_literal_element { + id: int <> + ' modifiers modifier + name_node_id: int PropertyName +} + +set_accessor |o--o{ modifier +set_accessor ||--o| PropertyName + +entity set_accessor_body { + set_accessor_id: int <> set_accessor + body_id: int block +} + +set_accessor ||--o| set_accessor_body + +' AccessorDeclaration +enum AccessorDeclaration { + get_accessor + set_accessor +} + +' CallSignature +entity call_signature extends signature_declaration, type_element { + id: int <> +} + +' ConstructSignature +entity construct_signature extends signature_declaration, type_element { + id: int <> +} + +' IndexSignature +entity index_signature extends signature_declaration, class_element, type_element { + id: int <> + ' modifiers modifier + type_node_id: int type_node +} + +index_signature |o--o{ modifier +index_signature |o--|| type_node + +' SemicolonClassElement +entity semicolon_class_element extends class_element { + id: int <> +} + +' PropertyAssignment +entity property_assignment extends object_literal_element { + id: int <> + name_node_id: int PropertyName + initializer_id: int expression +} + +property_assignment |o--|| PropertyName +property_assignment |o--|| expression + +' ShorthandPropertyAssignment +entity shorthand_property_assignment extends object_literal_element { + id: int <> + name_node_id: int identifier +} + +shorthand_property_assignment |o--|| identifier + +' SpreadAssignment +entity spread_assignment extends object_literal_element { + id: int <> + expression_id: int expression +} + +spread_assignment |o--|| expression + +' EnumMember +entity enum_member extends declaration { + id: int <> + parent_id: int enum_declaration + index: int + name_node_id: int PropertyName +} + +entity enum_member_initializer { + enum_member_id: int <> enum_member + initializer_id: int expression +} + +enum_member ||-o| enum_member_initializer +expression ||-o| enum_member_initializer + +' ==== End of Members ==== + +' ==== Declarations ==== + +' SignatureDeclaration +entity signature_declaration_name_node { + signature_declaration_id: int <> signature_declaration + name_node_id: int PropertyName +} + +signature_declaration ||--o| signature_declaration_name_node +PropertyName ||--o| signature_declaration_name_node + +entity signature_declaration_type_parameter { + type_parameter_id: int <> type_parameter + signature_declaration_id: int signature_declaration + index: int +} + +signature_declaration ||--o{ signature_declaration_type_parameter +type_parameter ||--o| signature_declaration_type_parameter + +entity signature_declaration_parameter { + parameter_id: int <> parameter + signature_declaration_id: int signature_declaration + index: int +} + +signature_declaration ||--o{ signature_declaration_parameter +parameter ||--o| signature_declaration_parameter + +entity signature_declaration_type_node { + signature_declaration_id: int <> signature_declaration + type_node_id: int type_node +} + +signature_declaration ||--o| signature_declaration_type_node +type_node ||--o| signature_declaration_type_node + +enum BlockOrExpression { + block + expression +} + +' FunctionLikeDeclaration +entity function_like_declaration extends signature_declaration { + id: int <> + kind: int +} + +entity function_like_declaration_asterisk_token { + function_like_declaration_id: int <> function_like_declaration + asterisk_token_id: int asterisk_token +} + +function_like_declaration ||--o| function_like_declaration_asterisk_token +asterisk_token ||--o| function_like_declaration_asterisk_token + +entity function_like_declaration_question_token { + function_like_declaration_id: int <> function_like_declaration + question_token_id: int question_token +} + +function_like_declaration ||--o| function_like_declaration_question_token +question_token ||--o| function_like_declaration_question_token + +entity function_like_declaration_exclamation_token { + function_like_declaration_id: int <> function_like_declaration + exclamation_token_id: int exclamation_token +} + +function_like_declaration ||--o| function_like_declaration_exclamation_token +exclamation_token ||--o| function_like_declaration_exclamation_token + +entity function_like_declaration_body { + function_like_declaration_id: int <> function_like_declaration + body_id: int BlockOrExpression +} + +function_like_declaration ||--o| function_like_declaration_body +BlockOrExpression ||--o| function_like_declaration_body + +' ClassLikeDeclaration +entity class_like_declaration extends declaration { + id: int <> + kind: int + ' heritage_clauses heritage_clause +} + +entity class_like_declaration_name_node { + class_like_declaration_id: int <> class_like_declaration + name_node_id: int identifier +} + +class_like_declaration ||--o| class_like_declaration_name_node +identifier ||--o| class_like_declaration_name_node + +entity class_like_declaration_type_parameter { + type_parameter_id: int <> type_parameter + class_like_declaration_id: int class_like_declaration + index: int +} + +class_like_declaration ||--o{ class_like_declaration_type_parameter +type_parameter ||--o| class_like_declaration_type_parameter + +entity class_like_declaration_member { + member_id: int <> class_element + class_like_declaration_id: int class_like_declaration + index: int +} + +class_like_declaration ||--o{ class_like_declaration_member +class_element ||--o| class_like_declaration_member + +' ==== End of Declarations ==== + +' ==== Type Nodes Continued ==== + +' ThisType +entity this_type extends type_node { + id: int <> +} + +enum IdentifierOrThisType { + identifier + this_type +} + +' TypePredicate +entity type_predicate extends type_node { + id: int <> + parameter_name_node_id: int IdentifierOrThisType +} + +type_predicate |o--|| IdentifierOrThisType + +entity type_predicate_asserts_modifier { + type_predicate_id: int <> type_predicate + asserts_modifier_id: int asserts_keyword +} + +type_predicate ||--o| type_predicate_asserts_modifier +asserts_keyword ||--o| type_predicate_asserts_modifier + +entity type_predicate_type_node { + type_predicate_id: int <> type_predicate + type_node_id: int type_node +} + +type_predicate ||--o| type_predicate_type_node +type_node ||--o| type_predicate_type_node + +' NodeWithTypeArguments +' kind: TypeReference | TypeQuery | ExpressionWithTypeArguments | ImportType +entity node_with_type_arguments extends type_node { + id: int <> + kind: int +} + +entity node_with_type_arguments_type_argument { + type_argument_id: int <> type_node + node_with_type_arguments_id: int node_with_type_arguments + index: int +} + +node_with_type_arguments ||--o{ node_with_type_arguments_type_argument +type_node ||--o| node_with_type_arguments_type_argument + +' TypeReference +entity type_reference extends node_with_type_arguments { + id: int <> + type_name_node_id: int EntityName +} + +type_reference |o--|| EntityName + +' FunctionOrConstructorType +entity function_or_constructor_type extends type_node, signature_declaration { + id: int <> + kind: int + type_node_id: int type_node +} + +function_or_constructor_type |o--|| type_node + +' FunctionType +entity function_type extends function_or_constructor_type { + id: int <> +} + +' ConstructorType +entity constructor_type extends function_or_constructor_type { + id: int <> + ' modifiers modifier +} + +constructor_type |o--o{ modifier + +' TypeQuery +entity type_query extends node_with_type_arguments { + id: int <> + expression_name_node_id: int EntityName +} + +type_query |o--|| EntityName + +' TypeLiteral +entity type_literal extends type_node, declaration { + id: int <> +} + +entity type_literal_member { + member_id: int <> type_element + type_literal_id: int type_literal + index: int +} + +type_literal ||--o{ type_literal_member +type_element ||--o| type_literal_member + +' ArrayType +entity array_type extends type_node { + id: int <> + element_type_node_id: int type_node +} + +array_type |o--|| type_node + +' TupleType +entity tuple_type extends type_node { + id: int <> +} + +entity tuple_type_element { + element_id: int <> type_node + tuple_type_id: int tuple_type + index: int +} + +tuple_type ||--o{ tuple_type_element +type_node ||--o| tuple_type_element + +' OptionalType +entity optional_type extends type_node { + id: int <> + type_node_id: int type_node +} + +optional_type |o--|| type_node + +' RestType +entity rest_type extends type_node { + id: int <> + type_node_id: int type_node +} + +rest_type |o--|| type_node + +' UnionType +entity union_type extends type_node { + id: int <> +} + +entity union_type_type_node { + type_node_id: int <> type_node + union_type_id: int union_type + index: int +} + +union_type ||--o{ union_type_type_node +type_node ||--o| union_type_type_node + +' IntersectionType +entity intersection_type extends type_node { + id: int <> +} + +entity intersection_type_type_node { + type_node_id: int <> type_node + intersection_type_id: int intersection_type + index: int +} + +intersection_type ||--o{ intersection_type_type_node +type_node ||--o| intersection_type_type_node + +' ConditionalType +entity conditional_type extends type_node { + id: int <> + check_type_node_id: int type_node + extends_type_node_id: int type_node + then_type_node_id: int type_node + else_type_node_id: int type_node +} + +conditional_type |o--|| type_node +conditional_type |o--|| type_node +conditional_type |o--|| type_node +conditional_type |o--|| type_node + +' InferType +entity infer_type extends type_node { + id: int <> + type_parameter_id: int type_parameter +} + +infer_type |o--|| type_parameter + +' ParenthesizedType +entity parenthesized_type extends type_node { + id: int <> + type_node_id: int type_node +} + +enum TypeOperatorOperatorType { + key_of_keyword + unique_keyword + readonly_keyword +} + +' TypeOperator +entity type_operator extends type_node { + id: int <> + operator_id: int TypeOperatorOperatorType + type_node_id: int type_node +} + +type_operator |o--|| TypeOperatorOperatorType +type_operator |o--|| type_node + +' IndexedAccessType +entity indexed_access_type extends type_node { + id: int <> + object_type_node_id: int type_node + index_type_node_id: int type_node +} + +indexed_access_type |o--|| type_node +indexed_access_type |o--|| type_node + +enum MappedTypeReadonlyTokenType { + readonly_keyword + plus_token + minus_token +} + +enum MappedTypeQuestionTokenType { + question_token + plus_token + minus_token +} + +' MappedType +entity mapped_type extends type_node, declaration { + id: int <> + type_parameter_id: int type_parameter +} + +mapped_type |o--|| type_parameter + +entity mapped_type_readonly_token { + mapped_type_id: int <> mapped_type + readonly_token_id: int MappedTypeReadonlyTokenType +} + +mapped_type ||-o| mapped_type_readonly_token +MappedTypeReadonlyTokenType ||-o| mapped_type_readonly_token + +entity mapped_type_name_type_node { + mapped_type_id: int <> mapped_type + name_type_node_id: int type_node +} + +mapped_type ||-o| mapped_type_name_type_node +type_node ||-o| mapped_type_name_type_node + +entity mapped_type_question_token { + mapped_type_id: int <> mapped_type + question_token_id: int MappedTypeQuestionTokenType +} + +mapped_type ||-o| mapped_type_question_token +MappedTypeQuestionTokenType ||-o| mapped_type_question_token + +entity mapped_type_type_node { + mapped_type_id: int <> mapped_type + type_node_id: int type_node +} + +mapped_type ||-o| mapped_type_type_node +type_node ||-o| mapped_type_type_node + +enum LiteralTypeLiteralType extends BooleanLiteral { + null_literal + literal_expression + prefix_unary_expression +} + +' LiteralType +entity literal_type extends type_node { + id: int <> + literal_id: int LiteralTypeLiteralType +} + +literal_type |o--|| LiteralTypeLiteralType + +' NamedTupleMember +entity named_tuple_member extends type_node, declaration { + id: int <> + name_node_id: int identifier + type_node_id: int type_node +} + +named_tuple_member |o--|| identifier +named_tuple_member |o--|| type_node + +entity named_tuple_member_dot_dot_dot_token { + named_tuple_member_id: int <> named_tuple_member + dot_dot_dot_token_id: int dot_dot_dot_token +} + +named_tuple_member ||--o| named_tuple_member_dot_dot_dot_token +dot_dot_dot_token ||--o| named_tuple_member_dot_dot_dot_token + +entity named_tuple_member_question_token { + named_tuple_member_id: int <> named_tuple_member + question_token_id: int question_token +} + +named_tuple_member ||--o| named_tuple_member_question_token +question_token ||--o| named_tuple_member_question_token + +' TemplateLiteralTypeSpan +entity template_literal_type_span extends type_node { + id: int <> + parent_id: int template_literal_type + index: int + type_node_id: int type_node + literal_id: int TemplateMiddleOrTail +} + +template_literal_type_span |o--|| type_node +template_literal_type_span |o--|| TemplateMiddleOrTail + +' TemplateLiteralType +entity template_literal_type extends type_node { + id: int <> + head_id: int template_head + ' templateSpans template_literal_type_span +} + +template_literal_type |o--|| template_head +template_literal_type ||--o{ template_literal_type_span + +' ImportTypeAssertionContainer +entity import_type_assertion_container extends ast_node { + id: int <> + parent_id: int import_type + assert_clause_id: int assert_clause +} + +' ImportType +entity import_type extends node_with_type_arguments { + id: int <> + is_type_of: boolean + argument_id: int type_node + ' assertions import_type_assertion_container +} + +import_type |o--|| type_node +import_type ||--o| import_type_assertion_container + +entity import_type_qualifier { + import_type_id: int <> import_type + qualifier_id: int EntityName +} + +import_type ||--o| import_type_qualifier +EntityName ||--o| import_type_qualifier + +' ==== End of Type Nodes ==== + +' ==== Binding patterns ==== + +' BindingElement +entity binding_element extends declaration { + id: int <> + name_node_id: int BindingName +} + +enum BindingPattern { + object_binding_pattern + array_binding_pattern +} + +enum ArrayBindingElement { + binding_element + omitted_expression +} + +entity binding_element_property_name_node { + binding_element_id: int <> binding_element + property_name_node_id: int PropertyName +} + +binding_element ||--o| binding_element_property_name_node +PropertyName ||--o| binding_element_property_name_node + +entity binding_element_dot_dot_dot_token { + binding_element_id: int <> binding_element + dot_dot_dot_token_id: int dot_dot_dot_token +} + +binding_element ||--o| binding_element_dot_dot_dot_token +dot_dot_dot_token ||--o| binding_element_dot_dot_dot_token + +entity binding_element_initializer { + binding_element_id: int <> binding_element + initializer_id: int expression +} + +binding_element ||--o| binding_element_initializer +expression ||--o| binding_element_initializer + +' ObjectBindingPattern +entity object_binding_pattern extends ast_node { + id: int <> +} + +entity object_binding_pattern_element { + element_id: int <> binding_element + object_binding_pattern_id: int object_binding_pattern + index: int +} + +object_binding_pattern ||--o{ object_binding_pattern_element +binding_element ||--o| object_binding_pattern_element + +' ArrayBindingPattern +entity array_binding_pattern extends ast_node { + id: int <> +} + +entity array_binding_pattern_element { + element_id: int <> ArrayBindingElement + array_binding_pattern_id: int array_binding_pattern + index: int +} + +array_binding_pattern ||--o{ array_binding_pattern_element +ArrayBindingElement ||--o| array_binding_pattern_element + +' ==== End of Binding patterns ==== + +' ==== Expressions ==== + +' ThisExpression +entity this_expression extends primary_expression { + id: int <> +} + +' SuperExpression +entity super_expression extends primary_expression { + id: int <> +} + +' ImportExpression +entity import_expression extends primary_expression { + id: int <> +} + +' ArrayLiteralExpression +entity array_literal_expression extends primary_expression { + id: int <> +} + +entity array_literal_expression_element { + element_id: int <> expression + array_literal_expression_id: int array_literal_expression + index: int +} + +array_literal_expression ||--o{ array_literal_expression_element +expression ||--o| array_literal_expression_element + + +' ObjectLiteralExpression +entity object_literal_expression extends primary_expression, declaration { + id: int <> +} + +entity object_literal_expression_property { + property_id: int <> object_literal_element + object_literal_expression_id: int object_literal_expression + index: int +} + +object_literal_expression ||--o{ object_literal_expression_property +object_literal_element ||--o| object_literal_expression_property + +' PropertyAccessExpression +entity property_access_expression extends member_expression, declaration { + id: int <> + expression_id: int left_hand_side_expression + name_node_id: int MemberName +} + +property_access_expression |o--|| left_hand_side_expression +property_access_expression |o--|| MemberName + +entity property_access_expression_question_dot_token { + property_access_expression_id: int <> property_access_expression + question_dot_token_id: int question_dot_token +} + +property_access_expression ||--o| property_access_expression_question_dot_token +question_dot_token ||--o| property_access_expression_question_dot_token + + +' ElementAccessExpression +entity element_access_expression extends member_expression { + id: int <> + expression_id: int left_hand_side_expression + argument_expression_id: int expression +} + +element_access_expression |o--|| left_hand_side_expression +element_access_expression |o--|| expression + +entity element_access_expression_question_dot_token { + element_access_expression_id: int <> element_access_expression + question_dot_token_id: int question_dot_token +} + +element_access_expression ||--o| element_access_expression_question_dot_token +question_dot_token ||--o| element_access_expression_question_dot_token + +' AccessExpression +enum AccessExpression { + property_access_expression + element_access_expression +} + +' CallExpression +entity call_expression extends left_hand_side_expression, declaration { + id: int <> + expression_id: int expression +} + +call_expression |o--|| expression + +entity call_expression_question_dot_token { + call_expression_id: int <> call_expression + question_dot_token_id: int question_dot_token +} + +call_expression ||--o| call_expression_question_dot_token +question_dot_token ||--o| call_expression_question_dot_token + +entity call_expression_type_argument { + type_argument_id: int <> type_node + call_expression_id: int call_expression + index: int +} + +call_expression ||--o{ call_expression_type_argument +type_node ||--o| call_expression_type_argument + +entity call_expression_argument { + argument_id: int <> expression + call_expression_id: int call_expression + index: int +} + +call_expression ||--o{ call_expression_argument +expression ||--o| call_expression_argument + +' NewExpression +entity new_expression extends primary_expression, declaration { + id: int <> + expression_id: int left_hand_side_expression +} + +entity new_expression_type_argument { + type_argument_id: int <> type_node + new_expression_id: int new_expression + index: int +} + +new_expression ||--o{ new_expression_type_argument +type_node ||--o| new_expression_type_argument + +entity new_expression_argument { + argument_id: int <> expression + new_expression_id: int new_expression + index: int +} + +new_expression ||--o{ new_expression_argument +expression ||--o| new_expression_argument + +' TemplateExpression +entity template_expression extends primary_expression { + id: int <> + head_id: int template_head + ' template_spans template_span +} + +template_expression |o--|| template_head +template_expression ||--o{ template_span + +enum TemplateLiteral { + template_expression + no_substitution_template_literal +} + +' TaggedTemplateExpression +entity tagged_template_expression extends member_expression { + id: int <> + tag_id: int left_hand_side_expression + template_id: int TemplateLiteral +} + +tagged_template_expression |o--|| left_hand_side_expression +tagged_template_expression |o--|| TemplateLiteral + +entity tagged_template_expression_type_argument { + type_argument_id: int <> type_node + tagged_template_expression_id: int tagged_template_expression + index: int +} + +tagged_template_expression ||--o{ tagged_template_expression_type_argument +type_node ||--o| tagged_template_expression_type_argument + +' TypeAssertionExpression +entity type_assertion_expression extends unary_expression { + id: int <> + type_node_id: int type_node + expression_id: int unary_expression +} + +type_assertion_expression |o--|| type_node +type_assertion_expression |o--|| unary_expression + +' ParenthesizedExpression +entity parenthesized_expression extends primary_expression { + id: int <> + expression_id: int expression +} + +parenthesized_expression |o--|| expression + +' FunctionExpression +entity function_expression extends primary_expression, function_like_declaration { + id: int <> + ' modifiers modifier + body_id: int block +} + +function_expression |o--o{ modifier + +entity function_expression_name_node { + function_expression_id: int <> function_expression + name_node_id: int identifier +} + +function_expression ||--o| function_expression_name_node +identifier ||--o| function_expression_name_node + +' ArrowFunction +entity arrow_function extends expression, function_like_declaration { + id: int <> + ' modifiers modifier + equals_greater_than_token_id: int equals_greater_than_token + body_id: int BlockOrExpression +} + +arrow_function |o--o{ modifier +arrow_function |o--|| equals_greater_than_token +arrow_function |o--|| BlockOrExpression + +' EtsComponentExpression +entity ets_component_expression extends primary_expression, declaration { + id: int <> + expression_id: int left_hand_side_expression +} + +ets_component_expression |o--|| left_hand_side_expression + +entity ets_component_expression_type_argument { + type_argument_id: int <> type_node + ets_component_expression_id: int ets_component_expression + index: int +} + +ets_component_expression ||--o{ ets_component_expression_type_argument +type_node ||--o| ets_component_expression_type_argument + +entity ets_component_expression_argument { + argument_id: int <> expression + ets_component_expression_id: int ets_component_expression + index: int +} + +ets_component_expression ||--o{ ets_component_expression_argument +expression ||--o| ets_component_expression_argument + +entity ets_component_expression_body { + ets_component_expression_id: int <> ets_component_expression + body_id: int block +} + +ets_component_expression ||--o| ets_component_expression_body + +' DeleteExpression +entity delete_expression extends unary_expression { + id: int <> + expression_id: int unary_expression +} + +delete_expression |o--|| unary_expression + +' TypeOfExpression +entity type_of_expression extends unary_expression { + id: int <> + expression_id: int unary_expression +} + +type_of_expression |o--|| unary_expression + +' VoidExpression +entity void_expression extends unary_expression { + id: int <> + expression_id: int unary_expression +} + +void_expression |o--|| unary_expression + +' AwaitExpression +entity await_expression extends unary_expression { + id: int <> + expression_id: int unary_expression +} + +await_expression |o--|| unary_expression + +' PrefixUnaryOperator +enum PrefixUnaryOperator { + plus_plus_token + minus_minus_token + plus_token + minus_token + tilde_token + exclamation_token +} + +' PrefixUnaryExpression +entity prefix_unary_expression extends update_expression { + id: int <> + operator_id: int PrefixUnaryOperator + operand_id: int unary_expression +} + +prefix_unary_expression |o--|| PrefixUnaryOperator +prefix_unary_expression |o--|| unary_expression + +' PostUnaryOperator +enum PostUnaryOperator { + plus_plus_token + minus_minus_token +} + +' PostfixUnaryExpression +entity postfix_unary_expression extends update_expression { + id: int <> + operand_id: int left_hand_side_expression + operator_id: int PostUnaryOperator +} + +postfix_unary_expression |o--|| left_hand_side_expression +postfix_unary_expression |o--|| PostUnaryOperator + +enum ExponentiationOperator { + asterisk_asterisk_token +} + +enum MultiplicativeOperator { + asterisk_token + slash_token + percent_token +} + +enum MultiplicativeOperatorOrHigher extends ExponentiationOperator, MultiplicativeOperator {} + +enum AdditiveOperator { + plus_token + minus_token +} + +enum AdditiveOperatorOrHigher extends MultiplicativeOperatorOrHigher, AdditiveOperator {} + +enum ShiftOperator { + less_than_less_than_token + greater_than_greater_than_token + greater_than_greater_than_greater_than_token +} + +enum ShiftOperatorOrHigher extends AdditiveOperatorOrHigher, ShiftOperator {} + +enum RelationalOperator { + less_than_token + less_than_equals_token + greater_than_token + greater_than_equals_token + instance_of_keyword + in_keyword +} + +enum RelationalOperatorOrHigher extends ShiftOperatorOrHigher, RelationalOperator {} + +enum EqualityOperator { + equals_equals_token + equals_equals_equals_token + exclamation_equals_equals_token + exclamation_equals_token +} + +enum EqualityOperatorOrHigher extends RelationalOperatorOrHigher, EqualityOperator {} + +enum BitwiseOperator { + ampersand_token + bar_token + caret_token +} + +enum BitwiseOperatorOrHigher extends EqualityOperatorOrHigher, BitwiseOperator {} + +enum LogicalOperator { + ampersand_ampersand_token + bar_bar_token +} + +enum LogicalOperatorOrHigher extends BitwiseOperatorOrHigher, LogicalOperator {} + +enum CompoundAssignmentOperator { + plus_equals_token + minus_equals_token + asterisk_equals_token + asterisk_asterisk_equals_token + slash_equals_token + percent_equals_token + ampersand_equals_token + bar_equals_token + caret_equals_token + less_than_less_than_equals_token + greater_than_greater_than_greater_than_equals_token + greater_than_greater_than_equals_token + bar_bar_equals_token + ampersand_ampersand_equals_token + question_question_equals_token +} + +enum AssignmentOperator extends CompoundAssignmentOperator { + equals_token +} + +enum AssignmentOperatorOrHigher extends LogicalOperatorOrHigher, AssignmentOperator { + question_question_token +} + +enum BinaryOperator extends AssignmentOperatorOrHigher { + comma_token +} + +' BinaryExpression +entity binary_expression extends expression, declaration { + id: int <> + left_id: int expression + operator_id: int BinaryOperator + right_id: int expression +} + +binary_expression |o--|| expression +binary_expression |o--|| BinaryOperator +binary_expression |o--|| expression + +' ConditionalExpression +entity conditional_expression extends expression { + id: int <> + condition_id: int expression + question_token_id: int question_token + then_expression_id: int expression + colon_token_id: int colon_token + else_expression_id: int expression +} + +conditional_expression |o--|| expression +conditional_expression |o--|| question_token +conditional_expression |o--|| expression +conditional_expression |o--|| colon_token +conditional_expression |o--|| expression + +' YieldExpression +entity yield_expression extends expression { + id: int <> +} + +entity yield_expression_asterisk_token { + yield_expression_id: int <> yield_expression + asterisk_token_id: int asterisk_token +} + +yield_expression ||--o| yield_expression_asterisk_token +asterisk_token ||--o| yield_expression_asterisk_token + +entity yield_expression_expression { + yield_expression_id: int <> yield_expression + expression_id: int expression +} + +yield_expression ||--o| yield_expression_expression +expression ||--o| yield_expression_expression + +' SpreadElement +entity spread_element extends expression { + id: int <> + expression_id: int expression +} + +spread_element |o--|| expression + +' ClassExpression +entity class_expression extends class_like_declaration, primary_expression { + id: int <> + ' modifiers modifier +} + +class_expression |o--o{ modifier + +' OmittedExpression +entity omitted_expression extends expression { + id: int <> +} + +' ExpressionWithTypeArguments +entity expression_with_type_arguments extends member_expression, node_with_type_arguments { + id: int <> + expression_id: int left_hand_side_expression +} + +expression_with_type_arguments |o--|| left_hand_side_expression + +' AsExpression +entity as_expression extends expression { + id: int <> + expression_id: int expression + type_node_id: int type_node +} + +as_expression |o--|| expression +as_expression |o--|| type_node + +' NonNullExpression +entity non_null_expression extends left_hand_side_expression { + id: int <> + expression_id: int expression +} + +non_null_expression |o--|| expression + +enum NewOrImportKeyword { + new_keyword + import_keyword +} + +' MetaProperty +entity meta_property extends primary_expression { + id: int <> + keyword_token_id: int NewOrImportKeyword + name_node_id: int identifier +} + +meta_property |o--|| NewOrImportKeyword +meta_property |o--|| identifier + +' SatisfiesExpression +entity satisfies_expression extends expression { + id: int <> + expression_id: int expression + type_node_id: int type_node +} + +satisfies_expression |o--|| expression +satisfies_expression |o--|| type_node + +' ==== End of Expressions ==== + +' ==== Statements and Clauses ==== + +' Statement +entity statement extends ast_node { + id: int <> + kind: int +} + +' Block +entity block extends statement { + id: int <> +} + +entity block_statement { + statement_id: int <> statement + block_id: int block + index: int +} + +block ||--o{ block_statement +statement |o--|| block_statement + +block ||--o| method_declaration_body +block ||--o| constructor_body +block ||--o| get_accessor_body +block ||--o| set_accessor_body +function_expression |o--|| block +block ||--o| ets_component_expression_body + + +' EmptyStatement +entity empty_statement extends statement { + id: int <> +} + +' VariableDeclaration +entity variable_declaration extends declaration { + id: int <> + name_node_id: int BindingName +} + +entity variable_declaration_exclamation_token { + variable_declaration_id: int <> variable_declaration + exclamation_token_id: int exclamation_token +} + +entity variable_declaration_type_node { + variable_declaration_id: int <> variable_declaration + type_node_id: int type_node +} + +entity variable_declaration_initializer { + variable_declaration_id: int <> variable_declaration + initializer_id: int expression +} + +variable_declaration |o--|| BindingName +variable_declaration ||-o| variable_declaration_exclamation_token +exclamation_token ||-o| variable_declaration_exclamation_token +variable_declaration ||-o| variable_declaration_type_node +type_node ||-o| variable_declaration_type_node +variable_declaration ||-o| variable_declaration_initializer +expression ||-o| variable_declaration_initializer + + +' VariableDeclarationList +entity variable_declaration_list extends ast_node { + id: int <> +} + +entity variable_declaration_list_declaration { + declaration_id: int <> variable_declaration + variable_declaration_list_id: int variable_declaration_list + index: int +} + +variable_declaration_list ||--|{ variable_declaration_list_declaration +variable_declaration ||--o| variable_declaration_list_declaration + +' VariableStatement +entity variable_statement extends statement { + id: int <> + ' modifiers modifier + declaration_list_id: int variable_declaration_list +} + +variable_statement |o--o{ modifier +variable_statement |o--|| variable_declaration_list + +' ExpressionStatement +entity expression_statement extends statement { + id: int <> + expression_id: int expression +} + +expression_statement |o--|| expression + +' IfStatement +entity if_statement extends statement { + id: int <> + condition_id: int expression + then_statement_id: int statement +} + +entity if_statement_else_statement { + if_statement_id: int <> if_statement + else_statement_id: int statement +} + +if_statement |o--|| expression +if_statement |o--|| statement +if_statement ||--o| if_statement_else_statement +statement ||--o| if_statement_else_statement + +' IterationStatement +entity iteration_statement extends statement { + id: int <> + kind: int + statement_id: int statement +} + +iteration_statement |o--|| statement + +' DoStatement +entity do_statement extends iteration_statement { + id: int <> + expression_id: int expression +} + +do_statement |o--|| expression + +' WhileStatement +entity while_statement extends iteration_statement { + id: int <> + expression_id: int expression +} + +while_statement |o--|| expression + +enum ForInitializer { + variable_declaration_list + expression +} + +' ForStatement +entity for_statement extends iteration_statement { + id: int <> +} + +entity for_statement_initializer { + for_statement_id: int <> for_statement + initializer_id: int ForInitializer +} + +entity for_statement_condition { + for_statement_id: int <> for_statement + condition_id: int expression +} + +entity for_statement_incrementor { + for_statement_id: int <> for_statement + incrementor_id: int expression +} + +for_statement ||--o| for_statement_initializer +for_statement ||--o| for_statement_condition +for_statement ||--o| for_statement_incrementor +ForInitializer ||--o| for_statement_initializer +expression ||--o| for_statement_condition +expression ||--o| for_statement_incrementor + +' ForInStatement +entity for_in_statement extends iteration_statement { + id: int <> + initializer_id: int ForInitializer + expression_id: int expression +} + +for_in_statement |o--|| ForInitializer +for_in_statement |o--|| expression + +' ForOfStatement +entity for_of_statement extends iteration_statement { + id: int <> + initializer_id: int ForInitializer + expression_id: int expression +} + +entity for_of_statement_await_modifier { + for_of_statement_id: int <> for_of_statement + await_modifier_id: int await_keyword +} + +for_of_statement |o--|| ForInitializer +for_of_statement |o--|| expression +for_of_statement ||--o| for_of_statement_await_modifier +await_keyword |o--|| for_of_statement_await_modifier + +' ForInOrOfStatement +enum ForInOrOfStatement { + for_in_statement + for_of_statement +} + +' ContinueStatement +entity continue_statement extends statement { + id: int <> +} + +entity continue_statement_label { + continue_statement_id: int <> continue_statement + label_id: int identifier +} + +continue_statement ||--o| continue_statement_label +identifier |o--|| continue_statement_label + +' BreakStatement +entity break_statement extends statement { + id: int <> +} + +entity break_statement_label { + break_statement_id: int <> continue_statement + label_id: int identifier +} + +enum BreakOrContinueStatement { + continue_statement + break_statement +} + +break_statement ||--o| break_statement_label +identifier |o--|| break_statement_label + +' ReturnStatement +entity return_statement extends statement { + id: int <> +} + +entity return_statement_expression { + return_statement_id: int <> return_statement + expression_id: int expression +} + +return_statement ||--o| return_statement_expression +expression |o--|| return_statement_expression + +' WithStatement +entity with_statement extends statement { + id: int <> + expression_id: int expression + statement_id: int statement +} + +with_statement |o--|| expression +with_statement |o--|| statement + +' CaseBlock +entity case_block extends ast_node { + id: int <> +} + +' CaseOrDefaultClause +enum CaseOrDefaultClause { + case_clause + default_clause +} + +entity case_block_clause { + clause_id: int <> CaseOrDefaultClause + case_block_id: int case_block + index: int +} + +case_block ||--o{ case_block_clause +CaseOrDefaultClause ||--|| case_block_clause + +' CaseClause +entity case_clause extends ast_node { + id: int <> + expression_id: int expression +} + +entity case_clause_statement { + statement_id: int <> statement + case_clause_id: int case_clause + index: int +} + +case_clause |o--|| expression +case_clause ||--o{ case_clause_statement +statement ||--o| case_clause_statement + + +' DefaultClause +entity default_clause extends ast_node { + id: int <> +} + +entity default_clause_statement { + statement_id: int <> statement + default_clause_id: int default_clause + index: int +} + +default_clause ||--o{ default_clause_statement +statement ||--o| default_clause_statement + +' SwitchStatement +entity switch_statement extends statement { + id: int <> + expression_id: int expression + case_block_id: int case_block +} + +switch_statement |o--|| expression +switch_statement |o--|| case_block + +' LabeledStatement +entity labeled_statement extends statement { + id: int <> + label_id: int identifier + statement_id: int statement +} + +labeled_statement |o--|| identifier +labeled_statement |o--|| statement + +' ThrowStatement +entity throw_statement extends statement { + id: int <> + expression_id: int expression +} + +throw_statement |o--|| expression + +' TryStatement +entity try_statement extends statement { + id: int <> + try_block_id: int block +} + +entity try_statement_finally_block { + try_statement_id: int <> try_statement + finally_block_id: int block +} + +try_statement ||--o| try_statement_finally_block +block ||--o| try_statement_finally_block + +' CatchClause +entity catch_clause extends ast_node { + id: int <> + parent_id: int try_statement + block_id: int block +} + +try_statement ||--o| catch_clause + +entity catch_clause_variable_declaration { + catch_clause_id: int <> catch_clause + variable_declaration_id: int variable_declaration +} + +catch_clause |o--|| block +catch_clause ||--o| catch_clause_variable_declaration +variable_declaration ||--o| catch_clause_variable_declaration + +' DebuggerStatement +entity debugger_statement extends statement { + id: int <> +} + +enum DeclarationStatementNameNodeType { + identifier + string_literal + numeric_literal +} + +' DeclarationStatement +entity declaration_statement extends declaration, statement { + id: int <> + kind: int +} + +entity declaration_statement_name_node { + declaration_statement_id: int <> declaration_statement + name_node_id: int DeclarationStatementNameNodeType +} + +declaration_statement ||--o| declaration_statement_name_node +DeclarationStatementNameNodeType |o--o| declaration_statement_name_node + +' FunctionDeclaration +entity function_declaration extends function_like_declaration, declaration_statement { + id: int <> + ' modifiers modifier +} + +function_declaration |o--o{ modifier + +entity function_declaration_name_node { + function_declaration_id: int <> function_declaration + name_node_id: int identifier +} + +entity function_declaration_body { + function_declaration_id: int <> function_declaration + body_id: int block +} + +function_declaration ||--o| function_declaration_name_node +identifier ||--o| function_declaration_name_node +function_declaration ||--o| function_declaration_body +block ||--o| function_declaration_body + +' ClassDeclaration +entity class_declaration extends class_like_declaration, declaration_statement { + id: int <> + ' modifiers modifier +} + +class_declaration |o--o{ modifier + +entity class_declaration_name_node { + class_declaration_id: int <> class_declaration + name_node_id: int identifier +} + +class_declaration ||--o| class_declaration_name_node +identifier ||--o| class_declaration_name_node + +' StructDeclaration +entity struct_declaration extends class_like_declaration, declaration_statement { + id: int <> + ' modifiers modifier +} + +struct_declaration |o--o{ modifier + +entity struct_declaration_name_node { + struct_declaration_id: int <> struct_declaration + name_node_id: int identifier +} + +struct_declaration ||--o| struct_declaration_name_node +identifier ||--o| struct_declaration_name_node + +enum InterfaceOrClassLikeDeclaration { + interface_declaration + class_like_declaration +} + +enum ExtendsOrImplementsKeyword { + extends_keyword + implements_keyword +} + +' HeritageClause +entity heritage_clause extends ast_node { + id: int <> + parent_id: int InterfaceOrClassLikeDeclaration + index: int + token_id: int ExtendsOrImplementsKeyword +} + +heritage_clause ||--|| ExtendsOrImplementsKeyword + +class_like_declaration |o--o{ heritage_clause + +entity heritage_clause_type_node { + type_node_id: int <> expression_with_type_arguments + heritage_clause_id: int heritage_clause + index: int +} + +heritage_clause ||--o{ heritage_clause_type_node +expression_with_type_arguments ||--o| heritage_clause_type_node + +' InterfaceDeclaration +entity interface_declaration extends declaration_statement { + id: int <> + ' modifiers modifier + name_node_id: int identifier + ' heritage_clauses heritage_clause +} + +interface_declaration |o--o{ modifier +interface_declaration |o--|| identifier +interface_declaration |o--o{ heritage_clause + +entity interface_declaration_type_parameter { + type_parameter_id: int <> type_parameter + interface_declaration_id: int interface_declaration + index: int +} + +interface_declaration ||--o{ interface_declaration_type_parameter +type_parameter ||--o| interface_declaration_type_parameter + +entity interface_declaration_member { + member_id: int <> type_element + interface_declaration_id: int interface_declaration + index: int +} + +interface_declaration ||--o{ interface_declaration_member +type_element ||--o| interface_declaration_member + + +' TypeAliasDeclaration +entity type_alias_declaration extends declaration_statement { + id: int <> + ' modifiers modifier + name_node_id: int identifier + type_node_id: int type_node +} + +type_alias_declaration |o--o{ modifier +type_alias_declaration |o--|| identifier +type_alias_declaration |o--|| type_node + +entity type_alias_declaration_type_parameter { + type_parameter_id: int <> type_parameter + type_alias_declaration_id: int type_alias_declaration + index: int +} + +type_alias_declaration ||--o{ type_alias_declaration_type_parameter +type_parameter ||--o| type_alias_declaration_type_parameter + +' EnumDeclaration +entity enum_declaration extends declaration_statement { + id: int <> + ' modifiers modifier + name_node_id: int identifier + ' members enum_member +} + +enum_declaration |o--o{ modifier +enum_declaration |o--|| identifier +enum_declaration ||--o{ enum_member + +' ModuleName +enum ModuleName { + identifier + string_literal +} + +' ModuleBody +enum ModuleBody { + module_block + module_declaration + identifier +} + +' ModuleDeclaration +entity module_declaration extends declaration_statement { + id: int <> + ' modifiers modifier + name_node_id: int ModuleName +} + +module_declaration |o--o{ modifier +module_declaration |o--|| ModuleName + +entity module_declaration_body { + module_declaration_id: int <> module_declaration + body_id: int ModuleBody +} + +module_declaration ||--o| module_declaration_body +ModuleBody ||--o| module_declaration_body + +' ModuleBlock +entity module_block extends statement { + id: int <> +} + +entity module_block_statement { + statement_id: int <> statement + module_block_id: int module_block + index: int +} + +module_block ||--o{ module_block_statement +statement ||--o| module_block_statement + +' NamespaceExportDeclaration +entity namespace_export_declaration extends declaration_statement { + id: int <> + name_node_id: int identifier +} + +namespace_export_declaration |o--|| identifier + +' ExternalModuleReference +entity external_module_reference extends ast_node { + id: int <> + expression_id: int expression +} + +external_module_reference |o--|| expression + +' ModuleReference +enum ModuleReference extends EntityName{ + external_module_reference +} + +' ImportEqualsDeclaration +entity import_equals_declaration extends declaration_statement { + id: int <> + ' modifiers modifier + name_node_id: int identifier + is_type_only: boolean + module_reference_id: int ModuleReference +} + +import_equals_declaration |o--o{ modifier +import_equals_declaration |o--|| identifier +import_equals_declaration |o--|| ModuleReference + +' NamespaceImport +entity namespace_import extends declaration { + id: int <> + name_node_id: int identifier +} + +namespace_import |o--|| identifier + +' ImportSpecifier +entity import_specifier extends declaration { + id: int <> + parent_id: int named_imports + index: int + name_node_id: int identifier + is_type_only: boolean +} + +import_specifier |o--|| identifier + +entity import_specifier_property_name_node { + import_specifier_id: int <> import_specifier + property_name_node_id: int identifier +} + +import_specifier ||--o| import_specifier_property_name_node +identifier ||--o| import_specifier_property_name_node + +' NamedImports +entity named_imports extends ast_node { + id: int <> + ' elements import_specifier +} + +named_imports ||--|{ import_specifier + +' NamedImportBindings +enum NamedImportBindings { + namespace_import + named_imports +} + +' ImportClause +entity import_clause extends declaration { + id: int <> + parent_id: int import_declaration + is_type_only: boolean +} + +entity import_clause_name_node { + import_clause_id: int <> import_clause + name_node_id: int identifier +} + +import_clause ||--o| import_clause_name_node +identifier ||--o| import_clause_name_node + +entity import_clause_named_bindings { + import_clause_id: int <> import_clause + named_bindings_id: int NamedImportBindings +} + +import_clause ||--o| import_clause_named_bindings +NamedImportBindings ||--o| import_clause_named_bindings + +' AssertionKey +enum AssertionKey { + identifier + string_literal +} + +' AssertEntry +entity assert_entry extends ast_node { + id: int <> + parent_id: int assert_clause + index: int + name_node_id: int AssertionKey + value_node_id: int expression +} + +assert_entry |o--|| AssertionKey +assert_entry |o--|| expression + +' AssertClause +entity assert_clause extends ast_node { + id: int <> + ' elements assert_entry +} + +assert_clause ||--o{ assert_entry + +import_type_assertion_container |o--|| assert_clause + +' ImportDeclaration +entity import_declaration extends declaration_statement { + id: int <> + ' modifiers modifier + ' import_clause import_clause + module_specifier_id: int string_literal +} + +import_declaration |o--o{ modifier +import_declaration |o--o| import_clause +import_declaration |o--|| string_literal + +entity import_declaration_assert_clause { + import_declaration_id: int <> import_declaration + assert_clause_id: int assert_clause +} + +import_declaration ||--o| import_declaration_assert_clause +assert_clause ||--o| import_declaration_assert_clause + +' ExportAssignment +entity export_assignment extends declaration_statement { + id: int <> + ' modifiers modifier + is_export_equals: boolean + expression_id: int expression +} + +export_assignment |o--o{ modifier +export_assignment |o--|| expression + +' ExportSpecifier +entity export_specifier extends declaration { + id: int <> + parent_id: int named_exports + index: int + is_type_only: boolean + name_node_id: int identifier +} + +export_specifier |o--|| identifier + +entity export_specifier_property_name_node { + export_specifier_id: int <> export_specifier + property_name_node_id: int identifier +} + +export_specifier ||--o| export_specifier_property_name_node +identifier ||--o| export_specifier_property_name_node + +' NamedExports +entity named_exports extends ast_node { + id: int <> + ' elements export_specifier +} + +named_exports ||--|{ export_specifier + +' NamespaceExport +entity namespace_export extends declaration { + id: int <> + name_node_id: int identifier +} + +namespace_export |o--|| identifier + +' NamedExportBindings +enum NamedExportBindings { + namespace_export + named_exports +} + +' ExportDeclaration +entity export_declaration extends declaration_statement { + id: int <> + ' modifiers modifier + is_type_only: boolean +} + +export_declaration |o--o{ modifier + +entity export_declaration_export_clause { + export_declaration_id: int <> export_declaration + export_clause_id: int NamedExportBindings +} + +export_declaration ||--o| export_declaration_export_clause +NamedExportBindings ||--o| export_declaration_export_clause + +entity export_declaration_module_specifier { + export_declaration_id: int <> export_declaration + module_specifier_id: int string_literal +} + +export_declaration ||--o| export_declaration_module_specifier +string_literal ||--o| export_declaration_module_specifier + +entity export_declaration_assert_clause { + export_declaration_id: int <> export_declaration + assert_clause_id: int +} + +export_declaration ||--o| export_declaration_assert_clause +assert_clause ||--o| export_declaration_assert_clause + +' ==== End of Statements and Clauses ==== + +' TopLevel +entity top_level { + id: int <> + kind: int + location_id: int location +} + +entity top_level_statement { + statement_id: int <> statement + top_level_id: int top_level + index: int +} + +top_level ||--o{ top_level_statement +statement ||--o| top_level_statement + +' +' End of AST Nodes +' + +enum AstNodeContainer { + top_level + function_like_declaration + module_declaration +} + +entity ast_node_container_relation { + ast_node_id: int <> ast_node + container_id: int AstNodeContainer +} + +entity cfg_entry_node { + id: int <> + ast_node_id: int AstNodeContainer +} + +entity cfg_exit_node { + id: int <> + ast_node_id: int AstNodeContainer +} + + +' use `symbol_` instead of `symbol` to avoid the typescript error TS2457: Type alias name cannot be 'symbol'. +entity symbol_ { + id: int <> + name: text + description: text +} + +entity ast_node_symbol { + ast_node_id: int <> ast_node + symbol_id: int symbol_ +} + +symbol_ ||--|{ ast_node_symbol +ast_node ||--o| ast_node_symbol + +entity shorthand_property_assignment_value_symbol { + shorthand_property_assignment_id: int <> shorthand_property_assignment + symbol_id: int symbol_ +} + +shorthand_property_assignment ||--o| shorthand_property_assignment_value_symbol +symbol_ |o--|| shorthand_property_assignment_value_symbol + + +entity type_ { + id: int <> + name: text +} + +entity ast_node_type { + ast_node_id: int <> ast_node + type_id: int type_ +} + +ast_node ||--o| ast_node_type +type_ ||--|{ ast_node_type + +enum CallLikeExpression { + call_expression + new_expression + tagged_template_expression + decorator + ets_component_expression +} + +enum MayInvokeExpression extends CallLikeExpression, AccessExpression {} + +entity call_site_declaration { + id: int <> + call_site_id: int MayInvokeExpression + declaration_id: int signature_declaration | property_signature +} + +call_site_declaration |o--|| MayInvokeExpression +call_site_declaration |o--o| signature_declaration +call_site_declaration |o--o| property_signature + +entity call_site_implementation { + id: int <> + call_site_id: int MayInvokeExpression + implementation_id: int signature_declaration +} + +call_site_implementation |o--|| MayInvokeExpression +call_site_implementation |o--|| signature_declaration + +' ==== Comments ==== + +entity comment { + id: int <> + kind: int + location_id: int location +} + +entity ast_node_comment { + id: int <> + kind: int + ast_node_id: int ast_node + comment_id: int comment + index: int +} + +comment ||--o{ ast_node_comment +ast_node ||--o{ ast_node_comment + +' ==== End of Comments ==== + +' ==== Other data ==== +entity metadata { + id: int <> + version: text + created_time: datetime +} + +entity ignored_path { + id: int <> + path_kind: int + path: text + ignore_kind: int +} + +@enduml diff --git a/language/arkts/extractor/jinja/puml_to_schema_prisma.py b/language/arkts/extractor/jinja/puml_to_schema_prisma.py new file mode 100755 index 00000000..e578e102 --- /dev/null +++ b/language/arkts/extractor/jinja/puml_to_schema_prisma.py @@ -0,0 +1,182 @@ +#! python3 + +""" + Copyright 2024 Ant Group CO., Ltd. + + Generate `schema.prisma` from `er.puml`. +""" + +import argparse +import os +import re +from dataclasses import dataclass +from pathlib import Path +from typing import List + +from jinja2 import Environment, FileSystemLoader + +prisma_type_map = { + "int": "Int", + "boolean": "Boolean", + "text": "String", + "datetime": "DateTime", +} + +PRISMA_ID_TYPE = "BigInt" + +script_dir_path = os.path.dirname(__file__) + + +@dataclass +class Column: + name: str + type: str + prisma_type: str + # gdl_type: str + is_pk: bool = False + + +@dataclass +class Table: + name: str + column_list: List[Column] + pk_index: int + + +def parse_args(): + """解析脚本的参数 + + Returns: + 解析后的 args 对象 + + """ + + parser = argparse.ArgumentParser( + description="Convert Plantuml ER file to prisma.schema" + ) + parser.add_argument( + "puml_er_file", type=argparse.FileType(encoding="utf-8", errors="replace") + ) + parser.add_argument( + "--prisma-schema", "--output", "-o", dest="output_path", default=script_dir_path + ) + + return parser.parse_args() + + +def parse_puml_er(puml_er_str: str) -> List[Table]: + """解析 puml ER 图的内容 + + Format: + entity location { + oid: INTEGER + file_oid: INTEGER + start_line_number: INTEGER + start_column_number: INTEGER + end_line_number: INTEGER + end_column_number: INTEGER + } + + Returns: + table_list: 解析后的 Table 列表 + + """ + + table_list: List[Table] = [] + + # 匹配每一个 ER 图中 entity 的内容 + entity_regex = r"(?<=\nentity\s).+ \{[^\}]+\}" + matches = re.finditer(entity_regex, puml_er_str, re.MULTILINE) + for match in matches: + entity_str = match.group().strip() + + # Get the table name + try: + table_name = entity_str.split(maxsplit=1)[0] + except: + continue + + # 匹配全部列的内容 + column_content_regex = r"(?<=\{).+(?=\})" + column_content_match = re.search( + pattern=column_content_regex, + string=entity_str, + flags=re.MULTILINE | re.DOTALL, + ) + if column_content_match is None: + continue + column_content = column_content_match.group().strip() + + # 获取每一个列名和类型 + column_desc_list = [x.strip() for x in column_content.splitlines()] + column_desc_list = [x for x in column_desc_list if x] + column_list: List[Column] = [] + pk_index = 0 + for column_desc in column_desc_list: + column_desc_list = [x.strip() for x in column_desc.split(" ")] + column_desc_list = [x for x in column_desc_list if x] + + column_name = column_desc_list[0] + + # Skip comments + if column_name.startswith("'"): + continue + + if column_name.endswith(":"): + column_name = column_name[:-1] + + column_type = column_desc_list[1] + column_prisma_type = PRISMA_ID_TYPE if (column_name == "id" or column_name.endswith("_id")) else prisma_type_map.get(column_type) + + if column_prisma_type is None: + raise RuntimeError( + f"Cannot convert column type to prisma type: {column_type}" + ) + + is_pk = "<>" in column_desc_list + if is_pk: + pk_index = len(column_list) + + column = Column( + name=column_name, + type=column_type, + prisma_type=column_prisma_type, + # gdl_type=column_gdl_type, + is_pk=is_pk, + ) + column_list.append(column) + + table = Table( + name=table_name, + column_list=column_list, + pk_index=pk_index, + ) + + table_list.append(table) + + return table_list + + +def main(): + args = parse_args() + puml_er_file = args.puml_er_file + puml_er_str = puml_er_file.read() + table_list = parse_puml_er(puml_er_str=puml_er_str) + puml_er_file.close() + + jinja_env = Environment( + loader=FileSystemLoader(searchpath=script_dir_path), + ) + + for template_name in jinja_env.list_templates(extensions="j2"): + template = jinja_env.get_template(template_name) + rendered_content = template.render( + table_list=table_list, + ) + rendered_path = Path(args.output_path, Path(template_name).stem) + with open(rendered_path, "w") as f: + f.write(rendered_content) + + +if __name__ == "__main__": + main() diff --git a/language/arkts/extractor/jinja/requirements.txt b/language/arkts/extractor/jinja/requirements.txt new file mode 100644 index 00000000..cd1737d6 --- /dev/null +++ b/language/arkts/extractor/jinja/requirements.txt @@ -0,0 +1 @@ +Jinja2==3.1.3 diff --git a/language/arkts/extractor/jinja/schema.prisma.j2 b/language/arkts/extractor/jinja/schema.prisma.j2 new file mode 100644 index 00000000..bac704b8 --- /dev/null +++ b/language/arkts/extractor/jinja/schema.prisma.j2 @@ -0,0 +1,19 @@ +// Generated from `er.puml` + +datasource db { + provider = "sqlite" + url = "file:init.db" +} + +generator client { + provider = "prisma-client-js" + binaryTargets = ["darwin", "darwin-arm64", "debian-openssl-1.0.x", "debian-openssl-1.1.x", "debian-openssl-3.0.x", "rhel-openssl-1.0.x", "rhel-openssl-1.1.x", "rhel-openssl-3.0.x"] +} + +{% for table in table_list %} +model {{table.name}} { + {%- for column in table.column_list %} + {{ column.name }} {{column.prisma_type}}{% if column.is_pk %} @id {%- endif -%} + {% endfor %} +} +{% endfor %} diff --git a/language/arkts/extractor/package-lock.json b/language/arkts/extractor/package-lock.json new file mode 100644 index 00000000..332ddfdc --- /dev/null +++ b/language/arkts/extractor/package-lock.json @@ -0,0 +1,9203 @@ +{ + "name": "coref-arkts-src-extractor", + "version": "1.0.0", + "lockfileVersion": 2, + "requires": true, + "packages": { + "": { + "name": "coref-arkts-src-extractor", + "version": "1.0.0", + "dependencies": { + "@prisma/client": "^5.12.1", + "commander": "^12.0.0", + "ignore": "^5.3.1", + "lodash": "^4.17.21", + "ohos-typescript": "^4.9.5-r6", + "threads": "^1.7.0" + }, + "bin": { + "coref-arkts-src-extractor": "dist/src/index.js" + }, + "devDependencies": { + "@bazel/typescript": "^5.8.1", + "@eslint/js": "^9.0.0", + "@types/jest": "^29.5.12", + "@types/lodash": "^4.17.0", + "@types/node": "^20.12.6", + "eslint": "^8.57.0", + "jest": "^29.7.0", + "pkg": "^5.8.1", + "prettier": "^3.2.5", + "prisma": "^5.12.1", + "ts-jest": "^29.1.2", + "ts-node": "^10.9.2", + "typescript": "^5.4.4", + "typescript-eslint": "^7.6.0" + } + }, + "node_modules/@aashutoshrathi/word-wrap": { + "version": "1.2.6", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/@ampproject/remapping": { + "version": "2.3.0", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@jridgewell/gen-mapping": "^0.3.5", + "@jridgewell/trace-mapping": "^0.3.24" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@babel/code-frame": { + "version": "7.24.2", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/highlight": "^7.24.2", + "picocolors": "^1.0.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/compat-data": { + "version": "7.24.4", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/core": { + "version": "7.24.4", + "dev": true, + "license": "MIT", + "dependencies": { + "@ampproject/remapping": "^2.2.0", + "@babel/code-frame": "^7.24.2", + "@babel/generator": "^7.24.4", + "@babel/helper-compilation-targets": "^7.23.6", + "@babel/helper-module-transforms": "^7.23.3", + "@babel/helpers": "^7.24.4", + "@babel/parser": "^7.24.4", + "@babel/template": "^7.24.0", + "@babel/traverse": "^7.24.1", + "@babel/types": "^7.24.0", + "convert-source-map": "^2.0.0", + "debug": "^4.1.0", + "gensync": "^1.0.0-beta.2", + "json5": "^2.2.3", + "semver": "^6.3.1" + }, + "engines": { + "node": ">=6.9.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/babel" + } + }, + "node_modules/@babel/generator": { + "version": "7.24.4", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/types": "^7.24.0", + "@jridgewell/gen-mapping": "^0.3.5", + "@jridgewell/trace-mapping": "^0.3.25", + "jsesc": "^2.5.1" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-compilation-targets": { + "version": "7.23.6", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/compat-data": "^7.23.5", + "@babel/helper-validator-option": "^7.23.5", + "browserslist": "^4.22.2", + "lru-cache": "^5.1.1", + "semver": "^6.3.1" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-environment-visitor": { + "version": "7.22.20", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-function-name": { + "version": "7.23.0", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/template": "^7.22.15", + "@babel/types": "^7.23.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-hoist-variables": { + "version": "7.22.5", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/types": "^7.22.5" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-module-imports": { + "version": "7.24.3", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/types": "^7.24.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-module-transforms": { + "version": "7.23.3", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-environment-visitor": "^7.22.20", + "@babel/helper-module-imports": "^7.22.15", + "@babel/helper-simple-access": "^7.22.5", + "@babel/helper-split-export-declaration": "^7.22.6", + "@babel/helper-validator-identifier": "^7.22.20" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0" + } + }, + "node_modules/@babel/helper-plugin-utils": { + "version": "7.24.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-simple-access": { + "version": "7.22.5", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/types": "^7.22.5" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-split-export-declaration": { + "version": "7.22.6", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/types": "^7.22.5" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-string-parser": { + "version": "7.24.1", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-validator-identifier": { + "version": "7.22.20", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-validator-option": { + "version": "7.23.5", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helpers": { + "version": "7.24.4", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/template": "^7.24.0", + "@babel/traverse": "^7.24.1", + "@babel/types": "^7.24.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/highlight": { + "version": "7.24.2", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-validator-identifier": "^7.22.20", + "chalk": "^2.4.2", + "js-tokens": "^4.0.0", + "picocolors": "^1.0.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/highlight/node_modules/ansi-styles": { + "version": "3.2.1", + "dev": true, + "license": "MIT", + "dependencies": { + "color-convert": "^1.9.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/@babel/highlight/node_modules/chalk": { + "version": "2.4.2", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/@babel/highlight/node_modules/color-convert": { + "version": "1.9.3", + "dev": true, + "license": "MIT", + "dependencies": { + "color-name": "1.1.3" + } + }, + "node_modules/@babel/highlight/node_modules/color-name": { + "version": "1.1.3", + "dev": true, + "license": "MIT" + }, + "node_modules/@babel/highlight/node_modules/escape-string-regexp": { + "version": "1.0.5", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.8.0" + } + }, + "node_modules/@babel/highlight/node_modules/has-flag": { + "version": "3.0.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/@babel/highlight/node_modules/supports-color": { + "version": "5.5.0", + "dev": true, + "license": "MIT", + "dependencies": { + "has-flag": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/@babel/parser": { + "version": "7.24.4", + "dev": true, + "license": "MIT", + "bin": { + "parser": "bin/babel-parser.js" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@babel/plugin-syntax-async-generators": { + "version": "7.8.4", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.8.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-bigint": { + "version": "7.8.3", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.8.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-class-properties": { + "version": "7.12.13", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.12.13" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-import-meta": { + "version": "7.10.4", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.10.4" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-json-strings": { + "version": "7.8.3", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.8.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-jsx": { + "version": "7.24.1", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.24.0" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-logical-assignment-operators": { + "version": "7.10.4", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.10.4" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-nullish-coalescing-operator": { + "version": "7.8.3", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.8.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-numeric-separator": { + "version": "7.10.4", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.10.4" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-object-rest-spread": { + "version": "7.8.3", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.8.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-optional-catch-binding": { + "version": "7.8.3", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.8.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-optional-chaining": { + "version": "7.8.3", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.8.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-top-level-await": { + "version": "7.14.5", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.14.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-typescript": { + "version": "7.24.1", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.24.0" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/template": { + "version": "7.24.0", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/code-frame": "^7.23.5", + "@babel/parser": "^7.24.0", + "@babel/types": "^7.24.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/traverse": { + "version": "7.24.1", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/code-frame": "^7.24.1", + "@babel/generator": "^7.24.1", + "@babel/helper-environment-visitor": "^7.22.20", + "@babel/helper-function-name": "^7.23.0", + "@babel/helper-hoist-variables": "^7.22.5", + "@babel/helper-split-export-declaration": "^7.22.6", + "@babel/parser": "^7.24.1", + "@babel/types": "^7.24.0", + "debug": "^4.3.1", + "globals": "^11.1.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/types": { + "version": "7.24.0", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-string-parser": "^7.23.4", + "@babel/helper-validator-identifier": "^7.22.20", + "to-fast-properties": "^2.0.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@bazel/typescript": { + "version": "5.8.1", + "dev": true, + "hasInstallScript": true, + "license": "Apache-2.0", + "dependencies": { + "@bazel/worker": "5.8.1", + "semver": "5.6.0", + "source-map-support": "0.5.9", + "tsutils": "3.21.0" + }, + "bin": { + "ts_project_options_validator": "internal/ts_project_options_validator.js" + }, + "peerDependencies": { + "typescript": ">=3.0.0" + } + }, + "node_modules/@bazel/typescript/node_modules/semver": { + "version": "5.6.0", + "dev": true, + "license": "ISC", + "bin": { + "semver": "bin/semver" + } + }, + "node_modules/@bazel/typescript/node_modules/source-map-support": { + "version": "0.5.9", + "dev": true, + "license": "MIT", + "dependencies": { + "buffer-from": "^1.0.0", + "source-map": "^0.6.0" + } + }, + "node_modules/@bazel/worker": { + "version": "5.8.1", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "google-protobuf": "^3.6.1" + } + }, + "node_modules/@bcoe/v8-coverage": { + "version": "0.2.3", + "dev": true, + "license": "MIT" + }, + "node_modules/@cspotcode/source-map-support": { + "version": "0.8.1", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/trace-mapping": "0.3.9" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/@cspotcode/source-map-support/node_modules/@jridgewell/trace-mapping": { + "version": "0.3.9", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/resolve-uri": "^3.0.3", + "@jridgewell/sourcemap-codec": "^1.4.10" + } + }, + "node_modules/@eslint-community/eslint-utils": { + "version": "4.4.0", + "dev": true, + "license": "MIT", + "dependencies": { + "eslint-visitor-keys": "^3.3.0" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "peerDependencies": { + "eslint": "^6.0.0 || ^7.0.0 || >=8.0.0" + } + }, + "node_modules/@eslint-community/regexpp": { + "version": "4.10.0", + "dev": true, + "license": "MIT", + "engines": { + "node": "^12.0.0 || ^14.0.0 || >=16.0.0" + } + }, + "node_modules/@eslint/eslintrc": { + "version": "2.1.4", + "dev": true, + "license": "MIT", + "dependencies": { + "ajv": "^6.12.4", + "debug": "^4.3.2", + "espree": "^9.6.0", + "globals": "^13.19.0", + "ignore": "^5.2.0", + "import-fresh": "^3.2.1", + "js-yaml": "^4.1.0", + "minimatch": "^3.1.2", + "strip-json-comments": "^3.1.1" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/@eslint/eslintrc/node_modules/argparse": { + "version": "2.0.1", + "dev": true, + "license": "Python-2.0" + }, + "node_modules/@eslint/eslintrc/node_modules/globals": { + "version": "13.24.0", + "dev": true, + "license": "MIT", + "dependencies": { + "type-fest": "^0.20.2" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/@eslint/eslintrc/node_modules/js-yaml": { + "version": "4.1.0", + "dev": true, + "license": "MIT", + "dependencies": { + "argparse": "^2.0.1" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, + "node_modules/@eslint/eslintrc/node_modules/type-fest": { + "version": "0.20.2", + "dev": true, + "license": "(MIT OR CC0-1.0)", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/@eslint/js": { + "version": "9.0.0", + "dev": true, + "license": "MIT", + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + } + }, + "node_modules/@humanwhocodes/config-array": { + "version": "0.11.14", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@humanwhocodes/object-schema": "^2.0.2", + "debug": "^4.3.1", + "minimatch": "^3.0.5" + }, + "engines": { + "node": ">=10.10.0" + } + }, + "node_modules/@humanwhocodes/module-importer": { + "version": "1.0.1", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=12.22" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/nzakas" + } + }, + "node_modules/@humanwhocodes/object-schema": { + "version": "2.0.3", + "dev": true, + "license": "BSD-3-Clause" + }, + "node_modules/@istanbuljs/load-nyc-config": { + "version": "1.1.0", + "dev": true, + "license": "ISC", + "dependencies": { + "camelcase": "^5.3.1", + "find-up": "^4.1.0", + "get-package-type": "^0.1.0", + "js-yaml": "^3.13.1", + "resolve-from": "^5.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/@istanbuljs/schema": { + "version": "0.1.3", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/@jest/console": { + "version": "29.7.0", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/types": "^29.6.3", + "@types/node": "*", + "chalk": "^4.0.0", + "jest-message-util": "^29.7.0", + "jest-util": "^29.7.0", + "slash": "^3.0.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/@jest/core": { + "version": "29.7.0", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/console": "^29.7.0", + "@jest/reporters": "^29.7.0", + "@jest/test-result": "^29.7.0", + "@jest/transform": "^29.7.0", + "@jest/types": "^29.6.3", + "@types/node": "*", + "ansi-escapes": "^4.2.1", + "chalk": "^4.0.0", + "ci-info": "^3.2.0", + "exit": "^0.1.2", + "graceful-fs": "^4.2.9", + "jest-changed-files": "^29.7.0", + "jest-config": "^29.7.0", + "jest-haste-map": "^29.7.0", + "jest-message-util": "^29.7.0", + "jest-regex-util": "^29.6.3", + "jest-resolve": "^29.7.0", + "jest-resolve-dependencies": "^29.7.0", + "jest-runner": "^29.7.0", + "jest-runtime": "^29.7.0", + "jest-snapshot": "^29.7.0", + "jest-util": "^29.7.0", + "jest-validate": "^29.7.0", + "jest-watcher": "^29.7.0", + "micromatch": "^4.0.4", + "pretty-format": "^29.7.0", + "slash": "^3.0.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + }, + "peerDependencies": { + "node-notifier": "^8.0.1 || ^9.0.0 || ^10.0.0" + }, + "peerDependenciesMeta": { + "node-notifier": { + "optional": true + } + } + }, + "node_modules/@jest/environment": { + "version": "29.7.0", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/fake-timers": "^29.7.0", + "@jest/types": "^29.6.3", + "@types/node": "*", + "jest-mock": "^29.7.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/@jest/expect": { + "version": "29.7.0", + "dev": true, + "license": "MIT", + "dependencies": { + "expect": "^29.7.0", + "jest-snapshot": "^29.7.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/@jest/expect-utils": { + "version": "29.7.0", + "dev": true, + "license": "MIT", + "dependencies": { + "jest-get-type": "^29.6.3" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/@jest/fake-timers": { + "version": "29.7.0", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/types": "^29.6.3", + "@sinonjs/fake-timers": "^10.0.2", + "@types/node": "*", + "jest-message-util": "^29.7.0", + "jest-mock": "^29.7.0", + "jest-util": "^29.7.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/@jest/globals": { + "version": "29.7.0", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/environment": "^29.7.0", + "@jest/expect": "^29.7.0", + "@jest/types": "^29.6.3", + "jest-mock": "^29.7.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/@jest/reporters": { + "version": "29.7.0", + "dev": true, + "license": "MIT", + "dependencies": { + "@bcoe/v8-coverage": "^0.2.3", + "@jest/console": "^29.7.0", + "@jest/test-result": "^29.7.0", + "@jest/transform": "^29.7.0", + "@jest/types": "^29.6.3", + "@jridgewell/trace-mapping": "^0.3.18", + "@types/node": "*", + "chalk": "^4.0.0", + "collect-v8-coverage": "^1.0.0", + "exit": "^0.1.2", + "glob": "^7.1.3", + "graceful-fs": "^4.2.9", + "istanbul-lib-coverage": "^3.0.0", + "istanbul-lib-instrument": "^6.0.0", + "istanbul-lib-report": "^3.0.0", + "istanbul-lib-source-maps": "^4.0.0", + "istanbul-reports": "^3.1.3", + "jest-message-util": "^29.7.0", + "jest-util": "^29.7.0", + "jest-worker": "^29.7.0", + "slash": "^3.0.0", + "string-length": "^4.0.1", + "strip-ansi": "^6.0.0", + "v8-to-istanbul": "^9.0.1" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + }, + "peerDependencies": { + "node-notifier": "^8.0.1 || ^9.0.0 || ^10.0.0" + }, + "peerDependenciesMeta": { + "node-notifier": { + "optional": true + } + } + }, + "node_modules/@jest/schemas": { + "version": "29.6.3", + "dev": true, + "license": "MIT", + "dependencies": { + "@sinclair/typebox": "^0.27.8" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/@jest/source-map": { + "version": "29.6.3", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/trace-mapping": "^0.3.18", + "callsites": "^3.0.0", + "graceful-fs": "^4.2.9" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/@jest/test-result": { + "version": "29.7.0", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/console": "^29.7.0", + "@jest/types": "^29.6.3", + "@types/istanbul-lib-coverage": "^2.0.0", + "collect-v8-coverage": "^1.0.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/@jest/test-sequencer": { + "version": "29.7.0", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/test-result": "^29.7.0", + "graceful-fs": "^4.2.9", + "jest-haste-map": "^29.7.0", + "slash": "^3.0.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/@jest/transform": { + "version": "29.7.0", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/core": "^7.11.6", + "@jest/types": "^29.6.3", + "@jridgewell/trace-mapping": "^0.3.18", + "babel-plugin-istanbul": "^6.1.1", + "chalk": "^4.0.0", + "convert-source-map": "^2.0.0", + "fast-json-stable-stringify": "^2.1.0", + "graceful-fs": "^4.2.9", + "jest-haste-map": "^29.7.0", + "jest-regex-util": "^29.6.3", + "jest-util": "^29.7.0", + "micromatch": "^4.0.4", + "pirates": "^4.0.4", + "slash": "^3.0.0", + "write-file-atomic": "^4.0.2" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/@jest/types": { + "version": "29.6.3", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/schemas": "^29.6.3", + "@types/istanbul-lib-coverage": "^2.0.0", + "@types/istanbul-reports": "^3.0.0", + "@types/node": "*", + "@types/yargs": "^17.0.8", + "chalk": "^4.0.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/@jridgewell/gen-mapping": { + "version": "0.3.5", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/set-array": "^1.2.1", + "@jridgewell/sourcemap-codec": "^1.4.10", + "@jridgewell/trace-mapping": "^0.3.24" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/resolve-uri": { + "version": "3.1.2", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/set-array": { + "version": "1.2.1", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/sourcemap-codec": { + "version": "1.4.15", + "dev": true, + "license": "MIT" + }, + "node_modules/@jridgewell/trace-mapping": { + "version": "0.3.25", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/resolve-uri": "^3.1.0", + "@jridgewell/sourcemap-codec": "^1.4.14" + } + }, + "node_modules/@nodelib/fs.scandir": { + "version": "2.1.5", + "dev": true, + "license": "MIT", + "dependencies": { + "@nodelib/fs.stat": "2.0.5", + "run-parallel": "^1.1.9" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/@nodelib/fs.stat": { + "version": "2.0.5", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 8" + } + }, + "node_modules/@nodelib/fs.walk": { + "version": "1.2.8", + "dev": true, + "license": "MIT", + "dependencies": { + "@nodelib/fs.scandir": "2.1.5", + "fastq": "^1.6.0" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/@prisma/client": { + "version": "5.12.1", + "hasInstallScript": true, + "license": "Apache-2.0", + "engines": { + "node": ">=16.13" + }, + "peerDependencies": { + "prisma": "*" + }, + "peerDependenciesMeta": { + "prisma": { + "optional": true + } + } + }, + "node_modules/@prisma/debug": { + "version": "5.12.1", + "devOptional": true, + "license": "Apache-2.0" + }, + "node_modules/@prisma/engines": { + "version": "5.12.1", + "devOptional": true, + "hasInstallScript": true, + "license": "Apache-2.0", + "dependencies": { + "@prisma/debug": "5.12.1", + "@prisma/engines-version": "5.12.0-21.473ed3124229e22d881cb7addf559799debae1ab", + "@prisma/fetch-engine": "5.12.1", + "@prisma/get-platform": "5.12.1" + } + }, + "node_modules/@prisma/engines-version": { + "version": "5.12.0-21.473ed3124229e22d881cb7addf559799debae1ab", + "devOptional": true, + "license": "Apache-2.0" + }, + "node_modules/@prisma/fetch-engine": { + "version": "5.12.1", + "devOptional": true, + "license": "Apache-2.0", + "dependencies": { + "@prisma/debug": "5.12.1", + "@prisma/engines-version": "5.12.0-21.473ed3124229e22d881cb7addf559799debae1ab", + "@prisma/get-platform": "5.12.1" + } + }, + "node_modules/@prisma/get-platform": { + "version": "5.12.1", + "devOptional": true, + "license": "Apache-2.0", + "dependencies": { + "@prisma/debug": "5.12.1" + } + }, + "node_modules/@sinclair/typebox": { + "version": "0.27.8", + "dev": true, + "license": "MIT" + }, + "node_modules/@sinonjs/commons": { + "version": "3.0.1", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "type-detect": "4.0.8" + } + }, + "node_modules/@sinonjs/fake-timers": { + "version": "10.3.0", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "@sinonjs/commons": "^3.0.0" + } + }, + "node_modules/@tsconfig/node10": { + "version": "1.0.11", + "dev": true, + "license": "MIT" + }, + "node_modules/@tsconfig/node12": { + "version": "1.0.11", + "dev": true, + "license": "MIT" + }, + "node_modules/@tsconfig/node14": { + "version": "1.0.3", + "dev": true, + "license": "MIT" + }, + "node_modules/@tsconfig/node16": { + "version": "1.0.4", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/babel__core": { + "version": "7.20.5", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/parser": "^7.20.7", + "@babel/types": "^7.20.7", + "@types/babel__generator": "*", + "@types/babel__template": "*", + "@types/babel__traverse": "*" + } + }, + "node_modules/@types/babel__generator": { + "version": "7.6.8", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/types": "^7.0.0" + } + }, + "node_modules/@types/babel__template": { + "version": "7.4.4", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/parser": "^7.1.0", + "@babel/types": "^7.0.0" + } + }, + "node_modules/@types/babel__traverse": { + "version": "7.20.5", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/types": "^7.20.7" + } + }, + "node_modules/@types/graceful-fs": { + "version": "4.1.9", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@types/istanbul-lib-coverage": { + "version": "2.0.6", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/istanbul-lib-report": { + "version": "3.0.3", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/istanbul-lib-coverage": "*" + } + }, + "node_modules/@types/istanbul-reports": { + "version": "3.0.4", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/istanbul-lib-report": "*" + } + }, + "node_modules/@types/jest": { + "version": "29.5.12", + "dev": true, + "license": "MIT", + "dependencies": { + "expect": "^29.0.0", + "pretty-format": "^29.0.0" + } + }, + "node_modules/@types/json-schema": { + "version": "7.0.15", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/lodash": { + "version": "4.17.0", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/node": { + "version": "20.12.6", + "dev": true, + "license": "MIT", + "dependencies": { + "undici-types": "~5.26.4" + } + }, + "node_modules/@types/semver": { + "version": "7.5.8", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/stack-utils": { + "version": "2.0.3", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/yargs": { + "version": "17.0.32", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/yargs-parser": "*" + } + }, + "node_modules/@types/yargs-parser": { + "version": "21.0.3", + "dev": true, + "license": "MIT" + }, + "node_modules/@typescript-eslint/eslint-plugin": { + "version": "7.6.0", + "dev": true, + "license": "MIT", + "dependencies": { + "@eslint-community/regexpp": "^4.10.0", + "@typescript-eslint/scope-manager": "7.6.0", + "@typescript-eslint/type-utils": "7.6.0", + "@typescript-eslint/utils": "7.6.0", + "@typescript-eslint/visitor-keys": "7.6.0", + "debug": "^4.3.4", + "graphemer": "^1.4.0", + "ignore": "^5.3.1", + "natural-compare": "^1.4.0", + "semver": "^7.6.0", + "ts-api-utils": "^1.3.0" + }, + "engines": { + "node": "^18.18.0 || >=20.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "@typescript-eslint/parser": "^7.0.0", + "eslint": "^8.56.0" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/@typescript-eslint/eslint-plugin/node_modules/lru-cache": { + "version": "6.0.0", + "dev": true, + "license": "ISC", + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/@typescript-eslint/eslint-plugin/node_modules/semver": { + "version": "7.6.0", + "dev": true, + "license": "ISC", + "dependencies": { + "lru-cache": "^6.0.0" + }, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/@typescript-eslint/eslint-plugin/node_modules/yallist": { + "version": "4.0.0", + "dev": true, + "license": "ISC" + }, + "node_modules/@typescript-eslint/parser": { + "version": "7.6.0", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "@typescript-eslint/scope-manager": "7.6.0", + "@typescript-eslint/types": "7.6.0", + "@typescript-eslint/typescript-estree": "7.6.0", + "@typescript-eslint/visitor-keys": "7.6.0", + "debug": "^4.3.4" + }, + "engines": { + "node": "^18.18.0 || >=20.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^8.56.0" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/@typescript-eslint/scope-manager": { + "version": "7.6.0", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/types": "7.6.0", + "@typescript-eslint/visitor-keys": "7.6.0" + }, + "engines": { + "node": "^18.18.0 || >=20.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/type-utils": { + "version": "7.6.0", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/typescript-estree": "7.6.0", + "@typescript-eslint/utils": "7.6.0", + "debug": "^4.3.4", + "ts-api-utils": "^1.3.0" + }, + "engines": { + "node": "^18.18.0 || >=20.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^8.56.0" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/@typescript-eslint/types": { + "version": "7.6.0", + "dev": true, + "license": "MIT", + "engines": { + "node": "^18.18.0 || >=20.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/typescript-estree": { + "version": "7.6.0", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "@typescript-eslint/types": "7.6.0", + "@typescript-eslint/visitor-keys": "7.6.0", + "debug": "^4.3.4", + "globby": "^11.1.0", + "is-glob": "^4.0.3", + "minimatch": "^9.0.4", + "semver": "^7.6.0", + "ts-api-utils": "^1.3.0" + }, + "engines": { + "node": "^18.18.0 || >=20.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/@typescript-eslint/typescript-estree/node_modules/brace-expansion": { + "version": "2.0.1", + "dev": true, + "license": "MIT", + "dependencies": { + "balanced-match": "^1.0.0" + } + }, + "node_modules/@typescript-eslint/typescript-estree/node_modules/lru-cache": { + "version": "6.0.0", + "dev": true, + "license": "ISC", + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/@typescript-eslint/typescript-estree/node_modules/minimatch": { + "version": "9.0.4", + "dev": true, + "license": "ISC", + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/@typescript-eslint/typescript-estree/node_modules/semver": { + "version": "7.6.0", + "dev": true, + "license": "ISC", + "dependencies": { + "lru-cache": "^6.0.0" + }, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/@typescript-eslint/typescript-estree/node_modules/yallist": { + "version": "4.0.0", + "dev": true, + "license": "ISC" + }, + "node_modules/@typescript-eslint/utils": { + "version": "7.6.0", + "dev": true, + "license": "MIT", + "dependencies": { + "@eslint-community/eslint-utils": "^4.4.0", + "@types/json-schema": "^7.0.15", + "@types/semver": "^7.5.8", + "@typescript-eslint/scope-manager": "7.6.0", + "@typescript-eslint/types": "7.6.0", + "@typescript-eslint/typescript-estree": "7.6.0", + "semver": "^7.6.0" + }, + "engines": { + "node": "^18.18.0 || >=20.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^8.56.0" + } + }, + "node_modules/@typescript-eslint/utils/node_modules/lru-cache": { + "version": "6.0.0", + "dev": true, + "license": "ISC", + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/@typescript-eslint/utils/node_modules/semver": { + "version": "7.6.0", + "dev": true, + "license": "ISC", + "dependencies": { + "lru-cache": "^6.0.0" + }, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/@typescript-eslint/utils/node_modules/yallist": { + "version": "4.0.0", + "dev": true, + "license": "ISC" + }, + "node_modules/@typescript-eslint/visitor-keys": { + "version": "7.6.0", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/types": "7.6.0", + "eslint-visitor-keys": "^3.4.3" + }, + "engines": { + "node": "^18.18.0 || >=20.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@ungap/structured-clone": { + "version": "1.2.0", + "dev": true, + "license": "ISC" + }, + "node_modules/acorn": { + "version": "8.11.3", + "dev": true, + "license": "MIT", + "bin": { + "acorn": "bin/acorn" + }, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/acorn-jsx": { + "version": "5.3.2", + "dev": true, + "license": "MIT", + "peerDependencies": { + "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0" + } + }, + "node_modules/acorn-walk": { + "version": "8.3.2", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/agent-base": { + "version": "6.0.2", + "dev": true, + "license": "MIT", + "dependencies": { + "debug": "4" + }, + "engines": { + "node": ">= 6.0.0" + } + }, + "node_modules/ajv": { + "version": "6.12.6", + "dev": true, + "license": "MIT", + "dependencies": { + "fast-deep-equal": "^3.1.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } + }, + "node_modules/ansi-escapes": { + "version": "4.3.2", + "dev": true, + "license": "MIT", + "dependencies": { + "type-fest": "^0.21.3" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/ansi-regex": { + "version": "5.0.1", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/ansi-styles": { + "version": "4.3.0", + "dev": true, + "license": "MIT", + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/anymatch": { + "version": "3.1.3", + "dev": true, + "license": "ISC", + "dependencies": { + "normalize-path": "^3.0.0", + "picomatch": "^2.0.4" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/arg": { + "version": "4.1.3", + "dev": true, + "license": "MIT" + }, + "node_modules/argparse": { + "version": "1.0.10", + "dev": true, + "license": "MIT", + "dependencies": { + "sprintf-js": "~1.0.2" + } + }, + "node_modules/array-union": { + "version": "2.1.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/at-least-node": { + "version": "1.0.0", + "dev": true, + "license": "ISC", + "engines": { + "node": ">= 4.0.0" + } + }, + "node_modules/babel-jest": { + "version": "29.7.0", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/transform": "^29.7.0", + "@types/babel__core": "^7.1.14", + "babel-plugin-istanbul": "^6.1.1", + "babel-preset-jest": "^29.6.3", + "chalk": "^4.0.0", + "graceful-fs": "^4.2.9", + "slash": "^3.0.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + }, + "peerDependencies": { + "@babel/core": "^7.8.0" + } + }, + "node_modules/babel-plugin-istanbul": { + "version": "6.1.1", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "@babel/helper-plugin-utils": "^7.0.0", + "@istanbuljs/load-nyc-config": "^1.0.0", + "@istanbuljs/schema": "^0.1.2", + "istanbul-lib-instrument": "^5.0.4", + "test-exclude": "^6.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/babel-plugin-istanbul/node_modules/istanbul-lib-instrument": { + "version": "5.2.1", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "@babel/core": "^7.12.3", + "@babel/parser": "^7.14.7", + "@istanbuljs/schema": "^0.1.2", + "istanbul-lib-coverage": "^3.2.0", + "semver": "^6.3.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/babel-plugin-jest-hoist": { + "version": "29.6.3", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/template": "^7.3.3", + "@babel/types": "^7.3.3", + "@types/babel__core": "^7.1.14", + "@types/babel__traverse": "^7.0.6" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/babel-preset-current-node-syntax": { + "version": "1.0.1", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/plugin-syntax-async-generators": "^7.8.4", + "@babel/plugin-syntax-bigint": "^7.8.3", + "@babel/plugin-syntax-class-properties": "^7.8.3", + "@babel/plugin-syntax-import-meta": "^7.8.3", + "@babel/plugin-syntax-json-strings": "^7.8.3", + "@babel/plugin-syntax-logical-assignment-operators": "^7.8.3", + "@babel/plugin-syntax-nullish-coalescing-operator": "^7.8.3", + "@babel/plugin-syntax-numeric-separator": "^7.8.3", + "@babel/plugin-syntax-object-rest-spread": "^7.8.3", + "@babel/plugin-syntax-optional-catch-binding": "^7.8.3", + "@babel/plugin-syntax-optional-chaining": "^7.8.3", + "@babel/plugin-syntax-top-level-await": "^7.8.3" + }, + "peerDependencies": { + "@babel/core": "^7.0.0" + } + }, + "node_modules/babel-preset-jest": { + "version": "29.6.3", + "dev": true, + "license": "MIT", + "dependencies": { + "babel-plugin-jest-hoist": "^29.6.3", + "babel-preset-current-node-syntax": "^1.0.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0" + } + }, + "node_modules/balanced-match": { + "version": "1.0.2", + "dev": true, + "license": "MIT" + }, + "node_modules/base64-js": { + "version": "1.5.1", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT" + }, + "node_modules/bl": { + "version": "4.1.0", + "dev": true, + "license": "MIT", + "dependencies": { + "buffer": "^5.5.0", + "inherits": "^2.0.4", + "readable-stream": "^3.4.0" + } + }, + "node_modules/bl/node_modules/readable-stream": { + "version": "3.6.2", + "dev": true, + "license": "MIT", + "dependencies": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/brace-expansion": { + "version": "1.1.11", + "dev": true, + "license": "MIT", + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/braces": { + "version": "3.0.2", + "dev": true, + "license": "MIT", + "dependencies": { + "fill-range": "^7.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/browserslist": { + "version": "4.23.0", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/browserslist" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/browserslist" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "dependencies": { + "caniuse-lite": "^1.0.30001587", + "electron-to-chromium": "^1.4.668", + "node-releases": "^2.0.14", + "update-browserslist-db": "^1.0.13" + }, + "bin": { + "browserslist": "cli.js" + }, + "engines": { + "node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7" + } + }, + "node_modules/bs-logger": { + "version": "0.2.6", + "dev": true, + "license": "MIT", + "dependencies": { + "fast-json-stable-stringify": "2.x" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/bser": { + "version": "2.1.1", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "node-int64": "^0.4.0" + } + }, + "node_modules/buffer": { + "version": "5.7.1", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT", + "dependencies": { + "base64-js": "^1.3.1", + "ieee754": "^1.1.13" + } + }, + "node_modules/buffer-from": { + "version": "1.1.2", + "dev": true, + "license": "MIT" + }, + "node_modules/callsites": { + "version": "3.1.0", + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/camelcase": { + "version": "5.3.1", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/caniuse-lite": { + "version": "1.0.30001607", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/browserslist" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/caniuse-lite" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "CC-BY-4.0" + }, + "node_modules/chalk": { + "version": "4.1.2", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/char-regex": { + "version": "1.0.2", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10" + } + }, + "node_modules/chownr": { + "version": "1.1.4", + "dev": true, + "license": "ISC" + }, + "node_modules/ci-info": { + "version": "3.9.0", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/sibiraj-s" + } + ], + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/cjs-module-lexer": { + "version": "1.2.3", + "dev": true, + "license": "MIT" + }, + "node_modules/cliui": { + "version": "8.0.1", + "dev": true, + "license": "ISC", + "dependencies": { + "string-width": "^4.2.0", + "strip-ansi": "^6.0.1", + "wrap-ansi": "^7.0.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/co": { + "version": "4.6.0", + "dev": true, + "license": "MIT", + "engines": { + "iojs": ">= 1.0.0", + "node": ">= 0.12.0" + } + }, + "node_modules/collect-v8-coverage": { + "version": "1.0.2", + "dev": true, + "license": "MIT" + }, + "node_modules/color-convert": { + "version": "2.0.1", + "dev": true, + "license": "MIT", + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/color-name": { + "version": "1.1.4", + "dev": true, + "license": "MIT" + }, + "node_modules/commander": { + "version": "12.0.0", + "license": "MIT", + "engines": { + "node": ">=18" + } + }, + "node_modules/concat-map": { + "version": "0.0.1", + "dev": true, + "license": "MIT" + }, + "node_modules/convert-source-map": { + "version": "2.0.0", + "dev": true, + "license": "MIT" + }, + "node_modules/core-util-is": { + "version": "1.0.3", + "dev": true, + "license": "MIT" + }, + "node_modules/create-jest": { + "version": "29.7.0", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/types": "^29.6.3", + "chalk": "^4.0.0", + "exit": "^0.1.2", + "graceful-fs": "^4.2.9", + "jest-config": "^29.7.0", + "jest-util": "^29.7.0", + "prompts": "^2.0.1" + }, + "bin": { + "create-jest": "bin/create-jest.js" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/create-require": { + "version": "1.1.1", + "dev": true, + "license": "MIT" + }, + "node_modules/cross-spawn": { + "version": "7.0.3", + "dev": true, + "license": "MIT", + "dependencies": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/debug": { + "version": "4.3.4", + "license": "MIT", + "dependencies": { + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/decompress-response": { + "version": "6.0.0", + "dev": true, + "license": "MIT", + "dependencies": { + "mimic-response": "^3.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/dedent": { + "version": "1.5.1", + "dev": true, + "license": "MIT", + "peerDependencies": { + "babel-plugin-macros": "^3.1.0" + }, + "peerDependenciesMeta": { + "babel-plugin-macros": { + "optional": true + } + } + }, + "node_modules/deep-extend": { + "version": "0.6.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4.0.0" + } + }, + "node_modules/deep-is": { + "version": "0.1.4", + "dev": true, + "license": "MIT" + }, + "node_modules/deepmerge": { + "version": "4.3.1", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/detect-libc": { + "version": "2.0.3", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=8" + } + }, + "node_modules/detect-newline": { + "version": "3.1.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/diff": { + "version": "4.0.2", + "dev": true, + "license": "BSD-3-Clause", + "engines": { + "node": ">=0.3.1" + } + }, + "node_modules/diff-sequences": { + "version": "29.6.3", + "dev": true, + "license": "MIT", + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/dir-glob": { + "version": "3.0.1", + "dev": true, + "license": "MIT", + "dependencies": { + "path-type": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/doctrine": { + "version": "3.0.0", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "esutils": "^2.0.2" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/electron-to-chromium": { + "version": "1.4.730", + "dev": true, + "license": "ISC" + }, + "node_modules/emittery": { + "version": "0.13.1", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sindresorhus/emittery?sponsor=1" + } + }, + "node_modules/emoji-regex": { + "version": "8.0.0", + "dev": true, + "license": "MIT" + }, + "node_modules/end-of-stream": { + "version": "1.4.4", + "dev": true, + "license": "MIT", + "dependencies": { + "once": "^1.4.0" + } + }, + "node_modules/error-ex": { + "version": "1.3.2", + "dev": true, + "license": "MIT", + "dependencies": { + "is-arrayish": "^0.2.1" + } + }, + "node_modules/escalade": { + "version": "3.1.2", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/escape-string-regexp": { + "version": "2.0.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/eslint": { + "version": "8.57.0", + "dev": true, + "license": "MIT", + "dependencies": { + "@eslint-community/eslint-utils": "^4.2.0", + "@eslint-community/regexpp": "^4.6.1", + "@eslint/eslintrc": "^2.1.4", + "@eslint/js": "8.57.0", + "@humanwhocodes/config-array": "^0.11.14", + "@humanwhocodes/module-importer": "^1.0.1", + "@nodelib/fs.walk": "^1.2.8", + "@ungap/structured-clone": "^1.2.0", + "ajv": "^6.12.4", + "chalk": "^4.0.0", + "cross-spawn": "^7.0.2", + "debug": "^4.3.2", + "doctrine": "^3.0.0", + "escape-string-regexp": "^4.0.0", + "eslint-scope": "^7.2.2", + "eslint-visitor-keys": "^3.4.3", + "espree": "^9.6.1", + "esquery": "^1.4.2", + "esutils": "^2.0.2", + "fast-deep-equal": "^3.1.3", + "file-entry-cache": "^6.0.1", + "find-up": "^5.0.0", + "glob-parent": "^6.0.2", + "globals": "^13.19.0", + "graphemer": "^1.4.0", + "ignore": "^5.2.0", + "imurmurhash": "^0.1.4", + "is-glob": "^4.0.0", + "is-path-inside": "^3.0.3", + "js-yaml": "^4.1.0", + "json-stable-stringify-without-jsonify": "^1.0.1", + "levn": "^0.4.1", + "lodash.merge": "^4.6.2", + "minimatch": "^3.1.2", + "natural-compare": "^1.4.0", + "optionator": "^0.9.3", + "strip-ansi": "^6.0.1", + "text-table": "^0.2.0" + }, + "bin": { + "eslint": "bin/eslint.js" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/eslint-scope": { + "version": "7.2.2", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "esrecurse": "^4.3.0", + "estraverse": "^5.2.0" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/eslint-visitor-keys": { + "version": "3.4.3", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/eslint/node_modules/@eslint/js": { + "version": "8.57.0", + "dev": true, + "license": "MIT", + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + } + }, + "node_modules/eslint/node_modules/argparse": { + "version": "2.0.1", + "dev": true, + "license": "Python-2.0" + }, + "node_modules/eslint/node_modules/escape-string-regexp": { + "version": "4.0.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/eslint/node_modules/find-up": { + "version": "5.0.0", + "dev": true, + "license": "MIT", + "dependencies": { + "locate-path": "^6.0.0", + "path-exists": "^4.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/eslint/node_modules/glob-parent": { + "version": "6.0.2", + "dev": true, + "license": "ISC", + "dependencies": { + "is-glob": "^4.0.3" + }, + "engines": { + "node": ">=10.13.0" + } + }, + "node_modules/eslint/node_modules/globals": { + "version": "13.24.0", + "dev": true, + "license": "MIT", + "dependencies": { + "type-fest": "^0.20.2" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/eslint/node_modules/js-yaml": { + "version": "4.1.0", + "dev": true, + "license": "MIT", + "dependencies": { + "argparse": "^2.0.1" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, + "node_modules/eslint/node_modules/locate-path": { + "version": "6.0.0", + "dev": true, + "license": "MIT", + "dependencies": { + "p-locate": "^5.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/eslint/node_modules/p-locate": { + "version": "5.0.0", + "dev": true, + "license": "MIT", + "dependencies": { + "p-limit": "^3.0.2" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/eslint/node_modules/type-fest": { + "version": "0.20.2", + "dev": true, + "license": "(MIT OR CC0-1.0)", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/esm": { + "version": "3.2.25", + "license": "MIT", + "optional": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/espree": { + "version": "9.6.1", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "acorn": "^8.9.0", + "acorn-jsx": "^5.3.2", + "eslint-visitor-keys": "^3.4.1" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/esprima": { + "version": "4.0.1", + "dev": true, + "license": "BSD-2-Clause", + "bin": { + "esparse": "bin/esparse.js", + "esvalidate": "bin/esvalidate.js" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/esquery": { + "version": "1.5.0", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "estraverse": "^5.1.0" + }, + "engines": { + "node": ">=0.10" + } + }, + "node_modules/esrecurse": { + "version": "4.3.0", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "estraverse": "^5.2.0" + }, + "engines": { + "node": ">=4.0" + } + }, + "node_modules/estraverse": { + "version": "5.3.0", + "dev": true, + "license": "BSD-2-Clause", + "engines": { + "node": ">=4.0" + } + }, + "node_modules/esutils": { + "version": "2.0.3", + "dev": true, + "license": "BSD-2-Clause", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/execa": { + "version": "5.1.1", + "dev": true, + "license": "MIT", + "dependencies": { + "cross-spawn": "^7.0.3", + "get-stream": "^6.0.0", + "human-signals": "^2.1.0", + "is-stream": "^2.0.0", + "merge-stream": "^2.0.0", + "npm-run-path": "^4.0.1", + "onetime": "^5.1.2", + "signal-exit": "^3.0.3", + "strip-final-newline": "^2.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sindresorhus/execa?sponsor=1" + } + }, + "node_modules/exit": { + "version": "0.1.2", + "dev": true, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/expand-template": { + "version": "2.0.3", + "dev": true, + "license": "(MIT OR WTFPL)", + "engines": { + "node": ">=6" + } + }, + "node_modules/expect": { + "version": "29.7.0", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/expect-utils": "^29.7.0", + "jest-get-type": "^29.6.3", + "jest-matcher-utils": "^29.7.0", + "jest-message-util": "^29.7.0", + "jest-util": "^29.7.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/fast-deep-equal": { + "version": "3.1.3", + "dev": true, + "license": "MIT" + }, + "node_modules/fast-glob": { + "version": "3.3.2", + "dev": true, + "license": "MIT", + "dependencies": { + "@nodelib/fs.stat": "^2.0.2", + "@nodelib/fs.walk": "^1.2.3", + "glob-parent": "^5.1.2", + "merge2": "^1.3.0", + "micromatch": "^4.0.4" + }, + "engines": { + "node": ">=8.6.0" + } + }, + "node_modules/fast-json-stable-stringify": { + "version": "2.1.0", + "dev": true, + "license": "MIT" + }, + "node_modules/fast-levenshtein": { + "version": "2.0.6", + "dev": true, + "license": "MIT" + }, + "node_modules/fastq": { + "version": "1.17.1", + "dev": true, + "license": "ISC", + "dependencies": { + "reusify": "^1.0.4" + } + }, + "node_modules/fb-watchman": { + "version": "2.0.2", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "bser": "2.1.1" + } + }, + "node_modules/file-entry-cache": { + "version": "6.0.1", + "dev": true, + "license": "MIT", + "dependencies": { + "flat-cache": "^3.0.4" + }, + "engines": { + "node": "^10.12.0 || >=12.0.0" + } + }, + "node_modules/fill-range": { + "version": "7.0.1", + "dev": true, + "license": "MIT", + "dependencies": { + "to-regex-range": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/find-up": { + "version": "4.1.0", + "dev": true, + "license": "MIT", + "dependencies": { + "locate-path": "^5.0.0", + "path-exists": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/flat-cache": { + "version": "3.2.0", + "dev": true, + "license": "MIT", + "dependencies": { + "flatted": "^3.2.9", + "keyv": "^4.5.3", + "rimraf": "^3.0.2" + }, + "engines": { + "node": "^10.12.0 || >=12.0.0" + } + }, + "node_modules/flatted": { + "version": "3.3.1", + "dev": true, + "license": "ISC" + }, + "node_modules/from2": { + "version": "2.3.0", + "dev": true, + "license": "MIT", + "dependencies": { + "inherits": "^2.0.1", + "readable-stream": "^2.0.0" + } + }, + "node_modules/fs-constants": { + "version": "1.0.0", + "dev": true, + "license": "MIT" + }, + "node_modules/fs-extra": { + "version": "9.1.0", + "dev": true, + "license": "MIT", + "dependencies": { + "at-least-node": "^1.0.0", + "graceful-fs": "^4.2.0", + "jsonfile": "^6.0.1", + "universalify": "^2.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/fs.realpath": { + "version": "1.0.0", + "dev": true, + "license": "ISC" + }, + "node_modules/fsevents": { + "version": "2.3.3", + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, + "node_modules/function-bind": { + "version": "1.1.2", + "dev": true, + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/gensync": { + "version": "1.0.0-beta.2", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/get-caller-file": { + "version": "2.0.5", + "dev": true, + "license": "ISC", + "engines": { + "node": "6.* || 8.* || >= 10.*" + } + }, + "node_modules/get-package-type": { + "version": "0.1.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8.0.0" + } + }, + "node_modules/get-stream": { + "version": "6.0.1", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/github-from-package": { + "version": "0.0.0", + "dev": true, + "license": "MIT" + }, + "node_modules/glob": { + "version": "7.2.3", + "dev": true, + "license": "ISC", + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.1.1", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "engines": { + "node": "*" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/glob-parent": { + "version": "5.1.2", + "dev": true, + "license": "ISC", + "dependencies": { + "is-glob": "^4.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/globals": { + "version": "11.12.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/globby": { + "version": "11.1.0", + "dev": true, + "license": "MIT", + "dependencies": { + "array-union": "^2.1.0", + "dir-glob": "^3.0.1", + "fast-glob": "^3.2.9", + "ignore": "^5.2.0", + "merge2": "^1.4.1", + "slash": "^3.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/google-protobuf": { + "version": "3.21.2", + "dev": true, + "license": "(BSD-3-Clause AND Apache-2.0)" + }, + "node_modules/graceful-fs": { + "version": "4.2.11", + "dev": true, + "license": "ISC" + }, + "node_modules/graphemer": { + "version": "1.4.0", + "dev": true, + "license": "MIT" + }, + "node_modules/has": { + "version": "1.0.4", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4.0" + } + }, + "node_modules/has-flag": { + "version": "4.0.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/hasown": { + "version": "2.0.2", + "dev": true, + "license": "MIT", + "dependencies": { + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/html-escaper": { + "version": "2.0.2", + "dev": true, + "license": "MIT" + }, + "node_modules/https-proxy-agent": { + "version": "5.0.1", + "dev": true, + "license": "MIT", + "dependencies": { + "agent-base": "6", + "debug": "4" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/human-signals": { + "version": "2.1.0", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=10.17.0" + } + }, + "node_modules/ieee754": { + "version": "1.2.1", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "BSD-3-Clause" + }, + "node_modules/ignore": { + "version": "5.3.1", + "license": "MIT", + "engines": { + "node": ">= 4" + } + }, + "node_modules/import-fresh": { + "version": "3.3.0", + "dev": true, + "license": "MIT", + "dependencies": { + "parent-module": "^1.0.0", + "resolve-from": "^4.0.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/import-fresh/node_modules/resolve-from": { + "version": "4.0.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/import-local": { + "version": "3.1.0", + "dev": true, + "license": "MIT", + "dependencies": { + "pkg-dir": "^4.2.0", + "resolve-cwd": "^3.0.0" + }, + "bin": { + "import-local-fixture": "fixtures/cli.js" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/imurmurhash": { + "version": "0.1.4", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.8.19" + } + }, + "node_modules/inflight": { + "version": "1.0.6", + "dev": true, + "license": "ISC", + "dependencies": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "node_modules/inherits": { + "version": "2.0.4", + "dev": true, + "license": "ISC" + }, + "node_modules/ini": { + "version": "1.3.8", + "dev": true, + "license": "ISC" + }, + "node_modules/into-stream": { + "version": "6.0.0", + "dev": true, + "license": "MIT", + "dependencies": { + "from2": "^2.3.0", + "p-is-promise": "^3.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/is-arrayish": { + "version": "0.2.1", + "dev": true, + "license": "MIT" + }, + "node_modules/is-core-module": { + "version": "2.9.0", + "dev": true, + "license": "MIT", + "dependencies": { + "has": "^1.0.3" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-extglob": { + "version": "2.1.1", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-fullwidth-code-point": { + "version": "3.0.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/is-generator-fn": { + "version": "2.1.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/is-glob": { + "version": "4.0.3", + "dev": true, + "license": "MIT", + "dependencies": { + "is-extglob": "^2.1.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-number": { + "version": "7.0.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.12.0" + } + }, + "node_modules/is-observable": { + "version": "2.1.0", + "license": "MIT", + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/is-path-inside": { + "version": "3.0.3", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/is-stream": { + "version": "2.0.1", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/isarray": { + "version": "1.0.0", + "dev": true, + "license": "MIT" + }, + "node_modules/isexe": { + "version": "2.0.0", + "dev": true, + "license": "ISC" + }, + "node_modules/istanbul-lib-coverage": { + "version": "3.2.2", + "dev": true, + "license": "BSD-3-Clause", + "engines": { + "node": ">=8" + } + }, + "node_modules/istanbul-lib-instrument": { + "version": "6.0.2", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "@babel/core": "^7.23.9", + "@babel/parser": "^7.23.9", + "@istanbuljs/schema": "^0.1.3", + "istanbul-lib-coverage": "^3.2.0", + "semver": "^7.5.4" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/istanbul-lib-instrument/node_modules/lru-cache": { + "version": "6.0.0", + "dev": true, + "license": "ISC", + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/istanbul-lib-instrument/node_modules/semver": { + "version": "7.6.0", + "dev": true, + "license": "ISC", + "dependencies": { + "lru-cache": "^6.0.0" + }, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/istanbul-lib-instrument/node_modules/yallist": { + "version": "4.0.0", + "dev": true, + "license": "ISC" + }, + "node_modules/istanbul-lib-report": { + "version": "3.0.1", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "istanbul-lib-coverage": "^3.0.0", + "make-dir": "^4.0.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/istanbul-lib-source-maps": { + "version": "4.0.1", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "debug": "^4.1.1", + "istanbul-lib-coverage": "^3.0.0", + "source-map": "^0.6.1" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/istanbul-reports": { + "version": "3.1.7", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "html-escaper": "^2.0.0", + "istanbul-lib-report": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/jest": { + "version": "29.7.0", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/core": "^29.7.0", + "@jest/types": "^29.6.3", + "import-local": "^3.0.2", + "jest-cli": "^29.7.0" + }, + "bin": { + "jest": "bin/jest.js" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + }, + "peerDependencies": { + "node-notifier": "^8.0.1 || ^9.0.0 || ^10.0.0" + }, + "peerDependenciesMeta": { + "node-notifier": { + "optional": true + } + } + }, + "node_modules/jest-changed-files": { + "version": "29.7.0", + "dev": true, + "license": "MIT", + "dependencies": { + "execa": "^5.0.0", + "jest-util": "^29.7.0", + "p-limit": "^3.1.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-circus": { + "version": "29.7.0", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/environment": "^29.7.0", + "@jest/expect": "^29.7.0", + "@jest/test-result": "^29.7.0", + "@jest/types": "^29.6.3", + "@types/node": "*", + "chalk": "^4.0.0", + "co": "^4.6.0", + "dedent": "^1.0.0", + "is-generator-fn": "^2.0.0", + "jest-each": "^29.7.0", + "jest-matcher-utils": "^29.7.0", + "jest-message-util": "^29.7.0", + "jest-runtime": "^29.7.0", + "jest-snapshot": "^29.7.0", + "jest-util": "^29.7.0", + "p-limit": "^3.1.0", + "pretty-format": "^29.7.0", + "pure-rand": "^6.0.0", + "slash": "^3.0.0", + "stack-utils": "^2.0.3" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-cli": { + "version": "29.7.0", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/core": "^29.7.0", + "@jest/test-result": "^29.7.0", + "@jest/types": "^29.6.3", + "chalk": "^4.0.0", + "create-jest": "^29.7.0", + "exit": "^0.1.2", + "import-local": "^3.0.2", + "jest-config": "^29.7.0", + "jest-util": "^29.7.0", + "jest-validate": "^29.7.0", + "yargs": "^17.3.1" + }, + "bin": { + "jest": "bin/jest.js" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + }, + "peerDependencies": { + "node-notifier": "^8.0.1 || ^9.0.0 || ^10.0.0" + }, + "peerDependenciesMeta": { + "node-notifier": { + "optional": true + } + } + }, + "node_modules/jest-config": { + "version": "29.7.0", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/core": "^7.11.6", + "@jest/test-sequencer": "^29.7.0", + "@jest/types": "^29.6.3", + "babel-jest": "^29.7.0", + "chalk": "^4.0.0", + "ci-info": "^3.2.0", + "deepmerge": "^4.2.2", + "glob": "^7.1.3", + "graceful-fs": "^4.2.9", + "jest-circus": "^29.7.0", + "jest-environment-node": "^29.7.0", + "jest-get-type": "^29.6.3", + "jest-regex-util": "^29.6.3", + "jest-resolve": "^29.7.0", + "jest-runner": "^29.7.0", + "jest-util": "^29.7.0", + "jest-validate": "^29.7.0", + "micromatch": "^4.0.4", + "parse-json": "^5.2.0", + "pretty-format": "^29.7.0", + "slash": "^3.0.0", + "strip-json-comments": "^3.1.1" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + }, + "peerDependencies": { + "@types/node": "*", + "ts-node": ">=9.0.0" + }, + "peerDependenciesMeta": { + "@types/node": { + "optional": true + }, + "ts-node": { + "optional": true + } + } + }, + "node_modules/jest-diff": { + "version": "29.7.0", + "dev": true, + "license": "MIT", + "dependencies": { + "chalk": "^4.0.0", + "diff-sequences": "^29.6.3", + "jest-get-type": "^29.6.3", + "pretty-format": "^29.7.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-docblock": { + "version": "29.7.0", + "dev": true, + "license": "MIT", + "dependencies": { + "detect-newline": "^3.0.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-each": { + "version": "29.7.0", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/types": "^29.6.3", + "chalk": "^4.0.0", + "jest-get-type": "^29.6.3", + "jest-util": "^29.7.0", + "pretty-format": "^29.7.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-environment-node": { + "version": "29.7.0", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/environment": "^29.7.0", + "@jest/fake-timers": "^29.7.0", + "@jest/types": "^29.6.3", + "@types/node": "*", + "jest-mock": "^29.7.0", + "jest-util": "^29.7.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-get-type": { + "version": "29.6.3", + "dev": true, + "license": "MIT", + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-haste-map": { + "version": "29.7.0", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/types": "^29.6.3", + "@types/graceful-fs": "^4.1.3", + "@types/node": "*", + "anymatch": "^3.0.3", + "fb-watchman": "^2.0.0", + "graceful-fs": "^4.2.9", + "jest-regex-util": "^29.6.3", + "jest-util": "^29.7.0", + "jest-worker": "^29.7.0", + "micromatch": "^4.0.4", + "walker": "^1.0.8" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + }, + "optionalDependencies": { + "fsevents": "^2.3.2" + } + }, + "node_modules/jest-leak-detector": { + "version": "29.7.0", + "dev": true, + "license": "MIT", + "dependencies": { + "jest-get-type": "^29.6.3", + "pretty-format": "^29.7.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-matcher-utils": { + "version": "29.7.0", + "dev": true, + "license": "MIT", + "dependencies": { + "chalk": "^4.0.0", + "jest-diff": "^29.7.0", + "jest-get-type": "^29.6.3", + "pretty-format": "^29.7.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-message-util": { + "version": "29.7.0", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/code-frame": "^7.12.13", + "@jest/types": "^29.6.3", + "@types/stack-utils": "^2.0.0", + "chalk": "^4.0.0", + "graceful-fs": "^4.2.9", + "micromatch": "^4.0.4", + "pretty-format": "^29.7.0", + "slash": "^3.0.0", + "stack-utils": "^2.0.3" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-mock": { + "version": "29.7.0", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/types": "^29.6.3", + "@types/node": "*", + "jest-util": "^29.7.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-pnp-resolver": { + "version": "1.2.3", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + }, + "peerDependencies": { + "jest-resolve": "*" + }, + "peerDependenciesMeta": { + "jest-resolve": { + "optional": true + } + } + }, + "node_modules/jest-regex-util": { + "version": "29.6.3", + "dev": true, + "license": "MIT", + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-resolve": { + "version": "29.7.0", + "dev": true, + "license": "MIT", + "dependencies": { + "chalk": "^4.0.0", + "graceful-fs": "^4.2.9", + "jest-haste-map": "^29.7.0", + "jest-pnp-resolver": "^1.2.2", + "jest-util": "^29.7.0", + "jest-validate": "^29.7.0", + "resolve": "^1.20.0", + "resolve.exports": "^2.0.0", + "slash": "^3.0.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-resolve-dependencies": { + "version": "29.7.0", + "dev": true, + "license": "MIT", + "dependencies": { + "jest-regex-util": "^29.6.3", + "jest-snapshot": "^29.7.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-runner": { + "version": "29.7.0", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/console": "^29.7.0", + "@jest/environment": "^29.7.0", + "@jest/test-result": "^29.7.0", + "@jest/transform": "^29.7.0", + "@jest/types": "^29.6.3", + "@types/node": "*", + "chalk": "^4.0.0", + "emittery": "^0.13.1", + "graceful-fs": "^4.2.9", + "jest-docblock": "^29.7.0", + "jest-environment-node": "^29.7.0", + "jest-haste-map": "^29.7.0", + "jest-leak-detector": "^29.7.0", + "jest-message-util": "^29.7.0", + "jest-resolve": "^29.7.0", + "jest-runtime": "^29.7.0", + "jest-util": "^29.7.0", + "jest-watcher": "^29.7.0", + "jest-worker": "^29.7.0", + "p-limit": "^3.1.0", + "source-map-support": "0.5.13" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-runtime": { + "version": "29.7.0", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/environment": "^29.7.0", + "@jest/fake-timers": "^29.7.0", + "@jest/globals": "^29.7.0", + "@jest/source-map": "^29.6.3", + "@jest/test-result": "^29.7.0", + "@jest/transform": "^29.7.0", + "@jest/types": "^29.6.3", + "@types/node": "*", + "chalk": "^4.0.0", + "cjs-module-lexer": "^1.0.0", + "collect-v8-coverage": "^1.0.0", + "glob": "^7.1.3", + "graceful-fs": "^4.2.9", + "jest-haste-map": "^29.7.0", + "jest-message-util": "^29.7.0", + "jest-mock": "^29.7.0", + "jest-regex-util": "^29.6.3", + "jest-resolve": "^29.7.0", + "jest-snapshot": "^29.7.0", + "jest-util": "^29.7.0", + "slash": "^3.0.0", + "strip-bom": "^4.0.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-snapshot": { + "version": "29.7.0", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/core": "^7.11.6", + "@babel/generator": "^7.7.2", + "@babel/plugin-syntax-jsx": "^7.7.2", + "@babel/plugin-syntax-typescript": "^7.7.2", + "@babel/types": "^7.3.3", + "@jest/expect-utils": "^29.7.0", + "@jest/transform": "^29.7.0", + "@jest/types": "^29.6.3", + "babel-preset-current-node-syntax": "^1.0.0", + "chalk": "^4.0.0", + "expect": "^29.7.0", + "graceful-fs": "^4.2.9", + "jest-diff": "^29.7.0", + "jest-get-type": "^29.6.3", + "jest-matcher-utils": "^29.7.0", + "jest-message-util": "^29.7.0", + "jest-util": "^29.7.0", + "natural-compare": "^1.4.0", + "pretty-format": "^29.7.0", + "semver": "^7.5.3" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-snapshot/node_modules/lru-cache": { + "version": "6.0.0", + "dev": true, + "license": "ISC", + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/jest-snapshot/node_modules/semver": { + "version": "7.6.0", + "dev": true, + "license": "ISC", + "dependencies": { + "lru-cache": "^6.0.0" + }, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/jest-snapshot/node_modules/yallist": { + "version": "4.0.0", + "dev": true, + "license": "ISC" + }, + "node_modules/jest-util": { + "version": "29.7.0", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/types": "^29.6.3", + "@types/node": "*", + "chalk": "^4.0.0", + "ci-info": "^3.2.0", + "graceful-fs": "^4.2.9", + "picomatch": "^2.2.3" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-validate": { + "version": "29.7.0", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/types": "^29.6.3", + "camelcase": "^6.2.0", + "chalk": "^4.0.0", + "jest-get-type": "^29.6.3", + "leven": "^3.1.0", + "pretty-format": "^29.7.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-validate/node_modules/camelcase": { + "version": "6.3.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/jest-watcher": { + "version": "29.7.0", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/test-result": "^29.7.0", + "@jest/types": "^29.6.3", + "@types/node": "*", + "ansi-escapes": "^4.2.1", + "chalk": "^4.0.0", + "emittery": "^0.13.1", + "jest-util": "^29.7.0", + "string-length": "^4.0.1" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-worker": { + "version": "29.7.0", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/node": "*", + "jest-util": "^29.7.0", + "merge-stream": "^2.0.0", + "supports-color": "^8.0.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-worker/node_modules/supports-color": { + "version": "8.1.1", + "dev": true, + "license": "MIT", + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/supports-color?sponsor=1" + } + }, + "node_modules/js-tokens": { + "version": "4.0.0", + "dev": true, + "license": "MIT" + }, + "node_modules/js-yaml": { + "version": "3.14.1", + "dev": true, + "license": "MIT", + "dependencies": { + "argparse": "^1.0.7", + "esprima": "^4.0.0" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, + "node_modules/jsesc": { + "version": "2.5.2", + "dev": true, + "license": "MIT", + "bin": { + "jsesc": "bin/jsesc" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/json-buffer": { + "version": "3.0.1", + "dev": true, + "license": "MIT" + }, + "node_modules/json-parse-even-better-errors": { + "version": "2.3.1", + "dev": true, + "license": "MIT" + }, + "node_modules/json-schema-traverse": { + "version": "0.4.1", + "dev": true, + "license": "MIT" + }, + "node_modules/json-stable-stringify-without-jsonify": { + "version": "1.0.1", + "dev": true, + "license": "MIT" + }, + "node_modules/json5": { + "version": "2.2.3", + "license": "MIT", + "bin": { + "json5": "lib/cli.js" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/jsonfile": { + "version": "6.1.0", + "dev": true, + "license": "MIT", + "dependencies": { + "universalify": "^2.0.0" + }, + "optionalDependencies": { + "graceful-fs": "^4.1.6" + } + }, + "node_modules/keyv": { + "version": "4.5.4", + "dev": true, + "license": "MIT", + "dependencies": { + "json-buffer": "3.0.1" + } + }, + "node_modules/kleur": { + "version": "3.0.3", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/leven": { + "version": "3.1.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/levn": { + "version": "0.4.1", + "dev": true, + "license": "MIT", + "dependencies": { + "prelude-ls": "^1.2.1", + "type-check": "~0.4.0" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/lines-and-columns": { + "version": "1.2.4", + "dev": true, + "license": "MIT" + }, + "node_modules/locate-path": { + "version": "5.0.0", + "dev": true, + "license": "MIT", + "dependencies": { + "p-locate": "^4.1.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/lodash": { + "version": "4.17.21", + "license": "MIT" + }, + "node_modules/lodash.memoize": { + "version": "4.1.2", + "dev": true, + "license": "MIT" + }, + "node_modules/lodash.merge": { + "version": "4.6.2", + "dev": true, + "license": "MIT" + }, + "node_modules/lru-cache": { + "version": "5.1.1", + "dev": true, + "license": "ISC", + "dependencies": { + "yallist": "^3.0.2" + } + }, + "node_modules/make-dir": { + "version": "4.0.0", + "dev": true, + "license": "MIT", + "dependencies": { + "semver": "^7.5.3" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/make-dir/node_modules/lru-cache": { + "version": "6.0.0", + "dev": true, + "license": "ISC", + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/make-dir/node_modules/semver": { + "version": "7.6.0", + "dev": true, + "license": "ISC", + "dependencies": { + "lru-cache": "^6.0.0" + }, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/make-dir/node_modules/yallist": { + "version": "4.0.0", + "dev": true, + "license": "ISC" + }, + "node_modules/make-error": { + "version": "1.3.6", + "dev": true, + "license": "ISC" + }, + "node_modules/makeerror": { + "version": "1.0.12", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "tmpl": "1.0.5" + } + }, + "node_modules/merge-stream": { + "version": "2.0.0", + "dev": true, + "license": "MIT" + }, + "node_modules/merge2": { + "version": "1.4.1", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 8" + } + }, + "node_modules/micromatch": { + "version": "4.0.5", + "dev": true, + "license": "MIT", + "dependencies": { + "braces": "^3.0.2", + "picomatch": "^2.3.1" + }, + "engines": { + "node": ">=8.6" + } + }, + "node_modules/mimic-fn": { + "version": "2.1.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/mimic-response": { + "version": "3.1.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/minimatch": { + "version": "3.1.2", + "dev": true, + "license": "ISC", + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/minimist": { + "version": "1.2.8", + "dev": true, + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/mkdirp-classic": { + "version": "0.5.3", + "dev": true, + "license": "MIT" + }, + "node_modules/ms": { + "version": "2.1.2", + "license": "MIT" + }, + "node_modules/multistream": { + "version": "4.1.0", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT", + "dependencies": { + "once": "^1.4.0", + "readable-stream": "^3.6.0" + } + }, + "node_modules/multistream/node_modules/readable-stream": { + "version": "3.6.2", + "dev": true, + "license": "MIT", + "dependencies": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/napi-build-utils": { + "version": "1.0.2", + "dev": true, + "license": "MIT" + }, + "node_modules/natural-compare": { + "version": "1.4.0", + "dev": true, + "license": "MIT" + }, + "node_modules/node-abi": { + "version": "3.57.0", + "dev": true, + "license": "MIT", + "dependencies": { + "semver": "^7.3.5" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/node-abi/node_modules/lru-cache": { + "version": "6.0.0", + "dev": true, + "license": "ISC", + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/node-abi/node_modules/semver": { + "version": "7.6.0", + "dev": true, + "license": "ISC", + "dependencies": { + "lru-cache": "^6.0.0" + }, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/node-abi/node_modules/yallist": { + "version": "4.0.0", + "dev": true, + "license": "ISC" + }, + "node_modules/node-fetch": { + "version": "2.7.0", + "dev": true, + "license": "MIT", + "dependencies": { + "whatwg-url": "^5.0.0" + }, + "engines": { + "node": "4.x || >=6.0.0" + }, + "peerDependencies": { + "encoding": "^0.1.0" + }, + "peerDependenciesMeta": { + "encoding": { + "optional": true + } + } + }, + "node_modules/node-int64": { + "version": "0.4.0", + "dev": true, + "license": "MIT" + }, + "node_modules/node-releases": { + "version": "2.0.14", + "dev": true, + "license": "MIT" + }, + "node_modules/normalize-path": { + "version": "3.0.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/npm-run-path": { + "version": "4.0.1", + "dev": true, + "license": "MIT", + "dependencies": { + "path-key": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/observable-fns": { + "version": "0.6.1", + "license": "MIT" + }, + "node_modules/ohos-typescript": { + "version": "4.9.5-r6", + "resolved": "https://registry.npmmirror.com/ohos-typescript/-/ohos-typescript-4.9.5-r6.tgz", + "integrity": "sha512-gwQq8e28xPdGNrIUXYM175N53fevIJOOuSOB45+X8neyhXT6nk8A+W6H46ejXIgMnHCR31OYidKrqAtGY26AhQ==", + "dependencies": { + "json5": "2.2.3" + }, + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=4.2.0" + } + }, + "node_modules/once": { + "version": "1.4.0", + "dev": true, + "license": "ISC", + "dependencies": { + "wrappy": "1" + } + }, + "node_modules/onetime": { + "version": "5.1.2", + "dev": true, + "license": "MIT", + "dependencies": { + "mimic-fn": "^2.1.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/optionator": { + "version": "0.9.3", + "dev": true, + "license": "MIT", + "dependencies": { + "@aashutoshrathi/word-wrap": "^1.2.3", + "deep-is": "^0.1.3", + "fast-levenshtein": "^2.0.6", + "levn": "^0.4.1", + "prelude-ls": "^1.2.1", + "type-check": "^0.4.0" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/p-is-promise": { + "version": "3.0.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/p-limit": { + "version": "3.1.0", + "dev": true, + "license": "MIT", + "dependencies": { + "yocto-queue": "^0.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/p-locate": { + "version": "4.1.0", + "dev": true, + "license": "MIT", + "dependencies": { + "p-limit": "^2.2.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/p-locate/node_modules/p-limit": { + "version": "2.3.0", + "dev": true, + "license": "MIT", + "dependencies": { + "p-try": "^2.0.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/p-try": { + "version": "2.2.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/parent-module": { + "version": "1.0.1", + "dev": true, + "license": "MIT", + "dependencies": { + "callsites": "^3.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/parse-json": { + "version": "5.2.0", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/code-frame": "^7.0.0", + "error-ex": "^1.3.1", + "json-parse-even-better-errors": "^2.3.0", + "lines-and-columns": "^1.1.6" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/path-exists": { + "version": "4.0.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/path-is-absolute": { + "version": "1.0.1", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/path-key": { + "version": "3.1.1", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/path-parse": { + "version": "1.0.7", + "dev": true, + "license": "MIT" + }, + "node_modules/path-type": { + "version": "4.0.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/picocolors": { + "version": "1.0.0", + "dev": true, + "license": "ISC" + }, + "node_modules/picomatch": { + "version": "2.3.1", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8.6" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/pirates": { + "version": "4.0.6", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 6" + } + }, + "node_modules/pkg": { + "version": "5.8.1", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/generator": "7.18.2", + "@babel/parser": "7.18.4", + "@babel/types": "7.19.0", + "chalk": "^4.1.2", + "fs-extra": "^9.1.0", + "globby": "^11.1.0", + "into-stream": "^6.0.0", + "is-core-module": "2.9.0", + "minimist": "^1.2.6", + "multistream": "^4.1.0", + "pkg-fetch": "3.4.2", + "prebuild-install": "7.1.1", + "resolve": "^1.22.0", + "stream-meter": "^1.0.4" + }, + "bin": { + "pkg": "lib-es5/bin.js" + }, + "peerDependencies": { + "node-notifier": ">=9.0.1" + }, + "peerDependenciesMeta": { + "node-notifier": { + "optional": true + } + } + }, + "node_modules/pkg-dir": { + "version": "4.2.0", + "dev": true, + "license": "MIT", + "dependencies": { + "find-up": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/pkg-fetch": { + "version": "3.4.2", + "dev": true, + "license": "MIT", + "dependencies": { + "chalk": "^4.1.2", + "fs-extra": "^9.1.0", + "https-proxy-agent": "^5.0.0", + "node-fetch": "^2.6.6", + "progress": "^2.0.3", + "semver": "^7.3.5", + "tar-fs": "^2.1.1", + "yargs": "^16.2.0" + }, + "bin": { + "pkg-fetch": "lib-es5/bin.js" + } + }, + "node_modules/pkg-fetch/node_modules/cliui": { + "version": "7.0.4", + "dev": true, + "license": "ISC", + "dependencies": { + "string-width": "^4.2.0", + "strip-ansi": "^6.0.0", + "wrap-ansi": "^7.0.0" + } + }, + "node_modules/pkg-fetch/node_modules/lru-cache": { + "version": "6.0.0", + "dev": true, + "license": "ISC", + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/pkg-fetch/node_modules/semver": { + "version": "7.6.0", + "dev": true, + "license": "ISC", + "dependencies": { + "lru-cache": "^6.0.0" + }, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/pkg-fetch/node_modules/yallist": { + "version": "4.0.0", + "dev": true, + "license": "ISC" + }, + "node_modules/pkg-fetch/node_modules/yargs": { + "version": "16.2.0", + "dev": true, + "license": "MIT", + "dependencies": { + "cliui": "^7.0.2", + "escalade": "^3.1.1", + "get-caller-file": "^2.0.5", + "require-directory": "^2.1.1", + "string-width": "^4.2.0", + "y18n": "^5.0.5", + "yargs-parser": "^20.2.2" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/pkg-fetch/node_modules/yargs-parser": { + "version": "20.2.9", + "dev": true, + "license": "ISC", + "engines": { + "node": ">=10" + } + }, + "node_modules/pkg/node_modules/@babel/generator": { + "version": "7.18.2", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/types": "^7.18.2", + "@jridgewell/gen-mapping": "^0.3.0", + "jsesc": "^2.5.1" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/pkg/node_modules/@babel/parser": { + "version": "7.18.4", + "dev": true, + "license": "MIT", + "bin": { + "parser": "bin/babel-parser.js" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/pkg/node_modules/@babel/types": { + "version": "7.19.0", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-string-parser": "^7.18.10", + "@babel/helper-validator-identifier": "^7.18.6", + "to-fast-properties": "^2.0.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/prebuild-install": { + "version": "7.1.1", + "dev": true, + "license": "MIT", + "dependencies": { + "detect-libc": "^2.0.0", + "expand-template": "^2.0.3", + "github-from-package": "0.0.0", + "minimist": "^1.2.3", + "mkdirp-classic": "^0.5.3", + "napi-build-utils": "^1.0.1", + "node-abi": "^3.3.0", + "pump": "^3.0.0", + "rc": "^1.2.7", + "simple-get": "^4.0.0", + "tar-fs": "^2.0.0", + "tunnel-agent": "^0.6.0" + }, + "bin": { + "prebuild-install": "bin.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/prelude-ls": { + "version": "1.2.1", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/prettier": { + "version": "3.2.5", + "dev": true, + "license": "MIT", + "bin": { + "prettier": "bin/prettier.cjs" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/prettier/prettier?sponsor=1" + } + }, + "node_modules/pretty-format": { + "version": "29.7.0", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/schemas": "^29.6.3", + "ansi-styles": "^5.0.0", + "react-is": "^18.0.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/pretty-format/node_modules/ansi-styles": { + "version": "5.2.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/prisma": { + "version": "5.12.1", + "devOptional": true, + "hasInstallScript": true, + "license": "Apache-2.0", + "dependencies": { + "@prisma/engines": "5.12.1" + }, + "bin": { + "prisma": "build/index.js" + }, + "engines": { + "node": ">=16.13" + } + }, + "node_modules/process-nextick-args": { + "version": "2.0.1", + "dev": true, + "license": "MIT" + }, + "node_modules/progress": { + "version": "2.0.3", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/prompts": { + "version": "2.4.2", + "dev": true, + "license": "MIT", + "dependencies": { + "kleur": "^3.0.3", + "sisteransi": "^1.0.5" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/pump": { + "version": "3.0.0", + "dev": true, + "license": "MIT", + "dependencies": { + "end-of-stream": "^1.1.0", + "once": "^1.3.1" + } + }, + "node_modules/punycode": { + "version": "2.3.1", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/pure-rand": { + "version": "6.1.0", + "dev": true, + "funding": [ + { + "type": "individual", + "url": "https://github.com/sponsors/dubzzz" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/fast-check" + } + ], + "license": "MIT" + }, + "node_modules/queue-microtask": { + "version": "1.2.3", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT" + }, + "node_modules/rc": { + "version": "1.2.8", + "dev": true, + "license": "(BSD-2-Clause OR MIT OR Apache-2.0)", + "dependencies": { + "deep-extend": "^0.6.0", + "ini": "~1.3.0", + "minimist": "^1.2.0", + "strip-json-comments": "~2.0.1" + }, + "bin": { + "rc": "cli.js" + } + }, + "node_modules/rc/node_modules/strip-json-comments": { + "version": "2.0.1", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/react-is": { + "version": "18.2.0", + "dev": true, + "license": "MIT" + }, + "node_modules/readable-stream": { + "version": "2.3.8", + "dev": true, + "license": "MIT", + "dependencies": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + } + }, + "node_modules/require-directory": { + "version": "2.1.1", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/resolve": { + "version": "1.22.8", + "dev": true, + "license": "MIT", + "dependencies": { + "is-core-module": "^2.13.0", + "path-parse": "^1.0.7", + "supports-preserve-symlinks-flag": "^1.0.0" + }, + "bin": { + "resolve": "bin/resolve" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/resolve-cwd": { + "version": "3.0.0", + "dev": true, + "license": "MIT", + "dependencies": { + "resolve-from": "^5.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/resolve-from": { + "version": "5.0.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/resolve.exports": { + "version": "2.0.2", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10" + } + }, + "node_modules/resolve/node_modules/is-core-module": { + "version": "2.13.1", + "dev": true, + "license": "MIT", + "dependencies": { + "hasown": "^2.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/reusify": { + "version": "1.0.4", + "dev": true, + "license": "MIT", + "engines": { + "iojs": ">=1.0.0", + "node": ">=0.10.0" + } + }, + "node_modules/rimraf": { + "version": "3.0.2", + "dev": true, + "license": "ISC", + "dependencies": { + "glob": "^7.1.3" + }, + "bin": { + "rimraf": "bin.js" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/run-parallel": { + "version": "1.2.0", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT", + "dependencies": { + "queue-microtask": "^1.2.2" + } + }, + "node_modules/safe-buffer": { + "version": "5.1.2", + "dev": true, + "license": "MIT" + }, + "node_modules/semver": { + "version": "6.3.1", + "dev": true, + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + } + }, + "node_modules/shebang-command": { + "version": "2.0.0", + "dev": true, + "license": "MIT", + "dependencies": { + "shebang-regex": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/shebang-regex": { + "version": "3.0.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/signal-exit": { + "version": "3.0.7", + "dev": true, + "license": "ISC" + }, + "node_modules/simple-concat": { + "version": "1.0.1", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT" + }, + "node_modules/simple-get": { + "version": "4.0.1", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT", + "dependencies": { + "decompress-response": "^6.0.0", + "once": "^1.3.1", + "simple-concat": "^1.0.0" + } + }, + "node_modules/sisteransi": { + "version": "1.0.5", + "dev": true, + "license": "MIT" + }, + "node_modules/slash": { + "version": "3.0.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/source-map": { + "version": "0.6.1", + "dev": true, + "license": "BSD-3-Clause", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/source-map-support": { + "version": "0.5.13", + "dev": true, + "license": "MIT", + "dependencies": { + "buffer-from": "^1.0.0", + "source-map": "^0.6.0" + } + }, + "node_modules/sprintf-js": { + "version": "1.0.3", + "dev": true, + "license": "BSD-3-Clause" + }, + "node_modules/stack-utils": { + "version": "2.0.6", + "dev": true, + "license": "MIT", + "dependencies": { + "escape-string-regexp": "^2.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/stream-meter": { + "version": "1.0.4", + "dev": true, + "license": "MIT", + "dependencies": { + "readable-stream": "^2.1.4" + } + }, + "node_modules/string_decoder": { + "version": "1.1.1", + "dev": true, + "license": "MIT", + "dependencies": { + "safe-buffer": "~5.1.0" + } + }, + "node_modules/string-length": { + "version": "4.0.2", + "dev": true, + "license": "MIT", + "dependencies": { + "char-regex": "^1.0.2", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/string-width": { + "version": "4.2.3", + "dev": true, + "license": "MIT", + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/strip-ansi": { + "version": "6.0.1", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/strip-bom": { + "version": "4.0.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/strip-final-newline": { + "version": "2.0.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/strip-json-comments": { + "version": "3.1.1", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/supports-color": { + "version": "7.2.0", + "dev": true, + "license": "MIT", + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/supports-preserve-symlinks-flag": { + "version": "1.0.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/tar-fs": { + "version": "2.1.1", + "dev": true, + "license": "MIT", + "dependencies": { + "chownr": "^1.1.1", + "mkdirp-classic": "^0.5.2", + "pump": "^3.0.0", + "tar-stream": "^2.1.4" + } + }, + "node_modules/tar-stream": { + "version": "2.2.0", + "dev": true, + "license": "MIT", + "dependencies": { + "bl": "^4.0.3", + "end-of-stream": "^1.4.1", + "fs-constants": "^1.0.0", + "inherits": "^2.0.3", + "readable-stream": "^3.1.1" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/tar-stream/node_modules/readable-stream": { + "version": "3.6.2", + "dev": true, + "license": "MIT", + "dependencies": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/test-exclude": { + "version": "6.0.0", + "dev": true, + "license": "ISC", + "dependencies": { + "@istanbuljs/schema": "^0.1.2", + "glob": "^7.1.4", + "minimatch": "^3.0.4" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/text-table": { + "version": "0.2.0", + "dev": true, + "license": "MIT" + }, + "node_modules/threads": { + "version": "1.7.0", + "license": "MIT", + "dependencies": { + "callsites": "^3.1.0", + "debug": "^4.2.0", + "is-observable": "^2.1.0", + "observable-fns": "^0.6.1" + }, + "funding": { + "url": "https://github.com/andywer/threads.js?sponsor=1" + }, + "optionalDependencies": { + "tiny-worker": ">= 2" + } + }, + "node_modules/tiny-worker": { + "version": "2.3.0", + "license": "BSD-3-Clause", + "optional": true, + "dependencies": { + "esm": "^3.2.25" + } + }, + "node_modules/tmpl": { + "version": "1.0.5", + "dev": true, + "license": "BSD-3-Clause" + }, + "node_modules/to-fast-properties": { + "version": "2.0.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/to-regex-range": { + "version": "5.0.1", + "dev": true, + "license": "MIT", + "dependencies": { + "is-number": "^7.0.0" + }, + "engines": { + "node": ">=8.0" + } + }, + "node_modules/tr46": { + "version": "0.0.3", + "dev": true, + "license": "MIT" + }, + "node_modules/ts-api-utils": { + "version": "1.3.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=16" + }, + "peerDependencies": { + "typescript": ">=4.2.0" + } + }, + "node_modules/ts-jest": { + "version": "29.1.2", + "dev": true, + "license": "MIT", + "dependencies": { + "bs-logger": "0.x", + "fast-json-stable-stringify": "2.x", + "jest-util": "^29.0.0", + "json5": "^2.2.3", + "lodash.memoize": "4.x", + "make-error": "1.x", + "semver": "^7.5.3", + "yargs-parser": "^21.0.1" + }, + "bin": { + "ts-jest": "cli.js" + }, + "engines": { + "node": "^16.10.0 || ^18.0.0 || >=20.0.0" + }, + "peerDependencies": { + "@babel/core": ">=7.0.0-beta.0 <8", + "@jest/types": "^29.0.0", + "babel-jest": "^29.0.0", + "jest": "^29.0.0", + "typescript": ">=4.3 <6" + }, + "peerDependenciesMeta": { + "@babel/core": { + "optional": true + }, + "@jest/types": { + "optional": true + }, + "babel-jest": { + "optional": true + }, + "esbuild": { + "optional": true + } + } + }, + "node_modules/ts-jest/node_modules/lru-cache": { + "version": "6.0.0", + "dev": true, + "license": "ISC", + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/ts-jest/node_modules/semver": { + "version": "7.6.0", + "dev": true, + "license": "ISC", + "dependencies": { + "lru-cache": "^6.0.0" + }, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/ts-jest/node_modules/yallist": { + "version": "4.0.0", + "dev": true, + "license": "ISC" + }, + "node_modules/ts-node": { + "version": "10.9.2", + "dev": true, + "license": "MIT", + "dependencies": { + "@cspotcode/source-map-support": "^0.8.0", + "@tsconfig/node10": "^1.0.7", + "@tsconfig/node12": "^1.0.7", + "@tsconfig/node14": "^1.0.0", + "@tsconfig/node16": "^1.0.2", + "acorn": "^8.4.1", + "acorn-walk": "^8.1.1", + "arg": "^4.1.0", + "create-require": "^1.1.0", + "diff": "^4.0.1", + "make-error": "^1.1.1", + "v8-compile-cache-lib": "^3.0.1", + "yn": "3.1.1" + }, + "bin": { + "ts-node": "dist/bin.js", + "ts-node-cwd": "dist/bin-cwd.js", + "ts-node-esm": "dist/bin-esm.js", + "ts-node-script": "dist/bin-script.js", + "ts-node-transpile-only": "dist/bin-transpile.js", + "ts-script": "dist/bin-script-deprecated.js" + }, + "peerDependencies": { + "@swc/core": ">=1.2.50", + "@swc/wasm": ">=1.2.50", + "@types/node": "*", + "typescript": ">=2.7" + }, + "peerDependenciesMeta": { + "@swc/core": { + "optional": true + }, + "@swc/wasm": { + "optional": true + } + } + }, + "node_modules/tslib": { + "version": "1.14.1", + "dev": true, + "license": "0BSD" + }, + "node_modules/tsutils": { + "version": "3.21.0", + "dev": true, + "license": "MIT", + "dependencies": { + "tslib": "^1.8.1" + }, + "engines": { + "node": ">= 6" + }, + "peerDependencies": { + "typescript": ">=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta" + } + }, + "node_modules/tunnel-agent": { + "version": "0.6.0", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "safe-buffer": "^5.0.1" + }, + "engines": { + "node": "*" + } + }, + "node_modules/type-check": { + "version": "0.4.0", + "dev": true, + "license": "MIT", + "dependencies": { + "prelude-ls": "^1.2.1" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/type-detect": { + "version": "4.0.8", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/type-fest": { + "version": "0.21.3", + "dev": true, + "license": "(MIT OR CC0-1.0)", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/typescript": { + "version": "5.4.4", + "dev": true, + "license": "Apache-2.0", + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=14.17" + } + }, + "node_modules/typescript-eslint": { + "version": "7.6.0", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/eslint-plugin": "7.6.0", + "@typescript-eslint/parser": "7.6.0", + "@typescript-eslint/utils": "7.6.0" + }, + "engines": { + "node": "^18.18.0 || >=20.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^8.56.0" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/undici-types": { + "version": "5.26.5", + "dev": true, + "license": "MIT" + }, + "node_modules/universalify": { + "version": "2.0.1", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 10.0.0" + } + }, + "node_modules/update-browserslist-db": { + "version": "1.0.13", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/browserslist" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/browserslist" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "dependencies": { + "escalade": "^3.1.1", + "picocolors": "^1.0.0" + }, + "bin": { + "update-browserslist-db": "cli.js" + }, + "peerDependencies": { + "browserslist": ">= 4.21.0" + } + }, + "node_modules/uri-js": { + "version": "4.4.1", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "punycode": "^2.1.0" + } + }, + "node_modules/util-deprecate": { + "version": "1.0.2", + "dev": true, + "license": "MIT" + }, + "node_modules/v8-compile-cache-lib": { + "version": "3.0.1", + "dev": true, + "license": "MIT" + }, + "node_modules/v8-to-istanbul": { + "version": "9.2.0", + "dev": true, + "license": "ISC", + "dependencies": { + "@jridgewell/trace-mapping": "^0.3.12", + "@types/istanbul-lib-coverage": "^2.0.1", + "convert-source-map": "^2.0.0" + }, + "engines": { + "node": ">=10.12.0" + } + }, + "node_modules/walker": { + "version": "1.0.8", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "makeerror": "1.0.12" + } + }, + "node_modules/webidl-conversions": { + "version": "3.0.1", + "dev": true, + "license": "BSD-2-Clause" + }, + "node_modules/whatwg-url": { + "version": "5.0.0", + "dev": true, + "license": "MIT", + "dependencies": { + "tr46": "~0.0.3", + "webidl-conversions": "^3.0.0" + } + }, + "node_modules/which": { + "version": "2.0.2", + "dev": true, + "license": "ISC", + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "node-which": "bin/node-which" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/wrap-ansi": { + "version": "7.0.0", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, + "node_modules/wrappy": { + "version": "1.0.2", + "dev": true, + "license": "ISC" + }, + "node_modules/write-file-atomic": { + "version": "4.0.2", + "dev": true, + "license": "ISC", + "dependencies": { + "imurmurhash": "^0.1.4", + "signal-exit": "^3.0.7" + }, + "engines": { + "node": "^12.13.0 || ^14.15.0 || >=16.0.0" + } + }, + "node_modules/y18n": { + "version": "5.0.8", + "dev": true, + "license": "ISC", + "engines": { + "node": ">=10" + } + }, + "node_modules/yallist": { + "version": "3.1.1", + "dev": true, + "license": "ISC" + }, + "node_modules/yargs": { + "version": "17.7.2", + "dev": true, + "license": "MIT", + "dependencies": { + "cliui": "^8.0.1", + "escalade": "^3.1.1", + "get-caller-file": "^2.0.5", + "require-directory": "^2.1.1", + "string-width": "^4.2.3", + "y18n": "^5.0.5", + "yargs-parser": "^21.1.1" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/yargs-parser": { + "version": "21.1.1", + "dev": true, + "license": "ISC", + "engines": { + "node": ">=12" + } + }, + "node_modules/yn": { + "version": "3.1.1", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/yocto-queue": { + "version": "0.1.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + } + }, + "dependencies": { + "@aashutoshrathi/word-wrap": { + "version": "1.2.6", + "dev": true + }, + "@ampproject/remapping": { + "version": "2.3.0", + "dev": true, + "requires": { + "@jridgewell/gen-mapping": "^0.3.5", + "@jridgewell/trace-mapping": "^0.3.24" + } + }, + "@babel/code-frame": { + "version": "7.24.2", + "dev": true, + "requires": { + "@babel/highlight": "^7.24.2", + "picocolors": "^1.0.0" + } + }, + "@babel/compat-data": { + "version": "7.24.4", + "dev": true + }, + "@babel/core": { + "version": "7.24.4", + "dev": true, + "requires": { + "@ampproject/remapping": "^2.2.0", + "@babel/code-frame": "^7.24.2", + "@babel/generator": "^7.24.4", + "@babel/helper-compilation-targets": "^7.23.6", + "@babel/helper-module-transforms": "^7.23.3", + "@babel/helpers": "^7.24.4", + "@babel/parser": "^7.24.4", + "@babel/template": "^7.24.0", + "@babel/traverse": "^7.24.1", + "@babel/types": "^7.24.0", + "convert-source-map": "^2.0.0", + "debug": "^4.1.0", + "gensync": "^1.0.0-beta.2", + "json5": "^2.2.3", + "semver": "^6.3.1" + } + }, + "@babel/generator": { + "version": "7.24.4", + "dev": true, + "requires": { + "@babel/types": "^7.24.0", + "@jridgewell/gen-mapping": "^0.3.5", + "@jridgewell/trace-mapping": "^0.3.25", + "jsesc": "^2.5.1" + } + }, + "@babel/helper-compilation-targets": { + "version": "7.23.6", + "dev": true, + "requires": { + "@babel/compat-data": "^7.23.5", + "@babel/helper-validator-option": "^7.23.5", + "browserslist": "^4.22.2", + "lru-cache": "^5.1.1", + "semver": "^6.3.1" + } + }, + "@babel/helper-environment-visitor": { + "version": "7.22.20", + "dev": true + }, + "@babel/helper-function-name": { + "version": "7.23.0", + "dev": true, + "requires": { + "@babel/template": "^7.22.15", + "@babel/types": "^7.23.0" + } + }, + "@babel/helper-hoist-variables": { + "version": "7.22.5", + "dev": true, + "requires": { + "@babel/types": "^7.22.5" + } + }, + "@babel/helper-module-imports": { + "version": "7.24.3", + "dev": true, + "requires": { + "@babel/types": "^7.24.0" + } + }, + "@babel/helper-module-transforms": { + "version": "7.23.3", + "dev": true, + "requires": { + "@babel/helper-environment-visitor": "^7.22.20", + "@babel/helper-module-imports": "^7.22.15", + "@babel/helper-simple-access": "^7.22.5", + "@babel/helper-split-export-declaration": "^7.22.6", + "@babel/helper-validator-identifier": "^7.22.20" + } + }, + "@babel/helper-plugin-utils": { + "version": "7.24.0", + "dev": true + }, + "@babel/helper-simple-access": { + "version": "7.22.5", + "dev": true, + "requires": { + "@babel/types": "^7.22.5" + } + }, + "@babel/helper-split-export-declaration": { + "version": "7.22.6", + "dev": true, + "requires": { + "@babel/types": "^7.22.5" + } + }, + "@babel/helper-string-parser": { + "version": "7.24.1", + "dev": true + }, + "@babel/helper-validator-identifier": { + "version": "7.22.20", + "dev": true + }, + "@babel/helper-validator-option": { + "version": "7.23.5", + "dev": true + }, + "@babel/helpers": { + "version": "7.24.4", + "dev": true, + "requires": { + "@babel/template": "^7.24.0", + "@babel/traverse": "^7.24.1", + "@babel/types": "^7.24.0" + } + }, + "@babel/highlight": { + "version": "7.24.2", + "dev": true, + "requires": { + "@babel/helper-validator-identifier": "^7.22.20", + "chalk": "^2.4.2", + "js-tokens": "^4.0.0", + "picocolors": "^1.0.0" + }, + "dependencies": { + "ansi-styles": { + "version": "3.2.1", + "dev": true, + "requires": { + "color-convert": "^1.9.0" + } + }, + "chalk": { + "version": "2.4.2", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + }, + "color-convert": { + "version": "1.9.3", + "dev": true, + "requires": { + "color-name": "1.1.3" + } + }, + "color-name": { + "version": "1.1.3", + "dev": true + }, + "escape-string-regexp": { + "version": "1.0.5", + "dev": true + }, + "has-flag": { + "version": "3.0.0", + "dev": true + }, + "supports-color": { + "version": "5.5.0", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + } + } + }, + "@babel/parser": { + "version": "7.24.4", + "dev": true + }, + "@babel/plugin-syntax-async-generators": { + "version": "7.8.4", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.8.0" + } + }, + "@babel/plugin-syntax-bigint": { + "version": "7.8.3", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.8.0" + } + }, + "@babel/plugin-syntax-class-properties": { + "version": "7.12.13", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.12.13" + } + }, + "@babel/plugin-syntax-import-meta": { + "version": "7.10.4", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.10.4" + } + }, + "@babel/plugin-syntax-json-strings": { + "version": "7.8.3", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.8.0" + } + }, + "@babel/plugin-syntax-jsx": { + "version": "7.24.1", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.24.0" + } + }, + "@babel/plugin-syntax-logical-assignment-operators": { + "version": "7.10.4", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.10.4" + } + }, + "@babel/plugin-syntax-nullish-coalescing-operator": { + "version": "7.8.3", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.8.0" + } + }, + "@babel/plugin-syntax-numeric-separator": { + "version": "7.10.4", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.10.4" + } + }, + "@babel/plugin-syntax-object-rest-spread": { + "version": "7.8.3", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.8.0" + } + }, + "@babel/plugin-syntax-optional-catch-binding": { + "version": "7.8.3", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.8.0" + } + }, + "@babel/plugin-syntax-optional-chaining": { + "version": "7.8.3", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.8.0" + } + }, + "@babel/plugin-syntax-top-level-await": { + "version": "7.14.5", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.14.5" + } + }, + "@babel/plugin-syntax-typescript": { + "version": "7.24.1", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.24.0" + } + }, + "@babel/template": { + "version": "7.24.0", + "dev": true, + "requires": { + "@babel/code-frame": "^7.23.5", + "@babel/parser": "^7.24.0", + "@babel/types": "^7.24.0" + } + }, + "@babel/traverse": { + "version": "7.24.1", + "dev": true, + "requires": { + "@babel/code-frame": "^7.24.1", + "@babel/generator": "^7.24.1", + "@babel/helper-environment-visitor": "^7.22.20", + "@babel/helper-function-name": "^7.23.0", + "@babel/helper-hoist-variables": "^7.22.5", + "@babel/helper-split-export-declaration": "^7.22.6", + "@babel/parser": "^7.24.1", + "@babel/types": "^7.24.0", + "debug": "^4.3.1", + "globals": "^11.1.0" + } + }, + "@babel/types": { + "version": "7.24.0", + "dev": true, + "requires": { + "@babel/helper-string-parser": "^7.23.4", + "@babel/helper-validator-identifier": "^7.22.20", + "to-fast-properties": "^2.0.0" + } + }, + "@bazel/typescript": { + "version": "5.8.1", + "dev": true, + "requires": { + "@bazel/worker": "5.8.1", + "semver": "5.6.0", + "source-map-support": "0.5.9", + "tsutils": "3.21.0" + }, + "dependencies": { + "semver": { + "version": "5.6.0", + "dev": true + }, + "source-map-support": { + "version": "0.5.9", + "dev": true, + "requires": { + "buffer-from": "^1.0.0", + "source-map": "^0.6.0" + } + } + } + }, + "@bazel/worker": { + "version": "5.8.1", + "dev": true, + "requires": { + "google-protobuf": "^3.6.1" + } + }, + "@bcoe/v8-coverage": { + "version": "0.2.3", + "dev": true + }, + "@cspotcode/source-map-support": { + "version": "0.8.1", + "dev": true, + "requires": { + "@jridgewell/trace-mapping": "0.3.9" + }, + "dependencies": { + "@jridgewell/trace-mapping": { + "version": "0.3.9", + "dev": true, + "requires": { + "@jridgewell/resolve-uri": "^3.0.3", + "@jridgewell/sourcemap-codec": "^1.4.10" + } + } + } + }, + "@eslint-community/eslint-utils": { + "version": "4.4.0", + "dev": true, + "requires": { + "eslint-visitor-keys": "^3.3.0" + } + }, + "@eslint-community/regexpp": { + "version": "4.10.0", + "dev": true + }, + "@eslint/eslintrc": { + "version": "2.1.4", + "dev": true, + "requires": { + "ajv": "^6.12.4", + "debug": "^4.3.2", + "espree": "^9.6.0", + "globals": "^13.19.0", + "ignore": "^5.2.0", + "import-fresh": "^3.2.1", + "js-yaml": "^4.1.0", + "minimatch": "^3.1.2", + "strip-json-comments": "^3.1.1" + }, + "dependencies": { + "argparse": { + "version": "2.0.1", + "dev": true + }, + "globals": { + "version": "13.24.0", + "dev": true, + "requires": { + "type-fest": "^0.20.2" + } + }, + "js-yaml": { + "version": "4.1.0", + "dev": true, + "requires": { + "argparse": "^2.0.1" + } + }, + "type-fest": { + "version": "0.20.2", + "dev": true + } + } + }, + "@eslint/js": { + "version": "9.0.0", + "dev": true + }, + "@humanwhocodes/config-array": { + "version": "0.11.14", + "dev": true, + "requires": { + "@humanwhocodes/object-schema": "^2.0.2", + "debug": "^4.3.1", + "minimatch": "^3.0.5" + } + }, + "@humanwhocodes/module-importer": { + "version": "1.0.1", + "dev": true + }, + "@humanwhocodes/object-schema": { + "version": "2.0.3", + "dev": true + }, + "@istanbuljs/load-nyc-config": { + "version": "1.1.0", + "dev": true, + "requires": { + "camelcase": "^5.3.1", + "find-up": "^4.1.0", + "get-package-type": "^0.1.0", + "js-yaml": "^3.13.1", + "resolve-from": "^5.0.0" + } + }, + "@istanbuljs/schema": { + "version": "0.1.3", + "dev": true + }, + "@jest/console": { + "version": "29.7.0", + "dev": true, + "requires": { + "@jest/types": "^29.6.3", + "@types/node": "*", + "chalk": "^4.0.0", + "jest-message-util": "^29.7.0", + "jest-util": "^29.7.0", + "slash": "^3.0.0" + } + }, + "@jest/core": { + "version": "29.7.0", + "dev": true, + "requires": { + "@jest/console": "^29.7.0", + "@jest/reporters": "^29.7.0", + "@jest/test-result": "^29.7.0", + "@jest/transform": "^29.7.0", + "@jest/types": "^29.6.3", + "@types/node": "*", + "ansi-escapes": "^4.2.1", + "chalk": "^4.0.0", + "ci-info": "^3.2.0", + "exit": "^0.1.2", + "graceful-fs": "^4.2.9", + "jest-changed-files": "^29.7.0", + "jest-config": "^29.7.0", + "jest-haste-map": "^29.7.0", + "jest-message-util": "^29.7.0", + "jest-regex-util": "^29.6.3", + "jest-resolve": "^29.7.0", + "jest-resolve-dependencies": "^29.7.0", + "jest-runner": "^29.7.0", + "jest-runtime": "^29.7.0", + "jest-snapshot": "^29.7.0", + "jest-util": "^29.7.0", + "jest-validate": "^29.7.0", + "jest-watcher": "^29.7.0", + "micromatch": "^4.0.4", + "pretty-format": "^29.7.0", + "slash": "^3.0.0", + "strip-ansi": "^6.0.0" + } + }, + "@jest/environment": { + "version": "29.7.0", + "dev": true, + "requires": { + "@jest/fake-timers": "^29.7.0", + "@jest/types": "^29.6.3", + "@types/node": "*", + "jest-mock": "^29.7.0" + } + }, + "@jest/expect": { + "version": "29.7.0", + "dev": true, + "requires": { + "expect": "^29.7.0", + "jest-snapshot": "^29.7.0" + } + }, + "@jest/expect-utils": { + "version": "29.7.0", + "dev": true, + "requires": { + "jest-get-type": "^29.6.3" + } + }, + "@jest/fake-timers": { + "version": "29.7.0", + "dev": true, + "requires": { + "@jest/types": "^29.6.3", + "@sinonjs/fake-timers": "^10.0.2", + "@types/node": "*", + "jest-message-util": "^29.7.0", + "jest-mock": "^29.7.0", + "jest-util": "^29.7.0" + } + }, + "@jest/globals": { + "version": "29.7.0", + "dev": true, + "requires": { + "@jest/environment": "^29.7.0", + "@jest/expect": "^29.7.0", + "@jest/types": "^29.6.3", + "jest-mock": "^29.7.0" + } + }, + "@jest/reporters": { + "version": "29.7.0", + "dev": true, + "requires": { + "@bcoe/v8-coverage": "^0.2.3", + "@jest/console": "^29.7.0", + "@jest/test-result": "^29.7.0", + "@jest/transform": "^29.7.0", + "@jest/types": "^29.6.3", + "@jridgewell/trace-mapping": "^0.3.18", + "@types/node": "*", + "chalk": "^4.0.0", + "collect-v8-coverage": "^1.0.0", + "exit": "^0.1.2", + "glob": "^7.1.3", + "graceful-fs": "^4.2.9", + "istanbul-lib-coverage": "^3.0.0", + "istanbul-lib-instrument": "^6.0.0", + "istanbul-lib-report": "^3.0.0", + "istanbul-lib-source-maps": "^4.0.0", + "istanbul-reports": "^3.1.3", + "jest-message-util": "^29.7.0", + "jest-util": "^29.7.0", + "jest-worker": "^29.7.0", + "slash": "^3.0.0", + "string-length": "^4.0.1", + "strip-ansi": "^6.0.0", + "v8-to-istanbul": "^9.0.1" + } + }, + "@jest/schemas": { + "version": "29.6.3", + "dev": true, + "requires": { + "@sinclair/typebox": "^0.27.8" + } + }, + "@jest/source-map": { + "version": "29.6.3", + "dev": true, + "requires": { + "@jridgewell/trace-mapping": "^0.3.18", + "callsites": "^3.0.0", + "graceful-fs": "^4.2.9" + } + }, + "@jest/test-result": { + "version": "29.7.0", + "dev": true, + "requires": { + "@jest/console": "^29.7.0", + "@jest/types": "^29.6.3", + "@types/istanbul-lib-coverage": "^2.0.0", + "collect-v8-coverage": "^1.0.0" + } + }, + "@jest/test-sequencer": { + "version": "29.7.0", + "dev": true, + "requires": { + "@jest/test-result": "^29.7.0", + "graceful-fs": "^4.2.9", + "jest-haste-map": "^29.7.0", + "slash": "^3.0.0" + } + }, + "@jest/transform": { + "version": "29.7.0", + "dev": true, + "requires": { + "@babel/core": "^7.11.6", + "@jest/types": "^29.6.3", + "@jridgewell/trace-mapping": "^0.3.18", + "babel-plugin-istanbul": "^6.1.1", + "chalk": "^4.0.0", + "convert-source-map": "^2.0.0", + "fast-json-stable-stringify": "^2.1.0", + "graceful-fs": "^4.2.9", + "jest-haste-map": "^29.7.0", + "jest-regex-util": "^29.6.3", + "jest-util": "^29.7.0", + "micromatch": "^4.0.4", + "pirates": "^4.0.4", + "slash": "^3.0.0", + "write-file-atomic": "^4.0.2" + } + }, + "@jest/types": { + "version": "29.6.3", + "dev": true, + "requires": { + "@jest/schemas": "^29.6.3", + "@types/istanbul-lib-coverage": "^2.0.0", + "@types/istanbul-reports": "^3.0.0", + "@types/node": "*", + "@types/yargs": "^17.0.8", + "chalk": "^4.0.0" + } + }, + "@jridgewell/gen-mapping": { + "version": "0.3.5", + "dev": true, + "requires": { + "@jridgewell/set-array": "^1.2.1", + "@jridgewell/sourcemap-codec": "^1.4.10", + "@jridgewell/trace-mapping": "^0.3.24" + } + }, + "@jridgewell/resolve-uri": { + "version": "3.1.2", + "dev": true + }, + "@jridgewell/set-array": { + "version": "1.2.1", + "dev": true + }, + "@jridgewell/sourcemap-codec": { + "version": "1.4.15", + "dev": true + }, + "@jridgewell/trace-mapping": { + "version": "0.3.25", + "dev": true, + "requires": { + "@jridgewell/resolve-uri": "^3.1.0", + "@jridgewell/sourcemap-codec": "^1.4.14" + } + }, + "@nodelib/fs.scandir": { + "version": "2.1.5", + "dev": true, + "requires": { + "@nodelib/fs.stat": "2.0.5", + "run-parallel": "^1.1.9" + } + }, + "@nodelib/fs.stat": { + "version": "2.0.5", + "dev": true + }, + "@nodelib/fs.walk": { + "version": "1.2.8", + "dev": true, + "requires": { + "@nodelib/fs.scandir": "2.1.5", + "fastq": "^1.6.0" + } + }, + "@prisma/client": { + "version": "5.12.1", + "requires": {} + }, + "@prisma/debug": { + "version": "5.12.1", + "devOptional": true + }, + "@prisma/engines": { + "version": "5.12.1", + "devOptional": true, + "requires": { + "@prisma/debug": "5.12.1", + "@prisma/engines-version": "5.12.0-21.473ed3124229e22d881cb7addf559799debae1ab", + "@prisma/fetch-engine": "5.12.1", + "@prisma/get-platform": "5.12.1" + } + }, + "@prisma/engines-version": { + "version": "5.12.0-21.473ed3124229e22d881cb7addf559799debae1ab", + "devOptional": true + }, + "@prisma/fetch-engine": { + "version": "5.12.1", + "devOptional": true, + "requires": { + "@prisma/debug": "5.12.1", + "@prisma/engines-version": "5.12.0-21.473ed3124229e22d881cb7addf559799debae1ab", + "@prisma/get-platform": "5.12.1" + } + }, + "@prisma/get-platform": { + "version": "5.12.1", + "devOptional": true, + "requires": { + "@prisma/debug": "5.12.1" + } + }, + "@sinclair/typebox": { + "version": "0.27.8", + "dev": true + }, + "@sinonjs/commons": { + "version": "3.0.1", + "dev": true, + "requires": { + "type-detect": "4.0.8" + } + }, + "@sinonjs/fake-timers": { + "version": "10.3.0", + "dev": true, + "requires": { + "@sinonjs/commons": "^3.0.0" + } + }, + "@tsconfig/node10": { + "version": "1.0.11", + "dev": true + }, + "@tsconfig/node12": { + "version": "1.0.11", + "dev": true + }, + "@tsconfig/node14": { + "version": "1.0.3", + "dev": true + }, + "@tsconfig/node16": { + "version": "1.0.4", + "dev": true + }, + "@types/babel__core": { + "version": "7.20.5", + "dev": true, + "requires": { + "@babel/parser": "^7.20.7", + "@babel/types": "^7.20.7", + "@types/babel__generator": "*", + "@types/babel__template": "*", + "@types/babel__traverse": "*" + } + }, + "@types/babel__generator": { + "version": "7.6.8", + "dev": true, + "requires": { + "@babel/types": "^7.0.0" + } + }, + "@types/babel__template": { + "version": "7.4.4", + "dev": true, + "requires": { + "@babel/parser": "^7.1.0", + "@babel/types": "^7.0.0" + } + }, + "@types/babel__traverse": { + "version": "7.20.5", + "dev": true, + "requires": { + "@babel/types": "^7.20.7" + } + }, + "@types/graceful-fs": { + "version": "4.1.9", + "dev": true, + "requires": { + "@types/node": "*" + } + }, + "@types/istanbul-lib-coverage": { + "version": "2.0.6", + "dev": true + }, + "@types/istanbul-lib-report": { + "version": "3.0.3", + "dev": true, + "requires": { + "@types/istanbul-lib-coverage": "*" + } + }, + "@types/istanbul-reports": { + "version": "3.0.4", + "dev": true, + "requires": { + "@types/istanbul-lib-report": "*" + } + }, + "@types/jest": { + "version": "29.5.12", + "dev": true, + "requires": { + "expect": "^29.0.0", + "pretty-format": "^29.0.0" + } + }, + "@types/json-schema": { + "version": "7.0.15", + "dev": true + }, + "@types/lodash": { + "version": "4.17.0", + "dev": true + }, + "@types/node": { + "version": "20.12.6", + "dev": true, + "requires": { + "undici-types": "~5.26.4" + } + }, + "@types/semver": { + "version": "7.5.8", + "dev": true + }, + "@types/stack-utils": { + "version": "2.0.3", + "dev": true + }, + "@types/yargs": { + "version": "17.0.32", + "dev": true, + "requires": { + "@types/yargs-parser": "*" + } + }, + "@types/yargs-parser": { + "version": "21.0.3", + "dev": true + }, + "@typescript-eslint/eslint-plugin": { + "version": "7.6.0", + "dev": true, + "requires": { + "@eslint-community/regexpp": "^4.10.0", + "@typescript-eslint/scope-manager": "7.6.0", + "@typescript-eslint/type-utils": "7.6.0", + "@typescript-eslint/utils": "7.6.0", + "@typescript-eslint/visitor-keys": "7.6.0", + "debug": "^4.3.4", + "graphemer": "^1.4.0", + "ignore": "^5.3.1", + "natural-compare": "^1.4.0", + "semver": "^7.6.0", + "ts-api-utils": "^1.3.0" + }, + "dependencies": { + "lru-cache": { + "version": "6.0.0", + "dev": true, + "requires": { + "yallist": "^4.0.0" + } + }, + "semver": { + "version": "7.6.0", + "dev": true, + "requires": { + "lru-cache": "^6.0.0" + } + }, + "yallist": { + "version": "4.0.0", + "dev": true + } + } + }, + "@typescript-eslint/parser": { + "version": "7.6.0", + "dev": true, + "requires": { + "@typescript-eslint/scope-manager": "7.6.0", + "@typescript-eslint/types": "7.6.0", + "@typescript-eslint/typescript-estree": "7.6.0", + "@typescript-eslint/visitor-keys": "7.6.0", + "debug": "^4.3.4" + } + }, + "@typescript-eslint/scope-manager": { + "version": "7.6.0", + "dev": true, + "requires": { + "@typescript-eslint/types": "7.6.0", + "@typescript-eslint/visitor-keys": "7.6.0" + } + }, + "@typescript-eslint/type-utils": { + "version": "7.6.0", + "dev": true, + "requires": { + "@typescript-eslint/typescript-estree": "7.6.0", + "@typescript-eslint/utils": "7.6.0", + "debug": "^4.3.4", + "ts-api-utils": "^1.3.0" + } + }, + "@typescript-eslint/types": { + "version": "7.6.0", + "dev": true + }, + "@typescript-eslint/typescript-estree": { + "version": "7.6.0", + "dev": true, + "requires": { + "@typescript-eslint/types": "7.6.0", + "@typescript-eslint/visitor-keys": "7.6.0", + "debug": "^4.3.4", + "globby": "^11.1.0", + "is-glob": "^4.0.3", + "minimatch": "^9.0.4", + "semver": "^7.6.0", + "ts-api-utils": "^1.3.0" + }, + "dependencies": { + "brace-expansion": { + "version": "2.0.1", + "dev": true, + "requires": { + "balanced-match": "^1.0.0" + } + }, + "lru-cache": { + "version": "6.0.0", + "dev": true, + "requires": { + "yallist": "^4.0.0" + } + }, + "minimatch": { + "version": "9.0.4", + "dev": true, + "requires": { + "brace-expansion": "^2.0.1" + } + }, + "semver": { + "version": "7.6.0", + "dev": true, + "requires": { + "lru-cache": "^6.0.0" + } + }, + "yallist": { + "version": "4.0.0", + "dev": true + } + } + }, + "@typescript-eslint/utils": { + "version": "7.6.0", + "dev": true, + "requires": { + "@eslint-community/eslint-utils": "^4.4.0", + "@types/json-schema": "^7.0.15", + "@types/semver": "^7.5.8", + "@typescript-eslint/scope-manager": "7.6.0", + "@typescript-eslint/types": "7.6.0", + "@typescript-eslint/typescript-estree": "7.6.0", + "semver": "^7.6.0" + }, + "dependencies": { + "lru-cache": { + "version": "6.0.0", + "dev": true, + "requires": { + "yallist": "^4.0.0" + } + }, + "semver": { + "version": "7.6.0", + "dev": true, + "requires": { + "lru-cache": "^6.0.0" + } + }, + "yallist": { + "version": "4.0.0", + "dev": true + } + } + }, + "@typescript-eslint/visitor-keys": { + "version": "7.6.0", + "dev": true, + "requires": { + "@typescript-eslint/types": "7.6.0", + "eslint-visitor-keys": "^3.4.3" + } + }, + "@ungap/structured-clone": { + "version": "1.2.0", + "dev": true + }, + "acorn": { + "version": "8.11.3", + "dev": true + }, + "acorn-jsx": { + "version": "5.3.2", + "dev": true, + "requires": {} + }, + "acorn-walk": { + "version": "8.3.2", + "dev": true + }, + "agent-base": { + "version": "6.0.2", + "dev": true, + "requires": { + "debug": "4" + } + }, + "ajv": { + "version": "6.12.6", + "dev": true, + "requires": { + "fast-deep-equal": "^3.1.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" + } + }, + "ansi-escapes": { + "version": "4.3.2", + "dev": true, + "requires": { + "type-fest": "^0.21.3" + } + }, + "ansi-regex": { + "version": "5.0.1", + "dev": true + }, + "ansi-styles": { + "version": "4.3.0", + "dev": true, + "requires": { + "color-convert": "^2.0.1" + } + }, + "anymatch": { + "version": "3.1.3", + "dev": true, + "requires": { + "normalize-path": "^3.0.0", + "picomatch": "^2.0.4" + } + }, + "arg": { + "version": "4.1.3", + "dev": true + }, + "argparse": { + "version": "1.0.10", + "dev": true, + "requires": { + "sprintf-js": "~1.0.2" + } + }, + "array-union": { + "version": "2.1.0", + "dev": true + }, + "at-least-node": { + "version": "1.0.0", + "dev": true + }, + "babel-jest": { + "version": "29.7.0", + "dev": true, + "requires": { + "@jest/transform": "^29.7.0", + "@types/babel__core": "^7.1.14", + "babel-plugin-istanbul": "^6.1.1", + "babel-preset-jest": "^29.6.3", + "chalk": "^4.0.0", + "graceful-fs": "^4.2.9", + "slash": "^3.0.0" + } + }, + "babel-plugin-istanbul": { + "version": "6.1.1", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.0.0", + "@istanbuljs/load-nyc-config": "^1.0.0", + "@istanbuljs/schema": "^0.1.2", + "istanbul-lib-instrument": "^5.0.4", + "test-exclude": "^6.0.0" + }, + "dependencies": { + "istanbul-lib-instrument": { + "version": "5.2.1", + "dev": true, + "requires": { + "@babel/core": "^7.12.3", + "@babel/parser": "^7.14.7", + "@istanbuljs/schema": "^0.1.2", + "istanbul-lib-coverage": "^3.2.0", + "semver": "^6.3.0" + } + } + } + }, + "babel-plugin-jest-hoist": { + "version": "29.6.3", + "dev": true, + "requires": { + "@babel/template": "^7.3.3", + "@babel/types": "^7.3.3", + "@types/babel__core": "^7.1.14", + "@types/babel__traverse": "^7.0.6" + } + }, + "babel-preset-current-node-syntax": { + "version": "1.0.1", + "dev": true, + "requires": { + "@babel/plugin-syntax-async-generators": "^7.8.4", + "@babel/plugin-syntax-bigint": "^7.8.3", + "@babel/plugin-syntax-class-properties": "^7.8.3", + "@babel/plugin-syntax-import-meta": "^7.8.3", + "@babel/plugin-syntax-json-strings": "^7.8.3", + "@babel/plugin-syntax-logical-assignment-operators": "^7.8.3", + "@babel/plugin-syntax-nullish-coalescing-operator": "^7.8.3", + "@babel/plugin-syntax-numeric-separator": "^7.8.3", + "@babel/plugin-syntax-object-rest-spread": "^7.8.3", + "@babel/plugin-syntax-optional-catch-binding": "^7.8.3", + "@babel/plugin-syntax-optional-chaining": "^7.8.3", + "@babel/plugin-syntax-top-level-await": "^7.8.3" + } + }, + "babel-preset-jest": { + "version": "29.6.3", + "dev": true, + "requires": { + "babel-plugin-jest-hoist": "^29.6.3", + "babel-preset-current-node-syntax": "^1.0.0" + } + }, + "balanced-match": { + "version": "1.0.2", + "dev": true + }, + "base64-js": { + "version": "1.5.1", + "dev": true + }, + "bl": { + "version": "4.1.0", + "dev": true, + "requires": { + "buffer": "^5.5.0", + "inherits": "^2.0.4", + "readable-stream": "^3.4.0" + }, + "dependencies": { + "readable-stream": { + "version": "3.6.2", + "dev": true, + "requires": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + } + } + } + }, + "brace-expansion": { + "version": "1.1.11", + "dev": true, + "requires": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "braces": { + "version": "3.0.2", + "dev": true, + "requires": { + "fill-range": "^7.0.1" + } + }, + "browserslist": { + "version": "4.23.0", + "dev": true, + "requires": { + "caniuse-lite": "^1.0.30001587", + "electron-to-chromium": "^1.4.668", + "node-releases": "^2.0.14", + "update-browserslist-db": "^1.0.13" + } + }, + "bs-logger": { + "version": "0.2.6", + "dev": true, + "requires": { + "fast-json-stable-stringify": "2.x" + } + }, + "bser": { + "version": "2.1.1", + "dev": true, + "requires": { + "node-int64": "^0.4.0" + } + }, + "buffer": { + "version": "5.7.1", + "dev": true, + "requires": { + "base64-js": "^1.3.1", + "ieee754": "^1.1.13" + } + }, + "buffer-from": { + "version": "1.1.2", + "dev": true + }, + "callsites": { + "version": "3.1.0" + }, + "camelcase": { + "version": "5.3.1", + "dev": true + }, + "caniuse-lite": { + "version": "1.0.30001607", + "dev": true + }, + "chalk": { + "version": "4.1.2", + "dev": true, + "requires": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + } + }, + "char-regex": { + "version": "1.0.2", + "dev": true + }, + "chownr": { + "version": "1.1.4", + "dev": true + }, + "ci-info": { + "version": "3.9.0", + "dev": true + }, + "cjs-module-lexer": { + "version": "1.2.3", + "dev": true + }, + "cliui": { + "version": "8.0.1", + "dev": true, + "requires": { + "string-width": "^4.2.0", + "strip-ansi": "^6.0.1", + "wrap-ansi": "^7.0.0" + } + }, + "co": { + "version": "4.6.0", + "dev": true + }, + "collect-v8-coverage": { + "version": "1.0.2", + "dev": true + }, + "color-convert": { + "version": "2.0.1", + "dev": true, + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "dev": true + }, + "commander": { + "version": "12.0.0" + }, + "concat-map": { + "version": "0.0.1", + "dev": true + }, + "convert-source-map": { + "version": "2.0.0", + "dev": true + }, + "core-util-is": { + "version": "1.0.3", + "dev": true + }, + "create-jest": { + "version": "29.7.0", + "dev": true, + "requires": { + "@jest/types": "^29.6.3", + "chalk": "^4.0.0", + "exit": "^0.1.2", + "graceful-fs": "^4.2.9", + "jest-config": "^29.7.0", + "jest-util": "^29.7.0", + "prompts": "^2.0.1" + } + }, + "create-require": { + "version": "1.1.1", + "dev": true + }, + "cross-spawn": { + "version": "7.0.3", + "dev": true, + "requires": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + } + }, + "debug": { + "version": "4.3.4", + "requires": { + "ms": "2.1.2" + } + }, + "decompress-response": { + "version": "6.0.0", + "dev": true, + "requires": { + "mimic-response": "^3.1.0" + } + }, + "dedent": { + "version": "1.5.1", + "dev": true, + "requires": {} + }, + "deep-extend": { + "version": "0.6.0", + "dev": true + }, + "deep-is": { + "version": "0.1.4", + "dev": true + }, + "deepmerge": { + "version": "4.3.1", + "dev": true + }, + "detect-libc": { + "version": "2.0.3", + "dev": true + }, + "detect-newline": { + "version": "3.1.0", + "dev": true + }, + "diff": { + "version": "4.0.2", + "dev": true + }, + "diff-sequences": { + "version": "29.6.3", + "dev": true + }, + "dir-glob": { + "version": "3.0.1", + "dev": true, + "requires": { + "path-type": "^4.0.0" + } + }, + "doctrine": { + "version": "3.0.0", + "dev": true, + "requires": { + "esutils": "^2.0.2" + } + }, + "electron-to-chromium": { + "version": "1.4.730", + "dev": true + }, + "emittery": { + "version": "0.13.1", + "dev": true + }, + "emoji-regex": { + "version": "8.0.0", + "dev": true + }, + "end-of-stream": { + "version": "1.4.4", + "dev": true, + "requires": { + "once": "^1.4.0" + } + }, + "error-ex": { + "version": "1.3.2", + "dev": true, + "requires": { + "is-arrayish": "^0.2.1" + } + }, + "escalade": { + "version": "3.1.2", + "dev": true + }, + "escape-string-regexp": { + "version": "2.0.0", + "dev": true + }, + "eslint": { + "version": "8.57.0", + "dev": true, + "requires": { + "@eslint-community/eslint-utils": "^4.2.0", + "@eslint-community/regexpp": "^4.6.1", + "@eslint/eslintrc": "^2.1.4", + "@eslint/js": "8.57.0", + "@humanwhocodes/config-array": "^0.11.14", + "@humanwhocodes/module-importer": "^1.0.1", + "@nodelib/fs.walk": "^1.2.8", + "@ungap/structured-clone": "^1.2.0", + "ajv": "^6.12.4", + "chalk": "^4.0.0", + "cross-spawn": "^7.0.2", + "debug": "^4.3.2", + "doctrine": "^3.0.0", + "escape-string-regexp": "^4.0.0", + "eslint-scope": "^7.2.2", + "eslint-visitor-keys": "^3.4.3", + "espree": "^9.6.1", + "esquery": "^1.4.2", + "esutils": "^2.0.2", + "fast-deep-equal": "^3.1.3", + "file-entry-cache": "^6.0.1", + "find-up": "^5.0.0", + "glob-parent": "^6.0.2", + "globals": "^13.19.0", + "graphemer": "^1.4.0", + "ignore": "^5.2.0", + "imurmurhash": "^0.1.4", + "is-glob": "^4.0.0", + "is-path-inside": "^3.0.3", + "js-yaml": "^4.1.0", + "json-stable-stringify-without-jsonify": "^1.0.1", + "levn": "^0.4.1", + "lodash.merge": "^4.6.2", + "minimatch": "^3.1.2", + "natural-compare": "^1.4.0", + "optionator": "^0.9.3", + "strip-ansi": "^6.0.1", + "text-table": "^0.2.0" + }, + "dependencies": { + "@eslint/js": { + "version": "8.57.0", + "dev": true + }, + "argparse": { + "version": "2.0.1", + "dev": true + }, + "escape-string-regexp": { + "version": "4.0.0", + "dev": true + }, + "find-up": { + "version": "5.0.0", + "dev": true, + "requires": { + "locate-path": "^6.0.0", + "path-exists": "^4.0.0" + } + }, + "glob-parent": { + "version": "6.0.2", + "dev": true, + "requires": { + "is-glob": "^4.0.3" + } + }, + "globals": { + "version": "13.24.0", + "dev": true, + "requires": { + "type-fest": "^0.20.2" + } + }, + "js-yaml": { + "version": "4.1.0", + "dev": true, + "requires": { + "argparse": "^2.0.1" + } + }, + "locate-path": { + "version": "6.0.0", + "dev": true, + "requires": { + "p-locate": "^5.0.0" + } + }, + "p-locate": { + "version": "5.0.0", + "dev": true, + "requires": { + "p-limit": "^3.0.2" + } + }, + "type-fest": { + "version": "0.20.2", + "dev": true + } + } + }, + "eslint-scope": { + "version": "7.2.2", + "dev": true, + "requires": { + "esrecurse": "^4.3.0", + "estraverse": "^5.2.0" + } + }, + "eslint-visitor-keys": { + "version": "3.4.3", + "dev": true + }, + "esm": { + "version": "3.2.25", + "optional": true + }, + "espree": { + "version": "9.6.1", + "dev": true, + "requires": { + "acorn": "^8.9.0", + "acorn-jsx": "^5.3.2", + "eslint-visitor-keys": "^3.4.1" + } + }, + "esprima": { + "version": "4.0.1", + "dev": true + }, + "esquery": { + "version": "1.5.0", + "dev": true, + "requires": { + "estraverse": "^5.1.0" + } + }, + "esrecurse": { + "version": "4.3.0", + "dev": true, + "requires": { + "estraverse": "^5.2.0" + } + }, + "estraverse": { + "version": "5.3.0", + "dev": true + }, + "esutils": { + "version": "2.0.3", + "dev": true + }, + "execa": { + "version": "5.1.1", + "dev": true, + "requires": { + "cross-spawn": "^7.0.3", + "get-stream": "^6.0.0", + "human-signals": "^2.1.0", + "is-stream": "^2.0.0", + "merge-stream": "^2.0.0", + "npm-run-path": "^4.0.1", + "onetime": "^5.1.2", + "signal-exit": "^3.0.3", + "strip-final-newline": "^2.0.0" + } + }, + "exit": { + "version": "0.1.2", + "dev": true + }, + "expand-template": { + "version": "2.0.3", + "dev": true + }, + "expect": { + "version": "29.7.0", + "dev": true, + "requires": { + "@jest/expect-utils": "^29.7.0", + "jest-get-type": "^29.6.3", + "jest-matcher-utils": "^29.7.0", + "jest-message-util": "^29.7.0", + "jest-util": "^29.7.0" + } + }, + "fast-deep-equal": { + "version": "3.1.3", + "dev": true + }, + "fast-glob": { + "version": "3.3.2", + "dev": true, + "requires": { + "@nodelib/fs.stat": "^2.0.2", + "@nodelib/fs.walk": "^1.2.3", + "glob-parent": "^5.1.2", + "merge2": "^1.3.0", + "micromatch": "^4.0.4" + } + }, + "fast-json-stable-stringify": { + "version": "2.1.0", + "dev": true + }, + "fast-levenshtein": { + "version": "2.0.6", + "dev": true + }, + "fastq": { + "version": "1.17.1", + "dev": true, + "requires": { + "reusify": "^1.0.4" + } + }, + "fb-watchman": { + "version": "2.0.2", + "dev": true, + "requires": { + "bser": "2.1.1" + } + }, + "file-entry-cache": { + "version": "6.0.1", + "dev": true, + "requires": { + "flat-cache": "^3.0.4" + } + }, + "fill-range": { + "version": "7.0.1", + "dev": true, + "requires": { + "to-regex-range": "^5.0.1" + } + }, + "find-up": { + "version": "4.1.0", + "dev": true, + "requires": { + "locate-path": "^5.0.0", + "path-exists": "^4.0.0" + } + }, + "flat-cache": { + "version": "3.2.0", + "dev": true, + "requires": { + "flatted": "^3.2.9", + "keyv": "^4.5.3", + "rimraf": "^3.0.2" + } + }, + "flatted": { + "version": "3.3.1", + "dev": true + }, + "from2": { + "version": "2.3.0", + "dev": true, + "requires": { + "inherits": "^2.0.1", + "readable-stream": "^2.0.0" + } + }, + "fs-constants": { + "version": "1.0.0", + "dev": true + }, + "fs-extra": { + "version": "9.1.0", + "dev": true, + "requires": { + "at-least-node": "^1.0.0", + "graceful-fs": "^4.2.0", + "jsonfile": "^6.0.1", + "universalify": "^2.0.0" + } + }, + "fs.realpath": { + "version": "1.0.0", + "dev": true + }, + "fsevents": { + "version": "2.3.3", + "dev": true, + "optional": true + }, + "function-bind": { + "version": "1.1.2", + "dev": true + }, + "gensync": { + "version": "1.0.0-beta.2", + "dev": true + }, + "get-caller-file": { + "version": "2.0.5", + "dev": true + }, + "get-package-type": { + "version": "0.1.0", + "dev": true + }, + "get-stream": { + "version": "6.0.1", + "dev": true + }, + "github-from-package": { + "version": "0.0.0", + "dev": true + }, + "glob": { + "version": "7.2.3", + "dev": true, + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.1.1", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } + }, + "glob-parent": { + "version": "5.1.2", + "dev": true, + "requires": { + "is-glob": "^4.0.1" + } + }, + "globals": { + "version": "11.12.0", + "dev": true + }, + "globby": { + "version": "11.1.0", + "dev": true, + "requires": { + "array-union": "^2.1.0", + "dir-glob": "^3.0.1", + "fast-glob": "^3.2.9", + "ignore": "^5.2.0", + "merge2": "^1.4.1", + "slash": "^3.0.0" + } + }, + "google-protobuf": { + "version": "3.21.2", + "dev": true + }, + "graceful-fs": { + "version": "4.2.11", + "dev": true + }, + "graphemer": { + "version": "1.4.0", + "dev": true + }, + "has": { + "version": "1.0.4", + "dev": true + }, + "has-flag": { + "version": "4.0.0", + "dev": true + }, + "hasown": { + "version": "2.0.2", + "dev": true, + "requires": { + "function-bind": "^1.1.2" + } + }, + "html-escaper": { + "version": "2.0.2", + "dev": true + }, + "https-proxy-agent": { + "version": "5.0.1", + "dev": true, + "requires": { + "agent-base": "6", + "debug": "4" + } + }, + "human-signals": { + "version": "2.1.0", + "dev": true + }, + "ieee754": { + "version": "1.2.1", + "dev": true + }, + "ignore": { + "version": "5.3.1" + }, + "import-fresh": { + "version": "3.3.0", + "dev": true, + "requires": { + "parent-module": "^1.0.0", + "resolve-from": "^4.0.0" + }, + "dependencies": { + "resolve-from": { + "version": "4.0.0", + "dev": true + } + } + }, + "import-local": { + "version": "3.1.0", + "dev": true, + "requires": { + "pkg-dir": "^4.2.0", + "resolve-cwd": "^3.0.0" + } + }, + "imurmurhash": { + "version": "0.1.4", + "dev": true + }, + "inflight": { + "version": "1.0.6", + "dev": true, + "requires": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "inherits": { + "version": "2.0.4", + "dev": true + }, + "ini": { + "version": "1.3.8", + "dev": true + }, + "into-stream": { + "version": "6.0.0", + "dev": true, + "requires": { + "from2": "^2.3.0", + "p-is-promise": "^3.0.0" + } + }, + "is-arrayish": { + "version": "0.2.1", + "dev": true + }, + "is-core-module": { + "version": "2.9.0", + "dev": true, + "requires": { + "has": "^1.0.3" + } + }, + "is-extglob": { + "version": "2.1.1", + "dev": true + }, + "is-fullwidth-code-point": { + "version": "3.0.0", + "dev": true + }, + "is-generator-fn": { + "version": "2.1.0", + "dev": true + }, + "is-glob": { + "version": "4.0.3", + "dev": true, + "requires": { + "is-extglob": "^2.1.1" + } + }, + "is-number": { + "version": "7.0.0", + "dev": true + }, + "is-observable": { + "version": "2.1.0" + }, + "is-path-inside": { + "version": "3.0.3", + "dev": true + }, + "is-stream": { + "version": "2.0.1", + "dev": true + }, + "isarray": { + "version": "1.0.0", + "dev": true + }, + "isexe": { + "version": "2.0.0", + "dev": true + }, + "istanbul-lib-coverage": { + "version": "3.2.2", + "dev": true + }, + "istanbul-lib-instrument": { + "version": "6.0.2", + "dev": true, + "requires": { + "@babel/core": "^7.23.9", + "@babel/parser": "^7.23.9", + "@istanbuljs/schema": "^0.1.3", + "istanbul-lib-coverage": "^3.2.0", + "semver": "^7.5.4" + }, + "dependencies": { + "lru-cache": { + "version": "6.0.0", + "dev": true, + "requires": { + "yallist": "^4.0.0" + } + }, + "semver": { + "version": "7.6.0", + "dev": true, + "requires": { + "lru-cache": "^6.0.0" + } + }, + "yallist": { + "version": "4.0.0", + "dev": true + } + } + }, + "istanbul-lib-report": { + "version": "3.0.1", + "dev": true, + "requires": { + "istanbul-lib-coverage": "^3.0.0", + "make-dir": "^4.0.0", + "supports-color": "^7.1.0" + } + }, + "istanbul-lib-source-maps": { + "version": "4.0.1", + "dev": true, + "requires": { + "debug": "^4.1.1", + "istanbul-lib-coverage": "^3.0.0", + "source-map": "^0.6.1" + } + }, + "istanbul-reports": { + "version": "3.1.7", + "dev": true, + "requires": { + "html-escaper": "^2.0.0", + "istanbul-lib-report": "^3.0.0" + } + }, + "jest": { + "version": "29.7.0", + "dev": true, + "requires": { + "@jest/core": "^29.7.0", + "@jest/types": "^29.6.3", + "import-local": "^3.0.2", + "jest-cli": "^29.7.0" + } + }, + "jest-changed-files": { + "version": "29.7.0", + "dev": true, + "requires": { + "execa": "^5.0.0", + "jest-util": "^29.7.0", + "p-limit": "^3.1.0" + } + }, + "jest-circus": { + "version": "29.7.0", + "dev": true, + "requires": { + "@jest/environment": "^29.7.0", + "@jest/expect": "^29.7.0", + "@jest/test-result": "^29.7.0", + "@jest/types": "^29.6.3", + "@types/node": "*", + "chalk": "^4.0.0", + "co": "^4.6.0", + "dedent": "^1.0.0", + "is-generator-fn": "^2.0.0", + "jest-each": "^29.7.0", + "jest-matcher-utils": "^29.7.0", + "jest-message-util": "^29.7.0", + "jest-runtime": "^29.7.0", + "jest-snapshot": "^29.7.0", + "jest-util": "^29.7.0", + "p-limit": "^3.1.0", + "pretty-format": "^29.7.0", + "pure-rand": "^6.0.0", + "slash": "^3.0.0", + "stack-utils": "^2.0.3" + } + }, + "jest-cli": { + "version": "29.7.0", + "dev": true, + "requires": { + "@jest/core": "^29.7.0", + "@jest/test-result": "^29.7.0", + "@jest/types": "^29.6.3", + "chalk": "^4.0.0", + "create-jest": "^29.7.0", + "exit": "^0.1.2", + "import-local": "^3.0.2", + "jest-config": "^29.7.0", + "jest-util": "^29.7.0", + "jest-validate": "^29.7.0", + "yargs": "^17.3.1" + } + }, + "jest-config": { + "version": "29.7.0", + "dev": true, + "requires": { + "@babel/core": "^7.11.6", + "@jest/test-sequencer": "^29.7.0", + "@jest/types": "^29.6.3", + "babel-jest": "^29.7.0", + "chalk": "^4.0.0", + "ci-info": "^3.2.0", + "deepmerge": "^4.2.2", + "glob": "^7.1.3", + "graceful-fs": "^4.2.9", + "jest-circus": "^29.7.0", + "jest-environment-node": "^29.7.0", + "jest-get-type": "^29.6.3", + "jest-regex-util": "^29.6.3", + "jest-resolve": "^29.7.0", + "jest-runner": "^29.7.0", + "jest-util": "^29.7.0", + "jest-validate": "^29.7.0", + "micromatch": "^4.0.4", + "parse-json": "^5.2.0", + "pretty-format": "^29.7.0", + "slash": "^3.0.0", + "strip-json-comments": "^3.1.1" + } + }, + "jest-diff": { + "version": "29.7.0", + "dev": true, + "requires": { + "chalk": "^4.0.0", + "diff-sequences": "^29.6.3", + "jest-get-type": "^29.6.3", + "pretty-format": "^29.7.0" + } + }, + "jest-docblock": { + "version": "29.7.0", + "dev": true, + "requires": { + "detect-newline": "^3.0.0" + } + }, + "jest-each": { + "version": "29.7.0", + "dev": true, + "requires": { + "@jest/types": "^29.6.3", + "chalk": "^4.0.0", + "jest-get-type": "^29.6.3", + "jest-util": "^29.7.0", + "pretty-format": "^29.7.0" + } + }, + "jest-environment-node": { + "version": "29.7.0", + "dev": true, + "requires": { + "@jest/environment": "^29.7.0", + "@jest/fake-timers": "^29.7.0", + "@jest/types": "^29.6.3", + "@types/node": "*", + "jest-mock": "^29.7.0", + "jest-util": "^29.7.0" + } + }, + "jest-get-type": { + "version": "29.6.3", + "dev": true + }, + "jest-haste-map": { + "version": "29.7.0", + "dev": true, + "requires": { + "@jest/types": "^29.6.3", + "@types/graceful-fs": "^4.1.3", + "@types/node": "*", + "anymatch": "^3.0.3", + "fb-watchman": "^2.0.0", + "fsevents": "^2.3.2", + "graceful-fs": "^4.2.9", + "jest-regex-util": "^29.6.3", + "jest-util": "^29.7.0", + "jest-worker": "^29.7.0", + "micromatch": "^4.0.4", + "walker": "^1.0.8" + } + }, + "jest-leak-detector": { + "version": "29.7.0", + "dev": true, + "requires": { + "jest-get-type": "^29.6.3", + "pretty-format": "^29.7.0" + } + }, + "jest-matcher-utils": { + "version": "29.7.0", + "dev": true, + "requires": { + "chalk": "^4.0.0", + "jest-diff": "^29.7.0", + "jest-get-type": "^29.6.3", + "pretty-format": "^29.7.0" + } + }, + "jest-message-util": { + "version": "29.7.0", + "dev": true, + "requires": { + "@babel/code-frame": "^7.12.13", + "@jest/types": "^29.6.3", + "@types/stack-utils": "^2.0.0", + "chalk": "^4.0.0", + "graceful-fs": "^4.2.9", + "micromatch": "^4.0.4", + "pretty-format": "^29.7.0", + "slash": "^3.0.0", + "stack-utils": "^2.0.3" + } + }, + "jest-mock": { + "version": "29.7.0", + "dev": true, + "requires": { + "@jest/types": "^29.6.3", + "@types/node": "*", + "jest-util": "^29.7.0" + } + }, + "jest-pnp-resolver": { + "version": "1.2.3", + "dev": true, + "requires": {} + }, + "jest-regex-util": { + "version": "29.6.3", + "dev": true + }, + "jest-resolve": { + "version": "29.7.0", + "dev": true, + "requires": { + "chalk": "^4.0.0", + "graceful-fs": "^4.2.9", + "jest-haste-map": "^29.7.0", + "jest-pnp-resolver": "^1.2.2", + "jest-util": "^29.7.0", + "jest-validate": "^29.7.0", + "resolve": "^1.20.0", + "resolve.exports": "^2.0.0", + "slash": "^3.0.0" + } + }, + "jest-resolve-dependencies": { + "version": "29.7.0", + "dev": true, + "requires": { + "jest-regex-util": "^29.6.3", + "jest-snapshot": "^29.7.0" + } + }, + "jest-runner": { + "version": "29.7.0", + "dev": true, + "requires": { + "@jest/console": "^29.7.0", + "@jest/environment": "^29.7.0", + "@jest/test-result": "^29.7.0", + "@jest/transform": "^29.7.0", + "@jest/types": "^29.6.3", + "@types/node": "*", + "chalk": "^4.0.0", + "emittery": "^0.13.1", + "graceful-fs": "^4.2.9", + "jest-docblock": "^29.7.0", + "jest-environment-node": "^29.7.0", + "jest-haste-map": "^29.7.0", + "jest-leak-detector": "^29.7.0", + "jest-message-util": "^29.7.0", + "jest-resolve": "^29.7.0", + "jest-runtime": "^29.7.0", + "jest-util": "^29.7.0", + "jest-watcher": "^29.7.0", + "jest-worker": "^29.7.0", + "p-limit": "^3.1.0", + "source-map-support": "0.5.13" + } + }, + "jest-runtime": { + "version": "29.7.0", + "dev": true, + "requires": { + "@jest/environment": "^29.7.0", + "@jest/fake-timers": "^29.7.0", + "@jest/globals": "^29.7.0", + "@jest/source-map": "^29.6.3", + "@jest/test-result": "^29.7.0", + "@jest/transform": "^29.7.0", + "@jest/types": "^29.6.3", + "@types/node": "*", + "chalk": "^4.0.0", + "cjs-module-lexer": "^1.0.0", + "collect-v8-coverage": "^1.0.0", + "glob": "^7.1.3", + "graceful-fs": "^4.2.9", + "jest-haste-map": "^29.7.0", + "jest-message-util": "^29.7.0", + "jest-mock": "^29.7.0", + "jest-regex-util": "^29.6.3", + "jest-resolve": "^29.7.0", + "jest-snapshot": "^29.7.0", + "jest-util": "^29.7.0", + "slash": "^3.0.0", + "strip-bom": "^4.0.0" + } + }, + "jest-snapshot": { + "version": "29.7.0", + "dev": true, + "requires": { + "@babel/core": "^7.11.6", + "@babel/generator": "^7.7.2", + "@babel/plugin-syntax-jsx": "^7.7.2", + "@babel/plugin-syntax-typescript": "^7.7.2", + "@babel/types": "^7.3.3", + "@jest/expect-utils": "^29.7.0", + "@jest/transform": "^29.7.0", + "@jest/types": "^29.6.3", + "babel-preset-current-node-syntax": "^1.0.0", + "chalk": "^4.0.0", + "expect": "^29.7.0", + "graceful-fs": "^4.2.9", + "jest-diff": "^29.7.0", + "jest-get-type": "^29.6.3", + "jest-matcher-utils": "^29.7.0", + "jest-message-util": "^29.7.0", + "jest-util": "^29.7.0", + "natural-compare": "^1.4.0", + "pretty-format": "^29.7.0", + "semver": "^7.5.3" + }, + "dependencies": { + "lru-cache": { + "version": "6.0.0", + "dev": true, + "requires": { + "yallist": "^4.0.0" + } + }, + "semver": { + "version": "7.6.0", + "dev": true, + "requires": { + "lru-cache": "^6.0.0" + } + }, + "yallist": { + "version": "4.0.0", + "dev": true + } + } + }, + "jest-util": { + "version": "29.7.0", + "dev": true, + "requires": { + "@jest/types": "^29.6.3", + "@types/node": "*", + "chalk": "^4.0.0", + "ci-info": "^3.2.0", + "graceful-fs": "^4.2.9", + "picomatch": "^2.2.3" + } + }, + "jest-validate": { + "version": "29.7.0", + "dev": true, + "requires": { + "@jest/types": "^29.6.3", + "camelcase": "^6.2.0", + "chalk": "^4.0.0", + "jest-get-type": "^29.6.3", + "leven": "^3.1.0", + "pretty-format": "^29.7.0" + }, + "dependencies": { + "camelcase": { + "version": "6.3.0", + "dev": true + } + } + }, + "jest-watcher": { + "version": "29.7.0", + "dev": true, + "requires": { + "@jest/test-result": "^29.7.0", + "@jest/types": "^29.6.3", + "@types/node": "*", + "ansi-escapes": "^4.2.1", + "chalk": "^4.0.0", + "emittery": "^0.13.1", + "jest-util": "^29.7.0", + "string-length": "^4.0.1" + } + }, + "jest-worker": { + "version": "29.7.0", + "dev": true, + "requires": { + "@types/node": "*", + "jest-util": "^29.7.0", + "merge-stream": "^2.0.0", + "supports-color": "^8.0.0" + }, + "dependencies": { + "supports-color": { + "version": "8.1.1", + "dev": true, + "requires": { + "has-flag": "^4.0.0" + } + } + } + }, + "js-tokens": { + "version": "4.0.0", + "dev": true + }, + "js-yaml": { + "version": "3.14.1", + "dev": true, + "requires": { + "argparse": "^1.0.7", + "esprima": "^4.0.0" + } + }, + "jsesc": { + "version": "2.5.2", + "dev": true + }, + "json-buffer": { + "version": "3.0.1", + "dev": true + }, + "json-parse-even-better-errors": { + "version": "2.3.1", + "dev": true + }, + "json-schema-traverse": { + "version": "0.4.1", + "dev": true + }, + "json-stable-stringify-without-jsonify": { + "version": "1.0.1", + "dev": true + }, + "json5": { + "version": "2.2.3" + }, + "jsonfile": { + "version": "6.1.0", + "dev": true, + "requires": { + "graceful-fs": "^4.1.6", + "universalify": "^2.0.0" + } + }, + "keyv": { + "version": "4.5.4", + "dev": true, + "requires": { + "json-buffer": "3.0.1" + } + }, + "kleur": { + "version": "3.0.3", + "dev": true + }, + "leven": { + "version": "3.1.0", + "dev": true + }, + "levn": { + "version": "0.4.1", + "dev": true, + "requires": { + "prelude-ls": "^1.2.1", + "type-check": "~0.4.0" + } + }, + "lines-and-columns": { + "version": "1.2.4", + "dev": true + }, + "locate-path": { + "version": "5.0.0", + "dev": true, + "requires": { + "p-locate": "^4.1.0" + } + }, + "lodash": { + "version": "4.17.21" + }, + "lodash.memoize": { + "version": "4.1.2", + "dev": true + }, + "lodash.merge": { + "version": "4.6.2", + "dev": true + }, + "lru-cache": { + "version": "5.1.1", + "dev": true, + "requires": { + "yallist": "^3.0.2" + } + }, + "make-dir": { + "version": "4.0.0", + "dev": true, + "requires": { + "semver": "^7.5.3" + }, + "dependencies": { + "lru-cache": { + "version": "6.0.0", + "dev": true, + "requires": { + "yallist": "^4.0.0" + } + }, + "semver": { + "version": "7.6.0", + "dev": true, + "requires": { + "lru-cache": "^6.0.0" + } + }, + "yallist": { + "version": "4.0.0", + "dev": true + } + } + }, + "make-error": { + "version": "1.3.6", + "dev": true + }, + "makeerror": { + "version": "1.0.12", + "dev": true, + "requires": { + "tmpl": "1.0.5" + } + }, + "merge-stream": { + "version": "2.0.0", + "dev": true + }, + "merge2": { + "version": "1.4.1", + "dev": true + }, + "micromatch": { + "version": "4.0.5", + "dev": true, + "requires": { + "braces": "^3.0.2", + "picomatch": "^2.3.1" + } + }, + "mimic-fn": { + "version": "2.1.0", + "dev": true + }, + "mimic-response": { + "version": "3.1.0", + "dev": true + }, + "minimatch": { + "version": "3.1.2", + "dev": true, + "requires": { + "brace-expansion": "^1.1.7" + } + }, + "minimist": { + "version": "1.2.8", + "dev": true + }, + "mkdirp-classic": { + "version": "0.5.3", + "dev": true + }, + "ms": { + "version": "2.1.2" + }, + "multistream": { + "version": "4.1.0", + "dev": true, + "requires": { + "once": "^1.4.0", + "readable-stream": "^3.6.0" + }, + "dependencies": { + "readable-stream": { + "version": "3.6.2", + "dev": true, + "requires": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + } + } + } + }, + "napi-build-utils": { + "version": "1.0.2", + "dev": true + }, + "natural-compare": { + "version": "1.4.0", + "dev": true + }, + "node-abi": { + "version": "3.57.0", + "dev": true, + "requires": { + "semver": "^7.3.5" + }, + "dependencies": { + "lru-cache": { + "version": "6.0.0", + "dev": true, + "requires": { + "yallist": "^4.0.0" + } + }, + "semver": { + "version": "7.6.0", + "dev": true, + "requires": { + "lru-cache": "^6.0.0" + } + }, + "yallist": { + "version": "4.0.0", + "dev": true + } + } + }, + "node-fetch": { + "version": "2.7.0", + "dev": true, + "requires": { + "whatwg-url": "^5.0.0" + } + }, + "node-int64": { + "version": "0.4.0", + "dev": true + }, + "node-releases": { + "version": "2.0.14", + "dev": true + }, + "normalize-path": { + "version": "3.0.0", + "dev": true + }, + "npm-run-path": { + "version": "4.0.1", + "dev": true, + "requires": { + "path-key": "^3.0.0" + } + }, + "observable-fns": { + "version": "0.6.1" + }, + "ohos-typescript": { + "version": "4.9.5-r6", + "resolved": "https://registry.npmmirror.com/ohos-typescript/-/ohos-typescript-4.9.5-r6.tgz", + "integrity": "sha512-gwQq8e28xPdGNrIUXYM175N53fevIJOOuSOB45+X8neyhXT6nk8A+W6H46ejXIgMnHCR31OYidKrqAtGY26AhQ==", + "requires": { + "json5": "2.2.3" + } + }, + "once": { + "version": "1.4.0", + "dev": true, + "requires": { + "wrappy": "1" + } + }, + "onetime": { + "version": "5.1.2", + "dev": true, + "requires": { + "mimic-fn": "^2.1.0" + } + }, + "optionator": { + "version": "0.9.3", + "dev": true, + "requires": { + "@aashutoshrathi/word-wrap": "^1.2.3", + "deep-is": "^0.1.3", + "fast-levenshtein": "^2.0.6", + "levn": "^0.4.1", + "prelude-ls": "^1.2.1", + "type-check": "^0.4.0" + } + }, + "p-is-promise": { + "version": "3.0.0", + "dev": true + }, + "p-limit": { + "version": "3.1.0", + "dev": true, + "requires": { + "yocto-queue": "^0.1.0" + } + }, + "p-locate": { + "version": "4.1.0", + "dev": true, + "requires": { + "p-limit": "^2.2.0" + }, + "dependencies": { + "p-limit": { + "version": "2.3.0", + "dev": true, + "requires": { + "p-try": "^2.0.0" + } + } + } + }, + "p-try": { + "version": "2.2.0", + "dev": true + }, + "parent-module": { + "version": "1.0.1", + "dev": true, + "requires": { + "callsites": "^3.0.0" + } + }, + "parse-json": { + "version": "5.2.0", + "dev": true, + "requires": { + "@babel/code-frame": "^7.0.0", + "error-ex": "^1.3.1", + "json-parse-even-better-errors": "^2.3.0", + "lines-and-columns": "^1.1.6" + } + }, + "path-exists": { + "version": "4.0.0", + "dev": true + }, + "path-is-absolute": { + "version": "1.0.1", + "dev": true + }, + "path-key": { + "version": "3.1.1", + "dev": true + }, + "path-parse": { + "version": "1.0.7", + "dev": true + }, + "path-type": { + "version": "4.0.0", + "dev": true + }, + "picocolors": { + "version": "1.0.0", + "dev": true + }, + "picomatch": { + "version": "2.3.1", + "dev": true + }, + "pirates": { + "version": "4.0.6", + "dev": true + }, + "pkg": { + "version": "5.8.1", + "dev": true, + "requires": { + "@babel/generator": "7.18.2", + "@babel/parser": "7.18.4", + "@babel/types": "7.19.0", + "chalk": "^4.1.2", + "fs-extra": "^9.1.0", + "globby": "^11.1.0", + "into-stream": "^6.0.0", + "is-core-module": "2.9.0", + "minimist": "^1.2.6", + "multistream": "^4.1.0", + "pkg-fetch": "3.4.2", + "prebuild-install": "7.1.1", + "resolve": "^1.22.0", + "stream-meter": "^1.0.4" + }, + "dependencies": { + "@babel/generator": { + "version": "7.18.2", + "dev": true, + "requires": { + "@babel/types": "^7.18.2", + "@jridgewell/gen-mapping": "^0.3.0", + "jsesc": "^2.5.1" + } + }, + "@babel/parser": { + "version": "7.18.4", + "dev": true + }, + "@babel/types": { + "version": "7.19.0", + "dev": true, + "requires": { + "@babel/helper-string-parser": "^7.18.10", + "@babel/helper-validator-identifier": "^7.18.6", + "to-fast-properties": "^2.0.0" + } + } + } + }, + "pkg-dir": { + "version": "4.2.0", + "dev": true, + "requires": { + "find-up": "^4.0.0" + } + }, + "pkg-fetch": { + "version": "3.4.2", + "dev": true, + "requires": { + "chalk": "^4.1.2", + "fs-extra": "^9.1.0", + "https-proxy-agent": "^5.0.0", + "node-fetch": "^2.6.6", + "progress": "^2.0.3", + "semver": "^7.3.5", + "tar-fs": "^2.1.1", + "yargs": "^16.2.0" + }, + "dependencies": { + "cliui": { + "version": "7.0.4", + "dev": true, + "requires": { + "string-width": "^4.2.0", + "strip-ansi": "^6.0.0", + "wrap-ansi": "^7.0.0" + } + }, + "lru-cache": { + "version": "6.0.0", + "dev": true, + "requires": { + "yallist": "^4.0.0" + } + }, + "semver": { + "version": "7.6.0", + "dev": true, + "requires": { + "lru-cache": "^6.0.0" + } + }, + "yallist": { + "version": "4.0.0", + "dev": true + }, + "yargs": { + "version": "16.2.0", + "dev": true, + "requires": { + "cliui": "^7.0.2", + "escalade": "^3.1.1", + "get-caller-file": "^2.0.5", + "require-directory": "^2.1.1", + "string-width": "^4.2.0", + "y18n": "^5.0.5", + "yargs-parser": "^20.2.2" + } + }, + "yargs-parser": { + "version": "20.2.9", + "dev": true + } + } + }, + "prebuild-install": { + "version": "7.1.1", + "dev": true, + "requires": { + "detect-libc": "^2.0.0", + "expand-template": "^2.0.3", + "github-from-package": "0.0.0", + "minimist": "^1.2.3", + "mkdirp-classic": "^0.5.3", + "napi-build-utils": "^1.0.1", + "node-abi": "^3.3.0", + "pump": "^3.0.0", + "rc": "^1.2.7", + "simple-get": "^4.0.0", + "tar-fs": "^2.0.0", + "tunnel-agent": "^0.6.0" + } + }, + "prelude-ls": { + "version": "1.2.1", + "dev": true + }, + "prettier": { + "version": "3.2.5", + "dev": true + }, + "pretty-format": { + "version": "29.7.0", + "dev": true, + "requires": { + "@jest/schemas": "^29.6.3", + "ansi-styles": "^5.0.0", + "react-is": "^18.0.0" + }, + "dependencies": { + "ansi-styles": { + "version": "5.2.0", + "dev": true + } + } + }, + "prisma": { + "version": "5.12.1", + "devOptional": true, + "requires": { + "@prisma/engines": "5.12.1" + } + }, + "process-nextick-args": { + "version": "2.0.1", + "dev": true + }, + "progress": { + "version": "2.0.3", + "dev": true + }, + "prompts": { + "version": "2.4.2", + "dev": true, + "requires": { + "kleur": "^3.0.3", + "sisteransi": "^1.0.5" + } + }, + "pump": { + "version": "3.0.0", + "dev": true, + "requires": { + "end-of-stream": "^1.1.0", + "once": "^1.3.1" + } + }, + "punycode": { + "version": "2.3.1", + "dev": true + }, + "pure-rand": { + "version": "6.1.0", + "dev": true + }, + "queue-microtask": { + "version": "1.2.3", + "dev": true + }, + "rc": { + "version": "1.2.8", + "dev": true, + "requires": { + "deep-extend": "^0.6.0", + "ini": "~1.3.0", + "minimist": "^1.2.0", + "strip-json-comments": "~2.0.1" + }, + "dependencies": { + "strip-json-comments": { + "version": "2.0.1", + "dev": true + } + } + }, + "react-is": { + "version": "18.2.0", + "dev": true + }, + "readable-stream": { + "version": "2.3.8", + "dev": true, + "requires": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + } + }, + "require-directory": { + "version": "2.1.1", + "dev": true + }, + "resolve": { + "version": "1.22.8", + "dev": true, + "requires": { + "is-core-module": "^2.13.0", + "path-parse": "^1.0.7", + "supports-preserve-symlinks-flag": "^1.0.0" + }, + "dependencies": { + "is-core-module": { + "version": "2.13.1", + "dev": true, + "requires": { + "hasown": "^2.0.0" + } + } + } + }, + "resolve-cwd": { + "version": "3.0.0", + "dev": true, + "requires": { + "resolve-from": "^5.0.0" + } + }, + "resolve-from": { + "version": "5.0.0", + "dev": true + }, + "resolve.exports": { + "version": "2.0.2", + "dev": true + }, + "reusify": { + "version": "1.0.4", + "dev": true + }, + "rimraf": { + "version": "3.0.2", + "dev": true, + "requires": { + "glob": "^7.1.3" + } + }, + "run-parallel": { + "version": "1.2.0", + "dev": true, + "requires": { + "queue-microtask": "^1.2.2" + } + }, + "safe-buffer": { + "version": "5.1.2", + "dev": true + }, + "semver": { + "version": "6.3.1", + "dev": true + }, + "shebang-command": { + "version": "2.0.0", + "dev": true, + "requires": { + "shebang-regex": "^3.0.0" + } + }, + "shebang-regex": { + "version": "3.0.0", + "dev": true + }, + "signal-exit": { + "version": "3.0.7", + "dev": true + }, + "simple-concat": { + "version": "1.0.1", + "dev": true + }, + "simple-get": { + "version": "4.0.1", + "dev": true, + "requires": { + "decompress-response": "^6.0.0", + "once": "^1.3.1", + "simple-concat": "^1.0.0" + } + }, + "sisteransi": { + "version": "1.0.5", + "dev": true + }, + "slash": { + "version": "3.0.0", + "dev": true + }, + "source-map": { + "version": "0.6.1", + "dev": true + }, + "source-map-support": { + "version": "0.5.13", + "dev": true, + "requires": { + "buffer-from": "^1.0.0", + "source-map": "^0.6.0" + } + }, + "sprintf-js": { + "version": "1.0.3", + "dev": true + }, + "stack-utils": { + "version": "2.0.6", + "dev": true, + "requires": { + "escape-string-regexp": "^2.0.0" + } + }, + "stream-meter": { + "version": "1.0.4", + "dev": true, + "requires": { + "readable-stream": "^2.1.4" + } + }, + "string_decoder": { + "version": "1.1.1", + "dev": true, + "requires": { + "safe-buffer": "~5.1.0" + } + }, + "string-length": { + "version": "4.0.2", + "dev": true, + "requires": { + "char-regex": "^1.0.2", + "strip-ansi": "^6.0.0" + } + }, + "string-width": { + "version": "4.2.3", + "dev": true, + "requires": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + } + }, + "strip-ansi": { + "version": "6.0.1", + "dev": true, + "requires": { + "ansi-regex": "^5.0.1" + } + }, + "strip-bom": { + "version": "4.0.0", + "dev": true + }, + "strip-final-newline": { + "version": "2.0.0", + "dev": true + }, + "strip-json-comments": { + "version": "3.1.1", + "dev": true + }, + "supports-color": { + "version": "7.2.0", + "dev": true, + "requires": { + "has-flag": "^4.0.0" + } + }, + "supports-preserve-symlinks-flag": { + "version": "1.0.0", + "dev": true + }, + "tar-fs": { + "version": "2.1.1", + "dev": true, + "requires": { + "chownr": "^1.1.1", + "mkdirp-classic": "^0.5.2", + "pump": "^3.0.0", + "tar-stream": "^2.1.4" + } + }, + "tar-stream": { + "version": "2.2.0", + "dev": true, + "requires": { + "bl": "^4.0.3", + "end-of-stream": "^1.4.1", + "fs-constants": "^1.0.0", + "inherits": "^2.0.3", + "readable-stream": "^3.1.1" + }, + "dependencies": { + "readable-stream": { + "version": "3.6.2", + "dev": true, + "requires": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + } + } + } + }, + "test-exclude": { + "version": "6.0.0", + "dev": true, + "requires": { + "@istanbuljs/schema": "^0.1.2", + "glob": "^7.1.4", + "minimatch": "^3.0.4" + } + }, + "text-table": { + "version": "0.2.0", + "dev": true + }, + "threads": { + "version": "1.7.0", + "requires": { + "callsites": "^3.1.0", + "debug": "^4.2.0", + "is-observable": "^2.1.0", + "observable-fns": "^0.6.1", + "tiny-worker": ">= 2" + } + }, + "tiny-worker": { + "version": "2.3.0", + "optional": true, + "requires": { + "esm": "^3.2.25" + } + }, + "tmpl": { + "version": "1.0.5", + "dev": true + }, + "to-fast-properties": { + "version": "2.0.0", + "dev": true + }, + "to-regex-range": { + "version": "5.0.1", + "dev": true, + "requires": { + "is-number": "^7.0.0" + } + }, + "tr46": { + "version": "0.0.3", + "dev": true + }, + "ts-api-utils": { + "version": "1.3.0", + "dev": true, + "requires": {} + }, + "ts-jest": { + "version": "29.1.2", + "dev": true, + "requires": { + "bs-logger": "0.x", + "fast-json-stable-stringify": "2.x", + "jest-util": "^29.0.0", + "json5": "^2.2.3", + "lodash.memoize": "4.x", + "make-error": "1.x", + "semver": "^7.5.3", + "yargs-parser": "^21.0.1" + }, + "dependencies": { + "lru-cache": { + "version": "6.0.0", + "dev": true, + "requires": { + "yallist": "^4.0.0" + } + }, + "semver": { + "version": "7.6.0", + "dev": true, + "requires": { + "lru-cache": "^6.0.0" + } + }, + "yallist": { + "version": "4.0.0", + "dev": true + } + } + }, + "ts-node": { + "version": "10.9.2", + "dev": true, + "requires": { + "@cspotcode/source-map-support": "^0.8.0", + "@tsconfig/node10": "^1.0.7", + "@tsconfig/node12": "^1.0.7", + "@tsconfig/node14": "^1.0.0", + "@tsconfig/node16": "^1.0.2", + "acorn": "^8.4.1", + "acorn-walk": "^8.1.1", + "arg": "^4.1.0", + "create-require": "^1.1.0", + "diff": "^4.0.1", + "make-error": "^1.1.1", + "v8-compile-cache-lib": "^3.0.1", + "yn": "3.1.1" + } + }, + "tslib": { + "version": "1.14.1", + "dev": true + }, + "tsutils": { + "version": "3.21.0", + "dev": true, + "requires": { + "tslib": "^1.8.1" + } + }, + "tunnel-agent": { + "version": "0.6.0", + "dev": true, + "requires": { + "safe-buffer": "^5.0.1" + } + }, + "type-check": { + "version": "0.4.0", + "dev": true, + "requires": { + "prelude-ls": "^1.2.1" + } + }, + "type-detect": { + "version": "4.0.8", + "dev": true + }, + "type-fest": { + "version": "0.21.3", + "dev": true + }, + "typescript": { + "version": "5.4.4", + "dev": true + }, + "typescript-eslint": { + "version": "7.6.0", + "dev": true, + "requires": { + "@typescript-eslint/eslint-plugin": "7.6.0", + "@typescript-eslint/parser": "7.6.0", + "@typescript-eslint/utils": "7.6.0" + } + }, + "undici-types": { + "version": "5.26.5", + "dev": true + }, + "universalify": { + "version": "2.0.1", + "dev": true + }, + "update-browserslist-db": { + "version": "1.0.13", + "dev": true, + "requires": { + "escalade": "^3.1.1", + "picocolors": "^1.0.0" + } + }, + "uri-js": { + "version": "4.4.1", + "dev": true, + "requires": { + "punycode": "^2.1.0" + } + }, + "util-deprecate": { + "version": "1.0.2", + "dev": true + }, + "v8-compile-cache-lib": { + "version": "3.0.1", + "dev": true + }, + "v8-to-istanbul": { + "version": "9.2.0", + "dev": true, + "requires": { + "@jridgewell/trace-mapping": "^0.3.12", + "@types/istanbul-lib-coverage": "^2.0.1", + "convert-source-map": "^2.0.0" + } + }, + "walker": { + "version": "1.0.8", + "dev": true, + "requires": { + "makeerror": "1.0.12" + } + }, + "webidl-conversions": { + "version": "3.0.1", + "dev": true + }, + "whatwg-url": { + "version": "5.0.0", + "dev": true, + "requires": { + "tr46": "~0.0.3", + "webidl-conversions": "^3.0.0" + } + }, + "which": { + "version": "2.0.2", + "dev": true, + "requires": { + "isexe": "^2.0.0" + } + }, + "wrap-ansi": { + "version": "7.0.0", + "dev": true, + "requires": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + } + }, + "wrappy": { + "version": "1.0.2", + "dev": true + }, + "write-file-atomic": { + "version": "4.0.2", + "dev": true, + "requires": { + "imurmurhash": "^0.1.4", + "signal-exit": "^3.0.7" + } + }, + "y18n": { + "version": "5.0.8", + "dev": true + }, + "yallist": { + "version": "3.1.1", + "dev": true + }, + "yargs": { + "version": "17.7.2", + "dev": true, + "requires": { + "cliui": "^8.0.1", + "escalade": "^3.1.1", + "get-caller-file": "^2.0.5", + "require-directory": "^2.1.1", + "string-width": "^4.2.3", + "y18n": "^5.0.5", + "yargs-parser": "^21.1.1" + } + }, + "yargs-parser": { + "version": "21.1.1", + "dev": true + }, + "yn": { + "version": "3.1.1", + "dev": true + }, + "yocto-queue": { + "version": "0.1.0", + "dev": true + } + } +} diff --git a/language/arkts/extractor/package.json b/language/arkts/extractor/package.json new file mode 100644 index 00000000..613eadda --- /dev/null +++ b/language/arkts/extractor/package.json @@ -0,0 +1,56 @@ +{ + "name": "coref-arkts-src-extractor", + "version": "1.0.0", + "description": "", + "main": "dist/src/index.js", + "bin": "dist/src/index.js", + "pkg": { + "assets": [ + "sdk/**/*", + "init.db", + "paths.json" + ], + "scripts": [ + "dist/src/core/worker.js" + ] + }, + "scripts": { + "gen-schema": "python3 jinja/puml_to_schema_prisma.py er.puml && mv jinja/schema.prisma schema.prisma", + "update-db": "npx prisma db push", + "clean": "rm -rf dist", + "clean-all": "rm -rf node_modules dist", + "build": "npm run clean && npx tsc -p .", + "pkg": "npm run build && npm run update-db && npx pkg . -C GZip -t node18 -o coref-arkts-src-extractor --options max-old-space-size=7168", + "test": "npx jest", + "prettier": "npx prettier --write src" + }, + "repository": { + "type": "git", + "url": "https://code.alipay.com/codeinsight_sys/sparrow-cli.git" + }, + "author": "", + "dependencies": { + "@prisma/client": "^5.12.1", + "commander": "^12.0.0", + "ignore": "^5.3.1", + "lodash": "^4.17.21", + "ohos-typescript": "^4.9.5-r6", + "threads": "^1.7.0" + }, + "devDependencies": { + "@bazel/typescript": "^5.8.1", + "@eslint/js": "^9.0.0", + "@types/jest": "^29.5.12", + "@types/lodash": "^4.17.0", + "@types/node": "^20.12.6", + "eslint": "^8.57.0", + "jest": "^29.7.0", + "pkg": "^5.8.1", + "prettier": "^3.2.5", + "prisma": "^5.12.1", + "ts-jest": "^29.1.2", + "ts-node": "^10.9.2", + "typescript": "^5.4.4", + "typescript-eslint": "^7.6.0" + } +} diff --git a/language/arkts/extractor/paths.json b/language/arkts/extractor/paths.json new file mode 100644 index 00000000..b1e79ed0 --- /dev/null +++ b/language/arkts/extractor/paths.json @@ -0,0 +1,1664 @@ +{ + "@kit.GameServiceKit": [ + "sdk/hms/ets/kits/@kit.GameServiceKit.d.ts" + ], + "@kit.StoreKit": [ + "sdk/hms/ets/kits/@kit.StoreKit.d.ts" + ], + "@kit.ScanKit": [ + "sdk/hms/ets/kits/@kit.ScanKit.d.ts" + ], + "@kit.StatusBarExtensionKit": [ + "sdk/hms/ets/kits/@kit.StatusBarExtensionKit.d.ts" + ], + "@kit.RemoteCommunicationKit": [ + "sdk/hms/ets/kits/@kit.RemoteCommunicationKit.d.ts" + ], + "@kit.IAPKit": [ + "sdk/hms/ets/kits/@kit.IAPKit.d.ts" + ], + "@kit.WalletKit": [ + "sdk/hms/ets/kits/@kit.WalletKit.d.ts" + ], + "@kit.CarKit": [ + "sdk/hms/ets/kits/@kit.CarKit.d.ts" + ], + "@kit.IntentsKit": [ + "sdk/hms/ets/kits/@kit.IntentsKit.d.ts" + ], + "@kit.CoreVisionKit": [ + "sdk/hms/ets/kits/@kit.CoreVisionKit.d.ts" + ], + "@kit.CoreSpeechKit": [ + "sdk/hms/ets/kits/@kit.CoreSpeechKit.d.ts" + ], + "@kit.VisionKit": [ + "sdk/hms/ets/kits/@kit.VisionKit.d.ts" + ], + "@kit.SpeechKit": [ + "sdk/hms/ets/kits/@kit.SpeechKit.d.ts" + ], + "@kit.CallKit": [ + "sdk/hms/ets/kits/@kit.CallKit.d.ts" + ], + "@kit.MapKit": [ + "sdk/hms/ets/kits/@kit.MapKit.d.ts" + ], + "@kit.ShareKit": [ + "sdk/hms/ets/kits/@kit.ShareKit.d.ts" + ], + "@kit.PreviewKit": [ + "sdk/hms/ets/kits/@kit.PreviewKit.d.ts" + ], + "@kit.PaymentKit": [ + "sdk/hms/ets/kits/@kit.PaymentKit.d.ts" + ], + "@kit.ServiceCollaborationKit": [ + "sdk/hms/ets/kits/@kit.ServiceCollaborationKit.d.ts" + ], + "@kit.CloudFoundationKit": [ + "sdk/hms/ets/kits/@kit.CloudFoundationKit.d.ts" + ], + "@kit.DeviceSecurityKit": [ + "sdk/hms/ets/kits/@kit.DeviceSecurityKit.d.ts" + ], + "@kit.NaturalLanguageKit": [ + "sdk/hms/ets/kits/@kit.NaturalLanguageKit.d.ts" + ], + "@kit.LiveViewKit": [ + "sdk/hms/ets/kits/@kit.LiveViewKit.d.ts" + ], + "@kit.PushKit": [ + "sdk/hms/ets/kits/@kit.PushKit.d.ts" + ], + "@kit.OnlineAuthenticationKit": [ + "sdk/hms/ets/kits/@kit.OnlineAuthenticationKit.d.ts" + ], + "@kit.Penkit": [ + "sdk/hms/ets/kits/@kit.Penkit.d.ts" + ], + "@kit.EnterpriseDataGuardKit": [ + "sdk/hms/ets/kits/@kit.EnterpriseDataGuardKit.d.ts" + ], + "@kit.ScenarioFusionKit": [ + "sdk/hms/ets/kits/@kit.ScenarioFusionKit.d.ts" + ], + "@kit.HealthServiceKit": [ + "sdk/hms/ets/kits/@kit.HealthServiceKit.d.ts" + ], + "@kit.PDFKit": [ + "sdk/hms/ets/kits/@kit.PDFKit.d.ts" + ], + "@kit.AccountKit": [ + "sdk/hms/ets/kits/@kit.AccountKit.d.ts" + ], + "@hms.ai.face.faceDetector": [ + "sdk/hms/ets/api/@hms.ai.face.faceDetector.d.ts" + ], + "@hms.health.store": [ + "sdk/hms/ets/api/@hms.health.store.d.ts" + ], + "@hms.core.appgalleryservice.updateManager": [ + "sdk/hms/ets/api/@hms.core.appgalleryservice.updateManager.d.ts" + ], + "@hms.telephony.voipCall": [ + "sdk/hms/ets/api/@hms.telephony.voipCall.d.ts" + ], + "@hms.core.map.mapCommon": [ + "sdk/hms/ets/api/@hms.core.map.mapCommon.d.ts" + ], + "@hms.collaboration.devicePicker": [ + "sdk/hms/ets/api/@hms.collaboration.devicePicker.d.ts" + ], + "@hms.core.account.shippingAddress": [ + "sdk/hms/ets/api/@hms.core.account.shippingAddress.d.ts" + ], + "@hms.security.ifaa": [ + "sdk/hms/ets/api/@hms.security.ifaa.d.ts" + ], + "@hms.security.trustedAppService": [ + "sdk/hms/ets/api/@hms.security.trustedAppService.d.ts" + ], + "@hms.core.map.site": [ + "sdk/hms/ets/api/@hms.core.map.site.d.ts" + ], + "@hms.ai.textReader": [ + "sdk/hms/ets/api/@hms.ai.textReader.d.ets" + ], + "@hms.core.map.sceneMap": [ + "sdk/hms/ets/api/@hms.core.map.sceneMap.d.ts" + ], + "@hms.ai.textToSpeech": [ + "sdk/hms/ets/api/@hms.ai.textToSpeech.d.ts" + ], + "@hms.pcService.statusBarManager": [ + "sdk/hms/ets/api/@hms.pcService.statusBarManager.d.ts" + ], + "@hms.stylus.HandwriteComponent": [ + "sdk/hms/ets/api/@hms.stylus.HandwriteComponent.d.ets" + ], + "@hms.core.account.realname": [ + "sdk/hms/ets/api/@hms.core.account.realname.d.ts" + ], + "@hms.stylus.handwrite": [ + "sdk/hms/ets/api/@hms.stylus.handwrite.d.ts" + ], + "@hms.core.account.LoginComponent": [ + "sdk/hms/ets/api/@hms.core.account.LoginComponent.d.ets" + ], + "@hms.core.appgalleryservice.attributionManager": [ + "sdk/hms/ets/api/@hms.core.appgalleryservice.attributionManager.d.ts" + ], + "@hms.core.scan.customScan": [ + "sdk/hms/ets/api/@hms.core.scan.customScan.d.ts" + ], + "@hms.core.push.serviceNotification": [ + "sdk/hms/ets/api/@hms.core.push.serviceNotification.d.ts" + ], + "@hms.core.iap": [ + "sdk/hms/ets/api/@hms.core.iap.d.ts" + ], + "@hms.carService.navigationInfoMgr": [ + "sdk/hms/ets/api/@hms.carService.navigationInfoMgr.d.ts" + ], + "@hms.core.scan.detectBarcode": [ + "sdk/hms/ets/api/@hms.core.scan.detectBarcode.d.ts" + ], + "@hms.core.deviceCloudGateway.cloudFunction": [ + "sdk/hms/ets/api/@hms.core.deviceCloudGateway.cloudFunction.d.ts" + ], + "@hms.collaboration.CollaborationDevicePicker": [ + "sdk/hms/ets/api/@hms.collaboration.CollaborationDevicePicker.d.ets" + ], + "@hms.core.appgalleryservice.productViewManager": [ + "sdk/hms/ets/api/@hms.core.appgalleryservice.productViewManager.d.ts" + ], + "@hms.core.account.minorsProtection": [ + "sdk/hms/ets/api/@hms.core.account.minorsProtection.d.ts" + ], + "@hms.ai.CardRecognition": [ + "sdk/hms/ets/api/@hms.ai.CardRecognition.d.ets" + ], + "@hms.core.liveview.LiveViewLockScreenExtensionAbility": [ + "sdk/hms/ets/api/@hms.core.liveview.LiveViewLockScreenExtensionAbility.d.ts" + ], + "@hms.core.map.navi": [ + "sdk/hms/ets/api/@hms.core.map.navi.d.ts" + ], + "@hms.pcService.StatusBarViewExtensionAbility": [ + "sdk/hms/ets/api/@hms.pcService.StatusBarViewExtensionAbility.d.ts" + ], + "@hms.core.scan.scanBarcode": [ + "sdk/hms/ets/api/@hms.core.scan.scanBarcode.d.ts" + ], + "@hms.core.authentication": [ + "sdk/hms/ets/api/@hms.core.authentication.d.ts" + ], + "@hms.ai.vision.subjectSegmentation": [ + "sdk/hms/ets/api/@hms.ai.vision.subjectSegmentation.d.ts" + ], + "@hms.core.map.map": [ + "sdk/hms/ets/api/@hms.core.map.map.d.ts" + ], + "@hms.bundle.sceneManager": [ + "sdk/hms/ets/api/@hms.bundle.sceneManager.d.ts" + ], + "@hms.core.payment.walletTransitCard": [ + "sdk/hms/ets/api/@hms.core.payment.walletTransitCard.d.ts" + ], + "@hms.core.atomicserviceComponent.atomicserviceUi": [ + "sdk/hms/ets/api/@hms.core.atomicserviceComponent.atomicserviceUi.d.ets" + ], + "@hms.core.deviceCloudGateway.cloudCommon": [ + "sdk/hms/ets/api/@hms.core.deviceCloudGateway.cloudCommon.d.ts" + ], + "@hms.ai.face.faceComparator": [ + "sdk/hms/ets/api/@hms.ai.face.faceComparator.d.ts" + ], + "@hms.health.service": [ + "sdk/hms/ets/api/@hms.health.service.d.ts" + ], + "@hms.core.push.pushService": [ + "sdk/hms/ets/api/@hms.core.push.pushService.d.ts" + ], + "@hms.core.account.invoiceAssistant": [ + "sdk/hms/ets/api/@hms.core.account.invoiceAssistant.d.ts" + ], + "@hms.ai.insightIntent": [ + "sdk/hms/ets/api/@hms.ai.insightIntent.d.ts" + ], + "@hms.core.payment.walletPass": [ + "sdk/hms/ets/api/@hms.core.payment.walletPass.d.ts" + ], + "@hms.core.liveview.LiveViewLockScreenExtensionContext": [ + "sdk/hms/ets/api/@hms.core.liveview.LiveViewLockScreenExtensionContext.d.ts" + ], + "@hms.collaboration.systemShare": [ + "sdk/hms/ets/api/@hms.collaboration.systemShare.d.ts" + ], + "@hms.core.scan.generateBarcode": [ + "sdk/hms/ets/api/@hms.core.scan.generateBarcode.d.ts" + ], + "@hms.core.gameservice.gameperformance": [ + "sdk/hms/ets/api/@hms.core.gameservice.gameperformance.d.ts" + ], + "@hms.global.taboo": [ + "sdk/hms/ets/api/@hms.global.taboo.d.ts" + ], + "@hms.ai.nlp.textProcessing": [ + "sdk/hms/ets/api/@hms.ai.nlp.textProcessing.d.ts" + ], + "@hms.collaboration.service": [ + "sdk/hms/ets/api/@hms.collaboration.service.d.ets" + ], + "@hms.core.push.RemoteNotificationExtensionAbility": [ + "sdk/hms/ets/api/@hms.core.push.RemoteNotificationExtensionAbility.d.ts" + ], + "@hms.ai.interactiveLiveness": [ + "sdk/hms/ets/api/@hms.ai.interactiveLiveness.d.ts" + ], + "@hms.ai.ocr.textRecognition": [ + "sdk/hms/ets/api/@hms.ai.ocr.textRecognition.d.ts" + ], + "@hms.collaboration.camera": [ + "sdk/hms/ets/api/@hms.collaboration.camera.d.ets" + ], + "@hms.core.scan.scanCore": [ + "sdk/hms/ets/api/@hms.core.scan.scanCore.d.ts" + ], + "@hms.core.gameservice.gameplayer": [ + "sdk/hms/ets/api/@hms.core.gameservice.gameplayer.d.ts" + ], + "@hms.security.safetyDetect": [ + "sdk/hms/ets/api/@hms.security.safetyDetect.d.ts" + ], + "@hms.core.atomicserviceComponent.atomicservice": [ + "sdk/hms/ets/api/@hms.core.atomicserviceComponent.atomicservice.d.ets" + ], + "@hms.core.appgalleryservice.attributionTestManager": [ + "sdk/hms/ets/api/@hms.core.appgalleryservice.attributionTestManager.d.ts" + ], + "@hms.ai.DocumentScanner": [ + "sdk/hms/ets/api/@hms.ai.DocumentScanner.d.ets" + ], + "@hms.core.AAID": [ + "sdk/hms/ets/api/@hms.core.AAID.d.ts" + ], + "@hms.security.fido": [ + "sdk/hms/ets/api/@hms.security.fido.d.ts" + ], + "@hms.core.payment.paymentService": [ + "sdk/hms/ets/api/@hms.core.payment.paymentService.d.ts" + ], + "@hms.core.map.MapComponent": [ + "sdk/hms/ets/api/@hms.core.map.MapComponent.d.ets" + ], + "@hms.core.push.RemoteNotificationExtensionContext": [ + "sdk/hms/ets/api/@hms.core.push.RemoteNotificationExtensionContext.d.ts" + ], + "@hms.collaboration.rcp": [ + "sdk/hms/ets/api/@hms.collaboration.rcp.d.ts" + ], + "@hms.pcService.fileGuard": [ + "sdk/hms/ets/api/@hms.pcService.fileGuard.d.ts" + ], + "@hms.core.appgalleryservice.moduleInstallManager": [ + "sdk/hms/ets/api/@hms.core.appgalleryservice.moduleInstallManager.d.ts" + ], + "@hms.core.push.VoIPExtensionContext": [ + "sdk/hms/ets/api/@hms.core.push.VoIPExtensionContext.d.ts" + ], + "@hms.core.push.RemoteLocationExtensionAbility": [ + "sdk/hms/ets/api/@hms.core.push.RemoteLocationExtensionAbility.d.ts" + ], + "@hms.core.deviceCloudGateway.cloudStorage": [ + "sdk/hms/ets/api/@hms.core.deviceCloudGateway.cloudStorage.d.ts" + ], + "@hms.filemanagement.filepreview": [ + "sdk/hms/ets/api/@hms.filemanagement.filepreview.d.ts" + ], + "@hms.core.push.PushExtensionContext": [ + "sdk/hms/ets/api/@hms.core.push.PushExtensionContext.d.ts" + ], + "@hms.security.deviceCertificate": [ + "sdk/hms/ets/api/@hms.security.deviceCertificate.d.ts" + ], + "@hms.ai.speechRecognizer": [ + "sdk/hms/ets/api/@hms.ai.speechRecognizer.d.ts" + ], + "@hms.core.push.pushCommon": [ + "sdk/hms/ets/api/@hms.core.push.pushCommon.d.ts" + ], + "@hms.officeservice.pdfservice": [ + "sdk/hms/ets/api/@hms.officeservice.pdfservice.d.ts" + ], + "@hms.core.push.PushExtensionAbility": [ + "sdk/hms/ets/api/@hms.core.push.PushExtensionAbility.d.ts" + ], + "@hms.core.deviceCloudGateway.cloudDatabase": [ + "sdk/hms/ets/api/@hms.core.deviceCloudGateway.cloudDatabase.d.ts" + ], + "@hms.core.account.extendservice": [ + "sdk/hms/ets/api/@hms.core.account.extendservice.d.ts" + ], + "@hms.core.map.staticMap": [ + "sdk/hms/ets/api/@hms.core.map.staticMap.d.ts" + ], + "@hms.core.push.RemoteLocationExtensionContext": [ + "sdk/hms/ets/api/@hms.core.push.RemoteLocationExtensionContext.d.ts" + ], + "@hms.core.liveview.liveViewManager": [ + "sdk/hms/ets/api/@hms.core.liveview.liveViewManager.d.ts" + ], + "@hms.core.push.VoIPExtensionAbility": [ + "sdk/hms/ets/api/@hms.core.push.VoIPExtensionAbility.d.ts" + ], + "@arkts.math.Decimal": [ + "sdk/openharmony/ets/arkts/@arkts.math.Decimal.d.ets" + ], + "@arkts.lang": [ + "sdk/openharmony/ets/arkts/@arkts.lang.d.ets" + ], + "@arkts.collections": [ + "sdk/openharmony/ets/arkts/@arkts.collections.d.ets" + ], + "@arkts.utils": [ + "sdk/openharmony/ets/arkts/@arkts.utils.d.ets" + ], + "@kit.AVSessionKit": [ + "sdk/openharmony/ets/kits/@kit.AVSessionKit.d.ts" + ], + "@kit.ArkTS": [ + "sdk/openharmony/ets/kits/@kit.ArkTS.d.ts" + ], + "@kit.ArkGraphics3D": [ + "sdk/openharmony/ets/kits/@kit.ArkGraphics3D.d.ts" + ], + "@kit.CoreFileKit": [ + "sdk/openharmony/ets/kits/@kit.CoreFileKit.d.ts" + ], + "@kit.ConnectivityKit": [ + "sdk/openharmony/ets/kits/@kit.ConnectivityKit.d.ts" + ], + "@kit.ContactsKit": [ + "sdk/openharmony/ets/kits/@kit.ContactsKit.d.ts" + ], + "@kit.CryptoArchitectureKit": [ + "sdk/openharmony/ets/kits/@kit.CryptoArchitectureKit.d.ts" + ], + "@kit.ArkData": [ + "sdk/openharmony/ets/kits/@kit.ArkData.d.ts" + ], + "@kit.PerformanceAnalysisKit": [ + "sdk/openharmony/ets/kits/@kit.PerformanceAnalysisKit.d.ts" + ], + "@kit.UniversalKeystoreKit": [ + "sdk/openharmony/ets/kits/@kit.UniversalKeystoreKit.d.ts" + ], + "@kit.MediaLibraryKit": [ + "sdk/openharmony/ets/kits/@kit.MediaLibraryKit.d.ts" + ], + "@kit.UserAuthenticationKit": [ + "sdk/openharmony/ets/kits/@kit.UserAuthenticationKit.d.ts" + ], + "@kit.ArkGraphics2D": [ + "sdk/openharmony/ets/kits/@kit.ArkGraphics2D.d.ts" + ], + "@kit.DistributedServiceKit": [ + "sdk/openharmony/ets/kits/@kit.DistributedServiceKit.d.ts" + ], + "@kit.AdsKit": [ + "sdk/openharmony/ets/kits/@kit.AdsKit.d.ts" + ], + "@kit.LocationKit": [ + "sdk/openharmony/ets/kits/@kit.LocationKit.d.ts" + ], + "@kit.DataLossPreventionKit": [ + "sdk/openharmony/ets/kits/@kit.DataLossPreventionKit.d.ts" + ], + "@kit.IMEKit": [ + "sdk/openharmony/ets/kits/@kit.IMEKit.d.ts" + ], + "@kit.DrmKit": [ + "sdk/openharmony/ets/kits/@kit.DrmKit.d.ts" + ], + "@kit.NetworkKit": [ + "sdk/openharmony/ets/kits/@kit.NetworkKit.d.ts" + ], + "@kit.DeviceCertificateKit": [ + "sdk/openharmony/ets/kits/@kit.DeviceCertificateKit.d.ts" + ], + "@kit.InputKit": [ + "sdk/openharmony/ets/kits/@kit.InputKit.d.ts" + ], + "@kit.IPCKit": [ + "sdk/openharmony/ets/kits/@kit.IPCKit.d.ts" + ], + "@kit.ArkWeb": [ + "sdk/openharmony/ets/kits/@kit.ArkWeb.d.ts" + ], + "@kit.CalendarKit": [ + "sdk/openharmony/ets/kits/@kit.CalendarKit.d.ts" + ], + "@kit.MDMKit": [ + "sdk/openharmony/ets/kits/@kit.MDMKit.d.ts" + ], + "@kit.BasicServicesKit": [ + "sdk/openharmony/ets/kits/@kit.BasicServicesKit.d.ts" + ], + "@kit.TelephonyKit": [ + "sdk/openharmony/ets/kits/@kit.TelephonyKit.d.ts" + ], + "@kit.MindSporeLiteKit": [ + "sdk/openharmony/ets/kits/@kit.MindSporeLiteKit.d.ts" + ], + "@kit.MultimodalAwarenessKit": [ + "sdk/openharmony/ets/kits/@kit.MultimodalAwarenessKit.d.ts" + ], + "@kit.BackgroundTasksKit": [ + "sdk/openharmony/ets/kits/@kit.BackgroundTasksKit.d.ts" + ], + "@kit.FormKit": [ + "sdk/openharmony/ets/kits/@kit.FormKit.d.ts" + ], + "@kit.NotificationKit": [ + "sdk/openharmony/ets/kits/@kit.NotificationKit.d.ts" + ], + "@kit.SensorServiceKit": [ + "sdk/openharmony/ets/kits/@kit.SensorServiceKit.d.ts" + ], + "@kit.ImageKit": [ + "sdk/openharmony/ets/kits/@kit.ImageKit.d.ts" + ], + "@kit.AudioKit": [ + "sdk/openharmony/ets/kits/@kit.AudioKit.d.ts" + ], + "@kit.TestKit": [ + "sdk/openharmony/ets/kits/@kit.TestKit.d.ts" + ], + "@kit.ArkUI": [ + "sdk/openharmony/ets/kits/@kit.ArkUI.d.ts" + ], + "@kit.AccessibilityKit": [ + "sdk/openharmony/ets/kits/@kit.AccessibilityKit.d.ts" + ], + "@kit.AssetStoreKit": [ + "sdk/openharmony/ets/kits/@kit.AssetStoreKit.d.ts" + ], + "@kit.AbilityKit": [ + "sdk/openharmony/ets/kits/@kit.AbilityKit.d.ts" + ], + "@kit.DriverDevelopmentKit": [ + "sdk/openharmony/ets/kits/@kit.DriverDevelopmentKit.d.ts" + ], + "@kit.MediaKit": [ + "sdk/openharmony/ets/kits/@kit.MediaKit.d.ts" + ], + "@kit.LocalizationKit": [ + "sdk/openharmony/ets/kits/@kit.LocalizationKit.d.ts" + ], + "@kit.CameraKit": [ + "sdk/openharmony/ets/kits/@kit.CameraKit.d.ts" + ], + "@ohos.wifiext": [ + "sdk/openharmony/ets/api/@ohos.wifiext.d.ts" + ], + "@ohos.arkui.advanced.SelectTitleBar": [ + "sdk/openharmony/ets/api/@ohos.arkui.advanced.SelectTitleBar.d.ets" + ], + "@ohos.app.ability.autoFillManager": [ + "sdk/openharmony/ets/api/@ohos.app.ability.autoFillManager.d.ts" + ], + "@ohos.multimedia.media": [ + "sdk/openharmony/ets/api/@ohos.multimedia.media.d.ts" + ], + "@ohos.data.commonType": [ + "sdk/openharmony/ets/api/@ohos.data.commonType.d.ts" + ], + "@ohos.arkui.observer": [ + "sdk/openharmony/ets/api/@ohos.arkui.observer.d.ts" + ], + "@ohos.deviceInfo": [ + "sdk/openharmony/ets/api/@ohos.deviceInfo.d.ts" + ], + "@ohos.enterprise.wifiManager": [ + "sdk/openharmony/ets/api/@ohos.enterprise.wifiManager.d.ts" + ], + "@ohos.reminderAgent": [ + "sdk/openharmony/ets/api/@ohos.reminderAgent.d.ts" + ], + "@ohos.web.netErrorList": [ + "sdk/openharmony/ets/api/@ohos.web.netErrorList.d.ts" + ], + "@ohos.application.formError": [ + "sdk/openharmony/ets/api/@ohos.application.formError.d.ts" + ], + "@ohos.data.relationalStore": [ + "sdk/openharmony/ets/api/@ohos.data.relationalStore.d.ts" + ], + "@ohos.batteryInfo": [ + "sdk/openharmony/ets/api/@ohos.batteryInfo.d.ts" + ], + "@ohos.nfc.cardEmulation": [ + "sdk/openharmony/ets/api/@ohos.nfc.cardEmulation.d.ts" + ], + "@ohos.animator": [ + "sdk/openharmony/ets/api/@ohos.animator.d.ts" + ], + "@ohos.arkui.advanced.EditableTitleBar": [ + "sdk/openharmony/ets/api/@ohos.arkui.advanced.EditableTitleBar.d.ets" + ], + "@ohos.net.networkSecurity": [ + "sdk/openharmony/ets/api/@ohos.net.networkSecurity.d.ts" + ], + "@system.prompt": [ + "sdk/openharmony/ets/api/@system.prompt.d.ts" + ], + "@system.storage": [ + "sdk/openharmony/ets/api/@system.storage.d.ts" + ], + "@ohos.connectedTag": [ + "sdk/openharmony/ets/api/@ohos.connectedTag.d.ts" + ], + "@ohos.inputMethodEngine": [ + "sdk/openharmony/ets/api/@ohos.inputMethodEngine.d.ts" + ], + "@ohos.enterprise.locationManager": [ + "sdk/openharmony/ets/api/@ohos.enterprise.locationManager.d.ts" + ], + "@ohos.enterprise.usbManager": [ + "sdk/openharmony/ets/api/@ohos.enterprise.usbManager.d.ts" + ], + "@ohos.graphics.scene": [ + "sdk/openharmony/ets/api/@ohos.graphics.scene.d.ts" + ], + "@system.device": [ + "sdk/openharmony/ets/api/@system.device.d.ts" + ], + "@ohos.bluetooth.map": [ + "sdk/openharmony/ets/api/@ohos.bluetooth.map.d.ts" + ], + "@ohos.settings": [ + "sdk/openharmony/ets/api/@ohos.settings.d.ts" + ], + "@ohos.telephony.sim": [ + "sdk/openharmony/ets/api/@ohos.telephony.sim.d.ts" + ], + "@ohos.data.ValuesBucket": [ + "sdk/openharmony/ets/api/@ohos.data.ValuesBucket.d.ts" + ], + "@system.notification": [ + "sdk/openharmony/ets/api/@system.notification.d.ts" + ], + "@ohos.bundle.bundleManager": [ + "sdk/openharmony/ets/api/@ohos.bundle.bundleManager.d.ts" + ], + "@ohos.bytrace": [ + "sdk/openharmony/ets/api/@ohos.bytrace.d.ts" + ], + "@ohos.bluetooth.hid": [ + "sdk/openharmony/ets/api/@ohos.bluetooth.hid.d.ts" + ], + "@ohos.arkui.advanced.GridObjectSortComponent": [ + "sdk/openharmony/ets/api/@ohos.arkui.advanced.GridObjectSortComponent.d.ets" + ], + "@ohos.inputMethodList": [ + "sdk/openharmony/ets/api/@ohos.inputMethodList.d.ets" + ], + "@ohos.net.mdns": [ + "sdk/openharmony/ets/api/@ohos.net.mdns.d.ts" + ], + "@ohos.arkui.advanced.Chip": [ + "sdk/openharmony/ets/api/@ohos.arkui.advanced.Chip.d.ets" + ], + "@ohos.telephony.radio": [ + "sdk/openharmony/ets/api/@ohos.telephony.radio.d.ts" + ], + "@ohos.app.form.FormExtensionAbility": [ + "sdk/openharmony/ets/api/@ohos.app.form.FormExtensionAbility.d.ts" + ], + "@ohos.enterprise.applicationManager": [ + "sdk/openharmony/ets/api/@ohos.enterprise.applicationManager.d.ts" + ], + "@ohos.bundleState": [ + "sdk/openharmony/ets/api/@ohos.bundleState.d.ts" + ], + "@ohos.arkui.uiExtension": [ + "sdk/openharmony/ets/api/@ohos.arkui.uiExtension.d.ts" + ], + "@ohos.arkui.advanced.ToolBar": [ + "sdk/openharmony/ets/api/@ohos.arkui.advanced.ToolBar.d.ets" + ], + "@ohos.net.socket": [ + "sdk/openharmony/ets/api/@ohos.net.socket.d.ts" + ], + "@ohos.UiTest": [ + "sdk/openharmony/ets/api/@ohos.UiTest.d.ts" + ], + "@ohos.display": [ + "sdk/openharmony/ets/api/@ohos.display.d.ts" + ], + "@ohos.bluetooth.ble": [ + "sdk/openharmony/ets/api/@ohos.bluetooth.ble.d.ts" + ], + "@ohos.telephony.observer": [ + "sdk/openharmony/ets/api/@ohos.telephony.observer.d.ts" + ], + "@ohos.wifiManagerExt": [ + "sdk/openharmony/ets/api/@ohos.wifiManagerExt.d.ts" + ], + "@ohos.app.ability.ShareExtensionAbility": [ + "sdk/openharmony/ets/api/@ohos.app.ability.ShareExtensionAbility.d.ts" + ], + "@ohos.abilityAccessCtrl": [ + "sdk/openharmony/ets/api/@ohos.abilityAccessCtrl.d.ts" + ], + "@ohos.ability.particleAbility": [ + "sdk/openharmony/ets/api/@ohos.ability.particleAbility.d.ts" + ], + "@ohos.advertising.AdComponent": [ + "sdk/openharmony/ets/api/@ohos.advertising.AdComponent.d.ets" + ], + "@ohos.telephony.data": [ + "sdk/openharmony/ets/api/@ohos.telephony.data.d.ts" + ], + "@ohos.arkui.advanced.SegmentButton": [ + "sdk/openharmony/ets/api/@ohos.arkui.advanced.SegmentButton.d.ets" + ], + "@ohos.app.ability.EmbeddedUIExtensionAbility": [ + "sdk/openharmony/ets/api/@ohos.app.ability.EmbeddedUIExtensionAbility.d.ts" + ], + "@ohos.multimodalInput.touchEvent": [ + "sdk/openharmony/ets/api/@ohos.multimodalInput.touchEvent.d.ts" + ], + "@ohos.util.Vector": [ + "sdk/openharmony/ets/api/@ohos.util.Vector.d.ts" + ], + "@ohos.application.uriPermissionManager": [ + "sdk/openharmony/ets/api/@ohos.application.uriPermissionManager.d.ts" + ], + "@ohos.bluetooth.pbap": [ + "sdk/openharmony/ets/api/@ohos.bluetooth.pbap.d.ts" + ], + "@ohos.graphics.drawing": [ + "sdk/openharmony/ets/api/@ohos.graphics.drawing.d.ts" + ], + "@ohos.router": [ + "sdk/openharmony/ets/api/@ohos.router.d.ts" + ], + "@ohos.account.appAccount": [ + "sdk/openharmony/ets/api/@ohos.account.appAccount.d.ts" + ], + "@ohos.ability.wantConstant": [ + "sdk/openharmony/ets/api/@ohos.ability.wantConstant.d.ts" + ], + "@system.battery": [ + "sdk/openharmony/ets/api/@system.battery.d.ts" + ], + "@ohos.file.fs": [ + "sdk/openharmony/ets/api/@ohos.file.fs.d.ts" + ], + "@ohos.file.environment": [ + "sdk/openharmony/ets/api/@ohos.file.environment.d.ts" + ], + "@ohos.app.form.formProvider": [ + "sdk/openharmony/ets/api/@ohos.app.form.formProvider.d.ts" + ], + "@ohos.file.fileAccess": [ + "sdk/openharmony/ets/api/@ohos.file.fileAccess.d.ts" + ], + "@ohos.multimodalInput.keyCode": [ + "sdk/openharmony/ets/api/@ohos.multimodalInput.keyCode.d.ts" + ], + "@ohos.arkui.advanced.TabTitleBar": [ + "sdk/openharmony/ets/api/@ohos.arkui.advanced.TabTitleBar.d.ets" + ], + "@ohos.net.webSocket": [ + "sdk/openharmony/ets/api/@ohos.net.webSocket.d.ts" + ], + "@ohos.telephony.vcard": [ + "sdk/openharmony/ets/api/@ohos.telephony.vcard.d.ts" + ], + "@ohos.app.form.formInfo": [ + "sdk/openharmony/ets/api/@ohos.app.form.formInfo.d.ts" + ], + "@ohos.multimodalInput.inputEvent": [ + "sdk/openharmony/ets/api/@ohos.multimodalInput.inputEvent.d.ts" + ], + "@ohos.data.cloudData": [ + "sdk/openharmony/ets/api/@ohos.data.cloudData.d.ts" + ], + "@ohos.arkui.advanced.ComposeListItem": [ + "sdk/openharmony/ets/api/@ohos.arkui.advanced.ComposeListItem.d.ets" + ], + "@ohos.arkui.advanced.ComposeTitleBar": [ + "sdk/openharmony/ets/api/@ohos.arkui.advanced.ComposeTitleBar.d.ets" + ], + "@ohos.account.osAccount": [ + "sdk/openharmony/ets/api/@ohos.account.osAccount.d.ts" + ], + "@ohos.net.http": [ + "sdk/openharmony/ets/api/@ohos.net.http.d.ts" + ], + "@ohos.security.huks": [ + "sdk/openharmony/ets/api/@ohos.security.huks.d.ts" + ], + "@ohos.arkui.dragController": [ + "sdk/openharmony/ets/api/@ohos.arkui.dragController.d.ts" + ], + "@ohos.app.ability.contextConstant": [ + "sdk/openharmony/ets/api/@ohos.app.ability.contextConstant.d.ts" + ], + "@ohos.multimodalInput.infraredEmitter": [ + "sdk/openharmony/ets/api/@ohos.multimodalInput.infraredEmitter.d.ts" + ], + "@ohos.security.asset": [ + "sdk/openharmony/ets/api/@ohos.security.asset.d.ts" + ], + "@ohos.data.preferences": [ + "sdk/openharmony/ets/api/@ohos.data.preferences.d.ts" + ], + "@ohos.application.BackupExtensionAbility": [ + "sdk/openharmony/ets/api/@ohos.application.BackupExtensionAbility.d.ts" + ], + "@ohos.stationary": [ + "sdk/openharmony/ets/api/@ohos.stationary.d.ts" + ], + "@ohos.window": [ + "sdk/openharmony/ets/api/@ohos.window.d.ts" + ], + "@ohos.bluetooth.socket": [ + "sdk/openharmony/ets/api/@ohos.bluetooth.socket.d.ts" + ], + "@ohos.backgroundTaskManager": [ + "sdk/openharmony/ets/api/@ohos.backgroundTaskManager.d.ts" + ], + "@ohos.multimedia.audioHaptic": [ + "sdk/openharmony/ets/api/@ohos.multimedia.audioHaptic.d.ts" + ], + "@ohos.measure": [ + "sdk/openharmony/ets/api/@ohos.measure.d.ts" + ], + "@ohos.file.storageStatistics": [ + "sdk/openharmony/ets/api/@ohos.file.storageStatistics.d.ts" + ], + "@ohos.resourceschedule.systemload": [ + "sdk/openharmony/ets/api/@ohos.resourceschedule.systemload.d.ts" + ], + "@ohos.fileshare": [ + "sdk/openharmony/ets/api/@ohos.fileshare.d.ts" + ], + "@ohos.runningLock": [ + "sdk/openharmony/ets/api/@ohos.runningLock.d.ts" + ], + "@ohos.application.testRunner": [ + "sdk/openharmony/ets/api/@ohos.application.testRunner.d.ts" + ], + "@ohos.arkui.advanced.TreeView": [ + "sdk/openharmony/ets/api/@ohos.arkui.advanced.TreeView.d.ets" + ], + "@ohos.arkui.advanced.FormMenu": [ + "sdk/openharmony/ets/api/@ohos.arkui.advanced.FormMenu.d.ets" + ], + "@ohos.app.ability.wantAgent": [ + "sdk/openharmony/ets/api/@ohos.app.ability.wantAgent.d.ts" + ], + "@ohos.hiviewdfx.hiAppEvent": [ + "sdk/openharmony/ets/api/@ohos.hiviewdfx.hiAppEvent.d.ts" + ], + "@ohos.app.ability.AbilityLifecycleCallback": [ + "sdk/openharmony/ets/api/@ohos.app.ability.AbilityLifecycleCallback.d.ts" + ], + "@ohos.privacyManager": [ + "sdk/openharmony/ets/api/@ohos.privacyManager.d.ts" + ], + "@ohos.app.ability.UIAbility": [ + "sdk/openharmony/ets/api/@ohos.app.ability.UIAbility.d.ts" + ], + "@ohos.enterprise.browser": [ + "sdk/openharmony/ets/api/@ohos.enterprise.browser.d.ts" + ], + "@ohos.wifiManager": [ + "sdk/openharmony/ets/api/@ohos.wifiManager.d.ts" + ], + "@ohos.hilog": [ + "sdk/openharmony/ets/api/@ohos.hilog.d.ts" + ], + "@system.fetch": [ + "sdk/openharmony/ets/api/@system.fetch.d.ts" + ], + "@ohos.bundle.defaultAppManager": [ + "sdk/openharmony/ets/api/@ohos.bundle.defaultAppManager.d.ts" + ], + "@system.bluetooth": [ + "sdk/openharmony/ets/api/@system.bluetooth.d.ts" + ], + "@ohos.security.cert": [ + "sdk/openharmony/ets/api/@ohos.security.cert.d.ts" + ], + "@ohos.PiPWindow": [ + "sdk/openharmony/ets/api/@ohos.PiPWindow.d.ts" + ], + "@ohos.uri": [ + "sdk/openharmony/ets/api/@ohos.uri.d.ts" + ], + "@ohos.hichecker": [ + "sdk/openharmony/ets/api/@ohos.hichecker.d.ts" + ], + "@ohos.app.ability.insightIntent": [ + "sdk/openharmony/ets/api/@ohos.app.ability.insightIntent.d.ts" + ], + "@ohos.multimedia.movingphotoview": [ + "sdk/openharmony/ets/api/@ohos.multimedia.movingphotoview.d.ts" + ], + "@ohos.notification": [ + "sdk/openharmony/ets/api/@ohos.notification.d.ts" + ], + "@ohos.enterprise.bluetoothManager": [ + "sdk/openharmony/ets/api/@ohos.enterprise.bluetoothManager.d.ts" + ], + "@ohos.accessibility.GesturePath": [ + "sdk/openharmony/ets/api/@ohos.accessibility.GesturePath.d.ts" + ], + "@ohos.application.formProvider": [ + "sdk/openharmony/ets/api/@ohos.application.formProvider.d.ts" + ], + "@ohos.arkui.advanced.SubHeader": [ + "sdk/openharmony/ets/api/@ohos.arkui.advanced.SubHeader.d.ets" + ], + "@ohos.security.cryptoFramework": [ + "sdk/openharmony/ets/api/@ohos.security.cryptoFramework.d.ts" + ], + "@ohos.multimodalInput.inputDeviceCooperate": [ + "sdk/openharmony/ets/api/@ohos.multimodalInput.inputDeviceCooperate.d.ts" + ], + "@ohos.xml": [ + "sdk/openharmony/ets/api/@ohos.xml.d.ts" + ], + "@ohos.multimodalInput.mouseEvent": [ + "sdk/openharmony/ets/api/@ohos.multimodalInput.mouseEvent.d.ts" + ], + "@ohos.screenshot": [ + "sdk/openharmony/ets/api/@ohos.screenshot.d.ts" + ], + "@ohos.arkui.advanced.SwipeRefresher": [ + "sdk/openharmony/ets/api/@ohos.arkui.advanced.SwipeRefresher.d.ets" + ], + "@ohos.wifi": [ + "sdk/openharmony/ets/api/@ohos.wifi.d.ts" + ], + "@system.sensor": [ + "sdk/openharmony/ets/api/@system.sensor.d.ts" + ], + "@system.configuration": [ + "sdk/openharmony/ets/api/@system.configuration.d.ts" + ], + "@ohos.data.distributedData": [ + "sdk/openharmony/ets/api/@ohos.data.distributedData.d.ts" + ], + "@ohos.util.Queue": [ + "sdk/openharmony/ets/api/@ohos.util.Queue.d.ts" + ], + "@ohos.net.policy": [ + "sdk/openharmony/ets/api/@ohos.net.policy.d.ts" + ], + "@ohos.graphics.sendableColorSpaceManager": [ + "sdk/openharmony/ets/api/@ohos.graphics.sendableColorSpaceManager.d.ets" + ], + "@ohos.arkui.UIContext": [ + "sdk/openharmony/ets/api/@ohos.arkui.UIContext.d.ts" + ], + "@ohos.data.distributedKVStore": [ + "sdk/openharmony/ets/api/@ohos.data.distributedKVStore.d.ts" + ], + "@ohos.multimedia.audio": [ + "sdk/openharmony/ets/api/@ohos.multimedia.audio.d.ts" + ], + "@ohos.telephony.sms": [ + "sdk/openharmony/ets/api/@ohos.telephony.sms.d.ts" + ], + "@ohos.data.cloudExtension": [ + "sdk/openharmony/ets/api/@ohos.data.cloudExtension.d.ts" + ], + "@system.network": [ + "sdk/openharmony/ets/api/@system.network.d.ts" + ], + "@ohos.util.HashMap": [ + "sdk/openharmony/ets/api/@ohos.util.HashMap.d.ts" + ], + "@ohos.enterprise.systemManager": [ + "sdk/openharmony/ets/api/@ohos.enterprise.systemManager.d.ts" + ], + "@ohos.i18n": [ + "sdk/openharmony/ets/api/@ohos.i18n.d.ts" + ], + "@ohos.net.connection": [ + "sdk/openharmony/ets/api/@ohos.net.connection.d.ts" + ], + "@ohos.arkui.advanced.ExceptionPrompt": [ + "sdk/openharmony/ets/api/@ohos.arkui.advanced.ExceptionPrompt.d.ets" + ], + "@ohos.InputMethodExtensionAbility": [ + "sdk/openharmony/ets/api/@ohos.InputMethodExtensionAbility.d.ts" + ], + "@ohos.multimodalInput.intentionCode": [ + "sdk/openharmony/ets/api/@ohos.multimodalInput.intentionCode.d.ts" + ], + "@ohos.usb": [ + "sdk/openharmony/ets/api/@ohos.usb.d.ts" + ], + "@ohos.sendableResourceManager": [ + "sdk/openharmony/ets/api/@ohos.sendableResourceManager.d.ets" + ], + "@ohos.request": [ + "sdk/openharmony/ets/api/@ohos.request.d.ts" + ], + "@ohos.app.ability.ConfigurationConstant": [ + "sdk/openharmony/ets/api/@ohos.app.ability.ConfigurationConstant.d.ts" + ], + "@system.mediaquery": [ + "sdk/openharmony/ets/api/@system.mediaquery.d.ts" + ], + "@ohos.resourceschedule.usageStatistics": [ + "sdk/openharmony/ets/api/@ohos.resourceschedule.usageStatistics.d.ts" + ], + "@ohos.fileio": [ + "sdk/openharmony/ets/api/@ohos.fileio.d.ts" + ], + "@ohos.data.uniformTypeDescriptor": [ + "sdk/openharmony/ets/api/@ohos.data.uniformTypeDescriptor.d.ts" + ], + "@ohos.app.appstartup.StartupConfig": [ + "sdk/openharmony/ets/api/@ohos.app.appstartup.StartupConfig.d.ts" + ], + "@ohos.arkui.advanced.FullScreenLaunchComponent": [ + "sdk/openharmony/ets/api/@ohos.arkui.advanced.FullScreenLaunchComponent.d.ets" + ], + "@ohos.nfc.controller": [ + "sdk/openharmony/ets/api/@ohos.nfc.controller.d.ts" + ], + "@ohos.bundle.overlay": [ + "sdk/openharmony/ets/api/@ohos.bundle.overlay.d.ts" + ], + "@ohos.app.appstartup.startupManager": [ + "sdk/openharmony/ets/api/@ohos.app.appstartup.startupManager.d.ts" + ], + "@ohos.net.statistics": [ + "sdk/openharmony/ets/api/@ohos.net.statistics.d.ts" + ], + "@ohos.InputMethodExtensionContext": [ + "sdk/openharmony/ets/api/@ohos.InputMethodExtensionContext.d.ts" + ], + "@ohos.print": [ + "sdk/openharmony/ets/api/@ohos.print.d.ts" + ], + "@ohos.promptAction": [ + "sdk/openharmony/ets/api/@ohos.promptAction.d.ts" + ], + "@ohos.pasteboard": [ + "sdk/openharmony/ets/api/@ohos.pasteboard.d.ts" + ], + "@ohos.data.unifiedDataChannel": [ + "sdk/openharmony/ets/api/@ohos.data.unifiedDataChannel.d.ts" + ], + "@ohos.resourceschedule.workScheduler": [ + "sdk/openharmony/ets/api/@ohos.resourceschedule.workScheduler.d.ts" + ], + "@ohos.systemTime": [ + "sdk/openharmony/ets/api/@ohos.systemTime.d.ts" + ], + "@ohos.multimedia.sendableImage": [ + "sdk/openharmony/ets/api/@ohos.multimedia.sendableImage.d.ets" + ], + "@system.file": [ + "sdk/openharmony/ets/api/@system.file.d.ts" + ], + "@ohos.enterprise.deviceInfo": [ + "sdk/openharmony/ets/api/@ohos.enterprise.deviceInfo.d.ts" + ], + "@ohos.app.ability.UIExtensionAbility": [ + "sdk/openharmony/ets/api/@ohos.app.ability.UIExtensionAbility.d.ts" + ], + "@ohos.ability.dataUriUtils": [ + "sdk/openharmony/ets/api/@ohos.ability.dataUriUtils.d.ts" + ], + "@ohos.bluetooth": [ + "sdk/openharmony/ets/api/@ohos.bluetooth.d.ts" + ], + "@ohos.arkui.advanced.SplitLayout": [ + "sdk/openharmony/ets/api/@ohos.arkui.advanced.SplitLayout.d.ets" + ], + "@ohos.app.ability.appManager": [ + "sdk/openharmony/ets/api/@ohos.app.ability.appManager.d.ts" + ], + "@system.vibrator": [ + "sdk/openharmony/ets/api/@system.vibrator.d.ts" + ], + "@ohos.multimodalInput.pointer": [ + "sdk/openharmony/ets/api/@ohos.multimodalInput.pointer.d.ts" + ], + "@ohos.pluginComponent": [ + "sdk/openharmony/ets/api/@ohos.pluginComponent.d.ts" + ], + "@ohos.arkui.componentUtils": [ + "sdk/openharmony/ets/api/@ohos.arkui.componentUtils.d.ts" + ], + "@ohos.app.ability.InsightIntentExecutor": [ + "sdk/openharmony/ets/api/@ohos.app.ability.InsightIntentExecutor.d.ts" + ], + "@ohos.hiTraceMeter": [ + "sdk/openharmony/ets/api/@ohos.hiTraceMeter.d.ts" + ], + "@system.package": [ + "sdk/openharmony/ets/api/@system.package.d.ts" + ], + "@ohos.file.securityLabel": [ + "sdk/openharmony/ets/api/@ohos.file.securityLabel.d.ts" + ], + "@ohos.ability.ability": [ + "sdk/openharmony/ets/api/@ohos.ability.ability.d.ts" + ], + "@ohos.screenLock": [ + "sdk/openharmony/ets/api/@ohos.screenLock.d.ts" + ], + "@ohos.usbManager": [ + "sdk/openharmony/ets/api/@ohos.usbManager.d.ts" + ], + "@ohos.net.sharing": [ + "sdk/openharmony/ets/api/@ohos.net.sharing.d.ts" + ], + "@ohos.multimedia.image": [ + "sdk/openharmony/ets/api/@ohos.multimedia.image.d.ts" + ], + "@ohos.data.dataSharePredicates": [ + "sdk/openharmony/ets/api/@ohos.data.dataSharePredicates.d.ts" + ], + "@ohos.multimedia.avCastPickerParam": [ + "sdk/openharmony/ets/api/@ohos.multimedia.avCastPickerParam.d.ts" + ], + "@ohos.application.ConfigurationConstant": [ + "sdk/openharmony/ets/api/@ohos.application.ConfigurationConstant.d.ts" + ], + "@ohos.util.LightWeightMap": [ + "sdk/openharmony/ets/api/@ohos.util.LightWeightMap.d.ts" + ], + "@ohos.matrix4": [ + "sdk/openharmony/ets/api/@ohos.matrix4.d.ts" + ], + "@ohos.util.TreeMap": [ + "sdk/openharmony/ets/api/@ohos.util.TreeMap.d.ts" + ], + "@ohos.font": [ + "sdk/openharmony/ets/api/@ohos.font.d.ts" + ], + "@ohos.app.ability.EnvironmentCallback": [ + "sdk/openharmony/ets/api/@ohos.app.ability.EnvironmentCallback.d.ts" + ], + "@ohos.app.ability.ChildProcess": [ + "sdk/openharmony/ets/api/@ohos.app.ability.ChildProcess.d.ts" + ], + "@ohos.net.vpnExtension": [ + "sdk/openharmony/ets/api/@ohos.net.vpnExtension.d.ts" + ], + "@ohos.file.PhotoPickerComponent": [ + "sdk/openharmony/ets/api/@ohos.file.PhotoPickerComponent.d.ets" + ], + "@ohos.app.ability.abilityDelegatorRegistry": [ + "sdk/openharmony/ets/api/@ohos.app.ability.abilityDelegatorRegistry.d.ts" + ], + "@ohos.ai.mindSporeLite": [ + "sdk/openharmony/ets/api/@ohos.ai.mindSporeLite.d.ts" + ], + "@ohos.application.abilityDelegatorRegistry": [ + "sdk/openharmony/ets/api/@ohos.application.abilityDelegatorRegistry.d.ts" + ], + "@ohos.enterprise.deviceControl": [ + "sdk/openharmony/ets/api/@ohos.enterprise.deviceControl.d.ts" + ], + "@ohos.bluetoothManager": [ + "sdk/openharmony/ets/api/@ohos.bluetoothManager.d.ts" + ], + "@ohos.resourceschedule.deviceStandby": [ + "sdk/openharmony/ets/api/@ohos.resourceschedule.deviceStandby.d.ts" + ], + "@ohos.advertising.AutoAdComponent": [ + "sdk/openharmony/ets/api/@ohos.advertising.AutoAdComponent.d.ets" + ], + "@ohos.application.Configuration": [ + "sdk/openharmony/ets/api/@ohos.application.Configuration.d.ts" + ], + "@ohos.arkui.advanced.ChipGroup": [ + "sdk/openharmony/ets/api/@ohos.arkui.advanced.ChipGroup.d.ets" + ], + "@ohos.util.Deque": [ + "sdk/openharmony/ets/api/@ohos.util.Deque.d.ts" + ], + "@ohos.util.LinkedList": [ + "sdk/openharmony/ets/api/@ohos.util.LinkedList.d.ts" + ], + "@ohos.ability.errorCode": [ + "sdk/openharmony/ets/api/@ohos.ability.errorCode.d.ts" + ], + "@ohos.app.ability.ApplicationStateChangeCallback": [ + "sdk/openharmony/ets/api/@ohos.app.ability.ApplicationStateChangeCallback.d.ts" + ], + "@ohos.util.LightWeightSet": [ + "sdk/openharmony/ets/api/@ohos.util.LightWeightSet.d.ts" + ], + "@ohos.app.ability.dataUriUtils": [ + "sdk/openharmony/ets/api/@ohos.app.ability.dataUriUtils.d.ts" + ], + "@ohos.util.TreeSet": [ + "sdk/openharmony/ets/api/@ohos.util.TreeSet.d.ts" + ], + "@ohos.advertising.AdsServiceExtensionAbility": [ + "sdk/openharmony/ets/api/@ohos.advertising.AdsServiceExtensionAbility.d.ts" + ], + "@ohos.enterprise.EnterpriseAdminExtensionAbility": [ + "sdk/openharmony/ets/api/@ohos.enterprise.EnterpriseAdminExtensionAbility.d.ts" + ], + "@ohos.app.appstartup.StartupListener": [ + "sdk/openharmony/ets/api/@ohos.app.appstartup.StartupListener.d.ts" + ], + "@ohos.accessibility.GesturePoint": [ + "sdk/openharmony/ets/api/@ohos.accessibility.GesturePoint.d.ts" + ], + "@ohos.application.formBindingData": [ + "sdk/openharmony/ets/api/@ohos.application.formBindingData.d.ts" + ], + "@ohos.geolocation": [ + "sdk/openharmony/ets/api/@ohos.geolocation.d.ts" + ], + "@ohos.multimedia.cameraPicker": [ + "sdk/openharmony/ets/api/@ohos.multimedia.cameraPicker.d.ts" + ], + "@ohos.app.ability.InsightIntentContext": [ + "sdk/openharmony/ets/api/@ohos.app.ability.InsightIntentContext.d.ts" + ], + "@ohos.app.ability.AbilityConstant": [ + "sdk/openharmony/ets/api/@ohos.app.ability.AbilityConstant.d.ts" + ], + "@ohos.app.ability.appRecovery": [ + "sdk/openharmony/ets/api/@ohos.app.ability.appRecovery.d.ts" + ], + "@system.router": [ + "sdk/openharmony/ets/api/@system.router.d.ts" + ], + "@ohos.bluetooth.hfp": [ + "sdk/openharmony/ets/api/@ohos.bluetooth.hfp.d.ts" + ], + "@ohos.multimedia.avsession": [ + "sdk/openharmony/ets/api/@ohos.multimedia.avsession.d.ts" + ], + "@ohos.enterprise.adminManager": [ + "sdk/openharmony/ets/api/@ohos.enterprise.adminManager.d.ts" + ], + "@ohos.worker": [ + "sdk/openharmony/ets/api/@ohos.worker.d.ts" + ], + "@ohos.bluetooth.pan": [ + "sdk/openharmony/ets/api/@ohos.bluetooth.pan.d.ts" + ], + "@ohos.inputMethod": [ + "sdk/openharmony/ets/api/@ohos.inputMethod.d.ts" + ], + "@ohos.arkui.advanced.Dialog": [ + "sdk/openharmony/ets/api/@ohos.arkui.advanced.Dialog.d.ets" + ], + "@ohos.security.certManager": [ + "sdk/openharmony/ets/api/@ohos.security.certManager.d.ts" + ], + "@ohos.app.appstartup.StartupTask": [ + "sdk/openharmony/ets/api/@ohos.app.appstartup.StartupTask.d.ets" + ], + "@ohos.web.webview": [ + "sdk/openharmony/ets/api/@ohos.web.webview.d.ts" + ], + "@ohos.app.ability.dialogRequest": [ + "sdk/openharmony/ets/api/@ohos.app.ability.dialogRequest.d.ts" + ], + "@ohos.reminderAgentManager": [ + "sdk/openharmony/ets/api/@ohos.reminderAgentManager.d.ts" + ], + "@ohos.bluetooth.baseProfile": [ + "sdk/openharmony/ets/api/@ohos.bluetooth.baseProfile.d.ts" + ], + "@ohos.hiAppEvent": [ + "sdk/openharmony/ets/api/@ohos.hiAppEvent.d.ts" + ], + "@ohos.bundle": [ + "sdk/openharmony/ets/api/@ohos.bundle.d.ts" + ], + "@ohos.app.ability.EmbeddableUIAbility": [ + "sdk/openharmony/ets/api/@ohos.app.ability.EmbeddableUIAbility.d.ts" + ], + "@ohos.accessibility": [ + "sdk/openharmony/ets/api/@ohos.accessibility.d.ts" + ], + "@ohos.arkui.advanced.DownloadFileButton": [ + "sdk/openharmony/ets/api/@ohos.arkui.advanced.DownloadFileButton.d.ets" + ], + "@ohos.driver.deviceManager": [ + "sdk/openharmony/ets/api/@ohos.driver.deviceManager.d.ts" + ], + "@ohos.arkui.advanced.Counter": [ + "sdk/openharmony/ets/api/@ohos.arkui.advanced.Counter.d.ets" + ], + "@ohos.graphics.text": [ + "sdk/openharmony/ets/api/@ohos.graphics.text.d.ts" + ], + "@ohos.InputMethodSubtype": [ + "sdk/openharmony/ets/api/@ohos.InputMethodSubtype.d.ts" + ], + "@ohos.app.ability.OpenLinkOptions": [ + "sdk/openharmony/ets/api/@ohos.app.ability.OpenLinkOptions.d.ts" + ], + "@ohos.arkui.advanced.Popup": [ + "sdk/openharmony/ets/api/@ohos.arkui.advanced.Popup.d.ets" + ], + "@ohos.util.stream": [ + "sdk/openharmony/ets/api/@ohos.util.stream.d.ts" + ], + "@ohos.commonEventManager": [ + "sdk/openharmony/ets/api/@ohos.commonEventManager.d.ts" + ], + "@ohos.contact": [ + "sdk/openharmony/ets/api/@ohos.contact.d.ts" + ], + "@ohos.file.fileuri": [ + "sdk/openharmony/ets/api/@ohos.file.fileuri.d.ts" + ], + "@ohos.util.HashSet": [ + "sdk/openharmony/ets/api/@ohos.util.HashSet.d.ts" + ], + "@ohos.document": [ + "sdk/openharmony/ets/api/@ohos.document.d.ts" + ], + "@ohos.wantAgent": [ + "sdk/openharmony/ets/api/@ohos.wantAgent.d.ts" + ], + "@ohos.multimedia.avVolumePanel": [ + "sdk/openharmony/ets/api/@ohos.multimedia.avVolumePanel.d.ets" + ], + "@ohos.app.ability.Ability": [ + "sdk/openharmony/ets/api/@ohos.app.ability.Ability.d.ts" + ], + "@ohos.graphics.displaySync": [ + "sdk/openharmony/ets/api/@ohos.graphics.displaySync.d.ts" + ], + "@ohos.process": [ + "sdk/openharmony/ets/api/@ohos.process.d.ts" + ], + "@ohos.bluetooth.a2dp": [ + "sdk/openharmony/ets/api/@ohos.bluetooth.a2dp.d.ts" + ], + "@ohos.util.PlainArray": [ + "sdk/openharmony/ets/api/@ohos.util.PlainArray.d.ts" + ], + "@ohos.zlib": [ + "sdk/openharmony/ets/api/@ohos.zlib.d.ts" + ], + "@ohos.app.ability.UIExtensionContentSession": [ + "sdk/openharmony/ets/api/@ohos.app.ability.UIExtensionContentSession.d.ts" + ], + "@ohos.app.appstartup.StartupConfigEntry": [ + "sdk/openharmony/ets/api/@ohos.app.appstartup.StartupConfigEntry.d.ts" + ], + "@ohos.distributedHardware.deviceManager": [ + "sdk/openharmony/ets/api/@ohos.distributedHardware.deviceManager.d.ts" + ], + "@ohos.bluetooth.connection": [ + "sdk/openharmony/ets/api/@ohos.bluetooth.connection.d.ts" + ], + "@ohos.app.ability.errorManager": [ + "sdk/openharmony/ets/api/@ohos.app.ability.errorManager.d.ts" + ], + "@ohos.resourceschedule.backgroundTaskManager": [ + "sdk/openharmony/ets/api/@ohos.resourceschedule.backgroundTaskManager.d.ts" + ], + "@ohos.systemDateTime": [ + "sdk/openharmony/ets/api/@ohos.systemDateTime.d.ts" + ], + "@ohos.deviceAttest": [ + "sdk/openharmony/ets/api/@ohos.deviceAttest.d.ts" + ], + "@ohos.prompt": [ + "sdk/openharmony/ets/api/@ohos.prompt.d.ts" + ], + "@ohos.app.ability.StartOptions": [ + "sdk/openharmony/ets/api/@ohos.app.ability.StartOptions.d.ts" + ], + "@ohos.enterprise.bundleManager": [ + "sdk/openharmony/ets/api/@ohos.enterprise.bundleManager.d.ts" + ], + "@ohos.hiTraceChain": [ + "sdk/openharmony/ets/api/@ohos.hiTraceChain.d.ts" + ], + "@ohos.arkui.advanced.SelectionMenu": [ + "sdk/openharmony/ets/api/@ohos.arkui.advanced.SelectionMenu.d.ets" + ], + "@ohos.identifier.oaid": [ + "sdk/openharmony/ets/api/@ohos.identifier.oaid.d.ts" + ], + "@ohos.WorkSchedulerExtensionAbility": [ + "sdk/openharmony/ets/api/@ohos.WorkSchedulerExtensionAbility.d.ts" + ], + "@ohos.convertxml": [ + "sdk/openharmony/ets/api/@ohos.convertxml.d.ts" + ], + "@ohos.ability.featureAbility": [ + "sdk/openharmony/ets/api/@ohos.ability.featureAbility.d.ts" + ], + "@ohos.multimedia.drm": [ + "sdk/openharmony/ets/api/@ohos.multimedia.drm.d.ts" + ], + "@ohos.graphics.hdrCapability": [ + "sdk/openharmony/ets/api/@ohos.graphics.hdrCapability.d.ts" + ], + "@ohos.arkui.advanced.Filter": [ + "sdk/openharmony/ets/api/@ohos.arkui.advanced.Filter.d.ets" + ], + "@ohos.hidebug": [ + "sdk/openharmony/ets/api/@ohos.hidebug.d.ts" + ], + "@ohos.thermal": [ + "sdk/openharmony/ets/api/@ohos.thermal.d.ts" + ], + "@ohos.file.picker": [ + "sdk/openharmony/ets/api/@ohos.file.picker.d.ts" + ], + "@ohos.app.ability.DriverExtensionAbility": [ + "sdk/openharmony/ets/api/@ohos.app.ability.DriverExtensionAbility.d.ts" + ], + "@system.cipher": [ + "sdk/openharmony/ets/api/@system.cipher.d.ts" + ], + "@ohos.power": [ + "sdk/openharmony/ets/api/@ohos.power.d.ts" + ], + "@ohos.advertising": [ + "sdk/openharmony/ets/api/@ohos.advertising.d.ts" + ], + "@ohos.application.appManager": [ + "sdk/openharmony/ets/api/@ohos.application.appManager.d.ts" + ], + "@ohos.arkui.drawableDescriptor": [ + "sdk/openharmony/ets/api/@ohos.arkui.drawableDescriptor.d.ts" + ], + "@ohos.app.ability.Configuration": [ + "sdk/openharmony/ets/api/@ohos.app.ability.Configuration.d.ts" + ], + "@ohos.multimedia.avCastPicker": [ + "sdk/openharmony/ets/api/@ohos.multimedia.avCastPicker.d.ets" + ], + "@ohos.app.ability.AbilityStage": [ + "sdk/openharmony/ets/api/@ohos.app.ability.AbilityStage.d.ts" + ], + "@ohos.util.Stack": [ + "sdk/openharmony/ets/api/@ohos.util.Stack.d.ts" + ], + "@ohos.faultLogger": [ + "sdk/openharmony/ets/api/@ohos.faultLogger.d.ts" + ], + "@ohos.app.ability.ExtensionAbility": [ + "sdk/openharmony/ets/api/@ohos.app.ability.ExtensionAbility.d.ts" + ], + "@ohos.statfs": [ + "sdk/openharmony/ets/api/@ohos.statfs.d.ts" + ], + "@ohos.file.AlbumPickerComponent": [ + "sdk/openharmony/ets/api/@ohos.file.AlbumPickerComponent.d.ets" + ], + "@ohos.base": [ + "sdk/openharmony/ets/api/@ohos.base.d.ts" + ], + "@ohos.events.emitter": [ + "sdk/openharmony/ets/api/@ohos.events.emitter.d.ts" + ], + "@ohos.multimedia.mediaLibrary": [ + "sdk/openharmony/ets/api/@ohos.multimedia.mediaLibrary.d.ts" + ], + "@ohos.bluetooth.access": [ + "sdk/openharmony/ets/api/@ohos.bluetooth.access.d.ts" + ], + "@ohos.app.ability.VpnExtensionAbility": [ + "sdk/openharmony/ets/api/@ohos.app.ability.VpnExtensionAbility.d.ts" + ], + "@ohos.rpc": [ + "sdk/openharmony/ets/api/@ohos.rpc.d.ts" + ], + "@ohos.arkui.theme": [ + "sdk/openharmony/ets/api/@ohos.arkui.theme.d.ts" + ], + "@ohos.vibrator": [ + "sdk/openharmony/ets/api/@ohos.vibrator.d.ts" + ], + "@ohos.dlpPermission": [ + "sdk/openharmony/ets/api/@ohos.dlpPermission.d.ts" + ], + "@ohos.intl": [ + "sdk/openharmony/ets/api/@ohos.intl.d.ts" + ], + "@ohos.file.BackupExtensionContext": [ + "sdk/openharmony/ets/api/@ohos.file.BackupExtensionContext.d.ts" + ], + "@ohos.file.statvfs": [ + "sdk/openharmony/ets/api/@ohos.file.statvfs.d.ts" + ], + "@ohos.calendarManager": [ + "sdk/openharmony/ets/api/@ohos.calendarManager.d.ts" + ], + "@ohos.data.distributedDataObject": [ + "sdk/openharmony/ets/api/@ohos.data.distributedDataObject.d.ts" + ], + "@ohos.data.rdb": [ + "sdk/openharmony/ets/api/@ohos.data.rdb.d.ts" + ], + "@ohos.util": [ + "sdk/openharmony/ets/api/@ohos.util.d.ts" + ], + "@ohos.userIAM.userAuth": [ + "sdk/openharmony/ets/api/@ohos.userIAM.userAuth.d.ts" + ], + "@ohos.arkui.inspector": [ + "sdk/openharmony/ets/api/@ohos.arkui.inspector.d.ts" + ], + "@ohos.bluetooth.constant": [ + "sdk/openharmony/ets/api/@ohos.bluetooth.constant.d.ts" + ], + "@ohos.data.uniformDataStruct": [ + "sdk/openharmony/ets/api/@ohos.data.uniformDataStruct.d.ts" + ], + "@ohos.userIAM.userAuthIcon": [ + "sdk/openharmony/ets/api/@ohos.userIAM.userAuthIcon.d.ets" + ], + "@ohos.app.ability.childProcessManager": [ + "sdk/openharmony/ets/api/@ohos.app.ability.childProcessManager.d.ts" + ], + "@ohos.multimedia.camera": [ + "sdk/openharmony/ets/api/@ohos.multimedia.camera.d.ts" + ], + "@ohos.app.ability.wantConstant": [ + "sdk/openharmony/ets/api/@ohos.app.ability.wantConstant.d.ts" + ], + "@ohos.buffer": [ + "sdk/openharmony/ets/api/@ohos.buffer.d.ts" + ], + "@ohos.arkui.modifier": [ + "sdk/openharmony/ets/api/@ohos.arkui.modifier.d.ts" + ], + "@ohos.enterprise.deviceSettings": [ + "sdk/openharmony/ets/api/@ohos.enterprise.deviceSettings.d.ts" + ], + "@ohos.file.cloudSync": [ + "sdk/openharmony/ets/api/@ohos.file.cloudSync.d.ts" + ], + "@ohos.taskpool": [ + "sdk/openharmony/ets/api/@ohos.taskpool.d.ts" + ], + "@ohos.graphics.colorSpaceManager": [ + "sdk/openharmony/ets/api/@ohos.graphics.colorSpaceManager.d.ts" + ], + "@ohos.application.formInfo": [ + "sdk/openharmony/ets/api/@ohos.application.formInfo.d.ts" + ], + "@ohos.application.Want": [ + "sdk/openharmony/ets/api/@ohos.application.Want.d.ts" + ], + "@ohos.wallpaper": [ + "sdk/openharmony/ets/api/@ohos.wallpaper.d.ts" + ], + "@ohos.mediaquery": [ + "sdk/openharmony/ets/api/@ohos.mediaquery.d.ts" + ], + "@ohos.continuation.continuationManager": [ + "sdk/openharmony/ets/api/@ohos.continuation.continuationManager.d.ts" + ], + "@ohos.enterprise.networkManager": [ + "sdk/openharmony/ets/api/@ohos.enterprise.networkManager.d.ts" + ], + "@ohos.data.storage": [ + "sdk/openharmony/ets/api/@ohos.data.storage.d.ts" + ], + "@ohos.effectKit": [ + "sdk/openharmony/ets/api/@ohos.effectKit.d.ts" + ], + "@ohos.sensor": [ + "sdk/openharmony/ets/api/@ohos.sensor.d.ts" + ], + "@ohos.telephony.call": [ + "sdk/openharmony/ets/api/@ohos.telephony.call.d.ts" + ], + "@ohos.multimodalInput.keyEvent": [ + "sdk/openharmony/ets/api/@ohos.multimodalInput.keyEvent.d.ts" + ], + "@ohos.net.vpn": [ + "sdk/openharmony/ets/api/@ohos.net.vpn.d.ts" + ], + "@ohos.enterprise.securityManager": [ + "sdk/openharmony/ets/api/@ohos.enterprise.securityManager.d.ts" + ], + "@ohos.url": [ + "sdk/openharmony/ets/api/@ohos.url.d.ts" + ], + "@ohos.file.hash": [ + "sdk/openharmony/ets/api/@ohos.file.hash.d.ts" + ], + "@ohos.resourceManager": [ + "sdk/openharmony/ets/api/@ohos.resourceManager.d.ts" + ], + "@system.app": [ + "sdk/openharmony/ets/api/@system.app.d.ts" + ], + "@ohos.nfc.tag": [ + "sdk/openharmony/ets/api/@ohos.nfc.tag.d.ts" + ], + "@ohos.multimodalInput.gestureEvent": [ + "sdk/openharmony/ets/api/@ohos.multimodalInput.gestureEvent.d.ts" + ], + "@ohos.notificationManager": [ + "sdk/openharmony/ets/api/@ohos.notificationManager.d.ts" + ], + "@ohos.inputMethod.Panel": [ + "sdk/openharmony/ets/api/@ohos.inputMethod.Panel.d.ts" + ], + "@ohos.app.ability.common": [ + "sdk/openharmony/ets/api/@ohos.app.ability.common.d.ts" + ], + "@system.brightness": [ + "sdk/openharmony/ets/api/@system.brightness.d.ts" + ], + "@system.request": [ + "sdk/openharmony/ets/api/@system.request.d.ts" + ], + "@ohos.net.ethernet": [ + "sdk/openharmony/ets/api/@ohos.net.ethernet.d.ts" + ], + "@ohos.util.ArrayList": [ + "sdk/openharmony/ets/api/@ohos.util.ArrayList.d.ts" + ], + "@ohos.file.photoAccessHelper": [ + "sdk/openharmony/ets/api/@ohos.file.photoAccessHelper.d.ts" + ], + "@ohos.util.json": [ + "sdk/openharmony/ets/api/@ohos.util.json.d.ts" + ], + "@ohos.enterprise.accountManager": [ + "sdk/openharmony/ets/api/@ohos.enterprise.accountManager.d.ts" + ], + "@ohos.geoLocationManager": [ + "sdk/openharmony/ets/api/@ohos.geoLocationManager.d.ts" + ], + "@ohos.arkui.componentSnapshot": [ + "sdk/openharmony/ets/api/@ohos.arkui.componentSnapshot.d.ts" + ], + "@ohos.app.ability.AtomicServiceOptions": [ + "sdk/openharmony/ets/api/@ohos.app.ability.AtomicServiceOptions.d.ts" + ], + "@ohos.bluetooth.wearDetection": [ + "sdk/openharmony/ets/api/@ohos.bluetooth.wearDetection.d.ts" + ], + "@ohos.app.ability.Want": [ + "sdk/openharmony/ets/api/@ohos.app.ability.Want.d.ts" + ], + "@ohos.commonEvent": [ + "sdk/openharmony/ets/api/@ohos.commonEvent.d.ts" + ], + "@system.geolocation": [ + "sdk/openharmony/ets/api/@system.geolocation.d.ts" + ], + "@ohos.app.ability.ActionExtensionAbility": [ + "sdk/openharmony/ets/api/@ohos.app.ability.ActionExtensionAbility.d.ts" + ], + "@ohos.app.form.formBindingData": [ + "sdk/openharmony/ets/api/@ohos.app.form.formBindingData.d.ts" + ], + "@ohos.graphics.common2D": [ + "sdk/openharmony/ets/api/@ohos.graphics.common2D.d.ts" + ], + "@ohos.arkui.node": [ + "sdk/openharmony/ets/api/@ohos.arkui.node.d.ts" + ], + "@ohos.data.dataAbility": [ + "sdk/openharmony/ets/api/@ohos.data.dataAbility.d.ts" + ], + "@ohos.curves": [ + "sdk/openharmony/ets/api/@ohos.curves.d.ts" + ], + "@ohos.data.sendablePreferences": [ + "sdk/openharmony/ets/api/@ohos.data.sendablePreferences.d.ets" + ], + "@ohos.application.AccessibilityExtensionAbility": [ + "sdk/openharmony/ets/api/@ohos.application.AccessibilityExtensionAbility.d.ts" + ], + "@ohos.file.cloudSyncManager": [ + "sdk/openharmony/ets/api/@ohos.file.cloudSyncManager.d.ts" + ], + "@ohos.util.List": [ + "sdk/openharmony/ets/api/@ohos.util.List.d.ts" + ], + "@ohos.enterprise.restrictions": [ + "sdk/openharmony/ets/api/@ohos.enterprise.restrictions.d.ts" + ], + "@ohos.distributedDeviceManager": [ + "sdk/openharmony/ets/api/@ohos.distributedDeviceManager.d.ts" + ], + "@ohos.account.distributedAccount": [ + "sdk/openharmony/ets/api/@ohos.account.distributedAccount.d.ts" + ], + "@ohos.secureElement": [ + "sdk/openharmony/ets/api/@ohos.secureElement.d.ts" + ], + "@ohos.multimodalInput.inputDevice": [ + "sdk/openharmony/ets/api/@ohos.multimodalInput.inputDevice.d.ts" + ], + "@ohos.userIAM.faceAuth": [ + "sdk/openharmony/ets/api/@ohos.userIAM.faceAuth.d.ts" + ], + "@ohos.arkui.shape": [ + "sdk/openharmony/ets/api/@ohos.arkui.shape.d.ts" + ], + "@ohos.arkui.advanced.ProgressButton": [ + "sdk/openharmony/ets/api/@ohos.arkui.advanced.ProgressButton.d.ets" + ] +} \ No newline at end of file diff --git a/language/arkts/extractor/schema.prisma b/language/arkts/extractor/schema.prisma new file mode 100644 index 00000000..43075d4c --- /dev/null +++ b/language/arkts/extractor/schema.prisma @@ -0,0 +1,1917 @@ +// Generated from `er.puml` + +datasource db { + provider = "sqlite" + url = "file:init.db" +} + +generator client { + provider = "prisma-client-js" + binaryTargets = ["darwin", "darwin-arm64", "debian-openssl-1.0.x", "debian-openssl-1.1.x", "debian-openssl-3.0.x", "rhel-openssl-1.0.x", "rhel-openssl-1.1.x", "rhel-openssl-3.0.x"] +} + + +model location { + id BigInt @id + file_id BigInt + start Int + start_line Int + start_column Int + end Int + end_line Int + end_column Int +} + +model text { + id BigInt @id + text String +} + +model number_of_lines { + id BigInt @id + lines Int + code_lines Int + comment_lines Int +} + +model file { + id BigInt @id + location_id BigInt + parent_id BigInt + name String + extension String + relative_path String +} + +model root_directory { + id BigInt @id + relative_path String +} + +model non_root_directory { + id BigInt @id + name String + relative_path String + parent_id BigInt +} + +model ast_node { + id BigInt @id + kind Int + parent_id BigInt + parent_kind Int + index Int + location_id BigInt +} + +model dot_token { + id BigInt @id +} + +model dot_dot_dot_token { + id BigInt @id +} + +model comma_token { + id BigInt @id +} + +model question_dot_token { + id BigInt @id +} + +model less_than_token { + id BigInt @id +} + +model greater_than_token { + id BigInt @id +} + +model less_than_equals_token { + id BigInt @id +} + +model greater_than_equals_token { + id BigInt @id +} + +model equals_equals_token { + id BigInt @id +} + +model exclamation_equals_token { + id BigInt @id +} + +model equals_equals_equals_token { + id BigInt @id +} + +model exclamation_equals_equals_token { + id BigInt @id +} + +model equals_greater_than_token { + id BigInt @id +} + +model plus_token { + id BigInt @id +} + +model minus_token { + id BigInt @id +} + +model asterisk_token { + id BigInt @id +} + +model asterisk_asterisk_token { + id BigInt @id +} + +model slash_token { + id BigInt @id +} + +model percent_token { + id BigInt @id +} + +model plus_plus_token { + id BigInt @id +} + +model minus_minus_token { + id BigInt @id +} + +model less_than_less_than_token { + id BigInt @id +} + +model greater_than_greater_than_token { + id BigInt @id +} + +model greater_than_greater_than_greater_than_token { + id BigInt @id +} + +model ampersand_token { + id BigInt @id +} + +model bar_token { + id BigInt @id +} + +model caret_token { + id BigInt @id +} + +model exclamation_token { + id BigInt @id +} + +model tilde_token { + id BigInt @id +} + +model ampersand_ampersand_token { + id BigInt @id +} + +model bar_bar_token { + id BigInt @id +} + +model question_token { + id BigInt @id +} + +model colon_token { + id BigInt @id +} + +model question_question_token { + id BigInt @id +} + +model equals_token { + id BigInt @id +} + +model plus_equals_token { + id BigInt @id +} + +model minus_equals_token { + id BigInt @id +} + +model asterisk_equals_token { + id BigInt @id +} + +model asterisk_asterisk_equals_token { + id BigInt @id +} + +model slash_equals_token { + id BigInt @id +} + +model percent_equals_token { + id BigInt @id +} + +model less_than_less_than_equals_token { + id BigInt @id +} + +model greater_than_greater_than_equals_token { + id BigInt @id +} + +model greater_than_greater_than_greater_than_equals_token { + id BigInt @id +} + +model ampersand_equals_token { + id BigInt @id +} + +model bar_equals_token { + id BigInt @id +} + +model bar_bar_equals_token { + id BigInt @id +} + +model ampersand_ampersand_equals_token { + id BigInt @id +} + +model question_question_equals_token { + id BigInt @id +} + +model caret_equals_token { + id BigInt @id +} + +model const_keyword { + id BigInt @id +} + +model default_keyword { + id BigInt @id +} + +model export_keyword { + id BigInt @id +} + +model extends_keyword { + id BigInt @id +} + +model import_keyword { + id BigInt @id +} + +model in_keyword { + id BigInt @id +} + +model instance_of_keyword { + id BigInt @id +} + +model new_keyword { + id BigInt @id +} + +model implements_keyword { + id BigInt @id +} + +model private_keyword { + id BigInt @id +} + +model protected_keyword { + id BigInt @id +} + +model public_keyword { + id BigInt @id +} + +model static_keyword { + id BigInt @id +} + +model abstract_keyword { + id BigInt @id +} + +model accessor_keyword { + id BigInt @id +} + +model asserts_keyword { + id BigInt @id +} + +model assert_keyword { + id BigInt @id +} + +model async_keyword { + id BigInt @id +} + +model await_keyword { + id BigInt @id +} + +model declare_keyword { + id BigInt @id +} + +model key_of_keyword { + id BigInt @id +} + +model out_keyword { + id BigInt @id +} + +model readonly_keyword { + id BigInt @id +} + +model unique_keyword { + id BigInt @id +} + +model override_keyword { + id BigInt @id +} + +model declaration { + id BigInt @id + kind Int +} + +model declaration_name_node { + declaration_id BigInt @id + name_node_id BigInt +} + +model expression { + id BigInt @id + kind Int +} + +model unary_expression { + id BigInt @id + kind Int +} + +model update_expression { + id BigInt @id + kind Int +} + +model left_hand_side_expression { + id BigInt @id + kind Int +} + +model member_expression { + id BigInt @id + kind Int +} + +model primary_expression { + id BigInt @id + kind Int +} + +model null_literal { + id BigInt @id +} + +model true_literal { + id BigInt @id +} + +model false_literal { + id BigInt @id +} + +model literal_like_node { + id BigInt @id + kind Int + value String +} + +model literal_expression { + id BigInt @id + kind Int +} + +model numeric_literal { + id BigInt @id + flags Int +} + +model big_int_literal { + id BigInt @id +} + +model string_literal { + id BigInt @id + single_quote Boolean +} + +model regular_expression_literal { + id BigInt @id +} + +model template_literal_like_node { + id BigInt @id + kind Int + raw_text String +} + +model no_substitution_template_literal { + id BigInt @id +} + +model template_head { + id BigInt @id +} + +model template_middle { + id BigInt @id +} + +model template_tail { + id BigInt @id +} + +model template_span { + id BigInt @id + parent_id BigInt + index Int + expression_id BigInt + literal_id BigInt +} + +model modifier { + id BigInt @id + kind Int + parent_id BigInt + parent_kind Int + index Int +} + +model identifier { + id BigInt @id + name String +} + +model private_identifier { + id BigInt @id + name String +} + +model qualified_name { + id BigInt @id + left_id BigInt + right_id BigInt +} + +model computed_property_name { + id BigInt @id + expression_id BigInt +} + +model type_node { + id BigInt @id + kind Int +} + +model any_type { + id BigInt @id +} + +model big_int_type { + id BigInt @id +} + +model boolean_type { + id BigInt @id +} + +model intrinsic_type { + id BigInt @id +} + +model never_type { + id BigInt @id +} + +model number_type { + id BigInt @id +} + +model object_type { + id BigInt @id +} + +model string_type { + id BigInt @id +} + +model symbol_type { + id BigInt @id +} + +model undefined_type { + id BigInt @id +} + +model unknown_type { + id BigInt @id +} + +model void_type { + id BigInt @id +} + +model type_parameter { + id BigInt @id + name_node_id BigInt +} + +model type_parameter_constraint { + type_parameter_id BigInt @id + constraint_id BigInt +} + +model type_parameter_default { + type_parameter_id BigInt @id + default_id BigInt +} + +model parameter { + id BigInt @id + name_node_id BigInt +} + +model parameter_dot_dot_dot_token { + parameter_id BigInt @id + dot_dot_dot_token_id BigInt +} + +model parameter_question_token { + parameter_id BigInt @id + question_token_id BigInt +} + +model parameter_type_node { + parameter_id BigInt @id + type_node_id BigInt +} + +model parameter_initializer { + parameter_id BigInt @id + initializer_id BigInt +} + +model decorator { + id BigInt @id + expression_id BigInt +} + +model object_literal_element { + id BigInt @id + kind Int +} + +model object_literal_element_name_node { + object_literal_element_id BigInt @id + name_node_id BigInt +} + +model class_element { + id BigInt @id + kind Int +} + +model class_element_name_node { + class_element_id BigInt @id + name_node_id BigInt +} + +model type_element { + id BigInt @id + kind Int +} + +model type_element_name_node { + type_element_id BigInt @id + name_node_id BigInt +} + +model type_element_question_token { + type_element_id BigInt @id + question_token_id BigInt +} + +model property_signature { + id BigInt @id + name_node_id BigInt +} + +model property_signature_question_token { + property_signature_id BigInt @id + question_token_id BigInt +} + +model property_signature_type_node { + property_signature_id BigInt @id + type_node_id BigInt +} + +model property_declaration { + id BigInt @id + name_node_id BigInt +} + +model property_declaration_question_token { + property_declaration_id BigInt @id + question_token_id BigInt +} + +model property_declaration_exclamation_token { + property_declaration_id BigInt @id + exclamation_token_id BigInt +} + +model property_declaration_type_node { + property_declaration_id BigInt @id + type_node_id BigInt +} + +model property_declaration_initializer { + property_declaration_id BigInt @id + initializer_id BigInt +} + +model method_signature { + id BigInt @id + name_node_id BigInt +} + +model method_declaration { + id BigInt @id + name_node_id BigInt +} + +model method_declaration_body { + method_declaration_id BigInt @id + body_id BigInt +} + +model class_static_block_declaration { + id BigInt @id + body_id BigInt +} + +model constructor { + id BigInt @id +} + +model constructor_body { + constructor_id BigInt @id + body_id BigInt +} + +model get_accessor { + id BigInt @id + name_node_id BigInt +} + +model get_accessor_body { + get_accessor_id BigInt @id + body_id BigInt +} + +model set_accessor { + id BigInt @id + name_node_id BigInt +} + +model set_accessor_body { + set_accessor_id BigInt @id + body_id BigInt +} + +model call_signature { + id BigInt @id +} + +model construct_signature { + id BigInt @id +} + +model index_signature { + id BigInt @id + type_node_id BigInt +} + +model semicolon_class_element { + id BigInt @id +} + +model property_assignment { + id BigInt @id + name_node_id BigInt + initializer_id BigInt +} + +model shorthand_property_assignment { + id BigInt @id + name_node_id BigInt +} + +model spread_assignment { + id BigInt @id + expression_id BigInt +} + +model enum_member { + id BigInt @id + parent_id BigInt + index Int + name_node_id BigInt +} + +model enum_member_initializer { + enum_member_id BigInt @id + initializer_id BigInt +} + +model signature_declaration { + id BigInt @id + kind Int +} + +model signature_declaration_name_node { + signature_declaration_id BigInt @id + name_node_id BigInt +} + +model signature_declaration_type_parameter { + type_parameter_id BigInt @id + signature_declaration_id BigInt + index Int +} + +model signature_declaration_parameter { + parameter_id BigInt @id + signature_declaration_id BigInt + index Int +} + +model signature_declaration_type_node { + signature_declaration_id BigInt @id + type_node_id BigInt +} + +model function_like_declaration { + id BigInt @id + kind Int +} + +model function_like_declaration_asterisk_token { + function_like_declaration_id BigInt @id + asterisk_token_id BigInt +} + +model function_like_declaration_question_token { + function_like_declaration_id BigInt @id + question_token_id BigInt +} + +model function_like_declaration_exclamation_token { + function_like_declaration_id BigInt @id + exclamation_token_id BigInt +} + +model function_like_declaration_body { + function_like_declaration_id BigInt @id + body_id BigInt +} + +model class_like_declaration { + id BigInt @id + kind Int +} + +model class_like_declaration_name_node { + class_like_declaration_id BigInt @id + name_node_id BigInt +} + +model class_like_declaration_type_parameter { + type_parameter_id BigInt @id + class_like_declaration_id BigInt + index Int +} + +model class_like_declaration_member { + member_id BigInt @id + class_like_declaration_id BigInt + index Int +} + +model this_type { + id BigInt @id +} + +model type_predicate { + id BigInt @id + parameter_name_node_id BigInt +} + +model type_predicate_asserts_modifier { + type_predicate_id BigInt @id + asserts_modifier_id BigInt +} + +model type_predicate_type_node { + type_predicate_id BigInt @id + type_node_id BigInt +} + +model node_with_type_arguments { + id BigInt @id + kind Int +} + +model node_with_type_arguments_type_argument { + type_argument_id BigInt @id + node_with_type_arguments_id BigInt + index Int +} + +model type_reference { + id BigInt @id + type_name_node_id BigInt +} + +model function_or_constructor_type { + id BigInt @id + kind Int + type_node_id BigInt +} + +model function_type { + id BigInt @id +} + +model constructor_type { + id BigInt @id +} + +model type_query { + id BigInt @id + expression_name_node_id BigInt +} + +model type_literal { + id BigInt @id +} + +model type_literal_member { + member_id BigInt @id + type_literal_id BigInt + index Int +} + +model array_type { + id BigInt @id + element_type_node_id BigInt +} + +model tuple_type { + id BigInt @id +} + +model tuple_type_element { + element_id BigInt @id + tuple_type_id BigInt + index Int +} + +model optional_type { + id BigInt @id + type_node_id BigInt +} + +model rest_type { + id BigInt @id + type_node_id BigInt +} + +model union_type { + id BigInt @id +} + +model union_type_type_node { + type_node_id BigInt @id + union_type_id BigInt + index Int +} + +model intersection_type { + id BigInt @id +} + +model intersection_type_type_node { + type_node_id BigInt @id + intersection_type_id BigInt + index Int +} + +model conditional_type { + id BigInt @id + check_type_node_id BigInt + extends_type_node_id BigInt + then_type_node_id BigInt + else_type_node_id BigInt +} + +model infer_type { + id BigInt @id + type_parameter_id BigInt +} + +model parenthesized_type { + id BigInt @id + type_node_id BigInt +} + +model type_operator { + id BigInt @id + operator_id BigInt + type_node_id BigInt +} + +model indexed_access_type { + id BigInt @id + object_type_node_id BigInt + index_type_node_id BigInt +} + +model mapped_type { + id BigInt @id + type_parameter_id BigInt +} + +model mapped_type_readonly_token { + mapped_type_id BigInt @id + readonly_token_id BigInt +} + +model mapped_type_name_type_node { + mapped_type_id BigInt @id + name_type_node_id BigInt +} + +model mapped_type_question_token { + mapped_type_id BigInt @id + question_token_id BigInt +} + +model mapped_type_type_node { + mapped_type_id BigInt @id + type_node_id BigInt +} + +model literal_type { + id BigInt @id + literal_id BigInt +} + +model named_tuple_member { + id BigInt @id + name_node_id BigInt + type_node_id BigInt +} + +model named_tuple_member_dot_dot_dot_token { + named_tuple_member_id BigInt @id + dot_dot_dot_token_id BigInt +} + +model named_tuple_member_question_token { + named_tuple_member_id BigInt @id + question_token_id BigInt +} + +model template_literal_type_span { + id BigInt @id + parent_id BigInt + index Int + type_node_id BigInt + literal_id BigInt +} + +model template_literal_type { + id BigInt @id + head_id BigInt +} + +model import_type_assertion_container { + id BigInt @id + parent_id BigInt + assert_clause_id BigInt +} + +model import_type { + id BigInt @id + is_type_of Boolean + argument_id BigInt +} + +model import_type_qualifier { + import_type_id BigInt @id + qualifier_id BigInt +} + +model binding_element { + id BigInt @id + name_node_id BigInt +} + +model binding_element_property_name_node { + binding_element_id BigInt @id + property_name_node_id BigInt +} + +model binding_element_dot_dot_dot_token { + binding_element_id BigInt @id + dot_dot_dot_token_id BigInt +} + +model binding_element_initializer { + binding_element_id BigInt @id + initializer_id BigInt +} + +model object_binding_pattern { + id BigInt @id +} + +model object_binding_pattern_element { + element_id BigInt @id + object_binding_pattern_id BigInt + index Int +} + +model array_binding_pattern { + id BigInt @id +} + +model array_binding_pattern_element { + element_id BigInt @id + array_binding_pattern_id BigInt + index Int +} + +model this_expression { + id BigInt @id +} + +model super_expression { + id BigInt @id +} + +model import_expression { + id BigInt @id +} + +model array_literal_expression { + id BigInt @id +} + +model array_literal_expression_element { + element_id BigInt @id + array_literal_expression_id BigInt + index Int +} + +model object_literal_expression { + id BigInt @id +} + +model object_literal_expression_property { + property_id BigInt @id + object_literal_expression_id BigInt + index Int +} + +model property_access_expression { + id BigInt @id + expression_id BigInt + name_node_id BigInt +} + +model property_access_expression_question_dot_token { + property_access_expression_id BigInt @id + question_dot_token_id BigInt +} + +model element_access_expression { + id BigInt @id + expression_id BigInt + argument_expression_id BigInt +} + +model element_access_expression_question_dot_token { + element_access_expression_id BigInt @id + question_dot_token_id BigInt +} + +model call_expression { + id BigInt @id + expression_id BigInt +} + +model call_expression_question_dot_token { + call_expression_id BigInt @id + question_dot_token_id BigInt +} + +model call_expression_type_argument { + type_argument_id BigInt @id + call_expression_id BigInt + index Int +} + +model call_expression_argument { + argument_id BigInt @id + call_expression_id BigInt + index Int +} + +model new_expression { + id BigInt @id + expression_id BigInt +} + +model new_expression_type_argument { + type_argument_id BigInt @id + new_expression_id BigInt + index Int +} + +model new_expression_argument { + argument_id BigInt @id + new_expression_id BigInt + index Int +} + +model template_expression { + id BigInt @id + head_id BigInt +} + +model tagged_template_expression { + id BigInt @id + tag_id BigInt + template_id BigInt +} + +model tagged_template_expression_type_argument { + type_argument_id BigInt @id + tagged_template_expression_id BigInt + index Int +} + +model type_assertion_expression { + id BigInt @id + type_node_id BigInt + expression_id BigInt +} + +model parenthesized_expression { + id BigInt @id + expression_id BigInt +} + +model function_expression { + id BigInt @id + body_id BigInt +} + +model function_expression_name_node { + function_expression_id BigInt @id + name_node_id BigInt +} + +model arrow_function { + id BigInt @id + equals_greater_than_token_id BigInt + body_id BigInt +} + +model ets_component_expression { + id BigInt @id + expression_id BigInt +} + +model ets_component_expression_type_argument { + type_argument_id BigInt @id + ets_component_expression_id BigInt + index Int +} + +model ets_component_expression_argument { + argument_id BigInt @id + ets_component_expression_id BigInt + index Int +} + +model ets_component_expression_body { + ets_component_expression_id BigInt @id + body_id BigInt +} + +model delete_expression { + id BigInt @id + expression_id BigInt +} + +model type_of_expression { + id BigInt @id + expression_id BigInt +} + +model void_expression { + id BigInt @id + expression_id BigInt +} + +model await_expression { + id BigInt @id + expression_id BigInt +} + +model prefix_unary_expression { + id BigInt @id + operator_id BigInt + operand_id BigInt +} + +model postfix_unary_expression { + id BigInt @id + operand_id BigInt + operator_id BigInt +} + +model binary_expression { + id BigInt @id + left_id BigInt + operator_id BigInt + right_id BigInt +} + +model conditional_expression { + id BigInt @id + condition_id BigInt + question_token_id BigInt + then_expression_id BigInt + colon_token_id BigInt + else_expression_id BigInt +} + +model yield_expression { + id BigInt @id +} + +model yield_expression_asterisk_token { + yield_expression_id BigInt @id + asterisk_token_id BigInt +} + +model yield_expression_expression { + yield_expression_id BigInt @id + expression_id BigInt +} + +model spread_element { + id BigInt @id + expression_id BigInt +} + +model class_expression { + id BigInt @id +} + +model omitted_expression { + id BigInt @id +} + +model expression_with_type_arguments { + id BigInt @id + expression_id BigInt +} + +model as_expression { + id BigInt @id + expression_id BigInt + type_node_id BigInt +} + +model non_null_expression { + id BigInt @id + expression_id BigInt +} + +model meta_property { + id BigInt @id + keyword_token_id BigInt + name_node_id BigInt +} + +model satisfies_expression { + id BigInt @id + expression_id BigInt + type_node_id BigInt +} + +model statement { + id BigInt @id + kind Int +} + +model block { + id BigInt @id +} + +model block_statement { + statement_id BigInt @id + block_id BigInt + index Int +} + +model empty_statement { + id BigInt @id +} + +model variable_declaration { + id BigInt @id + name_node_id BigInt +} + +model variable_declaration_exclamation_token { + variable_declaration_id BigInt @id + exclamation_token_id BigInt +} + +model variable_declaration_type_node { + variable_declaration_id BigInt @id + type_node_id BigInt +} + +model variable_declaration_initializer { + variable_declaration_id BigInt @id + initializer_id BigInt +} + +model variable_declaration_list { + id BigInt @id +} + +model variable_declaration_list_declaration { + declaration_id BigInt @id + variable_declaration_list_id BigInt + index Int +} + +model variable_statement { + id BigInt @id + declaration_list_id BigInt +} + +model expression_statement { + id BigInt @id + expression_id BigInt +} + +model if_statement { + id BigInt @id + condition_id BigInt + then_statement_id BigInt +} + +model if_statement_else_statement { + if_statement_id BigInt @id + else_statement_id BigInt +} + +model iteration_statement { + id BigInt @id + kind Int + statement_id BigInt +} + +model do_statement { + id BigInt @id + expression_id BigInt +} + +model while_statement { + id BigInt @id + expression_id BigInt +} + +model for_statement { + id BigInt @id +} + +model for_statement_initializer { + for_statement_id BigInt @id + initializer_id BigInt +} + +model for_statement_condition { + for_statement_id BigInt @id + condition_id BigInt +} + +model for_statement_incrementor { + for_statement_id BigInt @id + incrementor_id BigInt +} + +model for_in_statement { + id BigInt @id + initializer_id BigInt + expression_id BigInt +} + +model for_of_statement { + id BigInt @id + initializer_id BigInt + expression_id BigInt +} + +model for_of_statement_await_modifier { + for_of_statement_id BigInt @id + await_modifier_id BigInt +} + +model continue_statement { + id BigInt @id +} + +model continue_statement_label { + continue_statement_id BigInt @id + label_id BigInt +} + +model break_statement { + id BigInt @id +} + +model break_statement_label { + break_statement_id BigInt @id + label_id BigInt +} + +model return_statement { + id BigInt @id +} + +model return_statement_expression { + return_statement_id BigInt @id + expression_id BigInt +} + +model with_statement { + id BigInt @id + expression_id BigInt + statement_id BigInt +} + +model case_block { + id BigInt @id +} + +model case_block_clause { + clause_id BigInt @id + case_block_id BigInt + index Int +} + +model case_clause { + id BigInt @id + expression_id BigInt +} + +model case_clause_statement { + statement_id BigInt @id + case_clause_id BigInt + index Int +} + +model default_clause { + id BigInt @id +} + +model default_clause_statement { + statement_id BigInt @id + default_clause_id BigInt + index Int +} + +model switch_statement { + id BigInt @id + expression_id BigInt + case_block_id BigInt +} + +model labeled_statement { + id BigInt @id + label_id BigInt + statement_id BigInt +} + +model throw_statement { + id BigInt @id + expression_id BigInt +} + +model try_statement { + id BigInt @id + try_block_id BigInt +} + +model try_statement_finally_block { + try_statement_id BigInt @id + finally_block_id BigInt +} + +model catch_clause { + id BigInt @id + parent_id BigInt + block_id BigInt +} + +model catch_clause_variable_declaration { + catch_clause_id BigInt @id + variable_declaration_id BigInt +} + +model debugger_statement { + id BigInt @id +} + +model declaration_statement { + id BigInt @id + kind Int +} + +model declaration_statement_name_node { + declaration_statement_id BigInt @id + name_node_id BigInt +} + +model function_declaration { + id BigInt @id +} + +model function_declaration_name_node { + function_declaration_id BigInt @id + name_node_id BigInt +} + +model function_declaration_body { + function_declaration_id BigInt @id + body_id BigInt +} + +model class_declaration { + id BigInt @id +} + +model class_declaration_name_node { + class_declaration_id BigInt @id + name_node_id BigInt +} + +model struct_declaration { + id BigInt @id +} + +model struct_declaration_name_node { + struct_declaration_id BigInt @id + name_node_id BigInt +} + +model heritage_clause { + id BigInt @id + parent_id BigInt + index Int + token_id BigInt +} + +model heritage_clause_type_node { + type_node_id BigInt @id + heritage_clause_id BigInt + index Int +} + +model interface_declaration { + id BigInt @id + name_node_id BigInt +} + +model interface_declaration_type_parameter { + type_parameter_id BigInt @id + interface_declaration_id BigInt + index Int +} + +model interface_declaration_member { + member_id BigInt @id + interface_declaration_id BigInt + index Int +} + +model type_alias_declaration { + id BigInt @id + name_node_id BigInt + type_node_id BigInt +} + +model type_alias_declaration_type_parameter { + type_parameter_id BigInt @id + type_alias_declaration_id BigInt + index Int +} + +model enum_declaration { + id BigInt @id + name_node_id BigInt +} + +model module_declaration { + id BigInt @id + name_node_id BigInt +} + +model module_declaration_body { + module_declaration_id BigInt @id + body_id BigInt +} + +model module_block { + id BigInt @id +} + +model module_block_statement { + statement_id BigInt @id + module_block_id BigInt + index Int +} + +model namespace_export_declaration { + id BigInt @id + name_node_id BigInt +} + +model external_module_reference { + id BigInt @id + expression_id BigInt +} + +model import_equals_declaration { + id BigInt @id + name_node_id BigInt + is_type_only Boolean + module_reference_id BigInt +} + +model namespace_import { + id BigInt @id + name_node_id BigInt +} + +model import_specifier { + id BigInt @id + parent_id BigInt + index Int + name_node_id BigInt + is_type_only Boolean +} + +model import_specifier_property_name_node { + import_specifier_id BigInt @id + property_name_node_id BigInt +} + +model named_imports { + id BigInt @id +} + +model import_clause { + id BigInt @id + parent_id BigInt + is_type_only Boolean +} + +model import_clause_name_node { + import_clause_id BigInt @id + name_node_id BigInt +} + +model import_clause_named_bindings { + import_clause_id BigInt @id + named_bindings_id BigInt +} + +model assert_entry { + id BigInt @id + parent_id BigInt + index Int + name_node_id BigInt + value_node_id BigInt +} + +model assert_clause { + id BigInt @id +} + +model import_declaration { + id BigInt @id + module_specifier_id BigInt +} + +model import_declaration_assert_clause { + import_declaration_id BigInt @id + assert_clause_id BigInt +} + +model export_assignment { + id BigInt @id + is_export_equals Boolean + expression_id BigInt +} + +model export_specifier { + id BigInt @id + parent_id BigInt + index Int + is_type_only Boolean + name_node_id BigInt +} + +model export_specifier_property_name_node { + export_specifier_id BigInt @id + property_name_node_id BigInt +} + +model named_exports { + id BigInt @id +} + +model namespace_export { + id BigInt @id + name_node_id BigInt +} + +model export_declaration { + id BigInt @id + is_type_only Boolean +} + +model export_declaration_export_clause { + export_declaration_id BigInt @id + export_clause_id BigInt +} + +model export_declaration_module_specifier { + export_declaration_id BigInt @id + module_specifier_id BigInt +} + +model export_declaration_assert_clause { + export_declaration_id BigInt @id + assert_clause_id BigInt +} + +model top_level { + id BigInt @id + kind Int + location_id BigInt +} + +model top_level_statement { + statement_id BigInt @id + top_level_id BigInt + index Int +} + +model ast_node_container_relation { + ast_node_id BigInt @id + container_id BigInt +} + +model cfg_entry_node { + id BigInt @id + ast_node_id BigInt +} + +model cfg_exit_node { + id BigInt @id + ast_node_id BigInt +} + +model symbol_ { + id BigInt @id + name String + description String +} + +model ast_node_symbol { + ast_node_id BigInt @id + symbol_id BigInt +} + +model shorthand_property_assignment_value_symbol { + shorthand_property_assignment_id BigInt @id + symbol_id BigInt +} + +model type_ { + id BigInt @id + name String +} + +model ast_node_type { + ast_node_id BigInt @id + type_id BigInt +} + +model call_site_declaration { + id BigInt @id + call_site_id BigInt + declaration_id BigInt +} + +model call_site_implementation { + id BigInt @id + call_site_id BigInt + implementation_id BigInt +} + +model comment { + id BigInt @id + kind Int + location_id BigInt +} + +model ast_node_comment { + id BigInt @id + kind Int + ast_node_id BigInt + comment_id BigInt + index Int +} + +model metadata { + id BigInt @id + version String + created_time DateTime +} + +model ignored_path { + id BigInt @id + path_kind Int + path String + ignore_kind Int +} diff --git a/language/arkts/extractor/sdk/hms/ets/NOTICE.txt b/language/arkts/extractor/sdk/hms/ets/NOTICE.txt new file mode 100755 index 00000000..423b723d --- /dev/null +++ b/language/arkts/extractor/sdk/hms/ets/NOTICE.txt @@ -0,0 +1,2775 @@ +Notices for files contained in SDK in this directory: +============================================================ +Notices for file(s): +/previewer/liteWearable/config +/previewer/liteWearable/config/SourceHanSansSC-Regular.otf +/previewer/liteWearable/config/line_cj.brk +/previewer/module/core/account/liblogincomponent.dylib +/toolchains/lib/ace_napi_static.a +/toolchains/lib/global_resmgr_simulator.a +/toolchains/lib/graphic_utils_static_ide.a +/toolchains/lib/nativeapi_locale_simulator.a +/toolchains/lib/nativeapi_location_simulator.a +/toolchains/lib/ui_ide.a +------------------------------------------------------------ +Notices for software(s): +Software: +Path: //../foundation/arkui/ui_lite/ext/ide +Software: +Path: //../foundation/arkui/napi +Software: +Path: //../base/global/resource_management_lite/frameworks/resmgr_lite +Software: +Path: //../base/global/i18n_lite/interfaces/kits/js/builtin +Software: +Path: //../base/location/interfaces/kits/geo_lite/js/builtin +------------------------------------------------------------ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS +============================================================ +Notices for file(s): +/ets +/ets/sdkConfig.json +/ets/sysResource.js +/previewer/module/collaboration/libcamera.dylib +/previewer/module/collaboration/libcollaborationdevicepicker.dylib +/previewer/module/collaboration/libdevicepicker.dylib +/previewer/module/collaboration/libservice.dylib +/previewer/module/core/atomicserviceComponent/libatomicserviceui_napi.dylib +/previewer/module/core/map/libmapcomponent.dylib +/previewer/resources +/previewer/resources/HMSymbol-Black.ttf +/previewer/resources/HMSymbol-Bold.ttf +/previewer/resources/HMSymbol-ExtraBold.ttf +/previewer/resources/HMSymbol-ExtraLight.ttf +/previewer/resources/HMSymbol-Light.ttf +/previewer/resources/HMSymbol-Medium.ttf +/previewer/resources/HMSymbol-Regular.ttf +/previewer/resources/HMSymbol-SemiBold.ttf +/previewer/resources/HMSymbol-Thin.ttf +/previewer/resources/hm_symbol_config.json +/previewer/resources/hm_symbol_config_next.json +/previewer/resources/resources +/toolchains +/toolchains/configcheck +/toolchains/configcheck/configSchema_lite.json +/toolchains/configcheck/configSchema_rich.json +/toolchains/id_defined.json +/toolchains/lib +/toolchains/lib/Provisionsigntool.jar +/toolchains/lib/nativeapi_brightness_static.a +/toolchains/lib/nativeapi_miscdevice.a +/toolchains/lib/nativeapi_sensor.a +/toolchains/lib/sdk-sign-tool-full.jar +/toolchains/modulecheck +/toolchains/modulecheck/app.json +/toolchains/modulecheck/arkDataSchema.json +/toolchains/modulecheck/module.json +/toolchains/syscapcheck +/toolchains/syscapcheck/sysCapSchema.json +------------------------------------------------------------ +Notices for software(s): +Software: +Path: //../vendor/huawei/sdk/hmscore_sdk_tools +Software: +Path: //../vendor/huawei/base/global/system_resources +Software: +Path: //../vendor/huawei/foundation/bundlemanager/bundle_framework/common/configcheck +Software: +Path: //../vendor/huawei/sdk/hmscore_toolchains_tools/provision +Software: +Path: //../foundation/arkui/ui_ext_lite/tools/ide/brightness_lite/js/builtin +Software: +Path: //../base/sensors/sensorjs_lite/miscdevice_lite/interfaces/js/builtin +Software: +Path: //../base/sensors/sensorjs_lite/sensor_lite/interfaces/js/builtin +Software: +Path: //../vendor/huawei/sdk/hmscore_toolchains_tools/sdk_sign_tool +Software: +Path: //../vendor/huawei/foundation/bundlemanager/bundle_framework/common/modulecheck +Software: +Path: //../vendor/huawei/sdk/hmscore_toolchains_tools/syscapcheck +------------------------------------------------------------ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + +============================================================ +Notices for file(s): +/toolchains/lib/websockets_static.a +------------------------------------------------------------ +Notices for software(s): +Software: libwebsockets v4.3.3 +Path: //../third_party/libwebsockets +------------------------------------------------------------ +Libwebsockets and included programs are provided under the terms of the +MIT license shown below, with the exception that some sources are under +a similar permissive license like BSD, or are explicitly CC0 / public +domain to remove any obstacles from basing differently-licensed code on +them. + +Original liberal license retained: + + - lib/misc/sha-1.c - 3-clause BSD license retained, link to original [BSD3] + - win32port/zlib - ZLIB license (see zlib.h) [ZLIB] + - lib/tls/mbedtls/wrapper - Apache 2.0 (only built if linked against mbedtls) [APACHE2] + lib/tls/mbedtls/mbedtls-extensions.c + - lib/misc/base64-decode.c - already MIT + - lib/misc/ieeehalfprecision.c - 2-clause BSD license retained [BSD2] + +Relicensed to MIT: + + - lib/misc/daemonize.c - relicensed from Public Domain to MIT, + link to original Public Domain version + - lib/plat/windows/windows-resolv.c - relicensed from "Beerware v42" to MIT + +Public Domain (CC-zero) to simplify reuse: + + - test-apps/*.c + - test-apps/*.h + - minimal-examples/* + - lwsws/* + +Although libwebsockets is available under a permissive license, it does not +change the reality of dealing with large lumps of external code... if your +copy diverges it is guaranteed to contain security problems after a while +and can be very painful to pick backports (especially since historically, +we are very hot on cleaning and refactoring the codebase). The least +painful and lowest risk way remains sending your changes and fixes upstream +to us so you can easily use later releases and fixes. + +## MIT License applied to libwebsockets + +https://opensource.org/licenses/MIT + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to + deal in the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + sell copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + IN THE SOFTWARE. + +## BSD2 + +``` + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. +``` + +## BSD3 + +For convenience, a copy of the license on `./lib/misc/sha-1.c`. In binary +distribution, this applies to builds with ws support enabled, and without +`LWS_WITHOUT_BUILTIN_SHA1` at cmake. + +``` +/* + * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the project nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH +``` + +## ZLIB + +For convenience, a copy of the license on zlib. In binary distribution, +this applies for win32 builds with internal zlib only. You can avoid +building any zlib usage or copy at all with `-DLWS_WITH_ZLIB=0` (the +default), and so avoid needing to observe the license for binary +distribution that doesn't include the related code. + +``` + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. + + Jean-loup Gailly Mark Adler + jloup@gzip.org madler@alumni.caltech.edu +``` + + +## APACHE2 + +For convenience, a copy of the license on the mbedtls wrapper part. In binary +distribution, this applies only when building lws against mbedtls. + +The canonical license application to source files uses the URL reference, so the +whole is not reproduced here. + +``` +// Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at + +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +``` + +## CC0 + +For convenience,the full text of CC0 dedication found on the lws examples. +The intention of this is to dedicate the examples to the public domain, so +users can build off and modify them without any constraint. + +``` +Statement of Purpose + +The laws of most jurisdictions throughout the world automatically confer exclusive Copyright and Related Rights (defined below) upon the creator and subsequent owner(s) (each and all, an "owner") of an original work of authorship and/or a database (each, a "Work"). + +Certain owners wish to permanently relinquish those rights to a Work for the purpose of contributing to a commons of creative, cultural and scientific works ("Commons") that the public can reliably and without fear of later claims of infringement build upon, modify, incorporate in other works, reuse and redistribute as freely as possible in any form whatsoever and for any purposes, including without limitation commercial purposes. These owners may contribute to the Commons to promote the ideal of a free culture and the further production of creative, cultural and scientific works, or to gain reputation or greater distribution for their Work in part through the use and efforts of others. + +For these and/or other purposes and motivations, and without any expectation of additional consideration or compensation, the person associating CC0 with a Work (the "Affirmer"), to the extent that he or she is an owner of Copyright and Related Rights in the Work, voluntarily elects to apply CC0 to the Work and publicly distribute the Work under its terms, with knowledge of his or her Copyright and Related Rights in the Work and the meaning and intended legal effect of CC0 on those rights. + +1. Copyright and Related Rights. A Work made available under CC0 may be protected by copyright and related or neighboring rights ("Copyright and Related Rights"). Copyright and Related Rights include, but are not limited to, the following: + + the right to reproduce, adapt, distribute, perform, display, communicate, and translate a Work; + moral rights retained by the original author(s) and/or performer(s); + publicity and privacy rights pertaining to a person's image or likeness depicted in a Work; + rights protecting against unfair competition in regards to a Work, subject to the limitations in paragraph 4(a), below; + rights protecting the extraction, dissemination, use and reuse of data in a Work; + database rights (such as those arising under Directive 96/9/EC of the European Parliament and of the Council of 11 March 1996 on the legal protection of databases, and under any national implementation thereof, including any amended or successor version of such directive); and + other similar, equivalent or corresponding rights throughout the world based on applicable law or treaty, and any national implementations thereof. + +2. Waiver. To the greatest extent permitted by, but not in contravention of, applicable law, Affirmer hereby overtly, fully, permanently, irrevocably and unconditionally waives, abandons, and surrenders all of Affirmer's Copyright and Related Rights and associated claims and causes of action, whether now known or unknown (including existing as well as future claims and causes of action), in the Work (i) in all territories worldwide, (ii) for the maximum duration provided by applicable law or treaty (including future time extensions), (iii) in any current or future medium and for any number of copies, and (iv) for any purpose whatsoever, including without limitation commercial, advertising or promotional purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each member of the public at large and to the detriment of Affirmer's heirs and successors, fully intending that such Waiver shall not be subject to revocation, rescission, cancellation, termination, or any other legal or equitable action to disrupt the quiet enjoyment of the Work by the public as contemplated by Affirmer's express Statement of Purpose. + +3. Public License Fallback. Should any part of the Waiver for any reason be judged legally invalid or ineffective under applicable law, then the Waiver shall be preserved to the maximum extent permitted taking into account Affirmer's express Statement of Purpose. In addition, to the extent the Waiver is so judged Affirmer hereby grants to each affected person a royalty-free, non transferable, non sublicensable, non exclusive, irrevocable and unconditional license to exercise Affirmer's Copyright and Related Rights in the Work (i) in all territories worldwide, (ii) for the maximum duration provided by applicable law or treaty (including future time extensions), (iii) in any current or future medium and for any number of copies, and (iv) for any purpose whatsoever, including without limitation commercial, advertising or promotional purposes (the "License"). The License shall be deemed effective as of the date CC0 was applied by Affirmer to the Work. Should any part of the License for any reason be judged legally invalid or ineffective under applicable law, such partial invalidity or ineffectiveness shall not invalidate the remainder of the License, and in such case Affirmer hereby affirms that he or she will not (i) exercise any of his or her remaining Copyright and Related Rights in the Work or (ii) assert any associated claims and causes of action with respect to the Work, in either case contrary to Affirmer's express Statement of Purpose. + +4. Limitations and Disclaimers. + + No trademark or patent rights held by Affirmer are waived, abandoned, surrendered, licensed or otherwise affected by this document. + Affirmer offers the Work as-is and makes no representations or warranties of any kind concerning the Work, express, implied, statutory or otherwise, including without limitation warranties of title, merchantability, fitness for a particular purpose, non infringement, or the absence of latent or other defects, accuracy, or the present or absence of errors, whether or not discoverable, all to the greatest extent permissible under applicable law. + Affirmer disclaims responsibility for clearing rights of other persons that may apply to the Work or any use thereof, including without limitation any person's Copyright and Related Rights in the Work. Further, Affirmer disclaims responsibility for obtaining any necessary consents, permissions or other rights required for any use of the Work. + Affirmer understands and acknowledges that Creative Commons is not a party to this document and has no duty or obligation with respect to this CC0 or use of the Work. +``` + + +============================================================ +Notices for file(s): +/toolchains/lib/harfbuzz_static.a +------------------------------------------------------------ +Notices for software(s): +Software: harfbuzz 2.8.2 +Path: //../third_party/harfbuzz +------------------------------------------------------------ +HarfBuzz is licensed under the so-called "Old MIT" license. Details follow. +For parts of HarfBuzz that are licensed under different licenses see individual +files names COPYING in subdirectories where applicable. + +Copyright © 2010,2011,2012,2013,2014,2015,2016,2017,2018,2019,2020 Google, Inc. +Copyright © 2018,2019,2020 Ebrahim Byagowi +Copyright © 2019,2020 Facebook, Inc. +Copyright © 2012 Mozilla Foundation +Copyright © 2011 Codethink Limited +Copyright © 2008,2010 Nokia Corporation and/or its subsidiary(-ies) +Copyright © 2009 Keith Stribley +Copyright © 2009 Martin Hosken and SIL International +Copyright © 2007 Chris Wilson +Copyright © 2005,2006,2020,2021 Behdad Esfahbod +Copyright © 2005 David Turner +Copyright © 2004,2007,2008,2009,2010 Red Hat, Inc. +Copyright © 1998-2004 David Turner and Werner Lemberg + +For full copyright notices consult the individual files in the package. + + +Permission is hereby granted, without written agreement and without +license or royalty fees, to use, copy, modify, and distribute this +software and its documentation for any purpose, provided that the +above copyright notice and the following two paragraphs appear in +all copies of this software. + +IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR +DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES +ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN +IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGE. + +THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, +BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO +PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. + +============================================================ +Notices for file(s): +/toolchains/lib/libjerryscript.a +------------------------------------------------------------ +Notices for software(s): +Software: jerryscript v2.3.0 +Path: //../third_party/jerryscript +------------------------------------------------------------ +Copyright JS Foundation and other contributors, http://js.foundation + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright JS Foundation and other contributors, http://js.foundation + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +============================================================ +Notices for file(s): +/toolchains/lib/assembly_proto_static.a +/toolchains/lib/es2panda_lib.a +/toolchains/lib/panda_assembly_proto_static.a +------------------------------------------------------------ +Notices for software(s): +Software: +Path: //../arkcompiler/ets_frontend/merge_abc +Software: +Path: //../arkcompiler/ets_frontend/es2panda +------------------------------------------------------------ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + The "ts2panda\scripts\diagnosticMessages.json" file may contain + some information or content from the following software: + TypeScript + /*! ***************************************************************************** + Copyright (c) Microsoft Corporation. All rights reserved. + Licensed under the Apache License, Version 2.0 (the "License"); you may not use + this file except in compliance with the License. You may obtain a copy of the + License at http://www.apache.org/licenses/LICENSE-2.0 + + THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED + WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, + MERCHANTABLITY OR NON-INFRINGEMENT. + + See the Apache Version 2.0 License for specific language governing permissions + and limitations under the License. + ***************************************************************************** */ + Apache License 2.0 +============================================================ +Notices for file(s): +/toolchains/lib/protobuf_lite_static.a +/toolchains/lib/protobuf_static.a +/toolchains/lib/protoc_static_lib.a +------------------------------------------------------------ +Notices for software(s): +Software: google/protobuf 3.13.0 +Path: //../third_party/protobuf +------------------------------------------------------------ +Copyright 2008 Google Inc. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +Code generated by the Protocol Buffer compiler is owned by the owner +of the input file used when generating it. This code is not +standalone and requires a support library to be linked with it. This +support library is itself covered by the above license. + +============================================================ +Notices for file(s): +/toolchains/lib/turbojpeg_static.a +------------------------------------------------------------ +Notices for software(s): +Software: openEuler:libjpeg-turbo 2.1.1-3.oe2203sp1 +Path: //../third_party/libjpeg-turbo +------------------------------------------------------------ +libjpeg-turbo Licenses +====================== + +libjpeg-turbo is covered by three compatible BSD-style open source licenses: + +- The IJG (Independent JPEG Group) License, which is listed in + [README.ijg](README.ijg) + + This license applies to the libjpeg API library and associated programs + (any code inherited from libjpeg, and any modifications to that code.) + +- The Modified (3-clause) BSD License, which is listed below + + This license covers the TurboJPEG API library and associated programs, as + well as the build system. + +- The [zlib License](https://opensource.org/licenses/Zlib) + + This license is a subset of the other two, and it covers the libjpeg-turbo + SIMD extensions. + + +Complying with the libjpeg-turbo Licenses +========================================= + +This section provides a roll-up of the libjpeg-turbo licensing terms, to the +best of our understanding. + +1. If you are distributing a modified version of the libjpeg-turbo source, + then: + + 1. You cannot alter or remove any existing copyright or license notices + from the source. + + **Origin** + - Clause 1 of the IJG License + - Clause 1 of the Modified BSD License + - Clauses 1 and 3 of the zlib License + + 2. You must add your own copyright notice to the header of each source + file you modified, so others can tell that you modified that file (if + there is not an existing copyright header in that file, then you can + simply add a notice stating that you modified the file.) + + **Origin** + - Clause 1 of the IJG License + - Clause 2 of the zlib License + + 3. You must include the IJG README file, and you must not alter any of the + copyright or license text in that file. + + **Origin** + - Clause 1 of the IJG License + +2. If you are distributing only libjpeg-turbo binaries without the source, or + if you are distributing an application that statically links with + libjpeg-turbo, then: + + 1. Your product documentation must include a message stating: + + This software is based in part on the work of the Independent JPEG + Group. + + **Origin** + - Clause 2 of the IJG license + + 2. If your binary distribution includes or uses the TurboJPEG API, then + your product documentation must include the text of the Modified BSD + License (see below.) + + **Origin** + - Clause 2 of the Modified BSD License + +3. You cannot use the name of the IJG or The libjpeg-turbo Project or the + contributors thereof in advertising, publicity, etc. + + **Origin** + - IJG License + - Clause 3 of the Modified BSD License + +4. The IJG and The libjpeg-turbo Project do not warrant libjpeg-turbo to be + free of defects, nor do we accept any liability for undesirable + consequences resulting from your use of the software. + + **Origin** + - IJG License + - Modified BSD License + - zlib License + + +The Modified (3-clause) BSD License +=================================== + +Copyright (C)2009-2021 D. R. Commander. All Rights Reserved.
+Copyright (C)2015 Viktor Szathmáry. All Rights Reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +- Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. +- Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. +- Neither the name of the libjpeg-turbo Project nor the names of its + contributors may be used to endorse or promote products derived from this + software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS", +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE +LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. + + +Why Three Licenses? +=================== + +The zlib License could have been used instead of the Modified (3-clause) BSD +License, and since the IJG License effectively subsumes the distribution +conditions of the zlib License, this would have effectively placed +libjpeg-turbo binary distributions under the IJG License. However, the IJG +License specifically refers to the Independent JPEG Group and does not extend +attribution and endorsement protections to other entities. Thus, it was +desirable to choose a license that granted us the same protections for new code +that were granted to the IJG for code derived from their software. + +============================================================ +Notices for file(s): +/previewer/liteWearable/bin/Simulator +/toolchains/hilogtool +/toolchains/lib/ace_kit_common_simulator.a +/toolchains/lib/ace_kit_deviceinfo_simulator.a +/toolchains/lib/ace_kit_file_simulator.a +/toolchains/lib/ace_kit_kvstore_simulator.a +/toolchains/lib/ace_lite.a +/toolchains/lib/cli_lite.a +/toolchains/lib/jsapp_lite.a +/toolchains/lib/libark_js_intl_arm_set.a +/toolchains/lib/libark_jsruntime_arm_set.a +/toolchains/lib/libark_jsruntime_static.a +/toolchains/lib/libark_mock_stub_set.a +/toolchains/lib/libnativeapi_battery_simulator.a +/toolchains/lib/mock_lite.a +/toolchains/lib/sysparam_simulator.a +/toolchains/lib/util_lite.a +/toolchains/syscap_tool +------------------------------------------------------------ +Notices for software(s): +Software: +Path: //../commonlibrary/utils_lite/js/builtin/simulator +Software: +Path: //../foundation/arkui/ace_engine_lite/frameworks/targets/simulator +Software: +Path: //../ide/tools/previewer/cli +Software: +Path: //../ide/tools/previewer/jsapp +Software: +Path: //../arkcompiler/ets_runtime +Software: +Path: //../arkcompiler/ets_runtime/ecmascript/compiler +Software: +Path: //../base/powermgr/powermgr_lite/interfaces/kits/battery/js/builtin +Software: +Path: //../ide/tools/previewer/mock +Software: +Path: //../base/startup/init/simulator +Software: +Path: //../ide/tools/previewer/util +------------------------------------------------------------ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS +============================================================ +Notices for file(s): +/toolchains/lib/libuv_source.a +------------------------------------------------------------ +Notices for software(s): +Software: libuv v1.44.2 +Path: //../third_party/libuv +------------------------------------------------------------ +libuv is licensed for use as follows: + +==== +Copyright (c) 2015-present libuv project contributors. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to +deal in the Software without restriction, including without limitation the +rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +sell copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +IN THE SOFTWARE. +==== + +This license applies to parts of libuv originating from the +https://github.com/joyent/libuv repository: + +==== + +Copyright Joyent, Inc. and other Node contributors. All rights reserved. +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to +deal in the Software without restriction, including without limitation the +rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +sell copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +IN THE SOFTWARE. + +==== + +This license applies to all parts of libuv that are not externally +maintained libraries. + +The externally maintained libraries used by libuv are: + + - tree.h (from FreeBSD), copyright Niels Provos. Two clause BSD license. + + - inet_pton and inet_ntop implementations, contained in src/inet.c, are + copyright the Internet Systems Consortium, Inc., and licensed under the ISC + license. + + - stdint-msvc2008.h (from msinttypes), copyright Alexander Chemeris. Three + clause BSD license. + + - pthread-fixes.c, copyright Google Inc. and Sony Mobile Communications AB. + Three clause BSD license. + +============================================================ +Notices for file(s): +/toolchains/lib/cjson_static.a +------------------------------------------------------------ +Notices for software(s): +Software: cJSON 1.7.16 +Path: //../third_party/cJSON +------------------------------------------------------------ +Copyright (c) 2009-2017 Dave Gamble and cJSON contributors + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + + +============================================================ +Notices for file(s): +/toolchains/lib/libsec_static.a +------------------------------------------------------------ +Notices for software(s): +Software: bounds_checking_function v1.1.16 +Path: //../third_party/bounds_checking_function +------------------------------------------------------------ +木兰宽松许可证, 第2版 + +2020年1月 http://license.coscl.org.cn/MulanPSL2 + +您对“软件”的复制、使用、修改及分发受木兰宽松许可证,第2版(“本许可证”)的如下条款的约束: + +0. 定义 + +“软件” 是指由“贡献”构成的许可在“本许可证”下的程序和相关文档的集合。 + +“贡献” 是指由任一“贡献者”许可在“本许可证”下的受版权法保护的作品。 + +“贡献者” 是指将受版权法保护的作品许可在“本许可证”下的自然人或“法人实体”。 + +“法人实体” 是指提交贡献的机构及其“关联实体”。 + +“关联实体” 是指,对“本许可证”下的行为方而言,控制、受控制或与其共同受控制的机构,此处的控制是指有受控方或共同受控方至少50%直接或间接的投票权、资金或其他有价证券。 + +1. 授予版权许可 + +每个“贡献者”根据“本许可证”授予您永久性的、全球性的、免费的、非独占的、不可撤销的版权许可,您可以复制、使用、修改、分发其“贡献”,不论修改与否。 + +2. 授予专利许可 + +每个“贡献者”根据“本许可证”授予您永久性的、全球性的、免费的、非独占的、不可撤销的(根据本条规定撤销除外)专利许可,供您制造、委托制造、使用、许诺销售、销售、进口其“贡献”或以其他方式转移其“贡献”。前述专利许可仅限于“贡献者”现在或将来拥有或控制的其“贡献”本身或其“贡献”与许可“贡献”时的“软件”结合而将必然会侵犯的专利权利要求,不包括对“贡献”的修改或包含“贡献”的其他结合。如果您或您的“关联实体”直接或间接地,就“软件”或其中的“贡献”对任何人发起专利侵权诉讼(包括反诉或交叉诉讼)或其他专利维权行动,指控其侵犯专利权,则“本许可证”授予您对“软件”的专利许可自您提起诉讼或发起维权行动之日终止。 + +3. 无商标许可 + +“本许可证”不提供对“贡献者”的商品名称、商标、服务标志或产品名称的商标许可,但您为满足第4条规定的声明义务而必须使用除外。 + +4. 分发限制 + +您可以在任何媒介中将“软件”以源程序形式或可执行形式重新分发,不论修改与否,但您必须向接收者提供“本许可证”的副本,并保留“软件”中的版权、商标、专利及免责声明。 + +5. 免责声明与责任限制 + +“软件”及其中的“贡献”在提供时不带任何明示或默示的担保。在任何情况下,“贡献者”或版权所有者不对任何人因使用“软件”或其中的“贡献”而引发的任何直接或间接损失承担责任,不论因何种原因导致或者基于何种法律理论,即使其曾被建议有此种损失的可能性。 + +6. 语言 + +“本许可证”以中英文双语表述,中英文版本具有同等法律效力。如果中英文版本存在任何冲突不一致,以中文版为准。 + +条款结束 + +如何将木兰宽松许可证,第2版,应用到您的软件 + +如果您希望将木兰宽松许可证,第2版,应用到您的新软件,为了方便接收者查阅,建议您完成如下三步: + +1, 请您补充如下声明中的空白,包括软件名、软件的首次发表年份以及您作为版权人的名字; + +2, 请您在软件包的一级目录下创建以“LICENSE”为名的文件,将整个许可证文本放入该文件中; + +3, 请将如下声明文本放入每个源文件的头部注释中。 + +Copyright (c) [Year] [name of copyright holder] +[Software Name] is licensed under Mulan PSL v2. +You can use this software according to the terms and conditions of the Mulan PSL v2. +You may obtain a copy of Mulan PSL v2 at: + http://license.coscl.org.cn/MulanPSL2 +THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, +EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, +MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. +See the Mulan PSL v2 for more details. +Mulan Permissive Software License,Version 2 +Mulan Permissive Software License,Version 2 (Mulan PSL v2) + +January 2020 http://license.coscl.org.cn/MulanPSL2 + +Your reproduction, use, modification and distribution of the Software shall be subject to Mulan PSL v2 (this License) with the following terms and conditions: + +0. Definition + +Software means the program and related documents which are licensed under this License and comprise all Contribution(s). + +Contribution means the copyrightable work licensed by a particular Contributor under this License. + +Contributor means the Individual or Legal Entity who licenses its copyrightable work under this License. + +Legal Entity means the entity making a Contribution and all its Affiliates. + +Affiliates means entities that control, are controlled by, or are under common control with the acting entity under this License, 'control' means direct or indirect ownership of at least fifty percent (50%) of the voting power, capital or other securities of controlled or commonly controlled entity. + +1. Grant of Copyright License + +Subject to the terms and conditions of this License, each Contributor hereby grants to you a perpetual, worldwide, royalty-free, non-exclusive, irrevocable copyright license to reproduce, use, modify, or distribute its Contribution, with modification or not. + +2. Grant of Patent License + +Subject to the terms and conditions of this License, each Contributor hereby grants to you a perpetual, worldwide, royalty-free, non-exclusive, irrevocable (except for revocation under this Section) patent license to make, have made, use, offer for sale, sell, import or otherwise transfer its Contribution, where such patent license is only limited to the patent claims owned or controlled by such Contributor now or in future which will be necessarily infringed by its Contribution alone, or by combination of the Contribution with the Software to which the Contribution was contributed. The patent license shall not apply to any modification of the Contribution, and any other combination which includes the Contribution. If you or your Affiliates directly or indirectly institute patent litigation (including a cross claim or counterclaim in a litigation) or other patent enforcement activities against any individual or entity by alleging that the Software or any Contribution in it infringes patents, then any patent license granted to you under this License for the Software shall terminate as of the date such litigation or activity is filed or taken. + +3. No Trademark License + +No trademark license is granted to use the trade names, trademarks, service marks, or product names of Contributor, except as required to fulfill notice requirements in section 4. + +4. Distribution Restriction + +You may distribute the Software in any medium with or without modification, whether in source or executable forms, provided that you provide recipients with a copy of this License and retain copyright, patent, trademark and disclaimer statements in the Software. + +5. Disclaimer of Warranty and Limitation of Liability + +THE SOFTWARE AND CONTRIBUTION IN IT ARE PROVIDED WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED. IN NO EVENT SHALL ANY CONTRIBUTOR OR COPYRIGHT HOLDER BE LIABLE TO YOU FOR ANY DAMAGES, INCLUDING, BUT NOT LIMITED TO ANY DIRECT, OR INDIRECT, SPECIAL OR CONSEQUENTIAL DAMAGES ARISING FROM YOUR USE OR INABILITY TO USE THE SOFTWARE OR THE CONTRIBUTION IN IT, NO MATTER HOW IT'S CAUSED OR BASED ON WHICH LEGAL THEORY, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + +6. Language + +THIS LICENSE IS WRITTEN IN BOTH CHINESE AND ENGLISH, AND THE CHINESE VERSION AND ENGLISH VERSION SHALL HAVE THE SAME LEGAL EFFECT. IN THE CASE OF DIVERGENCE BETWEEN THE CHINESE AND ENGLISH VERSIONS, THE CHINESE VERSION SHALL PREVAIL. + +END OF THE TERMS AND CONDITIONS + +How to Apply the Mulan Permissive Software License,Version 2 (Mulan PSL v2) to Your Software + +To apply the Mulan PSL v2 to your work, for easy identification by recipients, you are suggested to complete following three steps: + +Fill in the blanks in following statement, including insert your software name, the year of the first publication of your software, and your name identified as the copyright owner; +Create a file named "LICENSE" which contains the whole context of this License in the first directory of your software package; +Attach the statement to the appropriate annotated syntax at the beginning of each source file. +Copyright (c) [Year] [name of copyright holder] +[Software Name] is licensed under Mulan PSL v2. +You can use this software according to the terms and conditions of the Mulan PSL v2. +You may obtain a copy of Mulan PSL v2 at: + http://license.coscl.org.cn/MulanPSL2 +THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, +EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, +MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. +See the Mulan PSL v2 for more details. +============================================================ +Notices for file(s): +/toolchains/lib/icu_font.a +/toolchains/lib/static_icustubdata.a +/toolchains/lib/static_icuuc.a +------------------------------------------------------------ +Notices for software(s): +Software: International Components for Unicode-Java 67.1 +Path: //../third_party/icu/icu4c/source/common +Software: International Components for Unicode-Java 67.1 +Path: //../third_party/icu/icu4c +------------------------------------------------------------ +UNICODE, INC. LICENSE AGREEMENT - DATA FILES AND SOFTWARE + +See Terms of Use +for definitions of Unicode Inc.’s Data Files and Software. + +NOTICE TO USER: Carefully read the following legal agreement. +BY DOWNLOADING, INSTALLING, COPYING OR OTHERWISE USING UNICODE INC.'S +DATA FILES ("DATA FILES"), AND/OR SOFTWARE ("SOFTWARE"), +YOU UNEQUIVOCALLY ACCEPT, AND AGREE TO BE BOUND BY, ALL OF THE +TERMS AND CONDITIONS OF THIS AGREEMENT. +IF YOU DO NOT AGREE, DO NOT DOWNLOAD, INSTALL, COPY, DISTRIBUTE OR USE +THE DATA FILES OR SOFTWARE. + +COPYRIGHT AND PERMISSION NOTICE + +Copyright © 1991-2022 Unicode, Inc. All rights reserved. +Distributed under the Terms of Use in https://www.unicode.org/copyright.html. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of the Unicode data files and any associated documentation +(the "Data Files") or Unicode software and any associated documentation +(the "Software") to deal in the Data Files or Software +without restriction, including without limitation the rights to use, +copy, modify, merge, publish, distribute, and/or sell copies of +the Data Files or Software, and to permit persons to whom the Data Files +or Software are furnished to do so, provided that either +(a) this copyright and permission notice appear with all copies +of the Data Files or Software, or +(b) this copyright and permission notice appear in associated +Documentation. + +THE DATA FILES AND SOFTWARE ARE PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE +WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT OF THIRD PARTY RIGHTS. +IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN THIS +NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL +DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, +DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER +TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THE DATA FILES OR SOFTWARE. + +Except as contained in this notice, the name of a copyright holder +shall not be used in advertising or otherwise to promote the sale, +use or other dealings in these Data Files or Software without prior +written authorization of the copyright holder. + +---------------------------------------------------------------------- + +Third-Party Software Licenses + +This section contains third-party software notices and/or additional +terms for licensed third-party software components included within ICU +libraries. + +---------------------------------------------------------------------- + +ICU License - ICU 1.8.1 to ICU 57.1 + +COPYRIGHT AND PERMISSION NOTICE + +Copyright (c) 1995-2016 International Business Machines Corporation and others +All rights reserved. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, and/or sell copies of the Software, and to permit persons +to whom the Software is furnished to do so, provided that the above +copyright notice(s) and this permission notice appear in all copies of +the Software and that both the above copyright notice(s) and this +permission notice appear in supporting documentation. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT +OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY +SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER +RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF +CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN +CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + +Except as contained in this notice, the name of a copyright holder +shall not be used in advertising or otherwise to promote the sale, use +or other dealings in this Software without prior written authorization +of the copyright holder. + +All trademarks and registered trademarks mentioned herein are the +property of their respective owners. + +---------------------------------------------------------------------- + +Chinese/Japanese Word Break Dictionary Data (cjdict.txt) + + # The Google Chrome software developed by Google is licensed under + # the BSD license. Other software included in this distribution is + # provided under other licenses, as set forth below. + # + # The BSD License + # http://opensource.org/licenses/bsd-license.php + # Copyright (C) 2006-2008, Google Inc. + # + # All rights reserved. + # + # Redistribution and use in source and binary forms, with or without + # modification, are permitted provided that the following conditions are met: + # + # Redistributions of source code must retain the above copyright notice, + # this list of conditions and the following disclaimer. + # Redistributions in binary form must reproduce the above + # copyright notice, this list of conditions and the following + # disclaimer in the documentation and/or other materials provided with + # the distribution. + # Neither the name of Google Inc. nor the names of its + # contributors may be used to endorse or promote products derived from + # this software without specific prior written permission. + # + # + # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND + # CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + # INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + # DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + # BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + # LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + # + # + # The word list in cjdict.txt are generated by combining three word lists + # listed below with further processing for compound word breaking. The + # frequency is generated with an iterative training against Google web + # corpora. + # + # * Libtabe (Chinese) + # - https://sourceforge.net/project/?group_id=1519 + # - Its license terms and conditions are shown below. + # + # * IPADIC (Japanese) + # - http://chasen.aist-nara.ac.jp/chasen/distribution.html + # - Its license terms and conditions are shown below. + # + # ---------COPYING.libtabe ---- BEGIN-------------------- + # + # /* + # * Copyright (c) 1999 TaBE Project. + # * Copyright (c) 1999 Pai-Hsiang Hsiao. + # * All rights reserved. + # * + # * Redistribution and use in source and binary forms, with or without + # * modification, are permitted provided that the following conditions + # * are met: + # * + # * . Redistributions of source code must retain the above copyright + # * notice, this list of conditions and the following disclaimer. + # * . Redistributions in binary form must reproduce the above copyright + # * notice, this list of conditions and the following disclaimer in + # * the documentation and/or other materials provided with the + # * distribution. + # * . Neither the name of the TaBE Project nor the names of its + # * contributors may be used to endorse or promote products derived + # * from this software without specific prior written permission. + # * + # * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + # * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + # * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + # * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + # * REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + # * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + # * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + # * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + # * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + # * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + # * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + # * OF THE POSSIBILITY OF SUCH DAMAGE. + # */ + # + # /* + # * Copyright (c) 1999 Computer Systems and Communication Lab, + # * Institute of Information Science, Academia + # * Sinica. All rights reserved. + # * + # * Redistribution and use in source and binary forms, with or without + # * modification, are permitted provided that the following conditions + # * are met: + # * + # * . Redistributions of source code must retain the above copyright + # * notice, this list of conditions and the following disclaimer. + # * . Redistributions in binary form must reproduce the above copyright + # * notice, this list of conditions and the following disclaimer in + # * the documentation and/or other materials provided with the + # * distribution. + # * . Neither the name of the Computer Systems and Communication Lab + # * nor the names of its contributors may be used to endorse or + # * promote products derived from this software without specific + # * prior written permission. + # * + # * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + # * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + # * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + # * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + # * REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + # * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + # * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + # * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + # * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + # * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + # * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + # * OF THE POSSIBILITY OF SUCH DAMAGE. + # */ + # + # Copyright 1996 Chih-Hao Tsai @ Beckman Institute, + # University of Illinois + # c-tsai4@uiuc.edu http://casper.beckman.uiuc.edu/~c-tsai4 + # + # ---------------COPYING.libtabe-----END-------------------------------- + # + # + # ---------------COPYING.ipadic-----BEGIN------------------------------- + # + # Copyright 2000, 2001, 2002, 2003 Nara Institute of Science + # and Technology. All Rights Reserved. + # + # Use, reproduction, and distribution of this software is permitted. + # Any copy of this software, whether in its original form or modified, + # must include both the above copyright notice and the following + # paragraphs. + # + # Nara Institute of Science and Technology (NAIST), + # the copyright holders, disclaims all warranties with regard to this + # software, including all implied warranties of merchantability and + # fitness, in no event shall NAIST be liable for + # any special, indirect or consequential damages or any damages + # whatsoever resulting from loss of use, data or profits, whether in an + # action of contract, negligence or other tortuous action, arising out + # of or in connection with the use or performance of this software. + # + # A large portion of the dictionary entries + # originate from ICOT Free Software. The following conditions for ICOT + # Free Software applies to the current dictionary as well. + # + # Each User may also freely distribute the Program, whether in its + # original form or modified, to any third party or parties, PROVIDED + # that the provisions of Section 3 ("NO WARRANTY") will ALWAYS appear + # on, or be attached to, the Program, which is distributed substantially + # in the same form as set out herein and that such intended + # distribution, if actually made, will neither violate or otherwise + # contravene any of the laws and regulations of the countries having + # jurisdiction over the User or the intended distribution itself. + # + # NO WARRANTY + # + # The program was produced on an experimental basis in the course of the + # research and development conducted during the project and is provided + # to users as so produced on an experimental basis. Accordingly, the + # program is provided without any warranty whatsoever, whether express, + # implied, statutory or otherwise. The term "warranty" used herein + # includes, but is not limited to, any warranty of the quality, + # performance, merchantability and fitness for a particular purpose of + # the program and the nonexistence of any infringement or violation of + # any right of any third party. + # + # Each user of the program will agree and understand, and be deemed to + # have agreed and understood, that there is no warranty whatsoever for + # the program and, accordingly, the entire risk arising from or + # otherwise connected with the program is assumed by the user. + # + # Therefore, neither ICOT, the copyright holder, or any other + # organization that participated in or was otherwise related to the + # development of the program and their respective officials, directors, + # officers and other employees shall be held liable for any and all + # damages, including, without limitation, general, special, incidental + # and consequential damages, arising out of or otherwise in connection + # with the use or inability to use the program or any product, material + # or result produced or otherwise obtained by using the program, + # regardless of whether they have been advised of, or otherwise had + # knowledge of, the possibility of such damages at any time during the + # project or thereafter. Each user will be deemed to have agreed to the + # foregoing by his or her commencement of use of the program. The term + # "use" as used herein includes, but is not limited to, the use, + # modification, copying and distribution of the program and the + # production of secondary products from the program. + # + # In the case where the program, whether in its original form or + # modified, was distributed or delivered to or received by a user from + # any person, organization or entity other than ICOT, unless it makes or + # grants independently of ICOT any specific warranty to the user in + # writing, such person, organization or entity, will also be exempted + # from and not be held liable to the user for any such damages as noted + # above as far as the program is concerned. + # + # ---------------COPYING.ipadic-----END---------------------------------- + +---------------------------------------------------------------------- + +Lao Word Break Dictionary Data (laodict.txt) + + # Copyright (C) 2016 and later: Unicode, Inc. and others. + # License & terms of use: http://www.unicode.org/copyright.html + # Copyright (c) 2015 International Business Machines Corporation + # and others. All Rights Reserved. + # + # Project: https://github.com/rober42539/lao-dictionary + # Dictionary: https://github.com/rober42539/lao-dictionary/laodict.txt + # License: https://github.com/rober42539/lao-dictionary/LICENSE.txt + # (copied below) + # + # This file is derived from the above dictionary version of Nov 22, 2020 + # ---------------------------------------------------------------------- + # Copyright (C) 2013 Brian Eugene Wilson, Robert Martin Campbell. + # All rights reserved. + # + # Redistribution and use in source and binary forms, with or without + # modification, are permitted provided that the following conditions are met: + # + # Redistributions of source code must retain the above copyright notice, this + # list of conditions and the following disclaimer. Redistributions in binary + # form must reproduce the above copyright notice, this list of conditions and + # the following disclaimer in the documentation and/or other materials + # provided with the distribution. + # + # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + # FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + # COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + # INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + # SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + # STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + # OF THE POSSIBILITY OF SUCH DAMAGE. + # -------------------------------------------------------------------------- + +---------------------------------------------------------------------- + +Burmese Word Break Dictionary Data (burmesedict.txt) + + # Copyright (c) 2014 International Business Machines Corporation + # and others. All Rights Reserved. + # + # This list is part of a project hosted at: + # github.com/kanyawtech/myanmar-karen-word-lists + # + # -------------------------------------------------------------------------- + # Copyright (c) 2013, LeRoy Benjamin Sharon + # All rights reserved. + # + # Redistribution and use in source and binary forms, with or without + # modification, are permitted provided that the following conditions + # are met: Redistributions of source code must retain the above + # copyright notice, this list of conditions and the following + # disclaimer. Redistributions in binary form must reproduce the + # above copyright notice, this list of conditions and the following + # disclaimer in the documentation and/or other materials provided + # with the distribution. + # + # Neither the name Myanmar Karen Word Lists, nor the names of its + # contributors may be used to endorse or promote products derived + # from this software without specific prior written permission. + # + # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND + # CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + # INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + # DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS + # BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED + # TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + # ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + # TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF + # THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + # SUCH DAMAGE. + # -------------------------------------------------------------------------- + +---------------------------------------------------------------------- + +Time Zone Database + + ICU uses the public domain data and code derived from Time Zone +Database for its time zone support. The ownership of the TZ database +is explained in BCP 175: Procedure for Maintaining the Time Zone +Database section 7. + + # 7. Database Ownership + # + # The TZ database itself is not an IETF Contribution or an IETF + # document. Rather it is a pre-existing and regularly updated work + # that is in the public domain, and is intended to remain in the + # public domain. Therefore, BCPs 78 [RFC5378] and 79 [RFC3979] do + # not apply to the TZ Database or contributions that individuals make + # to it. Should any claims be made and substantiated against the TZ + # Database, the organization that is providing the IANA + # Considerations defined in this RFC, under the memorandum of + # understanding with the IETF, currently ICANN, may act in accordance + # with all competent court orders. No ownership claims will be made + # by ICANN or the IETF Trust on the database or the code. Any person + # making a contribution to the database or code waives all rights to + # future claims in that contribution or in the TZ Database. + +---------------------------------------------------------------------- + +Google double-conversion + +Copyright 2006-2011, the V8 project authors. All rights reserved. +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + * Neither the name of Google Inc. nor the names of its + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +---------------------------------------------------------------------- + +File: aclocal.m4 (only for ICU4C) +Section: pkg.m4 - Macros to locate and utilise pkg-config. + + +Copyright © 2004 Scott James Remnant . +Copyright © 2012-2015 Dan Nicholson + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +02111-1307, USA. + +As a special exception to the GNU General Public License, if you +distribute this file as part of a program that contains a +configuration script generated by Autoconf, you may include it under +the same distribution terms that you use for the rest of that +program. + + +(The condition for the exception is fulfilled because +ICU4C includes a configuration script generated by Autoconf, +namely the `configure` script.) + +---------------------------------------------------------------------- + +File: config.guess (only for ICU4C) + + +This file is free software; you can redistribute it and/or modify it +under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, see . + +As a special exception to the GNU General Public License, if you +distribute this file as part of a program that contains a +configuration script generated by Autoconf, you may include it under +the same distribution terms that you use for the rest of that +program. This Exception is an additional permission under section 7 +of the GNU General Public License, version 3 ("GPLv3"). + + +(The condition for the exception is fulfilled because +ICU4C includes a configuration script generated by Autoconf, +namely the `configure` script.) + +---------------------------------------------------------------------- + +File: install-sh (only for ICU4C) + + +Copyright 1991 by the Massachusetts Institute of Technology + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation, and that the name of M.I.T. not be used in advertising or +publicity pertaining to distribution of the software without specific, +written prior permission. M.I.T. makes no representations about the +suitability of this software for any purpose. It is provided "as is" +without express or implied warranty. + +============================================================ +Notices for file(s): +/toolchains/lib/libpng_static.a +------------------------------------------------------------ +Notices for software(s): +Software: openEuler:libpng 1.6.38-1.oe2203sp1 +Path: //../third_party/libpng +------------------------------------------------------------ +COPYRIGHT NOTICE, DISCLAIMER, and LICENSE +========================================= + +PNG Reference Library License version 2 +--------------------------------------- + + * Copyright (c) 1995-2019 The PNG Reference Library Authors. + * Copyright (c) 2018-2019 Cosmin Truta. + * Copyright (c) 2000-2002, 2004, 2006-2018 Glenn Randers-Pehrson. + * Copyright (c) 1996-1997 Andreas Dilger. + * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc. + +The software is supplied "as is", without warranty of any kind, +express or implied, including, without limitation, the warranties +of merchantability, fitness for a particular purpose, title, and +non-infringement. In no event shall the Copyright owners, or +anyone distributing the software, be liable for any damages or +other liability, whether in contract, tort or otherwise, arising +from, out of, or in connection with the software, or the use or +other dealings in the software, even if advised of the possibility +of such damage. + +Permission is hereby granted to use, copy, modify, and distribute +this software, or portions hereof, for any purpose, without fee, +subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you + must not claim that you wrote the original software. If you + use this software in a product, an acknowledgment in the product + documentation would be appreciated, but is not required. + + 2. Altered source versions must be plainly marked as such, and must + not be misrepresented as being the original software. + + 3. This Copyright notice may not be removed or altered from any + source or altered source distribution. + + +PNG Reference Library License version 1 (for libpng 0.5 through 1.6.35) +----------------------------------------------------------------------- + +libpng versions 1.0.7, July 1, 2000, through 1.6.35, July 15, 2018 are +Copyright (c) 2000-2002, 2004, 2006-2018 Glenn Randers-Pehrson, are +derived from libpng-1.0.6, and are distributed according to the same +disclaimer and license as libpng-1.0.6 with the following individuals +added to the list of Contributing Authors: + + Simon-Pierre Cadieux + Eric S. Raymond + Mans Rullgard + Cosmin Truta + Gilles Vollant + James Yu + Mandar Sahastrabuddhe + Google Inc. + Vadim Barkov + +and with the following additions to the disclaimer: + + There is no warranty against interference with your enjoyment of + the library or against infringement. There is no warranty that our + efforts or the library will fulfill any of your particular purposes + or needs. This library is provided with all faults, and the entire + risk of satisfactory quality, performance, accuracy, and effort is + with the user. + +Some files in the "contrib" directory and some configure-generated +files that are distributed with libpng have other copyright owners, and +are released under other open source licenses. + +libpng versions 0.97, January 1998, through 1.0.6, March 20, 2000, are +Copyright (c) 1998-2000 Glenn Randers-Pehrson, are derived from +libpng-0.96, and are distributed according to the same disclaimer and +license as libpng-0.96, with the following individuals added to the +list of Contributing Authors: + + Tom Lane + Glenn Randers-Pehrson + Willem van Schaik + +libpng versions 0.89, June 1996, through 0.96, May 1997, are +Copyright (c) 1996-1997 Andreas Dilger, are derived from libpng-0.88, +and are distributed according to the same disclaimer and license as +libpng-0.88, with the following individuals added to the list of +Contributing Authors: + + John Bowler + Kevin Bracey + Sam Bushell + Magnus Holmgren + Greg Roelofs + Tom Tanner + +Some files in the "scripts" directory have other copyright owners, +but are released under this license. + +libpng versions 0.5, May 1995, through 0.88, January 1996, are +Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc. + +For the purposes of this copyright and license, "Contributing Authors" +is defined as the following set of individuals: + + Andreas Dilger + Dave Martindale + Guy Eric Schalnat + Paul Schmidt + Tim Wegner + +The PNG Reference Library is supplied "AS IS". The Contributing +Authors and Group 42, Inc. disclaim all warranties, expressed or +implied, including, without limitation, the warranties of +merchantability and of fitness for any purpose. The Contributing +Authors and Group 42, Inc. assume no liability for direct, indirect, +incidental, special, exemplary, or consequential damages, which may +result from the use of the PNG Reference Library, even if advised of +the possibility of such damage. + +Permission is hereby granted to use, copy, modify, and distribute this +source code, or portions hereof, for any purpose, without fee, subject +to the following restrictions: + + 1. The origin of this source code must not be misrepresented. + + 2. Altered versions must be plainly marked as such and must not + be misrepresented as being the original source. + + 3. This Copyright notice may not be removed or altered from any + source or altered source distribution. + +The Contributing Authors and Group 42, Inc. specifically permit, +without fee, and encourage the use of this source code as a component +to supporting the PNG file format in commercial products. If you use +this source code in a product, acknowledgment is not required but would +be appreciated. + +============================================================ +Notices for file(s): +/toolchains/lib/freetype_static.a +------------------------------------------------------------ +Notices for software(s): +Software: freetype 2.12.1-1.oe2203sp1 +Path: //../third_party/freetype +------------------------------------------------------------ +FREETYPE LICENSES +----------------- + +The FreeType 2 font engine is copyrighted work and cannot be used +legally without a software license. In order to make this project +usable to a vast majority of developers, we distribute it under two +mutually exclusive open-source licenses. + +This means that *you* must choose *one* of the two licenses described +below, then obey all its terms and conditions when using FreeType 2 in +any of your projects or products. + + - The FreeType License, found in the file `docs/FTL.TXT`, which is + similar to the original BSD license *with* an advertising clause + that forces you to explicitly cite the FreeType project in your + product's documentation. All details are in the license file. + This license is suited to products which don't use the GNU General + Public License. + + Note that this license is compatible to the GNU General Public + License version 3, but not version 2. + + - The GNU General Public License version 2, found in + `docs/GPLv2.TXT` (any later version can be used also), for + programs which already use the GPL. Note that the FTL is + incompatible with GPLv2 due to its advertisement clause. + +The contributed BDF and PCF drivers come with a license similar to +that of the X Window System. It is compatible to the above two +licenses (see files `src/bdf/README` and `src/pcf/README`). The same +holds for the source code files `src/base/fthash.c` and +`include/freetype/internal/fthash.h`; they wer part of the BDF driver +in earlier FreeType versions. + +The gzip module uses the zlib license (see `src/gzip/zlib.h`) which +too is compatible to the above two licenses. + +The MD5 checksum support (only used for debugging in development +builds) is in the public domain. + + +--- end of LICENSE.TXT --- + +============================================================ +Notices for file(s): +/toolchains/lib/abc2program_frontend_static.a +/toolchains/lib/libarkassembler_frontend_set_static.a +/toolchains/lib/libarkassembler_frontend_static.a +/toolchains/lib/libarkbase_frontend_set_static.a +/toolchains/lib/libarkbase_frontend_static.a +/toolchains/lib/libarkbase_static.a +/toolchains/lib/libarkbytecodeopt_frontend_static.a +/toolchains/lib/libarkcompiler_frontend_static.a +/toolchains/lib/libarkfile_frontend_set_static.a +/toolchains/lib/libarkfile_frontend_static.a +/toolchains/lib/libarkfile_static.a +/toolchains/lib/libarkziparchive_frontend_set_static.a +/toolchains/lib/libarkziparchive_frontend_static.a +/toolchains/lib/libarkziparchive_static.a +------------------------------------------------------------ +Notices for software(s): +Software: +Path: //../arkcompiler/runtime_core/abc2program +Software: +Path: //../arkcompiler/runtime_core/assembler +Software: +Path: //../arkcompiler/runtime_core/libpandabase +Software: +Path: //../arkcompiler/runtime_core/bytecode_optimizer +Software: +Path: //../arkcompiler/runtime_core/compiler +Software: +Path: //../arkcompiler/runtime_core/libpandafile +Software: +Path: //../arkcompiler/runtime_core/libziparchive +------------------------------------------------------------ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +============================================================ +Notices for file(s): +/toolchains/lib/libhilog_source_mac.a +------------------------------------------------------------ +Notices for software(s): +Software: +Path: //../base/hiviewdfx/hilog/frameworks/libhilog +------------------------------------------------------------ +Copyright (c) 2021 Huawei Device Co., Ltd. +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +============================================================ +Notices for file(s): +/toolchains/lib/libz.a +------------------------------------------------------------ +Notices for software(s): +Software: zlib v1.2.13 +Path: //../third_party/zlib +------------------------------------------------------------ +Copyright notice: + + (C) 1995-2022 Jean-loup Gailly and Mark Adler + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. + + Jean-loup Gailly Mark Adler + jloup@gzip.org madler@alumni.caltech.edu + diff --git a/language/arkts/extractor/sdk/hms/ets/api/@hms.ai.CardRecognition.d.ets b/language/arkts/extractor/sdk/hms/ets/api/@hms.ai.CardRecognition.d.ets new file mode 100755 index 00000000..c08de3c3 --- /dev/null +++ b/language/arkts/extractor/sdk/hms/ets/api/@hms.ai.CardRecognition.d.ets @@ -0,0 +1,174 @@ +/* + * Copyright (c) Huawei Technologies Co., Ltd. 2024-2024. All rights reserved. + */ +/** + * @file This module provides card recognition component. + * @kit VisionKit + */ +import { Callback } from '@ohos.base'; +/** + * This is a ui component used to identify card + * @syscap SystemCapability.AI.Component.CardRecognition + * @atomicservice + * @since 5.0.0(12) + */ +@Component +declare struct CardRecognition { + /** + * Supported card identification types. + * @type { CardType } + * @syscap SystemCapability.AI.Component.CardRecognition + * @atomicservice + * @since 5.0.0(12) + */ + supportType: CardType; + /** + * Card side to recognize. + * @type { CardSide } + * @default CardSide.DEFAULT + * @syscap SystemCapability.AI.Component.CardRecognition + * @atomicservice + * @since 5.0.0(12) + */ + cardSide?: CardSide; + /** + * Card recognition result callback. + * @type { Callback } + * @syscap SystemCapability.AI.Component.CardRecognition + * @atomicservice + * @since 5.0.0(12) + */ + callback: Callback; + /** + * Constructor used to create a CardRecognition object. + * @syscap SystemCapability.AI.Component.CardRecognition + * @atomicservice + * @since 5.0.0(12) + */ + build(): void; +} +/** + * Supported card identification types. + * + * @enum { number } + * @syscap SystemCapability.AI.Component.CardRecognition + * @atomicservice + * @since 5.0.0(12) + */ +declare enum CardType { + /** + * Card recognition automatic mode. + * + * @syscap SystemCapability.AI.Component.CardRecognition + * @atomicservice + * @since 5.0.0(12) + */ + CARD_AUTO = 0, + /** + * ID card. + * + * @syscap SystemCapability.AI.Component.CardRecognition + * @atomicservice + * @since 5.0.0(12) + */ + CARD_ID = 1, + /** + * Bank card. + * + * @syscap SystemCapability.AI.Component.CardRecognition + * @atomicservice + * @since 5.0.0(12) + */ + CARD_BANK = 2, + /** + * Passport. + * + * @syscap SystemCapability.AI.Component.CardRecognition + * @atomicservice + * @since 5.0.0(12) + */ + CARD_PASSPORT = 3, + /** + * Driver license. + * + * @syscap SystemCapability.AI.Component.CardRecognition + * @atomicservice + * @since 5.0.0(12) + */ + CARD_DRIVER_LICENSE = 4, + /** + * Vehicle license. + * + * @syscap SystemCapability.AI.Component.CardRecognition + * @atomicservice + * @since 5.0.0(12) + */ + CARD_VEHICLE_LICENSE = 5 +} +/** + * Card side to recognize. + * + * @enum { number } + * @syscap SystemCapability.AI.Component.CardRecognition + * @atomicservice + * @since 5.0.0(12) + */ +declare enum CardSide { + /** + * Front side. + * + * @syscap SystemCapability.AI.Component.CardRecognition + * @atomicservice + * @since 5.0.0(12) + */ + FRONT = 0, + /** + * Back side. + * + * @syscap SystemCapability.AI.Component.CardRecognition + * @atomicservice + * @since 5.0.0(12) + */ + BACK = 1, + /** + * Default side. + * + * @syscap SystemCapability.AI.Component.CardRecognition + * @atomicservice + * @since 5.0.0(12) + */ + DEFAULT = 2 +} +/** + * This is the card recognition result callback. + * @syscap SystemCapability.AI.Component.CardRecognition + * @atomicservice + * @since 5.0.0(12) + */ +declare interface CallbackParam { + /** + * Card recognition results. + * @type { number } + * @syscap SystemCapability.AI.Component.CardRecognition + * @atomicservice + * @since 5.0.0(12) + */ + code: number; + /** + * Card recognition type. + * @type { CardType } + * @syscap SystemCapability.AI.Component.CardRecognition + * @atomicservice + * @since 5.0.0(12) + */ + cardType?: CardType; + /** + * Card recognition card info. + * @type { Record> } + * @syscap SystemCapability.AI.Component.CardRecognition + * @atomicservice + * @since 5.0.0(12) + */ + cardInfo?: Record>; +} +export { CardRecognition, CardType, CardSide, CallbackParam }; diff --git a/language/arkts/extractor/sdk/hms/ets/api/@hms.ai.DocumentScanner.d.ets b/language/arkts/extractor/sdk/hms/ets/api/@hms.ai.DocumentScanner.d.ets new file mode 100755 index 00000000..8b75630f --- /dev/null +++ b/language/arkts/extractor/sdk/hms/ets/api/@hms.ai.DocumentScanner.d.ets @@ -0,0 +1,298 @@ +/* + * Copyright (c) Huawei Technologies Co., Ltd. 2024-2024. All rights reserved. + */ +/** + * @file This module provides card recognition component. + * @kit VisionKit + */ +/** + * This is a ui component used for generating document scans. + * @syscap SystemCapability.AI.Component.DocScan + * @atomicservice + * @since 5.0.0(12) + */ +@Component +declare struct DocumentScanner { + /** + * config for document scanner. + * + * @type { DocumentScannerConfig } + * @default [] + * @syscap SystemCapability.AI.Component.DocScan + * @atomicservice + * @since 5.0.0(12) + */ + scannerConfig: DocumentScannerConfig; + /** + * @param { (code: number, saveType: SaveOption, uris: string[]) => void } + * callback of the listened event, called when the Component is terminated. + * @syscap SystemCapability.AI.Component.DocScan + * @atomicservice + * @since 5.0.0(12) + */ + onResult: (code: number, saveType: SaveOption, uris: string[]) => void; + /** + * Constructor used to create a DocumentScanner object. + * @syscap SystemCapability.AI.Component.DocScan + * @atomicservice + * @since 5.0.0(12) + */ + build(): void; +} +/** + * The class of configuration of document scanner + * + * @typedef Configuration + * @syscap SystemCapability.AI.Component.DocScan + * @atomicservice + * @since 5.0.0(12) + */ +declare class DocumentScannerConfig { + /** + * Max number of shots supported. + * + * @type { number } + * @default 1 + * @max 12 + * @min 1 + * @syscap SystemCapability.AI.Component.DocScan + * @atomicservice + * @since 5.0.0(12) + */ + maxShotCount?: number; + /** + * Document type to be scanned. + * + * @type { DocType[] } + * @default [DocType.DOC] + * @syscap SystemCapability.AI.Component.DocScan + * @atomicservice + * @since 5.0.0(12) + */ + supportType: DocType[]; + /** + * Whether to support image selection from the gallery. + * + * @type { boolean } + * @default true + * @syscap SystemCapability.AI.Component.DocScan + * @atomicservice + * @since 5.0.0(12) + */ + isGallerySupported?: boolean; + /** + * Default filter id. + * + * @type { FilterId } + * @default FilterId.STRENGTHEN + * @syscap SystemCapability.AI.Component.DocScan + * @atomicservice + * @since 5.0.0(12) + */ + defaultFilterId?: FilterId; + /** + * WTabs needed to show to edit the image. + * + * @type { EditTab[] } + * @default [All EditTab] + * @syscap SystemCapability.AI.Component.DocScan + * @atomicservice + * @since 5.0.0(12) + */ + editTabs?: EditTab[]; + /** + * Default shooting mode, whether automatically or manually. + * + * @type { ShootingMode } + * @default ShootingMode.MANUAL + * @syscap SystemCapability.AI.Component.DocScan + * @atomicservice + * @since 5.0.0(12) + */ + defaultShootingMode?: ShootingMode; + /** + * Whether to show share button in edit page. + * + * @type { boolean } + * @default true + * @syscap SystemCapability.AI.Component.DocScan + * @atomicservice + * @since 5.0.0(12) + */ + isShareable?: boolean; + /** + * Whether to show share button in edit page. + * + * @type { SaveOption[] } + * @default [All SaveOption] + * @syscap SystemCapability.AI.Component.DocScan + * @atomicservice + * @since 5.0.0(12) + */ + saveOptions?: SaveOption[]; + /** + * Jump directly to the editing page based on the initial image provided. + * + * @type { string[] } + * @default [] + * @syscap SystemCapability.AI.Component.DocScan + * @atomicservice + * @since 5.0.0(12) + */ + originalUris?: string[]; +} +/** + * Enum for type of document to be scanned + * + * @enum { number } + * @syscap SystemCapability.AI.Component.DocScan + * @atomicservice + * @since 5.0.0(12) + */ +declare enum DocType { + /** + * Doc file + * + * @syscap SystemCapability.AI.Component.DocScan + * @atomicservice + * @since 5.0.0(12) + */ + DOC = 0, + /** + * Sheet file + * + * @syscap SystemCapability.AI.Component.DocScan + * @atomicservice + * @since 5.0.0(12) + */ + SHEET = 1 +} +/** + * Enum for id of filter on image + * + * @enum { number } + * @syscap SystemCapability.AI.Component.DocScan + * @atomicservice + * @since 5.0.0(12) + */ +declare enum FilterId { + /** + * Original filter + * + * @syscap SystemCapability.AI.Component.DocScan + * @atomicservice + * @since 5.0.0(12) + */ + ORIGINAL = 0, + /** + * Monochrome filter + * + * @syscap SystemCapability.AI.Component.DocScan + * @atomicservice + * @since 5.0.0(12) + */ + MONOCHROME = 1, + /** + * Strengthen filter + * + * @syscap SystemCapability.AI.Component.DocScan + * @atomicservice + * @since 5.0.0(12) + */ + STRENGTHEN = 2 +} +/** + * Enum for shooting mode, whether shoot automatically or manually + * + * @enum { number } + * @syscap SystemCapability.AI.Component.DocScan + * @atomicservice + * @since 5.0.0(12) + */ +declare enum ShootingMode { + /** + * Auto shoot + * + * @syscap SystemCapability.AI.Component.DocScan + * @atomicservice + * @since 5.0.0(12) + */ + AUTO = 0, + /** + * Manual shoot + * + * @syscap SystemCapability.AI.Component.DocScan + * @atomicservice + * @since 5.0.0(12) + */ + MANUAL = 1 +} +/** + * Enum for tool bar for editing image + * + * @enum { number } + * @syscap SystemCapability.AI.Component.DocScan + * @atomicservice + * @since 5.0.0(12) + */ +declare enum EditTab { + /** + * Rotate tab + * + * @syscap SystemCapability.AI.Component.DocScan + * @atomicservice + * @since 5.0.0(12) + */ + ROTATE_TAB = 0, + /** + * Delete tab + * + * @syscap SystemCapability.AI.Component.DocScan + * @atomicservice + * @since 5.0.0(12) + */ + DELETE_TAB = 1, + /** + * Reshoot tab + * + * @syscap SystemCapability.AI.Component.DocScan + * @atomicservice + * @since 5.0.0(12) + */ + RESHOOT_TAB = 2 +} +/** + * Enum for the saving format of image + * + * @enum { number } + * @syscap SystemCapability.AI.Component.DocScan + * @atomicservice + * @since 5.0.0(12) + */ +declare enum SaveOption { + /** + * Save JPG mode + * + * @syscap SystemCapability.AI.Component.DocScan + * @atomicservice + * @since 5.0.0(12) + */ + JPG = 0, + /** + * Save PDF mode + * + * @syscap SystemCapability.AI.Component.DocScan + * @atomicservice + * @since 5.0.0(12) + */ + PDF = 1, + /** + * Save EXCEL mode + * + * @syscap SystemCapability.AI.Component.DocScan + * @atomicservice + * @since 5.0.0(12) + */ + EXCEL = 2 +} +export { DocumentScanner, DocumentScannerConfig, DocType, FilterId, ShootingMode, EditTab, SaveOption }; diff --git a/language/arkts/extractor/sdk/hms/ets/api/@hms.ai.face.faceComparator.d.ts b/language/arkts/extractor/sdk/hms/ets/api/@hms.ai.face.faceComparator.d.ts new file mode 100755 index 00000000..26f6dbda --- /dev/null +++ b/language/arkts/extractor/sdk/hms/ets/api/@hms.ai.face.faceComparator.d.ts @@ -0,0 +1,53 @@ +/* + * Copyright (c) Huawei Technologies Co., Ltd. 2023-2023. All rights reserved. + */ +/** + * @file This module is used for face compare. + * @kit CoreVisionKit + * */ +import type image from '@ohos.multimedia.image'; +/** + * Identify and extract facial features, perform high-precision comparison on portraits, + * and provide confidence scores to determine whether the objects are the same person. + * @namespace faceComparator + * @syscap SystemCapability.AI.Face.Comparator + * @since 5.0.0(12) + */ +declare namespace faceComparator { + export interface VisionInfo { + /** + * Image information to be identified. + * @syscap SystemCapability.AI.Face.Comparator + * @since 5.0.0(12) + */ + readonly pixelMap: image.PixelMap; + } + export interface FaceCompareResult { + /** + * Determine if it's the same person + * @syscap SystemCapability.AI.Face.Comparator + * @since 5.0.0(12) + */ + readonly isSamePerson: boolean; + /** + * Calculate the similarity between two faces. The value ranges from 0 to 1. + * @syscap SystemCapability.AI.Face.Comparator + * @since 5.0.0(12) + */ + readonly similarity: number; + } + /** + * Recognize face information contained in pictures. + * @param { VisionInfo } visionInfo1 - The image information. + * @param { VisionInfo } visionInfo2 - The image information. + * @returns { Promise } The result of face comparison. + * @throws { BusinessError } 200 - Run timed out, please try again later. + * @throws { BusinessError } 401 - The parameter check failed. + * @throws { BusinessError } 1008400001 - Failed to run, please try again. + * @throws { BusinessError } 1008400002 - The service is abnormal. + * @syscap SystemCapability.AI.Face.Comparator + * @since 5.0.0(12) + */ + function compareFaces(visionInfo1: VisionInfo, visionInfo2: VisionInfo): Promise; +} +export default faceComparator; diff --git a/language/arkts/extractor/sdk/hms/ets/api/@hms.ai.face.faceDetector.d.ts b/language/arkts/extractor/sdk/hms/ets/api/@hms.ai.face.faceDetector.d.ts new file mode 100755 index 00000000..a04baec5 --- /dev/null +++ b/language/arkts/extractor/sdk/hms/ets/api/@hms.ai.face.faceDetector.d.ts @@ -0,0 +1,149 @@ +/* + * Copyright (c) Huawei Technologies Co., Ltd. 2023-2023. All rights reserved. + */ +/** + * @file This module is used for face detection. + * @kit CoreVisionKit + * */ +import type image from '@ohos.multimedia.image'; +/** + * This module is used for face detection. Specifically, it identifies multiple faces in a picture, + * return the number of faces, direction of each face, rectangular box of the face, and coordinates of the facial features. + * @namespace faceDetector + * @syscap SystemCapability.AI.Face.Detector + * @since 5.0.0(12) + */ +declare namespace faceDetector { + export interface VisionInfo { + /** + * Image information to be identified. + * @syscap SystemCapability.AI.Face.Detector + * @since 5.0.0(12) + */ + readonly pixelMap: image.PixelMap; + } + /** + * Indicates the position of the pixel point + * @interface Point + * @syscap SystemCapability.AI.Face.Detector + * @since 5.0.0(12) + */ + export interface FacePoint { + /** + * Horizontal coordinates of pixel point. + * @syscap SystemCapability.AI.Face.Detector + * @since 5.0.0(12) + */ + readonly x: number; + /** + * The vertical coordinate of the pixel point + * @syscap SystemCapability.AI.Face.Detector + * @since 5.0.0(12) + */ + readonly y: number; + } + /** + * Describe the orientation of a face in three-dimensional space. + * @interface FacePose + * @syscap SystemCapability.AI.Face.Detector + * @since 5.0.0(12) + */ + export interface FacePose { + /** + * Head-shaped yaw, rotating the object around the Y axis (localRotationY) + * @syscap SystemCapability.AI.Face.Detector + * @since 5.0.0(12) + */ + readonly yaw: number; + /** + * Head-shaped pitch, rotating the object around the X axis (localRotationX) + * @syscap SystemCapability.AI.Face.Detector + * @since 5.0.0(12) + */ + readonly pitch: number; + /** + * Head-shaped roll, rotating the object around the Z axis (localRotationZ) + * @syscap SystemCapability.AI.Face.Detector + * @since 5.0.0(12) + */ + readonly roll: number; + } + /** + * Describe the position and size of the face rectangle + * @interface FaceRectangle + * @syscap SystemCapability.AI.Face.Detector + * @since 5.0.0(12) + */ + export interface FaceRectangle { + /** + * Indicates the horizontal coordinate of the upper left corner of the face rectangle. + * @syscap SystemCapability.AI.Face.Detector + * @since 5.0.0(12) + */ + readonly left: number; + /** + * Indicates the vertical coordinate of the upper left corner of the face rectangle. + * @syscap SystemCapability.AI.Face.Detector + * @since 5.0.0(12) + */ + readonly top: number; + /** + * width of the face rectangle. + * @syscap SystemCapability.AI.Face.Detector + * @since 5.0.0(12) + */ + readonly width: number; + /** + * height of the face rectangle. + * @syscap SystemCapability.AI.Face.Detector + * @since 5.0.0(12) + */ + readonly height: number; + } + /** + * The result information of face recognition, including face number, coordinate information, and face + * detection results. + * @interface Face + * @syscap SystemCapability.AI.Face.Detector + * @since 5.0.0(12) + */ + export interface Face { + /** + * An array of numbers that represents the face detection results. The value range of each element + * @syscap SystemCapability.AI.Face.Detector + * @since 5.0.0(12) + */ + readonly probability: number; + /** + * detail for FacePose. + * @syscap SystemCapability.AI.Face.Detector + * @since 5.0.0(12) + */ + readonly pose: FacePose; + /** + * detail for FaceRectangle. + * @syscap SystemCapability.AI.Face.Detector + * @since 5.0.0(12) + */ + readonly rect: FaceRectangle; + /** + * detail for FacePoint. + * @syscap SystemCapability.AI.Face.Detector + * @since 5.0.0(12) + */ + readonly points: Array; + } + /** + * Recognize face information contained in pictures. + * @param { VisionInfo } visionInfo - The image information. + * @returns { Promise> } The result of face recognition. + * @throws { BusinessError } 200 - Run timed out, please try again later. + * @throws { BusinessError } 401 - The parameter check failed. + * @throws { BusinessError } 1008800001 - Failed to run, please try again. + * @throws { BusinessError } 1008800002 - The service is abnormal. + * @syscap SystemCapability.AI.Face.Detector + * @since 5.0.0(12) + */ + function detect(visionInfo: VisionInfo): Promise>; +} +export default faceDetector; diff --git a/language/arkts/extractor/sdk/hms/ets/api/@hms.ai.insightIntent.d.ts b/language/arkts/extractor/sdk/hms/ets/api/@hms.ai.insightIntent.d.ts new file mode 100755 index 00000000..f4bd71b3 --- /dev/null +++ b/language/arkts/extractor/sdk/hms/ets/api/@hms.ai.insightIntent.d.ts @@ -0,0 +1,229 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. All rights reserved. + */ +/** + * @file This module is used to share and delete InsightIntent. + * @kit IntentsKit + */ +import { AsyncCallback } from '@ohos.base'; +import common from '@ohos.app.ability.common'; +/** + * The module providers the capability to share and delete InsightIntent. + * The ability that support InsightIntent will be predicted and suggested to the user in system portal. + * + * @namespace insightIntent + * @syscap SystemCapability.AI.InsightIntent + * @since 4.0.0(10) + */ +declare namespace insightIntent { + /** + * Share the executed or expected InsightIntent. + * + * @param { common.BaseContext } context - Indicates the application context. + * @param { InsightIntent[] } intents - Indicates the intents to share. + * @param { AsyncCallback } callback - The callback of sharing intent result. + * @throws { BusinessError } 401 - The parameter check failed. + * @throws { BusinessError } 1000101101 - The application has not been registered with the InsightIntent. + * @throws { BusinessError } 1000101102 - HUAWEI Assistant has stopped providing services. + * @throws { BusinessError } 1000101103 - The switch of the app in the Data source has been turned off. + * @throws { BusinessError } 1000101104 - The number of sharing times exceeds the limit. + * @throws { BusinessError } 1000101105 - The size of a single shared data exceeds the limit. + * @throws { BusinessError } 1000101106 - Exceeded the maximum number of sharing times of all applications. + * @throws { BusinessError } 1000101201 - The service is abnormal. + * @syscap SystemCapability.AI.InsightIntent + * @since 4.0.0(10) + */ + function shareIntent(context: common.BaseContext, intents: InsightIntent[], callback: AsyncCallback): void; + /** + * Share the executed or expected InsightIntent. + * + * @param { common.BaseContext } context - Indicates the application context. + * @param { InsightIntent[] } intents - Indicates the intents to share. + * @returns { Promise } share intent result. + * @throws { BusinessError } 401 - The parameter check failed. + * @throws { BusinessError } 1000101101 - The application has not been registered with the InsightIntent. + * @throws { BusinessError } 1000101102 - HUAWEI Assistant has stopped providing services. + * @throws { BusinessError } 1000101103 - The switch of the app in the Data source has been turned off. + * @throws { BusinessError } 1000101104 - The number of sharing times exceeds the limit. + * @throws { BusinessError } 1000101105 - The size of a single shared data exceeds the limit. + * @throws { BusinessError } 1000101106 - Exceeded the maximum number of sharing times of all applications. + * @throws { BusinessError } 1000101201 - The service is abnormal. + * @syscap SystemCapability.AI.InsightIntent + * @since 4.0.0(10) + */ + function shareIntent(context: common.BaseContext, intents: InsightIntent[]): Promise; + /** + * Delete the InsightIntent. + * If the identifiers parameter is specified, the records corresponding to the identifiers under the intent + * name will be deleted. Otherwise, all the records under the intent name will be deleted. + * + * @param { common.BaseContext } context - Indicates the application context. + * @param { string } intentName - Indicates the name of the intent to be deleted. + * @param { string[] } identifiers - Indicates the identifiers of the intent to be deleted. + * @param { AsyncCallback } callback - The callback of deleting intent result. + * @throws { BusinessError } 401 - The parameter check failed. + * @throws { BusinessError } 1000101101 - The application has not been registered with the InsightIntent. + * @throws { BusinessError } 1000101201 - The service is abnormal. + * @syscap SystemCapability.AI.InsightIntent + * @since 4.0.0(10) + */ + function deleteIntent(context: common.BaseContext, intentName: string, identifiers: string[], callback: AsyncCallback): void; + /** + * Delete the InsightIntent. + * Delete all the records under the intent name. + * + * @param { common.BaseContext } context - Indicates the application context. + * @param { string } intentName - Indicates the name of the intent to be deleted. + * @param { AsyncCallback } callback - The callback of deleting intent result. + * @throws { BusinessError } 401 - The parameter check failed. + * @throws { BusinessError } 1000101101 - The application has not been registered with the InsightIntent. + * @throws { BusinessError } 1000101201 - The service is abnormal. + * @syscap SystemCapability.AI.InsightIntent + * @since 4.0.0(10) + */ + function deleteIntent(context: common.BaseContext, intentName: string, callback: AsyncCallback): void; + /** + * Delete the InsightIntent. + * If the identifiers parameter is specified, the records corresponding to the identifiers under the intent + * name will be deleted. Otherwise, all the records under the intent name will be deleted. + * + * @param { common.BaseContext } context - Indicates the application context. + * @param { string } intentName - Indicates the name of the intent to be deleted. + * @param { string[] } identifiers - Indicates the identifiers of the intent to be deleted. + * @returns { Promise } delete intent result. + * @throws { BusinessError } 401 - The parameter check failed. + * @throws { BusinessError } 1000101101 - The application has not been registered with the InsightIntent. + * @throws { BusinessError } 1000101201 - The service is abnormal. + * @syscap SystemCapability.AI.InsightIntent + * @since 4.0.0(10) + */ + function deleteIntent(context: common.BaseContext, intentName: string, identifiers?: string[]): Promise; + /** + * Delete the InsightIntent entities by entity ids under the entity name. + * + * @param { common.BaseContext } context - Indicates the application context. + * @param { string } entityName - Indicates the name of the entities to be deleted. + * @param { string[] } entityIds - Indicates the ids of the entities to be deleted. + * @param { AsyncCallback } callback - The callback of deleting entity result. + * @throws { BusinessError } 401 - The parameter check failed. + * @throws { BusinessError } 1000101101 - The application has not been registered with the InsightIntent. + * @throws { BusinessError } 1000101201 - The service is abnormal. + * @syscap SystemCapability.AI.InsightIntent + * @since 4.0.0(10) + */ + function deleteEntity(context: common.BaseContext, entityName: string, entityIds: string[], callback: AsyncCallback): void; + /** + * Delete the InsightIntent entities by entity ids under the entity name. + * + * @param { common.BaseContext } context - Indicates the application context. + * @param { string } entityName - Indicates the name of the entities to be deleted. + * @param { string[] } entityIds - Indicates the ids of the entities to be deleted. + * @returns { Promise } delete entity result. + * @throws { BusinessError } 401 - The parameter check failed. + * @throws { BusinessError } 1000101101 - The application has not been registered with the InsightIntent. + * @throws { BusinessError } 1000101201 - The service is abnormal. + * @syscap SystemCapability.AI.InsightIntent + * @since 4.0.0(10) + */ + function deleteEntity(context: common.BaseContext, entityName: string, entityIds: string[]): Promise; + /** + * Obtains a service open ID. + * + * @param { common.BaseContext } context - Indicates the application context. + * @param { boolean } renew - Whether to forcibly obtain a new service open ID from the cloud. true: yes; false: no. + * If false, obtain a service open ID that is stored locally. If there is no such a service open ID, obtain one from the cloud. + * @returns { Promise } Service Open Id. + * @throws { BusinessError } 401 - The parameter check failed. + * @throws { BusinessError } 1000101101 - The application has not been registered with the InsightIntent. + * @throws { BusinessError } 1000101102 - HUAWEI Assistant has stopped providing services. + * @throws { BusinessError } 1000101103 - The switch of the app in the Data source has been turned off. + * @throws { BusinessError } 1000101107 - Too many Service Open ID renew requests. + * @throws { BusinessError } 1000101201 - The service is abnormal. + * @syscap SystemCapability.AI.InsightIntent + * @since 5.0.0(12) + */ + function getSid(context: common.BaseContext, renew: boolean): Promise; + /** + * Indicates the InsightIntent. + * + * @typedef InsightIntent + * @syscap SystemCapability.AI.InsightIntent + * @since 4.0.0(10) + */ + interface InsightIntent { + /** + * Indicates the name of the intent. + * + * @syscap SystemCapability.AI.InsightIntent + * @since 4.0.0(10) + */ + intentName: string; + /** + * Indicates the version of the intent. + * + * @syscap SystemCapability.AI.InsightIntent + * @since 4.0.0(10) + */ + intentVersion: string; + /** + * Indicates the identifier of the intent. + * + * @syscap SystemCapability.AI.InsightIntent + * @since 4.0.0(10) + */ + identifier: string; + /** + * Indicates action info of the intent. + * + * @type { object } + * @syscap SystemCapability.AI.InsightIntent + * @since 4.0.0(10) + */ + /** + * Indicates action info of the intent. + * + * @type { IntentActionInfo } + * @syscap SystemCapability.AI.InsightIntent + * @since 5.0.0(12) + */ + intentActionInfo: IntentActionInfo; + /** + * Indicates entity info of the intent. + * + * @type { object } + * @syscap SystemCapability.AI.InsightIntent + * @since 4.0.0(10) + */ + /** + * Indicates entity info of the intent. + * + * @type { IntentEntityInfo } + * @syscap SystemCapability.AI.InsightIntent + * @since 5.0.0(12) + */ + intentEntityInfo: IntentEntityInfo; + } + /** + * Indicates the IntentEntityInfo. + * + * @typedef IntentEntityInfo + * @syscap SystemCapability.AI.InsightIntent + * @since 5.0.0(12) + */ + interface IntentEntityInfo { + entityId: string; + entityName: string; + [key: string]: Object; + } + /** + * Indicates the IntentActionInfo. + * + * @typedef IntentActionInfo + * @syscap SystemCapability.AI.InsightIntent + * @since 5.0.0(12) + */ + interface IntentActionInfo { + [key: string]: Object; + } +} +export default insightIntent; diff --git a/language/arkts/extractor/sdk/hms/ets/api/@hms.ai.interactiveLiveness.d.ts b/language/arkts/extractor/sdk/hms/ets/api/@hms.ai.interactiveLiveness.d.ts new file mode 100755 index 00000000..c86b4cca --- /dev/null +++ b/language/arkts/extractor/sdk/hms/ets/api/@hms.ai.interactiveLiveness.d.ts @@ -0,0 +1,259 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. All rights reserved. + */ +/** + * @file This module is used for face liveness detection. + * @kit VisionKit + * @bundle com.huawei.hmsapp.hiai.hsp/interactivelivenessHsp/Index 5.0.0(12) + * */ +import type image from '@ohos.multimedia.image'; +/** + * This module provides motion liveness detection and silent liveness detection applications. + * The application module is developed through the system-level hsp. + * + * @namespace interactiveLiveness + * @syscap SystemCapability.AI.Component.LivenessDetect + * @atomicservice + * @since 5.0.0(12) + */ +declare namespace interactiveLiveness { + /** + * Action Type Enumeration. + * + * @syscap SystemCapability.AI.Component.LivenessDetect + * @atomicservice + * @since 5.0.0(12) + * */ + enum DetectionMode { + /** + * indicates that the action is alive. + * + * @syscap SystemCapability.AI.Component.LivenessDetect + * @atomicservice + * @since 5.0.0(12) + * */ + INTERACTIVE_MODE = 'INTERACTIVE_MODE', + /** + * denotes silent living body. + * + * @syscap SystemCapability.AI.Component.LivenessDetect + * @atomicservice + * @since 5.0.0(12) + * */ + SILENT_MODE = 'SILENT_MODE' + } + /** + * Action Count Enumeration. + * + * @syscap SystemCapability.AI.Component.LivenessDetect + * @atomicservice + * @since 5.0.0(12) + * */ + enum ActionsNumber { + /** + * One action. + * Pick one action at random. + * + * @syscap SystemCapability.AI.Component.LivenessDetect + * @atomicservice + * @since 5.0.0(12) + */ + ONE_ACTION = 1, + /** + * Two actions. + * Pick two actions at random. + * + * @syscap SystemCapability.AI.Component.LivenessDetect + * @atomicservice + * @since 5.0.0(12) + */ + TWO_ACTION = 2, + /** + * Three actions. + * Pick three actions at random. + * + * @syscap SystemCapability.AI.Component.LivenessDetect + * @atomicservice + * @since 5.0.0(12) + */ + THREE_ACTION = 3, + /** + * Four actions. + * Pick four actions at random. + * + * @syscap SystemCapability.AI.Component.LivenessDetect + * @atomicservice + * @since 5.0.0(12) + */ + FOUR_ACTION = 4 + } + /** + * Route jump mode. + * + * @syscap SystemCapability.AI.Component.LivenessDetect + * @atomicservice + * @since 5.0.0(12) + * */ + enum RouteRedirectionMode { + /** + * back Jump mode. + * Use router.back to jump back after the collection is complete. + * + * @syscap SystemCapability.AI.Component.LivenessDetect + * @atomicservice + * @since 5.0.0(12) + */ + BACK_MODE = 'back', + /** + * Replace Jump mode. + * After the collection is complete, use router.replaceUrl to jump to the corresponding page. + * + * @syscap SystemCapability.AI.Component.LivenessDetect + * @atomicservice + * @since 5.0.0(12) + */ + REPLACE_MODE = 'replace' + } + /** + * External Configuration Interfaces. + * It's all optional. + * + * @syscap SystemCapability.AI.Component.LivenessDetect + * @atomicservice + * @since 5.0.0(12) + * */ + class InteractiveLivenessConfig { + /** + * Silent Living Default Action Living. + * + * @type { DetectionMode } + * @syscap SystemCapability.AI.Component.LivenessDetect + * @atomicservice + * @since 5.0.0(12) + */ + isSilentMode: DetectionMode; + /** + * The number of customized actions ranges from 1 to 4, and three actions are randomly selected by default. + * + * @type { ActionsNumber } + * @syscap SystemCapability.AI.Component.LivenessDetect + * @atomicservice + * @since 5.0.0(12) + */ + actionsNum?: ActionsNumber; + /** + * Failure page routing provides failure page by default. + * + * @type { string } + * @syscap SystemCapability.AI.Component.LivenessDetect + * @atomicservice + * @since 5.0.0(12) + */ + failedRouteUrl?: string; + /** + * Success page routing provides a success page by default. + * + * @type { string } + * @syscap SystemCapability.AI.Component.LivenessDetect + * @atomicservice + * @since 5.0.0(12) + */ + successfulRouteUrl?: string; + /** + * Route redirection mode. + * + * @type { RouteRedirectionMode } + * @syscap SystemCapability.AI.Component.LivenessDetect + * @atomicservice + * @since 5.0.0(12) + */ + routeMode?: RouteRedirectionMode; + } + /** + * The router.push redirection mode is used to access the HSP. + * + * @permission ohos.permission.ohos.permission.CAMERA + * @param { config } external configuration. + * @returns { Promise } Result of entering the liveness detection control. + * @throws { BusinessError } 1008301002 Route switching failed. + * @syscap SystemCapability.AI.Component.LivenessDetect + * @atomicservice + * @since 5.0.0(12) + * */ + function startLivenessDetection(config: InteractiveLivenessConfig): Promise; + /** + * Type of returned liveness detection. + * + * @syscap SystemCapability.AI.Component.LivenessDetect + * @atomicservice + * @since 5.0.0(12) + * */ + enum LivenessType { + /** + * Interactive liveness successfu1 result. + * + * @syscap SystemCapability.AI.Component.LivenessDetect + * @atomicservice + * @since 5.0.0(12) + * */ + INTERACTIVE_LIVENESS = 0, + /** + * Silent liveness successfu1 result. + * + * @syscap SystemCapability.AI.Component.LivenessDetect + * @atomicservice + * @since 5.0.0(12) + * */ + SILENT_LIVENESS = 1, + /** + * Not liveness failed result. + * + * @syscap SystemCapability.AI.Component.LivenessDetect + * @atomicservice + * @since 5.0.0(12) + * */ + NOT_LIVENESS = 2 + } + /** + * Return the detection result. + * + * @syscap SystemCapability.AI.Component.LivenessDetect + * @atomicservice + * @since 5.0.0(12) + * */ + class InteractiveLivenessResult { + /** + * Type of returned liveness detection. + * + * @type { LivenessType } + * @syscap SystemCapability.AI.Component.LivenessDetect + * @atomicservice + * @since 5.0.0(12) + * */ + livenessType: LivenessType; + /** + * Result image returned when the test result is successful. + * + * @type { image.PixelMap } + * @syscap SystemCapability.AI.Component.LivenessDetect + * @atomicservice + * @since 5.0.0(12) + * */ + mPixelMap?: image.PixelMap; + } + /** + * The result code and PixelMap image are obtained after the detection is successful. + * + * @returns { Promise } The results of the liveness test. + * @throws { BusinessError } 1008302000 Detection algorithm initialization. + * @throws { BusinessError } 1008302001 Detection timeout. + * @throws { BusinessError } 1008302002 Action mutual exclusion error. + * @throws { BusinessError } 1008302003 Continuity Check Failure. + * @throws { BusinessError } 1008302004 The test is not complete. + * @syscap SystemCapability.AI.Component.LivenessDetect + * @atomicservice + * @since 5.0.0(12) + * */ + function getInteractiveLivenessResult(): Promise; +} +export default interactiveLiveness; diff --git a/language/arkts/extractor/sdk/hms/ets/api/@hms.ai.nlp.textProcessing.d.ts b/language/arkts/extractor/sdk/hms/ets/api/@hms.ai.nlp.textProcessing.d.ts new file mode 100755 index 00000000..7e52c244 --- /dev/null +++ b/language/arkts/extractor/sdk/hms/ets/api/@hms.ai.nlp.textProcessing.d.ts @@ -0,0 +1,199 @@ +/* + * Copyright (c) Huawei Technologies Co., Ltd. 2024-2024. All rights reserved. + */ +/** + * @file This module is used for text nlu processing. + * @kit NaturalLanguageKit + */ +/** + * This module is used for text analysis, including text entity recognition and word segmentation. + * The returned result is object array Entity and WordSegmentResult object. + * @namespace textProcessing + * @syscap SystemCapability.AI.NaturalLanguage.TextProcessing + * @since 5.0.0(12) + */ +declare namespace textProcessing { + /** + * Configuration item obtained by the entity. + * @interface EntityConfig + * @syscap SystemCapability.AI.NaturalLanguage.TextProcessing + * @since 5.0.0(12) + */ + export interface EntityConfig { + /** + * Entity type configuration item. The structure is of the enumeration type. + * @syscap SystemCapability.AI.NaturalLanguage.TextProcessing + * @since 5.0.0(12) + */ + entityTypes?: EntityType[]; + } + /** + * Get entity method result. + * @interface Entity + * @syscap SystemCapability.AI.NaturalLanguage.TextProcessing + * @since 5.0.0(12) + */ + export interface Entity { + /** + * Original text of the entity. + * @syscap SystemCapability.AI.NaturalLanguage.TextProcessing + * @since 5.0.0(12) + */ + text: string; + /** + * Position of the entity in the original text. + * @syscap SystemCapability.AI.NaturalLanguage.TextProcessing + * @since 5.0.0(12) + */ + charOffset: number; + /** + * The type of the entity. + * @syscap SystemCapability.AI.NaturalLanguage.TextProcessing + * @since 5.0.0(12) + */ + type: EntityType; + /** + * Structured Information of the entity. + * @syscap SystemCapability.AI.NaturalLanguage.TextProcessing + * @since 5.0.0(12) + */ + jsonObject: string; + } + /** + * Result of word segmentation. + * @interface WordSegment + * @syscap SystemCapability.AI.NaturalLanguage.TextProcessing + * @since 5.0.0(12) + */ + export interface WordSegment { + /** + * the word in the getWordSegment method result. + * @syscap SystemCapability.AI.NaturalLanguage.TextProcessing + * @since 5.0.0(12) + */ + word: string; + /** + * The tag of word in the getWordSegment method result. + * @syscap SystemCapability.AI.NaturalLanguage.TextProcessing + * @since 5.0.0(12) + */ + wordTag: string; + } + /** + * Obtains the word segmentation result from the specified text, including basic words and part-of-speech. + * @param { string } text - The input text from js. + * @returns { Promise> } promise - The promise of getting getWordSegment result. + * @throws { BusinessError } 200 - Run timed out, please try again later. + * @throws { BusinessError } 401 - The parameter check failed. + * @throws { BusinessError } 1011200001 - Failed to run, please try again. + * @throws { BusinessError } 1011200002 - The service is abnormal. + * @syscap SystemCapability.AI.NaturalLanguage.TextProcessing + * @since 5.0.0(12) + */ + function getWordSegment(text: string): Promise>; + /** + * Get the entity from the given text. + * @param { string } text - The input text from js. + * @param { EntityConfig } entityConfig - Optional configuration item, which is the entity type. + * @param { string } text - The input text. + * @returns { Promise> } promise - The promise of getting getEntity result. + * @throws { BusinessError } 200 - Run timed out, please try again later. + * @throws { BusinessError } 401 - The parameter check failed. + * @throws { BusinessError } 1011200001 - Failed to run, please try again. + * @throws { BusinessError } 1011200002 - The service is abnormal. + * @syscap SystemCapability.AI.NaturalLanguage.TextProcessing + * @since 5.0.0(12) + */ + function getEntity(text: string, entityConfig?: EntityConfig): Promise>; + /** + * init nlp text processing. + * @returns { boolean } promise - Whether initialization is successful. + * @throws { BusinessError } 200 - Run timed out, please try again later. + * @throws { BusinessError } 401 - The parameter check failed. + * @throws { BusinessError } 1011200001 - Failed to run, please try again. + * @throws { BusinessError } 1011200002 - The service is abnormal. + * @syscap SystemCapability.AI.NaturalLanguage.TextProcessing + * @since 5.0.0(12) + */ + function init(): Promise; + /** + * release nlp text processing. + * @returns { boolean } promise - Whether release is successful. + * @throws { BusinessError } 200 - Run timed out, please try again later. + * @throws { BusinessError } 401 - The parameter check failed. + * @throws { BusinessError } 1011200001 - Failed to run, please try again. + * @throws { BusinessError } 1011200002 - The service is abnormal. + * @syscap SystemCapability.AI.NaturalLanguage.TextProcessing + * @since 5.0.0(12) + */ + function release(): Promise; +} +export default textProcessing; +/** + * Enumeration class of entity class + * @enum { string } + * @syscap SystemCapability.AI.NaturalLanguage.TextProcessing + * @since 5.0.0(12) + */ +export enum EntityType { + /** + * Time entity. + * @syscap SystemCapability.AI.NaturalLanguage.TextProcessing + * @since 5.0.0(12) + */ + DATETIME = 'datetime', + /** + * email entity. + * @syscap SystemCapability.AI.NaturalLanguage.TextProcessing + * @since 5.0.0(12) + */ + EMAIL = 'email', + /** + * Express number entity. + * @syscap SystemCapability.AI.NaturalLanguage.TextProcessing + * @since 5.0.0(12) + */ + EXPRESS_NO = 'expressNo', + /** + * Flight number Entity. + * @syscap SystemCapability.AI.NaturalLanguage.TextProcessing + * @since 5.0.0(12) + */ + FLIGHT_NO = 'flightNo', + /** + * Location entity. + * @syscap SystemCapability.AI.NaturalLanguage.TextProcessing + * @since 5.0.0(12) + */ + LOCATION = 'location', + /** + * name entity. + * @syscap SystemCapability.AI.NaturalLanguage.TextProcessing + * @since 5.0.0(12) + */ + NAME = 'name', + /** + * phone number entity. + * @syscap SystemCapability.AI.NaturalLanguage.TextProcessing + * @since 5.0.0(12) + */ + PHONE_NO = 'phoneNo', + /** + * url entity. + * @syscap SystemCapability.AI.NaturalLanguage.TextProcessing + * @since 5.0.0(12) + */ + URL = 'url', + /** + * Verification code entity. + * @syscap SystemCapability.AI.NaturalLanguage.TextProcessing + * @since 5.0.0(12) + */ + VERIFICATION_CODE = 'verificationCode', + /** + * ID number Entity. + * @syscap SystemCapability.AI.NaturalLanguage.TextProcessing + * @since 5.0.0(12) + */ + ID_NO = 'idNo' +} diff --git a/language/arkts/extractor/sdk/hms/ets/api/@hms.ai.ocr.textRecognition.d.ts b/language/arkts/extractor/sdk/hms/ets/api/@hms.ai.ocr.textRecognition.d.ts new file mode 100755 index 00000000..3ad9224e --- /dev/null +++ b/language/arkts/extractor/sdk/hms/ets/api/@hms.ai.ocr.textRecognition.d.ts @@ -0,0 +1,213 @@ +/* + * Copyright (c) Huawei Technologies Co., Ltd. 2023-2023. All rights reserved. + */ +/** + * @file This module provides the capabilities to image text recognition. + * @kit CoreVisionKit + */ +import type { AsyncCallback } from '@ohos.base'; +import type image from '@ohos.multimedia.image'; +/** + * This module is used for intelligent image text recognition. Specifically, it identifies text paragraphs, lines, and + * words in the image, and returns the corresponding coordinate information. The returned result can be used for UI interaction. + * @namespace textRecognition + * @syscap SystemCapability.AI.OCR.TextRecognition + * @since 4.0.0(10) + */ +declare namespace textRecognition { + /** + * This is the text recognition configuration. If the configuration can be specified during identification, + * the entire identification process will be accelerated. If not specified, general image text recognition will be + * performed by default. + * @interface TextRecognitionConfiguration + * @syscap SystemCapability.AI.OCR.TextRecognition + * @since 4.0.0(10) + */ + export interface TextRecognitionConfiguration { + /** + * The direction default value is true, that is, the default image is upright, and the direction + * does not need to be considered. + * @default true + * @syscap SystemCapability.AI.OCR.TextRecognition + * @since 4.0.0(10) + */ + isDirectionDetectionSupported?: boolean; + } + /** + * Visual configuration information, including related content such as pictures or video frame to be recognized. + * @interface VisionInfo + * @syscap SystemCapability.AI.OCR.TextRecognition + * @since 4.0.0(10) + */ + export interface VisionInfo { + /** + * Image information to be identified. + * @syscap SystemCapability.AI.OCR.TextRecognition + * @since 4.0.0(10) + */ + readonly pixelMap: image.PixelMap; + } + /** + * Indicates the position of the pixel point + * @interface PixelPoint + * @syscap SystemCapability.AI.OCR.TextRecognition + * @since 4.0.0(10) + */ + export interface PixelPoint { + /** + * Horizontal coordinates of pixel point. + * @syscap SystemCapability.AI.OCR.TextRecognition + * @since 4.0.0(10) + */ + readonly x: number; + /** + * The vertical coordinate of the pixel point + * @syscap SystemCapability.AI.OCR.TextRecognition + * @since 4.0.0(10) + */ + readonly y: number; + } + /** + * Describe the information of a word, including the content, and the coordinates of the outer frame. + * @interface TextWord + * @syscap SystemCapability.AI.OCR.TextRecognition + * @since 4.0.0(10) + */ + export interface TextWord { + /** + * The content of the word + * @syscap SystemCapability.AI.OCR.TextRecognition + * @since 4.0.0(10) + */ + readonly value: string; + /** + * Indicates the outline corner point of a word of text + * @syscap SystemCapability.AI.OCR.TextRecognition + * @since 4.0.0(10) + */ + readonly cornerPoints: Array; + } + /** + * Describes a line of text within an image. + * @interface TextLine + * @syscap SystemCapability.AI.OCR.TextRecognition + * @since 4.0.0(10) + */ + export interface TextLine { + /** + * Indicates the line content + * @syscap SystemCapability.AI.OCR.TextRecognition + * @since 4.0.0(10) + */ + readonly value: string; + /** + * Indicates the outline corner point of a line of text + * @syscap SystemCapability.AI.OCR.TextRecognition + * @since 4.0.0(10) + */ + readonly cornerPoints: Array; + /** + * Word information within a line of text. + * @syscap SystemCapability.AI.OCR.TextRecognition + * @since 4.0.0(10) + */ + readonly words: Array; + } + /** + * Describe the block of text within the image. + * @interface TextBlock + * @syscap SystemCapability.AI.OCR.TextRecognition + * @since 4.0.0(10) + */ + export interface TextBlock { + /** + * Indicates the block content + * @syscap SystemCapability.AI.OCR.TextRecognition + * @since 4.0.0(10) + */ + readonly value: string; + /** + * Indicates the line contents + * @syscap SystemCapability.AI.OCR.TextRecognition + * @since 4.0.0(10) + */ + readonly lines: Array; + } + /** + * The result information of text recognition, including text content and coordinate information. + * @interface TextRecognitionResult + * @syscap SystemCapability.AI.OCR.TextRecognition + * @since 4.0.0(10) + */ + export interface TextRecognitionResult { + /** + * Indicates the blocks content. + * @syscap SystemCapability.AI.OCR.TextRecognition + * @since 4.0.0(10) + */ + readonly value: string; + /** + * A lit of details for a block. + * @syscap SystemCapability.AI.OCR.TextRecognition + * @since 4.0.0(10) + */ + readonly blocks: Array; + } + /** + * Recognize text information contained in pictures. + * @param { VisionInfo } visionInfo - The image information. + * @param { AsyncCallback } callback - The callback of getting text recognition result. + * @throws { BusinessError } 200 - Run timed out, please try again later. + * @throws { BusinessError } 401 - The parameter check failed. + * @throws { BusinessError } 1001400001 - Failed to run, please try again. + * @throws { BusinessError } 1001400002 - The service is abnormal. + * @syscap SystemCapability.AI.OCR.TextRecognition + * @since 4.0.0(10) + */ + function recognizeText(visionInfo: VisionInfo, callback: AsyncCallback): void; + /** + * Recognize text information contained in pictures. + * @param { VisionInfo } visionInfo - The image information. + * @param { TextRecognitionConfiguration } configuration - the configuration information for text recognition. + * @returns { Promise } The result of text recognition. + * @throws { BusinessError } 200 - Run timed out, please try again later. + * @throws { BusinessError } 401 - The parameter check failed. + * @throws { BusinessError } 1001400001 - Failed to run, please try again. + * @throws { BusinessError } 1001400002 - The service is abnormal. + * @syscap SystemCapability.AI.OCR.TextRecognition + * @since 4.0.0(10) + */ + function recognizeText(visionInfo: VisionInfo, configuration?: TextRecognitionConfiguration): Promise; + /** + * Recognize text information contained in pictures. + * @param { VisionInfo } visionInfo - The image information to be recognized. + * @param { TextRecognitionConfiguration } configuration - the configuration information for text recognition. + * @param { AsyncCallback } callback - The callback of getting text recognition result. + * @throws { BusinessError } 200 - Run timed out, please try again later. + * @throws { BusinessError } 401 - The parameter check failed. + * @throws { BusinessError } 1001400001 - Failed to run, please try again. + * @throws { BusinessError } 1001400002 - The service is abnormal. + * @syscap SystemCapability.AI.OCR.TextRecognition + * @since 4.0.0(10) + */ + function recognizeText(visionInfo: VisionInfo, configuration: TextRecognitionConfiguration, callback: AsyncCallback): void; + /** + * Get the language types supported by the text recognition capability. + * @returns { Promise> } Returns a list of supported language types. + * @throws { BusinessError } 1001400001 - Failed to run, please try again. + * @throws { BusinessError } 1001400002 - The service is abnormal. + * @syscap SystemCapability.AI.OCR.TextRecognition + * @since 4.0.0(10) + */ + function getSupportedLanguages(): Promise>; + /** + * Get the language types supported by the text recognition capability. + * @param { AsyncCallback> } callback - The callback of supported language types. + * @throws { BusinessError } 1001400001 - Failed to run, please try again. + * @throws { BusinessError } 1001400002 - The service is abnormal. + * @syscap SystemCapability.AI.OCR.TextRecognition + * @since 4.0.0(10) + */ + function getSupportedLanguages(callback: AsyncCallback>): void; +} +export default textRecognition; diff --git a/language/arkts/extractor/sdk/hms/ets/api/@hms.ai.speechRecognizer.d.ts b/language/arkts/extractor/sdk/hms/ets/api/@hms.ai.speechRecognizer.d.ts new file mode 100755 index 00000000..f763806e --- /dev/null +++ b/language/arkts/extractor/sdk/hms/ets/api/@hms.ai.speechRecognizer.d.ts @@ -0,0 +1,367 @@ +/* + * Copyright (c) Huawei Technologies Co., Ltd. 2023-2023. All rights reserved. + */ +/** + * @file This module is used to convert speech to text. + * @kit CoreSpeechKit + */ +import type { AsyncCallback } from '@ohos.base'; +/** + * This module is used to convert speech to text. + * + * @namespace speechRecognizer + * @syscap SystemCapability.AI.SpeechRecognizer + * @since 4.1.0(11) + */ +declare namespace speechRecognizer { + /** + * Initialize SpeechRecognition engine with createEngineParams. + * If the engine is initialized, an engine instance will be returned by callback. Otherwise, an error code and description will be returned by callback. + * + * @param { CreateEngineParams } createEngineParams - The parameters of initializing engine. + * @param { AsyncCallback } callback - The callback of created instance. + * @throws { BusinessError } 1002200001 - Create engine failed. + * @throws { BusinessError } 1002200006 - The engine of speechRecognition is busy. + * @throws { BusinessError } 1002200008 - The engine of speechRecognition is being destroyed. + * @syscap SystemCapability.AI.SpeechRecognizer + * @since 4.1.0(11) + */ + function createEngine(createEngineParams: CreateEngineParams, callback: AsyncCallback): void; + /** + * Initialize SpeechRecognition engine with createEngineParams. + * If the engine is initialized, an engine instance will be returned by promise. Otherwise, an error code and description will be returned by promise. + * + * @param { CreateEngineParams } createEngineParams - The parameters of initializing engine. + * @returns { Promise } The result of instance. + * @throws { BusinessError } 1002200001 - Create engine failed. + * @throws { BusinessError } 1002200006 - The engine of SpeechRecognition is busy. + * @throws { BusinessError } 1002200008 - The engine of SpeechRecognition is being destroyed. + * @syscap SystemCapability.AI.SpeechRecognizer + * @since 4.1.0(11) + */ + function createEngine(createEngineParams: CreateEngineParams): Promise; + /** + * The definition of SpeechRecognition Engine. + * + * @interface SpeechRecognitionEngine + * @syscap SystemCapability.AI.SpeechRecognizer + * @since 4.1.0(11) + */ + export interface SpeechRecognitionEngine { + /** + * Set the callback of SpeechRecognition that will receive all information about the speech recognition. + * + * @param { RecognitionListener } listener - The callback function of recognition. + * @syscap SystemCapability.AI.SpeechRecognizer + * @since 4.1.0(11) + */ + setListener(listener: RecognitionListener): void; + /** + * Get the language types supported by the SpeechRecognition engine. + * + * @param { LanguageQuery } params - The Parameters of querying. + * @param { AsyncCallback> } callback - The callback of querying. + * @throws { BusinessError } 401 - The parameter check failed. + * @throws { BusinessError } 1002200007 - The engine is not initialized. + * @syscap SystemCapability.AI.SpeechRecognizer + * @since 4.1.0(11) + */ + listLanguages(params: LanguageQuery, callback: AsyncCallback>): void; + /** + * Get the language types supported by the SpeechRecognition engine. + * + * @param { LanguageQuery } params - The Parameters of querying. + * @returns { Promise> } The result of querying. + * @throws { BusinessError } 401 - The parameter check failed. + * @throws { BusinessError } 1002200007 - The engine is not initialized. + * @syscap SystemCapability.AI.SpeechRecognizer + * @since 4.1.0(11) + */ + listLanguages(params: LanguageQuery): Promise>; + /** + * Start the recognition process. + * Note that the setListener method must be invoked first. Otherwise, the callbacks of the recognition cannot be received. + * + * @param { StartParams } params - The Parameters of starting listening. + * @throws { BusinessError } 401 - The parameter check failed. + * @throws { BusinessError } 1002200002 - Start listening failed. + * @throws { BusinessError } 1002200007 - The engine is not initialized. + * @syscap SystemCapability.AI.SpeechRecognizer + * @since 4.1.0(11) + */ + startListening(params: StartParams): void; + /** + * Convert audio to text, and the length of audio data must be 640 or 1280. + * Note that the setListener method must be invoked first. Otherwise, the callbacks of the recognition cannot be received. + * Note that the startListening method must be invoked then. Otherwise, the writeAudio method will be failed. + * + * @param { string } sessionId - The session ID of recognition. + * @param { Uint8Array } audio - The data of recognition. + * @throws { BusinessError } 401 - The parameter check failed. + * @throws { BusinessError } 1002200003 - Exceeded the maximum audio length supported. + * @throws { BusinessError } 1002200007 - The engine is not initialized. + * @throws { BusinessError } 1002200010 - Write audio failed because the start listening is failed. + * @syscap SystemCapability.AI.SpeechRecognizer + * @since 4.1.0(11) + */ + writeAudio(sessionId: string, audio: Uint8Array): void; + /** + * Finish the recognition, and final recognition results will be received via Onresult method in RecognitionListener Object. + * Note that the setListener method must be invoked first. Otherwise, the callbacks of the recognition cannot be received. + * + * @param { string } sessionId - The session ID of recognition. + * @throws { BusinessError } 401 - The parameter check failed. + * @throws { BusinessError } 1002200004 - Finish recognition failed. + * @throws { BusinessError } 1002200007 - The engine is not initialized. + * @syscap SystemCapability.AI.SpeechRecognizer + * @since 4.1.0(11) + */ + finish(sessionId: string): void; + /** + * Cancel the recognition, and final recognition results will not be received. + * Note that the setListener method must be invoked first. Otherwise, the callbacks of the recognition cannot be received. + * + * @param { string } sessionId - The session ID of recognition. + * @throws { BusinessError } 401 - The parameter check failed. + * @throws { BusinessError } 1002200005 - Cancel recognition failed. + * @throws { BusinessError } 1002200007 - The engine is not initialized. + * @syscap SystemCapability.AI.SpeechRecognizer + * @since 4.1.0(11) + */ + cancel(sessionId: string): void; + /** + * Check whether the Speech Recognition engine is busy. + * Note that the setListener method must be invoked first. Otherwise, the callbacks of error cannot be received. + * + * @returns { boolean } True is returned if the SpeechRecognition engine is busy. Otherwise, false is returned. + * @throws { BusinessError } 1002200007 - The engine is not initialized. + * @syscap SystemCapability.AI.SpeechRecognizer + * @since 4.1.0(11) + */ + isBusy(): boolean; + /** + * Release the resources of SpeechRecognition engine. + * + * @syscap SystemCapability.AI.SpeechRecognizer + * @since 4.1.0(11) + */ + shutdown(): void; + } + /** + * The callback function of recognition. + * + * @interface RecognitionListener + * @syscap SystemCapability.AI.SpeechRecognizer + * @since 4.1.0(11) + */ + export interface RecognitionListener { + /** + * Indicates the callback for startListening success. + * + * @param { string } sessionId - The session ID of recognition. + * @param { string } eventMessage - The message of starting recognition. + * @syscap SystemCapability.AI.SpeechRecognizer + * @since 4.1.0(11) + */ + onStart(sessionId: string, eventMessage: string): void; + /** + * Indicates the callback for recognition event. + * + * @param { string } sessionId - The session ID of recognition. + * @param { number } eventCode - The event code of recognition. The value 1 indicates that the audio starts, and the value 3 indicates that the audio ends. + * @param { string } eventMessage - The event message of recognition. + * @syscap SystemCapability.AI.SpeechRecognizer + * @since 4.1.0(11) + */ + onEvent(sessionId: string, eventCode: number, eventMessage: string): void; + /** + * Indicates the callback for recognition result. + * + * @param { string } sessionId - The session ID of recognition. + * @param { SpeechRecognitionResult } result - The result of recognition. + * @syscap SystemCapability.AI.SpeechRecognizer + * @since 4.1.0(11) + */ + onResult(sessionId: string, result: SpeechRecognitionResult): void; + /** + * Indicates the callback for completing recognition. + * + * @param { string } sessionId - The session ID of recognition. + * @param { string } eventMessage - The message of completing recognition. + * @syscap SystemCapability.AI.SpeechRecognizer + * @since 4.1.0(11) + */ + onComplete(sessionId: string, eventMessage: string): void; + /** + * Indicates the callback of error. + * + * @param { string } sessionId - The session ID of recognition. + * @param { number } errorCode - The error code of recognition. + * @param { string } errorMessage - The detailed description of the error. + * @syscap SystemCapability.AI.SpeechRecognizer + * @since 4.1.0(11) + */ + onError(sessionId: string, errorCode: number, errorMessage: string): void; + } + /** + * The parameters of initializing engine. + * + * @interface CreateEngineParams + * @syscap SystemCapability.AI.SpeechRecognizer + * @since 4.1.0(11) + */ + export interface CreateEngineParams { + /** + * Indicates language info of the recognition. + * + * @syscap SystemCapability.AI.SpeechRecognizer + * @since 4.1.0(11) + */ + language: string; + /** + * Indicates module type of the recognition. + * The value 0 indicates online, value 1 indicates offline. + * + * @syscap SystemCapability.AI.SpeechRecognizer + * @since 4.1.0(11) + */ + online: number; + /** + * Indicates entity info of the speech. + * + * @syscap SystemCapability.AI.SpeechRecognizer + * @since 4.1.0(11) + */ + extraParams?: Record; + } + /** + * The Parameters of querying language types supported by SpeechRecognition engine. + * + * @interface LanguageQuery + * @syscap SystemCapability.AI.SpeechRecognizer + * @since 4.1.0(11) + */ + export interface LanguageQuery { + /** + * Indicates session ID of the recognition. + * + * @syscap SystemCapability.AI.SpeechRecognizer + * @since 4.1.0(11) + */ + sessionId: string; + /** + * Indicates entity info of the recognition. + * + * @syscap SystemCapability.AI.SpeechRecognizer + * @since 4.1.0(11) + */ + extraParams?: Record; + } + /** + * The parameters of starting recognition. + * + * @interface StartParams + * @syscap SystemCapability.AI.SpeechRecognizer + * @since 4.1.0(11) + */ + export interface StartParams { + /** + * Indicates session ID of the recognition. + * + * @syscap SystemCapability.AI.SpeechRecognizer + * @since 4.1.0(11) + */ + sessionId: string; + /** + * Indicates audio information of the recognition. + * + * @syscap SystemCapability.AI.SpeechRecognizer + * @since 4.1.0(11) + */ + audioInfo: AudioInfo; + /** + * Indicates entity info of the recognition. + * + * @syscap SystemCapability.AI.SpeechRecognizer + * @since 4.1.0(11) + */ + extraParams?: Record; + } + /** + * The parameters of audio information. + * + * @interface AudioInfo + * @syscap SystemCapability.AI.SpeechRecognizer + * @since 4.1.0(11) + */ + export interface AudioInfo { + /** + * Indicates audio type of the recognition. + * + * @syscap SystemCapability.AI.SpeechRecognizer + * @since 4.1.0(11) + */ + audioType: string; + /** + * Indicates sample rate of the recognition. + * + * @syscap SystemCapability.AI.SpeechRecognizer + * @since 4.1.0(11) + */ + sampleRate: number; + /** + * Indicates sound channel of the recognition. + * + * @syscap SystemCapability.AI.SpeechRecognizer + * @since 4.1.0(11) + */ + soundChannel: number; + /** + * Indicates sample bit of the recognition. + * + * @syscap SystemCapability.AI.SpeechRecognizer + * @since 4.1.0(11) + */ + sampleBit: number; + /** + * Indicates entity info of the recognition. + * + * @syscap SystemCapability.AI.SpeechRecognizer + * @since 4.1.0(11) + */ + extraParams?: Record; + } + /** + * The result of recognition. + * + * @interface SpeechRecognitionResult + * @syscap SystemCapability.AI.SpeechRecognizer + * @since 4.1.0(11) + */ + export interface SpeechRecognitionResult { + /** + * Indicates whether it is the final result of this sentence. + * The value true indicates the result is the final result of this sentence. + * + * @syscap SystemCapability.AI.SpeechRecognizer + * @since 4.1.0(11) + */ + isFinal: boolean; + /** + * Indicates whether it is the result of the last sentence. + * The value true indicates the result is the final result of this sentence. + * + * @syscap SystemCapability.AI.SpeechRecognizer + * @since 4.1.0(11) + */ + isLast: boolean; + /** + * Indicates the optimal result of recognition. + * + * @syscap SystemCapability.AI.SpeechRecognizer + * @since 4.1.0(11) + */ + result: string; + } +} +export default speechRecognizer; diff --git a/language/arkts/extractor/sdk/hms/ets/api/@hms.ai.textReader.d.ets b/language/arkts/extractor/sdk/hms/ets/api/@hms.ai.textReader.d.ets new file mode 100755 index 00000000..b1631f8a --- /dev/null +++ b/language/arkts/extractor/sdk/hms/ets/api/@hms.ai.textReader.d.ets @@ -0,0 +1,685 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. All rights reserved. + */ +/** + * @file This module is used for AI component textReader + * @kit SpeechKit + * @bundle com.huawei.hmsapp.hiai.hsp/textReaderHsp/Index 5.0.0(12) + * */ +import image from '@ohos.multimedia.image'; +import common from '@ohos.app.ability.common'; +import window from '@ohos.window'; +/** + * This module provides text-to-speech reader component + * The application module is developed through the system-level hsp. + * + * @namespace TextReader + * @syscap SystemCapability.AI.Component.TextReader + * @since 5.0.0(12) + */ +declare namespace TextReader { + /** + * Initialize textReader including player and model initialization. + * + * @param { common.BaseContext } context - Indicates the application context. + * @param { ReaderParam } - readParams, Indicates the params for text reader. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 1010600011 - Initialize failed. + * @syscap SystemCapability.AI.Component.TextReader + * @since 5.0.0(12) + */ + function init(context: common.BaseContext, readParams: ReaderParam): Promise; + /** + * release the resources of textReader. + * @throws { BusinessError } 1010600012 - The TextReader is not initialized. + * @syscap SystemCapability.AI.Component.TextReader + * @since 5.0.0(12) + */ + function release(): Promise; + /** + * Pull up the textReader player panel and start playing audio streams from the indicated article Id. + * @param { readInfoList } readInfoList. + * @param { articleId } - articleId. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 1010600012 - The TextReader is not initialized. + * @throws { BusinessError } 1010600013 - Text-to-speech engine error. + * @throws { BusinessError } 1010600014 - AudioRenderer play error. + * @throws { BusinessError } 1010600015 - Audio decode error. + * @throws { BusinessError } 1010600016 - AVSession error. + * @throws { BusinessError } 1010600017 - Other error. + * @syscap SystemCapability.AI.Component.TextReader + * @since 5.0.0(12) + */ + function start(readInfoList: ReadInfo[], articleId?: string): Promise; + /** + * Close the textReader player panel and stop playing audio streams. + * @throws { BusinessError } 1010600012 - The TextReader is not initialized. + * @syscap SystemCapability.AI.Component.TextReader + * @since 5.0.0(12) + */ + function stop(): Promise; + /** + * Pause audio stream playback. + * @throws { BusinessError } 1010600012 - The TextReader is not initialized. + * @syscap SystemCapability.AI.Component.TextReader + * @since 5.0.0(12) + */ + function pause(): void; + /** + * Resume audio stream playback. + * @throws { BusinessError } 1010600012 - The TextReader is not initialized. + * @throws { BusinessError } 1010600013 - TTS speak error. + * @throws { BusinessError } 1010600014 - AudioRenderer play error. + * @throws { BusinessError } 1010600015 - Audio decode error. + * @throws { BusinessError } 1010600016 - AvSession error. + * @syscap SystemCapability.AI.Component.TextReader + * @since 5.0.0(12) + */ + function resume(): void; + /** + * Hide the textReader player panel. + * @throws { BusinessError } 1010600012 - The TextReader is not initialized. + * @syscap SystemCapability.AI.Component.TextReader + * @since 5.0.0(12) + */ + function hidePanel(): void; + /** + * Show the textReader player panel. + * @throws { BusinessError } 1010600012 - The TextReader is not initialized. + * @syscap SystemCapability.AI.Component.TextReader + * @since 5.0.0(12) + */ + function showPanel(): void; + /** + * Query the reading state of the indicated article id. + * @param { id } id - Indicates the article id. + * @throws { BusinessError } 401 - Parameter error. + * @returns { ReadState } - ReadState is returned. + * @syscap SystemCapability.AI.Component.TextReader + * @since 5.0.0(12) + */ + function queryReadState(id?: string): ReadState; + /** + * Set the content of the indicated article id. + * @param { string } id - Indicates the article id. + * @param { content } string - Indicates the article content. + * @throws { BusinessError } 401 - Parameter error. + * @syscap SystemCapability.AI.Component.TextReader + * @since 5.0.0(12) + */ + function setArticleContent(id: string, content?: string): void; + /** + * Load more articles and set them to the playlist + * @param { ReadInfo[] } readInfos - Indicates the list of articles to be loaded. + * @param { boolean } isEnd - Indicates if no more content needed to be loaded. + * @throws { BusinessError } 401 - Parameter error. + * @syscap SystemCapability.AI.Component.TextReader + * @since 5.0.0(12) + */ + function loadMore(readInfos: ReadInfo[], isEnd: boolean): void; + /** + * Register player action callback + * @param { 'setArticle' } type - Registration Type, 'setArticle' + * @param { Callback } callback - Callback is invoked when the setArticle event is triggered. + * @throws { BusinessError } 401 - parameter check failed + * @syscap SystemCapability.AI.Component.TextReader + * @since 5.0.0(12) + */ + function on(type: 'setArticle', callback: Callback): void; + /** + * Unregister reader action callback + * @param { 'setArticle' } type - Registration Type, 'setArticle' + * @param { Callback } callback - Callback is invoked when the setArticle event is triggered. + * @throws { BusinessError } 401 - parameter check failed + * @syscap SystemCapability.AI.Component.TextReader + * @since 5.0.0(12) + */ + function off(type: 'setArticle', callback?: Callback): void; + /** + * Register reader action callback + * @param { 'clickArticle' } type - Registration Type, 'clickArticle' + * @param { Callback } callback - Callback is invoked when the clickArticle event is triggered. + * @throws { BusinessError } 401 - parameter check failed + * @syscap SystemCapability.AI.Component.TextReader + * @since 5.0.0(12) + */ + function on(type: 'clickArticle', callback: Callback): void; + /** + * Unregister reader action callback + * @param { 'clickArticle' } type - Registration Type, 'clickArticle' + * @param { Callback } callback - Callback is invoked when the clickArticle event is triggered. + * @throws { BusinessError } 401 - parameter check failed + * @syscap SystemCapability.AI.Component.TextReader + * @since 5.0.0(12) + */ + function off(type: 'clickArticle', callback?: Callback): void; + /** + * Register reader action callback + * @param { 'clickAuthor' } type - Registration Type, 'clickAuthor' + * @param { Callback } callback - Callback is invoked when the clickAuthor event is triggered. + * @throws { BusinessError } 401 - parameter check failed + * @syscap SystemCapability.AI.Component.TextReader + * @since 5.0.0(12) + */ + function on(type: 'clickAuthor', callback: Callback): void; + /** + * Unregister reader action callback + * @param { 'clickAuthor' } type - Registration Type, 'clickAuthor' + * @param { Callback } callback - Callback is invoked when the clickAuthor event is triggered. + * @throws { BusinessError } 401 - parameter check failed + * @syscap SystemCapability.AI.Component.TextReader + * @since 5.0.0(12) + */ + function off(type: 'clickAuthor', callback?: Callback): void; + /** + * Register reader action callback + * @param { 'clickNotification' } type - Registration Type, 'clickNotification' + * @param { Callback } callback - Callback is invoked when the clickNotification event is triggered. + * @throws { BusinessError } 401 - parameter check failed + * @syscap SystemCapability.AI.Component.TextReader + * @since 5.0.0(12) + */ + function on(type: 'clickNotification', callback: Callback): void; + /** + * Unregister reader action callback + * @param { 'clickNotification' } type - Registration Type, 'clickNotification' + * @param { Callback } callback - Callback is invoked when the clickNotification event is triggered. + * @throws { BusinessError } 401 - parameter check failed + * @syscap SystemCapability.AI.Component.TextReader + * @since 5.0.0(12) + */ + function off(type: 'clickNotification', callback?: Callback): void; + /** + * Register reader action callback + * @param { 'showPanel' } type - Registration Type, 'showPanel' + * @param { Callback } callback - Callback is invoked when the showPanel event is triggered. + * @throws { BusinessError } 401 - parameter check failed + * @syscap SystemCapability.AI.Component.TextReader + * @since 5.0.0(12) + */ + function on(type: 'showPanel', callback: Callback): void; + /** + * Unregister reader action callback + * @param { 'showPanel' } type - Registration Type, 'showPanel' + * @param { Callback } callback - Callback is invoked when the showPanel event is triggered. + * @throws { BusinessError } 401 - parameter check failed + * @syscap SystemCapability.AI.Component.TextReader + * @since 5.0.0(12) + */ + function off(type: 'showPanel', callback?: Callback): void; + /** + * Register reader action callback + * @param { 'hidePanel' } type - Registration Type, 'hidePanel' + * @param { Callback } callback - Callback is invoked when the hidePanel event is triggered. + * @throws { BusinessError } 401 - parameter check failed + * @syscap SystemCapability.AI.Component.TextReader + * @since 5.0.0(12) + */ + function on(type: 'hidePanel', callback: Callback): void; + /** + * Unregister reader action callback + * @param { 'hidePanel' } type - Registration Type, 'hidePanel' + * @param { Callback } callback - Callback is invoked when the hidePanel event is triggered. + * @throws { BusinessError } 401 - parameter check failed + * @syscap SystemCapability.AI.Component.TextReader + * @since 5.0.0(12) + */ + function off(type: 'hidePanel', callback?: Callback): void; + /** + * Register reader action callback + * @param { 'stop' } type - Registration Type, 'stop' + * @param { Callback } callback - Callback is invoked when the stop event is triggered. + * @throws { BusinessError } 401 - parameter check failed + * @syscap SystemCapability.AI.Component.TextReader + * @since 5.0.0(12) + */ + function on(type: 'stop', callback: Callback): void; + /** + * Unregister reader action callback + * @param { 'stop' } type - Registration Type, 'stop' + * @param { Callback } callback - Callback is invoked when the stop event is triggered. + * @throws { BusinessError } 401 - parameter check failed + * @syscap SystemCapability.AI.Component.TextReader + * @since 5.0.0(12) + */ + function off(type: 'stop', callback?: Callback): void; + /** + * Register reader action callback + * @param { 'release' } type - Registration Type, 'release' + * @param { Callback } callback - Callback is invoked when the release event is triggered. + * @throws { BusinessError } 401 - parameter check failed + * @syscap SystemCapability.AI.Component.TextReader + * @since 5.0.0(12) + */ + function on(type: 'release', callback: Callback): void; + /** + * Unregister reader action callback + * @param { 'release' } type - Registration Type, 'release' + * @param { Callback } callback - Callback is invoked when the release event is triggered. + * @throws { BusinessError } 401 - parameter check failed + * @syscap SystemCapability.AI.Component.TextReader + * @since 5.0.0(12) + */ + function off(type: 'release', callback?: Callback): void; + /** + * Register reader action callback + * @param { 'stateChange' } type - Registration Type, 'stateChange' + * @param { Callback } callback - Callback is invoked when the stateChange event is triggered. + * @throws { BusinessError } 401 - parameter check failed + * @syscap SystemCapability.AI.Component.TextReader + * @since 5.0.0(12) + */ + function on(type: 'stateChange', callback: Callback): void; + /** + * Unregister reader action callback + * @param { 'stateChange' } type - Registration Type, 'stateChange' + * @param { Callback } callback - Callback is invoked when the stateChange event is triggered. + * @throws { BusinessError } 401 - parameter check failed + * @syscap SystemCapability.AI.Component.TextReader + * @since 5.0.0(12) + */ + function off(type: 'stateChange', callback?: Callback): void; + /** + * Register reader action callback + * @param { 'requestMore' } type - Registration Type, 'requestMore' + * @param { Callback } callback - Callback is invoked when the requestMore event is triggered. + * @throws { BusinessError } 401 - parameter check failed + * @syscap SystemCapability.AI.Component.TextReader + * @since 5.0.0(12) + */ + function on(type: 'requestMore', callback: Callback): void; + /** + * Unregister reader action callback + * @param { 'requestMore' } type - Registration Type, 'requestMore' + * @param { Callback } callback - Callback is invoked when the requestMore event is triggered. + * @throws { BusinessError } 401 - parameter check failed + * @syscap SystemCapability.AI.Component.TextReader + * @since 5.0.0(12) + */ + function off(type: 'requestMore', callback?: Callback): void; + /** + * Register reader event callback + * @param { 'eventNotification' } type - Registration Type, 'eventNotification' + * @param { Callback } callback - Callback is invoked when the eventNotification event + * is triggered. + * @throws { BusinessError } 401 - parameter check failed + * @syscap SystemCapability.AI.Component.TextReader + * @since 5.0.0(12) + */ + function on(type: 'eventNotification', callback: Callback): void; + /** + * Unregister reader event callback + * @param { 'eventNotification' } type - Registration Type, 'eventNotification' + * @param { Callback } callback - Callback is invoked when the eventNotification event + * is triggered. + * @throws { BusinessError } 401 - parameter check failed + * @syscap SystemCapability.AI.Component.TextReader + * @since 5.0.0(12) + */ + function off(type: 'eventNotification', callback?: Callback): void; + /** + * Register reader event callback + * @param { 'eventPanel' } type - Registration Type, 'eventPanel' + * @param { Callback } callback - Callback is invoked when the eventPanel event is triggered. + * @throws { BusinessError } 401 - parameter check failed + * @syscap SystemCapability.AI.Component.TextReader + * @since 5.0.0(12) + */ + function on(type: 'eventPanel', callback: Callback): void; + /** + * Unregister reader event callback + * @param { 'eventPanel' } type - Registration Type, 'eventPanel' + * @param { Callback } callback - Callback is invoked when the eventPanel event is triggered. + * @throws { BusinessError } 401 - parameter check failed + * @syscap SystemCapability.AI.Component.TextReader + * @since 5.0.0(12) + */ + function off(type: 'eventPanel', callback?: Callback): void; + /** + * Register reader event callback + * @param { 'eventReadList' } type - Registration Type, 'eventReadList' + * @param { Callback> } callback - Callback is invoked when the eventReadList event + * is triggered. + * @throws { BusinessError } 401 - parameter check failed + * @syscap SystemCapability.AI.Component.TextReader + * @since 5.0.0(12) + */ + function on(type: 'eventReadList', callback: Callback>): void; + /** + * Unregister reader event callback + * @param { 'eventReadList' } type - Registration Type, 'eventReadList' + * @param { Callback> } callback - Callback is invoked when the eventReadList event + * is triggered. + * @throws { BusinessError } 401 - parameter check failed + * @syscap SystemCapability.AI.Component.TextReader + * @since 5.0.0(12) + */ + function off(type: 'eventReadList', callback?: Callback>): void; + /** + * The business brand information. + * + * @interface BusinessBrandInfo + * @syscap SystemCapability.AI.Component.TextReader + * @since 5.0.0(12) + */ + interface BusinessBrandInfo { + /** + * Brand name displayed on the panel + * @syscap SystemCapability.AI.Component.TextReader + * @since 5.0.0(12) + */ + panelName?: string; + /** + * Icon displayed on the panel + * @syscap SystemCapability.AI.Component.TextReader + * @since 5.0.0(12) + */ + panelIcon?: ResourceStr; + /** + * Icon displayed on the the notification bar + * @syscap SystemCapability.AI.Component.TextReader + * @since 5.0.0(12) + */ + notificationIcon?: ResourceStr; + /** + * Brand name displayed on the notification bar + * @syscap SystemCapability.AI.Component.TextReader + * @since 5.0.0(12) + */ + notificationName?: string; + } + /** + * Reader parameters for initialzation. + * + * @interface ReaderParam + * @syscap SystemCapability.AI.Component.TextReader + * @since 5.0.0(12) + */ + interface ReaderParam { + /** + * Display brand name, default to no + * @syscap SystemCapability.AI.Component.TextReader + * @since 5.0.0(12) + */ + isVoiceBrandVisible: boolean; + /** + * Business branch information + * @syscap SystemCapability.AI.Component.TextReader + * @since 5.0.0(12) + */ + businessBrandInfo?: BusinessBrandInfo; + /** + * Whether to set the fast forward/backward function to fast forward/backward for 15 seconds, + * default to no, that is, fast forward/backward the previous and next sentences + * @syscap SystemCapability.AI.Component.TextReader + * @since 5.0.0(12) + */ + isFastForward?: boolean; + /** + * Whether to support online audio stream synthesis, default to no + * mode: 0, online audio stream synthesis + * mode: 1, offline audio stream synthesis + * @syscap SystemCapability.AI.Component.TextReader + * @since 5.0.0(12) + */ + online?: number; + } + /** + * Text information structure, representing the attributes of text content and click ability. + * + * @interface TextInfo + * @syscap SystemCapability.AI.Component.TextReader + * @since 5.0.0(12) + */ + interface TextInfo { + /** + * Text content + * @syscap SystemCapability.AI.Component.TextReader + * @since 5.0.0(12) + */ + text: string; + /** + * The click ability of the text content + * @syscap SystemCapability.AI.Component.TextReader + * @since 5.0.0(12) + */ + isClickable: boolean; + } + /** + * The content information to be read aloud + * + * @interface ReadInfo + * @syscap SystemCapability.AI.Component.TextReader + * @since 5.0.0(12) + */ + interface ReadInfo { + /** + * ID of the article + * @syscap SystemCapability.AI.Component.TextReader + * @since 5.0.0(12) + */ + id: string; + /** + * Title of the article + * @syscap SystemCapability.AI.Component.TextReader + * @since 5.0.0(12) + */ + title: TextInfo; + /** + * Author of the article + * @syscap SystemCapability.AI.Component.TextReader + * @since 5.0.0(12) + */ + author?: TextInfo; + /** + * Date of the article + * @syscap SystemCapability.AI.Component.TextReader + * @since 5.0.0(12) + */ + date?: TextInfo; + /** + * Cover image of the article + * Format:PixelMap + * @syscap SystemCapability.AI.Component.TextReader + * @since 5.0.0(12) + */ + image?: image.PixelMap; + /** + * Body information of the article + * @syscap SystemCapability.AI.Component.TextReader + * @since 5.0.0(12) + */ + bodyInfo?: string; + /** + * Category of the article + * @syscap SystemCapability.AI.Component.TextReader + * @since 5.0.0(12) + */ + category?: string; + } + /** + * Notification business events + * + * @interface NotificationEvent + * @syscap SystemCapability.AI.Component.TextReader + * @since 5.0.0(12) + */ + interface NotificationEvent { + /** + * ID of the article + * @syscap SystemCapability.AI.Component.TextReader + * @since 5.0.0(12) + */ + id: string; + /** + * Type of the notification business events + * 1: Notification, + * 2: Broadcasting center + * @syscap SystemCapability.AI.Component.TextReader + * @since 5.0.0(12) + */ + type: number; + /** + * Notification bar or broadcast control center click event code + * NBC_01:Play button click + * NBC_02:Pause button click + * NBC_03:Close button click + * NBC_04:Prev button click + * NBC_05:Next button click + * NBC_06:Article cover click + * NBC_07:Article title click + * @syscap SystemCapability.AI.Component.TextReader + * @since 5.0.0(12) + */ + click: string; + } + /** + * Play panel events. + * + * @interface PanelEvent + * @syscap SystemCapability.AI.Component.TextReader + * @since 5.0.0(12) + */ + interface PanelEvent { + /** + * ID of the article + * @syscap SystemCapability.AI.Component.TextReader + * @since 5.0.0(12) + */ + id: string; + /** + * Panel click event code + * BPC_01:Panel-Play button click + * BPC_02:Panel-Pause button click + * BPC_03:Panel-Play prev button click + * BPC_04:Panel-Play next button click + * BPC_05:Panel-Play speed button click + * BPC_06:Panel-Person button click + * BPC_07:Panel-Article list button click + * BPC_08:Panel-Title click + * BPC_09:Panel-Author click + * BPC_10:Panel-close panel active (close button click of close slide) + * @syscap SystemCapability.AI.Component.TextReader + * @since 5.0.0(12) + */ + click: string; + } + /** + * Play list event. + * + * @interface ListEventState + * @syscap SystemCapability.AI.Component.TextReader + * @since 5.0.0(12) + */ + interface ListEventState { + /** + * ID of the article + * @syscap SystemCapability.AI.Component.TextReader + * @since 5.0.0(12) + */ + id: string; + } + /** + * Reading state. + * + * @interface ReadState + * @syscap SystemCapability.AI.Component.TextReader + * @since 5.0.0(12) + */ + interface ReadState { + /** + * ID of the article + * @syscap SystemCapability.AI.Component.TextReader + * @since 5.0.0(12) + */ + id: string; + /** + * State code of indicated article + * @syscap SystemCapability.AI.Component.TextReader + * @since 5.0.0(12) + */ + state: ReadStateCode; + } +} +export default TextReader; +/** + * Reading State Enumeration. + * + * @enum { number } + * @syscap SystemCapability.AI.Component.TextReader + * @since 5.0.0(12) + */ +export enum ReadStateCode { + /** + * Playing state. + * @syscap SystemCapability.AI.Component.TextReader + * @since 5.0.0(12) + */ + PLAYING = 1, + /** + * Pause state. + * @syscap SystemCapability.AI.Component.TextReader + * @since 5.0.0(12) + */ + PAUSED = 2, + /** + * Play completed state. + * @syscap SystemCapability.AI.Component.TextReader + * @since 5.0.0(12) + */ + COMPLETED = 3, + /** + * Not play yet / stop state. + * @syscap SystemCapability.AI.Component.TextReader + * @since 5.0.0(12) + */ + WAITING = 4, + /** + * Not in read list. + * @syscap SystemCapability.AI.Component.TextReader + * @since 5.0.0(12) + */ + NOT_IN_READ_LIST = 5 +} +/** + * Window manager used for setting window stage. + * + * @class WindowManager + * @syscap SystemCapability.AI.Component.TextReader + * @since 5.0.0(12) + */ +export class WindowManager { + /** + * Set the window stage to window manager + * @syscap SystemCapability.AI.Component.TextReader + * @since 5.0.0(12) + */ + public static setWindowStage(windowStage: window.WindowStage): void; + /** + * Get the window stage from window manager + * @syscap SystemCapability.AI.Component.TextReader + * @since 5.0.0(12) + */ + public static getWindowStage(): window.WindowStage; +} +/** + * Component of text reader icon. + * + * @Component TextReaderIcon + * @syscap SystemCapability.AI.Component.TextReader + * @since 5.0.0(12) + */ +@Component +export struct TextReaderIcon { + /** + * @syscap SystemCapability.AI.Component.TextReader + * @since 5.0.0(12) + */ + @Link + readState: ReadStateCode; + /** + * @syscap SystemCapability.AI.Component.TextReader + * @since 5.0.0(12) + */ + build(): void; +} diff --git a/language/arkts/extractor/sdk/hms/ets/api/@hms.ai.textToSpeech.d.ts b/language/arkts/extractor/sdk/hms/ets/api/@hms.ai.textToSpeech.d.ts new file mode 100755 index 00000000..5a7b3517 --- /dev/null +++ b/language/arkts/extractor/sdk/hms/ets/api/@hms.ai.textToSpeech.d.ts @@ -0,0 +1,437 @@ +/* + * Copyright (c) Huawei Technologies Co., Ltd. 2023-2023. All rights reserved. + */ +/** + * @file This module is used to convert text to speech. + * @kit CoreSpeechKit + */ +import type { AsyncCallback } from '@ohos.base'; +/** + * This module is used to convert text to speech. + * + * @namespace textToSpeech + * @syscap SystemCapability.AI.TextToSpeech + * @since 4.1.0(11) + */ +declare namespace textToSpeech { + /** + * Initialize TextToSpeech engine and returns an instance. + * If the engine is initialized, an engine instance will be returned by callback. Otherwise, an error code and description will be returned by callback. + * + * @param { CreateEngineParams } createEngineParams - The parameters of initializing engine. + * @param { AsyncCallback } callback - The callback of creating instance. + * @throws { BusinessError } 401 - The parameter check failed. + * @throws { BusinessError } 1002300002 - The language is not supported. + * @throws { BusinessError } 1002300003 - The person is not supported. + * @throws { BusinessError } 1002300005 - Create engine failed. + * @syscap SystemCapability.AI.TextToSpeech + * @since 4.1.0(11) + */ + function createEngine(createEngineParams: CreateEngineParams, callback: AsyncCallback): void; + /** + * Initialize TextToSpeech engine and returns an instance. + * If the engine is initialized, an engine instance will be returned by callback. Otherwise, an error code and description will be returned by callback. + * + * @param { CreateEngineParams } createEngineParams - The parameters of initializing engine. + * @returns { Promise } The result of instance. + * @throws { BusinessError } 401 - The parameter check failed. + * @throws { BusinessError } 1002300002 - The language is not supported. + * @throws { BusinessError } 1002300003 - The person is not supported. + * @throws { BusinessError } 1002300005 - Create engine failed. + * @syscap SystemCapability.AI.TextToSpeech + * @since 4.1.0(11) + */ + function createEngine(createEngineParams: CreateEngineParams): Promise; + /** + * The definition of Text-to-Speech Engine. + * + * @interface TextToSpeechEngine + * @syscap SystemCapability.AI.TextToSpeech + * @since 4.1.0(11) + */ + export interface TextToSpeechEngine { + /** + * Set the callback of Text-To-Speech that will receive all information about the Text-To-Speech. + * + * @param { SpeakListener } listener - The callback function of recognition. + * @syscap SystemCapability.AI.TextToSpeech + * @since 4.1.0(11) + */ + setListener(listener: SpeakListener): void; + /** + * Convert text to speech. + * Note that the setListener method must be invoked first. Otherwise, the callbacks of the speech cannot be received. + * + * @param { string } text - Text to be synthesized. + * @param { SpeakParams } speakParams - The parameters of speech. + * @throws { BusinessError } 401 - The parameter check failed. + * @throws { BusinessError } 1002300001 - The length of text is out of range or empty. + * @throws { BusinessError } 1002300006 - The service of TextToSpeech is busy. + * @throws { BusinessError } 1002300007 - Synthesis failed because the Text-to-Speech engine is not initialized. + * @syscap SystemCapability.AI.TextToSpeech + * @since 4.1.0(11) + */ + speak(text: string, speakParams: SpeakParams): void; + /** + * Get the language and person types supported by the Text-to-Speech engine. + * + * @param { VoiceQuery } params - The Parameters of querying. + * @param { AsyncCallback> } callback - The callback of querying. + * @throws { BusinessError } 401 - The parameter check failed. + * @throws { BusinessError } 1002300007 - The Text-to-Speech engine is not initialized. + * @syscap SystemCapability.AI.TextToSpeech + * @since 4.1.0(11) + */ + listVoices(params: VoiceQuery, callback: AsyncCallback>): void; + /** + * Get the language and person types supported by the Text-to-Speech engine. + * + * @param { VoiceQuery } params - The Parameters of querying. + * @returns { Promise> } The result of querying. + * @throws { BusinessError } 401 - The parameter check failed. + * @throws { BusinessError } 1002300007 - The Text-to-Speech engine is not initialized. + * @syscap SystemCapability.AI.TextToSpeech + * @since 4.1.0(11) + */ + listVoices(params: VoiceQuery): Promise>; + /** + * Stop speaking. + * Note that the setListener method must be invoked first. Otherwise, the callbacks of stop cannot be received. + * + * @throws { BusinessError } 1002300007 - The Text-to-Speech engine is not initialized. + * @syscap SystemCapability.AI.TextToSpeech + * @since 4.1.0(11) + */ + stop(): void; + /** + * Check whether the Text-to-Speech engine is busy. + * Note that the setListener method must be invoked first. Otherwise, the callbacks of error cannot be received. + * + * @returns { boolean } True is returned if the Text-To-Speech engine is busy. Otherwise, false is returned. + * @throws { BusinessError } 1002300007 - The Text-to-Speech engine is not initialized. + * @syscap SystemCapability.AI.TextToSpeech + * @since 4.1.0(11) + */ + isBusy(): boolean; + /** + * Release the resources of Text-to-Speech engine. + * + * @syscap SystemCapability.AI.TextToSpeech + * @since 4.1.0(11) + */ + shutdown(): void; + } + /** + * The callback function of speech. + * + * @interface SpeakListener + * @syscap SystemCapability.AI.TextToSpeech + * @since 4.1.0(11) + */ + export interface SpeakListener { + /** + * Indicates the callback for starting speech. + * + * @param { string } requestId - The request ID of speech. + * @param { StartResponse } response - The parameters of speech. + * @syscap SystemCapability.AI.TextToSpeech + * @since 4.1.0(11) + */ + onStart(requestId: string, response: StartResponse): void; + /** + * Indicates the callback for completing speech or completing synthesis. + * + * @param { string } requestId - The request ID of speech. + * @param { CompleteResponse } response - The related parameters of completing speech. + * @syscap SystemCapability.AI.TextToSpeech + * @since 4.1.0(11) + */ + onComplete(requestId: string, response: CompleteResponse): void; + /** + * Indicates the callback for success of stopping speech. + * + * @param { string } requestId - The request ID of speech. + * @param { StopResponse } response - The related parameters of stopping speech. + * @syscap SystemCapability.AI.TextToSpeech + * @since 4.1.0(11) + */ + onStop(requestId: string, response: StopResponse): void; + /** + * Indicates the callback for Synthesis, and the audio data is returned through parameter of audio. + * Note that when you need to receive a synthesized audio stream, the onData method needs to be called. + * + * @param { string } requestId - The request ID of speech. + * @param { ArrayBuffer } audio - The audio data of Synthesis. + * @param { SynthesisResponse } response - The parameters of Synthesis. + * @syscap SystemCapability.AI.TextToSpeech + * @since 4.1.0(11) + */ + onData?: (requestId: string, audio: ArrayBuffer, response: SynthesisResponse) => void; + /** + * Indicates the callback of error. + * + * @param { string } requestId - The request ID of speech. + * @param { number } errorCode - The error code of speech. + * @param { string } errorMessage - The detailed description of the error. + * @syscap SystemCapability.AI.TextToSpeech + * @since 4.1.0(11) + */ + onError(requestId: string, errorCode: number, errorMessage: string): void; + } + /** + * The parameters of initializing engine. + * + * @interface CreateEngineParams + * @syscap SystemCapability.AI.TextToSpeech + * @since 4.1.0(11) + */ + export interface CreateEngineParams { + /** + * Indicates language info of the speech. + * + * @syscap SystemCapability.AI.TextToSpeech + * @since 4.1.0(11) + */ + language: string; + /** + * Indicates person info of the speech. + * + * @syscap SystemCapability.AI.TextToSpeech + * @since 4.1.0(11) + */ + person: number; + /** + * Indicates module type of the speech. + * The value 0 indicates online, value 1 indicates offline. + * + * @syscap SystemCapability.AI.TextToSpeech + * @since 4.1.0(11) + */ + online: number; + /** + * Indicates entity info of the speech. + * + * @syscap SystemCapability.AI.TextToSpeech + * @since 4.1.0(11) + */ + extraParams?: Record; + } + /** + * The parameters of speech. + * + * @interface SpeakParams + * @syscap SystemCapability.AI.TextToSpeech + * @since 4.1.0(11) + */ + export interface SpeakParams { + /** + * Indicates request ID of the speech. + * Note that the request ID must be unique. + * + * @syscap SystemCapability.AI.TextToSpeech + * @since 4.1.0(11) + */ + requestId: string; + /** + * Indicates entity info of the speech. + * + * @syscap SystemCapability.AI.TextToSpeech + * @since 4.1.0(11) + */ + extraParams?: Record; + } + /** + * The Parameters of querying language and person supported by Text-to-Speech. + * + * @interface VoiceQuery + * @syscap SystemCapability.AI.TextToSpeech + * @since 4.1.0(11) + */ + export interface VoiceQuery { + /** + * Indicates request ID of the speech. + * Note that the request ID must be unique. + * + * @syscap SystemCapability.AI.TextToSpeech + * @since 4.1.0(11) + */ + requestId: string; + /** + * Indicates module type of the speech. + * The value 0 indicates online, value 1 indicates offline. + * + * @syscap SystemCapability.AI.TextToSpeech + * @since 4.1.0(11) + */ + online: number; + /** + * Indicates entity info of the speech. + * + * @syscap SystemCapability.AI.TextToSpeech + * @since 4.1.0(11) + */ + extraParams?: Record; + } + /** + * The information of language and person supported by Text-to-Speech. + * + * @interface VoiceInfo + * @syscap SystemCapability.AI.TextToSpeech + * @since 4.1.0(11) + */ + export interface VoiceInfo { + /** + * Indicates language info of the speech. + * + * @syscap SystemCapability.AI.TextToSpeech + * @since 4.1.0(11) + */ + language: string; + /** + * Indicates person info of the speech. + * + * @syscap SystemCapability.AI.TextToSpeech + * @since 4.1.0(11) + */ + person: number; + /** + * Indicates style info of the voice. + * + * @syscap SystemCapability.AI.TextToSpeech + * @since 4.1.0(11) + */ + style: string; + /** + * Indicates gender info of the voice. + * + * @syscap SystemCapability.AI.TextToSpeech + * @since 4.1.0(11) + */ + gender: string; + /** + * Indicates description of the voice. + * + * @syscap SystemCapability.AI.TextToSpeech + * @since 4.1.0(11) + */ + description: string; + } + /** + * The parameters of speech. + * + * @interface StartResponse + * @syscap SystemCapability.AI.TextToSpeech + * @since 4.1.0(11) + */ + export interface StartResponse { + /** + * Indicates audio type of the speech. + * + * @syscap SystemCapability.AI.TextToSpeech + * @since 4.1.0(11) + */ + audioType: string; + /** + * Indicates sample rate of the speech. + * + * @syscap SystemCapability.AI.TextToSpeech + * @since 4.1.0(11) + */ + sampleRate: number; + /** + * Indicates sample bit of the speech. + * + * @syscap SystemCapability.AI.TextToSpeech + * @since 4.1.0(11) + */ + sampleBit: number; + /** + * Indicates audio channel of the speech. + * + * @syscap SystemCapability.AI.TextToSpeech + * @since 4.1.0(11) + */ + audioChannel: number; + /** + * Indicates compress rate of the speech. + * + * @syscap SystemCapability.AI.TextToSpeech + * @since 4.1.0(11) + */ + compressRate: number; + } + /** + * The related parameters of stopping speech. + * + * @interface StopResponse + * @syscap SystemCapability.AI.TextToSpeech + * @since 4.1.0(11) + */ + export interface StopResponse { + /** + * The type of stopping speech. + * The value 0 indicates that synthesis and speech are stopped at the same time. + * The value 1 indicates that only the speech is stopped. + * + * @syscap SystemCapability.AI.TextToSpeech + * @since 4.1.0(11) + */ + type: number; + /** + * Indicates message of stopping. + * + * @syscap SystemCapability.AI.TextToSpeech + * @since 4.1.0(11) + */ + message: string; + } + /** + * The related parameters of completing speech. + * + * @interface CompleteResponse + * @syscap SystemCapability.AI.TextToSpeech + * @since 4.1.0(11) + */ + export interface CompleteResponse { + /** + * Indicates the end of synthesis or speech. + * The value 0 indicates the completion of synthesis, the value 1 indicates the completion of speech. + * + * @syscap SystemCapability.AI.TextToSpeech + * @since 4.1.0(11) + */ + type: number; + /** + * Indicates message of completing. + * + * @syscap SystemCapability.AI.TextToSpeech + * @since 4.1.0(11) + */ + message: string; + } + /** + * The related parameters of Synthesis. + * + * @interface SynthesisResponse + * @syscap SystemCapability.AI.TextToSpeech + * @since 4.1.0(11) + */ + export interface SynthesisResponse { + /** + * Indicates the sequence of the audio data. + * The value starts from 1 and increases by 1 each time. + * + * @syscap SystemCapability.AI.TextToSpeech + * @since 4.1.0(11) + */ + sequence: number; + /** + * Indicates type of the audio data. + * + * @syscap SystemCapability.AI.TextToSpeech + * @since 4.1.0(11) + */ + audioType: string; + } +} +export default textToSpeech; diff --git a/language/arkts/extractor/sdk/hms/ets/api/@hms.ai.vision.subjectSegmentation.d.ts b/language/arkts/extractor/sdk/hms/ets/api/@hms.ai.vision.subjectSegmentation.d.ts new file mode 100755 index 00000000..14f5e524 --- /dev/null +++ b/language/arkts/extractor/sdk/hms/ets/api/@hms.ai.vision.subjectSegmentation.d.ts @@ -0,0 +1,154 @@ +/* + * Copyright (c) Huawei Technologies Co., Ltd. 2024-2024. All rights reserved. + */ +/** + * @file This module is used for image segmentation. + * @kit CoreVisionKit + * */ +import type image from '@ohos.multimedia.image'; +/** + * This module is used for intelligent image segmentation in a photo. + * The return consists of two parts,fullSubject (mandatory) and subjectDetails (optional). + * @namespace subjectSegmentation + * @syscap SystemCapability.AI.Vision.SubjectSegmentation + * @since 5.0.0(12) + */ +declare namespace subjectSegmentation { + /** + * Visual configuration information, including related content such as pictures or video frame to be recognized. + * @interface VisionInfo + * @syscap SystemCapability.AI.Vision.SubjectSegmentation + * @since 5.0.0(12) + */ + export interface VisionInfo { + /** + * Image information to be identified. + * @syscap SystemCapability.AI.Vision.SubjectSegmentation + * @since 5.0.0(12) + */ + pixelMap: image.PixelMap; + } + /** + * Describe the position and size of the rectangle. + * @interface Rectangle + * @syscap SystemCapability.AI.Vision.SubjectSegmentation + * @since 5.0.0(12) + */ + export interface Rectangle { + /** + * Indicates the horizontal coordinate of the upper left corner of the object rectangle. + * @syscap SystemCapability.AI.Vision.SubjectSegmentation + * @since 5.0.0(12) + */ + left: number; + /** + * Indicates the vertical coordinate of the upper left corner of the object rectangle. + * @syscap SystemCapability.AI.Vision.SubjectSegmentation + * @since 5.0.0(12) + */ + top: number; + /** + * width of the object rectangle. + * @syscap SystemCapability.AI.Vision.SubjectSegmentation + * @since 5.0.0(12) + */ + width: number; + /** + * height of the object rectangle. + * @syscap SystemCapability.AI.Vision.SubjectSegmentation + * @since 5.0.0(12) + */ + height: number; + } + /** + * @Indicates the config of segmentation. + * @interface SegmentationConfig + * @syscap SystemCapability.AI.Vision.SubjectSegmentation + * @since 5.0.0(12) + */ + export interface SegmentationConfig { + /** + * The Optional maxCount: maximum number of output subjects. default 6, max 20. + * @syscap SystemCapability.AI.Vision.SubjectSegmentation + * @since 5.0.0(12) + */ + maxCount?: number; + /** + * Whether eachSubject information needed. + * @syscap SystemCapability.AI.Vision.SubjectSegmentation + * @since 5.0.0(12) + */ + enableSubjectDetails?: boolean; + /** + * Whether foregroundImage needed. + * @syscap SystemCapability.AI.Vision.SubjectSegmentation + * @since 5.0.0(12) + */ + enableSubjectForegroundImage?: boolean; + } + /** + * @Indicates the result of EachSubjectResult ability. + * @interface SubjectResult + * @syscap SystemCapability.AI.Vision.SubjectSegmentation + * @since 5.0.0(12) + */ + export interface SubjectResult { + /** + * Indicates the foreground image. + * @since 5.0.0(12) + * @syscap SystemCapability.AI.Vision.SubjectSegmentation + */ + foregroundImage: image.PixelMap; + /** + * Indicates the maskList. + * @since 5.0.0(12) + * @syscap SystemCapability.AI.Vision.SubjectSegmentation + */ + mattingList: Int32Array; + /** + * Indicates the bounding box of subject body. + * @since 5.0.0(12) + * @syscap SystemCapability.AI.Vision.SubjectSegmentation + */ + subjectRectangle: Rectangle; + } + /** + * Indicates the result of segment method. + * @interface SegmentationResult + * @syscap SystemCapability.AI.Vision.SubjectSegmentation + * @since 5.0.0(12) + */ + export interface SegmentationResult { + /** + * Indicates the number of objects in the image. + * @since 5.0.0(12) + * @syscap SystemCapability.AI.Vision.SubjectSegmentation + */ + subjectCount: number; + /** + * Indicates all subjects information. + * @since 5.0.0(12) + * @syscap SystemCapability.AI.Vision.SubjectSegmentation + */ + fullSubject: SubjectResult; + /** + * Indicates each subject information. + * @since 5.0.0(12) + * @syscap SystemCapability.AI.Vision.SubjectSegmentation + */ + subjectDetails?: Array; + } + /** + * Get the image segment result. + * @param { VisionInfo } visionInfo - The image information to be divided. + * @param { SegmentationConfig } config - Configuration information of the image to be segmented. + * @throws { BusinessError } 200 - Run timed out, please try again later. + * @throws { BusinessError } 401 - The parameter check failed. + * @throws { BusinessError } 1011000001 - Failed to run, please try again. + * @throws { BusinessError } 1011000002 - The service is abnormal. + * @syscap SystemCapability.AI.Vision.SubjectSegmentation + * @since 5.0.0(12) + */ + function doSegmentation(visionInfo: VisionInfo, config?: SegmentationConfig): Promise; +} +export default subjectSegmentation; diff --git a/language/arkts/extractor/sdk/hms/ets/api/@hms.bundle.sceneManager.d.ts b/language/arkts/extractor/sdk/hms/ets/api/@hms.bundle.sceneManager.d.ts new file mode 100755 index 00000000..120d8e38 --- /dev/null +++ b/language/arkts/extractor/sdk/hms/ets/api/@hms.bundle.sceneManager.d.ts @@ -0,0 +1,36 @@ +/* + * Copyright (c) Huawei Technologies Co., Ltd. 2023-2023. All rights reserved. + * Description: ecological rule manager scene manager ts interface define + */ +/** +* @file Ecological Scene Manager Interface Description file +* @kit StoreKit +*/ +/** + * Provides functions for the scene manager. + * + * @namespace sceneManager + * @syscap SystemCapability.BundleManager.EcologicalRuleManager.SceneManager + * @atomicservice + * @since 4.1.0(11) + */ +declare namespace sceneManager { + /** + * Obtains self scene code. + * + * @returns { string } Returns self scene code. + * @syscap SystemCapability.BundleManager.EcologicalRuleManager.SceneManager + * @atomicservice + * @since 4.1.0(11) + */ + function getSelfSceneCode(): string; + /** + * Obtains ads verification version. + * + * @returns { number } Returns ads verification version. + * @syscap SystemCapability.BundleManager.EcologicalRuleManager.SceneManager + * @since 4.1.0(11) + */ + function getAdsVerificationVersion(): number; +} +export default sceneManager; diff --git a/language/arkts/extractor/sdk/hms/ets/api/@hms.carService.navigationInfoMgr.d.ts b/language/arkts/extractor/sdk/hms/ets/api/@hms.carService.navigationInfoMgr.d.ts new file mode 100755 index 00000000..f8d58cfc --- /dev/null +++ b/language/arkts/extractor/sdk/hms/ets/api/@hms.carService.navigationInfoMgr.d.ts @@ -0,0 +1,550 @@ +/* + * Copyright (c) Huawei Technologies Co., Ltd. 2023-2023. All rights reserved. + */ +/** + * @file This module provides the capability to manage navigation info. + * @kit CarKit + */ +/** + * This module provides the capability to manage navigation info. + * @namespace navigationInfoMgr + * @syscap SystemCapability.CarService.NavigationInfo + * @since 4.1.0(11) + */ +declare namespace navigationInfoMgr { + /** + * Get single instance of NavigationController. + * @returns { NavigationController } - NavigationController instance. + * @syscap SystemCapability.CarService.NavigationInfo + * @since 4.1.0(11) + */ + function getNavigationController(): NavigationController; + /** + * The map application uses this interface to inject navigation information into the system and register for system navigation event listening. + * @syscap SystemCapability.CarService.NavigationInfo + * @since 4.1.0(11) + */ + interface NavigationController { + /** + * Set navigation status, including the navigation type, navigation destination, navigation passpoint, and route. + * @param { NavigationStatus } navigationStatus - Navigation status, including the navigation type, navigation destination, navigation passpoint, route, + * and map theme. + * @syscap SystemCapability.CarService.NavigationInfo + * @since 4.1.0(11) + */ + updateNavigationStatus(navigationStatus: NavigationStatus): void; + /** + * Set navigation metadata, including TBT information, roads, and electronic eyes. + * @param { NavigationMetadata } navigationMetadata - Navigation metadata, including TBT information, roads, and electronic eyes. + * @syscap SystemCapability.CarService.NavigationInfo + * @since 4.1.0(11) + */ + updateNavigationMetadata(navigationMetadata: NavigationMetadata): void; + /** + * Registers and listens to system navigation information and instructions. This method is invoked when the map application is started. + * @param { SystemNavigationListener } listener - System navigation listener. + * @syscap SystemCapability.CarService.NavigationInfo + * @since 4.1.0(11) + */ + registerSystemNavigationListener(listener: SystemNavigationListener): void; + /** + * Unregister the monitoring system navigation information and instructions. + * @syscap SystemCapability.CarService.NavigationInfo + * @since 4.1.0(11) + */ + unregisterSystemNavigationListener(): void; + } + /** + * System navigation event listener. + * @syscap SystemCapability.CarService.NavigationInfo + * @since 4.1.0(11) + */ + interface SystemNavigationListener { + /** + * Listening to system query events. + * @param { QueryType } query - Query Command. + * @param { { [key: string]: object } } args - Additional parameters of query command. + * @returns { Promise } - The promise returned by the function. + * @syscap SystemCapability.CarService.NavigationInfo + * @since 4.1.0(11) + */ + onQueryNavigationInfo(query: QueryType, args: { + [key: string]: object; + }): Promise; + /** + * Listening to system command events. + * @param { CommandType } command - Commands that need to be executed by the map application for system services. + * @param { { [key: string]: object } } args - Additional parameters of commands. + * @returns { Promise } - The promise returned by the function. + * @syscap SystemCapability.CarService.NavigationInfo + * @since 4.1.0(11) + */ + onReceiveNavigationCmd(command: CommandType, args: { + [key: string]: object; + }): Promise; + } + /** + * Navigation query or command result data. + * @syscap SystemCapability.CarService.NavigationInfo + * @since 4.1.0(11) + */ + interface ResultData { + /** + * Result data code. + * @syscap SystemCapability.CarService.NavigationInfo + * @since 4.1.0(11) + */ + code: number; + /** + * Result data message. + * @syscap SystemCapability.CarService.NavigationInfo + * @since 4.1.0(11) + */ + message: string; + /** + * Result additional Data. + * @syscap SystemCapability.CarService.NavigationInfo + * @since 4.1.0(11) + */ + data: { + [key: string]: object; + }; + } + /** + * Navigation status. + * @syscap SystemCapability.CarService.NavigationInfo + * @since 4.1.0(11) + */ + interface NavigationStatus { + /** + * Map status. + * @syscap SystemCapability.CarService.NavigationInfo + * @since 4.1.0(11) + */ + status: MapStatus; + /** + * Navigation type. + * @syscap SystemCapability.CarService.NavigationInfo + * @since 4.1.0(11) + */ + naviType: NaviType; + /** + * When status is MapStatus.NAVIGATION, this field indicates the destination address. When status is MapStatus.POI, this field indicates POI information. + * @syscap SystemCapability.CarService.NavigationInfo + * @since 4.1.0(11) + */ + destLocation: Location; + /** + * Pass point. + * @syscap SystemCapability.CarService.NavigationInfo + * @since 4.1.0(11) + */ + passPoint: Location[]; + /** + * Route index. + * @syscap SystemCapability.CarService.NavigationInfo + * @since 4.1.0(11) + */ + routeIndex: number; + /** + * Route preference. + * @syscap SystemCapability.CarService.NavigationInfo + * @since 4.1.0(11) + */ + routePreference: RoutePreference[]; + /** + * Map theme color. + * @syscap SystemCapability.CarService.NavigationInfo + * @since 4.1.0(11) + */ + theme: ThemeType; + /** + * Custom data. + * @syscap SystemCapability.CarService.NavigationInfo + * @since 4.1.0(11) + */ + customData: String; + } + /** + * Navigation metadata. + * @syscap SystemCapability.CarService.NavigationInfo + * @since 4.1.0(11) + */ + interface NavigationMetadata { + /** + * Navigation TBT turn mode. + * @syscap SystemCapability.CarService.NavigationInfo + * @since 4.1.0(11) + */ + naviTurnMode: number; + /** + * Remaining distance of the next action, that is, the guide distance. + * @syscap SystemCapability.CarService.NavigationInfo + * @since 4.1.0(11) + */ + segmentLeftDis: number; + /** + * Current road name. + * @syscap SystemCapability.CarService.NavigationInfo + * @since 4.1.0(11) + */ + currentRoadName: string; + /** + * Next road name. + * @syscap SystemCapability.CarService.NavigationInfo + * @since 4.1.0(11) + */ + nextRoadName: string; + /** + * Intersection view. + * @syscap SystemCapability.CarService.NavigationInfo + * @since 4.1.0(11) + */ + intersectionView: string; + /** + * Width of Intersection view. Unit: pixel. + * @syscap SystemCapability.CarService.NavigationInfo + * @since 4.1.0(11) + */ + viewWidth: number; + /** + * Height of Intersection view. Unit: pixel. + * @syscap SystemCapability.CarService.NavigationInfo + * @since 4.1.0(11) + */ + viewHeight: number; + /** + * Lane lines, in order from the far left to the last side. Each element corresponds to a direction. + * @syscap SystemCapability.CarService.NavigationInfo + * @since 4.1.0(11) + */ + trafficLane: string; + /** + * Electronic eye speed limit valid flag. + * @syscap SystemCapability.CarService.NavigationInfo + * @since 4.1.0(11) + */ + cameraSpeedLimitValid: boolean; + /** + * Electronic eye speed limit value. + * @syscap SystemCapability.CarService.NavigationInfo + * @since 4.1.0(11) + */ + cameraSpeedLimit: number; + /** + * Navigation speed limit valid flag. + * @syscap SystemCapability.CarService.NavigationInfo + * @since 4.1.0(11) + */ + naviSpeedLimitValid: boolean; + /** + * Navigation speed limit value. + * @syscap SystemCapability.CarService.NavigationInfo + * @since 4.1.0(11) + */ + naviSpeedLimit: number; + /** + * Current vehicle speed. Unit��m/s. + * @syscap SystemCapability.CarService.NavigationInfo + * @since 4.1.0(11) + */ + currentSpeed: number; + /** + * Navigation direction angle, relative to due north. + * @syscap SystemCapability.CarService.NavigationInfo + * @since 4.1.0(11) + */ + naviBearing: number; + /** + * Remaining distance of the whole journey.Unit��m + * @syscap SystemCapability.CarService.NavigationInfo + * @since 4.1.0(11) + */ + totalLeftDis: number; + /** + * Remaining time of the journey. Unit��min. + * @syscap SystemCapability.CarService.NavigationInfo + * @since 4.1.0(11) + */ + remainingTime: number; + } + /** + * Map status. + * @syscap SystemCapability.CarService.NavigationInfo + * @since 4.1.0(11) + */ + enum MapStatus { + /** + * The map is in idle state. Note: This parameter is used by default when the map application is not started. + * @syscap SystemCapability.CarService.NavigationInfo + * @since 4.1.0(11) + */ + IDLE, + /** + * The map is in navigation. + * @syscap SystemCapability.CarService.NavigationInfo + * @since 4.1.0(11) + */ + NAVIGATION, + /** + * The map is on cruise. + * @syscap SystemCapability.CarService.NavigationInfo + * @since 4.1.0(11) + */ + CRUISE, + /** + * The map is in the map point selection state. + * @syscap SystemCapability.CarService.NavigationInfo + * @since 4.1.0(11) + */ + POI, + /** + * The map is in route selection state. + * @syscap SystemCapability.CarService.NavigationInfo + * @since 4.1.0(11) + */ + ROUTE, + /** + * The map service is not available. Note: This parameter is set when the map application cannot provide services due to an internal error. + * @syscap SystemCapability.CarService.NavigationInfo + * @since 4.1.0(11) + */ + UNAVAILABLE + } + /** + * Navigation type. + * @syscap SystemCapability.CarService.NavigationInfo + * @since 4.1.0(11) + */ + enum NaviType { + /** + * DRIVING. + * @syscap SystemCapability.CarService.NavigationInfo + * @since 4.1.0(11) + */ + DRIVING, + /** + * MOTORCYCLE. + * @syscap SystemCapability.CarService.NavigationInfo + * @since 4.1.0(11) + */ + MOTORCYCLE, + /** + * CYCLING. + * @syscap SystemCapability.CarService.NavigationInfo + * @since 4.1.0(11) + */ + CYCLING, + /** + * WALKING. + * @syscap SystemCapability.CarService.NavigationInfo + * @since 4.1.0(11) + */ + WALKING + } + /** + * Location coordinate coding type. + * @syscap SystemCapability.CarService.NavigationInfo + * @since 4.1.0(11) + */ + enum LocationCoordType { + /** + * GCJ02. + * @syscap SystemCapability.CarService.NavigationInfo + * @since 4.1.0(11) + */ + GCJ02, + /** + * WGS84. + * @syscap SystemCapability.CarService.NavigationInfo + * @since 4.1.0(11) + */ + WGS84 + } + /** + * Location information. + * @syscap SystemCapability.CarService.NavigationInfo + * @since 4.1.0(11) + */ + interface Location { + /** + * Address Name. + * @syscap SystemCapability.CarService.NavigationInfo + * @since 4.1.0(11) + */ + name: string; + /** + * Location coordinate coding type. + * @syscap SystemCapability.CarService.NavigationInfo + * @since 4.1.0(11) + */ + coordType: LocationCoordType; + /** + * Longitude. + * @syscap SystemCapability.CarService.NavigationInfo + * @since 4.1.0(11) + */ + longitude: number; + /** + * Latitude. + * @syscap SystemCapability.CarService.NavigationInfo + * @since 4.1.0(11) + */ + latitude: number; + /** + * Altitude. Default value: 0. Unit: m. + * @syscap SystemCapability.CarService.NavigationInfo + * @since 4.1.0(11) + */ + altitude: number; + } + /** + * Map theme type. + * @syscap SystemCapability.CarService.NavigationInfo + * @since 4.1.0(11) + */ + enum ThemeType { + /** + * LIGHT. + * @syscap SystemCapability.CarService.NavigationInfo + * @since 4.1.0(11) + */ + LIGHT, + /** + * DARK. + * @syscap SystemCapability.CarService.NavigationInfo + * @since 4.1.0(11) + */ + DARK + } + /** + * Route preference type + * @syscap SystemCapability.CarService.NavigationInfo + * @since 4.1.0(11) + */ + enum RoutePreference { + /** + * Intelligent recommendation. + * @syscap SystemCapability.CarService.NavigationInfo + * @since 4.1.0(11) + */ + INTELLIGENT_RECOMMENDATION, + /** + * Highway first. + * @syscap SystemCapability.CarService.NavigationInfo + * @since 4.1.0(11) + */ + HIGHWAY_FIRST, + /** + * Avoid highway. + * @syscap SystemCapability.CarService.NavigationInfo + * @since 4.1.0(11) + */ + AVOID_HIGHWAY, + /** + * Avoid congestion. + * @syscap SystemCapability.CarService.NavigationInfo + * @since 4.1.0(11) + */ + AVOID_CONGESTION, + /** + * Less charge. + * @syscap SystemCapability.CarService.NavigationInfo + * @since 4.1.0(11) + */ + LESS_CHARGE, + /** + * Main road first. + * @syscap SystemCapability.CarService.NavigationInfo + * @since 4.1.0(11) + */ + MAIN_ROAD_FIRST, + /** + * Time first. + * @syscap SystemCapability.CarService.NavigationInfo + * @since 4.1.0(11) + */ + TIME_FIRST + } + /** + * Query command type. + * @syscap SystemCapability.CarService.NavigationInfo + * @since 4.1.0(11) + */ + enum QueryType { + /** + * Querying navigation status. + * @syscap SystemCapability.CarService.NavigationInfo + * @since 4.1.0(11) + */ + NAVIGATION_STATUS = 'navigationStatus', + /** + * Querying information such as navigation TBT. + * @syscap SystemCapability.CarService.NavigationInfo + * @since 4.1.0(11) + */ + NAVIGATION_METADATA = 'navigationMetadata' + } + /** + * Command type. + * @syscap SystemCapability.CarService.NavigationInfo + * @since 4.1.0(11) + */ + enum CommandType { + /** + * Start navigation. + * @syscap SystemCapability.CarService.NavigationInfo + * @since 4.1.0(11) + */ + START_NAVIGATION = 'startNavigation', + /** + * Stop navigation. + * @syscap SystemCapability.CarService.NavigationInfo + * @since 4.1.0(11) + */ + STOP_NAVIGATION = 'stopNavigation', + /** + * Go home. + * @syscap SystemCapability.CarService.NavigationInfo + * @since 4.1.0(11) + */ + GO_HOME = 'goHome', + /** + * Go to company. + * @syscap SystemCapability.CarService.NavigationInfo + * @since 4.1.0(11) + */ + GO_TO_COMPANY = 'goToCompany', + /** + * Launch map layers to other screens. + * @syscap SystemCapability.CarService.NavigationInfo + * @since 4.1.0(11) + */ + START_MAP_LAYER = 'startMapLayer', + /** + * Destroy map layers on other screens. + * @syscap SystemCapability.CarService.NavigationInfo + * @since 4.1.0(11) + */ + STOP_MAP_LAYER = 'stopMapLayer', + /** + * Zoom in on the map. + * @syscap SystemCapability.CarService.NavigationInfo + * @since 4.1.0(11) + */ + ZOOM_IN_MAP = 'zoomInMap', + /** + * Zoom out on the map. + * @syscap SystemCapability.CarService.NavigationInfo + * @since 4.1.0(11) + */ + ZOOM_OUT_MAP = 'zoomOutMap', + /** + * Change map theme. + * @syscap SystemCapability.CarService.NavigationInfo + * @since 4.1.0(11) + */ + CHANGE_THEME = 'changeTheme' + } +} +export default navigationInfoMgr; diff --git a/language/arkts/extractor/sdk/hms/ets/api/@hms.collaboration.CollaborationDevicePicker.d.ets b/language/arkts/extractor/sdk/hms/ets/api/@hms.collaboration.CollaborationDevicePicker.d.ets new file mode 100755 index 00000000..4230bc25 --- /dev/null +++ b/language/arkts/extractor/sdk/hms/ets/api/@hms.collaboration.CollaborationDevicePicker.d.ets @@ -0,0 +1,37 @@ +/* + * Copyright (c) Huawei Technologies Co., Ltd. 2023-2023. All rights reserved. + */ +/** + * @file Defines the component of CollaborationDevicePicker. + * @kit ServiceCollaborationKit + */ +import devicePicker from '@hms.collaboration.devicePicker'; +/** + * Provides collaboration device picker component, the caller use it to implement multi-device + * collaboration business. When the component is clicked, the devcie picker panel is displayed. + * + * @syscap SystemCapability.Collaboration.DevicePicker + * @since 4.0.0(10) + */ +@Component +export struct CollaborationDevicePicker { + /** + * Device picker controller, can interact with the device picker. You can through + * { @link devicePicker.createDevicePickerController } function create it. + * + * @type { devicePicker.DevicePickerController } + * @syscap SystemCapability.Collaboration.DevicePicker + * @since 4.0.0(10) + */ + controller: devicePicker.DevicePickerController; + /** + * Device picker attribute, indicates the description that the application wants to display to the user, + * is displayed at the top of the device picker panel. + * + * @type { devicePicker.DevicePickerAttribute } + * @syscap SystemCapability.Collaboration.DevicePicker + * @since 4.0.0(10) + */ + attribute: devicePicker.DevicePickerAttribute; + build(): void; +} diff --git a/language/arkts/extractor/sdk/hms/ets/api/@hms.collaboration.camera.d.ets b/language/arkts/extractor/sdk/hms/ets/api/@hms.collaboration.camera.d.ets new file mode 100755 index 00000000..eaa327ec --- /dev/null +++ b/language/arkts/extractor/sdk/hms/ets/api/@hms.collaboration.camera.d.ets @@ -0,0 +1,106 @@ +/* + * Copyright (c) Huawei Technologies Co., Ltd. 2023-2023. All rights reserved. + */ +/** + * @file Defines collaboration service capabilities and provides collaboration service interfaces. + * @kit ServiceCollaborationKit + */ +/** + * Provides collaboration camera's business type, the caller needs to setup { @link businessFilter } to specify + * kinds of business will get. + * + * @enum {number} + * @deprecated since 5.0.0(12) + * @useinstead hms.collaboration.service#CollaborationServiceFilter + * @syscap SystemCapability.Collaboration.Camera + * @since 4.0.0(10) + */ +declare enum CollaborationCameraBusinessFilter { + /** + * 0 include all abilities. + * + * @enum {number} + * @deprecated since 5.0.0(12) + * @useinstead hms.collaboration.service#CollaborationServiceFilter.ALL + * @syscap SystemCapability.Collaboration.Camera + * @since 4.0.0(10) + */ + ALL = 0, + /** + * 1 include take photo ability. + * + * @enum {number} + * @deprecated since 5.0.0(12) + * @useinstead hms.collaboration.service#CollaborationServiceFilter.TAKE_PHOTO + * @syscap SystemCapability.Collaboration.Camera + * @since 4.0.0(10) + */ + TAKE_PHOTO = 1, + /** + * 2 include scan document ability. + * + * @enum {number} + * @deprecated since 5.0.0(12) + * @useinstead hms.collaboration.service#CollaborationServiceFilter.SCAN_DOCUMENT + * @syscap SystemCapability.Collaboration.Camera + * @since 4.1.0(11) + */ + SCAN_DOCUMENT = 2, + /** + * 3 include image picker ability. + * + * @enum {number} + * @deprecated since 5.0.0(12) + * @useinstead hms.collaboration.service#CollaborationServiceFilter.IMAGE_PICKER + * @syscap SystemCapability.Collaboration.Camera + * @since 4.1.0(11) + */ + IMAGE_PICKER = 3 +} +/** + * Provides collaboration camera menu items with business, the caller needs to integrate it into the menu + * that needs to be displayed. + * + * @param { Array } businessFilter - Indicates the business types for the picker + * to filter and show. The default is [0], indicates all business of camera. + * @deprecated since 5.0.0(12) + * @useinstead hms.collaboration.service#createCollaborationServiceMenuItems + * @syscap SystemCapability.Collaboration.Camera + * @since 4.0.0(10) + */ +@Builder +declare function createCollaborationCameraMenuItems(businessFilter?: Array): void; +/** + * Provides collaboration camera status component, the caller needs to implement the { @link onState} method + * and declare this component in page. After the start of business, it will be called by collaboration framework. + * + * @deprecated since 5.0.0(12) + * @useinstead hms.collaboration.service#CollaborationServiceStateDialog + * @syscap SystemCapability.Collaboration.Camera + * @since 4.0.0(10) + */ +@Component +declare struct CollaborationCameraStateDialog { + /** + * Provides business callback interface, will be called after the business is completed. + * + * @param { number } stateCode - Indicates the business end status, the value 0 indicates success, 1001202001 + * indicates canceled by camera, 1001202002 indicates error occurred, 1001202003 indicates canceled by local. + * @param { ArrayBuffer } buffer - Indicates data returned after business success, other cases is null. + * @deprecated since 5.0.0(12) + * @useinstead hms.collaboration.service#CollaborationServiceStateDialog.onState + * @syscap SystemCapability.Collaboration.Camera + * @since 4.0.0(10) + */ + onState: (stateCode: number, buffer: ArrayBuffer) => void; + /** + * The default builder function for struct, You should not need to invoke this method directly. + * + * @deprecated since 5.0.0(12) + * @useinstead hms.collaboration.service#CollaborationServiceStateDialog.build + * @syscap SystemCapability.Collaboration.Camera + * @since 4.0.0(10) + */ + build(): void; +} +export { CollaborationCameraBusinessFilter, createCollaborationCameraMenuItems, CollaborationCameraStateDialog }; diff --git a/language/arkts/extractor/sdk/hms/ets/api/@hms.collaboration.devicePicker.d.ts b/language/arkts/extractor/sdk/hms/ets/api/@hms.collaboration.devicePicker.d.ts new file mode 100755 index 00000000..10231705 --- /dev/null +++ b/language/arkts/extractor/sdk/hms/ets/api/@hms.collaboration.devicePicker.d.ts @@ -0,0 +1,170 @@ +/* + * Copyright (c) Huawei Technologies Co., Ltd. 2023-2023. All rights reserved. + */ +/** + * @file Defines the capabilities of device picker. + * @kit ServiceCollaborationKit + */ +import type { Callback } from '@ohos.base'; +import type distributedDeviceManager from '@ohos.distributedDeviceManager'; +/** + * Provides device picker and DevicePickerController for distributed business, can be used + * with the { @link CollaborationDevicePicker }. The DevicePickerController can interact with + * the device picker, such as obtain information about the selected device, and update the + * current state of the device, and so on. + * + * @namespace devicePicker + * @syscap SystemCapability.Collaboration.DevicePicker + * @since 4.0.0(10) + */ +declare namespace devicePicker { + /** + * Device event definitions. { @link 'deviceSelected' } corresponds the user clicks the device + * in { @link IDLE } state, { @link 'deviceUnselected' } corresponds the user clicks the device + * in { @link SUCCESSFUL } state, { @link 'selectedDeviceOffline' } corresponds the device in + * { @link SUCCESSFUL } state offline. + * + * { 'deviceSelected' | 'deviceUnselected' | 'selectedDeviceOffline' } + * @syscap SystemCapability.Collaboration.DevicePicker + * @since 4.0.0(10) + */ + type DeviceEvent = 'deviceSelected' | 'deviceUnselected' | 'selectedDeviceOffline'; + /** + * Create { @link DevicePickerController } instance. + * + * @returns { DevicePickerController } The DevicePickerController instance. + * @syscap SystemCapability.Collaboration.DevicePicker + * @since 4.0.0(10) + */ + function createDevicePickerController(): DevicePickerController; + /** + * DevicePicker controller definitions, the controller can interact with the device picker. Contains + * event registration function for { @link DeviceEvent }, and updateState function, and so on. + * + * @syscap SystemCapability.Collaboration.DevicePicker + * @since 4.0.0(10) + */ + class DevicePickerController { + /** + * Register { @link DeviceEvent } callback, for example { @link 'deviceSelected' } callback + * called when the user clicks a device in { @link IDLE state }; { @link 'deviceUnselected' } + * callback called when the user clicks the device in { @link SUCCESSFUL } state; + * { @link 'selectedDeviceOffline' } callback called when the device in { @link SUCCESSFUL } + * state offline. You can use the {@code distributedDeviceManager.DeviceBasicInfo } to + * implement your own processing logic in this { @link callback }. + * + * @param { DeviceEvent } event - Device event. + * @param { Callback } callback - Called when + * user selects a device. + * @syscap SystemCapability.Collaboration.DevicePicker + * @since 4.0.0(10) + */ + on(event: DeviceEvent, callback: Callback): void; + /** + * Cancel the callback registered through { @link on }. + * + * @param { DeviceEvent } event - Device event. + * @param { Callback } callback - Callback + * function of the DeviceEvent. + * @syscap SystemCapability.Collaboration.DevicePicker + * @since 4.0.0(10) + */ + off(event: DeviceEvent, callback?: Callback): void; + /** + * Update the business state, then the device picker will display the current state. + * + * @param { string } networkId - Indicates the networkId of the device whose state is to be updated. + * @param { BusinessState } state - Indicates the business state to be updated. + * @param { ResourceStr } desc - Indicates the detailed description to display with the state, + * when the state is { @link FAILED }, you can describe the cause of the failure, the maximum + * length of the desc is 128. + * @syscap SystemCapability.Collaboration.DevicePicker + * @since 4.0.0(10) + */ + updateState(networkId: string, state: BusinessState, desc?: ResourceStr): void; + /** + * Release the instance created by function of { @link createDevicePickerController }. + * + * @syscap SystemCapability.Collaboration.DevicePicker + * @since 4.0.0(10) + */ + release(): void; + } + /** + * Device picker attribute definitions, this information is displayed at the top of + * the device picker panel. + * + * @syscap SystemCapability.Collaboration.DevicePicker + * @since 4.0.0(10) + */ + class DevicePickerAttribute { + /** + * The icon for caller ability or custom icon that you want to display to the user. + * + * @type { ?ResourceStr } + * @default the icon declare in module.json5 file + * @syscap SystemCapability.Collaboration.DevicePicker + * @since 4.0.0(10) + */ + abilityIcon?: ResourceStr; + /** + * The name for caller ability or custom name that you want to display to the user. + * + * @type { ?ResourceStr } + * @default the name declare in module.json5 file + * @syscap SystemCapability.Collaboration.DevicePicker + * @since 4.0.0(10) + */ + abilityName?: ResourceStr; + /** + * The description for caller ability or custom description that you want to display to the user. + * + * @type { ?ResourceStr } + * @default the description declare in module.json5 file + * @syscap SystemCapability.Collaboration.DevicePicker + * @since 4.0.0(10) + */ + abilityDesc?: ResourceStr; + /** + * The description for business type, for example "cast to"、 "flow to". + * + * @type { ?ResourceStr } + * @default "flow to" + * @syscap SystemCapability.Collaboration.DevicePicker + * @since 4.0.0(10) + */ + businessDesc?: ResourceStr; + } + /** + * Business state type definitions, the current state is displayed on the device picker along with + * the device name. + * + * @enum { number } + * @syscap SystemCapability.Collaboration.DevicePicker + * @since 4.0.0(10) + */ + enum BusinessState { + /** + * Indicates the idle state. + * + * @syscap SystemCapability.Collaboration.DevicePicker + * @since 4.0.0(10) + */ + IDLE = 0, + /** + * Indicates business succeed. + * + * @syscap SystemCapability.Collaboration.DevicePicker + * @since 4.0.0(10) + */ + SUCCESSFUL = 1, + /** + * Indicates business fail. + * + * @syscap SystemCapability.Collaboration.DevicePicker + * @since 4.0.0(10) + */ + FAILED = 2 + } +} +export default devicePicker; diff --git a/language/arkts/extractor/sdk/hms/ets/api/@hms.collaboration.rcp.d.ts b/language/arkts/extractor/sdk/hms/ets/api/@hms.collaboration.rcp.d.ts new file mode 100755 index 00000000..303f7763 --- /dev/null +++ b/language/arkts/extractor/sdk/hms/ets/api/@hms.collaboration.rcp.d.ts @@ -0,0 +1,2177 @@ +/* + * Copyright (c) Huawei Technologies Co., Ltd. 2023. All rights reserved. + */ +/** + * @file This module is used for remote communication. + * @kit RemoteCommunicationKit + */ + +import type url from '@ohos.url'; +import type cert from '@ohos.security.cert'; +import type fs from '@ohos.file.fs'; +/** + * Provides HTTP-related APIs. + * @namespace rcp + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 4.1.0(11) + */ +declare namespace rcp { + /** + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 4.1.0(11) + */ + export type URL = url.URL; + /** + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 5.0.0(12) + */ + export type X509Cert = cert.X509Cert; + /** + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 5.0.0(12) + */ + export type File = fs.File; + /** + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 5.0.0(12) + */ + export type RandomAccessFile = fs.RandomAccessFile; + /** + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 5.0.0(12) + */ + export type Stream = fs.Stream; + /** + * Some raw data type of ArkTs. + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 5.0.0(12) + */ + export type RawDataContent = string | ArrayBuffer | object; + /** + * File descriptor. + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 5.0.0(12) + */ + export type FileDescriptor = number; + /** + * Something like a file. + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 5.0.0(12) + */ + export type LocalFile = FileDescriptor | File | RandomAccessFile; + /** + * Something can write to a file. + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 5.0.0(12) + */ + export interface WriteFile { + /** + * Write to a file. + * @param { ArrayBuffer } buffer - Buffer you want to write. + * @returns { Promise } Return the number you write or noting if you do not care. + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 5.0.0(12) + */ + write(buffer: ArrayBuffer): Promise; + } + /** + * Something can read from a file. + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 5.0.0(12) + */ + export interface ReadFile { + /** + * Read from a file. + * @param { ArrayBuffer } buffer - Where to set the result. + * @returns { Promise } Return the number you read. + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 5.0.0(12) + */ + read(buffer: ArrayBuffer): Promise; + } + /** + * Something can write to a stream. + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 5.0.0(12) + */ + export interface WriteStream { + /** + * Write to a stream. + * @param { ArrayBuffer } buffer - Buffer you want to write. + * @returns { Promise } Return the number you write or nothing if you do not care. + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 5.0.0(12) + */ + write(buffer: ArrayBuffer): Promise; + } + /** + * Something can write to a stream. + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 5.0.0(12) + */ + export interface SyncWriteStream { + /** + * Write to a stream. + * @param { ArrayBuffer } buffer - Buffer you want to write. + * @returns { Promise } Return the number you write or nothing if you do not care. + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 5.0.0(12) + */ + writeSync(buffer: ArrayBuffer): void | number; + } + /** + * Something can read from a stream. + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 5.0.0(12) + */ + export interface ReadStream { + /** + * Read from a stream. + * @param { ArrayBuffer } buffer - Where to set the result. + * @returns { Promise } Return the number you read. + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 5.0.0(12) + */ + read(buffer: ArrayBuffer): Promise; + } + /** + * Something can read from a stream. + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 5.0.0(12) + */ + export interface SyncReadStream { + /** + * Read from a stream. + * @param { ArrayBuffer } buffer - Where to set the result. + * @returns { Promise } Return the number you read. + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 5.0.0(12) + */ + readSync(buffer: ArrayBuffer): number; + } + /** + * See {@link Response.body}, if your {@link Request.destination} is {@link DownloadToFile}, + * this is the path of your result. + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 5.0.0(12) + */ + export interface DownloadedTo { + /** + * This is the path of your result if your {@link Request.destination} is {@link DownloadToFile}. + * @type {Path} + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 5.0.0(12) + */ + path: Path; + /** + * Whether the request is skipped. + * @type {?true} + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 5.0.0(12) + */ + requestSkipped?: true; + } + /** + * Where to put you downloaded things. + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 5.0.0(12) + */ + export interface TargetFile { + /** + * Where to put you downloaded things. + * @type {Path} + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 5.0.0(12) + */ + path: Path; + /** + * Whether the request should be skipped. + * @type {?boolean} + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 5.0.0(12) + */ + skipRequest?: boolean; + } + /** + * Return a {@link TargetFile}. + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 5.0.0(12) + */ + export type TargetFileCallback = (request: Request, suggestedPath: Path) => TargetFile | Promise; + /** + * How to deal with the things downloaded. + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 5.0.0(12) + */ + export type IncomingDataCallback = (incomingData: ArrayBuffer) => void | Promise; + /** + * The file you want to upload. + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 5.0.0(12) + */ + export class UploadFromFile { + /** + * File or path. + * @type {Path | LocalFile | ReadFile} + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 5.0.0(12) + */ + readonly fileOrPath: Path | LocalFile | ReadFile; + /** + * Constructor. + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 5.0.0(12) + */ + constructor(fileOrPath: Path | LocalFile | ReadFile); + } + /** + * The stream you want to upload. + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 5.0.0(12) + */ + export class UploadFromStream { + /** + * Something like a stream. + * @type {Stream | ReadStream | SyncReadStream} + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 5.0.0(12) + */ + readonly stream: Stream | ReadStream | SyncReadStream; + /** + * Constructor. + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 5.0.0(12) + */ + constructor(stream: Stream | ReadStream | SyncReadStream); + } + /** + * Download to a file or a folder. If download to a folder, the file name is same as which it is in the server. + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 5.0.0(12) + */ + export type DownloadToFile = { + kind: 'file'; + file: TargetFileCallback; + } | { + kind: 'file'; + file: Path; + keepLocal?: boolean; + } | { + kind: 'file'; + file: LocalFile | WriteFile; + } | { + kind: 'folder'; + path: Path; + keepLocal?: boolean; + }; + /** + * Download to a stream. + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 5.0.0(12) + */ + export type DownloadToStream = { + kind: 'stream'; + stream: Stream | WriteStream | SyncWriteStream; + }; + /** + * Where to put the response body. + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 5.0.0(12) + */ + export type ResponseBodyDestination = 'array-buffer' | IncomingDataCallback | DownloadToFile | DownloadToStream; + /** + * Which information you want to collect during request processing. + * This determines which {@link Response.debugInfo} will be collected. + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 4.1.0(11) + */ + export interface InfoToCollect { + /** + * Whether to collect unclassified textual events. Default is false. + * @type {?boolean} + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 4.1.0(11) + */ + textual?: boolean; + /** + * Whether to collect incoming HTTP header events. Default is false. + * @type {?boolean} + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 4.1.0(11) + */ + incomingHeader?: boolean; + /** + * Whether to collect outgoing HTTP header events. Default is false. + * @type {?boolean} + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 4.1.0(11) + */ + outgoingHeader?: boolean; + /** + * Whether to collect events about incoming HTTP data. Default is false. + * @type {?boolean} + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 4.1.0(11) + */ + incomingData?: boolean; + /** + * Whether to collect events about outgoing HTTP data. Default is false. + * @type {?boolean} + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 4.1.0(11) + */ + outgoingData?: boolean; + /** + * Whether to collect incoming SSL/TLS events. Default is false. + * @type {?boolean} + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 4.1.0(11) + */ + incomingSslData?: boolean; + /** + * Whether to collect outgoing SSL/TLS events. Default is false. + * @type {?boolean} + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 4.1.0(11) + */ + outgoingSslData?: boolean; + } + /** + * The URL or string can be used as the input parameter of an HTTP/HTTPS address. + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 4.1.0(11) + */ + export type URLOrString = URL | string; + /** + * HTTP request method. + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 4.1.0(11) + */ + export type HttpMethod = 'GET' | 'POST' | 'HEAD' | 'PUT' | 'DELETE' | 'PATCH' | 'OPTIONS' | (string & NonNullable); + /** + * HTTP request headers. + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 4.1.0(11) + */ + export type RequestHeaders = { + [k: string]: string | string[] | undefined; + 'authorization'?: string; + 'accept'?: ContentType | ContentType[]; + 'accept-charset'?: string | string[]; + 'accept-encoding'?: ContentCoding | ContentCoding[]; + 'accept-language'?: string | string[]; + 'cache-control'?: string | string[]; + 'cookie'?: string | string[]; + 'range'?: string | string[]; + 'upgrade'?: string | string[]; + 'user-agent'?: string; + 'content-type'?: ContentType; + }; + /** + * HTTP response headers. + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 4.1.0(11) + */ + export type ResponseHeaders = { + [k: string]: string | string[] | undefined; + 'accept-ranges'?: 'none' | 'bytes' | (string & NonNullable); + 'allow'?: HttpMethod | HttpMethod[]; + 'cache-control'?: string | string[]; + 'content-encoding'?: ContentCoding; + 'content-range'?: string; + 'content-type'?: ContentType; + 'date'?: string; + 'etag'?: string; + 'expires'?: string; + 'location'?: string; + 'retry-after'?: string; + 'set-cookie'?: string | string[]; + 'server'?: string; + 'www-authenticate'?: string | string[]; + }; + /** + * HTTP request predefined content types. + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 4.1.0(11) + */ + export type ContentType = 'application/json' | 'text/plain' | 'multipart/form-data' | 'application/octet-stream' | 'application/x-www-form-urlencoded' | (string & NonNullable); + /** + * HTTP request predefined content coding types. + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 4.1.0(11) + */ + export type ContentCoding = 'aes128gcm' | 'br' | 'compress' | 'deflate' | 'exi' | 'gzip' | 'pack200-gzip' | 'x-compress' | 'x-gzip' | 'zstd' | (string & NonNullable); + /** + * HTTP request path preference. + * This is only a suggestion of the caller, and the system decides which path to use. + * @type {?'auto' | 'cellular'} + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 4.1.0(11) + */ + export type PathPreference = 'auto' | 'cellular'; + /** + * The type of network service. + * @type {?'default'} + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 4.1.0(11) + */ + /** + * The type of network service. Add some types. + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 5.0.0(12) + */ + export type ServiceType = 'default' | 'background' | 'realtimeVoice' | 'realtimeVideo' | 'callSignaling' | 'realtimeGame' | 'normalGame' | 'shortVideo' | 'longVideo' | 'livestreamingAnchor' | 'livestreamingWatcher' | 'download' | 'upload' | 'browser'; + /** + * Timeout settings. + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 4.1.0(11) + */ + export interface Timeout { + /** + * Connection timeout. The default value is 60000, in ms. + * @type {?number} + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 4.1.0(11) + */ + connectMs?: number; + /** + * Transfer timeout. The default value is 60000, in ms. + * @type {?number} + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 4.1.0(11) + */ + transferMs?: number; + } + /** + * An HTTP range request asks the server to send only a portion of an HTTP message back to a client. + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 4.1.0(11) + */ + export interface TransferRange { + /** + * Transfer start position. + * @type {?number} + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 4.1.0(11) + */ + from?: number; + /** + * Transfer end position. + * @type {?number} + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 4.1.0(11) + */ + to?: number; + } + /** + * HTTP transfer configuration. + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 4.1.0(11) + */ + export interface TransferConfiguration { + /** + * Whether to automatically follow HTTP redirect response. True by default. + * The maximum number of redirection is limited by the implementation. + * @type {?boolean} + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 4.1.0(11) + */ + autoRedirect?: boolean; + /** + * Set the maximum number of redirections for the request to follow if the autoRedirect property is true. + * Default is 50, maximum value is 2147483647. + * @type {?number} + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 5.0.0(12) + */ + maxAutoRedirects?: number; + /** + * Timeout configuration. If this option is not set, the default timeouts will be applied. + * Please check the {@link Timeout}. + * @type {?Timeout} + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 4.1.0(11) + */ + timeout?: Timeout; + /** + * Whether to assume that the target server supports HTTP/3. Default is false. + * @type {?boolean} + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 4.1.0(11) + */ + assumesHTTP3Capable?: boolean; + /** + * HTTP request path preference. + * This is only a suggestion of the caller, and the system decides which path to use. + * Default is auto, which means to give no advice to the system. + * @type {?PathPreference} + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 4.1.0(11) + */ + pathPreference?: PathPreference; + /** + * The type of network service. + * @type {?ServiceType} + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 4.1.0(11) + */ + serviceType?: ServiceType; + } + /** + * HTTP tracing configuration. + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 4.1.0(11) + */ + export interface TracingConfiguration { + /** + * Whether to print verbose logs when HTTP runs. Default is false. + * @type {?boolean} + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 4.1.0(11) + */ + verbose?: boolean; + /** + * Specify which request-processing events to collect. The collected events can be examined via response object. + * Check {@link Response.debugInfo} please. + * By default no events are collected. + * @type {?InfoToCollect} + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 4.1.0(11) + */ + infoToCollect?: InfoToCollect; + /** + * Whether to collect request timing information. Default is false. + * @type {?boolean} + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 4.1.0(11) + */ + collectTimeInfo?: boolean; + /** + * Callbacks to watch different HTTP events. + * @type {?HttpEventsHandler} + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 4.1.0(11) + */ + httpEventsHandler?: HttpEventsHandler; + } + /** + * HTTP proxy configuration. + * system: means that use system proxy configuration. + * no-proxy: means do not use proxy. + * object of @type {WebProxy} means providing custom proxy settings + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 4.1.0(11) + */ + export type ProxyConfiguration = 'system' | 'no-proxy' | WebProxy; + /** + * The server's authentication type. + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 4.1.0(11) + */ + export type AuthenticationType = 'basic' | 'ntlm' | 'digest'; + /** + * HTTP credential. Some server or proxy server need this. + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 4.1.0(11) + */ + export interface Credential { + /** + * Username of credential. Default is ''. + * @type {?string} + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 4.1.0(11) + */ + username: string; + /** + * Password of credential. Default is ''. + * @type {?string} + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 4.1.0(11) + */ + password: string; + } + /** + * HTTP server authentication. + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 4.1.0(11) + */ + export interface ServerAuthentication { + /** + * Credential of server. + * @type {?Credential} + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 4.1.0(11) + */ + credential: Credential; + /** + * Authentication type of server. If not set, negotiate with the server. + * @type {?AuthenticationType} + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 4.1.0(11) + */ + authenticationType?: AuthenticationType; + } + /** + * A function that can directly return IP addresses based on hostname and port. + * See {@link DnsConfiguration.dnsRules}. + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 4.1.0(11) + */ + export type DynamicDnsRule = (host: string, port: number) => IpAddress[]; + /** + * Name resolution configuration. + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 4.1.0(11) + */ + export interface DnsConfiguration { + /** + * Dns rule configuration. Default is undefined. + * {@link DnsServers}: means that preferentially use the specified dns servers to resolve hostname. + * {@link StaticDnsRules}: means that preferentially use the specified address if hostname matches. + * {@link DynamicDnsRule}: means that preferentially use the address returned in the function. + * @type {?DnsServers | StaticDnsRules | DynamicDnsRule} + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 4.1.0(11) + */ + dnsRules?: DnsServers | StaticDnsRules | DynamicDnsRule; + /** + * Dns over HTTPS configuration. Default is undefined. + * If set, preferentially use the address resolved by the DOH dns server. + * @type {?DnsOverHttpsConfiguration} + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 4.1.0(11) + */ + dnsOverHttps?: DnsOverHttpsConfiguration; + } + /** + * The validation context of {@link ValidationCallback} + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 5.0.0(12) + */ + export interface ValidationContext { + /** + * The raw data which in PEM format of certificate. + * @type {string[]} + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 5.0.0(12) + */ + pemCerts: string[]; + /** + * X509 certificate chain. + * @type {X509Cert[]} + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 5.0.0(12) + */ + x509Certs: X509Cert[]; + /** + * The host of this request. + * @type {string} + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 5.0.0(12) + */ + host: string; + /** + * The real IP which this request connect to. + * @type {string} + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 5.0.0(12) + */ + ip: string; + } + /** + * Self defined remote validation, {@link SecurityConfiguration.remoteValidation}. + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 5.0.0(12) + */ + export type ValidationCallback = (context: ValidationContext) => boolean | Promise; + /** + * Cipher suite which TLS1.3+ support. + * The framework has a built-in preference order, but your choice will be recorded. + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 5.0.0(12) + */ + export type TlsV13SpecificCipherSuite = 'TLS_AES_128_GCM_SHA256' | 'TLS_AES_256_GCM_SHA384' | 'TLS_CHACHA20_POLY1305_SHA256'; + /** + * Cipher suite which TLS1.2+ support. + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 5.0.0(12) + */ + export type TlsV12SpecificCipherSuite = 'TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256' | 'TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256' | 'TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384' | 'TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384' | 'TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256' | 'TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256' | 'TLS_RSA_WITH_AES_128_GCM_SHA256' | 'TLS_RSA_WITH_AES_256_GCM_SHA384'; + /** + * Cipher suite which TLS1.0+ support. + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 5.0.0(12) + */ + export type TlsV10SpecificCipherSuite = 'TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA' | 'TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA' | 'TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA' | 'TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA' | 'TLS_RSA_WITH_AES_128_CBC_SHA' | 'TLS_RSA_WITH_AES_256_CBC_SHA' | 'TLS_RSA_WITH_3DES_EDE_CBC_SHA'; + /** + * Include all cipher suite. + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 5.0.0(12) + */ + export type CipherSuite = TlsV13CipherSuite; + /** + * TLS1.3 cipher suite should include TLS1.2 cipher suite. + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 5.0.0(12) + */ + export type TlsV13CipherSuite = TlsV12CipherSuite | TlsV13SpecificCipherSuite; + /** + * TLS1.2 cipher suite should include TLS1.1 cipher suite. + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 5.0.0(12) + */ + export type TlsV12CipherSuite = TlsV11CipherSuite | TlsV12SpecificCipherSuite; + /** + * TLS1.1 cipher suite is same as TLS1.0 cipher suite. + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 5.0.0(12) + */ + export type TlsV11CipherSuite = TlsV10CipherSuite; + /** + * TLS1.0 cipher suite. + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 5.0.0(12) + */ + export type TlsV10CipherSuite = TlsV10SpecificCipherSuite; + /** + * TLS1.3 option. + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 5.0.0(12) + */ + export interface TlsV13Option { + /** + * Version is TLS1.3. + * @type {'TlsV1.3'} + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 5.0.0(12) + */ + tlsVersion: 'TlsV1.3'; + /** + * TlsV1.3 cipher suite. + * @type {?TlsV13CipherSuite[]} + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 5.0.0(12) + */ + cipherSuite?: TlsV13CipherSuite[]; + } + /** + * TLS1.2 option. + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 5.0.0(12) + */ + export interface TlsV12Option { + /** + * Version is TLS1.2. + * @type {'TlsV1.2'} + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 5.0.0(12) + */ + tlsVersion: 'TlsV1.2'; + /** + * TlsV1.2 cipher suite. + * @type {?TlsV12CipherSuite[]} + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 5.0.0(12) + */ + cipherSuite?: TlsV12CipherSuite[]; + } + /** + * TLS1.1 option. + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 5.0.0(12) + */ + export interface TlsV11Option { + /** + * Version is TLS1.1. + * @type {'TlsV1.1'} + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 5.0.0(12) + */ + tlsVersion: 'TlsV1.1'; + /** + * TlsV1.1 cipher suite. + * @type {?TlsV11CipherSuite[]} + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 5.0.0(12) + */ + cipherSuite?: TlsV11CipherSuite[]; + } + /** + * TLS1.0 option. + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 5.0.0(12) + */ + export interface TlsV10Option { + /** + * Version is TLS1.0. + * @type {'TlsV1.0'} + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 5.0.0(12) + */ + tlsVersion: 'TlsV1.0'; + /** + * TlsV1.0 cipher suite. + * @type {?TlsV10CipherSuite[]} + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 5.0.0(12) + */ + cipherSuite?: TlsV10CipherSuite[]; + } + /** + * Security configuration. + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 4.1.0(11) + */ + export interface SecurityConfiguration { + /** + * Certificate authority(CA) which is used to verify the remote server's identification. + * Default is 'system', if this field is not set, system CA will be used to verify the remote server's + * identification. + * See {@link CertificateAuthority}. + * @type {?'system' | 'skip' | CertificateAuthority} + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 4.1.0(11) + */ + /** + * Certificate authority(CA) which is used to verify the remote server's identification. + * @type {?"system" | "skip" | CertificateAuthority | ValidationCallback} + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 5.0.0(12) + */ + remoteValidation?: 'system' | 'skip' | CertificateAuthority | ValidationCallback; + /** + * Client certificate which is sent to the remote server, the the remote server will use it to verify the + * client's identification. Default is undefined, means server does not need to verify client. + * See {@link ClientCertificate}. + * @type {?ClientCertificate} + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 4.1.0(11) + */ + certificate?: ClientCertificate; + /** + * TLS option. + * 'system': use system tls configuration. + * CipherSuite[]: do not specify tls version, just specify cipher suite. + * @type {?'system' | CipherSuite[] | TlsV13Option | TlsV12Option | TlsV11Option | TlsV10Option} + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 5.0.0(12) + */ + tlsOptions?: 'system' | CipherSuite[] | TlsV13Option | TlsV12Option | TlsV11Option | TlsV10Option; + /** + * HTTP server authentication settings. No authentication by default. + * @type {?ServerAuthentication} + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 4.1.0(11) + */ + serverAuthentication?: ServerAuthentication; + } + /** + * HTTP configurations. + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 4.1.0(11) + */ + export interface Configuration { + /** + * HTTP transfer configuration. + * @type {?TransferConfiguration} + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 4.1.0(11) + */ + transfer?: TransferConfiguration; + /** + * HTTP tracing configuration. + * @type {?TracingConfiguration} + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 4.1.0(11) + */ + tracing?: TracingConfiguration; + /** + * HTTP proxy configuration. + * @type {?ProxyConfiguration} + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 4.1.0(11) + */ + proxy?: ProxyConfiguration; + /** + * HTTP dns configuration. + * @type {?DnsConfiguration} + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 4.1.0(11) + */ + dns?: DnsConfiguration; + /** + * HTTP security configuration. + * @type {?SecurityConfiguration} + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 4.1.0(11) + */ + security?: SecurityConfiguration; + } + /** + * Connection configuration. + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 5.0.0(12) + */ + export interface ConnectionConfiguration { + /** + * The maximum number of simultaneous TCP connections allowed to a single host + * (a host being the same as a hostname + port number pair). + * Default is 6, maximum value is 2147483647. + * @type {?number} + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 5.0.0(12) + */ + readonly maxConnectionsPerHost?: number; + /** + * The maximum number of simultaneous TCP connections allowed total in this session. + * Default is 64, maximum value is 2147483647. + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 5.0.0(12) + */ + readonly maxTotalConnections?: number; + } + /** + * Dns over HTTPS configuration. + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 4.1.0(11) + */ + export interface DnsOverHttpsConfiguration { + /** + * Url of DOH server. + * @type {?URLOrString} + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 4.1.0(11) + */ + url: URLOrString; + /** + * Whether to skip certificates validation. Default is false. + * @type {?boolean} + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 4.1.0(11) + */ + skipCertificatesValidation?: boolean; + } + /** + * Callback when HTTP body is received. + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 4.1.0(11) + */ + /** + * Add void | Promise as its return type. + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 5.0.0(12) + */ + export type OnDataReceive = (incomingData: ArrayBuffer) => number | void | Promise; + /** + * Callback indicates the upload progress. + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 4.1.0(11) + */ + export type OnUploadProgress = (totalSize: number, transferredSize: number) => void; + /** + * Callback indicates the download progress. + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 4.1.0(11) + */ + export type OnDownloadProgress = (totalSize: number, transferredSize: number) => void; + /** + * Callback when HTTP headers are received. + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 4.1.0(11) + */ + export type OnHeaderReceive = (headers: ResponseHeaders) => void; + /** + * Callback when HTTP transfer ended. + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 4.1.0(11) + */ + export type OnDataEnd = () => void; + /** + * Callback when {@link Request} or {@link Session} is canceled. + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 4.1.0(11) + */ + export type OnCanceled = () => void; + /** + * Callback when {@link Session} is closed. + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 4.1.0(11) + */ + export type OnClosed = () => void; + /** + * Callbacks to watch different HTTP events. + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 4.1.0(11) + */ + export interface HttpEventsHandler { + /** + * Callback called when a part of the HTTP response body is received. + * If the callback is registered, then returned {@link Response|response object} + * has undefined {@link Response.body|body} field. + * @type {?OnDataReceive} + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 4.1.0(11) + */ + onDataReceive?: OnDataReceive; + /** + * Callback called when an HTTP request part is sent to the server + * @type {?OnUploadProgress} + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 4.1.0(11) + */ + onUploadProgress?: OnUploadProgress; + /** + * Callback called when an HTTP response part is received from the server. + * @type {?OnDownloadProgress} + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 4.1.0(11) + */ + onDownloadProgress?: OnDownloadProgress; + /** + * Callback called when all HTTP requests are received. + * @type {?OnHeaderReceive} + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 4.1.0(11) + */ + onHeaderReceive?: OnHeaderReceive; + /** + * Callback called when an HTTP transmission is ended. + * @type {?OnDataEnd} + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 4.1.0(11) + */ + onDataEnd?: OnDataEnd; + /** + * Callback called when an HTTP request is canceled. + * @type {?OnCanceled} + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 4.1.0(11) + */ + onCanceled?: OnCanceled; + } + /** + * Certificate authority(CA) which is used to verify the remote server's identification. + * See {@link SecurityConfiguration.remoteValidation}. + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 4.1.0(11) + */ + export interface CertificateAuthority { + /** + * Certificate Authority certificates bundle used to verify the peer. It should be in PEM format. + * @type {?string | ArrayBuffer} + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 4.1.0(11) + */ + content?: string | ArrayBuffer; + /** + * A path to a Certificate Authority certificates file used to verify the peer. The file should be in PEM format. + * @type {?string} + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 4.1.0(11) + */ + filePath?: string; + /** + * A path to the directory holding multiple CA certificates used to verify the peer. + * The files in this directory should be PEM format. + * The files must be named by the subject name's hash and an extension of '.0''. + * For details, please see the documents. + * @type {?string} + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 4.1.0(11) + */ + folderPath?: string; + } + /** + * Client certificate which is sent to the remote server, the the remote server will use it to verify the client's + * identification. See {@link SecurityConfiguration.certificate}. + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 4.1.0(11) + */ + export interface ClientCertificate { + /** + * Client certificate content. It should be in 'PEM', 'DER' or 'P12' format. + * The actual format should be specified by {@link type}. + * @type {?string | ArrayBuffer} + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 4.1.0(11) + */ + content?: string | ArrayBuffer; + /** + * A path to a client certificate. The file should be in 'PEM', 'DER' or 'P12' format. + * The actual format should be specified by {@link type}. + * @type {?string} + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 4.1.0(11) + */ + filePath?: string; + /** + * Client certificate type. + * @type {?'PEM' | 'DER' | 'P12'} + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 4.1.0(11) + */ + type?: 'PEM' | 'DER' | 'P12'; + /** + * File name of your client certificate private key. + * @type {?string} + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 4.1.0(11) + */ + key?: string; + /** + * Password for your client certificate private key. + * @type {?string} + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 4.1.0(11) + */ + keyPassword?: string; + } + /** + * IP address is just a string. It could be IPv4 string or IPv6 string. + * It is used in {@link DnsServers} and {@link StaticDnsRule} and + * the function type of {@link DnsConfiguration.dnsRules}. + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 4.1.0(11) + */ + export type IpAddress = string; + /** + * This interface is used in {@link DnsServers}, indicates a DNS server address and port. + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 4.1.0(11) + */ + export interface IpAndPort { + /** + * Indicates an IPv4 or IPv6 address. + * @type {IpAddress} + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 4.1.0(11) + */ + ip: IpAddress; + /** + * Indicates a port. Range: [0, 65535]. Default is 53 + * @type {?number} + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 4.1.0(11) + */ + port?: number; + } + /** + * One of the types in {@link DnsConfiguration.dnsRules}. + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 4.1.0(11) + */ + export type DnsServers = IpAndPort[]; + /** + * One of the types in {@link DnsConfiguration.dnsRules}. + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 4.1.0(11) + */ + export interface StaticDnsRule { + /** + * Indicates a hostname. + * For example, URL is https://example.com:443, hostname is example.com. + * For example, URL is https://example.com, hostname is example.com. + * For example, URL is https://example.com:443/path, hostname is example.com. + * For example, URL is https://example.com:443?name=value, hostname is example.com. + * @type {string} + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 4.1.0(11) + */ + host: string; + /** + * Indicates a port. Range: [0, 65535]. + * @type {number} + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 4.1.0(11) + */ + port: number; + /** + * Indicates the IP addresses corresponding to the {@link host}. + * @type {IpAddress[]} + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 4.1.0(11) + */ + ipAddresses: IpAddress[]; + } + /** + * One of the types in {@link DnsConfiguration.dnsRules}. + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 4.1.0(11) + */ + export type StaticDnsRules = StaticDnsRule[]; + /** + * A function that determines whether a host uses a proxy or not. + * See {@link WebProxy.exclusions}. + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 4.1.0(11) + */ + export type DynamicExclusionRule = (url: URLOrString) => boolean; + /** + * Custom proxy configuration, see {@link ProxyConfiguration}. + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 4.1.0(11) + */ + export interface WebProxy { + /** + * Indicates the URL of the proxy server. If you do not set port explicitly, port will be 1080. + * @type {?URLOrString} + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 4.1.0(11) + */ + url: URLOrString; + /** + * Used to control when to create a proxy tunnel. + * Tunnel or tunneling means that an HTTP CONNECT request is sent to the proxy, asking it to connect to + * a remote host on a specific port number and then the traffic is just passed through the proxy. + * 'auto' means create tunnel for HTTPS, and not to create for HTTP. + * 'always' means always create tunnel. + * The default is 'auto'. + * @type {?'auto' | 'always'} + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 4.1.0(11) + */ + createTunnel?: 'auto' | 'always'; + /** + * If {@link Request.url} matches the rule of {@link exclusions}, the {@link Request} will not use proxy. + * @type {?URLOrString | URLOrString[] | DynamicExclusionRule} + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 4.1.0(11) + */ + exclusions?: URLOrString | URLOrString[] | DynamicExclusionRule; + /** + * The {@link SecurityConfiguration} in proxy. + * @type {?SecurityConfiguration} + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 4.1.0(11) + */ + security?: SecurityConfiguration; + } + /** + * HTTP request cookies + * + * Allow you to specify all cookies you need in one object as follows: {'name1': 'value1', 'name2': 'value2'}. + * Cookies will be transmitted in cookie header as follows: {'cookies': 'name1=value1; name2=value2'}. + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 4.1.0(11) + */ + export interface RequestCookies { + [name: string]: string; + } + /** + * HTTP request. + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 4.1.0(11) + */ + export class Request { + /** + * The unique id for every single request. Generated by system. + * @type {?string} + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 4.1.0(11) + */ + readonly id: string; + /** + * In {@link constructor} the parameter could be {@link URLOrString}, but URL is just {@link URL}, + * string need to be converted to {@link URL}. + * @type {?URL} + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 4.1.0(11) + */ + url: URL; + /** + * HTTP request method. Default is GET. + * @type {?HttpMethod} + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 4.1.0(11) + */ + method: HttpMethod; + /** + * HTTP request headers. + * @type {?RequestHeaders} + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 4.1.0(11) + */ + headers?: RequestHeaders; + /** + * HTTP request body. + * @type {?RequestContent} + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 4.1.0(11) + */ + content?: RequestContent; + /** + * HTTP request cookies. The setting is converted to the HTTP Cookies header. + * @type {?RequestCookies} + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 4.1.0(11) + */ + cookies?: RequestCookies; + /** + * HTTP transfer ranges. The setting is converted to the HTTP Range header. + * An HTTP request with range header asks the server to send back only a portion of an HTTP response. + * @type {?TransferRange | TransferRange[]} + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 4.1.0(11) + */ + transferRange?: TransferRange | TransferRange[]; + /** + * HTTP request configuration. See {@link Configuration}. + * Used to override default or session-wide settings. + * @type {?Configuration} + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 4.1.0(11) + */ + configuration?: Configuration; + /** + * Where to put the response body. + * @type {?ResponseBodyDestination} + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 5.0.0(12) + */ + destination?: ResponseBodyDestination; + /** + * Constructor of {@link Request}. {@link url} is needed, others are optional. + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 4.1.0(11) + */ + constructor(url: URLOrString, method?: HttpMethod, headers?: RequestHeaders, content?: RequestContent, cookies?: RequestCookies, transferRange?: TransferRange | TransferRange[], configuration?: Configuration); + } + /** + * The callback signature which maybe used in {@link FormFieldFileValue.contentOrPath} and {@link RequestContent}. + * This callback is called when API needs next portion of the data to send to the server. + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 4.1.0(11) + */ + /** + * Return type could be {@link ArrayBuffer} | {@link Promise} + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 5.0.0(12) + */ + export type GetDataCallback = (maxSize: number) => ArrayBuffer | Promise; + /** + * HTTP request body, see {@link Request.content}. + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 4.1.0(11) + */ + /** + * Add UploadFromFile | UploadFromStream as its type. + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 5.0.0(12) + */ + export type RequestContent = RawDataContent | Form | MultipartForm | GetDataCallback | UploadFromFile | UploadFromStream; + /** + * HTTP simple form data. + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 4.1.0(11) + */ + export class Form { + /** + * Constructor of {@link Form}. {@link fields} is needed. + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 4.1.0(11) + */ + constructor(fields: FormFields); + /** + * HTTP simple form data fields. + * @type {?FormFields} + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 4.1.0(11) + */ + fields: FormFields; + } + /** + * HTTP multipart form data. + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 4.1.0(11) + */ + export class MultipartForm { + /** + * Constructor of {@link MultipartForm}. {@link fields} is needed. + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 4.1.0(11) + */ + constructor(fields: MultipartFormFields); + /** + * HTTP multipart form data fields. + * @type {?MultipartFormFields} + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 4.1.0(11) + */ + fields: MultipartFormFields; + } + /** + * HTTP simple form data fields, see {@link Form.fields}. + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 4.1.0(11) + */ + export type FormFields = { + [k: string]: FormFieldValue | FormFieldValue[]; + }; + /** + * HTTP multipart form data fields, see {@link MultipartForm.fields}. + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 4.1.0(11) + */ + export type MultipartFormFields = { + [k: string]: MultipartFormFieldValue | MultipartFormFieldValue[]; + }; + /** + * HTTP multipart form data field value, see {@link MultipartFormFields}. + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 4.1.0(11) + */ + export type MultipartFormFieldValue = FormFieldValue | FormFieldFileValue; + /** + * HTTP simple form data field value, see {@link Form.fields} and {@link MultipartFormFieldValue}. + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 4.1.0(11) + */ + export type FormFieldValue = string | number | boolean | bigint; + /** + * A file path which is used in {@link FormFieldFileValue.contentOrPath}. + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 4.1.0(11) + */ + export type Path = string; + /** + * HTTP simple form data field value, see {@link MultipartFormFieldValue}. + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 4.1.0(11) + */ + export interface FormFieldFileValue { + /** + * HTTP multipart form data content type. + * @type {?ContentType} + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 4.1.0(11) + */ + contentType?: ContentType; + /** + * HTTP multipart form data remote file name. + * @type {?string} + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 4.1.0(11) + */ + remoteFileName?: string; + /** + * HTTP multipart form data content. + * @type {Path | FileContent | GetDataCallback} + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 4.1.0(11) + */ + contentOrPath: Path | FileContent | GetDataCallback; + } + /** + * One of the type of {@link FormFieldFileValue.contentOrPath}. + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 4.1.0(11) + */ + export interface FileContent { + /** + * Content could be {@link string} or {@link ArrayBuffer}. + * @type {string | ArrayBuffer} + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 4.1.0(11) + */ + content: string | ArrayBuffer; + } + /** + * HTTP debug information, see {@link Response.debugInfo}. + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 4.1.0(11) + */ + export interface DebugInfo { + /** + * Debug information type. + * @type {DebugEvent} + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 4.1.0(11) + */ + type: DebugEvent; + /** + * Debug information data. + * @type {ArrayBuffer} + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 4.1.0(11) + */ + data: ArrayBuffer; + } + /** + * Indicates the http version. + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 5.0.0(12) + */ + export type HttpVersion = '1.0' | '1.1' | '2' | '3' | 'unknown'; + /** + * HTTP response. + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 4.1.0(11) + */ + export interface Response { + /** + * HTTP request that initiated this response. + * Set a {@link Request} in {@link Response} to let it know which {@link Request} it comes from. + * @type {?Request} + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 4.1.0(11) + */ + readonly request: Request; + /** + * HTTP status code. + * @type {?number} + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 4.1.0(11) + */ + readonly statusCode: number; + /** + * HTTP response headers. + * @type {?ResponseHeaders} + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 4.1.0(11) + */ + readonly headers: ResponseHeaders; + /** + * The last used effective URL. + * If you follow redirects, it may not be the same value you set with {@link Request.url}. + * @type {?URL} + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 4.1.0(11) + */ + readonly effectiveUrl?: URL; + /** + * The HTTP response body. + * @type {?ArrayBuffer} + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 4.1.0(11) + */ + readonly body?: ArrayBuffer; + /** + * The path which the content downloaded. + * @type {?DownloadedTo} + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 5.0.0(12) + */ + readonly downloadedTo?: DownloadedTo; + /** + * The request/response processing debug info. Collected events depend on your + * {@link TracingConfiguration.debug} setting. + * @type {?DebugInfo[]} + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 4.1.0(11) + */ + readonly debugInfo?: DebugInfo[]; + /** + * The response time info. Whether to collect this, depends on your + * {@link TracingConfiguration.collectTimeInfo} setting. + * @type {?TimeInfo} + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 4.1.0(11) + */ + readonly timeInfo?: TimeInfo; + /** + * The response cookies. + * @type {?ResponseCookie[]} + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 4.1.0(11) + */ + readonly cookies?: ResponseCookie[]; + /** + * The http version. + * @type {?HttpVersion} + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 5.0.0(12) + */ + readonly httpVersion?: HttpVersion; + /** + * The reason phrase of the status line. + * @type {?string} + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 5.0.0(12) + */ + readonly reasonPhrase?: string; + /** + * Converts {@link body} to UTF-8 {@link string}. + * @returns { string | null } Returns UTF-8 string or {@link null} if {@link body} is not in UTF-8 format. + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 4.1.0(11) + */ + toString(): string | null; + /** + * Return result of JSON deserialization of {@link toString()}. + * @returns { object | null } Returns {@link JSON.parse} with parameter {@link toString()} if no exception. + * Returns null in case of any exception occurred. + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 4.1.0(11) + */ + toJSON(): object | null; + } + /** + * HTTP response debug event type. + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 4.1.0(11) + */ + export type DebugEvent = 'text' | 'headerIn' | 'headerOut' | 'dataIn' | 'dataOut' | 'sslDataIn' | 'sslDataOut'; + /** + * HTTP response timing information. It will be collected in {@link Response.timeInfo} and + * {@link TracingConfiguration.collectTimeInfo} decides whether to collect it. + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 4.1.0(11) + */ + export interface TimeInfo { + /** + * The time in milliseconds from the start until the remote host name was resolved. + * @type {?number} + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 4.1.0(11) + */ + nameLookupTimeMs: number; + /** + * The time in milliseconds from the start until the connection to the remote host (or proxy) was completed. + * @type {?number} + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 4.1.0(11) + */ + connectTimeMs: number; + /** + * The time in milliseconds from the start until the TLS handshake to the remote host (or proxy) was completed. + * @type {?number} + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 5.0.0(12) + */ + tlsHandshakeTimeMs: number; + /** + * The time in milliseconds, it took from the start until the transfer is just about to begin. + * @type {?number} + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 4.1.0(11) + */ + preTransferTimeMs: number; + /** + * The time in milliseconds, it took from the start until the first byte is received. + * @type {?number} + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 4.1.0(11) + */ + startTransferTimeMs: number; + /** + * The total time in milliseconds for the HTTP transfer, including name resolving, TCP connect etc. + * @type {?number} + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 4.1.0(11) + */ + totalTimeMs: number; + /** + * The time in milliseconds it took for all redirection steps including name lookup, connect, + * pre transfer and transfer. + * before final transaction was started. + * @type {?number} + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 4.1.0(11) + */ + redirectTimeMs: number; + } + /** + * HTTP response cookies. See {@link Response.cookies}. + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 4.1.0(11) + */ + export interface ResponseCookie { + /** + * Response cookie name. + * @type {?string} + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 4.1.0(11) + */ + name: string; + /** + * Response cookie value. + * @type {?string} + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 4.1.0(11) + */ + value?: string; + /** + * Response cookie domain attribute. + * @type {?string} + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 4.1.0(11) + */ + domain?: string; + /** + * Response cookie path attribute. + * @type {?string} + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 4.1.0(11) + */ + path?: string; + /** + * Response cookie expires attribute. + * @type {?string} + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 4.1.0(11) + */ + expires?: string; + /** + * Response cookie maxAge attribute. + * @type {?number} + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 4.1.0(11) + */ + maxAge?: number; + /** + * Response cookie Secure attribute. + * @type {?true} + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 4.1.0(11) + */ + isSecure?: true; + /** + * Response cookie httpOnly attribute. + * @type {?true} + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 4.1.0(11) + */ + httpOnly?: true; + /** + * Response cookie sameSite attribute. + * @type {?string} + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 4.1.0(11) + */ + sameSite?: string; + /** + * Raw size of this response cookie. + * Response cookie comes from 'Set-Cookies' header. + * For example, header is {'Set-Cookies': 'my-cookie=my-value'}, + * so rawSize is equal to 'my-cookie=my-value' string length. + * @type {?number} + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 4.1.0(11) + */ + rawSize?: number; + /** + * All attributes in the response cookie. + * @type {?CookieAttributes} + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 4.1.0(11) + */ + cookieAttributes?: CookieAttributes; + } + /** + * Response cooke attributes. See {@link ResponseCookie.cookieAttributes}. + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 4.1.0(11) + */ + export type CookieAttributes = { + [k: string]: string | undefined; + }; + /** + * Session is a main object to send HTTP requests. + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 4.1.0(11) + */ + export interface Session { + /** + * An unique id of {@link Session}. + * @type {?string} + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 4.1.0(11) + */ + readonly id: string; + /** + * Configuration of {@link Session}. + * @type {?SessionConfiguration | undefined} + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 4.1.0(11) + */ + readonly configuration: SessionConfiguration | undefined; + /** + * Send an HTTP request and get HTTP response. + * @permission ohos.permission.INTERNET + * @permission ohos.permission.GET_NETWORK_INFO If you want to use 'cellular' of {@link PathPreference}. + * @param { Request } request - An {@link Request} object. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 1007900001 - Unsupported protocol. + * @throws { BusinessError } 1007900003 - URL using bad/illegal format or missing URL. + * @throws { BusinessError } 1007900005 - Couldn't resolve proxy name. + * @throws { BusinessError } 1007900006 - Couldn't resolve host name. + * @throws { BusinessError } 1007900007 - Couldn't connect to server. + * @throws { BusinessError } 1007900008 - Weird server reply. + * @throws { BusinessError } 1007900009 - Access denied to remote resource. + * @throws { BusinessError } 1007900016 - Error in the HTTP2 framing layer. + * @throws { BusinessError } 1007900018 - Transferred a partial file. + * @throws { BusinessError } 1007900025 - Upload failed. + * @throws { BusinessError } 1007900026 - Failed to open/read local data from file/application. + * @throws { BusinessError } 1007900027 - Out of memory. + * @throws { BusinessError } 1007900028 - Timeout was reached. + * @throws { BusinessError } 1007900047 - Number of redirects hit maximum amount. + * @throws { BusinessError } 1007900052 - Server returned nothing (no headers, no data). + * @throws { BusinessError } 1007900055 - Failed sending data to the peer. + * @throws { BusinessError } 1007900056 - Failure when receiving data from the peer. + * @throws { BusinessError } 1007900058 - Problem with the local SSL certificate. + * @throws { BusinessError } 1007900059 - Couldn't use specified SSL cipher. + * @throws { BusinessError } 1007900060 - SSL peer certificate or SSH remote key was not OK. + * @throws { BusinessError } 1007900061 - Unrecognized or bad HTTP Content or Transfer-Encoding. + * @throws { BusinessError } 1007900063 - Maximum file size exceeded. + * @throws { BusinessError } 1007900070 - Disk full or allocation exceeded. + * @throws { BusinessError } 1007900073 - Remote file already exists. + * @throws { BusinessError } 1007900077 - Problem with the SSL CA cert (path? access rights?). + * @throws { BusinessError } 1007900078 - Remote file not found. + * @throws { BusinessError } 1007900094 - An authentication function returned an error. + * @throws { BusinessError } 1007900999 - Internal Error. + * @throws { BusinessError } 1007900998 - Method not supported. + * @throws { BusinessError } 1007900997 - Invalid content type. + * @throws { BusinessError } 1007900996 - Proxy type not supported. + * @throws { BusinessError } 1007900995 - Get system proxy failed. + * @throws { BusinessError } 1007900993 - Session is closed. + * @throws { BusinessError } 1007900992 - Request is canceled. + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 4.1.0(11) + */ + fetch(request: Request): Promise; + /** + * Send an HTTP GET request with specified URL and get HTTP response. + * We will create a {@link Request} and call fetch. + * No content will be set into the {@link Request}. Use {@link SessionConfiguration.headers} as its + * {@link Request.headers}, use {@link SessionConfiguration.cookies} as its {@link Request.cookies}. + * @permission ohos.permission.INTERNET + * @permission ohos.permission.GET_NETWORK_INFO If you want to use 'cellular' of {@link PathPreference}. + * @param { URLOrString } url - An HTTP URL. + * @returns { Promise } The promise returned by the function. + * @throws Check {@link Session.fetch} + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 4.1.0(11) + */ + /** + * Send an HTTP GET request with specified URL and get HTTP response. + * We will create a {@link Request} and call fetch. + * No content will be set into the {@link Request}. Use {@link SessionConfiguration.headers} as its + * {@link Request.headers}, use {@link SessionConfiguration.cookies} as its {@link Request.cookies}. + * @permission ohos.permission.INTERNET + * @permission ohos.permission.GET_NETWORK_INFO If you want to use 'cellular' of {@link PathPreference}. + * @param { URLOrString } url - An HTTP URL. + * @param { ResponseBodyDestination } destination - Response destination. + * @returns { Promise } The promise returned by the function. + * @throws Check {@link Session.fetch} + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 5.0.0(12) + */ + get(url: URLOrString, destination?: ResponseBodyDestination): Promise; + /** + * Send an HTTP POST request with specified URL and content, and get HTTP response. + * We will create a {@link Request} and call fetch. + * Use {@link SessionConfiguration.headers} as its {@link Request.headers}, + * use {@link SessionConfiguration.cookies} as its {@link Request.cookies}. + * @permission ohos.permission.INTERNET + * @permission ohos.permission.GET_NETWORK_INFO If you want to use 'cellular' of {@link PathPreference}. + * @param { URLOrString } url - An HTTP URL. + * @param { RequestContent } content - An HTTP body. + * @returns { Promise } The promise returned by the function. + * @throws Check {@link Session.fetch} + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 4.1.0(11) + */ + /** + * Send an HTTP POST request with specified URL and content, and get HTTP response. + * We will create a {@link Request} and call fetch. + * Use {@link SessionConfiguration.headers} as its {@link Request.headers}, + * use {@link SessionConfiguration.cookies} as its {@link Request.cookies}. + * @permission ohos.permission.INTERNET + * @permission ohos.permission.GET_NETWORK_INFO If you want to use 'cellular' of {@link PathPreference}. + * @param { URLOrString } url - An HTTP URL. + * @param { RequestContent } content - An HTTP body. + * @param { ResponseBodyDestination } destination - Response destination. + * @returns { Promise } The promise returned by the function. + * @throws Check {@link Session.fetch} + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 5.0.0(12) + */ + post(url: URLOrString, content?: RequestContent, destination?: ResponseBodyDestination): Promise; + /** + * Send an HTTP PUT request with specified URL and content, and get HTTP response. + * We will create a {@link Request} and call fetch. + * Use {@link SessionConfiguration.headers} as its {@link Request.headers}, + * use {@link SessionConfiguration.cookies} as its {@link Request.cookies}. + * @permission ohos.permission.INTERNET + * @permission ohos.permission.GET_NETWORK_INFO If you want to use 'cellular' of {@link PathPreference}. + * @param { URLOrString } url - An HTTP URL. + * @param { RequestContent } content - An HTTP body. + * @returns { Promise } The promise returned by the function. + * @throws Check {@link Session.fetch} + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 4.1.0(11) + */ + /** + * Send an HTTP PUT request with specified URL and content, and get HTTP response. + * We will create a {@link Request} and call fetch. + * Use {@link SessionConfiguration.headers} as its {@link Request.headers}, + * use {@link SessionConfiguration.cookies} as its {@link Request.cookies}. + * @permission ohos.permission.INTERNET + * @permission ohos.permission.GET_NETWORK_INFO If you want to use 'cellular' of {@link PathPreference}. + * @param { URLOrString } url - An HTTP URL. + * @param { RequestContent } content - An HTTP body. + * @param { ResponseBodyDestination } destination - Response destination. + * @returns { Promise } The promise returned by the function. + * @throws Check {@link Session.fetch} + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 5.0.0(12) + */ + put(url: URLOrString, content?: RequestContent, destination?: ResponseBodyDestination): Promise; + /** + * Download to a file. + * We will create a {@link Request} and call fetch. + * Use {@link SessionConfiguration.headers} as its {@link Request.headers}, + * use {@link SessionConfiguration.cookies} as its {@link Request.cookies}. + * @permission ohos.permission.INTERNET + * @permission ohos.permission.GET_NETWORK_INFO If you want to use 'cellular' of {@link PathPreference}. + * @param { URLOrString } url - An HTTP URL. + * @param { DownloadToFile } downloadTo - Download to a file. + * @returns { Promise } The promise returned by the function. + * @throws Check {@link Session.fetch} + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 5.0.0(12) + */ + downloadToFile(url: URLOrString, downloadTo: DownloadToFile): Promise; + /** + * Upload from a file. + * We will create a {@link Request} and call fetch. + * Use {@link SessionConfiguration.headers} as its {@link Request.headers}, + * use {@link SessionConfiguration.cookies} as its {@link Request.cookies}. + * @permission ohos.permission.INTERNET + * @permission ohos.permission.GET_NETWORK_INFO If you want to use 'cellular' of {@link PathPreference}. + * @param { URLOrString } url - An HTTP URL. + * @param { UploadFromFile } uploadFrom - Upload from a file. + * @returns { Promise } The promise returned by the function. + * @throws Check {@link Session.fetch} + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 5.0.0(12) + */ + uploadFromFile(url: URLOrString, uploadFrom: UploadFromFile): Promise; + /** + * Download to a stream. + * We will create a {@link Request} and call fetch. + * Use {@link SessionConfiguration.headers} as its {@link Request.headers}, + * use {@link SessionConfiguration.cookies} as its {@link Request.cookies}. + * @permission ohos.permission.INTERNET + * @permission ohos.permission.GET_NETWORK_INFO If you want to use 'cellular' of {@link PathPreference}. + * @param { URLOrString } url - An HTTP URL. + * @param { DownloadToStream } downloadTo - Download to a stream. + * @returns { Promise } The promise returned by the function. + * @throws Check {@link Session.fetch} + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 5.0.0(12) + */ + downloadToStream(url: URLOrString, downloadTo: DownloadToStream): Promise; + /** + * Upload from a stream. + * We will create a {@link Request} and call fetch. + * Use {@link SessionConfiguration.headers} as its {@link Request.headers}, + * use {@link SessionConfiguration.cookies} as its {@link Request.cookies}. + * @permission ohos.permission.INTERNET + * @permission ohos.permission.GET_NETWORK_INFO If you want to use 'cellular' of {@link PathPreference}. + * @param { URLOrString } url - An HTTP URL. + * @param { UploadFromStream } uploadFrom - Upload from a stream. + * @returns { Promise } The promise returned by the function. + * @throws Check {@link Session.fetch} + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 5.0.0(12) + */ + uploadFromStream(url: URLOrString, uploadFrom: UploadFromStream): Promise; + /** + * Send an HTTP HEAD request with specified URL and get HTTP response. + * We will create a {@link Request} and call fetch. + * No content will be set into the {@link Request}. Use {@link SessionConfiguration.headers} as its + * {@link Request.headers}, use {@link SessionConfiguration.cookies} as its {@link Request.cookies}. + * @permission ohos.permission.INTERNET + * @permission ohos.permission.GET_NETWORK_INFO If you want to use 'cellular' of {@link PathPreference}. + * @param { URLOrString } url - An HTTP URL. + * @returns { Promise } The promise returned by the function. + * @throws Check {@link Session.fetch} + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 4.1.0(11) + */ + head(url: URLOrString): Promise; + /** + * Send an HTTP DELETE request with specified URL and get HTTP response. + * We will create a {@link Request} and call fetch. + * No content will be set into the {@link Request}. Use {@link SessionConfiguration.headers} as its + * {@link Request.headers}, use {@link SessionConfiguration.cookies} as its {@link Request.cookies}. + * @permission ohos.permission.INTERNET + * @permission ohos.permission.GET_NETWORK_INFO If you want to use 'cellular' of {@link PathPreference}. + * @param { URLOrString } url - An HTTP URL. + * @returns { Promise } The promise returned by the function. + * @throws Check {@link Session.fetch} + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 4.1.0(11) + */ + delete(url: URLOrString): Promise; + /** + * Cancel a request or cancel some requests or cancel all requests. + * @param { Request | Request[] } requestToCancel? - A request or some requests. + * Undefined indicates all requests within this session. + * @returns { void } Nothing should be returned. + * @throws { BusinessError } 401 - Parameter error. + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 4.1.0(11) + */ + cancel(requestToCancel?: Request | Request[]): void; + /** + * Close a session. Closed session can not run requests. + * @returns { void } Nothing should be returned. + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 4.1.0(11) + */ + close(): void; + } + /** + * Creates a session. + * The maximum number of opened sessions {@link Session} is limited by the implementation. + * @param { SessionConfiguration } sessionConfiguration? - Session configuration. + * @returns { Session } Return an session with unique id. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 1007900994 - Sessions number reached limit. + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 4.1.0(11) + */ + export function createSession(sessionConfiguration?: SessionConfiguration): Session; + /** + * Listening to the {@link Session} close() or cancel() events. See {@link SessionConfiguration.sessionListener}. + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 4.1.0(11) + */ + export interface SessionListener { + /** + * Callback called in case {@link Session} is canceled. + * @type {?OnCanceled} + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 4.1.0(11) + */ + onCanceled?: OnCanceled; + /** + * Callback called in case {@link Session} is closed. + * @type {?OnClosed} + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 4.1.0(11) + */ + onClosed?: OnClosed; + } + /** + * Parameter of {@link Interceptor.intercept} and {@link RequestHandler.handle}. + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 5.0.0(12) + */ + export interface RequestContext { + /** + * The request which you intercepted. + * @type {Request} + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 5.0.0(12) + */ + request: Request; + /** + * The session which keep the interceptor. + * @type {Session} + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 5.0.0(12) + */ + session: Session; + } + /** + * Interceptor see {@link Session}. + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 5.0.0(12) + */ + export interface Interceptor { + /** + * Intercept a {@link Request}, and return a {@link Response}. + * @param { RequestContext } context the context which you intercepted. + * @param { RequestHandler } next you can return a Promise directly, + * or you can call the next interceptor. + * @returns { Promise } you can return a Promise directly, or return the value from the next. + * interceptor. + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 5.0.0(12) + */ + intercept(context: RequestContext, next: RequestHandler): Promise; + } + /** + * Interceptor handler {@link Interceptor}. + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 5.0.0(12) + */ + export interface RequestHandler { + /** + * Intercept a {@link Request}, and return a {@link Response}. + * @param { RequestContext } context the context which you intercepted. + * @returns { Promise } Our API will create a default handler for interceptors, so this is + * just an interface. + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 5.0.0(12) + */ + handle(context: RequestContext): Promise; + } + /** + * Session configuration. See {@link Session.configuration}. + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 4.1.0(11) + */ + export interface SessionConfiguration { + /** + * Interceptors will be made into an interceptor chain. + * Input: [A, B, C, D], made into A->B->C->D->defaultHandler. + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 5.0.0(12) + */ + interceptors?: Interceptor[]; + /** + * Default request level configuration. The options can be overridden via {@link Request.configuration}. + * @type {?Configuration} + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 4.1.0(11) + */ + requestConfiguration?: Configuration; + /** + * Base URL prepended to {@link Request.url} if it's not an absolute URL. + * For example, Request.url is '?name=value', baseAddress is 'https://example.com', + * then the real URL becomes 'https://example.com?name=value' when request is sent to server. + * @type {?URLOrString} + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 4.1.0(11) + */ + baseAddress?: URLOrString; + /** + * If {@link Session.fetch} is called, but no {@link RequestHeaders} are in {@link Request}, + * {@link headers} will be the {@link Request.headers}. + * @type {?RequestHeaders} + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 4.1.0(11) + */ + headers?: RequestHeaders; + /** + * If {@link Session.fetch} is called, but no {@link RequestCookies} in {@link Request}, + * {@link cookies} will be the {@link Request.cookies}. + * @type {?RequestCookies} + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 4.1.0(11) + */ + cookies?: RequestCookies; + /** + * Listening to the {@link Session} close() or cancel() events. See {@link SessionListener}. + * @type {?SessionListener} + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 4.1.0(11) + */ + sessionListener?: SessionListener; + /** + * Connection configuration. It's used to specify the maximum + * number of simultaneous TCP connections allowed total in this session and allowed to a single host. + * @type {?ConnectionConfiguration} + * @syscap SystemCapability.Collaboration.RemoteCommunication + * @since 5.0.0(12) + */ + connectionConfiguration?: ConnectionConfiguration; + } +} +export default rcp; diff --git a/language/arkts/extractor/sdk/hms/ets/api/@hms.collaboration.service.d.ets b/language/arkts/extractor/sdk/hms/ets/api/@hms.collaboration.service.d.ets new file mode 100755 index 00000000..98146cbd --- /dev/null +++ b/language/arkts/extractor/sdk/hms/ets/api/@hms.collaboration.service.d.ets @@ -0,0 +1,92 @@ +/* + * Copyright (c) Huawei Technologies Co., Ltd. 2023-2023. All rights reserved. + */ +/** + * @file Defines collaboration service capabilities and provides collaboration service interfaces. + * @kit ServiceCollaborationKit + */ +/** + * Enumerates the types of collaboration services. The caller must set up a { @link businessFilter } to specify + * the type of service to get. + * + * @enum {number} + * @syscap SystemCapability.Collaboration.Service + * @since 5.0.0(12) + */ +declare enum CollaborationServiceFilter { + /** + * 0 indicates all the collaboration services. + * + * @enum {number} + * @syscap SystemCapability.Collaboration.Service + * @since 5.0.0(12) + */ + ALL = 0, + /** + * 1 indicates the collaboration service used to take photos. + * + * @enum {number} + * @syscap SystemCapability.Collaboration.Service + * @since 5.0.0(12) + */ + TAKE_PHOTO = 1, + /** + * 2 indicates the collaboration service used to scan documents. + * + * @enum {number} + * @syscap SystemCapability.Collaboration.Service + * @since 5.0.0(12) + */ + SCAN_DOCUMENT = 2, + /** + * 3 indicates the collaboration service used to pick images. + * + * @enum {number} + * @syscap SystemCapability.Collaboration.Service + * @since 5.0.0(12) + */ + IMAGE_PICKER = 3 +} +/** + * Provides collaboration services that are displayed as menu items for user selection. + * + * @param { Array } businessFilter - Type of service to be displayed as a menu item. + * The default value is [0], indicating all the services. + * @syscap SystemCapability.Collaboration.Service + * @since 5.0.0(12) + */ +@Builder +declare function createCollaborationServiceMenuItems(businessFilter?: Array): void; +/** + * Provides the collaboration service status component. You must implement the { @link onState} method + * and declare this component in the dialog box. After the service starts, the dialog box will be called + * by the collaboration framework. + * + * @syscap SystemCapability.Collaboration.Service + * @since 5.0.0(12) + */ +@Component +declare struct CollaborationServiceStateDialog { + /** + * Called when the collaboration service is completed. + * + * @param { number } stateCode - State of the collaboration service. The value 0 indicates success, 1001202001 + * indicates service cancellation from the peer, 1001202002 indicates an error, and 1001202003 indicates service + * cancellation from the peer. + * @param { string } bufferType - Type of the buffer. The value general.image indicates image. The value + * general.video indicates video. + * @param { ArrayBuffer } buffer - Data returned in the case of a successful operation. Null is returned + * in other cases. + * @syscap SystemCapability.Collaboration.Service + * @since 5.0.0(12) + */ + onState: (stateCode: number, bufferType: string, buffer: ArrayBuffer) => void; + /** + * Default builder function for struct. You should not need to invoke this method directly. + * + * @syscap SystemCapability.Collaboration.Service + * @since 5.0.0(12) + */ + build(): void; +} +export { CollaborationServiceFilter, createCollaborationServiceMenuItems, CollaborationServiceStateDialog }; diff --git a/language/arkts/extractor/sdk/hms/ets/api/@hms.collaboration.systemShare.d.ts b/language/arkts/extractor/sdk/hms/ets/api/@hms.collaboration.systemShare.d.ts new file mode 100755 index 00000000..a5d1e3ba --- /dev/null +++ b/language/arkts/extractor/sdk/hms/ets/api/@hms.collaboration.systemShare.d.ts @@ -0,0 +1,465 @@ +/* + * Copyright (c) Huawei Technologies Co., Ltd. 2023-2023. All rights reserved. + */ +/** + * @file Defines share capability. + * @kit ShareKit + */ +import type Want from '@ohos.app.ability.Want'; +import type common from '@ohos.app.ability.common'; +/** + * Provide methods make the host (data owner) application can conveniently wrap shared data, + * make show the system share panel. + * + * @namespace systemShare + * @syscap SystemCapability.Collaboration.SystemShare + * @since 4.1.0(11) + */ +declare namespace systemShare { + /** + * Describe the shared data. + * + * @syscap SystemCapability.Collaboration.SystemShare + * @since 4.1.0(11) + */ + class SharedData { + /** + * Create shared data with shared record + * + * @param { SharedRecord } record - Record will add into shared data + * @throws { BusinessError } 401 - Parameter error. + * @syscap SystemCapability.Collaboration.SystemShare + * @since 4.1.0(11) + */ + constructor(record: SharedRecord); + /** + * Add a record into shared data + * + * @param { SharedRecord } record - Record will add into shared data. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 1003700001 - The number of records exceeds the maximum. + * @syscap SystemCapability.Collaboration.SystemShare + * @since 4.1.0(11) + */ + addRecord(record: SharedRecord): void; + /** + * Get all records of shared data + * + * @returns { Array } Return the records of shared data + * @syscap SystemCapability.Collaboration.SystemShare + * @since 4.1.0(11) + */ + getRecords(): Array; + } + /** + * Describe the shared record + * + * @syscap SystemCapability.Collaboration.SystemShare + * @since 4.1.0(11) + */ + interface SharedRecord { + /** + * Indicates the uniform type descriptor of shared record, + * for details,see {@link @ohos.data.uniformTypeDescriptor}. + * + * @type { string } + * @syscap SystemCapability.Collaboration.SystemShare + * @since 4.1.0(11) + */ + utd: string; + /** + * Indicates the content of shared record, information that does not + * require authorization, including but not limited to text, HTML text, and URL. + * + * @type { string } + * @syscap SystemCapability.Collaboration.SystemShare + * @since 4.1.0(11) + */ + content?: string; + /** + * Indicates the uri of shared record. + * + * @type { string } + * @syscap SystemCapability.Collaboration.SystemShare + * @since 4.1.0(11) + */ + uri?: string; + /** + * Indicates the title of shared record + * + * @type { string } + * @syscap SystemCapability.Collaboration.SystemShare + * @since 4.1.0(11) + */ + title?: string; + /** + * Indicates the label of shared record + * + * @type { string } + * @syscap SystemCapability.Collaboration.SystemShare + * @since 4.1.0(11) + */ + label?: string; + /** + * Indicates the description of shared record + * + * @type { string } + * @syscap SystemCapability.Collaboration.SystemShare + * @since 4.1.0(11) + */ + description?: string; + /** + * Indicates the thumbnail of shared record + * + * @type { Uint8Array } + * @syscap SystemCapability.Collaboration.SystemShare + * @since 4.1.0(11) + */ + thumbnail?: Uint8Array; + /** + * Indicates the extra data of shared record. The content + * is forwarded to the target application without permission authorization. + * + * @type { Record> } + * @syscap SystemCapability.Collaboration.SystemShare + * @since 4.1.0(11) + */ + extraData?: Record>; + } + /** + * Defines the offset property. + * @typedef Offset + * @syscap SystemCapability.Collaboration.SystemShare + * @since 4.1.0(11) + */ + interface Offset { + /** + * Coordinate x of the Position. + * + * @type {number} + * @syscap SystemCapability.Collaboration.SystemShare + * @since 4.1.0(11) + */ + x: number; + /** + * Coordinate y of the Position. + * + * @type {number} + * @syscap SystemCapability.Collaboration.SystemShare + * @since 4.1.0(11) + */ + y: number; + } + /** + * Defines the size property. + * + * @typedef Size + * @syscap SystemCapability.Collaboration.SystemShare + * @since 4.1.0(11) + */ + interface Size { + /** + * Defines the width property. + * + * @type {number} + * @syscap SystemCapability.Collaboration.SystemShare + * @since 4.1.0(11) + */ + width: number; + /** + * Defines the height property. + * + * @type {number} + * @syscap SystemCapability.Collaboration.SystemShare + * @since 4.1.0(11) + */ + height: number; + } + /** + * Defines share controller anchor. + * @typedef ShareControllerAnchor + * @syscap SystemCapability.Collaboration.SystemShare + * @since 4.1.0(11) + */ + interface ShareControllerAnchor { + /** + * Indicates the window offset of share controller + * can set Precise coordinates, or set the Coordinates of the upper left vertex of the component + * then set the size of the selected content area. + * + * @type { Offset } + * @syscap SystemCapability.Collaboration.SystemShare + * @since 4.1.0(11) + */ + windowOffset: Offset; + /** + * Indicates the size of the selected content area. + * + * @type { Size } + * @syscap SystemCapability.Collaboration.SystemShare + * @since 4.1.0(11) + */ + size?: Size; + } + /** + * Shared data preview mode definitions. + * + * @enum { number } + * @syscap SystemCapability.Collaboration.SystemShare + * @since 4.1.0(11) + */ + enum SharePreviewMode { + /** + * Indicates the default preview mode. + * + * @syscap SystemCapability.Collaboration.SystemShare + * @since 4.1.0(11) + */ + DEFAULT = 0, + /** + * Indicates the detail preview mode. + * + * @syscap SystemCapability.Collaboration.SystemShare + * @since 4.1.0(11) + */ + DETAIL + } + /** + * SystemShare ShareAbilityType definitions. + * + * @enum { number } + * @syscap SystemCapability.Collaboration.SystemShare + * @since 5.0.0(12) + */ + enum ShareAbilityType { + /** + * Indicates the Ability of copy data to pastbroad. + * + * @syscap SystemCapability.Collaboration.SystemShare + * @since 5.0.0(12) + */ + COPY_TO_PASTEBOARD = 0, + /** + * Indicates the Ability of save files as media assets. + * + * @syscap SystemCapability.Collaboration.SystemShare + * @since 5.0.0(12) + */ + SAVE_TO_MEDIA_ASSET = 1, + /** + * Indicates the Ability of save files as normal files. + * + * @syscap SystemCapability.Collaboration.SystemShare + * @since 5.0.0(12) + */ + SAVE_AS_FILE = 2, + /** + * Indicates the Ability of Print + * + * @syscap SystemCapability.Collaboration.SystemShare + * @since 5.0.0(12) + */ + PRINT = 3, + /** + * Indicates the Ability of SuperHub + * + * @syscap SystemCapability.Collaboration.SystemShare + * @since 5.0.0(12) + */ + SAVE_TO_SUPERHUB = 4 + } + /** + * Selection mode definitions. + * + * @enum { number } + * @syscap SystemCapability.Collaboration.SystemShare + * @since 4.1.0(11) + */ + enum SelectionMode { + /** + * Indicates the single selection mode. + * + * @syscap SystemCapability.Collaboration.SystemShare + * @since 4.1.0(11) + */ + SINGLE = 0, + /** + * Indicates the batch selection mode. + * + * @syscap SystemCapability.Collaboration.SystemShare + * @since 4.1.0(11) + */ + BATCH = 1 + } + /** + * Share controller options definitions. + * @typedef ShareControllerOptions + * @syscap SystemCapability.Collaboration.SystemShare + * @since 4.1.0(11) + */ + interface ShareControllerOptions { + /** + * Indicates the selection mode. + * + * @type { SelectionMode } + * @syscap SystemCapability.Collaboration.SystemShare + * @since 4.1.0(11) + */ + selectionMode?: SelectionMode; + /** + * Indicates the anchor of system share panel, set anchor or the ID of component. + * + * @type { ShareControllerAnchor | string } + * @syscap SystemCapability.Collaboration.SystemShare + * @since 4.1.0(11) + */ + anchor?: ShareControllerAnchor | string; + /** + * Indicates the preview mode. + * + * @type { SharePreviewMode } + * @syscap SystemCapability.Collaboration.SystemShare + * @since 4.1.0(11) + */ + previewMode?: SharePreviewMode; + /** + * Indicates configuration information about excluded Share Abilities. + * + * @type { Array } + * @syscap SystemCapability.Collaboration.SystemShare + * @since 5.0.0(12) + */ + excludedAbilities?: Array; + } + /** + * Share controller definitions, the controller can present system share panel. + * + * @syscap SystemCapability.Collaboration.SystemShare + * @since 4.1.0(11) + */ + class ShareController { + /** + * Create share controller with shared data + * + * @param { SharedData } data - host application's shared data + * @throws { BusinessError } 401 - Parameter error. + * @syscap SystemCapability.Collaboration.SystemShare + * @since 4.1.0(11) + */ + constructor(data: SharedData); + /** + * show system share panel + * @param { common.UIAbilityContext } context - the context of an ability. + * @param { ShareControllerOptions } options - fill the share controller configuration. + * @returns { Promise } the promise returned by the function. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 1003702001 - Record types are not support. + * (The batch and multiple selection modes support { @link UDMF.File } type records only.) + * @throws { BusinessError } 1003702002 - IPC data is oversized. + * @syscap SystemCapability.Collaboration.SystemShare + * @since 4.1.0(11) + */ + show(context: common.UIAbilityContext, options: ShareControllerOptions): Promise; + /** + * Register dismiss event callback. + * + * @param { 'dismiss' } event - canceled event. + * @param { void } callback - Called when system share panel dismissed. + * @syscap SystemCapability.Collaboration.SystemShare + * @since 4.1.0(11) + */ + on(event: 'dismiss', callback: () => void): void; + /** + * Cancel callback registered through { @link on }. + * + * @param { 'dismiss' } event - canceled event. + * @param { void } callback - Called when callback unregister. + * @syscap SystemCapability.Collaboration.SystemShare + * @since 4.1.0(11) + */ + off(event: 'dismiss', callback: () => void): void; + } + /** + * result Code of uiextension abilities. + * + * @enum { number } + * @syscap SystemCapability.Collaboration.SystemShare + * @since 5.0.0(12) + */ + enum ShareAbilityResultCode { + /** + * Indicates an error happened in abilities. + * + * @syscap SystemCapability.Collaboration.SystemShare + * @since 5.0.0(12) + */ + ERROR = -1, + /** + * Indicates user click back button. + * + * @syscap SystemCapability.Collaboration.SystemShare + * @since 5.0.0(12) + */ + BACK = 0, + /** + * Indicates user click close button. + * + * @syscap SystemCapability.Collaboration.SystemShare + * @since 5.0.0(12) + */ + CLOSE = 1 + } + /** + * Contact information definitions. + * @typedef ContactInfo + * @syscap SystemCapability.Collaboration.SystemShare + * @since 4.1.0(11) + */ + interface ContactInfo { + /** + * Indicates the contact type. + * + * @type { string } + * @syscap SystemCapability.Collaboration.SystemShare + * @since 4.1.0(11) + */ + contactType: string; + /** + * Indicates the contact ID. + * + * @type { string } + * @syscap SystemCapability.Collaboration.SystemShare + * @since 4.1.0(11) + */ + contactId: string; + } + /** + * Create shared data information from want. + * + * @param { want } want - the want transferred to the ability with sharing capability. + * @throws { BusinessError } 1003703001 - parse data failed. + * @syscap SystemCapability.Collaboration.SystemShare + * @since 4.1.0(11) + */ + function getSharedData(want: Want): Promise; + /** + * Create want from shared data information. + * + * @param { SharedData } data - the shared data information transferred to the ability with sharing capability. + * @param { ShareControllerOptions } options - fill the share controller configuration. + * @throws { BusinessError } 1003703001 - parse data failed. + * @syscap SystemCapability.Collaboration.SystemShare + * @since 5.0.0(12) + */ + function getWant(data: SharedData, options?: ShareControllerOptions): Promise; + /** + * Create contact information from want . + * + * @param { want } want - the want transferred to the ability with sharing capability. + * @throws { BusinessError } 1003703001 - parse data failed. + * @syscap SystemCapability.Collaboration.SystemShare + * @since 4.1.0(11) + */ + function getContactInfo(want: Want): Promise; +} +export default systemShare; diff --git a/language/arkts/extractor/sdk/hms/ets/api/@hms.core.AAID.d.ts b/language/arkts/extractor/sdk/hms/ets/api/@hms.core.AAID.d.ts new file mode 100755 index 00000000..ae10257f --- /dev/null +++ b/language/arkts/extractor/sdk/hms/ets/api/@hms.core.AAID.d.ts @@ -0,0 +1,66 @@ +/* + * Copyright (c) Huawei Technologies Co., Ltd. 2023. All rights reserved. + */ +/** + * @file Defines AAID capability. + * @kit PushKit + */ +import type { AsyncCallback } from '@ohos.base'; +/** + * AAID(Anonymous Application Identifier), identifies an app instance running on device. + * @namespace AAID + * @syscap SystemCapability.Push.PushService + * @StageModelOnly + * @since 4.0.0(10) + */ +declare namespace AAID { + /** + * Get AAID(Anonymous Application Identifier). + * @param { AsyncCallback } callback - Indicates the callback to get AAID(Anonymous Application Identifier). + * @throws { BusinessError } 401 - Invalid input parameter. + * @throws { BusinessError } 1000900001 - System internal error. + * @throws { BusinessError } 1000900006 - Connect AAID(Anonymous Application Identifier) service failed. + * @throws { BusinessError } 1000900007 - AAID(Anonymous Application Identifier) service internal error. + * @syscap SystemCapability.Push.PushService + * @StageModelOnly + * @since 4.0.0(10) + */ + export function getAAID(callback: AsyncCallback): void; + /** + * Get AAID(Anonymous Application Identifier). + * @returns { Promise } The result of get AAID(Anonymous Application Identifier). + * @throws { BusinessError } 401 - Invalid input parameter. + * @throws { BusinessError } 1000900001 - System internal error. + * @throws { BusinessError } 1000900006 - Connect AAID(Anonymous Application Identifier) service failed. + * @throws { BusinessError } 1000900007 - AAID(Anonymous Application Identifier) service internal error. + * @syscap SystemCapability.Push.PushService + * @StageModelOnly + * @since 4.0.0(10) + */ + export function getAAID(): Promise; + /** + * delete AAID(Anonymous Application Identifier). + * @param { AsyncCallback } callback - Indicates the callback to delete AAID(Anonymous Application Identifier). + * @throws { BusinessError } 401 - Invalid input parameter. + * @throws { BusinessError } 1000900001 - System internal error. + * @throws { BusinessError } 1000900006 - Connect AAID(Anonymous Application Identifier) service failed. + * @throws { BusinessError } 1000900007 - AAID(Anonymous Application Identifier) service internal error. + * @syscap SystemCapability.Push.PushService + * @StageModelOnly + * @since 4.0.0(10) + */ + export function deleteAAID(callback: AsyncCallback): void; + /** + * delete AAID(Anonymous Application Identifier). + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - Invalid input parameter. + * @throws { BusinessError } 1000900001 - System internal error. + * @throws { BusinessError } 1000900006 - Connect AAID(Anonymous Application Identifier) service failed. + * @throws { BusinessError } 1000900007 - AAID(Anonymous Application Identifier) service internal error. + * @syscap SystemCapability.Push.PushService + * @StageModelOnly + * @since 4.0.0(10) + */ + export function deleteAAID(): Promise; +} +export default AAID; diff --git a/language/arkts/extractor/sdk/hms/ets/api/@hms.core.account.LoginComponent.d.ets b/language/arkts/extractor/sdk/hms/ets/api/@hms.core.account.LoginComponent.d.ets new file mode 100755 index 00000000..2dbbecc3 --- /dev/null +++ b/language/arkts/extractor/sdk/hms/ets/api/@hms.core.account.LoginComponent.d.ets @@ -0,0 +1,887 @@ +/* + * Copyright (c) Huawei Technologies Co., Ltd. 2023-2023. All rights reserved. + */ +/** + * @file Defines UI components used to login with a HUAWEI ID. + * @kit AccountKit + */ +import { DrawableDescriptor } from '@ohos.arkui.drawableDescriptor'; +import { AsyncCallback } from '@ohos.base'; +/** + * Defines a UI component used to show the login panel. + * @syscap SystemCapability.AuthenticationServices.HuaweiID.UIComponent + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ +@Component +declare struct LoginPanel { + /** + * Controls whether to display the login panel. + * @syscap SystemCapability.AuthenticationServices.HuaweiID.UIComponent + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + @Link + show: boolean; + /** + * Defines the data displayed on the login panel. + * @syscap SystemCapability.AuthenticationServices.HuaweiID.UIComponent + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + params: loginComponentManager.LoginPanelParams; + /** + * Defines the controller to interact with the login panel. + * @syscap SystemCapability.AuthenticationServices.HuaweiID.UIComponent + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + controller: loginComponentManager.LoginPanelController; + /** + * Constructor used to create a LoginPanel object. + * @syscap SystemCapability.AuthenticationServices.HuaweiID.UIComponent + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + build(): void; +} +/** + * Defines a UI component used to show the button for login with a HUAWEI ID. + * @syscap SystemCapability.AuthenticationServices.HuaweiID.UIComponent + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ +@Component +declare struct LoginWithHuaweiIDButton { + /** + * Defines the presentation style of the button for login with a HUAWEI ID. + * @syscap SystemCapability.AuthenticationServices.HuaweiID.UIComponent + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + params: loginComponentManager.LoginWithHuaweiIDButtonParams; + /** + * Defines the controller to interact with the button for login with a HUAWEI ID. + * @syscap SystemCapability.AuthenticationServices.HuaweiID.UIComponent + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + controller: loginComponentManager.LoginWithHuaweiIDButtonController; + /** + * Constructor used to create a LoginWithHuaweiIDButton object. + * @syscap SystemCapability.AuthenticationServices.HuaweiID.UIComponent + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + build(): void; +} +/** + * Defines the business logic of the login component. + * @namespace loginComponentManager + * @syscap SystemCapability.AuthenticationServices.HuaweiID.UIComponent + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ +declare namespace loginComponentManager { + /** + * Enumerates the HUAWEI ID login types. + * @enum { number } + * @syscap SystemCapability.AuthenticationServices.HuaweiID.UIComponent + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + export enum LoginType { + /** + * HUAWEI ID associated with OpenID and UnionID. + * @syscap SystemCapability.AuthenticationServices.HuaweiID.UIComponent + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + ID = 0, + /** + * HUAWEI ID associated with PhoneNumber. + * The app needs to obtain the mobile phone number associated with the HUAWEI ID through an authorization code. + * @syscap SystemCapability.AuthenticationServices.HuaweiID.UIComponent + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + PHONE_NUMBER = 1, + /** + * HUAWEI ID associated with the real-time PhoneNumber. + * The authorization page will be displayed to authorize the real-time mobile phone number every time. + * The app needs to obtain the mobile phone number associated with the HUAWEI ID through an authorization code. + * @syscap SystemCapability.AuthenticationServices.HuaweiID.UIComponent + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + REAL_TIME_PHONE_NUMBER = 2, + /** + * Use the mobile number associated with the HUAWEI ID to easily sign in. + * The app needs to obtain the mobile phone number associated with the HUAWEI ID through an authorization code. + * @syscap SystemCapability.AuthenticationServices.HuaweiID.UIComponent + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + QUICK_LOGIN = 3 + } + /** + * Defines the app information to be displayed on the login panel. + * @typedef AppInfo + * @syscap SystemCapability.AuthenticationServices.HuaweiID.UIComponent + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + export interface AppInfo { + /** + * Icon of the app. + * @type { PixelMap | ResourceStr | DrawableDescriptor } + * @syscap SystemCapability.AuthenticationServices.HuaweiID.UIComponent + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + appIcon: PixelMap | ResourceStr | DrawableDescriptor; + /** + * Name of the app. The maximum length is 19 characters. + * @type { ResourceStr } appName + * @syscap SystemCapability.AuthenticationServices.HuaweiID.UIComponent + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + appName: ResourceStr; + /** + * Description of the app. The maximum length is 44 characters. + * @type { ResourceStr } + * @syscap SystemCapability.AuthenticationServices.HuaweiID.UIComponent + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + /** + * Description of the app. The maximum length is 44 characters. + * @type { ?ResourceStr } + * @syscap SystemCapability.AuthenticationServices.HuaweiID.UIComponent + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + appDescription?: ResourceStr; + } + /** + * Enumerates the types of the privacy text displayed on the login panel. + * @enum { number } + * @syscap SystemCapability.AuthenticationServices.HuaweiID.UIComponent + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + export enum TextType { + /** + * Plain text that cannot be clicked by the user. + * @syscap SystemCapability.AuthenticationServices.HuaweiID.UIComponent + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + PLAIN_TEXT = 0, + /** + * Rich text that can be clicked by the user. + * @syscap SystemCapability.AuthenticationServices.HuaweiID.UIComponent + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + RICH_TEXT = 1 + } + /** + * Defines the privacy text to be displayed on the login panel. + * @typedef PrivacyText + * @syscap SystemCapability.AuthenticationServices.HuaweiID.UIComponent + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + export interface PrivacyText { + /** + * Privacy text type, which can be plain text or rich text. + * @type { TextType } + * @syscap SystemCapability.AuthenticationServices.HuaweiID.UIComponent + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + type: TextType; + /** + * Privacy content to be displayed on the login panel. + * @type { ResourceStr } + * @syscap SystemCapability.AuthenticationServices.HuaweiID.UIComponent + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + text: ResourceStr; + /** + * Tag identifying the privacy text that the user clicked. + * The tag must be set when TextType is rich text. + * @type { ?string } + * @syscap SystemCapability.AuthenticationServices.HuaweiID.UIComponent + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + tag?: string; + } + /** + * Defines attributes of the button for other login modes. + * @typedef LoginPanelParams + * @syscap SystemCapability.AuthenticationServices.HuaweiID.UIComponent + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + export interface OptionalLoginButtonAttr { + /** + * Text displayed on the button. + * @type { ResourceStr } + * @syscap SystemCapability.AuthenticationServices.HuaweiID.UIComponent + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + text: ResourceStr; + } + /** + * Define the attributes of the area where other sign-in options are provided. + * @typedef LoginIcon + * @syscap SystemCapability.AuthenticationServices.HuaweiID.UIComponent + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + export interface LoginIcon { + /** + * Icon of the sign-in option. + * @type { PixelMap | ResourceStr | DrawableDescriptor } + * @syscap SystemCapability.AuthenticationServices.HuaweiID.UIComponent + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + icon: PixelMap | ResourceStr | DrawableDescriptor; + /** + * Tag identifying the icon that the user clicked. + * @type { ?string } + * @syscap SystemCapability.AuthenticationServices.HuaweiID.UIComponent + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + tag?: string; + } + /** + * Define the attributes of the area where other sign-in options are provided. + * @typedef OptionalLoginAreaAttr + * @syscap SystemCapability.AuthenticationServices.HuaweiID.UIComponent + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + export interface OptionalLoginAreaAttr { + /** + * Sign-in icon list. + * @type { LoginIcon[] } + * @syscap SystemCapability.AuthenticationServices.HuaweiID.UIComponent + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + iconArray: LoginIcon[]; + } + /** + * Defines the information displayed on the login panel. + * @typedef LoginPanelParams + * @syscap SystemCapability.AuthenticationServices.HuaweiID.UIComponent + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + export interface LoginPanelParams { + /** + * App information. + * @type { AppInfo } + * @syscap SystemCapability.AuthenticationServices.HuaweiID.UIComponent + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + appInfo: AppInfo; + /** + * Privacy text. + * @type { ?PrivacyText[] } + * @syscap SystemCapability.AuthenticationServices.HuaweiID.UIComponent + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + privacyText?: PrivacyText[]; + /** + * Button for other login modes. + * @type { ?OptionalLoginButtonAttr } + * @syscap SystemCapability.AuthenticationServices.HuaweiID.UIComponent + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + optionalLoginButtonAttr?: OptionalLoginButtonAttr; + /** + * HUAWEI ID login type. + * @type { ?LoginType } + * @default ID + * @syscap SystemCapability.AuthenticationServices.HuaweiID.UIComponent + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + loginType?: LoginType; + /** + * AnonymousPhoneNumber associated with the HUAWEI ID. + * @type { ?string } + * @syscap SystemCapability.AuthenticationServices.HuaweiID.UIComponent + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + anonymousPhoneNumber?: string; + /** + * Display the icon list for other sign-in options. + * @type { ?OptionalLoginAreaAttr } + * @syscap SystemCapability.AuthenticationServices.HuaweiID.UIComponent + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + optionalLoginAreaAttr?: OptionalLoginAreaAttr; + } + /** + * Defines the response returned for a successful login with the HUAWEI ID. + * @typedef HuaweiIDCredential + * @syscap SystemCapability.AuthenticationServices.HuaweiID.UIComponent + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + export interface HuaweiIDCredential { + /** + * UnionID associated with the HUAWEI ID. It is a unique user ID that remains the same + * across the apps used by the user. + * @type { string } + * @syscap SystemCapability.AuthenticationServices.HuaweiID.UIComponent + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + readonly unionID: string; + /** + * OpenID associated with the HUAWEI ID. It is a unique user ID that varies with the apps used by the user. + * @type { string } + * @syscap SystemCapability.AuthenticationServices.HuaweiID.UIComponent + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + readonly openID: string; + /** + * Token used by the app to interact with the server. + * @type { string } + * @syscap SystemCapability.AuthenticationServices.HuaweiID.UIComponent + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + readonly authorizationCode: string; + /** + * JSON Web Token (JWT) that ensures secure transfer of the user information to the app. + * @type { ?string } + * @syscap SystemCapability.AuthenticationServices.HuaweiID.UIComponent + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + readonly idToken?: string; + } + /** + * Defines the controller to interact with the login panel. + * @syscap SystemCapability.AuthenticationServices.HuaweiID.UIComponent + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + export class LoginPanelController { + /** + * Registers a callback to return the HUAWEI ID login response. + * @param { AsyncCallback } callback - Callback invoked to return the HUAWEI ID login response. + * AsyncCallback param err { BusinessError } Error code returned when the login fails. + * { BusinessError } 401 - Parameter error. + * { BusinessError } 1001500001 - Failed to check the fingerprint of the app bundle. + * { BusinessError } 1001500002 - This error code is reported when a request is already being processed. + * { BusinessError } 1001502001 - The user has not logged in with HUAWEI ID. + * { BusinessError } 1001502002 - The application is not authorized. + * { BusinessError } 1001502003 - Invalid input parameter value. + * { BusinessError } 1001502005 - Network error. + * { BusinessError } 1001502009 - Internal error. + * { BusinessError } 1001502012 - The user canceled the authorization. + * { BusinessError } 1001502014 - The app does not have the required scopes or permissions. + * { BusinessError } 12300001 - System service works abnormally. + * AsyncCallback param data { HuaweiIDCredential } Response returned when the login is successful. + * @returns { LoginPanelController } Returns the current controller instance. + * @syscap SystemCapability.AuthenticationServices.HuaweiID.UIComponent + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + /** + * Registers a callback to return the HUAWEI ID login response. + * @param { AsyncCallback } callback - Callback invoked to return the HUAWEI ID login response. + * AsyncCallback param err { BusinessError } Error code returned when the login fails. + * { BusinessError } 401 - Parameter error. + * { BusinessError } 1001500001 - Failed to check the fingerprint of the app bundle. + * { BusinessError } 1001500002 - This error code is reported when a request is already being processed. + * { BusinessError } 1001500003 - The scopes or permissions are not supported. + * { BusinessError } 1001502001 - The user has not logged in with HUAWEI ID. + * { BusinessError } 1001502002 - The application is not authorized. + * { BusinessError } 1001502003 - Invalid input parameter value. + * { BusinessError } 1001502005 - Network error. + * { BusinessError } 1001502009 - Internal error. + * { BusinessError } 1001502012 - The user canceled the authorization. + * { BusinessError } 1001502014 - The app does not have the required scopes or permissions. + * { BusinessError } 12300001 - System service works abnormally. + * { BusinessError } 1005300001 - The user did not accept the agreement. + * AsyncCallback param data { HuaweiIDCredential } Response returned when the login is successful. + * @returns { LoginPanelController } Returns the current controller instance. + * @syscap SystemCapability.AuthenticationServices.HuaweiID.UIComponent + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + onClickLoginWithHuaweiIDButton(callback: AsyncCallback): LoginPanelController; + /** + * Registers a callback to be invoked when the button for other login modes is clicked. + * @param { AsyncCallback } callback - Callback invoked when the button for other login modes is clicked. + * @returns { LoginPanelController } Returns the current controller instance. + * @syscap SystemCapability.AuthenticationServices.HuaweiID.UIComponent + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + onClickOptionalLoginButton(callback: AsyncCallback): LoginPanelController; + /** + * Registers a callback to be invoked when the privacy text is clicked. + * @param { AsyncCallback } callback - Callback invoked to return the tag of the privacy text clicked by the user. + * @returns { LoginPanelController } Returns the current controller instance. + * @syscap SystemCapability.AuthenticationServices.HuaweiID.UIComponent + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + onClickPrivacyText(callback: AsyncCallback): LoginPanelController; + /** + * Registers a callback to be invoked when the Close button is clicked. + * @param { AsyncCallback } callback - Callback invoked when the Close button is clicked. + * @returns { LoginPanelController } Returns the current controller instance. + * @syscap SystemCapability.AuthenticationServices.HuaweiID.UIComponent + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + onClickCloseButton(callback: AsyncCallback): LoginPanelController; + /** + * Register a callback to be triggered upon a click on one of the icons for other sign-in options. + * @param { AsyncCallback } callback - Callback triggered upon a click on one of the icons for other + * sign-in options. + * @returns { LoginPanelController } Return the current controller instance. + * @syscap SystemCapability.AuthenticationServices.HuaweiID.UIComponent + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + onClickOptionalLoginIcon(callback: AsyncCallback): LoginPanelController; + /** + * Registers a callback to be triggered when a user accepts the agreement + * or revokes their acceptance of the agreement. + * @param { AsyncCallback } callback - Callback to be triggered when a user accepts the agreement + * or revokes their acceptance of the agreement. + * @returns { LoginPanelController } Returns the current controller instance. + * @syscap SystemCapability.AuthenticationServices.HuaweiID.UIComponent + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + onChangeAgreementStatus(callback: AsyncCallback): LoginPanelController; + /** + * If you want to use a custom agreement page, you must first set the agreement status to NOT_ACCEPTED. + * When a user taps the HUAWEI ID login button, + * the error code indicating that the agreement is not accepted will be triggered. + * Once the user accepts the agreement, set the agreement status to ACCEPTED. + * @param { AgreementStatus } agreementStatus - The parameter indicates whether the user has accepted the agreement. + * @returns { LoginPanelController } Returns the current controller instance. + * @syscap SystemCapability.AuthenticationServices.HuaweiID.UIComponent + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + setAgreementStatus(agreementStatus: AgreementStatus): LoginPanelController; + /** + * Display the agreement page when a user clicks other sign-in options. + * @returns { LoginPanelController } Returns the current controller instance. + * @syscap SystemCapability.AuthenticationServices.HuaweiID.UIComponent + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + setShowAgreementForOptionalLogin(): LoginPanelController; + } + /** + * Status enum values for whether a user accepts the agreement. + * @enum { number } + * @syscap SystemCapability.AuthenticationServices.HuaweiID.UIComponent + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + export enum AgreementStatus { + /** + * The user did not accept the agreement. + * @syscap SystemCapability.AuthenticationServices.HuaweiID.UIComponent + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + NOT_ACCEPTED = 0, + /** + * The user has accepted the agreement. + * @syscap SystemCapability.AuthenticationServices.HuaweiID.UIComponent + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + ACCEPTED = 1 + } + /** + * Enumerates the styles of the HUAWEI ID login button. + * @enum { number } + * @syscap SystemCapability.AuthenticationServices.HuaweiID.UIComponent + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + export enum Style { + /** + * The button is red, and the border radius can be set. + * @syscap SystemCapability.AuthenticationServices.HuaweiID.UIComponent + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + BUTTON_RED = 0, + /** + * The button is white, and the border radius can be set. + * @syscap SystemCapability.AuthenticationServices.HuaweiID.UIComponent + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + BUTTON_WHITE = 1, + /** + * The button is white with a border, and the border radius can be set. + * @syscap SystemCapability.AuthenticationServices.HuaweiID.UIComponent + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + BUTTON_WHITE_OUTLINE = 2, + /** + * The button is black, and the border radius can be set. + * @syscap SystemCapability.AuthenticationServices.HuaweiID.UIComponent + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + BUTTON_BLACK = 3, + /** + * The button uses a red icon. + * @syscap SystemCapability.AuthenticationServices.HuaweiID.UIComponent + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + ICON_RED = 4, + /** + * The button uses a white icon. + * @syscap SystemCapability.AuthenticationServices.HuaweiID.UIComponent + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + ICON_WHITE = 5, + /** + * The button uses a white icon with a border. + * @syscap SystemCapability.AuthenticationServices.HuaweiID.UIComponent + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + ICON_WHITE_OUTLINE = 6, + /** + * The button uses a black icon. + * @syscap SystemCapability.AuthenticationServices.HuaweiID.UIComponent + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + ICON_BLACK = 7, + /** + * The button uses a red icon and gray background color. + * @syscap SystemCapability.AuthenticationServices.HuaweiID.UIComponent + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + ICON_GRAY = 8, + /** + * The button is gray and the border radius can be set. + * @syscap SystemCapability.AuthenticationServices.HuaweiID.UIComponent + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + BUTTON_GRAY = 9, + /** + * The button with text can be customized. + * @syscap SystemCapability.AuthenticationServices.HuaweiID.UIComponent + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + BUTTON_CUSTOM = 10 + } + /** + * Enumerates the color options available for BUTTON_CUSTOM. + * @enum { number } + * @syscap SystemCapability.AuthenticationServices.HuaweiID.UIComponent + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + export enum FontColor { + /** + * White. + * @syscap SystemCapability.AuthenticationServices.HuaweiID.UIComponent + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + WHITE = 0, + /** + * Black. + * @syscap SystemCapability.AuthenticationServices.HuaweiID.UIComponent + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + BLACK = 1 + } + /** + * Defines the params of BUTTON_CUSTOM. + * @typedef CustomButtonParams + * @syscap SystemCapability.AuthenticationServices.HuaweiID.UIComponent + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + export interface CustomButtonParams { + /** + * Font color. + * @type { ?FontColor } + * @default FontColor.WHITE + * @syscap SystemCapability.AuthenticationServices.HuaweiID.UIComponent + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + fontColor?: FontColor; + /** + * Background color. + * @type { ?ResourceColor } + * @default Red + * @syscap SystemCapability.AuthenticationServices.HuaweiID.UIComponent + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + backgroundColor?: ResourceColor; + } + /** + * Defines the attributes of the HUAWEI ID login button. + * @typedef LoginWithHuaweiIDButtonParams + * @syscap SystemCapability.AuthenticationServices.HuaweiID.UIComponent + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + export interface LoginWithHuaweiIDButtonParams { + /** + * Style of the button. + * @type { Style } + * @syscap SystemCapability.AuthenticationServices.HuaweiID.UIComponent + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + style: Style; + /** + * Border radius of the button. + * @type { ?number } + * @syscap SystemCapability.AuthenticationServices.HuaweiID.UIComponent + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + borderRadius?: number; + /** + * Radius of the icon on the button. + * @type { ?number } + * @default 24 + * @syscap SystemCapability.AuthenticationServices.HuaweiID.UIComponent + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + iconRadius?: number; + /** + * Whether to support the dark mode. If it is true, the button style changes with the system. + * @type { ?boolean } + * @default true + * @syscap SystemCapability.AuthenticationServices.HuaweiID.UIComponent + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + supportDarkMode?: boolean; + /** + * HUAWEI ID login type. + * @type { ?LoginType } + * @default ID + * @syscap SystemCapability.AuthenticationServices.HuaweiID.UIComponent + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + loginType?: LoginType; + /** + * The button can show a combination of text and icon. + * This parameter can be used only when Style is set to button-related settings (BUTTON_RED, BUTTON_WHITE, + * BUTTON_WHITE_OUTLINE, BUTTON_GRAY, or BUTTON_BLACK). + * @type { ?boolean } + * @syscap SystemCapability.AuthenticationServices.HuaweiID.UIComponent + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + textAndIconStyle?: boolean; + /** + * The params of BUTTON_CUSTOM. + * @type { ?CustomButtonParams } + * @syscap SystemCapability.AuthenticationServices.HuaweiID.UIComponent + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + customButtonParams?: CustomButtonParams; + } + /** + * Defines the controller to interact with the button for login with a HUAWEI ID. + * @syscap SystemCapability.AuthenticationServices.HuaweiID.UIComponent + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + export class LoginWithHuaweiIDButtonController { + /** + * Registers a callback to return the HUAWEI ID login response. + * @param { AsyncCallback } callback - Callback invoked to return the HUAWEI ID login response. + * AsyncCallback param err { BusinessError } Error code returned when the login fails. + * { BusinessError } 401 - Parameter error. + * { BusinessError } 1001500001 - Failed to check the fingerprint of the app bundle. + * { BusinessError } 1001500002 - This error code is reported when a request is already being processed. + * { BusinessError } 1001502001 - The user has not logged in with HUAWEI ID. + * { BusinessError } 1001502002 - The application is not authorized. + * { BusinessError } 1001502003 - Invalid input parameter value. + * { BusinessError } 1001502005 - Network error. + * { BusinessError } 1001502009 - Internal error. + * { BusinessError } 1001502012 - The user canceled the authorization. + * { BusinessError } 1001502014 - The app does not have the required scopes or permissions. + * { BusinessError } 12300001 - System service works abnormally. + * AsyncCallback param data { HuaweiIDCredential } Response returned when the login is successful. + * @returns { LoginWithHuaweiIDButtonController } Returns the current controller instance. + * @syscap SystemCapability.AuthenticationServices.HuaweiID.UIComponent + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + /** + * Registers a callback to return the HUAWEI ID login response. + * @param { AsyncCallback } callback - Callback invoked to return the HUAWEI ID login response. + * AsyncCallback param err { BusinessError } Error code returned when the login fails. + * { BusinessError } 401 - Parameter error. + * { BusinessError } 1001500001 - Failed to check the fingerprint of the app bundle. + * { BusinessError } 1001500002 - This error code is reported when a request is already being processed. + * { BusinessError } 1001500003 - The scopes or permissions are not supported. + * { BusinessError } 1001502001 - The user has not logged in with HUAWEI ID. + * { BusinessError } 1001502002 - The application is not authorized. + * { BusinessError } 1001502003 - Invalid input parameter value. + * { BusinessError } 1001502005 - Network error. + * { BusinessError } 1001502009 - Internal error. + * { BusinessError } 1001502012 - The user canceled the authorization. + * { BusinessError } 1001502014 - The app does not have the required scopes or permissions. + * { BusinessError } 12300001 - System service works abnormally. + * { BusinessError } 1005300001 - The user did not accept the agreement. + * AsyncCallback param data { HuaweiIDCredential } Response returned when the login is successful. + * @returns { LoginWithHuaweiIDButtonController } Returns the current controller instance. + * @syscap SystemCapability.AuthenticationServices.HuaweiID.UIComponent + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + onClickLoginWithHuaweiIDButton(callback: AsyncCallback): LoginWithHuaweiIDButtonController; + /** + * If a user is required to accept the agreement before logging in with HUAWEI ID, + * set the agreement status to NOT_ACCEPTED first. + * After the user accepts the agreement, set the status to ACCEPTED. + * @param { AgreementStatus } agreementStatus - The parameter indicates whether the user has accepted the agreement. + * @returns { LoginWithHuaweiIDButtonController } Returns the current controller instance. + * @syscap SystemCapability.AuthenticationServices.HuaweiID.UIComponent + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + setAgreementStatus(agreementStatus: AgreementStatus): LoginWithHuaweiIDButtonController; + } +} +export { LoginPanel, LoginWithHuaweiIDButton, loginComponentManager }; diff --git a/language/arkts/extractor/sdk/hms/ets/api/@hms.core.account.extendservice.d.ts b/language/arkts/extractor/sdk/hms/ets/api/@hms.core.account.extendservice.d.ts new file mode 100755 index 00000000..d08695a2 --- /dev/null +++ b/language/arkts/extractor/sdk/hms/ets/api/@hms.core.account.extendservice.d.ts @@ -0,0 +1,526 @@ +/* +* Copyright (c) 2023 Huawei Device Co., Ltd. All rights reserved. + */ +/** + * @file Defines the extended services of HUAWEI ID. + * @kit AccountKit + */ +import type { AsyncCallback } from '@ohos.base'; +import type common from '@ohos.app.ability.common'; +/** + * Definition of extendService module. + * @namespace extendService + * @syscap SystemCapability.AuthenticationServices.HuaweiID.ExtendService + * @stagemodelonly + * @since 4.0.0(10) + */ +/** + * Definition of extendService module. + * @namespace extendService + * @syscap SystemCapability.AuthenticationServices.HuaweiID.ExtendService + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ +declare namespace extendService { + /** + * Enumerates the error codes of the extendService. + * @enum { number } + * @syscap SystemCapability.AuthenticationServices.HuaweiID.ExtendService + * @stagemodelonly + * @since 4.0.0(10) + */ + /** + * Enumerates the error codes of the extendService. + * @enum { number } + * @syscap SystemCapability.AuthenticationServices.HuaweiID.ExtendService + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + enum ExtendErrorCode { + /** + * Parameter error. + * @syscap SystemCapability.AuthenticationServices.HuaweiID.ExtendService + * @stagemodelonly + * @since 4.0.0(10) + */ + /** + * Parameter error. + * @syscap SystemCapability.AuthenticationServices.HuaweiID.ExtendService + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + INVALID_PARAMETER = 401, + /** + * The network is unavailable. + * @syscap SystemCapability.AuthenticationServices.HuaweiID.ExtendService + * @stagemodelonly + * @since 4.0.0(10) + */ + /** + * The network is unavailable. + * @syscap SystemCapability.AuthenticationServices.HuaweiID.ExtendService + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + NETWORK_ERROR = 1001600001, + /** + * The user has not logged in with HUAWEI ID. + * @syscap SystemCapability.AuthenticationServices.HuaweiID.ExtendService + * @stagemodelonly + * @since 4.0.0(10) + */ + /** + * The user has not logged in with HUAWEI ID. + * @syscap SystemCapability.AuthenticationServices.HuaweiID.ExtendService + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + ACCOUNT_NOT_LOGGED_IN = 1001600002, + /** + * Failed to check the fingerprint of the application bundle. + * @syscap SystemCapability.AuthenticationServices.HuaweiID.ExtendService + * @stagemodelonly + * @since 4.0.0(10) + */ + /** + * Failed to check the fingerprint of the application bundle. + * @syscap SystemCapability.AuthenticationServices.HuaweiID.ExtendService + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + PACKAGE_FINGERPRINT_CHECK_ERROR = 1001600003, + /** + * The application does not have the required permissions. + * @syscap SystemCapability.AuthenticationServices.HuaweiID.ExtendService + * @stagemodelonly + * @since 4.0.0(10) + */ + /** + * The application does not have the required permissions. + * @syscap SystemCapability.AuthenticationServices.HuaweiID.ExtendService + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + PERMISSION_CHECK_ERROR = 1001600004, + /** + * The user canceled the current operation. + * @syscap SystemCapability.AuthenticationServices.HuaweiID.ExtendService + * @stagemodelonly + * @since 4.0.0(10) + */ + /** + * The user canceled the current operation. + * @syscap SystemCapability.AuthenticationServices.HuaweiID.ExtendService + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + USER_CANCELED = 1001600005, + /** + * The requested verification factors are unavailable on the device. + * @syscap SystemCapability.AuthenticationServices.HuaweiID.ExtendService + * @stagemodelonly + * @since 4.0.0(10) + */ + /** + * The requested verification factors are unavailable on the device. + * @syscap SystemCapability.AuthenticationServices.HuaweiID.ExtendService + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + VERIFICATION_FACTOR_UNAVAILABLE = 1001600006, + /** + * Internal error. + * @syscap SystemCapability.AuthenticationServices.HuaweiID.ExtendService + * @stagemodelonly + * @since 4.0.0(10) + */ + /** + * Internal error. + * @syscap SystemCapability.AuthenticationServices.HuaweiID.ExtendService + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + INTERNAL_ERROR = 1001600007 + } + /** + * Enumerates the ID types. + * @enum { number } + * @syscap SystemCapability.AuthenticationServices.HuaweiID.ExtendService + * @stagemodelonly + * @since 4.0.0(10) + */ + /** + * Enumerates the ID types. + * @enum { number } + * @syscap SystemCapability.AuthenticationServices.HuaweiID.ExtendService + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + enum IdType { + /** + * UID. + * @syscap SystemCapability.AuthenticationServices.HuaweiID.ExtendService + * @stagemodelonly + * @since 4.0.0(10) + */ + /** + * UID. + * @syscap SystemCapability.AuthenticationServices.HuaweiID.ExtendService + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + USER_ID = 1, + /** + * OpenID. + * @syscap SystemCapability.AuthenticationServices.HuaweiID.ExtendService + * @stagemodelonly + * @since 4.0.0(10) + */ + /** + * OpenID. + * @syscap SystemCapability.AuthenticationServices.HuaweiID.ExtendService + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + OPEN_ID = 2, + /** + * UnionID. + * @syscap SystemCapability.AuthenticationServices.HuaweiID.ExtendService + * @stagemodelonly + * @since 4.0.0(10) + */ + /** + * UnionID. + * @syscap SystemCapability.AuthenticationServices.HuaweiID.ExtendService + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + UNION_ID = 3 + } + /** + * Enumerates the risk levels. + * @enum { number } + * @syscap SystemCapability.AuthenticationServices.HuaweiID.ExtendService + * @stagemodelonly + * @since 4.0.0(10) + */ + /** + * Enumerates the risk levels. + * @enum { number } + * @syscap SystemCapability.AuthenticationServices.HuaweiID.ExtendService + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + enum RiskLevel { + /** + * Low risk level. + * @syscap SystemCapability.AuthenticationServices.HuaweiID.ExtendService + * @stagemodelonly + * @since 4.0.0(10) + */ + /** + * Low risk level. + * @syscap SystemCapability.AuthenticationServices.HuaweiID.ExtendService + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + LOW = 1, + /** + * High risk level. + * @syscap SystemCapability.AuthenticationServices.HuaweiID.ExtendService + * @stagemodelonly + * @since 4.0.0(10) + */ + /** + * High risk level. + * @syscap SystemCapability.AuthenticationServices.HuaweiID.ExtendService + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + HIGH = 2 + } + /** + * Defines the request used for verifying a user who has logged in. + * @typedef VerifyRequest + * @syscap SystemCapability.AuthenticationServices.HuaweiID.ExtendService + * @stagemodelonly + * @since 4.0.0(10) + */ + /** + * Defines the request used for verifying a user who has logged in. + * @typedef VerifyRequest + * @syscap SystemCapability.AuthenticationServices.HuaweiID.ExtendService + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + interface VerifyRequest { + /** + * Type of the ID. + * @type { IdType } + * @syscap SystemCapability.AuthenticationServices.HuaweiID.ExtendService + * @stagemodelonly + * @since 4.0.0(10) + */ + /** + * Type of the ID. + * @type { IdType } + * @syscap SystemCapability.AuthenticationServices.HuaweiID.ExtendService + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + idType: IdType; + /** + * ID of the user. + * @type { string } + * @syscap SystemCapability.AuthenticationServices.HuaweiID.ExtendService + * @stagemodelonly + * @since 4.0.0(10) + */ + /** + * ID of the user. + * @type { string } + * @syscap SystemCapability.AuthenticationServices.HuaweiID.ExtendService + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + idValue: string; + /** + * Scenario that triggers the identity verification. + * @type { string } + * @syscap SystemCapability.AuthenticationServices.HuaweiID.ExtendService + * @stagemodelonly + * @since 4.0.0(10) + */ + /** + * Scenario that triggers the identity verification. + * @type { string } + * @syscap SystemCapability.AuthenticationServices.HuaweiID.ExtendService + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + sceneId: string; + /** + * Risk level of the scenario. + * @type { RiskLevel } + * @syscap SystemCapability.AuthenticationServices.HuaweiID.ExtendService + * @stagemodelonly + * @since 4.0.0(10) + */ + /** + * Risk level of the scenario. + * @type { RiskLevel } + * @syscap SystemCapability.AuthenticationServices.HuaweiID.ExtendService + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + riskLevel: RiskLevel; + /** + * Nonce to be passed to the identity provider for preventing anti-replay attacks. It will be + * included in verifyToken. + * @type { string } + * @syscap SystemCapability.AuthenticationServices.HuaweiID.ExtendService + * @stagemodelonly + * @since 4.0.0(10) + */ + /** + * Nonce to be passed to the identity provider for preventing anti-replay attacks. It will be + * included in verifyToken. + * @type { string } + * @syscap SystemCapability.AuthenticationServices.HuaweiID.ExtendService + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + nonce: string; + } + /** + * Defines the result returned by verifyAccount(). + * @typedef VerifyResult + * @syscap SystemCapability.AuthenticationServices.HuaweiID.ExtendService + * @stagemodelonly + * @since 4.0.0(10) + */ + /** + * Defines the result returned by verifyAccount(). + * @typedef VerifyResult + * @syscap SystemCapability.AuthenticationServices.HuaweiID.ExtendService + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + interface VerifyResult { + /** + * A JSON Web Token (JWT) returned by the verification. + * @type { string } + * @syscap SystemCapability.AuthenticationServices.HuaweiID.ExtendService + * @stagemodelonly + * @since 4.0.0(10) + */ + /** + * A JSON Web Token (JWT) returned by the verification. + * @type { string } + * @syscap SystemCapability.AuthenticationServices.HuaweiID.ExtendService + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + readonly verifyToken: string; + } + /** + * Verifies the identity of a HUAWEI ID. This function uses an asynchronous callback to return the result. + * Note: This function must be called in the ArkUI page context. + * @param { common.UIAbilityContext } context - The context of an ability. + * @param { VerifyRequest } request - Indicates the verification request parameters. + * @param { AsyncCallback } callback - Indicates the callback used to return the result. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 1001600001 - The network is unavailable. + * @throws { BusinessError } 1001600002 - The user has not logged in with HUAWEI ID. + * @throws { BusinessError } 1001600003 - Failed to check the fingerprint of the application bundle. + * @throws { BusinessError } 1001600004 - The application does not have the required permissions. + * @throws { BusinessError } 1001600005 - The user canceled the current operation. + * @throws { BusinessError } 1001600006 - The requested verification factors are unavailable on the device. + * @throws { BusinessError } 1001600007 - Internal error. + * @syscap SystemCapability.AuthenticationServices.HuaweiID.ExtendService + * @stagemodelonly + * @since 4.0.0(10) + */ + /** + * Verifies the identity of a HUAWEI ID. This function uses an asynchronous callback to return the result. + * Note: This function must be called in the ArkUI page context. + * @param { common.Context } context - The context of an ability. + * @param { VerifyRequest } request - Indicates the verification request parameters. + * @param { AsyncCallback } callback - Indicates the callback used to return the result. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 1001600001 - The network is unavailable. + * @throws { BusinessError } 1001600002 - The user has not logged in with HUAWEI ID. + * @throws { BusinessError } 1001600003 - Failed to check the fingerprint of the application bundle. + * @throws { BusinessError } 1001600004 - The application does not have the required permissions. + * @throws { BusinessError } 1001600005 - The user canceled the current operation. + * @throws { BusinessError } 1001600006 - The requested verification factors are unavailable on the device. + * @throws { BusinessError } 1001600007 - Internal error. + * @syscap SystemCapability.AuthenticationServices.HuaweiID.ExtendService + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + function verifyAccount(context: common.Context, request: VerifyRequest, callback: AsyncCallback): void; + /** + * Verifies the identity of a HUAWEI ID. This function uses a promise to return the result. + * Note: This function must be called in the ArkUI page context. + * @param { common.UIAbilityContext } context - The context of an ability. + * @param { VerifyRequest } request - Indicates the verification request parameters. + * @returns { Promise } Promise used to return the result. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 1001600001 - The network is unavailable. + * @throws { BusinessError } 1001600002 - The user has not logged in with HUAWEI ID. + * @throws { BusinessError } 1001600003 - Failed to check the fingerprint of the application bundle. + * @throws { BusinessError } 1001600004 - The application does not have the required permissions. + * @throws { BusinessError } 1001600005 - The user canceled the current operation. + * @throws { BusinessError } 1001600006 - The requested verification factors are unavailable on the device. + * @throws { BusinessError } 1001600007 - Internal error. + * @syscap SystemCapability.AuthenticationServices.HuaweiID.ExtendService + * @stagemodelonly + * @since 4.0.0(10) + */ + /** + * Verifies the identity of a HUAWEI ID. This function uses a promise to return the result. + * Note: This function must be called in the ArkUI page context. + * @param { common.Context } context - The context of an ability. + * @param { VerifyRequest } request - Indicates the verification request parameters. + * @returns { Promise } Promise used to return the result. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 1001600001 - The network is unavailable. + * @throws { BusinessError } 1001600002 - The user has not logged in with HUAWEI ID. + * @throws { BusinessError } 1001600003 - Failed to check the fingerprint of the application bundle. + * @throws { BusinessError } 1001600004 - The application does not have the required permissions. + * @throws { BusinessError } 1001600005 - The user canceled the current operation. + * @throws { BusinessError } 1001600006 - The requested verification factors are unavailable on the device. + * @throws { BusinessError } 1001600007 - Internal error. + * @syscap SystemCapability.AuthenticationServices.HuaweiID.ExtendService + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + function verifyAccount(context: common.Context, request: VerifyRequest): Promise; + /** + * Opens the account center page. This function uses an asynchronous callback to return the result. + * Note: This function must be called in the ArkUI page context. + * @param { common.UIAbilityContext } context - The context of an ability. + * @param { AsyncCallback } callback - Indicates the callback used to return the result. + * @throws { BusinessError } 1001600002 - The user has not logged in with HUAWEI ID. + * @throws { BusinessError } 1001600003 - Failed to check the fingerprint of the application bundle. + * @throws { BusinessError } 1001600004 - The application does not have the required permissions. + * @throws { BusinessError } 1001600007 - Internal error. + * @syscap SystemCapability.AuthenticationServices.HuaweiID.ExtendService + * @stagemodelonly + * @since 4.0.0(10) + */ + /** + * Opens the account center page. This function uses an asynchronous callback to return the result. + * Note: This function must be called in the ArkUI page context. + * @param { common.Context } context - The context of an ability. + * @param { AsyncCallback } callback - Indicates the callback used to return the result. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 1001600001 - The network is unavailable. + * @throws { BusinessError } 1001600002 - The user has not logged in with HUAWEI ID. + * @throws { BusinessError } 1001600003 - Failed to check the fingerprint of the application bundle. + * @throws { BusinessError } 1001600004 - The application does not have the required permissions. + * @throws { BusinessError } 1001600007 - Internal error. + * @syscap SystemCapability.AuthenticationServices.HuaweiID.ExtendService + * @stagemodelonly + * @since 4.1.0(11) + */ + function startAccountCenter(context: common.Context, callback: AsyncCallback): void; + /** + * Opens the account center page. This function uses a promise to return the result. + * Note: The function must be called in the ArkUI page context. + * @param { common.UIAbilityContext } context - The context of an ability. + * @returns { Promise } Promise used to return the result. + * @throws { BusinessError } 1001600002 - The user has not logged in with HUAWEI ID. + * @throws { BusinessError } 1001600003 - Failed to check the fingerprint of the application bundle. + * @throws { BusinessError } 1001600004 - The application does not have the required permissions. + * @throws { BusinessError } 1001600007 - Internal error. + * @syscap SystemCapability.AuthenticationServices.HuaweiID.ExtendService + * @stagemodelonly + * @since 4.0.0(10) + */ + /** + * Opens the account center page. This function uses a promise to return the result. + * Note: The function must be called in the ArkUI page context. + * @param { common.Context } context - The context of an ability. + * @returns { Promise } Promise used to return the result. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 1001600001 - The network is unavailable. + * @throws { BusinessError } 1001600002 - The user has not logged in with HUAWEI ID. + * @throws { BusinessError } 1001600003 - Failed to check the fingerprint of the application bundle. + * @throws { BusinessError } 1001600004 - The application does not have the required permissions. + * @throws { BusinessError } 1001600007 - Internal error. + * @syscap SystemCapability.AuthenticationServices.HuaweiID.ExtendService + * @stagemodelonly + * @since 4.1.0(11) + */ + function startAccountCenter(context: common.Context): Promise; +} +export default extendService; diff --git a/language/arkts/extractor/sdk/hms/ets/api/@hms.core.account.invoiceAssistant.d.ts b/language/arkts/extractor/sdk/hms/ets/api/@hms.core.account.invoiceAssistant.d.ts new file mode 100755 index 00000000..815599fa --- /dev/null +++ b/language/arkts/extractor/sdk/hms/ets/api/@hms.core.account.invoiceAssistant.d.ts @@ -0,0 +1,205 @@ +/* + * Copyright (c) Huawei Technologies Co., Ltd. 2024-2024. All rights reserved. + */ +/** + * @file Defines the capabilities of invoiceAssistant module. + * @kit AccountKit + */ + +import type common from '@ohos.app.ability.common'; +/** + * This module provides the capabilities to use invoiceAssistant. + * + * @namespace invoiceAssistant + * @syscap SystemCapability.HuaweiID.InvoiceAssistant + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ +declare namespace invoiceAssistant { + /** + * Show invoice title select page. + * + * @param { common.Context } context - The context of an ability. + * @returns { Promise } Returns InvoiceTitle. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 1010060001 - The operation was canceled by the user. + * @throws { BusinessError } 1010060002 - System internal error. + * @throws { BusinessError } 1010060003 - The application is not authorized. + * @throws { BusinessError } 1010060004 - Too frequent API calls. + * @throws { BusinessError } 1010060005 - Network connection error. + * @throws { BusinessError } 1010060006 - The HUAWEI ID is not signed in. + * @throws { BusinessError } 1010060007 - Failed to create a invoice title because the title already exists. + * @throws { BusinessError } 1010060008 - The invoice service does not support the logged HUAWEI ID. + * @syscap SystemCapability.HuaweiID.InvoiceAssistant + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + function selectInvoiceTitle(context: common.Context): Promise; + /** + * InvoiceTitle object. + * + * @typedef InvoiceTitle + * @syscap SystemCapability.HuaweiID.InvoiceAssistant + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + interface InvoiceTitle { + /** + * InvoiceTitle type. + * + * @type { string } + * @syscap SystemCapability.HuaweiID.InvoiceAssistant + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + type: string; + /** + * Invoice title. + * + * @type { string } + * @syscap SystemCapability.HuaweiID.InvoiceAssistant + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + title: string; + /** + * InvoiceTitle taxNumber. + * + * @type { string } + * @syscap SystemCapability.HuaweiID.InvoiceAssistant + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + taxNumber: string; + /** + * InvoiceTitle companyAddress. + * + * @type { string } + * @syscap SystemCapability.HuaweiID.InvoiceAssistant + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + companyAddress: string; + /** + * InvoiceTitle telephone. + * + * @type { string } + * @syscap SystemCapability.HuaweiID.InvoiceAssistant + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + telephone: string; + /** + * InvoiceTitle bankName. + * + * @type { string } + * @syscap SystemCapability.HuaweiID.InvoiceAssistant + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + bankName: string; + /** + * InvoiceTitle bankAccount. + * + * @type { string } + * @syscap SystemCapability.HuaweiID.InvoiceAssistant + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + bankAccount: string; + } + /** + * Indicates the invoiceAssistant error code. + * + * @enum { number } + * @syscap SystemCapability.HuaweiID.InvoiceAssistant + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + enum InvoiceAssistantErrorCode { + /** + * The operation was canceled by the user. + * + * @syscap SystemCapability.HuaweiID.InvoiceAssistant + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + USER_CANCELED = 1010060001, + /** + * System internal error. + * + * @syscap SystemCapability.HuaweiID.InvoiceAssistant + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + SYSTEM_ERROR = 1010060002, + /** + * The application is not authorized. + * + * @syscap SystemCapability.HuaweiID.InvoiceAssistant + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + APP_NOT_AUTHORIZED = 1010060003, + /** + * Too frequent API calls. + * + * @syscap SystemCapability.HuaweiID.InvoiceAssistant + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + FREQUENT_CALLS = 1010060004, + /** + * Network connection error. + * + * @syscap SystemCapability.HuaweiID.InvoiceAssistant + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + NETWORK_ERROR = 1010060005, + /** + * The HUAWEI ID is not signed in. + * + * @syscap SystemCapability.HuaweiID.InvoiceAssistant + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + ACCOUNT_NOT_LOGGED_IN = 1010060006, + /** + * Failed to create a invoice title because the title already exists. + * + * @syscap SystemCapability.HuaweiID.InvoiceAssistant + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + INVOICE_TITLE_EXISTS = 1010060007, + /** + * The invoice service does not support the logged HUAWEI ID. + * + * @syscap SystemCapability.HuaweiID.InvoiceAssistant + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + UNSUPPORTED = 1010060008 + } +} +export default invoiceAssistant; diff --git a/language/arkts/extractor/sdk/hms/ets/api/@hms.core.account.minorsProtection.d.ts b/language/arkts/extractor/sdk/hms/ets/api/@hms.core.account.minorsProtection.d.ts new file mode 100755 index 00000000..d0201978 --- /dev/null +++ b/language/arkts/extractor/sdk/hms/ets/api/@hms.core.account.minorsProtection.d.ts @@ -0,0 +1,187 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. All rights reserved. + */ +/** + * @file Define the feature of minors protection for HUAWEI ID. + * @kit AccountKit + */ +import type common from '@ohos.app.ability.common'; +/** + * minorsProtection module. + * @namespace minorsProtection + * @syscap SystemCapability.AuthenticationServices.HuaweiID.MinorsProtection + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ +declare namespace minorsProtection { + /** + * Gets the information about minors protection, such as minors protection mode and age group. + * @returns { MinorsProtectionInfo } minors protection information. + * @throws { BusinessError } 1001502009 - Internal error. + * @syscap SystemCapability.AuthenticationServices.HuaweiID.MinorsProtection + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + function getMinorsProtectionInfoSync(): MinorsProtectionInfo; + /** + * Gets the information about minors protection, such as minors protection mode and age group. + * @returns { Promise } promise of minors protection information. + * @throws { BusinessError } 1001502009 - Internal error. + * @syscap SystemCapability.AuthenticationServices.HuaweiID.MinorsProtection + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + function getMinorsProtectionInfo(): Promise; + /** + * Start the password-verification page to verify minors protection credential. + * @param { common.Context } context - The context of an ability. + * @returns { Promise } promise of verification result. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Missing context parameter. 2. Incorrect context parameter type. + * @throws { BusinessError } 1001502009 - Internal error. + * @throws { BusinessError } 1009900002 - The minors mode is not enabled. + * @syscap SystemCapability.AuthenticationServices.HuaweiID.MinorsProtection + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + function verifyMinorsProtectionCredential(context: common.Context): Promise; + /** + * Lead user to start the page to turn on minors mode. + * @param { common.Context } context - The context of an ability. + * @returns { Promise } promise of void. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Missing context parameter. 2. Incorrect context parameter type. + * @throws { BusinessError } 1001502009 - Internal error. + * @throws { BusinessError } 1009900003 - The user canceled the operation. + * @throws { BusinessError } 1009900005 - The minors mode is already on. + * @throws { BusinessError } 1009900007 - Unsupported account. + * @syscap SystemCapability.AuthenticationServices.HuaweiID.MinorsProtection + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + function leadToTurnOnMinorsMode(context: common.Context): Promise; + /** + * Lead user to start the page to turn off minors mode. + * @param { common.Context } context - The context of an ability. + * @returns { Promise } promise of void. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Missing context parameter. 2. Incorrect context parameter type. + * @throws { BusinessError } 1001502009 - Internal error. + * @throws { BusinessError } 1009900003 - The user canceled the operation. + * @throws { BusinessError } 1009900006 - The minors mode is already off. + * @syscap SystemCapability.AuthenticationServices.HuaweiID.MinorsProtection + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + function leadToTurnOffMinorsMode(context: common.Context): Promise; + /** + * Defines the information about minors protection. + * @typedef MinorsProtectionInfo + * @syscap SystemCapability.AuthenticationServices.HuaweiID.MinorsProtection + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + interface MinorsProtectionInfo { + /** + * Minors protection mode. + * @type { boolean } + * @syscap SystemCapability.AuthenticationServices.HuaweiID.MinorsProtection + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + minorsProtectionMode: boolean; + /** + * Age group type. + * @type { AgeGroup } + * @syscap SystemCapability.AuthenticationServices.HuaweiID.MinorsProtection + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + ageGroup?: AgeGroup; + } + /** + * Defines the information about age group. + * @typedef AgeGroup + * @syscap SystemCapability.AuthenticationServices.HuaweiID.MinorsProtection + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + interface AgeGroup { + /** + * The lower limit of age group. + * @type { number } + * @syscap SystemCapability.AuthenticationServices.HuaweiID.MinorsProtection + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + lowerAge: number; + /** + * The upper limit of age group. + * @type { number } + * @syscap SystemCapability.AuthenticationServices.HuaweiID.MinorsProtection + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + upperAge: number; + } + /** + * Enumerates the error codes of the extendService. + * @enum { number } + * @syscap SystemCapability.AuthenticationServices.HuaweiID.MinorsProtection + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + enum MinorsModeErrorCode { + /** + * The minors mode is not enabled. + * @syscap SystemCapability.AuthenticationServices.HuaweiID.MinorsProtection + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + MINORS_MODE_NOT_ENABLED = 1009900002, + /** + * The user canceled the operation. + * @syscap SystemCapability.AuthenticationServices.HuaweiID.MinorsProtection + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + USER_CANCELED = 1009900003, + /** + * The minors mode is already on. + * @syscap SystemCapability.AuthenticationServices.HuaweiID.MinorsProtection + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + MINORS_MODE_ALREADY_ON = 1009900005, + /** + * The minors mode is already off. + * @syscap SystemCapability.AuthenticationServices.HuaweiID.MinorsProtection + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + MINORS_MODE_ALREADY_OFF = 1009900006, + /** + * Unsupported account. + * @syscap SystemCapability.AuthenticationServices.HuaweiID.MinorsProtection + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + UNSUPPORTED_ACCOUNT = 1009900007 + } +} +export default minorsProtection; diff --git a/language/arkts/extractor/sdk/hms/ets/api/@hms.core.account.realname.d.ts b/language/arkts/extractor/sdk/hms/ets/api/@hms.core.account.realname.d.ts new file mode 100755 index 00000000..09e20256 --- /dev/null +++ b/language/arkts/extractor/sdk/hms/ets/api/@hms.core.account.realname.d.ts @@ -0,0 +1,287 @@ +/* +* Copyright (c) 2023 Huawei Device Co., Ltd. All rights reserved. + */ +/** + * @file Defines the feature of real-name verification for HUAWEI ID. + * @kit AccountKit + */ + +import type common from '@ohos.app.ability.common'; +/** + * RealName module. + * @namespace realName + * @syscap SystemCapability.AuthenticationServices.HuaweiID.RealNameVerify + * @systemapi + * @stagemodelonly + * @since 4.0.0(10) + */ +/** + * RealName module. + * @namespace realName + * @syscap SystemCapability.AuthenticationServices.HuaweiID.RealNameVerify + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ +declare namespace realName { + /** + * Enumerates the error codes of the realName. + * @enum { number } + * @syscap SystemCapability.AuthenticationServices.HuaweiID.RealNameVerify + * @systemapi + * @stagemodelonly + * @since 4.0.0(10) + */ + /** + * Enumerates the error codes of the realName. + * @enum { number } + * @syscap SystemCapability.AuthenticationServices.HuaweiID.RealNameVerify + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + enum RealNameErrorCode { + /** + * The network is unavailable. + * @syscap SystemCapability.AuthenticationServices.HuaweiID.RealNameVerify + * @systemapi + * @stagemodelonly + * @since 4.0.0(10) + */ + /** + * The network is unavailable. + * @syscap SystemCapability.AuthenticationServices.HuaweiID.RealNameVerify + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + NETWORK_ERROR = 1002500001, + /** + * The user has not logged in with HUAWEI ID. + * @syscap SystemCapability.AuthenticationServices.HuaweiID.RealNameVerify + * @systemapi + * @stagemodelonly + * @since 4.0.0(10) + */ + /** + * The user has not logged in with HUAWEI ID. + * @syscap SystemCapability.AuthenticationServices.HuaweiID.RealNameVerify + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + ACCOUNT_NOT_LOGGED_IN = 1002500002, + /** + * Failed to check the fingerprint of the application bundle. + * @syscap SystemCapability.AuthenticationServices.HuaweiID.RealNameVerify + * @systemapi + * @stagemodelonly + * @since 4.0.0(10) + */ + /** + * Failed to check the fingerprint of the application bundle. + * @syscap SystemCapability.AuthenticationServices.HuaweiID.RealNameVerify + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + PACKAGE_FINGERPRINT_CHECK_ERROR = 1002500003, + /** + * The application does not have the required permissions. + * @syscap SystemCapability.AuthenticationServices.HuaweiID.RealNameVerify + * @systemapi + * @stagemodelonly + * @since 4.0.0(10) + */ + /** + * The application does not have the required permissions. + * @syscap SystemCapability.AuthenticationServices.HuaweiID.RealNameVerify + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + PERMISSION_CHECK_ERROR = 1002500004, + /** + * The user canceled the verification of the HUAWEI ID. + * @syscap SystemCapability.AuthenticationServices.HuaweiID.RealNameVerify + * @systemapi + * @stagemodelonly + * @since 4.0.0(10) + */ + /** + * The user canceled the verification of the HUAWEI ID. + * @syscap SystemCapability.AuthenticationServices.HuaweiID.RealNameVerify + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + USER_CANCELED = 1002500005, + /** + * Internal error. + * @syscap SystemCapability.AuthenticationServices.HuaweiID.RealNameVerify + * @systemapi + * @stagemodelonly + * @since 4.0.0(10) + */ + /** + * Internal error. + * @syscap SystemCapability.AuthenticationServices.HuaweiID.RealNameVerify + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + INTERNAL_ERROR = 1002500006, + /** + * Real-name verification is not supported for the HUAWEI ID. + * @syscap SystemCapability.AuthenticationServices.HuaweiID.RealNameVerify + * @systemapi + * @stagemodelonly + * @since 4.0.0(10) + */ + /** + * Real-name verification is not supported for the HUAWEI ID. + * @syscap SystemCapability.AuthenticationServices.HuaweiID.RealNameVerify + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + REAL_NAME_UNSUPPORTED = 1002500008, + /** + * Your face does not match your facial image as proof of identity. + * @syscap SystemCapability.AuthenticationServices.HuaweiID.RealNameVerify + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + FACE_NOT_MATCH = 1002500011, + /** + * No real-name information is found for the HUAWEI ID. + * @syscap SystemCapability.AuthenticationServices.HuaweiID.RealNameVerify + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + REAL_NAME_NOT_EXIST = 1002500012, + /** + * Your name and ID number do not match, or you may have recently changed your household registration + * or reported the loss of your ID card and had a new card issued. + * This identity information has not yet been synchronized with the Ministry of Public Security. + * @syscap SystemCapability.AuthenticationServices.HuaweiID.RealNameVerify + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + NAME_AND_ID_NUMBER_NOT_MATCH = 1002500013, + /** + * Too many real-name verification attempts. Try again 24 hours later. + * @syscap SystemCapability.AuthenticationServices.HuaweiID.RealNameVerify + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + TOO_MANY_ATTEMPTS = 1002500014, + /** + * The verificationToken parameter is incorrectly set. + * @syscap SystemCapability.AuthenticationServices.HuaweiID.RealNameVerify + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + VERIFICATION_TOKEN_INCORRECT = 1002500015, + /** + * This device does not support this API. + * @syscap SystemCapability.AuthenticationServices.HuaweiID.RealNameVerify + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + DEVICE_NOT_SUPPORTED = 1002500016 + } + /** + * Defines the request to perform a facial recognition verification for a user who has signed in. + * @typedef FacialRecognitionVerificationRequest + * @syscap SystemCapability.AuthenticationServices.HuaweiID.RealNameVerify + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + interface FacialRecognitionVerificationRequest { + /** + * Identity verification token, which is obtained from the OpenRealName service. + * @type { string } + * @syscap SystemCapability.AuthenticationServices.HuaweiID.RealNameVerify + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + verificationToken: string; + /** + * An opaque value used by the client to maintain the state between the request and callback for + * preventing cross-site request forgery. It will be returned without being modified in the + * corresponding credential after a successful verification. + * @type { ?string } + * @syscap SystemCapability.AuthenticationServices.HuaweiID.RealNameVerify + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + state?: string; + } + /** + * Defines the result of facial recognition verification for a user who has signed in. + * @typedef FacialRecognitionVerificationResult + * @syscap SystemCapability.AuthenticationServices.HuaweiID.RealNameVerify + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + interface FacialRecognitionVerificationResult { + /** + * Facial recognition verify token returned upon verification success. + * @type { string } + * @syscap SystemCapability.AuthenticationServices.HuaweiID.RealNameVerify + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + readonly facialRecognitionVerificationToken: string; + /** + * An opaque value used by the client to maintain the state between the request and callback for + * preventing cross-site request forgery. It will be returned without being modified in the + * corresponding credential after a successful verification. + * @type { ?string } + * @syscap SystemCapability.AuthenticationServices.HuaweiID.RealNameVerify + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + readonly state?: string; + } + /** + * Verify the facial recognition of a HUAWEI ID user. This function uses a promise to return the result. + * Note: This function must be called in the ArkUI page context. + * @param { common.Context } context - The context of an ability. + * @param { FacialRecognitionVerificationRequest } request - Facial recognition verification request parameters. + * @returns { Promise } Promise used to return the result. + * @throws { BusinessError } 401 - Invalid parameter. + * @throws { BusinessError } 1002500001 - The network is unavailable. + * @throws { BusinessError } 1002500002 - The user has not logged in with HUAWEI ID. + * @throws { BusinessError } 1002500003 - Failed to check the fingerprint of the application bundle. + * @throws { BusinessError } 1002500004 - The application does not have the required permissions. + * @throws { BusinessError } 1002500005 - The user canceled the verification of the HUAWEI ID. + * @throws { BusinessError } 1002500006 - Internal error. + * @throws { BusinessError } 1002500008 - Real-name verification is not supported for the HUAWEI ID. + * @throws { BusinessError } 1002500011 - Your face does not match your facial image as proof of identity. + * @throws { BusinessError } 1002500012 - No real-name information is found for the HUAWEI ID. + * @throws { BusinessError } 1002500013 - Your name and ID number do not match. + * @throws { BusinessError } 1002500014 - Too many real-name verification attempts. + * @throws { BusinessError } 1002500015 - The verifyToken parameter is incorrectly set. + * @throws { BusinessError } 1002500016 - This device does not support this API. + * @syscap SystemCapability.AuthenticationServices.HuaweiID.RealNameVerify + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + function startFacialRecognitionVerification(context: common.Context, request: FacialRecognitionVerificationRequest): Promise; +} +export default realName; diff --git a/language/arkts/extractor/sdk/hms/ets/api/@hms.core.account.shippingAddress.d.ts b/language/arkts/extractor/sdk/hms/ets/api/@hms.core.account.shippingAddress.d.ts new file mode 100755 index 00000000..cce13b24 --- /dev/null +++ b/language/arkts/extractor/sdk/hms/ets/api/@hms.core.account.shippingAddress.d.ts @@ -0,0 +1,203 @@ +/* +* Copyright (c) 2023 Huawei Device Co., Ltd. All rights reserved. + */ +/** + * @file Defines the feature of providing the HUAWEI ID-associated shipping address management service. + * @kit AccountKit + */ +import type common from '@ohos.app.ability.common'; +/** + * This module provides the shipping address management service APIs. + * @namespace shippingAddress + * @syscap SystemCapability.AuthenticationServices.HuaweiID.ShippingAddress + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ +declare namespace shippingAddress { + /** + * Enumerates the error codes of the shipping address management service. + * @enum { number } + * @syscap SystemCapability.AuthenticationServices.HuaweiID.ShippingAddress + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + enum ShippingAddressErrorCode { + /** + * Internal error. + * @syscap SystemCapability.AuthenticationServices.HuaweiID.ShippingAddress + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + INTERNAL_ERROR = 1008100001, + /** + * The network is unavailable. + * @syscap SystemCapability.AuthenticationServices.HuaweiID.ShippingAddress + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + NETWORK_ERROR = 1008100002, + /** + * The user has not signed in with HUAWEI ID. + * @syscap SystemCapability.AuthenticationServices.HuaweiID.ShippingAddress + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + ACCOUNT_NOT_LOGGED_IN = 1008100003, + /** + * Failed to check the fingerprint of the app bundle. + * @syscap SystemCapability.AuthenticationServices.HuaweiID.ShippingAddress + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + PACKAGE_FINGERPRINT_CHECK_ERROR = 1008100004, + /** + * The app does not have the required permissions. + * @syscap SystemCapability.AuthenticationServices.HuaweiID.ShippingAddress + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + PERMISSION_CHECK_ERROR = 1008100005, + /** + * The user quits the shipping address management service without finishing. + * @syscap SystemCapability.AuthenticationServices.HuaweiID.ShippingAddress + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + USER_CANCELED = 1008100006, + /** + * The shipping address management service does not support the HUAWEI ID that is already signed in. + * @syscap SystemCapability.AuthenticationServices.HuaweiID.ShippingAddress + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + UNSUPPORTED = 1008100007 + } + /** + * Shipping address. + * @typedef AddressInfo + * @syscap SystemCapability.AuthenticationServices.HuaweiID.ShippingAddress + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + interface AddressInfo { + /** + * User name. + * @type {string} + * @syscap SystemCapability.AuthenticationServices.HuaweiID.ShippingAddress + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + readonly userName: string; + /** + * Mobile phone number. + * @type {string} + * @syscap SystemCapability.AuthenticationServices.HuaweiID.ShippingAddress + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + readonly mobileNumber: string; + /** + * Landline phone number. + * @type {?string} + * @syscap SystemCapability.AuthenticationServices.HuaweiID.ShippingAddress + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + readonly telNumber?: string; + /** + * Zip code. + * @type {?string} + * @syscap SystemCapability.AuthenticationServices.HuaweiID.ShippingAddress + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + readonly zipCode?: string; + /** + * Country/Region code. + * @type {string} + * @syscap SystemCapability.AuthenticationServices.HuaweiID.ShippingAddress + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + readonly countryCode: string; + /** + * Province name. + * @type {string} + * @syscap SystemCapability.AuthenticationServices.HuaweiID.ShippingAddress + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + readonly provinceName: string; + /** + * City name. + * @type {string} + * @syscap SystemCapability.AuthenticationServices.HuaweiID.ShippingAddress + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + readonly cityName: string; + /** + * District name. + * @type {string} + * @syscap SystemCapability.AuthenticationServices.HuaweiID.ShippingAddress + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + readonly districtName: string; + /** + * Street name. + * @type {string} + * @syscap SystemCapability.AuthenticationServices.HuaweiID.ShippingAddress + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + readonly streetName: string; + /** + * Detailed address. + * @type {string} + * @syscap SystemCapability.AuthenticationServices.HuaweiID.ShippingAddress + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + readonly detailedAddress: string; + } + /** + * Bring up the address information page, and return the information about the selected address. + * @param { common.Context } context - Context of an ability. + * @returns { Promise } Promise returned by the function. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 1008100001 - Internal error. + * @throws { BusinessError } 1008100002 - The network is unavailable. + * @throws { BusinessError } 1008100003 - The user has not signed in with HUAWEI ID. + * @throws { BusinessError } 1008100004 - Failed to check the fingerprint of the app bundle. + * @throws { BusinessError } 1008100005 - The app does not have the required permissions. + * @throws { BusinessError } 1008100006 - The user quits the shipping address management service without finishing. + * @throws { BusinessError } 1008100007 - The shipping address management service does not support the HUAWEI ID that is already signed in. + * @syscap SystemCapability.AuthenticationServices.HuaweiID.ShippingAddress + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + function chooseAddress(context: common.Context): Promise; +} +export default shippingAddress; diff --git a/language/arkts/extractor/sdk/hms/ets/api/@hms.core.appgalleryservice.attributionManager.d.ts b/language/arkts/extractor/sdk/hms/ets/api/@hms.core.appgalleryservice.attributionManager.d.ts new file mode 100755 index 00000000..3155decb --- /dev/null +++ b/language/arkts/extractor/sdk/hms/ets/api/@hms.core.appgalleryservice.attributionManager.d.ts @@ -0,0 +1,192 @@ +/* + * Copyright (c) Huawei Technologies Co., Ltd. 2024-2024. All rights reserved. + */ +/** + * @file Attribution Manager Interface Description file + * @kit StoreKit + */ +/** + * Class that is used to declare methods of attribution. + * + * @namespace attributionManager + * @syscap SystemCapability.AppGalleryService.AttributionManager + * @StageModelOnly + * @since 5.0.0(12) + */ +declare namespace attributionManager { + /** + * Enum for attribution source type. + * + * @enum { number } + * @syscap SystemCapability.AppGalleryService.AttributionManager + * @StageModelOnly + * @since 5.0.0(12) + */ + export enum SourceType { + /** + * Indicates that attribution sourceType is impression. + * + * @syscap SystemCapability.AppGalleryService.AttributionManager + * @StageModelOnly + * @since 5.0.0(12) + */ + IMPRESSION = 0, + /** + * Indicates that attribution sourceType is click. + * + * @syscap SystemCapability.AppGalleryService.AttributionManager + * @StageModelOnly + * @since 5.0.0(12) + */ + CLICK = 1 + } + /** + * AdSourceInfo for register attribution source. + * + * @typedef AdSourceInfo + * @syscap SystemCapability.AppGalleryService.AttributionManager + * @StageModelOnly + * @since 5.0.0(12) + */ + export interface AdSourceInfo { + /** + * Identifier of the advertisement platform to which the advertisement task belongs. + * + * @type { string } + * @syscap SystemCapability.AppGalleryService.AttributionManager + * @StageModelOnly + * @since 5.0.0(12) + */ + adTechId: string; + /** + * Identifier of the advertisement task. + * + * @type { string } + * @syscap SystemCapability.AppGalleryService.AttributionManager + * @StageModelOnly + * @since 5.0.0(12) + */ + campaignId: string; + /** + * Identifier of the advertiser app published on AppGallery. + * + * @type { string } + * @syscap SystemCapability.AppGalleryService.AttributionManager + * @StageModelOnly + * @since 5.0.0(12) + */ + destinationId: string; + /** + * Type of attribution source. + * + * @type { SourceType } + * @syscap SystemCapability.AppGalleryService.AttributionManager + * @StageModelOnly + * @since 5.0.0(12) + */ + sourceType: SourceType; + /** + * Identifier of the monitoring platform used for the advertising. + * + * @type { ?string[] } + * @syscap SystemCapability.AppGalleryService.AttributionManager + * @StageModelOnly + * @since 5.0.0(12) + */ + mmpIds?: string[]; + /** + * Business information concerned by the ad platform, such as creative ideas or materials. + * + * @type { ?string } + * @syscap SystemCapability.AppGalleryService.AttributionManager + * @StageModelOnly + * @since 5.0.0(12) + */ + serviceTag?: string; + /** + * UUID used for computing signature. + * + * @type { string } + * @syscap SystemCapability.AppGalleryService.AttributionManager + * @StageModelOnly + * @since 5.0.0(12) + */ + nonce: string; + /** + * Timestamp of requesting advertisement. + * + * @type { number } + * @syscap SystemCapability.AppGalleryService.AttributionManager + * @StageModelOnly + * @@since 5.0.0(12) + */ + timestamp: number; + /** + * Signature of advertisement info. + * + * @type { string } + * @syscap SystemCapability.AppGalleryService.AttributionManager + * @StageModelOnly + * @since 5.0.0(12) + */ + signature: string; + } + /** + * AdTrigger info. + * + * @typedef AdTriggerInfo + * @syscap SystemCapability.AppGalleryService.AttributionManager + * @StageModelOnly + * @since 5.0.0(12) + */ + export interface AdTriggerInfo { + /** + * Business scene. + * + * @type { number } + * @syscap SystemCapability.AppGalleryService.AttributionManager + * @StageModelOnly + * @since 5.0.0(12) + */ + businessScene?: number; + /** + * Trigger code. + * + * @type { number } + * @syscap SystemCapability.AppGalleryService.AttributionManager + * @StageModelOnly + * @since 5.0.0(12) + */ + triggerData: number; + } + /** + * Used to register attribution source. + * + * @param { AdSourceInfo } adSourceInfo - AdSourceInfo for register attribution source. + * @returns { Promise } return value. + * @throws { BusinessError } 401 - The parameter check failed. + * @throws { BusinessError } 1009300001 - The specified service extension connect failed. + * @throws { BusinessError } 1009300002 - System internal error. + * @throws { BusinessError } 1009300003 - The identity check error. + * @throws { BusinessError } 1009300004 - The sign check error. + * @syscap SystemCapability.AppGalleryService.AttributionManager + * @StageModelOnly + * @since 5.0.0(12) + */ + function registerSource(adSourceInfo: AdSourceInfo): Promise; + /** + * Used to register trigger. + * + * @param { AdTriggerInfo } adTriggerInfo - AdTrigger info. + * @returns { Promise } return value. + * @throws { BusinessError } 401 - The parameter check failed. + * @throws { BusinessError } 1009300001 - The specified service extension connect failed. + * @throws { BusinessError } 1009300002 - System internal error. + * @throws { BusinessError } 1009300003 - The identity check error. + * @syscap SystemCapability.AppGalleryService.AttributionManager + * @StageModelOnly + * @since 5.0.0(12) + */ + function registerTrigger(adTriggerInfo: AdTriggerInfo): Promise; +} +export default attributionManager; diff --git a/language/arkts/extractor/sdk/hms/ets/api/@hms.core.appgalleryservice.attributionTestManager.d.ts b/language/arkts/extractor/sdk/hms/ets/api/@hms.core.appgalleryservice.attributionTestManager.d.ts new file mode 100755 index 00000000..c32d5786 --- /dev/null +++ b/language/arkts/extractor/sdk/hms/ets/api/@hms.core.appgalleryservice.attributionTestManager.d.ts @@ -0,0 +1,280 @@ +/* + * Copyright (c) Huawei Technologies Co., Ltd. 2024-2024. All rights reserved. + */ +/** + * @file Attribution Test Manager Interface Description file + * @kit StoreKit + */ +/** + * Class that is used to declare methods of managing attribution test information. + * + * @namespace attributionTestManager + * @syscap SystemCapability.AppGalleryService.AttributionManager + * @StageModelOnly + * @since 5.0.0(12) + */ +declare namespace attributionTestManager { + /** + * Enum for attribution source type. + * + * @enum { number } + * @syscap SystemCapability.AppGalleryService.AttributionManager + * @StageModelOnly + * @since 5.0.0(12) + */ + export enum SourceType { + /** + * Indicates that attribution sourceType is impression. + * + * @syscap SystemCapability.AppGalleryService.AttributionManager + * @StageModelOnly + * @since 5.0.0(12) + */ + IMPRESSION = 0, + /** + * Indicates that attribution sourceType is click. + * + * @syscap SystemCapability.AppGalleryService.AttributionManager + * @StageModelOnly + * @since 5.0.0(12) + */ + CLICK = 1 + } + /** + * Attribution source info to be validated in the testing environment + * + * @typedef AdSourceInfo + * @syscap SystemCapability.AppGalleryService.AttributionManager + * @StageModelOnly + * @since 5.0.0(12) + */ + export interface AdSourceInfo { + /** + * Identifier of the advertisement platform to which the advertisement task belongs. + * + * @type { string } + * @syscap SystemCapability.AppGalleryService.AttributionManager + * @StageModelOnly + * @since 5.0.0(12) + */ + adTechId: string; + /** + * Identifier of the advertisement task. + * + * @type { string } + * @syscap SystemCapability.AppGalleryService.AttributionManager + * @StageModelOnly + * @since 5.0.0(12) + */ + campaignId: string; + /** + * AppId of the advertiser app,generated by AppGallery. + * + * @type { string } + * @syscap SystemCapability.AppGalleryService.AttributionManager + * @StageModelOnly + * @since 5.0.0(12) + */ + destinationId: string; + /** + * Type of attribution source. + * + * @type { SourceType } + * @syscap SystemCapability.AppGalleryService.AttributionManager + * @StageModelOnly + * @since 5.0.0(12) + */ + sourceType: SourceType; + /** + * Identifier of the monitoring platform used for the advertising. + * + * @type { ?string[] } + * @syscap SystemCapability.AppGalleryService.AttributionManager + * @StageModelOnly + * @since 5.0.0(12) + */ + mmpIds?: string[]; + /** + * Business information concerned by the ad platform, such as creative ideas、materials. + * + * @type { ?string } + * @syscap SystemCapability.AppGalleryService.AttributionManager + * @StageModelOnly + * @since 5.0.0(12) + */ + serviceTag?: string; + /** + * UUID used for computing signature. + * + * @type { string } + * @syscap SystemCapability.AppGalleryService.AttributionManager + * @StageModelOnly + * @since 5.0.0(12) + */ + nonce: string; + /** + * Timestamp of requesting advertisement. + * + * @type { number } + * @syscap SystemCapability.AppGalleryService.AttributionManager + * @StageModelOnly + * @@since 5.0.0(12) + */ + timestamp: number; + /** + * Signature of advertisement info. + * + * @type { string } + * @syscap SystemCapability.AppGalleryService.AttributionManager + * @StageModelOnly + * @since 5.0.0(12) + */ + signature: string; + } + /** + * Postback info to be sent in the testing environment. + * + * @typedef PostbackInfo + * @syscap SystemCapability.AppGalleryService.AttributionManager + * @StageModelOnly + * @since 5.0.0(12) + */ + export interface PostbackInfo { + /** + * Identifier of the platform to which the postback will send to. + * + * @type { string } + * @syscap SystemCapability.AppGalleryService.AttributionManager + * @StageModelOnly + * @since 5.0.0(12) + */ + adTechId: string; + /** + * Identifier of the advertisement task. + * + * @type { string } + * @syscap SystemCapability.AppGalleryService.AttributionManager + * @StageModelOnly + * @since 5.0.0(12) + */ + campaignId: string; + /** + * AppId of the media app,generated by AppGallery. + * + * @type { string } + * @syscap SystemCapability.AppGalleryService.AttributionManager + * @StageModelOnly + * @since 5.0.0(12) + */ + sourceId: string; + /** + * AppId of the advertiser app,generated by AppGallery. + * + * @type { string } + * @syscap SystemCapability.AppGalleryService.AttributionManager + * @StageModelOnly + * @since 5.0.0(12) + */ + destinationId: string; + /** + * Business information concerned by the ad platform, such as creative ideas、materials. + * + * @type { ?string } + * @syscap SystemCapability.AppGalleryService.AttributionManager + * @StageModelOnly + * @since 5.0.0(12) + */ + serviceTag?: string; + /** + * Business scene. + * + * @type { number } + * @syscap SystemCapability.AppGalleryService.AttributionManager + * @StageModelOnly + * @since 5.0.0(12) + */ + businessScene?: number; + /** + * Trigger value. + * + * @type { number } + * @syscap SystemCapability.AppGalleryService.AttributionManager + * @StageModelOnly + * @since 5.0.0(12) + */ + triggerData: number; + /** + * Url where this postback will send to. + * + * @type { string } + * @syscap SystemCapability.AppGalleryService.AttributionManager + * @StageModelOnly + * @since 5.0.0(12) + */ + postbackUrl: string; + } + /** + * Used to validate attribution source in the testing environment. + * + * @param { AdSourceInfo } adSourceInfo - Attribution source info to be validated in the testing environment. + * @param { string } publicKey - The public key to validate signature. + * @returns { Promise } return value. + * @throws { BusinessError } 401 - The parameter check failed. + * @throws { BusinessError } 1009300001 - The specified service extension connect failed. + * @throws { BusinessError } 1009300002 - System internal error. + * @throws { BusinessError } 1009300101 - AdTechId is missing in the request. + * @throws { BusinessError } 1009300102 - CampaignId is missing in the request. + * @throws { BusinessError } 1009300104 - DestinationId is missing in the request. + * @throws { BusinessError } 1009300105 - SourceType is missing in the request. + * @throws { BusinessError } 1009300106 - Nonce is missing in the request. + * @throws { BusinessError } 1009300107 - Timestamp is missing in the request. + * @throws { BusinessError } 1009300108 - Signature is missing in the request. + * @throws { BusinessError } 1009300111 - AdSourceInfo is missing in the request. + * @throws { BusinessError } 1009300112 - PublicKey is missing in the request. + * @throws { BusinessError } 1009300114 - The signature verification failed in the testing environment. + * @syscap SystemCapability.AppGalleryService.AttributionManager + * @StageModelOnly + * @since 5.0.0(12) + */ + function validateSource(adSourceInfo: AdSourceInfo, publicKey: string): Promise; + /** + * Used to set attribution postback info in the testing environment. + * + * @param { PostbackInfo } postbackInfo - Postback info to be sent in the testing environment. + * @returns { Promise } return value. + * @throws { BusinessError } 401 - The parameter check failed. + * @throws { BusinessError } 1009300001 - The specified service extension connect failed. + * @throws { BusinessError } 1009300002 - System internal error. + * @throws { BusinessError } 1009300101 - AdTechId is missing in the request. + * @throws { BusinessError } 1009300102 - CampaignId is missing in the request. + * @throws { BusinessError } 1009300103 - SourceId is missing in the request. + * @throws { BusinessError } 1009300104 - DestinationId is missing in the request. + * @throws { BusinessError } 1009300109 - TriggerData is missing in the request. + * @throws { BusinessError } 1009300110 - PostbackUrl is missing in the request. + * @throws { BusinessError } 1009300113 - PostbackInfo is missing in the request. + * @throws { BusinessError } 1009300115 - Too many postbacks setting to the testing environment. + * @syscap SystemCapability.AppGalleryService.AttributionManager + * @StageModelOnly + * @since 5.0.0(12) + */ + function setPostback(postbackInfo: PostbackInfo): Promise; + /** + * Used to flush postbacks in the testing environment. + * + * @param { string } adTechId - AdTechId of whom the postbacks will be sent in the testing environment. + * @returns { Promise } return value. + * @throws { BusinessError } 401 - The parameter check failed. + * @throws { BusinessError } 1009300001 - The specified service extension connect failed. + * @throws { BusinessError } 1009300002 - System internal error. + * @throws { BusinessError } 1009300101 - AdTechId is missing in the request. + * @throws { BusinessError } 1009300116 - There is no postback to be sent of this adTechId. + * @throws { BusinessError } 1009300117 - Failed to send postbacks to the postbackUrl. + * @throws { BusinessError } 1009300119 - Network error. + * @throws { BusinessError } 1009300120 - Request too frequent. + * @syscap SystemCapability.AppGalleryService.AttributionManager + * @StageModelOnly + * @since 5.0.0(12) + */ + function flushPostbacks(adTechId: string): Promise; +} +export default attributionTestManager; diff --git a/language/arkts/extractor/sdk/hms/ets/api/@hms.core.appgalleryservice.moduleInstallManager.d.ts b/language/arkts/extractor/sdk/hms/ets/api/@hms.core.appgalleryservice.moduleInstallManager.d.ts new file mode 100755 index 00000000..ebd293db --- /dev/null +++ b/language/arkts/extractor/sdk/hms/ets/api/@hms.core.appgalleryservice.moduleInstallManager.d.ts @@ -0,0 +1,549 @@ +/* + * Copyright (c) Huawei Technologies Co., Ltd. 2023-2023. All rights reserved. + */ +/** +* @file ModuleInstall Manager Interface Description file +* @kit StoreKit +*/ +import type common from '@ohos.app.ability.common'; +import type { Callback } from '@ohos.base'; +import type bundleManager from '@ohos.bundle.bundleManager'; +/** + * The functions of module install manager. + * + * @namespace moduleInstallManager + * @syscap SystemCapability.AppGalleryService.Distribution.OnDemandInstall + * + */ +declare namespace moduleInstallManager { + /** + * IThe enumerated value indicates the installation status. + * + * @enum { number } + * @syscap SystemCapability.AppGalleryService.Distribution.OnDemandInstall + * @StageModelOnly + * @since 4.1.0(11) + */ + export enum InstallStatus { + /** + * Indicates module has been installed. + * + * @syscap SystemCapability.AppGalleryService.Distribution.OnDemandInstall + * @StageModelOnly + * @since 4.1.0(11) + */ + INSTALLED = 0, + /** + * Indicates module is not installed. + * + * @syscap SystemCapability.AppGalleryService.Distribution.OnDemandInstall + * @StageModelOnly + * @since 4.1.0(11) + */ + NOT_INSTALLED = 1 + } + /** + * The enumerated value indicates the download result status code. + * + * @enum { number } + * @syscap SystemCapability.AppGalleryService.Distribution.OnDemandInstall + * @StageModelOnly + * @since 4.1.0(11) + */ + export enum RequestErrorCode { + /** + * Indicates that all modules to be downloaded are installed. + * + * @syscap SystemCapability.AppGalleryService.Distribution.OnDemandInstall + * @StageModelOnly + * @since 4.1.0(11) + */ + MODULE_ALREADY_EXISTS = -8, + /** + * The module to be downloaded does not exist or does not adapt to the device. + * + * @syscap SystemCapability.AppGalleryService.Distribution.OnDemandInstall + * @StageModelOnly + * @since 4.1.0(11) + */ + MODULE_UNAVAILABLE = -7, + /** + * Indicates that the request is invalid and contains incomplete information. + * + * @syscap SystemCapability.AppGalleryService.Distribution.OnDemandInstall + * @StageModelOnly + * @since 4.1.0(11) + */ + INVALID_REQUEST = -6, + /** + * Indicates that the request failed due to a network connection error. + * + * @syscap SystemCapability.AppGalleryService.Distribution.OnDemandInstall + * @StageModelOnly + * @since 4.1.0(11) + */ + NETWORK_ERROR = -5, + /** + * Indicates that the caller information is abnormal. + * + * @syscap SystemCapability.AppGalleryService.Distribution.OnDemandInstall + * @StageModelOnly + * @since 4.1.0(11) + */ + INVOKER_VERIFICATION_FAILED = -4, + /** + * Indicates that only foreground requests for on-demand loading are allowed. + * + * @syscap SystemCapability.AppGalleryService.Distribution.OnDemandInstall + * @StageModelOnly + * @since 4.1.0(11) + */ + FOREGROUND_REQUIRED = -3, + /** + * Indicates that the request was rejected because at least one request is currently downloading. + * + * @syscap SystemCapability.AppGalleryService.Distribution.OnDemandInstall + * @StageModelOnly + * @since 4.1.0(11) + */ + ACTIVE_SESSION_LIMIT_EXCEEDED = -2, + /** + * Indicates request is failed. + * + * @syscap SystemCapability.AppGalleryService.Distribution.OnDemandInstall + * @StageModelOnly + * @since 4.1.0(11) + */ + FAILURE = -1, + /** + * Indicates request is successful. + * + * @syscap SystemCapability.AppGalleryService.Distribution.OnDemandInstall + * @StageModelOnly + * @since 4.1.0(11) + */ + SUCCESS = 0, + /** + * The user needs to confirm the request. A pop-up window is required to remind the developer of the traffic reminder. + * + * @syscap SystemCapability.AppGalleryService.Distribution.OnDemandInstall + * @StageModelOnly + * @since 4.1.0(11) + */ + DOWNLOAD_WAIT_WIFI = 1 + } + /** + * The enumerated value indicates the download task status code. + * + * @enum { number } + * @syscap SystemCapability.AppGalleryService.Distribution.OnDemandInstall + * @StageModelOnly + * @since 4.1.0(11) + */ + export enum TaskStatus { + /** + * Create download task fail. + * + * @syscap SystemCapability.AppGalleryService.Distribution.OnDemandInstall + * @StageModelOnly + * @since 4.1.0(11) + */ + CREATE_TASK_FAILED = -4, + /** + * A higher version application exists locally. + * + * @syscap SystemCapability.AppGalleryService.Distribution.OnDemandInstall + * @StageModelOnly + * @since 4.1.0(11) + */ + HIGHER_VERSION_INSTALLED = -3, + /** + * Download task already exists. + * + * @syscap SystemCapability.AppGalleryService.Distribution.OnDemandInstall + * @StageModelOnly + * @since 4.1.0(11) + */ + TASK_ALREADY_EXISTS = -2, + /** + * There is no download tasks. + * + * @syscap SystemCapability.AppGalleryService.Distribution.OnDemandInstall + * @StageModelOnly + * @since 4.1.0(11) + */ + TASK_UNFOUND = -1, + /** + * Download task is created now. + * + * @syscap SystemCapability.AppGalleryService.Distribution.OnDemandInstall + * @StageModelOnly + * @since 4.1.0(11) + */ + TASK_CREATED = 0, + /** + * The application is downloading. + * + * @syscap SystemCapability.AppGalleryService.Distribution.OnDemandInstall + * @StageModelOnly + * @since 4.1.0(11) + */ + DOWNLOADING = 1, + /** + * The download task is paused. + * + * @syscap SystemCapability.AppGalleryService.Distribution.OnDemandInstall + * @StageModelOnly + * @since 4.1.0(11) + */ + DOWNLOAD_PAUSING = 2, + /** + * The download task is waiting to start. + * + * @syscap SystemCapability.AppGalleryService.Distribution.OnDemandInstall + * @StageModelOnly + * @since 4.1.0(11) + */ + DOWNLOAD_WAITING = 3, + /** + * Download task is finished successfully. + * + * @syscap SystemCapability.AppGalleryService.Distribution.OnDemandInstall + * @StageModelOnly + * @since 4.1.0(11) + */ + DOWNLOAD_SUCCESSFUL = 4, + /** + * Download task is failed. + * + * @syscap SystemCapability.AppGalleryService.Distribution.OnDemandInstall + * @StageModelOnly + * @since 4.1.0(11) + */ + DOWNLOAD_FAILED = 5, + /** + * Waiting Wi-Fi to start download task. + * + * @syscap SystemCapability.AppGalleryService.Distribution.OnDemandInstall + * @StageModelOnly + * @since 4.1.0(11) + */ + DOWNLOAD_WAIT_WIFI = 6, + /** + * Waiting to start install task. + * + * @syscap SystemCapability.AppGalleryService.Distribution.OnDemandInstall + * @StageModelOnly + * @since 4.1.0(11) + */ + INSTALL_WAITING = 20, + /** + * The application is installing. + * + * @syscap SystemCapability.AppGalleryService.Distribution.OnDemandInstall + * @StageModelOnly + * @since 4.1.0(11) + */ + INSTALLING = 21, + /** + * Install task is finished successfully. + * + * @syscap SystemCapability.AppGalleryService.Distribution.OnDemandInstall + * @StageModelOnly + * @since 4.1.0(11) + */ + INSTALL_SUCCESSFUL = 22, + /** + * Install task is failed. + * + * @syscap SystemCapability.AppGalleryService.Distribution.OnDemandInstall + * @StageModelOnly + * @since 4.1.0(11) + */ + INSTALL_FAILED = 23 + } + /** + * Interface return value. + * + * @enum { number } + * @syscap SystemCapability.AppGalleryService.Distribution.OnDemandInstall + * @StageModelOnly + * @since 4.1.0(11) + */ + export enum ReturnCode { + /** + * Indicates that operation is success. + * + * @syscap SystemCapability.AppGalleryService.Distribution.OnDemandInstall + * @StageModelOnly + * @since 4.1.0(11) + */ + SUCCESS = 0, + /** + * Indicates that operation is fail. + * + * @syscap SystemCapability.AppGalleryService.Distribution.OnDemandInstall + * @StageModelOnly + * @since 4.1.0(11) + */ + FAILURE = 1 + } + /** + * Module installation information. + * + * @typedef InstalledModule + * @syscap SystemCapability.AppGalleryService.Distribution.OnDemandInstall + * @StageModelOnly + * @since 4.1.0(11) + */ + export interface InstalledModule { + /** + * Indicates name of this module. + * + * @type { string } + * @syscap SystemCapability.AppGalleryService.Distribution.OnDemandInstall + * @StageModelOnly + * @since 4.1.0(11) + */ + readonly moduleName: string; + /** + * Indicates type of this module. + * + * @type { bundleManager.ModuleType } + * @syscap SystemCapability.AppGalleryService.Distribution.OnDemandInstall + * @StageModelOnly + * @since 4.1.0(11) + */ + readonly moduleType?: bundleManager.ModuleType; + /** + * Whether the module is installed. + * + * @type { InstallStatus } + * @syscap SystemCapability.AppGalleryService.Distribution.OnDemandInstall + * @StageModelOnly + * @since 4.1.0(11) + */ + readonly installStatus: InstallStatus; + } + /** + * Session status of the on-demand loading module + * + * @typedef ModuleInstallSessionState + * @syscap SystemCapability.AppGalleryService.Distribution.OnDemandInstall + * @StageModelOnly + * @since 4.1.0(11) + */ + export interface ModuleInstallSessionState { + /** + * Request result returned to the invoker. + * + * @type { RequestErrorCode } + * @syscap SystemCapability.AppGalleryService.Distribution.OnDemandInstall + * @StageModelOnly + * @since 4.1.0(11) + */ + readonly code: RequestErrorCode; + /** + * Current status of a download task. + * + * @type { TaskStatus } + * @syscap SystemCapability.AppGalleryService.Distribution.OnDemandInstall + * @StageModelOnly + * @since 4.1.0(11) + */ + readonly taskStatus: TaskStatus; + /** + * Download task ID (timestamp when the task is created). The default value is 0. + * + * @type { string } + * @syscap SystemCapability.AppGalleryService.Distribution.OnDemandInstall + * @StageModelOnly + * @since 4.1.0(11) + */ + readonly taskId?: string; + /** + * Result description returned to the invoker. The default value is "". + * + * @type { string } + * @syscap SystemCapability.AppGalleryService.Distribution.OnDemandInstall + * @StageModelOnly + * @since 4.1.0(11) + */ + readonly desc: string; + /** + * List of modules to be downloaded. The default value is []. + * + * @type { string[] } + * @syscap SystemCapability.AppGalleryService.Distribution.OnDemandInstall + * @StageModelOnly + * @since 4.1.0(11) + */ + readonly modules?: string[]; + /** + * Total size of modules to be downloaded. The default value is 0. + * + * @type { number } + * @syscap SystemCapability.AppGalleryService.Distribution.OnDemandInstall + * @StageModelOnly + * @since 4.1.0(11) + */ + readonly totalSize?: number; + /** + * Installed size of the module to be downloaded. The default value is 0. + * + * @type { number } + * @syscap SystemCapability.AppGalleryService.Distribution.OnDemandInstall + * @StageModelOnly + * @since 4.1.0(11) + */ + readonly downloadedSize?: number; + } + /** + * Obtain the installation status of the module. + * + * @param { moduleName } string - Indicates name of this module. + * @return { InstalledModule } Returns the installation status of the module. + * @throws { BusinessError } 401 - The parameter check failed. + * @throws { BusinessError } 1006500001 - Failed to invoke the BMS. + * @syscap SystemCapability.AppGalleryService.Distribution.OnDemandInstall + * @StageModelOnly + * @since 4.1.0(11) + */ + function getInstalledModule(moduleName: string): InstalledModule; + /** + * Register the on-demand load completion listener. + * When the collaboration processes loads the module, the callback function is used to notify the caller. + * + * @param { 'moduleInstallStatus' } type - Type of the event to listen for. Only the moduleInstallStatus event is support. + * @param { Callback } callback - Callback is invoked when the event is triggered. + * @param { number } timeout - Monitoring duration. + * @throws { BusinessError } 401 - The parameter check failed. + * @throws { BusinessError } 1006500002 - The interface is called repeatedly with the same input. + * @throws { BusinessError } 1006500004 - SA connection failed. + * @syscap SystemCapability.AppGalleryService.Distribution.OnDemandInstall + * @StageModelOnly + * @since 4.1.0(11) + */ + function on(type: 'moduleInstallStatus', callback: Callback, timeout: number): void; + /** + * Unregisters service change events. + * + * @param { 'moduleInstallStatus' } type - Type of the event to listen for. Only the moduleInstallStatus event is support. + * @param { Callback } callback - Callback is invoked when the event is triggered. + * @throws { BusinessError } 401 - The parameter check failed. + * @throws { BusinessError } 1006500004 - SA connection failed. + * @throws { BusinessError } 1006500006 - The interface is not used together with "on". + * @syscap SystemCapability.AppGalleryService.Distribution.OnDemandInstall + * @StageModelOnly + * @since 4.1.0(11) + */ + function off(type: 'moduleInstallStatus', callback?: Callback): void; + /** + * Canceling an on-demand loading task + * + * @param { string } taskId - ID of a download task + * @return { ReturnCode } Operation result. 0: succeeded; 1: failed. + * @throws { BusinessError } 401 - The parameter check failed. + * @throws { BusinessError } 1006500007 - The specified service extension connect failed. + * @throws { BusinessError } 1006500008 - Write param into container failed. + * @throws { BusinessError } 1006500009 - Request to service error. + * @throws { BusinessError } 1006500010 - Response from service cannot be recognized. + * @syscap SystemCapability.AppGalleryService.Distribution.OnDemandInstall + * @StageModelOnly + * @since 4.1.0(11) + */ + function cancelTask(taskId: string): ReturnCode; + /** + * To verify that the invoker continues the download using mobile traffic on the foreground. + * + * @param { common.UIAbilityContext | common.ExtensionContext } context - the context of an ability or extensionContext + * @param { string } taskId - ID of a download task + * @return { ReturnCode } Operation result. 0: succeeded; 1: failed. + * @throws { BusinessError } 401 - The parameter check failed. + * @throws { BusinessError } 1006500007 - The specified service extension connect failed. + * @throws { BusinessError } 1006500008 - Write param into container failed. + * @throws { BusinessError } 1006500009 - Request to service error. + * @throws { BusinessError } 1006500010 - Response from service cannot be recognized. + * @syscap SystemCapability.AppGalleryService.Distribution.OnDemandInstall + * @StageModelOnly + * @since 4.1.0(11) + */ + function showCellularDataConfirmation(context: common.UIAbilityContext | common.ExtensionContext, taskId: string): ReturnCode; + /** + * The class of an Install request. + * + * @syscap SystemCapability.AppGalleryService.Distribution.OnDemandInstall + * @StageModelOnly + * @since 4.1.0(11) + */ + class InstallRequest { + } + /** + * The class of an Install controller. + * + * @syscap SystemCapability.AppGalleryService.Distribution.OnDemandInstall + * @StageModelOnly + * @since 4.1.0(11) + */ + class InstallProvider { + } + /** + * Defines the request for an app to load uninstalled modules as required. + * + * @extends InstallRequest + * @syscap SystemCapability.AppGalleryService.Distribution.OnDemandInstall + * @StageModelOnly + * @since 4.1.0(11) + */ + export class ModuleInstallRequest extends InstallRequest { + /** + * Adding module to Be Installed. + * + * @param { string } moduleName - Name of the module to be loaded. + * @return { ReturnCode } Operation result. 0: succeeded; 1: failed. + * @throws { BusinessError } 401 - The parameter check failed. + * @syscap SystemCapability.AppGalleryService.Distribution.OnDemandInstall + * @StageModelOnly + * @since 4.1.0(11) + */ + addModule(moduleName: string): ReturnCode; + } + /** + * Provides methods for implementing on-demand service loading for modules. + * + * @extends InstallProvider + * @syscap SystemCapability.AppGalleryService.Distribution.OnDemandInstall + * @StageModelOnly + * @since 4.1.0(11) + */ + export class ModuleInstallProvider extends InstallProvider { + /** + * Creating an On-Demand Loading Request. + * + * @param { common.UIAbilityContext | common.ExtensionContext } context - the context of an ability or extensionContext + * @param { string } taskId - ID of a download task. + * @return { ModuleInstallRequest } - Returns the ModuleInstallRequest object. + * @throws { BusinessError } 401 - The parameter check failed. + * @syscap SystemCapability.AppGalleryService.Distribution.OnDemandInstall + * @StageModelOnly + * @since 4.1.0(11) + */ + createModuleInstallRequest(context: common.UIAbilityContext | common.ExtensionContext): ModuleInstallRequest; + } + /** + * Load module packages as required based on ModuleInstallRequest. + * + * @param { ModuleInstallRequest } moduleInstallRequest - Indicates the module install request. + * @return { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - The parameter check failed. + * @throws { BusinessError } 1006500004 - SA connection failed. + * @throws { BusinessError } 1006500008 - Write param into container failed. + * @throws { BusinessError } 1006500009 - Request to service error. + * @throws { BusinessError } 1006500010 - Response from service cannot be recognized. + * @syscap SystemCapability.AppGalleryService.Distribution.OnDemandInstall + * @StageModelOnly + * @since 4.1.0(11) + */ + function fetchModules(moduleInstallRequest: ModuleInstallRequest): Promise; +} +export default moduleInstallManager; diff --git a/language/arkts/extractor/sdk/hms/ets/api/@hms.core.appgalleryservice.productViewManager.d.ts b/language/arkts/extractor/sdk/hms/ets/api/@hms.core.appgalleryservice.productViewManager.d.ts new file mode 100755 index 00000000..05fffac1 --- /dev/null +++ b/language/arkts/extractor/sdk/hms/ets/api/@hms.core.appgalleryservice.productViewManager.d.ts @@ -0,0 +1,165 @@ +/* + * Copyright (c) Huawei Technologies Co., Ltd. 2023-2023. All rights reserved. + */ +/** +* @file ProductView Manager Interface Description file +* @kit StoreKit +*/ +import type common from '@ohos.app.ability.common'; +import type Want from '@ohos.app.ability.Want'; +import type { Callback, ErrorCallback } from '@ohos.base'; +/** + * Class that is used to declare methods of open view provide by AppGallery. + * + * @namespace productViewManager + * @syscap SystemCapability.AppGalleryService.Distribution.Recommendations + * @StageModelOnly + * @since 4.1.0(11) + */ +declare namespace productViewManager { + /** + * The result from received data. + * + * @enum { number } + * @syscap SystemCapability.AppGalleryService.Distribution.Recommendations + * @StageModelOnly + * @since 4.1.0(11) + */ + export enum ReceiveDataResult { + /** + * Indicates that operation is success. + * + * @syscap SystemCapability.AppGalleryService.Distribution.Recommendations + * @StageModelOnly + * @since 4.1.0(11) + */ + SUCCESS = 1000, + /** + * Indicates that operation is fail. + * + * @syscap SystemCapability.AppGalleryService.Distribution.Recommendations + * @StageModelOnly + * @since 4.1.0(11) + */ + FAILURE = 1001, + /** + * Exception occurrence. + * + * @syscap SystemCapability.AppGalleryService.Distribution.Recommendations + * @StageModelOnly + * @since 4.1.0(11) + */ + EXCEPTION = 1002 + } + /** + * Result of opening the harmony service detail page. + * + * @typedef ServiceViewReceiveData + * @syscap SystemCapability.AppGalleryService.Distribution.Recommendations + * @StageModelOnly + * @since 4.1.0(11) + */ + export interface ServiceViewReceiveData { + /** + * Indicates result of opening the harmony service detail page. + * + * @type { ReceiveDataResult } + * @syscap SystemCapability.AppGalleryService.Distribution.Recommendations + * @StageModelOnly + * @since 4.1.0(11) + */ + readonly result: ReceiveDataResult; + /** + * Indicates description of opening harmony service detail page result. + * + * @type { string } + * @syscap SystemCapability.AppGalleryService.Distribution.Recommendations + * @StageModelOnly + * @since 4.1.0(11) + */ + readonly msg: string; + /** + * Indicates information of the harmony service detail page. + * + * @type { string } + * @syscap SystemCapability.AppGalleryService.Distribution.Recommendations + * @StageModelOnly + * @since 4.1.0(11) + */ + readonly formInfo: { + [key: string]: Object; + }; + } + /** + * Callback of opening the harmony service detail page which is for adding card to desktop. + * + * @typedef ServiceViewCallback + * @syscap SystemCapability.AppGalleryService.Distribution.Recommendations + * @StageModelOnly + * @since 4.1.0(11) + */ + export interface ServiceViewCallback { + /** + * Indicates callback function when receive the page information. + * + * @type { ?Callback } + * @syscap SystemCapability.AppGalleryService.Distribution.Recommendations + * @StageModelOnly + * @since 4.1.0(11) + */ + onReceive?: Callback; + /** + * Indicates callback function when receive an error. + * + * @type { ?ErrorCallback } + * @syscap SystemCapability.AppGalleryService.Distribution.Recommendations + * @StageModelOnly + * @since 4.1.0(11) + */ + onError?: ErrorCallback; + } + /** + * Callback of opening the detail page. + * + * @typedef ProductViewCallback + * @syscap SystemCapability.AppGalleryService.Distribution.Recommendations + * @StageModelOnly + * @since 4.1.0(11) + */ + export interface ProductViewCallback { + /** + * Indicates callback function when receive an error. + * + * @type { ?ErrorCallback } + * @syscap SystemCapability.AppGalleryService.Distribution.Recommendations + * @StageModelOnly + * @since 4.1.0(11) + */ + onError?: ErrorCallback; + } + /** + * Request to open the harmony service detail page which is for adding card to desktop. + * + * @param { common.UIAbilityContext } context - Indicates the ui ability context of the media application. + * @param { Want } want - Indicates the ability to start. + * @param { ?ServiceViewCallback } callbacks - callbacks for opening the harmony service detail page. + * @throws { BusinessError } 401 - The parameter check failed. + * @syscap SystemCapability.AppGalleryService.Distribution.Recommendations + * @StageModelOnly + * @since 4.1.0(11) + */ + function loadService(context: common.UIAbilityContext, want: Want, callback?: ServiceViewCallback): void; + /** + * Request to open the application detail page. + * + * @param { common.UIAbilityContext } context - Indicates the ui ability context of the media application. + * @param { Want } want - Indicates the ability to start. + * @param { ?ProductViewCallback } callbacks - callbacks for opening the application detail page. + * @throws { BusinessError } 401 - The parameter check failed. + * @syscap SystemCapability.AppGalleryService.Distribution.Recommendations + * @StageModelOnly + * @since 4.1.0(11) + */ + function loadProduct(context: common.UIAbilityContext, want: Want, callback?: ProductViewCallback): void; +} +export default productViewManager; diff --git a/language/arkts/extractor/sdk/hms/ets/api/@hms.core.appgalleryservice.updateManager.d.ts b/language/arkts/extractor/sdk/hms/ets/api/@hms.core.appgalleryservice.updateManager.d.ts new file mode 100755 index 00000000..d173fd55 --- /dev/null +++ b/language/arkts/extractor/sdk/hms/ets/api/@hms.core.appgalleryservice.updateManager.d.ts @@ -0,0 +1,117 @@ +/* + * Copyright (c) Huawei Technologies Co., Ltd. 2024-2024. All rights reserved. + */ +/** + * @file Update Manager Interface Description file + * @kit StoreKit + */ +import type common from '@ohos.app.ability.common'; +/** + * The functions of app update manager. + * + * @namespace updateManager + * @syscap SystemCapability.AppGalleryService.Distribution.Update + * @since 5.0.0(12) + */ +declare namespace updateManager { + /** + * Enum for Detect New Version + * + * @enum {number} + * @syscap SystemCapability.AppGalleryService.Distribution.Update + * @since 5.0.0(12) + */ + export enum UpdateAvailableCode { + /** + * A new version is available. + * + * @syscap SystemCapability.AppGalleryService.Distribution.Update + * @StageModelOnly + * @since 5.0.0(12) + */ + LATER_VERSION_EXIST = 1, + /** + * No new version + * + * @syscap SystemCapability.AppGalleryService.Distribution.Update + * @StageModelOnly + * @since 5.0.0(12) + */ + LATER_VERSION_NOT_EXIST = 0 + } + /** + * Enum for show update dialog result + * + * @enum {number} + * @syscap SystemCapability.AppGalleryService.Distribution.Update + * @since 5.0.0(12) + */ + export enum ShowUpdateResultCode { + /** + * Show update dialog success + * + * @syscap SystemCapability.AppGalleryService.Distribution.Update + * @StageModelOnly + * @since 5.0.0(12) + */ + SHOW_DIALOG_SUCCESS = 0, + /** + * Show update dialog fail + * + * @syscap SystemCapability.AppGalleryService.Distribution.Update + * @StageModelOnly + * @since 5.0.0(12) + */ + SHOW_DIALOG_FAILURE = 1 + } + /** + * Return check update reuslt + * + * @typedef CheckUpdateResult + * @syscap SystemCapability.AppGalleryService.Distribution.Update + * @since 5.0.0(12) + */ + export interface CheckUpdateResult { + /** + * Whether can update or not. + * 0:do not update; 1:has new version to update + * + * @syscap SystemCapability.AppGalleryService.Distribution.Update + * @since 5.0.0(12) + */ + readonly updateAvailable: UpdateAvailableCode; + } + /** + * Check for Update. + * + * @param { common.UIAbilityContext } context - the context of an ability + * @throws { BusinessError } 401 - The parameter check failed. + * @throws { BusinessError } 1009400001 - SA connect error + * @throws { BusinessError } 1009400002 - Request to service error. + * @throws { BusinessError } 1009400003 - Network error. + * @throws { BusinessError } 1009400004 - The application is not in the foreground. + * @throws { BusinessError } 1009400005 - Not agreeing to the privacy agreement. + * @throws { BusinessError } 1009400006 - Time limited. + * @throws { BusinessError } 1009400007 - Other error. + * @syscap SystemCapability.AppGalleryService.Distribution.Update + * @StageModelOnly + * @since 5.0.0(12) + */ + function checkAppUpdate(context: common.UIAbilityContext): Promise; + /** + * Displaying the update dialog. + * + * @param { common.UIAbilityContext} context - the context of an ability + * @throws { BusinessError } 401 - The parameter check failed. + * @throws { BusinessError } 1009400001 - SA connection error. + * @throws { BusinessError } 1009400002 - Request to service error. + * @throws { BusinessError } 1009400004 - The application is not in the foreground. + * @throws { BusinessError } 1009400005 - Not agreeing to the privacy agreement. + * @throws { BusinessError } 1009400007 - Other error. + * @syscap SystemCapability.AppGalleryService.Distribution.Update + * @StageModelOnly + * @since 5.0.0(12) + */ + function showUpdateDialog(context: common.UIAbilityContext): Promise; +} +export default updateManager; diff --git a/language/arkts/extractor/sdk/hms/ets/api/@hms.core.atomicserviceComponent.atomicservice.d.ets b/language/arkts/extractor/sdk/hms/ets/api/@hms.core.atomicserviceComponent.atomicservice.d.ets new file mode 100755 index 00000000..e37ae84f --- /dev/null +++ b/language/arkts/extractor/sdk/hms/ets/api/@hms.core.atomicserviceComponent.atomicservice.d.ets @@ -0,0 +1,511 @@ +/* + * Copyright (c) Huawei Technologies Co., Ltd. 2024-2024. All rights reserved. + */ +/** + * @file + * @kit ScenarioFusionKit + */ +import window from '@ohos.window'; +/** + * Scenario API + * + * @namespace atomicService + * @syscap SystemCapability.AtomicserviceComponent.atomicservice + * @StageModelOnly + * @atomicservice + * @since 5.0.0(12) + */ +declare namespace atomicService { + /** + * System Settings Properties + * + * @typedef SystemSettingInfo + * @syscap SystemCapability.AtomicserviceComponent.atomicservice + * @StageModelOnly + * @atomicservice + * @since 5.0.0(12) + */ + interface SystemSettingInfo { + /** + * Bluetooth switch + * + * @type { boolean } + * @readonly + * @syscap SystemCapability.AtomicserviceComponent.atomicservice + * @StageModelOnly + * @atomicservice + * @since 5.0.0(12) + */ + bluetoothEnabled?: boolean; + /** + * Location switch + * + * @type { boolean } + * @readonly + * @syscap SystemCapability.AtomicserviceComponent.atomicservice + * @StageModelOnly + * @atomicservice + * @since 5.0.0(12) + */ + locationEnabled?: boolean; + /** + * Wi-Fi switch + * + * @type { boolean } + * @readonly + * @syscap SystemCapability.AtomicserviceComponent.atomicservice + * @StageModelOnly + * @atomicservice + * @since 5.0.0(12) + */ + wifiEnabled?: boolean; + /** + * Device orientation + * + * @type { string } + * @readonly + * @syscap SystemCapability.AtomicserviceComponent.atomicservice + * @StageModelOnly + * @atomicservice + * @since 5.0.0(12) + */ + deviceOrientation?: string; + } + /** + * System Information Properties + * + * @typedef SystemInfo + * @syscap SystemCapability.AtomicserviceComponent.atomicservice + * @StageModelOnly + * @atomicservice + * @since 5.0.0(12) + */ + interface SystemInfo { + /** + * Device Brand + * + * @type { string } + * @readonly + * @syscap SystemCapability.AtomicserviceComponent.atomicservice + * @StageModelOnly + * @atomicservice + * @since 5.0.0(12) + */ + brand?: string; + /** + * Device Model + * + * @type { string } + * @readonly + * @syscap SystemCapability.AtomicserviceComponent.atomicservice + * @StageModelOnly + * @atomicservice + * @since 5.0.0(12) + */ + deviceModel?: string; + /** + * Screen Width + * + * @type { number } + * @readonly + * @syscap SystemCapability.AtomicserviceComponent.atomicservice + * @StageModelOnly + * @atomicservice + * @since 5.0.0(12) + */ + screenWidth?: number; + /** + * Screen Height + * + * @type { number } + * @readonly + * @syscap SystemCapability.AtomicserviceComponent.atomicservice + * @StageModelOnly + * @atomicservice + * @since 5.0.0(12) + */ + screenHeight?: number; + /** + * Status bar height + * + * @type { number } + * @readonly + * @syscap SystemCapability.AtomicserviceComponent.atomicservice + * @StageModelOnly + * @atomicservice + * @since 5.0.0(12) + */ + statusBarHeight?: number; + /** + * Screen security zone + * + * @type { window.AvoidArea } + * @readonly + * @syscap SystemCapability.AtomicserviceComponent.atomicservice + * @StageModelOnly + * @atomicservice + * @since 5.0.0(12) + */ + screenSafeArea?: window.AvoidArea; + /** + * Current system language + * + * @type { string } + * @readonly + * @syscap SystemCapability.AtomicserviceComponent.atomicservice + * @StageModelOnly + * @atomicservice + * @since 5.0.0(12) + */ + language?: string; + /** + * Operating system version + * + * @type { string } + * @readonly + * @syscap SystemCapability.AtomicserviceComponent.atomicservice + * @StageModelOnly + * @atomicservice + * @since 5.0.0(12) + */ + osFullName?: string; + /** + * System Font Size + * + * @type { number } + * @readonly + * @syscap SystemCapability.AtomicserviceComponent.atomicservice + * @StageModelOnly + * @atomicservice + * @since 5.0.0(12) + */ + fontSizeSetting?: number; + /** + * SDK Api Version + * + * @type { number } + * @readonly + * @syscap SystemCapability.AtomicserviceComponent.atomicservice + * @StageModelOnly + * @atomicservice + * @since 5.0.0(12) + */ + sdkApiVersion?: number; + /** + * Bluetooth switch + * + * @type { boolean } + * @readonly + * @syscap SystemCapability.AtomicserviceComponent.atomicservice + * @StageModelOnly + * @atomicservice + * @since 5.0.0(12) + */ + bluetoothEnabled?: boolean; + /** + * Location switch + * + * @type { boolean } + * @readonly + * @syscap SystemCapability.AtomicserviceComponent.atomicservice + * @StageModelOnly + * @atomicservice + * @since 5.0.0(12) + */ + locationEnabled?: boolean; + /** + * Wi-Fi switch + * + * @type { boolean } + * @readonly + * @syscap SystemCapability.AtomicserviceComponent.atomicservice + * @StageModelOnly + * @atomicservice + * @since 5.0.0(12) + */ + wifiEnabled?: boolean; + /** + * Device orientation + * + * @type { string } + * @readonly + * @syscap SystemCapability.AtomicserviceComponent.atomicservice + * @StageModelOnly + * @atomicservice + * @since 5.0.0(12) + */ + deviceOrientation?: string; + /** + * System current theme + * + * @type { ColorMode } + * @readonly + * @syscap SystemCapability.AtomicserviceComponent.atomicservice + * @StageModelOnly + * @atomicservice + * @since 5.0.0(12) + */ + theme?: ColorMode; + /** + * Usable Window Width + * + * @type { number } + * @readonly + * @syscap SystemCapability.AtomicserviceComponent.atomicservice + * @StageModelOnly + * @atomicservice + * @since 5.0.0(12) + */ + windowWidth?: number; + /** + * Usable Window Height + * + * @type { number } + * @readonly + * @syscap SystemCapability.AtomicserviceComponent.atomicservice + * @StageModelOnly + * @atomicservice + * @since 5.0.0(12) + */ + windowHeight?: number; + } + /** + * Types of SystemInfo. + * @syscap SystemCapability.AtomicserviceComponent.atomicservice + * @StageModelOnly + * @atomicservice + * @since 5.0.0(12) + */ + export type SystemInfoType = + /** + * Type for device brand. + * + * @syscap SystemCapability.AtomicserviceComponent.atomicservice + * @StageModelOnly + * @atomicservice + * @since 5.0.0(12) + */ + 'brand' + /** + * Type for device model. + * + * @syscap SystemCapability.AtomicserviceComponent.atomicservice + * @StageModelOnly + * @atomicservice + * @since 5.0.0(12) + */ + | 'deviceModel' + /** + * Type for device screen width. + * + * @syscap SystemCapability.AtomicserviceComponent.atomicservice + * @StageModelOnly + * @atomicservice + * @since 5.0.0(12) + */ + | 'screenWidth' + /** + * Type for device screen height. + * + * @syscap SystemCapability.AtomicserviceComponent.atomicservice + * @StageModelOnly + * @atomicservice + * @since 5.0.0(12) + */ + | 'screenHeight' + /** + * Type for status bar height. + * + * @syscap SystemCapability.AtomicserviceComponent.atomicservice + * @StageModelOnly + * @atomicservice + * @since 5.0.0(12) + */ + | 'statusBarHeight' + /** + * Type for device screen security zone. + * + * @syscap SystemCapability.AtomicserviceComponent.atomicservice + * @StageModelOnly + * @atomicservice + * @since 5.0.0(12) + */ + | 'screenSafeArea' + /** + * Type for system language. + * + * @syscap SystemCapability.AtomicserviceComponent.atomicservice + * @StageModelOnly + * @atomicservice + * @since 5.0.0(12) + */ + | 'language' + /** + * Type for operating system version. + * + * @syscap SystemCapability.AtomicserviceComponent.atomicservice + * @StageModelOnly + * @atomicservice + * @since 5.0.0(12) + */ + | 'osFullName' + /** + * Type for system font size. + * + * @syscap SystemCapability.AtomicserviceComponent.atomicservice + * @StageModelOnly + * @atomicservice + * @since 5.0.0(12) + */ + | 'fontSizeSetting' + /** + * Type for SDK api version. + * + * @syscap SystemCapability.AtomicserviceComponent.atomicservice + * @StageModelOnly + * @atomicservice + * @since 5.0.0(12) + */ + | 'sdkApiVersion' + /** + * Type for bluetooth switch. + * + * @syscap SystemCapability.AtomicserviceComponent.atomicservice + * @StageModelOnly + * @atomicservice + * @since 5.0.0(12) + */ + | 'bluetoothEnabled' + /** + * Type for location switch. + * + * @syscap SystemCapability.AtomicserviceComponent.atomicservice + * @StageModelOnly + * @atomicservice + * @since 5.0.0(12) + */ + | 'locationEnabled' + /** + * Type for Wi-Fi switch. + * + * @syscap SystemCapability.AtomicserviceComponent.atomicservice + * @StageModelOnly + * @atomicservice + * @since 5.0.0(12) + */ + | 'wifiEnabled' + /** + * Type for device orientation. + * + * @syscap SystemCapability.AtomicserviceComponent.atomicservice + * @StageModelOnly + * @atomicservice + * @since 5.0.0(12) + */ + | 'deviceOrientation' + /** + * Type for system current theme. + * + * @syscap SystemCapability.AtomicserviceComponent.atomicservice + * @StageModelOnly + * @atomicservice + * @since 5.0.0(12) + */ + | 'theme' + /** + * Type for device usable window width. + * + * @syscap SystemCapability.AtomicserviceComponent.atomicservice + * @StageModelOnly + * @atomicservice + * @since 5.0.0(12) + */ + | 'windowWidth' + /** + * Type for device usable window height. + * + * @syscap SystemCapability.AtomicserviceComponent.atomicservice + * @StageModelOnly + * @atomicservice + * @since 5.0.0(12) + */ + | 'windowHeight'; + /** + * Type of SystemSetting. + * @syscap SystemCapability.AtomicserviceComponent.atomicservice + * @StageModelOnly + * @atomicservice + * @since 5.0.0(12) + */ + export type SystemSettingType = + /** + * Type for bluetooth switch. + * + * @syscap SystemCapability.AtomicserviceComponent.atomicservice + * @StageModelOnly + * @atomicservice + * @since 5.0.0(12) + */ + 'bluetoothEnabled' + /** + * Type for location switch. + * + * @syscap SystemCapability.AtomicserviceComponent.atomicservice + * @StageModelOnly + * @atomicservice + * @since 5.0.0(12) + */ + | 'locationEnabled' + /** + * Type for Wi-Fi switch. + * + * @syscap SystemCapability.AtomicserviceComponent.atomicservice + * @StageModelOnly + * @atomicservice + * @since 5.0.0(12) + */ + | 'wifiEnabled' + /** + * Type for device orientation. + * + * @syscap SystemCapability.AtomicserviceComponent.atomicservice + * @StageModelOnly + * @atomicservice + * @since 5.0.0(12) + */ + | 'deviceOrientation'; + /** + * Obtains system information such as the device, network status, screen, language, and theme. + * @param { Array } properties - Indicates the list of parameters to be obtained. This parameter + * can be null or empty. + * @returns { SystemInfo } + * @syscap SystemCapability.AtomicserviceComponent.atomicservice + * @StageModelOnly + * @atomicservice + * @since 5.0.0(12) + */ + function getSystemInfoSync(properties?: Array): SystemInfo; + /** + * Obtains system information such as the device, network status, screen, language, and theme. + * @param { Array } properties - Indicates the list of parameters to be obtained. This parameter can + * be null or empty. + * @returns { Promise } + * @syscap SystemCapability.AtomicserviceComponent.atomicservice + * @StageModelOnly + * @atomicservice + * @since 5.0.0(12) + */ + function getSystemInfo(properties?: Array): Promise; + /** + * Obtains system information, including Bluetooth, location, Wi-Fi status, and device direction information. + * @param { Array } properties - Indicates the list of parameters to be obtained. This parameter + * can be null or empty. + * @returns { SystemSettingInfo } + * @syscap SystemCapability.AtomicserviceComponent.atomicservice + * @StageModelOnly + * @atomicservice + * @since 5.0.0(12) + */ + function getSystemSetting(properties?: Array): SystemSettingInfo; +} +export default atomicService; diff --git a/language/arkts/extractor/sdk/hms/ets/api/@hms.core.atomicserviceComponent.atomicserviceUi.d.ets b/language/arkts/extractor/sdk/hms/ets/api/@hms.core.atomicserviceComponent.atomicserviceUi.d.ets new file mode 100755 index 00000000..57b0d447 --- /dev/null +++ b/language/arkts/extractor/sdk/hms/ets/api/@hms.core.atomicserviceComponent.atomicserviceUi.d.ets @@ -0,0 +1,1233 @@ +/* + * Copyright (c) Huawei Technologies Co., Ltd. 2023-2023. All rights reserved. + */ +/** + * @file Defines a UI component used to show the FunctionalButton. + * @kit ScenarioFusionKit + */ +import type { AsyncCallback } from '@ohos.base'; +/** + * Defines a UI component used to show the FunctionalButton. + * @syscap SystemCapability.AtomicserviceComponent.UIComponent + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ +@Component +export declare struct FunctionalButton { + /** + * Defines FunctionalButton Params. + * @syscap SystemCapability.AtomicserviceComponent.UIComponent + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + @Prop + params: functionalButtonComponentManager.FunctionalButtonParams; + /** + * Defines the controller to interact with FunctionalButton. + * @syscap SystemCapability.AtomicserviceComponent.UIComponent + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + controller: functionalButtonComponentManager.FunctionalButtonController; + /** + * Constructor used to create a FunctionalButton object. + * @syscap SystemCapability.AtomicserviceComponent.UIComponent + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + build(): void; +} +/** + * Defines the business logic of the FunctionalButton component. + * @namespace functionalButtonComponentManager + * @syscap SystemCapability.AtomicserviceComponent.UIComponent + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ +export declare namespace functionalButtonComponentManager { + /** + * Enumerates the FunctionalButton types. + * @enum { number } + * @syscap SystemCapability.AtomicserviceComponent.UIComponent + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + export enum OpenType { + /** + * Default value, to get the phone number. + * @syscap SystemCapability.AtomicserviceComponent.UIComponent + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + GET_PHONE_NUMBER = 0, + /** + * To get the phone number in real-time. + * @syscap SystemCapability.AtomicserviceComponent.UIComponent + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + GET_REALTIME_PHONENUMBER = 1, + /** + * To launch app. + * @syscap SystemCapability.AtomicserviceComponent.UIComponent + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + LAUNCH_APP = 2, + /** + * To open the setting app. + * @syscap SystemCapability.AtomicserviceComponent.UIComponent + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + OPEN_SETTING = 3, + /** + * To choose the avatar. + * @syscap SystemCapability.AtomicserviceComponent.UIComponent + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + CHOOSE_AVATAR = 4, + /** + * To choose the address. + * @syscap SystemCapability.AtomicserviceComponent.UIComponent + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + CHOOSE_ADDRESS = 5, + /** + * To choose the invoice title. + * @syscap SystemCapability.AtomicserviceComponent.UIComponent + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + CHOOSE_INVOICE_TITLE = 6, + /** + * To choose the location. + * @syscap SystemCapability.AtomicserviceComponent.UIComponent + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + CHOOSE_LOCATION = 9 + } + /** + * Enumerates types of FunctionalButton size. + * @enum { number } + * @syscap SystemCapability.AtomicserviceComponent.UIComponent + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + export enum SizeType { + /** + * Default size of FunctionalButton. + * @syscap SystemCapability.AtomicserviceComponent.UIComponent + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + DEFAULT = 0, + /** + * Min size of FunctionalButton. + * @syscap SystemCapability.AtomicserviceComponent.UIComponent + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + MINI = 1 + } + /** + * Enumerates types of Button press style. + * @enum { number } + * @syscap SystemCapability.AtomicserviceComponent.UIComponent + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + export enum HoverClassType { + /** + * Click effect off. + * @syscap SystemCapability.AtomicserviceComponent.UIComponent + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + NONE = 0, + /** + * Click effect on. + * @syscap SystemCapability.AtomicserviceComponent.UIComponent + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + HOVER_CLASS = 1 + } + /** + * Enumerates color types of Button color. + * @enum { number } + * @syscap SystemCapability.AtomicserviceComponent.UIComponent + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + export enum ColorType { + /** + * Blue color type. + * @syscap SystemCapability.AtomicserviceComponent.UIComponent + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + DEFAULT = 0, + /** + * Green color type. + * @syscap SystemCapability.AtomicserviceComponent.UIComponent + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + PRIMARY = 1, + /** + * Red color type. + * @syscap SystemCapability.AtomicserviceComponent.UIComponent + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + WARN = 2 + } + /** + * Enumerates certification types. + * @enum { number } + * @syscap SystemCapability.AtomicserviceComponent.UIComponent + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + export enum CredentialType { + /** + * ID Card type. + * @syscap SystemCapability.AtomicserviceComponent.UIComponent + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + IDCard = 0 + } + /** + * Defines the real name authentication info. + * @typedef RealNameAuthenticationInfo + * @syscap SystemCapability.AtomicserviceComponent.UIComponent + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + export interface RealNameAuthenticationInfo { + /** + * openID. + * @type { string } + * @syscap SystemCapability.AtomicserviceComponent.UIComponent + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + openID: string; + /** + * name. + * @type { string } + * @syscap SystemCapability.AtomicserviceComponent.UIComponent + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + realName: string; + /** + * ID Number. + * @type { Uint8Array } + * @syscap SystemCapability.AtomicserviceComponent.UIComponent + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + credentialID: Uint8Array; + /** + * ID Type. + * @type { ?CredentialType } + * @syscap SystemCapability.AtomicserviceComponent.UIComponent + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + credentialType?: CredentialType; + } + /** + * Defines style option of button. + * @typedef StyleOption + * @syscap SystemCapability.AtomicserviceComponent.UIComponent + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + export interface StyleOption { + /** + * Size of button. + * @type { ?SizeType } + * @syscap SystemCapability.AtomicserviceComponent.UIComponent + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + size?: SizeType; + /** + * Background color of button. + * @type { ?ColorType } + * @syscap SystemCapability.AtomicserviceComponent.UIComponent + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + bgColor?: ColorType; + /** + * Plain of button. + * @type { ?boolean } + * @syscap SystemCapability.AtomicserviceComponent.UIComponent + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + plain?: boolean; + /** + * Disable of button. + * @type { ?boolean } + * @syscap SystemCapability.AtomicserviceComponent.UIComponent + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + disabled?: boolean; + /** + * Loadingprogress of button. + * @type { ?boolean } + * @syscap SystemCapability.AtomicserviceComponent.UIComponent + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + loading?: boolean; + /** + * Click effect of button. + * @type { ?HoverClassType } + * @syscap SystemCapability.AtomicserviceComponent.UIComponent + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + hoverClass?: HoverClassType; + /** + * The time when the click effect appears after clicking. + * @type { ?number } + * @syscap SystemCapability.AtomicserviceComponent.UIComponent + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + hoverStartTime?: number; + /** + * The delay in the disappearance of the click effect after clicking. + * @type { ?number } + * @syscap SystemCapability.AtomicserviceComponent.UIComponent + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + hoverStayTime?: number; + /** + * The property controller of button style config json. + * @type { ?ButtonConfig } + * @syscap SystemCapability.AtomicserviceComponent.UIComponent + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + styleConfig?: ButtonConfig; + } + /** + * Defines params of button. + * @typedef FunctionalButtonParams + * @syscap SystemCapability.AtomicserviceComponent.UIComponent + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + export interface FunctionalButtonParams { + /** + * Operation of button. + * @type { OpenType } + * @syscap SystemCapability.AtomicserviceComponent.UIComponent + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + openType: OpenType; + /** + * Label of button. + * @type { ResourceStr } + * @syscap SystemCapability.AtomicserviceComponent.UIComponent + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + label: ResourceStr; + /** + * Style option of button. + * @type { ?StyleOption } + * @syscap SystemCapability.AtomicserviceComponent.UIComponent + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + styleOption?: StyleOption; + /** + * The app Params of button to launch App. + * @type { ?AppParam } + * @syscap SystemCapability.AtomicserviceComponent.UIComponent + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + appParam?: AppParam; + /** + * The info of button to real name authentication. + * @type { ?RealNameAuthenticationInfo } + * @syscap SystemCapability.AtomicserviceComponent.UIComponent + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + realNameAuthenticationInfo?: RealNameAuthenticationInfo; + } + /** + * Defines the return body for getting phone number. + * @typedef GetPhoneNumberResult + * @syscap SystemCapability.AtomicserviceComponent.UIComponent + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + export interface GetPhoneNumberResult { + /** + * AuthCode. + * @type { ?string } + * @readonly + * @syscap SystemCapability.AtomicserviceComponent.UIComponent + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + code?: string; + } + /** + * Defines the return body for getting real time phone number. + * @typedef GetRealtimePhoneNumberResult + * @syscap SystemCapability.AtomicserviceComponent.UIComponent + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + export interface GetRealtimePhoneNumberResult { + /** + * AuthCode. + * @type { ?string } + * @readonly + * @syscap SystemCapability.AtomicserviceComponent.UIComponent + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + code?: string; + } + /** + * Defines the return body for opening setting. + * @typedef OpenSettingResult + * @syscap SystemCapability.AtomicserviceComponent.UIComponent + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + export interface OpenSettingResult { + /** + * Permissions map. + * @type { ?Map } + * @readonly + * @syscap SystemCapability.AtomicserviceComponent.UIComponent + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + permissions?: Map; + } + /** + * Defines the return body for choosing Avatar. + * @typedef ChooseAvatarResult + * @syscap SystemCapability.AtomicserviceComponent.UIComponent + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + export interface ChooseAvatarResult { + /** + * Avatar URI for the avatar. + * @type { ?string } + * @readonly + * @syscap SystemCapability.AtomicserviceComponent.UIComponent + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + avatarUri?: string; + } + /** + * Defines the params for Launch App. + * @typedef AppParam + * @syscap SystemCapability.AtomicserviceComponent.UIComponent + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + export interface AppParam { + /** + * BundleName. + * @type { ResourceStr } + * @syscap SystemCapability.AtomicserviceComponent.UIComponent + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + bundleName: ResourceStr; + /** + * AbilityName. + * @type { ?ResourceStr } + * @syscap SystemCapability.AtomicserviceComponent.UIComponent + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + abilityName?: ResourceStr; + } + /** + * Defines the return body for choosing address. + * @typedef ChooseAddressResult + * @syscap SystemCapability.AtomicserviceComponent.UIComponent + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + export interface ChooseAddressResult { + /** + * User name. + * @type { string } + * @readonly + * @syscap SystemCapability.AtomicserviceComponent.UIComponent + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + userName: string; + /** + * Mobile phone number. + * @type { ?string } + * @readonly + * @syscap SystemCapability.AtomicserviceComponent.UIComponent + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + mobileNumber?: string; + /** + * Landline phone number. + * @type {?string} + * @readonly + * @syscap SystemCapability.AtomicserviceComponent.UIComponent + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + telNumber?: string; + /** + * Zip code. + * @type {?string} + * @readonly + * @syscap SystemCapability.AtomicserviceComponent.UIComponent + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + zipCode?: string; + /** + * Country/Region code. + * @type { ?string } + * @readonly + * @syscap SystemCapability.AtomicserviceComponent.UIComponent + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + countryCode?: string; + /** + * Province name. + * @type { ?string } + * @readonly + * @syscap SystemCapability.AtomicserviceComponent.UIComponent + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + provinceName?: string; + /** + * City name. + * @type { ?string } + * @readonly + * @syscap SystemCapability.AtomicserviceComponent.UIComponent + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + cityName?: string; + /** + * District name. + * @type { ?string } + * @readonly + * @syscap SystemCapability.AtomicserviceComponent.UIComponent + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + districtName?: string; + /** + * Street Name. + * @type { ?string } + * @readonly + * @syscap SystemCapability.AtomicserviceComponent.UIComponent + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + streetName?: string; + /** + * Detailed address. + * @type { string } + * @readonly + * @syscap SystemCapability.AtomicserviceComponent.UIComponent + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + detailedAddress: string; + } + /** + * Defines the return body for choose Invoice Title. + * @typedef ChooseInvoiceTitleResult + * @syscap SystemCapability.AtomicserviceComponent.UIComponent + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + export interface ChooseInvoiceTitleResult { + /** + * Invoice type. + * @type { string } + * @readonly + * @syscap SystemCapability.AtomicserviceComponent.UIComponent + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + type: string; + /** + * Invoice title. + * @type { string } + * @readonly + * @syscap SystemCapability.AtomicserviceComponent.UIComponent + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + title: string; + /** + * Tax number. + * @type { string } + * @readonly + * @syscap SystemCapability.AtomicserviceComponent.UIComponent + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + taxNumber: string; + /** + * Company address. + * @type { ?string } + * @readonly + * @syscap SystemCapability.AtomicserviceComponent.UIComponent + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + companyAddress?: string; + /** + * Telephone number. + * @type { ?string } + * @readonly + * @syscap SystemCapability.AtomicserviceComponent.UIComponent + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + telephone?: string; + /** + * Bank Name. + * @type { ?string } + * @readonly + * @syscap SystemCapability.AtomicserviceComponent.UIComponent + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + bankName?: string; + /** + * Bank account. + * @type { ?string } + * @readonly + * @syscap SystemCapability.AtomicserviceComponent.UIComponent + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + bankAccount?: string; + } + /** + * Define the return body for choose Location result. + * @typedef ChooseLocationResult + * @syscap SystemCapability.AtomicserviceComponent.UIComponent + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + export interface ChooseLocationResult { + /** + * If no poiId, use name as location name. + * @type { string } + * @readonly + * @syscap SystemCapability.AtomicserviceComponent.UIComponent + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + name: string; + /** + * longitude. + * @type { number } + * @readonly + * @syscap SystemCapability.AtomicserviceComponent.UIComponent + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + longitude: number; + /** + * latitude. + * @type { number } + * @readonly + * @syscap SystemCapability.AtomicserviceComponent.UIComponent + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + latitude: number; + /** + * address. + * @type { string } + * @readonly + * @syscap SystemCapability.AtomicserviceComponent.UIComponent + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + address: string; + } + /** + * Defines the controller to interact with the button. + * @syscap SystemCapability.AtomicserviceComponent.UIComponent + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + export class FunctionalButtonController { + /** + * Registers a callback to return the get phone number result. + * @param { AsyncCallback } callback - Callback invoked to return the get phone number + * response. + * AsyncCallback param err { BusinessError } Error code returned when get phone number fails. + * AsyncCallback param data { GetPhoneNumberResult } Response returned when the get phone number is successful. + * @returns { FunctionalButtonController } Returns the current controller instance. + * @syscap SystemCapability.AtomicserviceComponent.UIComponent + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + onGetPhoneNumber(callback: AsyncCallback): FunctionalButtonController; + /** + * Registers a callback to return the get realtime phoneNumber result. + * @param { AsyncCallback } callback - Callback invoked to return the get + * realtime phone number response. + * AsyncCallback param err { BusinessError } Error code returned when get realtime phoneNumber fails. + * AsyncCallback param data { GetRealtimePhoneNumberResult } Response returned when the get realtime + * phone number is successful. + * @returns { FunctionalButtonController } Returns the current controller instance. + * @syscap SystemCapability.AtomicserviceComponent.UIComponent + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + onGetRealtimePhoneNumber(callback: AsyncCallback): FunctionalButtonController; + /** + * Registers a callback to return the launch app result. + * @param { AsyncCallback } callback - Callback invoked to return the launch app response. + * AsyncCallback param err { BusinessError } Error code returned when launch app fails. + * @returns { FunctionalButtonController } Returns the current controller instance. + * @syscap SystemCapability.AtomicserviceComponent.UIComponent + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + onLaunchApp(callback: AsyncCallback): FunctionalButtonController; + /** + * Registers a callback to return the open setting result. + * @param { AsyncCallback } callback - Callback invoked to return the open setting response. + * AsyncCallback param err { BusinessError } Error code returned when open setting fails. + * AsyncCallback param data { OpenSettingResult } Response returned when the open setting is successful. + * @returns { FunctionalButtonController } Returns the current controller instance. + * @syscap SystemCapability.AtomicserviceComponent.UIComponent + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + onOpenSetting(callback: AsyncCallback): FunctionalButtonController; + /** + * Registers a callback to return the choose avatar result. + * @param { AsyncCallback } callback - Callback invoked to return the choose avatar + * response. + * AsyncCallback param err { BusinessError } Error code returned when choose avatar fails. + * AsyncCallback param data { ChooseAvatarResult } Response returned when the choose avatar is successful. + * @returns { FunctionalButtonController } Returns the current controller instance. + * @syscap SystemCapability.AtomicserviceComponent.UIComponent + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + onChooseAvatar(callback: AsyncCallback): FunctionalButtonController; + /** + * Registers a callback to return the choose address result. + * @param { AsyncCallback } callback - Callback invoked to return the choose address + * response. + * AsyncCallback param err { BusinessError } Error code returned when choose address fails. + * AsyncCallback param data { ChooseAddressResult } Response returned when the choose address success. + * @returns { FunctionalButtonController } Returns the current controller instance. + * @syscap SystemCapability.AtomicserviceComponent.UIComponent + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + onChooseAddress(callback: AsyncCallback): FunctionalButtonController; + /** + * Registers a callback to return the choose invoice title result. + * @param { AsyncCallback } callback - Callback invoked to return the choose invoice + * title response. + * AsyncCallback param err { BusinessError } Error code returned when choose invoice title fails. + * AsyncCallback param data { ChooseInvoiceTitleResult } Response returned when the choose invoice title + * success. + * @returns { FunctionalButtonController } Returns the current controller instance. + * @syscap SystemCapability.AtomicserviceComponent.UIComponent + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + onChooseInvoiceTitle(callback: AsyncCallback): FunctionalButtonController; + /** + * Registers a callback to return the choose location result. + * @param { AsyncCallback } callback - Callback invoked to return the choose location + * title response. + * AsyncCallback param err { BusinessError } Error code returned when choose location fails. + * AsyncCallback param data { ChooseLocationResult } Response returned when the choose location success. + * @returns { FunctionalButtonController } Returns the current controller instance. + * @syscap SystemCapability.AtomicserviceComponent.UIComponent + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + onChooseLocation(callback: AsyncCallback): FunctionalButtonController; + } + /** + * Defines the controller to interact with the button property. + * @syscap SystemCapability.AtomicserviceComponent.UIComponent + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + export class ButtonConfig { + /** + * The type attribute of the Button. + * @param { ButtonType } value - The type attribute of the Button. + * @returns { ButtonConfig } Returns the current controller instance. + * @syscap SystemCapability.AtomicserviceComponent.UIComponent + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + type(value: ButtonType): ButtonConfig; + /** + * The stateEffect attribute of the Button. + * @param { boolean } value - The stateEffect attribute of the Button. + * @returns { ButtonConfig } Returns the current controller instance. + * @syscap SystemCapability.AtomicserviceComponent.UIComponent + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + stateEffect(value: boolean): ButtonConfig; + /** + * The fontColor attribute of the Button. + * @param { ResourceColor } value - The fontColor attribute of the Button. + * @returns { ButtonConfig } Returns the current controller instance. + * @syscap SystemCapability.AtomicserviceComponent.UIComponent + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + fontColor(value: ResourceColor): ButtonConfig; + /** + * The fontSize attribute of the Button. + * @param { Length } value - The fontSize attribute of the Button. + * @returns { ButtonConfig } Returns the current controller instance. + * @syscap SystemCapability.AtomicserviceComponent.UIComponent + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + fontSize(value: Length): ButtonConfig; + /** + * The fontWeight attribute of the Button. + * @param { string | number | FontWeight } value - The fontWeight attribute of the Button. + * @returns { ButtonConfig } Returns the current controller instance. + * @syscap SystemCapability.AtomicserviceComponent.UIComponent + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + fontWeight(value: string | number | FontWeight): ButtonConfig; + /** + * The fontStyle attribute of the Button. + * @param { FontStyle } value - The fontStyle attribute of the Button. + * @returns { ButtonConfig } Returns the current controller instance. + * @syscap SystemCapability.AtomicserviceComponent.UIComponent + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + fontStyle(value: FontStyle): ButtonConfig; + /** + * The fontFamily attribute of the Button. + * @param { string | Resource } value - The fontFamily attribute of the Button. + * @returns { ButtonConfig } Returns the current controller instance. + * @syscap SystemCapability.AtomicserviceComponent.UIComponent + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + fontFamily(value: string | Resource): ButtonConfig; + /** + * The width attribute of the Button. + * @param { Length } value - The width attribute of the Button. + * @returns { ButtonConfig } Returns the current controller instance. + * @syscap SystemCapability.AtomicserviceComponent.UIComponent + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + width(value: Length): ButtonConfig; + /** + * The height attribute of the Button. + * @param { Length } value - The height attribute of the Button. + * @returns { ButtonConfig } Returns the current controller instance. + * @syscap SystemCapability.AtomicserviceComponent.UIComponent + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + height(value: Length): ButtonConfig; + /** + * The size attribute of the Button. + * @param { SizeOptions } value - The size attribute of the Button. + * @returns { ButtonConfig } Returns the current controller instance. + * @syscap SystemCapability.AtomicserviceComponent.UIComponent + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + size(value: SizeOptions): ButtonConfig; + /** + * The constraintSize attribute of the Button. + * @param { ConstraintSizeOptions } value - The constraintSize attribute of the Button. + * @returns { ButtonConfig } Returns the current controller instance. + * @syscap SystemCapability.AtomicserviceComponent.UIComponent + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + constraintSize(value: ConstraintSizeOptions): ButtonConfig; + /** + * The padding attribute of the Button. + * @param { Length | Padding } value - The padding attribute of the Button. + * @returns { ButtonConfig } Returns the current controller instance. + * @syscap SystemCapability.AtomicserviceComponent.UIComponent + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + padding(value: Length | Padding): ButtonConfig; + /** + * The margin attribute of the Button. + * @param { Length | Padding } value - The margin attribute of the Button. + * @returns { ButtonConfig } Returns the current controller instance. + * @syscap SystemCapability.AtomicserviceComponent.UIComponent + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + margin(value: Length | Padding): ButtonConfig; + /** + * The backgroundColor attribute of the Button. + * @param { ResourceColor } value - The backgroundColor attribute of the Button. + * @returns { ButtonConfig } Returns the current controller instance. + * @syscap SystemCapability.AtomicserviceComponent.UIComponent + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + backgroundColor(value: ResourceColor): ButtonConfig; + /** + * The backgroundImage attribute of the Button. + * @param { ResourceStr } value - The backgroundImage src attribute of the Button. + * @param { ?ImageRepeat } repeat - The backgroundImage repeat attribute of the Button. + * @returns { ButtonConfig } Returns the current controller instance. + * @syscap SystemCapability.AtomicserviceComponent.UIComponent + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + backgroundImage(src: ResourceStr, repeat?: ImageRepeat): ButtonConfig; + /** + * The backgroundImageSize attribute of the Button. + * @param { SizeOptions | ImageSize } value - The backgroundImageSize attribute of the Button. + * @returns { ButtonConfig } Returns the current controller instance. + * @syscap SystemCapability.AtomicserviceComponent.UIComponent + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + backgroundImageSize(value: SizeOptions | ImageSize): ButtonConfig; + /** + * The backgroundImagePosition attribute of the Button. + * @param { Position | Alignment } value - The backgroundImagePosition attribute of the Button. + * @returns { ButtonConfig } Returns the current controller instance. + * @syscap SystemCapability.AtomicserviceComponent.UIComponent + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + backgroundImagePosition(value: Position | Alignment): ButtonConfig; + /** + * The opacity attribute of the Button. + * @param { number | Resource } value - The opacity attribute of the Button. + * @returns { ButtonConfig } Returns the current controller instance. + * @syscap SystemCapability.AtomicserviceComponent.UIComponent + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + opacity(value: number | Resource): ButtonConfig; + /** + * The border attribute of the Button. + * @param { BorderOptions } value - The border attribute of the Button. + * @returns { ButtonConfig } Returns the current controller instance. + * @syscap SystemCapability.AtomicserviceComponent.UIComponent + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + border(value: BorderOptions): ButtonConfig; + /** + * The borderStyle attribute of the Button. + * @param { BorderStyle | EdgeStyles } value - The borderStyle attribute of the Button. + * @returns { ButtonConfig } Returns the current controller instance. + * @syscap SystemCapability.AtomicserviceComponent.UIComponent + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + borderStyle(value: BorderStyle | EdgeStyles): ButtonConfig; + /** + * The borderWidth attribute of the Button. + * @param { Length | EdgeWidths } value - The borderWidth attribute of the Button. + * @returns { ButtonConfig } Returns the current controller instance. + * @syscap SystemCapability.AtomicserviceComponent.UIComponent + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + borderWidth(value: Length | EdgeWidths): ButtonConfig; + /** + * The borderColor attribute of the Button. + * @param { ResourceColor | EdgeColors } value - The borderColor attribute of the Button. + * @returns { ButtonConfig } Returns the current controller instance. + * @syscap SystemCapability.AtomicserviceComponent.UIComponent + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + borderColor(value: ResourceColor | EdgeColors): ButtonConfig; + /** + * The borderRadius attribute of the Button. + * @param { Length | BorderRadiuses } value - The borderRadius attribute of the Button. + * @returns { ButtonConfig } Returns the current controller instance. + * @syscap SystemCapability.AtomicserviceComponent.UIComponent + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + borderRadius(value: Length | BorderRadiuses): ButtonConfig; + /** + * The borderImage attribute of the Button. + * @param { BorderImageOption } value - The borderImage attribute of the Button. + * @returns { ButtonConfig } Returns the current controller instance. + * @syscap SystemCapability.AtomicserviceComponent.UIComponent + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + borderImage(value: BorderImageOption): ButtonConfig; + /** + * The scale attribute of the Button. + * @param { ScaleOptions } value - The scale attribute of the Button. + * @returns { ButtonConfig } Returns the current controller instance. + * @syscap SystemCapability.AtomicserviceComponent.UIComponent + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + scale(value: ScaleOptions): ButtonConfig; + /** + * The align attribute of the Button. + * @param { Alignment } value - The align attribute of the Button. + * @returns { ButtonConfig } Returns the current controller instance. + * @syscap SystemCapability.AtomicserviceComponent.UIComponent + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + align(value: Alignment): ButtonConfig; + /** + * The markAnchor attribute of the Button. + * @param { Position } value - The markAnchor attribute of the Button. + * @returns { ButtonConfig } Returns the current controller instance. + * @syscap SystemCapability.AtomicserviceComponent.UIComponent + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + markAnchor(value: Position): ButtonConfig; + /** + * The offset attribute of the Button. + * @param { Position } value - The offset attribute of the Button. + * @returns { ButtonConfig } Returns the current controller instance. + * @syscap SystemCapability.AtomicserviceComponent.UIComponent + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + offset(value: Position): ButtonConfig; + /** + * The enabled attribute of the Button. + * @param { boolean } value - The enabled attribute of the Button. + * @returns { ButtonConfig } Returns the current controller instance. + * @syscap SystemCapability.AtomicserviceComponent.UIComponent + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + enabled(value: boolean): ButtonConfig; + /** + * The loadingColor attribute of the Button. + * @param { ResourceColor } value - The loadingColor attribute of the Button. + * @returns { ButtonConfig } Returns the current controller instance. + * @syscap SystemCapability.AtomicserviceComponent.UIComponent + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + loadingColor(value: ResourceColor): ButtonConfig; + /** + * The loadingWidth attribute of the Button. + * @param { Length } value - The loadingWidth attribute of the Button. + * @returns { ButtonConfig } Returns the current controller instance. + * @syscap SystemCapability.AtomicserviceComponent.UIComponent + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + loadingWidth(value: Length): ButtonConfig; + /** + * The loadingHeight attribute of the Button. + * @param { Length } value - The loadingHeight attribute of the Button. + * @returns { ButtonConfig } Returns the current controller instance. + * @syscap SystemCapability.AtomicserviceComponent.UIComponent + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + loadingHeight(value: Length): ButtonConfig; + /** + * The loadingPadding attribute of the Button. + * @param { Length | Padding } value - The loadingPadding attribute of the Button. + * @returns { ButtonConfig } Returns the current controller instance. + * @syscap SystemCapability.AtomicserviceComponent.UIComponent + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + loadingPadding(value: Length | Padding): ButtonConfig; + /** + * The loadingMargin attribute of the Button. + * @param { Length | Padding } value - The loadingMargin attribute of the Button. + * @returns { ButtonConfig } Returns the current controller instance. + * @syscap SystemCapability.AtomicserviceComponent.UIComponent + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + loadingMargin(value: Length | Padding): ButtonConfig; + } +} diff --git a/language/arkts/extractor/sdk/hms/ets/api/@hms.core.authentication.d.ts b/language/arkts/extractor/sdk/hms/ets/api/@hms.core.authentication.d.ts new file mode 100755 index 00000000..845f85ac --- /dev/null +++ b/language/arkts/extractor/sdk/hms/ets/api/@hms.core.authentication.d.ts @@ -0,0 +1,1222 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. All rights reserved. + */ +/** + * @file Defines the authentication service of HUAWEI ID. + * @kit AccountKit + */ +import type { AsyncCallback } from '@ohos.base'; +import type common from '@ohos.app.ability.common'; +/** + * Authentication module. + * @namespace authentication + * @syscap SystemCapability.AuthenticationServices.HuaweiID.Auth + * @stagemodelonly + * @since 4.0.0(10) + */ +/** + * Authentication module. + * @namespace authentication + * @syscap SystemCapability.AuthenticationServices.HuaweiID.Auth + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ +declare namespace authentication { + /** + * The class of an authentication request. + * @syscap SystemCapability.AuthenticationServices.HuaweiID.Auth + * @stagemodelonly + * @since 4.0.0(10) + */ + /** + * The class of an authentication request. + * @syscap SystemCapability.AuthenticationServices.HuaweiID.Auth + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + class AuthenticationRequest { + } + /** + * The class of an authentication response. + * @syscap SystemCapability.AuthenticationServices.HuaweiID.Auth + * @stagemodelonly + * @since 4.0.0(10) + */ + /** + * The class of an authentication response. + * @syscap SystemCapability.AuthenticationServices.HuaweiID.Auth + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + class AuthenticationResponse { + } + /** + * The class of an authentication controller. + * @syscap SystemCapability.AuthenticationServices.HuaweiID.Auth + * @stagemodelonly + * @since 4.0.0(10) + */ + /** + * The class of an authentication controller. + * @syscap SystemCapability.AuthenticationServices.HuaweiID.Auth + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + class AuthenticationProvider { + } + /** + * Enumerates the cryptographic algorithms to be used with the JSON Web Signature (JWS). + * @enum { number } + * @syscap SystemCapability.AuthenticationServices.HuaweiID.Auth + * @stagemodelonly + * @since 4.0.0(10) + */ + /** + * Enumerates the cryptographic algorithms to be used with the JSON Web Signature (JWS). + * @enum { number } + * @syscap SystemCapability.AuthenticationServices.HuaweiID.Auth + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + export enum IdTokenSignAlgorithm { + /** + * RSASSA-PSS using SHA-256 and MGF1 with SHA-256 + * @syscap SystemCapability.AuthenticationServices.HuaweiID.Auth + * @stagemodelonly + * @since 4.0.0(10) + */ + /** + * RSASSA-PSS using SHA-256 and MGF1 with SHA-256 + * @syscap SystemCapability.AuthenticationServices.HuaweiID.Auth + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + PS256 = 1, + /** + * RSASSA-PKCS1-v1_5 using SHA-256 + * @syscap SystemCapability.AuthenticationServices.HuaweiID.Auth + * @stagemodelonly + * @since 4.0.0(10) + */ + /** + * RSASSA-PKCS1-v1_5 using SHA-256 + * @syscap SystemCapability.AuthenticationServices.HuaweiID.Auth + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + RS256 = 2 + } + /** + * Enumerates the authentication error codes returned in callback invoked after executeRequest() is called. + * @enum { number } + * @syscap SystemCapability.AuthenticationServices.HuaweiID.Auth + * @stagemodelonly + * @since 4.0.0(10) + */ + /** + * Enumerates the authentication error codes returned in callback invoked after executeRequest() is called. + * @enum { number } + * @syscap SystemCapability.AuthenticationServices.HuaweiID.Auth + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + export enum AuthenticationErrorCode { + /** + * The user has not logged in with HUAWEI ID. + * @syscap SystemCapability.AuthenticationServices.HuaweiID.Auth + * @stagemodelonly + * @since 4.0.0(10) + */ + /** + * The user has not logged in with HUAWEI ID. + * @syscap SystemCapability.AuthenticationServices.HuaweiID.Auth + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + ACCOUNT_NOT_LOGGED_IN = 1001502001, + /** + * The application is not authorized. + * @syscap SystemCapability.AuthenticationServices.HuaweiID.Auth + * @stagemodelonly + * @since 4.0.0(10) + */ + /** + * The application is not authorized. + * @syscap SystemCapability.AuthenticationServices.HuaweiID.Auth + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + APP_NOT_AUTHORIZED = 1001502002, + /** + * Invalid parameter. + * @syscap SystemCapability.AuthenticationServices.HuaweiID.Auth + * @stagemodelonly + * @since 4.0.0(10) + */ + /** + * Invalid parameter. + * @syscap SystemCapability.AuthenticationServices.HuaweiID.Auth + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + /** + * Invalid input parameter value. + * @syscap SystemCapability.AuthenticationServices.HuaweiID.Auth + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + PARAMETER_INVALID = 1001502003, + /** + * Network error. + * @syscap SystemCapability.AuthenticationServices.HuaweiID.Auth + * @stagemodelonly + * @since 4.0.0(10) + */ + /** + * Network error. + * @syscap SystemCapability.AuthenticationServices.HuaweiID.Auth + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + NETWORK_ERROR = 1001502005, + /** + * Internal error. + * @syscap SystemCapability.AuthenticationServices.HuaweiID.Auth + * @stagemodelonly + * @since 4.0.0(10) + */ + /** + * Internal error. + * @syscap SystemCapability.AuthenticationServices.HuaweiID.Auth + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + INTERNAL_ERROR = 1001502009, + /** + * Failed to check the fingerprint of the app bundle. + * @syscap SystemCapability.AuthenticationServices.HuaweiID.Auth + * @stagemodelonly + * @since 4.0.0(10) + */ + /** + * Failed to check the fingerprint of the app bundle. + * @syscap SystemCapability.AuthenticationServices.HuaweiID.Auth + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + PACKAGE_FINGERPRINT_CHECK_ERROR = 1001500001, + /** + * The user canceled the authorization. + * @syscap SystemCapability.AuthenticationServices.HuaweiID.Auth + * @stagemodelonly + * @since 4.0.0(10) + */ + /** + * The user canceled the authorization. + * @syscap SystemCapability.AuthenticationServices.HuaweiID.Auth + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + USER_CANCELED = 1001502012, + /** + * The app does not have the required scopes or permissions. + * @syscap SystemCapability.AuthenticationServices.HuaweiID.Auth + * @stagemodelonly + * @since 4.0.0(10) + */ + /** + * The app does not have the required scopes or permissions. + * @syscap SystemCapability.AuthenticationServices.HuaweiID.Auth + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + SCOPE_OR_PERMISSION_NOT_REQUESTED = 1001502014, + /** + * This error code is reported when a request is already being processed. + * This error code does not need to be handled. + * Your app needs to implement click control to prevent too many requests caused by continuous clicks. + * @syscap SystemCapability.AuthenticationServices.HuaweiID.Auth + * @stagemodelonly + * @since 4.0.0(10) + */ + /** + * This error code is reported when a request is already being processed. + * This error code does not need to be handled. + * Your app needs to implement click control to prevent too many requests caused by continuous clicks. + * @syscap SystemCapability.AuthenticationServices.HuaweiID.Auth + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + DUPLICATE_REQUEST_REJECTED = 1001500002, + /** + * The scopes or permissions are not supported. + * @syscap SystemCapability.AuthenticationServices.HuaweiID.Auth + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + SCOPE_OR_PERRMISSION_UNSUPPORTED = 1001500003 + } + /** + * Enumerates the ID types. + * @enum { number } + * @syscap SystemCapability.AuthenticationServices.HuaweiID.Auth + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + export enum IdType { + /** + * UID. + * @syscap SystemCapability.AuthenticationServices.HuaweiID.Auth + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + USER_ID = 1, + /** + * OpenID. + * @syscap SystemCapability.AuthenticationServices.HuaweiID.Auth + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + OPEN_ID = 2, + /** + * UnionID. + * @syscap SystemCapability.AuthenticationServices.HuaweiID.Auth + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + UNION_ID = 3 + } + /** + * Defines the possible values for the HUAWEI ID state of a user. + * @enum { number } + * @syscap SystemCapability.AuthenticationServices.HuaweiID.Auth + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + export enum State { + /** + * The user hasn't established a relationship with login HUAWEI ID. + * @syscap SystemCapability.AuthenticationServices.HuaweiID.Auth + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + UNLOGGED_IN = 0, + /** + * The user is authorized. + * @syscap SystemCapability.AuthenticationServices.HuaweiID.Auth + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + AUTHORIZED = 1, + /** + * The given user's authorization has been revoked and they should be signed out. + * @syscap SystemCapability.AuthenticationServices.HuaweiID.Auth + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + UNAUTHORIZED = 2 + } + /** + * Defines the request for get HUAWEI ID state. + * @typedef StateRequest + * @syscap SystemCapability.AuthenticationServices.HuaweiID.Auth + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + export interface StateRequest { + /** + * Type of the ID. + * @type { IdType } + * @syscap SystemCapability.AuthenticationServices.HuaweiID.Auth + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + idType: IdType; + /** + * ID of the user. + * @type { string } + * @syscap SystemCapability.AuthenticationServices.HuaweiID.Auth + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + idValue: string; + } + /** + * Defines the response for get HUAWEI ID state. + * @typedef StateResult + * @syscap SystemCapability.AuthenticationServices.HuaweiID.Auth + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + export interface StateResult { + /** + * Type of the state. + * @type { State } + * @syscap SystemCapability.AuthenticationServices.HuaweiID.Auth + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + state: State; + } + /** + * Defines the request for an application or an atomic service to log in with HUAWEI ID to obtain the OpenID + * and UnionID. + * @extends AuthenticationRequest + * @syscap SystemCapability.AuthenticationServices.HuaweiID.Auth + * @stagemodelonly + * @since 4.0.0(10) + */ + /** + * Defines the request for an application or an atomic service to log in with HUAWEI ID to obtain the OpenID + * and UnionID. + * @extends AuthenticationRequest + * @syscap SystemCapability.AuthenticationServices.HuaweiID.Auth + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + export class LoginWithHuaweiIDRequest extends AuthenticationRequest { + /** + * Whether the user needs to be logged in. If the value is true and user is logged out, the login + * UI will be started. In addition, the LoginWithHuaweiIDRequest must be executed in the ArkUI page context, + * or an exception will be thrown. + * If the value is false and the user is logged out, an error will be returned + * when LoginWithHuaweiIDRequest is executed. + * @type { ?boolean } + * @default true + * @syscap SystemCapability.AuthenticationServices.HuaweiID.Auth + * @stagemodelonly + * @since 4.0.0(10) + */ + /** + * Whether the user needs to be logged in. If the value is true and user is logged out, the login + * UI will be started. In addition, the LoginWithHuaweiIDRequest must be executed in the ArkUI page context, + * or an exception will be thrown. + * If the value is false and the user is logged out, an error will be returned + * when LoginWithHuaweiIDRequest is executed. + * @type { ?boolean } + * @default true + * @syscap SystemCapability.AuthenticationServices.HuaweiID.Auth + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + forceLogin?: boolean; + /** + * An opaque value used by the client to maintain the state between the request and callback + * for preventing cross-site request forgery. It will be returned without being modified in the + * corresponding credential after a successful login. + * @type { ?string } + * @syscap SystemCapability.AuthenticationServices.HuaweiID.Auth + * @stagemodelonly + * @since 4.0.0(10) + */ + /** + * An opaque value used by the client to maintain the state between the request and callback + * for preventing cross-site request forgery. It will be returned without being modified in the + * corresponding credential after a successful login. + * @type { ?string } + * @syscap SystemCapability.AuthenticationServices.HuaweiID.Auth + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + state?: string; + /** + * Nonce to be passed to the identity provider for preventing anti-replay attacks. It will be + * included in IDToken. + * @type { ?string } + * @syscap SystemCapability.AuthenticationServices.HuaweiID.Auth + * @stagemodelonly + * @since 4.0.0(10) + */ + /** + * Nonce to be passed to the identity provider for preventing anti-replay attacks. It will be + * included in IDToken. + * @type { ?string } + * @syscap SystemCapability.AuthenticationServices.HuaweiID.Auth + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + nonce?: string; + /** + * Signing algorithm used for IDToken. The default algorithm is PS256. + * @type { ?IdTokenSignAlgorithm } + * @syscap SystemCapability.AuthenticationServices.HuaweiID.Auth + * @stagemodelonly + * @since 4.0.0(10) + */ + /** + * Signing algorithm used for IDToken. The default algorithm is PS256. + * @type { ?IdTokenSignAlgorithm } + * @syscap SystemCapability.AuthenticationServices.HuaweiID.Auth + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + idTokenSignAlgorithm?: IdTokenSignAlgorithm; + } + /** + * Defines the request for an application or atomic service to ask authorization with the HUAWEI ID to apply for + * more user information. + * @extends AuthenticationRequest + * @syscap SystemCapability.AuthenticationServices.HuaweiID.Auth + * @stagemodelonly + * @since 4.0.0(10) + */ + /** + * Defines the request for an application or atomic service to ask authorization with the HUAWEI ID to apply for + * more user information. + * @extends AuthenticationRequest + * @syscap SystemCapability.AuthenticationServices.HuaweiID.Auth + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + export class AuthorizationWithHuaweiIDRequest extends AuthenticationRequest { + /** + * User information requested by the application. + * @type { ?string[] } + * @syscap SystemCapability.AuthenticationServices.HuaweiID.Auth + * @stagemodelonly + * @since 4.0.0(10) + */ + /** + * User information requested by the application. + * @type { ?string[] } + * @syscap SystemCapability.AuthenticationServices.HuaweiID.Auth + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + scopes?: string[]; + /** + * Permissions requested by the application. + * @type { ?string[] } + * @syscap SystemCapability.AuthenticationServices.HuaweiID.Auth + * @stagemodelonly + * @since 4.0.0(10) + */ + /** + * Permissions requested by the application. + * @type { ?string[] } + * @syscap SystemCapability.AuthenticationServices.HuaweiID.Auth + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + permissions?: string[]; + /** + * Whether the user needs to be logged in. If the value is true and user is logged out, the login + * UI will be started. In addition, the AuthorizationWithHuaweiIDRequest must be executed in the ArkUI page context, + * or an exception will be thrown. + * If the value is false and the user is logged out, an error will be returned when + * AuthorizationWithHuaweiIDRequest is executed. + * @type { ?boolean } + * @default true + * @syscap SystemCapability.AuthenticationServices.HuaweiID.Auth + * @stagemodelonly + * @since 4.0.0(10) + */ + /** + * Whether the user needs to be logged in. If the value is true and user is logged out, the login + * UI will be started. In addition, the AuthorizationWithHuaweiIDRequest must be executed in the ArkUI page context, + * or an exception will be thrown. + * If the value is false and the user is logged out, an error will be returned when + * AuthorizationWithHuaweiIDRequest is executed. + * @type { ?boolean } + * @default true + * @syscap SystemCapability.AuthenticationServices.HuaweiID.Auth + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + forceAuthorization?: boolean; + /** + * An opaque value used by the client to maintain the state between the request and callback for + * preventing cross-site request forgery. It will be returned without being modified in the + * corresponding credential after a successful authentication. + * @type { ?string } + * @syscap SystemCapability.AuthenticationServices.HuaweiID.Auth + * @stagemodelonly + * @since 4.0.0(10) + */ + /** + * An opaque value used by the client to maintain the state between the request and callback for + * preventing cross-site request forgery. It will be returned without being modified in the + * corresponding credential after a successful authentication. + * @type { ?string } + * @syscap SystemCapability.AuthenticationServices.HuaweiID.Auth + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + state?: string; + /** + * Nonce to be passed to the identity provider for preventing anti-replay attacks. It will be + * included in IDToken. + * @type { ?string } + * @syscap SystemCapability.AuthenticationServices.HuaweiID.Auth + * @stagemodelonly + * @since 4.0.0(10) + */ + /** + * Nonce to be passed to the identity provider for preventing anti-replay attacks. It will be + * included in IDToken. + * @type { ?string } + * @syscap SystemCapability.AuthenticationServices.HuaweiID.Auth + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + nonce?: string; + /** + * Signing algorithm used for IDToken. The default algorithm is PS256. + * @type { ?IdTokenSignAlgorithm } + * @syscap SystemCapability.AuthenticationServices.HuaweiID.Auth + * @stagemodelonly + * @since 4.0.0(10) + */ + /** + * Signing algorithm used for IDToken. The default algorithm is PS256. + * @type { ?IdTokenSignAlgorithm } + * @syscap SystemCapability.AuthenticationServices.HuaweiID.Auth + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + idTokenSignAlgorithm?: IdTokenSignAlgorithm; + } + /** + * Defines the request for an application or atomic service to cancel the scopes authorized by the HUAWEI ID service. + * @extends AuthenticationRequest + * @syscap SystemCapability.AuthenticationServices.HuaweiID.Auth + * @stagemodelonly + * @since 4.0.0(10) + */ + /** + * Defines the request for an application or atomic service to cancel the scopes authorized by the HUAWEI ID service. + * @extends AuthenticationRequest + * @syscap SystemCapability.AuthenticationServices.HuaweiID.Auth + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + export class CancelAuthorizationRequest extends AuthenticationRequest { + /** + * An opaque value used by the client to maintain the state between the request and callback for + * preventing cross-site request forgery. + * @type { ?string } + * @syscap SystemCapability.AuthenticationServices.HuaweiID.Auth + * @stagemodelonly + * @since 4.0.0(10) + */ + /** + * An opaque value used by the client to maintain the state between the request and callback for + * preventing cross-site request forgery. + * @type { ?string } + * @syscap SystemCapability.AuthenticationServices.HuaweiID.Auth + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + state?: string; + } + /** + * Defines the credential returned for a successful login with the HUAWEI ID. + * @typedef LoginWithHuaweiIDCredential + * @syscap SystemCapability.AuthenticationServices.HuaweiID.Auth + * @stagemodelonly + * @since 4.0.0(10) + */ + /** + * Defines the credential returned for a successful login with the HUAWEI ID. + * @typedef LoginWithHuaweiIDCredential + * @syscap SystemCapability.AuthenticationServices.HuaweiID.Auth + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + export interface LoginWithHuaweiIDCredential { + /** + * Token used by the application to interact with the server. + * @type { ?string } + * @syscap SystemCapability.AuthenticationServices.HuaweiID.Auth + * @stagemodelonly + * @since 4.0.0(10) + */ + /** + * Token used by the application to interact with the server. + * @type { ?string } + * @syscap SystemCapability.AuthenticationServices.HuaweiID.Auth + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + readonly authorizationCode?: string; + /** + * JSON Web Token (JWT) that ensures secure transfer of the user information to the application. + * @type { ?string } + * @syscap SystemCapability.AuthenticationServices.HuaweiID.Auth + * @stagemodelonly + * @since 4.0.0(10) + */ + /** + * JSON Web Token (JWT) that ensures secure transfer of the user information to the application. + * @type { ?string } + * @syscap SystemCapability.AuthenticationServices.HuaweiID.Auth + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + readonly idToken?: string; + /** + * OpenID associated with the HUAWEI ID. It is a unique user ID that varies with the applications used by the user. + * @type { string } + * @syscap SystemCapability.AuthenticationServices.HuaweiID.Auth + * @stagemodelonly + * @since 4.0.0(10) + */ + /** + * OpenID associated with the HUAWEI ID. It is a unique user ID that varies with the applications used by the user. + * @type { string } + * @syscap SystemCapability.AuthenticationServices.HuaweiID.Auth + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + readonly openID: string; + /** + * UnionID associated with the HUAWEI ID. It is a unique user ID that remains the same + * across the applications used by the user. + * @type { string } + * @syscap SystemCapability.AuthenticationServices.HuaweiID.Auth + * @stagemodelonly + * @since 4.0.0(10) + */ + /** + * UnionID associated with the HUAWEI ID. It is a unique user ID that remains the same + * across the applications used by the user. + * @type { string } + * @syscap SystemCapability.AuthenticationServices.HuaweiID.Auth + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + readonly unionID: string; + } + /** + * Defines the credential returned for a successful authorization of the HUAWEI ID. + * @typedef AuthorizationWithHuaweiIDCredential + * @syscap SystemCapability.AuthenticationServices.HuaweiID.Auth + * @stagemodelonly + * @since 4.0.0(10) + */ + /** + * Defines the credential returned for a successful authorization of the HUAWEI ID. + * @typedef AuthorizationWithHuaweiIDCredential + * @syscap SystemCapability.AuthenticationServices.HuaweiID.Auth + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + export interface AuthorizationWithHuaweiIDCredential { + /** + * Token used by the application to interact with the server. + * @type { ?string } + * @syscap SystemCapability.AuthenticationServices.HuaweiID.Auth + * @stagemodelonly + * @since 4.0.0(10) + */ + /** + * Token used by the application to interact with the server. + * @type { ?string } + * @syscap SystemCapability.AuthenticationServices.HuaweiID.Auth + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + readonly authorizationCode?: string; + /** + * JWT that ensures secure transfer of the user information to the app. + * @type { ?string } + * @syscap SystemCapability.AuthenticationServices.HuaweiID.Auth + * @stagemodelonly + * @since 4.0.0(10) + */ + /** + * JWT that ensures secure transfer of the user information to the app. + * @type { ?string } + * @syscap SystemCapability.AuthenticationServices.HuaweiID.Auth + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + readonly idToken?: string; + /** + * OpenID associated with the HUAWEI ID. It is a unique user ID that varies with the applications used by the user. + * @type { ?string } + * @syscap SystemCapability.AuthenticationServices.HuaweiID.Auth + * @stagemodelonly + * @since 4.0.0(10) + */ + /** + * OpenID associated with the HUAWEI ID. It is a unique user ID that varies with the applications used by the user. + * @type { ?string } + * @syscap SystemCapability.AuthenticationServices.HuaweiID.Auth + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + readonly openID?: string; + /** + * UnionID associated with the HUAWEI ID. It is a unique user ID that remains the same + * across the applications used by the user. + * @type { ?string } + * @syscap SystemCapability.AuthenticationServices.HuaweiID.Auth + * @stagemodelonly + * @since 4.0.0(10) + */ + /** + * UnionID associated with the HUAWEI ID. It is a unique user ID that remains the same + * across the applications used by the user. + * @type { ?string } + * @syscap SystemCapability.AuthenticationServices.HuaweiID.Auth + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + readonly unionID?: string; + /** + * URI of the user avatar. + * @type { ?string } + * @syscap SystemCapability.AuthenticationServices.HuaweiID.Auth + * @stagemodelonly + * @since 4.0.0(10) + */ + readonly avatarUri?: string; + /** + * Nick name of the user. + * @type { ?string } + * @syscap SystemCapability.AuthenticationServices.HuaweiID.Auth + * @stagemodelonly + * @since 4.0.0(10) + */ + readonly nickName?: string; + /** + * Email address of the user. + * @type { ?string } + * @syscap SystemCapability.AuthenticationServices.HuaweiID.Auth + * @stagemodelonly + * @since 4.0.0(10) + */ + readonly email?: string; + /** + * Information that can be accessed by the application. + * @type { ?string[] } + * @syscap SystemCapability.AuthenticationServices.HuaweiID.Auth + * @stagemodelonly + * @since 4.0.0(10) + */ + /** + * Information that can be accessed by the application. + * @type { ?string[] } + * @syscap SystemCapability.AuthenticationServices.HuaweiID.Auth + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + readonly authorizedScopes?: string[]; + /** + * Extra information of the user. + * @type { ?object } + * @syscap SystemCapability.AuthenticationServices.HuaweiID.Auth + * @stagemodelonly + * @since 4.0.0(10) + */ + /** + * Extra information of the user. + * @type { ?Record } + * @syscap SystemCapability.AuthenticationServices.HuaweiID.Auth + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + readonly extraInfo?: Record; + } + /** + * Defines the response to the login request returned by the HUAWEI ID service. + * @extends AuthenticationResponse + * @syscap SystemCapability.AuthenticationServices.HuaweiID.Auth + * @stagemodelonly + * @since 4.0.0(10) + */ + /** + * Defines the response to the login request returned by the HUAWEI ID service. + * @extends AuthenticationResponse + * @syscap SystemCapability.AuthenticationServices.HuaweiID.Auth + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + export class LoginWithHuaweiIDResponse extends AuthenticationResponse { + /** + * User credential returned by the HUAWEI ID service. + * @type { ?LoginWithHuaweiIDCredential } + * @syscap SystemCapability.AuthenticationServices.HuaweiID.Auth + * @stagemodelonly + * @since 4.0.0(10) + */ + /** + * User credential returned by the HUAWEI ID service. + * @type { ?LoginWithHuaweiIDCredential } + * @syscap SystemCapability.AuthenticationServices.HuaweiID.Auth + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + readonly data?: LoginWithHuaweiIDCredential; + /** + * An arbitrary string that the application provides to the request that generates the credential. + * @type { ?string } + * @syscap SystemCapability.AuthenticationServices.HuaweiID.Auth + * @stagemodelonly + * @since 4.0.0(10) + */ + /** + * An arbitrary string that the application provides to the request that generates the credential. + * @type { ?string } + * @syscap SystemCapability.AuthenticationServices.HuaweiID.Auth + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + readonly state?: string; + } + /** + * Defines the response to the authorization request returned by the HUAWEI ID service. + * @extends AuthenticationResponse + * @syscap SystemCapability.AuthenticationServices.HuaweiID.Auth + * @stagemodelonly + * @since 4.0.0(10) + */ + /** + * Defines the response to the authorization request returned by the HUAWEI ID service. + * @extends AuthenticationResponse + * @syscap SystemCapability.AuthenticationServices.HuaweiID.Auth + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + export class AuthorizationWithHuaweiIDResponse extends AuthenticationResponse { + /** + * User credential returned by the HUAWEI ID service. + * @type { ?AuthorizationWithHuaweiIDCredential } + * @syscap SystemCapability.AuthenticationServices.HuaweiID.Auth + * @stagemodelonly + * @since 4.0.0(10) + */ + /** + * User credential returned by the HUAWEI ID service. + * @type { ?AuthorizationWithHuaweiIDCredential } + * @syscap SystemCapability.AuthenticationServices.HuaweiID.Auth + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + readonly data?: AuthorizationWithHuaweiIDCredential; + /** + * An arbitrary string that the application provides to the request that generates the credential. + * @type { ?string } + * @syscap SystemCapability.AuthenticationServices.HuaweiID.Auth + * @stagemodelonly + * @since 4.0.0(10) + */ + /** + * An arbitrary string that the application provides to the request that generates the credential. + * @type { ?string } + * @syscap SystemCapability.AuthenticationServices.HuaweiID.Auth + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + readonly state?: string; + } + /** + * Defines the response to the request for canceling the authorization returned by the HUAWEI ID service. + * @extends AuthenticationResponse + * @syscap SystemCapability.AuthenticationServices.HuaweiID.Auth + * @stagemodelonly + * @since 4.0.0(10) + */ + /** + * Defines the response to the request for canceling the authorization returned by the HUAWEI ID service. + * @extends AuthenticationResponse + * @syscap SystemCapability.AuthenticationServices.HuaweiID.Auth + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + export class CancelAuthorizationResponse extends AuthenticationResponse { + /** + * An arbitrary string that the application provides to the request for canceling the authorization. + * @type { ?string } + * @syscap SystemCapability.AuthenticationServices.HuaweiID.Auth + * @stagemodelonly + * @since 4.0.0(10) + */ + /** + * An arbitrary string that the application provides to the request for canceling the authorization. + * @type { ?string } + * @syscap SystemCapability.AuthenticationServices.HuaweiID.Auth + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + readonly state?: string; + } + /** + * Provides methods for implementing the authentication service. + * @extends AuthenticationProvider + * @syscap SystemCapability.AuthenticationServices.HuaweiID.Auth + * @stagemodelonly + * @since 4.0.0(10) + */ + /** + * Provides methods for implementing the authentication service. + * @extends AuthenticationProvider + * @syscap SystemCapability.AuthenticationServices.HuaweiID.Auth + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + export class HuaweiIDProvider extends AuthenticationProvider { + /** + * Creates a login request with default scopes and permissions. + * Then, executeRequest() will be called. + * @returns { LoginWithHuaweiIDRequest } Returns the LoginWithHuaweiIDRequest object, + * which is passed to { AuthenticationController }. + * @syscap SystemCapability.AuthenticationServices.HuaweiID.Auth + * @stagemodelonly + * @since 4.0.0(10) + */ + /** + * Creates a login request with default scopes and permissions. + * Then, executeRequest() will be called. + * @returns { LoginWithHuaweiIDRequest } Returns the LoginWithHuaweiIDRequest object, + * which is passed to { AuthenticationController }. + * @syscap SystemCapability.AuthenticationServices.HuaweiID.Auth + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + createLoginWithHuaweiIDRequest(): LoginWithHuaweiIDRequest; + /** + * Creates an authorization request. + * You need to fill in parameters in the request. Then, executeRequest() will be called. + * @returns { AuthorizationWithHuaweiIDRequest } Returns the AuthorizationWithHuaweiIDRequest object, + * which is passed to { AuthenticationController }. + * @syscap SystemCapability.AuthenticationServices.HuaweiID.Auth + * @stagemodelonly + * @since 4.0.0(10) + */ + /** + * Creates an authorization request. + * You need to fill in parameters in the request. Then, executeRequest() will be called. + * @returns { AuthorizationWithHuaweiIDRequest } Returns the AuthorizationWithHuaweiIDRequest object, + * which is passed to { AuthenticationController }. + * @syscap SystemCapability.AuthenticationServices.HuaweiID.Auth + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + createAuthorizationWithHuaweiIDRequest(): AuthorizationWithHuaweiIDRequest; + /** + * Creates a request for canceling the authorization. + * Then, executeRequest() will be called. + * @returns { CancelAuthorizationRequest } Returns the CancelAuthorizationRequest object, + * which is passed to { AuthenticationController }. + * @syscap SystemCapability.AuthenticationServices.HuaweiID.Auth + * @stagemodelonly + * @since 4.0.0(10) + */ + /** + * Creates a request for canceling the authorization. + * Then, executeRequest() will be called. + * @returns { CancelAuthorizationRequest } Returns the CancelAuthorizationRequest object, + * which is passed to { AuthenticationController }. + * @syscap SystemCapability.AuthenticationServices.HuaweiID.Auth + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + createCancelAuthorizationRequest(): CancelAuthorizationRequest; + /** + * Get HUAWEI ID state for the given user. + * @param { StateRequest } request - Indicates the getHuaweiIDState request parameters. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 12300001 - System service works abnormally. + * @throws { BusinessError } 1001502003 - Invalid input parameter value. + * @syscap SystemCapability.AuthenticationServices.HuaweiID.Auth + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + getHuaweiIDState(request: StateRequest): Promise; + } + /** + * The class of an authentication controller. + * @syscap SystemCapability.AuthenticationServices.HuaweiID.Auth + * @stagemodelonly + * @since 4.0.0(10) + */ + /** + * The class of an authentication controller. + * @syscap SystemCapability.AuthenticationServices.HuaweiID.Auth + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + class AuthenticationController { + /** + * Constructs the specified authentication controller. + * @param { common.UIAbilityContext } context - The context of an ability. + * @syscap SystemCapability.AuthenticationServices.HuaweiID.Auth + * @stagemodelonly + * @since 4.0.0(10) + */ + /** + * Constructs the specified authentication controller. + * @param { common.Context } context - The context of an ability. + * @syscap SystemCapability.AuthenticationServices.HuaweiID.Auth + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + constructor(context?: common.Context); + /** + * Executes the specified authentication request. + * @param { AuthenticationRequest } request - Indicates the authentication request. + * @param { AsyncCallback } callback - Indicates the callback for getting the response. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 12300001 - System service works abnormally. + * @throws { BusinessError } 12300002 - Invalid parameter. + * @syscap SystemCapability.AuthenticationServices.HuaweiID.Auth + * @stagemodelonly + * @since 4.0.0(10) + */ + /** + * Executes the specified authentication request. + * @param { AuthenticationRequest } request - Indicates the authentication request. + * @param { AsyncCallback } callback - Indicates the callback for getting the response. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 12300001 - System service works abnormally. + * @throws { BusinessError } 12300002 - Invalid parameter. + * @syscap SystemCapability.AuthenticationServices.HuaweiID.Auth + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + /** + * Executes the specified authentication request. + * @param { AuthenticationRequest } request - Indicates the authentication request. + * @param { AsyncCallback> } callback - Indicates the callback for getting the response. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 12300001 - System service works abnormally. + * @throws { BusinessError } 1001502001 - The user has not logged in with HUAWEI ID. + * @throws { BusinessError } 1001502002 - The application is not authorized. + * @throws { BusinessError } 1001502003 - Invalid input parameter value. + * @throws { BusinessError } 1001502005 - Network error. + * @throws { BusinessError } 1001502009 - Internal error. + * @throws { BusinessError } 1001500001 - Failed to check the fingerprint of the app bundle. + * @throws { BusinessError } 1001502012 - The user canceled the authorization. + * @throws { BusinessError } 1001502014 - The app does not have the required scopes or permissions. + * @throws { BusinessError } 1001500002 - This error code is reported when a request is already being processed. + * @throws { BusinessError } 1001500003 - The scopes or permissions are not supported. + * @syscap SystemCapability.AuthenticationServices.HuaweiID.Auth + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + executeRequest(request: AuthenticationRequest, callback: AsyncCallback>): void; + /** + * Executes the specified authentication request. + * @param { AuthenticationRequest } request - Indicates the authentication request. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 12300001 - System service works abnormally. + * @throws { BusinessError } 12300002 - Invalid parameter. + * @syscap SystemCapability.AuthenticationServices.HuaweiID.Auth + * @stagemodelonly + * @since 4.0.0(10) + */ + /** + * Executes the specified authentication request. + * @param { AuthenticationRequest } request - Indicates the authentication request. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 12300001 - System service works abnormally. + * @throws { BusinessError } 12300002 - Invalid parameter. + * @syscap SystemCapability.AuthenticationServices.HuaweiID.Auth + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + /** + * Executes the specified authentication request. + * @param { AuthenticationRequest } request - Indicates the authentication request. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 12300001 - System service works abnormally. + * @throws { BusinessError } 1001502001 - The user has not logged in with HUAWEI ID. + * @throws { BusinessError } 1001502002 - The application is not authorized. + * @throws { BusinessError } 1001502003 - Invalid input parameter value. + * @throws { BusinessError } 1001502005 - Network error. + * @throws { BusinessError } 1001502009 - Internal error. + * @throws { BusinessError } 1001500001 - Failed to check the fingerprint of the app bundle. + * @throws { BusinessError } 1001502012 - The user canceled the authorization. + * @throws { BusinessError } 1001502014 - The app does not have the required scopes or permissions. + * @throws { BusinessError } 1001500002 - This error code is reported when a request is already being processed. + * @throws { BusinessError } 1001500003 - The scopes or permissions are not supported. + * @syscap SystemCapability.AuthenticationServices.HuaweiID.Auth + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + executeRequest(request: AuthenticationRequest): Promise; + } +} +export default authentication; diff --git a/language/arkts/extractor/sdk/hms/ets/api/@hms.core.deviceCloudGateway.cloudCommon.d.ts b/language/arkts/extractor/sdk/hms/ets/api/@hms.core.deviceCloudGateway.cloudCommon.d.ts new file mode 100755 index 00000000..0c9950f7 --- /dev/null +++ b/language/arkts/extractor/sdk/hms/ets/api/@hms.core.deviceCloudGateway.cloudCommon.d.ts @@ -0,0 +1,235 @@ +/* + * Copyright (c) Huawei Technologies Co., Ltd. 2023-2023. All rights reserved. + */ +/** + * @file Defines common parameters for CloudFoundationKit. + * @kit CloudFoundationKit + */ +import type request from '@ohos.request'; +/** + * This module provides common parameters for cloud development. + * Cloud resources are connected to AppGallery Connect. Before using the resources, you need to enable the corresponding services. + * + * @namespace cloudCommon + * @syscap SystemCapability.DeviceCloudGateway.CloudFoundation + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ +declare namespace cloudCommon { + /** + * Initialize the cloud development instance based on parameters. + * @param { ?CloudOptions } options - Parameters related to cloud development initialization. + * @throws { BusinessError } 401 - Parameter error. + * @syscap SystemCapability.DeviceCloudGateway.CloudFoundation + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + function init(options?: CloudOptions): void; + /** + * Initial Configuration. + * @typedef CloudOptions + * @syscap SystemCapability.DeviceCloudGateway.CloudFoundation + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + interface CloudOptions { + /** + * Indicates the resource storage region on the cloud. The default region is China. + * @type { ?CloudRegion } + * @syscap SystemCapability.DeviceCloudGateway.CloudFoundation + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + region?: CloudRegion; + /** + * Customized authentication credential provider. + * @type { ?AuthProvider } + * @syscap SystemCapability.DeviceCloudGateway.CloudFoundation + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + authProvider?: AuthProvider; + /** + * Parameters related to cloud function initialization. + * @type { ?FunctionOptions } + * @syscap SystemCapability.DeviceCloudGateway.CloudFoundation + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + functionOptions?: FunctionOptions; + /** + * Parameters related to cloud storage initialization. + * @type { ?StorageOptions } + * @syscap SystemCapability.DeviceCloudGateway.CloudFoundation + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + storageOptions?: StorageOptions; + /** + * Parameters related to cloud database initialization. + * @type { ?DatabaseOptions } + * @syscap SystemCapability.DeviceCloudGateway.CloudFoundation + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + databaseOptions?: DatabaseOptions; + } + /** + * Custom Authentication Provider. + * @typedef AuthProvider + * @syscap SystemCapability.DeviceCloudGateway.CloudFoundation + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + interface AuthProvider { + /** + * Returns the user credential of the customized authentication system. Each time the system interacts with the cloud, + * the system calls this interface to query the credential and carries the credential in the request body. + * @param { boolean } isForceRefresh - Need to force refresh to return latest user credentials. + * @return { Promise } Returns the user credential. It is recommended that the developer cache the credential + * and ensure that the returned value is valid. + * @syscap SystemCapability.DeviceCloudGateway.CloudFoundation + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + getAccessToken(isForceRefresh: boolean): Promise; + } + /** + * Cloud resource storage zone. + * @enum { number } + * @syscap SystemCapability.DeviceCloudGateway.CloudFoundation + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + enum CloudRegion { + /** + * storage zone: China. + * @enum { number } + * @syscap SystemCapability.DeviceCloudGateway.CloudFoundation + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + CHINA = 0, + /** + * storage zone: Germany. + * @enum { number } + * @syscap SystemCapability.DeviceCloudGateway.CloudFoundation + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + GERMANY = 1, + /** + * storage zone: Russian. + * @enum { number } + * @syscap SystemCapability.DeviceCloudGateway.CloudFoundation + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + RUSSIA = 2, + /** + * storage zone: Singapore. + * @enum { number } + * @syscap SystemCapability.DeviceCloudGateway.CloudFoundation + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + SINGAPORE = 3 + } + /** + * Initial configuration parameters of the cloud function. + * @typedef FunctionOptions + * @syscap SystemCapability.DeviceCloudGateway.CloudFoundation + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + interface FunctionOptions { + /** + * Function request timeout interval, in milliseconds. The default value is 70*1000. + * @type { ?number } + * @syscap SystemCapability.DeviceCloudGateway.CloudFoundation + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + timeout?: number; + } + /** + * Initial configuration parameters of the cloud storage. + * @typedef StorageOptions + * @syscap SystemCapability.DeviceCloudGateway.CloudFoundation + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + interface StorageOptions { + /** + * Indicates task's mode. + * The default is BACKGROUND. + * For frontend task, it has callbacks. + * For background task, it has notifications and fallback. + * + * @type { ?request.agent.Mode } + * @syscap SystemCapability.DeviceCloudGateway.CloudFoundation + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + mode?: request.agent.Mode; + /** + * The network. + * + * @type { ?request.agent.Network } + * @default Network.ANY + * @syscap SystemCapability.DeviceCloudGateway.CloudFoundation + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + network?: request.agent.Network; + } + /** + * Initial configuration parameters of the cloud database. + * @typedef DatabaseOptions + * @syscap SystemCapability.DeviceCloudGateway.CloudFoundation + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + interface DatabaseOptions { + /** + * Path of the schema configuration file downloaded from the cloud. The default value is the app-schema.json file in the rawfile directory. + * @type { ?string } + * @syscap SystemCapability.DeviceCloudGateway.CloudFoundation + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + schema?: string; + /** + * User-defined traceId, which is used to trace request operations. + * @type { ?string } + * @syscap SystemCapability.DeviceCloudGateway.CloudFoundation + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + traceId?: string; + } +} +export default cloudCommon; diff --git a/language/arkts/extractor/sdk/hms/ets/api/@hms.core.deviceCloudGateway.cloudDatabase.d.ts b/language/arkts/extractor/sdk/hms/ets/api/@hms.core.deviceCloudGateway.cloudDatabase.d.ts new file mode 100755 index 00000000..458d11f7 --- /dev/null +++ b/language/arkts/extractor/sdk/hms/ets/api/@hms.core.deviceCloudGateway.cloudDatabase.d.ts @@ -0,0 +1,536 @@ +/* + * Copyright (c) Huawei Technologies Co., Ltd. 2023-2023. All rights reserved. + */ +/** + * @file Define cloud database capabilities. + * @kit CloudFoundationKit + */ +import { AsyncCallback } from '@ohos.base'; +/** + * This module provides cloud database capabilities. + * Cloud resources are connected to AppGallery Connect. Before using the resources, you need to enable the corresponding services. + * + * @namespace cloudDatabase + * @syscap SystemCapability.DeviceCloudGateway.CloudFoundation + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ +declare namespace cloudDatabase { + /** + * Initialize the cloud database instance according to the zone name. + * @param { string } zone - zone name. + * @syscap SystemCapability.DeviceCloudGateway.CloudFoundation + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + function zone(zone: string): DatabaseZone; + /** + * Cloud database zone instance, which is used to perform operations on data in the storage area. + * @syscap SystemCapability.DeviceCloudGateway.CloudFoundation + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + class DatabaseZone { + /** + * Query the data that conform the conditions from the Cloud DB zone. + * @param { DatabaseQuery } condition - Query condition + * @return { Promise } Query result. + * @throws { BusinessError } 201 - No Internet permission. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 1008230001 - Network connection error. + * @throws { BusinessError } 1008230002 - Schema config error. + * @throws { BusinessError } 1008230003 - Natural object error. + * @throws { BusinessError } 1008230009 - Client internal error. + * @throws { BusinessError } 1008231001 - Server error. + * @syscap SystemCapability.DeviceCloudGateway.CloudFoundation + * @permission ohos.permission.INTERNET + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + query(condition: DatabaseQuery): Promise; + /** + * Query the data that conform the conditions from the Cloud DB zone. + * @param { DatabaseQuery } condition - Query condition + * @param { AsyncCallback } callback - Query result. + * @throws { BusinessError } 201 - No Internet permission. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 1008230001 - Network connection error. + * @throws { BusinessError } 1008230002 - Schema config error. + * @throws { BusinessError } 1008230003 - Natural object error. + * @throws { BusinessError } 1008230009 - Client internal error. + * @throws { BusinessError } 1008231001 - Server error. + * @syscap SystemCapability.DeviceCloudGateway.CloudFoundation + * @permission ohos.permission.INTERNET + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + query(condition: DatabaseQuery, callback: AsyncCallback): void; + /** + * Query the data that conform the conditions from the Cloud DB zone and perform arithmetic calculations on the specified fields. + * @param { DatabaseQuery } condition - Query condition + * @param { string } fieldName - Specifies the name of the field to be calculated in the query object. + * @param { QueryCalculate } calculate - calculate type. + * @return { Promise } calculate result. + * @throws { BusinessError } 201 - No Internet permission. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 1008230001 - Network connection error. + * @throws { BusinessError } 1008230002 - Schema config error. + * @throws { BusinessError } 1008230003 - Natural object error. + * @throws { BusinessError } 1008230009 - Client internal error. + * @throws { BusinessError } 1008231001 - Server error. + * @syscap SystemCapability.DeviceCloudGateway.CloudFoundation + * @permission ohos.permission.INTERNET + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + calculateQuery(condition: DatabaseQuery, fieldName: string, calculate: QueryCalculate): Promise; + /** + * Query the data that conform the conditions from the Cloud DB zone and perform arithmetic calculations on the specified fields. + * @param { DatabaseQuery } condition - Query condition + * @param { string } fieldName - Specifies the name of the field to be calculated in the query object. + * @param { QueryCalculate } calculate - calculate type. + * @param { AsyncCallback } callback - calculate result. + * @throws { BusinessError } 201 - No Internet permission. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 1008230001 - Network connection error. + * @throws { BusinessError } 1008230002 - Schema config error. + * @throws { BusinessError } 1008230003 - Natural object error. + * @throws { BusinessError } 1008230009 - Client internal error. + * @throws { BusinessError } 1008231001 - Server error. + * @syscap SystemCapability.DeviceCloudGateway.CloudFoundation + * @permission ohos.permission.INTERNET + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + calculateQuery(condition: DatabaseQuery, fieldName: string, calculate: QueryCalculate, callback: AsyncCallback): void; + /** + * Upsert one or more objects to Cloud DB zone. + * If an object with the same primary key already exists in the storage area, the existing object is updated. + * If it does not exist, one or more new objects are written. + * @param { T[] | T } objectList - One or more objects to be Upserted. + * @return { Promise } Obtains the operation result and returns the number of records that are successfully upsert. + * @throws { BusinessError } 201 - No Internet permission. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 1008230001 - Network connection error. + * @throws { BusinessError } 1008230002 - Schema config error. + * @throws { BusinessError } 1008230003 - Natural object error. + * @throws { BusinessError } 1008230009 - Client internal error. + * @throws { BusinessError } 1008231001 - Server error. + * @syscap SystemCapability.DeviceCloudGateway.CloudFoundation + * @permission ohos.permission.INTERNET + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + upsert(objectList: T[] | T): Promise; + /** + * Upsert one or more objects to Cloud DB zone. + * If an object with the same primary key already exists in the storage area, the existing object is updated. + * If it does not exist, one or more new objects are written. + * @param { T[] | T } objectList - One or more objects to be Upserted. + * @param { AsyncCallback } Obtains the operation result and returns the number of records that are successfully upsert. + * @throws { BusinessError } 201 - No Internet permission. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 1008230001 - Network connection error. + * @throws { BusinessError } 1008230002 - Schema config error. + * @throws { BusinessError } 1008230003 - Natural object error. + * @throws { BusinessError } 1008230009 - Client internal error. + * @throws { BusinessError } 1008231001 - Server error. + * @syscap SystemCapability.DeviceCloudGateway.CloudFoundation + * @permission ohos.permission.INTERNET + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + upsert(objectList: T[] | T, callback: AsyncCallback): void; + /** + * Delete one or more objects to Cloud DB zone. + * @param { T[] | T } objectList - One or more objects to be deleted. + * @return { Promise } the operation result and returns the number of records that are successfully deleted. + * @throws { BusinessError } 201 - No Internet permission. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 1008230001 - Network connection error. + * @throws { BusinessError } 1008230002 - Schema config error. + * @throws { BusinessError } 1008230003 - Natural object error. + * @throws { BusinessError } 1008230009 - Client internal error. + * @throws { BusinessError } 1008231001 - Server error. + * @syscap SystemCapability.DeviceCloudGateway.CloudFoundation + * @permission ohos.permission.INTERNET + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + delete(objectList: T[] | T): Promise; + /** + * Delete one or more objects to Cloud DB zone. + * @param { T[] | T } objectList - One or more objects to be deleted. + * @return { Promise } the operation result and returns the number of records that are successfully deleted. + * @throws { BusinessError } 201 - No Internet permission. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 1008230001 - Network connection error. + * @throws { BusinessError } 1008230002 - Schema config error. + * @throws { BusinessError } 1008230003 - Natural object error. + * @throws { BusinessError } 1008230009 - Client internal error. + * @throws { BusinessError } 1008231001 - Server error. + * @syscap SystemCapability.DeviceCloudGateway.CloudFoundation + * @permission ohos.permission.INTERNET + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + delete(objectList: T[] | T, callback: AsyncCallback): void; + } + /** + * Database data type base class, which is inherited when the table structure is generated on the cloud side. + * @syscap SystemCapability.DeviceCloudGateway.CloudFoundation + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + class DatabaseObject { + /** + * Data Type Name. + * @return { string } Data Type Name. + * @syscap SystemCapability.DeviceCloudGateway.CloudFoundation + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + naturalbase_ClassName(): string; + } + /** + * Data types supported by Cloud DB columns. + * @syscap SystemCapability.DeviceCloudGateway.CloudFoundation + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + type FieldType = string | number | boolean | Uint8Array | Date; + /** + * Database Query Calculation Type. + * @enum { number } + * @syscap SystemCapability.DeviceCloudGateway.CloudFoundation + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + enum QueryCalculate { + /** + * Calculate the average. + * @enum { number } + * @syscap SystemCapability.DeviceCloudGateway.CloudFoundation + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + AVERAGE = 0, + /** + * Calculate the sum. + * @enum { number } + * @syscap SystemCapability.DeviceCloudGateway.CloudFoundation + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + SUM = 1, + /** + * Calculate the maximum value. + * @enum { number } + * @syscap SystemCapability.DeviceCloudGateway.CloudFoundation + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + MAXIMUM = 2, + /** + * Calculate the minimum value. + * @enum { number } + * @syscap SystemCapability.DeviceCloudGateway.CloudFoundation + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + MINIMUM = 3, + /** + * Calculate the total number of records. + * @enum { number } + * @syscap SystemCapability.DeviceCloudGateway.CloudFoundation + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + COUNT = 4 + } + /** + * Provides rich predicate queries to construct query conditions. Construct your own DatabaseQuery object based on the above predicate query method. + * The cloud database will obtain the corresponding object from the storage area based on the specified query conditions and return the query result. + * @syscap SystemCapability.DeviceCloudGateway.CloudFoundation + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + class DatabaseQuery { + /** + * Set the information about the entity type to be queried. + * @param { function } entityClass - Concrete type constructor. + * @return { DatabaseQuery } The DatabaseQuery object that contains this condition. + * @syscap SystemCapability.DeviceCloudGateway.CloudFoundation + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + constructor(entityClass: new () => T); + /** + * Adds the query condition that the value of a field in the entity class is equal to the specified value. + * @param { string } fieldName - Field name in entity class. + * @param { FieldType } value - The specified value for the selected field. + * @return { DatabaseQuery } The DatabaseQuery object that contains this condition. + * @syscap SystemCapability.DeviceCloudGateway.CloudFoundation + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + equalTo(fieldName: string, value: FieldType): DatabaseQuery; + /** + * Adds the query condition that the value of a field in the entity class is not equal to the specified value. + * @param { string } fieldName - Field name in entity class. + * @param { FieldType } value - The specified value for the selected field. + * @return { DatabaseQuery } The DatabaseQuery object that contains this condition. + * @syscap SystemCapability.DeviceCloudGateway.CloudFoundation + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + notEqualTo(fieldName: string, value: FieldType): DatabaseQuery; + /** + * Adds a query condition in which the value of a field of the string type in an entity class starts with a specified substring. + * @param { string } fieldName - Field name in entity class. + * @param { FieldType } value - The specified value for the selected field. + * @return { DatabaseQuery } The DatabaseQuery object that contains this condition. + * @syscap SystemCapability.DeviceCloudGateway.CloudFoundation + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + beginsWith(fieldName: string, value: FieldType): DatabaseQuery; + /** + * Adds a query condition in which a field value of the string type in an entity class ends with a specified substring. + * @param { string } fieldName - Field name in entity class. + * @param { FieldType } value - The specified value for the selected field. + * @return { DatabaseQuery } The DatabaseQuery object that contains this condition. + * @syscap SystemCapability.DeviceCloudGateway.CloudFoundation + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + endsWith(fieldName: string, value: FieldType): DatabaseQuery; + /** + * Adds a query condition in which the value of a field of the string type in an entity class contains a specified substring. + * @param { string } fieldName - Field name in entity class.me in entity class.me in entity class. + * @param { FieldType } value - The specified value for the selected field. + * @return { DatabaseQuery } The DatabaseQuery object that contains this condition. + * @syscap SystemCapability.DeviceCloudGateway.CloudFoundation + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + contains(fieldName: string, value: FieldType): DatabaseQuery; + /** + * Add a query condition that the value of a field in an entity class is greater than a specified value. + * @param { string } fieldName - Field name in entity class. + * @param { FieldType } value - The specified value for the selected field. + * @return { DatabaseQuery } The DatabaseQuery object that contains this condition. + * @syscap SystemCapability.DeviceCloudGateway.CloudFoundation + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + greaterThan(fieldName: string, value: FieldType): DatabaseQuery; + /** + * Add a query condition that the value of a field in an entity class is greater than or equal to a specified value. + * @param { string } fieldName - Field name in entity class. + * @param { FieldType } value - The specified value for the selected field. + * @return { DatabaseQuery } The DatabaseQuery object that contains this condition. + * @syscap SystemCapability.DeviceCloudGateway.CloudFoundation + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + greaterThanOrEqualTo(fieldName: string, value: FieldType): DatabaseQuery; + /** + * Add a query condition that the value of a field in an entity class is less than the specified value. + * @param { string } fieldName - Field name in entity class. + * @param { FieldType } value - The specified value for the selected field. + * @return { DatabaseQuery } The DatabaseQuery object that contains this condition. + * @syscap SystemCapability.DeviceCloudGateway.CloudFoundation + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + lessThan(fieldName: string, value: FieldType): DatabaseQuery; + /** + * Adds a query condition that the value of a field in an entity class is less than or equal to a specified value. + * @param { string } fieldName - Field name in entity class. + * @param { FieldType } value - The specified value for the selected field. + * @return { DatabaseQuery } The DatabaseQuery object that contains this condition. + * @syscap SystemCapability.DeviceCloudGateway.CloudFoundation + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + lessThanOrEqualTo(fieldName: string, value: FieldType): DatabaseQuery; + /** + * Adds a query condition in which the value of a field in an entity class is contained in a specified array. + * @param { string } fieldName - Field name in entity class.me in entity class. + * @param { FieldType[] } values - Specified array range. + * @return { DatabaseQuery } The DatabaseQuery object that contains this condition. + * @syscap SystemCapability.DeviceCloudGateway.CloudFoundation + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + in(fieldName: string, values: FieldType[]): DatabaseQuery; + /** + * Add the query condition that the value of a field in the entity class is empty. + * @param { string } fieldName - Field name in entity class.me in entity class. + * @return { DatabaseQuery } The DatabaseQuery object that contains this condition. + * @syscap SystemCapability.DeviceCloudGateway.CloudFoundation + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + isNull(fieldName: string): DatabaseQuery; + /** + * Add the query condition that the value of a field in the entity class is not empty. + * @param { string } fieldName - Field name in entity class.me in entity class.me in entity class. + * @return { DatabaseQuery } The DatabaseQuery object that contains this condition. + * @syscap SystemCapability.DeviceCloudGateway.CloudFoundation + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + isNotNull(fieldName: string): DatabaseQuery; + /** + * Sorts query results by a specified field in ascending order. + * When using this method to sort fields, you are advised to create indexes for the sorted fields. + * Otherwise, when the number of data records of the object type reaches a certain value, + * the query may time out or fail due to low query efficiency, affecting user experience. + * This method is recommended for equalTo (), notEqualTo (), greaterThan (), greaterThanOrEqualTo (), lessThan (), + * lessThanOrEqualTo (), in (), beginsWith (), endsWith (), contains (), isNull (), isNotNull (), and limit (). + * @param { string } fieldName - Field name in entity class. + * @return { DatabaseQuery } The DatabaseQuery object that contains this condition. + * @syscap SystemCapability.DeviceCloudGateway.CloudFoundation + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + orderByAsc(fieldName: string): DatabaseQuery; + /** + * Sort query results by specified field in descending order. + * When using this method to sort fields, you are advised to create indexes for the sorted fields. + * Otherwise, when the number of data records of the object type reaches a certain value, + * the query may time out or fail due to low query efficiency, affecting user experience. + * This method is recommended for equalTo (), notEqualTo (), greaterThan (), greaterThanOrEqualTo (), lessThan (), lessThanOrEqualTo (), + * in (), beginsWith (), endsWith (), contains (), isNull (), isNotNull (), and limit (). + * @param { string } fieldName - Field name in entity class. + * @return { DatabaseQuery } The DatabaseQuery object that contains this condition. + * @syscap SystemCapability.DeviceCloudGateway.CloudFoundation + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + orderByDesc(fieldName: string): DatabaseQuery; + /** + * Specifies the number of data records in the returned query result set. + * If offset is not set, the first count objects are obtained by default. + * If the number of objects in the query result set is less than the value of count, all objects are returned. + * @param { number } count - Limit the number of data records that can be obtained. + * @param { ?number } offset - Specifies the start position of the data record. + * @return { DatabaseQuery } The DatabaseQuery object that contains this condition. + * @syscap SystemCapability.DeviceCloudGateway.CloudFoundation + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + limit(count: number, offset?: number): DatabaseQuery; + /** + * This method is called to put the left parenthesis"' + * ("Append to any query condition and concatenate the right parenthesis with the same query") "Used in combination. + * beginGroup () and endGroup () must appear in pairs and be used together with other query conditions. + * Between the beginGroup () and endGroup () methods, you can use equalTo (), notEqualTo (), greaterThan (), greaterThanOrEqualTo (), + * lessThan (), lessThanOrEqualTo (), in (), beginsWith (), endsWith (), isNull (), isNotNull (), and contains (). + * One or more of the preceding query conditions can be used at the same time. That is, the space between two parentheses cannot be empty. + * The beginGroup () method cannot be used directly before the and () and or () methods. That is, beginGroup ().and (), + * beginGroup ().and ().endGroup (), beginGroup ().or (), and beginGroup ().or ().endGroup () are not supported. + * @return { DatabaseQuery } The DatabaseQuery object that contains this condition. + * @syscap SystemCapability.DeviceCloudGateway.CloudFoundation + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + beginGroup(): DatabaseQuery; + /** + * This method is called to put the right parenthesis"' + * )"Append to any query condition and concatenate the left parenthesis with the same query"( "Used in combination. + * beginGroup () and endGroup () must appear in pairs and be used together with other query conditions. + * Between the beginGroup () and endGroup () methods, you can use equalTo (), notEqualTo (), greaterThan (), greaterThanOrEqualTo (), + * lessThan (), lessThanOrEqualTo (), in (), beginsWith (),endsWith (), isNull (), isNotNull (), and contains (). + * One or more of the preceding query conditions can be used at the same time. That is, the space between two parentheses cannot be empty. + * The endGroup () method cannot be used directly after the and () and or () methods. That is, beginGroup ().and ().endGroup (), and (), + * endGroup (), beginGroup ().or ().endGroup (), and or ().endGroup () are not supported. + * @return { DatabaseQuery } The DatabaseQuery object that contains this condition. + * @syscap SystemCapability.DeviceCloudGateway.CloudFoundation + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + endGroup(): DatabaseQuery; + /** + * Combines the two conditions before and after or using the OR operation and returns the union of the two query results. + * + * The or () method can be used only with other query conditions. + * when and equalTo (), notEqualTo (), greaterThan (), greaterThanOrEqualTo (), lessThan (), lessThanOrEqualTo (), in (), beginsWith (), + * endsWith (), isNull (), isNotN ull () and contains () together. When used in combination, the union of the two query results is returned. + * When used in combination with the and () method, and () cannot be used directly after or (). That is, the usage of or ().and () is not supported. + * When used in combination with the beginGroup () and endGroup () methods: + * Multi-layer nesting is supported, and beginGroup () and endGroup () must appear in pairs. + * The beginGroup () method cannot be used before the or () method, and the endGroup () method cannot be used after the or () method. + * That is, beginGroup ().or (),beginGroup ().or ().endGroup (), and or ().endGroup () are not supported. + * It cannot be used together with orderByAsc (), orderByDesc (), or limit (). + * @return { DatabaseQuery } The DatabaseQuery object that contains this condition. + * @syscap SystemCapability.DeviceCloudGateway.CloudFoundation + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + or(): DatabaseQuery; + /** + * Combines the two conditions using the and operation and returns the intersection of the two query results. + * + * The and () method can be used only with other query conditions. + * when and equalTo (), notEqualTo (), greaterThan (), greaterThanOrEqualTo (), lessThan (), lessThanOrEqualTo (), in (), beginsWith (), + * endsWith (), isNull (), isNotN When ull () and contains () are used together, the intersection of the two query results is returned. + * When the and () method is used together with the or () method, + * the and () method cannot be directly followed by the or () method. That is, and ().or () is not supported. + * When used in combination with the beginGroup () and endGroup () methods: + * Multi-layer nesting is supported, and beginGroup () and endGroup () must appear in pairs. + * The beginGroup () method cannot be used before the and () method, and the endGroup () method cannot be used after the and () method. + * That is, beginGroup ().and (),beginGroup ().and ().endGroup (), and and ().endGroup () are not supported. + * It cannot be used together with orderByAsc (), orderByDesc (), or limit (). + * @return { DatabaseQuery } The DatabaseQuery object that contains this condition. + * @syscap SystemCapability.DeviceCloudGateway.CloudFoundation + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + and(): DatabaseQuery; + } +} +export default cloudDatabase; diff --git a/language/arkts/extractor/sdk/hms/ets/api/@hms.core.deviceCloudGateway.cloudFunction.d.ts b/language/arkts/extractor/sdk/hms/ets/api/@hms.core.deviceCloudGateway.cloudFunction.d.ts new file mode 100755 index 00000000..4da919b9 --- /dev/null +++ b/language/arkts/extractor/sdk/hms/ets/api/@hms.core.deviceCloudGateway.cloudFunction.d.ts @@ -0,0 +1,156 @@ +/* + * Copyright (c) Huawei Technologies Co., Ltd. 2023-2023. All rights reserved. + */ +/** + * @file Define cloud function capabilities. + * @kit CloudFoundationKit + */ +import type { AsyncCallback } from '@ohos.base'; +/** + * This module provides cloud function capabilities. + * Cloud resources are connected to AppGallery Connect. Before using the resources, you need to enable the corresponding services. + * + * @namespace cloudFunction + * @syscap SystemCapability.DeviceCloudGateway.CloudFoundation + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ +declare namespace cloudFunction { + /** + * call the corresponding implementation of the cloud. + * @param { FunctionParams } parameters - Parameters related to the function. + * @return { Promise } Result returned by the function. + * @throws { BusinessError } 201 - No Internet permission. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 1008210001 - Network connection error. + * @throws { BusinessError } 1008210009 - Client internal error. + * @throws { BusinessError } 1008211001 - Server error. + * @permission ohos.permission.INTERNET + * @syscap SystemCapability.DeviceCloudGateway.CloudFoundation + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + function call(parameters: FunctionParams): Promise; + /** + * call the corresponding implementation of the cloud. + * @param { FunctionParams } parameters - Parameters related to the function. + * @param { AsyncCallback } callback - Result returned by the function. + * @throws { BusinessError } 201 - No Internet permission. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 1008210001 - Network connection error. + * @throws { BusinessError } 1008210009 - Client internal error. + * @throws { BusinessError } 1008211001 - Server error. + * @permission ohos.permission.INTERNET + * @syscap SystemCapability.DeviceCloudGateway.CloudFoundation + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + function call(parameters: FunctionParams, callback: AsyncCallback): void; + /** + * Cloud function invoking parameters. + * @typedef FunctionParams + * @syscap SystemCapability.DeviceCloudGateway.CloudFoundation + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + interface FunctionParams { + /** + * Cloud Function Name. + * @type { string } + * @syscap SystemCapability.DeviceCloudGateway.CloudFoundation + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + name: string; + /** + * Function request body. + * @type { ?(string | Object) } + * @syscap SystemCapability.DeviceCloudGateway.CloudFoundation + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + data?: string | Object; + /** + * Cloud function version. The default value is '$latest'. The latest version is supported. + * @type { ?string } + * @syscap SystemCapability.DeviceCloudGateway.CloudFoundation + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + version?: string; + /** + * Function request timeout interval, in milliseconds. The default value is 70 *1000. + * @type { ?number } + * @syscap SystemCapability.DeviceCloudGateway.CloudFoundation + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + timeout?: number; + /** + * Function request loading mode. + * @type { ?LoadMode } + * @syscap SystemCapability.DeviceCloudGateway.CloudFoundation + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + loadMode?: LoadMode; + } + /** + * Function request loading mode. + * + * @enum { number } + * @syscap SystemCapability.DeviceCloudGateway.CloudFoundation + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + enum LoadMode { + /** + * Common Mode. + * @enum { number } + * @syscap SystemCapability.DeviceCloudGateway.CloudFoundation + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + NORMAL = 0, + /** + * Preload Mode. + * @enum { number } + * @syscap SystemCapability.DeviceCloudGateway.CloudFoundation + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + PRELOAD = 1 + } + /** + * Returned result of invoking the cloud function. + * @typedef FunctionResult + * @syscap SystemCapability.DeviceCloudGateway.CloudFoundation + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + interface FunctionResult { + /** + * Returns the result of a function call. + * @type { string | Object } Returns the result of a function call. + * @syscap SystemCapability.DeviceCloudGateway.CloudFoundation + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + result: string | Object; + } +} +export default cloudFunction; diff --git a/language/arkts/extractor/sdk/hms/ets/api/@hms.core.deviceCloudGateway.cloudStorage.d.ts b/language/arkts/extractor/sdk/hms/ets/api/@hms.core.deviceCloudGateway.cloudStorage.d.ts new file mode 100755 index 00000000..c61e9b7b --- /dev/null +++ b/language/arkts/extractor/sdk/hms/ets/api/@hms.core.deviceCloudGateway.cloudStorage.d.ts @@ -0,0 +1,598 @@ +/* + * Copyright (c) Huawei Technologies Co., Ltd. 2023-2023. All rights reserved. + */ +/** + * @file Define cloud storage capabilities. + * @kit CloudFoundationKit + */ +import type { AsyncCallback } from '@ohos.base'; +import type request from '@ohos.request'; +import type common from '@ohos.app.ability.common'; +/** + * This module provides cloud storage capabilities. + * Cloud resources are connected to AppGallery Connect. Before using the resources, you need to enable the corresponding services. + * + * @namespace cloudStorage + * @syscap SystemCapability.DeviceCloudGateway.CloudFoundation + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ +declare namespace cloudStorage { + /** + * Initializing a Cloud Storage Instance. + * @param { ?string } name - Name of the storage instance. + * By default, an asynchronous task is started to query the default instance on the cloud. + * If you do not use the default value, ensure that the storage instance exists on the cloud. + * Otherwise, an error indicating that the storage instance cannot be found will occur in subsequent operations. + * The format is restricted by the cloud side: + * Only lowercase letters, digits, and hyphens (-) are allowed. + * The value must start and end with a letter or digit and contain 9 to 63 characters. + * Two or more consecutive hyphens (-) are not allowed. + * @throws { BusinessError } 401 - Parameter error. + * @syscap SystemCapability.DeviceCloudGateway.CloudFoundation + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + function bucket(name?: string): StorageBucket; + /** + * Cloud storage instance, which provides cloud storage upload and download capabilities. + * @syscap SystemCapability.DeviceCloudGateway.CloudFoundation + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + class StorageBucket { + /** + * Uploading a Specified File to the Cloud. + * @param { common.BaseContext } context - Application context. + * @param { UploadParams } parameters - Parameters related to file upload. + * @return { Promise } Upload task, which can be used to monitor the upload progress and operate the upload task. + * @throws { BusinessError } 201 - No Internet permission. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 1008220001 - Network connection error. + * @throws { BusinessError } 1008220009 - Client internal error. + * @throws { BusinessError } 1008221001 - Server error. + * @permission ohos.permission.INTERNET + * @syscap SystemCapability.DeviceCloudGateway.CloudFoundation + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + uploadFile(context: common.BaseContext, parameters: UploadParams): Promise; + /** + * Uploading a Specified File to the Cloud + * @param { common.BaseContext } context - Application context. + * @param { UploadParams } parameters - Parameters related to file upload. + * @param { AsyncCallback } callback - Upload task, which can be used to monitor the upload progress and operate the upload task. + * @throws { BusinessError } 201 - No Internet permission. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 1008220001 - Network connection error. + * @throws { BusinessError } 1008220009 - Client internal error. + * @throws { BusinessError } 1008221001 - Server error. + * @permission ohos.permission.INTERNET + * @syscap SystemCapability.DeviceCloudGateway.CloudFoundation + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + uploadFile(context: common.BaseContext, parameters: UploadParams, callback: AsyncCallback): void; + /** + * Downloading Files from the Cloud to the Local. + * @param { common.BaseContext } context - Application context. + * @param { DownloadParams } parameters - Parameters related to file download. + * @return { Promise } Download task, which can be used to monitor the download progress and operate the download task. + * @throws { BusinessError } 201 - No Internet permission. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 1008220001 - Network connection error. + * @throws { BusinessError } 1008220009 - Client internal error. + * @throws { BusinessError } 1008221001 - Server error. + * @permission ohos.permission.INTERNET + * @syscap SystemCapability.DeviceCloudGateway.CloudFoundation + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + downloadFile(context: common.BaseContext, parameters: DownloadParams): Promise; + /** + * Downloading Files from the Cloud to the Local. + * @param { common.BaseContext } context - Application context. + * @param { DownloadParams } parameters - Parameters related to file download. + * @param { AsyncCallback } callback - Download task, + * which can be used to monitor the download progress and operate the download task. + * @throws { BusinessError } 201 - No Internet permission. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 1008220001 - Network connection error. + * @throws { BusinessError } 1008220009 - Client internal error. + * @throws { BusinessError } 1008221001 - Server error. + * @permission ohos.permission.INTERNET + * @syscap SystemCapability.DeviceCloudGateway.CloudFoundation + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + downloadFile(context: common.BaseContext, parameters: DownloadParams, callback: AsyncCallback): void; + /** + * Obtaining the Cloud-side File Download Address. + * @param { string } cloudPath - File path on the cloud. + * @return { Promise } File download address on the cloud. + * @throws { BusinessError } 201 - No Internet permission. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 1008220001 - Network connection error. + * @throws { BusinessError } 1008220009 - Client internal error. + * @throws { BusinessError } 1008221001 - Server error. + * @permission ohos.permission.INTERNET + * @syscap SystemCapability.DeviceCloudGateway.CloudFoundation + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + getDownloadURL(cloudPath: string): Promise; + /** + * Obtaining the Cloud-side File Download Address. + * @param { string } cloudPath - File path on the cloud. + * @param { AsyncCallback } callback - File download address on the cloud. + * @throws { BusinessError } 201 - No Internet permission. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 1008220001 - Network connection error. + * @throws { BusinessError } 1008220009 - Client internal error. + * @throws { BusinessError } 1008221001 - Server error. + * @permission ohos.permission.INTERNET + * @syscap SystemCapability.DeviceCloudGateway.CloudFoundation + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + getDownloadURL(cloudPath: string, callback: AsyncCallback): void; + /** + * Deleting Cloud-side Files. + * @param { string } cloudPath - File path on the cloud. + * @return { Promise } Result of deleting the file from the cloud. + * @throws { BusinessError } 201 - No Internet permission. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 1008220001 - Network connection error. + * @throws { BusinessError } 1008220009 - Client internal error. + * @throws { BusinessError } 1008221001 - Server error. + * @permission ohos.permission.INTERNET + * @syscap SystemCapability.DeviceCloudGateway.CloudFoundation + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + deleteFile(cloudPath: string): Promise; + /** + * Deleting Cloud-side Files. + * @param { string } cloudPath - File path on the cloud. + * @param { AsyncCallback } callback - Result of deleting the file from the cloud. + * @throws { BusinessError } 201 - No Internet permission. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 1008220001 - Network connection error. + * @throws { BusinessError } 1008220009 - Client internal error. + * @throws { BusinessError } 1008221001 - Server error. + * @permission ohos.permission.INTERNET + * @syscap SystemCapability.DeviceCloudGateway.CloudFoundation + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + deleteFile(cloudPath: string, callback: AsyncCallback): void; + /** + * Obtaining the Cloud-side File List. + * @param { string } cloudPath - File path on the cloud. If an empty string is transferred, the file list in the root path on the cloud is obtained. + * @param { ListOptions } options - Parameters for obtaining the list. + * @return { Promise } List Results. + * @throws { BusinessError } 201 - No Internet permission. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 1008220001 - Network connection error. + * @throws { BusinessError } 1008220009 - Client internal error. + * @throws { BusinessError } 1008221001 - Server error. + * @permission ohos.permission.INTERNET + * @syscap SystemCapability.DeviceCloudGateway.CloudFoundation + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + list(cloudPath: string, options?: ListOptions): Promise; + /** + * Obtaining the Cloud-side File List. + * @param { string } cloudPath - File path on the cloud. If an empty string is transferred, the file list in the root path on the cloud is obtained. + * @param { ListOptions } options - Parameters for obtaining the list. + * @param { AsyncCallback } callback - List Results. + * @throws { BusinessError } 201 - No Internet permission. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 1008220001 - Network connection error. + * @throws { BusinessError } 1008220009 - Client internal error. + * @throws { BusinessError } 1008221001 - Server error. + * @permission ohos.permission.INTERNET + * @syscap SystemCapability.DeviceCloudGateway.CloudFoundation + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + list(cloudPath: string, options: ListOptions, callback: AsyncCallback): void; + /** + * Obtaining the Metadata of a Cloud-side File. + * @param { string } cloudPath - File path on the cloud. + * @return { Promise } Complete metadata information of the file on the cloud. + * @throws { BusinessError } 201 - No Internet permission. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 1008220001 - Network connection error. + * @throws { BusinessError } 1008220009 - Client internal error. + * @throws { BusinessError } 1008221001 - Server error. + * @permission ohos.permission.INTERNET + * @syscap SystemCapability.DeviceCloudGateway.CloudFoundation + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + getMetadata(cloudPath: string): Promise; + /** + * Obtaining the Metadata of a Cloud-side File. + * @param { string } cloudPath - File path on the cloud. + * @param { AsyncCallback } callback - Complete metadata information of the file on the cloud. + * @throws { BusinessError } 201 - No Internet permission. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 1008220001 - Network connection error. + * @throws { BusinessError } 1008220009 - Client internal error. + * @throws { BusinessError } 1008221001 - Server error. + * @permission ohos.permission.INTERNET + * @syscap SystemCapability.DeviceCloudGateway.CloudFoundation + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + getMetadata(cloudPath: string, callback: AsyncCallback): void; + /** + * Set the metadata of the file on the cloud. + * @param { string } cloudPath - File path on the cloud. + * @param { MetadataUpdatable } metadata - Metadata information of updatable parameters. + * @return { Promise } Complete metadata information after the update. + * @throws { BusinessError } 201 - No Internet permission. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 1008220001 - Network connection error. + * @throws { BusinessError } 1008220009 - Client internal error. + * @throws { BusinessError } 1008221001 - Server error. + * @permission ohos.permission.INTERNET + * @syscap SystemCapability.DeviceCloudGateway.CloudFoundation + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + setMetadata(cloudPath: string, metadata: MetadataUpdatable): Promise; + /** + * Set the metadata of the file on the cloud. + * @param { string } cloudPath - File path on the cloud. + * @param { MetadataUpdatable } metadata - Metadata information of updatable parameters. + * @param { AsyncCallback } callback - Complete metadata information after the update. + * @throws { BusinessError } 201 - No Internet permission. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 1008220001 - Network connection error. + * @throws { BusinessError } 1008220009 - Client internal error. + * @throws { BusinessError } 1008221001 - Server error. + * @permission ohos.permission.INTERNET + * @syscap SystemCapability.DeviceCloudGateway.CloudFoundation + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + setMetadata(cloudPath: string, metadata: MetadataUpdatable, callback: AsyncCallback): void; + } + /** + * Parameters related to the upload. + * @typedef UploadParams + * @syscap SystemCapability.DeviceCloudGateway.CloudFoundation + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + interface UploadParams { + /** + * Local File Path. + * @type { string } + * @syscap SystemCapability.DeviceCloudGateway.CloudFoundation + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + localPath: string; + /** + * File path on the cloud. + * @type { string } + * @syscap SystemCapability.DeviceCloudGateway.CloudFoundation + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + cloudPath: string; + /** + * Metadata information of updatable parameters. + * @type { ?MetadataUpdatable } + * @syscap SystemCapability.DeviceCloudGateway.CloudFoundation + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + metadata?: MetadataUpdatable; + /** + * Indicates task's mode. + * The default is BACKGROUND. + * For frontend task, it has callbacks. + * For background task, it has notifications and fallback. + * The cross-platform default is FOREGROUND. + * + * @type { ?request.agent.Mode } + * @default request.agent.Mode.BACKGROUND + * @syscap SystemCapability.DeviceCloudGateway.CloudFoundation + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + mode?: request.agent.Mode; + /** + * The network. + * + * @type { ?request.agent.Network } + * @default request.agent.Network.ANY + * @syscap SystemCapability.DeviceCloudGateway.CloudFoundation + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + network?: request.agent.Network; + } + /** + * Download Related Parameters. + * @typedef DownloadParams + * @syscap SystemCapability.DeviceCloudGateway.CloudFoundation + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + interface DownloadParams { + /** + * Local File Path + * @type { string } + * @syscap SystemCapability.DeviceCloudGateway.CloudFoundation + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + localPath: string; + /** + * File path on the cloud. + * @type { string } + * @syscap SystemCapability.DeviceCloudGateway.CloudFoundation + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + cloudPath: string; + /** + * Indicates task's mode. + * The default is BACKGROUND. + * For frontend task, it has callbacks. + * For background task, it has notifications and fallback. + * The cross-platform default is FOREGROUND. + * + * @type { ?request.agent.Mode } + * @default request.agent.Mode.BACKGROUND + * @syscap SystemCapability.DeviceCloudGateway.CloudFoundation + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + mode?: request.agent.Mode; + /** + * The solution choice when path already exists during download. + * The default is false. + * Currently support: + * true, rewrite the existed file. + * false, go to fail. + * + * @type { ?boolean } + * @default false + * @syscap SystemCapability.DeviceCloudGateway.CloudFoundation + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + overwrite?: boolean; + /** + * The network. + * + * @type { ?request.agent.Network } + * @default request.agent.Network.ANY + * @syscap SystemCapability.DeviceCloudGateway.CloudFoundation + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + network?: request.agent.Network; + } + /** + * Lists the parameters related to the operation. + * @typedef ListOptions + * @syscap SystemCapability.DeviceCloudGateway.CloudFoundation + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + interface ListOptions { + /** + * Maximum number of files to be listed. By default, all files are listed. The value ranges from 1 to 1000. + * @type { ?number } + * @syscap SystemCapability.DeviceCloudGateway.CloudFoundation + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + maxResults?: number; + /** + * Page Marker. + * @type { ?string } + * @syscap SystemCapability.DeviceCloudGateway.CloudFoundation + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + pageMarker?: string; + } + /** + * List the results of the operation + * @typedef ListResults + * @syscap SystemCapability.DeviceCloudGateway.CloudFoundation + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + interface ListResults { + /** + * Cloud-side directory list returned by the listing operation + * @type { string[] } + * @syscap SystemCapability.DeviceCloudGateway.CloudFoundation + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + directories: string[]; + /** + * Cloud-side file list returned by the listing operation. + * @type { string[] } + * @syscap SystemCapability.DeviceCloudGateway.CloudFoundation + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + files: string[]; + /** + * Page Marker. + * @type { ?string } + * @syscap SystemCapability.DeviceCloudGateway.CloudFoundation + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + pageMarker?: string; + } + /** + * Updateable metadata information. + * @typedef MetadataUpdatable + * @syscap SystemCapability.DeviceCloudGateway.CloudFoundation + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + interface MetadataUpdatable { + /** + * ContentType type of the standard HTTP header. + * @type { ?string } + * @syscap SystemCapability.DeviceCloudGateway.CloudFoundation + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + contentType?: string; + /** + * CacheControl in the standard HTTP header. + * @type { ?string } + * @syscap SystemCapability.DeviceCloudGateway.CloudFoundation + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + cacheControl?: string; + /** + * ContentDisposition of the standard HTTP header. + * @type { ?string } + * @syscap SystemCapability.DeviceCloudGateway.CloudFoundation + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + contentDisposition?: string; + /** + * ContentEncoding of the standard HTTP header. + * @type { ?string } + * @syscap SystemCapability.DeviceCloudGateway.CloudFoundation + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + contentEncoding?: string; + /** + * ContentLanguage of the standard HTTP header. + * @type { ?string } + * @syscap SystemCapability.DeviceCloudGateway.CloudFoundation + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + contentLanguage?: string; + /** + * Customized file attributes on the cloud are case-insensitive and must comply with the standard HTTP header specifications. + * @type { ?Record } + * @syscap SystemCapability.DeviceCloudGateway.CloudFoundation + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + customMetadata?: Record; + } + /** + * Complete metadata information. + * @typedef Metadata + * @syscap SystemCapability.DeviceCloudGateway.CloudFoundation + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + interface Metadata extends MetadataUpdatable { + /** + * Cloud-side file name. + * @type { string } + * @syscap SystemCapability.DeviceCloudGateway.CloudFoundation + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + name: string; + /** + * Cloud-side file size. + * @type { number } + * @syscap SystemCapability.DeviceCloudGateway.CloudFoundation + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + size: number; + /** + * Create time of the file on the cloud. + * @type { Date } + * @syscap SystemCapability.DeviceCloudGateway.CloudFoundation + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + createTime: Date; + /** + * Modification time of the file on the cloud. + * @type { Date } + * @syscap SystemCapability.DeviceCloudGateway.CloudFoundation + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + modifyTime: Date; + /** + * SHA256 information of the file on the cloud. + * @type { string } + * @syscap SystemCapability.DeviceCloudGateway.CloudFoundation + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + sha256Hash?: string; + } +} +export default cloudStorage; diff --git a/language/arkts/extractor/sdk/hms/ets/api/@hms.core.gameservice.gameperformance.d.ts b/language/arkts/extractor/sdk/hms/ets/api/@hms.core.gameservice.gameperformance.d.ts new file mode 100755 index 00000000..dd8cc26e --- /dev/null +++ b/language/arkts/extractor/sdk/hms/ets/api/@hms.core.gameservice.gameperformance.d.ts @@ -0,0 +1,634 @@ +/* + * Copyright (c) Huawei Technologies Co., Ltd. 2024-2024. All rights reserved. + */ +/** + * @file Defines the capabilities of GameServiceKit. + * @kit GameServiceKit + */ +import type { Callback } from '@ohos.base'; +/** + * This module provides performance capabilities for game app. + * + * @namespace gamePerformance + * @syscap SystemCapability.GameService.GamePerformance + * @since 5.0.0(12) + */ +declare namespace gamePerformance { + /** + * Gpu information. + * + * @typedef GpuInfo + * @syscap SystemCapability.GameService.GamePerformance + * @since 5.0.0(12) + */ + interface GpuInfo { + /** + * GPU load level. The value ranges from 1 to 10 in ascending order. + * + * @type { number } + * @syscap SystemCapability.GameService.GamePerformance + * @since 5.0.0(12) + */ + gpuLoadLevel?: number; + /** + * Vertex processing load level. The value ranges from 1 to 10 in ascending order. + * + * @type { number } + * @syscap SystemCapability.GameService.GamePerformance + * @since 5.0.0(12) + */ + vertexLoadLevel?: number; + /** + * Fragment processing load level. The value ranges from 1 to 10 in ascending order. + * + * @type { number } + * @syscap SystemCapability.GameService.GamePerformance + * @since 5.0.0(12) + */ + fragmentLoadLevel?: number; + /** + * Texture processing load level. The value ranges from 1 to 10 in ascending order. + * + * @type { number } + * @syscap SystemCapability.GameService.GamePerformance + * @since 5.0.0(12) + */ + textureLoadLevel?: number; + /** + * Bandwidth load level. The value ranges from 1 to 10 in ascending order. + * + * @type { number } + * @syscap SystemCapability.GameService.GamePerformance + * @since 5.0.0(12) + */ + bandwidthLoadLevel?: number; + } + /** + * Device information. + * + * @typedef DeviceInfo + * @syscap SystemCapability.GameService.GamePerformance + * @since 5.0.0(12) + */ + interface DeviceInfo { + /** + * Temperature level. The value ranges from 1 to 6. A higher value indicates a higher temperature. + * Suggestions as: + * 1: No action is required. + * 2: Reduce the specifications of the service that users are unaware of. + * For example, reduce the background update speed or delay the running of the service. + * 3: Suspend the services that do not need to be perceived and reduce the specifications of non-core game services. + * For example, reduce the foreground update speed. + * 4: Reduce the special effects appropriately. + * 5: Reduce the specifications of the game in all scenarios, such as the resolution, image quality, and frame rate. + * 6: Recommend playing down to minimum specs. + * + * @type { number } + * @syscap SystemCapability.GameService.GamePerformance + * @since 5.0.0(12) + */ + tempLevel: number; + /** + * GPU info + * + * @type { GpuInfo } + * @syscap SystemCapability.GameService.GamePerformance + * @since 5.0.0(12) + */ + gpuInfo?: GpuInfo; + } + /** + * Basic information. + * + * @typedef BaseGameInfo + * @syscap SystemCapability.GameService.GamePerformance + * @since 5.0.0(12) + */ + interface BaseGameInfo { + /** + * Message type. + * 0: Indicates a game package message, corresponding to GamePackageInfo. + * 1: Indicates a game config message, corresponding to GameConfigInfo. + * 2: Indicates a game scene message, corresponding to GameSceneInfo. + * 3: Indicates a game network status message, corresponding to GameNetInfo. + * 4: Indicates a game player into, corresponding to GamePlayerInfo. + * + * @type { number } + * @syscap SystemCapability.GameService.GamePerformance + * @since 5.0.0(12) + */ + messageType: number; + /** + * Extra info. + * A json string used to carry extension parameters. + * + * @type { string } + * @syscap SystemCapability.GameService.GamePerformance + * @since 5.0.0(12) + */ + extra?: string; + } + /** + * Game package info which not change in gaming. + * + * @typedef GamePackageInfo + * @syscap SystemCapability.GameService.GamePerformance + * @since 5.0.0(12) + */ + interface GamePackageInfo extends BaseGameInfo { + /** + * Bundle name. + * + * @type { string } + * @syscap SystemCapability.GameService.GamePerformance + * @since 5.0.0(12) + */ + bundleName: string; + /** + * App version. + * + * @type { string } + * @syscap SystemCapability.GameService.GamePerformance + * @since 5.0.0(12) + */ + appVersion: string; + /** + * Game engine type. + * 1: UNITY + * 2: UNREAL4 + * 3: MESSIAH + * 4: COCOS + * 200: OTHERS + * + * @type { number } + * @syscap SystemCapability.GameService.GamePerformance + * @since 5.0.0(12) + */ + engineType?: number; + /** + * Game engine version. + * + * @type { string } + * @syscap SystemCapability.GameService.GamePerformance + * @since 5.0.0(12) + */ + engineVersion?: string; + /** + * Game type. + * 1: MOBA + * 2: RPG + * 3: FPS + * 4: FTG + * 5: RAC + * 200: OTHERS + * + * @type { number } + * @syscap SystemCapability.GameService.GamePerformance + * @since 5.0.0(12) + */ + gameType?: number; + /** + * Is game render with vulkan or not. + * + * @type { boolean } + * @syscap SystemCapability.GameService.GamePerformance + * @since 5.0.0(12) + */ + vulkanSupported?: boolean; + } + /** + * Game config info. + * + * @typedef GameConfigInfo + * @syscap SystemCapability.GameService.GamePerformance + * @since 5.0.0(12) + */ + interface GameConfigInfo extends BaseGameInfo { + /** + * Max picture quality level. + * 1: Smooth + * 2: Balanced + * 3: HD + * 4: HDR HD + * 5: UHD + * + * @type { number } + * @syscap SystemCapability.GameService.GamePerformance + * @since 5.0.0(12) + */ + maxPictureQualityLevel: number; + /** + * Current picture quality level. + * + * @type { number } + * @syscap SystemCapability.GameService.GamePerformance + * @since 5.0.0(12) + */ + currentPictureQualityLevel: number; + /** + * Max frame rate. + * + * @type { number } + * @syscap SystemCapability.GameService.GamePerformance + * @since 5.0.0(12) + */ + maxFrameRate: number; + /** + * Current frame rate. + * + * @type { number } + * @syscap SystemCapability.GameService.GamePerformance + * @since 5.0.0(12) + */ + currentFrameRate: number; + /** + * Max resolution. + * + * @type { string } + * @syscap SystemCapability.GameService.GamePerformance + * @since 5.0.0(12) + */ + maxResolution: string; + /** + * Current resolution. + * + * @type { string } + * @syscap SystemCapability.GameService.GamePerformance + * @since 5.0.0(12) + */ + currentResolution: string; + /** + * Whether antialiasing is enabled. + * + * @type { boolean } + * @syscap SystemCapability.GameService.GamePerformance + * @since 5.0.0(12) + */ + antiAliasing: boolean; + /** + * Whether shadow is enabled. + * + * @type { boolean } + * @syscap SystemCapability.GameService.GamePerformance + * @since 5.0.0(12) + */ + shadow: boolean; + /** + * Whether multiThread is enabled. + * + * @type { boolean } + * @syscap SystemCapability.GameService.GamePerformance + * @since 5.0.0(12) + */ + multithreading: boolean; + /** + * Whether particle effects is enabled. + * + * @type { boolean } + * @syscap SystemCapability.GameService.GamePerformance + * @since 5.0.0(12) + */ + particle: boolean; + /** + * Whether HD mode is enabled. + * + * @type { boolean } + * @syscap SystemCapability.GameService.GamePerformance + * @since 5.0.0(12) + */ + hdMode: boolean; + } + /** + * Game scene info. + * + * @typedef GameSceneInfo + * @syscap SystemCapability.GameService.GamePerformance + * @since 5.0.0(12) + */ + interface GameSceneInfo extends BaseGameInfo { + /** + * Scene id. + * 0:The switchback scenario ends. + * 1: The game is started. + * 2: in-game update + * 3: Login process + * 4: Main screen + * 5: Load a game (self-loading) + * 6: Load a game (you load it and wait for other players) + * 7: in the game + * 8: Watch mode + * 100+: Customized scenario + * + * @type { number } + * @syscap SystemCapability.GameService.GamePerformance + * @since 5.0.0(12) + */ + sceneID: number; + /** + * Scene description. + * + * @type { string } + * @syscap SystemCapability.GameService.GamePerformance + * @since 5.0.0(12) + */ + description?: string; + /** + * Sub-scene id. + * + * @type { number } + * @syscap SystemCapability.GameService.GamePerformance + * @since 5.0.0(12) + */ + subSceneID?: number; + /** + * Sub-scene description. + * + * @type { string } + * @syscap SystemCapability.GameService.GamePerformance + * @since 5.0.0(12) + */ + subDescription?: string; + /** + * Importance of the game scenario. The value ranges from 1 to 5 in ascending order. + * + * @type { number } + * @syscap SystemCapability.GameService.GamePerformance + * @since 5.0.0(12) + */ + importanceLevel: number; + /** + * Frequency in one game of this scene. + * + * @type { number } + * @syscap SystemCapability.GameService.GamePerformance + * @since 5.0.0(12) + */ + sceneFrequency?: number; + /** + * Duration of this scene in milliseconds. + * + * @type { number } + * @syscap SystemCapability.GameService.GamePerformance + * @since 5.0.0(12) + */ + sceneTime?: number; + /** + * Recommended cpu level. The value ranges from 1 to 3 in ascending order. + * + * @type { number } + * @syscap SystemCapability.GameService.GamePerformance + * @since 5.0.0(12) + */ + recommendedCpuLevel?: number; + /** + * Recommended gpu level. The value ranges from 1 to 3 in ascending order. + * + * @type { number } + * @syscap SystemCapability.GameService.GamePerformance + * @since 5.0.0(12) + */ + recommendedGpuLevel?: number; + /** + * Recommended ddr level. The value ranges from 1 to 3 in ascending order. + * + * @type { number } + * @syscap SystemCapability.GameService.GamePerformance + * @since 5.0.0(12) + */ + recommendedDdrLevel?: number; + /** + * Recommended fps. + * + * @type { number } + * @syscap SystemCapability.GameService.GamePerformance + * @since 5.0.0(12) + */ + recommendedFps?: number; + /** + * Max fps of this scene. + * + * @type { number } + * @syscap SystemCapability.GameService.GamePerformance + * @since 5.0.0(12) + */ + maxFps?: number; + /** + * Current fps of this scene. + * + * @type { number } + * @syscap SystemCapability.GameService.GamePerformance + * @since 5.0.0(12) + */ + currentFps?: number; + /** + * Key thread. + * "render": rendering thread + * "logic": logic thread + * "net": network thread + * + * @type { string } + * @syscap SystemCapability.GameService.GamePerformance + * @since 5.0.0(12) + */ + keyThread?: string; + /** + * Average number of draw-calls per frame of this scene. + * + * @type { number } + * @syscap SystemCapability.GameService.GamePerformance + * @since 5.0.0(12) + */ + drawCallCount?: number; + /** + * Average number of model vertices per frame of this scene. + * + * @type { number } + * @syscap SystemCapability.GameService.GamePerformance + * @since 5.0.0(12) + */ + vertexCount?: number; + /** + * Average number of model triangles per frame of this scene. + * + * @type { number } + * @syscap SystemCapability.GameService.GamePerformance + * @since 5.0.0(12) + */ + triangleCount?: number; + /** + * Average number of shaders per frame of this scene. + * + * @type { number } + * @syscap SystemCapability.GameService.GamePerformance + * @since 5.0.0(12) + */ + shaderCount?: number; + /** + * Average number of textures per frame of this scene. + * + * @type { number } + * @syscap SystemCapability.GameService.GamePerformance + * @since 5.0.0(12) + */ + textureCount?: number; + /** + * Average number of meshes per frame of this scene. + * + * @type { number } + * @syscap SystemCapability.GameService.GamePerformance + * @since 5.0.0(12) + */ + meshCount?: number; + /** + * Average number of channels per frame of this scene. + * + * @type { number } + * @syscap SystemCapability.GameService.GamePerformance + * @since 5.0.0(12) + */ + channelCount?: number; + /** + * Number of participants on the same screen of this scene. + * + * @type { number } + * @syscap SystemCapability.GameService.GamePerformance + * @since 5.0.0(12) + */ + participantCount?: number; + } + /** + * Game network info + * + * @typedef GameNetInfo + * @syscap SystemCapability.GameService.GamePerformance + * @since 5.0.0(12) + */ + interface GameNetInfo extends BaseGameInfo { + /** + * Game network delay time in millisecond. + * When the total delay changes, the delay is sent once. The sending delay includes the uplink delay, downlink delay, and server processing time. + * + * @example total:50|up:20|server:10|down:20 + * @type { string } + * @syscap SystemCapability.GameService.GamePerformance + * @since 5.0.0(12) + */ + netLatency: string; + /** + * Game network load level. + * 1: low + * 2: mid + * 3: high + * + * @type { number } + * @syscap SystemCapability.GameService.GamePerformance + * @since 5.0.0(12) + */ + netLoad?: number; + } + /** + * Game player info + * + * @typedef GamePlayerInfo + * @syscap SystemCapability.GameService.GamePerformance + * @since 5.0.0(12) + */ + interface GamePlayerInfo extends BaseGameInfo { + /** + * Unique identifier of the game player. + * + * @type { ?string } + * @syscap SystemCapability.GameService.GamePerformance + * @since 5.0.0(12) + */ + gamePlayerId?: string; + /** + * Unique identifier of all game players distributed by the developer account. + * + * @type { ?string } + * @syscap SystemCapability.GameService.GamePerformance + * @since 5.0.0(12) + */ + teamPlayerId?: string; + /** + * The thirdOpenId of third game. + * + * @type { ?string } + * @syscap SystemCapability.GameService.GamePerformance + * @since 5.0.0(12) + */ + thirdOpenId?: string; + } + /** + * Enumerates the game error codes. + * + * @enum { number } + * @syscap SystemCapability.GameService.GamePerformance + * @since 5.0.0(12) + */ + enum GamePerformanceErrorCode { + /** + * System internal error. + * + * @syscap SystemCapability.GameService.GamePerformance + * @since 5.0.0(12) + */ + INTERNAL_ERROR = 1010300001, + /** + * Invalid caller. + * + * @syscap SystemCapability.GameService.GamePerformance + * @since 5.0.0(12) + */ + AUTH_FAILED = 1010300002, + /** + * Invalid request. + * + * @syscap SystemCapability.GameService.GamePerformance + * @since 5.0.0(12) + */ + INVALID_REQUEST = 1010300003 + } + /** + * Init game performance with package info. + * + * @param { GamePackageInfo } gamePackageInfo + * @returns { Promise } Returns void. + * @throws { BusinessError } 401 - The parameter check failed. + * @throws { BusinessError } 1010300002 - Invalid caller. + * @syscap SystemCapability.GameService.GamePerformance + * @since 5.0.0(12) + */ + function init(gamePackageInfo: GamePackageInfo): Promise; + /** + * Update game info in gaming. + * + * @param {T extends BaseGameInfo} gameInfo + * @returns { Promise } Returns void. + * @throws { BusinessError } 401 - The parameter check failed. + * @throws { BusinessError } 1010300003 - Invalid request. + * @syscap SystemCapability.GameService.GamePerformance + * @since 5.0.0(12) + */ + function updateGameInfo(gameInfo: T): Promise; + /** + * Subscribes device state change events. When target word is detected, the callback is invoked + * + * @param { 'deviceStateChanged' } type - Type of the event to listen for. + * @param { Callback } callback - Callback is invoked when the event is triggered. + * @throws { BusinessError } 401 - The parameter check failed. + * @syscap SystemCapability.GameService.GamePerformance + * @since 5.0.0(12) + */ + function on(type: 'deviceStateChanged', callback: Callback): void; + /** + * Unsubscribes device state change events + * @param { 'deviceStateChanged' } type - Type of the event to listen for. + * @param { ?Callback } [callback] - If this parameter is specified, unsubscribe only current subscriber, otherwise unsubscribe all subscribers. + * @throws { BusinessError } 401 - The parameter check failed. + * @syscap SystemCapability.GameService.GamePerformance + * @since 5.0.0(12) + */ + function off(type: 'deviceStateChanged', callback?: Callback): void; +} +export default gamePerformance; diff --git a/language/arkts/extractor/sdk/hms/ets/api/@hms.core.gameservice.gameplayer.d.ts b/language/arkts/extractor/sdk/hms/ets/api/@hms.core.gameservice.gameplayer.d.ts new file mode 100755 index 00000000..76df9f33 --- /dev/null +++ b/language/arkts/extractor/sdk/hms/ets/api/@hms.core.gameservice.gameplayer.d.ts @@ -0,0 +1,868 @@ +/* + * Copyright (c) Huawei Technologies Co., Ltd. 2023-2023. All rights reserved. + */ +/** + * @file Defines the capabilities of GameServiceKit. + * @kit GameServiceKit + */ +import type { AsyncCallback, Callback } from '@ohos.base'; +import type common from '@ohos.app.ability.common'; +/** + * This module provides compliance and interactive capabilities for game player. + * + * @namespace gamePlayer + * @syscap SystemCapability.Game.GameService.GamePlayer + * @since 4.0.0(10) + */ +declare namespace gamePlayer { + /** + * GSKLocalPlayer object represents local player information. + * The prefix GSK used in the variables is the acronym of GameServiceKit. + * + * @typedef GSKLocalPlayer + * @syscap SystemCapability.Game.GameService.GamePlayer + * @since 4.0.0(10) + */ + interface GSKLocalPlayer { + /** + * Unique identifier of the game player. + * + * @type { string } + * @syscap SystemCapability.Game.GameService.GamePlayer + * @since 4.0.0(10) + */ + gamePlayerId: string; + /** + * Unique identifier of all game players distributed by the developer account. + * + * @type { string } + * @syscap SystemCapability.Game.GameService.GamePlayer + * @since 4.0.0(10) + */ + teamPlayerId: string; + /** + * Id compatible type. + * Notes: 0 - incompatible; 1 - compatible playerId; 2 - compatible openId; + * + * @type { number } + * @syscap SystemCapability.Game.GameService.GamePlayer + * @since 4.0.0(10) + */ + idCompatibleType: number; + /** + * Player consumption privilege level in GameCenter. + * + * @type { number } + * @syscap SystemCapability.Game.GameService.GamePlayer + * @since 4.0.0(10) + */ + level: number; + /** + * Player's playable duration (minutes) this time. + * + * @type { number } + * @syscap SystemCapability.Game.GameService.GamePlayer + * @since 4.0.0(10) + */ + playableTime: number; + /** + * The type of the playerId used for game login. + * Notes: 1: gamePlayerId; 2: teamPlayerId + * + * @type { number } + * @syscap SystemCapability.Game.GameService.GamePlayer + * @since 5.0.0(12) + */ + loginIdType: number; + } + /** + * GSKPlayerRole object represents player role information. + * + * @typedef GSKPlayerRole + * @syscap SystemCapability.Game.GameService.GamePlayer + * @since 4.0.0(10) + */ + interface GSKPlayerRole { + /** + * Player role id. + * + * @type { string } + * @syscap SystemCapability.Game.GameService.GamePlayer + * @since 4.0.0(10) + */ + roleId: string; + /** + * Player role name. + * + * @type { string } + * @syscap SystemCapability.Game.GameService.GamePlayer + * @since 4.0.0(10) + */ + roleName: string; + /** + * Player zone server id. + * + * @type { ?string } + * @syscap SystemCapability.Game.GameService.GamePlayer + * @since 4.0.0(10) + */ + serverId?: string; + /** + * Player zone server name. + * + * @type { ?string } + * @syscap SystemCapability.Game.GameService.GamePlayer + * @since 4.0.0(10) + */ + serverName?: string; + /** + * Unique identifier of the game player. + * + * @type { ?string } + * @syscap SystemCapability.Game.GameService.GamePlayer + * @since 4.0.0(10) + */ + gamePlayerId?: string; + /** + * Unique identifier of all game players distributed by the developer account. + * + * @type { ?string } + * @syscap SystemCapability.Game.GameService.GamePlayer + * @since 4.0.0(10) + */ + teamPlayerId?: string; + /** + * The thirdOpenId of third game. + * + * @type { ?string } + * @syscap SystemCapability.Game.GameService.GamePlayer + * @since 5.0.0(12) + */ + thirdOpenId?: string; + } + /** + * Request parameter of the purchase API. + * + * @typedef PurchaseParameter + * @syscap SystemCapability.Game.GameService.GamePlayer + * @since 4.0.0(10) + */ + interface PurchaseParameter { + /** + * ID of product to be queried. + * Each product ID must exist and be unique in the current app. + * The product ID is the same as that you set when configuring product information in AppGallery Connect. + * + * @type { string } + * @syscap SystemCapability.Game.GameService.GamePlayer + * @since 4.0.0(10) + */ + productId: string; + /** + * Type of a product to be queried. + * + * @type { ProductType } + * @syscap SystemCapability.Game.GameService.GamePlayer + * @since 4.0.0(10) + */ + productType: ProductType; + /** + * Information stored on the merchant side. + * + * @type { ?string } + * @syscap SystemCapability.Game.GameService.GamePlayer + * @since 4.0.0(10) + */ + developerPayload?: string; + /** + * This parameter is used to pass the extra fields set by a merchant in a JSON string in the key:value format. + * + * @type { ?string } + * @syscap SystemCapability.Game.GameService.GamePlayer + * @since 4.0.0(10) + */ + reservedInfo?: string; + } + /** + * PurchaseResult object represents purchase result. + * + * @typedef PurchaseResult + * @syscap SystemCapability.Game.GameService.GamePlayer + * @since 4.0.0(10) + */ + interface PurchaseResult { + /** + * Information about products that have been purchased. + * + * @type { string } + * @syscap SystemCapability.Game.GameService.GamePlayer + * @since 4.0.0(10) + */ + inAppPurchaseData: string; + /** + * Signature string generated after consumption data is signed using a private payment key. + * + * @type { string } + * @syscap SystemCapability.Game.GameService.GamePlayer + * @since 4.0.0(10) + */ + signature: string; + /** + * Signature algorithm. + * + * @type { string } + * @syscap SystemCapability.Game.GameService.GamePlayer + * @since 4.0.0(10) + */ + signatureAlgorithm: string; + } + /** + * Represents create purchase result. + * + * @typedef CreatePurchaseResult + * @syscap SystemCapability.Game.GameService.GamePlayer + * @since 4.1.0(11) + */ + interface CreatePurchaseResult { + /** + * Purchase data, including purchase order and subscription status. + * + * @type { string } + * @syscap SystemCapability.Game.GameService.GamePlayer + * @since 4.1.0(11) + */ + purchaseData: string; + } + /** + * ThirdUserInfo object represents user info of third game. + * + * @typedef ThirdUserInfo + * @syscap SystemCapability.Game.GameService.GamePlayer + * @since 5.0.0(12) + */ + interface ThirdUserInfo { + /** + * The thirdOpenId of third game. + * + * @type { string} + * @syscap SystemCapability.Game.GameService.GamePlayer + * @since 5.0.0(12) + */ + thirdOpenId: string; + /** + * Whether the user is real name. + * + * @type { boolean } + * @syscap SystemCapability.Game.GameService.GamePlayer + * @since 5.0.0(12) + */ + isRealName?: boolean; + /** + * Whether the user is an adult. + * + * @type { boolean } + * @syscap SystemCapability.Game.GameService.GamePlayer + * @since 5.0.0(12) + */ + isAdult?: boolean; + /** + * Age range of user. + * + * @type { int } + * @syscap SystemCapability.Game.GameService.GamePlayer + * @since 5.0.0(12) + */ + ageRange?: ThirdUserAgeRange; + } + /** + * Union login parameters passed in by developer. + * + * @typedef UnionLoginParam + * @syscap SystemCapability.Game.GameService.GamePlayer + * @since 5.0.0(12) + */ + interface UnionLoginParam { + /** + * Used to indicate whether  to force a union login dialog pops up, allowing users to choose to login again. + * Note: + * true: When calling the unionLogin interface, a union login dialog will always pop up. + * false: When calling the unionLogin interface, the internal logic will determine + * whether to pop up the union login dialog. + * Usually, you don't need to assign a value to this parameter. When you need to switch accounts or perform + * other operations, assign this value to true + * + * @type { boolean } + * @syscap SystemCapability.Game.GameService.GamePlayer + * @since 5.0.0(12) + */ + showLoginDialog: boolean; + /** + * The type of login panel. + * Note: + * If this field value is not set, the default value is LoginPanelType ICON + * + * @type { LoginPanelType } + * @syscap SystemCapability.Game.GameService.GamePlayer + * @since 5.0.0(12) + */ + loginPanelType?: LoginPanelType; + /** + * Account information provided by game developers, used to display the game developer's login button + * in the login dialog. + * Note: + * The account name cannot be the same for different accounts. + * + * @type { Array} + * @syscap SystemCapability.Game.GameService.GamePlayer + * @since 5.0.0(12) + */ + thirdAccountInfos: Array; + } + /** + * Account information provided by game developers. + * + * @typedef ThirdAccountInfo + * @syscap SystemCapability.Game.GameService.GamePlayer + * @since 5.0.0(12) + */ + interface ThirdAccountInfo { + /** + * Resource information of account icon. + * resource of icon ($r or $rawfile) + * + * @type { ResourceStr } + * @syscap SystemCapability.Game.GameService.GamePlayer + * @since 5.0.0(12) + */ + accountIcon: Resource; + /** + * account name. + * + * @type { string } + * @syscap SystemCapability.Game.GameService.GamePlayer + * @since 5.0.0(12) + */ + accountName: string; + } + /** + * Union login results returned to developer. + * + * @typedef UnionLoginResult + * @syscap SystemCapability.Game.GameService.GamePlayer + * @since 5.0.0(12) + */ + interface UnionLoginResult { + /** + * The account name provided by the developer. + * Notes: + * If the user selects Huawei ID, return "hw_count". + * If you choose the account provided by the developer, return the account name passed in by the developer. + * If there is an exception during the login process, return "official_account". + * "official_account" indicates that the specific account name cannot be returned at present, and the developer + * can only be informed to log in through the official account.  If there are multiple official accounts, + * the developer can select one to log in + * + * @type { string } + * @syscap SystemCapability.Game.GameService.GamePlayer + * @since 5.0.0(12) + */ + accountName: string; + /** + * Notify developers whether the current player ID needs to be bound to their account. + * Notes: true:need be bound; false:no need be bound + * + * @type { boolean} + * @syscap SystemCapability.Game.GameService.GamePlayer + * @since 5.0.0(12) + */ + needBinding: boolean; + /** + * Local player information. + * + * @type { GSKLocalPlayer } + * @syscap SystemCapability.Game.GameService.GamePlayer + * @since 5.0.0(12) + */ + localPlayer: GSKLocalPlayer; + } + /** + * The change result of the Player returned to the developer. + * + * @typedef PlayerChangedResult + * @syscap SystemCapability.Game.GameService.GamePlayer + * @since 5.0.0(12) + */ + interface PlayerChangedResult { + /** + * The event of player changed. + * + * @type { PlayerChangedEvent } + * @syscap SystemCapability.Game.GameService.GamePlayer + * @since 5.0.0(12) + */ + event: PlayerChangedEvent; + /** + * This is a json string used to return relevant information about the current event. + * + * @type { string } + * @syscap SystemCapability.Game.GameService.GamePlayer + * @since 5.0.0(12) + */ + resultInfo: string; + } + /** + * Indicates the changed event of player. + * + * @enum { number } + * @syscap SystemCapability.Game.GameService.GamePlayer + * @since 5.0.0(12) + */ + enum PlayerChangedEvent { + /** + * The user switched game account + * + * @syscap SystemCapability.Game.GameService.GamePlayer + * @since 5.0.0(12) + */ + SWITCH_GAME_ACCOUNT = 0 + } + /** + * Enumerates the age range of ThirdUserInfo. + * + * @enum { number } + * @syscap SystemCapability.Game.GameService.GamePlayer + * @StageModelOnly + * @since 5.0.0(12) + */ + enum ThirdUserAgeRange { + /** + * User age less than 8 years old. + * + * @syscap SystemCapability.Game.GameService.GamePlayer + * @StageModelOnly + * @since 5.0.0(12) + */ + AGE_RANGE_8 = 1, + /** + * User age less than 16 years old and greater than 8 years old. + * + * @syscap SystemCapability.Game.GameService.GamePlayer + * @StageModelOnly + * @since 5.0.0(12) + */ + AGE_RANGE_16 = 2, + /** + * User age less than 18 years old and greater than 16 years old. + * + * @syscap SystemCapability.Game.GameService.GamePlayer + * @StageModelOnly + * @since 5.0.0(12) + */ + AGE_RANGE_18 = 3, + /** + * User age greater than 18 years old. + * + * @syscap SystemCapability.Game.GameService.GamePlayer + * @StageModelOnly + * @since 5.0.0(12) + */ + AGE_RANGE_ADULT = 4 + } + /** + * The type of login panel. + * + * @enum { number } + * @syscap SystemCapability.Game.GameService.GamePlayer + * @since 5.0.0(12) + */ + enum LoginPanelType { + /** + * The third-party account entrance is displayed as the account icon. + * + * @syscap SystemCapability.Game.GameService.GamePlayer + * @since 5.0.0(12) + */ + ICON = 0, + /** + * The third-party account entrance is displayed as a button + * + * @syscap SystemCapability.Game.GameService.GamePlayer + * @since 5.0.0(12) + */ + BUTTON = 1 + } + /** + * Enumerates the game error codes returned in callback invoked after executeRequest() is called. + * + * @enum { number } + * @syscap SystemCapability.Game.GameService.GamePlayer + * @StageModelOnly + * @since 4.1.0(11) + */ + enum GameErrorCode { + /** + * System internal error. + * + * @syscap SystemCapability.Game.GameService.GamePlayer + * @StageModelOnly + * @since 4.1.0(11) + */ + INTERNAL_ERROR = 1002000001, + /** + * Network connection error. + * + * @syscap SystemCapability.Game.GameService.GamePlayer + * @StageModelOnly + * @since 4.1.0(11) + */ + NETWORK_ERROR = 1002000002, + /** + * Get the HUAWEI ID information failed. + * + * @syscap SystemCapability.Game.GameService.GamePlayer + * @StageModelOnly + * @since 4.1.0(11) + */ + GET_HWID_INFO_FAILED = 1002000003, + /** + * User cancels real name authentication or not real name. + * + * @syscap SystemCapability.Game.GameService.GamePlayer + * @StageModelOnly + * @since 4.1.0(11) + */ + REALNAME_CANCELED_OR_NOT_REALNAME = 1002000004, + /** + * The country or region of the signed-in Huawei ID does not support. + * + * @syscap SystemCapability.Game.GameService.GamePlayer + * @StageModelOnly + * @since 4.1.0(11) + */ + COUNTRY_OR_REGION_NOT_SUPPORTED = 1002000005, + /** + * User is underage and has no playable time. + * + * @syscap SystemCapability.Game.GameService.GamePlayer + * @StageModelOnly + * @since 5.0.0(12) + */ + ANTI_ADDICTION_ERROR = 1002000006, + /** + * The application to which the product belongs is not listed in the specified country. + * + * @syscap SystemCapability.Game.GameService.GamePlayer + * @StageModelOnly + * @since 4.1.0(11) + */ + PRODUCT_BELONG_REGION_ERROR = 1002000007, + /** + * The HUAWEI ID is in the blocklist. + * + * @syscap SystemCapability.Game.GameService.GamePlayer + * @StageModelOnly + * @since 4.1.0(11) + */ + HWID_IN_BLOCKLIST = 1002000008, + /** + * The game account is unavailable for the game. + * + * @syscap SystemCapability.Game.GameService.GamePlayer + * @StageModelOnly + * @since 5.0.0(12) + */ + GAME_ACCOUNT_UNAVAILABLE = 1002000009, + /** + * The playerId is not current player. + * + * @syscap SystemCapability.Game.GameService.GamePlayer + * @StageModelOnly + * @since 5.0.0(12) + */ + PLAYER_ID_INVALID = 1002000010, + /** + * Agreement not agreed. + * + * @syscap SystemCapability.Game.GameService.GamePlayer + * @StageModelOnly + * @since 5.0.0(12) + */ + AGREEMENT_NOT_AGREED = 1002000011, + /** + * The thirdOpenId or teamPlayerId has been bound. + * + * @syscap SystemCapability.Game.GameService.GamePlayer + * @StageModelOnly + * @since 5.0.0(12) + */ + OPEN_ID_OR_PLAYER_ID_BOUND = 1002000012, + /** + * The thirdOpenId and teamPlayerId are not bound. + * + * @syscap SystemCapability.Game.GameService.GamePlayer + * @StageModelOnly + * @since 5.0.0(12) + */ + OPEN_ID_AND_PLAYER_ID_NOT_BOUND = 1002000013, + /** + * This interface is not available for this game. + * + * @syscap SystemCapability.Game.GameService.GamePlayer + * @StageModelOnly + * @since 5.0.0(12) + */ + CURRENT_API_NOT_AVAILABLE_FOR_GAME = 1002000014, + /** + * The current player information is invalid. Execute the login process again to obtain the player information. + * + * @syscap SystemCapability.Game.GameService.GamePlayer + * @StageModelOnly + * @since 5.0.0(12) + */ + CURRENT_PLAYER_INFO_INVALID = 1002000015, + /** + * User cancels union login. + * + * @syscap SystemCapability.Game.GameService.GamePlayer + * @StageModelOnly + * @since 5.0.0(12) + */ + UNION_LOGIN_CANCELED = 1002000016 + } + /** + * Indicates the product Type. + * + * @enum { number } + * @syscap SystemCapability.Game.GameService.GamePlayer + * @since 4.0.0(10) + */ + enum ProductType { + /** + * Consumable product + * + * @syscap SystemCapability.Game.GameService.GamePlayer + * @since 4.0.0(10) + */ + CONSUMABLE = 0, + /** + * Non-Consumable product for one time purchase + * + * @syscap SystemCapability.Game.GameService.GamePlayer + * @since 4.0.0(10) + */ + NONCONSUMABLE = 1, + /** + * Auto-renewable subscription product + * + * @syscap SystemCapability.Game.GameService.GamePlayer + * @since 5.0.0(12) + */ + AUTORENEWABLE = 2 + } + /** + * Init cache game config parameters, sign privacy agreement. + * + * @param { common.UIAbilityContext } context - The context of an ability. + * @returns { Promise } Returns void. + * @syscap SystemCapability.Game.GameService.GamePlayer + * @since 4.0.0(10) + */ + function init(context: common.UIAbilityContext): Promise; + /** + * Init cache game config parameters, sign privacy agreement. + * + * @param { common.UIAbilityContext } context - The context of an ability. + * @param { AsyncCallback } callback - callback. + * @syscap SystemCapability.Game.GameService.GamePlayer + * @since 4.0.0(10) + */ + function init(context: common.UIAbilityContext, callback: AsyncCallback): void; + /** + * Obtains local player information. + * + * @param { common.UIAbilityContext } context - The context of an ability. + * @returns { Promise } Returns GSKLocalPlayer. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 1002000001 - System internal error. + * @throws { BusinessError } 1002000002 - Network connection error. + * @throws { BusinessError } 1002000003 - The HUAWEI ID is not signed in or not authorized. + * @throws { BusinessError } 1002000004 - User cancels real name authentication or not real name. + * @throws { BusinessError } 1002000005 - The country or region of the signed-in Huawei ID does not support. + * @syscap SystemCapability.Game.GameService.GamePlayer + * @since 4.0.0(10) + */ + /** + * Obtains local player information. + * + * @param { common.UIAbilityContext } context - The context of an ability. + * @returns { Promise } Returns GSKLocalPlayer. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 1002000001 - System internal error. + * @throws { BusinessError } 1002000002 - Network connection error. + * @throws { BusinessError } 1002000003 - The HUAWEI ID is not signed in or not authorized. + * @throws { BusinessError } 1002000004 - User cancels real name authentication or not real name. + * @throws { BusinessError } 1002000005 - The country or region of the signed-in Huawei ID does not support. + * @throws { BusinessError } 1002000006 - User is underage and has no playable time. + * @throws { BusinessError } 1002000011 - Agreement not agreed. + * @throws { BusinessError } 1002000014 - This interface is not available for this game. + * @syscap SystemCapability.Game.GameService.GamePlayer + * @since 5.0.0(12) + */ + function getLocalPlayer(context: common.UIAbilityContext): Promise; + /** + * Obtains local player information. + * + * @param { common.UIAbilityContext } context - The context of an ability. + * @param { AsyncCallback } callback - callback. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 1002000001 - System internal error. + * @throws { BusinessError } 1002000002 - Network connection error. + * @throws { BusinessError } 1002000003 - The HUAWEI ID is not signed in or not authorized. + * @throws { BusinessError } 1002000004 - User cancels real name authentication or not real name. + * @throws { BusinessError } 1002000005 - The country or region of the signed-in Huawei ID does not support. + * @syscap SystemCapability.Game.GameService.GamePlayer + * @since 4.0.0(10) + */ + /** + * Obtains local player information. + * + * @param { common.UIAbilityContext } context - The context of an ability. + * @param { AsyncCallback } callback - callback. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 1002000001 - System internal error. + * @throws { BusinessError } 1002000002 - Network connection error. + * @throws { BusinessError } 1002000003 - The HUAWEI ID is not signed in or not authorized. + * @throws { BusinessError } 1002000004 - User cancels real name authentication or not real name. + * @throws { BusinessError } 1002000005 - The country or region of the signed-in Huawei ID does not support. + * @throws { BusinessError } 1002000006 - User is underage and has no playable time. + * @throws { BusinessError } 1002000011 - Agreement not agreed. + * @throws { BusinessError } 1002000014 - This interface is not available for this game. + * @syscap SystemCapability.Game.GameService.GamePlayer + * @since 5.0.0(12) + */ + function getLocalPlayer(context: common.UIAbilityContext, callback: AsyncCallback): void; + /** + * Save player role information. + * + * @param { common.UIAbilityContext } context - The context of an ability. + * @param { GSKPlayerRole } request - GSKPlayerRole. + * @returns { Promise } Returns void. + * @syscap SystemCapability.Game.GameService.GamePlayer + * @since 4.0.0(10) + */ + function savePlayerRole(context: common.UIAbilityContext, request: GSKPlayerRole): Promise; + /** + * Save player role information. + * + * @param { common.UIAbilityContext } context - The context of an ability. + * @param { GSKPlayerRole } request - GSKPlayerRole. + * @param { AsyncCallback } callback - callback. + * @syscap SystemCapability.Game.GameService.GamePlayer + * @since 4.0.0(10) + */ + function savePlayerRole(context: common.UIAbilityContext, request: GSKPlayerRole, callback: AsyncCallback): void; + /** + * Bind a game account to a Huawei player. + * + * @param { common.UIAbilityContext } context - The context of an ability. + * @param { string } thirdOpenId- The thirdOpenId of third game. + * @param { string } teamPlayerId- The teamPlayerId of Huawei player to bind. + * @returns { Promise } Returns void. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 1002000001 - System internal error. + * @throws { BusinessError } 1002000002 - Network connection error. + * @throws { BusinessError } 1002000003 - The HUAWEI ID is not signed in or not authorized. + * @throws { BusinessError } 1002000005 - The country or region of the signed-in Huawei ID does not support. + * @throws { BusinessError } 1002000010 - The playerId is not current player. + * @throws { BusinessError } 1002000011 - Agreement not agreed. + * @throws { BusinessError } 1002000012 - The thirdOpenId or teamPlayerId has been bound. + * @syscap SystemCapability.Game.GameService.GamePlayer + * @since 5.0.0(12) + */ + function bindPlayer(context: common.UIAbilityContext, thirdOpenId: string, teamPlayerId: string): Promise; + /** + * UnbindPlayer a game account to a Huawei player. + * + * @param { common.UIAbilityContext } context - The context of an ability. + * @param { string } thirdOpenId- The thirdOpenId of third game. + * @param { string } teamPlayerId- The teamPlayerId of Huawei player to unbind. + * @returns { Promise } Returns void. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 1002000001 - System internal error. + * @throws { BusinessError } 1002000002 - Network connection error. + * @throws { BusinessError } 1002000003 - The HUAWEI ID is not signed in or not authorized. + * @throws { BusinessError } 1002000005 - The country or region of the signed-in Huawei ID does not support. + * @throws { BusinessError } 1002000010 - The playerId is not current player. + * @throws { BusinessError } 1002000011 - Agreement not agreed. + * @throws { BusinessError } 1002000013 - The thirdOpenId and teamPlayerId is not bound. + * @syscap SystemCapability.Game.GameService.GamePlayer + * @since 5.0.0(12) + */ + function unbindPlayer(context: common.UIAbilityContext, thirdOpenId: string, teamPlayerId: string): Promise; + /** + * Verify whether the local player can enter the game. + * + * @param { common.UIAbilityContext } context - The context of an ability. + * @param { ThirdUserInfo } thirdUserInfo- user info of third game to verify. + * @returns { Promise } Returns void. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 1002000001 - System internal error. + * @throws { BusinessError } 1002000002 - Network connection error. + * @throws { BusinessError } 1002000003 - The HUAWEI ID is not signed in or not authorized. + * @throws { BusinessError } 1002000004 - User cancels real name authentication or not real name. + * @throws { BusinessError } 1002000005 - The country or region of the signed-in Huawei ID does not support. + * @throws { BusinessError } 1002000006 - User is underage and has no playable time. + * @throws { BusinessError } 1002000008 - The HUAWEI ID is in the blocklist. + * @throws { BusinessError } 1002000011 - Agreement not agreed. + * @throws { BusinessError } 1002000015 - The current player information is invalid. Execute the login process again to obtain the player information. + * @syscap SystemCapability.Game.GameService.GamePlayer + * @since 5.0.0(12) + */ + function verifyLocalPlayer(context: common.UIAbilityContext, thirdUserInfo: ThirdUserInfo): Promise; + /** + * Provide the ability to union login with Huawei ID and developer accounts. + * + * @param { common.UIAbilityContext } context - The context of an ability. + * @param { UnionLoginParam} context - The params of unionLogin. + * @returns { Promise } Returns UnionLoginResult. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 1002000001 - System internal error. + * @throws { BusinessError } 1002000002 - Network connection error. + * @throws { BusinessError } 1002000003 - The HUAWEI ID is not signed in or not authorized. + * @throws { BusinessError } 1002000004 - User cancels real name authentication or not real name. + * @throws { BusinessError } 1002000005 - The country or region of the signed-in Huawei ID does not support. + * @throws { BusinessError } 1002000008 - The HUAWEI ID is in the blocklist. + * @throws { BusinessError } 1002000011 - Agreement not agreed. + * @throws { BusinessError } 1002000014 - This interface is not available for this game. + * @throws { BusinessError } 1002000016 - Union login canceled by user. + * @syscap SystemCapability.Game.GameService.GamePlayer + * @since 5.0.0(12) + */ + function unionLogin(context: common.UIAbilityContext, loginParam: UnionLoginParam): Promise; + /** + * Registering a listening event for player changed. + * + * @param { 'playerChanged' } type - Type of the event to listen for. + * @param { Callback} callback- The callback object need to be registered. + * @returns { void } Returns void. + * @throws { BusinessError } 401 - Parameter error. + * @syscap SystemCapability.Game.GameService.GamePlayer + * @since 5.0.0(12) + */ + function on(type: 'playerChanged', callback: Callback): void; + /** + * Unregistering a listening event for player changed. + * Note: + * Callback is an optional parameter. If a callback object is passed in, it means that only the current callback + * is unregistered. If this parameter is not passed in, it means that all registered callbacks are unregistered + * + * @param { 'playerChanged' } type - Type of the event to listen for. + * @param { ?Callback } callback- The callback object need to be unregistered. + * @returns { void } Returns void. + * @throws { BusinessError } 401 - Parameter error. + * @syscap SystemCapability.Game.GameService.GamePlayer + * @since 5.0.0(12) + */ + function off(type: 'playerChanged', callback?: Callback): void; +} +export default gamePlayer; diff --git a/language/arkts/extractor/sdk/hms/ets/api/@hms.core.iap.d.ts b/language/arkts/extractor/sdk/hms/ets/api/@hms.core.iap.d.ts new file mode 100755 index 00000000..7aec208a --- /dev/null +++ b/language/arkts/extractor/sdk/hms/ets/api/@hms.core.iap.d.ts @@ -0,0 +1,2179 @@ +/* + * Copyright (c) Huawei Technologies Co., Ltd. 2023-2023. All rights reserved. + */ +/** + * @file Defines the capabilities of iap(in-App purchase) module. + * @kit IAPKit + */ +import type { AsyncCallback } from '@ohos.base'; +import type common from '@ohos.app.ability.common'; +/** + * This module provides the capabilities to use in-App purchase. + * + * @namespace iap + * @syscap SystemCapability.Payment.IAP + * @since 4.0.0(10) + */ +/** + * This module provides the capabilities to use in-App purchase. + * + * @namespace iap + * @syscap SystemCapability.Payment.IAP + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ +declare namespace iap { + /** + * Request parameter of the queryPurchases or queryOwnedPurchases or queryPurchaseRecords API. + * + * @typedef QueryPurchasesParameter + * @syscap SystemCapability.Payment.IAP + * @since 4.0.0(10) + */ + /** + * Request parameter of the queryPurchases or queryOwnedPurchases or queryPurchaseRecords API. + * + * @typedef QueryPurchasesParameter + * @syscap SystemCapability.Payment.IAP + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + interface QueryPurchasesParameter { + /** + * Type of a product to be queried. + * + * @type { ProductType } + * @syscap SystemCapability.Payment.IAP + * @since 4.0.0(10) + */ + /** + * Type of a product to be queried. + * + * @type { ProductType } + * @syscap SystemCapability.Payment.IAP + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + productType: ProductType; + /** + * Data location flag for query in pagination mode. + * + * @type { ?string } + * @syscap SystemCapability.Payment.IAP + * @since 4.0.0(10) + */ + /** + * Data location flag for query in pagination mode. + * + * @type { ?string } + * @syscap SystemCapability.Payment.IAP + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + continuationToken?: string; + /** + * Type of querying purchase. ALL as default if value is NULL. + * + * @type { ?PurchaseQueryType } + * @syscap SystemCapability.Payment.IAP + * @since 4.1.0(11) + */ + /** + * Type of querying purchase. + * + * @type { ?PurchaseQueryType } + * @default PurchaseQueryType.UNFINISHED + * @syscap SystemCapability.Payment.IAP + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + queryType?: PurchaseQueryType; + } + /** + * Request parameter of queryProducts API. + * + * @typedef QueryProductsParameter + * @syscap SystemCapability.Payment.IAP + * @since 4.0.0(10) + */ + /** + * Request parameter of queryProducts API. + * + * @typedef QueryProductsParameter + * @syscap SystemCapability.Payment.IAP + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + interface QueryProductsParameter { + /** + * Type of a product to be queried. + * + * @type { ProductType } + * @syscap SystemCapability.Payment.IAP + * @since 4.0.0(10) + */ + /** + * Type of a product to be queried. + * + * @type { ProductType } + * @syscap SystemCapability.Payment.IAP + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + productType: ProductType; + /** + * ID list of products to be queried. + * Each product ID must exist and be unique in the current app. + * The product ID is the same as that you set when configuring product information in AppGallery Connect. + * + * @type { string[] } + * @syscap SystemCapability.Payment.IAP + * @since 4.0.0(10) + */ + /** + * ID list of products to be queried. + * Each product ID must exist and be unique in the current app. + * The product ID is the same as that you set when configuring product information in AppGallery Connect. + * + * @type { string[] } + * @syscap SystemCapability.Payment.IAP + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + productIds: string[]; + } + /** + * Request parameter of the purchase API. + * + * @typedef PurchaseParameter + * @syscap SystemCapability.Payment.IAP + * @since 4.0.0(10) + */ + /** + * Request parameter of the purchase API. + * + * @typedef PurchaseParameter + * @syscap SystemCapability.Payment.IAP + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + interface PurchaseParameter { + /** + * ID of product to be queried. + * Each product ID must exist and be unique in the current app. + * The product ID is the same as that you set when configuring product information in AppGallery Connect. + * + * @type { string } + * @syscap SystemCapability.Payment.IAP + * @since 4.0.0(10) + */ + /** + * ID of product to be queried. + * Each product ID must exist and be unique in the current app. + * The product ID is the same as that you set when configuring product information in AppGallery Connect. + * + * @type { string } + * @syscap SystemCapability.Payment.IAP + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + productId: string; + /** + * Type of a product to be queried. + * + * @type { ProductType } + * @syscap SystemCapability.Payment.IAP + * @since 4.0.0(10) + */ + /** + * Type of a product to be queried. + * + * @type { ProductType } + * @syscap SystemCapability.Payment.IAP + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + productType: ProductType; + /** + * Information stored on the merchant side. + * + * @type { ?string } + * @syscap SystemCapability.Payment.IAP + * @since 4.0.0(10) + */ + /** + * Information stored on the merchant side. + * + * @type { ?string } + * @syscap SystemCapability.Payment.IAP + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + developerPayload?: string; + /** + * This parameter is used to pass the extra fields set by a merchant in a JSON string in the key:value format. + * + * @type { ?string } + * @syscap SystemCapability.Payment.IAP + * @since 4.0.0(10) + */ + /** + * This parameter is used to pass the extra fields set by a merchant in a JSON string in the key:value format. + * + * @type { ?string } + * @syscap SystemCapability.Payment.IAP + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + reservedInfo?: string; + } + /** + * Request parameter of the consumePurchase API. + * + * @typedef ConsumePurchaseParameter + * @syscap SystemCapability.Payment.IAP + * @since 4.0.0(10) + * @deprecated since 4.1.0(11) + */ + interface ConsumePurchaseParameter { + /** + * Purchase token, which is generated by the Huawei IAP server during payment and returned to the app. + * + * @type { string } + * @syscap SystemCapability.Payment.IAP + * @since 4.0.0(10) + */ + purchaseToken: string; + /** + * User-defined challenge, which uniquely identifies a consumption request. + * It is recorded in the purchase information and returned after the consumption is successful. + * + * @type { ?string } + * @syscap SystemCapability.Payment.IAP + * @since 4.0.0(10) + */ + developerChallenge?: string; + } + /** + * Request parameter of the finishPurchase API. + * + * @typedef FinishPurchaseParameter + * @syscap SystemCapability.Payment.IAP + * @since 4.1.0(11) + */ + /** + * Request parameter of the finishPurchase API. + * + * @typedef FinishPurchaseParameter + * @syscap SystemCapability.Payment.IAP + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + interface FinishPurchaseParameter { + /** + * Type of a product to be queried. + * + * @type { ProductType } + * @syscap SystemCapability.Payment.IAP + * @since 4.1.0(11) + */ + /** + * Type of a product to be queried. + * + * @type { ProductType } + * @syscap SystemCapability.Payment.IAP + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + productType: ProductType; + /** + * Purchase token, which is generated by the Huawei IAP server during payment and returned to the app. + * + * @type { string } + * @syscap SystemCapability.Payment.IAP + * @since 4.1.0(11) + */ + /** + * Purchase token, which is generated by the Huawei IAP server during payment and returned to the app. + * + * @type { string } + * @syscap SystemCapability.Payment.IAP + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + purchaseToken: string; + /** + * Purchase order ID returned in the purchase order payload. + * + * @type { string } + * @syscap SystemCapability.Payment.IAP + * @since 4.1.0(11) + */ + /** + * Purchase order ID returned in the purchase order payload. + * + * @type { string } + * @syscap SystemCapability.Payment.IAP + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + purchaseOrderId: string; + } + /** + * QueryPurchasesResult object represents purchased product information. + * + * @typedef QueryPurchasesResult + * @syscap SystemCapability.Payment.IAP + * @since 4.0.0(10) + * @deprecated since 4.1.0(11) + */ + interface QueryPurchasesResult { + /** + * ID list of found products. + * + * @type { string[] } + * @syscap SystemCapability.Payment.IAP + * @since 4.0.0(10) + */ + productList: string[]; + /** + * Information about products that have been purchased but not consumed or about all existing subscription + * relationships of users using the queryOwnedPurchases method. Returned in json strings. + * + * @type { string[] } + * @syscap SystemCapability.Payment.IAP + * @since 4.0.0(10) + */ + inAppPurchaseDataList: string[]; + /** + * Signature character string of each subscription relationship in the inAppPurchaseDataStrList list. + * + * @type { string[] } + * @syscap SystemCapability.Payment.IAP + * @since 4.0.0(10) + */ + inAppSignatureList: string[]; + /** + * Data location flag. + * + * @type { ?string } + * @syscap SystemCapability.Payment.IAP + * @since 4.0.0(10) + */ + continuationToken?: string; + /** + * Signature algorithm. + * + * @type { string } + * @syscap SystemCapability.Payment.IAP + * @since 4.0.0(10) + */ + signatureAlgorithm: string; + } + /** + * Represents signed query purchase result. + * + * @typedef QueryPurchaseResult + * @syscap SystemCapability.Payment.IAP + * @since 4.1.0(11) + */ + /** + * Represents signed query purchase result. + * + * @typedef QueryPurchaseResult + * @syscap SystemCapability.Payment.IAP + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + interface QueryPurchaseResult { + /** + * Signed purchase data list, including purchase order and subscription status. + * + * @type { string[] } + * @syscap SystemCapability.Payment.IAP + * @since 4.1.0(11) + */ + /** + * Signed purchase data list, including purchase order and subscription status. + * + * @type { string[] } + * @syscap SystemCapability.Payment.IAP + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + purchaseDataList: string[]; + /** + * Data location flag. + * + * @type { ?string } + * @syscap SystemCapability.Payment.IAP + * @since 4.1.0(11) + */ + /** + * Data location flag. + * + * @type { ?string } + * @syscap SystemCapability.Payment.IAP + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + continuationToken?: string; + } + /** + * Product information. + * + * @typedef Product + * @syscap SystemCapability.Payment.IAP + * @since 4.0.0(10) + */ + /** + * Product information. + * + * @typedef Product + * @syscap SystemCapability.Payment.IAP + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + interface Product { + /** + * Product ID. + * + * @type { string } + * @syscap SystemCapability.Payment.IAP + * @since 4.0.0(10) + */ + /** + * Product ID. + * + * @type { string } + * @syscap SystemCapability.Payment.IAP + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + id: string; + /** + * Type of a product to be queried. + * + * @type { ProductType } + * @syscap SystemCapability.Payment.IAP + * @since 4.0.0(10) + */ + /** + * Type of a product to be queried. + * + * @type { ProductType } + * @syscap SystemCapability.Payment.IAP + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + type: ProductType; + /** + * Product name, which is set during product information configuration. + * + * @type { string } + * @syscap SystemCapability.Payment.IAP + * @since 4.0.0(10) + */ + /** + * Product name, which is set during product information configuration. + * + * @type { string } + * @syscap SystemCapability.Payment.IAP + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + name: string; + /** + * Description of a product, which is set during product information configuration. + * + * @type { string } + * @syscap SystemCapability.Payment.IAP + * @since 4.0.0(10) + */ + /** + * Description of a product, which is set during product information configuration. + * + * @type { string } + * @syscap SystemCapability.Payment.IAP + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + description: string; + /** + * Displayed price of a product, including the currency symbol and actual price of the product. + * + * @type { string } + * @syscap SystemCapability.Payment.IAP + * @since 4.0.0(10) + * @deprecated since 4.1.0(11) + */ + price: string; + /** + * Displayed price of a product, including the currency symbol and actual price of the product. + * + * @type { ?string } + * @syscap SystemCapability.Payment.IAP + * @since 4.1.0(11) + */ + /** + * Displayed price of a product, including the currency symbol and actual price of the product. + * + * @type { ?string } + * @syscap SystemCapability.Payment.IAP + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + localPrice?: string; + /** + * Product price in micro unit, which equals to the actual product price multiplied by 1,000,000. + * + * @type { number } + * @syscap SystemCapability.Payment.IAP + * @since 4.0.0(10) + */ + /** + * Product price in micro unit, which equals to the actual product price multiplied by 1,000,000. + * + * @type { number } + * @syscap SystemCapability.Payment.IAP + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + microPrice: number; + /** + * Original price of a product, including the currency symbol and actual price of the product. + * + * @type { string } + * @syscap SystemCapability.Payment.IAP + * @since 4.0.0(10) + */ + /** + * Original price of a product, including the currency symbol and actual price of the product. + * + * @type { string } + * @syscap SystemCapability.Payment.IAP + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + originalLocalPrice: string; + /** + * Original price of a product in micro unit, which equals to the original product price multiplied by 1,000,000. + * + * @type { number } + * @syscap SystemCapability.Payment.IAP + * @since 4.0.0(10) + */ + /** + * Original price of a product in micro unit, which equals to the original product price multiplied by 1,000,000. + * + * @type { number } + * @syscap SystemCapability.Payment.IAP + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + originalMicroPrice: number; + /** + * Currency used to pay for a product. + * + * @type { string } + * @syscap SystemCapability.Payment.IAP + * @since 4.0.0(10) + */ + /** + * Currency used to pay for a product. + * + * @type { string } + * @syscap SystemCapability.Payment.IAP + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + currency: string; + /** + * The status of product. + * + * @type { ?ProductStatus } + * @syscap SystemCapability.Payment.IAP + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + status?: ProductStatus; + /** + * The subscription information of auto-renewables product. + * + * @type { ?Subscription } + * @syscap SystemCapability.Payment.IAP + * @since 4.1.0(11) + */ + /** + * The subscription information of auto-renewables product. + * + * @type { ?Subscription } + * @syscap SystemCapability.Payment.IAP + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + subscriptionInfo?: SubscriptionInfo; + /** + * The raw JSON representation of the product information. + * + * @type { ?string } + * @syscap SystemCapability.Payment.IAP + * @since 4.1.0(11) + */ + /** + * The raw JSON representation of the product information. + * + * @type { ?string } + * @syscap SystemCapability.Payment.IAP + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + jsonRepresentation?: string; + } + /** + * Subscription information. + * + * @typedef SubscriptionInfo + * @syscap SystemCapability.Payment.IAP + * @since 4.1.0(11) + */ + /** + * Subscription information. + * + * @typedef SubscriptionInfo + * @syscap SystemCapability.Payment.IAP + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + interface SubscriptionInfo { + /** + * Period unit. + * + * @type { PeriodUnit } + * @syscap SystemCapability.Payment.IAP + * @since 4.1.0(11) + */ + /** + * Period unit. + * + * @type { PeriodUnit } + * @syscap SystemCapability.Payment.IAP + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + periodUnit: PeriodUnit; + /** + * Number of periods. + * + * @type { number } + * @syscap SystemCapability.Payment.IAP + * @since 4.1.0(11) + */ + /** + * Number of periods. + * + * @type { number } + * @syscap SystemCapability.Payment.IAP + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + periodCount: number; + /** + * Subscription group id. + * + * @type { string } + * @syscap SystemCapability.Payment.IAP + * @since 4.1.0(11) + */ + /** + * Subscription group id. + * + * @type { string } + * @syscap SystemCapability.Payment.IAP + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + groupId: string; + /** + * Subscription group level.The rank of the subscription relative to other subscriptions in the same subscription group. + * + * @type { number } + * @syscap SystemCapability.Payment.IAP + * @since 4.1.0(11) + */ + /** + * Subscription group level.The rank of the subscription relative to other subscriptions in the same subscription group. + * + * @type { number } + * @syscap SystemCapability.Payment.IAP + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + groupLevel: number; + /** + * Whether a user has subscribed to promotions in the same group. + * + * @type { ?boolean } + * @syscap SystemCapability.Payment.IAP + * @since 4.1.0(11) + */ + /** + * Whether a user has subscribed to promotions in the same group. + * + * @type { ?boolean } + * @syscap SystemCapability.Payment.IAP + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + hasEligibilityForIntroOffer?: boolean; + /** + * Introductory offer. + * + * @type { ?SubscriptionOffer } + * @syscap SystemCapability.Payment.IAP + * @since 4.1.0(11) + */ + /** + * Introductory offer. + * + * @type { ?SubscriptionOffer } + * @syscap SystemCapability.Payment.IAP + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + introductoryOffer?: SubscriptionOffer; + } + /** + * Subscription offer information. + * + * @typedef SubscriptionOffer + * @syscap SystemCapability.Payment.IAP + * @since 4.1.0(11) + */ + /** + * Subscription offer information. + * + * @typedef SubscriptionOffer + * @syscap SystemCapability.Payment.IAP + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + interface SubscriptionOffer { + /** + * Payment mode of the offer. + * + * @type { OfferPaymentMode } + * @syscap SystemCapability.Payment.IAP + * @since 4.1.0(11) + */ + /** + * Payment mode of the offer. + * + * @type { OfferPaymentMode } + * @syscap SystemCapability.Payment.IAP + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + paymentMode: OfferPaymentMode; + /** + * Period unit. + * + * @type { PeriodUnit } + * @syscap SystemCapability.Payment.IAP + * @since 4.1.0(11) + */ + /** + * Period unit. + * + * @type { PeriodUnit } + * @syscap SystemCapability.Payment.IAP + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + periodUnit: PeriodUnit; + /** + * Number of promotion periods. + * + * @type { number } + * @syscap SystemCapability.Payment.IAP + * @since 4.1.0(11) + */ + /** + * Number of promotion periods. + * + * @type { number } + * @syscap SystemCapability.Payment.IAP + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + periodCount: number; + /** + * Displayed price of the offer, including the currency symbol and actual price of the product. + * + * @type { string } + * @syscap SystemCapability.Payment.IAP + * @since 4.1.0(11) + */ + /** + * Displayed price of the offer, including the currency symbol and actual price of the product. + * + * @type { string } + * @syscap SystemCapability.Payment.IAP + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + localPrice: string; + /** + * Offer price in micro unit, which equals to the actual offer price multiplied by 1,000,000. + * + * @type { number } + * @syscap SystemCapability.Payment.IAP + * @since 4.1.0(11) + */ + /** + * Offer price in micro unit, which equals to the actual offer price multiplied by 1,000,000. + * + * @type { number } + * @syscap SystemCapability.Payment.IAP + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + microPrice: number; + /** + * Subscription offer type. + * + * @type { OfferType } + * @syscap SystemCapability.Payment.IAP + * @since 4.1.0(11) + */ + /** + * Subscription offer type. + * + * @type { OfferType } + * @syscap SystemCapability.Payment.IAP + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + offerType: OfferType; + } + /** + * PurchaseResult object represents purchase result. + * + * @typedef PurchaseResult + * @syscap SystemCapability.Payment.IAP + * @since 4.0.0(10) + * @deprecated since 4.1.0(11) + */ + interface PurchaseResult { + /** + * Information about products that have been purchased. + * + * @type { string } + * @syscap SystemCapability.Payment.IAP + * @since 4.0.0(10) + */ + inAppPurchaseData: string; + /** + * Signature string generated after consumption data is signed using a private payment key. + * + * @type { string } + * @syscap SystemCapability.Payment.IAP + * @since 4.0.0(10) + */ + signature: string; + /** + * Signature algorithm. + * + * @type { string } + * @syscap SystemCapability.Payment.IAP + * @since 4.0.0(10) + */ + signatureAlgorithm: string; + } + /** + * Represents create purchase result. + * + * @typedef CreatePurchaseResult + * @syscap SystemCapability.Payment.IAP + * @since 4.1.0(11) + */ + /** + * Represents create purchase result. + * + * @typedef CreatePurchaseResult + * @syscap SystemCapability.Payment.IAP + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + interface CreatePurchaseResult { + /** + * Purchase data, including purchase order and subscription status. + * + * @type { string } + * @syscap SystemCapability.Payment.IAP + * @since 4.1.0(11) + */ + /** + * Purchase data, including purchase order and subscription status. + * + * @type { string } + * @syscap SystemCapability.Payment.IAP + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + purchaseData: string; + } + /** + * ConsumeResult object represents consume result. + * + * @typedef ConsumeResult + * @syscap SystemCapability.Payment.IAP + * @since 4.0.0(10) + * @deprecated since 4.1.0(11) + */ + interface ConsumeResult { + /** + * Consumption result data. + * + * @type { string } + * @syscap SystemCapability.Payment.IAP + * @since 4.0.0(10) + */ + consumedPurchaseData: string; + /** + * Signature string generated after consumption data is signed using a private payment key. + * + * @type { string } + * @syscap SystemCapability.Payment.IAP + * @since 4.0.0(10) + */ + signature: string; + /** + * Signature algorithm. + * + * @type { string } + * @syscap SystemCapability.Payment.IAP + * @since 4.0.0(10) + */ + signatureAlgorithm: string; + } + /** + * Represents the parameter of UI window. + * + * @typedef UIWindowParameter + * @syscap SystemCapability.Payment.IAP + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + interface UIWindowParameter { + /** + * The window screen mode. + * + * @type { WindowScreenMode } + * @syscap SystemCapability.Payment.IAP + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + windowScreenMode: WindowScreenMode; + } + /** + * Checks whether the currently signed-in HUAWEI ID is located in a country or region where HUAWEI IAP is available. + * + * @param { common.UIAbilityContext } context - The context of an ability. + * @returns { Promise } return void + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 1001860000 - The operation was canceled by the user + * @throws { BusinessError } 1001860001 - System internal error. + * @throws { BusinessError } 1001860004 - Too frequent API calls. + * @throws { BusinessError } 1001860005 - Network connection error. + * @throws { BusinessError } 1001860050 - The HUAWEI ID is not signed in. + * @throws { BusinessError } 1001860054 - The country or region of the signed-in HUAWEI ID does not support IAP. + * @syscap SystemCapability.Payment.IAP + * @since 4.0.0(10) + */ + /** + * Checks whether the currently signed-in HUAWEI ID is located in a country or region where HUAWEI IAP is available. + * + * @param { common.Context } context - The context of an ability. + * @returns { Promise } return void + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 1001860000 - The operation was canceled by the user + * @throws { BusinessError } 1001860001 - System internal error. + * @throws { BusinessError } 1001860004 - Too frequent API calls. + * @throws { BusinessError } 1001860005 - Network connection error. + * @throws { BusinessError } 1001860050 - The HUAWEI ID is not signed in. + * @throws { BusinessError } 1001860054 - The country or region of the signed-in HUAWEI ID does not support IAP. + * @syscap SystemCapability.Payment.IAP + * @since 4.1.0(11) + */ + /** + * Checks whether the currently signed-in HUAWEI ID is located in a country or region where HUAWEI IAP is available. + * + * @param { common.Context } context - The context of an ability. + * @returns { Promise } return void + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 1001860000 - The operation was canceled by the user + * @throws { BusinessError } 1001860001 - System internal error. + * @throws { BusinessError } 1001860004 - Too frequent API calls. + * @throws { BusinessError } 1001860005 - Network connection error. + * @throws { BusinessError } 1001860050 - The HUAWEI ID is not signed in. + * @throws { BusinessError } 1001860054 - The country or region of the signed-in HUAWEI ID does not support IAP. + * @syscap SystemCapability.Payment.IAP + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + function queryEnvironmentStatus(context: common.Context): Promise; + /** + * Checks whether the currently signed-in HUAWEI ID is located in a country or region where HUAWEI IAP is available. + * + * @param { common.UIAbilityContext } context - The context of an ability. + * @param { AsyncCallback } callback - callback + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 1001860000 - The operation was canceled by the user + * @throws { BusinessError } 1001860001 - System internal error. + * @throws { BusinessError } 1001860004 - Too frequent API calls. + * @throws { BusinessError } 1001860005 - Network connection error. + * @throws { BusinessError } 1001860050 - The HUAWEI ID is not signed in. + * @throws { BusinessError } 1001860054 - The country or region of the signed-in HUAWEI ID does not support IAP. + * @syscap SystemCapability.Payment.IAP + * @since 4.0.0(10) + */ + /** + * Checks whether the currently signed-in HUAWEI ID is located in a country or region where HUAWEI IAP is available. + * + * @param { common.Context } context - The context of an ability. + * @param { AsyncCallback } callback - callback + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 1001860000 - The operation was canceled by the user + * @throws { BusinessError } 1001860001 - System internal error. + * @throws { BusinessError } 1001860004 - Too frequent API calls. + * @throws { BusinessError } 1001860005 - Network connection error. + * @throws { BusinessError } 1001860050 - The HUAWEI ID is not signed in. + * @throws { BusinessError } 1001860054 - The country or region of the signed-in HUAWEI ID does not support IAP. + * @syscap SystemCapability.Payment.IAP + * @since 4.1.0(11) + */ + function queryEnvironmentStatus(context: common.Context, callback: AsyncCallback): void; + /** + * Obtains product details configured in AppGallery Connect. + * + * @param { common.UIAbilityContext } context - The context of an ability. + * @param { QueryProductsParameter } parameter - QueryProductsParameter. + * @returns { Promise> } Returns an array of products. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 1001860001 - System internal error. + * @throws { BusinessError } 1001860002 - The application is not authorized. + * @throws { BusinessError } 1001860003 - Invalid product information. + * @throws { BusinessError } 1001860004 - Too frequent API calls. + * @throws { BusinessError } 1001860005 - Network connection error. + * @throws { BusinessError } 1001860007 - The app to which the product belongs is not released in a specified location. + * @throws { BusinessError } 1001860050 - The HUAWEI ID is not signed in. + * @throws { BusinessError } 1001860054 - The country or region of the signed-in HUAWEI ID does not support IAP. + * @syscap SystemCapability.Payment.IAP + * @since 4.0.0(10) + */ + /** + * Obtains product details configured in AppGallery Connect. + * + * @param { common.UIAbilityContext } context - The context of an ability. + * @param { QueryProductsParameter } parameter - QueryProductsParameter. + * @returns { Promise> } Returns an array of products. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 1001860001 - System internal error. + * @throws { BusinessError } 1001860002 - The application is not authorized. + * @throws { BusinessError } 1001860003 - Invalid product information. + * @throws { BusinessError } 1001860004 - Too frequent API calls. + * @throws { BusinessError } 1001860005 - Network connection error. + * @throws { BusinessError } 1001860007 - The app to which the product belongs is not released in a specified location. + * @throws { BusinessError } 1001860050 - The HUAWEI ID is not signed in. + * @throws { BusinessError } 1001860054 - The country or region of the signed-in HUAWEI ID does not support IAP. + * @syscap SystemCapability.Payment.IAP + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + function queryProducts(context: common.UIAbilityContext, parameter: QueryProductsParameter): Promise>; + /** + * Obtains product details configured in AppGallery Connect. + * + * @param { common.UIAbilityContext } context - The context of an ability. + * @param { QueryProductsParameter } parameter - QueryProductsParameter. + * @param { AsyncCallback> } callback - callback with an array of products + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 1001860001 - System internal error. + * @throws { BusinessError } 1001860002 - The application is not authorized. + * @throws { BusinessError } 1001860003 - Invalid product information. + * @throws { BusinessError } 1001860004 - Too frequent API calls. + * @throws { BusinessError } 1001860005 - Network connection error. + * @throws { BusinessError } 1001860007 - The app to which the product belongs is not released in a specified location. + * @throws { BusinessError } 1001860050 - The HUAWEI ID is not signed in. + * @throws { BusinessError } 1001860054 - The country or region of the signed-in HUAWEI ID does not support IAP. + * @syscap SystemCapability.Payment.IAP + * @since 4.0.0(10) + */ + function queryProducts(context: common.UIAbilityContext, parameter: QueryProductsParameter, callback: AsyncCallback>): void; + /** + * Creates orders for products managed by the PMS, including consumables and non-consumables. + * + * @param { common.UIAbilityContext } context - The context of an ability. + * @param { PurchaseParameter } parameter - PurchaseParameter + * @returns { Promise } Returns PurchaseResult. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 1001860000 - The operation was canceled by the user + * @throws { BusinessError } 1001860001 - System internal error. + * @throws { BusinessError } 1001860002 - The application is not authorized. + * @throws { BusinessError } 1001860003 - Invalid product information. + * @throws { BusinessError } 1001860004 - Too frequent API calls. + * @throws { BusinessError } 1001860005 - Network connection error. + * @throws { BusinessError } 1001860007 - The app to which the product belongs is not released in a specified location. + * @throws { BusinessError } 1001860051 - Failed to purchase a product because the user already owns the product. + * @throws { BusinessError } 1001860054 - The country or region of the signed-in HUAWEI ID does not support IAP. + * @throws { BusinessError } 1001860056 - The user is not allowed to make purchase. + * @syscap SystemCapability.Payment.IAP + * @since 4.0.0(10) + * @deprecated since 4.1.0(11) + * @useinstead iap#createPurchase + */ + function purchase(context: common.UIAbilityContext, parameter: PurchaseParameter): Promise; + /** + * Creates orders for products managed by the PMS, including consumables and non-consumables. + * + * @param { common.UIAbilityContext } context - The context of an ability. + * @param { PurchaseParameter } parameter - PurchaseParameter + * @param { AsyncCallback } callback - PurchaseResult. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 1001860000 - The operation was canceled by the user + * @throws { BusinessError } 1001860001 - System internal error. + * @throws { BusinessError } 1001860002 - The application is not authorized. + * @throws { BusinessError } 1001860003 - Invalid product information. + * @throws { BusinessError } 1001860004 - Too frequent API calls. + * @throws { BusinessError } 1001860005 - Network connection error. + * @throws { BusinessError } 1001860007 - The app to which the product belongs is not released in a specified location. + * @throws { BusinessError } 1001860051 - Failed to purchase a product because the user already owns the product. + * @throws { BusinessError } 1001860054 - The country or region of the signed-in HUAWEI ID does not support IAP. + * @throws { BusinessError } 1001860056 - The user is not allowed to make purchase. + * @syscap SystemCapability.Payment.IAP + * @since 4.0.0(10) + * @deprecated since 4.1.0(11) + * @useinstead iap#createPurchase + */ + function purchase(context: common.UIAbilityContext, parameter: PurchaseParameter, callback: AsyncCallback): void; + /** + * Creates orders for products managed by the PMS, including all type of products. + * + * @param { common.UIAbilityContext } context - The context of an ability. + * @param { PurchaseParameter } parameter - Purchase parameter. + * @returns { Promise } Promise used to return the result. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 1001860000 - The operation was canceled by the user + * @throws { BusinessError } 1001860001 - System internal error. + * @throws { BusinessError } 1001860002 - The application is not authorized. + * @throws { BusinessError } 1001860003 - Invalid product information. + * @throws { BusinessError } 1001860004 - Too frequent API calls. + * @throws { BusinessError } 1001860005 - Network connection error. + * @throws { BusinessError } 1001860007 - The app to which the product belongs is not released in a specified location. + * @throws { BusinessError } 1001860051 - Failed to purchase a product because the user already owns the product. + * @throws { BusinessError } 1001860054 - The country or region of the signed-in HUAWEI ID does not support IAP. + * @throws { BusinessError } 1001860056 - The user is not allowed to make purchase. + * @syscap SystemCapability.Payment.IAP + * @since 4.1.0(11) + */ + /** + * Creates orders for products managed by the PMS, including all type of products. + * + * @param { common.UIAbilityContext } context - The context of an ability. + * @param { PurchaseParameter } parameter - Purchase parameter. + * @returns { Promise } Promise used to return the result. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 1001860000 - The operation was canceled by the user + * @throws { BusinessError } 1001860001 - System internal error. + * @throws { BusinessError } 1001860002 - The application is not authorized. + * @throws { BusinessError } 1001860003 - Invalid product information. + * @throws { BusinessError } 1001860004 - Too frequent API calls. + * @throws { BusinessError } 1001860005 - Network connection error. + * @throws { BusinessError } 1001860007 - The app to which the product belongs is not released in a specified location. + * @throws { BusinessError } 1001860051 - Failed to purchase a product because the user already owns the product. + * @throws { BusinessError } 1001860054 - The country or region of the signed-in HUAWEI ID does not support IAP. + * @throws { BusinessError } 1001860056 - The user is not allowed to make purchase. + * @syscap SystemCapability.Payment.IAP + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + function createPurchase(context: common.UIAbilityContext, parameter: PurchaseParameter): Promise; + /** + * Creates orders for products managed by the PMS, including all type of products. + * + * @param { common.UIAbilityContext } context - The context of an ability. + * @param { PurchaseParameter } parameter - Purchase parameter. + * @param { AsyncCallback } callback - The callback of creating purchase result. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 1001860000 - The operation was canceled by the user + * @throws { BusinessError } 1001860001 - System internal error. + * @throws { BusinessError } 1001860002 - The application is not authorized. + * @throws { BusinessError } 1001860003 - Invalid product information. + * @throws { BusinessError } 1001860004 - Too frequent API calls. + * @throws { BusinessError } 1001860005 - Network connection error. + * @throws { BusinessError } 1001860007 - The app to which the product belongs is not released in a specified location. + * @throws { BusinessError } 1001860051 - Failed to purchase a product because the user already owns the product. + * @throws { BusinessError } 1001860054 - The country or region of the signed-in HUAWEI ID does not support IAP. + * @throws { BusinessError } 1001860056 - The user is not allowed to make purchase. + * @syscap SystemCapability.Payment.IAP + * @since 4.1.0(11) + */ + function createPurchase(context: common.UIAbilityContext, parameter: PurchaseParameter, callback: AsyncCallback): void; + /** + * Queries information about all purchased products, including consumables and non-consumables. + * + * @param { common.UIAbilityContext } context - The context of an ability. + * @param { QueryPurchasesParameter } parameter - QueryPurchasesParameter + * @returns { Promise } QueryPurchasesResult + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 1001860001 - System internal error. + * @throws { BusinessError } 1001860002 - The application is not authorized. + * @throws { BusinessError } 1001860003 - Invalid product information. + * @throws { BusinessError } 1001860004 - Too frequent API calls. + * @throws { BusinessError } 1001860005 - Network connection error. + * @throws { BusinessError } 1001860007 - The app to which the product belongs is not released in a specified location. + * @throws { BusinessError } 1001860050 - The HUAWEI ID is not signed in. + * @throws { BusinessError } 1001860053 - The purchase has been finished and cannot be finished again. + * @throws { BusinessError } 1001860054 - The country or region of the signed-in HUAWEI ID does not support IAP. + * @syscap SystemCapability.Payment.IAP + * @since 4.0.0(10) + * @deprecated since 4.1.0(11) + * @useinstead iap#queryPurchases + */ + function queryOwnedPurchases(context: common.UIAbilityContext, parameter: QueryPurchasesParameter): Promise; + /** + * Queries information about all purchased products, including consumables and non-consumables. + * + * @param { common.UIAbilityContext } context - The context of an ability. + * @param { QueryPurchasesParameter } parameter - QueryPurchasesParameter + * @param { AsyncCallback } callback - callback + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 1001860001 - System internal error. + * @throws { BusinessError } 1001860002 - The application is not authorized. + * @throws { BusinessError } 1001860003 - Invalid product information. + * @throws { BusinessError } 1001860004 - Too frequent API calls. + * @throws { BusinessError } 1001860005 - Network connection error. + * @throws { BusinessError } 1001860007 - The app to which the product belongs is not released in a specified location. + * @throws { BusinessError } 1001860050 - The HUAWEI ID is not signed in. + * @throws { BusinessError } 1001860053 - The purchase has been finished and cannot be finished again. + * @throws { BusinessError } 1001860054 - The country or region of the signed-in HUAWEI ID does not support IAP. + * @syscap SystemCapability.Payment.IAP + * @since 4.0.0(10) + * @deprecated since 4.1.0(11) + * @useinstead iap#queryPurchases + */ + function queryOwnedPurchases(context: common.UIAbilityContext, parameter: QueryPurchasesParameter, callback: AsyncCallback): void; + /** + * Consumes a consumable after it is delivered to a user who has completed payment. + * + * @param { common.UIAbilityContext } context - The context of an ability. + * @param { ConsumePurchaseParameter } parameter - Returns PurchaseResult. + * @returns { Promise } Returns PurchaseResult. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 1001860001 - System internal error. + * @throws { BusinessError } 1001860002 - The application is not authorized. + * @throws { BusinessError } 1001860004 - Too frequent API calls. + * @throws { BusinessError } 1001860005 - Network connection error. + * @throws { BusinessError } 1001860007 - The app to which the product belongs is not released in a specified location. + * @throws { BusinessError } 1001860050 - The HUAWEI ID is not signed in. + * @throws { BusinessError } 1001860052 - The purchase cannot be finished because the user has not paid for it. + * @throws { BusinessError } 1001860053 - The purchase has been finished and cannot be finished again. + * @throws { BusinessError } 1001860054 - The country or region of the signed-in HUAWEI ID does not support IAP. + * @syscap SystemCapability.Payment.IAP + * @since 4.0.0(10) + * @deprecated since 4.1.0(11) + * @useinstead iap#finishPurchase + */ + function consumePurchase(context: common.UIAbilityContext, parameter: ConsumePurchaseParameter): Promise; + /** + * Consumes a consumable after it is delivered to a user who has completed payment. + * + * @param { common.UIAbilityContext } context - The context of an ability. + * @param { ConsumePurchaseParameter } parameter - ConsumePurchaseParameter. + * @param { AsyncCallback } callback - callback. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 1001860001 - System internal error. + * @throws { BusinessError } 1001860002 - The application is not authorized. + * @throws { BusinessError } 1001860004 - Too frequent API calls. + * @throws { BusinessError } 1001860005 - Network connection error. + * @throws { BusinessError } 1001860007 - The app to which the product belongs is not released in a specified location. + * @throws { BusinessError } 1001860050 - The HUAWEI ID is not signed in. + * @throws { BusinessError } 1001860052 - The purchase cannot be finished because the user has not paid for it. + * @throws { BusinessError } 1001860053 - The purchase has been finished and cannot be finished again. + * @throws { BusinessError } 1001860054 - The country or region of the signed-in HUAWEI ID does not support IAP. + * @syscap SystemCapability.Payment.IAP + * @since 4.0.0(10) + * @deprecated since 4.1.0(11) + * @useinstead iap#finishPurchase + */ + function consumePurchase(context: common.UIAbilityContext, parameter: ConsumePurchaseParameter, callback: AsyncCallback): void; + /** + * Completes the purchase after delivering the purchased content or enable the purchased service to user. + * + * @param { common.UIAbilityContext } context - The context of an ability. + * @param { FinishPurchaseParameter } parameter - The request parameter for finishing purchase. + * @returns { Promise } Returns void. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 1001860001 - System internal error. + * @throws { BusinessError } 1001860002 - The application is not authorized. + * @throws { BusinessError } 1001860004 - Too frequent API calls. + * @throws { BusinessError } 1001860005 - Network connection error. + * @throws { BusinessError } 1001860050 - The HUAWEI ID is not signed in. + * @throws { BusinessError } 1001860052 - The purchase cannot be finished because the user has not paid for it. + * @throws { BusinessError } 1001860053 - The purchase has been finished and cannot be finished again. + * @throws { BusinessError } 1001860054 - The country or region of the signed-in HUAWEI ID does not support IAP. + * @syscap SystemCapability.Payment.IAP + * @since 4.1.0(11) + */ + /** + * Completes the purchase after delivering the purchased content or enable the purchased service to user. + * + * @param { common.UIAbilityContext } context - The context of an ability. + * @param { FinishPurchaseParameter } parameter - The request parameter for finishing purchase. + * @returns { Promise } Returns void. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 1001860001 - System internal error. + * @throws { BusinessError } 1001860002 - The application is not authorized. + * @throws { BusinessError } 1001860004 - Too frequent API calls. + * @throws { BusinessError } 1001860005 - Network connection error. + * @throws { BusinessError } 1001860050 - The HUAWEI ID is not signed in. + * @throws { BusinessError } 1001860052 - The purchase cannot be finished because the user has not paid for it. + * @throws { BusinessError } 1001860053 - The purchase has been finished and cannot be finished again. + * @throws { BusinessError } 1001860054 - The country or region of the signed-in HUAWEI ID does not support IAP. + * @syscap SystemCapability.Payment.IAP + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + function finishPurchase(context: common.UIAbilityContext, parameter: FinishPurchaseParameter): Promise; + /** + * Completes the purchase after delivering the purchased content or enable the purchased service to user. + * + * @param { common.UIAbilityContext } context - The context of an ability. + * @param { FinishPurchaseParameter } parameter - The request parameter for finishing purchase. + * @param { AsyncCallback } callback - callback. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 1001860001 - System internal error. + * @throws { BusinessError } 1001860002 - The application is not authorized. + * @throws { BusinessError } 1001860004 - Too frequent API calls. + * @throws { BusinessError } 1001860005 - Network connection error. + * @throws { BusinessError } 1001860050 - The HUAWEI ID is not signed in. + * @throws { BusinessError } 1001860052 - The purchase cannot be finished because the user has not paid for it. + * @throws { BusinessError } 1001860053 - The purchase has been finished and cannot be finished again. + * @throws { BusinessError } 1001860054 - The country or region of the signed-in HUAWEI ID does not support IAP. + * @syscap SystemCapability.Payment.IAP + * @since 4.1.0(11) + */ + function finishPurchase(context: common.UIAbilityContext, parameter: FinishPurchaseParameter, callback: AsyncCallback): void; + /** + * Obtains the historical consumption information about consumable receipts. + * + * @param { common.UIAbilityContext } context - The context of an ability. + * @param { QueryPurchasesParameter } parameter - QueryPurchasesParameter. + * @returns { Promise } return QueryPurchasesResult + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 1001860001 - System internal error. + * @throws { BusinessError } 1001860002 - The application is not authorized. + * @throws { BusinessError } 1001860004 - Too frequent API calls. + * @throws { BusinessError } 1001860005 - Network connection error. + * @throws { BusinessError } 1001860050 - The HUAWEI ID is not signed in. + * @syscap SystemCapability.Payment.IAP + * @since 4.0.0(10) + * @deprecated since 4.1.0(11) + * @useinstead iap#queryPurchases + */ + function queryPurchaseRecords(context: common.UIAbilityContext, parameter: QueryPurchasesParameter): Promise; + /** + * Obtains the historical consumption information about consumable receipts. + * + * @param { common.UIAbilityContext } context - The context of an ability. + * @param { QueryPurchasesParameter } parameter - parameter of type QueryPurchasesParameter. + * @param { AsyncCallback } callback - callback. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 1001860001 - System internal error. + * @throws { BusinessError } 1001860002 - The application is not authorized. + * @throws { BusinessError } 1001860004 - Too frequent API calls. + * @throws { BusinessError } 1001860005 - Network connection error. + * @throws { BusinessError } 1001860050 - The HUAWEI ID is not signed in. + * @syscap SystemCapability.Payment.IAP + * @since 4.0.0(10) + * @deprecated since 4.1.0(11) + * @useinstead iap#queryPurchases + */ + function queryPurchaseRecords(context: common.UIAbilityContext, parameter: QueryPurchasesParameter, callback: AsyncCallback): void; + /** + * Obtains the purchased data information. + * + * @param { common.UIAbilityContext } context - The context of an ability. + * @param { QueryPurchasesParameter } parameter - Query purchases parameter. + * @returns { Promise } Promise used to return the result. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 1001860001 - System internal error. + * @throws { BusinessError } 1001860002 - The application is not authorized. + * @throws { BusinessError } 1001860004 - Too frequent API calls. + * @throws { BusinessError } 1001860005 - Network connection error. + * @throws { BusinessError } 1001860050 - The HUAWEI ID is not signed in. + * @throws { BusinessError } 1001860054 - The country or region of the signed-in HUAWEI ID does not support IAP. + * @syscap SystemCapability.Payment.IAP + * @since 4.1.0(11) + */ + /** + * Obtains the purchased data information. + * + * @param { common.UIAbilityContext } context - The context of an ability. + * @param { QueryPurchasesParameter } parameter - Query purchases parameter. + * @returns { Promise } Promise used to return the result. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 1001860001 - System internal error. + * @throws { BusinessError } 1001860002 - The application is not authorized. + * @throws { BusinessError } 1001860004 - Too frequent API calls. + * @throws { BusinessError } 1001860005 - Network connection error. + * @throws { BusinessError } 1001860050 - The HUAWEI ID is not signed in. + * @throws { BusinessError } 1001860054 - The country or region of the signed-in HUAWEI ID does not support IAP. + * @syscap SystemCapability.Payment.IAP + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + function queryPurchases(context: common.UIAbilityContext, parameter: QueryPurchasesParameter): Promise; + /** + * Obtains the purchased data information. + * + * @param { common.UIAbilityContext } context - The context of an ability. + * @param { QueryPurchasesParameter } parameter - Query purchases parameter. + * @param { AsyncCallback } callback - The callback of querying purchases. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 1001860001 - System internal error. + * @throws { BusinessError } 1001860002 - The application is not authorized. + * @throws { BusinessError } 1001860004 - Too frequent API calls. + * @throws { BusinessError } 1001860005 - Network connection error. + * @throws { BusinessError } 1001860050 - The HUAWEI ID is not signed in. + * @throws { BusinessError } 1001860054 - The country or region of the signed-in HUAWEI ID does not support IAP. + * @syscap SystemCapability.Payment.IAP + * @since 4.1.0(11) + */ + function queryPurchases(context: common.UIAbilityContext, parameter: QueryPurchasesParameter, callback: AsyncCallback): void; + /** + * Show subscription management page, include subscription list and detail. + * + * @param { common.Context } context - The context of an ability. + * @param { UIWindowParameter } uiParameter - A parameter that manages the ui window style. + * @param { ?string } groupId - Subscription group id. + * @returns { Promise } return void + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 1001860001 - System internal error. + * @throws { BusinessError } 1001860004 - Too frequent API calls. + * @throws { BusinessError } 1001860005 - Network connection error. + * @throws { BusinessError } 1001860050 - The HUAWEI ID is not signed in. + * @throws { BusinessError } 1001860054 - The country or region of the signed-in HUAWEI ID does not support IAP. + * @syscap SystemCapability.Payment.IAP + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + function showManagedSubscriptions(context: common.Context, uiParameter: UIWindowParameter, groupId?: string): Promise; + /** + * Checks whether the signed-in HUAWEI ID and the app provision type meet the requirements of the sandbox testing. + * + * @param { common.Context } context - The context of an ability. + * @returns { Promise } If in sandbox environment return true, otherwise return false. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 1001860001 - System internal error. + * @throws { BusinessError } 1001860002 - The application is not authorized. + * @throws { BusinessError } 1001860004 - Too frequent API calls. + * @throws { BusinessError } 1001860005 - Network connection error. + * @throws { BusinessError } 1001860050 - The HUAWEI ID is not signed in. + * @throws { BusinessError } 1001860054 - The country or region of the signed-in HUAWEI ID does not support IAP. + * @throws { BusinessError } 1001860057 - The app provision type is not debug. + * @throws { BusinessError } 1001860058 - The HUAWEI ID is not test account. + * @syscap SystemCapability.Payment.IAP + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + function isSandboxActivated(context: common.Context): Promise; + /** + * Indicates the product Type. + * + * @enum { number } + * @syscap SystemCapability.Payment.IAP + * @since 4.0.0(10) + */ + /** + * Indicates the product Type. + * + * @enum { number } + * @syscap SystemCapability.Payment.IAP + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + enum ProductType { + /** + * Consumable product + * + * @syscap SystemCapability.Payment.IAP + * @since 4.0.0(10) + */ + /** + * Consumable product + * + * @syscap SystemCapability.Payment.IAP + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + CONSUMABLE = 0, + /** + * Non-Consumable product for one time purchase + * + * @syscap SystemCapability.Payment.IAP + * @since 4.0.0(10) + */ + /** + * Non-Consumable product for one time purchase + * + * @syscap SystemCapability.Payment.IAP + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + NONCONSUMABLE = 1, + /** + * Auto-renewable subscription product + * + * @syscap SystemCapability.Payment.IAP + * @since 4.1.0(11) + */ + /** + * Auto-renewable subscription product + * + * @syscap SystemCapability.Payment.IAP + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + AUTORENEWABLE = 2 + } + /** + * Indicates the purchase querying type. + * + * @enum { number } + * @syscap SystemCapability.Payment.IAP + * @since 4.1.0(11) + */ + /** + * Indicates the purchase querying type. + * + * @enum { number } + * @syscap SystemCapability.Payment.IAP + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + enum PurchaseQueryType { + /** + * All purchases, including purchased consumables, non-consumables and auto-renewables history. + * + * @syscap SystemCapability.Payment.IAP + * @since 4.1.0(11) + */ + /** + * All purchases, including purchased consumables, non-consumables and auto-renewables history. + * + * @syscap SystemCapability.Payment.IAP + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + ALL = 0, + /** + * Purchased but not delivered products. + * + * @syscap SystemCapability.Payment.IAP + * @since 4.1.0(11) + */ + /** + * Purchased but not delivered products. + * + * @syscap SystemCapability.Payment.IAP + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + UNFINISHED = 1, + /** + * Purchased non-consumable and auto-renewables currently in effect. + * + * @syscap SystemCapability.Payment.IAP + * @since 4.1.0(11) + */ + /** + * Purchased non-consumable and auto-renewables currently in effect. + * + * @syscap SystemCapability.Payment.IAP + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + CURRENT_ENTITLEMENT = 2 + } + /** + * Indicates the subscription period unit. + * + * @enum { number } + * @syscap SystemCapability.Payment.IAP + * @since 4.1.0(11) + */ + /** + * Indicates the subscription period unit. + * + * @enum { number } + * @syscap SystemCapability.Payment.IAP + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + enum PeriodUnit { + /** + * Day unit. + * + * @syscap SystemCapability.Payment.IAP + * @since 4.1.0(11) + */ + /** + * Day unit. + * + * @syscap SystemCapability.Payment.IAP + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + DAY = 0, + /** + * Week unit. + * + * @syscap SystemCapability.Payment.IAP + * @since 4.1.0(11) + */ + /** + * Week unit. + * + * @syscap SystemCapability.Payment.IAP + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + WEEK = 1, + /** + * Month unit. + * + * @syscap SystemCapability.Payment.IAP + * @since 4.1.0(11) + */ + /** + * Month unit. + * + * @syscap SystemCapability.Payment.IAP + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + MONTH = 2, + /** + * Year unit. + * + * @syscap SystemCapability.Payment.IAP + * @since 4.1.0(11) + */ + /** + * Year unit. + * + * @syscap SystemCapability.Payment.IAP + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + YEAR = 3, + /** + * Minute unit. + * + * @syscap SystemCapability.Payment.IAP + * @since 4.1.0(11) + */ + /** + * Minute unit. + * + * @syscap SystemCapability.Payment.IAP + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + MINUTE = 4 + } + /** + * Indicates the payment mode of subscription offer. + * + * @enum { number } + * @syscap SystemCapability.Payment.IAP + * @since 4.1.0(11) + */ + /** + * Indicates the payment mode of subscription offer. + * + * @enum { number } + * @syscap SystemCapability.Payment.IAP + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + enum OfferPaymentMode { + /** + * Free trial. + * + * @syscap SystemCapability.Payment.IAP + * @since 4.1.0(11) + */ + /** + * Free trial. + * + * @syscap SystemCapability.Payment.IAP + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + FREE_TRIAL = 1, + /** + * Indicates the discount applies over a single billing period or multiple billing periods. + * + * @syscap SystemCapability.Payment.IAP + * @since 4.1.0(11) + */ + /** + * Indicates the discount applies over a single billing period or multiple billing periods. + * + * @syscap SystemCapability.Payment.IAP + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + PAY_AS_YOU_GO = 2, + /** + * Indicates the system applies the discount up front. + * + * @syscap SystemCapability.Payment.IAP + * @since 4.1.0(11) + */ + /** + * Indicates the system applies the discount up front. + * + * @syscap SystemCapability.Payment.IAP + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + PAY_UP_FRONT = 3 + } + /** + * Indicates the type of subscription offer. + * + * @enum { number } + * @syscap SystemCapability.Payment.IAP + * @since 4.1.0(11) + */ + /** + * Indicates the type of subscription offer. + * + * @enum { number } + * @syscap SystemCapability.Payment.IAP + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + enum OfferType { + /** + * Introductory offer. + * + * @syscap SystemCapability.Payment.IAP + * @since 4.1.0(11) + */ + /** + * Introductory offer. + * + * @syscap SystemCapability.Payment.IAP + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + INTRODUCTORY = 0, + /** + * Promotional offer. + * + * @syscap SystemCapability.Payment.IAP + * @since 4.1.0(11) + */ + /** + * Promotional offer. + * + * @syscap SystemCapability.Payment.IAP + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + PROMOTIONAL = 1 + } + /** + * Indicates the screen mode of window. + * + * @enum { number } + * @syscap SystemCapability.Payment.IAP + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + enum WindowScreenMode { + /** + * Semi-modal dialog box. + * + * @syscap SystemCapability.Payment.IAP + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + DIALOG_BOX = 1, + /** + * Full screen. + * + * @syscap SystemCapability.Payment.IAP + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + FULLSCREEN = 2 + } + /** + * Indicates the product status. + * + * @enum { number } + * @syscap SystemCapability.Payment.IAP + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + enum ProductStatus { + /** + * Valid. + * + * @syscap SystemCapability.Payment.IAP + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + VALID = 0, + /** + * Cancled. Products in this status cannot be renewed or subscribed to. + * + * @syscap SystemCapability.Payment.IAP + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + CANCELED = 1, + /** + * Offline. New subscription is not allowed, but existed subscription can be renewed. + * + * @syscap SystemCapability.Payment.IAP + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + OFFLINE = 3 + } + /** + * Indicates the iap error code. + * + * @enum { number } + * @syscap SystemCapability.Payment.IAP + * @since 4.1.0(11) + */ + /** + * Indicates the iap error code. + * + * @enum { number } + * @syscap SystemCapability.Payment.IAP + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + enum IAPErrorCode { + /** + * The operation was canceled by the user. + * + * @syscap SystemCapability.Payment.IAP + * @since 4.1.0(11) + */ + /** + * The operation was canceled by the user. + * + * @syscap SystemCapability.Payment.IAP + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + USER_CANCELED = 1001860000, + /** + * System internal error. + * + * @syscap SystemCapability.Payment.IAP + * @since 4.1.0(11) + */ + /** + * System internal error. + * + * @syscap SystemCapability.Payment.IAP + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + SYSTEM_ERROR = 1001860001, + /** + * The application is not authorized. + * + * @syscap SystemCapability.Payment.IAP + * @since 4.1.0(11) + */ + /** + * The application is not authorized. + * + * @syscap SystemCapability.Payment.IAP + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + APP_NOT_AUTHORIZED = 1001860002, + /** + * Invalid product information. + * + * @syscap SystemCapability.Payment.IAP + * @since 4.1.0(11) + */ + /** + * Invalid product information. + * + * @syscap SystemCapability.Payment.IAP + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + INVALID_PRODUCT = 1001860003, + /** + * Too frequent API calls. + * + * @syscap SystemCapability.Payment.IAP + * @since 4.1.0(11) + */ + /** + * Too frequent API calls. + * + * @syscap SystemCapability.Payment.IAP + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + FREQUENT_CALLS = 1001860004, + /** + * Network connection error. + * + * @syscap SystemCapability.Payment.IAP + * @since 4.1.0(11) + */ + /** + * Network connection error. + * + * @syscap SystemCapability.Payment.IAP + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + NETWORK_ERROR = 1001860005, + /** + * The app to which the product belongs is not released in a specified location. + * + * @syscap SystemCapability.Payment.IAP + * @since 4.1.0(11) + */ + /** + * The app to which the product belongs is not released in a specified location. + * + * @syscap SystemCapability.Payment.IAP + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + PRODUCT_TERRITORY_NOT_SUPPORTED = 1001860007, + /** + * The HUAWEI ID is not signed in. + * + * @syscap SystemCapability.Payment.IAP + * @since 4.1.0(11) + */ + /** + * The HUAWEI ID is not signed in. + * + * @syscap SystemCapability.Payment.IAP + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + ACCOUNT_NOT_LOGGED_IN = 1001860050, + /** + * Failed to purchase a product because the user already owns the product. + * + * @syscap SystemCapability.Payment.IAP + * @since 4.1.0(11) + */ + /** + * Failed to purchase a product because the user already owns the product. + * + * @syscap SystemCapability.Payment.IAP + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + PRODUCT_OWNED = 1001860051, + /** + * The purchase cannot be finished because the user has not paid for it. + * + * @syscap SystemCapability.Payment.IAP + * @since 4.1.0(11) + */ + /** + * The purchase cannot be finished because the user has not paid for it. + * + * @syscap SystemCapability.Payment.IAP + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + PURCHASE_NOT_PAID = 1001860052, + /** + * The purchase has been finished and cannot be finished again. + * + * @syscap SystemCapability.Payment.IAP + * @since 4.1.0(11) + */ + /** + * The purchase has been finished and cannot be finished again. + * + * @syscap SystemCapability.Payment.IAP + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + PURCHASE_FINISHED = 1001860053, + /** + * The country or region of the signed-in HUAWEI ID does not support IAP. + * + * @syscap SystemCapability.Payment.IAP + * @since 4.1.0(11) + */ + /** + * The country or region of the signed-in HUAWEI ID does not support IAP. + * + * @syscap SystemCapability.Payment.IAP + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + ACCOUNT_TERRITORY_NOT_SUPPORTED = 1001860054, + /** + * The user is not allowed to make purchase. + * + * @syscap SystemCapability.Payment.IAP + * @since 4.1.0(11) + */ + /** + * The user is not allowed to make purchase. + * + * @syscap SystemCapability.Payment.IAP + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + USER_NOT_ALLOWED = 1001860056, + /** + * The app provision type is not debug. + * + * @syscap SystemCapability.Payment.IAP + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + APP_NOT_DEBUG = 1001860057, + /** + * The HUAWEI ID is not test account. + * + * @syscap SystemCapability.Payment.IAP + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + ACCOUNT_NOT_TEST = 1001860058 + } +} +export default iap; diff --git a/language/arkts/extractor/sdk/hms/ets/api/@hms.core.liveview.LiveViewLockScreenExtensionAbility.d.ts b/language/arkts/extractor/sdk/hms/ets/api/@hms.core.liveview.LiveViewLockScreenExtensionAbility.d.ts new file mode 100755 index 00000000..09c6afd1 --- /dev/null +++ b/language/arkts/extractor/sdk/hms/ets/api/@hms.core.liveview.LiveViewLockScreenExtensionAbility.d.ts @@ -0,0 +1,28 @@ +/* + * Copyright (c) Huawei Technologies Co., Ltd. 2024. All rights reserved. + */ +/** + * @file Defines extension context of liveview lock screen extension. + * @kit LiveViewKit + */ +import type LiveViewLockScreenExtensionContext from '@hms.core.liveview.LiveViewLockScreenExtensionContext'; +import UIExtensionAbility from '@ohos.app.ability.UIExtensionAbility'; +/** + * The extension context of liveview lock screen extension. + * + * @extends UIExtensionAbility + * @syscap SystemCapability.LiveView.LiveViewService + * @StageModelOnly + * @since 5.0.0(12) + */ +export default class LiveViewLockScreenExtensionAbility extends UIExtensionAbility { + /** + * Indicates liveview lock screen extension context. + * + * @type { LiveViewLockScreenExtensionContext } + * @syscap SystemCapability.LiveView.LiveViewService + * @StageModelOnly + * @since 5.0.0(12) + */ + context: LiveViewLockScreenExtensionContext; +} diff --git a/language/arkts/extractor/sdk/hms/ets/api/@hms.core.liveview.LiveViewLockScreenExtensionContext.d.ts b/language/arkts/extractor/sdk/hms/ets/api/@hms.core.liveview.LiveViewLockScreenExtensionContext.d.ts new file mode 100755 index 00000000..fc9e428e --- /dev/null +++ b/language/arkts/extractor/sdk/hms/ets/api/@hms.core.liveview.LiveViewLockScreenExtensionContext.d.ts @@ -0,0 +1,18 @@ +/* + * Copyright (c) Huawei Technologies Co., Ltd. 2024. All rights reserved. + */ +/** + * @file Defines extension context of liveview lock screen extension. + * @kit LiveViewKit + */ +import ExtensionContext from '@ohos.inner.application.ExtensionContext'; +/** + * The extension context of liveview lock screen extension. + * + * @extends ExtensionContext + * @syscap SystemCapability.LiveView.LiveViewService + * @StageModelOnly + * @since 5.0.0(12) + */ +export default class LiveViewLockScreenExtensionContext extends ExtensionContext { +} diff --git a/language/arkts/extractor/sdk/hms/ets/api/@hms.core.liveview.liveViewManager.d.ts b/language/arkts/extractor/sdk/hms/ets/api/@hms.core.liveview.liveViewManager.d.ts new file mode 100755 index 00000000..50ff0006 --- /dev/null +++ b/language/arkts/extractor/sdk/hms/ets/api/@hms.core.liveview.liveViewManager.d.ts @@ -0,0 +1,1195 @@ +/* + * Copyright (c) Huawei Technologies Co., Ltd. 2023-2024. All rights reserved. + */ +/** + * @file Defines liveView capability. + * @kit LiveViewKit + */ +import type { WantAgent } from '@ohos.wantAgent'; +import type image from '@ohos.multimedia.image'; +/** + * Manages liveView. + * + * @namespace liveViewManager + * @syscap SystemCapability.LiveView.LiveViewService + * @StageModelOnly + * @since 4.1.0(11) + */ +declare namespace liveViewManager { + /** + * Checks whether this application allows to create liveView. + * + * @returns { Promise } Returns the result of obtaining liveView enable status in the form of Promise. + * @throws { BusinessError } 1003500001 - Internal error. + * @throws { BusinessError } 1003500002 - Marshalling or unmarshalling error. + * @throws { BusinessError } 1003500003 - Failed to connect service. + * @syscap SystemCapability.LiveView.LiveViewService + * @StageModelOnly + * @since 4.1.0(11) + */ + function isLiveViewEnabled(): Promise; + /** + * start a liveView. + * + * @param { LiveView } LiveView - a liveView. + * @returns { Promise } Returns the result of starting the liveView in the form of Promise. + * @throws { BusinessError } 401 - The parameter check failed. + * @throws { BusinessError } 1003500001 - Internal error. + * @throws { BusinessError } 1003500002 - Marshalling or unmarshalling error. + * @throws { BusinessError } 1003500003 - Failed to connect service. + * @throws { BusinessError } 1003500004 - LiveView is not enabled. + * @throws { BusinessError } 1003500005 - The right of liveView is not enabled. + * @throws { BusinessError } 1003500006 - The liveView already exists. + * @throws { BusinessError } 1003500007 - Couldn't connect to server. + * @throws { BusinessError } 1003500008 - Over max number liveViews per second. + * @syscap SystemCapability.LiveView.LiveViewService + * @StageModelOnly + * @since 4.1.0(11) + */ + function startLiveView(liveView: LiveView): Promise; + /** + * update the liveView. + * + * @param { LiveView } LiveView - a liveView. + * @returns { Promise } Returns the result of updating the liveView in the form of Promise. + * @throws { BusinessError } 401 - The parameter check failed. + * @throws { BusinessError } 1003500001 - Internal error. + * @throws { BusinessError } 1003500002 - Marshalling or unmarshalling error. + * @throws { BusinessError } 1003500003 - Failed to connect service. + * @throws { BusinessError } 1003500004 - LiveView is not enabled. + * @throws { BusinessError } 1003500008 - Over max number liveViews per second. + * @throws { BusinessError } 1003500009 - The liveView does not exist. + * @throws { BusinessError } 1003500010 - The liveView has ended. + * @throws { BusinessError } 1003500011 - The liveView sequence is incorrect. + * @syscap SystemCapability.LiveView.LiveViewService + * @StageModelOnly + * @since 4.1.0(11) + */ + function updateLiveView(liveView: LiveView): Promise; + /** + * stop the liveView. + * + * @param { LiveView } LiveView - a liveView. + * @returns { Promise } Returns the result of stopping the liveView in the form of Promise. + * @throws { BusinessError } 401 - The parameter check failed. + * @throws { BusinessError } 1003500001 - Internal error. + * @throws { BusinessError } 1003500002 - Marshalling or unmarshalling error. + * @throws { BusinessError } 1003500003 - Failed to connect service. + * @throws { BusinessError } 1003500004 - LiveView is not enabled. + * @throws { BusinessError } 1003500008 - Over max number liveViews per second. + * @throws { BusinessError } 1003500009 - The liveView does not exist. + * @throws { BusinessError } 1003500010 - The liveView has ended. + * @throws { BusinessError } 1003500011 - The liveView sequence is incorrect. + * @syscap SystemCapability.LiveView.LiveViewService + * @StageModelOnly + * @since 4.1.0(11) + */ + function stopLiveView(liveView: LiveView): Promise; + /** + * Obtains the active liveView by id. + * + * @param { number } id - the liveView id + * @returns { Promise } Returns the liveView. + * @throws { BusinessError } 401 - The parameter check failed. + * @throws { BusinessError } 1003500001 - Internal error. + * @throws { BusinessError } 1003500002 - Marshalling or unmarshalling error. + * @throws { BusinessError } 1003500003 - Failed to connect service. + * @throws { BusinessError } 1003500009 - The liveView does not exist. + * @syscap SystemCapability.LiveView.LiveViewService + * @StageModelOnly + * @since 4.1.0(11) + */ + function getActiveLiveView(id: number): Promise; + /** + * Defines a LiveView instance. + * + * @typedef LiveView + * @syscap SystemCapability.LiveView.LiveViewService + * @StageModelOnly + * @since 4.1.0(11) + */ + export interface LiveView { + /** + * liveView id. + * + * @type { number } + * @syscap SystemCapability.LiveView.LiveViewService + * @StageModelOnly + * @since 4.1.0(11) + */ + id: number; + /** + * liveView scenario. + * + * @type { string } + * @syscap SystemCapability.LiveView.LiveViewService + * @StageModelOnly + * @since 4.1.0(11) + */ + event: string; + /** + * liveView sequence. + * + * @type { ?number } + * @syscap SystemCapability.LiveView.LiveViewService + * @StageModelOnly + * @since 4.1.0(11) + */ + sequence?: number; + /** + * Obtains the remind mode of the liveView. The default value is false. + * + * @type { ?boolean } + * @syscap SystemCapability.LiveView.LiveViewService + * @StageModelOnly + * @since 4.1.0(11) + */ + isMute?: boolean; + /** + * The Timer of liveView. + * + * @type { ?LiveViewTimer } + * @syscap SystemCapability.LiveView.LiveViewService + * @StageModelOnly + * @since 5.0.0(12) + */ + timer?: LiveViewTimer; + /** + * the liveView data. + * + * @type { LiveViewData } + * @syscap SystemCapability.LiveView.LiveViewService + * @StageModelOnly + * @since 4.1.0(11) + */ + liveViewData: LiveViewData; + } + /** + * liveView data. + * + * @type { LiveViewData } + * @syscap SystemCapability.LiveView.LiveViewService + * @StageModelOnly + * @since 4.1.0(11) + */ + export interface LiveViewData { + /** + * primary content of liveView. + * + * @type { PrimaryData } + * @syscap SystemCapability.LiveView.LiveViewService + * @StageModelOnly + * @since 4.1.0(11) + */ + primary: PrimaryData; + /** + * capsule content of liveView. + * + * @type { ?TextCapsule|TimerCapsule|ProgressCapsule } + * @syscap SystemCapability.LiveView.LiveViewService + * @StageModelOnly + * @since 4.1.0(11) + */ + capsule?: TextCapsule | TimerCapsule | ProgressCapsule; + /** + * external screen content of liveView. + * + * @type { ?ExternalForm } + * @syscap SystemCapability.LiveView.LiveViewService + * @StageModelOnly + * @since 4.1.0(11) + */ + external?: ExternalData; + } + /** + * Defines a primary data of liveView instance. + * + * @type { PrimaryData } + * @syscap SystemCapability.LiveView.LiveViewService + * @StageModelOnly + * @since 4.1.0(11) + */ + export interface PrimaryData { + /** + * the title of primary data of liveView. + * + * @type { ?string } + * @syscap SystemCapability.LiveView.LiveViewService + * @StageModelOnly + * @since 4.1.0(11) + */ + title?: string; + /** + * the content of primary data of liveView. + * + * @type { ?Array } + * @syscap SystemCapability.LiveView.LiveViewService + * @StageModelOnly + * @since 4.1.0(11) + */ + content?: Array; + /** + * keep time when the liveView end. + * + * @type { ?number } + * @syscap SystemCapability.LiveView.LiveViewService + * @StageModelOnly + * @since 4.1.0(11) + */ + keepTime?: number; + /** + * The statics picture of liveView in lock screen. + * + * @type { ?string | image.PixelMap } + * @syscap SystemCapability.LiveView.LiveViewService + * @StageModelOnly + * @since 5.0.0(12) + */ + liveViewLockScreenPicture?: string | image.PixelMap; + /** + * The ability name of the liveview lock screen extension. + * + * @type { ?string } + * @syscap SystemCapability.LiveView.LiveViewService + * @StageModelOnly + * @since 5.0.0(12) + */ + liveViewLockScreenAbilityName?: string; + /** + * The paramters to create the liveview lock screen extension. + * + * @type { ?Record } + * @syscap SystemCapability.LiveView.LiveViewService + * @StageModelOnly + * @since 5.0.0(12) + */ + liveViewLockScreenAbilityParameters?: Record; + /** + * WantAgent instance to which the liveView will be clicked. + * + * @type { ?WantAgent } + * @syscap SystemCapability.LiveView.LiveViewService + * @StageModelOnly + * @since 4.1.0(11) + */ + clickAction?: WantAgent; + /** + * extend Content of liveView. + * + * @type { ?ExtensionData } + * @syscap SystemCapability.LiveView.LiveViewService + * @StageModelOnly + * @since 4.1.0(11) + */ + extensionData?: ExtensionData; + /** + * flexible layout content of liveView. + * ProgressLayout is used when the templateType is 3. + * PickupLayout is used when the templateType is 4. + * FlightLayout is used when the templateType is 5. + * ScoreLayout is used when the templateType is 7. + * + * @type { ?ProgressLayout|PickupLayout|FlightLayout|ScoreLayout } + * @syscap SystemCapability.LiveView.LiveViewService + * @StageModelOnly + * @since 4.1.0(11) + */ + /** + * flexible layout content of liveView. + * ProgressLayout is used when the templateType is 3. + * PickupLayout is used when the templateType is 4. + * FlightLayout is used when the templateType is 5. + * ScoreLayout is used when the templateType is 7. + * NavigationLayout is used when the templateType is 8. + * + * @type { ?ProgressLayout|PickupLayout|FlightLayout|ScoreLayout|NavigationLayout } + * @syscap SystemCapability.LiveView.LiveViewService + * @StageModelOnly + * @since 5.0.0(12) + */ + layoutData?: ProgressLayout | PickupLayout | FlightLayout | ScoreLayout | NavigationLayout; + } + /** + * Obtains the type of a liveView layout. + * + * @type { number } + * @syscap SystemCapability.LiveView.LiveViewService + * @StageModelOnly + * @since 4.1.0(11) + */ + export enum LayoutType { + /** + * default value. + * + * @syscap SystemCapability.LiveView.LiveViewService + * @StageModelOnly + * @since 4.1.0(11) + */ + LAYOUT_TYPE_DEFAULT = -1, + /** + * progress type. + * + * @syscap SystemCapability.LiveView.LiveViewService + * @StageModelOnly + * @since 4.1.0(11) + */ + LAYOUT_TYPE_PROGRESS = 3, + /** + * pick up type. + * + * @syscap SystemCapability.LiveView.LiveViewService + * @StageModelOnly + * @since 4.1.0(11) + */ + LAYOUT_TYPE_PICKUP = 4, + /** + * flight type. + * + * @syscap SystemCapability.LiveView.LiveViewService + * @StageModelOnly + * @since 4.1.0(11) + */ + LAYOUT_TYPE_FLIGHT = 5, + /** + * score type. + * + * @syscap SystemCapability.LiveView.LiveViewService + * @StageModelOnly + * @since 4.1.0(11) + */ + LAYOUT_TYPE_SCORE = 7, + /** + * navigation type. + * + * @syscap SystemCapability.LiveView.LiveViewService + * @StageModelOnly + * @since 5.0.0(12) + */ + LAYOUT_TYPE_NAVIGATION = 8 + } + /** + * Defines a extend area content of liveView instance. + * + * @type { ExtensionData } + * @syscap SystemCapability.LiveView.LiveViewService + * @StageModelOnly + * @since 4.1.0(11) + */ + export interface ExtensionData { + /** + * the text of extend area content of liveView. + * + * @type { ?string } + * @syscap SystemCapability.LiveView.LiveViewService + * @StageModelOnly + * @since 4.1.0(11) + */ + text?: string; + /** + * the type of extend area content. + * + * @type { ?number } + * @syscap SystemCapability.LiveView.LiveViewService + * @StageModelOnly + * @since 4.1.0(11) + */ + type?: ExtensionType; + /** + * the picture of extend area content. + * + * @type { string|image.PixelMap } + * @syscap SystemCapability.LiveView.LiveViewService + * @StageModelOnly + * @since 4.1.0(11) + */ + pic?: string | image.PixelMap; + /** + * WantAgent instance to which the extend area will be clicked. + * + * @type { ?WantAgent } + * @syscap SystemCapability.LiveView.LiveViewService + * @StageModelOnly + * @since 4.1.0(11) + */ + clickAction?: WantAgent; + } + /** + * Define a default capsule content of liveView instance. + * + * @type { BasicCapsuleContent } + * @syscap SystemCapability.LiveView.LiveViewService + * @StageModelOnly + * @since 4.1.0(11) + */ + export interface CapsuleData { + /** + * the type of capsule content of liveView. + * + * @type { number } + * @syscap SystemCapability.LiveView.LiveViewService + * @StageModelOnly + * @since 4.1.0(11) + */ + type: CapsuleType; + /** + * the status of capsule content of liveView. + * + * @type { number } + * @syscap SystemCapability.LiveView.LiveViewService + * @StageModelOnly + * @since 4.1.0(11) + */ + status: number; + /** + * the icon of capsule content of liveView.. + * + * @type { ?string|image.PixelMap } + * @syscap SystemCapability.LiveView.LiveViewService + * @StageModelOnly + * @since 4.1.0(11) + */ + icon?: string | image.PixelMap; + /** + * the backgroundColor of capsule content of liveView. + * + * @type { ?string } + * @syscap SystemCapability.LiveView.LiveViewService + * @StageModelOnly + * @since 4.1.0(11) + */ + backgroundColor?: string; + } + /** + * Define a text capsule content of liveView instance, when the type is 1. + * + * @type { TextCapsule } + * @syscap SystemCapability.LiveView.LiveViewService + * @StageModelOnly + * @since 4.1.0(11) + */ + export interface TextCapsule extends CapsuleData { + /** + * the title of capsule content of liveView.. + * + * @type { ?string } + * @syscap SystemCapability.LiveView.LiveViewService + * @StageModelOnly + * @since 4.1.0(11) + */ + title?: string; + /** + * the content of capsule content of liveView. + * + * @type { ?string } + * @syscap SystemCapability.LiveView.LiveViewService + * @StageModelOnly + * @since 4.1.0(11) + */ + content?: string; + } + /** + * Define a timer capsule content of liveView instance, when the type is 2. + * + * @type { TimerCapsule } + * @syscap SystemCapability.LiveView.LiveViewService + * @StageModelOnly + * @since 4.1.0(11) + */ + export interface TimerCapsule extends CapsuleData { + /** + * the content of capsule content of liveView. + * + * @type { ?string } + * @syscap SystemCapability.LiveView.LiveViewService + * @StageModelOnly + * @since 4.1.0(11) + */ + content?: string; + /** + * the time of capsule content of liveView. + * + * @type { ?number } + * @syscap SystemCapability.LiveView.LiveViewService + * @StageModelOnly + * @since 4.1.0(11) + */ + time?: number; + /** + * Indicates whether the capsule of the timer type is countdown,The default value is false. + * + * @type { ?boolean } + * @syscap SystemCapability.LiveView.LiveViewService + * @StageModelOnly + * @since 4.1.0(11) + */ + isCountdown?: boolean; + /** + * Indicates whether the capsule of the timer type pauses timing. The default value is false. + * + * @type { ?boolean } + * @syscap SystemCapability.LiveView.LiveViewService + * @StageModelOnly + * @since 4.1.0(11) + */ + isPaused?: boolean; + } + /** + * Define a progress capsule content of liveView instance, when the type is 2. + * + * @type { ProgressCapsule } + * @syscap SystemCapability.LiveView.LiveViewService + * @StageModelOnly + * @since 4.1.0(11) + */ + export interface ProgressCapsule extends CapsuleData { + /** + * Maximum progress value of the progress bar. + * + * @type { ?number } + * @syscap SystemCapability.LiveView.LiveViewService + * @StageModelOnly + * @since 4.1.0(11) + */ + max?: number; + /** + * current progress value of the progress bar. + * + * @type { ?number } + * @syscap SystemCapability.LiveView.LiveViewService + * @StageModelOnly + * @since 4.1.0(11) + */ + progress?: number; + /** + * Specifies whether the progress is displayed as a percentage or in other forms. + * + * @type { ?boolean } + * @syscap SystemCapability.LiveView.LiveViewService + * @StageModelOnly + * @since 4.1.0(11) + */ + indeterminate?: boolean; + } + /** + * Define a external screen content of liveView instance. + * + * @type { ExternalData } + * @syscap SystemCapability.LiveView.LiveViewService + * @StageModelOnly + * @since 4.1.0(11) + */ + export interface ExternalData { + /** + * the title of external screen content of liveView. + * + * @type { ?string } + * @syscap SystemCapability.LiveView.LiveViewService + * @StageModelOnly + * @since 4.1.0(11) + */ + title?: string; + /** + * the content of external screen content of liveView. + * + * @type { ?Array } + * @syscap SystemCapability.LiveView.LiveViewService + * @StageModelOnly + * @since 4.1.0(11) + */ + content?: Array; + /** + * the backgroundColor of external screen content of liveView. + * + * @type { ?string } + * @syscap SystemCapability.LiveView.LiveViewService + * @StageModelOnly + * @since 4.1.0(11) + */ + backgroundColor?: string; + } + /** + * Define a default layout data of liveView instance. + * + * @type { LayoutData } + * @syscap SystemCapability.LiveView.LiveViewService + * @StageModelOnly + * @since 4.1.0(11) + */ + export interface LayoutData { + /** + * liveView template type. + * + * @type { number } + * @syscap SystemCapability.LiveView.LiveViewService + * @StageModelOnly + * @since 4.1.0(11) + */ + layoutType: LayoutType; + } + /** + * Define a progress layout instance. + * + * @type { progressLayout } + * @syscap SystemCapability.LiveView.LiveViewService + * @StageModelOnly + * @since 4.1.0(11) + */ + export interface ProgressLayout extends LayoutData { + /** + * the current value of progress layout. + * + * @type { number } + * @syscap SystemCapability.LiveView.LiveViewService + * @StageModelOnly + * @since 4.1.0(11) + */ + progress: number; + /** + * the color value of progress layout. + * + * @type { ?string } + * @syscap SystemCapability.LiveView.LiveViewService + * @StageModelOnly + * @since 4.1.0(11) + */ + color?: string; + /** + * the backgroundColor value of progress layout. + * + * @type { ?string } + * @syscap SystemCapability.LiveView.LiveViewService + * @StageModelOnly + * @since 4.1.0(11) + */ + backgroundColor?: string; + /** + * display type of indicator small icon, + * 0: The indicator icon is not displayed. + * 1: displayed above the progress line + * 2: indicates that the display is overwritten on the progress line.. + * + * @type { ?number } + * @syscap SystemCapability.LiveView.LiveViewService + * @StageModelOnly + * @since 4.1.0(11) + */ + indicatorType?: IndicatorType; + /** + * indicator small icon. + * + * @type { ?string|image.PixelMap } + * @syscap SystemCapability.LiveView.LiveViewService + * @StageModelOnly + * @since 4.1.0(11) + */ + indicatorIcon?: string | image.PixelMap; + /** + * the lineType value of progress information. + * + * @type { ?number } + * @syscap SystemCapability.LiveView.LiveViewService + * @StageModelOnly + * @since 4.1.0(11) + */ + lineType?: LineType; + /** + * Node icon on the progress bar of the extend area + * + * @type { ?Array } + * @syscap SystemCapability.LiveView.LiveViewService + * @StageModelOnly + * @since 4.1.0(11) + */ + nodeIcons?: Array; + } + /** + * Define the pickup layout data instance when the layoutType is 3. + * + * @type { PickupLayout } + * @syscap SystemCapability.LiveView.LiveViewService + * @StageModelOnly + * @since 4.1.0(11) + */ + export interface PickupLayout extends LayoutData { + /** + * The title of PickupLayout. + * + * @type { ?string } + * @syscap SystemCapability.LiveView.LiveViewService + * @StageModelOnly + * @since 4.1.0(11) + */ + title?: string; + /** + * The content of PickupLayout. + * + * @type { ?string } + * @syscap SystemCapability.LiveView.LiveViewService + * @StageModelOnly + * @since 4.1.0(11) + */ + content?: string; + /** + * underlineColor of the content. + * + * @type { ?string } + * @syscap SystemCapability.LiveView.LiveViewService + * @StageModelOnly + * @since 4.1.0(11) + */ + underlineColor?: string; + /** + * the descImage of extend area content of liveView. + * + * @type { ?string|image.PixelMap } + * @syscap SystemCapability.LiveView.LiveViewService + * @StageModelOnly + * @since 4.1.0(11) + */ + descPic?: string | image.PixelMap; + } + /** + * Define the flight layout data instance when the layoutType is 4. + * + * @type { FlightLayout } + * @syscap SystemCapability.LiveView.LiveViewService + * @StageModelOnly + * @since 4.1.0(11) + */ + export interface FlightLayout extends LayoutData { + /** + * The title on the left in FlightLayout. + * + * @type { ?string } + * @syscap SystemCapability.LiveView.LiveViewService + * @StageModelOnly + * @since 4.1.0(11) + */ + firstTitle?: string; + /** + * The content on the right in FlightLayout. + * + * @type { ?string } + * @syscap SystemCapability.LiveView.LiveViewService + * @StageModelOnly + * @since 4.1.0(11) + */ + firstContent?: string; + /** + * The title on the right in FlightLayout. + * + * @type { ?string } + * @syscap SystemCapability.LiveView.LiveViewService + * @StageModelOnly + * @since 4.1.0(11) + */ + lastTitle?: string; + /** + * The content on the right in FlightLayout. + * + * @type { ?string } + * @syscap SystemCapability.LiveView.LiveViewService + * @StageModelOnly + * @since 4.1.0(11) + */ + lastContent?: string; + /** + * Interval icon display in the middle of the FlightLayout + * + * @type { ?string|image.PixelMap } + * @syscap SystemCapability.LiveView.LiveViewService + * @StageModelOnly + * @since 4.1.0(11) + */ + spaceIcon?: string | image.PixelMap; + /** + * Indicates whether to display the split line above the FlightLayout. + * + * @type { ?boolean } + * @syscap SystemCapability.LiveView.LiveViewService + * @StageModelOnly + * @since 4.1.0(11) + */ + isHorizontalLineDisplayed?: boolean; + /** + * Additional information in FlightLayout. + * + * @type { ?string } + * @syscap SystemCapability.LiveView.LiveViewService + * @StageModelOnly + * @since 5.0.0(12) + */ + additionalText?: string; + } + /** + * Define a template data instance when the layoutType is 7. + * + * @type { ScoreLayout } + * @syscap SystemCapability.LiveView.LiveViewService + * @StageModelOnly + * @since 4.1.0(11) + */ + export interface ScoreLayout extends LayoutData { + /** + * The name on the left in ScoreLayout. + * + * @type { ?string } + * @syscap SystemCapability.LiveView.LiveViewService + * @StageModelOnly + * @since 4.1.0(11) + */ + hostName?: string; + /** + * The icon on the left in ScoreLayout. + * + * @type { ?string|image.PixelMap } + * @syscap SystemCapability.LiveView.LiveViewService + * @StageModelOnly + * @since 4.1.0(11) + */ + hostIcon?: string | image.PixelMap; + /** + * The score on the left in ScoreLayout. + * + * @type { ?string } + * @syscap SystemCapability.LiveView.LiveViewService + * @StageModelOnly + * @since 4.1.0(11) + */ + hostScore?: string; + /** + * The name on the right in ScoreLayout. + * + * @type { ?string } + * @syscap SystemCapability.LiveView.LiveViewService + * @StageModelOnly + * @since 4.1.0(11) + */ + guestName?: string; + /** + * The icon on the right in ScoreLayout. + * + * @type { ?string|image.PixelMap } + * @syscap SystemCapability.LiveView.LiveViewService + * @StageModelOnly + * @since 4.1.0(11) + */ + guestIcon?: string | image.PixelMap; + /** + * The score on the right in ScoreLayout. + * + * @type { ?string } + * @syscap SystemCapability.LiveView.LiveViewService + * @StageModelOnly + * @since 4.1.0(11) + */ + guestScore?: string; + /** + * the score of Live activity, which is the description text at the top of the middle of the ScoreLayout. + * + * @type { ?string } + * @syscap SystemCapability.LiveView.LiveViewService + * @StageModelOnly + * @since 4.1.0(11) + */ + /** + * the score of Live activity, which is the description text at the top of the middle of the ScoreLayout. + * + * @type { ?string | Array } + * @syscap SystemCapability.LiveView.LiveViewService + * @StageModelOnly + * @since 5.0.0(12) + */ + competitionDesc?: string | Array; + /** + * the score of Live activity, which is the competition time of the ScoreLayout. + * + * @type { ?string } + * @syscap SystemCapability.LiveView.LiveViewService + * @StageModelOnly + * @since 4.1.0(11) + */ + competitionTime?: string; + /** + * Indicates whether to display the split line above the ScoreLayout. + * + * @type { ?boolean } + * @syscap SystemCapability.LiveView.LiveViewService + * @StageModelOnly + * @since 4.1.0(11) + */ + isHorizontalLineDisplayed?: boolean; + } + /** + * Define a template data instance when the layoutType is 8. + * + * @type { NavigationLayout } + * @syscap SystemCapability.LiveView.LiveViewService + * @StageModelOnly + * @since 5.0.0(12) + */ + export interface NavigationLayout extends LayoutData { + /** + * Defining Navigation icons + * + * @type { ?Array } + * @syscap SystemCapability.LiveView.LiveViewService + * @StageModelOnly + * @since 5.0.0(12) + */ + navigationIcons?: Array; + /** + * Cunrrent Navigation icon + * + * @type { ?string|image.PixelMap } + * @syscap SystemCapability.LiveView.LiveViewService + * @StageModelOnly + * @since 5.0.0(12) + */ + currentNavigationIcon?: string | image.PixelMap; + } + /** + * Define a richText instance to display different text color. + * + * @type { RichText } + * @syscap SystemCapability.LiveView.LiveViewService + * @StageModelOnly + * @since 4.1.0(11) + */ + export interface RichText { + /** + * text. + * + * @type { string } + * @syscap SystemCapability.LiveView.LiveViewService + * @StageModelOnly + * @since 4.1.0(11) + */ + text: string; + /** + * text color, the value is in the hexadecimal format of #ARGB. + * + * @type { ?string } + * @syscap SystemCapability.LiveView.LiveViewService + * @StageModelOnly + * @since 4.1.0(11) + */ + textColor?: string; + } + /** + * Display type of extend data. Default value is 0; + * + * @type { number } + * @syscap SystemCapability.LiveView.LiveViewService + * @StageModelOnly + * @since 4.1.0(11) + */ + export enum ExtensionType { + /** + * default display type. + * + * @syscap SystemCapability.LiveView.LiveViewService + * @StageModelOnly + * @since 4.1.0(11) + */ + EXTENSION_TYPE_DEFAULT = 0, + /** + * display type is common text. + * + * @syscap SystemCapability.LiveView.LiveViewService + * @StageModelOnly + * @since 4.1.0(11) + */ + EXTENSION_TYPE_COMMON_TEXT = 1, + /** + * display type is capsule text. + * + * @syscap SystemCapability.LiveView.LiveViewService + * @StageModelOnly + * @since 4.1.0(11) + */ + EXTENSION_TYPE_CAPSULE_TEXT = 2, + /** + * display type is the picture. + * + * @syscap SystemCapability.LiveView.LiveViewService + * @StageModelOnly + * @since 4.1.0(11) + */ + EXTENSION_TYPE_PIC = 3, + /** + * display type is the icon of app. + * + * @syscap SystemCapability.LiveView.LiveViewService + * @StageModelOnly + * @since 4.1.0(11) + */ + EXTENSION_TYPE_ICON = 4 + } + /** + * Display type of indicator. Default value is 0; + * + * @type { number } + * @syscap SystemCapability.LiveView.LiveViewService + * @StageModelOnly + * @since 4.1.0(11) + */ + export enum IndicatorType { + /** + * The indicator icon is not displayed. + * + * @syscap SystemCapability.LiveView.LiveViewService + * @StageModelOnly + * @since 4.1.0(11) + */ + INDICATOR_TYPE_UNDISPLAYED = 0, + /** + * displayed above the progress line. + * + * @syscap SystemCapability.LiveView.LiveViewService + * @StageModelOnly + * @since 4.1.0(11) + */ + INDICATOR_TYPE_UP = 1, + /** + * indicates that the display is overwritten on the progress line. + * + * @syscap SystemCapability.LiveView.LiveViewService + * @StageModelOnly + * @since 4.1.0(11) + */ + INDICATOR_TYPE_OVERLAY = 2 + } + /** + * Display type of the progress bar in the layout. Default value is 0; + * + * @type { number } + * @syscap SystemCapability.LiveView.LiveViewService + * @StageModelOnly + * @since 4.1.0(11) + */ + export enum LineType { + /** + * dotted lines progress. + * + * @syscap SystemCapability.LiveView.LiveViewService + * @StageModelOnly + * @since 4.1.0(11) + */ + LINE_TYPE_DOTTED_LINE = 0, + /** + * displayed above the progress line. + * + * @syscap SystemCapability.LiveView.LiveViewService + * @StageModelOnly + * @since 4.1.0(11) + */ + LINE_TYPE_NORMAL_SOLID_LINE = 1, + /** + * indicates that the display is overwritten on the progress line. + * + * @syscap SystemCapability.LiveView.LiveViewService + * @StageModelOnly + * @since 4.1.0(11) + */ + LINE_TYPE_THICK_SOLID_LINE = 2 + } + /** + * Display type of capsule.; + * + * @type { number } + * @syscap SystemCapability.LiveView.LiveViewService + * @StageModelOnly + * @since 4.1.0(11) + */ + export enum CapsuleType { + /** + * Text capsule. + * + * @syscap SystemCapability.LiveView.LiveViewService + * @StageModelOnly + * @since 4.1.0(11) + */ + CAPSULE_TYPE_TEXT = 1, + /** + * Timer capsule. + * + * @syscap SystemCapability.LiveView.LiveViewService + * @StageModelOnly + * @since 4.1.0(11) + */ + CAPSULE_TYPE_TIMER = 2, + /** + * progress capsule. + * + * @syscap SystemCapability.LiveView.LiveViewService + * @StageModelOnly + * @since 4.1.0(11) + */ + CAPSULE_TYPE_PROGRESS = 3 + } + /** + * Indicates the return result of the data to operate liveView. + * + * @type { LiveViewResult } + * @syscap SystemCapability.LiveView.LiveViewService + * @StageModelOnly + * @since 4.1.0(11) + */ + export interface LiveViewResult { + /** + * Indicates the result code returned after to start,update or end liveView. + * + * @syscap SystemCapability.LiveView.LiveViewService + * @StageModelOnly + * @since 4.1.0(11) + */ + resultCode: number; + /** + * Indicates the message returned after to start,update or end liveView. + * + * @syscap SystemCapability.LiveView.LiveViewService + * @StageModelOnly + * @since 4.1.0(11) + */ + message: String; + } + /** + * Define a timer instance to be used in liveView. + * + * @type { LiveViewTimer } + * @syscap SystemCapability.LiveView.LiveViewService + * @StageModelOnly + * @since 5.0.0(12) + */ + export interface LiveViewTimer { + /** + * the time of liveView timer. + * + * @type { ?number } + * @syscap SystemCapability.LiveView.LiveViewService + * @StageModelOnly + * @since 5.0.0(12) + */ + time?: number; + /** + * Indicates whether the timer type is countdown,The default value is false. + * + * @type { ?boolean } + * @syscap SystemCapability.LiveView.LiveViewService + * @StageModelOnly + * @since 5.0.0(12) + */ + isCountdown?: boolean; + /** + * Indicates whether the timer type pauses timing. The default value is false. + * + * @type { ?boolean } + * @syscap SystemCapability.LiveView.LiveViewService + * @StageModelOnly + * @since 5.0.0(12) + */ + isPaused?: boolean; + } +} +export default liveViewManager; diff --git a/language/arkts/extractor/sdk/hms/ets/api/@hms.core.map.MapComponent.d.ets b/language/arkts/extractor/sdk/hms/ets/api/@hms.core.map.MapComponent.d.ets new file mode 100755 index 00000000..f1943052 --- /dev/null +++ b/language/arkts/extractor/sdk/hms/ets/api/@hms.core.map.MapComponent.d.ets @@ -0,0 +1,62 @@ +/* + * Copyright (c) Huawei Technologies Co., Ltd. 2023. All rights reserved. + */ +/** + * @file Provide map component. + * @bundle com.huawei.hms.mapservice.kit/mapLibrary/ets/MapComponent 5.0.0(12) + * @kit MapKit + */ +import { AsyncCallback } from '@ohos.base'; +import mapCommon from '@hms.core.map.mapCommon'; +import map from '@hms.core.map.map'; +/** + * Provides map component, the caller needs to provide mapOptions and callback, and + * the caller can get MapController object by callback. + * + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ +@Component +export struct MapComponent { + /** + * Indicates the information to initialize the map. + * + * @type { mapCommon.MapOptions } + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + mapOptions: mapCommon.MapOptions; + /** + * Indicates the callback function when the map is initialized. + * + * @type { AsyncCallback } + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + mapCallback: AsyncCallback; + /** + * The default builder function for struct, You should not need to invoke this method directly. + * + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + build(): void; + /** + * The custom info window. + * + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + @BuilderParam + customInfoWindow: (markerDelegate: map.MarkerDelegate) => void; +} diff --git a/language/arkts/extractor/sdk/hms/ets/api/@hms.core.map.map.d.ts b/language/arkts/extractor/sdk/hms/ets/api/@hms.core.map.map.d.ts new file mode 100755 index 00000000..a573f900 --- /dev/null +++ b/language/arkts/extractor/sdk/hms/ets/api/@hms.core.map.map.d.ts @@ -0,0 +1,3447 @@ +/* + * Copyright (c) Huawei Technologies Co., Ltd. 2023-2023. All rights reserved. + */ +/** + * @file Provide the ability to control map behavior. + * @bundle com.huawei.hms.mapservice.kit/mapLibrary/ets/map 5.0.0(12) + * @kit MapKit + */ +import type { Callback, ErrorCallback } from '@ohos.base'; +import type mapCommon from '@hms.core.map.mapCommon'; +import type geoLocationManager from '@ohos.geoLocationManager'; +import type Curves from '@ohos.curves'; +import type image from '@ohos.multimedia.image'; +/** + * This module provides the ability to control map behavior, including UI and gesture control, event listening, and overlay adding. + * + * @namespace map + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ +declare namespace map { + /** + * This is the main function entry of the map. All map-related methods can be accessed from this interface. + * + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + class MapComponentController { + /** + * Updates the camera state as an animation for a specified duration + * Abnormal values are processed as no response. + * + * @param {CameraUpdate} update - Indicates the new camera state. + * @param {number} duration - Indicates the animate duration, unit is ms. The value is an integer greater than 0. If not set, the default value is 250. + * @returns {void} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + animateCamera(update: CameraUpdate, duration?: number): void; + /** + * Updates the camera status in animation mode and invokes the callback when the update is complete. + * + * @param { CameraUpdate } update - Indicates the new camera state. + * @param { ?number } duration - Indicates the animate duration, unit is ms. The value is an integer greater than 0.Default value is 250. + * @returns { Promise } Return animate result. + * @throws { BusinessError } 401 - Invalid input parameter. + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + animateCameraStatus(update: CameraUpdate, duration?: number): Promise; + /** + * Updates the map status and marker in animation mode. + * + * @param { CameraUpdate } update - Indicates the new camera state. + * @param { Marker } marker - Indicates the marker. + * @param { number } duration - Indicates the animate duration, unit is ms. + * @returns { Promise } Return animate result. + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + animateCameraWithMarker(update: CameraUpdate, marker: Marker, duration: number): Promise; + /** + * Stops the current animation of the map. + * + * @returns { void } + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + stopAnimation(): void; + /** + * remove all shapes, markers, and overlays on the map. + * + * @returns { void } + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + clear(): void; + /** + * Update Camera Status. + * Abnormal values are processed as no response. + * + * @param {CameraUpdate} update - Indicates the new camera state. + * @returns {void} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + moveCamera(update: CameraUpdate): void; + /** + * obtain the current status of map camera. + * + * @returns { mapCommon.CameraPosition } - Return the current status of map camera + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + getCameraPosition(): mapCommon.CameraPosition; + /** + * Constrains the camera target so that when the user moves the map, the camera target does not move out of this boundary. + * When the latitude of the northeast corner is lower than that of the southwest corner, the interface does not take effect. + * + * @param {mapCommon.LatLngBounds} bounds - Constrain the boundaries of the camera target. + * @returns { void } + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + setLatLngBounds(bounds: mapCommon.LatLngBounds): void; + /** + * Sets a pixel position on the screen as the center point of the map. + * After this method is used, the map is rotated and tilted based on the set screen coordinates. + * Abnormal values are processed as no response. + * + * @param {mapCommon.MapPoint} point - screen coordinate + * @returns { void } + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + setPointToCenter(point: mapCommon.MapPoint): void; + /** + * Set the camera maximum zoom level.Value range is [2,20]. + * If the value is greater than 20, use 20, and if the value is less than 2, use 2. + * If the value is lower than the current minimum zoom, the minimum zoom will use the same value. + * + * @param { number } maxZoom - Indicates the camera maximum zoom level. + * @returns { void } + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + setMaxZoom(maxZoom: number): void; + /** + * Set the camera minimum zoom level.Value range is [2,20]. + * If the value is greater than 20, use 20, and if the value is less than 2, use 2. + * If the value is higher than the current maximum zoom, the maximum zoom will use the same value. + * + * @param { number } minZoom - Indicates the camera minimum zoom level. + * @returns { void } + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + setMinZoom(minZoom: number): void; + /** + * Get the camera maximum zoom level. + * + * @returns { number } Return the camera maximum zoom level + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + getMaxZoom(): number; + /** + * Get the camera minimum zoom level. + * + * @returns { number } Return the camera minimum zoom level + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + getMinZoom(): number; + /** + * Turn the traffic layer on or off + * Abnormal values are handled according to the default values. + * + * @param {boolean} enabled - Indicates whether to enable the traffic layer. + * @returns { void } + * @default false + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + setTrafficEnabled(enabled: boolean): void; + /** + * Get the enable status of the traffic layer. + * + * @returns { boolean } Return the enable status of the traffic layer. + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + isTrafficEnabled(): boolean; + /** + * Turn the 3D building layers on or off. + * Abnormal values are handled according to the default values. + * + * @param {boolean} enabled - Indicates whether to enable the 3D building layer. + * @returns { void } + * @default false + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + setBuildingEnabled(enabled: boolean): void; + /** + * Get the enable status of the 3D building layer. + * + * @returns {boolean} Return the enable status of the 3D building layer. + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + isBuildingEnabled(): boolean; + /** + * Turn the my location layer on or off. + * Abnormal values are handled according to the default values. + * + * @param {boolean} myLocationEnabled - Indicates whether to enable the my location layer. + * @returns { void } + * @default false + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + setMyLocationEnabled(myLocationEnabled: boolean): void; + /** + * Set the location of user. + * Abnormal values are processed as no response. + * + * @param {geoLocationManager.Location} location - Indicates user's location. + * @returns { void } + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + setMyLocation(location: geoLocationManager.Location): void; + /** + * Set the style of my location layer. + * Abnormal values are processed as no response. + * + * @param {mapCommon.MyLocationStyle} style - Indicates the my location style + * @returns { Promise } + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + setMyLocationStyle(style: mapCommon.MyLocationStyle): Promise; + /** + * Get the enable status of the my location layer. + * + * @returns {boolean} Return the enable status of the my location layer. + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + isMyLocationEnabled(): boolean; + /** + * Set the switch for zooming in or out gestures. + * Abnormal values are handled according to the default values. + * + * @param { boolean } enabled - Indicates the switch for zooming in or out gestures. + * @returns { void } + * @default true + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + setZoomGesturesEnabled(enabled: boolean): void; + /** + * Return the switch for zooming in or out gestures. + * + * @returns { boolean } Return the switch for zooming in or out gestures. + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + isZoomGesturesEnabled(): boolean; + /** + * Set the switch for scrolling gestures. + * Abnormal values are handled according to the default values. + * + * @param { boolean } enabled - Indicates the switch for scrolling gestures. + * @returns { void } + * @default true + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + setScrollGesturesEnabled(enabled: boolean): void; + /** + * Return the switch for scrolling gestures. + * + * @returns { boolean } Return the switch for scrolling gestures. + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + isScrollGesturesEnabled(): boolean; + /** + * Sets whether to enable rotation gestures. + * Abnormal values are handled according to the default values. + * + * @param { boolean } enabled - Indicates whether to enable rotation gestures. + * @returns { void } + * @default true + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + setRotateGesturesEnabled(enabled: boolean): void; + /** + * Return whether to enable rotation gestures. + * + * @returns { boolean } Return whether to enable rotation gestures. + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + isRotateGesturesEnabled(): boolean; + /** + * Sets whether to enable tilt gestures. + * Abnormal values are handled according to the default values. + * + * @param { boolean } enabled - Indicates whether to enable tilt gestures. + * @returns { void } + * @default true + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + setTiltGesturesEnabled(enabled: boolean): void; + /** + * Return whether to enable tilt gestures. + * + * @returns { boolean } Return whether to enable tilt gestures. + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + isTiltGesturesEnabled(): boolean; + /** + * Sets whether to enable the zoom control. + * Abnormal values are handled according to the default values. + * + * @param { boolean } enabled - Indicates whether to enable the zoom control. + * @returns {void} + * @default true + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + setZoomControlsEnabled(enabled: boolean): void; + /** + * Return whether to enable the zoom control. + * + * @returns { boolean } Return whether to enable the zoom control. + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + isZoomControlsEnabled(): boolean; + /** + * Sets whether to enable the my location control. + * Abnormal values are handled according to the default values. + * + * @param { boolean } enabled - Indicates whether to enable the my location control. + * @returns { void } + * @default false + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + setMyLocationControlsEnabled(enabled: boolean): void; + /** + * Return whether to enable the my location control. + * + * @returns { boolean } Return whether to enable the my location control. + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + isMyLocationControlsEnabled(): boolean; + /** + * Sets whether to enable the scale control. + * Abnormal values are handled according to the default values. + * + * @param { boolean } enabled - Indicates whether to enable the scale control. + * @returns { void } + * @default false + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + setScaleControlsEnabled(enabled: boolean): void; + /** + * Return whether to enable the scale control. + * + * @returns { boolean } Return whether to enable the scale control. + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + isScaleControlsEnabled(): boolean; + /** + * Sets whether to enable the compass control. + * Abnormal values are handled according to the default values. + * + * @param { boolean } enabled - Indicates whether to enable the compass control. + * @returns { void } + * @default true + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + setCompassControlsEnabled(enabled: boolean): void; + /** + * Return whether to enable the compass control. + * + * @param { boolean } Return whether to enable the compass control. + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + isCompassControlsEnabled(): boolean; + /** + * Sets whether to zoom in or out at the center of the map. + * Abnormal values are handled according to the default values. + * + * @param { boolean } enabled - Indicates whether to zoom in or out at the center of the map. + * @returns { void } + * @default false + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + setGestureScaleByMapCenter(enabled: boolean): void; + /** + * Return whether to zoom in or out at the center of the map. + * + * @returns { boolean } Return whether to zoom in or out at the center of the map. + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + isGestureScaleByMapCenter(): boolean; + /** + * Set the alignment mode of the map logo + * Abnormal values are handled according to the default values. + * + * @param { mapCommon.LogoAlignment } alignment - Indicates the alignment mode of the map logo + * @returns { void } + * @default LogoAlignment.BOTTOM_START + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + setLogoAlignment(alignment: mapCommon.LogoAlignment): void; + /** + * Set the padding between the map border and the map logo. + * Abnormal values are processed as no response. + * + * @param { mapCommon.Padding } padding - Indicates the padding between the map border and the map logo. + * @returns { void } + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + setLogoPadding(padding: mapCommon.Padding): void; + /** + * Get the length (in meters) of a 1-pixel point on a map at the current zoom level. + * + * @returns { number } Return the length (in meters) of a 1-pixel point on a map at the current zoom level. + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + getScalePerPixel(): number; + /** + * Add a marker to the map. The icon of the marker is displayed in the marker position on the map. + * When a marker is clicked, the camera moves around the marker. + * + * @param {mapCommon.MarkerOptions} options - Indicates the marker attributes. + * @returns {Promise} Return the marker object. + * @throws { BusinessError } 401 - Invalid input parameter. + * @throws { BusinessError } 1002601001 - The object to be operated does not exist. + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + addMarker(options: mapCommon.MarkerOptions): Promise; + /** + * Add a circle to the map. + * + * @param { mapCommon.MapCircleOptions } options - Indicates the circle attributes. + * @returns { Promise } Return the marker object. + * @throws { BusinessError } 401 - Invalid input parameter. + * @throws { BusinessError } 1002601001 - The object to be operated does not exist. + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + addCircle(options: mapCommon.MapCircleOptions): Promise; + /** + * Add a polyline to the map. + * + * @param { mapCommon.MapPolylineOptions } options - Indicates the polyline attributes. + * @returns { Promise } Return the polyline object. + * @throws { BusinessError } 401 - Invalid input parameter. + * @throws { BusinessError } 1002601001 - The object to be operated does not exist. + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + addPolyline(options: mapCommon.MapPolylineOptions): Promise; + /** + * Add a polygon to the map. + * + * @param { mapCommon.MapPolygonOptions } options - Indicates the polygon attributes. + * @returns { Promise } Return the polygon object. + * @throws { BusinessError } 401 - Invalid input parameter. + * @throws { BusinessError } 1002601001 - The object to be operated does not exist. + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + addPolygon(options: mapCommon.MapPolygonOptions): Promise; + /** + * Add a point annotation to the map. + * + * @param { mapCommon.PointAnnotationParams } params - Indicates the point annotation attributes. + * @returns { Promise } Return the PointAnnotation object. + * @throws { BusinessError } 401 - Invalid input parameter. + * @throws { BusinessError } 1002601001 - The object to be operated does not exist. + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + addPointAnnotation(params: mapCommon.PointAnnotationParams): Promise; + /** + * Add a bubble to the map. + * + * @param { mapCommon.BubbleParams } params - Indicates the bubble attributes. + * @returns { Promise } Return the bubble object. + * @throws { BusinessError } 401 - Invalid input parameter. + * @throws { BusinessError } 1002601001 - The object to be operated does not exist. + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + addBubble(params: mapCommon.BubbleParams): Promise; + /** + * Set the boundary padding of the map. + * + * @param {mapCommon.Padding} padding - Indicates the boundary padding of the map. + * @returns { void } + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + setPadding(padding?: mapCommon.Padding): void; + /** + * Get the Projection object, which is used to convert the screen coordinates and longitude and latitude coordinates. + * + * @returns {Projection} Return Projection object + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + getProjection(): Projection; + /** + * Set the custom style id or content. + * + * @param { mapCommon.CustomMapStyleOptions } customMapStyleOptions - Indicates the custom style id or content. + * @returns { Promise } + * @throws { BusinessError } 1002601002 - The custom map style file does not exist. + * @throws { BusinessError } 1002601004 - The style content format is incorrect. + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + setCustomMapStyle(customMapStyleOptions: mapCommon.CustomMapStyleOptions): Promise; + /** + * Get the map mode is day or night. + * + * @returns { mapCommon.DayNightMode } + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + getDayNightMode(): mapCommon.DayNightMode; + /** + * Set the map mode is day or night. + * + * @param { mapCommon.DayNightMode } mode - Indicates the map mode is day or night. + * @returns { void } + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + setDayNightMode(mode: mapCommon.DayNightMode): void; + /** + * Get the map type. + * + * @returns { mapCommon.MapType } Return the map type. + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + getMapType(): mapCommon.MapType; + /** + * Set the map type. + * + * @param { mapCommon.MapType } mapType - Indicates the map type. + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + setMapType(mapType: mapCommon.MapType): void; + /** + * Set the scale controller position, which is the offset of the upper left corner of the scale + * relative to the upper left corner of the map component, in px. + * + * @param { mapCommon.MapPoint } point - Indicates the scale controller position. + * @returns { void } + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + setScalePosition(point: mapCommon.MapPoint): void; + /** + * Get the scale level, and the unit is meter. + * + * @returns { number } Return the scale level. + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + getScaleLevel(): number; + /** + * Set the compass controller position, which is the offset of the upper left corner of the compass + * relative to the upper left corner of the map component, in px. + * + * @param { mapCommon.MapPoint } point - Indicates the compass controller position. + * @returns { void } + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + setCompassPosition(point: mapCommon.MapPoint): void; + /** + * Set whether to allow all gestures. + * + * @param { boolean } enabled - Indicates whether to allow all gestures. + * @returns { void } + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + setAllGesturesEnabled(enabled: boolean): void; + /** + * Return the scale control height, in vp. + * + * @returns { number } Return the scale control height. + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + getScaleControlsHeight(): number; + /** + * Return the scale control width, in vp. + * + * @returns { number } Return the scale control width. + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + getScaleControlsWidth(): number; + /** + * Add cluster overlay. + * + * @param { mapCommon.ClusterOverlayParams } params - Indicates the cluster overlay parameter. + * @returns { Promise } Return ClusterOverlay. + * @throws { BusinessError } 401 - Invalid input parameter. + * @throws { BusinessError } 1002601001 - The object to be operated does not exist. + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + addClusterOverlay(params: mapCommon.ClusterOverlayParams): Promise; + /** + * Add image overlay. + * + * @param { mapCommon.ImageOverlayParams } params - Indicates the image overlay parameter. + * @returns { Promise } Return ImageOverlay. + * @throws { BusinessError } 401 - Invalid input parameter. + * @throws { BusinessError } 1002601001 - The object to be operated does not exist. + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + addImageOverlay(params: mapCommon.ImageOverlayParams): Promise; + /** + * Generating a Map Snapshot. + * + * @returns { Promise } Return map snapshot. + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + snapshot(): Promise; + /** + * listening the map camera changes event. + * This callback is not triggered during motion, but is triggered at the end of the animation. + * + * @param {'cameraChange'} type + * @param {Callback} callback - Indicates the listener when the map camera changes. + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + on(type: 'cameraChange', callback: Callback): void; + /** + * Cancel listening the map camera changes event. + * + * @param {'cameraChange'} type + * @param {Callback} callback - Cancel listening the map camera changes event. + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + off(type: 'cameraChange', callback: Callback): void; + /** + * listening the map camera idle event. + * + * @param {'cameraIdle'} type + * @param {Callback} callback - Indicates the listener when the map camera is idle. + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + on(type: 'cameraIdle', callback: Callback): void; + /** + * Cancel listening the map camera idle event. + * + * @param {'cameraIdle'} type + * @param {Callback} callback - Cancel listening the map camera idle event. + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + off(type: 'cameraIdle', callback: Callback): void; + /** + * Listen to the event that the map movement is canceled. + * + * @param {'cameraMoveCancel'} type + * @param {Callback} callback - Indicates the listener when the map movement is canceled. + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + on(type: 'cameraMoveCancel', callback: Callback): void; + /** + * Cancel listening the map camera move cancel event. + * + * @param {'cameraMoveCancel'} type + * @param {Callback} callback - Cancel listening the map camera move cancel event. + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + off(type: 'cameraMoveCancel', callback: Callback): void; + /** + * Listen to the event that the map movement is moving. + * + * @param {'cameraMove'} type + * @param {Callback} callback - Indicates the listener when the map movement is moving. + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + on(type: 'cameraMove', callback: Callback): void; + /** + * Cancel listening the map camera move event. + * + * @param {'cameraMove'} type + * @param {Callback} callback - Cancel listening the map camera move event. + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + off(type: 'cameraMove', callback: Callback): void; + /** + * Listen to the event that the map movement start moving. + * + * @param {'cameraMoveStart'} type + * @param {Callback} callback - Indicates the listener when the map movement start moving. + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + on(type: 'cameraMoveStart', callback: Callback): void; + /** + * Cancel listening the map camera move start event. + * + * @param {'cameraMoveStart'} type + * @param {Callback} callback - Cancel listening the map camera move start event. + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + off(type: 'cameraMoveStart', callback: Callback): void; + /** + * Listen to the event that the map is clicked. + * + * @param {'mapClick'} type + * @param {Callback} callback - Indicates the listener when click the map. + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + on(type: 'mapClick', callback: Callback): void; + /** + * Cancel listening the map click event. + * + * @param {'mapClick'} type + * @param {Callback} callback - Cancel listening the map click event. + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + off(type: 'mapClick', callback: Callback): void; + /** + * Listen to the event that the map is loaded. + * + * @param {'mapLoad'} type + * @param {Callback} callback - Indicates the listener when finish load the map. + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + on(type: 'mapLoad', callback: Callback): void; + /** + * Cancel listening the map load event. + * + * @param {'mapLoad'} type + * @param {Callback} callback - Cancel listening the map load event. + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + off(type: 'mapLoad', callback: Callback): void; + /** + * Listen to the event that the map is clicked long. + * + * @param {'mapLongClick'} type + * @param {Callback} callback - Indicates the listener when the map is clicked long. + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + on(type: 'mapLongClick', callback: Callback): void; + /** + * Cancel listening the map long click event. + * + * @param {'mapLongClick'} type + * @param {Callback} callback - Cancel listening the map long click event. + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + off(type: 'mapLongClick', callback: Callback): void; + /** + * Listen to the event that my location button is clicked. + * + * @param {'myLocationButtonClick'} type + * @param {Callback} callback - Indicates the listener when my location button is clicked. + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + on(type: 'myLocationButtonClick', callback: Callback): void; + /** + * Cancel listening the my location button click event. + * + * @param {'myLocationButtonClick'} type + * @param {Callback} callback - Cancel listening the my location button click event. + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + off(type: 'myLocationButtonClick', callback: Callback): void; + /** + * Listen to the event that my location layer is clicked. + * + * @param {'myLocationClick'} type + * @param {Callback} callback - Indicates the listener when my location layer is clicked. + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + on(type: 'myLocationClick', callback: Callback): void; + /** + * Cancel listening the my location layer click event. + * + * @param {'myLocationClick'} type + * @param {Callback} callback - Cancel listening the my location layer click event. + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + off(type: 'myLocationClick', callback: Callback): void; + /** + * Listen to the event that the poi on the map is clicked. + * + * @param {'poiClick'} type + * @param {Callback} callback - Indicates the listener when the poi on the map is clicked. + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + on(type: 'poiClick', callback: Callback): void; + /** + * Cancel listening the poi click event. + * + * @param {'poiClick'} type + * @param {Callback} callback - Cancel listening the poi click event. + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + off(type: 'poiClick', callback: Callback): void; + /** + * Listen to the event that the marker is clicked. + * + * @param {'markerClick'} type + * @param {Callback} callback - Indicates the listener when click the marker. + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + on(type: 'markerClick', callback: Callback): void; + /** + * Cancel listening the marker click event. + * + * @param {'markerClick'} type + * @param {Callback} callback - Cancel listening the marker click event. + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + off(type: 'markerClick', callback: Callback): void; + /** + * Listen to the event that the marker will be dragged. + * + * @param {'markerDragStart'} type + * @param {Callback} callback - Indicates the listener when the marker will be dragged. + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + on(type: 'markerDragStart', callback: Callback): void; + /** + * Cancel listening the marker drag start event. + * + * @param {'markerDragStart'} type + * @param {Callback} callback - Cancel listening the marker drag start event. + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + off(type: 'markerDragStart', callback: Callback): void; + /** + * Listen to the event that the marker is being dragged. + * + * @param {'markerDrag'} type + * @param {Callback} callback - Indicates the listener when the marker is being dragged. + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + on(type: 'markerDrag', callback: Callback): void; + /** + * Cancel listening the marker drag event. + * + * @param {'markerDrag'} type + * @param {Callback} callback - Cancel listening the marker drag event. + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + off(type: 'markerDrag', callback: Callback): void; + /** + * Listen to the event that the marker has been dragged. + * + * @param {'markerDragEnd'} type + * @param {Callback} callback - Indicates the listener when the marker has been dragged. + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + on(type: 'markerDragEnd', callback: Callback): void; + /** + * Cancel listening the marker drag end event. + * + * @param {'markerDragEnd'} type + * @param {Callback} callback - Cancel listening the marker drag end event. + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + off(type: 'markerDragEnd', callback: Callback): void; + /** + * Listen to the event that the circle is clicked. + * + * @param {'circleClick'} type + * @param {Callback} callback - Indicates the listener when click the circle. + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + on(type: 'circleClick', callback: Callback): void; + /** + * Cancel listening the circle click event. + * + * @param {'circleClick'} type + * @param {Callback} callback - Cancel listening the circle click event. + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + off(type: 'circleClick', callback: Callback): void; + /** + * Listen to the event that the polyline is clicked. + * + * @param {'polylineClick'} type + * @param {Callback} callback - Indicates the listener when click the polyline. + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + on(type: 'polylineClick', callback: Callback): void; + /** + * Cancel listening the polyline click event. + * + * @param {'polylineClick'} type + * @param {Callback} callback - Cancel listening the polyline click event. + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + off(type: 'polylineClick', callback: Callback): void; + /** + * Listen to the event that the polygon is clicked. + * + * @param {'polygonClick'} type + * @param {Callback} callback - Indicates the listener when click the polygon. + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + on(type: 'polygonClick', callback: Callback): void; + /** + * Cancel listening the polygon click event. + * + * @param {'polygonClick'} type + * @param {Callback} callback - Cancel listening the polygon click event. + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + off(type: 'polygonClick', callback: Callback): void; + /** + * Listen to the info window click event. + * + * @param {'infoWindowClick'} type + * @param {Callback} callback - Indicates the listener when click the info window. + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + on(type: 'infoWindowClick', callback: Callback): void; + /** + * Cancel listening the info window click event. + * + * @param {'infoWindowClick'} type + * @param {Callback} callback - Cancel listening the info window click event. + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + off(type: 'infoWindowClick', callback: Callback): void; + /** + * Listen to the info window close event. + * + * @param {'infoWindowClose'} type + * @param {Callback} callback - Indicates the listener when close the info window. + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + on(type: 'infoWindowClose', callback: Callback): void; + /** + * Cancel listening the info window close event. + * + * @param {'infoWindowClose'} type + * @param {Callback} callback - Cancel listening the info window close event. + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + off(type: 'infoWindowClose', callback: Callback): void; + /** + * Listen to the point annotation click event. + * + * @param {'pointAnnotationClick'} type + * @param {Callback} callback - Indicates the listener when click the point annotation. + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + on(type: 'pointAnnotationClick', callback: Callback): void; + /** + * Cancel listening the point annotation click event. + * + * @param {'pointAnnotationClick'} type + * @param {Callback} callback - Cancel listening the point annotation click event. + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + off(type: 'pointAnnotationClick', callback: Callback): void; + /** + * Listen to the bubble click event. + * + * @param {'bubbleClick'} type + * @param {Callback} callback - Indicates the listener when click the bubble. + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + on(type: 'bubbleClick', callback: Callback): void; + /** + * Cancel listening the bubble click event. + * + * @param {'bubbleClick'} type + * @param {Callback} callback - Cancel listening the bubble click event. + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + off(type: 'bubbleClick', callback: Callback): void; + /** + * Listen to the ImageOverlay click event. + * + * @param {'imageOverlayClick'} type + * @param {Callback} callback - Indicates the listener when click the ImageOverlay. + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + on(type: 'imageOverlayClick', callback: Callback): void; + /** + * Cancel listening the ImageOverlay click event. + * + * @param {'imageOverlayClick'} type + * @param {?Callback} callback - Cancel listening the ImageOverlay click event. + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + off(type: 'imageOverlayClick', callback?: Callback): void; + /** + * Listen to the error event occurred on the map. + * + * @param {'error'} type + * @param {ErrorCallback} callback - Indicates the listener for map error. + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + on(type: 'error', callback: ErrorCallback): void; + /** + * Cancel listening the map error event. + * + * @param {'error'} type + * @param {Callback} callback - Cancel listening the map error event. + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + off(type: 'error', callback: Callback): void; + } + /** + * This interface defines the base overlay, such as Marker, MapCircle, MapPolygon, and etc. + * + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + interface BaseOverlay { + /** + * Return the id of the BaseOverlay. + * + * @returns {string} Return the id of the BaseOverlay. + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + getId(): string; + /** + * Return the overlay level of the BaseOverlay. + * + * @returns { number } Return the overlay level of the BaseOverlay. + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + getZIndex(): number; + /** + * Return the custom Object of the BaseOverlay. + * + * @returns { Object } Return the custom Object of the BaseOverlay. + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + getTag(): Object; + /** + * Return whether the BaseOverlay is visible. + * + * @returns { boolean } Return whether the BaseOverlay is visible. + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + isVisible(): boolean; + /** + * Remove the BaseOverlay. + * + * @returns {void} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + remove(): void; + /** + * Set the overlay level of the BaseOverlay. + * Abnormal values are processed as no response. + * + * @param { number } zIndex - Indicates the overlay level of the BaseOverlay. + * @returns { void } + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + setZIndex(zIndex: number): void; + /** + * Set the custom Object of the BaseOverlay. + * If set undefined, system will clear the tag. + * + * @param { Object } tag - Indicates the custom Object of the BaseOverlay. + * @returns { void } + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + setTag(tag: Object): void; + /** + * Set whether the BaseOverlay is visible. + * Abnormal values are processed as no response. + * + * @param { boolean } visible - Indicates whether the BaseOverlay is visible. + * @returns { void } + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + setVisible(visible: boolean): void; + } + /** + * Provides interfaces for updating and querying marker. + * + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + interface Marker extends BaseOverlay { + /** + * Return the title of the marker's infoWindow. + * + * @returns { string } Return the title of the marker's infoWindow. + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + getTitle(): string; + /** + * Return the snippet of the marker's infoWindow. + * + * @returns { string } Return the snippet of the marker's infoWindow. + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + getSnippet(): string; + /** + * Return the alpha of the marker's icon. + * + * @returns { number } Return the alpha of the marker's icon. + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + getAlpha(): number; + /** + * Return the position of the marker. + * + * @returns { mapCommon.LatLng } Return the position of the marker. + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + getPosition(): mapCommon.LatLng; + /** + * Return the rotation direction of the marker's icon. + * + * @returns { number } Return the rotation direction of the marker's icon. + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + getRotation(): number; + /** + * Return whether the marker is clickable. + * + * @returns { boolean } Return whether the marker is clickable. + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + isClickable(): boolean; + /** + * Return whether the marker is draggable. + * + * @returns { boolean } Return whether the marker is draggable. + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + isDraggable(): boolean; + /** + * Return whether the marker's icon is shown on the ground. + * + * @returns { boolean } Return whether the marker's icon is shown on the ground. + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + isFlat(): boolean; + /** + * Set the alpha of the marker's icon. + * Abnormal values are processed as no response. + * + * @param { number } alpha - Indicates the alpha of the marker's icon. + * @return { void } + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + setAlpha(alpha: number): void; + /** + * Set the clickable switch of the marker. + * Abnormal values are processed as no response. + * + * @param { boolean } clickable - Indicates whether the marker is clickable. + * @return { void } + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + setClickable(clickable: boolean): void; + /** + * Set the draggable switch of the marker. + * Abnormal values are processed as no response. + * + * @param { boolean } draggable - Indicates whether the marker is draggable. + * @return { void } + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + setDraggable(draggable: boolean): void; + /** + * Set the flat switch of the marker. + * Abnormal values are processed as no response. + * + * @param { boolean } flat - Indicates whether the marker's icon is shown on the ground. + * @return { void } + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + setFlat(flat: boolean): void; + /** + * Set the icon of the marker which is the file URI format. + * Abnormal values are processed as no response. + * + * @param { string } icon - Indicates the icon of the marker. + * @return {Promise} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + /** + * Set the icon of the marker which is the file URI format. + * + * @param { string | image.PixelMap | Resource } icon - Indicates the icon of the marker. + * @return {Promise} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + setIcon(icon: string | image.PixelMap | Resource): Promise; + /** + * Set the position of the anchor point of the marker's icon. + * Abnormal values are processed as no response. + * + * @param { number } anchorU - Indicates the position of the anchor point of the marker's icon in the horizontal direction. Value range: [0, 1] + * @param { number } anchorV - Indicates the position of the anchor point of the marker's icon in the vertical direction. Value range: [0, 1] + * @return {void} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + setMarkerAnchor(anchorU: number, anchorV: number): void; + /** + * Set the position of the marker. + * Abnormal values are processed as no response. + * + * @param { mapCommon.LatLng } latLng - Indicates the position of the marker. + * @return { void } + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + setPosition(latLng: mapCommon.LatLng): void; + /** + * Set the rotation direction of the marker's icon. + * Abnormal values are processed as no response. + * + * @param { number } rotation - Indicates the rotation direction of the marker's icon. + * @return { void } + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + setRotation(rotation: number): void; + /** + * Set the title of marker info window. + * Abnormal values are processed as no response. + * + * @param { string } title - Indicates the title of marker info window. + * @return {void} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + setTitle(title: string): void; + /** + * Set the subTitle of marker info window. + * Abnormal values are processed as no response. + * + * @param { string } snippet - Indicates the subTitle of marker info window. + * @return {void} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + setSnippet(snippet: string): void; + /** + * Set the position of the anchor point of the marker info window. + * Abnormal values are processed as no response. + * + * @param { number } anchorU - Indicates the position of the anchor point of the marker info window in the horizontal direction. Value range: [0, 1] + * @param { number } anchorV - Indicates the position of the anchor point of the marker info window in the vertical direction. Value range: [0, 1] + * @return {void} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + setInfoWindowAnchor(anchorU: number, anchorV: number): void; + /** + * Set whether the marker info window is visible. + * Abnormal values are processed as no response. + * + * @param { boolean } visible - Indicates whether the marker info window is visible. + * @return {void} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + setInfoWindowVisible(visible: boolean): void; + /** + * Return whether the marker info window is visible. + * + * @returns { boolean } Return whether the marker info window is visible. + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + isInfoWindowVisible(): boolean; + /** + * Set the animation object + * + * @param {Animation} animation - Indicates the animation object + * @return {void} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + setAnimation(animation: Animation): void; + /** + * Start animation + * + * @returns {void} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + startAnimation(): void; + /** + * Clear animation + * + * @returns {void} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + clearAnimation(): void; + /** + * Return altitude, and the unit is meter. + * + * @return { number } + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + getAltitude(): number; + /** + * Set altitude, and the unit is meter. + * + * @param { number } altitude - Indicates marker altitude. + * @return { void } + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + setAltitude(altitude: number): void; + } + /** + * Provides interfaces for updating and querying polyline. + * + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + interface MapPolyline extends BaseOverlay { + /** + * Return the color of the polyline. + * + * @returns { number } Return the color of the polyline. + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + getColor(): number; + /** + * Return the multiple colors of the polyline. + * + * @returns { Array } Return the multiple colors of the polyline. + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + getColors(): Array; + /** + * Return the style of the end vertex of the polyline. + * + * @returns { mapCommon.CapStyle } Return the style of the end vertex of the polyline. + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + getEndCap(): mapCommon.CapStyle; + /** + * Return the node type of polyline corner. + * + * @returns { mapCommon.JointType } Return the node type of polyline corner. + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + getJointType(): mapCommon.JointType; + /** + * Return the stroke pattern styles of the polyline. + * + * @returns { Array } Return the stroke pattern styles of the polyline. + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + getPatterns(): Array; + /** + * Return the coordinate point list of the polyline. + * + * @returns { Array } Return the coordinate point list of the polyline. + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + getPoints(): Array; + /** + * Return the style of the start vertex of the polyline. + * + * @returns { mapCommon.CapStyle } Return the style of the start vertex of the polyline. + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + getStartCap(): mapCommon.CapStyle; + /** + * Return the width of the polyline. + * + * @returns { number } + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + getWidth(): number; + /** + * Return whether the polyline is clickable. + * + * @returns { boolean } Return whether the polyline is clickable. + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + isClickable(): boolean; + /** + * Return whether the polyline is drawn as a geodetic line. + * + * @returns { boolean } Return whether the polyline is drawn as a geodetic line. + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + isGeodesic(): boolean; + /** + * Return whether to enable the gradient color if there are multiple colors. + * + * @returns { boolean } Return whether to enable the gradient color if there are multiple colors. + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + isGradient(): boolean; + /** + * Set the clickable switch of the polyline. + * Abnormal values are processed as no response. + * + * @param { boolean } clickable - Indicates whether the polyline is clickable. + * @returns { void } + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + setClickable(clickable: boolean): void; + /** + * Set the color of the polyline. The color value is ARGB format。 + * Abnormal values are processed as no response. + * + * @param { number } color - Indicates the color of the polyline. + * @returns { void } + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + setColor(color: number): void; + /** + * Set the multiple colors of the polyline. The color value is ARGB format。 + * Abnormal values are processed as no response. + * + * @param { Array } colors - Indicates the multiple colors of the polyline. + * @returns { void } + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + setColors(colors: Array): void; + /** + * Set the style of the end vertex of the polyline. + * Abnormal values are processed as no response. + * + * @param { mapCommon.CapStyle }endCap - Indicates the style of the end vertex of the polyline. + * @returns { void } + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + setEndCap(endCap: mapCommon.CapStyle): void; + /** + * Set whether polyline is drawn as a geodetic line. + * Abnormal values are processed as no response. + * + * @param { boolean }geodesic - Indicates whether polyline is drawn as a geodetic line. + * @returns { void } + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + setGeodesic(geodesic: boolean): void; + /** + * Set whether to enable the gradient color if there are multiple colors. + * Abnormal values are processed as no response. + * + * @param { boolean } geodesic - Indicates whether to enable the gradient color if there are multiple colors. + * @returns { void } + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + setGradient(gradient: boolean): void; + /** + * Set the node type of polyline corner. + * Abnormal values are processed as no response. + * + * @param { mapCommon.JointType } jointType - Indicates the node type of polyline corner. + * @returns { void } + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + setJointType(jointType: mapCommon.JointType): void; + /** + * Set the stroke pattern styles of the polyline. + * Abnormal values are processed as no response. + * + * @param { Array } patterns - Indicates the stroke pattern styles of the polyline. + * @returns {void} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + setPatterns(patterns: Array): void; + /** + * Set the coordinate point list of the polyline. + * Abnormal values are processed as no response. + * + * @param { Array } points - Indicates the coordinate point list of the polyline. + * @returns { void } + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + setPoints(points: Array): void; + /** + * Set the style of the start vertex of the polyline. + * Abnormal values are processed as no response. + * + * @param { mapCommon.CapStyle } startCap - Indicates the style of the start vertex of the polyline. + * @returns { void } + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + setStartCap(startCap: mapCommon.CapStyle): void; + /** + * Set the width of the polyline. + * Abnormal values are processed as no response. + * + * @param { number } width - Indicates the width of the polyline. + * @returns { void } + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + setWidth(width: number): void; + /** + * Set the custom texture.Recommended that texture has no background color (use transparent color). + * @param { ResourceStr | image.PixelMap } customTexture - The custom texture. + * @returns { Promise } + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + setCustomTexture(customTexture: ResourceStr | image.PixelMap): Promise; + } + /** + * Provides interfaces for updating and querying polygon. + * + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + interface MapPolygon extends BaseOverlay { + /** + * Return the fill color of the polygon. + * + * @returns { number } - Return the fill color of the polygon. + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + getFillColor(): number; + /** + * Return the set of hollow holes in the polygon. + * + * @returns { Array> } Return the set of hollow holes in the polygon. + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + getHoles(): Array>; + /** + * Return the coordinate point list of the polygon. + * + * @returns { Array } + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + getPoints(): Array; + /** + * Return the stroke color of the polygon. + * + * @returns { number } Return the stroke color of the polygon. + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + getStrokeColor(): number; + /** + * Return the node type of polygon corner. + * + * @returns { mapCommon.JointType } Return the node type of polygon corner. + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + getJointType(): mapCommon.JointType; + /** + * Return the stroke pattern styles of the polygon. + * + * @returns { Array } Return the stroke pattern styles of the polygon. + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + getPatterns(): Array; + /** + * Return the stroke width of the polygon. + * + * @returns { number } Return the stroke width of the polygon. + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + getStrokeWidth(): number; + /** + * Return whether the polygon is clickable. + * + * @returns { boolean } Return whether the polygon is clickable. + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + isClickable(): boolean; + /** + * Return whether the polygon is drawn as a geodetic line. + * + * @returns { boolean } Return whether the polygon is drawn as a geodetic line. + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + isGeodesic(): boolean; + /** + * Set the clickable switch of the polygon. + * Abnormal values are processed as no response. + * + * @param { boolean } clickable - Indicates whether the polygon is clickable. + * @return {void} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + setClickable(clickable: boolean): void; + /** + * Set the fill color of the polygon. The color value is ARGB format。 + * Abnormal values are processed as no response. + * + * @param { number } color - Indicates the fill color of the polygon. + * @return { void } + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + setFillColor(color: number): void; + /** + * Set whether the polygon is drawn as a geodetic line. + * Abnormal values are processed as no response. + * + * @param { boolean }geodesic - Indicates whether the polygon is drawn as a geodetic line. + * @return { void } + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + setGeodesic(geodesic: boolean): void; + /** + * Set the set of hollow holes in the polygon. + * Abnormal values are processed as no response. + * + * @param { Array> } holes - Indicates the set of hollow holes in the polygon. + * @return { void } + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + setHoles(holes: Array>): void; + /** + * Set the coordinate point list of the polygon. + * Abnormal values are processed as no response. + * + * @param { Array> } holes - Indicates the coordinate point list of the polygon. + * @return { void } + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + setPoints(points: Array): void; + /** + * Set the stroke color of the polygon.The color value is ARGB format。 + * Abnormal values are processed as no response. + * + * @param { number } color - Indicates the stroke color of the polygon. + * @return { void } + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + setStrokeColor(color: number): void; + /** + * Set the node type of polygon corner. + * Abnormal values are processed as no response. + * + * @param { mapCommon.JointType } jointType - Indicates the node type of polygon corner. + * @return { void } + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + setJointType(jointType: mapCommon.JointType): void; + /** + * Set the stroke pattern styles of the polygon. + * Abnormal values are processed as no response. + * + * @param { Array } patterns - Indicates the stroke pattern styles of the polygon. + * @return { void } + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + setPatterns(patterns: Array): void; + /** + * Set the stroke width of the polygon. + * Abnormal values are processed as no response. + * + * @param { number } width - Indicates the stroke width of the polygon. + * @return { void } + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + setStrokeWidth(width: number): void; + } + /** + * Provides interfaces for updating and querying circle. + * + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + interface MapCircle extends BaseOverlay { + /** + * Return the center position of the circle. + * + * @returns { mapCommon.LatLng } Return the center position of the circle. + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + getCenter(): mapCommon.LatLng; + /** + * Return the fill color of the circle. + * + * @returns { number } Return the fill color of the circle. + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + getFillColor(): number; + /** + * Return the radius of the circle. + * + * @returns { number } Return the radius of the circle. + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + getRadius(): number; + /** + * Return the stroke color of the circle. + * + * @returns { number } Return the stroke color of the circle. + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + getStrokeColor(): number; + /** + * Return the stroke pattern styles of the circle. + * + * @returns { Array } Return the stroke pattern styles of the circle. + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + getPatterns(): Array; + /** + * Return the stroke width of the circle. + * + * @returns { number } Return the stroke width of the circle. + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + getStrokeWidth(): number; + /** + * Return whether the circle is clickable. + * + * @returns { boolean } Return whether the circle is clickable. + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + isClickable(): boolean; + /** + * Set the center position of the circle. + * Abnormal values are processed as no response. + * + * @param { mapCommon.LatLng } center - Indicates the center position of the circle. + * @return { void } Promise object.No return value. + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + setCenter(center: mapCommon.LatLng): void; + /** + * Set the clickable switch of the circle. + * Abnormal values are processed as no response. + * + * @param { boolean } clickable - Indicates whether the circle is clickable. + * @return { void } + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + setClickable(clickable: boolean): void; + /** + * Set the fill color of the circle.The color value is ARGB format。 + * Abnormal values are processed as no response. + * + * @param { number } color - Indicates the fill color of the circle. + * @return { void } + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + setFillColor(color: number): void; + /** + * Set the radius of the circle. + * Abnormal values are processed as no response. + * + * @param { number } radius - Indicates the radius of the circle. + * @return { void } + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + setRadius(radius: number): void; + /** + * Set the stroke color of the circle.The color value is ARGB format。 + * Abnormal values are processed as no response. + * + * @param { number } color - Indicates the stroke color of the circle. + * @return { void } + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + setStrokeColor(color: number): void; + /** + * Set the stroke pattern styles of the circle. + * Abnormal values are processed as no response. + * + * @param { Array } patterns - Indicates the stroke pattern styles of the circle. + * @return { void } + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + setPatterns(patterns: Array): void; + /** + * Set the stroke width of the circle. + * Abnormal values are processed as no response. + * + * @param { number } width - Indicates the stroke width of the circle. + * @return { void } Promise object.No return value. + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + setStrokeWidth(width: number): void; + } + /** + * Create a new CameraUpdate object to update the camera state. + * + * @param { mapCommon.CameraPosition } cameraPosition - Indicate the camera position. + * @returns { CameraUpdate } Return CameraUpdate object. + * @throws { BusinessError } 401 - Invalid input parameter. + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + function newCameraPosition(cameraPosition: mapCommon.CameraPosition): CameraUpdate; + /** + * Create a new CameraUpdate object to update the center point and zoom level of the map camera. + * + * @param { mapCommon.LatLng } latLng - Indicate the longitude and latitude + * @param { ?number } zoom - Indicate the zoom level + * @returns { CameraUpdate } Return CameraUpdate object. + * @throws { BusinessError } 401 - Invalid input parameter. + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + function newLatLng(latLng: mapCommon.LatLng, zoom?: number): CameraUpdate; + /** + * Create a new CameraUpdate object to set the longitude and latitude range. + * + * @param { mapCommon.LatLngBounds } bounds - Indicate the LatLngBounds + * @param { ?number } padding - Indicate the distance between the map area and the border, in pixels.If not set, use default value 0. + * @returns { CameraUpdate } Return CameraUpdate object. + * @throws { BusinessError } 401 - Invalid input parameter. + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + function newLatLngBounds(bounds: mapCommon.LatLngBounds, padding?: number): CameraUpdate; + /** + * Create a new CameraUpdate object which supports setting the screen height and width of the longitude + * and latitude rectangle range. + * + * @param { mapCommon.LatLngBounds } bounds - Indicate the LatLngBounds. + * @param { number } width - Indicate screen width. + * @param { number } height - Indicate screen height. + * @param { number } padding - Indicate the distance between the map area and the border, in pixels. + * @returns { CameraUpdate } Return CameraUpdate object. + * @throws { BusinessError } 401 - Invalid input parameter. + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + function newLatLngBounds(bounds: mapCommon.LatLngBounds, width: number, height: number, padding: number): CameraUpdate; + /** + * Create a new CameraUpdate object to move the map camera center by screen pixel. + * + * @param { number } x - Pixel value of horizontal movement. A positive value indicates move right, and a negative value indicates move left. + * @param { number } y - Pixel value of vertical movement. A positive value indicates move up, and a negative value indicates move down. + * @returns { CameraUpdate } Return CameraUpdate Object. + * @throws { BusinessError } 401 - Invalid input parameter. + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + function scrollBy(x: number, y: number): CameraUpdate; + /** + * Create a new CameraUpdate object to move the camera in increments by the specified zoom level and center point screen coordinates. + * + * @param { number } amount - Indicate the added zoom level + * @param { ?mapCommon.MapPoint } focus - Indicate the center point screen coordinates.If not set, use the center point of the screen as the focus. + * @returns { CameraUpdate } Return CameraUpdate object. + * @throws { BusinessError } 401 - Invalid input parameter. + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + function zoomBy(amount: number, focus?: mapCommon.MapPoint): CameraUpdate; + /** + * Create a new CameraUpdate object to increase the zoom level of the map by one level. + * + * @returns { CameraUpdate } Return CameraUpdate Object. + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + function zoomIn(): CameraUpdate; + /** + * Create a new CameraUpdate object to reduce the zoom level of the map by one level. + * + * @returns { CameraUpdate } Return CameraUpdate object. + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + function zoomOut(): CameraUpdate; + /** + * Create a new CameraUpdate object to set the zoom level of the map. Value range is [2,20] + * + * @param { number } zoom - Indicates the zoom level. + * @returns { CameraUpdate } Return CameraUpdate object. + * @throws { BusinessError } 401 - Invalid input parameter. + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + function zoomTo(zoom: number): CameraUpdate; + /** + * Calculates the distance between two coordinate. + * Abnormal values are processed to return 0. + * + * @param {mapCommon.LatLng} from - Indicates the start coordinates + * @param {mapCommon.LatLng} to - Indicates the end coordinates + * @returns {number} Return the distance between two coordinate, in meters. + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + function calculateDistance(from: mapCommon.LatLng, to: mapCommon.LatLng): number; + /** + * Coordinate conversion. Currently, only support from WGS84 to GCJ02. + * + * @param {mapCommon.CoordinateType} fromType - Indicates the coordinate type before conversion + * @param {mapCommon.CoordinateType} toType - Indicates the coordinate type after conversion + * @param {mapCommon.LatLng} location - Indicates the coordinate before conversion + * @returns {Promise} Return the coordinate after conversion + * @throws { BusinessError } 401 - Invalid input parameter. + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + function convertCoordinate(fromType: mapCommon.CoordinateType, toType: mapCommon.CoordinateType, location: mapCommon.LatLng): Promise; + /** + * Provide the camera movement parameters which is created by CameraUpdateFactory. + * + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + interface CameraUpdate { + } + /** + * This interface defines the overlays that support display priority control, such as PointAnnotation and Bubble. + * + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + interface BasePriorityOverlay extends BaseOverlay { + /** + * Return the max display zoom of the BasePriorityOverlay. + * + * @returns { number } Return the max display zoom of the BasePriorityOverlay. + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + getMaxZoom(): number; + /** + * Return the min display zoom of the BasePriorityOverlay. + * + * @returns { number } Return the min display zoom of the BasePriorityOverlay. + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + getMinZoom(): number; + /** + * Set the collision priority of the BasePriorityOverlay. + * Abnormal values are processed as no response. + * + * @param { number } priority - Indicates the collision priority of the BasePriorityOverlay. + * @returns {void} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + setPriority(priority: number): void; + /** + * Set the max and min display zoom of the BasePriorityOverlay. + * Abnormal values are processed as no response. + * + * @param { number } minZoom - Indicates the min display zoom of the BasePriorityOverlay. + * @param { number } maxZoom - Indicates the max display zoom of the BasePriorityOverlay. + * @returns {void} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + setZoom(minZoom: number, maxZoom: number): void; + /** + * Set the animation object + * + * @param {Animation} animation - Indicates the animation object + * @return {void} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + setAnimation(animation: Animation): void; + /** + * Start animation + * + * @returns {void} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + startAnimation(): void; + /** + * Clear animation + * + * @returns {void} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + clearAnimation(): void; + } + /** + * Provides interfaces for updating and querying point annotation. + * + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + interface PointAnnotation extends BasePriorityOverlay { + /** + * Return the position of the point annotation. + * + * @returns { mapCommon.LatLng } Return the position of the point annotation. + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + getPosition(): mapCommon.LatLng; + /** + * Return the text of the first title. + * + * @returns { mapCommon.Text } Return the text of the first title. + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + getTitleText(): mapCommon.Text; + /** + * + * Update the text of the first title. + * + * @param { mapCommon.Text } text - Indicates the text of the first title. + * @returns {void} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + setTitleText(text: mapCommon.Text): void; + /** + * Set the title font size animation. + * + * @param { FontSizeAnimation } animation - Indicates the title font size animation. + * @returns {void} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + setTitleAnimation(animation: FontSizeAnimation): void; + /** + * Start the title font size animation. + * + * @returns {void} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + startTitleAnimation(): void; + } + /** + * Provides interfaces for updating and querying bubble. + * + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + interface Bubble extends BasePriorityOverlay { + /** + * Set the icons in the upper left and lower right positions which are the file URI format. + * Abnormal values are processed as no response. + * + * @param { Array } icons - Indicates the bubble icons. + * @returns {Promise} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + /** + * Set the icons in the upper left and lower right positions which are the file URI format. + * + * @param { Array } icons - Indicates the bubble icons. + * @returns {Promise} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + setIcons(icons: Array): Promise; + /** + * Set the positions of the bubble. + * The system calculates the proper positions of the icons based on the multiple position segments. + * Abnormal values are processed as no response. + * + * @param { Array> } positions - Indicates the positions of the bubble. + * @returns {void} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + setPositions(positions: Array>): void; + } + /** + * Used to convert between screen coordinates and longitude and latitude. + * + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + interface Projection { + /** + * Converts screen coordinates to longitude and latitude coordinates. + * Abnormal values are processed to return Number.NaN. + * + * @param {mapCommon.MapPoint} point - Indicates the screen coordinates. + * @returns {mapCommon.LatLng} Return the longitude and latitude coordinates. + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + fromScreenLocation(point: mapCommon.MapPoint): mapCommon.LatLng; + /** + * Converts longitude and latitude coordinates to screen coordinates. + * Abnormal values are processed to return 0. + * + * @param {mapCommon.LatLng} position - Indicates the longitude and latitude coordinates. + * @returns {mapCommon.MapPoint} Return the screen coordinates. + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + toScreenLocation(position: mapCommon.LatLng): mapCommon.MapPoint; + /** + * Returns the coordinates of the current visible region. + * + * @returns {mapCommon.VisibleRegion} Return the coordinates of the current visible region. + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + getVisibleRegion(): mapCommon.VisibleRegion; + /** + * Obtains the target area corresponding to the map control based on the center point and zoom level. + * + * @param { mapCommon.LatLng } center - The center point. + * @param { number } zoom - The zoom level. + * @returns { mapCommon.LatLngBounds } Return the target area corresponding. + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + getMapBounds(center: mapCommon.LatLng, zoom: number): mapCommon.LatLngBounds; + } + /** + * LatLngBounds Util. + * + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + class LatLngBoundsUtils { + /** + * Determines whether the bounds contains the location. + * + * @param {mapCommon.LatLngBounds} bounds - Indicates the map bounds. + * @param {mapCommon.LatLng} position - Indicates the map location. + * @returns {boolean} Return the result.true:contain, false:does not contain + * @throws { BusinessError } 401 - Invalid input parameter. + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + static contains(bounds: mapCommon.LatLngBounds, position: mapCommon.LatLng): boolean; + /** + * Determines whether the src bounds contains the target bounds. + * @param {mapCommon.LatLngBounds} src - Indicates the src bounds. + * @param {mapCommon.LatLngBounds} target - Indicates the target bounds. + * @returns {boolean} Return the result.true:contain, false:does not contain + * @throws { BusinessError } 401 - Invalid input parameter. + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + static contains(src: mapCommon.LatLngBounds, target: mapCommon.LatLngBounds): boolean; + /** + * Obtains the center longitude and latitude of the bounds. + * + * @param {mapCommon.LatLngBounds} bounds - Indicates the map bounds. + * @returns {mapCommon.LatLng} Return the center longitude and latitude. + * @throws { BusinessError } 401 - Invalid input parameter. + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + static getCenter(bounds: mapCommon.LatLngBounds): mapCommon.LatLng; + /** + * Obtains a new bounds which include the position and old bounds. + * + * @param {mapCommon.LatLng} position - Indicates the map location. + * @param {mapCommon.LatLngBounds} bounds - Indicates the map bounds. + * @returns {mapCommon.LatLngBounds} Return a new bounds. + * @throws { BusinessError } 401 - Invalid input parameter. + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + static include(position: mapCommon.LatLng, bounds?: mapCommon.LatLngBounds): mapCommon.LatLngBounds; + } + /** + * An abstract class that controls map animation. + * + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + abstract class Animation { + /** + * Animation duration, in milliseconds. The default value is 250 ms. + * Abnormal values are handled according to the default values. + * + * @param { number } duration - Indicates the animation duration + * @returns {void} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + setDuration(duration: number): void; + /** + * The status after animation execution is complete.The default value is AnimationFillMode.FORWARDS. + * Abnormal values are handled according to the default values. + * + * @param { AnimationFillMode } fillMode - Indicates the status after animation execution is complete. + * @returns {void} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + setFillMode(fillMode: AnimationFillMode): void; + /** + * Number of times the animation is repeated. The default value is 0. + * Positive number: Repeat the execution based on the value. + * 0: The animation is not executed repeatedly. + * - 1: The number of execution times is infinite. + * Less than - 1: The default value 0 is used. + * Abnormal values are handled according to the default values. + * + * @param { number } repeatCount - Indicates the number of times the animation is repeated. + * @returns {void} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + setRepeatCount(repeatCount: number): void; + /** + * Indicates the repeated execution mode. The default value is AnimationRepeatMode.RESTART. + * Abnormal values are handled according to the default values. + * + * @param { AnimationRepeatMode } repeatMode - Indicates the repeated execution mode. + * @returns {void} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + setRepeatMode(repeatMode: AnimationRepeatMode): void; + /** + * Set the animation interpolator. + * + * @param { Curves.Curve } curve - Indicates the animation interpolator. + * @returns {void} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + setInterpolator(curve: Curves.Curve): void; + /** + * Listen the animation start event. + * + * @param {'start'} type - Indicates the animation start event. + * @param {Callback} callback - Indicates the callback interface + * @returns {void} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + on(type: 'start', callback: Callback): void; + /** + * Cancel listening to the animation start event. + * + * @param {'start'} type - Indicates the animation start event. + * @param {Callback} callback - Indicates the callback interface + * @returns {void} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + off(type: 'start', callback: Callback): void; + /** + * Listen the animation end event. + * + * @param {'end'} type - Indicates the animation end event. + * @param {Callback} callback - Indicates the callback interface + * @returns {void} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + on(type: 'end', callback: Callback): void; + /** + * Cancel listening to the animation end event. + * + * @param {'end'} type - Indicates the animation end event. + * @param {Callback} callback - Indicates the callback interface + * @returns {void} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + off(type: 'end', callback: Callback): void; + } + /** + * The animation class that controls the transparency. + * + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + class AlphaAnimation extends Animation { + /** + * Creates an AlphaAnimation object with start and target transparency. + * The transparency range is [0, 1]. The value 1 indicates opaque, and the value 0 indicates complete transparency. + * + * @param {number} fromAlpha - Indicates start transparency + * @param {number} toAlpha - Indicates target transparency + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + constructor(fromAlpha: number, toAlpha: number); + } + /** + * The animation class that controls rotation. + * + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + class RotateAnimation extends Animation { + /** + * Creates a RotateAnimation object using the start and target angles. + * The angles range is [0, 360]. + * + * @param {number} fromDegree - Indicates start angles + * @param {number} toDegree - Indicates target angles + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + constructor(fromDegree: number, toDegree: number); + } + /** + * The animation class that controls scaling. + * + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + class ScaleAnimation extends Animation { + /** + * Create a ScaleAnimation object using the start and target scale. + * The value 0 indicates zooming out to disappear. + * The value 1 indicates no scaling. + * A value less than 1 indicates zooming out. + * A value greater than 1 indicates zooming in. + * + * @param {number} fromX - Indicates the horizontal zoom applied at the beginning of the animation. + * @param {number} toX - Indicates the horizontal zoom applied at the end of the animation. + * @param {number} fromY - Indicates the vertical zoom applied at the beginning of the animation. + * @param {number} toY - Indicates the vertical zoom applied at the end of the animation. + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + constructor(fromX: number, toX: number, fromY: number, toY: number); + } + /** + * The animation class that controls translate. + * + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + class TranslateAnimation extends Animation { + /** + * Creates a TranslateAnimation object using the target latitude and longitude. + * + * @param {mapCommon.LatLng} target - Indicates target latitude and longitude. + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + constructor(target: mapCommon.LatLng); + } + /** + * The animation class that controls font size. + * + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + class FontSizeAnimation extends Animation { + /** + * Creates an FontSizeAnimation object with start and target font size. + * + * @param {number} fromSize - Indicates start font size + * @param {number} toSize - Indicates target font size + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + constructor(fromSize: number, toSize: number); + } + /** + * Control the frame animation of multiple pictures. + * Suggestions and restrictions: + * 1. Recommended that the image sizes be the same. + * 2. The number of images cannot exceed 200. + * 3. The duration must be greater than 33 ms.If not, it will be changed to 33. + * + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + class PlayImageAnimation extends Animation { + /** + * Add images. + * + * @param { Array } images - Indicates multiple pictures. + * @returns { Promise } + * @throws { BusinessError } 401 - Invalid input parameter. + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + addImages(images: Array): Promise; + } + /** + * The animation set. + * + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + class AnimationSet extends Animation { + /** + * Creates a AnimationSet object. + * + * @param {boolean} shareInterpolator - Indicates whether to share the interpolator. + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + constructor(shareInterpolator: boolean); + /** + * Add animation. + * + * @param {Animation} animation - Indicates the animation object + * @returns {void} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + addAnimation(animation: Animation): void; + /** + * clear animation. + * + * @returns {void} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + clearAnimation(): void; + } + /** + * The cluster overlay. + * + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + interface ClusterOverlay { + /** + * Listen cluster click event. + * + * @param { 'clusterClick' } type + * @param { Callback> } callback - Indicates the listener when click the cluster. + * @returns { void } + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + on(type: 'clusterClick', callback: Callback>): void; + /** + * Cancel listening cluster click event. + * + * @param { 'clusterClick' } type + * @param { Callback } callback - Cancel the listener when click the cluster. + * @returns { void } + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + off(type: 'clusterClick', callback: Callback): void; + /** + * Add cluster item to the cluster overlay. + * + * @param { mapCommon.ClusterItem } item - Indicates the cluster item. + * @returns { Promise } + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + addItem(item: mapCommon.ClusterItem): Promise; + /** + * Remove cluster overlay. + * + * @returns { Promise } + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + remove(): Promise; + } + /** + * Provides interfaces for updating and querying ImageOverlay. + * + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + interface ImageOverlay extends BaseOverlay { + /** + * Return bearing. + * + * @returns { number } Return bearing. + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + getBearing(): number; + /** + * Return bounds. + * + * @returns { mapCommon.LatLngBounds } Return bounds. + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + getBounds(): mapCommon.LatLngBounds; + /** + * Return height. + * + * @returns { number } Return height. + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + getHeight(): number; + /** + * Return width. + * + * @returns { number } Return width. + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + getWidth(): number; + /** + * Return position. + * + * @returns { mapCommon.LatLng } Return position. + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + getPosition(): mapCommon.LatLng; + /** + * Return transparency. + * + * @returns { number } Return transparency. + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + getTransparency(): number; + /** + * Return whether is clickable. + * + * @returns { boolean } Return whether is clickable. + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + isClickable(): boolean; + /** + * Set bearing. + * + * @param { number } bearing - Indicates the bearing. + * @returns { void } + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + setBearing(bearing: number): void; + /** + * Set the clickable switch. + * + * @param { boolean } clickable - Indicates whether is clickable. + * @return { void } + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + setClickable(clickable: boolean): void; + /** + * Set the width and height. + * + * @param { number } width - Indicates width. + * @param { ?number } height - Indicates height. + * @return { void } + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + setDimensions(width: number, height?: number): void; + /** + * Set the image + * + * @param { ResourceStr | image.PixelMap } icon - Indicates the image. + * @return { Promise } + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + setImage(image: ResourceStr | image.PixelMap): Promise; + /** + * Set the bounds + * + * @param { mapCommon.LatLngBounds } bounds - Indicates the bounds. + * @return { void } + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + setBounds(bounds: mapCommon.LatLngBounds): void; + /** + * Set the position + * + * @param { mapCommon.LatLng } bounds - Indicates the position. + * @return { void } + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + setPosition(position: mapCommon.LatLng): void; + /** + * Set the transparency + * + * @param { number } transparency - Indicates the transparency. + * @return { void } + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + setTransparency(transparency: number): void; + } + /** + * Spatial Relation Util. + * + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + class SpatialRelationUtil { + /** + * Determine whether a point is within a polygonal area. + * + * @param { Array } points - Indicates the polygon points. + * @param { mapCommon.LatLng } point - Indicates the point. + * @returns { boolean } Return the result.true:contain, false:does not contain + * @throws { BusinessError } 401 - Invalid input parameter. + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + static isPointContainedInPolygon(points: Array, point: mapCommon.LatLng): boolean; + } + /** + * The animation is finished or canceled. + * + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + interface AnimateResult { + /** + * The animation is finished. + * + * @type { ?boolean } + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + isFinished?: boolean; + /** + * The animation is canceled. + * + * @type { ?boolean } + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + isCanceled?: boolean; + } + /** + * The marker delegate class for the custom information window. + * + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + interface MarkerDelegate { + /** + * The marker to display the custom information window. + * + * @type { ?Marker } + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + marker?: Marker; + } + /** + * The animation fill mode. + * + * @enum {number} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + enum AnimationFillMode { + /** + * The animation remains at the last frame after execution. + * + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + FORWARDS = 0, + /** + * The animation remains at the first frame after execution. + * + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + BACKWARDS = 1 + } + /** + * The animation repeat mode. + * + * @enum {number} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + enum AnimationRepeatMode { + /** + * Play from the beginning when the animation is over. + * + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + RESTART = 0, + /** + * Rewind from the end of the animation. + * + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + REVERSE = 1 + } +} +export default map; diff --git a/language/arkts/extractor/sdk/hms/ets/api/@hms.core.map.mapCommon.d.ts b/language/arkts/extractor/sdk/hms/ets/api/@hms.core.map.mapCommon.d.ts new file mode 100755 index 00000000..fe091421 --- /dev/null +++ b/language/arkts/extractor/sdk/hms/ets/api/@hms.core.map.mapCommon.d.ts @@ -0,0 +1,2109 @@ +/* + * Copyright (c) Huawei Technologies Co., Ltd. 2023-2023. All rights reserved. + */ +/** + * @file Provide common object definitions for maps. + * @bundle com.huawei.hms.mapservice.kit/mapLibrary/ets/mapCommon 5.0.0(12) + * @kit MapKit + */ +import type image from '@ohos.multimedia.image'; +/** + * This module provides common object definitions for maps. + * + * @namespace mapCommon + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ +declare namespace mapCommon { + /** + * The information to initialize the map. + * + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + interface MapOptions { + /** + * Indicates the type of map. + * Abnormal values are handled according to the default values. + * + * @type { ?MapType } + * @default MapType.STANDARD + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + mapType?: MapType; + /** + * Indicates the position of map camera. + * + * @type { CameraPosition } + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + position: CameraPosition; + /** + * Indicates the move range of map camera. + * Abnormal values are handled according to no bounds. + * + * @type { ?LatLngBounds } + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + bounds?: LatLngBounds; + /** + * Indicates the max zoom of map. Value range is [2,20]. + * Abnormal values are handled according to the default values. + * + * @type { ?number } + * @default 20 + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + maxZoom?: number; + /** + * Indicates the min zoom of map. Value range is [2,20]. + * Abnormal values are handled according to the default values. + * + * @type { ?number } + * @default 2 + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + minZoom?: number; + /** + * Indicates the rotate gesture enable of map. + * Abnormal values are handled according to the default values. + * + * @type { ?boolean } + * @default true + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + rotateGesturesEnabled?: boolean; + /** + * Indicates the scroll gesture enable of map. + * Abnormal values are handled according to the default values. + * + * @type { ?boolean } + * @default true + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + scrollGesturesEnabled?: boolean; + /** + * Indicates the zoom gesture enable of map. + * Abnormal values are handled according to the default values. + * + * @type { ?boolean } + * @default true + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + zoomGesturesEnabled?: boolean; + /** + * Indicates the tilt gesture enable of map. + * Abnormal values are handled according to the default values. + * + * @type { ?boolean } + * @default true + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + tiltGesturesEnabled?: boolean; + /** + * Indicates the zoom controls enable of map. + * Abnormal values are handled according to the default values. + * + * @type { ?boolean } + * @default true + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + zoomControlsEnabled?: boolean; + /** + * Indicates the my location controls enable of map. + * Abnormal values are handled according to the default values. + * + * @type { ?boolean } + * @default false + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + myLocationControlsEnabled?: boolean; + /** + * Indicates the compass controls enable of map. + * Abnormal values are handled according to the default values. + * + * @type { ?boolean } + * @default true + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + compassControlsEnabled?: boolean; + /** + * Indicates the scale controls enable of map. + * Abnormal values are handled according to the default values. + * + * @type { ?boolean } + * @default false + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + scaleControlsEnabled?: boolean; + /** + * Indicates the boundary padding of the map. + * + * @type { ?Padding } + * @default { left:0 , top:0 , right:0 , bottom:0 } + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + padding?: Padding; + /** + * The custom style id + * + * @type { ?string } + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + styleId?: string; + /** + * The day and night mode. + * + * @type { ?DayNightMode } + * @default DayNightMode.DAY + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + dayNightMode?: DayNightMode; + } + /** + * The map type. + * + * @enum {number} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + enum MapType { + /** + * Indicate standard map with important natural features such as roads, buildings, green spaces and rivers. + * + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + STANDARD = 0, + /** + * Indicates blank map. + * + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + NONE = 1, + /** + * Indicate terrain map.Overlaying terrain data on a standard map + * + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + TERRAIN = 2 + } + /** + * Provide the longitude and latitude of the map. + * + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + interface LatLng { + /** + * Provide the longitude of the map.The value range is [-180, 180). + * + * @type { number } + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + longitude: number; + /** + * Provide the latitude of the map.The value range is [-90, 90]. + * + * @type { number } + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + latitude: number; + } + /** + * Provide the attributes of the map camera, include position, zoom level, tilt angle, and orientation. + * + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + interface CameraPosition { + /** + * Provide the camera position. + * + * @type { LatLng } + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + target: LatLng; + /** + * Provide the camera zoom level. Value range is [2,20] + * + * @type { number } + * @default 2 + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + zoom: number; + /** + * Provide the camera tilt angle.The value range is [0,75] + * + * @type { ?number } + * @default 0 + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + tilt?: number; + /** + * Provide the camera orientation. The due north direction is 0 degrees and increases clockwise.The value range is [0, 360]. + * + * @type { ?number } + * @default 0 + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + bearing?: number; + } + /** + * Provide the rectangular region defined by a pair of latitudes and longitudes. + * + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + interface LatLngBounds { + /** + * The position of the northeast corner. + * + * @type { LatLng } + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + northeast: LatLng; + /** + * The position of the southwest corner. + * + * @type { LatLng } + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + southwest: LatLng; + } + /** + * The border style used to describe a circle, polygon or polyline. + * + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + interface PatternItem { + /** + * The border style type + * + * @type { PatternItemType } + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + type: PatternItemType; + /** + * The length of the border if the border style type is DASH or GAP. + * + * @type { ?number } + * @default 1 + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + length?: number; + } + /** + * A border style type used to describe a circle, polygon, or polyline. + * + * @enum {number} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + enum PatternItemType { + /** + * A dash in the border of a polyline, polygon, or circle. + * + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + DASH = 0, + /** + * A dot in the border of a polyline, polygon, or circle. + * + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + DOT = 1, + /** + * A gap in the border of a polyline, polygon, or circle. + * + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + GAP = 2 + } + /** + * The corner drawing style for polyline and polygon. + * + * @enum {number} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + enum JointType { + /** + * Use sharp corners to connect path segments. + * + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + DEFAULT = 0, + /** + * Use bevels to connect path segments. + * + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + BEVEL = 1, + /** + * Use fillets to join path segments. + * + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + ROUND = 2 + } + /** + * Used to customize the my location style + * + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + interface MyLocationStyle { + /** + * The offset in the horizontal direction of the anchor point + * + * @type { ?number } + * @default 0.5 + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + anchorU?: number; + /** + * The offset in the vertical direction of the anchor point + * + * @type { ?number } + * @default 0.5 + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + anchorV?: number; + /** + * The my location icon which is the file URI format. + * + * @type { ?string } + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + /** + * The my location icon which is the file URI format. + * + * @type { ?string | image.PixelMap | Resource} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + icon?: string | image.PixelMap | Resource; + /** + * The fill color of the precision circle.The color value is ARGB format。 + * + * @type { ?number } + * @default 0x8F7570FF + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + radiusFillColor?: number; + /** + * My location layer display type. + * + * @type { ?MyLocationDisplayType } + * @default MyLocationDisplayType.DEFAULT + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + displayType?: MyLocationDisplayType; + } + /** + * Indicates the POI object on the map. + * + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + interface Poi { + /** + * Poi id + * + * @type { string } + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + id: string; + /** + * Poi name + * + * @type { string } + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + name: string; + /** + * Poi location + * + * @type { LatLng } + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + position: LatLng; + } + /** + * The alignment mode of the map logo + * + * @enum {number} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + enum LogoAlignment { + /** + * Place the logo on the lower left position. + * + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + BOTTOM_START = 0, + /** + * Place the logo on the lower right position. + * + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + BOTTOM_END = 1, + /** + * Place the logo on the upper left position. + * + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + TOP_START = 2, + /** + * Place the logo on the upper right position. + * + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + TOP_END = 3 + } + /** + * This interface defines the overlay basic information. + * + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + interface BaseOverlayOptions { + /** + * Indicates whether the BaseOverlay is visible. + * Abnormal values are handled according to the default values. + * + * @type { ?boolean } + * @default true + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + visible?: boolean; + /** + * Indicates the overlay level of the BaseOverlay. + * Abnormal values are handled according to the default values. + * + * @type { ?number } + * @default 0 + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + zIndex?: number; + } + /** + * Provides the attributes of marker + * + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + interface MarkerOptions extends BaseOverlayOptions { + /** + * The position of the marker + * + * @type { LatLng } + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + position: LatLng; + /** + * The rotation direction of the marker's icon + * Abnormal values are handled according to the default values. + * + * @type { ?number } + * @default 0 + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + rotation?: number; + /** + * Indicates the icon of the marker which is the file URI format. + * Abnormal values are handled according to the default icon. + * + * @type { ?string } + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + /** + * Indicates the icon of the marker which is the file URI format. + * + * @type { ?string | image.PixelMap | Resource } + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + icon?: string | image.PixelMap | Resource; + /** + * Indicates the alpha of the marker's icon. The value range is [0,1], 0 is completely transparent and 1 is completely opaque. + * Abnormal values are handled according to the default values. + * + * @type { ?number } + * @default 1 + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + alpha?: number; + /** + * Indicates the position of the anchor point of the marker's icon in the horizontal direction. Value range: [0, 1] + * Abnormal values are handled according to the default values. + * + * @type { ?number } + * @default 0.5 + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + anchorU?: number; + /** + * Indicates the position of the anchor point of the marker's icon in the vertical direction. Value range: [0, 1] + * Abnormal values are handled according to the default values. + * + * @type { ?number } + * @default 1 + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + anchorV?: number; + /** + * Indicates whether the marker is clickable. + * Abnormal values are handled according to the default values. + * + * @type { ?boolean } + * @default false + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + clickable?: boolean; + /** + * Indicates whether the marker is draggable. + * Abnormal values are handled according to the default values. + * + * @type { ?boolean } + * @default false + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + draggable?: boolean; + /** + * Indicates whether the marker's icon is shown on the ground. + * Abnormal values are handled according to the default values. + * + * @type { ?boolean } + * @default false + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + flat?: boolean; + /** + * Indicates the title of marker info window + * + * @type { ?string } + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + title?: string; + /** + * Indicates the subTitle of marker info window + * + * @type { ?string } + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + snippet?: string; + /** + * Indicates the position of the anchor point of the marker info window in the horizontal direction. Value range: [0, 1] + * Abnormal values are handled according to the default values. + * + * @type { ?number } + * @default 0.5 + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + infoWindowAnchorU?: number; + /** + * Indicates the position of the anchor point of the marker info window in the vertical direction. Value range: [0, 1] + * Abnormal values are handled according to the default values. + * + * @type { ?number } + * @default 0 + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + infoWindowAnchorV?: number; + /** + * altitude, and the unit is meter. + * + * @type { ?number } + * @default 0 + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + altitude?: number; + } + /** + * Provide the attributes of map circle + * + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + interface MapCircleOptions extends BaseOverlayOptions { + /** + * The center position of the circle + * Abnormal values are processed as no response. + * + * @type { LatLng } + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + center: LatLng; + /** + * The radius of the circle + * Abnormal values are handled according to the default values. + * + * @type { number } + * @default 0 + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + radius: number; + /** + * Return whether the circle is clickable. + * Abnormal values are handled according to the default values. + * + * @returns { ?boolean } Return whether the circle is clickable. + * @default false + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + clickable?: boolean; + /** + * The fill color of the circle.The color value is ARGB format。 + * Abnormal values are handled according to the default values. + * + * @type { ?number } + * @default 0x00000000 + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + fillColor?: number; + /** + * The stroke color of the circle.The color value is ARGB format。 + * Abnormal values are handled according to the default values. + * + * @type { ?number } + * @default 0xff000000 + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + strokeColor?: number; + /** + * The stroke pattern styles of the circle + * Abnormal values are handled according to the default values. + * + * @type { ?Array } + * @default [] + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + patterns?: Array; + /** + * The stroke width of the circle + * Abnormal values are handled according to the default values. + * + * @type { ?number } + * @default 10 + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + strokeWidth?: number; + } + /** + * Provides the attributes of map polygon + * + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + interface MapPolygonOptions extends BaseOverlayOptions { + /** + * The coordinate point list of the polygon + * Abnormal values are processed as no response. + * + * @type { Array } + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + points: Array; + /** + * The set of hollow holes in the polygon + * Abnormal values are handled according to the default values. + * + * @type { Array> } + * @default [] + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + holes?: Array>; + /** + * Indicates whether the polygon is clickable. + * Abnormal values are handled according to the default values. + * + * @type { ?boolean } + * @default false + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + clickable?: boolean; + /** + * The fill color of the polygon.The color value is ARGB format。 + * Abnormal values are handled according to the default values. + * + * @type { ?number } + * @default 0x00000000 + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + fillColor?: number; + /** + * Indicates whether the polygon is drawn as a geodetic line. + * Abnormal values are handled according to the default values. + * + * @type { ?boolean } + * @default false + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + geodesic?: boolean; + /** + * The stroke color of the polygon.The color value is ARGB format。 + * Abnormal values are handled according to the default values. + * + * @type { ?number } + * @default 0xff000000 + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + strokeColor?: number; + /** + * the node type of polygon corner. + * Abnormal values are handled according to the default values. + * + * @type { ?JointType } + * @default JointType.DEFAULT + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + jointType?: JointType; + /** + * The stroke pattern styles of the polygon + * Abnormal values are handled according to the default values. + * + * @type { ?Array } + * @default [] + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + patterns?: Array; + /** + * Indicates the stroke width of the polygon. + * Abnormal values are handled according to the default values. + * + * @type { ?number } + * @default 10 + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + strokeWidth?: number; + } + /** + * Provides the attributes of map polyline + * + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + interface MapPolylineOptions extends BaseOverlayOptions { + /** + * The coordinate point list of the polyline + * Abnormal values are processed as no response. + * + * @type { Array } + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + points: Array; + /** + * Indicates whether the polyline is clickable. + * Abnormal values are handled according to the default values. + * + * @type { ?boolean } + * @default false + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + clickable?: boolean; + /** + * The color of the polyline.The color value is ARGB format。 + * Abnormal values are handled according to the default values. + * + * @type { ?number } + * @default 0xff000000 + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + color?: number; + /** + * The multiple colors of the polyline.The color value is ARGB format。 + * Abnormal values are handled according to the default values. + * + * @type { ?Array } + * @default [] + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + colors?: Array; + /** + * The style of the start vertex of the polyline + * Abnormal values are handled according to the default values. + * + * @type { ?CapStyle } + * @default CapStyle.BUTT + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + startCap?: CapStyle; + /** + * The style of the end vertex of the polyline + * Abnormal values are handled according to the default values. + * + * @type { ?CapStyle } + * @default CapStyle.BUTT + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + endCap?: CapStyle; + /** + * Indicates whether the polyline is drawn as a geodetic line. + * Abnormal values are handled according to the default values. + * + * @type { ?boolean } + * @default false + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + geodesic?: boolean; + /** + * the node type of polyline corner. + * Abnormal values are handled according to the default values. + * + * @type { ?JointType } + * @default JointType.DEFAULT + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + jointType?: JointType; + /** + * The stroke pattern styles of the polyline + * Abnormal values are handled according to the default values. + * + * @type { ?Array } + * @default [] + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + patterns?: Array; + /** + * Indicates the width of the polyline. + * Abnormal values are handled according to the default values. + * + * @type { ?number } + * @default 10 + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + width?: number; + /** + * Indicates whether to enable the gradient color if there are multiple colors. + * Abnormal values are handled according to the default values. + * + * @type { ?boolean } + * @default false + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + gradient?: boolean; + /** + * Indicates the custom texture.Recommended that texture has no background color (use transparent color) + * + * @type { ?ResourceStr | image.PixelMap } + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + customTexture?: ResourceStr | image.PixelMap; + } + /** + * This interface defines the priority overlay basic information. + * + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + interface BasePriorityOverlayParams extends BaseOverlayOptions { + /** + * Indicates the position of the anchor point of the overlay icon in the horizontal direction. Value range: [0, 1] + * Abnormal values are handled according to the default values. + * + * @type { ?number } + * @default 0.5 + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + anchorU?: number; + /** + * Indicates the position of the anchor point of the overlay icon in the vertical direction. Value range: [0, 1] + * Abnormal values are handled according to the default values. + * + * @type { ?number } + * @default 1 + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + anchorV?: number; + /** + * If this parameter is set to true, the overlay is still forcibly displayed after being collided. + * Abnormal values are handled according to the default values. + * + * @type { ?boolean } + * @default false + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + forceVisible?: boolean; + /** + * Indicates the collision priority. A larger value indicates a lower priority. + * Abnormal values are handled according to the default values. + * + * @type { ?number } + * @default Number.MAX_VALUE + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + priority?: number; + /** + * Indicates the min display zoom. + * + * @type { ?number } + * @default 2 + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + minZoom?: number; + /** + * Indicates the max display zoom. + * + * @type { ?number } + * @default 20 + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + maxZoom?: number; + } + /** + * Provides the attributes of point annotation. + * + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + interface PointAnnotationParams extends BasePriorityOverlayParams { + /** + * The position of the point annotation. + * Abnormal values are processed as no response. + * + * @type { LatLng } + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + position: LatLng; + /** + * Indicates whether to support deduplication if the point annotation name is the same as the map poi name. + * Abnormal values are handled according to the default values. + * + * @type { ?boolean } + * @default false + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + repeatable?: boolean; + /** + * Indicates the conflict handling rules if the point annotation name is the same as the map poi name. + * Abnormal values are handled according to the default values. + * + * @type { ?boolean } + * @default CollisionRule.NAME + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + collisionRule?: CollisionRule; + /** + * Indicates the titles of the point annotation.The min length is 1, and the max length is 3. + * + * @type { Array } + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + titles: Array; + /** + * Indicates the icon of the point annotation. If not set, system will use the default icon. + * + * @type { ?string } + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + /** + * Indicates the icon of the point annotation. If not set, system will use the default icon. + * + * @type { ?string | image.PixelMap | Resource } + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + icon?: string | image.PixelMap | Resource; + /** + * Indicates whether to display the icon of the point annotation. + * Abnormal values are handled according to the displayed icon. + * + * @type { ?boolean } + * @default true + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + showIcon?: boolean; + } + /** + * Provides the text of point annotation title. + * + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + interface Text { + /** + * Indicates the title content. + * + * @type { string } + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + content: string; + /** + * Indicates the title color.The color value is ARGB format。 + * + * @type { ?number } + * @default 0xFF000000 + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + color?: number; + /** + * Indicates the name font size. + * + * @type { ?number } + * @default 15 + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + fontSize?: number; + /** + * Indicates the name stroke color.The color value is ARGB format。 + * + * @type { ?number } + * @default 0xFFFFFFFF + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + strokeColor?: number; + /** + * Indicates the name stroke width. + * + * @type { ?number } + * @default 2 + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + strokeWidth?: number; + /** + * Indicates the name font style. + * Abnormal values are handled according to the default icon. + * + * @type { ?FontStyle } + * @default FontStyle.REGULAR + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + fontStyle?: FontStyle; + } + /** + * Provides the attributes of bubble for displaying congestion and speed measurement information. + * + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + interface BubbleParams extends BasePriorityOverlayParams { + /** + * Indicates the positions of the bubble. + * The system calculates the proper positions of the icons based on the multiple position segments. + * Abnormal values are processed as no response. + * + * @type { Array> } + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + positions: Array>; + /** + * Indicates the icons in the upper left and lower right positions which are the file URI format. + * Abnormal values are processed as no response. + * + * @type { Array } + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + /** + * Indicates the icons in the upper left and lower right positions which are the file URI format. + * + * @type { Array } + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + icons: Array; + } + /** + * Set the boundary padding for the map to define the visible area of the map. + * + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + interface Padding { + /** + * Indicates the added padding distance on the left of the map, in pixels. + * Abnormal values are handled according to the default value. + * + * @type { ?number } + * @default 0 + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + left?: number; + /** + * Indicates the added padding distance on the top of the map, in pixels. + * Abnormal values are handled according to the default value. + * + * @type { ?number } + * @default 0 + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + top?: number; + /** + * Indicates the added padding distance on the right of the map, in pixels. + * Abnormal values are handled according to the default value. + * + * @type { ?number } + * @default 0 + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + right?: number; + /** + * Indicates the added padding distance on the bottom of the map, in pixels. + * Abnormal values are handled according to the default value. + * + * @type { ?number } + * @default 0 + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + bottom?: number; + } + /** + * Indicates the polygon formed by the longitude and latitude corresponding to the four vertices on the map. + * The polygon is an irregular quadrilateral. If the map is not slanted, the visible area is rectangular. + * If the map is slanted, the visible area is trapezoidal. + * + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + interface VisibleRegion { + /** + * The upper left corner of the viewable area. + * + * @type {LatLng} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + farLeft: LatLng; + /** + * The lower left corner of the viewable area. + * + * @type {LatLng} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + nearLeft: LatLng; + /** + * The upper right corner of the visible area. + * + * @type {LatLng} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + farRight: LatLng; + /** + * The lower right corner of the visible area. + * + * @type {LatLng} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + nearRight: LatLng; + /** + * Longitude and latitude range formed by the four vertices of the visible area + * + * @type {LatLngBounds} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + bounds: LatLngBounds; + } + /** + * A point on a two-dimensional map projection. + * + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + interface MapPoint { + /** + * Indicates the X coordinate of point. + * + * @type { number } + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + positionX: number; + /** + * Indicates the Y coordinate of point. + * + * @type { number } + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + positionY: number; + } + /** + * The custom style options. + * + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + interface CustomMapStyleOptions { + /** + * The custom style id.The system queries the style content based on the style id. + * If both styleId and styleContent are transferred, styleId will used. + * + * @type { ?string } + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + styleId?: string; + /** + * The custom style content, and the content format is json. + * + * @type { ?string } + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + styleContent?: string; + } + /** + * The cluster item. + * + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + abstract class ClusterItem { + /** + * The position of cluster item. + * + * @type { LatLng } + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + position: LatLng; + } + /** + * The cluster overlay parameters. + * + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + interface ClusterOverlayParams { + /** + * The cluster items. + * + * @type { Array } + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + clusterItems: Array; + /** + * The distance within which cluster items are aggregated, and the unit is vp. + * + * @type { number } + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + distance: number; + /** + * Customizing icons based on aggregated items. + * + * @param { Array } clusterItems - Indicates the aggregated items. + * @returns { Promise } Return custom image. + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + getCustomIcon?(clusterItems: Array): Promise; + } + /** + * The image overlay parameters. + * + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + interface ImageOverlayParams extends BaseOverlayOptions { + /** + * Sets the position of the overlay based on a rectangular area. + * position or bounds must be specified. If both are specified, bounds has a higher priority. + * + * @type { ?LatLngBounds } + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + bounds?: LatLngBounds; + /** + * Set the position of the overlay according to the location. + * position or bounds must be specified. If both are specified, bounds has a higher priority. + * + * @type { ?LatLng } + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + position?: LatLng; + /** + * Indicates the icon width, and the unit is meter.This parameter is valid only when position is set. + * + * @type { ?boolean } + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + width?: number; + /** + * Indicates the icon height, and the unit is meter.This parameter is valid only when position and width are set. + * + * @type { ?boolean } + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + height?: number; + /** + * Indicates the position of the anchor point of the ImageOverlay's icon in the horizontal direction. Value range: [0, 1] + * + * @type { ?number } + * @default 0.5 + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + anchorU?: number; + /** + * Indicates the position of the anchor point of the ImageOverlay's icon in the vertical direction. Value range: [0, 1] + * + * @type { ?number } + * @default 0.5 + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + anchorV?: number; + /** + * Sets the angle clockwise from true north.True North is 0 degrees. If the value is a positive number, the image is rotated clockwise. + * If the value is a negative number, the image is rotated counterclockwise. + * + * @type { ?number } + * @default 0 + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + bearing?: number; + /** + * Indicates whether is clickable. + * + * @type { ?boolean } + * @default false + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + clickable?: boolean; + /** + * Indicates the image. + * + * @type { ResourceStr | image.PixelMap } + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + image: ResourceStr | image.PixelMap; + /** + * Transparency of the overlay. The value range is [0, 1]. 0 indicates opaque, and 1 indicates fully transparent. + * + * @type { ?number } + * @default 0 + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + transparency?: number; + } + /** + * A border style type used to describe a circle, polygon, or polyline. + * + * @enum {number} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + enum CapStyle { + /** + * The two ends of the line are parallel lines. + * + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + BUTT = 0, + /** + * Extend half a circle at both ends of the line. + * + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + ROUND = 1, + /** + * Extend a rectangle at each end of the line. + * + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + SQUARE = 2 + } + /** + * Indicates the conflict handling rules if the point annotation name is the same as the map poi name. + * + * @enum {number} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + enum CollisionRule { + /** + * Both name and icon don't participate in collisions. + * + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + NONE = 0, + /** + * Only name participate in collisions. + * + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + NAME = 1, + /** + * Both name and icon can participate in collisions. + * + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + ALL = 2 + } + /** + * Indicates the font style of point annotation title. + * + * @enum {number} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + enum FontStyle { + /** + * regular + * + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + REGULAR = 0, + /** + * bold + * + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + BOLD = 1, + /** + * italic + * + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + ITALIC = 2, + /** + * bold and italic + * + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + BOLD_ITALIC = 3, + /** + * medium + * + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + MEDIUM = 4, + /** + * medium and italic + * + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + MEDIUM_ITALIC = 5 + } + /** + * Coordinate System Type + * + * @enum {number} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + enum CoordinateType { + /** + * WGS84 Coordinate + * + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + WGS84 = 0, + /** + * GCJ02 Coordinate + * + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + GCJ02 = 1 + } + /** + * My location display type. + * + * @enum {number} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + enum MyLocationDisplayType { + /** + * Continuous location. The camera does not move to the center point of the map. + * The positioning blue point moves with the device. + * + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + DEFAULT = 0, + /** + * Location only once and move the view point to the center point of the map. + * + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + LOCATE = 1, + /** + * Continuous location. The camera move to the center point of the map. The positioning blue point moves with the device. + * + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + FOLLOW = 2, + /** + * Continuous location. The camera move to the center point of the map. The positioning blue point moves with the device + * , and the location point rotates according to the device direction. + * + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + FOLLOW_ROTATE = 3 + } + /** + * The map day or night mode. + * + * @enum {number} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + enum DayNightMode { + /** + * day mode + * + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + DAY = 0, + /** + * night mode + * + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + NIGHT = 1, + /** + * Auto mode. If the dark color switch is turned on, the night mode is displayed. Otherwise, the day mode is displayed. + * + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + AUTO = 2 + } +} +export default mapCommon; diff --git a/language/arkts/extractor/sdk/hms/ets/api/@hms.core.map.navi.d.ts b/language/arkts/extractor/sdk/hms/ets/api/@hms.core.map.navi.d.ts new file mode 100755 index 00000000..63813641 --- /dev/null +++ b/language/arkts/extractor/sdk/hms/ets/api/@hms.core.map.navi.d.ts @@ -0,0 +1,1517 @@ +/* + * Copyright (c) Huawei Technologies Co., Ltd. 2023-2023. All rights reserved. + */ +/** + * @file Provide the navigation data service. + * @kit MapKit + */ +import type mapCommon from '@hms.core.map.mapCommon'; +import type common from '@ohos.app.ability.common'; +/** + * Provides a set of APIs, with which you can use the navigation data service to develop functions such as route planning. + * + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ +declare namespace navi { + /** + * Plans driving routes between two places. + * + * Restrictions: + * 1. Up to 3 routes can be returned for each request. + * 2. Up to 5 waypoints can be specified. + * + * @param { DrivingRouteParams } params - Indicates the routes attributes. + * @returns { Promise } - The routes. + * + * @throws { BusinessError } 401 - Invalid input parameter. + * @throws { BusinessError } 1002600001 - System internal error. + * @throws { BusinessError } 1002600002 - Failed to connect to the Map service. + * @throws { BusinessError } 1002600003 - App authentication failed. + * @throws { BusinessError } 1002600004 - The Map permission is not enabled. + * @throws { BusinessError } 1002600006 - The API call times exceeds the quota. + * @throws { BusinessError } 1002600007 - The API QPS exceeds the quota. + * @throws { BusinessError } 1002600008 - The API is in arrears. + * @throws { BusinessError } 1002600009 - The API have not subscribed to any pay-as-you-go package. + * @throws { BusinessError } 1002600010 - The server is busy. please wait and try again. + * @throws { BusinessError } 1002600011 - Server error. + * @throws { BusinessError } 1002600999 - Unknown error. + * @throws { BusinessError } 1002602001 - The start and end points do not have home countries, or a service error occurred. + * @throws { BusinessError } 1002602002 - Cross-region route planning is not supported. + * @throws { BusinessError } 1002602003 - Start points or end points exceed 100. + * @throws { BusinessError } 1002602004 - The linear distance between the start point and end point exceeds the upper limit. + * @throws { BusinessError } 1002602005 - The start point, end point, or waypoint does not support navigation. + * @throws { BusinessError } 1002602006 - The request point is mapped to the same point on the road. + * + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + function getDrivingRoutes(params: DrivingRouteParams): Promise; + /** + * Plans driving routes between two places. + * + * Restrictions: + * 1. Up to 3 routes can be returned for each request. + * 2. Up to 5 waypoints can be specified. + * + * @param { common.Context } context - The context of an ability. + * @param { DrivingRouteParams } params - Indicates the routes attributes. + * @returns { Promise } - The routes. + * @throws { BusinessError } 401 - Invalid input parameter. + * @throws { BusinessError } 1002600001 - System internal error. + * @throws { BusinessError } 1002600002 - Failed to connect to the Map service. + * @throws { BusinessError } 1002600003 - App authentication failed. + * @throws { BusinessError } 1002600004 - The Map permission is not enabled. + * @throws { BusinessError } 1002600006 - The API call times exceeds the quota. + * @throws { BusinessError } 1002600007 - The API QPS exceeds the quota. + * @throws { BusinessError } 1002600008 - The API is in arrears. + * @throws { BusinessError } 1002600009 - The API have not subscribed to any pay-as-you-go package. + * @throws { BusinessError } 1002600010 - The server is busy. please wait and try again. + * @throws { BusinessError } 1002600011 - Server error. + * @throws { BusinessError } 1002600999 - Unknown error. + * @throws { BusinessError } 1002602001 - The start and end points do not have home countries, or a service error occurred. + * @throws { BusinessError } 1002602002 - Cross-region route planning is not supported. + * @throws { BusinessError } 1002602003 - Start points or end points exceed 100. + * @throws { BusinessError } 1002602004 - The linear distance between the start point and end point exceeds the upper limit. + * @throws { BusinessError } 1002602005 - The start point, end point, or waypoint does not support navigation. + * @throws { BusinessError } 1002602006 - The request point is mapped to the same point on the road. + * + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + function getDrivingRoutes(context: common.Context, params: DrivingRouteParams): Promise; + /** + * Plans walking routes between two places. + * + * Restrictions: + * 1. A route can only be planned within a distance of 150 kilometers. + * + * @param { RouteParams } params - Indicates the routes attributes. + * @returns { Promise } - The routes. + * + * @throws { BusinessError } 401 - Invalid input parameter. + * @throws { BusinessError } 1002600001 - System internal error. + * @throws { BusinessError } 1002600002 - Failed to connect to the Map service. + * @throws { BusinessError } 1002600003 - App authentication failed. + * @throws { BusinessError } 1002600004 - The Map permission is not enabled. + * @throws { BusinessError } 1002600006 - The API call times exceeds the quota. + * @throws { BusinessError } 1002600007 - The API QPS exceeds the quota. + * @throws { BusinessError } 1002600008 - The API is in arrears. + * @throws { BusinessError } 1002600009 - The API have not subscribed to any pay-as-you-go package. + * @throws { BusinessError } 1002600010 - The server is busy. please wait and try again. + * @throws { BusinessError } 1002600011 - Server error. + * @throws { BusinessError } 1002600999 - Unknown error. + * @throws { BusinessError } 1002602001 - The start and end points do not have home countries, or a service error occurred. + * @throws { BusinessError } 1002602002 - Cross-region route planning is not supported. + * @throws { BusinessError } 1002602003 - Start points or end points exceed 100. + * @throws { BusinessError } 1002602004 - The linear distance between the start point and end point exceeds the upper limit. + * @throws { BusinessError } 1002602005 - The start point, end point, or waypoint does not support navigation. + * @throws { BusinessError } 1002602006 - The request point is mapped to the same point on the road. + * + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + function getWalkingRoutes(params: RouteParams): Promise; + /** + * Plans walking routes between two places. + * + * Restrictions: + * 1. A route can only be planned within a distance of 150 kilometers. + * + * @param { common.Context } context - The context of an ability. + * @param { RouteParams } params - Indicates the routes attributes. + * @returns { Promise } - The routes. + * @throws { BusinessError } 401 - Invalid input parameter. + * @throws { BusinessError } 1002600001 - System internal error. + * @throws { BusinessError } 1002600002 - Failed to connect to the Map service. + * @throws { BusinessError } 1002600003 - App authentication failed. + * @throws { BusinessError } 1002600004 - The Map permission is not enabled. + * @throws { BusinessError } 1002600006 - The API call times exceeds the quota. + * @throws { BusinessError } 1002600007 - The API QPS exceeds the quota. + * @throws { BusinessError } 1002600008 - The API is in arrears. + * @throws { BusinessError } 1002600009 - The API have not subscribed to any pay-as-you-go package. + * @throws { BusinessError } 1002600010 - The server is busy. please wait and try again. + * @throws { BusinessError } 1002600011 - Server error. + * @throws { BusinessError } 1002600999 - Unknown error. + * @throws { BusinessError } 1002602001 - The start and end points do not have home countries, or a service error occurred. + * @throws { BusinessError } 1002602002 - Cross-region route planning is not supported. + * @throws { BusinessError } 1002602003 - Start points or end points exceed 100. + * @throws { BusinessError } 1002602004 - The linear distance between the start point and end point exceeds the upper limit. + * @throws { BusinessError } 1002602005 - The start point, end point, or waypoint does not support navigation. + * @throws { BusinessError } 1002602006 - The request point is mapped to the same point on the road. + * + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + function getWalkingRoutes(context: common.Context, params: RouteParams): Promise; + /** + * Plans cycling routes between two places. + * + * Restrictions: + * 1. A route can only be planned within a distance of 500 kilometers. + * + * @param { RouteParams } params - Indicates the routes attributes. + * @returns { Promise } - The routes. + * + * @throws { BusinessError } 401 - Invalid input parameter. + * @throws { BusinessError } 1002600001 - System internal error. + * @throws { BusinessError } 1002600002 - Failed to connect to the Map service. + * @throws { BusinessError } 1002600003 - App authentication failed. + * @throws { BusinessError } 1002600004 - The Map permission is not enabled. + * @throws { BusinessError } 1002600006 - The API call times exceeds the quota. + * @throws { BusinessError } 1002600007 - The API QPS exceeds the quota. + * @throws { BusinessError } 1002600008 - The API is in arrears. + * @throws { BusinessError } 1002600009 - The API have not subscribed to any pay-as-you-go package. + * @throws { BusinessError } 1002600010 - The server is busy. please wait and try again. + * @throws { BusinessError } 1002600011 - Server error. + * @throws { BusinessError } 1002600999 - Unknown error. + * @throws { BusinessError } 1002602001 - The start and end points do not have home countries, or a service error occurred. + * @throws { BusinessError } 1002602002 - Cross-region route planning is not supported. + * @throws { BusinessError } 1002602003 - Start points or end points exceed 100. + * @throws { BusinessError } 1002602004 - The linear distance between the start point and end point exceeds the upper limit. + * @throws { BusinessError } 1002602005 - The start point, end point, or waypoint does not support navigation. + * @throws { BusinessError } 1002602006 - The request point is mapped to the same point on the road. + * + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + function getCyclingRoutes(params: RouteParams): Promise; + /** + * Plans cycling routes between two places. + * + * Restrictions: + * 1. A route can only be planned within a distance of 500 kilometers. + * + * @param { common.Context } context - The context of an ability. + * @param { RouteParams } params - Indicates the routes attributes. + * @returns { Promise } - The routes. + * @throws { BusinessError } 401 - Invalid input parameter. + * @throws { BusinessError } 1002600001 - System internal error. + * @throws { BusinessError } 1002600002 - Failed to connect to the Map service. + * @throws { BusinessError } 1002600003 - App authentication failed. + * @throws { BusinessError } 1002600004 - The Map permission is not enabled. + * @throws { BusinessError } 1002600006 - The API call times exceeds the quota. + * @throws { BusinessError } 1002600007 - The API QPS exceeds the quota. + * @throws { BusinessError } 1002600008 - The API is in arrears. + * @throws { BusinessError } 1002600009 - The API have not subscribed to any pay-as-you-go package. + * @throws { BusinessError } 1002600010 - The server is busy. please wait and try again. + * @throws { BusinessError } 1002600011 - Server error. + * @throws { BusinessError } 1002600999 - Unknown error. + * @throws { BusinessError } 1002602001 - The start and end points do not have home countries, or a service error occurred. + * @throws { BusinessError } 1002602002 - Cross-region route planning is not supported. + * @throws { BusinessError } 1002602003 - Start points or end points exceed 100. + * @throws { BusinessError } 1002602004 - The linear distance between the start point and end point exceeds the upper limit. + * @throws { BusinessError } 1002602005 - The start point, end point, or waypoint does not support navigation. + * @throws { BusinessError } 1002602006 - The request point is mapped to the same point on the road. + * + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + function getCyclingRoutes(context: common.Context, params: RouteParams): Promise; + /** + * Plans driving routes between multiple places. + * + * Scenario: + * This function is applicable to high concurrency scenarios, for example, online ride-hailing order dispatch. + * In this scenario, the function can calculate routes between multiple start points and end points, and + * find the start point and end point required for online ride-hailing order dispatch. + * + * Restrictions: + * 1. A route can only be planned within a distance of 10000 kilometers. + * 2. The number of start points multiplying the number of end points cannot exceed 100. + * + * @param { DrivingMatrixParams } params - Indicates the routes attributes. + * @returns { Promise } - The routes matrix. + * + * @throws { BusinessError } 401 - Invalid input parameter. + * @throws { BusinessError } 1002600001 - System internal error. + * @throws { BusinessError } 1002600002 - Failed to connect to the Map service. + * @throws { BusinessError } 1002600003 - App authentication failed. + * @throws { BusinessError } 1002600004 - The Map permission is not enabled. + * @throws { BusinessError } 1002600006 - The API call times exceeds the quota. + * @throws { BusinessError } 1002600007 - The API QPS exceeds the quota. + * @throws { BusinessError } 1002600008 - The API is in arrears. + * @throws { BusinessError } 1002600009 - The API have not subscribed to any pay-as-you-go package. + * @throws { BusinessError } 1002600010 - The server is busy. please wait and try again. + * @throws { BusinessError } 1002600011 - Server error. + * @throws { BusinessError } 1002600999 - Unknown error. + * @throws { BusinessError } 1002602001 - The start and end points do not have home countries, or a service error occurred. + * @throws { BusinessError } 1002602002 - Cross-region route planning is not supported. + * @throws { BusinessError } 1002602003 - Start points or end points exceed 100. + * @throws { BusinessError } 1002602004 - The linear distance between the start point and end point exceeds the upper limit. + * @throws { BusinessError } 1002602005 - The start point, end point, or waypoint does not support navigation. + * @throws { BusinessError } 1002602006 - The request point is mapped to the same point on the road. + * + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + function getDrivingMatrix(params: DrivingMatrixParams): Promise; + /** + * Plans walking routes between multiple places. + * + * Scenario: + * This function is applicable to high concurrency scenarios, for example, package delivery. + * In this scenario, the function can calculate routes between multiple start points and end points, + * and find the start points and end points required for package delivery. + * + * Restrictions: + * 1. A route can only be planned within a distance of 150 kilometers. + * 2. The number of start points multiplying the number of end points cannot exceed 100. + * + * @param { MatrixParams } params - Indicates the routes attributes. + * @returns { Promise } - The routes matrix. + * + * @throws { BusinessError } 401 - Invalid input parameter. + * @throws { BusinessError } 1002600001 - System internal error. + * @throws { BusinessError } 1002600002 - Failed to connect to the Map service. + * @throws { BusinessError } 1002600003 - App authentication failed. + * @throws { BusinessError } 1002600004 - The Map permission is not enabled. + * @throws { BusinessError } 1002600006 - The API call times exceeds the quota. + * @throws { BusinessError } 1002600007 - The API QPS exceeds the quota. + * @throws { BusinessError } 1002600008 - The API is in arrears. + * @throws { BusinessError } 1002600009 - The API have not subscribed to any pay-as-you-go package. + * @throws { BusinessError } 1002600010 - The server is busy. please wait and try again. + * @throws { BusinessError } 1002600011 - Server error. + * @throws { BusinessError } 1002600999 - Unknown error. + * @throws { BusinessError } 1002602001 - The start and end points do not have home countries, or a service error occurred. + * @throws { BusinessError } 1002602002 - Cross-region route planning is not supported. + * @throws { BusinessError } 1002602003 - Start points or end points exceed 100. + * @throws { BusinessError } 1002602004 - The linear distance between the start point and end point exceeds the upper limit. + * @throws { BusinessError } 1002602005 - The start point, end point, or waypoint does not support navigation. + * @throws { BusinessError } 1002602006 - The request point is mapped to the same point on the road. + * + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + function getWalkingMatrix(params: MatrixParams): Promise; + /** + * Plans cycling routes between multiple places. + * + * Scenario: + * This function is applicable to high concurrency scenarios, for example, package delivery. + * In this scenario, the function can calculate routes between multiple start points and end points, + * and find the start points and end points required for package delivery. + * + * Restrictions: + * 1. A route can only be planned within a distance of 500 kilometers. + * 2. The number of start points multiplying the number of end points cannot exceed 100. + * + * @param { MatrixParams } params - Indicates the routes attributes. + * @returns { Promise } - The routes matrix. + * + * @throws { BusinessError } 401 - Invalid input parameter. + * @throws { BusinessError } 1002600001 - System internal error. + * @throws { BusinessError } 1002600002 - Failed to connect to the Map service. + * @throws { BusinessError } 1002600003 - App authentication failed. + * @throws { BusinessError } 1002600004 - The Map permission is not enabled. + * @throws { BusinessError } 1002600006 - The API call times exceeds the quota. + * @throws { BusinessError } 1002600007 - The API QPS exceeds the quota. + * @throws { BusinessError } 1002600008 - The API is in arrears. + * @throws { BusinessError } 1002600009 - The API have not subscribed to any pay-as-you-go package. + * @throws { BusinessError } 1002600010 - The server is busy. please wait and try again. + * @throws { BusinessError } 1002600011 - Server error. + * @throws { BusinessError } 1002600999 - Unknown error. + * @throws { BusinessError } 1002602001 - The start and end points do not have home countries, or a service error occurred. + * @throws { BusinessError } 1002602002 - Cross-region route planning is not supported. + * @throws { BusinessError } 1002602003 - Start points or end points exceed 100. + * @throws { BusinessError } 1002602004 - The linear distance between the start point and end point exceeds the upper limit. + * @throws { BusinessError } 1002602005 - The start point, end point, or waypoint does not support navigation. + * @throws { BusinessError } 1002602006 - The request point is mapped to the same point on the road. + * + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + function getCyclingMatrix(params: MatrixParams): Promise; + /** + * Captures roads based on specified coordinate points to snap the user track to the correct roads, and + * returns a set of coordinate points on the actual roads that the vehicle was traveling along. + * + * Scenario: + * Snap coordinate points on the vehicle traveling track to the actual roads. + * + * Restrictions: + * The number of coordinate points cannot exceed 100, and the distance between two adjacent points must + * be less than 500 meters. + * + * @param { SnapToRoadsParams } params - Indicates the routes attributes. + * @returns { Promise } - The result. + * + * @throws { BusinessError } 401 - Invalid input parameter. + * @throws { BusinessError } 1002600001 - System internal error. + * @throws { BusinessError } 1002600002 - Failed to connect to the Map service. + * @throws { BusinessError } 1002600003 - App authentication failed. + * @throws { BusinessError } 1002600004 - The Map permission is not enabled. + * @throws { BusinessError } 1002600006 - The API call times exceeds the quota. + * @throws { BusinessError } 1002600007 - The API QPS exceeds the quota. + * @throws { BusinessError } 1002600008 - The API is in arrears. + * @throws { BusinessError } 1002600009 - The API have not subscribed to any pay-as-you-go package. + * @throws { BusinessError } 1002600010 - The server is busy. please wait and try again. + * @throws { BusinessError } 1002600011 - Server error. + * @throws { BusinessError } 1002600999 - Unknown error. + * @throws { BusinessError } 1002602001 - The start and end points do not have home countries, or a service error occurred. + * @throws { BusinessError } 1002602002 - Cross-region route planning is not supported. + * @throws { BusinessError } 1002602003 - Start points or end points exceed 100. + * @throws { BusinessError } 1002602004 - The linear distance between the start point and end point exceeds the upper limit. + * @throws { BusinessError } 1002602005 - The start point, end point, or waypoint does not support navigation. + * @throws { BusinessError } 1002602006 - The request point is mapped to the same point on the road. + * + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + function snapToRoads(params: SnapToRoadsParams): Promise; + /** + * The route planning attributes. + * + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + interface RouteCoordinate { + /** + * Road binding type of the start and end points. + * + * The params are 0 (default), 1, and 3. + * 0: Road binding is restricted. Do not bind closed roads, roads under construction, traffic restricted roads, + * and roads set to avoid for the departure place. Do not bind highways, ferries, and roads set to avoid for + * the destination. + * 1: Road binding is not restricted. + * 3: track binding. You can enter longitude-latitude coordinates of consecutive track points in the + * originPoints field for unlimited binding. Only the start point is supported. + * + * @type {?number} + * @default 0 + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + matchType?: number; + /** + * Latitude. + * + * @type {number} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + latitude: number; + /** + * Longitude. + * + * @type {number} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + longitude: number; + /** + * Accuracy. + * + * @type {?number} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + accuracy?: number; + /** + * Altitude. + * + * @type {?number} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + altitude?: number; + /** + * Bearing. + * + * @type {?number} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + bearing?: number; + /** + * Speed. + * + * @type {?number} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + speed?: number; + /** + * Timestamp. + * + * @type {?number} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + timestamp?: number; + } + /** + * The route planning attributes. + * + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + interface RouteParams { + /** + * A list of coordinates of start points for road binding, and the last coordinate + * is the real departure place. + * + * The number of coordinate points cannot exceed 31, and the distance + * between two adjacent points should be greater than 1 meters. + * + * @type {Array} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + origins: Array; + /** + * Destination place. + * + * @type {RouteCoordinate} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + destination: RouteCoordinate; + /** + * Language of the returned result. + * Currently, only zh_CN (Chinese) and en (English) are supported. + * + * @type {?string} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + language?: string; + /** + * Specified policy for calculating routes. The params are as follows: + * 0: Take the least time (default) + * 1: Avoid toll roads. + * 2: Avoid highways. + * 4: short distance. + * 8: Avoid ferries + * 16: Avoid congested roads. + * 32: Prioritize main roads. + * 64: Select routes intelligently. + * 128: Prioritize highways. + * 256: Take routes charging the least. + * 512: Smooth speed. + * + * Restrictions: + * The default value is 0. Currently, options 16, 32, 128, and 256 are supported only for route planning + * in the Chinese mainland. These options will be supported in other countries and regions later. + * + * @type {?Array} + * @default 0 + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + avoids?: Array; + /** + * Additional information, including: + * 0: Base (default) + * 1: New traffic condition information + * + * @type {?number} + * @default 0 + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + extension?: number; + } + /** + * Route result. + * + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + interface RouteResult { + /** + * Routes. + * + * @type {Array} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + routes: Array; + } + /** + * The walking route planning attributes. + * + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + interface DrivingRouteParams extends RouteParams { + /** + * Waypoints. You can specify up to 5 waypoints. + * + * @type {?Array} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + waypoints?: Array; + /** + * Waypoint type. The params are as follows: + * false: stopover (default) + * true: via (pass-by) + * + * @type {?boolean} + * @default false + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + isViaType?: boolean; + /** + * Indicates whether to optimize the waypoint. The params are as follows: + * false: no (default) + * true: yes + * + * @type {?boolean} + * @default false + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + optimize?: boolean; + /** + * Indicates whether to return multiple planned routes. + * false: no (default) + * true: yes + * + * @type {?boolean} + * @default false + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + alternatives?: boolean; + /** + * Estimated departure time, in seconds since 00:00:00 on January 1, 1970 (UTC). + * The value should be the current time or a future time. + * + * @type {?number} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + departAt?: number; + /** + * Time estimation mode. The params are as follows: + * 0: best guess (default) + * 1: The traffic condition is worse than the historical average. + * 2: The traffic condition is better than the historical average. + * + * @type {?number} + * @default 0 + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + trafficMode?: number; + } + /** + * Route. + * + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + interface Route { + /** + * Steps. + * + * @type {Array} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + steps: Array; + /** + * Overview polyline. + * + * @type {?Array} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + overviewPolyline?: Array; + /** + * Optimized waypoint index. + * This parameter is available only when viaType is set to false and optimize is set to true.. + * + * @type {?Array} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + optimizedWaypoints?: Array; + /** + * Route bounds. + * + * @type {?Array} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + bounds?: Array; + /** + * Number of traffic lights, 0 means no traffic lights. + * + * @type {?number} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + trafficLightCount?: number; + /** + * Indicates whether the destination is in a restricted area. + * + * @type {?boolean} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + isDestinationInRestrictedArea?: boolean; + /** + * Indicates whether the time zone of the destination is different from that of the departure place. + * + * @type {?boolean} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + isDestinationInDiffTimeZone?: boolean; + /** + * Indicates whether the route crosses a country boundary. + * + * @type {?boolean} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + isCrossCountry?: boolean; + /** + * Indicates whether the route crosses multiple country boundaries. + * + * @type {?boolean} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + isCrossMultiCountries?: boolean; + /** + * Indicates whether the route includes private or restricted roads. + * + * @type {?boolean} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + hasRestrictedRoad?: boolean; + /** + * Indicates whether the route includes rough roads. + * + * @type {?boolean} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + hasRoughRoad?: boolean; + /** + * Indicates whether the route includes ferries. + * + * @type {?boolean} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + hasFerry?: boolean; + /** + * Indicates whether the route includes toll gates. + * + * @type {?boolean} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + hasTolls?: boolean; + /** + * Indicates whether the route has stairs. + * + * @type {?boolean} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + hasStairs?: boolean; + } + /** + * Step of route. + * + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + interface RouteStep { + /** + * Road section information. + * + * @type {Array} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + roads: Array; + /** + * Coordinate of departure place. + * + * @type {mapCommon.LatLng} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + startLocation: mapCommon.LatLng; + /** + * Departure place details. + * + * @type {?string} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + startAddress?: string; + /** + * Coordinate of destination. + * + * @type {mapCommon.LatLng} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + endLocation: mapCommon.LatLng; + /** + * Destination details. + * + * @type {?string} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + endAddress?: string; + /** + * Waypoint information. + * + * @type {?Array} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + viaWaypoints?: Array; + /** + * Path distance, in meters. + * + * @type {?number} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + distance?: number; + /** + * Distance description. + * + * @type {?string} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + distanceDescription?: string; + /** + * Journey time, in seconds. + * + * @type {?number} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + duration?: number; + /** + * Journey time description. + * + * @type {?string} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + durationDescription?: string; + /** + * Journey time calculated based on the real-time traffic condition, in seconds. + * + * @type {?number} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + durationInTraffic?: number; + /** + * Description of the journey time calculated based on the real-time traffic condition. + * + * @type {?string} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + durationInTrafficDescription?: string; + } + /** + * Road of a RouteStep. + * + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + interface RouteRoad { + /** + * Coordinate of departure place. + * + * @type {mapCommon.LatLng} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + startLocation: mapCommon.LatLng; + /** + * Coordinate of destination. + * + * @type {mapCommon.LatLng} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + endLocation: mapCommon.LatLng; + /** + * A series of coordinate points on a road section (including coordinates of the departure place and destination). + * + * @type {Array} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + polyline: Array; + /** + * Path distance, in meters. + * + * @type {number} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + distance: number; + /** + * Distance description. + * + * @type {?string} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + distanceDescription?: string; + /** + * Journey time, in seconds. + * + * @type {number} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + duration: number; + /** + * Journey time description. + * + * @type {?string} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + durationDescription?: string; + /** + * Road name. + * + * @type {?string} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + roadName?: string; + /** + * Operation to be performed in the current step. The params are as follows: + * - TURN_SLIGHT_LEFT + * - TURN_SHARP_LEFT + * - UTURN_LEFT + * - TURN_LEFT + * - TURN_SLIGHT_RIGHT + * - TURN_SHARP_RIGHT + * - UTURN_RIGHT + * - TURN_RIGHT + * - STRAIGHT + * - RAMP_LEFT + * - RAMP_RIGHT + * - MERGE + * - FORK_LEFT + * - FORK_RIGHT + * - FERRY (not supported currently) + * - FERRY_TRAIN (not supported currently) + * - ROUNDABOUT_LEFT + * - ROUNDABOUT_RIGHT + * - END + * + * @type {?string} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + action?: string; + /** + * Road direction. The params are as follows: + * 0: bidirectional + * 1: forward direction + * 2: reverse direction + * + * @type {?number} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + orientation?: number; + /** + * Text instruction. + * + * @type {?string} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + instruction?: string; + /** + * Traffic information. + * + * @type {?Array} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + trafficSegments?: Array; + } + /** + * Coordinate bounds. + * + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + interface CoordinateBound { + /** + * Northeast. + * + * @type {mapCommon.LatLng} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + northeast: mapCommon.LatLng; + /** + * Southwest. + * + * @type {mapCommon.LatLng} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + southwest: mapCommon.LatLng; + } + /** + * Waypoint. + * + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + interface Waypoint { + /** + * Longitude and latitude of the waypoint. + * + * @type {mapCommon.LatLng} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + location: mapCommon.LatLng; + /** + * Waypoint index in the step array. + * + * @type {number} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + stepIndex: number; + } + /** + * Traffic information. + * + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + interface TrafficSegment { + /** + * Distance, in meters. + * + * @type {number} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + distance: number; + /** + * Traffic status. The params are as follows:0: unknown + * 1: smooth + * 2: slow + * 3: congested + * 4: extremely congested + * + * @type {number} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + status: number; + /** + * A series of coordinate points on a road section. + * + * @type {Array} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + polyline: Array; + } + /** + * Matrix params. + * + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + interface MatrixParams { + /** + * Longitudes and latitudes of the start points. A maximum of 100 start points are allowed. + * + * @type {Array} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + origins: Array; + /** + * Longitudes and latitudes of the end points. A maximum of 100 end points are allowed. + * + * NOTE: + * 1.The number of start points multiplying the number of end points cannot exceed 100. + * 2.The linear distance between the start point and end point cannot exceed 150 km. + * + * @type {Array} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + destinations: Array; + /** + * Language of the returned result. + * Currently, only zh_CN (Chinese) and en (English) are supported. + * + * @type {?string} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + language?: string; + /** + * Specified policy for calculating routes. The params are as follows: + * 0: Take the least time (default). + * 1: Avoid toll roads. + * 2: Avoid highways. + * 4: short distance. + * 8: Avoid ferries. + * 16: Avoid congested roads. + * 32: Prioritize main roads. + * 64: Select routes intelligently. + * 128: Prioritize highways. + * 256: Take routes charging the least. + * + * Restrictions: + * 1. Walking & cycling only supports two policies: 0 and 8. + * 2. Driving supports all policies, but params 16, 32, 128, and 256 are supported only + * for route planning in the Chinese mainland. These params will be supported in other + * countries and regions later. + * + * @type {?Array} + * @default 0 + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + avoids?: Array; + } + /** + * Matrix result. + * + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + interface MatrixResult { + /** + * Start point details. + * + * @type {Array} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + originAddresses: Array; + /** + * End point details. + * + * @type {Array} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + destinationAddresses: Array; + /** + * Distances and journey time of routes between start points and end points. + * + * @type {Array} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + rows: Array; + } + /** + * Driving matrix params. + * + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + interface DrivingMatrixParams extends MatrixParams { + /** + * Estimated departure time, in seconds since 00:00:00 on January 1, 1970 (UTC). + * The value should be the current time or a future time. + * + * @type {?number} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + departAt?: number; + /** + * Time estimation mode. The params are as follows: + * 0: best guess (default) + * 1: The traffic condition is worse than the historical average. + * 2: The traffic condition is better than the historical average. + * + * @type {?number} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + trafficMode?: number; + } + /** + * Row of a matrix. + * + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + interface MatrixRow { + /** + * Cells. + * + * @type {Array} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + cells: Array; + } + /** + * Cell of a matrix. + * + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + interface MatrixCell { + /** + * Distance in meters. + * + * @type {?number} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + distance?: number; + /** + * Distance description. + * + * @type {?string} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + distanceDescription?: string; + /** + * Journey time, in seconds. + * + * @type {?number} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + duration?: number; + /** + * Journey time description. + * + * @type {?string} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + durationDescription?: string; + } + /** + * The snap to roads attributes. + * + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + interface SnapToRoadsParams { + /** + * Coordinate points on the road. The number of coordinate points cannot exceed 100, + * and the distance between two adjacent points cannot exceed 500 meters. + * + * @type {Array} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + points: Array; + } + /** + * The snap to roads result. + * + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + interface SnapToRoadsResult { + /** + * Time required, in milliseconds. + * + * @type {number} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + responseTime: number; + /** + * Coordinate points on the road. The number of coordinate points cannot exceed 100, + * and the distance between two adjacent points cannot exceed 500 meters. + * + * @type {Array} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + snappedPoints: Array; + } + /** + * Snapped point. + * + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + interface SnappedPoint { + /** + * Latitude. + * + * @type {number} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + latitude: number; + /** + * Longitude. + * + * @type {number} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + longitude: number; + /** + * ID of a road. + * + * @type {string} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + roadId: string; + } +} +export default navi; diff --git a/language/arkts/extractor/sdk/hms/ets/api/@hms.core.map.sceneMap.d.ts b/language/arkts/extractor/sdk/hms/ets/api/@hms.core.map.sceneMap.d.ts new file mode 100755 index 00000000..4f2f9243 --- /dev/null +++ b/language/arkts/extractor/sdk/hms/ets/api/@hms.core.map.sceneMap.d.ts @@ -0,0 +1,433 @@ +/* + * Copyright (c) Huawei Technologies Co., Ltd. 2023-2023. All rights reserved. + */ +/** + * @file Provide the scenario-based map ui page. + * @kit MapKit + */ +import type common from '@ohos.app.ability.common'; +import type mapCommon from '@hms.core.map.mapCommon'; +import type site from '@hms.core.map.site'; +import type image from '@ohos.multimedia.image'; +/** + * Provides scenario-based map ui page. + * + * @namespace sceneMap + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ +declare namespace sceneMap { + /** + * Bring up the map location detail page. + * + * @param {LocationQueryOptions} options - Indicates the options for bring up the map location detail page. + * @param {UIAbilityContext} context - The context of an ability. + * @returns {Promise} + * @throws { BusinessError } 401 - Invalid input parameter. + * @throws { BusinessError } 1002600001 - System internal error. + * @throws { BusinessError } 1002600002 - Failed to connect to the Map service. + * @throws { BusinessError } 1002600003 - App authentication failed. + * @throws { BusinessError } 1002600004 - The Map permission is not enabled. + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + function queryLocation(context: common.UIAbilityContext, options: LocationQueryOptions): Promise; + /** + * Bring up the map choose location page. User can query locations and choose any one. + * + * @param {LocationChoosingOptions} options - Indicates the options for bring up the map choose location page. + * @param {UIAbilityContext} context - The context of an ability. + * @returns {Promise} Return the choose location result. + * @throws { BusinessError } 401 - Invalid input parameter. + * @throws { BusinessError } 1002600001 - System internal error. + * @throws { BusinessError } 1002600002 - Failed to connect to the Map service. + * @throws { BusinessError } 1002600003 - App authentication failed. + * @throws { BusinessError } 1002600004 - The Map permission is not enabled. + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + function chooseLocation(context: common.UIAbilityContext, options: LocationChoosingOptions): Promise; + /** + * Bring up the administrative division selection page. + * Note: This function must be called in the ArkUI page context. + * @param {common.Context} context - The context of an ability. + * @param {DistrictSelectOptions} options - Indicates the options for bring up the administrative division selection page. + * @returns {Promise} Return the administrative division selection result. + * @throws { BusinessError } 401 - Invalid input parameter. + * @throws { BusinessError } 1002600001 - System internal error. + * @throws { BusinessError } 1002600002 - Failed to connect to the Map service. + * @throws { BusinessError } 1002600003 - App authentication failed. + * @throws { BusinessError } 1002600004 - The Map permission is not enabled. + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + function selectDistrict(context: common.Context, options: DistrictSelectOptions): Promise; + /** + * Provides the options for bring up the map location detail page. + * + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + interface LocationQueryOptions { + /** + * The siteId id for querying location detail, if no siteId, use the location to query location detail. + * + * @type { ?string } + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + siteId?: string; + /** + * Set the page language.Currently, only zh-CN and en are available.If not set, will use the system default language. + * Abnormal values are handled according to the system default values. + * + * @type { ?string } + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + language?: string; + /** + * If no siteId, use the location to query location detail. + * + * @type { ?mapCommon.LatLng } + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + location?: mapCommon.LatLng; + /** + * If no siteId, use name as location name. + * + * @type { ?string } + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + name?: string; + /** + * If no siteId, use address as location address. + * + * @type { ?string } + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + address?: string; + /** + * Indicates whether to display commercial information. If the value is false, the taxi function cannot be displayed. + * + * @type { ?boolean } + * @default true + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + showBusiness?: boolean; + } + /** + * Provides the options for bring up the map choose location page. + * + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + interface LocationChoosingOptions { + /** + * The location for query address.If no location, use the current location as the location.If no current location, use the default location. + * + * @type { ?mapCommon.LatLng } + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + location?: mapCommon.LatLng; + /** + * Set the page language.Currently, only zh-CN and en are available.If not set, will use the system default language. + * Abnormal values are handled according to the system default values. + * + * @type { ?string } + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + language?: string; + /** + * Display the POIs of ths specified POI types. + * + * @type { ?Array } + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + poiTypes?: Array; + /** + * Set whether to display the search controls. + * Abnormal values are handled according to the default values. + * + * @type { ?boolean } + * @default false + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + searchEnabled?: boolean; + /** + * Indicates whether to display nearby poi. + * Abnormal values are handled according to the default values. + * + * @type { ?boolean } + * @default false + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + showNearbyPoi?: boolean; + /** + * Indicates whether to return map snapshot. + * + * @type { ?boolean } + * @default false + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + snapshotEnabled?: boolean; + } + /** + * Provides the result of the map choose location page. + * + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + interface LocationChoosingResult { + /** + * The chosen site id. If select a location instead of a poi, this value cannot be returned. + * + * @type { ?string } + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + siteId?: string; + /** + * The chosen location. + * + * @type { mapCommon.LatLng } + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + location: mapCommon.LatLng; + /** + * The chosen location name.If select a location instead of a poi, this value cannot be returned. + * + * @type { ?string } + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + name?: string; + /** + * The chosen location address. + * + * @type { string } + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + address: string; + /** + * The site's address component. + * + * @type { ?site.AddressComponent } + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + addressComponent?: site.AddressComponent; + /** + * The current map zoom. + * + * @type { number } + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + zoom: number; + /** + * The map snapshot. + * + * @type { ?image.PixelMap } + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + snapshot?: image.PixelMap; + } + /** + * Provide input options for the administrative division selection request. + * + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + interface DistrictSelectOptions { + /** + * Querying administrative division of a specified country. + * The country code must comply with the ISO 3166-1 alpha-2 rule. + * + * @type { ?string } + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + countryCode?: string; + /** + * Set the page language. + * + * @type { ?string } + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + language?: string; + } + /** + * Provide the result for the administrative division selection request. + * + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + interface DistrictSelectResult { + /** + * Returns the level information of the selected administrative division. + * + * @type { Array } + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + districts: Array; + } + /** + * Provide the administrative division info. + * + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + interface District { + /** + * siteId. + * + * @type {?string} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + siteId?: string; + /** + * name. + * + * @type {?string} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + name?: string; + /** + * location. + * + * @type {?mapCommon.LatLng} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + location?: mapCommon.LatLng; + /** + * adminLevel. + * + * @type {?string} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + adminLevel?: string; + /** + * adminCode, supported only in China. + * + * @type {?string} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + adminCode?: string; + /** + * cityCode, supported only in China. + * + * @type {?string} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + cityCode?: string; + /** + * country code. + * + * @type {?string} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + countryCode?: string; + } +} +export default sceneMap; diff --git a/language/arkts/extractor/sdk/hms/ets/api/@hms.core.map.site.d.ts b/language/arkts/extractor/sdk/hms/ets/api/@hms.core.map.site.d.ts new file mode 100755 index 00000000..16c79514 --- /dev/null +++ b/language/arkts/extractor/sdk/hms/ets/api/@hms.core.map.site.d.ts @@ -0,0 +1,1845 @@ +/* + * Copyright (c) Huawei Technologies Co., Ltd. 2023-2023. All rights reserved. + */ +/** + * @file Provide keyword search, nearby search, automatic completion, details query, geocoding. + * @kit MapKit + */ +import type mapCommon from '@hms.core.map.mapCommon'; +import type common from '@ohos.app.ability.common'; +/** + * This module provides interfaces for keyword search, nearby search, automatic completion, + * details query, geocoding. + * + * @namespace site + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ +declare namespace site { + /** + * Provides interfaces for keyword search. + * + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + interface SearchByTextParams { + /** + * Provide search query text. + * The string length range is [1, 512] + * + * @type {string} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + query: string; + /** + * Provide the location of the map. + * + * @type { ?mapCommon.LatLng } + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + location?: mapCommon.LatLng; + /** + * Provide the location radius. + * The value range is [1, 50000] + * + * @type { ?number } + * @default 50000 + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + radius?: number; + /** + * Provide the search language. + * + * @type { ?string } + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + language?: string; + /** + * Provide the search Poi Type. + * Returns the location of the specified Huawei classification system. For the value range, see PoiType. + * + * @type { ?Array } + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + poiTypes?: Array; + /** + * Provide the search country code. + * The country code must comply with the ISO 3166-1 alpha-2 rule + * + * @type { ?Array } + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + countryCodes?: Array; + /** + * Provide the search cityId. + * For cities in Chinese Mainland and Hong Kong and Macao, cityCode or adminCode of three to four digits can be transferred. + * For details, see the city code and area code table. The value of cityId can contain 16 to 18 digits. + * + * @type { ?string } + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + cityId?: string; + /** + * Indicates whether the search result is restricted to a specified city. + * This parameter must be used together with the cityId parameter. + * + * @type { ?boolean } + * @default false + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + isCityLimit?: boolean; + /** + * Provide result whether contain child nodes. + * + * @type { ?boolean } + * @default false + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + isChildren?: boolean; + /** + * Provide return result page index. + * The value range is [1, 500] + * + * @type { ?number } + * @default 1 + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + pageIndex?: number; + /** + * Provide return result page size. + * The value range is [1, 20] + * Constraint: pageIndex x pageSize <= 500 + * + * @type { ?number } + * @default 20 + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + pageSize?: number; + } + /** + * Provides interfaces for nearby search. + * + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + interface NearbySearchParams { + /** + * Provide search query text. + * The string length range is [1, 512] + * + * @type {?string} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + query?: string; + /** + * Provide the location of the map. + * + * @type { mapCommon.LatLng } + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + location: mapCommon.LatLng; + /** + * Provide the location radius. + * The value range is [1, 50000] + * + * @type { ?number } + * @default 1000 + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + radius?: number; + /** + * Provide the search language. + * + * @type { ?string } + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + language?: string; + /** + * Provide the search Poi Type. + * Returns the location of the specified Huawei classification system. For the value range, see PoiType. + * + * @type { ?Array } + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + poiTypes?: Array; + /** + * Provide return result page index. + * The value range is [1, 500] + * + * @type { ?number } + * @default 1 + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + pageIndex?: number; + /** + * Provide return result page size. + * The value range is [1, 20] + * Constraint: pageIndex x pageSize <= 500 + * + * @type { ?number } + * @default 20 + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + pageSize?: number; + /** + * Sort rule. + * + * @type { ?SortRule } + * @default SortRule.COMPOSITE + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + sortRule?: SortRule; + } + /** + * Provides interfaces for auto-Complete Search. + * + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + interface QueryAutoCompleteParams { + /** + * Provide search query text. + * The string length range is [1, 512] + * + * @type {string} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + query: string; + /** + * Provide the location of the map. + * + * @type { ?mapCommon.LatLng } + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + location?: mapCommon.LatLng; + /** + * Provide the location radius. + * The value range is [1, 50000] + * + * @type { ?number } + * @default 50000 + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + radius?: number; + /** + * Provide the search language. + * + * @type { ?string } + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + language?: string; + /** + * Provide the search Poi Types. + * Returns the location of the specified Huawei classification system. For the value range, see PoiType. + * + * @type { ?Array } + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + poiTypes?: Array; + /** + * Provide the search cityId. + * For cities in Chinese Mainland and Hong Kong and Macao, cityCode or adminCode of three to four digits can be transferred. + * For details, see the city code and area code table. The value of cityId can contain 16 to 18 digits. + * + * @type { ?string } + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + cityId?: string; + /** + * Indicates whether the search result is restricted to a specified city. + * This parameter must be used together with the cityId parameter. + * + * @type { ?boolean } + * @default false + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + isCityLimit?: boolean; + /** + * Provide result whether contain child nodes. + * + * @type { ?boolean } + * @default false + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + isChildren?: boolean; + } + /** + * Provides interfaces for address Details Search. + * + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + interface SearchByIdParams { + /** + * Provide the siteId. + * The string length range is [1, 256] + * + * @type { string } + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + siteId: string; + /** + * Provide the search language. + * + * @type { ?string } + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + language?: string; + /** + * Provide result whether contain child nodes. + * + * @type { ?boolean } + * @default false + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + isChildren?: boolean; + } + /** + * Provides interfaces for positive geographic search. + * + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + interface GeocodeParams { + /** + * Provide the address. + * The string length range is [1, 512] + * + * @type { string } + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + query: string; + /** + * Provide the search language. + * + * @type { ?string } + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + language?: string; + /** + * bounds. + * Rectangular longitude and latitude box to which search results are biased + * + * @type {?mapCommon.LatLngBounds} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + bounds?: mapCommon.LatLngBounds; + } + /** + * Provides interfaces for inverse geographic search. + * + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + interface ReverseGeocodeParams { + /** + * Provide the location of the map. + * + * @type { mapCommon.LatLng } + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + location: mapCommon.LatLng; + /** + * Provide the search radius. + * The value range is [0, 1000] + * + * @type { ?number } + * @default 1000 + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + radius?: number; + /** + * Provide the search language. + * + * @type { ?string } + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + language?: string; + /** + * Provide the search extension. + * Indicates whether to extend the return of POI, AOI, and ROAD information. + * + * @type { ?boolean } + * @default false + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + isExtension?: boolean; + /** + * Provide the search poiType. + * Returns the location of the specified Huawei classification system. For the value range, see PoiType. + * maximum of five types can be entered. + * + * @type { ?Array } + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + poiTypes?: Array; + } + /** + * Provides interfaces for keyword search Result. + * + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + interface SearchByTextResult { + /** + * result number. + * If the query is successful, the total number of records that meet the search criteria is returned. + * The total number of records may be greater than 500. + * + * @type {number} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + totalCount: number; + /** + * sites. + * + * @type {?Array} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + sites?: Array; + } + /** + * Provides interfaces for nearby search Response Result. + * + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + interface NearbySearchResult { + /** + * result number. + * If the query is successful, the total number of records that meet the search criteria is returned. + * The total number of records may be greater than 500. + * + * @type {number} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + totalCount: number; + /** + * sites. + * + * @type {?Array} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + sites?: Array; + } + /** + * Provides interfaces for auto-Complete Search Result. + * + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + interface QueryAutoCompleteResult { + /** + * sites. + * + * @type {?Array} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + sites?: Array; + } + /** + * Provides interfaces for address Details Search Result. + * + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + interface SearchByIdResult { + /** + * site. + * + * @type {?Site} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + site?: Site; + } + /** + * Provides interfaces for positive geographic search. + * + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + interface GeocodeResult { + /** + * sites. + * + * @type {?Array} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + sites?: Array; + } + /** + * Provides interfaces for inverse geographic search Result. + * + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + interface ReverseGeocodeResult { + /** + * addressComponent. + * + * @type {AddressComponent} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + addressComponent: AddressComponent; + /** + * addressDescription. + * + * @type {string} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + addressDescription: string; + /** + * aois. + * + * @type {?Array} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + aois?: Array; + /** + * pois. + * + * @type {?Array} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + pois?: Array; + /** + * roads. + * + * @type {?Array} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + roads?: Array; + /** + * intersections. + * + * @type {?Array} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + intersections?: Array; + } + /** + * The Site. + * + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + interface Site { + /** + * siteId. + * + * @type {string} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + siteId: string; + /** + * name. + * + * @type {?string} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + name?: string; + /** + * formatAddress. + * + * @type {?string} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + formatAddress?: string; + /** + * addressComponent. + * + * @type {AddressComponent} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + addressComponent: AddressComponent; + /** + * location. + * + * @type {?mapCommon.LatLng} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + location?: mapCommon.LatLng; + /** + * viewport. + * + * @type {?mapCommon.LatLngBounds} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + viewport?: mapCommon.LatLngBounds; + /** + * result distance. + * + * @type {?number} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + distance?: number; + /** + * utcOffset. + * + * @type {?number} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + utcOffset?: number; + /** + * poi. + * + * @type {?Poi} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + poi?: Poi; + } + /** + * The AddressComponent. + * + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + interface AddressComponent { + /** + * countryName. + * + * @type {string} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + countryName?: string; + /** + * country. + * + * @type {?string} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + countryCode?: string; + /** + * adminLevel1. + * + * @type {?string} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + adminLevel1?: string; + /** + * adminLevel2. + * + * @type {?string} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + adminLevel2?: string; + /** + * adminLevel3. + * + * @type {?string} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + adminLevel3?: string; + /** + * adminLevel4. + * + * @type {?string} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + adminLevel4?: string; + /** + * adminLevel5. + * + * @type {?string} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + adminLevel5?: string; + /** + * locality. + * + * @type {?string} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + locality?: string; + /** + * subLocality1. + * + * @type {?string} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + subLocality1?: string; + /** + * subLocality2. + * + * @type {?string} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + subLocality2?: string; + /** + * neighborhood. + * + * @type {?Array} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + neighborhoods?: Array; + /** + * adminCode. + * + * @type {?string} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + adminCode?: string; + /** + * postalCode. + * + * @type {?string} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + postalCode?: string; + /** + * city. + * + * @type {?City} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + city?: City; + /** + * streetNumber. + * + * @type {?StreetNumber} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + streetNumber?: StreetNumber; + } + /** + * The City. + * + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + interface City { + /** + * cityCode. + * + * @type {string} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + cityCode?: string; + /** + * cityId. + * + * @type {string} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + cityId?: string; + /** + * cityLevel. + * + * @type {?string} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + cityName?: string; + } + /** + * The StreetNumber. + * + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + interface StreetNumber { + /** + * direction. + * + * @type {string} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + direction?: string; + /** + * distance. + * + * @type {number} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + distance?: number; + /** + * location. + * + * @type {?mapCommon.LatLng} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + location?: mapCommon.LatLng; + /** + * streetNumber. + * + * @type {string} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + streetNumber?: string; + /** + * streetName. + * + * @type {string} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + streetName?: string; + /** + * formatAddress. + * + * @type {string} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + formatAddress?: string; + } + /** + * The Poi. + * + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + interface Poi { + /** + * poiTypes. + * + * @type {?Array} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + poiTypes?: Array; + /** + * poiTypeIds. + * + * @type {?Array} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + poiTypeIds?: Array; + /** + * phone. + * + * @type {?string} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + phone?: string; + /** + * internationalPhone. + * + * @type {?string} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + internationalPhone?: string; + /** + * rating. + * + * @type {?number} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + rating?: number; + /** + * websiteUrl. + * + * @type {?string} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + websiteUrl?: string; + /** + * openingHours. + * + * @type {?OpeningHours} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + openingHours?: OpeningHours; + /** + * businessStatus. + * + * @type {?string} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + businessStatus?: string; + /** + * brand. + * + * @type {?string} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + brand?: string; + /** + * email. + * + * @type {?string} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + email?: string; + /** + * starRating. + * + * @type {?string} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + starRating?: number; + /** + * child nodes. + * + * @type {?Array} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + childNodes?: Array; + /** + * icon. + * + * @type {?string} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + icon?: string; + /** + * description. + * + * @type {?string} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + description?: string; + /** + * abstractText. + * + * @type {?string} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + abstractText?: string; + /** + * comment. + * + * @type {?Comment} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + comment?: Comment; + } + /** + * The OpeningHours. + * + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + interface OpeningHours { + /** + * texts. + * + * @type {Array} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + texts?: Array; + /** + * periods. + * + * @type {?Array} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + periods?: Array; + } + /** + * The Period. + * + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + interface Period { + /** + * open. + * + * @type {?TimeOfWeek} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + open?: TimeOfWeek; + /** + * close. + * + * @type {?TimeOfWeek} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + close?: TimeOfWeek; + } + /** + * The TimeOfWeek. + * + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + interface TimeOfWeek { + /** + * week. + * + * @type {?number} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + week?: number; + /** + * time. + * + * @type {?string} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + time?: string; + } + /** + * Child Node. + * + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + interface ChildNode { + /** + * siteId. + * + * @type {?string} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + siteId?: string; + /** + * name. + * + * @type {?string} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + name?: string; + /** + * formatAddress. + * + * @type {?string} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + formatAddress?: string; + /** + * location. + * + * @type {?mapCommon.LatLng} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + location?: mapCommon.LatLng; + /** + * poiTypes. + * + * @type {?Array} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + poiTypes?: Array; + } + /** + * The Comment. + * + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + interface Comment { + /** + * averageRating. + * + * @type {?number} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + averageRating?: number; + /** + * total. + * + * @type {?number} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + total?: number; + } + /** + * The Aoi. + * + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + interface Aoi { + /** + * area. + * + * @type {?number} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + area?: number; + /** + * distance. + * + * @type {?number} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + distance?: number; + /** + * siteId. + * + * @type {?number} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + siteId?: string; + /** + * Provide the location of the map. + * + * @type { ?mapCommon.LatLng } + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + location?: mapCommon.LatLng; + /** + * name. + * + * @type {?string} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + name?: string; + /** + * poiType. + * + * @type {?string} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + poiType?: string; + } + /** + * The ReverseGeocodePoi. + * + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + interface ReverseGeocodePoi { + /** + * address. + * + * @type {?string} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + address?: string; + /** + * direction. + * + * @type {?string} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + direction?: string; + /** + * distance. + * + * @type {?number} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + distance?: number; + /** + * siteId. + * + * @type {?string} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + siteId?: string; + /** + * Provide the location of the map. + * + * @type { ?mapCommon.LatLng } + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + location?: mapCommon.LatLng; + /** + * name. + * + * @type {?string} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + name?: string; + /** + * poiType. + * + * @type {?string} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + poiType?: string; + } + /** + * The Road. + * + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + interface Road { + /** + * direction. + * + * @type {?string} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + direction?: string; + /** + * distance. + * + * @type {?number} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + distance?: number; + /** + * siteId. + * + * @type {?string} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + siteId?: string; + /** + * Provide the location of the map. + * + * @type { ?mapCommon.LatLng } + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + location?: mapCommon.LatLng; + /** + * name. + * + * @type {?string} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + name?: string; + } + /** + * The Intersection. + * + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + interface Intersection { + /** + * direction. + * + * @type {?string} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + direction?: string; + /** + * distance. + * + * @type {?number} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + distance?: number; + /** + * siteId. + * + * @type {?string} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + siteId?: string; + /** + * Provide the location of the map. + * + * @type { ?mapCommon.LatLng } + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + location?: mapCommon.LatLng; + /** + * name. + * + * @type {?string} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + name?: string; + } + /** + * Keyword query interface. + * Abnormal values are processed as no response. + * + * @param { SearchByTextParams } searchByTextParams. + * @returns { SearchByTextResult } Return SearchByTextResult object. + * @throws { BusinessError } 401 - Invalid input parameter. + * @throws { BusinessError } 1002600001 - System internal error. + * @throws { BusinessError } 1002600002 - Failed to connect to the Map service. + * @throws { BusinessError } 1002600003 - App authentication failed. + * @throws { BusinessError } 1002600004 - The Map permission is not enabled. + * @throws { BusinessError } 1002603001 - Zero result. + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + function searchByText(searchByTextParams: SearchByTextParams): Promise; + /** + * Keyword query interface. + * + * @param { common.Context } context - The context of an ability. + * @param { SearchByTextParams } searchByTextParams - searchByTextParams. + * @returns { SearchByTextResult } Return SearchByTextResult object. + * @throws { BusinessError } 401 - Invalid input parameter. + * @throws { BusinessError } 1002600001 - System internal error. + * @throws { BusinessError } 1002600002 - Failed to connect to the Map service. + * @throws { BusinessError } 1002600003 - App authentication failed. + * @throws { BusinessError } 1002600004 - The Map permission is not enabled. + * @throws { BusinessError } 1002603001 - Zero result. + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + function searchByText(context: common.Context, searchByTextParams: SearchByTextParams): Promise; + /** + * Peripheral search interface. + * Abnormal values are processed as no response. + * + * @param { NearbySearchParams } nearbySearchParams. + * @returns { NearbySearchResult } Return NearbySearchResult object. + * @throws { BusinessError } 401 - Invalid input parameter. + * @throws { BusinessError } 1002600001 - System internal error. + * @throws { BusinessError } 1002600002 - Failed to connect to the Map service. + * @throws { BusinessError } 1002600003 - App authentication failed. + * @throws { BusinessError } 1002600004 - The Map permission is not enabled. + * @throws { BusinessError } 1002603001 - Zero result. + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + function nearbySearch(nearbySearchParams: NearbySearchParams): Promise; + /** + * Auto-Complete Interface. + * Abnormal values are processed as no response. + * + * @param { QueryAutoCompleteParams } queryAutoCompleteParams + * @returns { QueryAutoCompleteResult } Return QueryAutoCompleteResult object. + * @throws { BusinessError } 401 - Invalid input parameter. + * @throws { BusinessError } 1002600001 - System internal error. + * @throws { BusinessError } 1002600002 - Failed to connect to the Map service. + * @throws { BusinessError } 1002600003 - App authentication failed. + * @throws { BusinessError } 1002600004 - The Map permission is not enabled. + * @throws { BusinessError } 1002603001 - Zero result. + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + function queryAutoComplete(queryAutoCompleteParams: QueryAutoCompleteParams): Promise; + /** + * Address details interface. + * Abnormal values are processed as no response. + * + * @param { SearchByIdParams } searchByIdParams + * @returns { SearchByIdResult } Return SearchByIdResult object. + * @throws { BusinessError } 401 - Invalid input parameter. + * @throws { BusinessError } 1002600001 - System internal error. + * @throws { BusinessError } 1002600002 - Failed to connect to the Map service. + * @throws { BusinessError } 1002600003 - App authentication failed. + * @throws { BusinessError } 1002600004 - The Map permission is not enabled. + * @throws { BusinessError } 1002603001 - Zero result. + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + function searchById(searchByIdParams: SearchByIdParams): Promise; + /** + * geocoding interface. + * Abnormal values are processed as no response. + * + * @param { GeocodeParams } geocodeParams. + * @returns { GeocodeResult } Return GeocodeResult Object. + * @throws { BusinessError } 401 - Invalid input parameter. + * @throws { BusinessError } 1002600001 - System internal error. + * @throws { BusinessError } 1002600002 - Failed to connect to the Map service. + * @throws { BusinessError } 1002600003 - App authentication failed. + * @throws { BusinessError } 1002600004 - The Map permission is not enabled. + * @throws { BusinessError } 1002603001 - Zero result. + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + function geocode(geocodeParams: GeocodeParams): Promise; + /** + * inverse geocoding interface + * Abnormal values are processed as no response. + * + * @param { ReverseGeocodeParams } reverseGeocodeParams + * @returns { ReverseGeocodeResult } Return ReverseGeocodeResult object. + * @throws { BusinessError } 401 - Invalid input parameter. + * @throws { BusinessError } 1002600001 - System internal error. + * @throws { BusinessError } 1002600002 - Failed to connect to the Map service. + * @throws { BusinessError } 1002600003 - App authentication failed. + * @throws { BusinessError } 1002600004 - The Map permission is not enabled. + * @throws { BusinessError } 1002603001 - Zero result. + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + function reverseGeocode(reverseGeocodeParams: ReverseGeocodeParams): Promise; + /** + * Rule of result sort. + * + * @enum {number} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + enum SortRule { + /** + * Composite sort. + * + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + COMPOSITE = 0, + /** + * Sort by distance. + * + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + DISTANCE = 1 + } +} +export default site; diff --git a/language/arkts/extractor/sdk/hms/ets/api/@hms.core.map.staticMap.d.ts b/language/arkts/extractor/sdk/hms/ets/api/@hms.core.map.staticMap.d.ts new file mode 100755 index 00000000..cc7357aa --- /dev/null +++ b/language/arkts/extractor/sdk/hms/ets/api/@hms.core.map.staticMap.d.ts @@ -0,0 +1,311 @@ +/* + * Copyright (c) Huawei Technologies Co., Ltd. 2023-2023. All rights reserved. + */ +/** + * @file Provide map static image. + * @kit MapKit + */ +import type image from '@ohos.multimedia.image'; +import type mapCommon from '@hms.core.map.mapCommon'; +/** + * Returns a map image that enables developer to embed the map as a picture in their own pages. + * + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ +declare namespace staticMap { + /** + * Make a map image based on the provided location, image height, and image width. + * + * @param { StaticMapOptions } options - Indicates the map image attributes. + * @returns { Promise } - The map image + * @throws { BusinessError } 401 - Invalid input parameter. + * @throws { BusinessError } 1002600001 - System internal error. + * @throws { BusinessError } 1002600002 - Failed to connect to the Map service. + * @throws { BusinessError } 1002600003 - App authentication failed. + * @throws { BusinessError } 1002600004 - The Map permission is not enabled. + * @throws { BusinessError } 1002600005 - The network is unavailable. + * @throws { BusinessError } 1002600006 - The API call times exceeds the quota. + * @throws { BusinessError } 1002600007 - The API QPS exceeds the quota. + * @throws { BusinessError } 1002600008 - The API is in arrears. + * @throws { BusinessError } 1002600009 - The API have not subscribed to any pay-as-you-go package. + * @throws { BusinessError } 1002600010 -The server is busy. please wait and try again. + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + function getMapImage(options: StaticMapOptions): Promise; + /** + * The map image attributes + * + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + interface StaticMapOptions { + /** + * The center point coordinates of the map + * + * @type {LatLng} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + location: mapCommon.LatLng; + /** + * The zoom level of the map + * + * @type {number} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + zoom: number; + /** + * The width of the image.If scale is 1, value range is (0,1024], and if scale is 2, value range is (0,512]. + * + * @type {number} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + imageWidth: number; + /** + * The height of the image.If scale is 1, value range is (0,1024], and if scale is 2, value range is (0,512]. + * + * @type {number} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + imageHeight: number; + /** + * For mobile devices, use scale parameter to return higher-resolution map images. + * The scale value is multiplied with the size to determine the actual output size of the image in pixels, + * without changing the coverage area of the map. + * Default scale value is 1; accepted values are 1 and 2. + * + * @type {?number} + * @default 1 + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + scale?: number; + /** + * The alignment mode of the map logo + * + * @type {?LogoAlignment} + * @default LogoAlignment.BOTTOM_START + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + logoAlignment?: mapCommon.LogoAlignment; + /** + * Add markers on the map image. + * + * @type {?Array} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + markers?: Array; + /** + * Add path on the map image. + * + * @type {?StaticMapPath} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + path?: StaticMapPath; + /** + * The day and night mode. + * + * @type { ?mapCommon.DayNightMode } + * @default DayNightMode.DAY + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + dayNightMode?: mapCommon.DayNightMode; + } + /** + * The marker info which will be added on the map image. + * + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + interface StaticMapMarker { + /** + * Indicates the marker location. + * + * @type {LatLng} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + location: mapCommon.LatLng; + /** + * Indicates the marker custom icon, which must start with http:// or https://. If not set, system will use the default icon. + * + * @type {?string} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + icon?: string; + /** + * If use the default icon, choose use which size of the default icon. + * + * @type {?IconSize} + * @default IconSize.NORMAL + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + defaultIconSize?: IconSize; + /** + * Indicates the text in the Marker icon. + * + * @type {?string} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + font?: string; + /** + * Indicates the text color in the Marker icon.The color value is ARGB format。 + * + * @type {?number} + * @default 0xff000000 + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + fontColor?: number; + /** + * Indicates rotation angle of the Marker icon. + * + * @type {?number} + * @default 0 + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + rotation?: number; + } + /** + * The path info which will be added on the map image. + * + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + interface StaticMapPath { + /** + * Indicates the coordinates of the path. + * + * @type {Array} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + locations: Array; + /** + * Indicates the color of the path.The color value is ARGB format。 + * + * @type {?number} + * @default 0xff000000 + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + color?: number; + /** + * Indicates the fill color of the path. If set the fillColor, the path indicates a polygon.The color value is ARGB format。 + * + * @type {?number} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + fillColor?: number; + /** + * Indicates the width of the path. + * + * @type {?number} + * @default 5 + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + width?: number; + } + /** + * The default icon size of static map marker + * + * @enum {number} + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + enum IconSize { + /** + * Use the smallest icon + * + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + TINY = 0, + /** + * Use the small Icon + * + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + SMALL = 1, + /** + * Use the medium Icon + * + * @syscap SystemCapability.Map.Core + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + NORMAL = 2 + } +} +export default staticMap; diff --git a/language/arkts/extractor/sdk/hms/ets/api/@hms.core.payment.paymentService.d.ts b/language/arkts/extractor/sdk/hms/ets/api/@hms.core.payment.paymentService.d.ts new file mode 100755 index 00000000..81eff2f8 --- /dev/null +++ b/language/arkts/extractor/sdk/hms/ets/api/@hms.core.payment.paymentService.d.ts @@ -0,0 +1,88 @@ +/* + * Copyright (c) Huawei Technologies Co., Ltd. 2023-2023. All rights reserved. + */ +/** + * @file This module provides the capabilities to use payment service. + * @kit PaymentKit + */ +import type { AsyncCallback } from '@ohos.base'; +import type common from '@ohos.app.ability.common'; +/** + * This module provides the capabilities to use payment service. + * + * @namespace paymentService + * @syscap SystemCapability.Payment.PaymentService + * @atomicservice + * @since 4.1.0(11) + */ +declare namespace paymentService { + /** + * Pull up PaymentService checkout + * + * @param { common.UIAbilityContext } context - The context of an ability. + * @param { string } orderStr - order information + * @returns { Promise } - void. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 1001930000 - The operation was canceled by the user. + * @throws { BusinessError } 1001930001 - Pay failed. + * @throws { BusinessError } 1001930002 - The transaction has been processed. + * @throws { BusinessError } 1001930010 - Duplicate request. + * @throws { BusinessError } 1001930011 - Network connection error. + * @syscap SystemCapability.Payment.PaymentService + * @atomicservice + * @since 4.1.0(11) + */ + function requestPayment(context: common.UIAbilityContext, orderStr: string): Promise; + /** + * Pull up PaymentService checkout + * + * @param { common.UIAbilityContext } context - The context of an ability. + * @param { string } orderStr - order information + * @param { AsyncCallback } callback - void. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 1001930000 - The operation was canceled by the user. + * @throws { BusinessError } 1001930001 - Pay failed. + * @throws { BusinessError } 1001930002 - The transaction has been processed. + * @throws { BusinessError } 1001930010 - Duplicate request. + * @throws { BusinessError } 1001930011 - Network connection error. + * @syscap SystemCapability.Payment.PaymentService + * @atomicservice + * @since 4.1.0(11) + */ + function requestPayment(context: common.UIAbilityContext, orderStr: string, callback: AsyncCallback): void; + /** + * Pull up PaymentService withhold checkout + * + * @param { common.UIAbilityContext } context - The context of an ability. + * @param { string } contractStr - contract information + * @returns { Promise } - void. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 1001930000 - The operation was canceled by the user. + * @throws { BusinessError } 1001930002 - The transaction has been processed. + * @throws { BusinessError } 1001930003 - Withhold failed. + * @throws { BusinessError } 1001930010 - Duplicate request. + * @throws { BusinessError } 1001930011 - Network connection error. + * @syscap SystemCapability.Payment.PaymentService + * @atomicservice + * @since 5.0.0(12) + */ + function requestContract(context: common.UIAbilityContext, contractStr: string): Promise; + /** + * Pull up PaymentService withhold checkout + * + * @param { common.UIAbilityContext } context - The context of an ability. + * @param { string } contractStr - contract information + * @param { AsyncCallback } callback - void. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 1001930000 - The operation was canceled by the user. + * @throws { BusinessError } 1001930002 - The transaction has been processed. + * @throws { BusinessError } 1001930003 - Withhold failed. + * @throws { BusinessError } 1001930010 - Duplicate request. + * @throws { BusinessError } 1001930011 - Network connection error. + * @syscap SystemCapability.Payment.PaymentService + * @atomicservice + * @since 5.0.0(12) + */ + function requestContract(context: common.UIAbilityContext, contractStr: string, callback: AsyncCallback): void; +} +export default paymentService; diff --git a/language/arkts/extractor/sdk/hms/ets/api/@hms.core.payment.walletPass.d.ts b/language/arkts/extractor/sdk/hms/ets/api/@hms.core.payment.walletPass.d.ts new file mode 100755 index 00000000..1a7ab9c9 --- /dev/null +++ b/language/arkts/extractor/sdk/hms/ets/api/@hms.core.payment.walletPass.d.ts @@ -0,0 +1,287 @@ +/* + * Copyright (c) Huawei Technologies Co., Ltd. 2023-2023. All rights reserved. + */ +/** + * @file + * @kit WalletKit + * @bundle com.huawei.hmos.walletkit/walletKit/ets/service/Pass 5.0.0(12) + */ +import type common from '@ohos.app.ability.common'; +import rpc from '@ohos.rpc'; +/** + * This module provides the capabilities of pass cards in Wallet. + * + * @namespace walletPass + * @syscap SystemCapability.Payment.Wallet + * @atomicservice + * @since 5.0.0(12) + */ +declare namespace walletPass { + /** + * Manages pass cards in the specified device. + * Sends RKE messages to the vehicle and gets the execution result. + * + * @syscap SystemCapability.Payment.Wallet + * @atomicservice + * @since 5.0.0(12) + */ + class WalletPassClient { + /** + * Creates a WalletPassClient Object. + * + * @param { common.UIAbilityContext } Context of the caller. + * @syscap SystemCapability.Payment.Wallet + * @atomicservice + * @since 5.0.0(12) + */ + constructor(context: common.UIAbilityContext); + /** + * Obtains the device information of a pass card. + * + * @param { string } passStr - Pass card information. + * @returns { Promise } - Returns a string in JSON format, which contains the device information. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 1010200001 - No permission to access the Wallet APIs. + * @throws { BusinessError } 1010200002 - Wallet app not found. + * @throws { BusinessError } 1010200003 - The environment of the wallet is not ready. + * @throws { BusinessError } 1010200006 - The device's remote paired watch cannot be connected. + * @throws { BusinessError } 1010220003 - Pass service is temporarily unavailable. + * @throws { BusinessError } 1010200013 - Operation failed because of an internal error. + * @throws { BusinessError } 1010200014 - The Wallet APIs can be called by the device owner only. + * @syscap SystemCapability.Payment.Wallet + * @atomicservice + * @since 5.0.0(12) + */ + queryPassDeviceInfo(passStr: string): Promise; + /** + * Checks whether a pass card can be added to this device or the remote paired watch. + * + * @param { string } passStr - Pass card information. + * @returns { Promise } - Returns a string indicating the check result. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 1010200001 - No permission to access the Wallet APIs. + * @throws { BusinessError } 1010200002 - Wallet app not found. + * @throws { BusinessError } 1010200003 - The environment of the wallet is not ready. + * @throws { BusinessError } 1010200004 - The device does not support this card. + * @throws { BusinessError } 1010200006 - The device's remote paired watch cannot be connected. + * @throws { BusinessError } 1010200009 - The chip space is full, and no more cards can be added. + * @throws { BusinessError } 1010200010 - Network connection error. + * @throws { BusinessError } 1010220002 - The card already exists in the specified device. + * @throws { BusinessError } 1010220003 - Pass service is temporarily unavailable. + * @throws { BusinessError } 1010200013 - Operation failed because of an internal error. + * @throws { BusinessError } 1010200014 - The Wallet APIs can be called by the device owner only. + * @syscap SystemCapability.Payment.Wallet + * @atomicservice + * @since 5.0.0(12) + */ + canAddPass(passStr: string): Promise; + /** + * Initializes the Wallet app's environment. + * + * @param { string } passStr - Pass card information. + * @returns { Promise } - Promise that returns no value. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 1010200002 - Wallet app not found. + * @throws { BusinessError } 1010200005 - The operation was canceled by the user. + * @throws { BusinessError } 1010200011 - Failed to initialize the environment. + * @throws { BusinessError } 1010200013 - Operation failed because of an internal error. + * @throws { BusinessError } 1010200014 - The Wallet APIs can be called by the device owner only. + * @syscap SystemCapability.Payment.Wallet + * @atomicservice + * @since 5.0.0(12) + */ + initWalletEnvironment(passStr: string): Promise; + /** + * Adds a pass card into Wallet. + * + * @param { string } passStr - Pass card information. + * @returns { Promise } - Returns a string indicating whether the pass card has been added. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 1010200002 - Wallet app not found. + * @throws { BusinessError } 1010200004 - The device does not support this card. + * @throws { BusinessError } 1010200005 - The operation was canceled by the user. + * @throws { BusinessError } 1010200006 - The device's remote paired watch cannot be connected. + * @throws { BusinessError } 1010200009 - The chip space is full, and no more cards can be added. + * @throws { BusinessError } 1010200012 - Duplicate request. + * @throws { BusinessError } 1010220002 - The card already exists in the specified device. + * @throws { BusinessError } 1010220003 - Pass service is temporarily unavailable. + * @throws { BusinessError } 1010220401 - Failed to add the card because the signature verification failed. + * @throws { BusinessError } 1010220402 - Failed to add the card because the data decryption failed. + * @throws { BusinessError } 1010220403 - Failed to add the card because the instance ID does not exist. + * @throws { BusinessError } 1010220404 - Failed to add the card because the instance ID has been used. + * @throws { BusinessError } 1010200013 - Operation failed because of an internal error. + * @throws { BusinessError } 1010200014 - The Wallet APIs can be called by the device owner only. + * @syscap SystemCapability.Payment.Wallet + * @atomicservice + * @since 5.0.0(12) + */ + addPass(passStr: string): Promise; + /** + * Obtains the pass cards in the specified device. + * + * @param { string } passStr - Pass card information. + * @returns { Promise } - Returns the pass cards in the specified device. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 1010200001 - No permission to access the Wallet APIs. + * @throws { BusinessError } 1010200002 - Wallet app not found. + * @throws { BusinessError } 1010200003 - The environment of the wallet is not ready. + * @throws { BusinessError } 1010200006 - The device's remote paired watch cannot be connected. + * @throws { BusinessError } 1010220501 - No card that meets the search criteria is found. + * @throws { BusinessError } 1010200013 - Operation failed because of an internal error. + * @throws { BusinessError } 1010200014 - The Wallet APIs can be called by the device owner only. + * @syscap SystemCapability.Payment.Wallet + * @atomicservice + * @since 5.0.0(12) + */ + queryPass(passStr: string): Promise; + /** + * Views the enabled pass cards. + * + * @param { string } passStr - Pass card information. + * @returns { Promise } - Promise that returns no value. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 1010200002 - Wallet app not found. + * @throws { BusinessError } 1010220004 - The card does not exist in the specified device. + * @throws { BusinessError } 1010200005 - The operation was canceled by the user. + * @throws { BusinessError } 1010200006 - The device's remote paired watch cannot be connected. + * @throws { BusinessError } 1010200013 - Operation failed because of an internal error. + * @throws { BusinessError } 1010200014 - The Wallet APIs can be called by the device owner only. + * @syscap SystemCapability.Payment.Wallet + * @atomicservice + * @since 5.0.0(12) + */ + viewPass(passStr: string): Promise; + /** + * Updates the data of a pass card. + * + * @param { string } passStr - Pass card information. + * @returns { Promise } - Returns a string indicating whether the pass card has been updated. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 1010200001 - No permission to access the Wallet APIs. + * @throws { BusinessError } 1010200002 - Wallet app not found. + * @throws { BusinessError } 1010200005 - The operation was canceled by the user. + * @throws { BusinessError } 1010200006 - The device's remote paired watch cannot be connected. + * @throws { BusinessError } 1010220003 - Pass service is temporarily unavailable. + * @throws { BusinessError } 1010220004 - The card does not exist in the specified device. + * @throws { BusinessError } 1010220701 - Failed to update the card because no update is detected. + * @throws { BusinessError } 1010200013 - Operation failed because of an internal error. + * @throws { BusinessError } 1010200014 - The Wallet APIs can be called by the device owner only. + * @syscap SystemCapability.Payment.Wallet + * @atomicservice + * @since 5.0.0(12) + */ + updatePass(passStr: string): Promise; + /** + * Deletes a pass card. + * + * @param { string } passStr - Pass card information. + * @returns { Promise } - Returns a string indicating whether the pass card has been deleted. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 1010200001 - No permission to access the Wallet APIs. + * @throws { BusinessError } 1010200002 - Wallet app not found. + * @throws { BusinessError } 1010200005 - The operation was canceled by the user. + * @throws { BusinessError } 1010200006 - The device's remote paired watch cannot be connected. + * @throws { BusinessError } 1010200012 - Duplicate request. + * @throws { BusinessError } 1010220003 - Pass service is temporarily unavailable. + * @throws { BusinessError } 1010220004 - The card does not exist in the specified device. + * @throws { BusinessError } 1010200013 - Operation failed because of an internal error. + * @throws { BusinessError } 1010200014 - The Wallet APIs can be called by the device owner only. + * @syscap SystemCapability.Payment.Wallet + * @atomicservice + * @since 5.0.0(12) + */ + deletePass(passStr: string): Promise; + /** + * Checks the connection state between the device and the vehicle. + * + * @param { string } rkeStr - RKE command. + * @returns { Promise } - Returns a string in JSON format, which indicates the connection state between the device and the vehicle. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 1010200001 - No permission to access the Wallet APIs. + * @throws { BusinessError } 1010200002 - Wallet app not found. + * @throws { BusinessError } 1010200006 - The device's remote paired watch cannot be connected. + * @throws { BusinessError } 1010220004 - The card does not exist in the specified device. + * @throws { BusinessError } 1010200013 - Operation failed because of an internal error. + * @throws { BusinessError } 1010200014 - The Wallet APIs can be called by the device owner only. + * @syscap SystemCapability.Payment.Wallet + * @atomicservice + * @since 5.0.0(12) + */ + queryICCEConnectionState(rkeStr: string): Promise; + /** + * Initiates a connection to the vehicle. + * + * @param { string } rkeStr - RKE command. + * @returns { Promise } - Returns a string, which indicates whether the connection between the device and the vehicle is established. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 1010200001 - No permission to access the Wallet APIs. + * @throws { BusinessError } 1010200002 - Wallet app not found. + * @throws { BusinessError } 1010200006 - The device's remote paired watch cannot be connected. + * @throws { BusinessError } 1010200010 - Network connection error. + * @throws { BusinessError } 1010200012 - Duplicate request. + * @throws { BusinessError } 1010220004 - The card does not exist in the specified device. + * @throws { BusinessError } 1010221001 - Connection failed because the pairing code is not obtained. + * @throws { BusinessError } 1010200013 - Operation failed because of an internal error. + * @throws { BusinessError } 1010200014 - The Wallet APIs can be called by the device owner only. + * @syscap SystemCapability.Payment.Wallet + * @atomicservice + * @since 5.0.0(12) + */ + startICCEConnection(rkeStr: string): Promise; + /** + * Registers an ICCE listener. + * + * @param { string } rkeStr - RKE command. + * @param { rpc.RemoteObject } eventNotifyListener - Event listener. + * @returns { Promise } - Returns a string indicating whether the registration is successful. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 1010200001 - No permission to access the Wallet APIs. + * @throws { BusinessError } 1010200002 - Wallet app not found. + * @throws { BusinessError } 1010200012 - Duplicate request. + * @throws { BusinessError } 1010221101 - Registration failed because of duplicate register name. + * @throws { BusinessError } 1010200013 - Operation failed because of an internal error. + * @throws { BusinessError } 1010200014 - The Wallet APIs can be called by the device owner only. + * @syscap SystemCapability.Payment.Wallet + * @atomicservice + * @since 5.0.0(12) + */ + registerICCEListener(rkeStr: string, eventNotifyListener: rpc.RemoteObject): Promise; + /** + * Unregisters an ICCE listener. + * + * @param { string } rkeStr - RKE command. + * @returns { Promise } - Returns a string indicating whether the unregistration is successful. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 1010200001 - No permission to access the Wallet APIs. + * @throws { BusinessError } 1010200002 - Wallet app not found. + * @throws { BusinessError } 1010221201 - The registration may have been unregistered before. + * @throws { BusinessError } 1010200013 - Operation failed because of an internal error. + * @throws { BusinessError } 1010200014 - The Wallet APIs can be called by the device owner only. + * @syscap SystemCapability.Payment.Wallet + * @atomicservice + * @since 5.0.0(12) + */ + unregisterICCEListener(rkeStr: string): Promise; + /** + * Sends an RKE message. + * + * @param { string } rkeStr - RKE command. + * @returns { Promise } - Returns a string indicating whether the RKE message is sent successfully. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 1010200001 - No permission to access the Wallet APIs. + * @throws { BusinessError } 1010200002 - Wallet app not found. + * @throws { BusinessError } 1010200006 - The device's remote paired watch cannot be connected. + * @throws { BusinessError } 1010200012 - Duplicate request. + * @throws { BusinessError } 1010220004 - The card does not exist in the specified device. + * @throws { BusinessError } 1010221301 - Failed to send the RKE message because of a connection failure. + * @throws { BusinessError } 1010221302 - Failed to send the RKE message because of an authentication failure. + * @throws { BusinessError } 1010200013 - Operation failed because of an internal error. + * @throws { BusinessError } 1010200014 - The Wallet APIs can be called by the device owner only. + * @syscap SystemCapability.Payment.Wallet + * @atomicservice + * @since 5.0.0(12) + */ + sendICCERKEMessage(rkeStr: string): Promise; + } +} +export default walletPass; diff --git a/language/arkts/extractor/sdk/hms/ets/api/@hms.core.payment.walletTransitCard.d.ts b/language/arkts/extractor/sdk/hms/ets/api/@hms.core.payment.walletTransitCard.d.ts new file mode 100755 index 00000000..23b7a7cb --- /dev/null +++ b/language/arkts/extractor/sdk/hms/ets/api/@hms.core.payment.walletTransitCard.d.ts @@ -0,0 +1,351 @@ +/* + * Copyright (c) Huawei Technologies Co., Ltd. 2023-2023. All rights reserved. + */ +/** +* @file +* @kit WalletKit +* @bundle com.huawei.hmos.walletkit/walletKit/ets/service/TransitCard 5.0.0(12) +*/ +import type common from '@ohos.app.ability.common'; +/** + * This module provides the capabilities of the transit card in Wallet. + * + * @namespace walletTransitCard + * @syscap SystemCapability.Payment.Wallet + * @atomicservice + * @since 5.0.0(12) + */ +declare namespace walletTransitCard { + /** + * The TransitCardClient class. + * @syscap SystemCapability.Payment.Wallet + * @atomicservice + * @since 5.0.0(12) + */ + class TransitCardClient { + /** + * Creates a TransitCardClient Object. + * + * @param { common.UIAbilityContext } - Context of the caller. + * @param { string } callerId - ID of the caller. + * @syscap SystemCapability.Payment.Wallet + * @atomicservice + * @since 5.0.0(12) + */ + constructor(context: common.UIAbilityContext, callerId: string); + /** + * Obtains an array of CardMetadataInDevice objects, each of which contains the device information and the metadata of every card supported + * by the device. + * An empty array will be returned in the device without eSE or if the specified device does not support any transit card. + * + * @param { DeviceType } specifiedDeviceType - Type of the specified device. + * @param { string } callerToken? - Authentication JWT token of the mini program in Wechat, Alipay, and the like. + * @returns { Promise } - Returns the array of CardMetadataInDevice objects, each of which contains the device information and + * the metadata of every card. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 1010200001 - No permission to access the Wallet APIs. + * @throws { BusinessError } 1010200002 - Wallet app not found. + * @throws { BusinessError } 1010200003 - The environment of the wallet is not ready. + * @throws { BusinessError } 1010200006 - The device's remote paired watch cannot be connected. + * @throws { BusinessError } 1010200010 - Network connection error. + * @throws { BusinessError } 1010200013 - Operation failed because of an internal error. + * @throws { BusinessError } 1010200014 - The Wallet APIs can be called by the device owner only. + * @syscap SystemCapability.Payment.Wallet + * @atomicservice + * @since 5.0.0(12) + */ + getCardMetadataInDevice(specifiedDeviceType: DeviceType, callerToken?: string): Promise; + /** + * Obtains the information of a transit card. + * + * @param { string } logicalCardNumber - Serial number of the card. + * @param { string } callerToken? - Authentication JWT token of the mini program in Wechat, Alipay, and the like. + * @param { string } specifiedDeviceId - ID of the device where the card exists. + * @returns { Promise } - Returns the transit card information. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 1010200001 - No permission to access the Wallet APIs. + * @throws { BusinessError } 1010200002 - Wallet app not found. + * @throws { BusinessError } 1010200003 - The environment of the wallet is not ready. + * @throws { BusinessError } 1010200006 - The device's remote paired watch cannot be connected. + * @throws { BusinessError } 1010200010 - Network connection error. + * @throws { BusinessError } 1010210101 - The card status is not correct. + * @throws { BusinessError } 1010210119 - Failed to read the card data. + * @throws { BusinessError } 1010200013 - Operation failed because of an internal error. + * @throws { BusinessError } 1010200014 - The Wallet APIs can be called by the device owner only. + * @syscap SystemCapability.Payment.Wallet + * @atomicservice + * @since 5.0.0(12) + */ + getTransitCardInfo(logicalCardNumber: string, specifiedDeviceId: string, callerToken?: string): Promise; + /** + * Checks whether a transit card can be added in Wallet in the specified device. + * + * @param { string } issuerId - ID of the issuer of the card. The value is from CardMetadata in CardMetadataInDevice. + * @param { string } specifiedDeviceId - ID of the device where the card will be added. The value is from CardMetadataInDevice. + * @returns { Promise } - Returns a token for adding the card. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 1010200001 - No permission to access the Wallet APIs. + * @throws { BusinessError } 1010200002 - Wallet app not found. + * @throws { BusinessError } 1010200003 - The environment of the wallet is not ready. + * @throws { BusinessError } 1010200006 - The device's remote paired watch cannot be connected. + * @throws { BusinessError } 1010200007 - The OS version is too old. Please upgrade the OS version. + * @throws { BusinessError } 1010200008 - The wallet version is too old. + * @throws { BusinessError } 1010200009 - The chip space is full, and no more cards can be added. + * @throws { BusinessError } 1010200010 - Network connection error. + * @throws { BusinessError } 1010200013 - Operation failed because of an internal error. + * @throws { BusinessError } 1010200014 - The Wallet APIs can be called by the device owner only. + * @throws { BusinessError } 1010210201 - The device does not support adding the card specified by issuerId. + * @throws { BusinessError } 1010210202 - A card conflicting with the specified card already exists in the device. + * @throws { BusinessError } 1010210203 - The specified card already exists. + * @throws { BusinessError } 1010210204 - The card addition service is temporarily offline. + * @syscap SystemCapability.Payment.Wallet + * @atomicservice + * @since 5.0.0(12) + */ + canAddTransitCard(issuerId: string, specifiedDeviceId: string): Promise; + /** + * Sets up the Wallet app's environment. + * You should call this API to setup the Wallet app when you get the error code below from another API: + * Error code: 1010200002 - Wallet app not found. A dialog box will be displayed to guide the user to install the app. + * Error code: 1010200003 - The environment of the wallet is not ready. The Wallet app will be opened. The user needs to accept the + * privacy agreement of Wallet and log in with a Huawei ID. + * + * @returns { Promise } - Promise that returns no value. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 1010200014 - The Wallet APIs can be called by the device owner only. + * @throws { BusinessError } 1010200002 - Wallet app not found. + * @throws { BusinessError } 1010200011 - Failed to initialize the environment. + * @throws { BusinessError } 1010200013 - Operation failed because of an internal error. + * @syscap SystemCapability.Payment.Wallet + * @atomicservice + * @since 5.0.0(12) + */ + setupWalletEnvironment(): Promise; + /** + * Adds a transit card into the wallet and returns the card metadata. + * + * @param { string } addCardOpaqueData - Result of the function canAddTransitCard. + * @param { string } serverOrderId - Order ID generated in the service provider's backend server for the card addition business. + * @returns { Promise } - Returns the card metadata. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 1010200001 - No permission to access the Wallet APIs. + * @throws { BusinessError } 1010200010 - Network connection error. + * @throws { BusinessError } 1010200013 - Operation failed because of an internal error. + * @throws { BusinessError } 1010200014 - The Wallet APIs can be called by the device owner only. + * @throws { BusinessError } 1010210301 - The card adding conditions are not met. The order can be refunded to end the card addition process. + * @throws { BusinessError } 1010210319 - Failed to add the card. + * @syscap SystemCapability.Payment.Wallet + * @atomicservice + * @since 5.0.0(12) + */ + addTransitCard(addCardOpaqueData: string, serverOrderId: string): Promise; + /** + * Recharges a transit card according to the service specified by serverOrderId and returns the new balance. + * + * @param { string } logicalCardNumber - Serial number of the card. + * @param { string } specifiedDeviceId - ID of the device where the card exists. + * @param { string } serverOrderId - Order ID generated in the service provider's backend server for the balance recharging service. + * @returns { Promise } - Returns the new balance. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 1010200001 - No permission to access the Wallet APIs. + * @throws { BusinessError } 1010200002 - Wallet app not found. + * @throws { BusinessError } 1010200003 - The environment of the wallet is not ready. + * @throws { BusinessError } 1010200006 - The device's remote paired watch cannot be connected. + * @throws { BusinessError } 1010200010 - Network connection error. + * @throws { BusinessError } 1010200013 - Operation failed because of an internal error. + * @throws { BusinessError } 1010200014 - The Wallet APIs can be called by the device owner only. + * @throws { BusinessError } 1010210401 - The specified card does not exist. + * @throws { BusinessError } 1010210402 - The status of the specified card is incorrect. + * @throws { BusinessError } 1010210419 - Failed to recharge the card. + * @syscap SystemCapability.Payment.Wallet + * @atomicservice + * @since 5.0.0(12) + */ + rechargeTransitCard(logicalCardNumber: string, specifiedDeviceId: string, serverOrderId: string): Promise; + /** + * Updates the data of a transit card according to the service specified by serverOrderId. + * + * @param { string } logicalCardNumber - Serial number of the card. + * @param { string } specifiedDeviceId - ID of the device where the card exists. + * @param { string } serverOrderId - Order ID generated in the service provider's backend server for the card data update service. + * @returns { Promise } - Promise that returns no value. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 1010200001 - No permission to access the Wallet APIs. + * @throws { BusinessError } 1010200002 - Wallet app not found. + * @throws { BusinessError } 1010200003 - The environment of the wallet is not ready. + * @throws { BusinessError } 1010200006 - The device's remote paired watch cannot be connected. + * @throws { BusinessError } 1010200010 - Network connection error. + * @throws { BusinessError } 1010200013 - Operation failed because of an internal error. + * @throws { BusinessError } 1010200014 - The Wallet APIs can be called by the device owner only. + * @throws { BusinessError } 1010210501 - The specified card does not exist. + * @throws { BusinessError } 1010210502 - The status of the specified card is incorrect. + * @throws { BusinessError } 1010210519 - Failed to update the card data. + * @syscap SystemCapability.Payment.Wallet + * @atomicservice + * @since 5.0.0(12) + */ + updateTransitCard(logicalCardNumber: string, specifiedDeviceId: string, serverOrderId: string): Promise; + /** + * Deletes a transit card according to the service specified by serverOrderId. + * + * @param { string } logicalCardNumber - Serial number of the card. + * @param { string } specifiedDeviceId - ID of the device where the card exists. + * @param { string } serverOrderId - Order ID generated in the service provider's backend server for the card deletion service. + * @returns { Promise } - Promise that returns no value. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 1010200001 - No permission to access the Wallet APIs. + * @throws { BusinessError } 1010200002 - Wallet app not found. + * @throws { BusinessError } 1010200003 - The environment of the wallet is not ready. + * @throws { BusinessError } 1010200006 - The device's remote paired watch cannot be connected. + * @throws { BusinessError } 1010200010 - Network connection error. + * @throws { BusinessError } 1010200013 - Operation failed because of an internal error. + * @throws { BusinessError } 1010200014 - The Wallet APIs can be called by the device owner only. + * @throws { BusinessError } 1010210619 - Failed to delete the card. + * @syscap SystemCapability.Payment.Wallet + * @atomicservice + * @since 5.0.0(12) + */ + deleteTransitCard(logicalCardNumber: string, specifiedDeviceId: string, serverOrderId: string): Promise; + } + /** + * Describes the metadata of a card. + * + * @syscap SystemCapability.Payment.Wallet + * @atomicservice + * @since 5.0.0(12) + */ + interface CardMetadata { + /** + * ID of the issuer of the card. + * + * @syscap SystemCapability.Payment.Wallet + * @atomicservice + * @since 5.0.0(12) + */ + issuerId: string; + /** + * Applet ID for the card in the SE chip. + * + * @syscap SystemCapability.Payment.Wallet + * @atomicservice + * @since 5.0.0(12) + */ + aid: string; + /** + * Serial number of the card. It is mandatory only when a transit card exists in the device. + * + * @syscap SystemCapability.Payment.Wallet + * @atomicservice + * @since 5.0.0(12) + */ + logicalCardNumber?: string; + /** + * Card number displayed. It is mandatory only when a transit card exists in the device. + * + * @syscap SystemCapability.Payment.Wallet + * @atomicservice + * @since 5.0.0(12) + */ + cardNumber?: string; + /** + * Balance of the card. It is mandatory only when a transit card exists in the device. + * + * @syscap SystemCapability.Payment.Wallet + * @atomicservice + * @since 5.0.0(12) + */ + balance?: number; + } + /** + * Describes the card metadata in the device. + * + * @syscap SystemCapability.Payment.Wallet + * @atomicservice + * @since 5.0.0(12) + */ + interface CardMetadataInDevice { + /** + * Device ID, which is used by the developer. + * + * @syscap SystemCapability.Payment.Wallet + * @atomicservice + * @since 5.0.0(12) + */ + deviceId: string; + /** + * Device type. + * + * @syscap SystemCapability.Payment.Wallet + * @atomicservice + * @since 5.0.0(12) + */ + deviceType: DeviceType; + /** + * Device name displayed. + * + * @syscap SystemCapability.Payment.Wallet + * @atomicservice + * @since 5.0.0(12) + */ + displayName: string; + /** + * Array holding the metadata of every card supported by the device. + * + * @syscap SystemCapability.Payment.Wallet + * @atomicservice + * @since 5.0.0(12) + */ + cardMetadata: CardMetadata[]; + } + /** + * Describes the transit card information. + * + * @syscap SystemCapability.Payment.Wallet + * @atomicservice + * @since 5.0.0(12) + */ + interface TransitCardInfo { + /** + * Card number displayed. + * + * @syscap SystemCapability.Payment.Wallet + * @atomicservice + * @since 5.0.0(12) + */ + cardNumber: string; + /** + * Card data customized by the service provider. + * + * @syscap SystemCapability.Payment.Wallet + * @atomicservice + * @since 5.0.0(12) + */ + customCardData?: string; + } + /** + * Enumerates the device types. + * + * @syscap SystemCapability.Payment.Wallet + * @atomicservice + * @since 5.0.0(12) + */ + enum DeviceType { + /** + * Phone. + * + * @syscap SystemCapability.Payment.Wallet + * @atomicservice + * @since 5.0.0(12) + */ + DEVICE_PHONE = 0, + /** + * Wearable. + * + * @syscap SystemCapability.Payment.Wallet + * @atomicservice + * @since 5.0.0(12) + */ + DEVICE_WATCH = 1 + } +} +export default walletTransitCard; diff --git a/language/arkts/extractor/sdk/hms/ets/api/@hms.core.push.PushExtensionAbility.d.ts b/language/arkts/extractor/sdk/hms/ets/api/@hms.core.push.PushExtensionAbility.d.ts new file mode 100755 index 00000000..f627c946 --- /dev/null +++ b/language/arkts/extractor/sdk/hms/ets/api/@hms.core.push.PushExtensionAbility.d.ts @@ -0,0 +1,40 @@ +/* + * Copyright (c) Huawei Technologies Co., Ltd. 2023. All rights reserved. + */ +/** + * @file Defines push extension ability. + * @kit PushKit + */ +import type PushExtensionContext from '@hms.core.push.PushExtensionContext'; +import type pushCommon from '@hms.core.push.pushCommon'; +/** + * Class of push extension ability. + * @syscap SystemCapability.Push.PushService + * @StageModelOnly + * @since 4.0.0(10) + */ +export default class PushExtensionAbility { + /** + * Indicates push extension context. + * @type { PushExtensionContext } + * @syscap SystemCapability.Push.PushService + * @StageModelOnly + * @since 4.0.0(10) + */ + context: PushExtensionContext; + /** + * Called back when message is received. + * @param { pushCommon.PushPayload } payload - Indicates the data of push payload. + * @syscap SystemCapability.Push.PushService + * @StageModelOnly + * @since 4.0.0(10) + */ + onReceiveMessage(payload: pushCommon.PushPayload): void; + /** + * Called back before a push extension is destroyed. + * @syscap SystemCapability.Push.PushService + * @StageModelOnly + * @since 4.0.0(10) + */ + onDestroy(): void; +} diff --git a/language/arkts/extractor/sdk/hms/ets/api/@hms.core.push.PushExtensionContext.d.ts b/language/arkts/extractor/sdk/hms/ets/api/@hms.core.push.PushExtensionContext.d.ts new file mode 100755 index 00000000..cc0b9d4b --- /dev/null +++ b/language/arkts/extractor/sdk/hms/ets/api/@hms.core.push.PushExtensionContext.d.ts @@ -0,0 +1,17 @@ +/* + * Copyright (c) Huawei Technologies Co., Ltd. 2023. All rights reserved. + */ +/** + * @file Defines extension context of push extension. + * @kit PushKit + */ +import ExtensionContext from '@ohos.inner.application.ExtensionContext'; +/** + * The extension context of push extension. + * @extends ExtensionContext + * @syscap SystemCapability.Push.PushService + * @StageModelOnly + * @since 4.0.0(10) + */ +export default class PushExtensionContext extends ExtensionContext { +} diff --git a/language/arkts/extractor/sdk/hms/ets/api/@hms.core.push.RemoteLocationExtensionAbility.d.ts b/language/arkts/extractor/sdk/hms/ets/api/@hms.core.push.RemoteLocationExtensionAbility.d.ts new file mode 100755 index 00000000..7d438db7 --- /dev/null +++ b/language/arkts/extractor/sdk/hms/ets/api/@hms.core.push.RemoteLocationExtensionAbility.d.ts @@ -0,0 +1,45 @@ +/* + * Copyright (c) Huawei Technologies Co., Ltd. 2023. All rights reserved. + */ +/** + * @file Defines remote location extension ability. + * @kit PushKit + */ +import type RemoteLocationExtensionContext from '@hms.core.push.RemoteLocationExtensionContext'; +import type pushCommon from '@hms.core.push.pushCommon'; +/** + * Class of remote location extension ability. + * + * @syscap SystemCapability.Push.PushService + * @StageModelOnly + * @since 4.1.0(11) + */ +export default class RemoteLocationExtensionAbility { + /** + * Indicates remote location extension context. + * + * @type { RemoteLocationExtensionContext } + * @syscap SystemCapability.Push.PushService + * @StageModelOnly + * @since 4.1.0(11) + */ + context: RemoteLocationExtensionContext; + /** + * Called back when message is received. + * + * @param { pushCommon.PushPayload } payload - Indicates the data of push payload. + * @returns { Promise } The promise returned by the function. + * @syscap SystemCapability.Push.PushService + * @StageModelOnly + * @since 4.1.0(11) + */ + onReceiveMessage(payload: pushCommon.PushPayload): Promise; + /** + * Called back before a remote location extension is destroyed. + * + * @syscap SystemCapability.Push.PushService + * @StageModelOnly + * @since 4.1.0(11) + */ + onDestroy(): void; +} diff --git a/language/arkts/extractor/sdk/hms/ets/api/@hms.core.push.RemoteLocationExtensionContext.d.ts b/language/arkts/extractor/sdk/hms/ets/api/@hms.core.push.RemoteLocationExtensionContext.d.ts new file mode 100755 index 00000000..238d1d4f --- /dev/null +++ b/language/arkts/extractor/sdk/hms/ets/api/@hms.core.push.RemoteLocationExtensionContext.d.ts @@ -0,0 +1,18 @@ +/* + * Copyright (c) Huawei Technologies Co., Ltd. 2023. All rights reserved. + */ +/** + * @file Defines extension context of remote location extension. + * @kit PushKit + */ +import ExtensionContext from '@ohos.inner.application.ExtensionContext'; +/** + * The extension context of remote location extension. + * + * @extends RemoteLocationExtensionContext + * @syscap SystemCapability.Push.PushService + * @StageModelOnly + * @since 4.1.0(11) + */ +export default class RemoteLocationExtensionContext extends ExtensionContext { +} diff --git a/language/arkts/extractor/sdk/hms/ets/api/@hms.core.push.RemoteNotificationExtensionAbility.d.ts b/language/arkts/extractor/sdk/hms/ets/api/@hms.core.push.RemoteNotificationExtensionAbility.d.ts new file mode 100755 index 00000000..fa5e5cd2 --- /dev/null +++ b/language/arkts/extractor/sdk/hms/ets/api/@hms.core.push.RemoteNotificationExtensionAbility.d.ts @@ -0,0 +1,45 @@ +/* + * Copyright (c) Huawei Technologies Co., Ltd. 2023. All rights reserved. + */ +/** + * @file Defines remote notification extension ability. + * @kit PushKit + */ +import type RemoteNotificationExtensionContext from '@hms.core.push.RemoteNotificationExtensionContext'; +import type pushCommon from '@hms.core.push.pushCommon'; +/** + * Class of remote notification extension ability. + * + * @syscap SystemCapability.Push.PushService + * @StageModelOnly + * @since 4.1.0(11) + */ +export default class RemoteNotificationExtensionAbility { + /** + * Indicates remote notification extension context. + * + * @type { RemoteNotificationExtensionContext } + * @syscap SystemCapability.Push.PushService + * @StageModelOnly + * @since 4.1.0(11) + */ + context: RemoteNotificationExtensionContext; + /** + * Called back when message is received. + * + * @param { pushCommon.RemoteNotificationInfo } remoteNotificationInfo - Indicates the remote notification information. + * @returns { Promise } Returns the remote notification content. + * @syscap SystemCapability.Push.PushService + * @StageModelOnly + * @since 4.1.0(11) + */ + onReceiveMessage(remoteNotificationInfo: pushCommon.RemoteNotificationInfo): Promise; + /** + * Called back before a remote notification extension is destroyed. + * + * @syscap SystemCapability.Push.PushService + * @StageModelOnly + * @since 4.1.0(11) + */ + onDestroy(): void; +} diff --git a/language/arkts/extractor/sdk/hms/ets/api/@hms.core.push.RemoteNotificationExtensionContext.d.ts b/language/arkts/extractor/sdk/hms/ets/api/@hms.core.push.RemoteNotificationExtensionContext.d.ts new file mode 100755 index 00000000..d9ab462e --- /dev/null +++ b/language/arkts/extractor/sdk/hms/ets/api/@hms.core.push.RemoteNotificationExtensionContext.d.ts @@ -0,0 +1,18 @@ +/* + * Copyright (c) Huawei Technologies Co., Ltd. 2023. All rights reserved. + */ +/** + * @file Defines extension context of remote notification extension. + * @kit PushKit + */ +import ExtensionContext from '@ohos.inner.application.ExtensionContext'; +/** + * The extension context of remote notification extension. + * + * @extends RemoteNotificationExtensionContext + * @syscap SystemCapability.Push.PushService + * @StageModelOnly + * @since 4.1.0(11) + */ +export default class RemoteNotificationExtensionContext extends ExtensionContext { +} diff --git a/language/arkts/extractor/sdk/hms/ets/api/@hms.core.push.VoIPExtensionAbility.d.ts b/language/arkts/extractor/sdk/hms/ets/api/@hms.core.push.VoIPExtensionAbility.d.ts new file mode 100755 index 00000000..37d1536a --- /dev/null +++ b/language/arkts/extractor/sdk/hms/ets/api/@hms.core.push.VoIPExtensionAbility.d.ts @@ -0,0 +1,37 @@ +/* + * Copyright (c) Huawei Technologies Co., Ltd. 2023. All rights reserved. + */ +/** + * @file Defines voip extension ability. + * @kit PushKit + */ +import type VoIPExtensionContext from '@hms.core.push.VoIPExtensionContext'; +import type pushCommon from '@hms.core.push.pushCommon'; +import UIExtensionAbility from '@ohos.app.ability.UIExtensionAbility'; +/** + * Class of voip extension ability. + * + * @syscap SystemCapability.Push.PushService + * @StageModelOnly + * @since 4.1.0(11) + */ +export default class VoIPExtensionAbility extends UIExtensionAbility { + /** + * Indicates voip extension context. + * + * @type { VoIPExtensionContext } + * @syscap SystemCapability.Push.PushService + * @StageModelOnly + * @since 4.1.0(11) + */ + context: VoIPExtensionContext; + /** + * Called back when message is received. + * + * @param { pushCommon.VoIPInfo } voipInfo - Indicates the data of voip. + * @syscap SystemCapability.Push.PushService + * @StageModelOnly + * @since 4.1.0(11) + */ + onReceiveMessage(voipInfo: pushCommon.VoIPInfo): void; +} diff --git a/language/arkts/extractor/sdk/hms/ets/api/@hms.core.push.VoIPExtensionContext.d.ts b/language/arkts/extractor/sdk/hms/ets/api/@hms.core.push.VoIPExtensionContext.d.ts new file mode 100755 index 00000000..16fe840c --- /dev/null +++ b/language/arkts/extractor/sdk/hms/ets/api/@hms.core.push.VoIPExtensionContext.d.ts @@ -0,0 +1,18 @@ +/* + * Copyright (c) Huawei Technologies Co., Ltd. 2023. All rights reserved. + */ +/** + * @file Defines extension context of voip extension. + * @kit PushKit + */ +import UIExtensionContext from '@ohos.inner.application.UIExtensionContext'; +/** + * The extension context of voip extension. + * + * @extends VoIPExtensionContext + * @syscap SystemCapability.Push.PushService + * @StageModelOnly + * @since 4.1.0(11) + */ +export default class VoIPExtensionContext extends UIExtensionContext { +} diff --git a/language/arkts/extractor/sdk/hms/ets/api/@hms.core.push.pushCommon.d.ts b/language/arkts/extractor/sdk/hms/ets/api/@hms.core.push.pushCommon.d.ts new file mode 100755 index 00000000..adc0cfb3 --- /dev/null +++ b/language/arkts/extractor/sdk/hms/ets/api/@hms.core.push.pushCommon.d.ts @@ -0,0 +1,208 @@ +/* + * Copyright (c) Huawei Technologies Co., Ltd. 2023. All rights reserved. + */ +/** + * @file Defines common data object of push. + * @kit PushKit + */ +import type image from '@ohos.multimedia.image'; +/** + * Common data object of push. + * @namespace pushCommon + * @syscap SystemCapability.Push.PushService + * @StageModelOnly + * @since 4.0.0(10) + */ +declare namespace pushCommon { + /** + * class of push payload. + * @typedef PushPayload + * @syscap SystemCapability.Push.PushService + * @StageModelOnly + * @since 4.0.0(10) + */ + export interface PushPayload { + /** + * The type of push payload. + * @syscap SystemCapability.Push.PushService + * @StageModelOnly + * @since 4.0.0(10) + */ + type: string; + /** + * The data of push payload. + * @syscap SystemCapability.Push.PushService + * @StageModelOnly + * @since 4.0.0(10) + */ + data: string; + } + /** + * The profile type of application. + * @enum { number } + * @syscap SystemCapability.Push.PushService + * @StageModelOnly + * @since 4.0.0(10) + */ + export enum AppProfileType { + /** + * Profile type of os distributed account. + * @syscap SystemCapability.Push.PushService + * @StageModelOnly + * @since 4.0.0(10) + */ + PROFILE_TYPE_OS_DISTRIBUTED_ACCOUNT = 1, + /** + * Profile type of application account. + * @syscap SystemCapability.Push.PushService + * @StageModelOnly + * @since 4.0.0(10) + */ + PROFILE_TYPE_APPLICATION_ACCOUNT = 2 + } + /** + * Class of remote notification information. + * + * @typedef RemoteNotificationInfo + * @syscap SystemCapability.Push.PushService + * @StageModelOnly + * @since 4.1.0(11) + */ + export interface RemoteNotificationInfo extends PushPayload { + /** + * Notification ID. + * @type { number } + * @syscap SystemCapability.Push.PushService + * @StageModelOnly + * @since 4.1.0(11) + */ + id: number; + } + /** + * Class of remote notification content. + * + * @typedef RemoteNotificationContent + * @syscap SystemCapability.Push.PushService + * @StageModelOnly + * @since 4.1.0(11) + */ + export interface RemoteNotificationContent { + /** + * Title of remote notification. + * + * @type { string } + * @syscap SystemCapability.Push.PushService + * @StageModelOnly + * @since 4.1.0(11) + */ + /** + * Title of remote notification. + * + * @type { ?string } + * @syscap SystemCapability.Push.PushService + * @StageModelOnly + * @since 5.0.0(12) + */ + title?: string; + /** + * Content of remote notification. + * + * @type { string } + * @syscap SystemCapability.Push.PushService + * @StageModelOnly + * @since 4.1.0(11) + */ + /** + * Content of remote notification. + * + * @type { ?string } + * @syscap SystemCapability.Push.PushService + * @StageModelOnly + * @since 5.0.0(12) + */ + text?: string; + /** + * Overlay icon of remote notification. + * + * @type { ?image.PixelMap } + * @syscap SystemCapability.Push.PushService + * @StageModelOnly + * @since 4.1.0(11) + */ + overlayIcon?: image.PixelMap; + /** + * Number of remote notifications displayed on the app icon. + * + * @type { number } + * @syscap SystemCapability.Push.PushService + * @StageModelOnly + * @since 4.1.0(11) + */ + badgeNumber?: number; + /** + * Number of remote notifications displayed on the app icon. + * + * @type { number } + * @syscap SystemCapability.Push.PushService + * @StageModelOnly + * @since 5.0.0(12) + */ + setBadgeNumber?: number; + /** + * Data that can be replaced when the notification is clicked. + * + * @type { RemoteWantAgent } + * @syscap SystemCapability.Push.PushService + * @StageModelOnly + * @since 4.1.0(11) + */ + wantAgent?: RemoteWantAgent; + } + /** + * Class of voip information. + * + * @typedef VoIPInfo + * @syscap SystemCapability.Push.PushService + * @StageModelOnly + * @since 4.1.0(11) + */ + export interface VoIPInfo extends PushPayload { + /** + * VoIP call ID. + * @type { string } + * @syscap SystemCapability.Push.PushService + * @StageModelOnly + * @since 4.1.0(11) + */ + callId: string; + } + /** + * Class of remote want agent. + * + * @typedef RemoteWantAgent + * @syscap SystemCapability.Push.PushService + * @StageModelOnly + * @since 4.1.0(11) + */ + export interface RemoteWantAgent { + /** + * Ability Name of RemoteWantAgent. + * + * @type { string } + * @syscap SystemCapability.Push.PushService + * @StageModelOnly + * @since 4.1.0(11) + */ + abilityName: string; + /** + * The parameters of RemoteWantAgent. + * + * @type { Record } + * @syscap SystemCapability.Push.PushService + * @StageModelOnly + * @since 4.1.0(11) + */ + parameters?: Record; + } +} +export default pushCommon; diff --git a/language/arkts/extractor/sdk/hms/ets/api/@hms.core.push.pushService.d.ts b/language/arkts/extractor/sdk/hms/ets/api/@hms.core.push.pushService.d.ts new file mode 100755 index 00000000..9a29f5ae --- /dev/null +++ b/language/arkts/extractor/sdk/hms/ets/api/@hms.core.push.pushService.d.ts @@ -0,0 +1,169 @@ +/* + * Copyright (c) Huawei Technologies Co., Ltd. 2023. All rights reserved. + */ +/** + * @file Defines module of push service. + * @kit PushKit + */ +import type { AsyncCallback, Callback } from '@ohos.base'; +import type Ability from '@ohos.app.ability.Ability'; +import type pushCommon from '@hms.core.push.pushCommon'; +/** + * This module of push service. + * @namespace pushService + * @syscap SystemCapability.Push.PushService + * @StageModelOnly + * @since 4.0.0(10) + */ +declare namespace pushService { + /** + * Obtains a token from push service. + * @param { AsyncCallback } callback - Indicates the callback to get token. + * @throws { BusinessError } 401 - Invalid input parameter. + * @throws { BusinessError } 1000900001 - System internal error. + * @throws { BusinessError } 1000900008 - Connect push service failed. + * @throws { BusinessError } 1000900009 - Push service internal error. + * @throws { BusinessError } 1000900010 - Illegal application identity. + * @throws { BusinessError } 1000900011 - The network is unavailable. + * @throws { BusinessError } 1000900012 - Push rights are not activated. + * @throws { BusinessError } 1000900013 - Cross-location application is not allowed to obtain the token. + * @throws { BusinessError } 1000900014 - The device does not support getting token. + * @syscap SystemCapability.Push.PushService + * @StageModelOnly + * @since 4.0.0(10) + */ + export function getToken(callback: AsyncCallback): void; + /** + * Obtains a token from push service. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - Invalid input parameter. + * @throws { BusinessError } 1000900001 - System internal error. + * @throws { BusinessError } 1000900008 - Connect push service failed. + * @throws { BusinessError } 1000900009 - Push service internal error. + * @throws { BusinessError } 1000900010 - Illegal application identity. + * @throws { BusinessError } 1000900011 - The network is unavailable. + * @throws { BusinessError } 1000900012 - Push rights are not activated. + * @throws { BusinessError } 1000900013 - Cross-location application is not allowed to obtain the token. + * @throws { BusinessError } 1000900014 - The device does not support getting token. + * @syscap SystemCapability.Push.PushService + * @StageModelOnly + * @since 4.0.0(10) + */ + export function getToken(): Promise; + /** + * Delete a token from push service. + * @param { AsyncCallback } callback - Indicates the callback to delete token. + * @throws { BusinessError } 401 - Invalid input parameter. + * @throws { BusinessError } 1000900001 - System internal error. + * @throws { BusinessError } 1000900008 - Connect push service failed. + * @throws { BusinessError } 1000900009 - Push service internal error. + * @throws { BusinessError } 1000900010 - Illegal application identity. + * @throws { BusinessError } 1000900011 - The network is unavailable. + * @syscap SystemCapability.Push.PushService + * @StageModelOnly + * @since 4.0.0(10) + */ + export function deleteToken(callback: AsyncCallback): void; + /** + * Delete a token from push service. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - Invalid input parameter. + * @throws { BusinessError } 1000900001 - System internal error. + * @throws { BusinessError } 1000900008 - Connect push service failed. + * @throws { BusinessError } 1000900009 - Push service internal error. + * @throws { BusinessError } 1000900010 - Illegal application identity. + * @throws { BusinessError } 1000900011 - The network is unavailable. + * @syscap SystemCapability.Push.PushService + * @StageModelOnly + * @since 4.0.0(10) + */ + export function deleteToken(): Promise; + /** + * Receive push message. + * @param { 'IM' | 'VoIP' | 'BACKGROUND' } pushType - The push type of message to receive. + * @param { Ability } ability - Application ability information. + * @param { Callback} onMessage - Callback after receiving the message. + * @throws { BusinessError } 401 - Invalid input parameter. + * @throws { BusinessError } 1000900001 - System internal error. + * @throws { BusinessError } 1000900005 - Messages of the same push type cannot be received repeatedly. + * @syscap SystemCapability.Push.PushService + * @StageModelOnly + * @since 4.0.0(10) + */ + /** + * Receive push message. + * @param { 'IM' | 'VoIP' | 'BACKGROUND' | 'EMERGENCY' } pushType - The push type of message to receive. + * @param { Ability } ability - Application ability information. + * @param { Callback} onMessage - Callback after receiving the message. + * @throws { BusinessError } 401 - Invalid input parameter. + * @throws { BusinessError } 1000900001 - System internal error. + * @throws { BusinessError } 1000900005 - Messages of the same push type cannot be received repeatedly. + * @syscap SystemCapability.Push.PushService + * @StageModelOnly + * @since 5.0.0(12) + */ + export function receiveMessage(pushType: 'IM' | 'VoIP' | 'BACKGROUND' | 'EMERGENCY', ability: Ability, onMessage: Callback): void; + /** + * Bind the relationship between the profile and application on the device. + * @param { pushCommon.AppProfileType } appProfileType - The profile type of the application. + * @param { string } appProfileId - The profile id of the application. + * @param { AsyncCallback } callback - Indicates the callback to bindAppProfileId. + * @throws { BusinessError } 401 - Invalid input parameter. + * @throws { BusinessError } 1000900001 - System internal error. + * @throws { BusinessError } 1000900008 - Connect push service failed. + * @throws { BusinessError } 1000900009 - Push service internal error. + * @throws { BusinessError } 1000900010 - Illegal application identity. + * @throws { BusinessError } 1000900015 - The number of bound profile-app relationships exceeds the maximum. + * @throws { BusinessError } 1000900016 - The os distributed account is not logged in. + * @syscap SystemCapability.Push.PushService + * @StageModelOnly + * @since 4.0.0(10) + */ + export function bindAppProfileId(appProfileType: pushCommon.AppProfileType, appProfileId: string, callback: AsyncCallback): void; + /** + * Bind the relationship between the profile and application on the device. + * @param { pushCommon.AppProfileType } appProfileType - The profile type of the application. + * @param { string } appProfileId - The profile id of the application. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - Invalid input parameter. + * @throws { BusinessError } 1000900001 - System internal error. + * @throws { BusinessError } 1000900008 - Connect push service failed. + * @throws { BusinessError } 1000900009 - Push service internal error. + * @throws { BusinessError } 1000900010 - Illegal application identity. + * @throws { BusinessError } 1000900015 - The number of bound profile-app relationships exceeds the maximum. + * @throws { BusinessError } 1000900016 - The os distributed account is not logged in. + * @syscap SystemCapability.Push.PushService + * @StageModelOnly + * @since 4.0.0(10) + */ + export function bindAppProfileId(appProfileType: pushCommon.AppProfileType, appProfileId: string): Promise; + /** + * Unbind the relationship between the profile and application on the device. + * @param { string } appProfileId - The profile id of the application. + * @param { AsyncCallback } callback - Indicates the callback to bindAppProfileId. + * @throws { BusinessError } 401 - Invalid input parameter. + * @throws { BusinessError } 1000900001 - System internal error. + * @throws { BusinessError } 1000900008 - Connect push service failed. + * @throws { BusinessError } 1000900009 - Push service internal error. + * @throws { BusinessError } 1000900010 - Illegal application identity. + * @syscap SystemCapability.Push.PushService + * @StageModelOnly + * @since 4.0.0(10) + */ + export function unbindAppProfileId(appProfileId: string, callback: AsyncCallback): void; + /** + * Unbind the relationship between the profile and application on the device. + * @param { string } appProfileId - The profile id of the application. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - Invalid input parameter. + * @throws { BusinessError } 1000900001 - System internal error. + * @throws { BusinessError } 1000900008 - Connect push service failed. + * @throws { BusinessError } 1000900009 - Push service internal error. + * @throws { BusinessError } 1000900010 - Illegal application identity. + * @syscap SystemCapability.Push.PushService + * @StageModelOnly + * @since 4.0.0(10) + */ + export function unbindAppProfileId(appProfileId: string): Promise; +} +export default pushService; diff --git a/language/arkts/extractor/sdk/hms/ets/api/@hms.core.push.serviceNotification.d.ts b/language/arkts/extractor/sdk/hms/ets/api/@hms.core.push.serviceNotification.d.ts new file mode 100755 index 00000000..5949879c --- /dev/null +++ b/language/arkts/extractor/sdk/hms/ets/api/@hms.core.push.serviceNotification.d.ts @@ -0,0 +1,338 @@ +/* + * Copyright (c) Huawei Technologies Co., Ltd. 2023. All rights reserved. + */ +/** + * @file Defines module of service notification. + * @kit PushKit + */ +import type { AsyncCallback } from '@ohos.base'; +import type Context from '@ohos.inner.application.Context'; +/** + * This module of service notification. + * + * @namespace serviceNotification + * @syscap SystemCapability.Push.PushService + * @StageModelOnly + * @since 4.1.0(11) + */ +/** +* This module of service notification. +* +* @namespace serviceNotification +* @syscap SystemCapability.Push.PushService +* @StageModelOnly +* @atomicservice +* @since 5.0.0(12) +*/ +declare namespace serviceNotification { + /** + * Request subscribe notification. + * + * @param { Context } context - Indicates the context of application or capability. + * @param { Array } entityIds - Indicates ids of the entities to be subscribed. + * @param { AsyncCallback } callback - The callback of requestSubscribeNotification. + * @throws { BusinessError } 401 - Invalid input parameter. + * @throws { BusinessError } 1000900001 - System internal error. + * @throws { BusinessError } 1000900008 - Connect push service failed. + * @throws { BusinessError } 1000900009 - Push service internal error. + * @throws { BusinessError } 1000900010 - Illegal application identity. + * @throws { BusinessError } 1000900011 - Network is unavailable. + * @throws { BusinessError } 1000900017 - Current operation does not support. + * @throws { BusinessError } 1000900018 - Number of calls exceeded. + * @throws { BusinessError } 1000900019 - Illegal entity id. + * @throws { BusinessError } 1000900020 - App token is empty. + * @throws { BusinessError } 1000900021 - App is not available or not registered. + * @throws { BusinessError } 1000900022 - Notification switch off. + * @throws { BusinessError } 1000900023 - Number of entity ids exceed the upper limit. + * @throws { BusinessError } 1000900024 - Failed to display subscription UI. + * @throws { BusinessError } 1000900025 - No rights to access entity id. + * @throws { BusinessError } 1000900026 - Illegal entity type. + * @syscap SystemCapability.Push.PushService + * @StageModelOnly + * @since 4.1.0(11) + */ + export function requestSubscribeNotification(context: Context, entityIds: Array, callback: AsyncCallback): void; + /** + * Request subscribe notification. + * + * @param { Context } context - Indicates the context of application or capability. + * @param { Array } entityIds - Indicates ids of the entities to be subscribed. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - Invalid input parameter. + * @throws { BusinessError } 1000900001 - System internal error. + * @throws { BusinessError } 1000900008 - Connect push service failed. + * @throws { BusinessError } 1000900009 - Push service internal error. + * @throws { BusinessError } 1000900010 - Illegal application identity. + * @throws { BusinessError } 1000900011 - Network is unavailable. + * @throws { BusinessError } 1000900017 - Current operation does not support. + * @throws { BusinessError } 1000900018 - Number of calls exceeded. + * @throws { BusinessError } 1000900019 - Illegal entity id. + * @throws { BusinessError } 1000900020 - App token is empty. + * @throws { BusinessError } 1000900021 - App is not available or not registered. + * @throws { BusinessError } 1000900022 - Notification switch off. + * @throws { BusinessError } 1000900023 - Number of entity ids exceed the upper limit. + * @throws { BusinessError } 1000900024 - Failed to display subscription UI. + * @throws { BusinessError } 1000900025 - No rights to access entity id. + * @throws { BusinessError } 1000900026 - Illegal entity type. + * @syscap SystemCapability.Push.PushService + * @StageModelOnly + * @since 4.1.0(11) + */ + /** + * Request subscribe notification. + * + * @param { Context } context - Indicates the context of application or capability. + * @param { Array } entityIds - Indicates ids of the entities to be subscribed. + * @param { SubscribeNotificationType } type - Indicates subscribe notification type to be subscribed. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - Invalid input parameter. + * @throws { BusinessError } 1000900001 - System internal error. + * @throws { BusinessError } 1000900008 - Connect push service failed. + * @throws { BusinessError } 1000900009 - Push service internal error. + * @throws { BusinessError } 1000900010 - Illegal application identity. + * @throws { BusinessError } 1000900011 - Network is unavailable. + * @throws { BusinessError } 1000900017 - Current operation does not support. + * @throws { BusinessError } 1000900018 - Number of calls exceeded. + * @throws { BusinessError } 1000900019 - Illegal entity id. + * @throws { BusinessError } 1000900020 - App token is empty. + * @throws { BusinessError } 1000900021 - App is not available or not registered. + * @throws { BusinessError } 1000900022 - Notification switch off. + * @throws { BusinessError } 1000900023 - Number of entity ids exceed the upper limit. + * @throws { BusinessError } 1000900024 - Failed to display subscription UI. + * @throws { BusinessError } 1000900025 - No rights to access entity id. + * @throws { BusinessError } 1000900026 - Illegal entity type. + * @throws { BusinessError } 1000900030 - The user has not logged in with HUAWEI ID. + * @syscap SystemCapability.Push.PushService + * @StageModelOnly + * @atomicservice + * @since 5.0.0(12) + */ + export function requestSubscribeNotification(context: Context, entityIds: Array, type?: SubscribeNotificationType): Promise; + /** + * Request result of entity ids. + * + * @typedef RequestResult + * @syscap SystemCapability.Push.PushService + * @StageModelOnly + * @since 4.1.0(11) + */ + /** + * Request result of entity ids. + * + * @typedef RequestResult + * @syscap SystemCapability.Push.PushService + * @StageModelOnly + * @atomicservice + * @since 5.0.0(12) + */ + export interface RequestResult { + /** + * Result of subscribed entities. + * + * @type { Array } + * @readonly + * @syscap SystemCapability.Push.PushService + * @StageModelOnly + * @since 4.1.0(11) + */ + /** + * Result of subscribed entities. + * + * @type { Array } + * @readonly + * @syscap SystemCapability.Push.PushService + * @StageModelOnly + * @atomicservice + * @since 5.0.0(12) + */ + readonly entityResult: Array; + } + /** + * Entity result. + * + * @typedef EntityResult + * @syscap SystemCapability.Push.PushService + * @StageModelOnly + * @since 4.1.0(11) + */ + /** + * Entity result. + * + * @typedef EntityResult + * @syscap SystemCapability.Push.PushService + * @StageModelOnly + * @atomicservice + * @since 5.0.0(12) + */ + export interface EntityResult { + /** + * Entity id. + * + * @type { string } + * @readonly + * @syscap SystemCapability.Push.PushService + * @StageModelOnly + * @since 4.1.0(11) + */ + /** + * Entity id. + * + * @type { string } + * @readonly + * @syscap SystemCapability.Push.PushService + * @StageModelOnly + * @atomicservice + * @since 5.0.0(12) + */ + readonly entityId: string; + /** + * Result code. + * + * @type { ResultCode } + * @readonly + * @syscap SystemCapability.Push.PushService + * @StageModelOnly + * @since 4.1.0(11) + */ + /** + * Result code. + * + * @type { ResultCode } + * @readonly + * @syscap SystemCapability.Push.PushService + * @StageModelOnly + * @atomicservice + * @since 5.0.0(12) + */ + readonly resultCode: ResultCode; + } + /** + * The result code of entity. + * + * @typedef ResultCode + * @syscap SystemCapability.Push.PushService + * @StageModelOnly + * @since 4.1.0(11) + */ + /** + * The result code of entity. + * + * @typedef ResultCode + * @syscap SystemCapability.Push.PushService + * @StageModelOnly + * @atomicservice + * @since 5.0.0(12) + */ + export enum ResultCode { + /** + * Entity is accepted. + * + * @syscap SystemCapability.Push.PushService + * @StageModelOnly + * @since 4.1.0(11) + */ + /** + * Entity is accepted. + * + * @syscap SystemCapability.Push.PushService + * @StageModelOnly + * @atomicservice + * @since 5.0.0(12) + */ + ACCEPTED = 0, + /** + * Entity is rejected + * + * @syscap SystemCapability.Push.PushService + * @StageModelOnly + * @since 4.1.0(11) + */ + /** + * Entity is rejected + * + * @syscap SystemCapability.Push.PushService + * @StageModelOnly + * @atomicservice + * @since 5.0.0(12) + */ + REJECTED = 1, + /** + * Entity is filtered. + * + * @syscap SystemCapability.Push.PushService + * @StageModelOnly + * @since 4.1.0(11) + */ + /** + * Entity is filtered. + * + * @syscap SystemCapability.Push.PushService + * @StageModelOnly + * @atomicservice + * @since 5.0.0(12) + */ + FILTERED = 2, + /** + * Entity is banned. + * + * @syscap SystemCapability.Push.PushService + * @StageModelOnly + * @since 4.1.0(11) + */ + /** + * Entity is banned. + * + * @syscap SystemCapability.Push.PushService + * @StageModelOnly + * @atomicservice + * @since 5.0.0(12) + */ + BANNED = 3, + /** + * Unknown error. + * + * @syscap SystemCapability.Push.PushService + * @StageModelOnly + * @since 4.1.0(11) + */ + /** + * Unknown error. + * + * @syscap SystemCapability.Push.PushService + * @StageModelOnly + * @atomicservice + * @since 5.0.0(12) + */ + UNKNOWN = -1 + } + /** + * The type of the subscribe notification. + * + * @typedef SubscribeNotificationType + * @syscap SystemCapability.Push.PushService + * @StageModelOnly + * @atomicservice + * @since 5.0.0(12) + */ + export enum SubscribeNotificationType { + /** + * Subscribe with token. + * + * @syscap SystemCapability.Push.PushService + * @StageModelOnly + * @atomicservice + * @since 5.0.0(12) + */ + SUBSCRIBE_WITH_TOKEN = 0, + /** + * Subscribe with HuaweiID. + * + * @syscap SystemCapability.Push.PushService + * @StageModelOnly + * @atomicservice + * @since 5.0.0(12) + */ + SUBSCRIBE_WITH_HUAWEI_ID = 1 + } +} +export default serviceNotification; diff --git a/language/arkts/extractor/sdk/hms/ets/api/@hms.core.scan.customScan.d.ts b/language/arkts/extractor/sdk/hms/ets/api/@hms.core.scan.customScan.d.ts new file mode 100755 index 00000000..1cbe5c77 --- /dev/null +++ b/language/arkts/extractor/sdk/hms/ets/api/@hms.core.scan.customScan.d.ts @@ -0,0 +1,231 @@ +/* + * Copyright (c) Huawei Technologies Co., Ltd. 2023-2023. All rights reserved. + */ +/** + * @file This module provides the capabilities to scan barcodes. + * @kit ScanKit + */ +import type { AsyncCallback } from '@ohos.base'; +import type scanBarcode from '@hms.core.scan.scanBarcode'; +/** + * This module provides the capabilities to scan barcodes. + * @namespace customScan + * @syscap SystemCapability.Multimedia.Scan.ScanBarcode + * @since 4.1.0(11) + */ +declare namespace customScan { + /** + * Describes viewControl info. + * @typedef ViewControl + * @syscap SystemCapability.Multimedia.Scan.ScanBarcode + * @since 4.1.0(11) + */ + interface ViewControl { + /** + * The width of XComponent surface. + * @type { number } + * @syscap SystemCapability.Multimedia.Scan.ScanBarcode + * @since 4.1.0(11) + */ + width: number; + /** + * The height of XComponent surface. + * @type { number } + * @syscap SystemCapability.Multimedia.Scan.ScanBarcode + * @since 4.1.0(11) + */ + height: number; + /** + * The surfaceId held by XComponent. + * @type { string } + * @syscap SystemCapability.Multimedia.Scan.ScanBarcode + * @since 4.1.0(11) + */ + surfaceId: string; + } + /** + * Describes scan frame info. + * @typedef ScanFrame + * @syscap SystemCapability.Multimedia.Scan.ScanBarcode + * @since 5.0.0(12) + */ + interface ScanFrame { + /** + * The camera byte buffer. + * @type { ArrayBuffer } + * @syscap SystemCapability.Multimedia.Scan.ScanBarcode + * @since 5.0.0(12) + */ + byteBuffer: ArrayBuffer; + /** + * The scan frame width. + * @type { number } + * @syscap SystemCapability.Multimedia.Scan.ScanBarcode + * @since 5.0.0(12) + */ + width: number; + /** + * The scan frame height. + * @type { number } + * @syscap SystemCapability.Multimedia.Scan.ScanBarcode + * @since 5.0.0(12) + */ + height: number; + /** + * Describes positions of codes. + * @type { ?Array } + * @syscap SystemCapability.Multimedia.Scan.ScanBarcode + * @since 5.0.0(12) + */ + scanCodeRects?: Array; + } + /** + * Init custom scan. + * @permission ohos.permission.CAMERA + * @param { scanBarcode.ScanOptions } options - Option for scan. + * @throws { BusinessError } 401 - The parameter check failed. + * @throws { BusinessError } 1000500001 - Internal error. + * @syscap SystemCapability.Multimedia.Scan.ScanBarcode + * @since 4.1.0(11) + */ + function init(options?: scanBarcode.ScanOptions): void; + /** + * Start custom scan. + * @permission ohos.permission.CAMERA + * @param { ViewControl } viewControl - ViewControl info. + * @param { AsyncCallback> } callback - The callback used to return result of custom scan. + * @throws { BusinessError } 401 - The parameter check failed. + * @throws { BusinessError } 1000500001 - Internal error. + * @syscap SystemCapability.Multimedia.Scan.ScanBarcode + * @since 4.1.0(11) + */ + /** + * Start custom scan. + * @permission ohos.permission.CAMERA + * @param { ViewControl } viewControl - ViewControl info. + * @param { AsyncCallback> } callback - The callback used to return result of custom scan. + * @param { ?AsyncCallback } frameCallback - The callback used to return camera frame. + * @throws { BusinessError } 401 - The parameter check failed. + * @throws { BusinessError } 1000500001 - Internal error. + * @syscap SystemCapability.Multimedia.Scan.ScanBarcode + * @since 5.0.0(12) + */ + function start(viewControl: ViewControl, callback: AsyncCallback>, frameCallback?: AsyncCallback): void; + /** + * Start custom scan. + * @permission ohos.permission.CAMERA + * @param { ViewControl } viewControl - ViewControl info. + * @returns { Promise> } The result returned by the function. + * @throws { BusinessError } 401 - The parameter check failed. + * @throws { BusinessError } 1000500001 - Internal error. + * @syscap SystemCapability.Multimedia.Scan.ScanBarcode + * @since 4.1.0(11) + */ + function start(viewControl: ViewControl): Promise>; + /** + * Stop custom scan. + * @param { AsyncCallback } callback - Indicates the callback to stop custom scan. + * @throws { BusinessError } 1000500001 - Internal error. + * @syscap SystemCapability.Multimedia.Scan.ScanBarcode + * @since 4.1.0(11) + */ + function stop(callback: AsyncCallback): void; + /** + * Stop custom scan. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 1000500001 - Internal error. + * @syscap SystemCapability.Multimedia.Scan.ScanBarcode + * @since 4.1.0(11) + */ + function stop(): Promise; + /** + * Release scan stream. + * @param { AsyncCallback } callback - Indicates the callback to release scan stream. + * @throws { BusinessError } 1000500001 - Internal error. + * @syscap SystemCapability.Multimedia.Scan.ScanBarcode + * @since 4.1.0(11) + */ + function release(callback: AsyncCallback): void; + /** + * Release scan stream. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 1000500001 - Internal error. + * @syscap SystemCapability.Multimedia.Scan.ScanBarcode + * @since 4.1.0(11) + */ + function release(): Promise; + /** + * Open flash light. + * @throws { BusinessError } 1000500001 - Internal error. + * @syscap SystemCapability.Multimedia.Scan.ScanBarcode + * @since 4.1.0(11) + */ + function openFlashLight(): void; + /** + * Close flash light. + * @throws { BusinessError } 1000500001 - Internal error. + * @syscap SystemCapability.Multimedia.Scan.ScanBarcode + * @since 4.1.0(11) + */ + function closeFlashLight(): void; + /** + * Get flash status. + * @return { boolean } true. + * @throws { BusinessError } 1000500001 - Internal error. + * @syscap SystemCapability.Multimedia.Scan.ScanBarcode + * @since 4.1.0(11) + */ + function getFlashLightStatus(): boolean; + /** + * Set camera zoom. + * @param { number } zoomValue - Zoom value. + * @throws { BusinessError } 401 - The parameter check failed. + * @throws { BusinessError } 1000500001 - Internal error. + * @syscap SystemCapability.Multimedia.Scan.ScanBarcode + * @since 5.0.0(12) + */ + function setZoom(zoomValue: number): void; + /** + * Get camera zoom value. + * @return { number } The camera zoom value + * @throws { BusinessError } 1000500001 - Internal error. + * @syscap SystemCapability.Multimedia.Scan.ScanBarcode + * @since 5.0.0(12) + */ + function getZoom(): number; + /** + * Subscribes lightingFlash event callback. + * @param { 'lightingFlash' } type - Event type. + * @param { AsyncCallback } callback - Indicates the callback when receive the lightingFlash event. + * @throws { BusinessError } 1000500001 - Internal error. + * @syscap SystemCapability.Multimedia.Scan.ScanBarcode + * @since 5.0.0(12) + */ + function on(type: 'lightingFlash', callback: AsyncCallback): void; + /** + * Unsubscribes lightingFlash event callback. + * @param { 'lightingFlash' } type - Event type. + * @param { AsyncCallback } callback - Indicates the callback when receive the lightingFlash event. + * @throws { BusinessError } 1000500001 - Internal error. + * @syscap SystemCapability.Multimedia.Scan.ScanBarcode + * @since 5.0.0(12) + */ + function off(type: 'lightingFlash', callback?: AsyncCallback): void; + /** + * Set focus point. + * @param { scanBarcode.Point } point - target focus point. + * @throws { BusinessError } 401 - The parameter check failed. + * @throws { BusinessError } 1000500001 - Internal error. + * @syscap SystemCapability.Multimedia.Scan.ScanBarcode + * @since 5.0.0(12) + */ + function setFocusPoint(point: scanBarcode.Point): void; + /** + * Resets to the default focus mode. + * @throws { BusinessError } 1000500001 - Internal error. + * @syscap SystemCapability.Multimedia.Scan.ScanBarcode + * @since 5.0.0(12) + */ + function resetFocus(): void; +} +export default customScan; diff --git a/language/arkts/extractor/sdk/hms/ets/api/@hms.core.scan.detectBarcode.d.ts b/language/arkts/extractor/sdk/hms/ets/api/@hms.core.scan.detectBarcode.d.ts new file mode 100755 index 00000000..8de7a60c --- /dev/null +++ b/language/arkts/extractor/sdk/hms/ets/api/@hms.core.scan.detectBarcode.d.ts @@ -0,0 +1,148 @@ +/* + * Copyright (c) Huawei Technologies Co., Ltd. 2023-2023. All rights reserved. + */ +/** + * @file This module provides the capabilities to detect barcodes in an image. + * @kit ScanKit + */ +import type { AsyncCallback } from '@ohos.base'; +import type scanBarcode from '@hms.core.scan.scanBarcode'; +/** + * This module provides the capabilities to detect barcodes in an image. + * @namespace detectBarcode + * @syscap SystemCapability.Multimedia.Scan.ScanBarcode + * @since 4.1.0(11) + */ +declare namespace detectBarcode { + /** + * Represents an input image object. + * @typedef InputImage + * @syscap SystemCapability.Multimedia.Scan.ScanBarcode + * @since 4.1.0(11) + */ + interface InputImage { + /** + * The URI of a local image file. + * @type { string } + * @syscap SystemCapability.Multimedia.Scan.ScanBarcode + * @since 4.1.0(11) + */ + uri: string; + } + /** + * Detects barcodes from the specified image. + * @param { InputImage } inputImage - Indicates the input image. + * @param { scanBarcode.ScanOptions } options - Option for detecting barcode. + * @param { AsyncCallback> } callback - The callback used to return result detected in the image. + * @throws { BusinessError } 401 - The parameter check failed. + * @throws { BusinessError } 1000500001 - Internal error. + * @syscap SystemCapability.Multimedia.Scan.ScanBarcode + * @since 4.1.0(11) + */ + function decode(inputImage: InputImage, options: scanBarcode.ScanOptions, callback: AsyncCallback>): void; + /** + * Detects barcodes from the specified image. + * @param { InputImage } inputImage - Indicates the input image. + * @param { AsyncCallback> } callback - The callback used to return result detected in the image. + * @throws { BusinessError } 401 - The parameter check failed. + * @throws { BusinessError } 1000500001 - Internal error. + * @syscap SystemCapability.Multimedia.Scan.ScanBarcode + * @since 4.1.0(11) + */ + function decode(inputImage: InputImage, callback: AsyncCallback>): void; + /** + * Detects barcodes from the supplied image. + * @param { InputImage } inputImage - Indicates the input image. + * @param { scanBarcode.ScanOptions } options - Option for detecting barcode. + * @returns { Promise> } The result detected in the image. + * @throws { BusinessError } 401 - The parameter check failed. + * @throws { BusinessError } 1000500001 - Internal error. + * @syscap SystemCapability.Multimedia.Scan.ScanBarcode + * @since 4.1.0(11) + */ + function decode(inputImage: InputImage, options?: scanBarcode.ScanOptions): Promise>; + /** + * Describes an image represented by a byte array. + * @typedef ByteImage + * @syscap SystemCapability.Multimedia.Scan.ScanBarcode + * @since 5.0.0(12) + */ + interface ByteImage { + /** + * The buffer of the image. + * @type { ArrayBuffer } + * @syscap SystemCapability.Multimedia.Scan.ScanBarcode + * @since 5.0.0(12) + */ + byteBuffer: ArrayBuffer; + /** + * The width of the image. + * @type { number } + * @syscap SystemCapability.Multimedia.Scan.ScanBarcode + * @since 5.0.0(12) + */ + width: number; + /** + * The height of the image. + * @type { number } + * @syscap SystemCapability.Multimedia.Scan.ScanBarcode + * @since 5.0.0(12) + */ + height: number; + /** + * The format of the image. + * @type { ImageFormat } + * @syscap SystemCapability.Multimedia.Scan.ScanBarcode + * @since 5.0.0(12) + */ + format: ImageFormat; + } + /** + * Enumerates image formats. + * @enum { number } + * @syscap SystemCapability.Multimedia.Scan.ScanBarcode + * @since 5.0.0(12) + */ + enum ImageFormat { + /** + * NV21 format. + * @syscap SystemCapability.Multimedia.Scan.ScanBarcode + * @since 5.0.0(12) + */ + NV21 = 0 + } + /** + * Describes detect result info. + * @typedef DetectResult + * @syscap SystemCapability.Multimedia.Scan.ScanBarcode + * @since 5.0.0(12) + */ + interface DetectResult { + /** + * The results detect a byteBuffer image. + * @type { Array } + * @syscap SystemCapability.Multimedia.Scan.ScanBarcode + * @since 5.0.0(12) + */ + scanResults: Array; + /** + * Zoom value. + * @type { number } + * @syscap SystemCapability.Multimedia.Scan.ScanBarcode + * @since 5.0.0(12) + */ + zoomValue: number; + } + /** + * Detects barcodes from the bytebuffer image. + * @param { ByteImage } image - Indicates an image represented by a byte array. + * @param { scanBarcode.ScanOptions } options - Option for detecting barcode. + * @returns { Promise } The result detected in the image. + * @throws { BusinessError } 401 - The parameter check failed. + * @throws { BusinessError } 1000500001 - Internal error. + * @syscap SystemCapability.Multimedia.Scan.ScanBarcode + * @since 5.0.0(12) + */ + function decodeImage(image: ByteImage, options?: scanBarcode.ScanOptions): Promise; +} +export default detectBarcode; diff --git a/language/arkts/extractor/sdk/hms/ets/api/@hms.core.scan.generateBarcode.d.ts b/language/arkts/extractor/sdk/hms/ets/api/@hms.core.scan.generateBarcode.d.ts new file mode 100755 index 00000000..7b99babb --- /dev/null +++ b/language/arkts/extractor/sdk/hms/ets/api/@hms.core.scan.generateBarcode.d.ts @@ -0,0 +1,130 @@ +/* + * Copyright (c) Huawei Technologies Co., Ltd. 2023-2023. All rights reserved. + */ +/** + * @file This module provides the capabilities to generate barcodes. + * @kit ScanKit + */ +import type image from '@ohos.multimedia.image'; +import type { AsyncCallback } from '@ohos.base'; +import type scanCore from '@hms.core.scan.scanCore'; +/** + * This module provides the capabilities to generate barcodes. + * @namespace generateBarcode + * @syscap SystemCapability.Multimedia.Scan.GenerateBarcode + * @since 4.1.0(11) + */ +declare namespace generateBarcode { + /** + * Enum for the QR code error correction level. + * @enum {number} + * @syscap SystemCapability.Multimedia.Scan.GenerateBarcode + * @since 4.1.0(11) + */ + enum ErrorCorrectionLevel { + /** + * QR code correction error level 7%. + * @syscap SystemCapability.Multimedia.Scan.GenerateBarcode + * @since 4.1.0(11) + */ + LEVEL_L = 0, + /** + * QR code correction error level 15%. + * @syscap SystemCapability.Multimedia.Scan.GenerateBarcode + * @since 4.1.0(11) + */ + LEVEL_M = 1, + /** + * QR code correction error level 25%. + * @syscap SystemCapability.Multimedia.Scan.GenerateBarcode + * @since 4.1.0(11) + */ + LEVEL_Q = 2, + /** + * QR code correction error level 30%. + * @syscap SystemCapability.Multimedia.Scan.GenerateBarcode + * @since 4.1.0(11) + */ + LEVEL_H = 3 + } + /** + * Describes createBarcode options. + * @typedef CreateOptions + * @syscap SystemCapability.Multimedia.Scan.GenerateBarcode + * @since 4.1.0(11) + */ + interface CreateOptions { + /** + * The scan types. + * @type { scanCore.ScanType } + * @syscap SystemCapability.Multimedia.Scan.GenerateBarcode + * @since 4.1.0(11) + */ + scanType: scanCore.ScanType; + /** + * The barcode height. + * @type { number } + * @syscap SystemCapability.Multimedia.Scan.GenerateBarcode + * @since 4.1.0(11) + */ + height: number; + /** + * The barcode width. + * @type { number } + * @syscap SystemCapability.Multimedia.Scan.GenerateBarcode + * @since 4.1.0(11) + */ + width: number; + /** + * The background color of image.PixelMap. + * @type { ?number } + * @syscap SystemCapability.Multimedia.Scan.GenerateBarcode + * @since 4.1.0(11) + */ + backgroundColor?: number; + /** + * The barcode color of image.PixelMap. + * @type { ?number } + * @syscap SystemCapability.Multimedia.Scan.GenerateBarcode + * @since 4.1.0(11) + */ + pixelMapColor?: number; + /** + * The margin of the barcode pattern from the surrounding area. + * @type { ?number } + * @syscap SystemCapability.Multimedia.Scan.GenerateBarcode + * @since 4.1.0(11) + */ + margin?: number; + /** + * The percentage of the symbol dedicated to error correction. + * @type { ?ErrorCorrectionLevel } + * @syscap SystemCapability.Multimedia.Scan.GenerateBarcode + * @since 4.1.0(11) + */ + level?: ErrorCorrectionLevel; + } + /** + * Create a barcode. + * @param { string } content - Content for create a barcode. + * @param { CreateOptions } options - Option for create a barcode. + * @returns { Promise } Promise - The image.PixelMap of a barcode. + * @throws { BusinessError } 401 - The parameter check failed. + * @throws { BusinessError } 1000500001 - Internal error. + * @syscap SystemCapability.Multimedia.Scan.GenerateBarcode + * @since 4.1.0(11) + */ + function createBarcode(content: string, options: CreateOptions): Promise; + /** + * Create a barcode. + * @param { string } content - Content for create a barcode. + * @param { CreateOptions } options - Option for create a barcode. + * @param { AsyncCallback } callback - The callback used to return image.PixelMap of a barcode. + * @throws { BusinessError } 401 - The parameter check failed. + * @throws { BusinessError } 1000500001 - Internal error. + * @syscap SystemCapability.Multimedia.Scan.GenerateBarcode + * @since 4.1.0(11) + */ + function createBarcode(content: string, options: CreateOptions, callback: AsyncCallback): void; +} +export default generateBarcode; diff --git a/language/arkts/extractor/sdk/hms/ets/api/@hms.core.scan.scanBarcode.d.ts b/language/arkts/extractor/sdk/hms/ets/api/@hms.core.scan.scanBarcode.d.ts new file mode 100755 index 00000000..fc8f3084 --- /dev/null +++ b/language/arkts/extractor/sdk/hms/ets/api/@hms.core.scan.scanBarcode.d.ts @@ -0,0 +1,271 @@ +/* + * Copyright (c) Huawei Technologies Co., Ltd. 2023-2023. All rights reserved. + */ +/** + * @file This module provides capabilities to scan barcodes, including 1D and 2D barcodes. + * @kit ScanKit + */ +import type { AsyncCallback } from '@ohos.base'; +import type scanCore from '@hms.core.scan.scanCore'; +import type common from '@ohos.app.ability.common'; +/** + * This module provides capabilities to scan barcodes. + * @namespace scanBarcode + * @syscap SystemCapability.Multimedia.Scan.ScanBarcode + * @since 4.0.0(10) + */ +/** + * This module provides capabilities to scan barcodes. + * @namespace scanBarcode + * @syscap SystemCapability.Multimedia.Scan.ScanBarcode + * @atomicservice + * @since 4.1.0(11) + */ +declare namespace scanBarcode { + /** + * Describes start scan options. + * @typedef ScanOptions + * @syscap SystemCapability.Multimedia.Scan.ScanBarcode + * @since 4.0.0(10) + */ + /** + * Describes start scan options. + * @typedef ScanOptions + * @syscap SystemCapability.Multimedia.Scan.ScanBarcode + * @atomicservice + * @since 4.1.0(11) + */ + interface ScanOptions { + /** + * The scan types. + * @type { ?Array } + * @syscap SystemCapability.Multimedia.Scan.ScanBarcode + * @since 4.0.0(10) + */ + /** + * The scan types. + * @type { ?Array } + * @syscap SystemCapability.Multimedia.Scan.ScanBarcode + * @atomicservice + * @since 4.1.0(11) + */ + scanTypes?: Array; + /** + * Enable multiMode. + * @type { ?boolean } + * @syscap SystemCapability.Multimedia.Scan.ScanBarcode + * @since 4.0.0(10) + */ + /** + * Enable multiMode. + * @type { ?boolean } + * @syscap SystemCapability.Multimedia.Scan.ScanBarcode + * @atomicservice + * @since 4.1.0(11) + */ + enableMultiMode?: boolean; + /** + * Enable album. + * @type { ?boolean } + * @syscap SystemCapability.Multimedia.Scan.ScanBarcode + * @since 4.0.0(10) + */ + /** + * Enable album. + * @type { ?boolean } + * @syscap SystemCapability.Multimedia.Scan.ScanBarcode + * @atomicservice + * @since 4.1.0(11) + */ + enableAlbum?: boolean; + } + /** + * Describes the code position. + * @typedef ScanCodeRect + * @syscap SystemCapability.Multimedia.Scan.ScanBarcode + * @since 4.1.0(11) + */ + interface ScanCodeRect { + /** + * The x-coordinate of the upper left corner of the external rectangle of the code. + * @type { number } + * @syscap SystemCapability.Multimedia.Scan.ScanBarcode + * @since 4.1.0(11) + */ + left: number; + /** + * The y-coordinate of the upper left corner of the external rectangle of the code. + * @type { number } + * @syscap SystemCapability.Multimedia.Scan.ScanBarcode + * @since 4.1.0(11) + */ + top: number; + /** + * The x-coordinates of the lower right corner of the external rectangle of the code. + * @type { number } + * @syscap SystemCapability.Multimedia.Scan.ScanBarcode + * @since 4.1.0(11) + */ + right: number; + /** + * The y-coordinate of the lower right corner of the external rectangle of the code. + * @type { number } + * @syscap SystemCapability.Multimedia.Scan.ScanBarcode + * @since 4.1.0(11) + */ + bottom: number; + } + /** + * Point parameter. + * @typedef point + * @syscap SystemCapability.Multimedia.Scan.ScanBarcode + * @since 5.0.0(12) + */ + interface Point { + /** + * Indicates the X coordinate of point. + * @type { number } + * @syscap SystemCapability.Multimedia.Scan.ScanBarcode + * @since 5.0.0(12) + */ + x: number; + /** + * Indicates the Y coordinate of point. + * @type { number } + * @syscap SystemCapability.Multimedia.Scan.ScanBarcode + * @since 5.0.0(12) + */ + y: number; + } + /** + * Describes scan result info. + * @typedef ScanResult + * @syscap SystemCapability.Multimedia.Scan.ScanBarcode + * @since 4.0.0(10) + */ + /** + * Describes scan result info. + * @typedef ScanResult + * @syscap SystemCapability.Multimedia.Scan.ScanBarcode + * @atomicservice + * @since 4.1.0(11) + */ + interface ScanResult { + /** + * The scan result type. + * @type { scanCore.ScanType } + * @syscap SystemCapability.Multimedia.Scan.ScanBarcode + * @since 4.0.0(10) + */ + /** + * The scan result type. + * @type { scanCore.ScanType } + * @syscap SystemCapability.Multimedia.Scan.ScanBarcode + * @atomicservice + * @since 4.1.0(11) + */ + scanType: scanCore.ScanType; + /** + * The scan result value. + * @type { string } + * @syscap SystemCapability.Multimedia.Scan.ScanBarcode + * @since 4.0.0(10) + */ + /** + * The scan result value. + * @type { string } + * @syscap SystemCapability.Multimedia.Scan.ScanBarcode + * @atomicservice + * @since 4.1.0(11) + */ + originalValue: string; + /** + * The scan result rect. + * @type { ?ScanCodeRect } + * @syscap SystemCapability.Multimedia.Scan.ScanBarcode + * @since 4.1.0(11) + */ + scanCodeRect?: ScanCodeRect; + /** + * The scan result corner points. + * @type { ?Array } + * @syscap SystemCapability.Multimedia.Scan.ScanBarcode + * @since 5.0.0(12) + */ + cornerPoints?: Array; + } + /** + * Bring up the scanning UI to scan barcodes. + * @param { ScanOptions } options - option for start scan. + * @param { AsyncCallback } callback - the callback scan result of startScan. + * @throws { BusinessError } 401 - the parameter check failed. + * @syscap SystemCapability.Multimedia.Scan.ScanBarcode + * @since 4.0.0(10) + * @deprecated since 11 + * @useinstead scanBarcode.startScanForResult + */ + function startScan(options: ScanOptions, callback: AsyncCallback): void; + /** + * Bring up the scanning UI to scan a barcode. + * @param { AsyncCallback } callback - the callback scan result of startScan. + * @throws { BusinessError } 401 - the parameter check failed. + * @syscap SystemCapability.Multimedia.Scan.ScanBarcode + * @since 4.0.0(10) + * @deprecated since 11 + * @useinstead scanBarcode.startScanForResult + */ + function startScan(callback: AsyncCallback): void; + /** + * Bring up the scanning UI to scan barcodes. + * @param { ScanOptions } options - Option for start scan. + * @returns { Promise } the scan result returned by the function. + * @throws { BusinessError } 401 - the parameter check failed. + * @syscap SystemCapability.Multimedia.Scan.ScanBarcode + * @since 4.0.0(10) + * @deprecated since 11 + * @useinstead scanBarcode.startScanForResult + */ + function startScan(options?: ScanOptions): Promise; + /** + * Bring up the scanning UI to scan barcodes. + * Note: This function must be called in the ArkUI page context. + * @param { common.Context } context - The context of an ability. + * @param { AsyncCallback } callback - The callback used to return scan result of startScanForResult. + * @throws { BusinessError } 401 - The parameter check failed. + * @throws { BusinessError } 1000500001 - Internal error. + * @syscap SystemCapability.Multimedia.Scan.ScanBarcode + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + function startScanForResult(context: common.Context, callback: AsyncCallback): void; + /** + * Bring up the scanning UI to scan barcodes. + * Note: This function must be called in the ArkUI page context. + * @param { common.Context } context - The context of an ability. + * @param { ScanOptions } options - Option for start scan. + * @param { AsyncCallback } callback - The callback used to return scan result of startScanForResult. + * @throws { BusinessError } 401 - The parameter check failed. + * @throws { BusinessError } 1000500001 - Internal error. + * @syscap SystemCapability.Multimedia.Scan.ScanBarcode + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + function startScanForResult(context: common.Context, options: ScanOptions, callback: AsyncCallback): void; + /** + * Bring up the scanning UI to scan barcodes. + * Note: The function must be called in the ArkUI page context. + * @param { common.Context } context - The context of an ability. + * @param { ScanOptions } options - Option for start scan. + * @returns { Promise } The scan result returned by the function. + * @throws { BusinessError } 401 - The parameter check failed. + * @throws { BusinessError } 1000500001 - Internal error. + * @syscap SystemCapability.Multimedia.Scan.ScanBarcode + * @stagemodelonly + * @atomicservice + * @since 4.1.0(11) + */ + function startScanForResult(context: common.Context, options?: ScanOptions): Promise; +} +export default scanBarcode; diff --git a/language/arkts/extractor/sdk/hms/ets/api/@hms.core.scan.scanCore.d.ts b/language/arkts/extractor/sdk/hms/ets/api/@hms.core.scan.scanCore.d.ts new file mode 100755 index 00000000..7b6ba996 --- /dev/null +++ b/language/arkts/extractor/sdk/hms/ets/api/@hms.core.scan.scanCore.d.ts @@ -0,0 +1,270 @@ +/* + * Copyright (c) Huawei Technologies Co., Ltd. 2023-2023. All rights reserved. + */ +/** + * @file Core data object of ScanKit. + * @kit ScanKit + */ +/** + * Core data object of ScanKit. + * @namespace scanCore + * @syscap SystemCapability.Multimedia.Scan.Core + * @since 4.0.0(10) + */ +/** + * Core data object of ScanKit. + * @namespace scanCore + * @syscap SystemCapability.Multimedia.Scan.Core + * @atomicservice + * @since 4.1.0(11) + */ +declare namespace scanCore { + /** + * Enum for barcode type. + * @enum {number} + * @syscap SystemCapability.Multimedia.Scan.Core + * @since 4.0.0(10) + */ + /** + * Enum for barcode type. + * @enum {number} + * @syscap SystemCapability.Multimedia.Scan.Core + * @atomicservice + * @since 4.1.0(11) + */ + enum ScanType { + /** + * Unknown code + * @syscap SystemCapability.Multimedia.Scan.Core + * @since 4.0.0(10) + */ + /** + * Unknown code + * @syscap SystemCapability.Multimedia.Scan.Core + * @atomicservice + * @since 4.1.0(11) + */ + FORMAT_UNKNOWN = 0, + /** + * Aztec code + * @syscap SystemCapability.Multimedia.Scan.Core + * @since 4.0.0(10) + */ + /** + * Aztec code + * @syscap SystemCapability.Multimedia.Scan.Core + * @atomicservice + * @since 4.1.0(11) + */ + AZTEC_CODE = 1, + /** + * Codabar code + * @syscap SystemCapability.Multimedia.Scan.Core + * @since 4.0.0(10) + */ + /** + * Codabar code + * @syscap SystemCapability.Multimedia.Scan.Core + * @atomicservice + * @since 4.1.0(11) + */ + CODABAR_CODE = 2, + /** + * Code 39 code + * @syscap SystemCapability.Multimedia.Scan.Core + * @since 4.0.0(10) + */ + /** + * Code 39 code + * @syscap SystemCapability.Multimedia.Scan.Core + * @atomicservice + * @since 4.1.0(11) + */ + CODE39_CODE = 3, + /** + * Code 93 code + * @syscap SystemCapability.Multimedia.Scan.Core + * @since 4.0.0(10) + */ + /** + * Code 93 code + * @syscap SystemCapability.Multimedia.Scan.Core + * @atomicservice + * @since 4.1.0(11) + */ + CODE93_CODE = 4, + /** + * Code 128 code + * @syscap SystemCapability.Multimedia.Scan.Core + * @since 4.0.0(10) + */ + /** + * Code 128 code + * @syscap SystemCapability.Multimedia.Scan.Core + * @atomicservice + * @since 4.1.0(11) + */ + CODE128_CODE = 5, + /** + * Data Matrix code + * @syscap SystemCapability.Multimedia.Scan.Core + * @since 4.0.0(10) + */ + /** + * Data Matrix code + * @syscap SystemCapability.Multimedia.Scan.Core + * @atomicservice + * @since 4.1.0(11) + */ + DATAMATRIX_CODE = 6, + /** + * EAN-8 code + * @syscap SystemCapability.Multimedia.Scan.Core + * @since 4.0.0(10) + */ + /** + * EAN-8 code + * @syscap SystemCapability.Multimedia.Scan.Core + * @atomicservice + * @since 4.1.0(11) + */ + EAN8_CODE = 7, + /** + * EAN-13 code + * @syscap SystemCapability.Multimedia.Scan.Core + * @since 4.0.0(10) + */ + /** + * EAN-13 code + * @syscap SystemCapability.Multimedia.Scan.Core + * @atomicservice + * @since 4.1.0(11) + */ + EAN13_CODE = 8, + /** + * ITF-14 code + * @syscap SystemCapability.Multimedia.Scan.Core + * @since 4.0.0(10) + */ + /** + * ITF-14 code + * @syscap SystemCapability.Multimedia.Scan.Core + * @atomicservice + * @since 4.1.0(11) + */ + ITF14_CODE = 9, + /** + * PDF417 code + * @syscap SystemCapability.Multimedia.Scan.Core + * @since 4.0.0(10) + */ + /** + * PDF417 code + * @syscap SystemCapability.Multimedia.Scan.Core + * @atomicservice + * @since 4.1.0(11) + */ + PDF417_CODE = 10, + /** + * QR code + * @syscap SystemCapability.Multimedia.Scan.Core + * @since 4.0.0(10) + */ + /** + * QR code + * @syscap SystemCapability.Multimedia.Scan.Core + * @atomicservice + * @since 4.1.0(11) + */ + QR_CODE = 11, + /** + * UPC-A code + * @syscap SystemCapability.Multimedia.Scan.Core + * @since 4.0.0(10) + */ + /** + * UPC-A code + * @syscap SystemCapability.Multimedia.Scan.Core + * @atomicservice + * @since 4.1.0(11) + */ + UPC_A_CODE = 12, + /** + * UPC-E code + * @syscap SystemCapability.Multimedia.Scan.Core + * @since 4.0.0(10) + */ + /** + * UPC-E code + * @syscap SystemCapability.Multimedia.Scan.Core + * @atomicservice + * @since 4.1.0(11) + */ + UPC_E_CODE = 13, + /** + * MULTIFUNCTIONAL code + * @syscap SystemCapability.Multimedia.Scan.Core + * @since 4.0.0(10) + */ + /** + * MULTIFUNCTIONAL code + * @syscap SystemCapability.Multimedia.Scan.Core + * @atomicservice + * @since 4.1.0(11) + */ + MULTIFUNCTIONAL_CODE = 14, + /** + * One dimension code + * @syscap SystemCapability.Multimedia.Scan.Core + * @since 4.0.0(10) + */ + /** + * One dimension code + * @syscap SystemCapability.Multimedia.Scan.Core + * @atomicservice + * @since 4.1.0(11) + */ + ONE_D_CODE = 100, + /** + * Two dimension code + * @syscap SystemCapability.Multimedia.Scan.Core + * @since 4.0.0(10) + */ + /** + * Two dimension code + * @syscap SystemCapability.Multimedia.Scan.Core + * @atomicservice + * @since 4.1.0(11) + */ + TWO_D_CODE = 101, + /** + * All codes + * @syscap SystemCapability.Multimedia.Scan.Core + * @since 4.0.0(10) + */ + /** + * All codes + * @syscap SystemCapability.Multimedia.Scan.Core + * @atomicservice + * @since 4.1.0(11) + */ + ALL = 1001 + } + /** + * Enumerates the scan error codes. + * @enum { number } + * @syscap SystemCapability.Multimedia.Scan.Core + * @atomicservice + * @since 4.1.0(11) + */ + enum ScanErrorCode { + /** + * Scan service internal error. + * @syscap SystemCapability.Multimedia.Scan.Core + * @atomicservice + * @since 4.1.0(11) + */ + INTERNAL_ERROR = 1000500001 + } +} +export default scanCore; diff --git a/language/arkts/extractor/sdk/hms/ets/api/@hms.filemanagement.filepreview.d.ts b/language/arkts/extractor/sdk/hms/ets/api/@hms.filemanagement.filepreview.d.ts new file mode 100755 index 00000000..1c2c9bc5 --- /dev/null +++ b/language/arkts/extractor/sdk/hms/ets/api/@hms.filemanagement.filepreview.d.ts @@ -0,0 +1,238 @@ +/* + * Copyright (c) Huawei Technologies Co., Ltd. 2023-2023. All rights reserved. + */ +/** + * @file Defines the capabilities of preview module. + * @kit PreviewKit + */ +import type { AsyncCallback } from '@ohos.base'; +/** + * This module provides the capability to preview the file. + * @namespace filePreview + * @syscap SystemCapability.FileManagement.FilePreview.Core + * @atomicservice + * @since 4.1.0(11) + */ +declare namespace filePreview { + /** + * open file preview. display in dialog winodow. Repeated opening within 1 second is invalid. + * + * @param { Context } context - context. + * @param { PreviewInfo } file - file information. + * @param { DisplayInfo } info - window display rect. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - invalid input parameter. + * @syscap SystemCapability.FileManagement.FilePreview.Core + * @atomicservice + * @since 4.1.0(11) + */ + function openPreview(context: Context, file: PreviewInfo, info?: DisplayInfo): Promise; + /** + * open file preview. display in dialog winodow. Repeated opening within 1 second is invalid. + * + * @param { Context } context - context. + * @param { PreviewInfo } file - file information. + * @param { DisplayInfo } info - window display rect. + * @param { AsyncCallback } callback - The callback of the openPreview. + * @throws { BusinessError } 401 - invalid input parameter. + * @syscap SystemCapability.FileManagement.FilePreview.Core + * @atomicservice + * @since 4.1.0(11) + */ + function openPreview(context: Context, file: PreviewInfo, info?: DisplayInfo, callback: AsyncCallback): void; + /** + * Multiple file open preview. Only valid on mobile. Repeated opening within 1 second is invalid. + * + * @param { Context } context - context. + * @param { Array } files - Preview file list. + * @param { number } index - index of select file. Default is zero. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - invalid input parameter. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.FileManagement.FilePreview.Core + * @atomicservice + * @since 5.0.0(12) + */ + function openPreview(context: Context, files: Array, index?: number): Promise; + /** + * Determine whether the file can be previewed + * + * @param { Context } context - context. + * @param { string } uri - file uri. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - invalid input parameter. + * @syscap SystemCapability.FileManagement.FilePreview.Core + * @atomicservice + * @since 4.1.0(11) + */ + function canPreview(context: Context, uri: string): Promise; + /** + * Determine whether the file can be previewed + * + * @param { Context } context - context. + * @param { string } file - file uri. + * @param { AsyncCallback } callback - The callback of the canPreview. + * @throws { BusinessError } 401 - invalid input parameter. + * @syscap SystemCapability.FileManagement.FilePreview.Core + * @atomicservice + * @since 4.1.0(11) + */ + function canPreview(context: Context, uri: string, callback: AsyncCallback): void; + /** + * Is the preview window open + * + * @param { Context } context - context. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - invalid input parameter. + * @syscap SystemCapability.FileManagement.FilePreview.Core + * @atomicservice + * @since 4.1.0(11) + */ + function hasDisplayed(context: Context): Promise; + /** + * Is the preview window open + * + * @param { Context } context - context. + * @param { AsyncCallback } callback - The callback of the hasDisplayed. + * @throws { BusinessError } 401 - invalid input parameter. + * @syscap SystemCapability.FileManagement.FilePreview.Core + * @atomicservice + * @since 4.1.0(11) + */ + function hasDisplayed(context: Context, callback: AsyncCallback): void; + /** + * close the preview window + * + * @param { Context } context - context. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - invalid input parameter. + * @syscap SystemCapability.FileManagement.FilePreview.Core + * @atomicservice + * @since 4.1.0(11) + */ + function closePreview(context: Context): Promise; + /** + * close the preview window + * + * @param { Context } context - context. + * @param { AsyncCallback } callback - The callback of the close. + * @throws { BusinessError } 401 - invalid input parameter. + * @syscap SystemCapability.FileManagement.FilePreview.Core + * @atomicservice + * @since 4.1.0(11) + */ + function closePreview(context: Context, callback: AsyncCallback): void; + /** + * load data when the preview window already existed. Repeated opening within 100 milliseconds is invalid. + * + * @param { Context } context - context. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - invalid input parameter. + * @syscap SystemCapability.FileManagement.FilePreview.Core + * @atomicservice + * @since 4.1.0(11) + */ + function loadData(context: Context, file: PreviewInfo): Promise; + /** + * load data when the preview window already existed. Repeated opening within 100 milliseconds is invalid. + * + * @param { Context } context - context. + * @param { AsyncCallback } callback - The callback of the canPreview. + * @throws { BusinessError } 401 - invalid input parameter. + * @syscap SystemCapability.FileManagement.FilePreview.Core + * @atomicservice + * @since 4.1.0(11) + */ + function loadData(context: Context, file: PreviewInfo, callback: AsyncCallback): void; + /** + * Load multiple files when the preview window already existed. Only valid on mobile. Repeated opening within 100 milliseconds is invalid. + * + * @param { Context } context - context. + * @param { Array } files - Preview file list. + * @param { number } index - index of select file. Default is zero. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - invalid input parameter. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.FileManagement.FilePreview.Core + * @atomicservice + * @since 5.0.0(12) + */ + function loadData(context: Context, files: Array, index?: number): Promise; + /** + * File preview information + * + * @typedef PreviewInfo + * @syscap SystemCapability.FileManagement.FilePreview.Core + * @atomicservice + * @since 4.1.0(11) + */ + interface PreviewInfo { + /** + * title name. + * @type { ?string } + * @syscap SystemCapability.FileManagement.FilePreview.Core + * @atomicservice + * @since 4.1.0(11) + */ + title?: string; + /** + * file uri. + * @type { string } + * @syscap SystemCapability.FileManagement.FilePreview.Core + * @atomicservice + * @since 4.1.0(11) + */ + uri: string; + /** + * file mimeType + * @type { string } + * @syscap SystemCapability.FileManagement.FilePreview.Core + * @atomicservice + * @since 4.1.0(11) + */ + mimeType: string; + } + /** + * Preview window position properties + * + * @typedef DisplayInfo + * @syscap SystemCapability.FileManagement.FilePreview.Core + * @atomicservice + * @since 4.1.0(11) + */ + interface DisplayInfo { + /** + * the display window level x. + * @type { number } + * @syscap SystemCapability.FileManagement.FilePreview.Core + * @atomicservice + * @since 4.1.0(11) + */ + x: number; + /** + * the display window level y. + * @type { number } + * @syscap SystemCapability.FileManagement.FilePreview.Core + * @atomicservice + * @since 4.1.0(11) + */ + y: number; + /** + * the display window width. + * @type { ?number } + * @syscap SystemCapability.FileManagement.FilePreview.Core + * @atomicservice + * @since 4.1.0(11) + */ + width?: number; + /** + * the display window height. + * @type { ?number } + * @syscap SystemCapability.FileManagement.FilePreview.Core + * @atomicservice + * @since 4.1.0(11) + */ + height?: number; + } +} +export default filePreview; diff --git a/language/arkts/extractor/sdk/hms/ets/api/@hms.global.taboo.d.ts b/language/arkts/extractor/sdk/hms/ets/api/@hms.global.taboo.d.ts new file mode 100755 index 00000000..e619b42f --- /dev/null +++ b/language/arkts/extractor/sdk/hms/ets/api/@hms.global.taboo.d.ts @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. All rights reserved. + */ + +/** + * Provides taboo related APIs to deal with political, religious, or cultural data. + * + * @namespace taboo + * @syscap SystemCapability.Global.I18nExt + * @since 4.0.0(10) + */ +declare namespace taboo { + /** + * Provides APIs for obtaining taboo information which is used to avoid political, religious, or cultural complaints. + * + * @syscap SystemCapability.Global.I18nExt + * @since 4.0.0(10) + */ + export class Taboo { + /** + * A constructor used to create a Taboo object. + * + * @syscap SystemCapability.Global.I18nExt + * @since 4.0.0(10) + */ + constructor(); + /** + * Obtain blocked language array. + * + * @returns { Array } a array containing language codes that are not allowed. + * @syscap SystemCapability.Global.I18nExt + * @since 4.0.0(10) + */ + getBlockedLanguages(): Array; + /** + * Obtain blocked region array. + * + * @param { string } language - Specifies the language in which the region is not allowed. + * @returns { Array } a array containing region codes that are not allowed. + * @throws { BusinessError } 401 - check param failed + * @throws { BusinessError } 890001 - param value not valid + * @syscap SystemCapability.Global.I18nExt + * @since 4.0.0(10) + */ + getBlockedRegions(language: string): Array; + /** + * Obtain blocked city array. + * + * @returns { Array } a array containing city codes that are not allowed. + * @syscap SystemCapability.Global.I18nExt + * @since 4.0.0(10) + */ + getBlockedCities(): Array; + } +} +export default taboo; diff --git a/language/arkts/extractor/sdk/hms/ets/api/@hms.health.service.d.ts b/language/arkts/extractor/sdk/hms/ets/api/@hms.health.service.d.ts new file mode 100755 index 00000000..4f9ba31a --- /dev/null +++ b/language/arkts/extractor/sdk/hms/ets/api/@hms.health.service.d.ts @@ -0,0 +1,118 @@ +/* + * Copyright (c) Huawei Technologies Co., Ltd. 2023-2024. All rights reserved. + */ +/** + * @file Defines the capabilities of HealthServiceKit. + * @kit HealthServiceKit + * @bundle com.huawei.hmos.health.kit/HealthService/ets/Index 5.0.0(12) + */ +/** + * This module provides api to comunicates with the health service. + * + * @namespace healthService + * @syscap SystemCapability.Health.HealthService + * @atomicservice + * @since 5.0.0(12) + */ +declare namespace healthService { + /** + * Namespace for daily activity data and api. + * + * @namespace workout + * @syscap SystemCapability.Health.HealthService + * @atomicservice + * @since 5.0.0(12) + */ + namespace workout { + /** + * Reads today's total activity sport. + * + * @returns { Promise } Result of today's total sport record and goals. + * @throws { BusinessError } 201 - Permission verification failed. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 14500101 - Service exception. + * @syscap SystemCapability.Health.HealthService + * @atomicservice + * @since 5.0.0(12) + */ + function readActivityReport(): Promise; + /** + * Provides the data of today's total sport record and goals. + * + * @typedef ActivityReport + * @syscap SystemCapability.Health.HealthService + * @atomicservice + * @since 5.0.0(12) + */ + interface ActivityReport { + /** + * Indicates the value of today's total steps. + * + * @syscap SystemCapability.Health.HealthService + * @atomicservice + * @since 5.0.0(12) + */ + steps: number; + /** + * Indicates the value of today's total step goals. + * + * @syscap SystemCapability.Health.HealthService + * @atomicservice + * @since 5.0.0(12) + */ + stepsGoal?: number; + /** + * Indicates the value of today's total active calories. + * + * @syscap SystemCapability.Health.HealthService + * @atomicservice + * @since 5.0.0(12) + */ + activeCalories: number; + /** + * Indicates the value of today's total active calories goals. + * + * @syscap SystemCapability.Health.HealthService + * @atomicservice + * @since 5.0.0(12) + */ + activeCaloriesGoal?: number; + /** + * Indicates the value of today's total exercise duration. + * Intensity is the cumulative amount of moderate to high-intensity exercise in a day. + * + * @syscap SystemCapability.Health.HealthService + * @atomicservice + * @since 5.0.0(12) + */ + exercise: number; + /** + * Indicates the value of today's total exercise duration goals. + * + * @syscap SystemCapability.Health.HealthService + * @atomicservice + * @since 5.0.0(12) + */ + exerciseGoal?: number; + /** + * Indicates the value of today's total active hours. + * Active hours are the number of hours when standing up for at least 1 minute. + * + * @syscap SystemCapability.Health.HealthService + * @atomicservice + * @since 5.0.0(12) + */ + activeHours: number; + /** + * Indicates the value of today's total active hours goals. + * Active hours are the number of hours when standing up for at least 1 minute. + * + * @syscap SystemCapability.Health.HealthService + * @atomicservice + * @since 5.0.0(12) + */ + activeHoursGoal?: number; + } + } +} +export default healthService; diff --git a/language/arkts/extractor/sdk/hms/ets/api/@hms.health.store.d.ts b/language/arkts/extractor/sdk/hms/ets/api/@hms.health.store.d.ts new file mode 100755 index 00000000..5049cf86 --- /dev/null +++ b/language/arkts/extractor/sdk/hms/ets/api/@hms.health.store.d.ts @@ -0,0 +1,3884 @@ +/* + * Copyright (c) Huawei Technologies Co., Ltd. 2023-2023. All rights reserved. + */ +/** + * @file Defines the capabilities of HealthServiceKit. + * @kit HealthServiceKit + * @bundle com.huawei.hmos.health.kit/HealthStore/ets/Index 5.0.0(12) + */ + +import type common from '@ohos.app.ability.common'; +/** + * This module provides healthStore abilities. + * + * @namespace healthStore + * @syscap SystemCapability.Health.HealthStore + * @atomicservice + * @since 5.0.0(12) + */ +declare namespace healthStore { + /** + * Represents the data types of health data. + * + * @syscap SystemCapability.Health.HealthStore + * @atomicservice + * @since 5.0.0(12) + */ + interface DataType { + /** + * Identity value of data type, should be unique. + * + * @syscap SystemCapability.Health.HealthStore + * @atomicservice + * @since 5.0.0(12) + */ + readonly id: number; + /** + * Identity value of data type, should be unique. + * + * @syscap SystemCapability.Health.HealthStore + * @atomicservice + * @since 5.0.0(12) + */ + readonly name?: string; + } + /** + * Represents the application information. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + interface AppInfo { + /** + * Application bundle name, represents a native application in a consumer device. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + readonly bundleName?: string; + /** + * Application ID, represents an server application which interacts with the Health cloud. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + readonly appId?: string; + /** + * Application name. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + readonly appName?: string; + /** + * Application version. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + readonly version?: string; + } + /** + * Predefined device category. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + enum DeviceCategory { + /** + * Represent a virtual device in which user input the value manually without running real action. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + MANUAL_INPUT = '000', + /** + * Represent smart phone device. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + SMART_PHONE = '00E', + /** + * Represent watch device. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + WEARABLE_WATCH = '06D', + /** + * Represent band device + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + WEARABLE_BAND = '06E', + /** + * Represent head phone device. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + SMART_HEADPHONES = '082', + /** + * Represent weight measurement device. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + HDK_WEIGHT_SCALE = '0CB', + /** + * Represent blood sugar measurement device. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + HDK_BLOOD_SUGAR_MONITOR = '086', + /** + * Represent blood pressure measurement device. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + HDK_BLOOD_PRESSURE_MONITOR = '02B', + /** + * Represent heart rate measurement device. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + HDK_HEART_RATE_MONITOR = '088', + /** + * Represent body temperature measurement device. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + HDK_THERMOMETER = '0B3', + /** + * Represent body oxygen measurement device. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + HDK_BLOOD_OXYGEN_MONITOR = '0B4', + /** + * Represent rope skipping measurement device. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + HDK_ROPE_SKIPPING = '095', + /** + * Represent treadmill. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + HDK_TREADMILL = '08F', + /** + * Represent exercise bike. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + HDK_EXERCISE_BIKE = '0BF', + /** + * Represent rowing machine. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + HDK_ROWING_MACHINE = '0C1', + /** + * Represent elliptical machine. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + HDK_ELLIPTICAL_MACHINE = '0C0', + /** + * Represent walking machine. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + HDK_WALKING_MACHINE = '092', + /** + * Represent SPORTS_GENIE device. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + SPORTS_GENIE = 'A12' + } + /** + * Represents the device information. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + interface DeviceInfo { + /** + * Unique id of the device. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + readonly uniqueId: string; + /** + * Device udid. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + readonly udid?: string; + /** + * Name of the device. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + readonly name?: string; + /** + * Device category. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + readonly category?: DeviceCategory; + /** + * Product id, predefined by Device Profile, check the specification for details. + */ + readonly productId?: string; + /** + * Device model. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + readonly model?: string; + /** + * Name of manufacturer. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + readonly manufacturer?: string; + /** + * Mac address. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + readonly mac?: string; + /** + * Serial number. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + readonly sn?: string; + /** + * Hardware version. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + readonly hardwareVersion?: string; + /** + * Software version. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + readonly softwareVersion?: string; + /** + * Firmware version. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + readonly firmwareVersion?: string; + } + /** + * Represents the data source of health data. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + interface DataSource { + /** + * Identify of this data source. + * Generated by the platform, you cant't change it. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + readonly dataSourceId: string; + /** + * Device information. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + readonly deviceInfo?: DeviceInfo; + /** + * Application information. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + readonly appInfo?: AppInfo; + } + /** + * Represents the data source of health data. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + type DataSourceBase = Omit; + /** + * Represents basic info of health data. + * + * @syscap SystemCapability.Health.HealthStore + * @atomicservice + * @since 5.0.0(12) + */ + interface SampleDataBase { + /** + * Data type of the data. + * + * @syscap SystemCapability.Health.HealthStore + * @atomicservice + * @since 5.0.0(12) + */ + dataType: DataType; + /** + * Data source of the data. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + dataSourceId: string; + /** + * Local date of the data. + * Use Intl.DateTimeFormat 'en-US', that should be 'MM/DD/YYYY' + * + * @syscap SystemCapability.Health.HealthStore + * @atomicservice + * @since 5.0.0(12) + */ + localDate: string; + /** + * Start time of the data, Unix epoch in millisecond. + * + * @syscap SystemCapability.Health.HealthStore + * @atomicservice + * @since 5.0.0(12) + */ + startTime: number; + /** + * End time of the data, Unix epoch in millisecond. + * + * @syscap SystemCapability.Health.HealthStore + * @atomicservice + * @since 5.0.0(12) + */ + endTime: number; + /** + * Time zone of the data. + * In the format `GMT+0800` + * + * @syscap SystemCapability.Health.HealthStore + * @atomicservice + * @since 5.0.0(12) + */ + timeZone: string; + /** + * Create time or modify time of the data, Unix epoch in millisecond. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + modifiedTime: number; + } + /** + * Define the type for field value. + * + * @syscap SystemCapability.Health.HealthStore + * @atomicservice + * @since 5.0.0(12) + */ + type HealthValueType = number | string | boolean; + /** + * Define the type for sequence field value. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + type SequenceValueType = number | string | boolean | object; + /** + * Represents a sample point data. + * SamplePoint defines a model of an instantaneous sample measurement of th target, + * it uses one or more fields to describe the data. + * for example: blood pressure, + * the sampled value is a representation of a certain timestamp, so the startTime is equal to the endTime, + * and it contains three fields to describe it, systolic/diastolic/heartBrat. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + interface SamplePoint = Record> extends SampleDataBase { + /** + * Fields of the data. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + fields: Pick; + } + /** + * Sub data type of a sequence data type. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + type SubDataType = DataType; + /** + * Pace-related value type + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + type PaceValueType = Record; + /** + * Represents an exercise sequence summary data. + * ExerciseSummary defines the statistics of a data type over the period during exercise. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + interface ExerciseSummary { + /** + * Fields of the sequence summary data. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + [P: string]: HealthValueType | PaceValueType; + } + /** + * SequencePoint defines a model of an instantaneous sample data in exercise, + * it uses one or more fields to describe the data. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + interface SequencePoint { + /** + * Start time of the data, Unix epoch in millisecond. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + startTime: number; + /** + * Fields of the data. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + [P: string]: HealthValueType; + } + /** + * Represents a exercise sequence. + * Data of exercise sequence that last for a certain period of time, + * it contains the sequence summary data and detailed sequence points. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + interface ExerciseSequence = Record, DK extends Record = Record> extends SampleDataBase { + /** + * The type of exercise + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + exerciseType: SubDataType; + /** + * Active duration time of the exercise sequence data, Unix epoch in millisecond. + * The start/end time identifies the complete duration of the exercise. + * However, the active duration time can be shorter. + * If no value is assigned, the start/end time is used by default. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + duration?: number; + /** + * Summary data. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + summaries: Pick; + /** + * Detailed data. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + details?: Pick; + } + /** + * Represents a health sequence. + * Data of health sequence that last for a certain period of time, + * it contains the feature fields and associated atomic sampling detailed sequence points. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + interface HealthSequence = Record, DK extends Record = Record> extends SampleDataBase { + /** + * Summary data of HealthSequence. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + summaries: Pick; + /** + * Detailed data associated with the health sequence. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + details?: Pick; + } + /** + * Order of result sort. + * + * @syscap SystemCapability.Health.HealthStore + * @atomicservice + * @since 5.0.0(12) + */ + enum SortOrder { + /** + * In ascending order. + * + * @syscap SystemCapability.Health.HealthStore + * @atomicservice + * @since 5.0.0(12) + */ + ASC = 0, + /** + * In descending order. + * + * @syscap SystemCapability.Health.HealthStore + * @atomicservice + * @since 5.0.0(12) + */ + DESC = 1 + } + /** + * Represents data source options, used for query and delete. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + interface DataSourceOptions { + /** + * A unique data source id to associate a data source. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + dataSourceId?: string; + /** + * A unique device id to associate a device. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + deviceUniqueId?: string; + /** + * App bundle name. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + appBundleName?: string; + /** + * App ID. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + appId?: string; + } + /** + * DataRequest sub-users options + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + interface SubUserOption { + } + /** + * Base interface of request. + * + * @syscap SystemCapability.Health.HealthStore + * @atomicservice + * @since 5.0.0(12) + */ + interface DataRequest { + /** + * Start local date of the data. + * Use Intl.DateTimeFormat 'en-US', that should be 'MM/DD/YYYY' + * + * @syscap SystemCapability.Health.HealthStore + * @atomicservice + * @since 5.0.0(12) + */ + startLocalDate: string; + /** + * End local date of the data. + * Use Intl.DateTimeFormat 'en-US', that should be 'MM/DD/YYYY' + * + * @syscap SystemCapability.Health.HealthStore + * @atomicservice + * @since 5.0.0(12) + */ + endLocalDate: string; + /** + * Start time of request, Unix epoch in millisecond. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + startTime: number; + /** + * End time of request, Unix epoch in millisecond. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + endTime: number; + /** + * Related data source of this request. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + dataSourceOptions?: DataSourceOptions; + } + /** + * Base interface of data read request. + * + * @syscap SystemCapability.Health.HealthStore + * @atomicservice + * @since 5.0.0(12) + */ + interface DataReadRequest extends DataRequest { + /** + * Represents how many records will be read, omitted for read all the data. + * + * @syscap SystemCapability.Health.HealthStore + * @atomicservice + * @since 5.0.0(12) + */ + count?: number; + /** + * Represents the offset relative to the current position. + * + * @syscap SystemCapability.Health.HealthStore + * @atomicservice + * @since 5.0.0(12) + */ + offset?: number; + /** + * Sort order, omitted for ascending order + * + * @syscap SystemCapability.Health.HealthStore + * @atomicservice + * @since 5.0.0(12) + */ + sortOrder?: SortOrder; + } + /** + * Represents SamplePoint read request. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + interface SamplePointReadRequest = Record> extends Omit { + /** + * Related data type(s) of this request. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + samplePointDataType: DataType | DataType[]; + /** + * Fields to read, omitted for read all the fields. + * just set any value to the the expected read field(s), and the system will return the expected field(s). + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + fields?: Partial>; + } + /** + * Define read options when read ExerciseSequence and HealthSequence detail data. + * It's valid to combine any of the options, but withDetails will override withPartialDetails. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + interface SequenceReadOptions = Record> { + /** + * Should read details. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + withDetails?: boolean; + /** + * Should read partial details. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + withPartialDetails?: (keyof DK)[]; + } + /** + * Aggregation policy metrics type + * + * @syscap SystemCapability.Health.HealthStore + * @atomicservice + * @since 5.0.0(12) + */ + type AggregateMetricScope = 'max' | 'min' | 'avg' | 'sum' | 'last' | 'count'; + /** + * aggregation strategies + * + * @syscap SystemCapability.Health.HealthStore + * @atomicservice + * @since 5.0.0(12) + */ + type AggregateMetrics = Partial>; + /** + * Group policies + * + * @syscap SystemCapability.Health.HealthStore + * @atomicservice + * @since 5.0.0(12) + */ + enum GroupUnitType { + /** + * Group By Day + * + * @syscap SystemCapability.Health.HealthStore + * @atomicservice + * @since 5.0.0(12) + */ + DAY = 3 + } + /** + * Represents AggregateRequest group option. + * + * @syscap SystemCapability.Health.HealthStore + * @atomicservice + * @since 5.0.0(12) + */ + interface GroupOption { + /** + * Group policy + * + * @syscap SystemCapability.Health.HealthStore + * @atomicservice + * @since 5.0.0(12) + */ + unitType: GroupUnitType; + /** + * How many group unit + * + * @syscap SystemCapability.Health.HealthStore + * @atomicservice + * @since 5.0.0(12) + */ + duration?: number; + } + /** + * Represents Aggregate read request. + * + * @syscap SystemCapability.Health.HealthStore + * @atomicservice + * @since 5.0.0(12) + */ + interface AggregateRequest = Record, DK extends Record = Record> extends Omit { + /** + * Related data type of this request. + * + * @syscap SystemCapability.Health.HealthStore + * @atomicservice + * @since 5.0.0(12) + */ + dataType: DataType; + /** + * Aggregate metrics to be read + * just set any value to the the expected read field(s), and the system will return the expected field(s). + * + * @syscap SystemCapability.Health.HealthStore + * @atomicservice + * @since 5.0.0(12) + */ + metrics: Partial>; + /** + * Group by + * + * @syscap SystemCapability.Health.HealthStore + * @atomicservice + * @since 5.0.0(12) + */ + groupBy: GroupOption; + } + /** + * Aggregating query results + * + * @syscap SystemCapability.Health.HealthStore + * @atomicservice + * @since 5.0.0(12) + */ + interface AggregateResult = Record> extends Omit { + /** + * Fields to read, omitted for read all the fields. + * just set any value to the the expected read field(s), and the system will return the expected field(s). + * + * @syscap SystemCapability.Health.HealthStore + * @atomicservice + * @since 5.0.0(12) + */ + fields: Pick; + } + /** + * Represents ExerciseSequence read request. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + interface ExerciseSequenceReadRequest = Record> extends Omit { + /** + * Sub data type(s). + * When the value is null, the Sub data type is unlimited. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + exerciseType: SubDataType | SubDataType[] | null; + /** + * Read details options of ExerciseSequence + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + readOptions?: SequenceReadOptions; + } + /** + * Represents HealthSequence read request. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + interface HealthSequenceReadRequest = Record> extends Omit { + /** + * health sequence data type(s) of this request. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + healthSequenceDataType: DataType | DataType[]; + /** + * Read details options of HealthSequence + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + readOptions?: SequenceReadOptions; + } + /** + * Represents unix time based delete request. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + interface UnixTimeBasedDataDeleteRequest extends Omit { + /** + * Related data type(s) of this request. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + dataType: DataType | DataType[]; + } + /** + * Represents sample point delete request. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + type SamplePointDeleteRequest = UnixTimeBasedDataDeleteRequest; + /** + * Represents exercise sequence delete request. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + interface ExerciseSequenceDeleteRequest extends Omit { + /** + * Sub data type(s). + * When the value is null, the Sub data type is unlimited. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + exerciseType: SubDataType | SubDataType[] | null; + } + /** + * Represents health sequence delete request. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + interface HealthSequenceDeleteRequest extends Omit { + /** + * Related health sequence data type(s) of this request. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + healthSequenceDataType: DataType | DataType[]; + } + /** + * Represents read request of data source. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + interface DataSourceReadRequest { + /** + * Identify of a data source. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + dataSourceId?: string; + /** + * Application bundle name. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + bundleName?: string; + /** + * Unique id of the device. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + deviceUniqueId?: string; + } + /** + * Base interface of Authorization. + * + * @syscap SystemCapability.Health.HealthStore + * @atomicservice + * @since 5.0.0(12) + */ + interface AuthorizationBase { + /** + * The data types of read permission required. + * + * @syscap SystemCapability.Health.HealthStore + * @atomicservice + * @since 5.0.0(12) + */ + readDataTypes: DataType[]; + /** + * The data types of write permission required. + * + * @syscap SystemCapability.Health.HealthStore + * @atomicservice + * @since 5.0.0(12) + */ + writeDataTypes: DataType[]; + } + /** + * Parameter for request authorization. + * + * @syscap SystemCapability.Health.HealthStore + * @atomicservice + * @since 5.0.0(12) + */ + interface AuthorizationRequest extends AuthorizationBase { + } + /** + * Response of authorization. + * + * @syscap SystemCapability.Health.HealthStore + * @atomicservice + * @since 5.0.0(12) + */ + interface AuthorizationResponse extends AuthorizationBase { + } + /** + * Init health store module. + * + * @param { common.Context } context - The context of current ability. + * @returns { Promise } Returns void. + * @throws { BusinessError } 401 - Parameter error. + * @syscap SystemCapability.Health.HealthStore + * @atomicservice + * @since 5.0.0(12) + */ + function init(context: common.Context): Promise; + /** + * API of manipulate the data source. + */ + /** + * Read data source. + * + * @param { DataSourceReadRequest } request - Data source to read. + * @returns { Promise } Result of data source array. + * @throws { BusinessError } 201 - Permission verification failed. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 1002700001 - System internal error. + * @throws { BusinessError } 1002700002 - Database processing error. + * @throws { BusinessError } 1002701001 - Network error. The network is unavailable. + * @throws { BusinessError } 1002702001 - Account error. The user has not logged in with HUAWEI ID. + * @throws { BusinessError } 1002702002 - Account error. Failed to obtain account information with HUAWEI ID. + * @throws { BusinessError } 1002703001 - User privacy is not agreed. + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + function readDataSource(request: DataSourceReadRequest): Promise; + /** + * Insert data source. + * + * @param DataSourceBase Data source to insert. + * @returns { Promise } Returned a data source id. + * @throws { BusinessError } 201 - Permission verification failed. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 1002700001 - System internal error. + * @throws { BusinessError } 1002700002 - Database processing error. + * @throws { BusinessError } 1002701001 - Network error. The network is unavailable. + * @throws { BusinessError } 1002702001 - Account error. The user has not logged in with HUAWEI ID. + * @throws { BusinessError } 1002702002 - Account error. Failed to obtain account information with HUAWEI ID. + * @throws { BusinessError } 1002703001 - User privacy is not agreed. + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + function insertDataSource(dataSource: DataSourceBase): Promise; + /** + * Update data source. + * + * @param dataSource Data source to update. + * @returns { Promise } Returned promise. + * @throws { BusinessError } 201 - Permission verification failed. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 1002700001 - System internal error. + * @throws { BusinessError } 1002700002 - Database processing error. + * @throws { BusinessError } 1002701001 - Network error. The network is unavailable. + * @throws { BusinessError } 1002702001 - Account error. The user has not logged in with HUAWEI ID. + * @throws { BusinessError } 1002702002 - Account error. Failed to obtain account information with HUAWEI ID. + * @throws { BusinessError } 1002703001 - User privacy is not agreed. + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + function updateDataSource(dataSource: DataSource): Promise; + /** + * API of manipulate the data store + */ + /** + * Read sample point data from the health data store. + * + * @param { SamplePointReadRequest } request - A request of data read. + * @returns { Promise } Result of health data array. + * @throws { BusinessError } 201 - Permission verification failed. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 1002700001 - System internal error. + * @throws { BusinessError } 1002700002 - Database processing error. + * @throws { BusinessError } 1002701001 - Network error. The network is unavailable. + * @throws { BusinessError } 1002702001 - Account error. The user has not logged in with HUAWEI ID. + * @throws { BusinessError } 1002702002 - Account error. Failed to obtain account information with HUAWEI ID. + * @throws { BusinessError } 1002703001 - User privacy is not agreed. + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + function readData(request: SamplePointReadRequest): Promise; + /** + * Read exercise sequence data from the health data store. + * + * @param { ExerciseSequenceReadRequest } request - A request of data read. + * @returns { Promise } Result of health data array. + * @throws { BusinessError } 201 - Permission verification failed. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 1002700001 - System internal error. + * @throws { BusinessError } 1002700002 - Database processing error. + * @throws { BusinessError } 1002701001 - Network error. The network is unavailable. + * @throws { BusinessError } 1002702001 - Account error. The user has not logged in with HUAWEI ID. + * @throws { BusinessError } 1002702002 - Account error. Failed to obtain account information with HUAWEI ID. + * @throws { BusinessError } 1002703001 - User privacy is not agreed. + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + function readData(request: ExerciseSequenceReadRequest): Promise; + /** + * Read health sequence data from the health data store. + * + * @param { HealthSequenceReadRequest } request - A request of data read. + * @returns { Promise } Result of health data array. + * @throws { BusinessError } 201 - Permission verification failed. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 1002700001 - System internal error. + * @throws { BusinessError } 1002700002 - Database processing error. + * @throws { BusinessError } 1002701001 - Network error. The network is unavailable. + * @throws { BusinessError } 1002702001 - Account error. The user has not logged in with HUAWEI ID. + * @throws { BusinessError } 1002702002 - Account error. Failed to obtain account information with HUAWEI ID. + * @throws { BusinessError } 1002703001 - User privacy is not agreed. + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + function readData(request: HealthSequenceReadRequest): Promise; + /** + * aggregate data from the health data store. + * + * @param { AggregateRequest } request - A request of data aggregate. + * @returns { Promise } Result of health data array. + * @throws { BusinessError } 201 - Permission verification failed. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 1002700001 - System internal error. + * @throws { BusinessError } 1002700002 - Database processing error. + * @throws { BusinessError } 1002701001 - Network error. The network is unavailable. + * @throws { BusinessError } 1002702001 - Account error. The user has not logged in with HUAWEI ID. + * @throws { BusinessError } 1002702002 - Account error. Failed to obtain account information with HUAWEI ID. + * @throws { BusinessError } 1002703001 - User privacy is not agreed. + * @syscap SystemCapability.Health.HealthStore + * @atomicservice + * @since 5.0.0(12) + */ + function aggregateData(request: AggregateRequest): Promise; + /** + * Save sample point data to health data store. + * + * @param sampleData Health data to be saved. + * @returns { Promise } Returned Promise. + * @throws { BusinessError } 201 - Permission verification failed. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 1002700001 - System internal error. + * @throws { BusinessError } 1002700002 - Database processing error. + * @throws { BusinessError } 1002701001 - Network error. The network is unavailable. + * @throws { BusinessError } 1002702001 - Account error. The user has not logged in with HUAWEI ID. + * @throws { BusinessError } 1002702002 - Account error. Failed to obtain account information with HUAWEI ID. + * @throws { BusinessError } 1002703001 - User privacy is not agreed. + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + function saveData(sampleData: SamplePoint[] | SamplePoint): Promise; + /** + * Save exercise sequence data to health data store. + * + * @param exerciseSequence Health data to be saved. + * @returns { Promise } Returned Promise. + * @throws { BusinessError } 201 - Permission verification failed. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 1002700001 - System internal error. + * @throws { BusinessError } 1002700002 - Database processing error. + * @throws { BusinessError } 1002701001 - Network error. The network is unavailable. + * @throws { BusinessError } 1002702001 - Account error. The user has not logged in with HUAWEI ID. + * @throws { BusinessError } 1002702002 - Account error. Failed to obtain account information with HUAWEI ID. + * @throws { BusinessError } 1002703001 - User privacy is not agreed. + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + function saveData(exerciseSequence: ExerciseSequence[] | ExerciseSequence): Promise; + /** + * Save health sequence data to health data store. + * + * @param healthSequence Health data to be saved. + * @returns { Promise } Returned Promise. + * @throws { BusinessError } 201 - Permission verification failed. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 1002700001 - System internal error. + * @throws { BusinessError } 1002700002 - Database processing error. + * @throws { BusinessError } 1002701001 - Network error. The network is unavailable. + * @throws { BusinessError } 1002702001 - Account error. The user has not logged in with HUAWEI ID. + * @throws { BusinessError } 1002702002 - Account error. Failed to obtain account information with HUAWEI ID. + * @throws { BusinessError } 1002703001 - User privacy is not agreed. + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + function saveData(healthSequence: HealthSequence[] | HealthSequence): Promise; + /** + * Delete data based on request. + * + * @param request request to delete. + * @returns { Promise } Returned promise. + * @throws { BusinessError } 201 - Permission verification failed. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 1002700001 - System internal error. + * @throws { BusinessError } 1002700002 - Database processing error. + * @throws { BusinessError } 1002701001 - Network error. The network is unavailable. + * @throws { BusinessError } 1002702001 - Account error. The user has not logged in with HUAWEI ID. + * @throws { BusinessError } 1002702002 - Account error. Failed to obtain account information with HUAWEI ID. + * @throws { BusinessError } 1002703001 - User privacy is not agreed. + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + function deleteData(request: SamplePointDeleteRequest): Promise; + /** + * Delete exercise sequence data based on request. + * + * @param request request to delete. + * @returns { Promise } Returned promise. + * @throws { BusinessError } 201 - Permission verification failed. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 1002700001 - System internal error. + * @throws { BusinessError } 1002700002 - Database processing error. + * @throws { BusinessError } 1002701001 - Network error. The network is unavailable. + * @throws { BusinessError } 1002702001 - Account error. The user has not logged in with HUAWEI ID. + * @throws { BusinessError } 1002702002 - Account error. Failed to obtain account information with HUAWEI ID. + * @throws { BusinessError } 1002703001 - User privacy is not agreed. + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + function deleteData(request: ExerciseSequenceDeleteRequest): Promise; + /** + * Delete health sequence data based on request. + * + * @param request request to delete. + * @returns { Promise } Returned promise. + * @throws { BusinessError } 201 - Permission verification failed. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 1002700001 - System internal error. + * @throws { BusinessError } 1002700002 - Database processing error. + * @throws { BusinessError } 1002701001 - Network error. The network is unavailable. + * @throws { BusinessError } 1002702001 - Account error. The user has not logged in with HUAWEI ID. + * @throws { BusinessError } 1002702002 - Account error. Failed to obtain account information with HUAWEI ID. + * @throws { BusinessError } 1002703001 - User privacy is not agreed. + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + function deleteData(request: HealthSequenceDeleteRequest): Promise; + /** + * Delete the given sample point data. + * + * @param samplePoint Data to be deleted. + * @returns { Promise } Returned promise. + * @throws { BusinessError } 201 - Permission verification failed. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 1002700001 - System internal error. + * @throws { BusinessError } 1002700002 - Database processing error. + * @throws { BusinessError } 1002701001 - Network error. The network is unavailable. + * @throws { BusinessError } 1002702001 - Account error. The user has not logged in with HUAWEI ID. + * @throws { BusinessError } 1002702002 - Account error. Failed to obtain account information with HUAWEI ID. + * @throws { BusinessError } 1002703001 - User privacy is not agreed. + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + function deleteData(samplePoint: SamplePoint | SamplePoint[]): Promise; + /** + * Delete the given exercise sequence data. + * + * @param exerciseSequence Data to be deleted. + * @returns { Promise } Returned promise. + * @throws { BusinessError } 201 - Permission verification failed. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 1002700001 - System internal error. + * @throws { BusinessError } 1002700002 - Database processing error. + * @throws { BusinessError } 1002701001 - Network error. The network is unavailable. + * @throws { BusinessError } 1002702001 - Account error. The user has not logged in with HUAWEI ID. + * @throws { BusinessError } 1002702002 - Account error. Failed to obtain account information with HUAWEI ID. + * @throws { BusinessError } 1002703001 - User privacy is not agreed. + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + function deleteData(exerciseSequence: ExerciseSequence | ExerciseSequence[]): Promise; + /** + * Delete the given health sequence data. + * + * @param healthSequence Data to be deleted. + * @returns { Promise } Returned promise. + * @throws { BusinessError } 201 - Permission verification failed. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 1002700001 - System internal error. + * @throws { BusinessError } 1002700002 - Database processing error. + * @throws { BusinessError } 1002701001 - Network error. The network is unavailable. + * @throws { BusinessError } 1002702001 - Account error. The user has not logged in with HUAWEI ID. + * @throws { BusinessError } 1002702002 - Account error. Failed to obtain account information with HUAWEI ID. + * @throws { BusinessError } 1002703001 - User privacy is not agreed. + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + function deleteData(healthSequence: HealthSequence | HealthSequence[]): Promise; + /** + * Request authorizations. + * + * @param context UIAbilityContext. + * @param request authorizations request. + * @returns { Promise } Returned promise. + * @throws { BusinessError } 201 - Permission verification failed. + * @throws { BusinessError } 401 - Parameter error. + * @syscap SystemCapability.Health.HealthStore + * @atomicservice + * @since 5.0.0(12) + */ + function requestAuthorizations(context: common.UIAbilityContext, request: AuthorizationRequest): Promise; + /** + * Query authorizations. + * + * @param request query authorizations request. + * @returns { Promise } Returned promise. + * @throws { BusinessError } 201 - Permission verification failed. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 1002701001 - Network error. The network is unavailable. + * @throws { BusinessError } 1002702001 - Account error. The user has not logged in with HUAWEI ID. + * @throws { BusinessError } 1002702002 - Account error. Failed to obtain account information with HUAWEI ID. + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + function getAuthorizations(request: AuthorizationRequest): Promise; + /** + * Cancel authorizations. + * + * @returns { Promise } Returned promise. + * @throws { BusinessError } 201 - Permission verification failed. + * @syscap SystemCapability.Health.HealthStore + * @atomicservice + * @since 5.0.0(12) + */ + function cancelAuthorizations(): Promise; + /** + * Define all the data types constant. + * + * @namespace healthDataTypes + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + namespace healthDataTypes { + /** + * Constant definition of the SamplePoint dataType daily activities. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + const DAILY_ACTIVITIES: healthStore.DataType; + /** + * Constant definition of the SamplePoint dataType heart rate. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + const HEART_RATE: healthStore.DataType; + /** + * Constant definition of the SamplePoint dataType blood oxygen saturation. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + const BLOOD_OXYGEN_SATURATION: healthStore.DataType; + /** + * Constant definition of the SamplePoint dataType stress. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + const STRESS: healthStore.DataType; + /** + * Constant definition of the SamplePoint dataType body temperature. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + const BODY_TEMPERATURE: healthStore.DataType; + /** + * Constant definition of the HealthSequence dataType sleep record. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + const SLEEP_RECORD: healthStore.DataType; + /** + * Constant definition of the HealthSequence dataType nap record. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + const SLEEP_NAP_RECORD: healthStore.DataType; + /** + * Constant definition of the ExerciseSequence dataType workout. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + const WORKOUT: healthStore.DataType; + /** + * Constant definition of the ExerciseSequence exerciseType running. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + const RUNNING: healthStore.SubDataType; + /** + * Constant definition of the ExerciseSequence exerciseType indoor running. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + const INDOOR_RUNNING: healthStore.SubDataType; + /** + * Constant definition of the ExerciseSequence exerciseType trail running. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + const TRAIL_RUNNING: healthStore.SubDataType; + /** + * Constant definition of the ExerciseSequence exerciseType walking. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + const WALKING: healthStore.SubDataType; + /** + * Constant definition of the ExerciseSequence exerciseType indoor walking. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + const INDOOR_WALKING: healthStore.SubDataType; + /** + * Constant definition of the ExerciseSequence exerciseType hiking. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + const HIKING: healthStore.SubDataType; + /** + * Constant definition of the ExerciseSequence exerciseType cycling. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + const CYCLING: healthStore.SubDataType; + /** + * Constant definition of the ExerciseSequence exerciseType indoor cycling. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + const INDOOR_CYCLING: healthStore.SubDataType; + /** + * Constant definition of the ExerciseSequence exerciseType spinning. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + const SPINNING: healthStore.SubDataType; + /** + * Constant definition of the ExerciseSequence exerciseType jumping rope. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + const JUMPING_ROPE: healthStore.SubDataType; + } + /** + * Define data model field structures used in the health store. + * + * @namespace healthFields + * @syscap SystemCapability.Health.HealthStore + * @atomicservice + * @since 5.0.0(12) + */ + namespace healthFields { + /** + * Define the type for daily activities SamplePoint structure. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + type DailyActivities = { + /** + * Number of daily activities step, value must be [0, ∞). + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + step: number; + /** + * Number of daily activities calorie in calories, value must be [0, ∞). + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + calorie: number; + /** + * Number of daily activities distance in meters, value must be [0, ∞). + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + distance: number; + /** + * Duration of daily activities in milliseconds, value must be [0, ∞). + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + duration?: number; + /** + * Status of daily activities. + * The possible status values are as follows: + * 2: Mountaineering + * 3: Cycling + * 4: running + * 5: walking + * 9: Swimming + * 10: Fitness + * 13: standing + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + status?: number; + /** + * Intensity status of daily activities, + * The possible status values are as follows: + * 0: not intensity status + * 1: intensity status + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + isIntensity?: number; + /** + * Number of daily activities climb high altitude in meters. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + climbHighAltitude?: number; + /** + * Stand status of daily activities. + * The possible status values are as follows: + * 0: is not stand status + * 1: stand status + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + isStand?: number; + }; + /** + * Define the type for daily activities aggregation structure. + * + * @syscap SystemCapability.Health.HealthStore + * @atomicservice + * @since 5.0.0(12) + */ + type DailyActivitiesAggregation = { + /** + * Sum of daily activities step. + * + * @syscap SystemCapability.Health.HealthStore + * @atomicservice + * @since 5.0.0(12) + */ + step: Omit; + /** + * Sum of daily activities calorie. + * + * @syscap SystemCapability.Health.HealthStore + * @atomicservice + * @since 5.0.0(12) + */ + calorie: Omit; + /** + * Sum of daily activities distance. + * + * @syscap SystemCapability.Health.HealthStore + * @atomicservice + * @since 5.0.0(12) + */ + distance: Omit; + /** + * Sum of daily activities climb high altitude. + * + * @syscap SystemCapability.Health.HealthStore + * @atomicservice + * @since 5.0.0(12) + */ + climbHighAltitude: Omit; + /** + * Sum of daily activities intensity status. + * + * @syscap SystemCapability.Health.HealthStore + * @atomicservice + * @since 5.0.0(12) + */ + isIntensity: Omit; + /** + * Sum of daily activities stand status. + * + * @syscap SystemCapability.Health.HealthStore + * @atomicservice + * @since 5.0.0(12) + */ + isStand: Omit; + }; + /** + * Define the type for heart rate SamplePoint structure. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + type HeartRate = { + /** + * Heart rate in beats per minute, value must be [0, ∞). + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + bpm: number; + }; + /** + * Define the type for blood oxygen saturation SamplePoint structure. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + type BloodOxygenSaturation = { + /** + * Blood oxygen saturation level, value must be (0, 100]. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + spo2: number; + }; + /** + * Define the type for stress SamplePoint structure. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + type Stress = { + /** + * Stress score, value must be [1, 99]. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + stressScore: number; + }; + /** + * Define the type for body temperature SamplePoint structure. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + type BodyTemperature = { + /** + * Body temperature in degrees Celsius, value must be [34, 42]. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + bodyTemperature: number; + }; + /** + * Define exerciseSequence summary data structure + */ + /** + * Define the type for steps exerciseSummary structure. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + type StepSummary = { + /** + * Total number of steps for exerciseSequence, value must be (0, ∞). + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + totalSteps: number; + }; + /** + * Define the type for distance exerciseSummary structure. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + type DistanceSummary = { + /** + * Total distance for exerciseSequence in meters, value must be (0, ∞). + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + totalDistance: number; + }; + /** + * Define the type for calorie exerciseSummary structure. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + type CalorieSummary = { + /** + * Total number of calories for exerciseSequence in calories, value must be (0, ∞). + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + totalCalories: number; + }; + /** + * Define the type for quantity exerciseSummary structure. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + type QuantitySummary = { + /** + * Average quantity for exerciseSequence, value must be [0, ∞). + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + avg: number; + /** + * Maximum quantity for exerciseSequence, value must be [0, ∞). + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + max: number; + /** + * Minimum quantity for exerciseSequence, value must be [0, ∞). + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + min?: number; + }; + /** + * Define the type for exercise heart rate summary structure. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + type ExerciseHeartRateSummary = QuantitySummary; + /** + * Define the type for speed summary structure. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + type SpeedSummary = QuantitySummary; + /** + * Define the type for cadence summary structure. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + type CadenceSummary = QuantitySummary; + /** + * Define the type for running form summary structure. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + type RunningFormSummary = { + /** + * Average ground contact time for exerciseSequence in milliseconds, value must be [0, 5000]. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + avgGroundContactTime: number; + /** + * Average ground impact acceleration for exerciseSequence in G-forces. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + avgGroundImpactAcceleration?: number; + /** + * Average swing angle for exerciseSequence in degree. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + avgSwingAngle?: number; + /** + * Average eversion excursion for exerciseSequence in degree. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + avgEversionExcursion?: number; + /** + * Average hang time for exerciseSequence in milliseconds. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + avgHangTime?: number; + /** + * Average rate of ground contact time to hang time for exerciseSequence. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + avgGroundHangTimeRate?: number; + /** + * Fore foot strike pattern for exerciseSequence. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + foreFootStrikePattern?: number; + /** + * Hind foot strike pattern for exerciseSequence. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + hindFootStrikePattern?: number; + /** + * Whole foot strike pattern for exerciseSequence. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + wholeFootStrikePattern?: number; + /** + * Average impact peak for exerciseSequence in BW(multiples of body weight). + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + avgImpactPeak?: number; + /** + * Average vertical impact rate for exerciseSequence in BW/S. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + avgVerticalImpactRate?: number; + /** + * Average vertical oscillation for exerciseSequence in centimeters. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + avgVerticalOscillation?: number; + /** + * Average vertical ratio for exerciseSequence in percentage. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + avgVerticalRatio?: number; + /** + * Average gc time balance for exerciseSequence, percentage of ground contact duration of the left foot + * as compared to the ground contact duration of both feet (that of the right foot is 100% minus this value). + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + avgGcTimeBalance?: number; + }; + /** + * Define the type for altitude summary structure. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + type AltitudeSummary = { + /** + * Maximum altitude for exerciseSequence. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + max: number; + /** + * Minimum altitude for exerciseSequence. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + min: number; + /** + * Average altitude for exerciseSequence. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + avg?: number; + /** + * Total ascent for exerciseSequence, value must be [0, ∞). + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + totalAscent?: number; + /** + * Total descent for exerciseSequence, value must be [0, ∞). + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + totalDescent?: number; + }; + /** + * Define the type for location summary structure. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + type LocationSummary = { + /** + * Starting latitude for exerciseSequence, value must be [-90, 90]. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + startLat?: number; + /** + * Ending latitude for exerciseSequence, value must be [-90, 90]. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + endLat?: number; + /** + * Starting longitude for exerciseSequence, value must be [-180, 180]. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + startLon?: number; + /** + * Ending longitude for exerciseSequence, value must be [-180, 180]. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + endLon?: number; + /** + * Coordinate information for exerciseSequence. + * The possible values are: 'GCJ02', 'WGS84', 'BD09' + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + coordinate: string; + }; + /** + * Define the type for pedaling cadence summary structure. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + type PedalingCadenceSummary = QuantitySummary; + /** + * Define the type for power summary structure. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + type PowerSummary = QuantitySummary; + /** + * Define the type for skip speed summary structure. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + type SkipSpeedSummary = QuantitySummary; + /** + * Define the type for resistance exerciseSummary structure. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + type ResistanceSummary = { + /** + * Resistance level one lower limit, value must be [1, 100]. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + resLv1LowerLimit: number; + /** + * Resistance level two lower limit, value must be [1, 100]. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + resLv2LowerLimit: number; + /** + * Resistance level three lower limit, value must be [1, 100]. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + resLv3LowerLimit: number; + /** + * Resistance level four lower limit, value must be [1, 100]. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + resLv4LowerLimit: number; + /** + * Resistance level five lower limit, value must be [1, 100]. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + resLv5LowerLimit: number; + /** + * Resistance level five upper limit, value must be [1, 100]. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + resLv5UpperLimit: number; + /** + * Resistance level one duration in minute, value must be [0, ∞). + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + resLv1Duration: number; + /** + * Resistance level two duration in minute, value must be [0, ∞). + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + resLv2Duration: number; + /** + * Resistance level three duration in minute, value must be [0, ∞). + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + resLv3Duration: number; + /** + * Resistance level four duration in minute, value must be [0, ∞). + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + resLv4Duration: number; + /** + * Resistance level five duration in minute, value must be [0, ∞). + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + resLv5Duration: number; + /** + * Maximum resistance level, value must be [1, 100]. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + maxRes?: number; + /** + * Minimum resistance level, value must be [1, 100]. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + minRes?: number; + }; + /** + * Define the type for running exercise feature structure. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + type RunningFeature = { + /** + * Average pace for running exercise in second/km, value must be [0, ∞). + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + avgPace: number; + /** + * Best pace for running exercise in second/km, value must be [0, ∞). + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + bestPace: number; + /** + * Pace map for running exercise. + * This field indicates the pace information per kilometer. The unit is second/km. + * For example: + * '1.0':407.945 + * '2.0':473.98846 + * '2.170':473.98846 + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + paceMap?: healthStore.PaceValueType; + /** + * Part time map for running exercise. + * Segmental data (key: kilometer; value: second) + * When km is used, the distance value is accurate to the fourth decimal place. + * Value is the time taken to cover the current distance. + * '1.0':3.0 + * '2.0':6.0 + * '3.0':9.0 + * '21.0975':7020.0 + * '42.195':18000.0 + * Where, 21.0975 and 42.195 are the distances of the half Marathon and full Marathon, respectively. + * Except for these two types of race, the first decimal place is 0. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + partTimeMap?: healthStore.PaceValueType; + }; + /** + * Define the type for jumping rope exercise feature structure. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + type JumpingRopeFeature = { + /** + * Number of skips for jumping rope exercise, value must be [0, ∞). + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + skipNum: number; + /** + * Number of interruptions for jumping rope exercise, value must be [0, ∞). + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + interruptions?: number; + /** + * Longest streak for jumping rope exercise, value must be [0, ∞). + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + longestStreak?: number; + /** + * Number of double unders for jumping rope exercise, value must be [0, ∞). + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + doubleUnders?: number; + /** + * Number of triple unders for jumping rope exercise, value must be [0, ∞). + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + tripleUnders?: number; + }; + /** + * Define the type for walking exercise summary structure. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + type WalkingSummary = { + /** + * Summary of the distance covered during walking exercise. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + distance: DistanceSummary; + /** + * Summary of the calories burned during walking exercise. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + calorie: CalorieSummary; + /** + * Summary of the speed during walking exercise. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + speed: SpeedSummary; + /** + * Summary of the heart rate during walking exercise. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + exerciseHeartRate?: ExerciseHeartRateSummary; + /** + * Summary of the steps taken during walking exercise. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + step?: StepSummary; + /** + * Summary of the cadence during walking exercise. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + cadence?: CadenceSummary; + /** + * Summary of the altitude during walking exercise. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + altitude?: AltitudeSummary; + /** + * Summary of the location during walking exercise. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + location?: LocationSummary; + }; + /** + * Define the type for running exerciseSummary structure. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + type RunningSummary = { + /** + * Distance summary for running exerciseSequence + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + distance: DistanceSummary; + /** + * Calorie summary for running exerciseSequence + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + calorie: CalorieSummary; + /** + * Speed summary for running exerciseSequence + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + speed: SpeedSummary; + /** + * Exercise heart rate summary for running exerciseSequence + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + exerciseHeartRate?: ExerciseHeartRateSummary; + /** + * Step summary for running exerciseSequence + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + step?: StepSummary; + /** + * Cadence summary for running exerciseSequence + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + cadence?: CadenceSummary; + /** + * Altitude summary for running exerciseSequence + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + altitude?: AltitudeSummary; + /** + * Location summary for running exerciseSequence + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + location?: LocationSummary; + /** + * Running form summary for running exerciseSequence + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + runningForm?: RunningFormSummary; + /** + * Running feature summary for running exerciseSequence + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + runningFeature?: RunningFeature; + }; + /** + * Define the type for cycling exerciseSummary structure. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + type CyclingSummary = { + /** + * Distance summary for cycling exerciseSequence + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + distance: DistanceSummary; + /** + * Calorie summary for cycling exerciseSequence + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + calorie: CalorieSummary; + /** + * Speed summary for cycling exerciseSequence + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + speed: SpeedSummary; + /** + * Exercise heart rate summary for cycling exerciseSequence + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + exerciseHeartRate?: ExerciseHeartRateSummary; + /** + * Resistance summary for cycling exerciseSequence + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + resistance?: ResistanceSummary; + /** + * Pedaling cadence summary for cycling exerciseSequence + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + pedalingCadence?: PedalingCadenceSummary; + /** + * Power summary for cycling exerciseSequence + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + power?: PowerSummary; + /** + * Altitude summary for cycling exerciseSequence + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + altitude?: AltitudeSummary; + /** + * Location summary for cycling exerciseSequence + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + location?: LocationSummary; + }; + /** + * Define the type for jumping rope exerciseSummary structure. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + type JumpingRopeSummary = { + /** + * Jumping rope feature summary for jumping rope exerciseSequence + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + jumpingRopeFeature: JumpingRopeFeature; + /** + * Calorie summary for jumping rope exerciseSequence + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + calorie: CalorieSummary; + /** + * Skip speed summary for jumping rope exerciseSequence + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + skipSpeed: SkipSpeedSummary; + /** + * Exercise heart rate summary for jumping rope exerciseSequence + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + exerciseHeartRate?: ExerciseHeartRateSummary; + }; + /** + * Define the interface for exercise heart rate SequencePoint structure. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + interface ExerciseHeartRate extends healthStore.SequencePoint { + /** + * Exercise heart rate in beats per minute, value must be (0, 255). + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + bpm: number; + } + /** + * Define the interface for speed SequencePoint structure. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + interface Speed extends healthStore.SequencePoint { + /** + * Speed measured in m/s, value must be [0, ∞). + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + speed: number; + } + /** + * Define the interface for cadence SequencePoint structure. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + interface Cadence extends healthStore.SequencePoint { + /** + * Number of steps per minute, value must be [0, ∞). + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + cadence: number; + } + /** + * Define the interface for running form SequencePoint structure. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + interface RunningForm extends healthStore.SequencePoint { + /** + * Ground contact time in milliseconds, value must be [0, 5000]. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + groundContactTime: number; + /** + * Ground impact acceleration measured in G-forces, value must be [0, 50]. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + groundImpactAcceleration?: number; + /** + * Swing angle measured in degrees, value must be [0, 360]. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + swingAngle?: number; + /** + * Eversion excursion measured in degrees, value must be [-100, 100]. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + eversionExcursion?: number; + /** + * Hang time measured in milliseconds, value must be [0, 500]. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + hangTime?: number; + /** + * The rate of ground contact time to hang time, value must be [0, 500]. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + groundHangTimeRate?: number; + /** + * Forefoot strike pattern measured as a percentage, value must be [0, 100]. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + foreFootStrikePattern?: number; + /** + * Hindfoot strike pattern measured as a percentage, value must be [0, 100]. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + hindFootStrikePattern?: number; + /** + * Whole foot strike pattern measured as a percentage, value must be [0, 100]. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + wholeFootStrikePattern?: number; + /** + * Impact peak measured in BW(multiples of body weight), value must be [0, 10]. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + impactPeak?: number; + /** + * Vertical oscillation measured in centimetres, value must be [0,25.6]. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + verticalOscillation?: number; + /** + * Vertical ratio measured as a percentage, value must be [0, 100]. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + verticalRatio?: number; + /** + * Ground contact time balance measured as a percentage, value must be [0, 100]. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + gcTimeBalance?: number; + } + /** + * Define the interface for altitude SequencePoint structure. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + interface Altitude extends healthStore.SequencePoint { + /** + * Altitude measured in meters. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + altitude: number; + } + /** + * Define the interface for location SequencePoint structure. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + interface Location extends healthStore.SequencePoint { + /** + * Latitude of the location, value must be [-90, 90]. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + latitude: number; + /** + * Longitude of the location, value must be [-180, 180]. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + longitude: number; + } + /** + * Define the interface for pedaling cadence SequencePoint structure. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + interface PedalingCadence extends healthStore.SequencePoint { + /** + * Number of pedal revolutions per minute, value must be [0, ∞). + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + rpm: number; + } + /** + * Define the interface for power SequencePoint structure. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + interface Power extends healthStore.SequencePoint { + /** + * Power measured in watts, value must be [0, ∞). + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + power: number; + } + /** + * Define the interface for skip speed SequencePoint structure. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + interface SkipSpeed extends healthStore.SequencePoint { + /** + * Skip speed measured in revolutions/min, value must be [0, ∞). + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + skipSpeed: number; + } + /** + * Define the interface for resistance SequencePoint structure. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + interface Resistance extends healthStore.SequencePoint { + /** + * Resistance level, value must be [1, 100]. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + resLevel: number; + } + /** + * Defines the type for walking exerciseSequence detail structure. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + type WalkingDetail = { + /** + * SequencePoint array of exercise heart rate for walking exerciseSequence. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + exerciseHeartRate?: ExerciseHeartRate[]; + /** + * SequencePoint array of speed for walking exerciseSequence. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + speed?: Speed[]; + /** + * SequencePoint array of cadence for walking exerciseSequence. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + cadence?: Cadence[]; + /** + * SequencePoint array of altitude for walking exerciseSequence. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + altitude?: Altitude[]; + /** + * SequencePoint array of location for walking exerciseSequence. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + location?: Location[]; + }; + /** + * Defines the type for running exerciseSequence detail structure. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + type RunningDetail = { + /** + * SequencePoint array of exercise heart rate for running exerciseSequence. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + exerciseHeartRate?: ExerciseHeartRate[]; + /** + * SequencePoint array of speed for running exerciseSequence. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + speed?: Speed[]; + /** + * SequencePoint array of cadence for running exerciseSequence. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + cadence?: Cadence[]; + /** + * SequencePoint array of running form for running exerciseSequence. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + runningForm?: RunningForm[]; + /** + * SequencePoint array of location for running exerciseSequence. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + location?: Location[]; + /** + * SequencePoint array of altitude for running exerciseSequence. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + altitude?: Altitude[]; + }; + /** + * Defines the type for cycling exerciseSequence detail structure. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + type CyclingDetail = { + /** + * SequencePoint array of exercise heart rate for cycling exerciseSequence. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + exerciseHeartRate?: ExerciseHeartRate[]; + /** + * SequencePoint array of speed for cycling exerciseSequence. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + speed?: Speed[]; + /** + * SequencePoint array of altitude for cycling exerciseSequence. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + altitude?: Altitude[]; + /** + * SequencePoint array of location for cycling exerciseSequence. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + location?: Location[]; + /** + * SequencePoint array of pedaling cadence for cycling exerciseSequence. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + pedalingCadence?: PedalingCadence[]; + /** + * SequencePoint array of power for cycling exerciseSequence. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + power?: Power[]; + /** + * SequencePoint array of resistance for cycling exerciseSequence. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + resistance?: Resistance[]; + }; + /** + * Defines the type for jumping rope exerciseSequence detail structure. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + type JumpingRopeDetail = { + /** + * SequencePoint array of exercise heart rate for jumping rope exerciseSequence. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + exerciseHeartRate?: ExerciseHeartRate[]; + /** + * SequencePoint array of skip speed for jumping rope exerciseSequence. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + skipSpeed?: SkipSpeed[]; + }; + /** + * Define the type for sleep record structure. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + type Sleep = { + /** + * Earliest time of falling asleep in milliseconds since epoch, value must be [0, ∞). + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + fallAsleepTime: number; + /** + * Latest time of waking up in milliseconds since epoch, value must be [0, ∞). + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + wakeupTime: number; + /** + * Sleep duration in seconds, value must be [0, ∞). + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + duration: number; + /** + * Earliest time to go to bed in milliseconds since epoch, value must be [0, ∞). + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + bedTime?: number; + /** + * Latest time to get up in milliseconds since epoch, value must be [0, ∞). + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + risingTime?: number; + /** + * Prepare time for sleep in milliseconds since epoch, value must be [0, ∞). + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + prepareSleepTime?: number; + /** + * Shallow sleep duration in seconds, value must be [0, ∞). + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + shallowDuration?: number; + /** + * Deep sleep duration in seconds, value must be [0, ∞). + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + deepDuration?: number; + /** + * Dream sleep duration in seconds, value must be [0, ∞). + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + dreamDuration?: number; + /** + * Awake duration in seconds, value must be [0, ∞). + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + wakeDuration?: number; + /** + * Number of awakenings, value must be [0, ∞). + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + wakeCount?: number; + /** + * On-bed duration in seconds, value must be [0, ∞). + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + onBedDuration?: number; + /** + * Sleep recording duration in seconds, value must be [0, ∞). + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + recordDuration?: number; + /** + * Sleep efficiency, value must be [0, 100]. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + sleepEfficiency?: number; + /** + * Sleep score, value must be [0, 100]. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + sleepScore?: number; + /** + * Deep sleep continuity, value must be [0, 100]. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + deepSleepContinuity?: number; + /** + * Respiratory quality score, value must be [0, 100]. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + respiratoryQualityScore?: number; + /** + * Number of rollovers, value must be [0, ∞). + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + turnOverCount?: number; + /** + * Reasons for end of sleep, value must be [0, ∞). + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + sleepEndReason?: number; + /** + * Sleep symptoms. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + sleepSymptoms?: string; + /** + * Sleep type. + * The possible values are as follows: + * 1: TruSleep + * 2: regular sleep + * 3: Manually enter sleep + * 4: Phone records sleep + * If this parameter is not set, the default value 2 is used. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + sleepType?: number; + }; + /** + * Define the interface for nap record structure. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + type SleepNap = { + /** + * Duration of nap in seconds, value must be [0, ∞). + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + noonDuration: number; + /** + * Recording duration of nap in seconds, value must be [0, ∞). + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + noonRecordDuration?: number; + }; + /** + * Define the interface for sleep segment data structure. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + interface SleepSegment extends healthStore.SequencePoint { + /** + * Sleep status. + * The possible values are as follows: + * 0: unknown + * 1: deepSleep + * 2: shallowSleep + * 3: dreamSleep + * 4: wake + * 5: noonSleep + * 6: onBed + * 7:sleep(manual recording) + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + sleepStatus: number; + /** + * End time of sleep segment in milliseconds since epoch. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + endTime: number; + } + /** + * Define the type for sleep detail data structure. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + type SleepDetail = { + /** + * Sleep segment array. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + sleepSegment?: SleepSegment[]; + }; + } + /** + * Define data models used in the health store. + * + * @namespace healthModels + * @syscap SystemCapability.Health.HealthStore + * @atomicservice + * @since 5.0.0(12) + */ + namespace healthModels { + /** + * Define the type for daily activities SamplePoint. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + type DailyActivities = healthStore.SamplePoint; + /** + * Define the type for heart rate SamplePoint. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + type HeartRate = healthStore.SamplePoint; + /** + * Define the type for blood oxygen saturation SamplePoint. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + type BloodOxygenSaturation = healthStore.SamplePoint; + /** + * Define the type for stress SamplePoint. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + type Stress = healthStore.SamplePoint; + /** + * Define the type for body temperature SamplePoint. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + type BodyTemperature = healthStore.SamplePoint; + /** + * Define the type for aggregate result of daily activities. + * + * @syscap SystemCapability.Health.HealthStore + * @atomicservice + * @since 5.0.0(12) + */ + type DailyActivitiesAggregateResult = healthStore.AggregateResult; + /** + * Define the type for walking ExerciseSequence. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + type Walking = healthStore.ExerciseSequence; + /** + * Define the type for indoor walking ExerciseSequence. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + type IndoorWalking = Walking; + /** + * Define the type for hiking ExerciseSequence. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + type Hiking = Walking; + /** + * Define the type for running ExerciseSequence. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + type Running = healthStore.ExerciseSequence; + /** + * Define the type for indoor running ExerciseSequence. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + type IndoorRunning = Running; + /** + * Define the type for trail running ExerciseSequence. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + type TrailRunning = Running; + /** + * Define the type for cycling ExerciseSequence. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + type Cycling = healthStore.ExerciseSequence; + /** + * Define the type for indoor cycling ExerciseSequence. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + type IndoorCycling = Cycling; + /** + * Define the type for spinning ExerciseSequence. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + type Spinning = Cycling; + /** + * Define the type for jumping rope ExerciseSequence. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + type JumpingRope = healthStore.ExerciseSequence; + /** + * Define the type for sleep record HealthSequence. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + type SleepRecord = healthStore.HealthSequence; + /** + * Define the type for nap record HealthSequence, and this is another type of sleep record. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + type SleepNapRecord = healthStore.HealthSequence; + } + /** + * Namespace for SamplePoint related functionality. + * + * @namespace samplePointHelper + * @syscap SystemCapability.Health.HealthStore + * @atomicservice + * @since 5.0.0(12) + */ + namespace samplePointHelper { + /** + * Namespace for daily activities related functionality. + * + * @namespace dailyActivities + * @syscap SystemCapability.Health.HealthStore + * @atomicservice + * @since 5.0.0(12) + */ + namespace dailyActivities { + /** + * The data type for daily activities. + * + * @syscap SystemCapability.Health.HealthStore + * @atomicservice + * @since 5.0.0(12) + */ + const DATA_TYPE: healthStore.DataType; + /** + * The model for DailyActivities SamplePoint. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + type Model = healthModels.DailyActivities; + /** + * The fields for DailyActivities Model. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + type Fields = healthFields.DailyActivities; + /** + * The model for DailyActivities AggregateResult. + * + * @syscap SystemCapability.Health.HealthStore + * @atomicservice + * @since 5.0.0(12) + */ + type AggregateResult = healthModels.DailyActivitiesAggregateResult; + /** + * The fields for DailyActivities AggregateResult Model. + * + * @syscap SystemCapability.Health.HealthStore + * @atomicservice + * @since 5.0.0(12) + */ + type AggregateFields = healthFields.DailyActivitiesAggregation; + } + /** + * Namespace for heart rate related functionality. + * + * @namespace heartRate + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + namespace heartRate { + /** + * The data type for heart rate. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + const DATA_TYPE: healthStore.DataType; + /** + * The model for HeartRate SamplePoint. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + type Model = healthModels.HeartRate; + /** + * The fields for HeartRate Model. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + type Fields = healthFields.HeartRate; + } + /** + * Namespace for blood oxygen saturation related functionality. + * + * @namespace bloodOxygenSaturation + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + namespace bloodOxygenSaturation { + /** + * The data type for blood oxygen saturation. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + const DATA_TYPE: healthStore.DataType; + /** + * The model for BloodOxygenSaturation SamplePoint. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + type Model = healthModels.BloodOxygenSaturation; + /** + * The fields for BloodOxygenSaturation Model. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + type Fields = healthFields.BloodOxygenSaturation; + } + /** + * Namespace for stress related functionality. + * + * @namespace stress + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + namespace stress { + /** + * The data type for stress. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + const DATA_TYPE: healthStore.DataType; + /** + * The model for Stress SamplePoint. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + type Model = healthModels.Stress; + /** + * The fields for Stress Model. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + type Fields = healthFields.Stress; + } + /** + * Namespace for body temperature related functionality. + * + * @namespace bodyTemperature + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + namespace bodyTemperature { + /** + * The data type for body temperature. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + const DATA_TYPE: healthStore.DataType; + /** + * The model for BodyTemperature SamplePoint. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + type Model = healthModels.BodyTemperature; + /** + * The fields for BodyTemperature Model. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + type Fields = healthFields.BodyTemperature; + } + } + /** + * Namespace for ExerciseSequence related functionality. + * + * @namespace exerciseSequenceHelper + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + namespace exerciseSequenceHelper { + /** + * The data type for ExerciseSequence. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + const DATA_TYPE: healthStore.DataType; + /** + * Namespace for walking related functionality. + * + * @namespace walking + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + namespace walking { + /** + * The exercise type for walking. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + const EXERCISE_TYPE: healthStore.SubDataType; + /** + * The model for Walking ExerciseSequence. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + type Model = healthModels.Walking; + /** + * The fields for WalkingSummary. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + type SummaryFields = healthFields.WalkingSummary; + /** + * The fields for WalkingDetail. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + type DetailFields = healthFields.WalkingDetail; + } + /** + * Namespace for indoor walking related functionality. + * + * @namespace indoorWalking + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + namespace indoorWalking { + /** + * The exercise type for indoor walking. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + const EXERCISE_TYPE: healthStore.SubDataType; + /** + * The model for IndoorWalking ExerciseSequence. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + type Model = healthModels.IndoorWalking; + /** + * The fields for WalkingSummary. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + type SummaryFields = healthFields.WalkingSummary; + /** + * The fields for WalkingDetail. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + type DetailFields = healthFields.WalkingDetail; + } + /** + * Namespace for hiking related functionality. + * + * @namespace hiking + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + namespace hiking { + /** + * The exercise type for hiking. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + const EXERCISE_TYPE: healthStore.SubDataType; + /** + * The model for Hiking ExerciseSequence. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + type Model = healthModels.Hiking; + /** + * The fields for WalkingSummary. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + type SummaryFields = healthFields.WalkingSummary; + /** + * The fields for WalkingDetail. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + type DetailFields = healthFields.WalkingDetail; + } + /** + * Namespace for running related functionality. + * + * @namespace running + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + namespace running { + /** + * The exercise type for running. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + const EXERCISE_TYPE: healthStore.SubDataType; + /** + * The model for Running ExerciseSequence. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + type Model = healthModels.Running; + /** + * The fields for RunningSummary. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + type SummaryFields = healthFields.RunningSummary; + /** + * The fields for RunningDetail. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + type DetailFields = healthFields.RunningDetail; + } + /** + * Namespace for indoor running related functionality. + * + * @namespace indoorRunning + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + namespace indoorRunning { + /** + * The exercise type for indoor running. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + const EXERCISE_TYPE: healthStore.SubDataType; + /** + * The model for IndoorRunning ExerciseSequence. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + type Model = healthModels.IndoorRunning; + /** + * The fields for RunningSummary. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + type SummaryFields = healthFields.RunningSummary; + /** + * The fields for RunningDetail. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + type DetailFields = healthFields.RunningDetail; + } + /** + * Namespace for trail running related functionality. + * + * @namespace trailRunning + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + namespace trailRunning { + /** + * The exercise type for trail running. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + const EXERCISE_TYPE: healthStore.SubDataType; + /** + * The model for TrailRunning ExerciseSequence. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + type Model = healthModels.TrailRunning; + /** + * The fields for RunningSummary. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + type SummaryFields = healthFields.RunningSummary; + /** + * The fields for RunningDetail. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + type DetailFields = healthFields.RunningDetail; + } + /** + * Namespace for cycling related functionality. + * + * @namespace cycling + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + namespace cycling { + /** + * The exercise type for cycling. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + const EXERCISE_TYPE: healthStore.SubDataType; + /** + * The model for Cycling ExerciseSequence. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + type Model = healthModels.Cycling; + /** + * The fields for CyclingSummary. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + type SummaryFields = healthFields.CyclingSummary; + /** + * The fields for CyclingDetail. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + type DetailFields = healthFields.CyclingDetail; + } + /** + * Namespace for indoor cycling related functionality. + * + * @namespace indoorCycling + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + namespace indoorCycling { + /** + * The exercise type for indoor cycling. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + const EXERCISE_TYPE: healthStore.SubDataType; + /** + * The model for IndoorCycling ExerciseSequence. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + type Model = healthModels.IndoorCycling; + /** + * The fields for CyclingSummary. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + type SummaryFields = healthFields.CyclingSummary; + /** + * The fields for CyclingDetail. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + type DetailFields = healthFields.CyclingDetail; + } + /** + * Namespace for spinning related functionality. + * + * @namespace spinning + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + namespace spinning { + /** + * The exercise type for spinning. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + const EXERCISE_TYPE: healthStore.SubDataType; + /** + * The model for Spinning ExerciseSequence. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + type Model = healthModels.Spinning; + /** + * The fields for CyclingSummary. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + type SummaryFields = healthFields.CyclingSummary; + /** + * The fields for CyclingDetail. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + type DetailFields = healthFields.CyclingDetail; + } + /** + * Namespace for jumping rope related functionality. + * + * @namespace jumpingRope + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + namespace jumpingRope { + /** + * The exercise type for jumping rope. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + const EXERCISE_TYPE: healthStore.SubDataType; + /** + * The model for JumpingRope ExerciseSequence. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + type Model = healthModels.JumpingRope; + /** + * The fields for JumpingRopeSummary. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + type SummaryFields = healthFields.JumpingRopeSummary; + /** + * The fields for JumpingRopeDetail. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + type DetailFields = healthFields.JumpingRopeDetail; + } + } + /** + * Namespace for HealthSequence related functionality. + * + * @namespace healthSequenceHelper + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + namespace healthSequenceHelper { + /** + * Namespace for sleep record related functionality. + * + * @namespace sleepRecord + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + namespace sleepRecord { + /** + * The data type for sleep record. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + const DATA_TYPE: healthStore.DataType; + /** + * The model for SleepRecord HealthSequence. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + type Model = healthModels.SleepRecord; + /** + * The fields for SleepRecord Model. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + type Fields = healthFields.Sleep; + /** + * The fields for SleepDetail. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + type DetailFields = healthFields.SleepDetail; + } + /** + * Namespace for nap record related functionality. + * + * @namespace sleepNapRecord + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + namespace sleepNapRecord { + /** + * The data type for nap record. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + const DATA_TYPE: healthStore.DataType; + /** + * The model for SleepNapRecord HealthSequence. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + type Model = healthModels.SleepNapRecord; + /** + * The fields for SleepNapRecord Model. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + type Fields = healthFields.SleepNap; + /** + * The fields for SleepDetail. + * + * @syscap SystemCapability.Health.HealthStore + * @since 5.0.0(12) + */ + type DetailFields = healthFields.SleepDetail; + } + } +} +export default healthStore; diff --git a/language/arkts/extractor/sdk/hms/ets/api/@hms.officeservice.pdfservice.d.ts b/language/arkts/extractor/sdk/hms/ets/api/@hms.officeservice.pdfservice.d.ts new file mode 100755 index 00000000..8b45ef3a --- /dev/null +++ b/language/arkts/extractor/sdk/hms/ets/api/@hms.officeservice.pdfservice.d.ts @@ -0,0 +1,2819 @@ +import image from '@ohos.multimedia.image'; +/** + * @file Defines the capabilities of pdf module. + * @kit PDFKit + */ +/** +* This module provides the capability to load the pdf. +* @namespace pdfService +* @syscap SystemCapability.OfficeService.PDFService.Core +* @since 5.0.0(12) +*/ +declare namespace pdfService { + /** + * The information of fonts. + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + export class FontInfo { + /** + * Constructor + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + constructor(); + /** + * The file path of font file. + * @type { ?string } + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + fontPath?: string; + /** + * The font name. + * @type { ?string } + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + fontName?: string; + } + /** + * The information of header and footer in PDFPage. + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + export class HeaderFooterInfo { + /** + * Constructor + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + constructor(); + /** + * The font info. + * @type { FontInfo } + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + fontInfo: FontInfo; + /** + * The text size of header and footer text. + * @type { number } + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + textSize: number; + /** + * The character set of text. + * @type { CharsetType } + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + charset: CharsetType; + /** + * Whether there is underline of text. + * @type { boolean } + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + underline: boolean; + /** + * The RGB text color. + * @type { number } + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + textColor: number; + /** + * The left margin of header and footer in pixels. + * @type { number } + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + leftMargin: number; + /** + * The top margin of header in pixels. + * @type { number } + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + topMargin: number; + /** + * The right margin of header and footer in pixels. + * @type { number } + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + rightMargin: number; + /** + * The bottom margin of footer in pixels. + * @type { number } + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + bottomMargin: number; + /** + * The text content at the left of header. + * @type { string } + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + headerLeftText: string; + /** + * The text content at the center of header. + * @type { string } + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + headerCenterText: string; + /** + * The text content at the right of header. + * @type { string } + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + headerRightText: string; + /** + * The text content at the left of footer. + * @type { string } + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + footerLeftText: string; + /** + * The text content at the center of footer. + * @type { string } + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + footerCenterText: string; + /** + * The text content at the right of footer. + * @type { string } + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + footerRightText: string; + } + /** + * The public information of watermark in PDFPage. + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + export class WatermarkInfo { + /** + * Constructor + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + constructor(); + /** + * The type of the watermark object. + * @type { WatermarkType } + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + watermarkType: WatermarkType; + /** + * The zoom scale of the watermark object. + * @type { number } + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + scale: number; + /** + * The rotation angle of the watermark object. + * @type { number } + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + rotation: number; + /** + * The opacity of the watermark object. + * @type { number } + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + opacity: number; + /** + * Whether the watermark is on top of the page. + * @type { boolean } + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + isOnTop: boolean; + /** + * The horizontal alignment of the watermark object in page. + * @type { WatermarkAlignment } + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + horizontalAlignment: WatermarkAlignment; + /** + * The relative horizontal space of the watermark object in page. + * If left aligned, the space describes the space between the object and left edge in pixels; + * If center aligned, the space describes the space between the object and the vertical center line in pixels; + * If right aligned, the space describes the space between the object and right edge in pixels; + * @type { number } + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + horizontalSpace: number; + /** + * The vertical alignment of the watermark object in page. + * @type { WatermarkAlignment } + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + verticalAlignment: WatermarkAlignment; + /** + * The vertical space of the watermark object in page. + * If top aligned, the space describes the space between the object and top edge in pixels; + * If center aligned, the space describes the space between the object and the horizontal center line in pixels; + * If bottom aligned, the space describes the space between the object and bottom edge in pixels; + * @type { number } + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + verticalSpace: number; + } + /** + * The information of text watermark in PDFPage. + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + export class TextWatermarkInfo extends WatermarkInfo { + /** + * The content of text watermark. + * @type { string } + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + content: string; + /** + * The font path of the text watermark. + * @type { FontInfo } + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + fontInfo: FontInfo; + /** + * The text size of the text watermark. + * @type { number } + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + textSize: number; + /** + * The RGB color of the text watermark. + * @type { number } + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + textColor: number; + } + /** + * The information of image watermark in PDFPage. + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + export class ImageWatermarkInfo extends WatermarkInfo { + /** + * The file path of the watermark image. + * @type { string } + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + imagePath: string; + } + /** + * The information of background in PDFPage. + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + export class BackgroundInfo { + /** + * Constructor + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + constructor(); + /** + * The file path of background image. + * @type { string } + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + imagePath: string; + /** + * The RGB color of background + * @type { number } + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + backgroundColor: number; + /** + * The zoom scale of the background object. + * @type { number } + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + scale: number; + /** + * The rotation angle of the background object. + * @type { number } + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + rotation: number; + /** + * The opacity of the background. + * @type { number } + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + opacity: number; + /** + * Whether the watermark is on top of the page. + * @type { boolean } + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + isOnTop: boolean; + /** + * The horizontal alignment of the background object in page. + * @type { BackgroundAlignment } + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + horizontalAlignment: BackgroundAlignment; + /** + * The relative horizontal space of the background object in page. + * If left aligned, the space describes the space between the object and left edge in pixels; + * If center aligned, the space describes the space between the object and the vertical center line in pixels; + * If right aligned, the space describes the space between the object and right edge in pixels; + * @type { number } + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + horizontalSpace: number; + /** + * The vertical alignment of the background object in page. + * @type { BackgroundAlignment } + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + verticalAlignment: BackgroundAlignment; + /** + * The vertical space of the background object in page. + * If top aligned, the space describes the space between the object and top edge in pixels; + * If center aligned, the space describes the space between the object and the horizontal center line in pixels; + * If bottom aligned, the space describes the space between the object and bottom edge in pixels; + * @type { number } + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + verticalSpace: number; + } + /** + * PDF Document class + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + export class PdfDocument { + /** + * Constructor + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + constructor(); + /** + * Load a file with a specified file path or uri. + * @param { string } path - file path. + * @param { string } password - File encryption password. + * @param { (progress: number) => number } onProgress - Progress bar callback function. + * @returns { ParseResult } ParseResult enum type. + * @throws { BusinessError } 401 - invalid input parameter. + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + loadDocument(path: string, password?: string, onProgress?: (progress: number) => number): ParseResult; + /** + * Release PDF documents. + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + releaseDocument(): void; + /** + * Save document to specified file path. + * @param { string } path - file path. + * @param { (progress: number) => number } onProgress - Progress bar callback function + * @returns { boolean } Whether the document was saved successfully. + * @throws { BusinessError } 401 - invalid input parameter. + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + saveDocument(path: string, onProgress?: (progress: number) => number): boolean; + /** + * Create a blank document. + * @param { number } width - Document width. + * @param { number } height - Document height. + * @returns { boolean } Whether the document was successfully created. + * @throws { BusinessError } 401 - invalid input parameter. + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + createDocument(width: number, height: number): boolean; + /** + * Whether the document is encrypted. + * @param { string } path - file path. + * @returns { boolean } Whether the document is encrypted. + * @throws { BusinessError } 401 - invalid input parameter. + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + isEncrypted(path: string): boolean; + /** + * Remove the encryption lock. + * @returns { boolean } Whether the encryption lock was successfully deleted. + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + removeSecurity(): boolean; + /** + * Get the number of document pages. + * @returns { number } Number of document pages. + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + getPageCount(): number; + /** + * Get the object of the specified page. + * @param { number } index - Get the page object. + * @returns { PdfPage } Specify the page object. + * @throws { BusinessError } 401 - invalid input parameter. + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + getPage(index: number): PdfPage; + /** + * Insert PDF page at specified location. + * @param { number } index - At which page to insert PDF page. + * @param { number } width - Insert PDF page width. + * @param { number } height - Insert PDF page height. + * @returns { PdfPage } Inserted PDF page. + * @throws { BusinessError } 401 - invalid input parameter. + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + insertBlankPage(index: number, width: number, height: number): PdfPage; + /** + * Add Pages from other Documents to the current Document. + * @param { PdfDocument } document - PdfDocument object. + * @param { number } fromIndex - From which page of other documents should I start adding. + * @param { number } pageCount - Add number of pages. + * @param { number } index - From which page of the current document do you start adding. + * @returns { PdfPage } Inserted PDF page. + * @throws { BusinessError } 401 - invalid input parameter. + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + insertPageFromDocument(document: PdfDocument, fromIndex: number, pageCount: number, index: number): PdfPage; + /** + * Delete PDF page at specified location. + * @param { number } index - Starting from which PDF page to delete. + * @param { number } count - Delete several PDF pages. + * @throws { BusinessError } 401 - invalid input parameter. + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + deletePage(index: number, count: number): void; + /** + * Move the specified page to the index position + * @param { number } index - Starting from which PDF page to delete. + * @param { number } dest - End PDF pages. + * @returns { boolean } Whether the specified page was successfully moved to the index position. + * @throws { BusinessError } 401 - invalid input parameter. + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + movePage(index: number, dest: number): boolean; + /** + * Get font weight. + * @returns { number } The font weight. + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + getFontWeight(): number; + /** + * Set font weight. + * @param { number } weight - Font weight. + * @throws { BusinessError } 401 - invalid input parameter. + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + setFontWeight(weight: number): void; + /** + * Get PDF metadata (author, creator, provider). + * @returns { MetaData } PDF metadata. + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + getMetadata(): Metadata; + /** + * Convert pdf document to images and save the images to a specified file path. + * @param { string } path - file path. + * @param { ImageFormat } format - Picture enumeration type. + * @param { (progress: number) => number } onProgress - Progress bar callback function. + * @returns { boolean } Whether the image was successfully converted. + * @throws { BusinessError } 401 - invalid input parameter. + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + convertToImage(path: string, format: ImageFormat, onProgress?: (progress: number) => number): boolean; + /** + * Get Root Bookmark. + * @returns { Bookmark } Bookmark. + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + getRootBookmark(): Bookmark; + /** + * Create Bookmark. + * @returns { Bookmark } Bookmark. + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + createBookmark(): Bookmark; + /** + * Remove Bookmark. + * @param { Bookmark } bookmark - bookmark. + * @returns { boolean } Whether the image was successfully converted. + * @throws { BusinessError } 401 - invalid input parameter. + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + removeBookmark(bookmark: Bookmark): boolean; + /** + * Insert Bookmark. + * @param { Bookmark } bookmark - bookmark. + * @param { Bookmark } parent - parent. + * @param { number } position - position. + * @returns { boolean } Whether the image was successfully converted. + * @throws { BusinessError } 401 - invalid input parameter. + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + insertBookmark(bookmark: Bookmark, parent: Bookmark, position: number): boolean; + /** + * Add header and footer to the whole document. + * @param { HeaderFooterInfo } info - Header and footer information. + * @param { number } startIndex - start page index (inclusive) of header and footer. + * @param { number } endIndex - end page index (inclusive) of header and footer. + * @param { boolean } oddPages - whether add header and footer on the odd pages in the page range. + * @param { boolean } evenPages - whether add header and footer on the even pages in the page range. + * @throws { BusinessError } 401 - invalid input parameter. + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + addHeaderFooter(info: HeaderFooterInfo, startIndex: number, endIndex: number, oddPages: boolean, evenPages: boolean): void; + /** + * Get header and footer of the document. + * @returns { HeaderFooterInfo } header and footer information. + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + getHeaderFooter(): HeaderFooterInfo; + /** + * Whether the document has header or footer. + * @returns { boolean } Whether there is header and footer information on this page. + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + hasHeaderFooter(): boolean; + /** + * Remove header and footer of the document. + * @returns { boolean } Whether the header and footer were successfully removed. + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + removeHeaderFooter(): boolean; + /** + * Add watermark to the whole document. + * @param { WatermarkInfo } info - Watermark information. + * @param { number } startIndex - start page index (inclusive) of watermark. + * @param { number } endIndex - end page index (inclusive) of watermark. + * @param { boolean } oddPages - whether add watermark on the odd pages in the page range. + * @param { boolean } evenPages - whether add watermark on the even pages in the page range. + * @throws { BusinessError } 401 - invalid input parameter. + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + addWatermark(info: WatermarkInfo, startIndex: number, endIndex: number, oddPages: boolean, evenPages: boolean): void; + /** + * Get Watermark information of the document. + * @returns { WatermarkInfo } watermark information. + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + getWatermark(): WatermarkInfo; + /** + * Whether the document has watermark. + * @returns { boolean } Whether there is watermark information on the page. + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + hasWatermark(): boolean; + /** + * Remove watermark of the document. + * @returns { boolean } Whether the removal was successfully. + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + removeWatermark(): boolean; + /** + * Add background to the whole document. + * @param { BackgroundInfo } info - Background information. + * @param { number } startIndex - start page index (inclusive) of background. + * @param { number } endIndex - end page index (inclusive) of background. + * @param { boolean } oddPages - whether add background on the odd pages in the page range. + * @param { boolean } evenPages - whether add background on the even pages in the page range. + * @throws { BusinessError } 401 - invalid input parameter. + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + addBackground(info: BackgroundInfo, startIndex: number, endIndex: number, oddPages: boolean, evenPages: boolean): void; + /** + * Get document background information. + * @returns { BackgroundInfo } Document background information. + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + getBackground(): BackgroundInfo; + /** + * Whether the document has background. + * @returns { boolean } Is there a background. + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + hasBackground(): boolean; + /** + * Remove background of the document. + * @returns { boolean } Whether the removal was successfully. + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + removeBackground(): boolean; + } + /** + * PDF Metadata + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + export class Metadata { + /** + * The title of the document. + * @type { string } + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + title: string; + /** + * The author of the document. + * @type { string } + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + author: string; + /** + * The subject/theme of the document. + * @type { string } + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + subject: string; + /** + * The keywords of the document. + * @type { string } + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + keywords: string; + /** + * The creator, or if the file was converted to PDF from another format, the name of the program that created the original file. + * @type { string } + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + creator: string; + /** + * The converter, if the file is converted to PDF from another format, the application that converts to PDF. + * @type { string } + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + producer: string; + /** + * Creation date. + * @type { Date } + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + creationDate: Date; + /** + * Modified date. + * @type { Date } + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + modifiedDate: Date; + } + /** + * BorderStyle + * @enum { number } + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + export enum BorderStyle { + /** + * No border. + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + NONE = 0, + /** + * Solid border. + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + SOLID = 1, + /** + * Beveled border. + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + BEVELED = 2, + /** + * Inset border. + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + INSET = 3, + /** + * Underline border. + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + UNDERLINE = 4, + /** + * Dash border. + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + DASH = 5 + } + /** + * AnnotationFlag + * @enum { number } + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + export enum AnnotationFlag { + /** + * The annotation is invisible. + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + INVISIBLE = 1, + /** + * The annotation is hidden. + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + HIDDEN = 2, + /** + * The annotation is printed. + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + PRINTED = 4 + } + /** + * The PdfAnnotation object on PdfPage. + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + export class PdfAnnotation { + /** + * The annotation type. + * @type { AnnotationType } + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + type: AnnotationType; + /** + * The unique id of the annotation. + * @type { string } + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + uniqueId: string; + /** + * Get the PDF page of the annotation. + * @returns { PdfPage } The pdf page holding the annotation. + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + getPdfPage(): PdfPage; + /** + * Get the index of current annotation in page. + * @returns { number } The annotation index. + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + getAnnotationIndex(): number; + /** + * Get info of current anntation. + * @returns { PdfAnnotationInfo } The annotation info. + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + getAnnotationInfo(): PdfAnnotationInfo; + /** + * Move the annotation to specified coordinates. + * @param { number } x - Destination x coordinate. + * @param { number } y - Destination y coordinate. + * @throws { BusinessError } 401 - invalid input parameter. + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + moveTo(x: number, y: number): void; + /** + * Whether the current annotation is a mark up type annotation. + * @returns { boolean } Whether the anntation is markup. + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + isMarkup(): boolean; + } + /** + * The information of an annotation in page. + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + export class PdfAnnotationInfo { + /** + * The annotation type. + * @type { AnnotationType } + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + type: AnnotationType; + /** + * The unique id of the annotation. + * @type { string } + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + uniqueId: string; + /** + * The content of the annotation. + * @type { ?string } + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + content?: string; + /** + * The modified time of the annotation. + * @type { ?Date } + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + modifiedTime?: Date; + /** + * The border of the annotation. + * @type { ?PdfBorder } + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + border?: PdfBorder; + /** + * The flag of the annotation. + * @type { ?AnnotationFlag } + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + flag?: AnnotationFlag; + /** + * The title of the annotation. + * @type { ?string } + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + title?: string; + /** + * The opacity of the annotation. + * @type { ?number } + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + opacity?: number; + /** + * The subject of the annotation. + * @type { ?string } + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + subject?: string; + /** + * The creation date of the annotation. + * @type { ?Date } + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + creationDate?: Date; + } + /** + * The information of text type annotation. + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + export class TextAnnotationInfo extends PdfAnnotationInfo { + /** + * The iconName of text type annotation. + * @type { string } + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + iconName: string; + /** + * The text annotation state of text type annotation. + * @type { TextAnnotationState } + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + state: TextAnnotationState; + /** + * The x coordinate (distance to left edge) of text type annotation. + * @type { number } + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + x: number; + /** + * The y coordinate (distance to bottom edge) of text type annotation. + * @type { number } + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + y: number; + /** + * The RGB color of text type annotation. + * @type { ?number } + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + color?: number; + } + /** + * The information of link type annotation. + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + export class LinkAnnotationInfo extends PdfAnnotationInfo { + /** + * left. + * @type { number } + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + left: number; + /** + * bottom. + * @type { number } + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + bottom: number; + /** + * right. + * @type { number } + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + right: number; + /** + * top. + * @type { number } + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + top: number; + /** + * The highlight mode of the link. + * @type { ?HighlightMode } + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + highlightMode?: HighlightMode; + /** + * The RGB color of the link. + * @type { ?number } + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + color?: number; + } + /** + * The information of free-text type annotation. + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + export class FreeTextAnnotationInfo extends PdfAnnotationInfo { + /** + * The x coordinate (distance to left edge) of text type annotation. + * @type { number } + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + x: number; + /** + * The y coordinate (distance to bottom edge) of text type annotation. + * @type { number } + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + y: number; + /** + * The width of the free text. + * @type { ?number } + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + width?: number; + /** + * The fill color of the annotation. + * @type { ?number } + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + fillColor?: number; + /** + * The textStyle of the annotation. + * @type { ?TextStyle } + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + textStyle?: TextStyle; + /** + * The text alignment of the text. + * @type { ?AlignmentType } + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + textAlignment?: AlignmentType; + } + /** + * The information of square type annotation. + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + export class SquareAnnotationInfo extends PdfAnnotationInfo { + /** + * The distance to left edge of the page. + * @type { number } + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + left: number; + /** + * The distance to bottom edge of the page. + * @type { number } + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + bottom: number; + /** + * The distance to right edge of the page. + * @type { number } + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + right: number; + /** + * The distance to top edge of the page. + * @type { number } + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + top: number; + /** + * The line color of the square. + * @type { ?number } + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + lineColor?: number; + /** + * The fill color of the square. + * @type { ?number } + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + fillColor?: number; + } + /** + * The information of oval type annotation. + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + export class OvalAnnotationInfo extends PdfAnnotationInfo { + /** + * The distance to left edge of the page. + * @type { number } + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + left: number; + /** + * The distance to bottom edge of the page. + * @type { number } + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + bottom: number; + /** + * The distance to right edge of the page. + * @type { number } + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + right: number; + /** + * The distance to top edge of the page. + * @type { number } + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + top: number; + /** + * The line color of the oval annotation. + * @type { ?number } + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + lineColor?: number; + /** + * The fill color of the oval annotation. + * @type { ?number } + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + fillColor?: number; + } + /** + * The information of polygon type annotation. + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + export class PolygonAnnotationInfo extends PdfAnnotationInfo { + /** + * The array of PDFPoints in order describing the polygon. + * @type { Array } + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + vertexes: Array; + /** + * The line color of the annotation. + * @type { ?number } + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + lineColor?: number; + /** + * The fill color of the annotation. + * @type { ?number } + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + fillColor?: number; + } + /** + * The information of line type annotation. + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + export class LineAnnotationInfo extends PdfAnnotationInfo { + /** + * The x coordinate (distance to left edge) of start point. + * @type { number } + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + startX: number; + /** + * The y coordinate (distance to bottom edge) of start point. + * @type { number } + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + startY: number; + /** + * The x coordinate (distance to left edge) of end point. + * @type { number } + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + endX: number; + /** + * The y coordinate (distance to bottom edge) of end point. + * @type { number } + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + endY: number; + /** + * The style at the start point. + * @type { LineEndStyle } + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + startPointStyle: LineEndStyle; + /** + * The style at the end point. + * @type { LineEndStyle } + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + endPointStyle: LineEndStyle; + /** + * The line color of the annotation. + * @type { ?number } + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + lineColor?: number; + } + /** + * The information of polyline type annotation. + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + export class PolylineAnnotationInfo extends PdfAnnotationInfo { + /** + * The array of PDFPoints in order describing the polygon. + * @type { Array } + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + vertexes: Array; + /** + * The line color of the annotation. + * @type { ?number } + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + lineColor?: number; + } + /** + * The information of highlight type annotation. + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + export class HighlightAnnotationInfo extends PdfAnnotationInfo { + /** + * The array of PDFPoints of the highlight region. + * Each link annotation has 4*n points, each group of 4 points are: + * - 1st point: the top-left point of a rectangle + * - 2nd point: the top-right point of a rectangle + * - 3rd point: the bottom-left point of a rectangle + * - 4th point: the bottom-right point of a rectangle + * @type { Array } + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + quadPoints: Array; + /** + * The RGB color of the highlight. + * @type { ?number } + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + color?: number; + } + /** + * The information of underline type annotation. + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + export class UnderlineAnnotationInfo extends PdfAnnotationInfo { + /** + * The array of PDFPoints of the highlight region. + * Each link annotation has 4*n points, each group of 4 points are: + * - 1st point: the top-left point of a rectangle + * - 2nd point: the top-right point of a rectangle + * - 3rd point: the bottom-left point of a rectangle + * - 4th point: the bottom-right point of a rectangle + * @type { Array } + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + quadPoints: Array; + } + /** + * The information of strikethrough type annotation. + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + export class StrikethroughAnnotationInfo extends PdfAnnotationInfo { + /** + * The array of PDFPoints of the highlight region. + * Each link annotation has 4*n points, each group of 4 points are: + * - 1st point: the top-left point of a rectangle + * - 2nd point: the top-right point of a rectangle + * - 3rd point: the bottom-left point of a rectangle + * - 4th point: the bottom-right point of a rectangle + * @type { Array } + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + quadPoints: Array; + } + /** + * The information of ink type annotation. + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + export class InkAnnotationInfo extends PdfAnnotationInfo { + /** + * The array of PdfPoint in order describing the ink annotation. + * @type { Array } + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + inkPoints: Array; + /** + * The line color of the annotation. + * @type { ?number } + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + lineColor?: number; + } + /** + * The information of stamp type annotation. + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + export class StampAnnotationInfo extends PdfAnnotationInfo { + /** + * The file path of the image as stamp. + * @type { string } + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + imagePath: string; + /** + * The distance to left edge of the page. + * @type { number } + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + left: number; + /** + * The distance to bottom edge of the page. + * @type { number } + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + bottom: number; + /** + * The distance to right edge of the page. + * @type { number } + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + right: number; + /** + * The distance to top edge of the page. + * @type { number } + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + top: number; + } + /** + * A point location of a pdf page. + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + export class PdfPoint { + /** + * Constructor + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + constructor(); + /** + * x coordinate of point (distance to the left edge of the page). + * @type { number } + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + x: number; + /** + * y coordinate of point (distance to the bottom edge of the page). + * @type { number } + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + y: number; + } + /** + * A rectangle of a pdf page. + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + export class PdfRect { + /** + * Constructor + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + constructor(); + /** + * The distance between the left edge and the rectangle. + * @type { number } + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + left: number; + /** + * The distance between the top edge and the rectangle. + * @type { number } + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + top: number; + /** + * The distance between the right edge and the rectangle. + * @type { number } + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + right: number; + /** + * The distance between the bottom edge and the rectangle. + * @type { number } + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + bottom: number; + } + /** + * The PDF matrix used to describe a rectangle area in pdf page. + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + export class PdfMatrix { + /** + * Constructor + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + constructor(); + /** + * The x coordinate (the distance between the left edge). + * @type { number } + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + x: number; + /** + * The x coordinate (the distance between the bottom edge). + * @type { number } + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + y: number; + /** + * The width of the matrix area. + * @type { number } + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + width: number; + /** + * The height of the matrix area. + * @type { number } + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + height: number; + /** + * The rotation angle of the matrix area. + * @type { number } + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + rotate: number; + } + /** + * The pdf page. + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + export class PdfPage { + /** + * Get PDF Document object. + * @returns { PdfDocument } document object. + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + getDocument(): PdfDocument; + /** + * Get annotations in the page. + * @returns { Array } Annotation list. + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + getAnnotations(): Array; + /** + * Add annotation to page. + * @param { PdfAnnotationInfo } annotationInfo - annotation information. + * @returns { PdfAnnotation } pdf annotation. + * @throws { BusinessError } 401 - invalid input parameter. + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + addAnnotation(annotationInfo: PdfAnnotationInfo): PdfAnnotation; + /** + * Set an existiong annotation's info. + * @param { PdfAnnotation } annotation - the annotation. + * @param { PdfAnnotationInfo } annotationInfo - annotation information. + * @throws { BusinessError } 401 - invalid input parameter. + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + setAnnotation(annotation: PdfAnnotation, annotationInfo: PdfAnnotationInfo): void; + /** + * remove an existing Annotation. + * @param { PdfAnnotation } annotation - annotation obj. + * @throws { BusinessError } 401 - invalid input parameter. + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + removeAnnotation(annotation: PdfAnnotation): void; + /** + * Get the index of the current page. + * @returns { number } Page index. + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + getIndex(): number; + /** + * Get the width of the current page. + * @returns { number } Page Width. + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + getWidth(): number; + /** + * Get the height of the current page. + * @returns { number } Page height. + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + getHeight(): number; + /** + * Set page boundary, boxtype is an enumeration value. + * @param { BoxType } boxtype - Page boundaries. + * @param { PdfRect } rect - rectangle. + * @throws { BusinessError } 401 - invalid input parameter. + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + setBox(boxtype: BoxType, rect: PdfRect): void; + /** + * Get page boundary, boxtype is an enumeration value. + * @param { BoxType } boxtype - Page boundaries. + * @returns { PdfRect } rectangle. + * @throws { BusinessError } 401 - invalid input parameter. + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + getBox(boxtype: BoxType): PdfRect; + /** + * Set the page rotation angle. + * @param { RotationAngle } rotation - Rotation angle enumeration value. + * @throws { BusinessError } 401 - invalid input parameter. + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + setRotation(rotation: RotationAngle): void; + /** + * Get the rotation angle of the page. + * @returns { RotationAngle } Rotation angle. + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + getRotation(): RotationAngle; + /** + * Get the pixelMap of current page as image. + * @returns { image.PixelMap } image.PixelMap. + * @throws { BusinessError } 401 - invalid input parameter. + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + getPagePixelMap(): image.PixelMap; + /** + * Get the pixelMap of current page as a snapshot with more parameters. + * @param { PdfMatrix } matrix - matrix, describes the area of the image in page. + * @param { boolean } isGray - isGray, describes whether get a gray-only image. + * @param { boolean } drawAnnotations - drawAnnotations, describes whether draw the annotations in image. + * @returns { image.PixelMap } image.PixelMap. + * @throws { BusinessError } 401 - invalid input parameter. + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + getCustomPagePixelMap(matrix: PdfMatrix, isGray: boolean, drawAnnotations: boolean): image.PixelMap; + /** + * Add text content to the page. + * This method can only add text line by line instead of multiple lines. + * @param { string } text - text content. + * @param { number } x - the x coordinate(distance to the left edge) of the location to add text. + * @param { number } y - the y coordinate(distance to the bottom edge) of the location to add text. + * @param { TextStyle } style - TextStyle. + * @throws { BusinessError } 401 - invalid input parameter. + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + addTextObject(text: string, x: number, y: number, style: TextStyle): void; + /** + * Add image object to the page. + * @param { string } path - file path. + * @param { number } x - the x coordinate(distance to the left edge) of the top-bottom point of the image. + * @param { number } y - the y coordinate(distance to the bottom edge) of the top-bottom point of the image. + * @param { number } width - the width of the image. + * @param { number } height - the height of the image. + * @throws { BusinessError } 401 - invalid input parameter. + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + addImageObject(path: string, x: number, y: number, width: number, height: number): void; + /** + * Get all graphics objects in current page. + * Return in positional order (from left to right, top to bottom, supporting mirroring languages). + * @returns { Array } All graphics objects. + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + getGraphicsObjects(): Array; + /** + * Delete a specified GraphicsObject. + * @returns { GraphicsObject } All TextObject objects. + * @throws { BusinessError } 401 - invalid input parameter. + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + deleteGraphicsObject(object: GraphicsObject): void; + } + /** + * The GraphicsObject in pdf page. + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + export class GraphicsObject { + /** + * The type of the current graphics object. + * @type { GraphicsObjectType } + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + type: GraphicsObjectType; + /** + * The x coordinate(distance to the left edge) of the GraphicsObject location. + * @type { number } + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + x: number; + /** + * The y coordinate(distance to the bottom edge) of the GraphicsObject location. + * @type { number } + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + y: number; + /** + * The rectangle describing the clip of the GraphicsObject. + * @type { PdfRect } + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + clipRect: PdfRect; + /** + * The stroke color. + * @type { number } + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + strokeColor: number; + /** + * The stroke transparency. + * @type { number } + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + strokeOpacity: number; + /** + * The fill color. + * @type { number } + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + fillColor: number; + /** + * The fill transparency. + * @type { number } + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + fillOpacity: number; + /** + * The rotation angle. + * @type { number } + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + rotate: number; + } + /** + * TextObject type of GraphicsObject + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + export class TextObject extends GraphicsObject { + /** + * The text content. + * @type { string } + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + text: string; + /** + * The font info. + * @type { FontInfo } + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + fontInfo: FontInfo; + /** + * The text size. + * @type { number } + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + textSize: number; + /** + * The space between each character. + * @type { number } + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + charspace: number; + /** + * The space between each word. + * @type { number } + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + wordspace: number; + /** + * The list of character areas. + * Each area is described by a rectangle for its location as left, right, top, bottom. + * @type { Array } + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + charRects: Array; + /** + * Character unicode array. + * @type { Array } + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + charUnicodes: Array; + } + /** + * ImageObject type of GraphicsObject + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + export class ImageObject extends GraphicsObject { + /** + * Use a special syntax to represent small image data directly within the content stream. + * @type { image.PixelMap } + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + pixelMap: image.PixelMap; + /** + * The width of the image object. + * @type { number } + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + width: number; + /** + * The height of the image object. + * @type { number } + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + height: number; + } + /** + * Bookmark of pdf document. + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + export class Bookmark { + /** + * Is root bookmark. + * @returns { boolean } Is root bookmark. + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + isRootBookmark(): boolean; + /** + * Get parent bookmark. + * @returns { Bookmark } Parent bookmark. + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + getParent(): Bookmark; + /** + * Whether this bookmark have child nodes. + * @returns { boolean } Whether there are child nodes. + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + hasChild(): boolean; + /** + * Get child bookmarks. + * @returns { Array } The child bookmark nodes. + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + getChildren(): Array; + /** + * Get destination info. + * @returns { DestInfo } The destination info. + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + getDestInfo(): DestInfo; + /** + * Set destination info. + * @param { BookmarkInfo } info - The destination info. + * @throws { BusinessError } 401 - invalid input parameter. + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + setDestInfo(info: DestInfo): void; + /** + * Get bookmark information. + * @returns { BookmarkInfo } The bookmark info. + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + getBookmarkInfo(): BookmarkInfo; + /** + * Set bookmark info. + * @param { BookmarkInfo } info - BookmarkInfo. + * @throws { BusinessError } 401 - invalid input parameter. + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + setBookmarkInfo(info: BookmarkInfo): void; + } + /** + * The information of bookmark. + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + export class BookmarkInfo { + /** + * Constructor + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + constructor(); + /** + * The bookmark title. + * @type { string } + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + title: string; + /** + * The color of bookmark title. + * @type { ?number } + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + titleColor?: number; + /** + * Whether is bold text. + * @type { ?boolean } + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + isBold?: boolean; + /**c + * @type { ?boolean } + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + isItalic?: boolean; + } + /** + * The destination info. + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + export class DestInfo { + /** + * Constructor + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + constructor(); + /** + * The page fitting mode when jump to the destination. + * @type { FitMode } + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + fitMode: FitMode; + /** + * The page index. + * @type { number } + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + pageIndex: number; + /** + * Distance from the left edge, x when choose FIT_MODE_XYZ or left when choose FIT_MODE_RECT. + * @type { ?number } + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + left?: number; + /** + * Distance from the top edge, y when choose FIT_MODE_XYZ or right when choose FIT_MODE_RECT. + * @type { ?number } + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + top?: number; + /** + * Distance from the right edge, used when choose FIT_MODE_RECT. + * @type { ?number } + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + right?: number; + /** + * Distance from the bottom edge, used when choose FIT_MODE_RECT. + * @type { ?number } + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + bottom?: number; + /** + * Magnification factor when choose FIT_MODE_XYZ. + * @type { ?number } + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + zoom?: number; + } + /** + * The style of text. + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + export class TextStyle { + /** + * The font info. + * @type { ?FontInfo } + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + fontInfo?: FontInfo; + /** + * The text size. + * @type { ?number } + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + textSize?: number; + /** + * The text color. + * @type { ?number } + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + textColor?: number; + /** + * Whether is bold text. + * @type { ?boolean } + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + isBold?: boolean; + /** + * Whether is italic text. + * @type { ?boolean } + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + isItalic?: boolean; + /** + * Whether is underline text. + * @type { ?boolean } + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + isUnderline?: boolean; + /** + * Whether is strikethrough text. + * @type { ?boolean } + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + isStrikethrough?: boolean; + } + /** + * Open document return value. + * @enum { number } + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + export enum ParseResult { + /** + * Successfully parsed. + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + PARSE_SUCCESS = 0, + /** + * File error. + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + PARSE_ERROR_FILE = 1, + /** + * Format error. + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + PARSE_ERROR_FORMAT = 2, + /** + * Password error. + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + PARSE_ERROR_PASSWORD = 3, + /** + * Handler error. + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + PARSE_ERROR_HANDLER = 4, + /** + * Cert error. + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + PARSE_ERROR_CERT = 5 + } + /** + * Page layout display mode + * @enum { number } + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + export enum PageLayout { + /** + * Layout single page. + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + LAYOUT_SINGLE = 1, + /** + * Layout double page. + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + LAYOUT_DOUBLE = 2 + } + /** + * Page adaptation method + * @enum { number } + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + export enum PageFit { + /** + * Actual size. + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + FIT_NONE = 0, + /** + * Zoom by page. + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + FIT_PAGE = 1, + /** + * Fit by width. + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + FIT_WIDTH = 2, + /** + * Adapt to height. + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + FIT_HEIGHT = 3 + } + /** + * Rotation angle. + * @enum { number } + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + export enum RotationAngle { + /** + * Angle 0 degree. + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + ANGLE_0 = 0, + /** + * Angle 90 degrees. + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + ANGLE_90 = 90, + /** + * Angle 180 degrees. + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + ANGLE_180 = 180, + /** + * Angle 270 degrees. + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + ANGLE_270 = 270 + } + /** + * Page boundaries. + * @enum { number } + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + export enum BoxType { + /** + * Define the boundaries of the physical media on which the page is displayed or printed. + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + BOX_MEDIA = 0, + /** + * Defines the visible area of ​​the default user space. + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + BOX_CROP = 1, + /** + * Defines the area to which page content should be clipped when output in a production environment. + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + BOX_BLEED = 2, + /** + * Expected size of finished page after trimming. + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + BOX_TRIM = 3, + /** + * Define the scope of meaningful content that the page creator wants for the page. + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + BOX_ART = 4 + } + /** + * Graphic object type. + * @enum { number } + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + export enum GraphicsObjectType { + /** + * text object. + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + OBJECT_TEXT = 1, + /** + * path object. + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + OBJECT_PATH = 2, + /** + * image object. + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + OBJECT_IMAGE = 3, + /** + * shading object. + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + OBJECT_SHADING = 4, + /** + * form object. + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + OBJECT_FORM = 5 + } + /** + * Text Annotation State. + * @enum { number } + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + export enum TextAnnotationState { + /** + * Commented and tagged by user. + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + UNMARKED = 0, + /** + * Comments are not marked by the user, by default. + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + MARKED = 1 + } + /** + * Highlight Mode. + * @enum { number } + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + export enum HighlightMode { + /** + * Contents of accessories notes. + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + HIGHLIGHT_INVERT = 1, + /** + * Invert annotation borders. + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + HIGHLIGHT_OUTLINE = 2, + /** + * Pressed appearance for displaying annotations. + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + HIGHLIGHT_PUSH = 3, + /** + * Toggle, only useful for widget comments. + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + HIGHLIGHT_TOGGLE = 4 + } + /** + * Alignment Type. + * @enum { number } + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + export enum AlignmentType { + /** + * The distance to left edge of the page. + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + LEFT = 0, + /** + * The distance to center line of the page. + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + MIDDLE = 1, + /** + * The distance to right edge of the page. + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + RIGHT = 2 + } + /** + * Line style of line ends. + * @enum { number } + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + export enum LineEndStyle { + /** + * No style. + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + STYLE_NONE = 0, + /** + * Square end. + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + STYLE_SQUARE = 1, + /** + * Circle end. + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + STYLE_CIRCLE = 2, + /** + * Diamond end. + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + STYLE_DIAMOND = 3, + /** + * Open arrow end. + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + STYLE_OPEN_ARROW = 4, + /** + * Closed arrow end. + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + STYLE_CLOSED_ARROW = 5, + /** + * Butt end. + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + STYLE_BUTT = 6, + /** + * ROpenArrow end. + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + STYLE_R_OPEN_ARROW = 7, + /** + * RClosedArrow end. + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + STYLE_R_CLOSED_ARROW = 8, + /** + * Slash end. + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + STYLE_SLASH = 9 + } + /** + * Image Format + * @enum { number } + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + export enum ImageFormat { + /** + * PNG. + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + PNG = 0, + /** + * BMP. + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + BMP = 1, + /** + * JPEG. + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + JPEG = 2 + } + /** + * Annotation Type. + * @enum { number } + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + export enum AnnotationType { + /** + * Unknown text. + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + UNKNOWN = 0, + /** + * Sticky text. + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + TEXT = 1, + /** + * Link. + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + LINK = 2, + /** + * Free text. + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + FREETEXT = 3, + /** + * Line. + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + LINE = 4, + /** + * Square, including rectangle. + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + SQUARE = 5, + /** + * Oval, including circle. + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + OVAL = 6, + /** + * Polygon. + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + POLYGON = 7, + /** + * Polyline. + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + POLYLINE = 8, + /** + * Highlight. + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + HIGHLIGHT = 9, + /** + * Underline. + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + UNDERLINE = 10, + /** + * Strikethrough. + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + STRIKETHROUGH = 12, + /** + * Stamp. + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + STAMP = 13, + /** + * Ink. + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + INK = 15, + /** + * Popup. + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + POPUP = 16 + } + /** + * PdfBorder. + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + export class PdfBorder { + /** + * Constructor + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + constructor(); + /** + * The border style. + * @type { BorderStyle } + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + borderStyle: BorderStyle; + /** + * The border width. + * @type { number } + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + borderWidth: number; + /** + * The border color. + * @type { number } + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + borderColor: number; + } + /** + * Page fit mode. + * @enum { number } + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + export enum FitMode { + /** + * Zoom the page by a top-left point in page, and the content of the page magnified by the factor zoom. + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + FIT_MODE_XYZ = 1, + /** + * Fit the page to the entire width of the page within the window. + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + FIT_MODE_HORIZONTAL = 2, + /** + * Fit the page to the entire height of the page within the window. + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + FIT_MODE_VERTICAL = 3, + /** + * Fit the page to a rectangle of the page within the window. + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + FIT_MODE_RECT = 4 + } + /** + * Watermark Type. + * @enum { number } + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + export enum WatermarkType { + /** + * Text watermark. + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + WATERMARK_TEXT = 1, + /** + * Image watermark. + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + WATERMARK_IMAGE = 2 + } + /** + * Watermark Alignment. + * @enum { number } + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + export enum WatermarkAlignment { + /** + * Top align the watermark. + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + WATERMARK_ALIGNMENT_TOP = 0, + /** + * Vertical center align the watermark. + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + WATERMARK_ALIGNMENT_VCENTER = 1, + /** + * Bottom align the watermark. + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + WATERMARK_ALIGNMENT_BOTTOM = 2, + /** + * Left align the watermark. + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + WATERMARK_ALIGNMENT_LEFT = 3, + /** + * Horizontal center align the watermark. + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + WATERMARK_ALIGNMENT_HCENTER = 4, + /** + * Right align the watermark. + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + WATERMARK_ALIGNMENT_RIGHT = 5 + } + /** + * Background alignment. + * @enum { number } + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + export enum BackgroundAlignment { + /** + * Top align the background. + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + BACKGROUND_ALIGNMENT_TOP = 0, + /** + * Vertical center align the background. + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + BACKGROUND_ALIGNMENT_VCENTER = 1, + /** + * Bottom align the background. + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + BACKGROUND_ALIGNMENT_BOTTOM = 2, + /** + * Left align the background. + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + BACKGROUND_ALIGNMENT_LEFT = 3, + /** + * Horizontal center align the background. + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + BACKGROUND_ALIGNMENT_HCENTER = 4, + /** + * Right align the background. + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + BACKGROUND_ALIGNMENT_RIGHT = 5 + } + /** + * Character set. + * @enum { number } + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + export enum CharsetType { + /** + * CID + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + PDF_FONT_CID_FONT_CHARSET = 0x100000, + /** + * ANSI + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + PDF_FONT_ANSI_CHARSET = 0, + /** + * Default + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + PDF_FONT_DEFAULT_CHARSET = 1, + /** + * Symbol + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + PDF_FONT_SYMBOL_CHARSET = 2, + /** + * Shift JIS + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + PDF_FONT_SHIFT_JIS_CHARSET = 128, + /** + * Hangeul + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + PDF_FONT_HANGUL_CHARSET = 129, + /** + * GB2312 + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + PDF_FONT_GB2312_CHARSET = 134, + /** + * Chinese BIG5 + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + PDF_FONT_CHINESE_BIG5_CHARSET = 136, + /** + * Thai + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + PDF_FONT_THAI_CHARSET = 222, + /** + * East Europe + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + PDF_FONT_EAST_EUROPE_CHARSET = 238, + /** + * Russian + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + PDF_FONT_RUSSIAN_CHARSET = 204, + /** + * Greek + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + PDF_FONT_GREEK_CHARSET = 161, + /** + * Turkish + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + PDF_FONT_TURKISH_CHARSET = 162, + /** + * Vietnamese + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + PDF_FONT_VIETNAMESE_CHARSET = 163, + /** + * Hebrew + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + PDF_FONT_HEBREW_CHARSET = 177, + /** + * Arabic + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + PDF_FONT_ARABIC_CHARSET = 178, + /** + * Baltic + * @syscap SystemCapability.OfficeService.PDFService.Core + * @since 5.0.0(12) + */ + PDF_FONT_BALTIC_CHARSET = 186 + } +} +export default pdfService; diff --git a/language/arkts/extractor/sdk/hms/ets/api/@hms.pcService.StatusBarViewExtensionAbility.d.ts b/language/arkts/extractor/sdk/hms/ets/api/@hms.pcService.StatusBarViewExtensionAbility.d.ts new file mode 100755 index 00000000..66dccdeb --- /dev/null +++ b/language/arkts/extractor/sdk/hms/ets/api/@hms.pcService.StatusBarViewExtensionAbility.d.ts @@ -0,0 +1,17 @@ +/* + * Copyright (c) Huawei Technologies Co., Ltd. 2024. All rights reserved. + */ +/** + * @file Defines statusBarView extension ability. + * @kit StatusBarExtensionKit + */ +import UIExtensionAbility from '@ohos.app.ability.UIExtensionAbility'; +/** + * Class of statusBarView extension ability. + * + * @syscap SystemCapability.PCService.StatusBarManager + * @StageModelOnly + * @since 5.0.0(12) + */ +export default class StatusBarViewExtensionAbility extends UIExtensionAbility { +} diff --git a/language/arkts/extractor/sdk/hms/ets/api/@hms.pcService.fileGuard.d.ts b/language/arkts/extractor/sdk/hms/ets/api/@hms.pcService.fileGuard.d.ts new file mode 100755 index 00000000..ec28f45b --- /dev/null +++ b/language/arkts/extractor/sdk/hms/ets/api/@hms.pcService.fileGuard.d.ts @@ -0,0 +1,355 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. All rights reserved. + */ +/** + * @file This module providers the capability to mark and control documents. + * @kit EnterpriseDataGuardKit + */ +import type { AsyncCallback } from '@ohos.base'; +/** + * The module providers the capability to mark and control documents. + * + * @namespace fileGuard + * @syscap SystemCapability.PCService.FileGuard + * @since 4.0.0(10) + */ +declare namespace fileGuard { + /** + * Provides common directory scan type definition. + * + * @enum { number } CommonDirScanType + * @syscap SystemCapability.PCService.FileGuard + * @since 4.0.0(10) + */ + enum CommonDirScanType { + /** + * Indicates a scan file task type for the media directory. + * + * @syscap SystemCapability.PCService.FileGuard + * @since 4.0.0(10) + */ + MEDIA_ONLY = 0, + /** + * Indicates a scan file task type for the media and sandbox directory. + * + * @syscap SystemCapability.PCService.FileGuard + * @since 4.0.0(10) + */ + MEDIA_AND_SANDBOX + } + /** + * Provides file security level. + * + * @enum { number } SecurityLevel + * @syscap SystemCapability.PCService.FileGuard + * @since 4.0.0(10) + */ + enum SecurityLevel { + /** + * Indicates that the security level is public. + * + * @syscap SystemCapability.PCService.FileGuard + * @since 4.0.0(10) + */ + EXTERNAL = 0, + /** + * Indicates that the security level is internal. + * + * @syscap SystemCapability.PCService.FileGuard + * @since 4.0.0(10) + */ + INTERNAL, + /** + * Indicates that the security level is secret. + * + * @syscap SystemCapability.PCService.FileGuard + * @since 4.0.0(10) + */ + SECRET, + /** + * Indicates that the security level is confidential. + * + * @syscap SystemCapability.PCService.FileGuard + * @since 4.0.0(10) + */ + CONFIDENTIAL, + /** + * Indicates that the security level is top secret. + * + * @syscap SystemCapability.PCService.FileGuard + * @since 4.0.0(10) + */ + TOP_SECRET + } + /** + * Provides path information of a file, including the absolute path and uri. + * + * @interface FilePathInfo + * @syscap SystemCapability.PCService.FileGuard + * @since 4.0.0(10) + */ + interface FilePathInfo { + /** + * The absolute path of a file. + * + * @type { string } + * @syscap SystemCapability.PCService.FileGuard + * @since 4.0.0(10) + */ + absolutePath: string; + /** + * The uri of a file. + * + * @type { string } + * @syscap SystemCapability.PCService.FileGuard + * @since 4.0.0(10) + */ + uri: string; + } + /** + * Provides tag information of a file, including the security level and tag. + * + * @interface FileTagInfo + * @syscap SystemCapability.PCService.FileGuard + * @since 4.0.0(10) + */ + interface FileTagInfo { + /** + * The security level of a file, including external, internal, secret, confidential and top_secret. + * + * @type { number } + * @syscap SystemCapability.PCService.FileGuard + * @since 4.0.0(10) + */ + securityLevel: number; + /** + * The tag information of a file. + * + * @type { string } + * @syscap SystemCapability.PCService.FileGuard + * @since 4.0.0(10) + */ + tag: string; + } + /** + * Provides methods for file scanning callback. + * + * @interface ScanFileCallback + * @syscap SystemCapability.PCService.FileGuard + * @since 4.0.0(10) + */ + interface ScanFileCallback { + /** + * Notifies the client of the scan result. + * + * @param { Array } files - List of scanned files. + * @syscap SystemCapability.PCService.FileGuard + * @since 4.0.0(10) + */ + onReceiveFileList(files: Array): void; + /** + * Notifies the client that the scan task is completed. + * + * @param { number } count - Total number of scanned files. + * @syscap SystemCapability.PCService.FileGuard + * @since 4.0.0(10) + */ + onTaskCompleted(count: number): void; + } + /** + * Provides methods for file management and control. + * + * @syscap SystemCapability.PCService.FileGuard + * @since 4.0.0(10) + */ + class FileGuard { + /** + * @syscap SystemCapability.PCService.FileGuard + * @since 4.0.0(10) + */ + constructor(); + /** + * start to get file list from common directory. + * @permission ohos.permission.FILE_GUARD_MANAGER + * @param { CommonDirScanType } type - Public directory scan scope. + * @param { ScanFileCallback } callback - The callback of scan result. + * @param { number } [batchNum] - The number of file lists returned each time. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - The parameter check failed. + * @syscap SystemCapability.PCService.FileGuard + * @since 4.0.0(10) + */ + startFileScanTask(type: CommonDirScanType, callback: ScanFileCallback, batchNum?: number): void; + /** + * start to get file list from customized directory. + * @permission ohos.permission.FILE_GUARD_MANAGER + * @param { string } path - The customized directory. + * @param { ScanFileCallback } callback - The callback of scan result. + * @param { number } [batchNum] - The number of file lists returned each time. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - The parameter check failed. + * @syscap SystemCapability.PCService.FileGuard + * @since 4.0.0(10) + */ + startFileScanTask(path: string, callback: ScanFileCallback, batchNum?: number): void; + /** + * Open a file. + * @permission ohos.permission.FILE_GUARD_MANAGER + * @param { string } path - Absolute path of the file. + * @param { AsyncCallback } callback - The callback is used to return the file descriptor. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - The parameter check failed. + * @syscap SystemCapability.PCService.FileGuard + * @since 4.0.0(10) + */ + openFile(path: string, callback: AsyncCallback): void; + /** + * Open a file. + * @permission ohos.permission.FILE_GUARD_MANAGER + * @param { string } path - Absolute path of the file. + * @returns { Promise } Returns the file descriptor. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - The parameter check failed. + * @syscap SystemCapability.PCService.FileGuard + * @since 4.0.0(10) + */ + openFile(path: string): Promise; + /** + * Set file tag for a KIA File. + * @permission ohos.permission.FILE_GUARD_MANAGER + * @param { string } path - Absolute path of the KIA file. + * @param { SecurityLevel } level - File security level. + * @param { string } tag - File attribute tag. + * @param { AsyncCallback } callback - Asynchronous callback interface. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - The parameter check failed. + * @syscap SystemCapability.PCService.FileGuard + * @since 4.0.0(10) + */ + setFileTag(path: string, level: SecurityLevel, tag: string, callback: AsyncCallback): void; + /** + * Set file tag for a KIA File. + * @permission ohos.permission.FILE_GUARD_MANAGER + * @param { string } path - Absolute path of the KIA file. + * @param { SecurityLevel } level - File security level. + * @param { string } tag - File attribute tag. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - The parameter check failed. + * @syscap SystemCapability.PCService.FileGuard + * @since 4.0.0(10) + */ + setFileTag(path: string, level: SecurityLevel, tag: string): Promise; + /** + * Query file tag. + * @permission ohos.permission.FILE_GUARD_MANAGER + * @param { string } path - Absolute path of the KIA file. + * @param { AsyncCallback } callback - The callback is used to return the security level and tag. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - The parameter check failed. + * @syscap SystemCapability.PCService.FileGuard + * @since 4.0.0(10) + */ + queryFileTag(path: string, callback: AsyncCallback): void; + /** + * Query file tag. + * @permission ohos.permission.FILE_GUARD_MANAGER + * @param { string } path - Absolute path of the KIA file. + * @returns { Promise } Returns the security level and tag. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - The parameter check failed. + * @syscap SystemCapability.PCService.FileGuard + * @since 4.0.0(10) + */ + queryFileTag(path: string): Promise; + /** + * get the URI of a file. + * @permission ohos.permission.FILE_GUARD_MANAGER + * @param { string } path - Absolute path of the KIA file. + * @param { AsyncCallback } callback - The callback is used to return the absolute file path and uri + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - The parameter check failed. + * @syscap SystemCapability.PCService.FileGuard + * @since 4.0.0(10) + */ + getFileUri(path: string, callback: AsyncCallback): void; + /** + * get the URI of a file. + * @permission ohos.permission.FILE_GUARD_MANAGER + * @param { string } path - Absolute path of the KIA file. + * @returns { Promise } Returns the absolute file path and uri + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - The parameter check failed. + * @syscap SystemCapability.PCService.FileGuard + * @since 4.0.0(10) + */ + getFileUri(path: string): Promise; + /** + * Delete a file. + * @permission ohos.permission.FILE_GUARD_MANAGER + * @param { string } path - Absolute path of the KIA file. + * @param { AsyncCallback } callback - Asynchronous callback interface. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - The parameter check failed. + * @syscap SystemCapability.PCService.FileGuard + * @since 4.0.0(10) + */ + deleteFile(path: string, callback: AsyncCallback): void; + /** + * Delete a file. + * @permission ohos.permission.FILE_GUARD_MANAGER + * @param { string } path - Absolute path of the KIA file. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - The parameter check failed. + * @syscap SystemCapability.PCService.FileGuard + * @since 4.0.0(10) + */ + deleteFile(path: string): Promise; + /** + * Update the security control policy. + * @permission ohos.permission.SET_FILE_GUARD_POLICY + * @param { string } policy - The security control policy. + * @param { AsyncCallback } callback - Asynchronous callback interface. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - The parameter check failed. + * @syscap SystemCapability.PCService.FileGuard + * @since 4.0.0(10) + */ + updatePolicy(policy: string, callback: AsyncCallback): void; + /** + * Update the security control policy. + * @permission ohos.permission.SET_FILE_GUARD_POLICY + * @param { string } policy - The security control policy. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - The parameter check failed. + * @syscap SystemCapability.PCService.FileGuard + * @since 4.0.0(10) + */ + updatePolicy(policy: string): Promise; + /** + * Set the KIA file list. + * @permission ohos.permission.FILE_GUARD_MANAGER + * @param { string } filelist - KIA file list. + * @param { AsyncCallback } callback - Asynchronous callback interface. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - The parameter check failed. + * @syscap SystemCapability.PCService.FileGuard + * @since 4.0.0(10) + */ + setKiaFilelist(filelist: string, callback: AsyncCallback): void; + /** + * Set the KIA file list. + * @permission ohos.permission.FILE_GUARD_MANAGER + * @param { string } filelist - KIA file list. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - The parameter check failed. + * @syscap SystemCapability.PCService.FileGuard + * @since 4.0.0(10) + */ + setKiaFilelist(filelist: string): Promise; + } +} +export default fileGuard; diff --git a/language/arkts/extractor/sdk/hms/ets/api/@hms.pcService.statusBarManager.d.ts b/language/arkts/extractor/sdk/hms/ets/api/@hms.pcService.statusBarManager.d.ts new file mode 100755 index 00000000..e38be24a --- /dev/null +++ b/language/arkts/extractor/sdk/hms/ets/api/@hms.pcService.statusBarManager.d.ts @@ -0,0 +1,256 @@ +/* + * Copyright (c) Huawei Technologies Co., Ltd. 2024-2024. All rights reserved. + */ +/** + * @file Defines the capabilities of status bar manager module. + * @kit StatusBarExtensionKit + */ +import image from '@ohos.multimedia.image'; +import common from '@ohos.app.ability.common'; +/** + * This module provides api to access to the status bar. + * @namespace statusBarManager + * + * @syscap SystemCapability.PCService.StatusBarManager + * @since 5.0.0(12) + */ +declare namespace statusBarManager { + /** + * The details of the StatusBar item. + * + * @syscap SystemCapability.PCService.StatusBarManager + * @since 5.0.0(12) + */ + interface StatusBarItem { + /** + * The icon information. + * + * @type { StatusBarIcon } + * @syscap SystemCapability.PCService.StatusBarManager + * @since 5.0.0(12) + */ + icons: StatusBarIcon; + /** + * Quick operation information in the left-click pop-up window. + * + * @type { QuickOperation } + * @syscap SystemCapability.PCService.StatusBarManager + * @since 5.0.0(12) + */ + quickOperation: QuickOperation; + /** + * Information about the right-click menu of the icon in the status bar. + * + * @type { ?Array } + * @syscap SystemCapability.PCService.StatusBarManager + * @since 5.0.0(12) + */ + statusBarGroupMenu?: Array; + } + /** + * The app icon in status bar. + * + * @syscap SystemCapability.PCService.StatusBarManager + * @since 5.0.0(12) + */ + interface StatusBarIcon { + /** + * The icon on the dark background + * + * @type { image.PixelMap } + * @syscap SystemCapability.PCService.StatusBarManager + * @since 5.0.0(12) + */ + white: image.PixelMap; + /** + * The icon on the light background. + * + * @type { image.PixelMap } + * @syscap SystemCapability.PCService.StatusBarManager + * @since 5.0.0(12) + */ + black: image.PixelMap; + } + /** + * The menu group infomation of the icon of status bar. + * + * @syscap SystemCapability.PCService.StatusBarManager + * @since 5.0.0(12) + */ + type StatusBarGroupMenu = Array; + /** + * The information of single menu item in the status bar. + * + * @syscap SystemCapability.PCService.StatusBarManager + * @since 5.0.0(12) + */ + interface StatusBarMenuItem { + /** + * The title of the menu item. + * + * @type { string } + * @syscap SystemCapability.PCService.StatusBarManager + * @since 5.0.0(12) + */ + title: string; + /** + * The action information of the menu item. + * + * @type { ?StatusBarMenuAction } + * @syscap SystemCapability.PCService.StatusBarManager + * @since 5.0.0(12) + */ + menuAction?: StatusBarMenuAction; + /** + * Submenu information. + * + * @type { ?Array } + * @syscap SystemCapability.PCService.StatusBarManager + * @since 5.0.0(12) + */ + subMenu?: Array; + } + /** + * Menu Item Action. + * The function of starting ability of the current application is supported currently. + * + * @syscap SystemCapability.PCService.StatusBarManager + * @since 5.0.0(12) + */ + interface StatusBarMenuAction { + /** + * ability name of application. + * + * @type { string } + * @syscap SystemCapability.PCService.StatusBarManager + * @since 5.0.0(12) + */ + abilityName: string; + /** + * The description of an module name in an want. + * + * @type { ?string } + * @syscap SystemCapability.PCService.StatusBarManager + * @since 5.0.0(12) + */ + moduleName?: string; + } + /** + * The information of submenu item in the statusbar. + * + * @syscap SystemCapability.PCService.StatusBarManager + * @since 5.0.0(12) + */ + interface StatusBarSubMenuItem { + /** + * The title of the submenu item. + * + * @type { string } + * @syscap SystemCapability.PCService.StatusBarManager + * @since 5.0.0(12) + */ + subTitle: string; + /** + * The action information of the submenu item. + * + * @type { StatusBarMenuAction } + * @syscap SystemCapability.PCService.StatusBarManager + * @since 5.0.0(12) + */ + menuAction: StatusBarMenuAction; + } + /** + * Quick operation information in the left-click pop-up window corresponding to the icon in the status bar. + * + * @syscap SystemCapability.PCService.StatusBarManager + * @since 5.0.0(12) + */ + interface QuickOperation { + /** + * The title of QuickOperation window. + * + * @type { string } + * @syscap SystemCapability.PCService.StatusBarManager + * @since 5.0.0(12) + */ + title: string; + /** + * The height of QuickOperation window. + * + * @type { number } + * @syscap SystemCapability.PCService.StatusBarManager + * @since 5.0.0(12) + */ + height: number; + /** + * The name of the custom AccessViewExtensionAbility + * + * @type { string } + * @syscap SystemCapability.PCService.StatusBarManager + * @since 5.0.0(12) + */ + abilityName: string; + /** + * The description of an module name in an want. + * + * @type { ?string } + * @syscap SystemCapability.PCService.StatusBarManager + * @since 5.0.0(12) + */ + moduleName?: string; + } + /** + * Add the app icon to the status bar. + * + * @param { common.Context } context - context. + * @param { StatusBarItem } statusBarItem - The details of the icon in status bar. + * @throws { BusinessError } 401 - The parameter check failed. + * @throws { BusinessError } 1010710001 - The size of the pixelmap exceeds the limit. + * @throws { BusinessError } 1010710002 - The number of menu items or submenu items exceeds the limit. + * @throws { BusinessError } 1010720001 - A menu item contains neither submenu nor menuAction. + * @syscap SystemCapability.PCService.StatusBarManager + * @since 5.0.0(12) + */ + function addToStatusBar(context: common.Context, statusbarItem: StatusBarItem): void; + /** + * Remove the app icon from the status bar. + * + * @param { common.Context } context - context. + * @syscap SystemCapability.PCService.StatusBarManager + * @since 5.0.0(12) + */ + function removeFromStatusBar(context: common.Context): void; + /** + * Updated the right-click menu information of the app icon in the status bar. + * + * @param { common.Context } context - context. + * @param { Array } statusBarGroupMenus - The menu infomation of the icon of status bar. + * @throws { BusinessError } 401 - The parameter check failed. + * @throws { BusinessError } 1010710002 - The number of menu items or submenu items exceeds the limit. + * @throws { BusinessError } 1010720001 - A menu item contains neither submenu nor menuAction. + * @syscap SystemCapability.PCService.StatusBarManager + * @since 5.0.0(12) + */ + function updateStatusBarMenu(context: common.Context, statusBarGroupMenus: Array): void; + /** + * Updated the left-click menu height of the app icon in the status bar. + * + * @param { common.Context } context - context. + * @param { number } height - The height of the custom area in the left-click pop-up window. + * @throws { BusinessError } 401 - The parameter check failed. + * @syscap SystemCapability.PCService.StatusBarManager + * @since 5.0.0(12) + */ + function updateQuickOperationHeight(context: common.Context, height: number): void; + /** + * Update the app icon in the status bar. + * + * @param { StatusBarIcon } statusBarIcon - The information of the app icon in status bar. + * @throws { BusinessError } 401 - The parameter check failed. + * @throws { BusinessError } 1010710001 - The size of the pixelmap exceeds the limit. + * @syscap SystemCapability.PCService.StatusBarManager + * @since 5.0.0(12) + */ + function updateStatusBarIcon(context: common.Context, statusBarIcon: StatusBarIcon): void; +} +export default statusBarManager; diff --git a/language/arkts/extractor/sdk/hms/ets/api/@hms.security.deviceCertificate.d.ts b/language/arkts/extractor/sdk/hms/ets/api/@hms.security.deviceCertificate.d.ts new file mode 100755 index 00000000..196026d4 --- /dev/null +++ b/language/arkts/extractor/sdk/hms/ets/api/@hms.security.deviceCertificate.d.ts @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. All rights reserved. + */ +/** + * @file This module provides the capabilities to device certification. + * @kit DeviceSecurityKit + */ +/** + * Provides public api based device certificate. + * + * @namespace deviceCertificate + * @syscap SystemCapability.Security.DeviceCertificate + * @since 5.0.0(12) + */ +declare namespace deviceCertificate { + /** + * Provides to get device Token. + * + * @returns { Promise } the device token. + * @throws { BusinessError } 201 - has no permission. + * @throws { BusinessError } 1003300005 - internal error. + * @throws { BusinessError } 1003300006 - access cloud server fail. + * @syscap SystemCapability.Security.DeviceCertificate + * @since 5.0.0(12) + */ + function getDeviceToken(): Promise; +} +export default deviceCertificate; diff --git a/language/arkts/extractor/sdk/hms/ets/api/@hms.security.fido.d.ts b/language/arkts/extractor/sdk/hms/ets/api/@hms.security.fido.d.ts new file mode 100755 index 00000000..56aa64d0 --- /dev/null +++ b/language/arkts/extractor/sdk/hms/ets/api/@hms.security.fido.d.ts @@ -0,0 +1,941 @@ +/* + * Copyright (c) Huawei Technologies Co., Ltd. 2023-2023. All rights reserved. + */ +/** + * @file This module provides the capabilities to use FIDO online authentication. + * @kit OnlineAuthenticationKit + */ +import type common from '@ohos.app.ability.common'; +/** + * This module provides the capabilities to use fido authentication. + * + * @namespace fido + * @syscap SystemCapability.Security.FIDO + * @since 4.1.0(11) + */ +/** + * This module provides the capabilities to use fido authentication. + * + * @namespace fido + * @syscap SystemCapability.Security.FIDO + * @atomicservice + * @since 5.0.0(12) + */ +declare namespace fido { + /** + * ChannelBinding contains channel binding information. + * + * @typedef ChannelBinding + * @syscap SystemCapability.Security.FIDO + * @since 4.1.0(11) + */ + /** + * ChannelBinding contains channel binding information. + * + * @typedef ChannelBinding + * @syscap SystemCapability.Security.FIDO + * @atomicservice + * @since 5.0.0(12) + */ + interface ChannelBinding { + /** + * The field serverEndPoint must be set to the base64url-encoded hash of the TLS server certificate + * if this is available. + * + * @type { ?string } + * @syscap SystemCapability.Security.FIDO + * @since 4.1.0(11) + */ + /** + * The field serverEndPoint must be set to the base64url-encoded hash of the TLS server certificate + * if this is available. + * + * @type { ?string } + * @syscap SystemCapability.Security.FIDO + * @atomicservice + * @since 5.0.0(12) + */ + serverEndPoint?: string; + /** + * This field must be absent if the TLS server certificate is not available to the FIDO UAF Client. + * This field must be set to the base64url-encoded, DER-encoded TLS server certificate, if this data + * is available to the FIDO UAF Client. + * + * @type { ?string } + * @syscap SystemCapability.Security.FIDO + * @since 4.1.0(11) + */ + /** + * This field must be absent if the TLS server certificate is not available to the FIDO UAF Client. + * This field must be set to the base64url-encoded, DER-encoded TLS server certificate, if this data + * is available to the FIDO UAF Client. + * + * @type { ?string } + * @syscap SystemCapability.Security.FIDO + * @atomicservice + * @since 5.0.0(12) + */ + tlsServerCertificate?: string; + /** + * Must be set to the base64url-encoded TLS channel Finished structure. + * It must, however, be absent, if this data is not available to the FIDO UAF Client. + * + * @type { ?string } + * @syscap SystemCapability.Security.FIDO + * @since 4.1.0(11) + */ + /** + * Must be set to the base64url-encoded TLS channel Finished structure. + * It must, however, be absent, if this data is not available to the FIDO UAF Client. + * + * @type { ?string } + * @syscap SystemCapability.Security.FIDO + * @atomicservice + * @since 5.0.0(12) + */ + tlsUnique?: string; + /** + * Must be absent if the client TLS stack doesn't provide TLS ChannelID information to the processing entity. + * Must be set to "unused" if TLS ChannelID information is supported by the client-side TLS stack but has not + * been signaled by the TLS (web) server. + * + * @type { ?string } + * @syscap SystemCapability.Security.FIDO + * @since 4.1.0(11) + */ + /** + * Must be absent if the client TLS stack doesn't provide TLS ChannelID information to the processing entity. + * Must be set to "unused" if TLS ChannelID information is supported by the client-side TLS stack but has not + * been signaled by the TLS (web) server. + * + * @type { ?string } + * @syscap SystemCapability.Security.FIDO + * @atomicservice + * @since 5.0.0(12) + */ + cidPubkey?: string; + /** + * Must be absent if the client TLS stack doesn't provide Token Binding ID information to the processing entity. + * Must be set to "unused" if Token Binding ID information is supported by the client-side TLS stack but has not + * been signaled by the TLS (web) server. + * Otherwise, it must be set to the base64url-encoded serialized TokenBindingID structure using UTF-8 encoding. + * + * @type { ?string } + * @syscap SystemCapability.Security.FIDO + * @since 4.1.0(11) + */ + /** + * Must be absent if the client TLS stack doesn't provide Token Binding ID information to the processing entity. + * Must be set to "unused" if Token Binding ID information is supported by the client-side TLS stack but has not + * been signaled by the TLS (web) server. + * Otherwise, it must be set to the base64url-encoded serialized TokenBindingID structure using UTF-8 encoding. + * + * @type { ?string } + * @syscap SystemCapability.Security.FIDO + * @atomicservice + * @since 5.0.0(12) + */ + tokenBinding?: string; + } + /** + * The UAFMessage dictionary is a wrapper object that contains the raw UAF protocol Message and additional JSON data. + * + * @typedef UAFMessage + * @syscap SystemCapability.Security.FIDO + * @since 4.1.0(11) + */ + /** + * The UAFMessage dictionary is a wrapper object that contains the raw UAF protocol Message and additional JSON data. + * + * @typedef UAFMessage + * @syscap SystemCapability.Security.FIDO + * @atomicservice + * @since 5.0.0(12) + */ + interface UAFMessage { + /** + * This key contains the UAF protocol Message that will be processed by the FIDO UAF Client or Server. + * + * @type { string } + * @syscap SystemCapability.Security.FIDO + * @since 4.1.0(11) + */ + /** + * This key contains the UAF protocol Message that will be processed by the FIDO UAF Client or Server. + * + * @type { string } + * @syscap SystemCapability.Security.FIDO + * @atomicservice + * @since 5.0.0(12) + */ + uafProtocolMessage: string; + /** + * This key allows the FIDO Server or client application to attach additional data. + * + * @type { ?string } + * @syscap SystemCapability.Security.FIDO + * @since 4.1.0(11) + */ + /** + * This key allows the FIDO Server or client application to attach additional data. + * + * @type { ?string } + * @syscap SystemCapability.Security.FIDO + * @atomicservice + * @since 5.0.0(12) + */ + additionalData?: string; + } + /** + * Describes a version of the UAF protocol. + * + * @typedef Version + * @syscap SystemCapability.Security.FIDO + * @since 4.1.0(11) + */ + /** + * Describes a version of the UAF protocol. + * + * @typedef Version + * @syscap SystemCapability.Security.FIDO + * @atomicservice + * @since 5.0.0(12) + */ + interface Version { + /** + * Major version number. + * + * @type { number } + * @syscap SystemCapability.Security.FIDO + * @since 4.1.0(11) + */ + /** + * Major version number. + * + * @type { number } + * @syscap SystemCapability.Security.FIDO + * @atomicservice + * @since 5.0.0(12) + */ + major: number; + /** + * Minor version number. + * + * @type { number } + * @syscap SystemCapability.Security.FIDO + * @since 4.1.0(11) + */ + /** + * Minor version number. + * + * @type { number } + * @syscap SystemCapability.Security.FIDO + * @atomicservice + * @since 5.0.0(12) + */ + minor: number; + } + /** + * Describes an RGB three-sample tuple palette entry. + * + * @typedef RgbPaletteEntry + * @syscap SystemCapability.Security.FIDO + * @since 4.1.0(11) + */ + /** + * Describes an RGB three-sample tuple palette entry. + * + * @typedef RgbPaletteEntry + * @syscap SystemCapability.Security.FIDO + * @atomicservice + * @since 5.0.0(12) + */ + interface RgbPaletteEntry { + /** + * Red channel sample value + * + * @type { number } + * @syscap SystemCapability.Security.FIDO + * @since 4.1.0(11) + */ + /** + * Red channel sample value + * + * @type { number } + * @syscap SystemCapability.Security.FIDO + * @atomicservice + * @since 5.0.0(12) + */ + r: number; + /** + * Green channel sample value + * + * @type { number } + * @syscap SystemCapability.Security.FIDO + * @since 4.1.0(11) + */ + /** + * Green channel sample value + * + * @type { number } + * @syscap SystemCapability.Security.FIDO + * @atomicservice + * @since 5.0.0(12) + */ + g: number; + /** + * Blue channel sample value + * + * @type { number } + * @syscap SystemCapability.Security.FIDO + * @since 4.1.0(11) + */ + /** + * Blue channel sample value + * + * @type { number } + * @syscap SystemCapability.Security.FIDO + * @atomicservice + * @since 5.0.0(12) + */ + b: number; + } + /** + * Describes a PNG image characteristics as defined in the PNG spec for image header and palette table. + * + * @typedef DisplayPNGCharacteristicsDescriptor + * @syscap SystemCapability.Security.FIDO + * @since 4.1.0(11) + */ + /** + * Describes a PNG image characteristics as defined in the PNG spec for image header and palette table. + * + * @typedef DisplayPNGCharacteristicsDescriptor + * @syscap SystemCapability.Security.FIDO + * @atomicservice + * @since 5.0.0(12) + */ + interface DisplayPNGCharacteristicsDescriptor { + /** + * Image width + * + * @type { number } + * @syscap SystemCapability.Security.FIDO + * @since 4.1.0(11) + */ + /** + * Image width + * + * @type { number } + * @syscap SystemCapability.Security.FIDO + * @atomicservice + * @since 5.0.0(12) + */ + width: number; + /** + * Image height + * + * @type { number } + * @syscap SystemCapability.Security.FIDO + * @since 4.1.0(11) + */ + /** + * Image height + * + * @type { number } + * @syscap SystemCapability.Security.FIDO + * @atomicservice + * @since 5.0.0(12) + */ + height: number; + /** + * Bit depth + * + * @type { number } + * @syscap SystemCapability.Security.FIDO + * @since 4.1.0(11) + */ + /** + * Bit depth + * + * @type { number } + * @syscap SystemCapability.Security.FIDO + * @atomicservice + * @since 5.0.0(12) + */ + bitDepth: number; + /** + * Color type defines the PNG image type. + * + * @type { number } + * @syscap SystemCapability.Security.FIDO + * @since 4.1.0(11) + */ + /** + * Color type defines the PNG image type. + * + * @type { number } + * @syscap SystemCapability.Security.FIDO + * @atomicservice + * @since 5.0.0(12) + */ + colorType: number; + /** + * Compression method used to compress the image data. + * + * @type { number } + * @syscap SystemCapability.Security.FIDO + * @since 4.1.0(11) + */ + /** + * Compression method used to compress the image data. + * + * @type { number } + * @syscap SystemCapability.Security.FIDO + * @atomicservice + * @since 5.0.0(12) + */ + compression: number; + /** + * Filter method is the preprocessing method applied to the image data before compression. + * + * @type { number } + * @syscap SystemCapability.Security.FIDO + * @since 4.1.0(11) + */ + /** + * Filter method is the preprocessing method applied to the image data before compression. + * + * @type { number } + * @syscap SystemCapability.Security.FIDO + * @atomicservice + * @since 5.0.0(12) + */ + filter: number; + /** + * Interlace method is the transmission order of the image data. + * + * @type { number } + * @syscap SystemCapability.Security.FIDO + * @since 4.1.0(11) + */ + /** + * Interlace method is the transmission order of the image data. + * + * @type { number } + * @syscap SystemCapability.Security.FIDO + * @atomicservice + * @since 5.0.0(12) + */ + interlace: number; + /** + * 1 to 256 palette entries + * + * @type { number } + * @syscap SystemCapability.Security.FIDO + * @since 4.1.0(11) + */ + /** + * 1 to 256 palette entries + * + * @type { number } + * @syscap SystemCapability.Security.FIDO + * @atomicservice + * @since 5.0.0(12) + */ + plte?: Array; + } + /** + * Describes the subset of both verified metadata and transient information about the state of an available authenticator. + * + * @typedef Authenticator + * @syscap SystemCapability.Security.FIDO + * @since 4.1.0(11) + */ + /** + * Describes the subset of both verified metadata and transient information about the state of an available authenticator. + * + * @typedef Authenticator + * @syscap SystemCapability.Security.FIDO + * @atomicservice + * @since 5.0.0(12) + */ + interface Authenticator { + /** + * Name for the authenticator + * + * @readonly + * @syscap SystemCapability.Security.FIDO + * @since 4.1.0(11) + */ + /** + * Name for the authenticator + * + * @readonly + * @syscap SystemCapability.Security.FIDO + * @atomicservice + * @since 5.0.0(12) + */ + readonly title: string; + /** + * The Authenticator Attestation ID, which identifies the type and batch of the authenticator. + * + * @readonly + * @syscap SystemCapability.Security.FIDO + * @since 4.1.0(11) + */ + /** + * The Authenticator Attestation ID, which identifies the type and batch of the authenticator. + * + * @readonly + * @syscap SystemCapability.Security.FIDO + * @atomicservice + * @since 5.0.0(12) + */ + readonly aaid: string; + /** + * The description string for the authenticator. + * + * @readonly + * @syscap SystemCapability.Security.FIDO + * @since 4.1.0(11) + */ + /** + * The description string for the authenticator. + * + * @readonly + * @syscap SystemCapability.Security.FIDO + * @atomicservice + * @since 5.0.0(12) + */ + readonly description: string; + /** + * Indicates the UAF protocol Versions supported by the authenticator. + * + * @readonly + * @syscap SystemCapability.Security.FIDO + * @since 4.1.0(11) + */ + /** + * Indicates the UAF protocol Versions supported by the authenticator. + * + * @readonly + * @syscap SystemCapability.Security.FIDO + * @atomicservice + * @since 5.0.0(12) + */ + readonly supportedUAFVersions: Array; + /** + * The assertion scheme the authenticator uses for attested data and signatures. + * + * @readonly + * @syscap SystemCapability.Security.FIDO + * @since 4.1.0(11) + */ + /** + * The assertion scheme the authenticator uses for attested data and signatures. + * + * @readonly + * @syscap SystemCapability.Security.FIDO + * @atomicservice + * @since 5.0.0(12) + */ + readonly assertionScheme: string; + /** + * Supported Authentication Algorithm. + * + * @readonly + * @syscap SystemCapability.Security.FIDO + * @since 4.1.0(11) + */ + /** + * Supported Authentication Algorithm. + * + * @readonly + * @syscap SystemCapability.Security.FIDO + * @atomicservice + * @since 5.0.0(12) + */ + readonly authenticationAlgorithm: number; + /** + * A list of supported attestation types. + * + * @readonly + * @syscap SystemCapability.Security.FIDO + * @since 4.1.0(11) + */ + /** + * A list of supported attestation types. + * + * @readonly + * @syscap SystemCapability.Security.FIDO + * @atomicservice + * @since 5.0.0(12) + */ + readonly attestationTypes: Array; + /** + * A set of bit flags indicating the user verification methods supported by the authenticator. + * + * @readonly + * @syscap SystemCapability.Security.FIDO + * @since 4.1.0(11) + */ + /** + * A set of bit flags indicating the user verification methods supported by the authenticator. + * + * @readonly + * @syscap SystemCapability.Security.FIDO + * @atomicservice + * @since 5.0.0(12) + */ + readonly userVerification: number; + /** + * A set of bit flags indicating the key protection used by the authenticator. + * + * @readonly + * @syscap SystemCapability.Security.FIDO + * @since 4.1.0(11) + */ + /** + * A set of bit flags indicating the key protection used by the authenticator. + * + * @readonly + * @syscap SystemCapability.Security.FIDO + * @atomicservice + * @since 5.0.0(12) + */ + readonly keyProtection: number; + /** + * A set of bit flags indicating the matcher protection used by the authenticator. + * + * @readonly + * @syscap SystemCapability.Security.FIDO + * @since 4.1.0(11) + */ + /** + * A set of bit flags indicating the matcher protection used by the authenticator. + * + * @readonly + * @syscap SystemCapability.Security.FIDO + * @atomicservice + * @since 5.0.0(12) + */ + readonly matcherProtection: number; + /** + * A set of bit flags indicating how the authenticator is currently connected to the FIDO User Device. + * + * @readonly + * @syscap SystemCapability.Security.FIDO + * @since 4.1.0(11) + */ + /** + * A set of bit flags indicating how the authenticator is currently connected to the FIDO User Device. + * + * @readonly + * @syscap SystemCapability.Security.FIDO + * @atomicservice + * @since 5.0.0(12) + */ + readonly attachmentHint: number; + /** + * Indicates whether the authenticator can only be used as a second-factor. + * + * @readonly + * @syscap SystemCapability.Security.FIDO + * @since 4.1.0(11) + */ + /** + * Indicates whether the authenticator can only be used as a second-factor. + * + * @readonly + * @syscap SystemCapability.Security.FIDO + * @atomicservice + * @since 5.0.0(12) + */ + readonly isSecondFactorOnly: boolean; + /** + * A set of bit flags indicating the availability and type of transaction confirmation display. + * + * @readonly + * @syscap SystemCapability.Security.FIDO + * @since 4.1.0(11) + */ + /** + * A set of bit flags indicating the availability and type of transaction confirmation display. + * + * @readonly + * @syscap SystemCapability.Security.FIDO + * @atomicservice + * @since 5.0.0(12) + */ + readonly tcDisplay: number; + /** + * The MIME content-type [RFC2045] supported by the transaction confirmation display. + * + * @readonly + * @syscap SystemCapability.Security.FIDO + * @since 4.1.0(11) + */ + /** + * The MIME content-type [RFC2045] supported by the transaction confirmation display. + * + * @readonly + * @syscap SystemCapability.Security.FIDO + * @atomicservice + * @since 5.0.0(12) + */ + readonly tcDisplayContentType: string; + /** + * The set of PNG characteristics currently supported by the transaction confirmation display. + * + * @readonly + * @syscap SystemCapability.Security.FIDO + * @since 4.1.0(11) + */ + /** + * The set of PNG characteristics currently supported by the transaction confirmation display. + * + * @readonly + * @syscap SystemCapability.Security.FIDO + * @atomicservice + * @since 5.0.0(12) + */ + readonly tcDisplayPNGCharacteristics: Array; + /** + * A PNG [PNG] icon for the authenticator. + * + * @readonly + * @syscap SystemCapability.Security.FIDO + * @since 4.1.0(11) + */ + /** + * A PNG [PNG] icon for the authenticator. + * + * @readonly + * @syscap SystemCapability.Security.FIDO + * @atomicservice + * @since 5.0.0(12) + */ + readonly icon: string; + /** + * A list of supported UAF protocol extension identifiers. + * + * @readonly + * @syscap SystemCapability.Security.FIDO + * @since 4.1.0(11) + */ + /** + * A list of supported UAF protocol extension identifiers. + * + * @readonly + * @syscap SystemCapability.Security.FIDO + * @atomicservice + * @since 5.0.0(12) + */ + readonly supportedExtensionIDs: Array; + } + /** + * Describes the current state of FIDO UAF client software and authenticators available to the application. + * + * @typedef DiscoveryData + * @syscap SystemCapability.Security.FIDO + * @since 4.1.0(11) + */ + /** + * Describes the current state of FIDO UAF client software and authenticators available to the application. + * + * @typedef DiscoveryData + * @syscap SystemCapability.Security.FIDO + * @atomicservice + * @since 5.0.0(12) + */ + interface DiscoveryData { + /** + * List of FIDO UAF protocol versions supported by the client, most-preferred first. + * + * @type { Array } + * @syscap SystemCapability.Security.FIDO + * @since 4.1.0(11) + */ + /** + * List of FIDO UAF protocol versions supported by the client, most-preferred first. + * + * @type { Array } + * @syscap SystemCapability.Security.FIDO + * @atomicservice + * @since 5.0.0(12) + */ + supportedUAFVersions: Array; + /** + * Vendor of the FIDO UAF. + * + * @type { string } + * @syscap SystemCapability.Security.FIDO + * @since 4.1.0(11) + */ + /** + * Vendor of the FIDO UAF. + * + * @type { string } + * @syscap SystemCapability.Security.FIDO + * @atomicservice + * @since 5.0.0(12) + */ + clientVendor: string; + /** + * The version of the FIDO UAF Client. + * + * @type { Version } + * @syscap SystemCapability.Security.FIDO + * @since 4.1.0(11) + */ + /** + * The version of the FIDO UAF Client. + * + * @type { Version } + * @syscap SystemCapability.Security.FIDO + * @atomicservice + * @since 5.0.0(12) + */ + clientVersion: Version; + /** + * An array containing Authenticator dictionaries describing the available UAF authenticators. The order is not significant. The list may be empty. + * + * @type { string } + * @syscap SystemCapability.Security.FIDO + * @since 4.1.0(11) + */ + /** + * An array containing Authenticator dictionaries describing the available UAF authenticators. The order is not significant. The list may be empty. + * + * @type { string } + * @syscap SystemCapability.Security.FIDO + * @atomicservice + * @since 5.0.0(12) + */ + availableAuthenticators: Array; + } + /** + * Discovers the authentication capability of the device and returns the authenticator data supported + * by the current device software. + * + * @param { common.Context } context - The context of an ability. + * @returns { Promise } return parameter of type DiscoveryData + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 1005900015 - System Interruption. + * @throws { BusinessError } 1005900016 - Unknown error. + * @syscap SystemCapability.Security.FIDO + * @since 4.1.0(11) + */ + /** + * Discovers the authentication capability of the device and returns the authenticator data supported + * by the current device software. + * + * @param { common.Context } context - The context of an ability. + * @returns { Promise } return parameter of type DiscoveryData + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 1005900015 - System Interruption. + * @throws { BusinessError } 1005900016 - Unknown error. + * @syscap SystemCapability.Security.FIDO + * @atomicservice + * @since 5.0.0(12) + */ + function discover(context: common.Context): Promise; + /** + * Check whether the user policy is enabled. + * + * @param { common.Context } context - The context of an ability. + * @param { UAFMessage } uafRequest - The parameter of type UAFMessage. + * @returns { Promise } return parameter of type void + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 1005900005 - No authenticator matching the authenticator policy specified is available. + * @throws { BusinessError } 1005900006 - A violation of the UAF protocol occurred. + * @throws { BusinessError } 1005900015 - System Interruption. + * @throws { BusinessError } 1005900016 - Unknown error. + * @syscap SystemCapability.Security.FIDO + * @since 4.1.0(11) + */ + /** + * Check whether the user policy is enabled. + * + * @param { common.Context } context - The context of an ability. + * @param { UAFMessage } uafRequest - The parameter of type UAFMessage. + * @returns { Promise } return parameter of type void + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 1005900005 - No authenticator matching the authenticator policy specified is available. + * @throws { BusinessError } 1005900006 - A violation of the UAF protocol occurred. + * @throws { BusinessError } 1005900015 - System Interruption. + * @throws { BusinessError } 1005900016 - Unknown error. + * @syscap SystemCapability.Security.FIDO + * @atomicservice + * @since 5.0.0(12) + */ + function checkPolicy(context: common.Context, uafRequest: UAFMessage): Promise; + /** + * Interface for processing user operations + * + * @param { common.Context } context - The context of an ability. + * @param { UAFMessage } uafRequest - The parameter of type UAFMessage. + * @param { ChannelBinding } channelBindings - The parameter of type ChannelBinding. + * @returns { Promise } return parameter of type UAFMessage + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 1005900003 - User cancels. + * @throws { BusinessError } 1005900005 - No authenticator matching the authenticator policy specified is available. + * @throws { BusinessError } 1005900006 - A violation of the UAF protocol occurred. + * @throws { BusinessError } 1005900007 - No Facet_ID is registered. + * @throws { BusinessError } 1005900009 - The authenticator denies access to the generated request. + * @throws { BusinessError } 1005900014 - The user does not record biometric features or the authentication module is abnormal. + * @throws { BusinessError } 1005900015 - System Interruption. + * @throws { BusinessError } 1005900016 - Unknown error. + * @syscap SystemCapability.Security.FIDO + * @since 4.1.0(11) + */ + /** + * Interface for processing user operations + * + * @param { common.Context } context - The context of an ability. + * @param { UAFMessage } uafRequest - The parameter of type UAFMessage. + * @param { ChannelBinding } channelBindings - The parameter of type ChannelBinding. + * @returns { Promise } return parameter of type UAFMessage + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 1005900003 - User cancels. + * @throws { BusinessError } 1005900005 - No authenticator matching the authenticator policy specified is available. + * @throws { BusinessError } 1005900006 - A violation of the UAF protocol occurred. + * @throws { BusinessError } 1005900007 - No Facet_ID is registered. + * @throws { BusinessError } 1005900009 - The authenticator denies access to the generated request. + * @throws { BusinessError } 1005900014 - The user does not record biometric features or the authentication module is abnormal. + * @throws { BusinessError } 1005900015 - System Interruption. + * @throws { BusinessError } 1005900016 - Unknown error. + * @syscap SystemCapability.Security.FIDO + * @atomicservice + * @since 5.0.0(12) + */ + function processUAFOperation(context: common.Context, uafRequest: UAFMessage, channelBindings?: ChannelBinding): Promise; + /** + * Used to indicate the status code resulting from a FIDO UAF message delivered to the remote server. + * + * @param { common.Context } context - The context of an ability. + * @param { UAFMessage } uafResponse - The parameter of type UAFMessage. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 1005900006 - A violation of the UAF protocol occurred. + * @throws { BusinessError } 1005900015 - System Interruption. + * @throws { BusinessError } 1005900016 - Unknown error. + * @syscap SystemCapability.Security.FIDO + * @since 4.1.0(11) + */ + /** + * Used to indicate the status code resulting from a FIDO UAF message delivered to the remote server. + * + * @param { common.Context } context - The context of an ability. + * @param { UAFMessage } uafResponse - The parameter of type UAFMessage. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 1005900006 - A violation of the UAF protocol occurred. + * @throws { BusinessError } 1005900015 - System Interruption. + * @throws { BusinessError } 1005900016 - Unknown error. + * @syscap SystemCapability.Security.FIDO + * @atomicservice + * @since 5.0.0(12) + */ + function notifyUAFResult(context: common.Context, uafResponse: UAFMessage): Promise; +} +export default fido; diff --git a/language/arkts/extractor/sdk/hms/ets/api/@hms.security.ifaa.d.ts b/language/arkts/extractor/sdk/hms/ets/api/@hms.security.ifaa.d.ts new file mode 100755 index 00000000..b88e564b --- /dev/null +++ b/language/arkts/extractor/sdk/hms/ets/api/@hms.security.ifaa.d.ts @@ -0,0 +1,582 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. All rights reserved. + */ +/** + * @file This module provides the capabilities to use IFAA online authentication. + * @kit OnlineAuthenticationKit + */ +import type { AsyncCallback } from '@ohos.base'; +/** + * Support the IFAA protocol, provide platform infrastructure to support secret free payment, support super + * application ecosystem capabilities, and improve system security and user experience. + * + * @namespace ifaa + * @syscap SystemCapability.Security.Ifaa + * @since 4.1.0(11) + */ +/** + * Support the IFAA protocol, provide platform infrastructure to support secret free payment, support super + * application ecosystem capabilities, and improve system security and user experience. + * + * @namespace ifaa + * @syscap SystemCapability.Security.Ifaa + * @atomicservice + * @since 5.0.0(12) + */ +declare namespace ifaa { + /** + * Get ifaa version. + * + * @returns { Uint8Array } the anonymized deviceId. + * @syscap SystemCapability.Security.Ifaa + * @since 4.1.0(11) + */ + /** + * Get ifaa version. + * + * @returns { Uint8Array } the anonymized deviceId. + * @syscap SystemCapability.Security.Ifaa + * @atomicservice + * @since 5.0.0(12) + */ + function getVersionSync(): number; + /** + * Get anonymized deviceId. + * + * @param { Uint8Array } userToken - user token allocated by the ifaa alliance. + * @returns { Uint8Array } the anonymized deviceId. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 1006100001 - System Interruption. + * @throws { BusinessError } 1006100002 - The service is abnormal. + * @syscap SystemCapability.Security.Ifaa + * @since 4.1.0(11) + */ + /** + * Get anonymized deviceId. + * + * @param { Uint8Array } userToken - user token allocated by the ifaa alliance. + * @returns { Uint8Array } the anonymized deviceId. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 1006100001 - System Interruption. + * @throws { BusinessError } 1006100002 - The service is abnormal. + * @syscap SystemCapability.Security.Ifaa + * @atomicservice + * @since 5.0.0(12) + */ + function getAnonymousIdSync(userToken: Uint8Array): Uint8Array; + /** + * Get anonymized deviceId. + * + * @param { Uint8Array } userToken - user token allocated by the ifaa alliance. + * @returns { Promise } the promise used to return the anonymized deviceId. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 1006100001 - System Interruption. + * @throws { BusinessError } 1006100002 - The service is abnormal. + * @syscap SystemCapability.Security.Ifaa + * @since 4.1.0(11) + */ + /** + * Get anonymized deviceId. + * + * @param { Uint8Array } userToken - user token allocated by the ifaa alliance. + * @returns { Promise } the promise used to return the anonymized deviceId. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 1006100001 - System Interruption. + * @throws { BusinessError } 1006100002 - The service is abnormal. + * @syscap SystemCapability.Security.Ifaa + * @atomicservice + * @since 5.0.0(12) + */ + function getAnonymousId(userToken: Uint8Array): Promise; + /** + * Get anonymized deviceId. + * + * @param { Uint8Array } userToken - user token allocated by the ifaa alliance. + * @param { AsyncCallback } callback - the callback used to return the anonymized deviceId. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 1006100001 - System Interruption. + * @throws { BusinessError } 1006100002 - The service is abnormal. + * @syscap SystemCapability.Security.Ifaa + * @since 4.1.0(11) + */ + /** + * Get anonymized deviceId. + * + * @param { Uint8Array } userToken - user token allocated by the ifaa alliance. + * @param { AsyncCallback } callback - the callback used to return the anonymized deviceId. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 1006100001 - System Interruption. + * @throws { BusinessError } 1006100002 - The service is abnormal. + * @syscap SystemCapability.Security.Ifaa + * @atomicservice + * @since 5.0.0(12) + */ + function getAnonymousId(userToken: Uint8Array, callback: AsyncCallback): void; + /** + * Get the enabling status of the IFAA. + * + * @param { Uint8Array } userToken - user token allocated by the ifaa alliance. + * @returns { Promise } the promise used to return the enabling status of the IFAA. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 1006100001 - System Interruption. + * @throws { BusinessError } 1006100002 - The service is abnormal. + * @syscap SystemCapability.Security.Ifaa + * @since 4.1.0(11) + */ + /** + * Get the enabling status of the IFAA. + * + * @param { Uint8Array } userToken - user token allocated by the ifaa alliance. + * @returns { Promise } the promise used to return the enabling status of the IFAA. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 1006100001 - System Interruption. + * @throws { BusinessError } 1006100002 - The service is abnormal. + * @syscap SystemCapability.Security.Ifaa + * @atomicservice + * @since 5.0.0(12) + */ + function queryStatusSync(userToken: Uint8Array): boolean; + /** + * Get the enabling status of the IFAA. + * + * @param { Uint8Array } userToken - user token allocated by the ifaa alliance. + * @returns { Promise } the promise used to return the enabling status of the IFAA. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 1006100001 - System Interruption. + * @throws { BusinessError } 1006100002 - The service is abnormal. + * @syscap SystemCapability.Security.Ifaa + * @since 4.1.0(11) + */ + /** + * Get the enabling status of the IFAA. + * + * @param { Uint8Array } userToken - user token allocated by the ifaa alliance. + * @returns { Promise } the promise used to return the enabling status of the IFAA. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 1006100001 - System Interruption. + * @throws { BusinessError } 1006100002 - The service is abnormal. + * @syscap SystemCapability.Security.Ifaa + * @atomicservice + * @since 5.0.0(12) + */ + function queryStatus(userToken: Uint8Array): Promise; + /** + * Get the enabling status of the IFAA. + * + * @param { Uint8Array } userToken - user token allocated by the ifaa alliance. + * @param { AsyncCallback } callback - the callback used to return the enabling status of the IFAA. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 1006100001 - System Interruption. + * @throws { BusinessError } 1006100002 - The service is abnormal. + * @syscap SystemCapability.Security.Ifaa + * @since 4.1.0(11) + */ + /** + * Get the enabling status of the IFAA. + * + * @param { Uint8Array } userToken - user token allocated by the ifaa alliance. + * @param { AsyncCallback } callback - the callback used to return the enabling status of the IFAA. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 1006100001 - System Interruption. + * @throws { BusinessError } 1006100002 - The service is abnormal. + * @syscap SystemCapability.Security.Ifaa + * @atomicservice + * @since 5.0.0(12) + */ + function queryStatus(userToken: Uint8Array, callback: AsyncCallback): void; + /** + * Enable the IFAA feature. + * + * @param { Uint8Array } enableData - Data required for enabling the IFAA feature. + * @returns { Promise } the promise used to return the result of enabling the IFAA feature. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 1006100001 - System Interruption. + * @throws { BusinessError } 1006100002 - The service is abnormal. + * @syscap SystemCapability.Security.Ifaa + * @since 4.1.0(11) + */ + /** + * Enable the IFAA feature. + * + * @param { Uint8Array } enableData - Data required for enabling the IFAA feature. + * @returns { Promise } the promise used to return the result of enabling the IFAA feature. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 1006100001 - System Interruption. + * @throws { BusinessError } 1006100002 - The service is abnormal. + * @syscap SystemCapability.Security.Ifaa + * @atomicservice + * @since 5.0.0(12) + */ + function register(registerData: Uint8Array): Promise; + /** + * Enable the IFAA feature. + * + * @param { Uint8Array } enableData - Data required for enabling the IFAA feature. + * @param { AsyncCallback } callback - the callback used to return the result of enabling the IFAA feature. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 1006100001 - System Interruption. + * @throws { BusinessError } 1006100002 - The service is abnormal. + * @syscap SystemCapability.Security.Ifaa + * @since 4.1.0(11) + */ + /** + * Enable the IFAA feature. + * + * @param { Uint8Array } enableData - Data required for enabling the IFAA feature. + * @param { AsyncCallback } callback - the callback used to return the result of enabling the IFAA feature. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 1006100001 - System Interruption. + * @throws { BusinessError } 1006100002 - The service is abnormal. + * @syscap SystemCapability.Security.Ifaa + * @atomicservice + * @since 5.0.0(12) + */ + function register(registerData: Uint8Array, callback: AsyncCallback): void; + /** + * Get parameters of the authentication request. + * + * @returns { Uint8Array } the parameters. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 1006100001 - System Interruption. + * @throws { BusinessError } 1006100002 - The service is abnormal. + * @syscap SystemCapability.Security.Ifaa + * @since 4.1.0(11) + */ + /** + * Get parameters of the authentication request. + * + * @returns { Uint8Array } the parameters. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 1006100001 - System Interruption. + * @throws { BusinessError } 1006100002 - The service is abnormal. + * @syscap SystemCapability.Security.Ifaa + * @atomicservice + * @since 5.0.0(12) + */ + function preAuthSync(): Uint8Array; + /** + * Get parameters of the authentication request. + * + * @returns { Promise } the promise used to return the parameters. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 1006100001 - System Interruption. + * @throws { BusinessError } 1006100002 - The service is abnormal. + * @syscap SystemCapability.Security.Ifaa + * @since 4.1.0(11) + */ + /** + * Get parameters of the authentication request. + * + * @returns { Promise } the promise used to return the parameters. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 1006100001 - System Interruption. + * @throws { BusinessError } 1006100002 - The service is abnormal. + * @syscap SystemCapability.Security.Ifaa + * @atomicservice + * @since 5.0.0(12) + */ + function preAuth(): Promise; + /** + * Get parameters of the authentication request. + * + * @param { AsyncCallback } callback - the callback used to return the parameters. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 1006100001 - System Interruption. + * @throws { BusinessError } 1006100002 - The service is abnormal. + * @syscap SystemCapability.Security.Ifaa + * @since 4.1.0(11) + */ + /** + * Get parameters of the authentication request. + * + * @param { AsyncCallback } callback - the callback used to return the parameters. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 1006100001 - System Interruption. + * @throws { BusinessError } 1006100002 - The service is abnormal. + * @syscap SystemCapability.Security.Ifaa + * @atomicservice + * @since 5.0.0(12) + */ + function preAuth(callback: AsyncCallback): void; + /** + * Auth the IFAA feature. + * + * @param { Uint8Array } authToken - Result of the biometric authentication. + * @param { Uint8Array } authData - Data required for authentication. + * @returns { Promise } the promise used to return the result of authentication. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 1006100001 - System Interruption. + * @throws { BusinessError } 1006100002 - The service is abnormal. + * @syscap SystemCapability.Security.Ifaa + * @since 4.1.0(11) + */ + /** + * Auth the IFAA feature. + * + * @param { Uint8Array } authToken - Result of the biometric authentication. + * @param { Uint8Array } authData - Data required for authentication. + * @returns { Promise } the promise used to return the result of authentication. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 1006100001 - System Interruption. + * @throws { BusinessError } 1006100002 - The service is abnormal. + * @syscap SystemCapability.Security.Ifaa + * @atomicservice + * @since 5.0.0(12) + */ + function authSync(authToken: Uint8Array, authData: Uint8Array): Uint8Array; + /** + * Auth the IFAA feature. + * + * @param { Uint8Array } authToken - Result of the biometric authentication. + * @param { Uint8Array } authData - Data required for authentication. + * @returns { Promise } the promise used to return the result of authentication. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 1006100001 - System Interruption. + * @throws { BusinessError } 1006100002 - The service is abnormal. + * @syscap SystemCapability.Security.Ifaa + * @since 4.1.0(11) + */ + /** + * Auth the IFAA feature. + * + * @param { Uint8Array } authToken - Result of the biometric authentication. + * @param { Uint8Array } authData - Data required for authentication. + * @returns { Promise } the promise used to return the result of authentication. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 1006100001 - System Interruption. + * @throws { BusinessError } 1006100002 - The service is abnormal. + * @syscap SystemCapability.Security.Ifaa + * @atomicservice + * @since 5.0.0(12) + */ + function auth(authToken: Uint8Array, authData: Uint8Array): Promise; + /** + * Auth the IFAA feature. + * + * @param { Uint8Array } authToken - Result of the biometric authentication. + * @param { Uint8Array } authData - Data required for authentication. + * @param { AsyncCallback } callback - the callback used to return the result of authentication. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 1006100001 - System Interruption. + * @throws { BusinessError } 1006100002 - The service is abnormal. + * @syscap SystemCapability.Security.Ifaa + * @since 4.1.0(11) + */ + /** + * Auth the IFAA feature. + * + * @param { Uint8Array } authToken - Result of the biometric authentication. + * @param { Uint8Array } authData - Data required for authentication. + * @param { AsyncCallback } callback - the callback used to return the result of authentication. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 1006100001 - System Interruption. + * @throws { BusinessError } 1006100002 - The service is abnormal. + * @syscap SystemCapability.Security.Ifaa + * @atomicservice + * @since 5.0.0(12) + */ + function auth(authToken: Uint8Array, authData: Uint8Array, callback: AsyncCallback): void; + /** + * Deregister the IFAA feature. + * + * @param { Uint8Array } deregisterData- Data required for deregister the IFAA feature. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 1006100001 - System Interruption. + * @throws { BusinessError } 1006100002 - The service is abnormal. + * @syscap SystemCapability.Security.Ifaa + * @since 4.1.0(11) + */ + /** + * Deregister the IFAA feature. + * + * @param { Uint8Array } deregisterData- Data required for deregister the IFAA feature. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 1006100001 - System Interruption. + * @throws { BusinessError } 1006100002 - The service is abnormal. + * @syscap SystemCapability.Security.Ifaa + * @atomicservice + * @since 5.0.0(12) + */ + function deregisterSync(deregisterData: Uint8Array): void; + /** + * Deregister the IFAA feature. + * + * @param { Uint8Array } deregisterData- Data required for deregister the IFAA feature. + * @returns { Promise } the promise returned by the function. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 1006100001 - System Interruption. + * @throws { BusinessError } 1006100002 - The service is abnormal. + * @syscap SystemCapability.Security.Ifaa + * @since 4.1.0(11) + */ + /** + * Deregister the IFAA feature. + * + * @param { Uint8Array } deregisterData- Data required for deregister the IFAA feature. + * @returns { Promise } the promise returned by the function. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 1006100001 - System Interruption. + * @throws { BusinessError } 1006100002 - The service is abnormal. + * @syscap SystemCapability.Security.Ifaa + * @atomicservice + * @since 5.0.0(12) + */ + function deregister(deregisterData: Uint8Array): Promise; + /** + * Deregister the IFAA feature. + * + * @param { Uint8Array } deregisterData- Data required for deregister the IFAA feature. + * @param { AsyncCallback } callback - the callback returned by the function. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 1006100001 - System Interruption. + * @throws { BusinessError } 1006100002 - The service is abnormal. + * @syscap SystemCapability.Security.Ifaa + * @since 4.1.0(11) + */ + /** + * Deregister the IFAA feature. + * + * @param { Uint8Array } deregisterData- Data required for deregister the IFAA feature. + * @param { AsyncCallback } callback - the callback returned by the function. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 1006100001 - System Interruption. + * @throws { BusinessError } 1006100002 - The service is abnormal. + * @syscap SystemCapability.Security.Ifaa + * @atomicservice + * @since 5.0.0(12) + */ + function deregister(deregisterData: Uint8Array, callback: AsyncCallback): void; + /** + * Get protocol version. + * + * @returns { Uint8Array } the protocol version. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 1006100001 - System Interruption. + * @throws { BusinessError } 1006100002 - The service is abnormal. + * @syscap SystemCapability.Security.Ifaa + * @since 4.1.0(11) + */ + /** + * Get protocol version. + * + * @returns { Uint8Array } the protocol version. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 1006100001 - System Interruption. + * @throws { BusinessError } 1006100002 - The service is abnormal. + * @syscap SystemCapability.Security.Ifaa + * @atomicservice + * @since 5.0.0(12) + */ + function getProtocolVersionSync(): Uint8Array; + /** + * Get protocol version. + * + * @returns { Promise } the promise used to return the protocol version. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 1006100001 - System Interruption. + * @throws { BusinessError } 1006100002 - The service is abnormal. + * @syscap SystemCapability.Security.Ifaa + * @since 4.1.0(11) + */ + /** + * Get protocol version. + * + * @returns { Promise } the promise used to return the protocol version. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 1006100001 - System Interruption. + * @throws { BusinessError } 1006100002 - The service is abnormal. + * @syscap SystemCapability.Security.Ifaa + * @atomicservice + * @since 5.0.0(12) + */ + function getProtocolVersion(): Promise; + /** + * Get protocol version. + * + * @param { AsyncCallback } callback - the callback used to return the protocol version. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 1006100001 - System Interruption. + * @throws { BusinessError } 1006100002 - The service is abnormal. + * @syscap SystemCapability.Security.Ifaa + * @since 4.1.0(11) + */ + /** + * Get protocol version. + * + * @param { AsyncCallback } callback - the callback used to return the protocol version. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 1006100001 - System Interruption. + * @throws { BusinessError } 1006100002 - The service is abnormal. + * @syscap SystemCapability.Security.Ifaa + * @atomicservice + * @since 5.0.0(12) + */ + function getProtocolVersion(callback: AsyncCallback): void; + /** + * Get supported certificate types. + * + * @returns { Uint8Array } the supported certificate types. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 1006100001 - System Interruption. + * @throws { BusinessError } 1006100002 - The service is abnormal. + * @syscap SystemCapability.Security.Ifaa + * @since 4.1.0(11) + */ + /** + * Get supported certificate types. + * + * @returns { Uint8Array } the supported certificate types. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 1006100001 - System Interruption. + * @throws { BusinessError } 1006100002 - The service is abnormal. + * @syscap SystemCapability.Security.Ifaa + * @atomicservice + * @since 5.0.0(12) + */ + function getSupportedCertTypesSync(): Uint8Array; + /** + * Get supported certificate types. + * + * @returns { Promise } the promise used to return the supported certificate types. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 1006100001 - System Interruption. + * @throws { BusinessError } 1006100002 - The service is abnormal. + * @syscap SystemCapability.Security.Ifaa + * @since 4.1.0(11) + */ + /** + * Get supported certificate types. + * + * @returns { Promise } the promise used to return the supported certificate types. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 1006100001 - System Interruption. + * @throws { BusinessError } 1006100002 - The service is abnormal. + * @syscap SystemCapability.Security.Ifaa + * @atomicservice + * @since 5.0.0(12) + */ + function getSupportedCertTypes(): Promise; + /** + * Get supported certificate types. + * + * @param { AsyncCallback } callback - the callback used to return the supported certificate types. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 1006100001 - System Interruption. + * @throws { BusinessError } 1006100002 - The service is abnormal. + * @syscap SystemCapability.Security.Ifaa + * @since 4.1.0(11) + */ + /** + * Get supported certificate types. + * + * @param { AsyncCallback } callback - the callback used to return the supported certificate types. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 1006100001 - System Interruption. + * @throws { BusinessError } 1006100002 - The service is abnormal. + * @syscap SystemCapability.Security.Ifaa + * @atomicservice + * @since 5.0.0(12) + */ + function getSupportedCertTypes(callback: AsyncCallback): void; +} +export default ifaa; diff --git a/language/arkts/extractor/sdk/hms/ets/api/@hms.security.safetyDetect.d.ts b/language/arkts/extractor/sdk/hms/ets/api/@hms.security.safetyDetect.d.ts new file mode 100755 index 00000000..93a6c7ef --- /dev/null +++ b/language/arkts/extractor/sdk/hms/ets/api/@hms.security.safetyDetect.d.ts @@ -0,0 +1,191 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. All rights reserved. + */ +/** + * @file This module provides the capabilities to safety detection. + * @kit DeviceSecurityKit + */ +/** + * Provides safety detection. + * + * @namespace safetyDetect + * @syscap SystemCapability.Security.SafetyDetect + * @since 5.0.0(12) + */ +declare namespace safetyDetect { + /** + * UrlCheckRequest contains the URL check request parameters. + * + * @typedef UrlCheckRequest + * @syscap SystemCapability.Security.SafetyDetect + * @since 5.0.0(12) + */ + interface UrlCheckRequest { + /** + * Indicates the URL list to check. + * The maximum length of array is 10, and the maximum length of the URL is 4096. + * + * @type { Array } + * @syscap SystemCapability.Security.SafetyDetect + * @since 5.0.0(12) + */ + urls: Array; + } + /** + * UrlCheckResponse contains the URL check result. + * + * @typedef UrlCheckResponse + * @syscap SystemCapability.Security.SafetyDetect + * @since 5.0.0(12) + */ + interface UrlCheckResponse { + /** + * Indicates the result of URL check. + * + * @type { Array } + * @readonly + * @syscap SystemCapability.Security.SafetyDetect + * @since 5.0.0(12) + */ + results: Array; + } + /** + * UrlCheckResult contains the URL threat. + * + * @typedef UrlCheckResult + * @syscap SystemCapability.Security.SafetyDetect + * @since 5.0.0(12) + */ + interface UrlCheckResult { + /** + * Indicates the checked URL. + * + * @type { string } + * @syscap SystemCapability.Security.SafetyDetect + * @since 5.0.0(12) + */ + url: string; + /** + * Indicates the thread type of URL. + * + * @type { UrlThreatType } + * @syscap SystemCapability.Security.SafetyDetect + * @since 5.0.0(12) + */ + threat: UrlThreatType; + } + /** + * Enum for URL threat type + * + * @enum { number } + * @syscap SystemCapability.Security.SafetyDetect + * @since 5.0.0(12) + */ + enum UrlThreatType { + /** + * Indicates the URL has no threat. + * + * @syscap SystemCapability.Security.SafetyDetect + * @since 5.0.0(12) + */ + NORMAL = 0, + /** + * Indicates the URL is malicious, such as Rogue software or Trojan horse websites. + * + * @syscap SystemCapability.Security.SafetyDetect + * @since 5.0.0(12) + */ + MALWARE = 1, + /** + * Indicates the URL is Phishing. + * + * @syscap SystemCapability.Security.SafetyDetect + * @since 5.0.0(12) + */ + PHISHING = 2, + /** + * Indicates the URL is suspected of other violations. + * + * @syscap SystemCapability.Security.SafetyDetect + * @since 5.0.0(12) + */ + OTHERS = 3 + } + /** + * Provides URL threat check. + * + * @param { UrlCheckRequest } req - indicates the request for system integrity check. + * @returns { Promise } The result of URL threat check. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameters. + * Possible causes: + * 1. Mandatory parameters are left unspecified. + * 2. Incorrect parameter types. + * 3. Parameter verification failed. + * @throws { BusinessError } 1010800001 - Internal error. + * @throws { BusinessError } 1010800002 - The network is unreachable. + * @throws { BusinessError } 1010800003 - Access cloud server fail. + * @syscap SystemCapability.Security.SafetyDetect + * @since 5.0.0(12) + */ + function checkUrlThreat(req: UrlCheckRequest): Promise; + /** + * SysIntegrityRequest contains the system integrity check request parameters. + * + * @typedef SysIntegrityRequest + * @syscap SystemCapability.Security.SafetyDetect + * @since 5.0.0(12) + */ + interface SysIntegrityRequest { + /** + * Indicates the nonce for anti-replay. The length ranges from 16 to 66 bytes. + * + * @type { string } + * @syscap SystemCapability.Security.SafetyDetect + * @since 5.0.0(12) + */ + nonce: string; + } + /** + * SysIntegrityResponse contains the system integrity check result. + * + * @typedef SysIntegrityResponse + * @syscap SystemCapability.Security.SafetyDetect + * @since 5.0.0(12) + */ + interface SysIntegrityResponse { + /** + * Indicates the result of system integrity check. The format is JSON WEB Signature. + * The check results are used in the following ways: + * a. Parse the JWS to obtain the header, payload, and signature. + * b. Obtain the signature algorithm and certificate chain from the header. + * c. Obtain the signature from signature and verify the signature. + * d. Obtain the integrity verification result from the payload. + * + * @type { string } + * @readonly + * @syscap SystemCapability.Security.SafetyDetect + * @since 5.0.0(12) + */ + result: string; + } + /** + * Provides system integrity check. + * + * @param { SysIntegrityRequest } req - Indicates a system integrity check request. + * @returns { Promise } The result of system integrity check. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameters. + * Possible causes: + * 1. Mandatory parameters are left unspecified. + * 2. Incorrect parameter types. + * 3. Parameter verification failed. + * @throws { BusinessError } 1010800001 - Internal error. + * @throws { BusinessError } 1010800002 - The network is unreachable. + * @throws { BusinessError } 1010800003 - Access cloud server fail. + * @syscap SystemCapability.Security.SafetyDetect + * @since 5.0.0(12) + */ + function checkSysIntegrity(req: SysIntegrityRequest): Promise; +} +export default safetyDetect; diff --git a/language/arkts/extractor/sdk/hms/ets/api/@hms.security.trustedAppService.d.ts b/language/arkts/extractor/sdk/hms/ets/api/@hms.security.trustedAppService.d.ts new file mode 100755 index 00000000..91611742 --- /dev/null +++ b/language/arkts/extractor/sdk/hms/ets/api/@hms.security.trustedAppService.d.ts @@ -0,0 +1,511 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. All rights reserved. + */ +/** + * @file This module provides the capabilities to trusted app service. + * @kit DeviceSecurityKit + */ +/** + * This module provides the capability of secure location attestation and secure camera attestation. + * + * @namespace trustedAppService + * @syscap SystemCapability.Security.TrustedAppService.Core + * @since 5.0.0(12) + */ +declare namespace trustedAppService { + /** + * Enum for attestation key algorithm. + * + * @enum { number } + * @syscap SystemCapability.Security.TrustedAppService.Core + * @since 5.0.0(12) + */ + export enum AttestKeyAlg { + /** + * The ECC (Elliptic Curve Cryptography) algorithm used for attestation. + * + * @syscap SystemCapability.Security.TrustedAppService.Core + * @since 5.0.0(12) + */ + ATTEST_ALG_ECC = 1 + } + /** + * Enum for attestation key size. + * + * @enum { number } + * @syscap SystemCapability.Security.TrustedAppService.Core + * @since 5.0.0(12) + */ + export enum AttestKeySize { + /** + * This specifies a key size of 256 bits. + * + * @syscap SystemCapability.Security.TrustedAppService.Core + * @since 5.0.0(12) + */ + ATTEST_ECC_KEY_SIZE_256 = 256, + /** + * This specifies a key size of 384 bits. + * + * @syscap SystemCapability.Security.TrustedAppService.Core + * @since 5.0.0(12) + */ + ATTEST_ECC_KEY_SIZE_384 = 384 + } + /** + * Enum for attestation type. + * + * @enum { number } + * @syscap SystemCapability.Security.TrustedAppService.Core + * @since 5.0.0(12) + */ + export enum AttestType { + /** + * The attestation type for location services. + * + * @syscap SystemCapability.Security.TrustedAppService.Core + * @since 5.0.0(12) + */ + ATTEST_TYPE_LOCATION = 1, + /** + * The attestation type for camera services. + * + * @syscap SystemCapability.Security.TrustedAppService.Core + * @since 5.0.0(12) + */ + ATTEST_TYPE_CAMERA = 2 + } + /** + * Enum for attestation base tag type. + * + * @enum { number } + * @syscap SystemCapability.Security.TrustedAppService.Core + * @since 5.0.0(12) + */ + export enum AttestTagType { + /** + * Invalid tag type. + * + * @syscap SystemCapability.Security.TrustedAppService.Core + * @since 5.0.0(12) + */ + ATTEST_TAG_TYPE_INVALID = 0 << 28, + /** + * Integer tag type. + * + * @syscap SystemCapability.Security.TrustedAppService.Core + * @since 5.0.0(12) + */ + ATTEST_TAG_TYPE_INT = 1 << 28, + /** + * Unsigned integer tag type. + * + * @syscap SystemCapability.Security.TrustedAppService.Core + * @since 5.0.0(12) + */ + ATTEST_TAG_TYPE_UINT = 2 << 28, + /** + * Unsigned long integer tag type. + * + * @syscap SystemCapability.Security.TrustedAppService.Core + * @since 5.0.0(12) + */ + ATTEST_TAG_TYPE_ULONG = 3 << 28, + /** + * Boolean tag type. + * + * @syscap SystemCapability.Security.TrustedAppService.Core + * @since 5.0.0(12) + */ + ATTEST_TAG_TYPE_BOOL = 4 << 28, + /** + * Byte array tag type. + * + * @syscap SystemCapability.Security.TrustedAppService.Core + * @since 5.0.0(12) + */ + ATTEST_TAG_TYPE_BYTES = 5 << 28 + } + /** + * Enum for attestation tag. + * + * @enum { number } + * @syscap SystemCapability.Security.TrustedAppService.Core + * @since 5.0.0(12) + */ + export enum AttestTag { + /** + * Invalid tag. + * + * @syscap SystemCapability.Security.TrustedAppService.Core + * @since 5.0.0(12) + */ + ATTEST_TAG_INVALID = AttestTagType.ATTEST_TAG_TYPE_INVALID | 0, + /** + * Algorithm tag. + * + * @syscap SystemCapability.Security.TrustedAppService.Core + * @since 5.0.0(12) + */ + ATTEST_TAG_ALGORITHM = AttestTagType.ATTEST_TAG_TYPE_UINT | 1, + /** + * Key size tag. + * + * @syscap SystemCapability.Security.TrustedAppService.Core + * @since 5.0.0(12) + */ + ATTEST_TAG_KEY_SIZE = AttestTagType.ATTEST_TAG_TYPE_UINT | 2, + /** + * Device type tag. + * + * @syscap SystemCapability.Security.TrustedAppService.Core + * @since 5.0.0(12) + */ + ATTEST_TAG_DEVICE_TYPE = AttestTagType.ATTEST_TAG_TYPE_UINT | 3, + /** + * Device ID tag. + * + * @syscap SystemCapability.Security.TrustedAppService.Core + * @since 5.0.0(12) + */ + ATTEST_TAG_DEVICE_ID = AttestTagType.ATTEST_TAG_TYPE_UINT | 4 + } + /** + * Interface of attestation param. + * + * @typedef AttestParam + * @syscap SystemCapability.Security.TrustedAppService.Core + * @since 5.0.0(12) + */ + export interface AttestParam { + /** + * The attestation parameter tag. + * + * @type { AttestTag } + * @syscap SystemCapability.Security.TrustedAppService.Core + * @since 5.0.0(12) + */ + tag: AttestTag; + /** + * The attestation parameter value. + * + * @type { boolean | number | bigint | Uint8Array } + * @syscap SystemCapability.Security.TrustedAppService.Core + * @since 5.0.0(12) + */ + value: boolean | number | bigint | Uint8Array; + } + /** + * Interface of attestation option. + * + * @typedef AttestOptions + * @syscap SystemCapability.Security.TrustedAppService.Core + * @since 5.0.0(12) + */ + export interface AttestOptions { + /** + * The properties of attestation options. + * + * @type { Array } + * @syscap SystemCapability.Security.TrustedAppService.Core + * @since 5.0.0(12) + */ + properties: Array; + } + /** + * Interface of attestation result. + * + * @typedef AttestReturnResult + * @syscap SystemCapability.Security.TrustedAppService.Core + * @since 5.0.0(12) + */ + export interface AttestReturnResult { + /** + * The certchains of attestation. + * + * @type { Array } + * @syscap SystemCapability.Security.TrustedAppService.Core + * @since 5.0.0(12) + */ + certChains: Array; + } + /** + * Enum for attestation exception error code. + * + * @enum { number } + * @syscap SystemCapability.Security.TrustedAppService.Core + * @since 5.0.0(12) + */ + export enum AttestExceptionErrCode { + /** + * @syscap SystemCapability.Security.TrustedAppService.Core + * @since 5.0.0(12) + */ + ATTEST_ERROR_NO_PERMISSION = 201, + /** + * @syscap SystemCapability.Security.TrustedAppService.Core + * @since 5.0.0(12) + */ + ATTEST_ERROR_ILLEGAL_ARGUMENT = 401, + /** + * @syscap SystemCapability.Security.TrustedAppService.Core + * @since 5.0.0(12) + */ + ATTEST_ERROR_INVALID_ALG_ARGUMENT = 1011500001, + /** + * @syscap SystemCapability.Security.TrustedAppService.Core + * @since 5.0.0(12) + */ + ATTEST_ERROR_MISSING_ARGUMENT = 1011500002, + /** + * @syscap SystemCapability.Security.TrustedAppService.Core + * @since 5.0.0(12) + */ + ATTEST_ERROR_KEY_GENERATOR_FAILED = 1011500003, + /** + * @syscap SystemCapability.Security.TrustedAppService.Core + * @since 5.0.0(12) + */ + ATTEST_ERROR_CERTS_CREATION_FAILED = 1011500004, + /** + * @syscap SystemCapability.Security.TrustedAppService.Core + * @since 5.0.0(12) + */ + ATTEST_ERROR_FILE_OPERATION_FAILED = 1011500005, + /** + * @syscap SystemCapability.Security.TrustedAppService.Core + * @since 5.0.0(12) + */ + ATTEST_ERROR_COMMUNICATION_FAILED = 1011500006, + /** + * @syscap SystemCapability.Security.TrustedAppService.Core + * @since 5.0.0(12) + */ + ATTEST_ERROR_ITEM_NOT_FOUND = 1011500007, + /** + * @syscap SystemCapability.Security.TrustedAppService.Core + * @since 5.0.0(12) + */ + ATTEST_ERROR_CERTS_VERIFICATION_FAILED = 1011500008, + /** + * @syscap SystemCapability.Security.TrustedAppService.Core + * @since 5.0.0(12) + */ + ATTEST_ERROR_CERTS_EXPIRED = 1011500009, + /** + * @syscap SystemCapability.Security.TrustedAppService.Core + * @since 5.0.0(12) + */ + ATTEST_ERROR_KEY_NOT_MATCHED = 1011500010, + /** + * @syscap SystemCapability.Security.TrustedAppService.Core + * @since 5.0.0(12) + */ + ATTEST_ERROR_SECURE_CAMERA_INITIALIZATION_FAILED = 1011500011, + /** + * @syscap SystemCapability.Security.TrustedAppService.Core + * @since 5.0.0(12) + */ + ATTEST_ERROR_CONTEXT_BAD_STATE = 1011500012, + /** + * @syscap SystemCapability.Security.TrustedAppService.Core + * @since 5.0.0(12) + */ + ATTEST_ERROR_KEY_EXPIRED = 1011500013, + /** + * @syscap SystemCapability.Security.TrustedAppService.Core + * @since 5.0.0(12) + */ + ATTEST_ERROR_LOCATION_SERVICE_UNAVAILABLE = 1011500014, + /** + * @syscap SystemCapability.Security.TrustedAppService.Core + * @since 5.0.0(12) + */ + ATTEST_ERROR_LOCATION_SWITCH_OFF = 1011500015, + /** + * @syscap SystemCapability.Security.TrustedAppService.Core + * @since 5.0.0(12) + */ + ATTEST_ERROR_LOCATION_FAILED = 1011500016 + } + /** + * Create attestation key. + * + * @param { AttestOptions } options - options indicates the properties of the key. + * @syscap SystemCapability.Security.TrustedAppService.Core + * @throws { BusinessError } 401 - argument is invalid. + * @throws { BusinessError } 1011500001 - algorithm param is invalid. + * @throws { BusinessError } 1011500002 - algorithm param is missing. + * @throws { BusinessError } 1011500003 - create attestation key failed. + * @throws { BusinessError } 1011500004 - create anonymous certificate failed. + * @throws { BusinessError } 1011500005 - operating file failed. + * @throws { BusinessError } 1011500006 - IPC communication failed. + * @since 5.0.0(12) + */ + function createAttestKey(options: AttestOptions): Promise; + /** + * Destroy attestation key. + * + * @syscap SystemCapability.Security.TrustedAppService.Core + * @throws { BusinessError } 1011500005 - operating file failed. + * @throws { BusinessError } 1011500006 - IPC communication failed. + * @throws { BusinessError } 1011500007 - item not found. + * @since 5.0.0(12) + */ + function destroyAttestKey(): Promise; + /** + * Initialize attestation context for secure location or secure camera. + * + * @param { AttestOptions } options - options indicates the properties of the key. + * @param { string } userData - options indicates the properties of the key. + * @returns { Promise } Return the certchains. + * @syscap SystemCapability.Security.TrustedAppService.Core + * @throws { BusinessError } 401 - argument is invalid. + * @throws { BusinessError } 1011500002 - param is missing. + * @throws { BusinessError } 1011500005 - operating file failed. + * @throws { BusinessError } 1011500006 - IPC communication failed. + * @throws { BusinessError } 1011500007 - item not found. + * @throws { BusinessError } 1011500008 - anonymous certificate verify failed. + * @throws { BusinessError } 1011500009 - anonymous certificate has expired. + * @throws { BusinessError } 1011500010 - get attestation key failed. + * @throws { BusinessError } 1011500011 - initialize secure camera failed. + * @since 5.0.0(12) + */ + function initializeAttestContext(userData: string, options: AttestOptions): Promise; + /** + * Finalize attestation context. + * + * @syscap SystemCapability.Security.TrustedAppService.Core + * @throws { BusinessError } 401 - argument is invalid. + * @throws { BusinessError } 1011500002 - param is missing. + * @throws { BusinessError } 1011500006 - IPC communication failed. + * @throws { BusinessError } 1011500007 - item not found. + * @since 5.0.0(12) + */ + function finalizeAttestContext(options: AttestOptions): Promise; + /** + * Enum for locating priority. + * + * @enum { number } + * @syscap SystemCapability.Security.TrustedAppService.Location + * @since 5.0.0(12) + */ + export enum LocatingPriority { + /** + * Preferentially ensure the highest locating accuracy. + * + * @syscap SystemCapability.Security.TrustedAppService.Location + * @since 5.0.0(12) + */ + PRIORITY_ACCURACY, + /** + * Preferentially ensure the fastest locating speed. + * + * @syscap SystemCapability.Security.TrustedAppService.Location + * @since 5.0.0(12) + */ + PRIORITY_LOCATING_SPEED + } + /** + * Supported location infos. + * + * @interface Location + * @syscap SystemCapability.Security.TrustedAppService.Location + * @since 5.0.0(12) + */ + export interface Location { + /** + * The latitude value. + * + * @type { number } + * @syscap SystemCapability.Security.TrustedAppService.Location + * @since 5.0.0(12) + */ + latitude: number; + /** + * The longitude value. + * + * @type { number } + * @syscap SystemCapability.Security.TrustedAppService.Location + * @since 5.0.0(12) + */ + longitude: number; + /** + * The altitude value. + * + * @type { number } + * @syscap SystemCapability.Security.TrustedAppService.Location + * @since 5.0.0(12) + */ + altitude: number; + /** + * The accuracy value. + * + * @type { number } + * @syscap SystemCapability.Security.TrustedAppService.Location + * @since 5.0.0(12) + */ + accuracy: number; + /** + * The timestamp value. + * + * @type { number } + * @syscap SystemCapability.Security.TrustedAppService.Location + * @since 5.0.0(12) + */ + timestamp: number; + } + /** + * SecureLocation info. + * + * @interface Location + * @syscap SystemCapability.Security.TrustedAppService.Location + * @since 5.0.0(12) + */ + export interface SecureLocation { + /** + * The location value. + * + * @type { Location } + * @syscap SystemCapability.Security.TrustedAppService.Location + * @since 5.0.0(12) + */ + originalLocation: Location; + /** + * The user data value. + * + * @type { String } + * @syscap SystemCapability.Security.TrustedAppService.Location + * @since 5.0.0(12) + */ + userData: String; + /** + * The signture info. + * + * @type { String } + * @syscap SystemCapability.Security.TrustedAppService.Location + * @since 5.0.0(12) + */ + signature: String; + } + /** + * Get current secure location. + * + * @permission ohos.permission.LOCATION + * @permission ohos.permission.APPROXIMATELY_LOCATION + * @param { number } [timeout] - Timeout of a single location request, in milliseconds. + * @param { LocatingPriority } [priority] - Priority of the location request. + * @returns { Promise } The promise returned by the function. + * @syscap SystemCapability.Security.TrustedAppService.Location + * @throws { BusinessError } 201 - has no permission. + * @throws { BusinessError } 401 - argument is invalid. + * @throws { BusinessError } 1011500012 - attestation context not initialized. + * @throws { BusinessError } 1011500013 - attestation key has expired. + * @throws { BusinessError } 1011500014 - location service is unavailable. + * @throws { BusinessError } 1011500015 - The location switch is off. + * @throws { BusinessError } 1011500016 - Failed to obtain the secure geographical location. + * @since 5.0.0(12) + */ + function getCurrentSecureLocation(timeout: number, priority: LocatingPriority): Promise; +} +export default trustedAppService; diff --git a/language/arkts/extractor/sdk/hms/ets/api/@hms.stylus.HandwriteComponent.d.ets b/language/arkts/extractor/sdk/hms/ets/api/@hms.stylus.HandwriteComponent.d.ets new file mode 100755 index 00000000..6cb1b878 --- /dev/null +++ b/language/arkts/extractor/sdk/hms/ets/api/@hms.stylus.HandwriteComponent.d.ets @@ -0,0 +1,110 @@ +/* + * Copyright (c) Huawei Technologies Co., Ltd. 2024-2024. All rights reserved. + */ +/** + * @file Provide the common handwrite view and the ability to control handwrite view behavior. + * @bundle com.huawei.hmos.hwstylusfeature/Penkit/ets/hsp/HandwritePaint 5.0.0(12) + * @kit Penkit + */ +import type { AsyncCallback } from '@ohos.base'; +/** + * Provides handwrite component, the caller needs to provide handwrite controller and callback + * + * @syscap SystemCapability.Stylus.Handwrite + * @stagemodelonly + * @struct + * @atomicservice + * @since 5.0.0(12) + */ +@Component +export struct HandwriteComponent { + /** + * This is the main function entry of the handwrite component. + * + * @syscap SystemCapability.Stylus.Handwrite + * @type { HandwriteController } + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + handwriteController: HandwriteController; + /** + * Callback function when the handwrite component has finished initializing. + * + * @type { function } + * @returns { void } + * @syscap SystemCapability.Stylus.Handwrite + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + onInit?: () => void; + /** + * Callback function when the handwrite component is scaling. + * + * @type { function } + * @param { number } scale - The handwrite component scaling ratio. + * @returns { void } + * @syscap SystemCapability.Stylus.Handwrite + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + onScale?: (scale: number) => void; + /** + * The default builder function for struct, You should not need to invoke this method directly. + * + * @syscap SystemCapability.Stylus.Handwrite + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + build(): void; +} +/** + * This is the main function entry of the handwrite component. + * All map-related methods can be accessed from this interface. + * + * @syscap SystemCapability.Applications.StylusFeature + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ +export class HandwriteController { + /** + * Save handwrite content. + * + * @param { string } path - File path for saving the handwrite content. + * @returns { Promise } + * @throws { BusinessError } 1010400002 - save filed + * @syscap SystemCapability.Stylus.Handwrite + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + save(path: string): Promise; + /** + * Load handwrite content. + * + * @param { string } path - File path for loading the handwrite content. + * @returns { void } + * @throws { BusinessError } 1010400001 - load filed + * @syscap SystemCapability.Stylus.Handwrite + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + load(path: string): void; + /** + * Registers a callback to be invoked when finishing loading. + * + * @param { AsyncCallback } callback - Callback invoked to return the id of the handwrite content page. + * @returns { void } + * @throws { BusinessError } 1010400001 - load filed + * @syscap SystemCapability.Stylus.Handwrite + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + onLoad(callback: AsyncCallback): void; +} diff --git a/language/arkts/extractor/sdk/hms/ets/api/@hms.stylus.handwrite.d.ts b/language/arkts/extractor/sdk/hms/ets/api/@hms.stylus.handwrite.d.ts new file mode 100755 index 00000000..999c63bf --- /dev/null +++ b/language/arkts/extractor/sdk/hms/ets/api/@hms.stylus.handwrite.d.ts @@ -0,0 +1,154 @@ +/* + * Copyright (c) Huawei Technologies Co., Ltd. 2024-2024. All rights reserved. + */ +/** + * @file Provide auxiliary handwrite ability + * @bundle com.huawei.hmos.hwstylusfeature/Penkit/ets/hsp/HandwritePaint 5.0.0(12) + * @kit Penkit + */ +import { Callback } from '@ohos.base'; +/** + * Provide instant shape ability to draw standard shapes. This ability will recognize shapes from the original handwriting input event. + * The shape recognition will be triggered when the input event paused for some time. + * + * @syscap SystemCapability.Stylus.Handwrite + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ +export class InstantShapeGenerator { + /** + * Pass touch event to do recognition. This function must be called inside the Component's onTouch callback handler. + * + * @param {TouchEvent} event - Indicates the touch event received from the Component's onTouch callback handler. + * @returns {void} + * @throws { BusinessError } 1010410001 - internal recognition engine has been released. + * @syscap SystemCapability.Stylus.Handwrite + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + processTouchEvent(event: TouchEvent): void; + /** + * Extract shape information from given shape string and generate Path2D object with that information. + * This method can convert string to a Path2D object, can be called after loading handwriting content(e.g. shape string) from file. + * + * @param {string} shapeString - Indicates shape information string. + * @param {number} penSize - Indicates pen size to draw the result shape. Some of the shape results vary according to this value such as the arrow. + * @returns {Path2D} - A Path2D object contains all the shape information and can be drawn directly. + * @throws { BusinessError } 1010410001 - internal recognition engine has been released. + * @syscap SystemCapability.Stylus.Handwrite + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + getPathFromString(shapeString: string, penSize: number): Path2D; + /** + * Notify component size change. The size of the shape(e.g. radius of circle) varys according to the component size. + * + * @param {number} width - Indicates new component width. + * @param {number} height - Indicates new component height. + * @returns {void} + * @throws { BusinessError } 1010410001 - internal recognition engine has been released. + * @syscap SystemCapability.Stylus.Handwrite + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + notifyAreaChange(width: number, height: number): void; + /** + * Set pause time to trigger recognition. The unit of pause time is millisecond. + * + * @param {number} time - Indicates target pause time. + * @returns {void} + * @throws { BusinessError } 1010410001 - internal recognition engine has been released. + * @syscap SystemCapability.Stylus.Handwrite + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + setPauseTime(time: number): void; + /** + * Release resource to free memory. + * + * @returns {void} + * @syscap SystemCapability.Stylus.Handwrite + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + release(): void; + /** + * Register a callback to handle shape result. + * + * @param {Callback} callback - Callback invoded to return shape result. + * @returns {InstantShapeGenerator} - Returns current instance. + * @syscap SystemCapability.Stylus.Handwrite + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + onShapeRecognized(callback: Callback): InstantShapeGenerator; +} +/** + * Defines the standard shape result. + * + * @typedef ShapeInfo + * @syscap SystemCapability.Stylus.Handwrite + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ +export interface ShapeInfo { + /** + * Path2D object of the shape. + * + * @type {Path2D} + * @syscap SystemCapability.Stylus.Handwrite + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + shapePath: Path2D; + /** + * Shape information, can be saved to file. + * + * @type {string} + * @syscap SystemCapability.Stylus.Handwrite + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + shapeString: string; + /** + * Shape type. + * + * @type {number} + * @syscap SystemCapability.Stylus.Handwrite + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + shapeType: number; +} +/** + * Provide point prediction ability based on the input touch event and historical event. + * + * @syscap SystemCapability.Stylus.Handwrite + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ +export class PointPredictor { + /** + * Get prediction point according to the given input touch event. + * + * @param {TouchEvent} event - Indicates the touch event received by component. + * @returns {TouchPoint} - Returns prediction point. + * @syscap SystemCapability.Stylus.Handwrite + * @stagemodelonly + * @atomicservice + * @since 5.0.0(12) + */ + getPredictionPoint(event: TouchEvent): TouchPoint; +} diff --git a/language/arkts/extractor/sdk/hms/ets/api/@hms.telephony.voipCall.d.ts b/language/arkts/extractor/sdk/hms/ets/api/@hms.telephony.voipCall.d.ts new file mode 100755 index 00000000..4a642ed1 --- /dev/null +++ b/language/arkts/extractor/sdk/hms/ets/api/@hms.telephony.voipCall.d.ts @@ -0,0 +1,476 @@ +/* + * Copyright (c) Huawei Technologies Co., Ltd. 2023. All rights reserved. + */ +/** + * @file This module provides the capabilities to voip call. + * @kit CallKit + */ +import type { Callback } from '@ohos.base'; +import type image from '@ohos.multimedia.image'; +/** + * Provides methods related to VoIP Call Manager. + * + * @namespace voipCall + * @syscap SystemCapability.Telephony.VoipCallManager + * @since 4.1.0(11) + */ +declare namespace voipCall { + /** + * Subscribe to the voipCallUiEvent event. + * + * @param { 'voipCallUiEvent' } type - Event type. Indicates the voipCallUiEvent event to be subscribed to. + * @param { Callback } callback - Indicates the callback for getting the result + * of VoIP call event information. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 1007200001 - Invalid parameter value. + * @throws { BusinessError } 1007200002 - Operation failed. Cannot connect to service. + * @throws { BusinessError } 1007200003 - System internal error. + * @throws { BusinessError } 1007200999 - Unknown error code. + * @syscap SystemCapability.Telephony.VoipCallManager + * @since 4.1.0(11) + */ + function on(type: 'voipCallUiEvent', callback: Callback): void; + /** + * Unsubscribe to the voipCallUiEvent event. + * + * @param { 'voipCallUiEvent' } type - Event type. Indicates the voipCallUiEvent event to be unsubscribed to. + * @param { Callback } callback - Indicates the callback to unsubscribe from + * the voipCallUiEvent event. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 1007200001 - Invalid parameter value. + * @throws { BusinessError } 1007200002 - Operation failed. Cannot connect to service. + * @throws { BusinessError } 1007200003 - System internal error. + * @throws { BusinessError } 1007200999 - Unknown error code. + * @syscap SystemCapability.Telephony.VoipCallManager + * @since 4.1.0(11) + */ + function off(type: 'voipCallUiEvent', callback?: Callback): void; + /** + * Third-party applications report call status changes + * + * @param { string } callId - Indicates the identifier of the call. + * @param { VoipCallState } callState - Indicates the call state. + * @returns { Promise } The promise returned by the reportCallStateChange. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 1007200001 - Invalid parameter value. + * @throws { BusinessError } 1007200002 - Operation failed. Cannot connect to service. + * @throws { BusinessError } 1007200003 - System internal error. + * @throws { BusinessError } 1007200999 - Unknown error code. + * @syscap SystemCapability.Telephony.VoipCallManager + * @since 4.1.0(11) + */ + function reportCallStateChange(callId: string, callState: VoipCallState): Promise; + /** + * Third-party applications report incoming call + * + * @param { VoipCallAttribute } voipCallAttribute - Indicates the call detail information of the incoming call. + * @returns { Promise } Returns the error reason when reportIncomingCall fail. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 1007200001 - Invalid parameter value. + * @throws { BusinessError } 1007200002 - Operation failed. Cannot connect to service. + * @throws { BusinessError } 1007200003 - System internal error. + * @throws { BusinessError } 1007200999 - Unknown error code. + * @syscap SystemCapability.Telephony.VoipCallManager + * @since 4.1.0(11) + */ + function reportIncomingCall(voipCallAttribute: VoipCallAttribute): Promise; + /** + * Third-party applications report outgoing call + * + * @param { VoipCallAttribute } voipCallAttribute - Indicates the call detail information of the outgoing call. + * @returns { Promise } Returns the error reason when reportOutgoingCall fail. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 1007200001 - Invalid parameter value. + * @throws { BusinessError } 1007200002 - Operation failed. Cannot connect to service. + * @throws { BusinessError } 1007200003 - System internal error. + * @throws { BusinessError } 1007200999 - Unknown error code. + * @syscap SystemCapability.Telephony.VoipCallManager + * @since 5.0.0(12) + */ + function reportOutgoingCall(voipCallAttribute: VoipCallAttribute): Promise; + /** + * Third-party applications report call audio event change + * + * @param { string } callId - Indicates the identifier of the call. + * @param { CallAudioEvent } callAudioEvent - Indicates the audio event of the call. + * @returns { Promise } The promise returned by the reportCallAudioEventChange. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 1007200001 - Invalid parameter value. + * @throws { BusinessError } 1007200002 - Operation failed. Cannot connect to service. + * @throws { BusinessError } 1007200003 - System internal error. + * @throws { BusinessError } 1007200999 - Unknown error code. + * @syscap SystemCapability.Telephony.VoipCallManager + * @since 5.0.0(12) + */ + function reportCallAudioEventChange(callId: string, callAudioEvent: CallAudioEvent): Promise; + /** + * Third-party applications report the failed cause incoming call + * + * @param { string } callId - Indicates the identifier of the call. + * @param { VoipCallFailureCause } voipCallFailureCause - Indicates the failed cause of the incoming call. + * @returns { Promise } The promise returned by the reportIncomingCallError. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 1007200001 - Invalid parameter value. + * @throws { BusinessError } 1007200002 - Operation failed. Cannot connect to service. + * @throws { BusinessError } 1007200003 - System internal error. + * @throws { BusinessError } 1007200999 - Unknown error code. + * @syscap SystemCapability.Telephony.VoipCallManager + * @since 4.1.0(11) + */ + function reportIncomingCallError(callId: string, voipCallFailureCause: VoipCallFailureCause): Promise; + /** + * Indicates the voip call dedail information. + * + * @interface VoipCallAttribute + * @syscap SystemCapability.Telephony.VoipCallManager + * @since 4.1.0(11) + */ + export interface VoipCallAttribute { + /** + * Indicates the identifier of the call. + * + * @type { string } + * @syscap SystemCapability.Telephony.VoipCallManager + * @since 4.1.0(11) + */ + callId: string; + /** + * Indicates the VoIP call type, includes voice and video. + * + * @type { VoipCallType } + * @syscap SystemCapability.Telephony.VoipCallManager + * @since 4.1.0(11) + */ + voipCallType: VoipCallType; + /** + * Indicates the user name of the VoIP call. + * + * @type { string } + * @syscap SystemCapability.Telephony.VoipCallManager + * @since 4.1.0(11) + */ + userName: string; + /** + * Indicates the user profile photo of the incoming call. + * + * @type { image.PixelMap } + * @syscap SystemCapability.Telephony.VoipCallManager + * @since 4.1.0(11) + */ + userProfile: image.PixelMap; + /** + * Indicates the application UI extension ability name. + * + * @type { string } + * @syscap SystemCapability.Telephony.VoipCallManager + * @since 4.1.0(11) + */ + abilityName: string; + /** + * Indicates the call state of VoIP call. + * + * @type { VoipCallState } + * @syscap SystemCapability.Telephony.VoipCallManager + * @since 4.1.0(11) + */ + voipCallState: VoipCallState; + /** + * Indicates whether the VoIP incoming call default show live call banner. Default value is true. + * + * @type { ?boolean } + * @syscap SystemCapability.Telephony.VoipCallManager + * @since 5.0.0(12) + */ + showBannerForIncomingCall?: boolean; + } + /** + * Indicates the VoIP call type. + * + * @enum { number } + * @syscap SystemCapability.Telephony.VoipCallManager + * @since 4.1.0(11) + */ + export enum VoipCallType { + /** + * Indicates the type of voip call is voice. + * + * @syscap SystemCapability.Telephony.VoipCallManager + * @since 4.1.0(11) + */ + VOIP_CALL_VOICE = 0, + /** + * Indicates the type of voip call is video. + * + * @syscap SystemCapability.Telephony.VoipCallManager + * @since 4.1.0(11) + */ + VOIP_CALL_VIDEO = 1 + } + /** + * Indicates the VoIP call state. + * + * @enum { number } + * @syscap SystemCapability.Telephony.VoipCallManager + * @since 4.1.0(11) + */ + export enum VoipCallState { + /** + * Indicates the call state is idle. + * + * @syscap SystemCapability.Telephony.VoipCallManager + * @since 4.1.0(11) + */ + VOIP_CALL_STATE_IDLE = 0, + /** + * Indicates the call state is ringing. + * + * @syscap SystemCapability.Telephony.VoipCallManager + * @since 4.1.0(11) + */ + VOIP_CALL_STATE_RINGING = 1, + /** + * Indicates the call state is active. + * + * @syscap SystemCapability.Telephony.VoipCallManager + * @since 4.1.0(11) + */ + VOIP_CALL_STATE_ACTIVE = 2, + /** + * Indicates the call state is holding. + * + * @syscap SystemCapability.Telephony.VoipCallManager + * @since 4.1.0(11) + */ + VOIP_CALL_STATE_HOLDING = 3, + /** + * Indicates the call state is disconnected. + * + * @syscap SystemCapability.Telephony.VoipCallManager + * @since 4.1.0(11) + */ + VOIP_CALL_STATE_DISCONNECTED = 4, + /** + * Indicates the call state is dialing + * + * @syscap SystemCapability.Telephony.VoipCallManager + * @since 5.0.0(12) + */ + VOIP_CALL_STATE_DIALING = 5 + } + /** + * Indicates the event of the VoIP call from UI. + * + * @enum { number } + * @syscap SystemCapability.Telephony.VoipCallManager + * @since 4.1.0(11) + */ + export enum VoipCallUiEvent { + /** + * Indicates there is no event. + * + * @syscap SystemCapability.Telephony.VoipCallManager + * @since 4.1.0(11) + */ + VOIP_CALL_EVENT_NONE = 0, + /** + * Indicates the user clicked the voice answer button. + * + * @syscap SystemCapability.Telephony.VoipCallManager + * @since 4.1.0(11) + */ + VOIP_CALL_EVENT_VOICE_ANSWER = 1, + /** + * Indicates the user clicked the video answer button. + * + * @syscap SystemCapability.Telephony.VoipCallManager + * @since 4.1.0(11) + */ + VOIP_CALL_EVENT_VIDEO_ANSWER = 2, + /** + * Indicates the user clicked the reject button. + * + * @syscap SystemCapability.Telephony.VoipCallManager + * @since 4.1.0(11) + */ + VOIP_CALL_EVENT_REJECT = 3, + /** + * Indicates the voip call was hung up by other cause. + * + * @syscap SystemCapability.Telephony.VoipCallManager + * @since 4.1.0(11) + */ + VOIP_CALL_EVENT_HANGUP = 4, + /** + * Indicates the user clicked muted. + * + * @syscap SystemCapability.Telephony.VoipCallManager + * @since 5.0.0(12) + */ + VOIP_CALL_EVENT_MUTED = 5, + /** Indicates the user clicked unmuted. + * + * @syscap SystemCapability.Telephony.VoipCallManager + * @since 5.0.0(12) + */ + VOIP_CALL_EVENT_UNMUTED = 6, + /** + * Indicates the user clicked speaker on. + * + * @syscap SystemCapability.Telephony.VoipCallManager + * @since 5.0.0(12) + */ + VOIP_CALL_EVENT_SPEAKER_ON = 7, + /** + * Indicates the user clicked speaker off. + * + * @syscap SystemCapability.Telephony.VoipCallManager + * @since 5.0.0(12) + */ + VOIP_CALL_EVENT_SPEAKER_OFF = 8 + } + /** + * Indicates the error reason. + * + * @enum { number } + * @syscap SystemCapability.Telephony.VoipCallManager + * @since 4.1.0(11) + */ + export enum ErrorReason { + /** + * Indicates there is no error. + * + * @syscap SystemCapability.Telephony.VoipCallManager + * @since 4.1.0(11) + */ + ERROR_NONE = 0, + /** + * Indicates there is already a cellular call. + * + * @syscap SystemCapability.Telephony.VoipCallManager + * @since 4.1.0(11) + */ + CELLULAR_CALL_EXISTS = 1, + /** + * Indicates there is already a voip call. + * + * @syscap SystemCapability.Telephony.VoipCallManager + * @since 4.1.0(11) + */ + VOIP_CALL_EXISTS = 2, + /** + * Indicates this is a invalid call. + * + * @syscap SystemCapability.Telephony.VoipCallManager + * @since 4.1.0(11) + */ + INVALID_CALL = 3, + /** + * Indicates the user answered the cellular call first. + * + * @syscap SystemCapability.Telephony.VoipCallManager + * @since 4.1.0(11) + */ + USER_ANSWER_CELLULAR_FIRST = 4 + } + /** + * Indicates the VoIP call event detail information. + * + * @interface VoipCallUiEventInfo + * @syscap SystemCapability.Telephony.VoipCallManager + * @since 4.1.0(11) + */ + export interface VoipCallUiEventInfo { + /** + * Indicates the identifier of the call. + * + * @type { string } + * @syscap SystemCapability.Telephony.VoipCallManager + * @since 4.1.0(11) + */ + callId: string; + /** + * Indicates the event of the voip call. + * + * @type { VoipCallUiEvent } + * @syscap SystemCapability.Telephony.VoipCallManager + * @since 4.1.0(11) + */ + voipCallUiEvent: VoipCallUiEvent; + /** + * Indicates the error reason. + * + * @type { ErrorReason } + * @syscap SystemCapability.Telephony.VoipCallManager + * @since 4.1.0(11) + */ + errorReason: ErrorReason; + } + /** + * Indicates the failed cause of the incoming call. + * + * @enum { number } + * @syscap SystemCapability.Telephony.VoipCallManager + * @since 4.1.0(11) + */ + export enum VoipCallFailureCause { + /** + * Indicates the fail caused is other. + * + * @syscap SystemCapability.Telephony.VoipCallManager + * @since 4.1.0(11) + */ + OTHER = 0, + /** + * Indicates application line is busy. + * + * @syscap SystemCapability.Telephony.VoipCallManager + * @since 4.1.0(11) + */ + ROUTE_BUSY = 1, + /** + * Indicates application failed to establish connection. + * + * @syscap SystemCapability.Telephony.VoipCallManager + * @since 4.1.0(11) + */ + CONNECTION_FAILED = 2 + } + /** + * Indicates the event of the voip call audio mode change. + * + * @enum { number } + * @syscap SystemCapability.Telephony.VoipCallManager + * @since 5.0.0(12) + */ + export enum CallAudioEvent { + /** + * Indicates the event of muted + * + * @syscap SystemCapability.Telephony.VoipCallManager + * @since 5.0.0(12) + */ + AUDIO_EVENT_MUTED = 0, + /** + * Indicates the event of unmuted + * + * @syscap SystemCapability.Telephony.VoipCallManager + * @since 5.0.0(12) + */ + AUDIO_EVENT_UNMUTED = 1, + /** + * Indicates the event of speaker on + * + * @syscap SystemCapability.Telephony.VoipCallManager + * @since 5.0.0(12) + */ + AUDIO_EVENT_SPEAKER_ON = 2, + /** + * Indicates the event of speaker on + * + * @syscap SystemCapability.Telephony.VoipCallManager + * @since 5.0.0(12) + */ + AUDIO_EVENT_SPEAKER_OFF = 3 + } +} +export default voipCall; diff --git a/language/arkts/extractor/sdk/hms/ets/api/device-define/2in1-hmos.json b/language/arkts/extractor/sdk/hms/ets/api/device-define/2in1-hmos.json new file mode 100755 index 00000000..da59b92a --- /dev/null +++ b/language/arkts/extractor/sdk/hms/ets/api/device-define/2in1-hmos.json @@ -0,0 +1,68 @@ +{ + "SysCaps": [ + "SystemCapability.Global.I18nExt", + "SystemCapability.HiviewDFX.HiView.LogService", + "SystemCapability.HiviewDFX.XPower", + "SystemCapability.Collaboration.Camera", + "SystemCapability.Push.PushService", + "SystemCapability.LiveView.LiveViewService", + "SystemCapability.Collaboration.DevicePicker", + "SystemCapability.Customization.EnterpriseDeviceManagerExt", + "SystemCapability.Cloud.HiAnalytics", + "SystemCapability.AuthenticationServices.HuaweiID.Auth", + "SystemCapability.AuthenticationServices.HuaweiID.ExtendService", + "SystemCapability.PCService.FileGuard", + "SystemCapability.AuthenticationServices.HuaweiID.RealNameVerify", + "SystemCapability.FileManagement.FilePreview.Core", + "SystemCapability.OfficeService.PDFService.Core", + "SystemCapability.Security.DeviceCertificate", + "SystemCapability.Security.DeviceSecurityMode", + "SystemCapability.DeviceCloudGateway.CloudCapabilityManager", + "SystemCapability.DeviceCloudGateway.ClientCloudCacheService.Grs", + "SystemCapability.HiviewDFX.InfoSec", + "SystemCapability.Telephony.TelephonyEnhanced", + "SystemCapability.UserIAM.FingerprintAuthExt", + "SystemCapability.Security.SecurityPrivacyServer", + "SystemCapability.AuthenticationServices.HuaweiID.UIComponent", + "SystemCapability.HiViewDFX.Maintenance", + "SystemCapability.Collaboration.SystemShare", + "SystemCapability.Security.Ifaa", + "SystemCapability.Security.CodeProtect", + "SystemCapability.Collaboration.ServiceManager", + "SystemCapability.MiscServices.Theme", + "SystemCapability.BundleManager.EcologicalRuleManager.EcologicalRuleDataManager", + "SystemCapability.BundleManager.EcologicalRuleManager.SceneManager", + "SystemCapability.AppGalleryService.AppInfoManager", + "SystemCapability.AppGalleryService.Distribution.UnifiedInstall", + "SystemCapability.AppGalleryService.Distribution.Recommendations", + "SystemCapability.Security.FIDO", + "SystemCapability.AppGalleryService.Distribution.OnDemandInstall", + "SystemCapability.AI.Search", + "SystemCapability.Collaboration.RemoteCommunication", + "SystemCapability.AI.IntelligentKws.Core", + "SystemCapability.Game.GameService.GamePlayer", + "SystemCapability.AI.OCR.TextRecognition", + "SystemCapability.AI.SpeechRecognizer", + "SystemCapability.AI.TextToSpeech", + "SystemCapability.Payment.IAP", + "SystemCapability.Payment.PaymentService", + "SystemCapability.AppGalleryService.Distribution.Update", + "SystemCapability.AppGalleryService.AttributionManager", + "SystemCapability.AI.Component.LivenessDetect", + "SystemCapability.HiviewDFX.HiView.ChrLogService", + "SystemCapability.AI.Face.Detector", + "SystemCapability.AI.Face.Comparator", + "SystemCapability.Collaboration.Service", + "SystemCapability.Multimedia.ImageLoader.Core", + "SystemCapability.AuthenticationServices.HuaweiID.ShippingAddress", + "SystemCapability.HuaweiID.InvoiceAssistant", + "SystemCapability.AI.Component.TextReader", + "SystemCapability.GameService.GamePerformance", + "SystemCapability.Security.SafetyDetect", + "SystemCapability.PCService.StatusBarManager", + "SystemCapability.Stylus.Handwrite", + "SystemCapability.AI.Vision.SubjectSegmentation", + "SystemCapability.Security.SecurityAudit", + "SystemCapability.AI.NaturalLanguage.TextProcessing" + ] +} diff --git a/language/arkts/extractor/sdk/hms/ets/api/device-define/2in1.json b/language/arkts/extractor/sdk/hms/ets/api/device-define/2in1.json new file mode 100755 index 00000000..826f33a4 --- /dev/null +++ b/language/arkts/extractor/sdk/hms/ets/api/device-define/2in1.json @@ -0,0 +1,225 @@ +{ + "SysCaps": [ + "SystemCapability.ArkUI.ArkUI.Full", + "SystemCapability.ArkUI.ArkUI.Lite", + "SystemCapability.ArkUI.ArkUI.Napi", + "SystemCapability.ArkUI.ArkUI.Libuv", + "SystemCapability.ArkUI.UiAppearance", + "SystemCapability.Base", + "SystemCapability.BundleManager.BundleFramework", + "SystemCapability.BundleManager.BundleFramework.Overlay", + "SystemCapability.BundleManager.DistributedBundleFramework", + "SystemCapability.BundleManager.Zlib", + "SystemCapability.Graphic.Graphic2D.WebGL", + "SystemCapability.Graphic.Graphic2D.WebGL2", + "SystemCapability.WindowManager.WindowManager.Core", + "SystemCapability.WindowManager.WindowManager.MutiScreen", + "SystemCapability.Notification.CommonEvent", + "SystemCapability.Notification.Notification", + "SystemCapability.Notification.ReminderAgent", + "SystemCapability.Notification.Emitter", + "SystemCapability.Communication.IPC.Core", + "SystemCapability.Communication.SoftBus.Core", + "SystemCapability.Communication.NetManager.Core", + "SystemCapability.Communication.NetManager.Ethernet", + "SystemCapability.Communication.NetManager.NetSharing", + "SystemCapability.Communication.NetManager.MDNS", + "SystemCapability.Communication.NetManager.Vpn", + "SystemCapability.Communication.NetStack", + "SystemCapability.Communication.NetManager.SmartHotSpot", + "SystemCapability.Communication.WiFi.Core", + "SystemCapability.Communication.WiFi.STA", + "SystemCapability.Communication.WiFi.AP.Core", + "SystemCapability.Communication.WiFi.P2P", + "SystemCapability.Communication.Bluetooth.Core", + "SystemCapability.Communication.Bluetooth.Lite", + "SystemCapability.Location.Location.Core", + "SystemCapability.Location.Location.Geocoder", + "SystemCapability.Location.Location.Geofence", + "SystemCapability.Location.Location.Gnss", + "SystemCapability.Location.Location.Lite", + "SystemCapability.MultimodalInput.Input.Core", + "SystemCapability.MultimodalInput.Input.InputDevice", + "SystemCapability.MultimodalInput.Input.RemoteInputDevice", + "SystemCapability.MultimodalInput.Input.InputMonitor", + "SystemCapability.MultimodalInput.Input.InputConsumer", + "SystemCapability.MultimodalInput.Input.InputSimulator", + "SystemCapability.MultimodalInput.Input.InputFilter", + "SystemCapability.MultimodalInput.Input.Pointer", + "SystemCapability.MultimodalInput.Input.ShortKey", + "SystemCapability.PowerManager.BatteryManager.Extension", + "SystemCapability.PowerManager.BatteryManager.Lite", + "SystemCapability.PowerManager.BatteryStatistics", + "SystemCapability.PowerManager.DisplayPowerManager", + "SystemCapability.PowerManager.DisplayPowerManager.Lite", + "SystemCapability.PowerManager.ThermalManager", + "SystemCapability.PowerManager.PowerManager.Core", + "SystemCapability.PowerManager.BatteryManager.Core", + "SystemCapability.PowerManager.PowerManager.Extension", + "SystemCapability.Multimedia.Media.Core", + "SystemCapability.Multimedia.Media.AudioPlayer", + "SystemCapability.Multimedia.Media.AudioRecorder", + "SystemCapability.Multimedia.Media.VideoPlayer", + "SystemCapability.Multimedia.Media.VideoRecorder", + "SystemCapability.Multimedia.Media.CodecBase", + "SystemCapability.Multimedia.Media.AudioDecoder", + "SystemCapability.Multimedia.Media.AudioEncoder", + "SystemCapability.Multimedia.Media.VideoDecoder", + "SystemCapability.Multimedia.Media.VideoEncoder", + "SystemCapability.Multimedia.Media.Spliter", + "SystemCapability.Multimedia.Media.Muxer", + "SystemCapability.Multimedia.Media.AVPlayer", + "SystemCapability.Multimedia.Media.AVRecorder", + "SystemCapability.Multimedia.AVSession.Core", + "SystemCapability.Multimedia.AVSession.Manager", + "SystemCapability.Multimedia.AVSession.AVCast", + "SystemCapability.Multimedia.Audio.Core", + "SystemCapability.Multimedia.Audio.Renderer", + "SystemCapability.Multimedia.Audio.Capturer", + "SystemCapability.Multimedia.Audio.Device", + "SystemCapability.Multimedia.Audio.Volume", + "SystemCapability.Multimedia.Audio.Communication", + "SystemCapability.Multimedia.Audio.Interrupt", + "SystemCapability.Multimedia.Audio.Tone", + "SystemCapability.Multimedia.Audio.PlaybackCapture", + "SystemCapability.Multimedia.Camera.Core", + "SystemCapability.Multimedia.Camera.DistributedCore", + "SystemCapability.Multimedia.Image.Core", + "SystemCapability.Multimedia.Image.ImageSource", + "SystemCapability.Multimedia.Image.ImagePacker", + "SystemCapability.Multimedia.Image.ImageReceiver", + "SystemCapability.Multimedia.MediaLibrary.Core", + "SystemCapability.Multimedia.MediaLibrary.SmartAlbum", + "SystemCapability.Multimedia.MediaLibrary.DistributedCore", + "SystemCapability.Multimedia.SystemSound.Core", + "SystemCapability.Global.I18n", + "SystemCapability.Global.ResourceManager", + "SystemCapability.Customization.ConfigPolicy", + "SystemCapability.Customization.EnterpriseDeviceManager", + "SystemCapability.BarrierFree.Accessibility.Core", + "SystemCapability.BarrierFree.Accessibility.Vision", + "SystemCapability.BarrierFree.Accessibility.Hearing", + "SystemCapability.BarrierFree.Accessibility.Interaction", + "SystemCapability.ResourceSchedule.WorkScheduler", + "SystemCapability.ResourceSchedule.BackgroundTaskManager.ContinuousTask", + "SystemCapability.ResourceSchedule.BackgroundTaskManager.TransientTask", + "SystemCapability.ResourceSchedule.UsageStatistics.App", + "SystemCapability.ResourceSchedule.UsageStatistics.AppGroup", + "SystemCapability.Utils.Lang", + "SystemCapability.HiviewDFX.HiLog", + "SystemCapability.HiviewDFX.HiTrace", + "SystemCapability.HiviewDFX.Hiview.FaultLogger", + "SystemCapability.HiviewDFX.Hiview.LogLibrary", + "SystemCapability.HiviewDFX.HiChecker", + "SystemCapability.HiviewDFX.HiCollie", + "SystemCapability.HiviewDFX.HiDumper", + "SystemCapability.HiviewDFX.HiAppEvent", + "SystemCapability.HiviewDFX.HiSysEvent", + "SystemCapability.HiviewDFX.HiProfiler.HiDebug", + "SystemCapability.Update.UpdateService", + "SystemCapability.DistributedHardware.DeviceManager", + "SystemCapability.Security.DeviceAuth", + "SystemCapability.Security.DataTransitManager", + "SystemCapability.Security.DeviceSecurityLevel", + "SystemCapability.Security.Huks.Core", + "SystemCapability.Security.Huks.Extension", + "SystemCapability.Security.Asset", + "SystemCapability.Security.AccessToken", + "SystemCapability.Account.OsAccount", + "SystemCapability.Account.AppAccount", + "SystemCapability.UserIAM.UserAuth.Core", + "SystemCapability.UserIAM.UserAuth.PinAuth", + "SystemCapability.UserIAM.UserAuth.FaceAuth", + "SystemCapability.MiscServices.InputMethodFramework", + "SystemCapability.MiscServices.Pasteboard", + "SystemCapability.MiscServices.Time", + "SystemCapability.MiscServices.Wallpaper", + "SystemCapability.MiscServices.ScreenLock", + "SystemCapability.MiscServices.Upload", + "SystemCapability.MiscServices.Download", + "SystemCapability.FileManagement.StorageService.Backup", + "SystemCapability.FileManagement.StorageService.SpatialStatistics", + "SystemCapability.FileManagement.StorageService.Volume", + "SystemCapability.FileManagement.StorageService.Encryption", + "SystemCapability.FileManagement.File.FileIO", + "SystemCapability.FileManagement.File.FileIO.Lite", + "SystemCapability.FileManagement.File.Environment", + "SystemCapability.FileManagement.File.DistributedFile", + "SystemCapability.FileManagement.AppFileService", + "SystemCapability.FileManagement.UserFileService", + "SystemCapability.FileManagement.UserFileManager.Core", + "SystemCapability.FileManagement.PhotoAccessHelper.Core", + "SystemCapability.FileManagement.DistributedFileService.CloudSyncManager", + "SystemCapability.FileManagement.DistributedFileService.CloudSync.Core", + "SystemCapability.USB.USBManager", + "SystemCapability.Sensors.Sensor", + "SystemCapability.Sensors.MiscDevice", + "SystemCapability.Sensors.Sensor.Lite", + "SystemCapability.Sensors.MiscDevice.Lite", + "SystemCapability.Startup.SystemInfo", + "SystemCapability.Startup.SystemInfo.Lite", + "SystemCapability.DistributedDataManager.RelationalStore.Core", + "SystemCapability.DistributedDataManager.RelationalStore.Synchronize", + "SystemCapability.DistributedDataManager.KVStore.Core", + "SystemCapability.DistributedDataManager.KVStore.DistributedKVStore", + "SystemCapability.DistributedDataManager.DataObject.DistributedObject", + "SystemCapability.DistributedDataManager.Preferences.Core", + "SystemCapability.DistributedDataManager.Preferences.Core.Lite", + "SystemCapability.DistributedDataManager.DataShare.Core", + "SystemCapability.DistributedDataManager.DataShare.Consumer", + "SystemCapability.DistributedDataManager.DataShare.Provider", + "SystemCapability.DistributedDataManager.CloudSync.Config", + "SystemCapability.DistributedDataManager.CloudSync.Client", + "SystemCapability.DistributedDataManager.CloudSync.Server", + "SystemCapability.Ability.AbilityBase", + "SystemCapability.Ability.AbilityRuntime.Core", + "SystemCapability.Ability.AbilityRuntime.FAModel", + "SystemCapability.Ability.AbilityRuntime.AbilityCore", + "SystemCapability.Ability.AbilityRuntime.Mission", + "SystemCapability.Ability.AbilityTools.AbilityAssistant", + "SystemCapability.Ability.Form", + "SystemCapability.Ability.DistributedAbilityManager", + "SystemCapability.Applications.settings.Core", + "SystemCapability.Test.UiTest", + "SystemCapability.Web.Webview.Core", + "SystemCapability.Cloud.AAID", + "SystemCapability.Cloud.OAID", + "SystemCapability.Cloud.VAID", + "SystemCapability.Security.CertificateManager", + "SystemCapability.Security.CryptoFramework", + "SystemCapability.Security.Cert", + "SystemCapability.BundleManager.BundleFramework.Core", + "SystemCapability.BundleManager.BundleFramework.FreeInstall", + "SystemCapability.BundleManager.BundleFramework.Resource", + "SystemCapability.BundleManager.BundleFramework.DefaultApp", + "SystemCapability.BundleManager.BundleFramework.Launcher", + "SystemCapability.BundleManager.BundleFramework.SandboxApp", + "SystemCapability.BundleManager.BundleFramework.QuickFix", + "SystemCapability.BundleManager.BundleFramework.AppControl", + "SystemCapability.Ability.AbilityRuntime.QuickFix", + "SystemCapability.Graphic.Graphic2D.ColorManager.Core", + "SystemCapability.ResourceSchedule.BackgroundTaskManager.EfficiencyResourcesApply", + "SystemCapability.Msdp.DeviceStatus.Stationary", + "SystemCapability.XTS.DeviceAttest", + "SystemCapability.Request.FileTransferAgent", + "SystemCapability.ResourceSchedule.DeviceStandby", + "SystemCapability.DistributedDataManager.UDMF.Core", + "SystemCapability.Print.PrintFramework", + "SystemCapability.Multimedia.Media.AVScreenCapture", + "SystemCapability.MultimodalInput.Input.Cooperator", + "SystemCapability.Security.Cipher", + "SystemCapability.Security.CryptoFramework.Cert", + "SystemCapability.Security.DataLossPrevention", + "SystemCapability.Multimedia.Image.ImageCreator", + "SystemCapability.Developtools.Syscap", + "SystemCapability.Communication.SecureElement", + "SystemCapability.FileManagement.UserFileManager", + "SystemCapability.FileManagement.UserFileManager.DistributedCore", + "SystemCapability.Driver.ExternalDevice", + "SystemCapability.FileManagement.File.Environment.FolderObtain", + "SystemCapability.FileManagement.AppFileService.FolderAuthorization", + "SystemCapability.FileManagement.UserFileService.FolderSelection", + "SystemCapability.AI.IntelligentVoice.Core", + "SystemCapability.Ability.AppStartup" + ] +} diff --git a/language/arkts/extractor/sdk/hms/ets/api/device-define/car-hmos.json b/language/arkts/extractor/sdk/hms/ets/api/device-define/car-hmos.json new file mode 100755 index 00000000..e67660b3 --- /dev/null +++ b/language/arkts/extractor/sdk/hms/ets/api/device-define/car-hmos.json @@ -0,0 +1,66 @@ +{ + "SysCaps": [ + "SystemCapability.AI.InsightIntent", + "SystemCapability.Global.I18nExt", + "SystemCapability.HiviewDFX.HiView.LogService", + "SystemCapability.HiviewDFX.XPower", + "SystemCapability.Push.PushService", + "SystemCapability.LiveView.LiveViewService", + "SystemCapability.Payment.IAP", + "SystemCapability.Payment.PaymentService", + "SystemCapability.Customization.EnterpriseDeviceManagerExt", + "SystemCapability.Cloud.HiAnalytics", + "SystemCapability.Collaboration.Camera", + "SystemCapability.AuthenticationServices.HuaweiID.Auth", + "SystemCapability.AuthenticationServices.HuaweiID.ExtendService", + "SystemCapability.AuthenticationServices.HuaweiID.RealNameVerify", + "SystemCapability.AuthenticationServices.HuaweiID.MinorsProtection", + "SystemCapability.Game.GameService.GamePlayer", + "SystemCapability.Security.DeviceCertificate", + "SystemCapability.Security.DeviceSecurityMode", + "SystemCapability.Security.ActivationLock", + "SystemCapability.DeviceCloudGateway.CloudCapabilityManager", + "SystemCapability.DeviceCloudGateway.ClientCloudCacheService.Grs", + "SystemCapability.HiviewDFX.InfoSec", + "SystemCapability.FindDevice.FindNetwork", + "SystemCapability.Communication.NetManager.SmartHotSpot", + "SystemCapability.Multimedia.Scan.Core", + "SystemCapability.Multimedia.Scan.ScanBarcode", + "SystemCapability.Multimedia.Scan.GenerateBarcode", + "SystemCapability.Security.SecurityPrivacyServer", + "SystemCapability.AuthenticationServices.HuaweiID.UIComponent", + "SystemCapability.HiViewDFX.Maintenance", + "SystemCapability.Collaboration.SystemShare", + "SystemCapability.Security.Ifaa", + "SystemCapability.Security.CodeProtect", + "SystemCapability.Collaboration.ServiceManager", + "SystemCapability.MiscServices.Theme", + "SystemCapability.BundleManager.EcologicalRuleManager.EcologicalRuleDataManager", + "SystemCapability.BundleManager.EcologicalRuleManager.SceneManager", + "SystemCapability.AppGalleryService.AppInfoManager", + "SystemCapability.AppGalleryService.Distribution.UnifiedInstall", + "SystemCapability.AppGalleryService.Distribution.Recommendations", + "SystemCapability.Security.FIDO", + "SystemCapability.AppGalleryService.Distribution.OnDemandInstall", + "SystemCapability.AI.HiAIFoundation", + "SystemCapability.AI.Search", + "SystemCapability.Collaboration.RemoteCommunication", + "SystemCapability.AI.IntelligentKws.Core", + "SystemCapability.Health.HealthStore", + "SystemCapability.Health.HealthService", + "SystemCapability.AppGalleryService.Distribution.Update", + "SystemCapability.AppGalleryService.AttributionManager", + "SystemCapability.AI.Component.CardRecognition", + "SystemCapability.AI.Component.DocScan", + "SystemCapability.AI.Component.LivenessDetect", + "SystemCapability.AI.Face.Detector", + "SystemCapability.AI.Face.Comparator", + "SystemCapability.Collaboration.Service", + "SystemCapability.Multimedia.ImageLoader.Core", + "SystemCapability.AuthenticationServices.HuaweiID.ShippingAddress", + "SystemCapability.GraphicsGame.RenderAccelerate", + "SystemCapability.AI.Component.TextReader", + "SystemCapability.ResourceSchedule.LowpowerManager", + "SystemCapability.GameService.GamePerformance" + ] +} diff --git a/language/arkts/extractor/sdk/hms/ets/api/device-define/car.json b/language/arkts/extractor/sdk/hms/ets/api/device-define/car.json new file mode 100755 index 00000000..0df3e9c4 --- /dev/null +++ b/language/arkts/extractor/sdk/hms/ets/api/device-define/car.json @@ -0,0 +1,211 @@ +{ + "SysCaps": [ + "SystemCapability.ArkUI.ArkUI.Full", + "SystemCapability.ArkUI.ArkUI.Napi", + "SystemCapability.ArkUI.ArkUI.Libuv", + "SystemCapability.ArkUI.ArkUI.Lite", + "SystemCapability.ArkUI.UiAppearance", + "SystemCapability.Base", + "SystemCapability.BundleManager.BundleFramework", + "SystemCapability.BundleManager.BundleFramework.Overlay", + "SystemCapability.BundleManager.DistributedBundleFramework", + "SystemCapability.BundleManager.Zlib", + "SystemCapability.Graphic.Graphic2D.EGL", + "SystemCapability.Graphic.Graphic2D.GLES2", + "SystemCapability.Graphic.Graphic2D.GLES3", + "SystemCapability.Graphic.Graphic2D.WebGL", + "SystemCapability.Window.SessionManager", + "SystemCapability.WindowManager.WindowManager.Core", + "SystemCapability.Notification.CommonEvent", + "SystemCapability.Notification.Notification", + "SystemCapability.Notification.ReminderAgent", + "SystemCapability.Notification.Emitter", + "SystemCapability.Communication.IPC.Core", + "SystemCapability.Communication.SoftBus.Core", + "SystemCapability.Communication.NetManager.Core", + "SystemCapability.Communication.NetManager.Ethernet", + "SystemCapability.Communication.NetManager.NetSharing", + "SystemCapability.Communication.NetManager.MDNS", + "SystemCapability.Communication.NetManager.Vpn", + "SystemCapability.Communication.NetStack", + "SystemCapability.Communication.WiFi.Core", + "SystemCapability.Communication.WiFi.STA", + "SystemCapability.Communication.WiFi.AP.Core", + "SystemCapability.Communication.WiFi.P2P", + "SystemCapability.Communication.Bluetooth.Core", + "SystemCapability.Location.Location.Core", + "SystemCapability.Location.Location.Geocoder", + "SystemCapability.Location.Location.Geofence", + "SystemCapability.Location.Location.Gnss", + "SystemCapability.MultimodalInput.Input.Core", + "SystemCapability.MultimodalInput.Input.InputDevice", + "SystemCapability.MultimodalInput.Input.InputMonitor", + "SystemCapability.MultimodalInput.Input.InputConsumer", + "SystemCapability.MultimodalInput.Input.InputSimulator", + "SystemCapability.MultimodalInput.Input.Pointer", + "SystemCapability.MultimodalInput.Input.ShortKey", + "SystemCapability.PowerManager.BatteryManager.Extension", + "SystemCapability.PowerManager.DisplayPowerManager", + "SystemCapability.PowerManager.ThermalManager", + "SystemCapability.PowerManager.PowerManager.Core", + "SystemCapability.PowerManager.BatteryManager.Core", + "SystemCapability.PowerManager.PowerManager.Extension", + "SystemCapability.Multimedia.Media.Core", + "SystemCapability.Multimedia.Media.AudioPlayer", + "SystemCapability.Multimedia.Media.AudioRecorder", + "SystemCapability.Multimedia.Media.VideoPlayer", + "SystemCapability.Multimedia.Media.VideoRecorder", + "SystemCapability.Multimedia.Media.CodecBase", + "SystemCapability.Multimedia.Media.AudioCodec", + "SystemCapability.Multimedia.Media.AudioDecoder", + "SystemCapability.Multimedia.Media.AudioEncoder", + "SystemCapability.Multimedia.Media.VideoDecoder", + "SystemCapability.Multimedia.Media.VideoEncoder", + "SystemCapability.Multimedia.Media.Spliter", + "SystemCapability.Multimedia.Media.Muxer", + "SystemCapability.Multimedia.Media.AVPlayer", + "SystemCapability.Multimedia.Media.AVRecorder", + "SystemCapability.Multimedia.Media.AVMetadataExtractor", + "SystemCapability.Multimedia.Media.AVImageGenerator", + "SystemCapability.Multimedia.AVSession.Core", + "SystemCapability.Multimedia.AVSession.Manager", + "SystemCapability.Multimedia.AVSession.AVCast", + "SystemCapability.Multimedia.Audio.Core", + "SystemCapability.Multimedia.Audio.Renderer", + "SystemCapability.Multimedia.Audio.Capturer", + "SystemCapability.Multimedia.Audio.Device", + "SystemCapability.Multimedia.Audio.Volume", + "SystemCapability.Multimedia.Audio.Communication", + "SystemCapability.Multimedia.Audio.Interrupt", + "SystemCapability.Multimedia.Audio.Tone", + "SystemCapability.Multimedia.Audio.PlaybackCapture", + "SystemCapability.Multimedia.Camera.Core", + "SystemCapability.Multimedia.Drm.Core", + "SystemCapability.Multimedia.Image.Core", + "SystemCapability.Multimedia.Image.ImageSource", + "SystemCapability.Multimedia.Image.ImagePacker", + "SystemCapability.Multimedia.Image.ImageReceiver", + "SystemCapability.Multimedia.MediaLibrary.Core", + "SystemCapability.Multimedia.MediaLibrary.DistributedCore", + "SystemCapability.Multimedia.SystemSound.Core", + "SystemCapability.Global.I18n", + "SystemCapability.Global.ResourceManager", + "SystemCapability.Customization.ConfigPolicy", + "SystemCapability.Customization.EnterpriseDeviceManager", + "SystemCapability.BarrierFree.Accessibility.Core", + "SystemCapability.BarrierFree.Accessibility.Vision", + "SystemCapability.BarrierFree.Accessibility.Hearing", + "SystemCapability.ResourceSchedule.WorkScheduler", + "SystemCapability.ResourceSchedule.BackgroundTaskManager.ContinuousTask", + "SystemCapability.ResourceSchedule.BackgroundTaskManager.TransientTask", + "SystemCapability.ResourceSchedule.UsageStatistics.App", + "SystemCapability.ResourceSchedule.UsageStatistics.AppGroup", + "SystemCapability.Utils.Lang", + "SystemCapability.HiviewDFX.HiLog", + "SystemCapability.HiviewDFX.HiTrace", + "SystemCapability.HiviewDFX.Hiview.FaultLogger", + "SystemCapability.HiviewDFX.Hiview.LogLibrary", + "SystemCapability.HiviewDFX.HiChecker", + "SystemCapability.HiviewDFX.HiDumper", + "SystemCapability.HiviewDFX.HiAppEvent", + "SystemCapability.HiviewDFX.HiSysEvent", + "SystemCapability.HiviewDFX.HiProfiler.HiDebug", + "SystemCapability.Update.UpdateService", + "SystemCapability.DistributedHardware.DeviceManager", + "SystemCapability.Security.DeviceAuth", + "SystemCapability.Security.DataTransitManager", + "SystemCapability.Security.DeviceSecurityLevel", + "SystemCapability.Security.Huks.Core", + "SystemCapability.Security.Huks.Extension", + "SystemCapability.Security.Asset", + "SystemCapability.Security.AccessToken", + "SystemCapability.Security.SecurityGuard", + "SystemCapability.Account.OsAccount", + "SystemCapability.Account.AppAccount", + "SystemCapability.UserIAM.UserAuth.Core", + "SystemCapability.UserIAM.UserAuth.PinAuth", + "SystemCapability.MiscServices.InputMethodFramework", + "SystemCapability.MiscServices.Pasteboard", + "SystemCapability.MiscServices.Time", + "SystemCapability.MiscServices.Wallpaper", + "SystemCapability.MiscServices.ScreenLock", + "SystemCapability.MiscServices.Upload", + "SystemCapability.MiscServices.Download", + "SystemCapability.FileManagement.StorageService.Backup", + "SystemCapability.FileManagement.StorageService.SpatialStatistics", + "SystemCapability.FileManagement.StorageService.Volume", + "SystemCapability.FileManagement.StorageService.Encryption", + "SystemCapability.FileManagement.File.FileIO", + "SystemCapability.FileManagement.File.Environment", + "SystemCapability.FileManagement.File.DistributedFile", + "SystemCapability.FileManagement.AppFileService", + "SystemCapability.FileManagement.UserFileService", + "SystemCapability.FileManagement.UserFileManager.Core", + "SystemCapability.FileManagement.PhotoAccessHelper.Core", + "SystemCapability.FileManagement.DistributedFileService.CloudSyncManager", + "SystemCapability.FileManagement.DistributedFileService.CloudSync.Core", + "SystemCapability.USB.USBManager", + "SystemCapability.Sensors.Sensor", + "SystemCapability.Sensors.MiscDevice", + "SystemCapability.Startup.SystemInfo", + "SystemCapability.DistributedDataManager.RelationalStore.Core", + "SystemCapability.DistributedDataManager.CommonType", + "SystemCapability.DistributedDataManager.KVStore.Core", + "SystemCapability.DistributedDataManager.KVStore.DistributedKVStore", + "SystemCapability.DistributedDataManager.DataObject.DistributedObject", + "SystemCapability.DistributedDataManager.Preferences.Core", + "SystemCapability.DistributedDataManager.DataShare.Core", + "SystemCapability.DistributedDataManager.DataShare.Consumer", + "SystemCapability.DistributedDataManager.DataShare.Provider", + "SystemCapability.DistributedDataManager.CloudSync.Config", + "SystemCapability.DistributedDataManager.CloudSync.Client", + "SystemCapability.DistributedDataManager.CloudSync.Server", + "SystemCapability.Ability.AbilityBase", + "SystemCapability.Ability.AbilityRuntime.Core", + "SystemCapability.Ability.AbilityRuntime.FAModel", + "SystemCapability.Ability.AbilityRuntime.AbilityCore", + "SystemCapability.Ability.AbilityRuntime.Mission", + "SystemCapability.Ability.AbilityTools.AbilityAssistant", + "SystemCapability.Ability.Form", + "SystemCapability.Ability.DistributedAbilityManager", + "SystemCapability.Applications.CalendarData", + "SystemCapability.Applications.Settings.Core", + "SystemCapability.Test.UiTest", + "SystemCapability.Web.Webview.Core", + "SystemCapability.Advertising.OAID", + "SystemCapability.Advertising.Ads", + "SystemCapability.Security.CertificateManager", + "SystemCapability.Security.CryptoFramework", + "SystemCapability.Security.Cert", + "SystemCapability.BundleManager.BundleFramework.Core", + "SystemCapability.BundleManager.BundleFramework.FreeInstall", + "SystemCapability.BundleManager.BundleFramework.Resource", + "SystemCapability.BundleManager.BundleFramework.DefaultApp", + "SystemCapability.BundleManager.BundleFramework.Launcher", + "SystemCapability.BundleManager.BundleFramework.AppControl", + "SystemCapability.Ability.AbilityRuntime.QuickFix", + "SystemCapability.Graphic.Graphic2D.ColorManager.Core", + "SystemCapability.ResourceSchedule.BackgroundTaskManager.EfficiencyResourcesApply", + "SystemCapability.Request.FileTransferAgent", + "SystemCapability.ResourceSchedule.DeviceStandby", + "SystemCapability.DistributedDataManager.UDMF.Core", + "SystemCapability.Multimedia.Media.AVScreenCapture", + "SystemCapability.Multimedia.Media.SoundPool", + "SystemCapability.Multimedia.Audio.Spatialization", + "SystemCapability.Multimedia.AudioHaptic.Core", + "SystemCapability.ArkUi.Graphics3D", + "SystemCapability.Graphics.Drawing", + "SystemCapability.Graphic.Graphic2D.NativeDrawing", + "SystemCapability.XTS.DeviceAttest", + "SystemCapability.Developtools.Syscap", + "SystemCapability.Resourceschedule.Ffrt.Core", + "SystemCapability.Graphic.Graphic2D.NativeWindow", + "SystemCapability.Graphic.Graphic2D.NativeBuffer", + "SystemCapability.Graphic.Graphic2D.NativeImage", + "SystemCapability.Graphic.Graphic2D.NativeVsync", + "SystemCapability.Graphic.Vulkan", + "SystemCapability.Multimedia.Image.ImageCreator", + "SystemCapability.Graphic.Graphic2D.WebGL2", + "SystemCapability.Ability.AppStartup" + ] +} diff --git a/language/arkts/extractor/sdk/hms/ets/api/device-define/liteWearable-hmos.json b/language/arkts/extractor/sdk/hms/ets/api/device-define/liteWearable-hmos.json new file mode 100755 index 00000000..2db31302 --- /dev/null +++ b/language/arkts/extractor/sdk/hms/ets/api/device-define/liteWearable-hmos.json @@ -0,0 +1,4 @@ +{ + "SysCaps": [ + ] +} diff --git a/language/arkts/extractor/sdk/hms/ets/api/device-define/phone-hmos.json b/language/arkts/extractor/sdk/hms/ets/api/device-define/phone-hmos.json new file mode 100755 index 00000000..cfc1b5e3 --- /dev/null +++ b/language/arkts/extractor/sdk/hms/ets/api/device-define/phone-hmos.json @@ -0,0 +1,100 @@ +{ + "SysCaps": [ + "SystemCapability.AtomicserviceComponent.UIComponent", + "SystemCapability.AtomicserviceComponent.atomicservice", + "SystemCapability.AI.InsightIntent", + "SystemCapability.Global.I18nExt", + "SystemCapability.HiviewDFX.HiView.LogService", + "SystemCapability.HiviewDFX.XPower", + "SystemCapability.HiviewDFX.HiView.ChrLogService", + "SystemCapability.Collaboration.Camera", + "SystemCapability.Communication.NetManager.SmartHotSpot", + "SystemCapability.Push.PushService", + "SystemCapability.LiveView.LiveViewService", + "SystemCapability.Payment.IAP", + "SystemCapability.Payment.PaymentService", + "SystemCapability.Collaboration.DevicePicker", + "SystemCapability.Multimedia.Scan.Core", + "SystemCapability.Multimedia.Scan.ScanBarcode", + "SystemCapability.Customization.EnterpriseDeviceManagerExt", + "SystemCapability.Cloud.HiAnalytics", + "SystemCapability.AuthenticationServices.HuaweiID.Auth", + "SystemCapability.AuthenticationServices.HuaweiID.ExtendService", + "SystemCapability.AuthenticationServices.HuaweiID.RealNameVerify", + "SystemCapability.AuthenticationServices.HuaweiID.MinorsProtection", + "SystemCapability.Game.GameService.GamePlayer", + "SystemCapability.AI.OCR.TextRecognition", + "SystemCapability.Map.Core", + "SystemCapability.FileManagement.FilePreview.Core", + "SystemCapability.OfficeService.PDFService.Core", + "SystemCapability.Security.DeviceCertificate", + "SystemCapability.Security.ActivationLock", + "SystemCapability.Multimedia.Scan.GenerateBarcode", + "SystemCapability.Security.Ifaa", + "SystemCapability.Security.CodeProtect", + "SystemCapability.Security.DeviceSecurityMode", + "SystemCapability.AI.TextToSpeech", + "SystemCapability.DeviceCloudGateway.CloudCapabilityManager", + "SystemCapability.DeviceCloudGateway.ClientCloudCacheService.Grs", + "SystemCapability.DeviceCloudGateway.CloudFoundation", + "SystemCapability.HiviewDFX.InfoSec", + "SystemCapability.FindDevice.FindNetwork", + "SystemCapability.Communication.NFC.WalletExt", + "SystemCapability.Telephony.TelephonyEnhanced", + "SystemCapability.Telephony.TelephonyEnhanced.VSim", + "SystemCapability.Telephony.VoipCallManager", + "SystemCapability.Telephony.CallManager", + "SystemCapability.VirtService.BmsBrokerAdapter", + "SystemCapability.UserIAM.FingerprintAuthExt", + "SystemCapability.Security.SecurityPrivacyServer", + "SystemCapability.UtilityApplication.ParentControl.Core", + "SystemCapability.VirtService.Base", + "SystemCapability.AuthenticationServices.HuaweiID.UIComponent", + "SystemCapability.AI.SpeechRecognizer", + "SystemCapability.HiViewDFX.Maintenance", + "SystemCapability.Collaboration.SystemShare", + "SystemCapability.Collaboration.ServiceManager", + "SystemCapability.MiscServices.Theme", + "SystemCapability.CarService.DistributedEngine", + "SystemCapability.BundleManager.EcologicalRuleManager.EcologicalRuleDataManager", + "SystemCapability.BundleManager.EcologicalRuleManager.SceneManager", + "SystemCapability.AppGalleryService.AppInfoManager", + "SystemCapability.AppGalleryService.Distribution.UnifiedInstall", + "SystemCapability.AppGalleryService.Distribution.Recommendations", + "SystemCapability.Security.FIDO", + "SystemCapability.AppGalleryService.Distribution.OnDemandInstall", + "SystemCapability.AI.HiAIFoundation", + "SystemCapability.CarService.NavigationInfo", + "SystemCapability.AI.Search", + "SystemCapability.Graphic.ApsManager.Resolution", + "SystemCapability.Collaboration.RemoteCommunication", + "SystemCapability.AI.IntelligentKws.Core", + "SystemCapability.Health.HealthStore", + "SystemCapability.Health.HealthService", + "SystemCapability.AppGalleryService.Distribution.Update", + "SystemCapability.GraphicsGame.RenderAccelerate", + "SystemCapability.AppGalleryService.AttributionManager", + "SystemCapability.AI.Component.CardRecognition", + "SystemCapability.AI.Component.DocScan", + "SystemCapability.AI.Component.LivenessDetect", + "SystemCapability.AI.Face.Detector", + "SystemCapability.AI.Face.Comparator", + "SystemCapability.Collaboration.Service", + "SystemCapability.Multimedia.ImageLoader.Core", + "SystemCapability.AuthenticationServices.HuaweiID.ShippingAddress", + "SystemCapability.HuaweiID.InvoiceAssistant", + "SystemCapability.Graphic.XEngine", + "SystemCapability.AREngine.Core", + "SystemCapability.AI.Component.TextReader", + "SystemCapability.ResourceSchedule.LowpowerManager", + "SystemCapability.Security.SafetyDetect", + "SystemCapability.Stylus.Handwrite", + "SystemCapability.GameService.GamePerformance", + "SystemCapability.AI.Vision.SubjectSegmentation", + "SystemCapability.AI.NaturalLanguage.TextProcessing", + "SystemCapability.Security.PrivateSpace", + "SystemCapability.Payment.Wallet", + "SystemCapability.Security.trustedAppService.Core", + "SystemCapability.Security.trustedAppService.Location" + ] +} diff --git a/language/arkts/extractor/sdk/hms/ets/api/device-define/phone.json b/language/arkts/extractor/sdk/hms/ets/api/device-define/phone.json new file mode 100755 index 00000000..44699d14 --- /dev/null +++ b/language/arkts/extractor/sdk/hms/ets/api/device-define/phone.json @@ -0,0 +1,220 @@ +{ + "SysCaps": [ + "SystemCapability.ArkUI.ArkUI.Full", + "SystemCapability.ArkUI.ArkUI.Napi", + "SystemCapability.ArkUI.ArkUI.Libuv", + "SystemCapability.ArkUI.ArkUI.Lite", + "SystemCapability.ArkUI.UiAppearance", + "SystemCapability.Base", + "SystemCapability.BundleManager.BundleFramework", + "SystemCapability.BundleManager.BundleFramework.Overlay", + "SystemCapability.BundleManager.DistributedBundleFramework", + "SystemCapability.BundleManager.Zlib", + "SystemCapability.Graphic.Graphic2D.EGL", + "SystemCapability.Graphic.Graphic2D.GLES2", + "SystemCapability.Graphic.Graphic2D.GLES3", + "SystemCapability.Graphic.Graphic2D.WebGL", + "SystemCapability.Graphic.Graphic2D.WebGL2", + "SystemCapability.Window.SessionManager", + "SystemCapability.WindowManager.WindowManager.Core", + "SystemCapability.Notification.CommonEvent", + "SystemCapability.Notification.Notification", + "SystemCapability.Notification.ReminderAgent", + "SystemCapability.Notification.Emitter", + "SystemCapability.Communication.IPC.Core", + "SystemCapability.Communication.SoftBus.Core", + "SystemCapability.Communication.NetManager.Core", + "SystemCapability.Communication.NetManager.Ethernet", + "SystemCapability.Communication.NetManager.NetSharing", + "SystemCapability.Communication.NetManager.MDNS", + "SystemCapability.Communication.NetManager.Vpn", + "SystemCapability.Communication.NetStack", + "SystemCapability.Communication.WiFi.Core", + "SystemCapability.Communication.WiFi.STA", + "SystemCapability.Communication.WiFi.AP.Core", + "SystemCapability.Communication.WiFi.P2P", + "SystemCapability.Communication.Bluetooth.Core", + "SystemCapability.Location.Location.Core", + "SystemCapability.Location.Location.Geocoder", + "SystemCapability.Location.Location.Geofence", + "SystemCapability.Location.Location.Gnss", + "SystemCapability.MultimodalInput.Input.Core", + "SystemCapability.MultimodalInput.Input.InputDevice", + "SystemCapability.MultimodalInput.Input.InputMonitor", + "SystemCapability.MultimodalInput.Input.InputConsumer", + "SystemCapability.MultimodalInput.Input.InputSimulator", + "SystemCapability.MultimodalInput.Input.Pointer", + "SystemCapability.MultimodalInput.Input.ShortKey", + "SystemCapability.PowerManager.BatteryManager.Extension", + "SystemCapability.PowerManager.DisplayPowerManager", + "SystemCapability.PowerManager.ThermalManager", + "SystemCapability.PowerManager.PowerManager.Core", + "SystemCapability.PowerManager.BatteryManager.Core", + "SystemCapability.PowerManager.PowerManager.Extension", + "SystemCapability.Multimedia.Media.Core", + "SystemCapability.Multimedia.Media.AudioPlayer", + "SystemCapability.Multimedia.Media.AudioRecorder", + "SystemCapability.Multimedia.Media.VideoPlayer", + "SystemCapability.Multimedia.Media.VideoRecorder", + "SystemCapability.Multimedia.Media.CodecBase", + "SystemCapability.Multimedia.Media.AudioCodec", + "SystemCapability.Multimedia.Media.AudioDecoder", + "SystemCapability.Multimedia.Media.AudioEncoder", + "SystemCapability.Multimedia.Media.VideoDecoder", + "SystemCapability.Multimedia.Media.VideoEncoder", + "SystemCapability.Multimedia.Media.Spliter", + "SystemCapability.Multimedia.Media.Muxer", + "SystemCapability.Multimedia.Media.AVPlayer", + "SystemCapability.Multimedia.Media.AVRecorder", + "SystemCapability.Multimedia.Media.AVMetadataExtractor", + "SystemCapability.Multimedia.Media.AVImageGenerator", + "SystemCapability.Multimedia.AVSession.Core", + "SystemCapability.Multimedia.AVSession.Manager", + "SystemCapability.Multimedia.AVSession.AVCast", + "SystemCapability.Multimedia.AVSession.ExtendedDisplayCast", + "SystemCapability.Multimedia.Audio.Core", + "SystemCapability.Multimedia.Audio.Renderer", + "SystemCapability.Multimedia.Audio.Capturer", + "SystemCapability.Multimedia.Audio.Device", + "SystemCapability.Multimedia.Audio.Volume", + "SystemCapability.Multimedia.Audio.Communication", + "SystemCapability.Multimedia.Audio.Interrupt", + "SystemCapability.Multimedia.Audio.Tone", + "SystemCapability.Multimedia.Audio.PlaybackCapture", + "SystemCapability.Multimedia.Camera.Core", + "SystemCapability.Multimedia.Drm.Core", + "SystemCapability.Multimedia.Image.Core", + "SystemCapability.Multimedia.Image.ImageSource", + "SystemCapability.Multimedia.Image.ImagePacker", + "SystemCapability.Multimedia.Image.ImageReceiver", + "SystemCapability.Multimedia.ImageEffect.Core", + "SystemCapability.Multimedia.MediaLibrary.Core", + "SystemCapability.Multimedia.MediaLibrary.DistributedCore", + "SystemCapability.Multimedia.SystemSound.Core", + "SystemCapability.Telephony.CoreService", + "SystemCapability.Telephony.CallManager", + "SystemCapability.Telephony.CellularCall", + "SystemCapability.Telephony.CellularData", + "SystemCapability.Telephony.SmsMms", + "SystemCapability.Telephony.StateRegistry", + "SystemCapability.Global.I18n", + "SystemCapability.Global.ResourceManager", + "SystemCapability.Customization.ConfigPolicy", + "SystemCapability.Customization.EnterpriseDeviceManager", + "SystemCapability.BarrierFree.Accessibility.Core", + "SystemCapability.BarrierFree.Accessibility.Vision", + "SystemCapability.BarrierFree.Accessibility.Hearing", + "SystemCapability.ResourceSchedule.WorkScheduler", + "SystemCapability.ResourceSchedule.BackgroundTaskManager.ContinuousTask", + "SystemCapability.ResourceSchedule.BackgroundTaskManager.TransientTask", + "SystemCapability.ResourceSchedule.UsageStatistics.App", + "SystemCapability.ResourceSchedule.UsageStatistics.AppGroup", + "SystemCapability.Utils.Lang", + "SystemCapability.HiviewDFX.HiLog", + "SystemCapability.HiviewDFX.HiTrace", + "SystemCapability.HiviewDFX.Hiview.FaultLogger", + "SystemCapability.HiviewDFX.Hiview.LogLibrary", + "SystemCapability.HiviewDFX.HiChecker", + "SystemCapability.HiviewDFX.HiDumper", + "SystemCapability.HiviewDFX.HiAppEvent", + "SystemCapability.HiviewDFX.HiSysEvent", + "SystemCapability.HiviewDFX.HiProfiler.HiDebug", + "SystemCapability.Update.UpdateService", + "SystemCapability.DistributedHardware.DeviceManager", + "SystemCapability.Security.DeviceAuth", + "SystemCapability.Security.DataTransitManager", + "SystemCapability.Security.DeviceSecurityLevel", + "SystemCapability.Security.Huks.Core", + "SystemCapability.Security.Huks.Extension", + "SystemCapability.Security.Asset", + "SystemCapability.Security.AccessToken", + "SystemCapability.Account.OsAccount", + "SystemCapability.Account.AppAccount", + "SystemCapability.UserIAM.UserAuth.Core", + "SystemCapability.UserIAM.UserAuth.PinAuth", + "SystemCapability.MiscServices.InputMethodFramework", + "SystemCapability.MiscServices.Pasteboard", + "SystemCapability.MiscServices.Time", + "SystemCapability.MiscServices.Wallpaper", + "SystemCapability.MiscServices.ScreenLock", + "SystemCapability.MiscServices.Upload", + "SystemCapability.MiscServices.Download", + "SystemCapability.FileManagement.StorageService.Backup", + "SystemCapability.FileManagement.StorageService.SpatialStatistics", + "SystemCapability.FileManagement.StorageService.Volume", + "SystemCapability.FileManagement.StorageService.Encryption", + "SystemCapability.FileManagement.File.FileIO", + "SystemCapability.FileManagement.File.Environment", + "SystemCapability.FileManagement.File.DistributedFile", + "SystemCapability.FileManagement.AppFileService", + "SystemCapability.FileManagement.UserFileService", + "SystemCapability.FileManagement.UserFileManager.Core", + "SystemCapability.FileManagement.PhotoAccessHelper.Core", + "SystemCapability.FileManagement.DistributedFileService.CloudSyncManager", + "SystemCapability.FileManagement.DistributedFileService.CloudSync.Core", + "SystemCapability.USB.USBManager", + "SystemCapability.Sensors.Sensor", + "SystemCapability.Sensors.MiscDevice", + "SystemCapability.Startup.SystemInfo", + "SystemCapability.DistributedDataManager.RelationalStore.Core", + "SystemCapability.DistributedDataManager.CommonType", + "SystemCapability.DistributedDataManager.KVStore.Core", + "SystemCapability.DistributedDataManager.KVStore.DistributedKVStore", + "SystemCapability.DistributedDataManager.DataObject.DistributedObject", + "SystemCapability.DistributedDataManager.Preferences.Core", + "SystemCapability.DistributedDataManager.DataShare.Core", + "SystemCapability.DistributedDataManager.DataShare.Consumer", + "SystemCapability.DistributedDataManager.DataShare.Provider", + "SystemCapability.DistributedDataManager.CloudSync.Config", + "SystemCapability.DistributedDataManager.CloudSync.Client", + "SystemCapability.DistributedDataManager.CloudSync.Server", + "SystemCapability.Ability.AbilityBase", + "SystemCapability.Ability.AbilityRuntime.Core", + "SystemCapability.Ability.AbilityRuntime.FAModel", + "SystemCapability.Ability.AbilityRuntime.AbilityCore", + "SystemCapability.Ability.AbilityRuntime.Mission", + "SystemCapability.Ability.AbilityTools.AbilityAssistant", + "SystemCapability.Ability.Form", + "SystemCapability.Ability.DistributedAbilityManager", + "SystemCapability.Applications.CalendarData", + "SystemCapability.Applications.ContactsData", + "SystemCapability.Applications.Contacts", + "SystemCapability.Applications.Settings.Core", + "SystemCapability.Test.UiTest", + "SystemCapability.Web.Webview.Core", + "SystemCapability.Advertising.OAID", + "SystemCapability.Advertising.Ads", + "SystemCapability.Security.CertificateManager", + "SystemCapability.Security.CryptoFramework", + "SystemCapability.Security.Cert", + "SystemCapability.BundleManager.BundleFramework.Core", + "SystemCapability.BundleManager.BundleFramework.FreeInstall", + "SystemCapability.BundleManager.BundleFramework.Resource", + "SystemCapability.BundleManager.BundleFramework.DefaultApp", + "SystemCapability.BundleManager.BundleFramework.Launcher", + "SystemCapability.BundleManager.BundleFramework.AppControl", + "SystemCapability.Ability.AbilityRuntime.QuickFix", + "SystemCapability.Graphic.Graphic2D.ColorManager.Core", + "SystemCapability.ResourceSchedule.BackgroundTaskManager.EfficiencyResourcesApply", + "SystemCapability.XTS.DeviceAttest", + "SystemCapability.Request.FileTransferAgent", + "SystemCapability.ResourceSchedule.DeviceStandby", + "SystemCapability.DistributedDataManager.UDMF.Core", + "SystemCapability.Multimedia.Media.AVScreenCapture", + "SystemCapability.Multimedia.Media.SoundPool", + "SystemCapability.Multimedia.Audio.Spatialization", + "SystemCapability.Multimedia.AudioHaptic.Core", + "SystemCapability.ArkUi.Graphics3D", + "SystemCapability.Graphics.Drawing", + "SystemCapability.Graphic.Graphic2D.NativeDrawing", + "SystemCapability.Developtools.Syscap", + "SystemCapability.Resourceschedule.Ffrt.Core", + "SystemCapability.Graphic.Graphic2D.NativeWindow", + "SystemCapability.Graphic.Graphic2D.NativeBuffer", + "SystemCapability.Graphic.Graphic2D.NativeImage", + "SystemCapability.Graphic.Graphic2D.NativeVsync", + "SystemCapability.Graphic.Vulkan", + "SystemCapability.Multimedia.Image.ImageCreator", + "SystemCapability.Ability.AppStartup" + ] +} diff --git a/language/arkts/extractor/sdk/hms/ets/api/device-define/tablet-hmos.json b/language/arkts/extractor/sdk/hms/ets/api/device-define/tablet-hmos.json new file mode 100755 index 00000000..a98b814a --- /dev/null +++ b/language/arkts/extractor/sdk/hms/ets/api/device-define/tablet-hmos.json @@ -0,0 +1,85 @@ +{ + "SysCaps": [ + "SystemCapability.AtomicserviceComponent.UIComponent", + "SystemCapability.AtomicserviceComponent.atomicservice", + "SystemCapability.AI.InsightIntent", + "SystemCapability.Global.I18nExt", + "SystemCapability.HiviewDFX.HiView.LogService", + "SystemCapability.HiviewDFX.XPower", + "SystemCapability.HiviewDFX.HiView.ChrLogService", + "SystemCapability.Push.PushService", + "SystemCapability.LiveView.LiveViewService", + "SystemCapability.Payment.IAP", + "SystemCapability.Payment.PaymentService", + "SystemCapability.Customization.EnterpriseDeviceManagerExt", + "SystemCapability.Cloud.HiAnalytics", + "SystemCapability.Collaboration.Camera", + "SystemCapability.AuthenticationServices.HuaweiID.Auth", + "SystemCapability.AuthenticationServices.HuaweiID.ExtendService", + "SystemCapability.AuthenticationServices.HuaweiID.RealNameVerify", + "SystemCapability.AuthenticationServices.HuaweiID.MinorsProtection", + "SystemCapability.Game.GameService.GamePlayer", + "SystemCapability.AI.OCR.TextRecognition", + "SystemCapability.AI.SpeechRecognizer", + "SystemCapability.AI.TextToSpeech", + "SystemCapability.FileManagement.FilePreview.Core", + "SystemCapability.OfficeService.PDFService.Core", + "SystemCapability.Security.DeviceCertificate", + "SystemCapability.Security.DeviceSecurityMode", + "SystemCapability.Security.ActivationLock", + "SystemCapability.DeviceCloudGateway.CloudCapabilityManager", + "SystemCapability.DeviceCloudGateway.ClientCloudCacheService.Grs", + "SystemCapability.DeviceCloudGateway.CloudFoundation", + "SystemCapability.HiviewDFX.InfoSec", + "SystemCapability.FindDevice.FindNetwork", + "SystemCapability.Telephony.TelephonyEnhanced", + "SystemCapability.Communication.NetManager.SmartHotSpot", + "SystemCapability.UtilityApplication.ParentControl.Core", + "SystemCapability.Multimedia.Scan.Core", + "SystemCapability.Multimedia.Scan.ScanBarcode", + "SystemCapability.Multimedia.Scan.GenerateBarcode", + "SystemCapability.UserIAM.FingerprintAuthExt", + "SystemCapability.Security.SecurityPrivacyServer", + "SystemCapability.AuthenticationServices.HuaweiID.UIComponent", + "SystemCapability.HiViewDFX.Maintenance", + "SystemCapability.Collaboration.SystemShare", + "SystemCapability.Security.Ifaa", + "SystemCapability.Security.CodeProtect", + "SystemCapability.Collaboration.ServiceManager", + "SystemCapability.MiscServices.Theme", + "SystemCapability.BundleManager.EcologicalRuleManager.EcologicalRuleDataManager", + "SystemCapability.BundleManager.EcologicalRuleManager.SceneManager", + "SystemCapability.AppGalleryService.AppInfoManager", + "SystemCapability.AppGalleryService.Distribution.UnifiedInstall", + "SystemCapability.AppGalleryService.Distribution.Recommendations", + "SystemCapability.Security.FIDO", + "SystemCapability.AppGalleryService.Distribution.OnDemandInstall", + "SystemCapability.AI.HiAIFoundation", + "SystemCapability.AI.Search", + "SystemCapability.Graphic.ApsManager.Resolution", + "SystemCapability.Collaboration.RemoteCommunication", + "SystemCapability.AI.IntelligentKws.Core", + "SystemCapability.Health.HealthStore", + "SystemCapability.Health.HealthService", + "SystemCapability.AppGalleryService.Distribution.Update", + "SystemCapability.GraphicsGame.RenderAccelerate", + "SystemCapability.AppGalleryService.AttributionManager", + "SystemCapability.AI.Component.CardRecognition", + "SystemCapability.AI.Component.DocScan", + "SystemCapability.AI.Component.LivenessDetect", + "SystemCapability.AI.Face.Detector", + "SystemCapability.AI.Face.Comparator", + "SystemCapability.Collaboration.Service", + "SystemCapability.Multimedia.ImageLoader.Core", + "SystemCapability.AuthenticationServices.HuaweiID.ShippingAddress", + "SystemCapability.HuaweiID.InvoiceAssistant", + "SystemCapability.AI.Component.TextReader", + "SystemCapability.ResourceSchedule.LowpowerManager", + "SystemCapability.Security.SafetyDetect", + "SystemCapability.Stylus.Handwrite", + "SystemCapability.GameService.GamePerformance", + "SystemCapability.AI.Vision.SubjectSegmentation", + "SystemCapability.AI.NaturalLanguage.TextProcessing", + "SystemCapability.Security.PrivateSpace" + ] +} diff --git a/language/arkts/extractor/sdk/hms/ets/kits/@kit.AccountKit.d.ts b/language/arkts/extractor/sdk/hms/ets/kits/@kit.AccountKit.d.ts new file mode 100755 index 00000000..355932ea --- /dev/null +++ b/language/arkts/extractor/sdk/hms/ets/kits/@kit.AccountKit.d.ts @@ -0,0 +1,17 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. All rights reserved. + */ +/** + * @file Defines the capabilities of account kit. + * @kit AccountKit + * @since 4.1.0(11) + */ + +import authentication from '@hms.core.authentication'; +import extendService from '@hms.core.account.extendservice'; +import {LoginPanel, LoginWithHuaweiIDButton, loginComponentManager} from '@hms.core.account.LoginComponent'; +import realName from '@hms.core.account.realname'; +import shippingAddress from '@hms.core.account.shippingAddress'; +import minorsProtection from '@hms.core.account.minorsProtection'; +import invoiceAssistant from '@hms.core.account.invoiceAssistant'; +export {authentication, extendService, LoginPanel, LoginWithHuaweiIDButton, loginComponentManager, realName, shippingAddress, minorsProtection, invoiceAssistant} ; \ No newline at end of file diff --git a/language/arkts/extractor/sdk/hms/ets/kits/@kit.CallKit.d.ts b/language/arkts/extractor/sdk/hms/ets/kits/@kit.CallKit.d.ts new file mode 100755 index 00000000..7ba346ad --- /dev/null +++ b/language/arkts/extractor/sdk/hms/ets/kits/@kit.CallKit.d.ts @@ -0,0 +1,11 @@ +/* + * Copyright (c) Huawei Technologies Co., Ltd. 2023-2023. All rights reserved. + */ +/** + * @file Defines the capabilities of call kit. + * @kit CallKit + * @since 4.1.0(11) + */ + +import voipCall from '@hms.telephony.voipCall'; +export {voipCall} ; \ No newline at end of file diff --git a/language/arkts/extractor/sdk/hms/ets/kits/@kit.CarKit.d.ts b/language/arkts/extractor/sdk/hms/ets/kits/@kit.CarKit.d.ts new file mode 100755 index 00000000..4258d81e --- /dev/null +++ b/language/arkts/extractor/sdk/hms/ets/kits/@kit.CarKit.d.ts @@ -0,0 +1,11 @@ +/* + * Copyright (c) Huawei Technologies Co., Ltd. 2023-2023. All rights reserved. + */ +/** + * @file Defines the capabilities of car kit. + * @kit CarKit + * @since 4.1.0(11) + */ + +import navigationInfoMgr from '@hms.carService.navigationInfoMgr'; +export {navigationInfoMgr} ; \ No newline at end of file diff --git a/language/arkts/extractor/sdk/hms/ets/kits/@kit.CloudFoundationKit.d.ts b/language/arkts/extractor/sdk/hms/ets/kits/@kit.CloudFoundationKit.d.ts new file mode 100755 index 00000000..d6b237e0 --- /dev/null +++ b/language/arkts/extractor/sdk/hms/ets/kits/@kit.CloudFoundationKit.d.ts @@ -0,0 +1,14 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. All rights reserved. + */ +/** + * @file Defines the capabilities of cloud foundation kit. + * @kit CloudFoundationKit + * @since 5.0.0(12) + */ + +import cloudCommon from '@hms.core.deviceCloudGateway.cloudCommon'; +import cloudFunction from '@hms.core.deviceCloudGateway.cloudFunction'; +import cloudStorage from '@hms.core.deviceCloudGateway.cloudStorage'; +import cloudDatabase from '@hms.core.deviceCloudGateway.cloudDatabase'; +export {cloudCommon, cloudFunction, cloudStorage, cloudDatabase} ; \ No newline at end of file diff --git a/language/arkts/extractor/sdk/hms/ets/kits/@kit.CoreSpeechKit.d.ts b/language/arkts/extractor/sdk/hms/ets/kits/@kit.CoreSpeechKit.d.ts new file mode 100755 index 00000000..1ed01801 --- /dev/null +++ b/language/arkts/extractor/sdk/hms/ets/kits/@kit.CoreSpeechKit.d.ts @@ -0,0 +1,12 @@ +/* + * Copyright (c) Huawei Technologies Co., Ltd. 2023-2023. All rights reserved. + */ +/** + * @file Defines the capabilities of core speech kit. + * @kit CoreSpeechKit + * @since 4.1.0(11) + */ + +import speechRecognizer from '@hms.ai.speechRecognizer'; +import textToSpeech from '@hms.ai.textToSpeech'; +export {speechRecognizer, textToSpeech} ; \ No newline at end of file diff --git a/language/arkts/extractor/sdk/hms/ets/kits/@kit.CoreVisionKit.d.ts b/language/arkts/extractor/sdk/hms/ets/kits/@kit.CoreVisionKit.d.ts new file mode 100755 index 00000000..6d6fd190 --- /dev/null +++ b/language/arkts/extractor/sdk/hms/ets/kits/@kit.CoreVisionKit.d.ts @@ -0,0 +1,14 @@ +/* + * Copyright (c) Huawei Technologies Co., Ltd. 2023-2023. All rights reserved. + */ +/** + * @file Defines the capabilities of core vision kit. + * @kit CoreVisionKit + * @since 4.1.0(11) + */ + +import textRecognition from '@hms.ai.ocr.textRecognition'; +import faceDetector from '@hms.ai.face.faceDetector'; +import faceComparator from '@hms.ai.face.faceComparator'; +import subjectSegmentation from '@hms.ai.vision.subjectSegmentation'; +export {textRecognition, faceDetector, faceComparator, subjectSegmentation} ; \ No newline at end of file diff --git a/language/arkts/extractor/sdk/hms/ets/kits/@kit.DeviceSecurityKit.d.ts b/language/arkts/extractor/sdk/hms/ets/kits/@kit.DeviceSecurityKit.d.ts new file mode 100755 index 00000000..4fcce311 --- /dev/null +++ b/language/arkts/extractor/sdk/hms/ets/kits/@kit.DeviceSecurityKit.d.ts @@ -0,0 +1,13 @@ +/* + * Copyright (c) Huawei Technologies Co., Ltd. 2024-2024. All rights reserved. + */ +/** + * @file Defines the capabilities of Device Security Kit. + * @kit DeviceSecurityKit + * @since since 5.0.0(12) + */ + +import safetyDetect from '@hms.security.safetyDetect'; +import deviceCertificate from '@hms.security.deviceCertificate'; +import trustedAppService from '@hms.security.trustedAppService'; +export {safetyDetect, deviceCertificate, trustedAppService} ; \ No newline at end of file diff --git a/language/arkts/extractor/sdk/hms/ets/kits/@kit.EnterpriseDataGuardKit.d.ts b/language/arkts/extractor/sdk/hms/ets/kits/@kit.EnterpriseDataGuardKit.d.ts new file mode 100755 index 00000000..45f854af --- /dev/null +++ b/language/arkts/extractor/sdk/hms/ets/kits/@kit.EnterpriseDataGuardKit.d.ts @@ -0,0 +1,11 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. All rights reserved. + */ +/** + * @file This module providers the capability to mark and control documents. + * @kit EnterpriseDataGuardKit + * @since 4.1.0(11) + */ + +import fileGuard from '@hms.pcService.fileGuard'; +export {fileGuard} ; \ No newline at end of file diff --git a/language/arkts/extractor/sdk/hms/ets/kits/@kit.GameServiceKit.d.ts b/language/arkts/extractor/sdk/hms/ets/kits/@kit.GameServiceKit.d.ts new file mode 100755 index 00000000..59d27aed --- /dev/null +++ b/language/arkts/extractor/sdk/hms/ets/kits/@kit.GameServiceKit.d.ts @@ -0,0 +1,12 @@ +/* + * Copyright (c) Huawei Technologies Co., Ltd. 2023-2023. All rights reserved. + */ +/** + * @file Defines the capabilities of GameServiceKit. + * @kit GameServiceKit + * @since 4.1.0(11) + */ + +import gamePlayer from '@hms.core.gameservice.gameplayer'; +import gamePerformance from '@hms.core.gameservice.gameperformance'; +export {gamePlayer, gamePerformance} ; \ No newline at end of file diff --git a/language/arkts/extractor/sdk/hms/ets/kits/@kit.HealthServiceKit.d.ts b/language/arkts/extractor/sdk/hms/ets/kits/@kit.HealthServiceKit.d.ts new file mode 100755 index 00000000..581348d0 --- /dev/null +++ b/language/arkts/extractor/sdk/hms/ets/kits/@kit.HealthServiceKit.d.ts @@ -0,0 +1,12 @@ +/* + * Copyright (c) Huawei Technologies Co., Ltd. 2023-2023. All rights reserved. + */ +/** + * @file Defines the capabilities of HealthServiceKit. + * @kit HealthServiceKit + * @since 5.0.0(12) + */ + +import healthStore from '@hms.health.store'; +import healthService from '@hms.health.service'; +export {healthStore, healthService} ; \ No newline at end of file diff --git a/language/arkts/extractor/sdk/hms/ets/kits/@kit.IAPKit.d.ts b/language/arkts/extractor/sdk/hms/ets/kits/@kit.IAPKit.d.ts new file mode 100755 index 00000000..d58852e5 --- /dev/null +++ b/language/arkts/extractor/sdk/hms/ets/kits/@kit.IAPKit.d.ts @@ -0,0 +1,11 @@ +/* + * Copyright (c) Huawei Technologies Co., Ltd. 2023-2023. All rights reserved. + */ +/** + * @file Defines the capabilities of iap(in-App purchase) kit. + * @kit IAPKit + * @since 4.1.0(11) + */ + +import iap from '@hms.core.iap'; +export {iap} ; \ No newline at end of file diff --git a/language/arkts/extractor/sdk/hms/ets/kits/@kit.IntentsKit.d.ts b/language/arkts/extractor/sdk/hms/ets/kits/@kit.IntentsKit.d.ts new file mode 100755 index 00000000..76222173 --- /dev/null +++ b/language/arkts/extractor/sdk/hms/ets/kits/@kit.IntentsKit.d.ts @@ -0,0 +1,11 @@ +/* + * Copyright (c) Huawei Technologies Co., Ltd. 2023-2023. All rights reserved. + */ +/** + * @file Defines the capabilities of intents kit. + * @kit IntentsKit + * @since 4.1.0(11) + */ + +import insightIntent from '@hms.ai.insightIntent'; +export {insightIntent} ; \ No newline at end of file diff --git a/language/arkts/extractor/sdk/hms/ets/kits/@kit.LiveViewKit.d.ts b/language/arkts/extractor/sdk/hms/ets/kits/@kit.LiveViewKit.d.ts new file mode 100755 index 00000000..2094da91 --- /dev/null +++ b/language/arkts/extractor/sdk/hms/ets/kits/@kit.LiveViewKit.d.ts @@ -0,0 +1,14 @@ +/* + * Copyright (c) Huawei Technologies Co., Ltd. 2023. All rights reserved. + */ +/** + * provider from LiveView Kit APIs + * @file Defines the ability of LiveViewKit + * @kit LiveViewKit + * @since 4.1.0(11) + */ + +import liveViewManager from '@hms.core.liveview.liveViewManager'; +import LiveViewLockScreenExtensionAbility from '@hms.core.liveview.LiveViewLockScreenExtensionAbility'; +import LiveViewLockScreenExtensionContext from '@hms.core.liveview.LiveViewLockScreenExtensionContext'; +export {liveViewManager, LiveViewLockScreenExtensionAbility, LiveViewLockScreenExtensionContext} ; \ No newline at end of file diff --git a/language/arkts/extractor/sdk/hms/ets/kits/@kit.MapKit.d.ts b/language/arkts/extractor/sdk/hms/ets/kits/@kit.MapKit.d.ts new file mode 100755 index 00000000..c6d60172 --- /dev/null +++ b/language/arkts/extractor/sdk/hms/ets/kits/@kit.MapKit.d.ts @@ -0,0 +1,17 @@ +/* + * Copyright (c) Huawei Technologies Co., Ltd. 2023-2023. All rights reserved. + */ +/** + * @file Defines the capabilities of map kit. + * @kit MapKit + * @since 4.1.0(11) + */ + +import mapCommon from '@hms.core.map.mapCommon'; +import map from '@hms.core.map.map'; +import {MapComponent} from '@hms.core.map.MapComponent'; +import staticMap from '@hms.core.map.staticMap'; +import site from '@hms.core.map.site'; +import navi from '@hms.core.map.navi'; +import sceneMap from '@hms.core.map.sceneMap'; +export {mapCommon, map, MapComponent, staticMap, site, navi, sceneMap} ; \ No newline at end of file diff --git a/language/arkts/extractor/sdk/hms/ets/kits/@kit.NaturalLanguageKit.d.ts b/language/arkts/extractor/sdk/hms/ets/kits/@kit.NaturalLanguageKit.d.ts new file mode 100755 index 00000000..93b3db69 --- /dev/null +++ b/language/arkts/extractor/sdk/hms/ets/kits/@kit.NaturalLanguageKit.d.ts @@ -0,0 +1,12 @@ +/* + * Copyright (c) Huawei Technologies Co., Ltd. 2024. All rights reserved. + */ +/** + * @file Defines the capabilities of NaturalLanguage kit. + * @kit NaturalLanguageKit + * @since 5.0.0(12) + */ + +import {EntityType} from '@hms.ai.nlp.textProcessing'; +import textProcessing from '@hms.ai.nlp.textProcessing'; +export {EntityType, textProcessing} ; \ No newline at end of file diff --git a/language/arkts/extractor/sdk/hms/ets/kits/@kit.OnlineAuthenticationKit.d.ts b/language/arkts/extractor/sdk/hms/ets/kits/@kit.OnlineAuthenticationKit.d.ts new file mode 100755 index 00000000..aa1618fd --- /dev/null +++ b/language/arkts/extractor/sdk/hms/ets/kits/@kit.OnlineAuthenticationKit.d.ts @@ -0,0 +1,12 @@ +/* + * Copyright (c) Huawei Technologies Co., Ltd. 2023-2023. All rights reserved. + */ +/** + * @file Defines the capabilities of online authentication kit. + * @kit OnlineAuthenticationKit + * @since 4.1.0(11) + */ + +import fido from '@hms.security.fido'; +import ifaa from '@hms.security.ifaa'; +export {fido, ifaa} ; \ No newline at end of file diff --git a/language/arkts/extractor/sdk/hms/ets/kits/@kit.PDFKit.d.ts b/language/arkts/extractor/sdk/hms/ets/kits/@kit.PDFKit.d.ts new file mode 100755 index 00000000..42d1e8d7 --- /dev/null +++ b/language/arkts/extractor/sdk/hms/ets/kits/@kit.PDFKit.d.ts @@ -0,0 +1,11 @@ +/* + * Copyright (c) Huawei Technologies Co., Ltd. 2023-2023. All rights reserved. + */ +/** + * @file Defines the capabilities of PDF kit. + * @kit PDFKit + * @since 5.0.0(12) + */ + +import pdfService from '@hms.officeservice.pdfservice'; +export {pdfService} ; \ No newline at end of file diff --git a/language/arkts/extractor/sdk/hms/ets/kits/@kit.PaymentKit.d.ts b/language/arkts/extractor/sdk/hms/ets/kits/@kit.PaymentKit.d.ts new file mode 100755 index 00000000..8e2f1383 --- /dev/null +++ b/language/arkts/extractor/sdk/hms/ets/kits/@kit.PaymentKit.d.ts @@ -0,0 +1,11 @@ +/* + * Copyright (c) Huawei Technologies Co., Ltd. 2023-2023. All rights reserved. + */ +/** + * @file Defines the capabilities of payment kit. + * @kit PaymentKit + * @since 4.1.0(11) + */ + +import paymentService from '@hms.core.payment.paymentService'; +export {paymentService} ; \ No newline at end of file diff --git a/language/arkts/extractor/sdk/hms/ets/kits/@kit.Penkit.d.ts b/language/arkts/extractor/sdk/hms/ets/kits/@kit.Penkit.d.ts new file mode 100755 index 00000000..58b9a554 --- /dev/null +++ b/language/arkts/extractor/sdk/hms/ets/kits/@kit.Penkit.d.ts @@ -0,0 +1,14 @@ +/* + * Copyright (c) Huawei Technologies Co., Ltd. 2024-2024. All rights reserved. + */ +/** + * provider from Pen Kit APIs + * @file Defines the capabilities of Pen kit. + * @kit Penkit + * @since 5.0.0(12) + */ + +import {HandwriteController, HandwriteComponent} from '@hms.stylus.HandwriteComponent'; +import {InstantShapeGenerator, ShapeInfo} from '@hms.stylus.handwrite'; +import {PointPredictor} from '@hms.stylus.handwrite'; +export {HandwriteController, HandwriteComponent, InstantShapeGenerator, ShapeInfo, PointPredictor} ; \ No newline at end of file diff --git a/language/arkts/extractor/sdk/hms/ets/kits/@kit.PreviewKit.d.ts b/language/arkts/extractor/sdk/hms/ets/kits/@kit.PreviewKit.d.ts new file mode 100755 index 00000000..e7bd8345 --- /dev/null +++ b/language/arkts/extractor/sdk/hms/ets/kits/@kit.PreviewKit.d.ts @@ -0,0 +1,11 @@ +/* + * Copyright (c) Huawei Technologies Co., Ltd. 2023-2023. All rights reserved. + */ +/** + * @file Defines the capabilities of Preview kit. + * @kit PreviewKit + * @since 4.1.0(11) + */ + +import filePreview from '@hms.filemanagement.filepreview'; +export {filePreview} ; \ No newline at end of file diff --git a/language/arkts/extractor/sdk/hms/ets/kits/@kit.PushKit.d.ts b/language/arkts/extractor/sdk/hms/ets/kits/@kit.PushKit.d.ts new file mode 100755 index 00000000..ea04525a --- /dev/null +++ b/language/arkts/extractor/sdk/hms/ets/kits/@kit.PushKit.d.ts @@ -0,0 +1,23 @@ +/* + * Copyright (c) Huawei Technologies Co., Ltd. 2023. All rights reserved. + */ +/** + * provider from Push Kit APIs + * @file Defines the ability of PushKit. + * @kit PushKit + * @since 4.1.0(11) + */ + +import AAID from '@hms.core.AAID'; +import pushCommon from '@hms.core.push.pushCommon'; +import PushExtensionAbility from '@hms.core.push.PushExtensionAbility'; +import PushExtensionContext from '@hms.core.push.PushExtensionContext'; +import pushService from '@hms.core.push.pushService'; +import RemoteLocationExtensionAbility from '@hms.core.push.RemoteLocationExtensionAbility'; +import RemoteLocationExtensionContext from '@hms.core.push.RemoteLocationExtensionContext'; +import RemoteNotificationExtensionAbility from '@hms.core.push.RemoteNotificationExtensionAbility'; +import RemoteNotificationExtensionContext from '@hms.core.push.RemoteNotificationExtensionContext'; +import serviceNotification from '@hms.core.push.serviceNotification'; +import VoIPExtensionAbility from '@hms.core.push.VoIPExtensionAbility'; +import VoIPExtensionContext from '@hms.core.push.VoIPExtensionContext'; +export {AAID, pushCommon, PushExtensionAbility, PushExtensionContext, pushService, RemoteLocationExtensionAbility, RemoteLocationExtensionContext, RemoteNotificationExtensionAbility, RemoteNotificationExtensionContext, serviceNotification, VoIPExtensionAbility, VoIPExtensionContext} ; \ No newline at end of file diff --git a/language/arkts/extractor/sdk/hms/ets/kits/@kit.RemoteCommunicationKit.d.ts b/language/arkts/extractor/sdk/hms/ets/kits/@kit.RemoteCommunicationKit.d.ts new file mode 100755 index 00000000..0f406ca6 --- /dev/null +++ b/language/arkts/extractor/sdk/hms/ets/kits/@kit.RemoteCommunicationKit.d.ts @@ -0,0 +1,11 @@ +/* + * Copyright (c) Huawei Technologies Co., Ltd. 2023. All rights reserved. + */ +/** + * @file Defines the capabilities of remote communication platform. + * @kit RemoteCommunicationKit + * @since 4.1.0(11) + */ + +import rcp from '@hms.collaboration.rcp'; +export {rcp} ; \ No newline at end of file diff --git a/language/arkts/extractor/sdk/hms/ets/kits/@kit.ScanKit.d.ts b/language/arkts/extractor/sdk/hms/ets/kits/@kit.ScanKit.d.ts new file mode 100755 index 00000000..b65e4576 --- /dev/null +++ b/language/arkts/extractor/sdk/hms/ets/kits/@kit.ScanKit.d.ts @@ -0,0 +1,16 @@ +/* + * Copyright (c) Huawei Technologies Co., Ltd. 2023-2023. All rights reserved. + */ +/** + * provider form APIs + * @file + * @kit ScanKit + * @since 4.1.0(11) + */ + +import scanCore from '@hms.core.scan.scanCore'; +import scanBarcode from '@hms.core.scan.scanBarcode'; +import customScan from '@hms.core.scan.customScan'; +import detectBarcode from '@hms.core.scan.detectBarcode'; +import generateBarcode from '@hms.core.scan.generateBarcode'; +export {scanCore, scanBarcode, customScan, detectBarcode, generateBarcode} ; \ No newline at end of file diff --git a/language/arkts/extractor/sdk/hms/ets/kits/@kit.ScenarioFusionKit.d.ts b/language/arkts/extractor/sdk/hms/ets/kits/@kit.ScenarioFusionKit.d.ts new file mode 100755 index 00000000..547af137 --- /dev/null +++ b/language/arkts/extractor/sdk/hms/ets/kits/@kit.ScenarioFusionKit.d.ts @@ -0,0 +1,12 @@ +/* + * Copyright (c) Huawei Technologies Co., Ltd. 2023-2024. All rights reserved. + */ +/** + * @file Defines the capabilities of scenario fusion Kit. + * @kit ScenarioFusionKit + * @since 4.1.0(11) + */ + +import {FunctionalButton, functionalButtonComponentManager} from '@hms.core.atomicserviceComponent.atomicserviceUi'; +import atomicService from '@hms.core.atomicserviceComponent.atomicservice'; +export {FunctionalButton, functionalButtonComponentManager, atomicService} ; \ No newline at end of file diff --git a/language/arkts/extractor/sdk/hms/ets/kits/@kit.ServiceCollaborationKit.d.ts b/language/arkts/extractor/sdk/hms/ets/kits/@kit.ServiceCollaborationKit.d.ts new file mode 100755 index 00000000..68a51941 --- /dev/null +++ b/language/arkts/extractor/sdk/hms/ets/kits/@kit.ServiceCollaborationKit.d.ts @@ -0,0 +1,14 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. All rights reserved. + */ +/** + * @file Defines the capabilities of collaboration kit. + * @kit ServiceCollaborationKit + * @since 4.1.0(11) + */ + +import {CollaborationCameraBusinessFilter, createCollaborationCameraMenuItems, CollaborationCameraStateDialog} from '@hms.collaboration.camera'; +import {CollaborationServiceFilter, createCollaborationServiceMenuItems, CollaborationServiceStateDialog} from '@hms.collaboration.service'; +import {CollaborationDevicePicker} from '@hms.collaboration.CollaborationDevicePicker'; +import devicePicker from '@hms.collaboration.devicePicker'; +export {CollaborationCameraBusinessFilter, createCollaborationCameraMenuItems, CollaborationCameraStateDialog, CollaborationServiceFilter, createCollaborationServiceMenuItems, CollaborationServiceStateDialog, CollaborationDevicePicker, devicePicker} ; \ No newline at end of file diff --git a/language/arkts/extractor/sdk/hms/ets/kits/@kit.ShareKit.d.ts b/language/arkts/extractor/sdk/hms/ets/kits/@kit.ShareKit.d.ts new file mode 100755 index 00000000..7bd60ec0 --- /dev/null +++ b/language/arkts/extractor/sdk/hms/ets/kits/@kit.ShareKit.d.ts @@ -0,0 +1,11 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. All rights reserved. + */ +/** + * @file Defines the capabilities of share kit. + * @kit ShareKit + * @since 4.1.0(11) + */ + +import systemShare from '@hms.collaboration.systemShare'; +export {systemShare} ; \ No newline at end of file diff --git a/language/arkts/extractor/sdk/hms/ets/kits/@kit.SpeechKit.d.ts b/language/arkts/extractor/sdk/hms/ets/kits/@kit.SpeechKit.d.ts new file mode 100755 index 00000000..90709ed8 --- /dev/null +++ b/language/arkts/extractor/sdk/hms/ets/kits/@kit.SpeechKit.d.ts @@ -0,0 +1,11 @@ +/* + * Copyright (c) Huawei Technologies Co., Ltd. 2024. All rights reserved. + */ +/** + * @file Defines the capabilities of speech kit. + * @kit SpeechKit + * @since 5.0.0(12) + */ + +import TextReader, {WindowManager, TextReaderIcon, ReadStateCode} from '@hms.ai.textReader'; +export {TextReader, WindowManager, TextReaderIcon, ReadStateCode} ; \ No newline at end of file diff --git a/language/arkts/extractor/sdk/hms/ets/kits/@kit.StatusBarExtensionKit.d.ts b/language/arkts/extractor/sdk/hms/ets/kits/@kit.StatusBarExtensionKit.d.ts new file mode 100755 index 00000000..8881a7fe --- /dev/null +++ b/language/arkts/extractor/sdk/hms/ets/kits/@kit.StatusBarExtensionKit.d.ts @@ -0,0 +1,12 @@ +/* + * Copyright (c) Huawei Technologies Co., Ltd. 2024. All rights reserved. + */ +/** + * @file Defines the capabilities of status bar extension kit. + * @kit StatusBarExtensionKit + * @since 5.0.0(12) + */ + +import statusBarManager from '@hms.pcService.statusBarManager'; +import StatusBarViewExtensionAbility from '@hms.pcService.StatusBarViewExtensionAbility'; +export {statusBarManager, StatusBarViewExtensionAbility} ; \ No newline at end of file diff --git a/language/arkts/extractor/sdk/hms/ets/kits/@kit.StoreKit.d.ts b/language/arkts/extractor/sdk/hms/ets/kits/@kit.StoreKit.d.ts new file mode 100755 index 00000000..d9c2a1d0 --- /dev/null +++ b/language/arkts/extractor/sdk/hms/ets/kits/@kit.StoreKit.d.ts @@ -0,0 +1,17 @@ +/* + * Copyright (c) Huawei Technologies Co., Ltd. 2023-2023. All rights reserved. + */ +/** + * provider Store Kit APIs + * @file + * @kit StoreKit + * @since 4.1.0(11) + */ + +import productViewManager from '@hms.core.appgalleryservice.productViewManager'; +import moduleInstallManager from '@hms.core.appgalleryservice.moduleInstallManager'; +import updateManager from '@hms.core.appgalleryservice.updateManager'; +import attributionManager from '@hms.core.appgalleryservice.attributionManager'; +import attributionTestManager from '@hms.core.appgalleryservice.attributionTestManager'; +import sceneManager from '@hms.bundle.sceneManager'; +export {productViewManager, moduleInstallManager, updateManager, attributionManager, attributionTestManager, sceneManager} ; \ No newline at end of file diff --git a/language/arkts/extractor/sdk/hms/ets/kits/@kit.VisionKit.d.ts b/language/arkts/extractor/sdk/hms/ets/kits/@kit.VisionKit.d.ts new file mode 100755 index 00000000..8ec528b5 --- /dev/null +++ b/language/arkts/extractor/sdk/hms/ets/kits/@kit.VisionKit.d.ts @@ -0,0 +1,13 @@ +/* + * Copyright (c) Huawei Technologies Co., Ltd. 2024. All rights reserved. + */ +/** + * @file Defines the capabilities of vision kit. + * @kit VisionKit + * @since 5.0.0(12) + */ + +import interactiveLiveness from '@hms.ai.interactiveLiveness'; +import {CardRecognition, CallbackParam, CardType, CardSide} from '@hms.ai.CardRecognition'; +import {DocumentScanner, DocumentScannerConfig, DocType, FilterId, ShootingMode, EditTab, SaveOption} from '@hms.ai.DocumentScanner'; +export {interactiveLiveness, CardRecognition, CallbackParam, CardType, CardSide, DocumentScanner, DocumentScannerConfig, DocType, FilterId, ShootingMode, EditTab, SaveOption} ; \ No newline at end of file diff --git a/language/arkts/extractor/sdk/hms/ets/kits/@kit.WalletKit.d.ts b/language/arkts/extractor/sdk/hms/ets/kits/@kit.WalletKit.d.ts new file mode 100755 index 00000000..af0b4f67 --- /dev/null +++ b/language/arkts/extractor/sdk/hms/ets/kits/@kit.WalletKit.d.ts @@ -0,0 +1,12 @@ +/* + * Copyright (c) Huawei Technologies Co., Ltd. 2023-2023. All rights reserved. + */ +/** + * @file Defines the capabilities of wallet kit. + * @kit WalletKit + * @since 5.0.0(12) + */ + +import walletPass from '@hms.core.payment.walletPass'; +import walletTransitCard from '@hms.core.payment.walletTransitCard'; +export {walletPass, walletTransitCard} ; \ No newline at end of file diff --git a/language/arkts/extractor/sdk/hms/ets/sdkConfig.json b/language/arkts/extractor/sdk/hms/ets/sdkConfig.json new file mode 100755 index 00000000..95a4225d --- /dev/null +++ b/language/arkts/extractor/sdk/hms/ets/sdkConfig.json @@ -0,0 +1,4 @@ +{ + "apiPath": ["./api", "./kits"], + "prefix": "@hms" + } \ No newline at end of file diff --git a/language/arkts/extractor/sdk/hms/ets/sysResource.js b/language/arkts/extractor/sdk/hms/ets/sysResource.js new file mode 100755 index 00000000..04775d17 --- /dev/null +++ b/language/arkts/extractor/sdk/hms/ets/sysResource.js @@ -0,0 +1,10 @@ +module.exports.sys = { + string: { + ohos_app_name: 130023424, + copy: 130023426 + }, + media: { + ohos_app_icon: 130023425, + ai_recognize: 130023427 + } +} diff --git a/language/arkts/extractor/sdk/hms/ets/uni-package.json b/language/arkts/extractor/sdk/hms/ets/uni-package.json new file mode 100755 index 00000000..8c2aea25 --- /dev/null +++ b/language/arkts/extractor/sdk/hms/ets/uni-package.json @@ -0,0 +1,11 @@ +{ + "apiVersion": "12", + "displayName": "Ets", + "meta": { + "metaVersion": "3.1.0" + }, + "path": "ets", + "platformVersion": "5.0.0", + "releaseType": "Canary4", + "version": "5.0.0.25" +} \ No newline at end of file diff --git a/language/arkts/extractor/sdk/openharmony/ets/NOTICE.txt b/language/arkts/extractor/sdk/openharmony/ets/NOTICE.txt new file mode 100755 index 00000000..bdf55c16 --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/NOTICE.txt @@ -0,0 +1,8646 @@ +Notices for files contained in SDK in this directory: +============================================================ +Notices for file(s): +/ets/api +/ets/api/@internal/full +/ets/api/@internal/full/canvaspattern.d.ts +/ets/api/@internal/full/featureability.d.ts +/ets/api/@internal/full/global.d.ts +/ets/api/@internal/full/index.d.ts +/ets/api/@internal/full/lifecycle.d.ts +/ets/api/@system.app.d.ts +/ets/api/@system.configuration.d.ts +/ets/api/@system.file.d.ts +/ets/api/@system.mediaquery.d.ts +/ets/api/@system.prompt.d.ts +/ets/api/@system.router.d.ts +/ets/api/device-define-common +/ets/api/device-define-common/device-define-common +/ets/component/action_sheet.d.ts +/ets/component/alert_dialog.d.ts +/ets/component/alphabet_indexer.d.ts +/ets/component/badge.d.ts +/ets/component/blank.d.ts +/ets/component/button.d.ts +/ets/component/calendar_picker.d.ts +/ets/component/canvas.d.ts +/ets/component/checkbox.d.ts +/ets/component/checkboxgroup.d.ts +/ets/component/circle.d.ts +/ets/component/column.d.ts +/ets/component/column_split.d.ts +/ets/component/common.d.ts +/ets/component/common_ts_ets_api.d.ts +/ets/component/component3d.d.ts +/ets/component/container_span.d.ts +/ets/component/content_slot.d.ts +/ets/component/context_menu.d.ts +/ets/component/counter.d.ts +/ets/component/custom_dialog_controller.d.ts +/ets/component/data_panel.d.ts +/ets/component/date_picker.d.ts +/ets/component/divider.d.ts +/ets/component/ellipse.d.ts +/ets/component/embedded_component.d.ts +/ets/component/enums.d.ts +/ets/component/flex.d.ts +/ets/component/flow_item.d.ts +/ets/component/focus.d.ts +/ets/component/folder_stack.d.ts +/ets/component/for_each.d.ts +/ets/component/form_link.d.ts +/ets/component/gauge.d.ts +/ets/component/gesture.d.ts +/ets/component/grid.d.ts +/ets/component/gridItem.d.ts +/ets/component/grid_col.d.ts +/ets/component/grid_container.d.ts +/ets/component/grid_row.d.ts +/ets/component/hyperlink.d.ts +/ets/component/image.d.ts +/ets/component/image_animator.d.ts +/ets/component/image_span.d.ts +/ets/component/index-full.d.ts +/ets/component/lazy_for_each.d.ts +/ets/component/line.d.ts +/ets/component/list.d.ts +/ets/component/list_item.d.ts +/ets/component/list_item_group.d.ts +/ets/component/loading_progress.d.ts +/ets/component/location_button.d.ts +/ets/component/marquee.d.ts +/ets/component/matrix2d.d.ts +/ets/component/menu.d.ts +/ets/component/menu_item.d.ts +/ets/component/menu_item_group.d.ts +/ets/component/nav_destination.d.ts +/ets/component/nav_router.d.ts +/ets/component/navigation.d.ts +/ets/component/navigator.d.ts +/ets/component/node_container.d.ts +/ets/component/page_transition.d.ts +/ets/component/panel.d.ts +/ets/component/particle.d.ts +/ets/component/paste_button.d.ts +/ets/component/path.d.ts +/ets/component/pattern_lock.d.ts +/ets/component/polygon.d.ts +/ets/component/polyline.d.ts +/ets/component/progress.d.ts +/ets/component/qrcode.d.ts +/ets/component/radio.d.ts +/ets/component/rating.d.ts +/ets/component/rect.d.ts +/ets/component/refresh.d.ts +/ets/component/relative_container.d.ts +/ets/component/repeat.d.ts +/ets/component/rich_editor.d.ts +/ets/component/rich_text.d.ts +/ets/component/row.d.ts +/ets/component/row_split.d.ts +/ets/component/save_button.d.ts +/ets/component/scroll.d.ts +/ets/component/scroll_bar.d.ts +/ets/component/search.d.ts +/ets/component/security_component.d.ts +/ets/component/select.d.ts +/ets/component/shape.d.ts +/ets/component/sidebar.d.ts +/ets/component/slider.d.ts +/ets/component/span.d.ts +/ets/component/stack.d.ts +/ets/component/state_management.d.ts +/ets/component/stepper.d.ts +/ets/component/stepper_item.d.ts +/ets/component/styled_string.d.ts +/ets/component/swiper.d.ts +/ets/component/symbol_span.d.ts +/ets/component/symbolglyph.d.ts +/ets/component/tab_content.d.ts +/ets/component/tabs.d.ts +/ets/component/text.d.ts +/ets/component/text_area.d.ts +/ets/component/text_clock.d.ts +/ets/component/text_common.d.ts +/ets/component/text_input.d.ts +/ets/component/text_picker.d.ts +/ets/component/text_timer.d.ts +/ets/component/time_picker.d.ts +/ets/component/toggle.d.ts +/ets/component/units.d.ts +/ets/component/video.d.ts +/ets/component/water_flow.d.ts +/ets/component/web.d.ts +/ets/component/with_theme.d.ts +/ets/component/xcomponent.d.ts +/ets/kits +/ets/kits/kits +/js/api/@internal/full +/js/api/@internal/full/canvaspattern.d.ts +/js/api/@internal/full/console.d.ts +/js/api/@internal/full/dom.d.ts +/js/api/@internal/full/featureability.d.ts +/js/api/@internal/full/global.d.ts +/js/api/@internal/full/index.d.ts +/js/api/@internal/full/viewmodel.d.ts +/js/api/@internal/lite +/js/api/@internal/lite/console.d.ts +/js/api/@internal/lite/global.d.ts +/js/api/@internal/lite/index.d.ts +/js/api/@internal/lite/viewmodel.d.ts +/js/api/config +/js/api/config/css +/js/api/config/hml +/js/build-tools/binary-tools/fastjson-1.2.83.jar +/js/build-tools/binary-tools/haptobin_tool.jar +/js/form +/js/form/action +/js/form/css +/js/form/hml +/previewer/common +/previewer/common/bin/fontconfig.json +/previewer/common/bin/icudt72l.dat +/previewer/common/bin/lib2d_graphics.dylib +/previewer/common/bin/lib2d_graphics_new.dylib +/previewer/common/bin/libability_simulator.dylib +/previewer/common/bin/libace_compatible.dylib +/previewer/common/bin/libace_forward_compatibility.dylib +/previewer/common/bin/libace_napi.dylib +/previewer/common/bin/libace_uicontent.dylib +/previewer/common/bin/libark_debugger.dylib +/previewer/common/bin/libark_ecma_debugger.dylib +/previewer/common/bin/libark_jsruntime.dylib +/previewer/common/bin/libcjson.dylib +/previewer/common/bin/libconsole.dylib +/previewer/common/bin/libcrypto_openssl.dylib +/previewer/common/bin/libcrypto_restool.dylib +/previewer/common/bin/libcurl_shared.dylib +/previewer/common/bin/libdistributeddata_inner_mock.dylib +/previewer/common/bin/libdistributeddb_mock.dylib +/previewer/common/bin/libdrawable_descriptor.dylib +/previewer/common/bin/libdrawing_napi_impl.dylib +/previewer/common/bin/libfilemgmt_libhilog.dylib +/previewer/common/bin/libfilemgmt_libn.dylib +/previewer/common/bin/libglfw.dylib +/previewer/common/bin/libglfw_render_context.dylib +/previewer/common/bin/libglobal_resmgr_mac.dylib +/previewer/common/bin/libgraphics_effect.dylib +/previewer/common/bin/libhilog.dylib +/previewer/common/bin/libhilog_mac.dylib +/previewer/common/bin/libhmicui18n.dylib +/previewer/common/bin/libhmicuuc.dylib +/previewer/common/bin/libjsoncpp.dylib +/previewer/common/bin/libnative_preferences.dylib +/previewer/common/bin/libnative_rdb.dylib +/previewer/common/bin/libnghttp2_shared.dylib +/previewer/common/bin/libpreviewer_window.dylib +/previewer/common/bin/libpreviewer_window_napi.dylib +/previewer/common/bin/librender_service_base.dylib +/previewer/common/bin/librender_service_client.dylib +/previewer/common/bin/librosen_text.dylib +/previewer/common/bin/libsec_shared.dylib +/previewer/common/bin/libshared_libz.dylib +/previewer/common/bin/libskia_canvaskit.dylib +/previewer/common/bin/libsqlite_sdk.dylib +/previewer/common/bin/libssl_openssl.dylib +/previewer/common/bin/libstring_utils.dylib +/previewer/common/bin/libtexgine.dylib +/previewer/common/bin/libtimer.dylib +/previewer/common/bin/libuv.dylib +/previewer/common/bin/module/arkui +/previewer/common/bin/module/arkui/modifier.abc +/previewer/common/bin/module/arkui/node.abc +/previewer/common/bin/module/arkui/theme.abc +/previewer/common/bin/module/arkui/uicontext.abc +/previewer/common/resources +/previewer/liteWearable/config +/previewer/liteWearable/config/SourceHanSansSC-Regular.otf +/previewer/liteWearable/config/line_cj.brk +/toolchains/configcheck/configSchema_lite.json +/toolchains/configcheck/configSchema_rich.json +/toolchains/hdc +/toolchains/id_defined.json +/toolchains/lib/2d_graphics_source_mac.a +/toolchains/lib/ace_base_i18n_mac.a +/toolchains/lib/ace_base_mac.a +/toolchains/lib/ace_core_components_ability_mac.a +/toolchains/lib/ace_core_components_align_mac.a +/toolchains/lib/ace_core_components_animation_ng_mac.a +/toolchains/lib/ace_core_components_arc_mac.a +/toolchains/lib/ace_core_components_badge_mac.a +/toolchains/lib/ace_core_components_base_ng_mac.a +/toolchains/lib/ace_core_components_box_mac.a +/toolchains/lib/ace_core_components_bubble_mac.a +/toolchains/lib/ace_core_components_button_mac.a +/toolchains/lib/ace_core_components_calendar_mac.a +/toolchains/lib/ace_core_components_camera_mac.a +/toolchains/lib/ace_core_components_chart_mac.a +/toolchains/lib/ace_core_components_checkable_mac.a +/toolchains/lib/ace_core_components_clip_mac.a +/toolchains/lib/ace_core_components_clock_mac.a +/toolchains/lib/ace_core_components_common_mac.a +/toolchains/lib/ace_core_components_common_v2_mac.a +/toolchains/lib/ace_core_components_container_modal_mac.a +/toolchains/lib/ace_core_components_counter_mac.a +/toolchains/lib/ace_core_components_coverage_mac.a +/toolchains/lib/ace_core_components_custom_dialog_mac.a +/toolchains/lib/ace_core_components_custom_paint_mac.a +/toolchains/lib/ace_core_components_data_panel_mac.a +/toolchains/lib/ace_core_components_dialog_mac.a +/toolchains/lib/ace_core_components_dialog_modal_mac.a +/toolchains/lib/ace_core_components_dialog_tween_mac.a +/toolchains/lib/ace_core_components_display_mac.a +/toolchains/lib/ace_core_components_divider_mac.a +/toolchains/lib/ace_core_components_drag_bar_mac.a +/toolchains/lib/ace_core_components_drop_filter_mac.a +/toolchains/lib/ace_core_components_event_ng_mac.a +/toolchains/lib/ace_core_components_flex_mac.a +/toolchains/lib/ace_core_components_focus_animation_mac.a +/toolchains/lib/ace_core_components_focus_collaboration_mac.a +/toolchains/lib/ace_core_components_focusable_mac.a +/toolchains/lib/ace_core_components_font_mac.a +/toolchains/lib/ace_core_components_foreach_mac.a +/toolchains/lib/ace_core_components_foreach_part_upd_mac.a +/toolchains/lib/ace_core_components_foreach_v2_mac.a +/toolchains/lib/ace_core_components_gesture_listener_mac.a +/toolchains/lib/ace_core_components_gestures_ng_mac.a +/toolchains/lib/ace_core_components_grid_layout_mac.a +/toolchains/lib/ace_core_components_grid_layout_v2_mac.a +/toolchains/lib/ace_core_components_grid_mac.a +/toolchains/lib/ace_core_components_grid_v2_mac.a +/toolchains/lib/ace_core_components_hyperlink_mac.a +/toolchains/lib/ace_core_components_ifelse_mac.a +/toolchains/lib/ace_core_components_image_mac.a +/toolchains/lib/ace_core_components_image_provider_ng_mac.a +/toolchains/lib/ace_core_components_indexer_mac.a +/toolchains/lib/ace_core_components_indexer_v2_mac.a +/toolchains/lib/ace_core_components_inspector_v2_mac.a +/toolchains/lib/ace_core_components_layout_ng_mac.a +/toolchains/lib/ace_core_components_list_mac.a +/toolchains/lib/ace_core_components_list_v2_mac.a +/toolchains/lib/ace_core_components_manager_ng_mac.a +/toolchains/lib/ace_core_components_marquee_mac.a +/toolchains/lib/ace_core_components_menu_mac.a +/toolchains/lib/ace_core_components_mouse_listener_mac.a +/toolchains/lib/ace_core_components_multimodal_mac.a +/toolchains/lib/ace_core_components_navigation_bar_mac.a +/toolchains/lib/ace_core_components_navigator_mac.a +/toolchains/lib/ace_core_components_option_mac.a +/toolchains/lib/ace_core_components_overlay_mac.a +/toolchains/lib/ace_core_components_padding_mac.a +/toolchains/lib/ace_core_components_page_mac.a +/toolchains/lib/ace_core_components_page_transition_mac.a +/toolchains/lib/ace_core_components_panel_mac.a +/toolchains/lib/ace_core_components_pattern_lock_mac.a +/toolchains/lib/ace_core_components_pattern_ng_mac.a +/toolchains/lib/ace_core_components_patternlock_pattern_ng_mac.a +/toolchains/lib/ace_core_components_picker_mac.a +/toolchains/lib/ace_core_components_piece_mac.a +/toolchains/lib/ace_core_components_popup_mac.a +/toolchains/lib/ace_core_components_positioned_mac.a +/toolchains/lib/ace_core_components_preview_mock_pattern_ng_mac.a +/toolchains/lib/ace_core_components_progress_mac.a +/toolchains/lib/ace_core_components_property_ng_mac.a +/toolchains/lib/ace_core_components_proxy_mac.a +/toolchains/lib/ace_core_components_qrcode_mac.a +/toolchains/lib/ace_core_components_qrcode_pattern_ng_mac.a +/toolchains/lib/ace_core_components_rating_mac.a +/toolchains/lib/ace_core_components_refresh_mac.a +/toolchains/lib/ace_core_components_relative_container_mac.a +/toolchains/lib/ace_core_components_render_ng_mac.a +/toolchains/lib/ace_core_components_rich_editor_pattern_ng_mac.a +/toolchains/lib/ace_core_components_root_mac.a +/toolchains/lib/ace_core_components_scoring_mac.a +/toolchains/lib/ace_core_components_scroll_bar_mac.a +/toolchains/lib/ace_core_components_scroll_mac.a +/toolchains/lib/ace_core_components_search_mac.a +/toolchains/lib/ace_core_components_security_component_pattern_ng_mac.a +/toolchains/lib/ace_core_components_select_mac.a +/toolchains/lib/ace_core_components_select_popup_mac.a +/toolchains/lib/ace_core_components_semi_modal_mac.a +/toolchains/lib/ace_core_components_shadow_mac.a +/toolchains/lib/ace_core_components_shape_mac.a +/toolchains/lib/ace_core_components_shared_transition_mac.a +/toolchains/lib/ace_core_components_sheet_mac.a +/toolchains/lib/ace_core_components_side_bar_mac.a +/toolchains/lib/ace_core_components_slider_mac.a +/toolchains/lib/ace_core_components_split_container_mac.a +/toolchains/lib/ace_core_components_stack_mac.a +/toolchains/lib/ace_core_components_stage_mac.a +/toolchains/lib/ace_core_components_stepper_mac.a +/toolchains/lib/ace_core_components_svg_mac.a +/toolchains/lib/ace_core_components_svg_ng_mac.a +/toolchains/lib/ace_core_components_swiper_mac.a +/toolchains/lib/ace_core_components_swiper_v2_mac.a +/toolchains/lib/ace_core_components_syntax_ng_mac.a +/toolchains/lib/ace_core_components_tab_bar_mac.a +/toolchains/lib/ace_core_components_tabs_v2_mac.a +/toolchains/lib/ace_core_components_text_clock_mac.a +/toolchains/lib/ace_core_components_text_field_mac.a +/toolchains/lib/ace_core_components_text_field_pattern_ng_mac.a +/toolchains/lib/ace_core_components_text_mac.a +/toolchains/lib/ace_core_components_text_overlay_mac.a +/toolchains/lib/ace_core_components_text_span_mac.a +/toolchains/lib/ace_core_components_texttimer_mac.a +/toolchains/lib/ace_core_components_theme_mac.a +/toolchains/lib/ace_core_components_tip_mac.a +/toolchains/lib/ace_core_components_toast_mac.a +/toolchains/lib/ace_core_components_toggle_mac.a +/toolchains/lib/ace_core_components_tool_bar_mac.a +/toolchains/lib/ace_core_components_touch_listener_mac.a +/toolchains/lib/ace_core_components_track_mac.a +/toolchains/lib/ace_core_components_transform_mac.a +/toolchains/lib/ace_core_components_transition_mac.a +/toolchains/lib/ace_core_components_triangle_mac.a +/toolchains/lib/ace_core_components_tween_mac.a +/toolchains/lib/ace_core_components_video_mac.a +/toolchains/lib/ace_core_components_watch_slider_mac.a +/toolchains/lib/ace_core_components_water_flow_v2_mac.a +/toolchains/lib/ace_core_components_wrap_mac.a +/toolchains/lib/ace_core_interfaces_native_node_mac.a +/toolchains/lib/ace_core_mac.a +/toolchains/lib/ace_core_pipeline_ng_mac.a +/toolchains/lib/ace_napi_static.a +/toolchains/lib/ace_resource.a +/toolchains/lib/animator_static_mac.a +/toolchains/lib/app_check_tool.jar +/toolchains/lib/app_packing_tool.jar +/toolchains/lib/app_unpacking_tool.jar +/toolchains/lib/ark_debugger_static.a +/toolchains/lib/atomicservicebar_static_mac.a +/toolchains/lib/binary_resource_mac_and_windows.a +/toolchains/lib/bridge_accessibility_mac.a +/toolchains/lib/bridge_common_mac.a +/toolchains/lib/card_frontend_mac.a +/toolchains/lib/componentsnapshot_static_mac.a +/toolchains/lib/componentutils_static_mac.a +/toolchains/lib/configuration_static_mac.a +/toolchains/lib/darwin.a +/toolchains/lib/data_codec.a +/toolchains/lib/declarative_frontend_mac.a +/toolchains/lib/declarative_js_engine_ark_mac.a +/toolchains/lib/declarative_js_engine_bridge_ark_mac.a +/toolchains/lib/device_static_mac.a +/toolchains/lib/displaysync_static_mac.a +/toolchains/lib/dragcontroller_static_mac.a +/toolchains/lib/focuscontroller_static_mac.a +/toolchains/lib/font_static_mac.a +/toolchains/lib/framework_bridge_mac.a +/toolchains/lib/global_resmgr_simulator.a +/toolchains/lib/graphic_utils_static_ide.a +/toolchains/lib/grid_static_mac.a +/toolchains/lib/hilog.a +/toolchains/lib/impl_eventhandler.a +/toolchains/lib/inspector_static_mac.a +/toolchains/lib/js_engine_ark_mac.a +/toolchains/lib/js_engine_bridge_ark_mac.a +/toolchains/lib/js_frontend_mac.a +/toolchains/lib/js_inspector_mac.a +/toolchains/lib/libace_static_mac.a +/toolchains/lib/libark_ecma_debugger_set.a +/toolchains/lib/libtexgine_drawing.a +/toolchains/lib/libtexgine_source.a +/toolchains/lib/measure_static_mac.a +/toolchains/lib/mediaquery_static_mac.a +/toolchains/lib/mock_image_native.a +/toolchains/lib/mock_ipc_core.a +/toolchains/lib/mock_utils.a +/toolchains/lib/napi_utils_static_mac.a +/toolchains/lib/nativeapi_locale_simulator.a +/toolchains/lib/observer_static_mac.a +/toolchains/lib/overlay_static_mac.a +/toolchains/lib/performancemonitor_static_mac.a +/toolchains/lib/plugin_frontend_mac.a +/toolchains/lib/preview_entrance_source.a +/toolchains/lib/preview_external_source.a +/toolchains/lib/preview_inspector_source.a +/toolchains/lib/preview_osal_source.a +/toolchains/lib/prompt_static_mac.a +/toolchains/lib/promptaction_static_mac.a +/toolchains/lib/render_frame_trace.a +/toolchains/lib/render_service_base_src.a +/toolchains/lib/render_service_client_src.a +/toolchains/lib/rosen_libharfbuzz_mac.a +/toolchains/lib/rosen_libicu_mac.a +/toolchains/lib/rosen_text_inner.a +/toolchains/lib/rosen_text_skia.a +/toolchains/lib/router_static_mac.a +/toolchains/lib/sandbox_utils.a +/toolchains/lib/simulator_osal.a +/toolchains/lib/skia_li +/toolchains/lib/skia_paragraph.a +/toolchains/lib/skia_shaper.a +/toolchains/lib/skia_unicode.a +/toolchains/lib/surface_headers.a +/toolchains/lib/ui_ide.a +/toolchains/lib/utilsecurec_source.a +/toolchains/lib/websocket_base.a +/toolchains/lib/websocket_server.a +/toolchains/modulecheck/app.json +/toolchains/modulecheck/appStartup.json +/toolchains/modulecheck/commonEvents.json +/toolchains/modulecheck/customUtds.json +/toolchains/modulecheck/distroFilter.json +/toolchains/modulecheck/forms.json +/toolchains/modulecheck/insightIntent.json +/toolchains/modulecheck/menu.json +/toolchains/modulecheck/module.json +/toolchains/modulecheck/pages.json +/toolchains/modulecheck/routerMap.json +/toolchains/modulecheck/shortcuts.json +/toolchains/restool +/toolchains/syscapcheck +/toolchains/syscapcheck/sysCapSchema.json +------------------------------------------------------------ +Notices for software(s): +Software: +Path: /k-public/public_interface/sdk-js +Software: +Path: //developtools/packing_tool +Software: +Path: //foundation/arkui/ace_engine/adapter/preview/sdk +Software: +Path: //foundation/ability/ability_runtime/frameworks/simulator +Software: +Path: //foundation/window/window_manager/previewer +Software: +Path: //foundation/arkui/ui_lite/ext/ide +Software: +Path: //developtools/packing_tool/configcheck +Software: +Path: //developtools/global_resource_tool +Software: +Path: //foundation/graphic/graphic_2d/rosen/modules/2d_graphics +Software: +Path: //foundation/arkui/ace_engine/frameworks/base/i18n +Software: +Path: //foundation/arkui/ace_engine/frameworks/base +Software: +Path: //foundation/arkui/ace_engine/frameworks/core/components/ability_component +Software: +Path: //foundation/arkui/ace_engine/frameworks/core/components/align +Software: +Path: //foundation/arkui/ace_engine/frameworks/core/components_ng/animation +Software: +Path: //foundation/arkui/ace_engine/frameworks/core/components/arc +Software: +Path: //foundation/arkui/ace_engine/frameworks/core/components/badge +Software: +Path: //foundation/arkui/ace_engine/frameworks/core/components_ng/base +Software: +Path: //foundation/arkui/ace_engine/frameworks/core/components/box +Software: +Path: //foundation/arkui/ace_engine/frameworks/core/components/bubble +Software: +Path: //foundation/arkui/ace_engine/frameworks/core/components/button +Software: +Path: //foundation/arkui/ace_engine/frameworks/core/components/calendar +Software: +Path: //foundation/arkui/ace_engine/frameworks/core/components/camera +Software: +Path: //foundation/arkui/ace_engine/frameworks/core/components/chart +Software: +Path: //foundation/arkui/ace_engine/frameworks/core/components/checkable +Software: +Path: //foundation/arkui/ace_engine/frameworks/core/components/clip +Software: +Path: //foundation/arkui/ace_engine/frameworks/core/components/clock +Software: +Path: //foundation/arkui/ace_engine/frameworks/core/components/common +Software: +Path: //foundation/arkui/ace_engine/frameworks/core/components_v2/common +Software: +Path: //foundation/arkui/ace_engine/frameworks/core/components/container_modal +Software: +Path: //foundation/arkui/ace_engine/frameworks/core/components/counter +Software: +Path: //foundation/arkui/ace_engine/frameworks/core/components/coverage +Software: +Path: //foundation/arkui/ace_engine/frameworks/core/components/custom_dialog +Software: +Path: //foundation/arkui/ace_engine/frameworks/core/components/custom_paint +Software: +Path: //foundation/arkui/ace_engine/frameworks/core/components/data_panel +Software: +Path: //foundation/arkui/ace_engine/frameworks/core/components/dialog +Software: +Path: //foundation/arkui/ace_engine/frameworks/core/components/dialog_modal +Software: +Path: //foundation/arkui/ace_engine/frameworks/core/components/dialog_tween +Software: +Path: //foundation/arkui/ace_engine/frameworks/core/components/display +Software: +Path: //foundation/arkui/ace_engine/frameworks/core/components/divider +Software: +Path: //foundation/arkui/ace_engine/frameworks/core/components/drag_bar +Software: +Path: //foundation/arkui/ace_engine/frameworks/core/components/drop_filter +Software: +Path: //foundation/arkui/ace_engine/frameworks/core/components_ng/event +Software: +Path: //foundation/arkui/ace_engine/frameworks/core/components/flex +Software: +Path: //foundation/arkui/ace_engine/frameworks/core/components/focus_animation +Software: +Path: //foundation/arkui/ace_engine/frameworks/core/components/focus_collaboration +Software: +Path: //foundation/arkui/ace_engine/frameworks/core/components/focusable +Software: +Path: //foundation/arkui/ace_engine/frameworks/core/components/font +Software: +Path: //foundation/arkui/ace_engine/frameworks/core/components/foreach +Software: +Path: //foundation/arkui/ace_engine/frameworks/core/components_part_upd/foreach +Software: +Path: //foundation/arkui/ace_engine/frameworks/core/components_v2/foreach +Software: +Path: //foundation/arkui/ace_engine/frameworks/core/components/gesture_listener +Software: +Path: //foundation/arkui/ace_engine/frameworks/core/components_ng/gestures +Software: +Path: //foundation/arkui/ace_engine/frameworks/core/components/grid_layout +Software: +Path: //foundation/arkui/ace_engine/frameworks/core/components_v2/grid_layout +Software: +Path: //foundation/arkui/ace_engine/frameworks/core/components/grid +Software: +Path: //foundation/arkui/ace_engine/frameworks/core/components_v2/grid +Software: +Path: //foundation/arkui/ace_engine/frameworks/core/components/hyperlink +Software: +Path: //foundation/arkui/ace_engine/frameworks/core/components/ifelse +Software: +Path: //foundation/arkui/ace_engine/frameworks/core/components/image +Software: +Path: //foundation/arkui/ace_engine/frameworks/core/components_ng/image_provider +Software: +Path: //foundation/arkui/ace_engine/frameworks/core/components/indexer +Software: +Path: //foundation/arkui/ace_engine/frameworks/core/components_v2/indexer +Software: +Path: //foundation/arkui/ace_engine/frameworks/core/components_v2/inspector +Software: +Path: //foundation/arkui/ace_engine/frameworks/core/components_ng/layout +Software: +Path: //foundation/arkui/ace_engine/frameworks/core/components/list +Software: +Path: //foundation/arkui/ace_engine/frameworks/core/components_v2/list +Software: +Path: //foundation/arkui/ace_engine/frameworks/core/components_ng/manager +Software: +Path: //foundation/arkui/ace_engine/frameworks/core/components/marquee +Software: +Path: //foundation/arkui/ace_engine/frameworks/core/components/menu +Software: +Path: //foundation/arkui/ace_engine/frameworks/core/components/mouse_listener +Software: +Path: //foundation/arkui/ace_engine/frameworks/core/components/multimodal +Software: +Path: //foundation/arkui/ace_engine/frameworks/core/components/navigation_bar +Software: +Path: //foundation/arkui/ace_engine/frameworks/core/components/navigator +Software: +Path: //foundation/arkui/ace_engine/frameworks/core/components/option +Software: +Path: //foundation/arkui/ace_engine/frameworks/core/components/overlay +Software: +Path: //foundation/arkui/ace_engine/frameworks/core/components/padding +Software: +Path: //foundation/arkui/ace_engine/frameworks/core/components/page +Software: +Path: //foundation/arkui/ace_engine/frameworks/core/components/page_transition +Software: +Path: //foundation/arkui/ace_engine/frameworks/core/components/panel +Software: +Path: //foundation/arkui/ace_engine/frameworks/core/components_v2/pattern_lock +Software: +Path: //foundation/arkui/ace_engine/frameworks/core/components_ng/pattern +Software: +Path: //foundation/arkui/ace_engine/frameworks/core/components_ng/pattern/patternlock +Software: +Path: //foundation/arkui/ace_engine/frameworks/core/components/picker +Software: +Path: //foundation/arkui/ace_engine/frameworks/core/components/piece +Software: +Path: //foundation/arkui/ace_engine/frameworks/core/components/popup +Software: +Path: //foundation/arkui/ace_engine/frameworks/core/components/positioned +Software: +Path: //foundation/arkui/ace_engine/frameworks/core/components_ng/pattern/preview_mock +Software: +Path: //foundation/arkui/ace_engine/frameworks/core/components/progress +Software: +Path: //foundation/arkui/ace_engine/frameworks/core/components_ng/property +Software: +Path: //foundation/arkui/ace_engine/frameworks/core/components/proxy +Software: +Path: //foundation/arkui/ace_engine/frameworks/core/components/qrcode +Software: +Path: //foundation/arkui/ace_engine/frameworks/core/components_ng/pattern/qrcode +Software: +Path: //foundation/arkui/ace_engine/frameworks/core/components/rating +Software: +Path: //foundation/arkui/ace_engine/frameworks/core/components/refresh +Software: +Path: //foundation/arkui/ace_engine/frameworks/core/components/relative_container +Software: +Path: //foundation/arkui/ace_engine/frameworks/core/components_ng/render +Software: +Path: //foundation/arkui/ace_engine/frameworks/core/components_ng/pattern/rich_editor +Software: +Path: //foundation/arkui/ace_engine/frameworks/core/components/root +Software: +Path: //foundation/arkui/ace_engine/frameworks/core/components/scoring +Software: +Path: //foundation/arkui/ace_engine/frameworks/core/components/scroll_bar +Software: +Path: //foundation/arkui/ace_engine/frameworks/core/components/scroll +Software: +Path: //foundation/arkui/ace_engine/frameworks/core/components/search +Software: +Path: //foundation/arkui/ace_engine/frameworks/core/components_ng/pattern/security_component +Software: +Path: //foundation/arkui/ace_engine/frameworks/core/components/select +Software: +Path: //foundation/arkui/ace_engine/frameworks/core/components/select_popup +Software: +Path: //foundation/arkui/ace_engine/frameworks/core/components/semi_modal +Software: +Path: //foundation/arkui/ace_engine/frameworks/core/components/shadow +Software: +Path: //foundation/arkui/ace_engine/frameworks/core/components/shape +Software: +Path: //foundation/arkui/ace_engine/frameworks/core/components/shared_transition +Software: +Path: //foundation/arkui/ace_engine/frameworks/core/components/sheet +Software: +Path: //foundation/arkui/ace_engine/frameworks/core/components/side_bar +Software: +Path: //foundation/arkui/ace_engine/frameworks/core/components/slider +Software: +Path: //foundation/arkui/ace_engine/frameworks/core/components/split_container +Software: +Path: //foundation/arkui/ace_engine/frameworks/core/components/stack +Software: +Path: //foundation/arkui/ace_engine/frameworks/core/components/stage +Software: +Path: //foundation/arkui/ace_engine/frameworks/core/components/stepper +Software: +Path: //foundation/arkui/ace_engine/frameworks/core/components/svg +Software: +Path: //foundation/arkui/ace_engine/frameworks/core/components_ng/svg +Software: +Path: //foundation/arkui/ace_engine/frameworks/core/components/swiper +Software: +Path: //foundation/arkui/ace_engine/frameworks/core/components_v2/swiper +Software: +Path: //foundation/arkui/ace_engine/frameworks/core/components_ng/syntax +Software: +Path: //foundation/arkui/ace_engine/frameworks/core/components/tab_bar +Software: +Path: //foundation/arkui/ace_engine/frameworks/core/components_v2/tabs +Software: +Path: //foundation/arkui/ace_engine/frameworks/core/components/text_clock +Software: +Path: //foundation/arkui/ace_engine/frameworks/core/components/text_field +Software: +Path: //foundation/arkui/ace_engine/frameworks/core/components_ng/pattern/text_field +Software: +Path: //foundation/arkui/ace_engine/frameworks/core/components/text +Software: +Path: //foundation/arkui/ace_engine/frameworks/core/components/text_overlay +Software: +Path: //foundation/arkui/ace_engine/frameworks/core/components/text_span +Software: +Path: //foundation/arkui/ace_engine/frameworks/core/components/texttimer +Software: +Path: //foundation/arkui/ace_engine/frameworks/core/components/theme +Software: +Path: //foundation/arkui/ace_engine/frameworks/core/components/tip +Software: +Path: //foundation/arkui/ace_engine/frameworks/core/components/toast +Software: +Path: //foundation/arkui/ace_engine/frameworks/core/components/toggle +Software: +Path: //foundation/arkui/ace_engine/frameworks/core/components/tool_bar +Software: +Path: //foundation/arkui/ace_engine/frameworks/core/components/touch_listener +Software: +Path: //foundation/arkui/ace_engine/frameworks/core/components/track +Software: +Path: //foundation/arkui/ace_engine/frameworks/core/components/transform +Software: +Path: //foundation/arkui/ace_engine/frameworks/core/components/transition +Software: +Path: //foundation/arkui/ace_engine/frameworks/core/components/triangle +Software: +Path: //foundation/arkui/ace_engine/frameworks/core/components/tween +Software: +Path: //foundation/arkui/ace_engine/frameworks/core/components/video +Software: +Path: //foundation/arkui/ace_engine/frameworks/core/components/watch_slider +Software: +Path: //foundation/arkui/ace_engine/frameworks/core/components_v2/water_flow +Software: +Path: //foundation/arkui/ace_engine/frameworks/core/components/wrap +Software: +Path: //foundation/arkui/ace_engine/frameworks/core/interfaces/native +Software: +Path: //foundation/arkui/ace_engine/frameworks/core +Software: +Path: //foundation/arkui/ace_engine/frameworks/core/pipeline_ng +Software: +Path: //foundation/arkui/napi +Software: +Path: //foundation/arkui/ace_engine/frameworks/base/resource +Software: +Path: //foundation/arkui/ace_engine/interfaces/napi/kits/animator +Software: +Path: //arkcompiler/toolchain/inspector +Software: +Path: //foundation/arkui/ace_engine/interfaces/napi/kits/atomic_service_bar +Software: +Path: //foundation/arkui/ace_engine/frameworks/bridge/common/accessibility +Software: +Path: //foundation/arkui/ace_engine/frameworks/bridge/common +Software: +Path: //foundation/arkui/ace_engine/frameworks/bridge/card_frontend +Software: +Path: //foundation/arkui/ace_engine/interfaces/napi/kits/component_snapshot +Software: +Path: //foundation/arkui/ace_engine/interfaces/napi/kits/componentutils +Software: +Path: //foundation/arkui/ace_engine/interfaces/napi/kits/configuration +Software: +Path: //foundation/graphic/graphic_2d/rosen/modules/render_service_base/src/platform/darwin +Software: +Path: //foundation/arkui/ace_engine/frameworks/bridge/codec +Software: +Path: //foundation/arkui/ace_engine/frameworks/bridge/declarative_frontend +Software: +Path: //foundation/arkui/ace_engine/frameworks/bridge/declarative_frontend/engine/jsi +Software: +Path: //foundation/arkui/ace_engine/interfaces/napi/kits/device +Software: +Path: //foundation/arkui/ace_engine/interfaces/napi/kits/display_sync +Software: +Path: //foundation/arkui/ace_engine/interfaces/napi/kits/drag_controller +Software: +Path: //foundation/arkui/ace_engine/interfaces/napi/kits/focus_controller +Software: +Path: //foundation/arkui/ace_engine/interfaces/napi/kits/font +Software: +Path: //foundation/arkui/ace_engine/frameworks/bridge +Software: +Path: //base/global/resource_management_lite/frameworks/resmgr_lite +Software: +Path: //foundation/arkui/ace_engine/interfaces/napi/kits/grid +Software: +Path: //foundation/graphic/graphic_2d/rosen/modules/platform +Software: +Path: //foundation/arkui/ace_engine/interfaces/napi/kits/inspector +Software: +Path: //foundation/arkui/ace_engine/frameworks/bridge/js_frontend/engine +Software: +Path: //foundation/arkui/ace_engine/frameworks/bridge/js_frontend/engine/jsi +Software: +Path: //foundation/arkui/ace_engine/frameworks/bridge/js_frontend +Software: +Path: //foundation/arkui/ace_engine/frameworks/core/accessibility/js_inspector +Software: +Path: //foundation/arkui/ace_engine/build +Software: +Path: //arkcompiler/toolchain/tooling +Software: +Path: //foundation/graphic/graphic_2d/rosen/modules/texgine/texgine_drawing +Software: +Path: //foundation/graphic/graphic_2d/rosen/modules/texgine +Software: +Path: //foundation/arkui/ace_engine/interfaces/napi/kits/measure +Software: +Path: //foundation/arkui/ace_engine/interfaces/napi/kits/mediaquery +Software: +Path: //foundation/arkui/ace_engine/interfaces/napi/kits/utils +Software: +Path: //base/global/i18n_lite/interfaces/kits/js/builtin +Software: +Path: //foundation/arkui/ace_engine/interfaces/napi/kits/observer +Software: +Path: //foundation/arkui/ace_engine/interfaces/napi/kits/overlay +Software: +Path: //foundation/arkui/ace_engine/interfaces/napi/kits/performancemonitor +Software: +Path: //foundation/arkui/ace_engine/frameworks/bridge/plugin_frontend +Software: +Path: //foundation/arkui/ace_engine/adapter/preview/entrance +Software: +Path: //foundation/arkui/ace_engine/adapter/preview/external +Software: +Path: //foundation/arkui/ace_engine/adapter/preview/inspector +Software: +Path: //foundation/arkui/ace_engine/adapter/preview/osal +Software: +Path: //foundation/arkui/ace_engine/interfaces/napi/kits/prompt +Software: +Path: //foundation/arkui/ace_engine/interfaces/napi/kits/promptaction +Software: +Path: //foundation/graphic/graphic_2d/rosen/modules/render_frame_trace +Software: +Path: //foundation/graphic/graphic_2d/rosen/modules/render_service_base +Software: +Path: //foundation/graphic/graphic_2d/rosen/modules/render_service_client +Software: +Path: //foundation/graphic/graphic_2d/rosen/build/harfbuzz +Software: +Path: //foundation/graphic/graphic_2d/rosen/build/icu +Software: +Path: //foundation/graphic/graphic_2d/rosen/modules/2d_engine/rosen_text +Software: +Path: //foundation/arkui/ace_engine/interfaces/napi/kits/router +Software: +Path: //foundation/graphic/graphic_2d/utils/sandbox +Software: +Path: //foundation/ability/ability_runtime/frameworks/simulator/osal +Software: +Path: //foundation/graphic/graphic_2d/rosen/modules/2d_engine/rosen_text/skia_txt +Software: +Path: //foundation/graphic/graphic_surface/surface +Software: +Path: //arkcompiler/toolchain/websocket +Software: +Path: //developtools/packing_tool/modulecheck +------------------------------------------------------------ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS +============================================================ +Notices for file(s): +/ets/build-tools/ets-loader +/ets/build-tools/ets-loader/codegen +/ets/build-tools/ets-loader/codegen/codegen +/ets/build-tools/ets-loader/compile_plugin.js +/ets/build-tools/ets-loader/components +/ets/build-tools/ets-loader/components/components +/ets/build-tools/ets-loader/declarations +/ets/build-tools/ets-loader/declarations/declarations +/ets/build-tools/ets-loader/form_components +/ets/build-tools/ets-loader/form_components/form_components +/ets/build-tools/ets-loader/kit_configs +/ets/build-tools/ets-loader/kit_configs/kit_configs +/ets/build-tools/ets-loader/lib +/ets/build-tools/ets-loader/lib/lib +/ets/build-tools/ets-loader/main.js +/ets/build-tools/ets-loader/node_modules +/ets/build-tools/ets-loader/npm-install.js +/ets/build-tools/ets-loader/package-lock.json +/ets/build-tools/ets-loader/package.json +/ets/build-tools/ets-loader/rollup.config.js +/ets/build-tools/ets-loader/server +/ets/build-tools/ets-loader/server/server +/ets/build-tools/ets-loader/sysResource.js +/ets/build-tools/ets-loader/tsconfig.esm.json +/ets/build-tools/ets-loader/tsconfig.json +/ets/build-tools/ets-loader/webpack.config.js +/ets/component +/ets/component/component_config.json +/ets/component/form_config.json +/js/build-tools/ace-loader +/js/build-tools/ace-loader/babel.config.js +/js/build-tools/ace-loader/index.js +/js/build-tools/ace-loader/lib/lib +/js/build-tools/ace-loader/main.product.js +/js/build-tools/ace-loader/node_modules +/js/build-tools/ace-loader/npm-install.js +/js/build-tools/ace-loader/package-lock.json +/js/build-tools/ace-loader/package.json +/js/build-tools/ace-loader/sample +/js/build-tools/ace-loader/webpack.lite.config.js +/js/build-tools/ace-loader/webpack.rich.config.js +/toolchains/lib/arraylist_static.a +/toolchains/lib/buffer_static.a +/toolchains/lib/deque_static.a +/toolchains/lib/hashmap_static.a +/toolchains/lib/hashset_static.a +/toolchains/lib/lightweightmap_static.a +/toolchains/lib/lightweightset_static.a +/toolchains/lib/linkedlist_static.a +/toolchains/lib/list_static.a +/toolchains/lib/plainarray_static.a +/toolchains/lib/queue_static.a +/toolchains/lib/stack_static.a +/toolchains/lib/struct_static.a +/toolchains/lib/svg.a +/toolchains/lib/treemap_static.a +/toolchains/lib/treeset_static.a +/toolchains/lib/vector_static.a +------------------------------------------------------------ +Notices for software(s): +Software: +Path: //developtools/ace_ets2bundle +Software: +Path: //developtools/ace_js2bundle +Software: +Path: //commonlibrary/ets_utils/js_util_module/container +Software: +Path: //commonlibrary/ets_utils/js_api_module/buffer +Software: +Path: //third_party/skia/modules/svg +------------------------------------------------------------ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + +============================================================ +Notices for file(s): +/toolchains/lib/napi_utils_static.a +------------------------------------------------------------ +Notices for software(s): +Software: +Path: //foundation/communication/netstack/utils/napi_utils +------------------------------------------------------------ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +============================================================ +Notices for file(s): +/toolchains/lib/liblz4_static.a +------------------------------------------------------------ +Notices for software(s): +Software: lz4 1.9.4 +Path: //third_party/lz4 +------------------------------------------------------------ +This repository uses 2 different licenses : +- all files in the `lib` directory use a BSD 2-Clause license +- all other files use a GPLv2 license, unless explicitly stated otherwise + +Relevant license is reminded at the top of each source file, +and with presence of COPYING or LICENSE file in associated directories. + +This model is selected to emphasize that +files in the `lib` directory are designed to be included into 3rd party applications, +while all other files, in `programs`, `tests` or `examples`, +are intended to be used "as is", as part of their intended scenarios, +with no intention to support 3rd party integration use cases. + +============================================================ +Notices for file(s): +/toolchains/lib/websockets_static.a +------------------------------------------------------------ +Notices for software(s): +Software: libwebsockets v4.3.3 +Path: //third_party/libwebsockets +------------------------------------------------------------ +Libwebsockets and included programs are provided under the terms of the +MIT license shown below, with the exception that some sources are under +a similar permissive license like BSD, or are explicitly CC0 / public +domain to remove any obstacles from basing differently-licensed code on +them. + +Original liberal license retained: + + - lib/misc/sha-1.c - 3-clause BSD license retained, link to original [BSD3] + - win32port/zlib - ZLIB license (see zlib.h) [ZLIB] + - lib/tls/mbedtls/wrapper - Apache 2.0 (only built if linked against mbedtls) [APACHE2] + lib/tls/mbedtls/mbedtls-extensions.c + - lib/misc/base64-decode.c - already MIT + - lib/misc/ieeehalfprecision.c - 2-clause BSD license retained [BSD2] + +Relicensed to MIT: + + - lib/misc/daemonize.c - relicensed from Public Domain to MIT, + link to original Public Domain version + - lib/plat/windows/windows-resolv.c - relicensed from "Beerware v42" to MIT + +Public Domain (CC-zero) to simplify reuse: + + - test-apps/*.c + - test-apps/*.h + - minimal-examples/* + - lwsws/* + +Although libwebsockets is available under a permissive license, it does not +change the reality of dealing with large lumps of external code... if your +copy diverges it is guaranteed to contain security problems after a while +and can be very painful to pick backports (especially since historically, +we are very hot on cleaning and refactoring the codebase). The least +painful and lowest risk way remains sending your changes and fixes upstream +to us so you can easily use later releases and fixes. + +## MIT License applied to libwebsockets + +https://opensource.org/licenses/MIT + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to + deal in the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + sell copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + IN THE SOFTWARE. + +## BSD2 + +``` + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. +``` + +## BSD3 + +For convenience, a copy of the license on `./lib/misc/sha-1.c`. In binary +distribution, this applies to builds with ws support enabled, and without +`LWS_WITHOUT_BUILTIN_SHA1` at cmake. + +``` +/* + * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the project nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH +``` + +## ZLIB + +For convenience, a copy of the license on zlib. In binary distribution, +this applies for win32 builds with internal zlib only. You can avoid +building any zlib usage or copy at all with `-DLWS_WITH_ZLIB=0` (the +default), and so avoid needing to observe the license for binary +distribution that doesn't include the related code. + +``` + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. + + Jean-loup Gailly Mark Adler + jloup@gzip.org madler@alumni.caltech.edu +``` + + +## APACHE2 + +For convenience, a copy of the license on the mbedtls wrapper part. In binary +distribution, this applies only when building lws against mbedtls. + +The canonical license application to source files uses the URL reference, so the +whole is not reproduced here. + +``` +// Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at + +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +``` + +## CC0 + +For convenience,the full text of CC0 dedication found on the lws examples. +The intention of this is to dedicate the examples to the public domain, so +users can build off and modify them without any constraint. + +``` +Statement of Purpose + +The laws of most jurisdictions throughout the world automatically confer exclusive Copyright and Related Rights (defined below) upon the creator and subsequent owner(s) (each and all, an "owner") of an original work of authorship and/or a database (each, a "Work"). + +Certain owners wish to permanently relinquish those rights to a Work for the purpose of contributing to a commons of creative, cultural and scientific works ("Commons") that the public can reliably and without fear of later claims of infringement build upon, modify, incorporate in other works, reuse and redistribute as freely as possible in any form whatsoever and for any purposes, including without limitation commercial purposes. These owners may contribute to the Commons to promote the ideal of a free culture and the further production of creative, cultural and scientific works, or to gain reputation or greater distribution for their Work in part through the use and efforts of others. + +For these and/or other purposes and motivations, and without any expectation of additional consideration or compensation, the person associating CC0 with a Work (the "Affirmer"), to the extent that he or she is an owner of Copyright and Related Rights in the Work, voluntarily elects to apply CC0 to the Work and publicly distribute the Work under its terms, with knowledge of his or her Copyright and Related Rights in the Work and the meaning and intended legal effect of CC0 on those rights. + +1. Copyright and Related Rights. A Work made available under CC0 may be protected by copyright and related or neighboring rights ("Copyright and Related Rights"). Copyright and Related Rights include, but are not limited to, the following: + + the right to reproduce, adapt, distribute, perform, display, communicate, and translate a Work; + moral rights retained by the original author(s) and/or performer(s); + publicity and privacy rights pertaining to a person's image or likeness depicted in a Work; + rights protecting against unfair competition in regards to a Work, subject to the limitations in paragraph 4(a), below; + rights protecting the extraction, dissemination, use and reuse of data in a Work; + database rights (such as those arising under Directive 96/9/EC of the European Parliament and of the Council of 11 March 1996 on the legal protection of databases, and under any national implementation thereof, including any amended or successor version of such directive); and + other similar, equivalent or corresponding rights throughout the world based on applicable law or treaty, and any national implementations thereof. + +2. Waiver. To the greatest extent permitted by, but not in contravention of, applicable law, Affirmer hereby overtly, fully, permanently, irrevocably and unconditionally waives, abandons, and surrenders all of Affirmer's Copyright and Related Rights and associated claims and causes of action, whether now known or unknown (including existing as well as future claims and causes of action), in the Work (i) in all territories worldwide, (ii) for the maximum duration provided by applicable law or treaty (including future time extensions), (iii) in any current or future medium and for any number of copies, and (iv) for any purpose whatsoever, including without limitation commercial, advertising or promotional purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each member of the public at large and to the detriment of Affirmer's heirs and successors, fully intending that such Waiver shall not be subject to revocation, rescission, cancellation, termination, or any other legal or equitable action to disrupt the quiet enjoyment of the Work by the public as contemplated by Affirmer's express Statement of Purpose. + +3. Public License Fallback. Should any part of the Waiver for any reason be judged legally invalid or ineffective under applicable law, then the Waiver shall be preserved to the maximum extent permitted taking into account Affirmer's express Statement of Purpose. In addition, to the extent the Waiver is so judged Affirmer hereby grants to each affected person a royalty-free, non transferable, non sublicensable, non exclusive, irrevocable and unconditional license to exercise Affirmer's Copyright and Related Rights in the Work (i) in all territories worldwide, (ii) for the maximum duration provided by applicable law or treaty (including future time extensions), (iii) in any current or future medium and for any number of copies, and (iv) for any purpose whatsoever, including without limitation commercial, advertising or promotional purposes (the "License"). The License shall be deemed effective as of the date CC0 was applied by Affirmer to the Work. Should any part of the License for any reason be judged legally invalid or ineffective under applicable law, such partial invalidity or ineffectiveness shall not invalidate the remainder of the License, and in such case Affirmer hereby affirms that he or she will not (i) exercise any of his or her remaining Copyright and Related Rights in the Work or (ii) assert any associated claims and causes of action with respect to the Work, in either case contrary to Affirmer's express Statement of Purpose. + +4. Limitations and Disclaimers. + + No trademark or patent rights held by Affirmer are waived, abandoned, surrendered, licensed or otherwise affected by this document. + Affirmer offers the Work as-is and makes no representations or warranties of any kind concerning the Work, express, implied, statutory or otherwise, including without limitation warranties of title, merchantability, fitness for a particular purpose, non infringement, or the absence of latent or other defects, accuracy, or the present or absence of errors, whether or not discoverable, all to the greatest extent permissible under applicable law. + Affirmer disclaims responsibility for clearing rights of other persons that may apply to the Work or any use thereof, including without limitation any person's Copyright and Related Rights in the Work. Further, Affirmer disclaims responsibility for obtaining any necessary consents, permissions or other rights required for any use of the Work. + Affirmer understands and acknowledges that Creative Commons is not a party to this document and has no duty or obligation with respect to this CC0 or use of the Work. +``` + + +============================================================ +Notices for file(s): +/toolchains/lib/harfbuzz_static.a +------------------------------------------------------------ +Notices for software(s): +Software: harfbuzz 2.8.2 +Path: //third_party/harfbuzz +------------------------------------------------------------ +HarfBuzz is licensed under the so-called "Old MIT" license. Details follow. +For parts of HarfBuzz that are licensed under different licenses see individual +files names COPYING in subdirectories where applicable. + +Copyright © 2010,2011,2012,2013,2014,2015,2016,2017,2018,2019,2020 Google, Inc. +Copyright © 2018,2019,2020 Ebrahim Byagowi +Copyright © 2019,2020 Facebook, Inc. +Copyright © 2012 Mozilla Foundation +Copyright © 2011 Codethink Limited +Copyright © 2008,2010 Nokia Corporation and/or its subsidiary(-ies) +Copyright © 2009 Keith Stribley +Copyright © 2009 Martin Hosken and SIL International +Copyright © 2007 Chris Wilson +Copyright © 2005,2006,2020,2021 Behdad Esfahbod +Copyright © 2005 David Turner +Copyright © 2004,2007,2008,2009,2010 Red Hat, Inc. +Copyright © 1998-2004 David Turner and Werner Lemberg + +For full copyright notices consult the individual files in the package. + + +Permission is hereby granted, without written agreement and without +license or royalty fees, to use, copy, modify, and distribute this +software and its documentation for any purpose, provided that the +above copyright notice and the following two paragraphs appear in +all copies of this software. + +IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR +DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES +ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN +IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGE. + +THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, +BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO +PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. + +============================================================ +Notices for file(s): +/js/build-tools/ace-loader/bin/jerry-snapshot +/js/build-tools/ace-loader/bin/jerry +/toolchains/lib/libjerryscript.a +------------------------------------------------------------ +Notices for software(s): +Software: jerryscript v2.3.0 +Path: //third_party/jerryscript +------------------------------------------------------------ +Copyright JS Foundation and other contributors, http://js.foundation + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright JS Foundation and other contributors, http://js.foundation + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +============================================================ +Notices for file(s): +/toolchains/lib/libusb_source.a +/toolchains/libusb_shared.dylib +------------------------------------------------------------ +Notices for software(s): +Software: openEuler:libusbx 1.0.26-1.oe2203sp1 +Path: //third_party/libusb +------------------------------------------------------------ + GNU LESSER GENERAL PUBLIC LICENSE + Version 2.1, February 1999 + + Copyright (C) 1991, 1999 Free Software Foundation, Inc. + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + +[This is the first released version of the Lesser GPL. It also counts + as the successor of the GNU Library Public License, version 2, hence + the version number 2.1.] + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +Licenses are intended to guarantee your freedom to share and change +free software--to make sure the software is free for all its users. + + This license, the Lesser General Public License, applies to some +specially designated software packages--typically libraries--of the +Free Software Foundation and other authors who decide to use it. You +can use it too, but we suggest you first think carefully about whether +this license or the ordinary General Public License is the better +strategy to use in any particular case, based on the explanations below. + + When we speak of free software, we are referring to freedom of use, +not price. Our General Public Licenses are designed to make sure that +you have the freedom to distribute copies of free software (and charge +for this service if you wish); that you receive source code or can get +it if you want it; that you can change the software and use pieces of +it in new free programs; and that you are informed that you can do +these things. + + To protect your rights, we need to make restrictions that forbid +distributors to deny you these rights or to ask you to surrender these +rights. These restrictions translate to certain responsibilities for +you if you distribute copies of the library or if you modify it. + + For example, if you distribute copies of the library, whether gratis +or for a fee, you must give the recipients all the rights that we gave +you. You must make sure that they, too, receive or can get the source +code. If you link other code with the library, you must provide +complete object files to the recipients, so that they can relink them +with the library after making changes to the library and recompiling +it. And you must show them these terms so they know their rights. + + We protect your rights with a two-step method: (1) we copyright the +library, and (2) we offer you this license, which gives you legal +permission to copy, distribute and/or modify the library. + + To protect each distributor, we want to make it very clear that +there is no warranty for the free library. Also, if the library is +modified by someone else and passed on, the recipients should know +that what they have is not the original version, so that the original +author's reputation will not be affected by problems that might be +introduced by others. + + Finally, software patents pose a constant threat to the existence of +any free program. We wish to make sure that a company cannot +effectively restrict the users of a free program by obtaining a +restrictive license from a patent holder. Therefore, we insist that +any patent license obtained for a version of the library must be +consistent with the full freedom of use specified in this license. + + Most GNU software, including some libraries, is covered by the +ordinary GNU General Public License. This license, the GNU Lesser +General Public License, applies to certain designated libraries, and +is quite different from the ordinary General Public License. We use +this license for certain libraries in order to permit linking those +libraries into non-free programs. + + When a program is linked with a library, whether statically or using +a shared library, the combination of the two is legally speaking a +combined work, a derivative of the original library. The ordinary +General Public License therefore permits such linking only if the +entire combination fits its criteria of freedom. The Lesser General +Public License permits more lax criteria for linking other code with +the library. + + We call this license the "Lesser" General Public License because it +does Less to protect the user's freedom than the ordinary General +Public License. It also provides other free software developers Less +of an advantage over competing non-free programs. These disadvantages +are the reason we use the ordinary General Public License for many +libraries. However, the Lesser license provides advantages in certain +special circumstances. + + For example, on rare occasions, there may be a special need to +encourage the widest possible use of a certain library, so that it becomes +a de-facto standard. To achieve this, non-free programs must be +allowed to use the library. A more frequent case is that a free +library does the same job as widely used non-free libraries. In this +case, there is little to gain by limiting the free library to free +software only, so we use the Lesser General Public License. + + In other cases, permission to use a particular library in non-free +programs enables a greater number of people to use a large body of +free software. For example, permission to use the GNU C Library in +non-free programs enables many more people to use the whole GNU +operating system, as well as its variant, the GNU/Linux operating +system. + + Although the Lesser General Public License is Less protective of the +users' freedom, it does ensure that the user of a program that is +linked with the Library has the freedom and the wherewithal to run +that program using a modified version of the Library. + + The precise terms and conditions for copying, distribution and +modification follow. Pay close attention to the difference between a +"work based on the library" and a "work that uses the library". The +former contains code derived from the library, whereas the latter must +be combined with the library in order to run. + + GNU LESSER GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License Agreement applies to any software library or other +program which contains a notice placed by the copyright holder or +other authorized party saying it may be distributed under the terms of +this Lesser General Public License (also called "this License"). +Each licensee is addressed as "you". + + A "library" means a collection of software functions and/or data +prepared so as to be conveniently linked with application programs +(which use some of those functions and data) to form executables. + + The "Library", below, refers to any such software library or work +which has been distributed under these terms. A "work based on the +Library" means either the Library or any derivative work under +copyright law: that is to say, a work containing the Library or a +portion of it, either verbatim or with modifications and/or translated +straightforwardly into another language. (Hereinafter, translation is +included without limitation in the term "modification".) + + "Source code" for a work means the preferred form of the work for +making modifications to it. For a library, complete source code means +all the source code for all modules it contains, plus any associated +interface definition files, plus the scripts used to control compilation +and installation of the library. + + Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running a program using the Library is not restricted, and output from +such a program is covered only if its contents constitute a work based +on the Library (independent of the use of the Library in a tool for +writing it). Whether that is true depends on what the Library does +and what the program that uses the Library does. + + 1. You may copy and distribute verbatim copies of the Library's +complete source code as you receive it, in any medium, provided that +you conspicuously and appropriately publish on each copy an +appropriate copyright notice and disclaimer of warranty; keep intact +all the notices that refer to this License and to the absence of any +warranty; and distribute a copy of this License along with the +Library. + + You may charge a fee for the physical act of transferring a copy, +and you may at your option offer warranty protection in exchange for a +fee. + + 2. You may modify your copy or copies of the Library or any portion +of it, thus forming a work based on the Library, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) The modified work must itself be a software library. + + b) You must cause the files modified to carry prominent notices + stating that you changed the files and the date of any change. + + c) You must cause the whole of the work to be licensed at no + charge to all third parties under the terms of this License. + + d) If a facility in the modified Library refers to a function or a + table of data to be supplied by an application program that uses + the facility, other than as an argument passed when the facility + is invoked, then you must make a good faith effort to ensure that, + in the event an application does not supply such function or + table, the facility still operates, and performs whatever part of + its purpose remains meaningful. + + (For example, a function in a library to compute square roots has + a purpose that is entirely well-defined independent of the + application. Therefore, Subsection 2d requires that any + application-supplied function or table used by this function must + be optional: if the application does not supply it, the square + root function must still compute square roots.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Library, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Library, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote +it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Library. + +In addition, mere aggregation of another work not based on the Library +with the Library (or with a work based on the Library) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may opt to apply the terms of the ordinary GNU General Public +License instead of this License to a given copy of the Library. To do +this, you must alter all the notices that refer to this License, so +that they refer to the ordinary GNU General Public License, version 2, +instead of to this License. (If a newer version than version 2 of the +ordinary GNU General Public License has appeared, then you can specify +that version instead if you wish.) Do not make any other change in +these notices. + + Once this change is made in a given copy, it is irreversible for +that copy, so the ordinary GNU General Public License applies to all +subsequent copies and derivative works made from that copy. + + This option is useful when you wish to copy part of the code of +the Library into a program that is not a library. + + 4. You may copy and distribute the Library (or a portion or +derivative of it, under Section 2) in object code or executable form +under the terms of Sections 1 and 2 above provided that you accompany +it with the complete corresponding machine-readable source code, which +must be distributed under the terms of Sections 1 and 2 above on a +medium customarily used for software interchange. + + If distribution of object code is made by offering access to copy +from a designated place, then offering equivalent access to copy the +source code from the same place satisfies the requirement to +distribute the source code, even though third parties are not +compelled to copy the source along with the object code. + + 5. A program that contains no derivative of any portion of the +Library, but is designed to work with the Library by being compiled or +linked with it, is called a "work that uses the Library". Such a +work, in isolation, is not a derivative work of the Library, and +therefore falls outside the scope of this License. + + However, linking a "work that uses the Library" with the Library +creates an executable that is a derivative of the Library (because it +contains portions of the Library), rather than a "work that uses the +library". The executable is therefore covered by this License. +Section 6 states terms for distribution of such executables. + + When a "work that uses the Library" uses material from a header file +that is part of the Library, the object code for the work may be a +derivative work of the Library even though the source code is not. +Whether this is true is especially significant if the work can be +linked without the Library, or if the work is itself a library. The +threshold for this to be true is not precisely defined by law. + + If such an object file uses only numerical parameters, data +structure layouts and accessors, and small macros and small inline +functions (ten lines or less in length), then the use of the object +file is unrestricted, regardless of whether it is legally a derivative +work. (Executables containing this object code plus portions of the +Library will still fall under Section 6.) + + Otherwise, if the work is a derivative of the Library, you may +distribute the object code for the work under the terms of Section 6. +Any executables containing that work also fall under Section 6, +whether or not they are linked directly with the Library itself. + + 6. As an exception to the Sections above, you may also combine or +link a "work that uses the Library" with the Library to produce a +work containing portions of the Library, and distribute that work +under terms of your choice, provided that the terms permit +modification of the work for the customer's own use and reverse +engineering for debugging such modifications. + + You must give prominent notice with each copy of the work that the +Library is used in it and that the Library and its use are covered by +this License. You must supply a copy of this License. If the work +during execution displays copyright notices, you must include the +copyright notice for the Library among them, as well as a reference +directing the user to the copy of this License. Also, you must do one +of these things: + + a) Accompany the work with the complete corresponding + machine-readable source code for the Library including whatever + changes were used in the work (which must be distributed under + Sections 1 and 2 above); and, if the work is an executable linked + with the Library, with the complete machine-readable "work that + uses the Library", as object code and/or source code, so that the + user can modify the Library and then relink to produce a modified + executable containing the modified Library. (It is understood + that the user who changes the contents of definitions files in the + Library will not necessarily be able to recompile the application + to use the modified definitions.) + + b) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (1) uses at run time a + copy of the library already present on the user's computer system, + rather than copying library functions into the executable, and (2) + will operate properly with a modified version of the library, if + the user installs one, as long as the modified version is + interface-compatible with the version that the work was made with. + + c) Accompany the work with a written offer, valid for at + least three years, to give the same user the materials + specified in Subsection 6a, above, for a charge no more + than the cost of performing this distribution. + + d) If distribution of the work is made by offering access to copy + from a designated place, offer equivalent access to copy the above + specified materials from the same place. + + e) Verify that the user has already received a copy of these + materials or that you have already sent this user a copy. + + For an executable, the required form of the "work that uses the +Library" must include any data and utility programs needed for +reproducing the executable from it. However, as a special exception, +the materials to be distributed need not include anything that is +normally distributed (in either source or binary form) with the major +components (compiler, kernel, and so on) of the operating system on +which the executable runs, unless that component itself accompanies +the executable. + + It may happen that this requirement contradicts the license +restrictions of other proprietary libraries that do not normally +accompany the operating system. Such a contradiction means you cannot +use both them and the Library together in an executable that you +distribute. + + 7. You may place library facilities that are a work based on the +Library side-by-side in a single library together with other library +facilities not covered by this License, and distribute such a combined +library, provided that the separate distribution of the work based on +the Library and of the other library facilities is otherwise +permitted, and provided that you do these two things: + + a) Accompany the combined library with a copy of the same work + based on the Library, uncombined with any other library + facilities. This must be distributed under the terms of the + Sections above. + + b) Give prominent notice with the combined library of the fact + that part of it is a work based on the Library, and explaining + where to find the accompanying uncombined form of the same work. + + 8. You may not copy, modify, sublicense, link with, or distribute +the Library except as expressly provided under this License. Any +attempt otherwise to copy, modify, sublicense, link with, or +distribute the Library is void, and will automatically terminate your +rights under this License. However, parties who have received copies, +or rights, from you under this License will not have their licenses +terminated so long as such parties remain in full compliance. + + 9. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Library or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Library (or any work based on the +Library), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Library or works based on it. + + 10. Each time you redistribute the Library (or any work based on the +Library), the recipient automatically receives a license from the +original licensor to copy, distribute, link with or modify the Library +subject to these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties with +this License. + + 11. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Library at all. For example, if a patent +license would not permit royalty-free redistribution of the Library by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Library. + +If any portion of this section is held invalid or unenforceable under any +particular circumstance, the balance of the section is intended to apply, +and the section as a whole is intended to apply in other circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 12. If the distribution and/or use of the Library is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Library under this License may add +an explicit geographical distribution limitation excluding those countries, +so that distribution is permitted only in or among countries not thus +excluded. In such case, this License incorporates the limitation as if +written in the body of this License. + + 13. The Free Software Foundation may publish revised and/or new +versions of the Lesser General Public License from time to time. +Such new versions will be similar in spirit to the present version, +but may differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Library +specifies a version number of this License which applies to it and +"any later version", you have the option of following the terms and +conditions either of that version or of any later version published by +the Free Software Foundation. If the Library does not specify a +license version number, you may choose any version ever published by +the Free Software Foundation. + + 14. If you wish to incorporate parts of the Library into other free +programs whose distribution conditions are incompatible with these, +write to the author to ask for permission. For software which is +copyrighted by the Free Software Foundation, write to the Free +Software Foundation; we sometimes make exceptions for this. Our +decision will be guided by the two goals of preserving the free status +of all derivatives of our free software and of promoting the sharing +and reuse of software generally. + + NO WARRANTY + + 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO +WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. +EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR +OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY +KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE +LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME +THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN +WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY +AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU +FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR +CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE +LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING +RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A +FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF +SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Libraries + + If you develop a new library, and you want it to be of the greatest +possible use to the public, we recommend making it free software that +everyone can redistribute and change. You can do so by permitting +redistribution under these terms (or, alternatively, under the terms of the +ordinary General Public License). + + To apply these terms, attach the following notices to the library. It is +safest to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least the +"copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +Also add information on how to contact you by electronic and paper mail. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the library, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the + library `Frob' (a library for tweaking knobs) written by James Random Hacker. + + , 1 April 1990 + Ty Coon, President of Vice + +That's all there is to it! + + + +============================================================ +Notices for file(s): +/toolchains/lib/skia_mac.a +/toolchains/lib/skia_ohos.a +------------------------------------------------------------ +Notices for software(s): +Software: +Path: //third_party/skia +------------------------------------------------------------ +Copyright (c) 2011 Google Inc. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + + * Neither the name of the copyright holder nor the names of its + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +============================================================ +Notices for file(s): +/ets/build-tools/ets-loader/bin/ark/build-mac/bin/es2abc +/ets/build-tools/ets-loader/bin/ark/build-mac/bin/merge_abc +/ets/build-tools/ets-loader/bin/ark/build-mac/legacy_api8 +/ets/build-tools/ets-loader/bin/ark/build-mac/legacy_api8/bin/js2abc +/ets/build-tools/ets-loader/bin/ark/build-mac/legacy_api8/node_modules +/ets/build-tools/ets-loader/bin/ark/build-mac/legacy_api8/package-lock.json +/ets/build-tools/ets-loader/bin/ark/build-mac/legacy_api8/package.json +/ets/build-tools/ets-loader/bin/ark/build-mac/legacy_api8/src/index.js +/ets/build-tools/ets-loader/bin/ark/ts2abc.js +/js/build-tools/ace-loader/bin/ark/build-mac/bin/es2abc +/js/build-tools/ace-loader/bin/ark/build-mac/bin/merge_abc +/js/build-tools/ace-loader/bin/ark/build-mac/legacy_api8 +/js/build-tools/ace-loader/bin/ark/build-mac/legacy_api8/bin/js2abc +/js/build-tools/ace-loader/bin/ark/build-mac/legacy_api8/node_modules +/js/build-tools/ace-loader/bin/ark/build-mac/legacy_api8/package-lock.json +/js/build-tools/ace-loader/bin/ark/build-mac/legacy_api8/package.json +/js/build-tools/ace-loader/bin/ark/build-mac/legacy_api8/src/index.js +/js/build-tools/ace-loader/bin/ark/ts2abc.js +/toolchains/lib/assembly_proto_static.a +/toolchains/lib/es2panda_lib.a +/toolchains/lib/panda_assembly_proto_static.a +------------------------------------------------------------ +Notices for software(s): +Software: +Path: //arkcompiler/ets_frontend/es2panda +Software: +Path: //arkcompiler/ets_frontend/merge_abc +Software: +Path: //arkcompiler/ets_frontend/legacy_bin +------------------------------------------------------------ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + The "ts2panda\scripts\diagnosticMessages.json" file may contain + some information or content from the following software: + TypeScript + /*! ***************************************************************************** + Copyright (c) Microsoft Corporation. All rights reserved. + Licensed under the Apache License, Version 2.0 (the "License"); you may not use + this file except in compliance with the License. You may obtain a copy of the + License at http://www.apache.org/licenses/LICENSE-2.0 + + THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED + WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, + MERCHANTABLITY OR NON-INFRINGEMENT. + + See the Apache Version 2.0 License for specific language governing permissions + and limitations under the License. + ***************************************************************************** */ + Apache License 2.0 +============================================================ +Notices for file(s): +/toolchains/lib/node_header_notice.a +------------------------------------------------------------ +Notices for software(s): +Software: node v18.20.1 +Path: //third_party/node +------------------------------------------------------------ +Node.js is licensed for use as follows: + +""" +Copyright Node.js contributors. All rights reserved. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to +deal in the Software without restriction, including without limitation the +rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +sell copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +IN THE SOFTWARE. +""" + +This license applies to parts of Node.js originating from the +https://github.com/joyent/node repository: + +""" +Copyright Joyent, Inc. and other Node contributors. All rights reserved. +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to +deal in the Software without restriction, including without limitation the +rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +sell copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +IN THE SOFTWARE. +""" + +The Node.js license applies to all parts of Node.js that are not externally +maintained libraries. + +The externally maintained libraries used by Node.js are: + +- Acorn, located at deps/acorn, is licensed as follows: + """ + MIT License + + Copyright (C) 2012-2022 by various contributors (see AUTHORS) + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + """ + +- c-ares, located at deps/cares, is licensed as follows: + """ + MIT License + + Copyright (c) 1998 Massachusetts Institute of Technology + Copyright (c) 2007 - 2023 Daniel Stenberg with many contributors, see AUTHORS + file. + + Permission is hereby granted, free of charge, to any person obtaining a copy of + this software and associated documentation files (the "Software"), to deal in + the Software without restriction, including without limitation the rights to + use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + the Software, and to permit persons to whom the Software is furnished to do so, + subject to the following conditions: + + The above copyright notice and this permission notice (including the next + paragraph) shall be included in all copies or substantial portions of the + Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE. + """ + +- cjs-module-lexer, located at deps/cjs-module-lexer, is licensed as follows: + """ + MIT License + ----------- + + Copyright (C) 2018-2020 Guy Bedford + + Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + """ + +- ittapi, located at deps/v8/third_party/ittapi, is licensed as follows: + """ + Copyright (c) 2019 Intel Corporation. All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. + 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + """ + +- ICU, located at deps/icu-small, is licensed as follows: + """ + UNICODE, INC. LICENSE AGREEMENT - DATA FILES AND SOFTWARE + + See Terms of Use + for definitions of Unicode Inc.’s Data Files and Software. + + NOTICE TO USER: Carefully read the following legal agreement. + BY DOWNLOADING, INSTALLING, COPYING OR OTHERWISE USING UNICODE INC.'S + DATA FILES ("DATA FILES"), AND/OR SOFTWARE ("SOFTWARE"), + YOU UNEQUIVOCALLY ACCEPT, AND AGREE TO BE BOUND BY, ALL OF THE + TERMS AND CONDITIONS OF THIS AGREEMENT. + IF YOU DO NOT AGREE, DO NOT DOWNLOAD, INSTALL, COPY, DISTRIBUTE OR USE + THE DATA FILES OR SOFTWARE. + + COPYRIGHT AND PERMISSION NOTICE + + Copyright © 1991-2023 Unicode, Inc. All rights reserved. + Distributed under the Terms of Use in https://www.unicode.org/copyright.html. + + Permission is hereby granted, free of charge, to any person obtaining + a copy of the Unicode data files and any associated documentation + (the "Data Files") or Unicode software and any associated documentation + (the "Software") to deal in the Data Files or Software + without restriction, including without limitation the rights to use, + copy, modify, merge, publish, distribute, and/or sell copies of + the Data Files or Software, and to permit persons to whom the Data Files + or Software are furnished to do so, provided that either + (a) this copyright and permission notice appear with all copies + of the Data Files or Software, or + (b) this copyright and permission notice appear in associated + Documentation. + + THE DATA FILES AND SOFTWARE ARE PROVIDED "AS IS", WITHOUT WARRANTY OF + ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE + WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT OF THIRD PARTY RIGHTS. + IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN THIS + NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL + DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + PERFORMANCE OF THE DATA FILES OR SOFTWARE. + + Except as contained in this notice, the name of a copyright holder + shall not be used in advertising or otherwise to promote the sale, + use or other dealings in these Data Files or Software without prior + written authorization of the copyright holder. + + ---------------------------------------------------------------------- + + Third-Party Software Licenses + + This section contains third-party software notices and/or additional + terms for licensed third-party software components included within ICU + libraries. + + ---------------------------------------------------------------------- + + ICU License - ICU 1.8.1 to ICU 57.1 + + COPYRIGHT AND PERMISSION NOTICE + + Copyright (c) 1995-2016 International Business Machines Corporation and others + All rights reserved. + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, and/or sell copies of the Software, and to permit persons + to whom the Software is furnished to do so, provided that the above + copyright notice(s) and this permission notice appear in all copies of + the Software and that both the above copyright notice(s) and this + permission notice appear in supporting documentation. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT + OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR + HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY + SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER + RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF + CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN + CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + + Except as contained in this notice, the name of a copyright holder + shall not be used in advertising or otherwise to promote the sale, use + or other dealings in this Software without prior written authorization + of the copyright holder. + + All trademarks and registered trademarks mentioned herein are the + property of their respective owners. + + ---------------------------------------------------------------------- + + Chinese/Japanese Word Break Dictionary Data (cjdict.txt) + + # The Google Chrome software developed by Google is licensed under + # the BSD license. Other software included in this distribution is + # provided under other licenses, as set forth below. + # + # The BSD License + # http://opensource.org/licenses/bsd-license.php + # Copyright (C) 2006-2008, Google Inc. + # + # All rights reserved. + # + # Redistribution and use in source and binary forms, with or without + # modification, are permitted provided that the following conditions are met: + # + # Redistributions of source code must retain the above copyright notice, + # this list of conditions and the following disclaimer. + # Redistributions in binary form must reproduce the above + # copyright notice, this list of conditions and the following + # disclaimer in the documentation and/or other materials provided with + # the distribution. + # Neither the name of Google Inc. nor the names of its + # contributors may be used to endorse or promote products derived from + # this software without specific prior written permission. + # + # + # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND + # CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + # INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + # DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + # BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + # LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + # + # + # The word list in cjdict.txt are generated by combining three word lists + # listed below with further processing for compound word breaking. The + # frequency is generated with an iterative training against Google web + # corpora. + # + # * Libtabe (Chinese) + # - https://sourceforge.net/project/?group_id=1519 + # - Its license terms and conditions are shown below. + # + # * IPADIC (Japanese) + # - http://chasen.aist-nara.ac.jp/chasen/distribution.html + # - Its license terms and conditions are shown below. + # + # ---------COPYING.libtabe ---- BEGIN-------------------- + # + # /* + # * Copyright (c) 1999 TaBE Project. + # * Copyright (c) 1999 Pai-Hsiang Hsiao. + # * All rights reserved. + # * + # * Redistribution and use in source and binary forms, with or without + # * modification, are permitted provided that the following conditions + # * are met: + # * + # * . Redistributions of source code must retain the above copyright + # * notice, this list of conditions and the following disclaimer. + # * . Redistributions in binary form must reproduce the above copyright + # * notice, this list of conditions and the following disclaimer in + # * the documentation and/or other materials provided with the + # * distribution. + # * . Neither the name of the TaBE Project nor the names of its + # * contributors may be used to endorse or promote products derived + # * from this software without specific prior written permission. + # * + # * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + # * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + # * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + # * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + # * REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + # * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + # * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + # * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + # * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + # * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + # * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + # * OF THE POSSIBILITY OF SUCH DAMAGE. + # */ + # + # /* + # * Copyright (c) 1999 Computer Systems and Communication Lab, + # * Institute of Information Science, Academia + # * Sinica. All rights reserved. + # * + # * Redistribution and use in source and binary forms, with or without + # * modification, are permitted provided that the following conditions + # * are met: + # * + # * . Redistributions of source code must retain the above copyright + # * notice, this list of conditions and the following disclaimer. + # * . Redistributions in binary form must reproduce the above copyright + # * notice, this list of conditions and the following disclaimer in + # * the documentation and/or other materials provided with the + # * distribution. + # * . Neither the name of the Computer Systems and Communication Lab + # * nor the names of its contributors may be used to endorse or + # * promote products derived from this software without specific + # * prior written permission. + # * + # * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + # * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + # * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + # * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + # * REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + # * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + # * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + # * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + # * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + # * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + # * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + # * OF THE POSSIBILITY OF SUCH DAMAGE. + # */ + # + # Copyright 1996 Chih-Hao Tsai @ Beckman Institute, + # University of Illinois + # c-tsai4@uiuc.edu http://casper.beckman.uiuc.edu/~c-tsai4 + # + # ---------------COPYING.libtabe-----END-------------------------------- + # + # + # ---------------COPYING.ipadic-----BEGIN------------------------------- + # + # Copyright 2000, 2001, 2002, 2003 Nara Institute of Science + # and Technology. All Rights Reserved. + # + # Use, reproduction, and distribution of this software is permitted. + # Any copy of this software, whether in its original form or modified, + # must include both the above copyright notice and the following + # paragraphs. + # + # Nara Institute of Science and Technology (NAIST), + # the copyright holders, disclaims all warranties with regard to this + # software, including all implied warranties of merchantability and + # fitness, in no event shall NAIST be liable for + # any special, indirect or consequential damages or any damages + # whatsoever resulting from loss of use, data or profits, whether in an + # action of contract, negligence or other tortuous action, arising out + # of or in connection with the use or performance of this software. + # + # A large portion of the dictionary entries + # originate from ICOT Free Software. The following conditions for ICOT + # Free Software applies to the current dictionary as well. + # + # Each User may also freely distribute the Program, whether in its + # original form or modified, to any third party or parties, PROVIDED + # that the provisions of Section 3 ("NO WARRANTY") will ALWAYS appear + # on, or be attached to, the Program, which is distributed substantially + # in the same form as set out herein and that such intended + # distribution, if actually made, will neither violate or otherwise + # contravene any of the laws and regulations of the countries having + # jurisdiction over the User or the intended distribution itself. + # + # NO WARRANTY + # + # The program was produced on an experimental basis in the course of the + # research and development conducted during the project and is provided + # to users as so produced on an experimental basis. Accordingly, the + # program is provided without any warranty whatsoever, whether express, + # implied, statutory or otherwise. The term "warranty" used herein + # includes, but is not limited to, any warranty of the quality, + # performance, merchantability and fitness for a particular purpose of + # the program and the nonexistence of any infringement or violation of + # any right of any third party. + # + # Each user of the program will agree and understand, and be deemed to + # have agreed and understood, that there is no warranty whatsoever for + # the program and, accordingly, the entire risk arising from or + # otherwise connected with the program is assumed by the user. + # + # Therefore, neither ICOT, the copyright holder, or any other + # organization that participated in or was otherwise related to the + # development of the program and their respective officials, directors, + # officers and other employees shall be held liable for any and all + # damages, including, without limitation, general, special, incidental + # and consequential damages, arising out of or otherwise in connection + # with the use or inability to use the program or any product, material + # or result produced or otherwise obtained by using the program, + # regardless of whether they have been advised of, or otherwise had + # knowledge of, the possibility of such damages at any time during the + # project or thereafter. Each user will be deemed to have agreed to the + # foregoing by his or her commencement of use of the program. The term + # "use" as used herein includes, but is not limited to, the use, + # modification, copying and distribution of the program and the + # production of secondary products from the program. + # + # In the case where the program, whether in its original form or + # modified, was distributed or delivered to or received by a user from + # any person, organization or entity other than ICOT, unless it makes or + # grants independently of ICOT any specific warranty to the user in + # writing, such person, organization or entity, will also be exempted + # from and not be held liable to the user for any such damages as noted + # above as far as the program is concerned. + # + # ---------------COPYING.ipadic-----END---------------------------------- + + ---------------------------------------------------------------------- + + Lao Word Break Dictionary Data (laodict.txt) + + # Copyright (C) 2016 and later: Unicode, Inc. and others. + # License & terms of use: http://www.unicode.org/copyright.html + # Copyright (c) 2015 International Business Machines Corporation + # and others. All Rights Reserved. + # + # Project: https://github.com/rober42539/lao-dictionary + # Dictionary: https://github.com/rober42539/lao-dictionary/laodict.txt + # License: https://github.com/rober42539/lao-dictionary/LICENSE.txt + # (copied below) + # + # This file is derived from the above dictionary version of Nov 22, 2020 + # ---------------------------------------------------------------------- + # Copyright (C) 2013 Brian Eugene Wilson, Robert Martin Campbell. + # All rights reserved. + # + # Redistribution and use in source and binary forms, with or without + # modification, are permitted provided that the following conditions are met: + # + # Redistributions of source code must retain the above copyright notice, this + # list of conditions and the following disclaimer. Redistributions in binary + # form must reproduce the above copyright notice, this list of conditions and + # the following disclaimer in the documentation and/or other materials + # provided with the distribution. + # + # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + # FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + # COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + # INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + # SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + # STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + # OF THE POSSIBILITY OF SUCH DAMAGE. + # -------------------------------------------------------------------------- + + ---------------------------------------------------------------------- + + Burmese Word Break Dictionary Data (burmesedict.txt) + + # Copyright (c) 2014 International Business Machines Corporation + # and others. All Rights Reserved. + # + # This list is part of a project hosted at: + # github.com/kanyawtech/myanmar-karen-word-lists + # + # -------------------------------------------------------------------------- + # Copyright (c) 2013, LeRoy Benjamin Sharon + # All rights reserved. + # + # Redistribution and use in source and binary forms, with or without + # modification, are permitted provided that the following conditions + # are met: Redistributions of source code must retain the above + # copyright notice, this list of conditions and the following + # disclaimer. Redistributions in binary form must reproduce the + # above copyright notice, this list of conditions and the following + # disclaimer in the documentation and/or other materials provided + # with the distribution. + # + # Neither the name Myanmar Karen Word Lists, nor the names of its + # contributors may be used to endorse or promote products derived + # from this software without specific prior written permission. + # + # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND + # CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + # INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + # DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS + # BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED + # TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + # ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + # TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF + # THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + # SUCH DAMAGE. + # -------------------------------------------------------------------------- + + ---------------------------------------------------------------------- + + Time Zone Database + + ICU uses the public domain data and code derived from Time Zone + Database for its time zone support. The ownership of the TZ database + is explained in BCP 175: Procedure for Maintaining the Time Zone + Database section 7. + + # 7. Database Ownership + # + # The TZ database itself is not an IETF Contribution or an IETF + # document. Rather it is a pre-existing and regularly updated work + # that is in the public domain, and is intended to remain in the + # public domain. Therefore, BCPs 78 [RFC5378] and 79 [RFC3979] do + # not apply to the TZ Database or contributions that individuals make + # to it. Should any claims be made and substantiated against the TZ + # Database, the organization that is providing the IANA + # Considerations defined in this RFC, under the memorandum of + # understanding with the IETF, currently ICANN, may act in accordance + # with all competent court orders. No ownership claims will be made + # by ICANN or the IETF Trust on the database or the code. Any person + # making a contribution to the database or code waives all rights to + # future claims in that contribution or in the TZ Database. + + ---------------------------------------------------------------------- + + Google double-conversion + + Copyright 2006-2011, the V8 project authors. All rights reserved. + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are + met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + * Neither the name of Google Inc. nor the names of its + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + ---------------------------------------------------------------------- + + File: aclocal.m4 (only for ICU4C) + Section: pkg.m4 - Macros to locate and utilise pkg-config. + + Copyright © 2004 Scott James Remnant . + Copyright © 2012-2015 Dan Nicholson + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + 02111-1307, USA. + + As a special exception to the GNU General Public License, if you + distribute this file as part of a program that contains a + configuration script generated by Autoconf, you may include it under + the same distribution terms that you use for the rest of that + program. + + (The condition for the exception is fulfilled because + ICU4C includes a configuration script generated by Autoconf, + namely the `configure` script.) + + ---------------------------------------------------------------------- + + File: config.guess (only for ICU4C) + + This file is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, see . + + As a special exception to the GNU General Public License, if you + distribute this file as part of a program that contains a + configuration script generated by Autoconf, you may include it under + the same distribution terms that you use for the rest of that + program. This Exception is an additional permission under section 7 + of the GNU General Public License, version 3 ("GPLv3"). + + (The condition for the exception is fulfilled because + ICU4C includes a configuration script generated by Autoconf, + namely the `configure` script.) + + ---------------------------------------------------------------------- + + File: install-sh (only for ICU4C) + + Copyright 1991 by the Massachusetts Institute of Technology + + Permission to use, copy, modify, distribute, and sell this software and its + documentation for any purpose is hereby granted without fee, provided that + the above copyright notice appear in all copies and that both that + copyright notice and this permission notice appear in supporting + documentation, and that the name of M.I.T. not be used in advertising or + publicity pertaining to distribution of the software without specific, + written prior permission. M.I.T. makes no representations about the + suitability of this software for any purpose. It is provided "as is" + without express or implied warranty. + """ + +- libuv, located at deps/uv, is licensed as follows: + """ + Copyright (c) 2015-present libuv project contributors. + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to + deal in the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + sell copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + IN THE SOFTWARE. + This license applies to parts of libuv originating from the + https://github.com/joyent/libuv repository: + + ==== + + Copyright Joyent, Inc. and other Node contributors. All rights reserved. + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to + deal in the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + sell copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + IN THE SOFTWARE. + + ==== + + This license applies to all parts of libuv that are not externally + maintained libraries. + + The externally maintained libraries used by libuv are: + + - tree.h (from FreeBSD), copyright Niels Provos. Two clause BSD license. + + - inet_pton and inet_ntop implementations, contained in src/inet.c, are + copyright the Internet Systems Consortium, Inc., and licensed under the ISC + license. + """ + +- llhttp, located at deps/llhttp, is licensed as follows: + """ + This software is licensed under the MIT License. + + Copyright Fedor Indutny, 2018. + + Permission is hereby granted, free of charge, to any person obtaining a + copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to permit + persons to whom the Software is furnished to do so, subject to the + following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN + NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, + DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + USE OR OTHER DEALINGS IN THE SOFTWARE. + """ + +- corepack, located at deps/corepack, is licensed as follows: + """ + **Copyright © Corepack contributors** + + Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + """ + +- undici, located at deps/undici, is licensed as follows: + """ + MIT License + + Copyright (c) Matteo Collina and Undici contributors + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all + copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE. + """ + +- postject, located at test/fixtures/postject-copy, is licensed as follows: + """ + Postject is licensed for use as follows: + + """ + MIT License + + Copyright (c) 2022 Postman, Inc + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all + copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE. + """ + + The Postject license applies to all parts of Postject that are not externally + maintained libraries. + + The externally maintained libraries used by Postject are: + + - LIEF, located at vendor/LIEF, is licensed as follows: + """ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "{}" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright 2017 - 2022 R. Thomas + Copyright 2017 - 2022 Quarkslab + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + """ + """ + +- OpenSSL, located at deps/openssl, is licensed as follows: + """ + Apache License + Version 2.0, January 2004 + https://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + """ + +- Punycode.js, located at lib/punycode.js, is licensed as follows: + """ + Copyright Mathias Bynens + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE + LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + """ + +- V8, located at deps/v8, is licensed as follows: + """ + This license applies to all parts of V8 that are not externally + maintained libraries. The externally maintained libraries used by V8 + are: + + - PCRE test suite, located in + test/mjsunit/third_party/regexp-pcre/regexp-pcre.js. This is based on the + test suite from PCRE-7.3, which is copyrighted by the University + of Cambridge and Google, Inc. The copyright notice and license + are embedded in regexp-pcre.js. + + - Layout tests, located in test/mjsunit/third_party/object-keys. These are + based on layout tests from webkit.org which are copyrighted by + Apple Computer, Inc. and released under a 3-clause BSD license. + + - Strongtalk assembler, the basis of the files assembler-arm-inl.h, + assembler-arm.cc, assembler-arm.h, assembler-ia32-inl.h, + assembler-ia32.cc, assembler-ia32.h, assembler-x64-inl.h, + assembler-x64.cc, assembler-x64.h, assembler.cc and assembler.h. + This code is copyrighted by Sun Microsystems Inc. and released + under a 3-clause BSD license. + + - Valgrind client API header, located at src/third_party/valgrind/valgrind.h + This is released under the BSD license. + + - The Wasm C/C++ API headers, located at third_party/wasm-api/wasm.{h,hh} + This is released under the Apache license. The API's upstream prototype + implementation also formed the basis of V8's implementation in + src/wasm/c-api.cc. + + These libraries have their own licenses; we recommend you read them, + as their terms may differ from the terms below. + + Further license information can be found in LICENSE files located in + sub-directories. + + Copyright 2014, the V8 project authors. All rights reserved. + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are + met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + * Neither the name of Google Inc. nor the names of its + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + """ + +- SipHash, located at deps/v8/src/third_party/siphash, is licensed as follows: + """ + SipHash reference C implementation + + Copyright (c) 2016 Jean-Philippe Aumasson + + To the extent possible under law, the author(s) have dedicated all + copyright and related and neighboring rights to this software to the public + domain worldwide. This software is distributed without any warranty. + """ + +- zlib, located at deps/zlib, is licensed as follows: + """ + zlib.h -- interface of the 'zlib' general purpose compression library + version 1.2.13.1, October xxth, 2022 + + Copyright (C) 1995-2022 Jean-loup Gailly and Mark Adler + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. + + Jean-loup Gailly Mark Adler + jloup@gzip.org madler@alumni.caltech.edu + """ + +- simdutf, located at deps/simdutf, is licensed as follows: + """ + Copyright 2021 The simdutf authors + + Permission is hereby granted, free of charge, to any person obtaining a copy of + this software and associated documentation files (the "Software"), to deal in + the Software without restriction, including without limitation the rights to + use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + the Software, and to permit persons to whom the Software is furnished to do so, + subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all + copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS + FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER + IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + """ + +- ada, located at deps/ada, is licensed as follows: + """ + Copyright 2023 Yagiz Nizipli and Daniel Lemire + + Permission is hereby granted, free of charge, to any person obtaining a copy of + this software and associated documentation files (the "Software"), to deal in + the Software without restriction, including without limitation the rights to + use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + the Software, and to permit persons to whom the Software is furnished to do so, + subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all + copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS + FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER + IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + """ + +- minimatch, located at deps/minimatch, is licensed as follows: + """ + The ISC License + + Copyright (c) 2011-2023 Isaac Z. Schlueter and Contributors + + Permission to use, copy, modify, and/or distribute this software for any + purpose with or without fee is hereby granted, provided that the above + copyright notice and this permission notice appear in all copies. + + THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR + IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + """ + +- npm, located at deps/npm, is licensed as follows: + """ + The npm application + Copyright (c) npm, Inc. and Contributors + Licensed on the terms of The Artistic License 2.0 + + Node package dependencies of the npm application + Copyright (c) their respective copyright owners + Licensed on their respective license terms + + The npm public registry at https://registry.npmjs.org + and the npm website at https://www.npmjs.com + Operated by npm, Inc. + Use governed by terms published on https://www.npmjs.com + + "Node.js" + Trademark Joyent, Inc., https://joyent.com + Neither npm nor npm, Inc. are affiliated with Joyent, Inc. + + The Node.js application + Project of Node Foundation, https://nodejs.org + + The npm Logo + Copyright (c) Mathias Pettersson and Brian Hammond + + "Gubblebum Blocky" typeface + Copyright (c) Tjarda Koster, https://jelloween.deviantart.com + Used with permission + + -------- + + The Artistic License 2.0 + + Copyright (c) 2000-2006, The Perl Foundation. + + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + This license establishes the terms under which a given free software + Package may be copied, modified, distributed, and/or redistributed. + The intent is that the Copyright Holder maintains some artistic + control over the development of that Package while still keeping the + Package available as open source and free software. + + You are always permitted to make arrangements wholly outside of this + license directly with the Copyright Holder of a given Package. If the + terms of this license do not permit the full use that you propose to + make of the Package, you should contact the Copyright Holder and seek + a different licensing arrangement. + + Definitions + + "Copyright Holder" means the individual(s) or organization(s) + named in the copyright notice for the entire Package. + + "Contributor" means any party that has contributed code or other + material to the Package, in accordance with the Copyright Holder's + procedures. + + "You" and "your" means any person who would like to copy, + distribute, or modify the Package. + + "Package" means the collection of files distributed by the + Copyright Holder, and derivatives of that collection and/or of + those files. A given Package may consist of either the Standard + Version, or a Modified Version. + + "Distribute" means providing a copy of the Package or making it + accessible to anyone else, or in the case of a company or + organization, to others outside of your company or organization. + + "Distributor Fee" means any fee that you charge for Distributing + this Package or providing support for this Package to another + party. It does not mean licensing fees. + + "Standard Version" refers to the Package if it has not been + modified, or has been modified only in ways explicitly requested + by the Copyright Holder. + + "Modified Version" means the Package, if it has been changed, and + such changes were not explicitly requested by the Copyright + Holder. + + "Original License" means this Artistic License as Distributed with + the Standard Version of the Package, in its current version or as + it may be modified by The Perl Foundation in the future. + + "Source" form means the source code, documentation source, and + configuration files for the Package. + + "Compiled" form means the compiled bytecode, object code, binary, + or any other form resulting from mechanical transformation or + translation of the Source form. + + Permission for Use and Modification Without Distribution + + (1) You are permitted to use the Standard Version and create and use + Modified Versions for any purpose without restriction, provided that + you do not Distribute the Modified Version. + + Permissions for Redistribution of the Standard Version + + (2) You may Distribute verbatim copies of the Source form of the + Standard Version of this Package in any medium without restriction, + either gratis or for a Distributor Fee, provided that you duplicate + all of the original copyright notices and associated disclaimers. At + your discretion, such verbatim copies may or may not include a + Compiled form of the Package. + + (3) You may apply any bug fixes, portability changes, and other + modifications made available from the Copyright Holder. The resulting + Package will still be considered the Standard Version, and as such + will be subject to the Original License. + + Distribution of Modified Versions of the Package as Source + + (4) You may Distribute your Modified Version as Source (either gratis + or for a Distributor Fee, and with or without a Compiled form of the + Modified Version) provided that you clearly document how it differs + from the Standard Version, including, but not limited to, documenting + any non-standard features, executables, or modules, and provided that + you do at least ONE of the following: + + (a) make the Modified Version available to the Copyright Holder + of the Standard Version, under the Original License, so that the + Copyright Holder may include your modifications in the Standard + Version. + + (b) ensure that installation of your Modified Version does not + prevent the user installing or running the Standard Version. In + addition, the Modified Version must bear a name that is different + from the name of the Standard Version. + + (c) allow anyone who receives a copy of the Modified Version to + make the Source form of the Modified Version available to others + under + + (i) the Original License or + + (ii) a license that permits the licensee to freely copy, + modify and redistribute the Modified Version using the same + licensing terms that apply to the copy that the licensee + received, and requires that the Source form of the Modified + Version, and of any works derived from it, be made freely + available in that license fees are prohibited but Distributor + Fees are allowed. + + Distribution of Compiled Forms of the Standard Version + or Modified Versions without the Source + + (5) You may Distribute Compiled forms of the Standard Version without + the Source, provided that you include complete instructions on how to + get the Source of the Standard Version. Such instructions must be + valid at the time of your distribution. If these instructions, at any + time while you are carrying out such distribution, become invalid, you + must provide new instructions on demand or cease further distribution. + If you provide valid instructions or cease distribution within thirty + days after you become aware that the instructions are invalid, then + you do not forfeit any of your rights under this license. + + (6) You may Distribute a Modified Version in Compiled form without + the Source, provided that you comply with Section 4 with respect to + the Source of the Modified Version. + + Aggregating or Linking the Package + + (7) You may aggregate the Package (either the Standard Version or + Modified Version) with other packages and Distribute the resulting + aggregation provided that you do not charge a licensing fee for the + Package. Distributor Fees are permitted, and licensing fees for other + components in the aggregation are permitted. The terms of this license + apply to the use and Distribution of the Standard or Modified Versions + as included in the aggregation. + + (8) You are permitted to link Modified and Standard Versions with + other works, to embed the Package in a larger work of your own, or to + build stand-alone binary or bytecode versions of applications that + include the Package, and Distribute the result without restriction, + provided the result does not expose a direct interface to the Package. + + Items That are Not Considered Part of a Modified Version + + (9) Works (including, but not limited to, modules and scripts) that + merely extend or make use of the Package, do not, by themselves, cause + the Package to be a Modified Version. In addition, such works are not + considered parts of the Package itself, and are not subject to the + terms of this license. + + General Provisions + + (10) Any use, modification, and distribution of the Standard or + Modified Versions is governed by this Artistic License. By using, + modifying or distributing the Package, you accept this license. Do not + use, modify, or distribute the Package, if you do not accept this + license. + + (11) If your Modified Version has been derived from a Modified + Version made by someone other than you, you are nevertheless required + to ensure that your Modified Version complies with the requirements of + this license. + + (12) This license does not grant you the right to use any trademark, + service mark, tradename, or logo of the Copyright Holder. + + (13) This license includes the non-exclusive, worldwide, + free-of-charge patent license to make, have made, use, offer to sell, + sell, import and otherwise transfer the Package with respect to any + patent claims licensable by the Copyright Holder that are necessarily + infringed by the Package. If you institute patent litigation + (including a cross-claim or counterclaim) against any party alleging + that the Package constitutes direct or contributory patent + infringement, then this Artistic License to you shall terminate on the + date that such litigation is filed. + + (14) Disclaimer of Warranty: + THE PACKAGE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS + IS' AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES. THE IMPLIED + WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR + NON-INFRINGEMENT ARE DISCLAIMED TO THE EXTENT PERMITTED BY YOUR LOCAL + LAW. UNLESS REQUIRED BY LAW, NO COPYRIGHT HOLDER OR CONTRIBUTOR WILL + BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL + DAMAGES ARISING IN ANY WAY OUT OF THE USE OF THE PACKAGE, EVEN IF + ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + -------- + """ + +- GYP, located at tools/gyp, is licensed as follows: + """ + Copyright (c) 2020 Node.js contributors. All rights reserved. + Copyright (c) 2009 Google Inc. All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are + met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following disclaimer + in the documentation and/or other materials provided with the + distribution. + * Neither the name of Google Inc. nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + """ + +- inspector_protocol, located at tools/inspector_protocol, is licensed as follows: + """ + // Copyright 2016 The Chromium Authors. All rights reserved. + // + // Redistribution and use in source and binary forms, with or without + // modification, are permitted provided that the following conditions are + // met: + // + // * Redistributions of source code must retain the above copyright + // notice, this list of conditions and the following disclaimer. + // * Redistributions in binary form must reproduce the above + // copyright notice, this list of conditions and the following disclaimer + // in the documentation and/or other materials provided with the + // distribution. + // * Neither the name of Google Inc. nor the names of its + // contributors may be used to endorse or promote products derived from + // this software without specific prior written permission. + // + // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + """ + +- jinja2, located at tools/inspector_protocol/jinja2, is licensed as follows: + """ + Copyright (c) 2009 by the Jinja Team, see AUTHORS for more details. + + Some rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are + met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + + * The names of the contributors may not be used to endorse or + promote products derived from this software without specific + prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + """ + +- markupsafe, located at tools/inspector_protocol/markupsafe, is licensed as follows: + """ + Copyright (c) 2010 by Armin Ronacher and contributors. See AUTHORS + for more details. + + Some rights reserved. + + Redistribution and use in source and binary forms of the software as well + as documentation, with or without modification, are permitted provided + that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + + * The names of the contributors may not be used to endorse or + promote products derived from this software without specific + prior written permission. + + THIS SOFTWARE AND DOCUMENTATION IS PROVIDED BY THE COPYRIGHT HOLDERS AND + CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT + NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER + OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE AND DOCUMENTATION, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH + DAMAGE. + """ + +- cpplint.py, located at tools/cpplint.py, is licensed as follows: + """ + Copyright (c) 2009 Google Inc. All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are + met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following disclaimer + in the documentation and/or other materials provided with the + distribution. + * Neither the name of Google Inc. nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + """ + +- ESLint, located at tools/node_modules/eslint, is licensed as follows: + """ + Copyright OpenJS Foundation and other contributors, + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + """ + +- gtest, located at deps/googletest, is licensed as follows: + """ + Copyright 2008, Google Inc. + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are + met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following disclaimer + in the documentation and/or other materials provided with the + distribution. + * Neither the name of Google Inc. nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + """ + +- nghttp2, located at deps/nghttp2, is licensed as follows: + """ + The MIT License + + Copyright (c) 2012, 2014, 2015, 2016 Tatsuhiro Tsujikawa + Copyright (c) 2012, 2014, 2015, 2016 nghttp2 contributors + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE + LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + """ + +- large_pages, located at src/large_pages, is licensed as follows: + """ + Copyright (C) 2018 Intel Corporation + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), + to deal in the Software without restriction, including without limitation + the rights to use, copy, modify, merge, publish, distribute, sublicense, + and/or sell copies of the Software, and to permit persons to whom + the Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL + THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES + OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE + OR OTHER DEALINGS IN THE SOFTWARE. + """ + +- caja, located at lib/internal/freeze_intrinsics.js, is licensed as follows: + """ + Adapted from SES/Caja - Copyright (C) 2011 Google Inc. + Copyright (C) 2018 Agoric + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + """ + +- brotli, located at deps/brotli, is licensed as follows: + """ + Copyright (c) 2009, 2010, 2013-2016 by the Brotli Authors. + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + """ + +- HdrHistogram, located at deps/histogram, is licensed as follows: + """ + The code in this repository code was Written by Gil Tene, Michael Barker, + and Matt Warren, and released to the public domain, as explained at + http://creativecommons.org/publicdomain/zero/1.0/ + + For users of this code who wish to consume it under the "BSD" license + rather than under the public domain or CC0 contribution text mentioned + above, the code found under this directory is *also* provided under the + following license (commonly referred to as the BSD 2-Clause License). This + license does not detract from the above stated release of the code into + the public domain, and simply represents an additional license granted by + the Author. + + ----------------------------------------------------------------------------- + ** Beginning of "BSD 2-Clause License" text. ** + + Copyright (c) 2012, 2013, 2014 Gil Tene + Copyright (c) 2014 Michael Barker + Copyright (c) 2014 Matt Warren + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + THE POSSIBILITY OF SUCH DAMAGE. + """ + +- highlight.js, located at doc/api_assets/highlight.pack.js, is licensed as follows: + """ + BSD 3-Clause License + + Copyright (c) 2006, Ivan Sagalaev. + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + * Neither the name of the copyright holder nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + """ + +- node-heapdump, located at src/heap_utils.cc, is licensed as follows: + """ + ISC License + + Copyright (c) 2012, Ben Noordhuis + + Permission to use, copy, modify, and/or distribute this software for any + purpose with or without fee is hereby granted, provided that the above + copyright notice and this permission notice appear in all copies. + + THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + + === src/compat.h src/compat-inl.h === + + ISC License + + Copyright (c) 2014, StrongLoop Inc. + + Permission to use, copy, modify, and/or distribute this software for any + purpose with or without fee is hereby granted, provided that the above + copyright notice and this permission notice appear in all copies. + + THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + """ + +- rimraf, located at lib/internal/fs/rimraf.js, is licensed as follows: + """ + The ISC License + + Copyright (c) Isaac Z. Schlueter and Contributors + + Permission to use, copy, modify, and/or distribute this software for any + purpose with or without fee is hereby granted, provided that the above + copyright notice and this permission notice appear in all copies. + + THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR + IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + """ + +- uvwasi, located at deps/uvwasi, is licensed as follows: + """ + MIT License + + Copyright (c) 2019 Colin Ihrig and Contributors + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all + copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE. + """ + +- ngtcp2, located at deps/ngtcp2/ngtcp2/, is licensed as follows: + """ + The MIT License + + Copyright (c) 2016 ngtcp2 contributors + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE + LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + """ + +- nghttp3, located at deps/ngtcp2/nghttp3/, is licensed as follows: + """ + The MIT License + + Copyright (c) 2019 nghttp3 contributors + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE + LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + """ + +- node-fs-extra, located at lib/internal/fs/cp, is licensed as follows: + """ + (The MIT License) + + Copyright (c) 2011-2017 JP Richardson + + Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files + (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, + merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE + WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS + OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + """ + +- base64, located at deps/base64/base64/, is licensed as follows: + """ + Copyright (c) 2005-2007, Nick Galbreath + Copyright (c) 2013-2019, Alfred Klomp + Copyright (c) 2015-2017, Wojciech Mula + Copyright (c) 2016-2017, Matthieu Darbois + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are + met: + + - Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + - Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS + IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A + PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED + TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + """ + +============================================================ +Notices for file(s): +/toolchains/lib/protobuf_lite_static.a +/toolchains/lib/protobuf_static.a +/toolchains/lib/protoc_static_lib.a +------------------------------------------------------------ +Notices for software(s): +Software: google/protobuf 3.13.0 +Path: //third_party/protobuf +------------------------------------------------------------ +Copyright 2008 Google Inc. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +Code generated by the Protocol Buffer compiler is owned by the owner +of the input file used when generating it. This code is not +standalone and requires a support library to be linked with it. This +support library is itself covered by the above license. + +============================================================ +Notices for file(s): +/toolchains/lib/crypto_source.a +/toolchains/lib/libcrypto_static.a +/toolchains/lib/ssl_source.a +------------------------------------------------------------ +Notices for software(s): +Software: OpenSSL 3.0.9 +Path: //third_party/openssl +------------------------------------------------------------ + + Apache License + Version 2.0, January 2004 + https://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + +============================================================ +Notices for file(s): +/toolchains/lib/turbojpeg_static.a +------------------------------------------------------------ +Notices for software(s): +Software: openEuler:libjpeg-turbo 2.1.1-3.oe2203sp1 +Path: //third_party/libjpeg-turbo +------------------------------------------------------------ +libjpeg-turbo Licenses +====================== + +libjpeg-turbo is covered by three compatible BSD-style open source licenses: + +- The IJG (Independent JPEG Group) License, which is listed in + [README.ijg](README.ijg) + + This license applies to the libjpeg API library and associated programs + (any code inherited from libjpeg, and any modifications to that code.) + +- The Modified (3-clause) BSD License, which is listed below + + This license covers the TurboJPEG API library and associated programs, as + well as the build system. + +- The [zlib License](https://opensource.org/licenses/Zlib) + + This license is a subset of the other two, and it covers the libjpeg-turbo + SIMD extensions. + + +Complying with the libjpeg-turbo Licenses +========================================= + +This section provides a roll-up of the libjpeg-turbo licensing terms, to the +best of our understanding. + +1. If you are distributing a modified version of the libjpeg-turbo source, + then: + + 1. You cannot alter or remove any existing copyright or license notices + from the source. + + **Origin** + - Clause 1 of the IJG License + - Clause 1 of the Modified BSD License + - Clauses 1 and 3 of the zlib License + + 2. You must add your own copyright notice to the header of each source + file you modified, so others can tell that you modified that file (if + there is not an existing copyright header in that file, then you can + simply add a notice stating that you modified the file.) + + **Origin** + - Clause 1 of the IJG License + - Clause 2 of the zlib License + + 3. You must include the IJG README file, and you must not alter any of the + copyright or license text in that file. + + **Origin** + - Clause 1 of the IJG License + +2. If you are distributing only libjpeg-turbo binaries without the source, or + if you are distributing an application that statically links with + libjpeg-turbo, then: + + 1. Your product documentation must include a message stating: + + This software is based in part on the work of the Independent JPEG + Group. + + **Origin** + - Clause 2 of the IJG license + + 2. If your binary distribution includes or uses the TurboJPEG API, then + your product documentation must include the text of the Modified BSD + License (see below.) + + **Origin** + - Clause 2 of the Modified BSD License + +3. You cannot use the name of the IJG or The libjpeg-turbo Project or the + contributors thereof in advertising, publicity, etc. + + **Origin** + - IJG License + - Clause 3 of the Modified BSD License + +4. The IJG and The libjpeg-turbo Project do not warrant libjpeg-turbo to be + free of defects, nor do we accept any liability for undesirable + consequences resulting from your use of the software. + + **Origin** + - IJG License + - Modified BSD License + - zlib License + + +The Modified (3-clause) BSD License +=================================== + +Copyright (C)2009-2021 D. R. Commander. All Rights Reserved.
+Copyright (C)2015 Viktor Szathmáry. All Rights Reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +- Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. +- Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. +- Neither the name of the libjpeg-turbo Project nor the names of its + contributors may be used to endorse or promote products derived from this + software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS", +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE +LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. + + +Why Three Licenses? +=================== + +The zlib License could have been used instead of the Modified (3-clause) BSD +License, and since the IJG License effectively subsumes the distribution +conditions of the zlib License, this would have effectively placed +libjpeg-turbo binary distributions under the IJG License. However, the IJG +License specifically refers to the Independent JPEG Group and does not extend +attribution and endorsement protections to other entities. Thus, it was +desirable to choose a license that granted us the same protections for new code +that were granted to the IJG for code derived from their software. + +============================================================ +Notices for file(s): +/js/build-tools/ace-loader/lib/parse +------------------------------------------------------------ +Notices for software(s): +Software: parse5 7.0.0 +Path: //third_party/parse5 +------------------------------------------------------------ +Copyright (c) 2013-2019 Ivan Nikulin (ifaaan@gmail.com, https://github.com/inikulin) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + +============================================================ +Notices for file(s): +/ets/build-tools/ets-loader/bin/ark/build-mac/aot/src +/ets/build-tools/ets-loader/bin/ark/build-mac/aot/src/lib_ark_builtins.d.ts +/ets/build-tools/ets-loader/bin/ark/build-mac/bin +/ets/build-tools/ets-loader/bin/ark/build-mac/bin/ark_aot_compiler +/ets/build-tools/ets-loader/bin/ark/build-mac/bin/libhilog_mac.dylib +/ets/build-tools/ets-loader/bin/ark/build-mac/bin/libhmicui18n.dylib +/ets/build-tools/ets-loader/bin/ark/build-mac/bin/libhmicuuc.dylib +/ets/build-tools/ets-loader/bin/ark/build-mac/bin/libsec_shared.dylib +/ets/build-tools/ets-loader/bin/ark/build-mac/bin/libshared_libz.dylib +/previewer/common/bin/Previewer +/previewer/common/bin/libide_extension.dylib +/previewer/common/bin/libide_util.dylib +/previewer/liteWearable/bin/Simulator +/toolchains/hnpcli +/toolchains/idl +/toolchains/lib/ace_kit_common_simulator.a +/toolchains/lib/ace_kit_deviceinfo_simulator.a +/toolchains/lib/ace_kit_file_simulator.a +/toolchains/lib/ace_kit_kvstore_simulator.a +/toolchains/lib/ace_lite.a +/toolchains/lib/cli_lite.a +/toolchains/lib/cli_rich.a +/toolchains/lib/jsapp_lite.a +/toolchains/lib/jsapp_rich.a +/toolchains/lib/libark_js_intl_arm_set.a +/toolchains/lib/libark_js_intl_set.a +/toolchains/lib/libark_jsoptimizer_set_with_maple.a +/toolchains/lib/libark_jsruntime_arm_set.a +/toolchains/lib/libark_jsruntime_set.a +/toolchains/lib/libark_jsruntime_static.a +/toolchains/lib/libark_mock_stub_set.a +/toolchains/lib/libcg.a +/toolchains/lib/libcgaarch64.a +/toolchains/lib/libcglowerer.a +/toolchains/lib/libcgphases.a +/toolchains/lib/libcgx8664.a +/toolchains/lib/libcommandline.a +/toolchains/lib/libdriver_option.a +/toolchains/lib/libhilognapi_src.a +/toolchains/lib/libmaple_driver.a +/toolchains/lib/libmempool.a +/toolchains/lib/libmpl2mpl.a +/toolchains/lib/libmplad.a +/toolchains/lib/libmplbe.a +/toolchains/lib/libmplir.a +/toolchains/lib/libmplme.a +/toolchains/lib/libmplpgo.a +/toolchains/lib/libmplphase.a +/toolchains/lib/libmplutil.a +/toolchains/lib/libnativeapi_battery_simulator.a +/toolchains/lib/mock_lite.a +/toolchains/lib/mock_rich.a +/toolchains/lib/sysparam_simulator.a +/toolchains/lib/util_lite.a +/toolchains/lib/util_rich.a +/toolchains/syscap_tool +------------------------------------------------------------ +Notices for software(s): +Software: +Path: //arkcompiler/ets_runtime/ecmascript/sdk +Software: +Path: //ide/tools/previewer +Software: +Path: //commonlibrary/utils_lite/js/builtin/simulator +Software: +Path: //foundation/arkui/ace_engine_lite/frameworks/targets/simulator +Software: +Path: //ide/tools/previewer/cli +Software: +Path: //ide/tools/previewer/jsapp +Software: +Path: //arkcompiler/ets_runtime +Software: +Path: //arkcompiler/ets_runtime/ecmascript/compiler +Software: +Path: //arkcompiler/ets_runtime/ecmascript/compiler/codegen/maple/maple_be +Software: +Path: //arkcompiler/ets_runtime/ecmascript/compiler/codegen/maple/maple_util +Software: +Path: //arkcompiler/ets_runtime/ecmascript/compiler/codegen/maple/maple_driver +Software: +Path: //base/hiviewdfx/hilog/interfaces/js/kits/napi +Software: +Path: //arkcompiler/ets_runtime/ecmascript/compiler/codegen/maple/mempool +Software: +Path: //arkcompiler/ets_runtime/ecmascript/compiler/codegen/maple/mpl2mpl +Software: +Path: //arkcompiler/ets_runtime/ecmascript/compiler/codegen/maple/maple_ir +Software: +Path: //arkcompiler/ets_runtime/ecmascript/compiler/codegen/maple/maple_me +Software: +Path: //arkcompiler/ets_runtime/ecmascript/compiler/codegen/maple/maple_pgo +Software: +Path: //arkcompiler/ets_runtime/ecmascript/compiler/codegen/maple/maple_phase +Software: +Path: //base/powermgr/powermgr_lite/interfaces/kits/battery/js/builtin +Software: +Path: //ide/tools/previewer/mock +Software: +Path: //base/startup/init/simulator +Software: +Path: //ide/tools/previewer/util +------------------------------------------------------------ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS +============================================================ +Notices for file(s): +/toolchains/lib/libuv_source.a +/toolchains/lib/uv_static.a +------------------------------------------------------------ +Notices for software(s): +Software: libuv v1.44.2 +Path: //third_party/libuv +------------------------------------------------------------ +libuv is licensed for use as follows: + +==== +Copyright (c) 2015-present libuv project contributors. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to +deal in the Software without restriction, including without limitation the +rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +sell copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +IN THE SOFTWARE. +==== + +This license applies to parts of libuv originating from the +https://github.com/joyent/libuv repository: + +==== + +Copyright Joyent, Inc. and other Node contributors. All rights reserved. +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to +deal in the Software without restriction, including without limitation the +rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +sell copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +IN THE SOFTWARE. + +==== + +This license applies to all parts of libuv that are not externally +maintained libraries. + +The externally maintained libraries used by libuv are: + + - tree.h (from FreeBSD), copyright Niels Provos. Two clause BSD license. + + - inet_pton and inet_ntop implementations, contained in src/inet.c, are + copyright the Internet Systems Consortium, Inc., and licensed under the ISC + license. + + - stdint-msvc2008.h (from msinttypes), copyright Alexander Chemeris. Three + clause BSD license. + + - pthread-fixes.c, copyright Google Inc. and Sony Mobile Communications AB. + Three clause BSD license. + +============================================================ +Notices for file(s): +/toolchains/lib/ace_core_pipeline_mac.a +------------------------------------------------------------ +Notices for software(s): +Software: +Path: //foundation/arkui/ace_engine/frameworks/core/pipeline +------------------------------------------------------------ +Copyright (c) 2021 Huawei Device Co., Ltd. +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +*************************************************************** +pipeline, it is derived from the following: +https://flutter.dev/ +version v1.9.1+hotfix.1 +*************************************************************** +Copyright 2014 The Chromium Authors. All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + * Neither the name of Google Inc. nor the names of its + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +============================================================ +Notices for file(s): +/toolchains/lib/cjson_static.a +------------------------------------------------------------ +Notices for software(s): +Software: cJSON 1.7.16 +Path: //third_party/cJSON +------------------------------------------------------------ +Copyright (c) 2009-2017 Dave Gamble and cJSON contributors + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + + +============================================================ +Notices for file(s): +/toolchains/lib/libsec_static.a +------------------------------------------------------------ +Notices for software(s): +Software: bounds_checking_function v1.1.16 +Path: //third_party/bounds_checking_function +------------------------------------------------------------ +木兰宽松许可证, 第2版 + +2020年1月 http://license.coscl.org.cn/MulanPSL2 + +您对“软件”的复制、使用、修改及分发受木兰宽松许可证,第2版(“本许可证”)的如下条款的约束: + +0. 定义 + +“软件” 是指由“贡献”构成的许可在“本许可证”下的程序和相关文档的集合。 + +“贡献” 是指由任一“贡献者”许可在“本许可证”下的受版权法保护的作品。 + +“贡献者” 是指将受版权法保护的作品许可在“本许可证”下的自然人或“法人实体”。 + +“法人实体” 是指提交贡献的机构及其“关联实体”。 + +“关联实体” 是指,对“本许可证”下的行为方而言,控制、受控制或与其共同受控制的机构,此处的控制是指有受控方或共同受控方至少50%直接或间接的投票权、资金或其他有价证券。 + +1. 授予版权许可 + +每个“贡献者”根据“本许可证”授予您永久性的、全球性的、免费的、非独占的、不可撤销的版权许可,您可以复制、使用、修改、分发其“贡献”,不论修改与否。 + +2. 授予专利许可 + +每个“贡献者”根据“本许可证”授予您永久性的、全球性的、免费的、非独占的、不可撤销的(根据本条规定撤销除外)专利许可,供您制造、委托制造、使用、许诺销售、销售、进口其“贡献”或以其他方式转移其“贡献”。前述专利许可仅限于“贡献者”现在或将来拥有或控制的其“贡献”本身或其“贡献”与许可“贡献”时的“软件”结合而将必然会侵犯的专利权利要求,不包括对“贡献”的修改或包含“贡献”的其他结合。如果您或您的“关联实体”直接或间接地,就“软件”或其中的“贡献”对任何人发起专利侵权诉讼(包括反诉或交叉诉讼)或其他专利维权行动,指控其侵犯专利权,则“本许可证”授予您对“软件”的专利许可自您提起诉讼或发起维权行动之日终止。 + +3. 无商标许可 + +“本许可证”不提供对“贡献者”的商品名称、商标、服务标志或产品名称的商标许可,但您为满足第4条规定的声明义务而必须使用除外。 + +4. 分发限制 + +您可以在任何媒介中将“软件”以源程序形式或可执行形式重新分发,不论修改与否,但您必须向接收者提供“本许可证”的副本,并保留“软件”中的版权、商标、专利及免责声明。 + +5. 免责声明与责任限制 + +“软件”及其中的“贡献”在提供时不带任何明示或默示的担保。在任何情况下,“贡献者”或版权所有者不对任何人因使用“软件”或其中的“贡献”而引发的任何直接或间接损失承担责任,不论因何种原因导致或者基于何种法律理论,即使其曾被建议有此种损失的可能性。 + +6. 语言 + +“本许可证”以中英文双语表述,中英文版本具有同等法律效力。如果中英文版本存在任何冲突不一致,以中文版为准。 + +条款结束 + +如何将木兰宽松许可证,第2版,应用到您的软件 + +如果您希望将木兰宽松许可证,第2版,应用到您的新软件,为了方便接收者查阅,建议您完成如下三步: + +1, 请您补充如下声明中的空白,包括软件名、软件的首次发表年份以及您作为版权人的名字; + +2, 请您在软件包的一级目录下创建以“LICENSE”为名的文件,将整个许可证文本放入该文件中; + +3, 请将如下声明文本放入每个源文件的头部注释中。 + +Copyright (c) [Year] [name of copyright holder] +[Software Name] is licensed under Mulan PSL v2. +You can use this software according to the terms and conditions of the Mulan PSL v2. +You may obtain a copy of Mulan PSL v2 at: + http://license.coscl.org.cn/MulanPSL2 +THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, +EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, +MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. +See the Mulan PSL v2 for more details. +Mulan Permissive Software License,Version 2 +Mulan Permissive Software License,Version 2 (Mulan PSL v2) + +January 2020 http://license.coscl.org.cn/MulanPSL2 + +Your reproduction, use, modification and distribution of the Software shall be subject to Mulan PSL v2 (this License) with the following terms and conditions: + +0. Definition + +Software means the program and related documents which are licensed under this License and comprise all Contribution(s). + +Contribution means the copyrightable work licensed by a particular Contributor under this License. + +Contributor means the Individual or Legal Entity who licenses its copyrightable work under this License. + +Legal Entity means the entity making a Contribution and all its Affiliates. + +Affiliates means entities that control, are controlled by, or are under common control with the acting entity under this License, 'control' means direct or indirect ownership of at least fifty percent (50%) of the voting power, capital or other securities of controlled or commonly controlled entity. + +1. Grant of Copyright License + +Subject to the terms and conditions of this License, each Contributor hereby grants to you a perpetual, worldwide, royalty-free, non-exclusive, irrevocable copyright license to reproduce, use, modify, or distribute its Contribution, with modification or not. + +2. Grant of Patent License + +Subject to the terms and conditions of this License, each Contributor hereby grants to you a perpetual, worldwide, royalty-free, non-exclusive, irrevocable (except for revocation under this Section) patent license to make, have made, use, offer for sale, sell, import or otherwise transfer its Contribution, where such patent license is only limited to the patent claims owned or controlled by such Contributor now or in future which will be necessarily infringed by its Contribution alone, or by combination of the Contribution with the Software to which the Contribution was contributed. The patent license shall not apply to any modification of the Contribution, and any other combination which includes the Contribution. If you or your Affiliates directly or indirectly institute patent litigation (including a cross claim or counterclaim in a litigation) or other patent enforcement activities against any individual or entity by alleging that the Software or any Contribution in it infringes patents, then any patent license granted to you under this License for the Software shall terminate as of the date such litigation or activity is filed or taken. + +3. No Trademark License + +No trademark license is granted to use the trade names, trademarks, service marks, or product names of Contributor, except as required to fulfill notice requirements in section 4. + +4. Distribution Restriction + +You may distribute the Software in any medium with or without modification, whether in source or executable forms, provided that you provide recipients with a copy of this License and retain copyright, patent, trademark and disclaimer statements in the Software. + +5. Disclaimer of Warranty and Limitation of Liability + +THE SOFTWARE AND CONTRIBUTION IN IT ARE PROVIDED WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED. IN NO EVENT SHALL ANY CONTRIBUTOR OR COPYRIGHT HOLDER BE LIABLE TO YOU FOR ANY DAMAGES, INCLUDING, BUT NOT LIMITED TO ANY DIRECT, OR INDIRECT, SPECIAL OR CONSEQUENTIAL DAMAGES ARISING FROM YOUR USE OR INABILITY TO USE THE SOFTWARE OR THE CONTRIBUTION IN IT, NO MATTER HOW IT'S CAUSED OR BASED ON WHICH LEGAL THEORY, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + +6. Language + +THIS LICENSE IS WRITTEN IN BOTH CHINESE AND ENGLISH, AND THE CHINESE VERSION AND ENGLISH VERSION SHALL HAVE THE SAME LEGAL EFFECT. IN THE CASE OF DIVERGENCE BETWEEN THE CHINESE AND ENGLISH VERSIONS, THE CHINESE VERSION SHALL PREVAIL. + +END OF THE TERMS AND CONDITIONS + +How to Apply the Mulan Permissive Software License,Version 2 (Mulan PSL v2) to Your Software + +To apply the Mulan PSL v2 to your work, for easy identification by recipients, you are suggested to complete following three steps: + +Fill in the blanks in following statement, including insert your software name, the year of the first publication of your software, and your name identified as the copyright owner; +Create a file named "LICENSE" which contains the whole context of this License in the first directory of your software package; +Attach the statement to the appropriate annotated syntax at the beginning of each source file. +Copyright (c) [Year] [name of copyright holder] +[Software Name] is licensed under Mulan PSL v2. +You can use this software according to the terms and conditions of the Mulan PSL v2. +You may obtain a copy of Mulan PSL v2 at: + http://license.coscl.org.cn/MulanPSL2 +THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, +EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, +MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. +See the Mulan PSL v2 for more details. +============================================================ +Notices for file(s): +/toolchains/lib/libEGL.a +------------------------------------------------------------ +Notices for software(s): +Software: EGL 1.5 +Path: //third_party/EGL +------------------------------------------------------------ +Copyright 2006-2020 The Khronos Group Inc. + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +============================================================ +Notices for file(s): +/toolchains/lib/curl.a +------------------------------------------------------------ +Notices for software(s): +Software: curl 8.6.0 +Path: //third_party/curl +------------------------------------------------------------ +COPYRIGHT AND PERMISSION NOTICE + +Copyright (c) 1996 - 2024, Daniel Stenberg, , and many +contributors, see the THANKS file. + +All rights reserved. + +Permission to use, copy, modify, and distribute this software for any purpose +with or without fee is hereby granted, provided that the above copyright +notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN +NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE +OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of a copyright holder shall not +be used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization of the copyright holder. + +============================================================ +Notices for file(s): +/toolchains/lib/icu_font.a +/toolchains/lib/static_icui18n.a +/toolchains/lib/static_icustubdata.a +/toolchains/lib/static_icuuc.a +------------------------------------------------------------ +Notices for software(s): +Software: International Components for Unicode-Java 67.1 +Path: //third_party/icu/icu4c/source/common +Software: International Components for Unicode-Java 67.1 +Path: //third_party/icu/icu4c +------------------------------------------------------------ +UNICODE, INC. LICENSE AGREEMENT - DATA FILES AND SOFTWARE + +See Terms of Use +for definitions of Unicode Inc.’s Data Files and Software. + +NOTICE TO USER: Carefully read the following legal agreement. +BY DOWNLOADING, INSTALLING, COPYING OR OTHERWISE USING UNICODE INC.'S +DATA FILES ("DATA FILES"), AND/OR SOFTWARE ("SOFTWARE"), +YOU UNEQUIVOCALLY ACCEPT, AND AGREE TO BE BOUND BY, ALL OF THE +TERMS AND CONDITIONS OF THIS AGREEMENT. +IF YOU DO NOT AGREE, DO NOT DOWNLOAD, INSTALL, COPY, DISTRIBUTE OR USE +THE DATA FILES OR SOFTWARE. + +COPYRIGHT AND PERMISSION NOTICE + +Copyright © 1991-2022 Unicode, Inc. All rights reserved. +Distributed under the Terms of Use in https://www.unicode.org/copyright.html. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of the Unicode data files and any associated documentation +(the "Data Files") or Unicode software and any associated documentation +(the "Software") to deal in the Data Files or Software +without restriction, including without limitation the rights to use, +copy, modify, merge, publish, distribute, and/or sell copies of +the Data Files or Software, and to permit persons to whom the Data Files +or Software are furnished to do so, provided that either +(a) this copyright and permission notice appear with all copies +of the Data Files or Software, or +(b) this copyright and permission notice appear in associated +Documentation. + +THE DATA FILES AND SOFTWARE ARE PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE +WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT OF THIRD PARTY RIGHTS. +IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN THIS +NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL +DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, +DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER +TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THE DATA FILES OR SOFTWARE. + +Except as contained in this notice, the name of a copyright holder +shall not be used in advertising or otherwise to promote the sale, +use or other dealings in these Data Files or Software without prior +written authorization of the copyright holder. + +---------------------------------------------------------------------- + +Third-Party Software Licenses + +This section contains third-party software notices and/or additional +terms for licensed third-party software components included within ICU +libraries. + +---------------------------------------------------------------------- + +ICU License - ICU 1.8.1 to ICU 57.1 + +COPYRIGHT AND PERMISSION NOTICE + +Copyright (c) 1995-2016 International Business Machines Corporation and others +All rights reserved. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, and/or sell copies of the Software, and to permit persons +to whom the Software is furnished to do so, provided that the above +copyright notice(s) and this permission notice appear in all copies of +the Software and that both the above copyright notice(s) and this +permission notice appear in supporting documentation. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT +OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY +SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER +RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF +CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN +CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + +Except as contained in this notice, the name of a copyright holder +shall not be used in advertising or otherwise to promote the sale, use +or other dealings in this Software without prior written authorization +of the copyright holder. + +All trademarks and registered trademarks mentioned herein are the +property of their respective owners. + +---------------------------------------------------------------------- + +Chinese/Japanese Word Break Dictionary Data (cjdict.txt) + + # The Google Chrome software developed by Google is licensed under + # the BSD license. Other software included in this distribution is + # provided under other licenses, as set forth below. + # + # The BSD License + # http://opensource.org/licenses/bsd-license.php + # Copyright (C) 2006-2008, Google Inc. + # + # All rights reserved. + # + # Redistribution and use in source and binary forms, with or without + # modification, are permitted provided that the following conditions are met: + # + # Redistributions of source code must retain the above copyright notice, + # this list of conditions and the following disclaimer. + # Redistributions in binary form must reproduce the above + # copyright notice, this list of conditions and the following + # disclaimer in the documentation and/or other materials provided with + # the distribution. + # Neither the name of Google Inc. nor the names of its + # contributors may be used to endorse or promote products derived from + # this software without specific prior written permission. + # + # + # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND + # CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + # INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + # DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + # BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + # LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + # + # + # The word list in cjdict.txt are generated by combining three word lists + # listed below with further processing for compound word breaking. The + # frequency is generated with an iterative training against Google web + # corpora. + # + # * Libtabe (Chinese) + # - https://sourceforge.net/project/?group_id=1519 + # - Its license terms and conditions are shown below. + # + # * IPADIC (Japanese) + # - http://chasen.aist-nara.ac.jp/chasen/distribution.html + # - Its license terms and conditions are shown below. + # + # ---------COPYING.libtabe ---- BEGIN-------------------- + # + # /* + # * Copyright (c) 1999 TaBE Project. + # * Copyright (c) 1999 Pai-Hsiang Hsiao. + # * All rights reserved. + # * + # * Redistribution and use in source and binary forms, with or without + # * modification, are permitted provided that the following conditions + # * are met: + # * + # * . Redistributions of source code must retain the above copyright + # * notice, this list of conditions and the following disclaimer. + # * . Redistributions in binary form must reproduce the above copyright + # * notice, this list of conditions and the following disclaimer in + # * the documentation and/or other materials provided with the + # * distribution. + # * . Neither the name of the TaBE Project nor the names of its + # * contributors may be used to endorse or promote products derived + # * from this software without specific prior written permission. + # * + # * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + # * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + # * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + # * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + # * REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + # * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + # * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + # * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + # * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + # * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + # * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + # * OF THE POSSIBILITY OF SUCH DAMAGE. + # */ + # + # /* + # * Copyright (c) 1999 Computer Systems and Communication Lab, + # * Institute of Information Science, Academia + # * Sinica. All rights reserved. + # * + # * Redistribution and use in source and binary forms, with or without + # * modification, are permitted provided that the following conditions + # * are met: + # * + # * . Redistributions of source code must retain the above copyright + # * notice, this list of conditions and the following disclaimer. + # * . Redistributions in binary form must reproduce the above copyright + # * notice, this list of conditions and the following disclaimer in + # * the documentation and/or other materials provided with the + # * distribution. + # * . Neither the name of the Computer Systems and Communication Lab + # * nor the names of its contributors may be used to endorse or + # * promote products derived from this software without specific + # * prior written permission. + # * + # * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + # * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + # * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + # * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + # * REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + # * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + # * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + # * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + # * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + # * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + # * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + # * OF THE POSSIBILITY OF SUCH DAMAGE. + # */ + # + # Copyright 1996 Chih-Hao Tsai @ Beckman Institute, + # University of Illinois + # c-tsai4@uiuc.edu http://casper.beckman.uiuc.edu/~c-tsai4 + # + # ---------------COPYING.libtabe-----END-------------------------------- + # + # + # ---------------COPYING.ipadic-----BEGIN------------------------------- + # + # Copyright 2000, 2001, 2002, 2003 Nara Institute of Science + # and Technology. All Rights Reserved. + # + # Use, reproduction, and distribution of this software is permitted. + # Any copy of this software, whether in its original form or modified, + # must include both the above copyright notice and the following + # paragraphs. + # + # Nara Institute of Science and Technology (NAIST), + # the copyright holders, disclaims all warranties with regard to this + # software, including all implied warranties of merchantability and + # fitness, in no event shall NAIST be liable for + # any special, indirect or consequential damages or any damages + # whatsoever resulting from loss of use, data or profits, whether in an + # action of contract, negligence or other tortuous action, arising out + # of or in connection with the use or performance of this software. + # + # A large portion of the dictionary entries + # originate from ICOT Free Software. The following conditions for ICOT + # Free Software applies to the current dictionary as well. + # + # Each User may also freely distribute the Program, whether in its + # original form or modified, to any third party or parties, PROVIDED + # that the provisions of Section 3 ("NO WARRANTY") will ALWAYS appear + # on, or be attached to, the Program, which is distributed substantially + # in the same form as set out herein and that such intended + # distribution, if actually made, will neither violate or otherwise + # contravene any of the laws and regulations of the countries having + # jurisdiction over the User or the intended distribution itself. + # + # NO WARRANTY + # + # The program was produced on an experimental basis in the course of the + # research and development conducted during the project and is provided + # to users as so produced on an experimental basis. Accordingly, the + # program is provided without any warranty whatsoever, whether express, + # implied, statutory or otherwise. The term "warranty" used herein + # includes, but is not limited to, any warranty of the quality, + # performance, merchantability and fitness for a particular purpose of + # the program and the nonexistence of any infringement or violation of + # any right of any third party. + # + # Each user of the program will agree and understand, and be deemed to + # have agreed and understood, that there is no warranty whatsoever for + # the program and, accordingly, the entire risk arising from or + # otherwise connected with the program is assumed by the user. + # + # Therefore, neither ICOT, the copyright holder, or any other + # organization that participated in or was otherwise related to the + # development of the program and their respective officials, directors, + # officers and other employees shall be held liable for any and all + # damages, including, without limitation, general, special, incidental + # and consequential damages, arising out of or otherwise in connection + # with the use or inability to use the program or any product, material + # or result produced or otherwise obtained by using the program, + # regardless of whether they have been advised of, or otherwise had + # knowledge of, the possibility of such damages at any time during the + # project or thereafter. Each user will be deemed to have agreed to the + # foregoing by his or her commencement of use of the program. The term + # "use" as used herein includes, but is not limited to, the use, + # modification, copying and distribution of the program and the + # production of secondary products from the program. + # + # In the case where the program, whether in its original form or + # modified, was distributed or delivered to or received by a user from + # any person, organization or entity other than ICOT, unless it makes or + # grants independently of ICOT any specific warranty to the user in + # writing, such person, organization or entity, will also be exempted + # from and not be held liable to the user for any such damages as noted + # above as far as the program is concerned. + # + # ---------------COPYING.ipadic-----END---------------------------------- + +---------------------------------------------------------------------- + +Lao Word Break Dictionary Data (laodict.txt) + + # Copyright (C) 2016 and later: Unicode, Inc. and others. + # License & terms of use: http://www.unicode.org/copyright.html + # Copyright (c) 2015 International Business Machines Corporation + # and others. All Rights Reserved. + # + # Project: https://github.com/rober42539/lao-dictionary + # Dictionary: https://github.com/rober42539/lao-dictionary/laodict.txt + # License: https://github.com/rober42539/lao-dictionary/LICENSE.txt + # (copied below) + # + # This file is derived from the above dictionary version of Nov 22, 2020 + # ---------------------------------------------------------------------- + # Copyright (C) 2013 Brian Eugene Wilson, Robert Martin Campbell. + # All rights reserved. + # + # Redistribution and use in source and binary forms, with or without + # modification, are permitted provided that the following conditions are met: + # + # Redistributions of source code must retain the above copyright notice, this + # list of conditions and the following disclaimer. Redistributions in binary + # form must reproduce the above copyright notice, this list of conditions and + # the following disclaimer in the documentation and/or other materials + # provided with the distribution. + # + # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + # FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + # COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + # INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + # SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + # STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + # OF THE POSSIBILITY OF SUCH DAMAGE. + # -------------------------------------------------------------------------- + +---------------------------------------------------------------------- + +Burmese Word Break Dictionary Data (burmesedict.txt) + + # Copyright (c) 2014 International Business Machines Corporation + # and others. All Rights Reserved. + # + # This list is part of a project hosted at: + # github.com/kanyawtech/myanmar-karen-word-lists + # + # -------------------------------------------------------------------------- + # Copyright (c) 2013, LeRoy Benjamin Sharon + # All rights reserved. + # + # Redistribution and use in source and binary forms, with or without + # modification, are permitted provided that the following conditions + # are met: Redistributions of source code must retain the above + # copyright notice, this list of conditions and the following + # disclaimer. Redistributions in binary form must reproduce the + # above copyright notice, this list of conditions and the following + # disclaimer in the documentation and/or other materials provided + # with the distribution. + # + # Neither the name Myanmar Karen Word Lists, nor the names of its + # contributors may be used to endorse or promote products derived + # from this software without specific prior written permission. + # + # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND + # CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + # INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + # DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS + # BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED + # TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + # ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + # TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF + # THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + # SUCH DAMAGE. + # -------------------------------------------------------------------------- + +---------------------------------------------------------------------- + +Time Zone Database + + ICU uses the public domain data and code derived from Time Zone +Database for its time zone support. The ownership of the TZ database +is explained in BCP 175: Procedure for Maintaining the Time Zone +Database section 7. + + # 7. Database Ownership + # + # The TZ database itself is not an IETF Contribution or an IETF + # document. Rather it is a pre-existing and regularly updated work + # that is in the public domain, and is intended to remain in the + # public domain. Therefore, BCPs 78 [RFC5378] and 79 [RFC3979] do + # not apply to the TZ Database or contributions that individuals make + # to it. Should any claims be made and substantiated against the TZ + # Database, the organization that is providing the IANA + # Considerations defined in this RFC, under the memorandum of + # understanding with the IETF, currently ICANN, may act in accordance + # with all competent court orders. No ownership claims will be made + # by ICANN or the IETF Trust on the database or the code. Any person + # making a contribution to the database or code waives all rights to + # future claims in that contribution or in the TZ Database. + +---------------------------------------------------------------------- + +Google double-conversion + +Copyright 2006-2011, the V8 project authors. All rights reserved. +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + * Neither the name of Google Inc. nor the names of its + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +---------------------------------------------------------------------- + +File: aclocal.m4 (only for ICU4C) +Section: pkg.m4 - Macros to locate and utilise pkg-config. + + +Copyright © 2004 Scott James Remnant . +Copyright © 2012-2015 Dan Nicholson + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +02111-1307, USA. + +As a special exception to the GNU General Public License, if you +distribute this file as part of a program that contains a +configuration script generated by Autoconf, you may include it under +the same distribution terms that you use for the rest of that +program. + + +(The condition for the exception is fulfilled because +ICU4C includes a configuration script generated by Autoconf, +namely the `configure` script.) + +---------------------------------------------------------------------- + +File: config.guess (only for ICU4C) + + +This file is free software; you can redistribute it and/or modify it +under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, see . + +As a special exception to the GNU General Public License, if you +distribute this file as part of a program that contains a +configuration script generated by Autoconf, you may include it under +the same distribution terms that you use for the rest of that +program. This Exception is an additional permission under section 7 +of the GNU General Public License, version 3 ("GPLv3"). + + +(The condition for the exception is fulfilled because +ICU4C includes a configuration script generated by Autoconf, +namely the `configure` script.) + +---------------------------------------------------------------------- + +File: install-sh (only for ICU4C) + + +Copyright 1991 by the Massachusetts Institute of Technology + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation, and that the name of M.I.T. not be used in advertising or +publicity pertaining to distribution of the software without specific, +written prior permission. M.I.T. makes no representations about the +suitability of this software for any purpose. It is provided "as is" +without express or implied warranty. + +============================================================ +Notices for file(s): +/previewer/common/bin/HMOSColorEmojiCompat.ttf +/previewer/common/bin/HMOSColorEmojiFlags.ttf +/previewer/common/bin/HMSymbol-Black.ttf +/previewer/common/bin/HMSymbol-Bold.ttf +/previewer/common/bin/HMSymbol-ExtraBold.ttf +/previewer/common/bin/HMSymbol-ExtraLight.ttf +/previewer/common/bin/HMSymbol-Light.ttf +/previewer/common/bin/HMSymbol-Medium.ttf +/previewer/common/bin/HMSymbol-Regular.ttf +/previewer/common/bin/HMSymbol-SemiBold.ttf +/previewer/common/bin/HMSymbol-Thin.ttf +/previewer/common/bin/HarmonyOS_SansSC_Semibold.ttf +/previewer/common/bin/HarmonyOS_Sans_Black.ttf +/previewer/common/bin/HarmonyOS_Sans_Black_Italic.ttf +/previewer/common/bin/HarmonyOS_Sans_Bold.ttf +/previewer/common/bin/HarmonyOS_Sans_Bold_Italic.ttf +/previewer/common/bin/HarmonyOS_Sans_Condensed_Black.ttf +/previewer/common/bin/HarmonyOS_Sans_Condensed_Black_Italic.ttf +/previewer/common/bin/HarmonyOS_Sans_Condensed_Bold.ttf +/previewer/common/bin/HarmonyOS_Sans_Condensed_Bold_Italic.ttf +/previewer/common/bin/HarmonyOS_Sans_Condensed_Light.ttf +/previewer/common/bin/HarmonyOS_Sans_Condensed_Light_Italic.ttf +/previewer/common/bin/HarmonyOS_Sans_Condensed_Medium.ttf +/previewer/common/bin/HarmonyOS_Sans_Condensed_Medium_Italic.ttf +/previewer/common/bin/HarmonyOS_Sans_Condensed_Regular.ttf +/previewer/common/bin/HarmonyOS_Sans_Condensed_Regular_Italic.ttf +/previewer/common/bin/HarmonyOS_Sans_Condensed_Thin.ttf +/previewer/common/bin/HarmonyOS_Sans_Condensed_Thin_Italic.ttf +/previewer/common/bin/HarmonyOS_Sans_Digit.ttf +/previewer/common/bin/HarmonyOS_Sans_Digit_Medium.ttf +/previewer/common/bin/HarmonyOS_Sans_Light.ttf +/previewer/common/bin/HarmonyOS_Sans_Light_Italic.ttf +/previewer/common/bin/HarmonyOS_Sans_Medium.ttf +/previewer/common/bin/HarmonyOS_Sans_Medium_Italic.ttf +/previewer/common/bin/HarmonyOS_Sans_Naskh_Arabic_Black.ttf +/previewer/common/bin/HarmonyOS_Sans_Naskh_Arabic_Bold.ttf +/previewer/common/bin/HarmonyOS_Sans_Naskh_Arabic_Light.ttf +/previewer/common/bin/HarmonyOS_Sans_Naskh_Arabic_Medium.ttf +/previewer/common/bin/HarmonyOS_Sans_Naskh_Arabic_Regular.ttf +/previewer/common/bin/HarmonyOS_Sans_Naskh_Arabic_Thin.ttf +/previewer/common/bin/HarmonyOS_Sans_Naskh_Arabic_UI_Black.ttf +/previewer/common/bin/HarmonyOS_Sans_Naskh_Arabic_UI_Bold.ttf +/previewer/common/bin/HarmonyOS_Sans_Naskh_Arabic_UI_Light.ttf +/previewer/common/bin/HarmonyOS_Sans_Naskh_Arabic_UI_Medium.ttf +/previewer/common/bin/HarmonyOS_Sans_Naskh_Arabic_UI_Regular.ttf +/previewer/common/bin/HarmonyOS_Sans_Naskh_Arabic_UI_Thin.ttf +/previewer/common/bin/HarmonyOS_Sans_Regular.ttf +/previewer/common/bin/HarmonyOS_Sans_Regular_Italic.ttf +/previewer/common/bin/HarmonyOS_Sans_SC_Black.ttf +/previewer/common/bin/HarmonyOS_Sans_SC_Bold.ttf +/previewer/common/bin/HarmonyOS_Sans_SC_Light.ttf +/previewer/common/bin/HarmonyOS_Sans_SC_Medium.ttf +/previewer/common/bin/HarmonyOS_Sans_SC_Regular.ttf +/previewer/common/bin/HarmonyOS_Sans_SC_Thin.ttf +/previewer/common/bin/HarmonyOS_Sans_TC_Black.ttf +/previewer/common/bin/HarmonyOS_Sans_TC_Bold.ttf +/previewer/common/bin/HarmonyOS_Sans_TC_Light.ttf +/previewer/common/bin/HarmonyOS_Sans_TC_Medium.ttf +/previewer/common/bin/HarmonyOS_Sans_TC_Regular.ttf +/previewer/common/bin/HarmonyOS_Sans_TC_Thin.ttf +/previewer/common/bin/HarmonyOS_Sans_Thin.ttf +/previewer/common/bin/HarmonyOS_Sans_Thin_Italic.ttf +/previewer/common/bin/hm_symbol_config.json +/previewer/common/bin/hm_symbol_config_next.json +------------------------------------------------------------ +Notices for software(s): +Software: +Path: //base/global/system_resources +------------------------------------------------------------ +System resource package is licensed under Apache License Version 2.0. +-------------------------------------------------------------------------------- + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS +============================================================ +Notices for file(s): +/toolchains/lib/libpng_static.a +------------------------------------------------------------ +Notices for software(s): +Software: openEuler:libpng 1.6.38-1.oe2203sp1 +Path: //third_party/libpng +------------------------------------------------------------ +COPYRIGHT NOTICE, DISCLAIMER, and LICENSE +========================================= + +PNG Reference Library License version 2 +--------------------------------------- + + * Copyright (c) 1995-2019 The PNG Reference Library Authors. + * Copyright (c) 2018-2019 Cosmin Truta. + * Copyright (c) 2000-2002, 2004, 2006-2018 Glenn Randers-Pehrson. + * Copyright (c) 1996-1997 Andreas Dilger. + * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc. + +The software is supplied "as is", without warranty of any kind, +express or implied, including, without limitation, the warranties +of merchantability, fitness for a particular purpose, title, and +non-infringement. In no event shall the Copyright owners, or +anyone distributing the software, be liable for any damages or +other liability, whether in contract, tort or otherwise, arising +from, out of, or in connection with the software, or the use or +other dealings in the software, even if advised of the possibility +of such damage. + +Permission is hereby granted to use, copy, modify, and distribute +this software, or portions hereof, for any purpose, without fee, +subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you + must not claim that you wrote the original software. If you + use this software in a product, an acknowledgment in the product + documentation would be appreciated, but is not required. + + 2. Altered source versions must be plainly marked as such, and must + not be misrepresented as being the original software. + + 3. This Copyright notice may not be removed or altered from any + source or altered source distribution. + + +PNG Reference Library License version 1 (for libpng 0.5 through 1.6.35) +----------------------------------------------------------------------- + +libpng versions 1.0.7, July 1, 2000, through 1.6.35, July 15, 2018 are +Copyright (c) 2000-2002, 2004, 2006-2018 Glenn Randers-Pehrson, are +derived from libpng-1.0.6, and are distributed according to the same +disclaimer and license as libpng-1.0.6 with the following individuals +added to the list of Contributing Authors: + + Simon-Pierre Cadieux + Eric S. Raymond + Mans Rullgard + Cosmin Truta + Gilles Vollant + James Yu + Mandar Sahastrabuddhe + Google Inc. + Vadim Barkov + +and with the following additions to the disclaimer: + + There is no warranty against interference with your enjoyment of + the library or against infringement. There is no warranty that our + efforts or the library will fulfill any of your particular purposes + or needs. This library is provided with all faults, and the entire + risk of satisfactory quality, performance, accuracy, and effort is + with the user. + +Some files in the "contrib" directory and some configure-generated +files that are distributed with libpng have other copyright owners, and +are released under other open source licenses. + +libpng versions 0.97, January 1998, through 1.0.6, March 20, 2000, are +Copyright (c) 1998-2000 Glenn Randers-Pehrson, are derived from +libpng-0.96, and are distributed according to the same disclaimer and +license as libpng-0.96, with the following individuals added to the +list of Contributing Authors: + + Tom Lane + Glenn Randers-Pehrson + Willem van Schaik + +libpng versions 0.89, June 1996, through 0.96, May 1997, are +Copyright (c) 1996-1997 Andreas Dilger, are derived from libpng-0.88, +and are distributed according to the same disclaimer and license as +libpng-0.88, with the following individuals added to the list of +Contributing Authors: + + John Bowler + Kevin Bracey + Sam Bushell + Magnus Holmgren + Greg Roelofs + Tom Tanner + +Some files in the "scripts" directory have other copyright owners, +but are released under this license. + +libpng versions 0.5, May 1995, through 0.88, January 1996, are +Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc. + +For the purposes of this copyright and license, "Contributing Authors" +is defined as the following set of individuals: + + Andreas Dilger + Dave Martindale + Guy Eric Schalnat + Paul Schmidt + Tim Wegner + +The PNG Reference Library is supplied "AS IS". The Contributing +Authors and Group 42, Inc. disclaim all warranties, expressed or +implied, including, without limitation, the warranties of +merchantability and of fitness for any purpose. The Contributing +Authors and Group 42, Inc. assume no liability for direct, indirect, +incidental, special, exemplary, or consequential damages, which may +result from the use of the PNG Reference Library, even if advised of +the possibility of such damage. + +Permission is hereby granted to use, copy, modify, and distribute this +source code, or portions hereof, for any purpose, without fee, subject +to the following restrictions: + + 1. The origin of this source code must not be misrepresented. + + 2. Altered versions must be plainly marked as such and must not + be misrepresented as being the original source. + + 3. This Copyright notice may not be removed or altered from any + source or altered source distribution. + +The Contributing Authors and Group 42, Inc. specifically permit, +without fee, and encourage the use of this source code as a component +to supporting the PNG file format in commercial products. If you use +this source code in a product, acknowledgment is not required but would +be appreciated. + +============================================================ +Notices for file(s): +/toolchains/lib/static_libxml2.a +------------------------------------------------------------ +Notices for software(s): +Software: openEuler:libxml2 2.9.14-9.oe2203sp3 +Path: //third_party/libxml2 +------------------------------------------------------------ +Except where otherwise noted in the source code (e.g. the files hash.c, +list.c and the trio files, which are covered by a similar licence but +with different Copyright notices) all the files are: + + Copyright (C) 1998-2012 Daniel Veillard. All Rights Reserved. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is fur- +nished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FIT- +NESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + +============================================================ +Notices for file(s): +/toolchains/lib/bzip2_src.a +/toolchains/lib/libbz2.a +------------------------------------------------------------ +Notices for software(s): +Software: Bzip2 1.0.8-6.oe2203sp3 +Path: //third_party/bzip2 +------------------------------------------------------------ + +-------------------------------------------------------------------------- + +This program, "bzip2", the associated library "libbzip2", and all +documentation, are copyright (C) 1996-2019 Julian R Seward. All +rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + +1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + +2. The origin of this software must not be misrepresented; you must + not claim that you wrote the original software. If you use this + software in a product, an acknowledgment in the product + documentation would be appreciated but is not required. + +3. Altered source versions must be plainly marked as such, and must + not be misrepresented as being the original software. + +4. The name of the author may not be used to endorse or promote + products derived from this software without specific prior written + permission. + +THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS +OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +Julian Seward, jseward@acm.org +bzip2/libbzip2 version 1.0.8 of 13 July 2019 + +-------------------------------------------------------------------------- + +============================================================ +Notices for file(s): +/previewer/common/bin +/previewer/common/bin/NotoSansAdlam[wght].ttf +/previewer/common/bin/NotoSansAnatolianHieroglyphs-Regular.ttf +/previewer/common/bin/NotoSansArmenian[wdth,wght].ttf +/previewer/common/bin/NotoSansAvestan-Regular.ttf +/previewer/common/bin/NotoSansBalinese[wght].ttf +/previewer/common/bin/NotoSansBamum[wght].ttf +/previewer/common/bin/NotoSansBassaVah[wght].ttf +/previewer/common/bin/NotoSansBatak-Regular.ttf +/previewer/common/bin/NotoSansBengaliUI-Bold.ttf +/previewer/common/bin/NotoSansBengaliUI-Medium.ttf +/previewer/common/bin/NotoSansBengaliUI-Regular.ttf +/previewer/common/bin/NotoSansBengaliUI-SemiBold.ttf +/previewer/common/bin/NotoSansBengali[wdth,wght].ttf +/previewer/common/bin/NotoSansBhaiksuki-Regular.ttf +/previewer/common/bin/NotoSansBrahmi-Regular.ttf +/previewer/common/bin/NotoSansBuginese-Regular.ttf +/previewer/common/bin/NotoSansBuhid-Regular.ttf +/previewer/common/bin/NotoSansCanadianAboriginal[wght].ttf +/previewer/common/bin/NotoSansCarian-Regular.ttf +/previewer/common/bin/NotoSansChakma-Regular.ttf +/previewer/common/bin/NotoSansCham[wght].ttf +/previewer/common/bin/NotoSansCherokee[wght].ttf +/previewer/common/bin/NotoSansCoptic-Regular.ttf +/previewer/common/bin/NotoSansCuneiform-Regular.ttf +/previewer/common/bin/NotoSansCypriot-Regular.ttf +/previewer/common/bin/NotoSansDeseret-Regular.ttf +/previewer/common/bin/NotoSansDevanagariUI-Bold.ttf +/previewer/common/bin/NotoSansDevanagariUI-Medium.ttf +/previewer/common/bin/NotoSansDevanagariUI-Regular.ttf +/previewer/common/bin/NotoSansDevanagariUI-SemiBold.ttf +/previewer/common/bin/NotoSansDevanagari[wdth,wght].ttf +/previewer/common/bin/NotoSansEgyptianHieroglyphs-Regular.ttf +/previewer/common/bin/NotoSansElbasan-Regular.ttf +/previewer/common/bin/NotoSansEthiopic[wdth,wght].ttf +/previewer/common/bin/NotoSansGeorgian[wdth,wght].ttf +/previewer/common/bin/NotoSansGlagolitic-Regular.ttf +/previewer/common/bin/NotoSansGothic-Regular.ttf +/previewer/common/bin/NotoSansGrantha-Regular.ttf +/previewer/common/bin/NotoSansGujaratiUI-Bold.ttf +/previewer/common/bin/NotoSansGujaratiUI-Regular.ttf +/previewer/common/bin/NotoSansGujarati[wdth,wght].ttf +/previewer/common/bin/NotoSansGunjalaGondi[wght].ttf +/previewer/common/bin/NotoSansGurmukhiUI-Bold.ttf +/previewer/common/bin/NotoSansGurmukhiUI-Medium.ttf +/previewer/common/bin/NotoSansGurmukhiUI-Regular.ttf +/previewer/common/bin/NotoSansGurmukhiUI-SemiBold.ttf +/previewer/common/bin/NotoSansGurmukhi[wdth,wght].ttf +/previewer/common/bin/NotoSansHanifiRohingya[wght].ttf +/previewer/common/bin/NotoSansHanunoo-Regular.ttf +/previewer/common/bin/NotoSansHatran-Regular.ttf +/previewer/common/bin/NotoSansHebrew[wdth,wght].ttf +/previewer/common/bin/NotoSansImperialAramaic-Regular.ttf +/previewer/common/bin/NotoSansInscriptionalPahlavi-Regular.ttf +/previewer/common/bin/NotoSansInscriptionalParthian-Regular.ttf +/previewer/common/bin/NotoSansJavanese[wght].ttf +/previewer/common/bin/NotoSansKaithi-Regular.ttf +/previewer/common/bin/NotoSansKannadaUI-Bold.ttf +/previewer/common/bin/NotoSansKannadaUI-Medium.ttf +/previewer/common/bin/NotoSansKannadaUI-Regular.ttf +/previewer/common/bin/NotoSansKannadaUI-SemiBold.ttf +/previewer/common/bin/NotoSansKannada[wdth,wght].ttf +/previewer/common/bin/NotoSansKayahLi[wght].ttf +/previewer/common/bin/NotoSansKharoshthi-Regular.ttf +/previewer/common/bin/NotoSansKhmer[wdth,wght].ttf +/previewer/common/bin/NotoSansKhojki-Regular.ttf +/previewer/common/bin/NotoSansLao[wdth,wght].ttf +/previewer/common/bin/NotoSansLepcha-Regular.ttf +/previewer/common/bin/NotoSansLimbu-Regular.ttf +/previewer/common/bin/NotoSansLinearA-Regular.ttf +/previewer/common/bin/NotoSansLinearB-Regular.ttf +/previewer/common/bin/NotoSansLisu[wght].ttf +/previewer/common/bin/NotoSansLycian-Regular.ttf +/previewer/common/bin/NotoSansLydian-Regular.ttf +/previewer/common/bin/NotoSansMalayalamUI-Bold.ttf +/previewer/common/bin/NotoSansMalayalamUI-Medium.ttf +/previewer/common/bin/NotoSansMalayalamUI-Regular.ttf +/previewer/common/bin/NotoSansMalayalamUI-SemiBold.ttf +/previewer/common/bin/NotoSansMalayalam[wdth,wght].ttf +/previewer/common/bin/NotoSansMandaic-Regular.ttf +/previewer/common/bin/NotoSansManichaean-Regular.ttf +/previewer/common/bin/NotoSansMarchen-Regular.ttf +/previewer/common/bin/NotoSansMasaramGondi-Regular.ttf +/previewer/common/bin/NotoSansMedefaidrin[wght].ttf +/previewer/common/bin/NotoSansMeeteiMayek[wght].ttf +/previewer/common/bin/NotoSansMeroitic-Regular.ttf +/previewer/common/bin/NotoSansMiao-Regular.ttf +/previewer/common/bin/NotoSansModi-Regular.ttf +/previewer/common/bin/NotoSansMongolian-Regular.ttf +/previewer/common/bin/NotoSansMono[wdth,wght].ttf +/previewer/common/bin/NotoSansMro-Regular.ttf +/previewer/common/bin/NotoSansMultani-Regular.ttf +/previewer/common/bin/NotoSansMyanmar[wdth,wght].ttf +/previewer/common/bin/NotoSansNKo-Regular.ttf +/previewer/common/bin/NotoSansNabataean-Regular.ttf +/previewer/common/bin/NotoSansNewTaiLue[wght].ttf +/previewer/common/bin/NotoSansNewa-Regular.ttf +/previewer/common/bin/NotoSansOgham-Regular.ttf +/previewer/common/bin/NotoSansOlChiki[wght].ttf +/previewer/common/bin/NotoSansOldItalic-Regular.ttf +/previewer/common/bin/NotoSansOldNorthArabian-Regular.ttf +/previewer/common/bin/NotoSansOldPermic-Regular.ttf +/previewer/common/bin/NotoSansOldPersian-Regular.ttf +/previewer/common/bin/NotoSansOldSouthArabian-Regular.ttf +/previewer/common/bin/NotoSansOldTurkic-Regular.ttf +/previewer/common/bin/NotoSansOriya[wdth,wght].ttf +/previewer/common/bin/NotoSansOsage-Regular.ttf +/previewer/common/bin/NotoSansOsmanya-Regular.ttf +/previewer/common/bin/NotoSansPahawhHmong-Regular.ttf +/previewer/common/bin/NotoSansPalmyrene-Regular.ttf +/previewer/common/bin/NotoSansPauCinHau-Regular.ttf +/previewer/common/bin/NotoSansPhags-Pa-Regular.ttf +/previewer/common/bin/NotoSansPhoenician-Regular.ttf +/previewer/common/bin/NotoSansRejang-Regular.ttf +/previewer/common/bin/NotoSansRunic-Regular.ttf +/previewer/common/bin/NotoSansSamaritan-Regular.ttf +/previewer/common/bin/NotoSansSaurashtra-Regular.ttf +/previewer/common/bin/NotoSansSharada-Regular.ttf +/previewer/common/bin/NotoSansShavian-Regular.ttf +/previewer/common/bin/NotoSansSinhalaUI-Bold.ttf +/previewer/common/bin/NotoSansSinhalaUI-Medium.ttf +/previewer/common/bin/NotoSansSinhalaUI-Regular.ttf +/previewer/common/bin/NotoSansSinhalaUI-SemiBold.ttf +/previewer/common/bin/NotoSansSinhala[wdth,wght].ttf +/previewer/common/bin/NotoSansSoraSompeng[wght].ttf +/previewer/common/bin/NotoSansSoyombo-Regular.ttf +/previewer/common/bin/NotoSansSundanese[wght].ttf +/previewer/common/bin/NotoSansSylotiNagri-Regular.ttf +/previewer/common/bin/NotoSansSymbols-Regular.ttf +/previewer/common/bin/NotoSansSymbols2-Regular.ttf +/previewer/common/bin/NotoSansSyriacEastern[wght].ttf +/previewer/common/bin/NotoSansSyriacWestern[wght].ttf +/previewer/common/bin/NotoSansTagalog-Regular.ttf +/previewer/common/bin/NotoSansTagbanwa-Regular.ttf +/previewer/common/bin/NotoSansTaiLe-Regular.ttf +/previewer/common/bin/NotoSansTaiTham[wght].ttf +/previewer/common/bin/NotoSansTaiViet-Regular.ttf +/previewer/common/bin/NotoSansTakri-Regular.ttf +/previewer/common/bin/NotoSansTamilUI-Bold.ttf +/previewer/common/bin/NotoSansTamilUI-Medium.ttf +/previewer/common/bin/NotoSansTamilUI-Regular.ttf +/previewer/common/bin/NotoSansTamilUI-SemiBold.ttf +/previewer/common/bin/NotoSansTamil[wdth,wght].ttf +/previewer/common/bin/NotoSansTeluguUI-Bold.ttf +/previewer/common/bin/NotoSansTeluguUI-Medium.ttf +/previewer/common/bin/NotoSansTeluguUI-Regular.ttf +/previewer/common/bin/NotoSansTeluguUI-SemiBold.ttf +/previewer/common/bin/NotoSansTelugu[wdth,wght].ttf +/previewer/common/bin/NotoSansThaana[wght].ttf +/previewer/common/bin/NotoSansThai[wdth,wght].ttf +/previewer/common/bin/NotoSansTifinagh-Regular.ttf +/previewer/common/bin/NotoSansUgaritic-Regular.ttf +/previewer/common/bin/NotoSansVai-Regular.ttf +/previewer/common/bin/NotoSansWancho-Regular.ttf +/previewer/common/bin/NotoSansWarangCiti-Regular.ttf +/previewer/common/bin/NotoSansYi-Regular.ttf +/previewer/common/bin/NotoSans[wdth,wght].ttf +/previewer/common/bin/NotoSerifAhom-Regular.ttf +/previewer/common/bin/NotoSerifArmenian[wdth,wght].ttf +/previewer/common/bin/NotoSerifBengali[wdth,wght].ttf +/previewer/common/bin/NotoSerifDevanagari[wdth,wght].ttf +/previewer/common/bin/NotoSerifDogra-Regular.ttf +/previewer/common/bin/NotoSerifEthiopic[wdth,wght].ttf +/previewer/common/bin/NotoSerifGeorgian[wdth,wght].ttf +/previewer/common/bin/NotoSerifGujarati[wght].ttf +/previewer/common/bin/NotoSerifGurmukhi[wght].ttf +/previewer/common/bin/NotoSerifHebrew[wdth,wght].ttf +/previewer/common/bin/NotoSerifKannada[wght].ttf +/previewer/common/bin/NotoSerifKhmer[wdth,wght].ttf +/previewer/common/bin/NotoSerifLao[wdth,wght].ttf +/previewer/common/bin/NotoSerifMalayalam[wght].ttf +/previewer/common/bin/NotoSerifMyanmar[wdth,wght].ttf +/previewer/common/bin/NotoSerifSinhala[wdth,wght].ttf +/previewer/common/bin/NotoSerifTamil[wdth,wght].ttf +/previewer/common/bin/NotoSerifTelugu[wght].ttf +/previewer/common/bin/NotoSerifThai[wdth,wght].ttf +/previewer/common/bin/NotoSerifTibetan[wght].ttf +/previewer/common/bin/NotoSerifYezidi[wght].ttf +/previewer/common/bin/NotoSerif[wdth,wght].ttf +------------------------------------------------------------ +Notices for software(s): +Software: Noto Fonts NotoSansMath-v2.539 +Path: //third_party/notofonts +------------------------------------------------------------ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +============================================================ +Notices for file(s): +/toolchains/lib/freetype_static.a +------------------------------------------------------------ +Notices for software(s): +Software: freetype 2.12.1-1.oe2203sp1 +Path: //third_party/freetype +------------------------------------------------------------ +FREETYPE LICENSES +----------------- + +The FreeType 2 font engine is copyrighted work and cannot be used +legally without a software license. In order to make this project +usable to a vast majority of developers, we distribute it under two +mutually exclusive open-source licenses. + +This means that *you* must choose *one* of the two licenses described +below, then obey all its terms and conditions when using FreeType 2 in +any of your projects or products. + + - The FreeType License, found in the file `docs/FTL.TXT`, which is + similar to the original BSD license *with* an advertising clause + that forces you to explicitly cite the FreeType project in your + product's documentation. All details are in the license file. + This license is suited to products which don't use the GNU General + Public License. + + Note that this license is compatible to the GNU General Public + License version 3, but not version 2. + + - The GNU General Public License version 2, found in + `docs/GPLv2.TXT` (any later version can be used also), for + programs which already use the GPL. Note that the FTL is + incompatible with GPLv2 due to its advertisement clause. + +The contributed BDF and PCF drivers come with a license similar to +that of the X Window System. It is compatible to the above two +licenses (see files `src/bdf/README` and `src/pcf/README`). The same +holds for the source code files `src/base/fthash.c` and +`include/freetype/internal/fthash.h`; they wer part of the BDF driver +in earlier FreeType versions. + +The gzip module uses the zlib license (see `src/gzip/zlib.h`) which +too is compatible to the above two licenses. + +The MD5 checksum support (only used for debugging in development +builds) is in the public domain. + + +--- end of LICENSE.TXT --- + +============================================================ +Notices for file(s): +/toolchains +/toolchains/OpenHarmony.p12 +/toolchains/OpenHarmonyProfileDebug.pem +/toolchains/OpenHarmonyProfileRelease.pem +/toolchains/UnsgnedDebugProfileTemplate.json +/toolchains/UnsgnedReleasedProfileTemplate.json +/toolchains/hap-sign-tool.jar +/toolchains/lib/libGLES.a +------------------------------------------------------------ +Notices for software(s): +Software: +Path: //developtools/hapsigner +Software: openGLES 63161d674db04a96635c6ab300db793e83f6762c +Path: //third_party/openGLES +------------------------------------------------------------ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +============================================================ +Notices for file(s): +/ets/arkts +/ets/arkts/arkts +------------------------------------------------------------ +Notices for software(s): +Software: +Path: /k-public/public_interface/sdk-js +------------------------------------------------------------ +The API design of the arkts.math.Decimal module is based on the third-party software Decimal.js, +which is licensed under the MIT License. To comply with open-source licensing, +we acknowledge the MIT License terms and include this notice. + +Please refer to the full LICENSE text for Decimal.js's licensing terms and conditions. + +The MIT Licence. + +Copyright (c) 2022 Michael Mclaughlin + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + +============================================================ +Notices for file(s): +/toolchains/diff +/toolchains/lib/libringbuffer.a +/toolchains/lib/libupdaterlog.a +/toolchains/lib/libupdaterpackage.a +------------------------------------------------------------ +Notices for software(s): +Software: +Path: //base/update/updater/services/common/ring_buffer +Software: +Path: //base/update/updater/services/log +Software: +Path: //base/update/updater/services/package +------------------------------------------------------------ +Copyright (C) 2021 Huawei Device Co., Ltd. +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +*************************************************************** + +bsdiff, it is derived from the following: +https://github.com/mendsley/bsdiff +version 4.3 +*************************************************************** + Copyright 2003-2005 Colin Percival + Copyright 2012 Matthew Endsley + All rights reserved + + Redistribution and use in source and binary forms, with or without + modification, are permitted providing that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + +*************************************************************** + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + +============================================================ +Notices for file(s): +/toolchains/ark_disasm +/toolchains/lib/abc2program_frontend_static.a +/toolchains/lib/arkdisassembler_frontend_static.a +/toolchains/lib/libarkassembler_frontend_set_static.a +/toolchains/lib/libarkassembler_frontend_static.a +/toolchains/lib/libarkbase_frontend_set_static.a +/toolchains/lib/libarkbase_frontend_static.a +/toolchains/lib/libarkbase_static.a +/toolchains/lib/libarkbytecodeopt_frontend_static.a +/toolchains/lib/libarkcompiler_frontend_static.a +/toolchains/lib/libarkfile_frontend_set_static.a +/toolchains/lib/libarkfile_frontend_static.a +/toolchains/lib/libarkfile_static.a +/toolchains/lib/libarkziparchive_frontend_set_static.a +/toolchains/lib/libarkziparchive_frontend_static.a +/toolchains/lib/libarkziparchive_static.a +------------------------------------------------------------ +Notices for software(s): +Software: +Path: //arkcompiler/runtime_core/abc2program +Software: +Path: //arkcompiler/runtime_core/disassembler +Software: +Path: //arkcompiler/runtime_core/assembler +Software: +Path: //arkcompiler/runtime_core/libpandabase +Software: +Path: //arkcompiler/runtime_core/bytecode_optimizer +Software: +Path: //arkcompiler/runtime_core/compiler +Software: +Path: //arkcompiler/runtime_core/libpandafile +Software: +Path: //arkcompiler/runtime_core/libziparchive +------------------------------------------------------------ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +============================================================ +Notices for file(s): +/js/build-tools/ace-loader/lib/element.js +/js/build-tools/ace-loader/lib/json.js +/js/build-tools/ace-loader/lib/legacy.js +/js/build-tools/ace-loader/lib/loader.js +/js/build-tools/ace-loader/lib/parser.js +/js/build-tools/ace-loader/lib/script.js +/js/build-tools/ace-loader/lib/scripter +/js/build-tools/ace-loader/lib/style.js +/js/build-tools/ace-loader/lib/styler +/js/build-tools/ace-loader/lib/template.js +/js/build-tools/ace-loader/lib/util.js +------------------------------------------------------------ +Notices for software(s): +Software: weex-loader v0.7.12 +Path: //third_party/weex-loader +------------------------------------------------------------ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright 2019 Apache Incubator-Weex + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +============================================================ +Notices for file(s): +/toolchains/lib/libhilog_source_mac.a +------------------------------------------------------------ +Notices for software(s): +Software: +Path: //base/hiviewdfx/hilog/frameworks/libhilog +------------------------------------------------------------ +Copyright (c) 2021 Huawei Device Co., Ltd. +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +============================================================ +Notices for file(s): +/toolchains/lib/libz.a +------------------------------------------------------------ +Notices for software(s): +Software: zlib v1.2.13 +Path: //third_party/zlib +------------------------------------------------------------ +Copyright notice: + + (C) 1995-2022 Jean-loup Gailly and Mark Adler + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. + + Jean-loup Gailly Mark Adler + jloup@gzip.org madler@alumni.caltech.edu + diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@internal/full/canvaspattern.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@internal/full/canvaspattern.d.ts new file mode 100755 index 00000000..9f60f33c --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@internal/full/canvaspattern.d.ts @@ -0,0 +1,444 @@ +/* + * Copyright (c) 2022-2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit ArkUI + */ +/** + * Describes an opaque object of a template, which is created using the createPattern() method. + * + * @interface CanvasPattern + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 8 + */ +/** + * Describes an opaque object of a template, which is created using the createPattern() method. + * + * @interface CanvasPattern + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 9 + * @form + */ +/** + * Describes an opaque object of a template, which is created using the createPattern() method. + * + * @interface CanvasPattern + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + * @form + */ +export interface CanvasPattern { + /** + * Adds the matrix transformation effect to the current template. + * + * @param { Matrix2D } [transform] - transformation matrix + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 8 + */ + /** + * Adds the matrix transformation effect to the current template. + * + * @param { Matrix2D } [transform] - transformation matrix + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 9 + * @form + */ + /** + * Adds the matrix transformation effect to the current template. + * + * @param { Matrix2D } [transform] - transformation matrix + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + * @form + */ + setTransform(transform?: Matrix2D): void; +} +/** + * 2D transformation matrix, supporting rotation, translation, and scaling of the X-axis and Y-axis + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 8 + */ +/** + * 2D transformation matrix, supporting rotation, translation, and scaling of the X-axis and Y-axis + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 9 + * @form + */ +/** + * 2D transformation matrix, supporting rotation, translation, and scaling of the X-axis and Y-axis + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + * @form + */ +export class Matrix2D { + /** + * Horizontal Zoom + * + * @type { ?number } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 8 + */ + /** + * Horizontal Zoom + * + * @type { ?number } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 9 + * @form + */ + /** + * Horizontal Zoom + * + * @type { ?number } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + * @form + */ + scaleX?: number; + /** + * Vertical Tilt + * + * @type { ?number } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 8 + */ + /** + * Vertical Tilt + * + * @type { ?number } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 9 + * @form + */ + /** + * Vertical Tilt + * + * @type { ?number } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + * @form + */ + rotateY?: number; + /** + * Horizontal Tilt + * + * @type { ?number } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 8 + */ + /** + * Horizontal Tilt + * + * @type { ?number } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 9 + * @form + */ + /** + * Horizontal Tilt + * + * @type { ?number } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + * @form + */ + rotateX?: number; + /** + * Vertical Zoom + * + * @type { ?number } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 8 + */ + /** + * Vertical Zoom + * + * @type { ?number } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 9 + * @form + */ + /** + * Vertical Zoom + * + * @type { ?number } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + * @form + */ + scaleY?: number; + /** + * Horizontal movement + * + * @type { ?number } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 8 + */ + /** + * Horizontal movement + * + * @type { ?number } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 9 + * @form + */ + /** + * Horizontal movement + * + * @type { ?number } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + * @form + */ + translateX?: number; + /** + * Vertical movement + * + * @type { ?number } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 8 + */ + /** + * Vertical movement + * + * @type { ?number } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 9 + * @form + */ + /** + * Vertical movement + * + * @type { ?number } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + * @form + */ + translateY?: number; + /** + * Transforms the current 2D matrix back to the identity matrix (i.e., without any rotational + * translation scaling effect) + * + * @returns { Matrix2D } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 8 + */ + /** + * Transforms the current 2D matrix back to the identity matrix (i.e., without any rotational + * translation scaling effect) + * + * @returns { Matrix2D } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 9 + * @form + */ + /** + * Transforms the current 2D matrix back to the identity matrix (i.e., without any rotational + * translation scaling effect) + * + * @returns { Matrix2D } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + * @form + */ + identity(): Matrix2D; + /** + * Transform the current 2D matrix into an inverse matrix (that is, the transformation effect + * is the opposite effect of the original) + * + * @returns { Matrix2D } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 8 + */ + /** + * Transform the current 2D matrix into an inverse matrix (that is, the transformation effect + * is the opposite effect of the original) + * + * @returns { Matrix2D } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 9 + * @form + */ + /** + * Transform the current 2D matrix into an inverse matrix (that is, the transformation effect + * is the opposite effect of the original) + * + * @returns { Matrix2D } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + * @form + */ + invert(): Matrix2D; + /** + * The matrix is superimposed in right multiplication mode. When the input parameter is empty, + * the matrix is superimposed. + * + * @param { Matrix2D } [other] - Matrix to be superimposed + * @returns { Matrix2D } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 8 + */ + /** + * The matrix is superimposed in right multiplication mode. When the input parameter is empty, + * the matrix is superimposed. + * + * @param { Matrix2D } [other] - Matrix to be superimposed + * @returns { Matrix2D } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 9 + * @form + */ + /** + * The matrix is superimposed in right multiplication mode. When the input parameter is empty, + * the matrix is superimposed. + * + * @param { Matrix2D } [other] - Matrix to be superimposed + * @returns { Matrix2D } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + * @form + */ + multiply(other?: Matrix2D): Matrix2D; + /** + * Adds the rotation effect of the X and Y axes to the current matrix. + * + * @param { number } [rx] - Rotation effect of the X axis + * @param { number } [ry] - Rotation effect of the Y-axis + * @returns { Matrix2D } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 8 + */ + /** + * Adds the rotation effect of the X and Y axes to the current matrix. + * + * @param { number } [rx] - Rotation effect of the X axis + * @param { number } [ry] - Rotation effect of the Y-axis + * @returns { Matrix2D } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 9 + * @form + */ + /** + * Adds the rotation effect of the X and Y axes to the current matrix. + * + * @param { number } [rx] - Rotation effect of the X axis + * @param { number } [ry] - Rotation effect of the Y-axis + * @returns { Matrix2D } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + * @form + */ + rotate(rx?: number, ry?: number): Matrix2D; + /** + * Adds the translation effect of the X and Y axes to the current matrix. + * + * @param { number } [tx] - X-axis translation effect + * @param { number } [ty] - Y-axis translation effect + * @returns { Matrix2D } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 8 + */ + /** + * Adds the translation effect of the X and Y axes to the current matrix. + * + * @param { number } [tx] - X-axis translation effect + * @param { number } [ty] - Y-axis translation effect + * @returns { Matrix2D } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 9 + * @form + */ + /** + * Adds the translation effect of the X and Y axes to the current matrix. + * + * @param { number } [tx] - X-axis translation effect + * @param { number } [ty] - Y-axis translation effect + * @returns { Matrix2D } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + * @form + */ + translate(tx?: number, ty?: number): Matrix2D; + /** + * Adds the scaling effect of the X and Y axes to the current matrix. + * + * @param { number } [sx] - X-axis scaling effect + * @param { number } [sy] - Y-axis scaling effect + * @returns { Matrix2D } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 8 + */ + /** + * Adds the scaling effect of the X and Y axes to the current matrix. + * + * @param { number } [sx] - X-axis scaling effect + * @param { number } [sy] - Y-axis scaling effect + * @returns { Matrix2D } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 9 + * @form + */ + /** + * Adds the scaling effect of the X and Y axes to the current matrix. + * + * @param { number } [sx] - X-axis scaling effect + * @param { number } [sy] - Y-axis scaling effect + * @returns { Matrix2D } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + * @form + */ + scale(sx?: number, sy?: number): Matrix2D; + /** + * Constructs a 2D change matrix object. The default value is the unit matrix. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 8 + */ + /** + * Constructs a 2D change matrix object. The default value is the unit matrix. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 9 + * @form + */ + /** + * Constructs a 2D change matrix object. The default value is the unit matrix. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + * @form + */ + constructor(); +} diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@internal/full/featureability.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@internal/full/featureability.d.ts new file mode 100755 index 00000000..b1e0af6d --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@internal/full/featureability.d.ts @@ -0,0 +1,452 @@ +/* + * Copyright (c) 2020 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit ArkUI + */ +/** + * @typedef Result + * @syscap SystemCapability.ArkUI.ArkUI.Lite + * @since 5 + * @deprecated since 8 + */ +export interface Result { + /** + * Result code. + * @syscap SystemCapability.ArkUI.ArkUI.Lite + * @since 5 + * @deprecated since 8 + */ + code: number; + /** + * Returned data. + * @syscap SystemCapability.ArkUI.ArkUI.Lite + * @since 5 + * @deprecated since 8 + */ + data: object; +} +/** + * @typedef SubscribeMessageResponse + * @syscap SystemCapability.ArkUI.ArkUI.Lite + * @since 5 + * @deprecated since 8 + */ +export interface SubscribeMessageResponse { + /** + * Peer device ID. + * @syscap SystemCapability.ArkUI.ArkUI.Lite + * @since 5 + * @deprecated since 8 + */ + deviceId: string; + /** + * Name of the bundle where the peer ability has been located. The name is case sensitive. + * @syscap SystemCapability.ArkUI.ArkUI.Lite + * @since 5 + * @deprecated since 8 + */ + bundleName: string; + /** + * Peer ability name, which is case sensitive. + * @syscap SystemCapability.ArkUI.ArkUI.Lite + * @since 5 + * @deprecated since 8 + */ + abilityName: string; + /** + * Messages received from the device. + * @syscap SystemCapability.ArkUI.ArkUI.Lite + * @since 5 + * @deprecated since 8 + */ + message: string; +} +/** + * @typedef CallAbilityParam + * @syscap SystemCapability.ArkUI.ArkUI.Lite + * @since 5 + * @deprecated since 8 + */ +export interface CallAbilityParam { + /** + * Name of the bundle where the ability has been located. The name is case sensitive and must be the same as that on the AA side. + * @syscap SystemCapability.ArkUI.ArkUI.Lite + * @since 5 + * @deprecated since 8 + */ + bundleName: string; + /** + * Ability name, which is case sensitive and must be the same as that on the AA side. + * @syscap SystemCapability.ArkUI.ArkUI.Lite + * @since 5 + * @deprecated since 8 + */ + abilityName: string; + /** + * Ability operation code, which defines the service function of an AA and must be consistent with the AA side. + * @syscap SystemCapability.ArkUI.ArkUI.Lite + * @since 5 + * @deprecated since 8 + */ + messageCode: number; + /** + * Ability type. Different types of abilities have different implementation on the AA side. + * 0: Ability, which has an independent lifecycle. The FA starts and requests an AA through an RPC. Such type of abilities are used to provide basic services for multiple FAs to call or are used when the abilities should run in the background. + * 1: Internal ability, which shares the same process with the FA and communicates with it by calling internal functions. Such type of abilities are used in scenarios that require low response latency and cannot be called by other FAs. + * @syscap SystemCapability.ArkUI.ArkUI.Lite + * @since 5 + * @deprecated since 8 + */ + abilityType: number; + /** + * Data sent to the ability. The data to carry differs depending on the service to be processed and its field name must be consistent with the AA side. + * @syscap SystemCapability.ArkUI.ArkUI.Lite + * @since 5 + * @deprecated since 8 + */ + data?: object; + /** + * Whether the request is synchronous or asynchronous. The synchronous mode is used by default. Currently, the asynchronous mode is available only for internal abilities. + * 0: Synchronous mode (default value) + * 1: Asynchronous mode + * @syscap SystemCapability.ArkUI.ArkUI.Lite + * @since 5 + * @deprecated since 8 + */ + syncOption?: number; +} +/** + * @typedef SubscribeAbilityEventParam + * @syscap SystemCapability.ArkUI.ArkUI.Lite + * @since 5 + * @deprecated since 8 + */ +export interface SubscribeAbilityEventParam { + /** + * Name of the bundle where the ability has been located. The name is case sensitive and must be the same as that on the AA side. + * @syscap SystemCapability.ArkUI.ArkUI.Lite + * @since 5 + * @deprecated since 8 + */ + bundleName: string; + /** + * Ability name, which is case sensitive and must be the same as that on the AA side. + * @syscap SystemCapability.ArkUI.ArkUI.Lite + * @since 5 + * @deprecated since 8 + */ + abilityName: string; + /** + * Ability operation code, which defines the service function of an AA and must be consistent with the AA side. + * @syscap SystemCapability.ArkUI.ArkUI.Lite + * @since 5 + * @deprecated since 8 + */ + messageCode: number; + /** + * Ability type. Different types of abilities have different implementation on the AA side. + * 0: Ability, which has an independent lifecycle. The FA starts and requests an AA through an RPC. Such type of abilities are used to provide basic services for multiple FAs to call or are used when the abilities should run in the background. + * 1: Internal ability, which shares the same process with the FA and communicates with it by calling internal functions. Such type of abilities are used in scenarios that require low response latency and cannot be called by other FAs. + * @syscap SystemCapability.ArkUI.ArkUI.Lite + * @since 5 + * @deprecated since 8 + */ + abilityType: number; + /** + * Whether the request is synchronous or asynchronous. The synchronous mode is used by default. Currently, the asynchronous mode is available only for internal abilities. + * 0: Synchronous mode (default value) + * 1: Asynchronous mode + * @syscap SystemCapability.ArkUI.ArkUI.Lite + * @since 5 + * @deprecated since 8 + */ + syncOption?: number; +} +/** + * @typedef SendMessageOptions + * @syscap SystemCapability.ArkUI.ArkUI.Lite + * @since 5 + * @deprecated since 8 + */ +export interface SendMessageOptions { + /** + * Destination device ID. + * @syscap SystemCapability.ArkUI.ArkUI.Lite + * @since 5 + * @deprecated since 8 + */ + deviceId: string; + /** + * Name of the destination bundle where the ability has been located. The name is case sensitive. + * @syscap SystemCapability.ArkUI.ArkUI.Lite + * @since 5 + * @deprecated since 8 + */ + bundleName: string; + /** + * Destination ability name, which is case sensitive. + * @syscap SystemCapability.ArkUI.ArkUI.Lite + * @since 5 + * @deprecated since 8 + */ + abilityName: string; + /** + * Messages sent to the destination device. + * A maximum of 1 KB of data can be transmitted at a time. + * If more than 1 KB of data needs to be transmitted, split the messages into multiple parts to transmit. + * @syscap SystemCapability.ArkUI.ArkUI.Lite + * @since 5 + * @deprecated since 8 + */ + message?: string; + /** + * Called when the messages are sent successfully. + * @syscap SystemCapability.ArkUI.ArkUI.Lite + * @since 5 + * @deprecated since 8 + */ + success?: () => void; + /** + * Called when the messages fail to be sent. + * @syscap SystemCapability.ArkUI.ArkUI.Lite + * @since 5 + * @deprecated since 8 + */ + fail?: (data: string, code: number) => void; + /** + * Called when the execution is completed. + * @syscap SystemCapability.ArkUI.ArkUI.Lite + * @since 5 + * @deprecated since 8 + */ + complete?: () => void; +} +/** + * @typedef SubscribeMessageOptions + * @syscap SystemCapability.ArkUI.ArkUI.Lite + * @since 5 + * @deprecated since 8 + */ +export interface SubscribeMessageOptions { + /** + * Called when the messages are sent successfully. + * @syscap SystemCapability.ArkUI.ArkUI.Lite + * @since 5 + * @deprecated since 8 + */ + success?: (data: SubscribeMessageResponse) => void; + /** + * Called when the messages fail to be sent. + * @syscap SystemCapability.ArkUI.ArkUI.Lite + * @since 5 + * @deprecated since 8 + */ + fail?: (data: string, code: number) => void; +} +/** + * @typedef RequestParams + * @syscap SystemCapability.ArkUI.ArkUI.Lite + * @since 5 + * @deprecated since 8 + */ +export interface RequestParams { + /** + * The name of the bundle to start. It should be used with abilityname and case sensitive. + * @syscap SystemCapability.ArkUI.ArkUI.Lite + * @since 5 + * @deprecated since 8 + */ + bundleName?: string; + /** + * Ability name, which is case sensitive. + * @syscap SystemCapability.ArkUI.ArkUI.Lite + * @since 5 + * @deprecated since 8 + */ + abilityName?: string; + /** + * The list of entities to which the FA to be called. If it is not filled in, all entity lists will be found by default. It should be used with action. + * @syscap SystemCapability.ArkUI.ArkUI.Lite + * @since 5 + * @deprecated since 8 + */ + entities?: Array; + /** + * Without specifying the bundle name and ability name, you can start the application according to other properties with action. + * @syscap SystemCapability.ArkUI.ArkUI.Lite + * @since 5 + * @deprecated since 8 + */ + action?: string; + /** + * If more than one FA meets the conditions, the user can select the device from the popup. + * 0: Default. Select the FA to start from the local and remote devices. + * 1: start FA from the local device. + * @syscap SystemCapability.ArkUI.ArkUI.Lite + * @since 5 + * @deprecated since 8 + */ + deviceType?: number; + /** + * Data sent to the ability which need to be serializable. + * @syscap SystemCapability.ArkUI.ArkUI.Lite + * @since 5 + * @deprecated since 8 + */ + data?: object; + /** + * Configuration switch when start FA. + * @syscap SystemCapability.ArkUI.ArkUI.Lite + * @since 5 + * @deprecated since 8 + */ + flag?: number; + /** + * Specify the url of the page which the FA to be called. Use home page directly by default. + * @syscap SystemCapability.ArkUI.ArkUI.Lite + * @since 5 + * @deprecated since 8 + */ + url?: string; +} +/** + * @typedef FinishWithResultParams + * @syscap SystemCapability.ArkUI.ArkUI.Lite + * @since 5 + * @deprecated since 8 + */ +export interface FinishWithResultParams { + /** + * Result code. + * @syscap SystemCapability.ArkUI.ArkUI.Lite + * @since 5 + * @deprecated since 8 + */ + code: number; + /** + * Returned data. + * @syscap SystemCapability.ArkUI.ArkUI.Lite + * @since 5 + * @deprecated since 8 + */ + result: object; +} +/** + * @syscap SystemCapability.ArkUI.ArkUI.Lite + * @since 5 + * @deprecated since 8 + * @useinstead ohos.ability.featureAbility.FeatureAbility + */ +export declare class FeatureAbility { + /** + * Start a FA without callback result. + * @param { RequestParams } request - Indicates the request param. + * @returns { Promise } A Promise object is returned, which contains the result of whether to call Ability's interface successfully. + * @syscap SystemCapability.ArkUI.ArkUI.Lite + * @since 5 + * @deprecated since 8 + * @useinstead ohos.ability.featureAbility.FeatureAbility#startAbility + */ + static startAbility(request: RequestParams): Promise; + /** + * Start a FA with callback result. + * @param { RequestParams } request - Indicates the request param. + * @returns { Promise } A Promise object is returned, which contains the result of the data FA returned. + * @syscap SystemCapability.ArkUI.ArkUI.Lite + * @since 5 + * @deprecated since 8 + * @useinstead ohos.ability.featureAbility.FeatureAbility#startAbilityForResult + */ + static startAbilityForResult(request: RequestParams): Promise; + /** + * FA call the interface to destroy itself and set the result as parameters. + * @param { FinishWithResultParams } param - Indicates the request param. + * @returns { Promise } A Promise object is returned, which contains the result whether to callback successfully. + * @syscap SystemCapability.ArkUI.ArkUI.Lite + * @since 5 + * @deprecated since 8 + * @useinstead ohos.ability.featureAbility.FeatureAbility#terminateSelfWithResult + */ + static finishWithResult(param: FinishWithResultParams): Promise; + /** + * Get device information list. + * @param { number } flag - Default 0, get the information list of all devices in the network. + * @returns { Promise } A Promise object is returned, which contains the result whether the device information list is obtained successfully. + * @syscap SystemCapability.ArkUI.ArkUI.Lite + * @since 5 + * @deprecated since 8 + */ + static getDeviceList(flag: number): Promise; + /** + * Calls an AA. + * @param { CallAbilityParam } param - Indicates the request param. + * @returns { Promise } A Promise object is returned, which contains the result data returned by the AA. The result is a JSON string. + * @syscap SystemCapability.ArkUI.ArkUI.Lite + * @since 5 + * @deprecated since 8 + */ + static callAbility(param: CallAbilityParam): Promise; + /** + * Start FA migration. + * @returns { Promise } A Promise object is returned, which contains the result data returned by the AA. The result is a JSON string. + * @syscap SystemCapability.ArkUI.ArkUI.Lite + * @since 5 + * @deprecated since 8 + */ + static continueAbility(): Promise; + /** + * Subscribe to events of an AA. + * @param { SubscribeAbilityEventParam } param - Indicates the request param. + * @param { Function } func - Indicates the event reporting callback. + * @returns { Promise } A Promise object is returned, which contains the result data returned by the AA. The result is a JSON string. + * @syscap SystemCapability.ArkUI.ArkUI.Lite + * @since 5 + * @deprecated since 8 + */ + static subscribeAbilityEvent(param: SubscribeAbilityEventParam, func: Function): Promise; + /** + * Unsubscribe from events of an AA. + * @param { SubscribeAbilityEventParam } param - Indicates the request param. + * @returns { Promise } A Promise object is returned, which contains the result data returned by the AA. The result is a JSON string. + * @syscap SystemCapability.ArkUI.ArkUI.Lite + * @since 5 + * @deprecated since 8 + */ + static unsubscribeAbilityEvent(param: SubscribeAbilityEventParam): Promise; + /** + * Sends messages to the destination device. + * @param { SendMessageOptions } options - Options. + * @syscap SystemCapability.ArkUI.ArkUI.Lite + * @since 5 + * @deprecated since 8 + */ + static sendMsg(options: SendMessageOptions): void; + /** + * Listens for messages sent from other devices. + * @param { SubscribeMessageOptions } options - Options. + * @syscap SystemCapability.ArkUI.ArkUI.Lite + * @since 5 + * @deprecated since 8 + */ + static subscribeMsg(options: SubscribeMessageOptions): void; + /** + * Cancel the listening for messages sent from other devices. + * @syscap SystemCapability.ArkUI.ArkUI.Lite + * @since 5 + * @deprecated since 8 + */ + static unsubscribeMsg(): void; +} diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@internal/full/global.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@internal/full/global.d.ts new file mode 100755 index 00000000..a406bc3e --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@internal/full/global.d.ts @@ -0,0 +1,746 @@ +/* + * Copyright (c) 2021-2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit ArkUI + */ + +/// +import { TouchObject, KeyEvent, MouseEvent } from 'SpecialEvent'; +/** + * Defines the console info. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 7 + */ +/** + * Defines the console info. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 9 + * @form + */ +/** + * Defines the console info. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 10 + * @form + */ +/** + * Defines the console info. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 11 + * @form + */ +export declare class console { + /** + * Prints "debug" logs. + * + * @param { string } message - Text to print. + * @param { any[] } arguments + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 7 + */ + /** + * Prints "debug" logs. + * + * @param { string } message - Text to print. + * @param { any[] } arguments + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 9 + * @form + */ + /** + * Prints "debug" logs. + * + * @param { string } message - Text to print. + * @param { any[] } arguments + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 10 + * @form + */ + /** + * Prints "debug" logs. + * + * @param { string } message - Text to print. + * @param { any[] } arguments + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 11 + * @form + */ + static debug(message: string, ...arguments: any[]): void; + /** + * Prints "log" logs. + * + * @param { string } message - Text to print. + * @param { any[] } arguments + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 7 + */ + /** + * Prints "log" logs. + * + * @param { string } message - Text to print. + * @param { any[] } arguments + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 9 + * @form + */ + /** + * Prints "log" logs. + * + * @param { string } message - Text to print. + * @param { any[] } arguments + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 10 + * @form + */ + /** + * Prints "log" logs. + * + * @param { string } message - Text to print. + * @param { any[] } arguments + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 11 + * @form + */ + static log(message: string, ...arguments: any[]): void; + /** + * Prints "info" logs. + * + * @param { string } message - Text to print. + * @param { any[] } arguments + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 7 + */ + /** + * Prints "info" logs. + * + * @param { string } message - Text to print. + * @param { any[] } arguments + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 9 + * @form + */ + /** + * Prints "info" logs. + * + * @param { string } message - Text to print. + * @param { any[] } arguments + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 10 + * @form + */ + /** + * Prints "info" logs. + * + * @param { string } message - Text to print. + * @param { any[] } arguments + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 11 + * @form + */ + static info(message: string, ...arguments: any[]): void; + /** + * Prints "warn" logs. + * + * @param { string } message - Text to print. + * @param { any[] } arguments + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 7 + */ + /** + * Prints "warn" logs. + * + * @param { string } message - Text to print. + * @param { any[] } arguments + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 9 + * @form + */ + /** + * Prints "warn" logs. + * + * @param { string } message - Text to print. + * @param { any[] } arguments + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 10 + * @form + */ + /** + * Prints "warn" logs. + * + * @param { string } message - Text to print. + * @param { any[] } arguments + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 11 + * @form + */ + static warn(message: string, ...arguments: any[]): void; + /** + * Prints "error" logs. + * + * @param { string } message - Text to print. + * @param { any[] } arguments + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 7 + */ + /** + * Prints "error" logs. + * + * @param { string } message - Text to print. + * @param { any[] } arguments + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 9 + * @form + */ + /** + * Prints "error" logs. + * + * @param { string } message - Text to print. + * @param { any[] } arguments + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 10 + * @form + */ + /** + * Prints "error" logs. + * + * @param { string } message - Text to print. + * @param { any[] } arguments + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 11 + * @form + */ + static error(message: string, ...arguments: any[]): void; + /** + * Prints a message if value is false or omitted. + * + * @param { Object } [value] - The value tested for being truthy. + * @param { Object[] } arguments - Used as error message to print. + * @throws { BusinessError } 401 - The parameter check failed. + * @static + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @since 10 + */ + static assert(value?: Object, ...arguments: Object[]): void; + /** + * Maintains an internal counter specific to label and print the number of times + * console.count() has been called with the given label. + * + * @param { string } [label] - Counter name. Default: "default". + * @throws { BusinessError } 401 - The parameter check failed. + * @static + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @since 10 + */ + static count(label?: string): void; + /** + * Reset the internal counter specific to label. + * + * @param { string } [label] - Counter name. Default: "default". + * @throws { BusinessError } 401 - The parameter check failed. + * @static + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @since 10 + */ + static countReset(label?: string): void; + /** + * Prints properties of the specified JavaScript object. + * + * @param { Object } [dir] - A JavaScript object whose properties should be output. + * @static + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @since 10 + */ + static dir(dir?: Object): void; + /** + * This method calls console.log() passing it the arguments received. + * This method does not produce any XML formatting. + * + * @param { Object[] } arguments - Text to print. + * @static + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @since 10 + */ + static dirxml(...arguments: Object[]): void; + /** + * Creates a new inline group, causing any subsequent console messages to be indented by an additional level. + * + * @param { Object[] } arguments - messages to print first. + * @static + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @since 10 + */ + static group(...arguments: Object[]): void; + /** + * Same as console.group() + * + * @param { Object[] } arguments - messages to print first. + * @static + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @since 10 + */ + static groupCollapsed(...arguments: Object[]): void; + /** + * Exit current inline group. + * + * @static + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @since 10 + */ + static groupEnd(): void; + /** + * Prints tabular data as a table. + * + * @param { Object } [tableData] - tabular data. + * @static + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @since 10 + */ + static table(tableData?: Object): void; + /** + * Start a timer. + * + * @param { string } [label] - Timer name. Default: "default". + * @throws { BusinessError } 401 - The parameter check failed. + * @static + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @since 10 + */ + static time(label?: string): void; + /** + * End a timer and print time duration. + * + * @param { string } [label] - Timer name. Default: "default". + * @throws { BusinessError } 401 - The parameter check failed. + * @static + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @since 10 + */ + static timeEnd(label?: string): void; + /** + * Print the elapsed time and other data arguments. + * + * @param { string } [label] - Timer name. Default: "default". + * @param { Object[] } arguments - Text to print. + * @throws { BusinessError } 401 - The parameter check failed. + * @static + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @since 10 + */ + static timeLog(label?: string, ...arguments: Object[]): void; + /** + * Prints stack information for the current code location. + * + * @param { Object[] } arguments - message to print. + * @static + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @since 10 + */ + static trace(...arguments: Object[]): void; + /** + * Prints hybrid stack information for the current code location. + * + * @static + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @since 12 + */ + static traceHybridStack(): void; +} +/** + * Sets the interval for repeatedly calling a function. + * + * @param { Function | string } handler - Indicates the function to be called after the timer goes off. + * For devices of "tv", "phone, tablet", and "wearable" types, this parameter can be a function or string. + * For devices of "lite wearable" and "smartVision" types, this parameter must be a function. + * @param { number } delay - Indicates the interval between each two calls, in milliseconds. The function will be called after this delay. + * @param { any[] } arguments - Indicates additional arguments to pass to "handler" when the timer goes off. + * @returns { number } Returns the timer ID. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 7 + */ +/** + * Sets the interval for repeatedly calling a function. + * + * @param { Function | string } handler - Indicates the function to be called after the timer goes off. + * For devices of "tv", "phone, tablet", and "wearable" types, this parameter can be a function or string. + * For devices of "lite wearable" and "smartVision" types, this parameter must be a function. + * @param { number } delay - Indicates the interval between each two calls, in milliseconds. The function will be called after this delay. + * @param { any[] } arguments - Indicates additional arguments to pass to "handler" when the timer goes off. + * @returns { number } Returns the timer ID. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 10 + */ +/** + * Sets the interval for repeatedly calling a function. + * + * @param { Function | string } handler - Indicates the function to be called after the timer goes off. + * For devices of "tv", "phone, tablet", and "wearable" types, this parameter can be a function or string. + * For devices of "lite wearable" and "smartVision" types, this parameter must be a function. + * @param { number } delay - Indicates the interval between each two calls, in milliseconds. The function will be called after this delay. + * @param { any[] } arguments - Indicates additional arguments to pass to "handler" when the timer goes off. + * @returns { number } Returns the timer ID. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 11 + */ +export declare function setInterval(handler: Function | string, delay: number, ...arguments: any[]): number; +/** + * Sets a timer after which a function will be executed. + * + * @param { Function | string } handler - Indicates the function to be called after the timer goes off. + * For devices of "tv", "phone, tablet", and "wearable" types, this parameter can be a function or string. + * For devices of "lite wearable" and "smartVision" types, this parameter must be a function. + * @param { number } [delay] - Indicates the delay (in milliseconds) after which the function will be called. + * If this parameter is left empty, default value "0" will be used, which means that the function will be called immediately or as soon as possible. + * @param { any[] } arguments - Indicates additional arguments to pass to "handler" when the timer goes off. + * @returns { number } Returns the timer ID. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 7 + */ +/** + * Sets a timer after which a function will be executed. + * + * @param { Function | string } handler - Indicates the function to be called after the timer goes off. + * For devices of "tv", "phone, tablet", and "wearable" types, this parameter can be a function or string. + * For devices of "lite wearable" and "smartVision" types, this parameter must be a function. + * @param { number } [delay] - Indicates the delay (in milliseconds) after which the function will be called. + * If this parameter is left empty, default value "0" will be used, which means that the function will be called immediately or as soon as possible. + * @param { any[] } [arguments] - Indicates additional arguments to pass to "handler" when the timer goes off. + * @returns { number } Returns the timer ID. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 10 + */ +/** + * Sets a timer after which a function will be executed. + * + * @param { Function | string } handler - Indicates the function to be called after the timer goes off. + * For devices of "tv", "phone, tablet", and "wearable" types, this parameter can be a function or string. + * For devices of "lite wearable" and "smartVision" types, this parameter must be a function. + * @param { number } [delay] - Indicates the delay (in milliseconds) after which the function will be called. + * If this parameter is left empty, default value "0" will be used, which means that the function will be called immediately or as soon as possible. + * @param { any[] } [arguments] - Indicates additional arguments to pass to "handler" when the timer goes off. + * @returns { number } Returns the timer ID. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 11 + */ +export declare function setTimeout(handler: Function | string, delay?: number, ...arguments: any[]): number; +/** + * Cancel the interval set by " setInterval()". + * + * @param { number } [intervalID] - Indicates the timer ID returned by "setInterval()". + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 7 + */ +/** + * Cancel the interval set by " setInterval()". + * + * @param { number } [intervalID] - Indicates the timer ID returned by "setInterval()". + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 10 + */ +/** + * Cancel the interval set by " setInterval()". + * + * @param { number } [intervalID] - Indicates the timer ID returned by "setInterval()". + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 11 + */ +export declare function clearInterval(intervalID?: number): void; +/** + * Cancel the timer set by "setTimeout()". + * + * @param { number } [timeoutID] - Indicates the timer ID returned by "setTimeout()". + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 7 + */ +/** + * Cancel the timer set by "setTimeout()". + * + * @param { number } [timeoutID] - Indicates the timer ID returned by "setTimeout()". + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 10 + */ +/** + * Cancel the timer set by "setTimeout()". + * + * @param { number } [timeoutID] - Indicates the timer ID returned by "setTimeout()". + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 11 + */ +export declare function clearTimeout(timeoutID?: number): void; +/** + * Defining syscap function. + * + * @param { string } syscap + * @returns { boolean } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 8 + */ +/** + * Defining syscap function. + * + * @param { string } syscap + * @returns { boolean } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 10 + */ +/** + * Defining syscap function. + * + * @param { string } syscap + * @returns { boolean } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 11 + */ +export declare function canIUse(syscap: string): boolean; +/** + * Obtains all attributes of the component with the specified ID. + * + * @param { string } id - ID of the component whose attributes are to be obtained. + * @returns { string } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 9 + * @test + */ +/** + * Obtains all attributes of the component with the specified ID. + * + * @param { string } id - ID of the component whose attributes are to be obtained. + * @returns { string } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 10 + * @test + */ +/** + * Obtains all attributes of the component with the specified ID. + * + * @param { string } id - ID of the component whose attributes are to be obtained. + * @returns { string } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 11 + * @test + */ +export declare function getInspectorByKey(id: string): string; +/** + * Get components tree. + * + * @returns { Object } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 9 + * @test + */ +/** + * Get components tree. + * + * @returns { Object } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 10 + * @test + */ +/** + * Get components tree. + * + * @returns { Object } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 11 + * @test + */ +export declare function getInspectorTree(): Object; +/** + * Sends an event to the component with the specified ID. + * + * @param { string } id - ID of the component for which the event is to be sent. + * @param { number } action - Type of the event to be sent. The options are as follows: Click event: 10 LongClick: 11. + * @param { string } params - Event parameters. If there is no parameter, pass an empty string "". + * @returns { boolean } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 9 + * @test + */ +/** + * Sends an event to the component with the specified ID. + * + * @param { string } id - ID of the component for which the event is to be sent. + * @param { number } action - Type of the event to be sent. The options are as follows: Click event: 10 LongClick: 11. + * @param { string } params - Event parameters. If there is no parameter, pass an empty string "". + * @returns { boolean } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 10 + * @test + */ +/** + * Sends an event to the component with the specified ID. + * + * @param { string } id - ID of the component for which the event is to be sent. + * @param { number } action - Type of the event to be sent. The options are as follows: Click event: 10 LongClick: 11. + * @param { string } params - Event parameters. If there is no parameter, pass an empty string "". + * @returns { boolean } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 11 + * @test + */ +export declare function sendEventByKey(id: string, action: number, params: string): boolean; +/** + * Send touch event. + * + * @param { TouchObject } event - TouchObject to be sent. + * @returns { boolean } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 9 + * @test + */ +/** + * Send touch event. + * + * @param { TouchObject } event - TouchObject to be sent. + * @returns { boolean } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 10 + * @test + */ +/** + * Send touch event. + * + * @param { TouchObject } event - TouchObject to be sent. + * @returns { boolean } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 11 + * @test + */ +export declare function sendTouchEvent(event: TouchObject): boolean; +/** + * Send key event. + * + * @param { KeyEvent } event - KeyEvent to be sent. + * @returns { boolean } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 9 + * @test + */ +/** + * Send key event. + * + * @param { KeyEvent } event - KeyEvent to be sent. + * @returns { boolean } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 10 + * @test + */ +/** + * Send key event. + * + * @param { KeyEvent } event - KeyEvent to be sent. + * @returns { boolean } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 11 + * @test + */ +export declare function sendKeyEvent(event: KeyEvent): boolean; +/** + * Send mouse event. + * + * @param { MouseEvent } event - MouseEvent to be sent. + * @returns { boolean } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 9 + * @test + */ +/** + * Send mouse event. + * + * @param { MouseEvent } event - MouseEvent to be sent. + * @returns { boolean } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 10 + * @test + */ +/** + * Send mouse event. + * + * @param { MouseEvent } event - MouseEvent to be sent. + * @returns { boolean } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 11 + * @test + */ +export declare function sendMouseEvent(event: MouseEvent): boolean; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@internal/full/index.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@internal/full/index.d.ts new file mode 100755 index 00000000..f9796d4f --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@internal/full/index.d.ts @@ -0,0 +1,17 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +export * from './featureability'; +export * from './global'; +export * from './lifecycle'; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@internal/full/lifecycle.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@internal/full/lifecycle.d.ts new file mode 100755 index 00000000..cceb73df --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@internal/full/lifecycle.d.ts @@ -0,0 +1,548 @@ +/* + * Copyright (c) 2021-2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit AbilityKit + */ +import Want from '../../@ohos.app.ability.Want'; +import { ResultSet } from '../../data/rdb/resultSet'; +import { AbilityInfo } from '../../bundle/abilityInfo'; +import { DataAbilityResult } from '../../ability/dataAbilityResult'; +import { DataAbilityOperation } from '../../ability/dataAbilityOperation'; +import dataAbility from '../../@ohos.data.dataAbility'; +import formBindingData from '../../@ohos.application.formBindingData'; +import formInfo from '../../@ohos.app.form.formInfo'; +import rdb from '../../@ohos.data.rdb'; +import rpc from '../../@ohos.rpc'; +import { PacMap } from '../../ability/dataAbilityHelper'; +import { AsyncCallback } from '../../@ohos.base'; +/** + * interface of form lifecycle. + * + * @interface LifecycleForm + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @FAModelOnly + * @since 7 + */ +export declare interface LifecycleForm { + /** + * Called to return a {@link formBindingData.FormBindingData} object. + * + * @param { Want } want - Indicates the detailed information for creating a {@link formBindingData#FormBindingData}. + * The {@code Want} object must include the form ID, form name, and grid style of the form, + * which can be obtained from {@link formInfo#FormParam#IDENTITY_KEY}, + * {@link formInfo#FormParam#NAME_KEY}, and {@link formInfo#FormParam#DIMENSION_KEY}, + * respectively. Such form information must be managed as persistent data for further form + * acquisition, update, and deletion. + * @returns { formBindingData.FormBindingData } Returns the created {@link formBindingData#FormBindingData} object. + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @FAModelOnly + * @since 8 + */ + onCreate?(want: Want): formBindingData.FormBindingData; + /** + * Called when the form provider is notified that a temporary form is successfully converted to a normal form. + * + * @param { string } formId - Indicates the ID of the form. + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @FAModelOnly + * @since 8 + */ + onCastToNormal?(formId: string): void; + /** + * Called to notify the form provider to update a specified form. + * + * @param { string } formId - Indicates the ID of the form to update. + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @FAModelOnly + * @since 8 + */ + onUpdate?(formId: string): void; + /** + * Called when the form provider receives form events from the system. + * + * @param { object } newStatus - Indicates the form events occurred. The key in the {@code Map} object indicates + * form ID,and the value indicates the event type, which can be either + * {@link formInfo#VisibilityType#FORM_VISIBLE} or + * {@link formInfo#VisibilityType#FORM_INVISIBLE}. + * {@link formInfo#VisibilityType#FORM_VISIBLE} + * means that the form becomes visible, and + * {@link formInfo#VisibilityType#FORM_INVISIBLE} + * means that the form becomes invisible. + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @FAModelOnly + * @since 8 + */ + /** + * Called when the form provider receives form events from the system. + * + * @param { Record } newStatus - Indicates the form events occurred. The key in the {@code Map} + * object indicates form ID,and the value indicates the event type, + * which can be either + * {@link formInfo#VisibilityType#FORM_VISIBLE} or + * {@link formInfo#VisibilityType#FORM_INVISIBLE}. + * {@link formInfo#VisibilityType#FORM_VISIBLE} + * means that the form becomes visible, and + * {@link formInfo#VisibilityType#FORM_INVISIBLE} + * means that the form becomes invisible. + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @FAModelOnly + * @since 11 + */ + onVisibilityChange?(newStatus: Record): void; + /** + * Called when a specified message event defined by the form provider is triggered. This method is valid only for + * JS forms. + * + * @param { string } formId - Indicates the ID of the form on which the message event is triggered, which is + * provided by the client to the form provider. + * @param { string } message - Indicates the value of the {@code params} field of the message event. This parameter + * is used to identify the specific component on which the event is triggered. + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @FAModelOnly + * @since 8 + */ + onEvent?(formId: string, message: string): void; + /** + * Called to notify the form provider that a specified form has been deleted. Override this method if + * you want your application, as the form provider, to be notified of form deletion. + * + * @param { string } formId - Indicates the ID of the deleted form. + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @FAModelOnly + * @since 8 + */ + onDestroy?(formId: string): void; + /** + * Called to return a {@link FormState} object. + *

You must override this callback if you want this ability to return the actual form state. Otherwise, + * this method returns {@link FormState#DEFAULT} by default.

+ * + * @param { Want } want - Indicates the description of the form for which the {@link formInfo#FormState} is obtained. + * The description covers the bundle name, ability name, module name, form name, form + * dimensions. + * @returns { formInfo.FormState } Returns the {@link formInfo#FormState} object. + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @FAModelOnly + * @since 8 + */ + onAcquireFormState?(want: Want): formInfo.FormState; +} +/** + * interface of app lifecycle. + * + * @interface LifecycleApp + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @FAModelOnly + * @since 7 + */ +export declare interface LifecycleApp { + /** + * Called back when the state of an ability changes from BACKGROUND to INACTIVE. + * + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @FAModelOnly + * @since 7 + */ + onShow?(): void; + /** + * Called back when an ability enters the BACKGROUND state. + * + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @FAModelOnly + * @since 7 + */ + onHide?(): void; + /** + * Called back before an ability is destroyed. + * + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @FAModelOnly + * @since 7 + */ + onDestroy?(): void; + /** + * Called back when an ability is started for initialization. + * + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @FAModelOnly + * @since 7 + */ + onCreate?(): void; + /** + * Asks a user whether to start the migration. + * + * @returns { boolean } Returns {@code true} if the user allows the migration; returns {@code false} otherwise. + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @FAModelOnly + * @since 7 + */ + onStartContinuation?(): boolean; + /** + * Saves the user data of a local ability generated during runtime. + * After the migration is triggered and the local ability is ready, this method is called when the Distributed + * Scheduler Service requests data from the local ability. + * + * @param { Object } data - Indicates the user data to save. + * @returns { boolean } Returns {@code true} if the data is successfully saved; returns {@code false} otherwise. + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @FAModelOnly + * @since 7 + */ + onSaveData?(data: Object): boolean; + /** + * Called back when a local ability migration is complete. + *

You can define the processing logic after the migration is complete. For example, you can display a prompt to + * notify the user of the successful migration and then exit the local ability.

+ * + * @param { number } result - Indicates the migration result code. The value {@code 0} indicates that the migration is + * successful, and {@code -1} indicates that the migration fails. + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @FAModelOnly + * @since 7 + */ + onCompleteContinuation?(result: number): void; + /** + * Restores the user data saved during the migration for an ability on the remote device immediately after the + * ability is created on the remote device. Lifecycle scheduling for the ability starts only after the user data + * is restored. + * + * @param { Object } data - Indicates the user data to restore. + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @FAModelOnly + * @since 7 + */ + onRestoreData?(data: Object): void; + /** + * Called to notify the local device when a running ability on the remote device is destroyed after a reversible + * migration is performed for the ability from the local device to the remote device. + * + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @FAModelOnly + * @since 7 + */ + onRemoteTerminated?(): void; + /** + * This method is called when the system determines that the ability may be destroyed in an unexpected + * situation, for example, when the screen orientation changes or the user touches the Home key. Generally, + * this method is used only to save temporary states. + * + * @param { PacMap } outState - Indicates the {@code PacMap} object used for storing user data and states. This + * parameter cannot be null. + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @FAModelOnly + * @since 7 + */ + onSaveAbilityState?(outState: PacMap): void; + /** + * This method is called if an ability was destroyed at a certain time due to resource reclaim or was + * unexpectedly destroyed and the {@link #onSaveAbilityState(PacMap)} method was called to save its user data and + * states. Generally, this method is called after the {@link #onStart(Want)} method. + * + * @param { PacMap } inState - Indicates the {@code PacMap} object used for storing data and states. This + * parameter can not be null. + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @FAModelOnly + * @since 7 + */ + onRestoreAbilityState?(inState: PacMap): void; + /** + * Called back when an ability enters the INACTIVE state (an ability in this state is not interactive and may + * change to the BACKGROUND or ACTIVE state). + * + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @FAModelOnly + * @since 7 + */ + onInactive?(): void; + /** + * Called back when an ability enters the ACTIVE state. + * + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @FAModelOnly + * @since 7 + */ + onActive?(): void; + /** + * Called when the launch mode of an ability is set to singleton. + * + * @param { Want } want - Indicates the new {@code want} containing information about the ability. + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @FAModelOnly + * @since 7 + */ + onNewWant?(want: Want): void; + /** + * Called when the system has determined to trim the memory, for example, when the ability is running in the + * background and there is no enough memory for running as many background processes as possible. + * + * @param { number } level - Indicates the memory trim level, which shows the current memory usage status. + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @FAModelOnly + * @since 7 + */ + onMemoryLevel?(level: number): void; +} +/** + * interface of service lifecycle. + * + * @interface LifecycleService + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @FAModelOnly + * @since 7 + */ +export declare interface LifecycleService { + /** + * Called back when an ability is started for initialization (it can be called only once in the entire lifecycle of + * an ability). + * + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @FAModelOnly + * @since 7 + */ + onStart?(): void; + /** + * Called back when Service is started. + * + * @param { Want } want - Indicates the want of Service to start. + * @param { number } startId - Indicates the number of times the Service ability has been started. {@code startId} is + * incremented by 1 every time the ability is started. For example, if the ability + * has been started for six times. + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @FAModelOnly + * @since 7 + */ + onCommand?(want: Want, startId: number): void; + /** + * Called back before an ability is destroyed. + * + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @FAModelOnly + * @since 7 + */ + onStop?(): void; + /** + * Called back when a Service ability is first connected to an ability. + * + * @param { Want } want - Indicates connection information about the Service ability. + * @returns { rpc.RemoteObject } Returns the proxy of the Service ability. + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @FAModelOnly + * @since 7 + */ + onConnect?(want: Want): rpc.RemoteObject; + /** + * Called back when all abilities connected to a Service ability are disconnected. + * + * @param { Want } want - Indicates disconnection information about the Service ability. + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @FAModelOnly + * @since 7 + */ + onDisconnect?(want: Want): void; + /** + * Called when a new client attempts to connect to a Service ability after all previous client connections to it + * are disconnected. + *

The Service ability must have been started but not been destroyed, that is, {@link #startAbility} has been + * called but {@link #terminateSelf} has not.

+ * + * @param { Want } want - Indicates the want of the Service ability being connected. + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @FAModelOnly + * @since 7 + */ + onReconnect?(want: Want): void; +} +/** + * interface of data lifecycle. + * + * @interface LifecycleData + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @FAModelOnly + * @since 7 + */ +export declare interface LifecycleData { + /** + * Updates one or more data records in the database. This method should be implemented by a Data ability. + * + * @param { string } uri - Indicates the database table storing the data to update. + * @param { rdb.ValuesBucket } valueBucket - Indicates the data to update. This parameter can be null. + * @param { dataAbility.DataAbilityPredicates } predicates - Indicates filter criteria. If this parameter is null, + * all data records will be updated by default. + * @param { AsyncCallback } callback - function specified by framework to receive the result, developer should + * call this function to return the result to framework. + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @FAModelOnly + * @since 7 + */ + update?(uri: string, valueBucket: rdb.ValuesBucket, predicates: dataAbility.DataAbilityPredicates, callback: AsyncCallback): void; + /** + * Queries one or more data records in the database. This method should be implemented by a Data ability. + * + * @param { string } uri - Indicates the database table storing the data to query. + * @param { Array } columns - Indicates the columns to be queried, in array, for example, {"name","age"}. + * You should define the processing logic when this parameter is null. + * @param { dataAbility.DataAbilityPredicates } predicates - Indicates filter criteria. If this parameter is null, + * all data records will be queried by default. + * @param { AsyncCallback } callback - function specified by framework to receive the result, developer + * should call this function to return the result to framework. + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @FAModelOnly + * @since 7 + */ + query?(uri: string, columns: Array, predicates: dataAbility.DataAbilityPredicates, callback: AsyncCallback): void; + /** + * Deletes one or more data records. This method should be implemented by a Data ability. + * + * @param { string } uri - Indicates the database table storing the data to delete. + * @param { dataAbility.DataAbilityPredicates } predicates - Indicates filter criteria. If this parameter is null, + * all data records will be deleted by default. + * @param { AsyncCallback } callback - function specified by framework to receive the result, developer should + * call this function to return the result to framework. + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @FAModelOnly + * @since 7 + */ + delete?(uri: string, predicates: dataAbility.DataAbilityPredicates, callback: AsyncCallback): void; + /** + * Converts the given {@code uri} that refer to the Data ability into a normalized URI. A normalized URI can be + * used across devices, persisted, backed up, and restored. It can refer to the same item in the Data ability + * even if the context has changed. + * + * @param { string } uri - Indicates the uri to normalize. + * @param { AsyncCallback } callback - function specified by framework to receive the result, developer + * should call this function to return the result to framework. + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @FAModelOnly + * @since 7 + */ + normalizeUri?(uri: string, callback: AsyncCallback): void; + /** + * Inserts multiple data records into the database. This method should be implemented by a Data ability. + * + * @param { string } uri - Indicates the position where the data is to insert. + * @param { Array } valueBuckets - Indicates the data to insert. + * @param { AsyncCallback } callback - function specified by framework to receive the result, developer should + * call this function to return the result to framework. + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @FAModelOnly + * @since 7 + */ + batchInsert?(uri: string, valueBuckets: Array, callback: AsyncCallback): void; + /** + * Converts the given normalized {@code uri} generated by {@link #normalizeUri(uri)} into a denormalized one. + * The default implementation of this method returns the original uri passed to it. + * + * @param { string } uri - Indicates the uri to denormalize. + * @param { AsyncCallback } callback - function specified by framework to receive the result, developer + * should call this function to return the result to framework. + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @FAModelOnly + * @since 7 + */ + denormalizeUri?(uri: string, callback: AsyncCallback): void; + /** + * Inserts a data record into the database. This method should be implemented by a Data ability. + * + * @param { string } uri - Indicates the position where the data is to insert. + * @param { rdb.ValuesBucket } valueBucket - Indicates the data to insert. + * @param { AsyncCallback } callback - function specified by framework to receive the result, developer + * should call this function to return the result to framework. + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @FAModelOnly + * @since 7 + */ + insert?(uri: string, valueBucket: rdb.ValuesBucket, callback: AsyncCallback): void; + /** + * Opens a file. This method should be implemented by a Data ability. + * + * @param { string } uri - Indicates the path of the file to open. + * @param { string } mode - Indicates the open mode, which can be "r" for read-only access, "w" for write-only access + * (erasing whatever data is currently in the file), "wt" for write access that truncates any + * existing file,"wa" for write-only access to append to any existing data, "rw" for read and + * write access on any existing data, or "rwt" for read and write access that truncates any + * existing file. + * @param { AsyncCallback } callback - function specified by framework to receive the result, developer should + * call this function to return the result to framework. + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @FAModelOnly + * @since 7 + */ + openFile?(uri: string, mode: string, callback: AsyncCallback): void; + /** + * Obtains the MIME type of files. This method should be implemented by a Data ability. + * + * @param { string } uri - Indicates the path of the files to obtain. + * @param { string } mimeTypeFilter - Indicates the MIME type of the files to obtain. This parameter cannot be set to + * {@code null}. + *

1. "*/*": Obtains all types supported by a Data ability. + *

2. "image/*": Obtains files whose main type is image of any subtype. + *

3. "*/jpg": Obtains files whose subtype is JPG of any main type. + * @param { AsyncCallback> } callback - function specified by framework to receive the result, developer + * should call this function to return the result to framework. + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @FAModelOnly + * @since 7 + */ + getFileTypes?(uri: string, mimeTypeFilter: string, callback: AsyncCallback>): void; + /** + * Called to carry {@code AbilityInfo} to this ability after the ability is initialized. + * + * @param { AbilityInfo } info - Indicates the {@code AbilityInfo} object containing information about this ability. + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @FAModelOnly + * @since 7 + */ + onInitialized?(info: AbilityInfo): void; + /** + * Obtains the MIME type matching the data specified by the URI of the Data ability. This method should be + * implemented by a Data ability. + *

Data abilities supports general data types, including text, HTML, and JPEG.

+ * + * @param { string } uri - Indicates the uri of the data. + * @param { AsyncCallback } callback - function specified by framework to receive the result, developer should + * call this function to return the result to framework. + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @FAModelOnly + * @since 7 + */ + getType?(uri: string, callback: AsyncCallback): void; + /** + * Performs batch operations on the database. This method should be implemented by a Data ability. + * + * @param { Array } ops - Indicates the data operation list, which can contain multiple operations + * on the database. + * @param { AsyncCallback> } callback - specified by framework to receive the result, + * developer should call this function to return + * the result to framework. + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @FAModelOnly + * @since 7 + */ + executeBatch?(ops: Array, callback: AsyncCallback>): void; + /** + * Defines a method in this Data ability (implementation depending on child classes). + * + * @param { string } method - Indicates the method name. + * @param { string } arg - Indicates the parameter transferred by the method. + * @param { PacMap } extras - Indicates the parameter transferred by the method. + * @param { AsyncCallback } callback - function specified by framework to receive the result, developer + * should call this function to return the result to framework. + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @FAModelOnly + * @since 7 + */ + call?(method: string, arg: string, extras: PacMap, callback: AsyncCallback): void; +} diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.InputMethodExtensionAbility.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.InputMethodExtensionAbility.d.ts new file mode 100755 index 00000000..c4a1ed90 --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.InputMethodExtensionAbility.d.ts @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit IMEKit + */ +import Want from './@ohos.app.ability.Want'; +import type InputMethodExtensionContext from './@ohos.InputMethodExtensionContext'; +/** + * The extension ability class of input method. + * + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @StageModelOnly + * @since 9 + */ +export default class InputMethodExtensionAbility { + /** + * Indicates input method extension ability context. + * + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @StageModelOnly + * @since 9 + */ + context: InputMethodExtensionContext; + /** + * Called back when a input method extension is started for initialization. + * + * @param { Want } want - Indicates the want of created service extension. + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @StageModelOnly + * @since 9 + */ + onCreate(want: Want): void; + /** + * Called back before a input method extension is destroyed. + * + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @StageModelOnly + * @since 9 + */ + onDestroy(): void; +} diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.InputMethodExtensionContext.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.InputMethodExtensionContext.d.ts new file mode 100755 index 00000000..b2ce4215 --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.InputMethodExtensionContext.d.ts @@ -0,0 +1,78 @@ +/* + * Copyright (c) 2022-2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit IMEKit + */ +import { AsyncCallback } from './@ohos.base'; +import Want from './@ohos.app.ability.Want'; +import ExtensionContext from './application/ExtensionContext'; +/** + * The extension context class of input method. + * + * @extends ExtensionContext + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @StageModelOnly + * @since 9 + */ +export default class InputMethodExtensionContext extends ExtensionContext { + /** + * Destroy the input method extension. + * + * @param { AsyncCallback } callback - the callback of destroy. + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @StageModelOnly + * @since 9 + */ + destroy(callback: AsyncCallback): void; + /** + * Destroy the input method extension. + * + * @returns { Promise } the promise returned by the function. + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @StageModelOnly + * @since 9 + */ + destroy(): Promise; + /** + * Inputmethod extension uses this method to start a specific ability. + * + * @param { Want } want - Indicates the ability to start. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. + * @throws { BusinessError } 16000001 - The specified ability does not exist. + * @throws { BusinessError } 16000002 - Incorrect ability type. + * @throws { BusinessError } 16000004 - Can not start invisible component. + * @throws { BusinessError } 16000005 - The specified process does not have the permission. + * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. + * @throws { BusinessError } 16000008 - The crowdtesting application expires. + * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode. + * @throws { BusinessError } 16000010 - The call with the continuation flag is forbidden. + * @throws { BusinessError } 16000011 - The context does not exist. + * @throws { BusinessError } 16000012 - The application is controlled. + * @throws { BusinessError } 16000013 - The application is controlled by EDM. + * @throws { BusinessError } 16000019 - Can not match any component. + * @throws { BusinessError } 16000050 - Internal error. + * @throws { BusinessError } 16000053 - The ability is not on the top of the UI. + * @throws { BusinessError } 16000055 - Installation-free timed out. + * @throws { BusinessError } 16000061 - Can not start component belongs to other bundle. + * @throws { BusinessError } 16200001 - The caller has been released. + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @StageModelOnly + * @since 12 + */ + startAbility(want: Want): Promise; +} diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.InputMethodSubtype.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.InputMethodSubtype.d.ts new file mode 100755 index 00000000..46a210c3 --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.InputMethodSubtype.d.ts @@ -0,0 +1,106 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit IMEKit + */ +/** + * Input method subtype + * + * @interface InputMethodSubtype + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 9 + */ +export default interface InputMethodSubtype { + /** + * The label of input method subtype. + * + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 9 + */ + readonly label?: string; + /** + * The label id of input method subtype. + * + * @type { ?number } + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 10 + */ + readonly labelId?: number; + /** + * The name of input method. + * + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 9 + */ + readonly name: string; + /** + * The id of input method subtype. + * + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 9 + */ + readonly id: string; + /** + * The mode of input method subtype. + * + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 9 + */ + readonly mode?: 'upper' | 'lower'; + /** + * The locale of input method subtype. + * + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 9 + */ + readonly locale: string; + /** + * The language of input method subtype. + * + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 9 + */ + readonly language: string; + /** + * The icon of input method subtype. + * + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 9 + */ + readonly icon?: string; + /** + * The icon id of input method subtype. + * + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 9 + */ + readonly iconId?: number; + /** + * The extra info of input method subtype. + * + * @type { object } + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 9 + */ + /** + * The extra info of input method subtype. + * + * @type { ?object } + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 10 + */ + extra?: object; +} diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.PiPWindow.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.PiPWindow.d.ts new file mode 100755 index 00000000..9a5dd83d --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.PiPWindow.d.ts @@ -0,0 +1,431 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit ArkUI + */ +import type BaseContext from './application/BaseContext'; +/** + * Picture In Picture Window Manager + * + * @namespace PiPWindow + * @syscap SystemCapability.Window.SessionManager + * @since 11 + */ +declare namespace PiPWindow { + /** + * If picture-in-picture enabled in current OS. + * + * @returns { boolean } true if PictureInPicture enabled, otherwise false + * @syscap SystemCapability.Window.SessionManager + * @since 11 + */ + function isPiPEnabled(): boolean; + /** + * Create picture-in-picture controller + * + * @param { PiPConfiguration } config - Params for picture-in-picture controller creation. The config must be valid, + * the context and componentController in config should not be null. If templateType is specified, make sure + * it's type of PiPTemplateType. If controlGroups is specified, make sure it correspond to the templateType. + * @returns { Promise } - The promise returned by the function + * @throws { BusinessError } 401 - Params error. Possible causes: 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types. 3.Parameter verification failed + * @throws { BusinessError } 801 - Capability not supported + * @syscap SystemCapability.Window.SessionManager + * @since 11 + */ + function create(config: PiPConfiguration): Promise; + /** + * PiPConfiguration + * + * @interface PiPConfiguration + * @syscap SystemCapability.Window.SessionManager + * @since 11 + */ + interface PiPConfiguration { + /** + * Indicates window context. + * + * @type { BaseContext } + * @syscap SystemCapability.Window.SessionManager + * @since 11 + */ + context: BaseContext; + /** + * Indicates the origin XComponentController. + * + * @type { XComponentController } + * @syscap SystemCapability.Window.SessionManager + * @since 11 + */ + componentController: XComponentController; + /** + * Indicates navigation ID. + * + * @type { ?string } + * @syscap SystemCapability.Window.SessionManager + * @since 11 + */ + navigationId?: string; + /** + * Picture-in-picture template type. + * + * @type { ?PiPTemplateType } + * @syscap SystemCapability.Window.SessionManager + * @since 11 + */ + templateType?: PiPTemplateType; + /** + * Describes the width of content to be displayed in PiP window. For adjusting PiP window aspect ratio. + * + * @type { ?number } + * @syscap SystemCapability.Window.SessionManager + * @since 11 + */ + contentWidth?: number; + /** + * Describes the height of content to be displayed in PiP window. For adjusting PiP window aspect ratio. + * + * @type { ?number } + * @syscap SystemCapability.Window.SessionManager + * @since 11 + */ + contentHeight?: number; + /** + * Describes the custom controls to be displayed in PiP window control panel. If the parameter is empty, only mandatory controls are displayed. + * + * @type { ?Array } + * @syscap SystemCapability.Window.SessionManager + * @since 12 + */ + controlGroups?: Array; + } + /** + * Describe the type of picture-in-picture. + * + * @enum { number }. + * @syscap SystemCapability.Window.SessionManager + * @since 11 + */ + enum PiPTemplateType { + /** + * Indicates the content to show in picture-in-picture window is video play + * @syscap SystemCapability.Window.SessionManager + * @since 11 + */ + VIDEO_PLAY, + /** + * Indicates the content to show in picture-in-picture window is video call + * @syscap SystemCapability.Window.SessionManager + * @since 11 + */ + VIDEO_CALL, + /** + * Indicates the content to show in picture-in-picture window is video meeting + * @syscap SystemCapability.Window.SessionManager + * @since 11 + */ + VIDEO_MEETING, + /** + * Indicates the content to show in picture-in-picture window is video live + * @syscap SystemCapability.Window.SessionManager + * @since 11 + */ + VIDEO_LIVE + } + /** + * Enum for PiP window callback event type. + * + * @enum { number }. + * @syscap SystemCapability.Window.SessionManager + * @since 11 + */ + enum PiPState { + /** + * PiP window is about to start. + * + * @syscap SystemCapability.Window.SessionManager + * @since 11 + */ + ABOUT_TO_START = 1, + /** + * PiP window started. + * + * @syscap SystemCapability.Window.SessionManager + * @since 11 + */ + STARTED = 2, + /** + * PiP window is about to stop. + * + * @syscap SystemCapability.Window.SessionManager + * @since 11 + */ + ABOUT_TO_STOP = 3, + /** + * PiP window stopped. + * + * @syscap SystemCapability.Window.SessionManager + * @since 11 + */ + STOPPED = 4, + /** + * Restore the original page from PiP window + * + * @syscap SystemCapability.Window.SessionManager + * @since 11 + */ + ABOUT_TO_RESTORE = 5, + /** + * Error message during start/stop. + * + * @syscap SystemCapability.Window.SessionManager + * @since 11 + */ + ERROR = 6 + } + /** + * Describe PiP window custom controls. + * + * @typedef { VideoPlayControlGroup | VideoCallControlGroup | VideoMeetingControlGroup } + * @syscap SystemCapability.Window.SessionManager + * @since 12 + */ + type PiPControlGroup = VideoPlayControlGroup | VideoCallControlGroup | VideoMeetingControlGroup; + /** + * Enum for video play PiP window custom controls. + * + * @enum { number }. + * @syscap SystemCapability.Window.SessionManager + * @since 12 + */ + enum VideoPlayControlGroup { + /** + * Previous/Next for video. + * + * @syscap SystemCapability.Window.SessionManager + * @since 12 + */ + VIDEO_PREVIOUS_NEXT = 101, + /** + * Forward/Backward for video. + * + * @syscap SystemCapability.Window.SessionManager + * @since 12 + */ + FAST_FORWARD_BACKWARD = 102 + } + /** + * Enum for video call PiP window custom controls. + * + * @enum { number }. + * @syscap SystemCapability.Window.SessionManager + * @since 12 + */ + enum VideoCallControlGroup { + /** + * Turn on/off the microphone. + * + * @syscap SystemCapability.Window.SessionManager + * @since 12 + */ + MICROPHONE_SWITCH = 201, + /** + * Hang up. + * + * @syscap SystemCapability.Window.SessionManager + * @since 12 + */ + HANG_UP_BUTTON = 202, + /** + * Turn on/off the camera + * + * @syscap SystemCapability.Window.SessionManager + * @since 12 + */ + CAMERA_SWITCH = 203 + } + /** + * Enum for video meeting PiP window custom controls. + * + * @enum { number }. + * @syscap SystemCapability.Window.SessionManager + * @since 12 + */ + enum VideoMeetingControlGroup { + /** + * Hang up. + * + * @syscap SystemCapability.Window.SessionManager + * @since 12 + */ + HANG_UP_BUTTON = 301, + /** + * Turn on/off the camera + * + * @syscap SystemCapability.Window.SessionManager + * @since 12 + */ + CAMERA_SWITCH = 302, + /** + * Mute switch. + * + * @syscap SystemCapability.Window.SessionManager + * @since 12 + */ + MUTE_SWITCH = 303 + } + /** + * Describe picture-in-picture action event type. + * + * @typedef { PiPVideoActionEvent | PiPCallActionEvent | PiPMeetingActionEvent | PiPLiveActionEvent } + * @syscap SystemCapability.Window.SessionManager + * @since 11 + */ + type PiPActionEventType = PiPVideoActionEvent | PiPCallActionEvent | PiPMeetingActionEvent | PiPLiveActionEvent; + /** + * Describe picture-in-picture video template action event type. + * + * @typedef { 'playbackStateChanged' | 'nextVideo' | 'previousVideo' } + * @syscap SystemCapability.Window.SessionManager + * @since 11 + */ + /** + * Describe picture-in-picture video template action event type. + * + * @typedef { 'playbackStateChanged' | 'nextVideo' | 'previousVideo' | 'fastForward' | 'fastBackward' } + * @syscap SystemCapability.Window.SessionManager + * @since 12 + */ + type PiPVideoActionEvent = 'playbackStateChanged' | 'nextVideo' | 'previousVideo' | 'fastForward' | 'fastBackward'; + /** + * Describe picture-in-picture call template action event type. + * + * @typedef { 'hangUp' | 'micStateChanged' | 'videoStateChanged' } + * @syscap SystemCapability.Window.SessionManager + * @since 11 + */ + type PiPCallActionEvent = 'hangUp' | 'micStateChanged' | 'videoStateChanged'; + /** + * Describe picture-in-picture meeting template action event type. + * + * @typedef { 'hangUp' | 'voiceStateChanged' | 'videoStateChanged' } + * @syscap SystemCapability.Window.SessionManager + * @since 11 + */ + type PiPMeetingActionEvent = 'hangUp' | 'voiceStateChanged' | 'videoStateChanged'; + /** + * Describe picture-in-picture live template action event type. + * + * @typedef { 'playbackStateChanged' } + * @syscap SystemCapability.Window.SessionManager + * @since 11 + */ + type PiPLiveActionEvent = 'playbackStateChanged'; + /** + * Describe picture-in-picture control panel action event callback. + * + * @typedef { function } ControlPanelActionEventCallback + * @param { PiPActionEventType } event - the event from controlPanel + * @param { number } [status] - the status of control button + * @syscap SystemCapability.Window.SessionManager + * @since 12 + */ + type ControlPanelActionEventCallback = (event: PiPActionEventType, status?: number) => void; + /** + * PiPController + * + * @interface PiPController + * @syscap SystemCapability.Window.SessionManager + * @since 11 + */ + interface PiPController { + /** + * Start picture-in-picture + * @returns { Promise } - The promise returned by the function + * @throws { BusinessError } 1300012 - If PiP window state is abnormal. + * @throws { BusinessError } 1300013 - Create PiP window failed. + * @throws { BusinessError } 1300014 - Error when load PiP window content or show PiP window + * @throws { BusinessError } 1300015 - If window has created + * @syscap SystemCapability.Window.SessionManager + * @since 11 + */ + startPiP(): Promise; + /** + * Stop picture-in-picture. + * @returns { Promise } - The promise returned by the function. + * @throws { BusinessError } 1300011 - Stop PiP window failed. + * @throws { BusinessError } 1300012 - If PiP window state is abnormal. + * @throws { BusinessError } 1300015 - If window is stopping + * @syscap SystemCapability.Window.SessionManager + * @since 11 + */ + stopPiP(): Promise; + /** + * Set if auto start picture-in-picture when back home + * @param { boolean } enable - Enable auto start picture-in-picture when back home + * @syscap SystemCapability.Window.SessionManager + * @since 11 + */ + setAutoStartEnabled(enable: boolean): void; + /** + * Update source content size to adjust PiP window aspect ratio. + * @param { number } width - Indicate the width of the content. The width can consist of only digits and above 0. + * @param { number } height - Indicate the height of the content. The height can consist of only digits and above 0. + * @throws { BusinessError } 401 - Params error. Possible causes: 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types. + * @syscap SystemCapability.Window.SessionManager + * @since 11 + */ + updateContentSize(width: number, height: number): void; + /** + * Register picture-in-picture control event listener. + * @param { 'stateChange' } type - Registration type, PiP lifecycle state change, 'stateChange' + * @param { function } callback - Used to handle {'stateChange'} command + * @syscap SystemCapability.Window.SessionManager + * @since 11 + */ + on(type: 'stateChange', callback: (state: PiPState, reason: string) => void): void; + /** + * Unregister picture-in-picture lifecycle event listener. + * @param { 'stateChange' } type - Used to unregister listener for {'stateChange'} command + * @syscap SystemCapability.Window.SessionManager + * @since 11 + */ + off(type: 'stateChange'): void; + /** + * Register picture-in-picture control event listener. + * @param { 'controlPanelActionEvent' } type - Registration type, user action event, 'controlPanelActionEvent' + * @param { function } callback - Used to handle {'controlPanelActionEvent'} command + * @syscap SystemCapability.Window.SessionManager + * @since 11 + */ + /** + * Register picture-in-picture control event listener. + * + * @param { 'controlPanelActionEvent' } type - Registration type, user action event, 'controlPanelActionEvent' + * @param { ControlPanelActionEventCallback } callback - Used to handle {'controlPanelActionEvent'} command. + * @syscap SystemCapability.Window.SessionManager + * @since 12 + */ + on(type: 'controlPanelActionEvent', callback: ControlPanelActionEventCallback): void; + /** + * Unregister picture-in-picture lifecycle event listener + * @param { 'controlPanelActionEvent' } type - Used to unregister listener for {'controlPanelActionEvent'} command + * @syscap SystemCapability.Window.SessionManager + * @since 11 + */ + off(type: 'controlPanelActionEvent'): void; + } +} +export default PiPWindow; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.UiTest.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.UiTest.d.ts new file mode 100755 index 00000000..67371eee --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.UiTest.d.ts @@ -0,0 +1,4393 @@ +/* + * Copyright (C) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License,Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing,software + * distributed under the License is distributed on an "ASIS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit TestKit + */ +import { Callback } from './@ohos.base'; +/** + * Enumerates the string value match pattern. + * + * @enum {number} + * @syscap SystemCapability.Test.UiTest + * @since 8 + */ +/** + * Enumerates the string value match pattern. + * + * @enum {number} + * @syscap SystemCapability.Test.UiTest + * @crossplatform + * @since 10 + */ +/** + * Enumerates the string value match pattern. + * + * @enum {number} + * @syscap SystemCapability.Test.UiTest + * @crossplatform + * @atomicservice + * @since 11 + */ +declare enum MatchPattern { + /** + * Equals to a string. + * + * @syscap SystemCapability.Test.UiTest + * @since 8 + * @test + */ + /** + * Equals to a string. + * + * @syscap SystemCapability.Test.UiTest + * @crossplatform + * @since 10 + * @test + */ + /** + * Equals to a string. + * + * @syscap SystemCapability.Test.UiTest + * @crossplatform + * @atomicservice + * @since 11 + * @test + */ + EQUALS = 0, + /** + * Contains a substring. + * + * @syscap SystemCapability.Test.UiTest + * @since 8 + * @test + */ + /** + * Contains a substring. + * + * @syscap SystemCapability.Test.UiTest + * @crossplatform + * @since 10 + * @test + */ + /** + * Contains a substring. + * + * @syscap SystemCapability.Test.UiTest + * @crossplatform + * @atomicservice + * @since 11 + * @test + */ + CONTAINS = 1, + /** + * StartsWith a substring. + * + * @syscap SystemCapability.Test.UiTest + * @since 8 + * @test + */ + /** + * StartsWith a substring. + * + * @syscap SystemCapability.Test.UiTest + * @crossplatform + * @since 10 + * @test + */ + /** + * StartsWith a substring. + * + * @syscap SystemCapability.Test.UiTest + * @crossplatform + * @atomicservice + * @since 11 + * @test + */ + STARTS_WITH = 2, + /** + * EndsWith a substring. + * + * @syscap SystemCapability.Test.UiTest + * @since 8 + * @test + */ + /** + * EndsWith a substring. + * + * @syscap SystemCapability.Test.UiTest + * @crossplatform + * @since 10 + * @test + */ + /** + * EndsWith a substring. + * + * @syscap SystemCapability.Test.UiTest + * @crossplatform + * @atomicservice + * @since 11 + * @test + */ + ENDS_WITH = 3 +} +/** + * Describes the attribute requirements for the target UiComponents. + * + * @syscap SystemCapability.Test.UiTest + * @since 8 + * @deprecated since 9 + * @useinstead ohos.UiTest.On + */ +declare class By { + /** + * Specifies the text for the target UiComponent. + * + * @param { string } txt The text value. + * @param { MatchPattern } pattern The {@link MatchPattern} of the text value,default to {@link MatchPattern.EQUALS} + * @returns { By } this {@link By} object. + * @syscap SystemCapability.Test.UiTest + * @since 8 + * @deprecated since 9 + * @useinstead ohos.UiTest.On#text + * @test + */ + text(txt: string, pattern?: MatchPattern): By; + /** + * Specifies the inspector key of the target UiComponent. + * + * @param { string } key The inspectorKey value. + * @returns { By } this {@link By} object. + * @syscap SystemCapability.Test.UiTest + * @since 8 + * @deprecated since 9 + * @useinstead ohos.UiTest.On#id + * @test + */ + key(key: string): By; + /** + * Specifies the id of the target UiComponent. + * + * @param { number } id The id value. + * @returns { By } this {@link By} object. + * @syscap SystemCapability.Test.UiTest + * @since 8 + * @deprecated since 9 + * @test + */ + id(id: number): By; + /** + * Specifies the type of the target UiComponent. + * + * @param { string } tp The type value. + * @returns { By } this {@link By} object. + * @syscap SystemCapability.Test.UiTest + * @since 8 + * @deprecated since 9 + * @useinstead ohos.UiTest.On#type + * @test + */ + type(tp: string): By; + /** + * Specifies the clickable status of the target UiComponent. + * + * @param { boolean } b The clickable status,default to true. + * @returns { By } this {@link By} object. + * @syscap SystemCapability.Test.UiTest + * @since 8 + * @deprecated since 9 + * @useinstead ohos.UiTest.On#clickable + * @test + */ + clickable(b?: boolean): By; + /** + * Specifies the scrollable status of the target UiComponent. + * + * @param { boolean } b The scrollable status,default to true. + * @returns { By } this {@link By} object. + * @syscap SystemCapability.Test.UiTest + * @since 8 + * @deprecated since 9 + * @useinstead ohos.UiTest.On#scrollable + * @test + */ + scrollable(b?: boolean): By; + /** + * Specifies the enabled status of the target UiComponent. + * + * @param { boolean } b The enabled status,default to true. + * @returns { By } this {@link By} object. + * @syscap SystemCapability.Test.UiTest + * @since 8 + * @deprecated since 9 + * @useinstead ohos.UiTest.On#enabled + * @test + */ + enabled(b?: boolean): By; + /** + * Specifies the focused status of the target UiComponent. + * + * @param { boolean } b The focused status,default to true. + * @returns { By } this {@link By} object. + * @syscap SystemCapability.Test.UiTest + * @since 8 + * @deprecated since 9 + * @useinstead ohos.UiTest.On#focused + * @test + */ + focused(b?: boolean): By; + /** + * Specifies the selected status of the target UiComponent. + * + * @param { boolean } b The selected status,default to true. + * @returns { By } this {@link By} object. + * @syscap SystemCapability.Test.UiTest + * @since 8 + * @deprecated since 9 + * @useinstead ohos.UiTest.On#selected + * @test + */ + selected(b?: boolean): By; + /** + * Requires the target UiComponent which is before another UiComponent that specified by the given {@link By} + * object,used to locate UiComponent relatively. + * + * @param { By } by Describes the attribute requirements of UiComponent which the target one is in front of. + * @returns { By } this {@link By} object. + * @syscap SystemCapability.Test.UiTest + * @since 8 + * @deprecated since 9 + * @useinstead ohos.UiTest.On#isBefore + * @test + */ + isBefore(by: By): By; + /** + * Requires the target UiComponent which is after another UiComponent that specified by the given {@link By} + * object,used to locate UiComponent relatively. + * + * @param { By } by Describes the attribute requirements of UiComponent which the target one is in back of. + * @returns { By } this {@link By} object. + * @syscap SystemCapability.Test.UiTest + * @since 8 + * @deprecated since 9 + * @useinstead ohos.UiTest.On#isAfter + * @test + */ + isAfter(by: By): By; +} +/** + * Represents a UiComponent of the ohos application,user can perform operations or query attributes on it. + * + * @syscap SystemCapability.Test.UiTest + * @since 8 + * @deprecated since 9 + * @useinstead ohos.uitest.Component + * @test + */ +declare class UiComponent { + /** + * Click this {@link UiComponent}. + * + * @returns { Promise } + * @syscap SystemCapability.Test.UiTest + * @since 8 + * @deprecated since 9 + * @useinstead ohos.UiTest.Component#click + * @test + */ + click(): Promise; + /** + * Double click this {@link UiComponent}. + * + * @returns { Promise } + * @syscap SystemCapability.Test.UiTest + * @since 8 + * @deprecated since 9 + * @useinstead ohos.UiTest.Component#doubleClick + * @test + */ + doubleClick(): Promise; + /** + * Long click this {@link UiComponent}. + * + * @returns { Promise } + * @syscap SystemCapability.Test.UiTest + * @since 8 + * @deprecated since 9 + * @useinstead ohos.UiTest.Component#longClick + * @test + */ + longClick(): Promise; + /** + * Get the id attribute value. + * + * @returns { Promise } the id value. + * @syscap SystemCapability.Test.UiTest + * @since 8 + * @deprecated since 9 + * @test + */ + getId(): Promise; + /** + * Get the inspectorKey attribute value. + * + * @returns { Promise } the inspectorKey value. + * @syscap SystemCapability.Test.UiTest + * @since 8 + * @deprecated since 9 + * @useinstead ohos.UiTest.Component#getId + * @test + */ + getKey(): Promise; + /** + * Get the text attribute value. + * + * @returns { Promise } the text value. + * @syscap SystemCapability.Test.UiTest + * @since 8 + * @deprecated since 9 + * @useinstead ohos.UiTest.Component#getText + * @test + */ + getText(): Promise; + /** + * Get the type name. + * + * @returns { Promise } the type name. + * @syscap SystemCapability.Test.UiTest + * @since 8 + * @deprecated since 9 + * @useinstead ohos.UiTest.Component#getType + * @test + */ + getType(): Promise; + /** + * Get the clickable status of this {@link UiComponent}. + * + * @returns { Promise } the clickable status. + * @syscap SystemCapability.Test.UiTest + * @since 8 + * @deprecated since 9 + * @useinstead ohos.UiTest.Component#isClickable + * @test + */ + isClickable(): Promise; + /** + * Get the scrollable status of this {@link UiComponent}. + * + * @returns { Promise } the scrollable status. + * @syscap SystemCapability.Test.UiTest + * @since 8 + * @deprecated since 9 + * @useinstead ohos.UiTest.Component#isScrollable + * @test + */ + isScrollable(): Promise; + /** + * Get the enabled status of this {@link UiComponent}. + * + * @returns { Promise } the enabled status. + * @syscap SystemCapability.Test.UiTest + * @since 8 + * @deprecated since 9 + * @useinstead ohos.UiTest.Component#isEnabled + * @test + */ + isEnabled(): Promise; + /** + * Get the focused status of this {@link UiComponent}. + * + * @returns { Promise } the focused status. + * @syscap SystemCapability.Test.UiTest + * @since 8 + * @deprecated since 9 + * @useinstead ohos.UiTest.Component#isFocused + * @test + */ + isFocused(): Promise; + /** + * Get the selected status of this {@link UiComponent}. + * + * @returns { Promise } the selected status. + * @syscap SystemCapability.Test.UiTest + * @since 8 + * @deprecated since 9 + * @useinstead ohos.UiTest.Component#isSelected + * @test + */ + isSelected(): Promise; + /** + * Inject text to this {@link UiComponent},applicable to TextInput. + * + * @param { string } text The text to inject. + * @returns { Promise } + * @syscap SystemCapability.Test.UiTest + * @since 8 + * @deprecated since 9 + * @useinstead ohos.UiTest.Component#inputText + * @test + */ + inputText(text: string): Promise; + /** + * Scroll on this {@link UiComponent}to find matched {@link UiComponent},applicable to scrollable one. + * + * @param { By } by The attribute requirements of the target {@link UiComponent}. + * @returns { Promise } the found result,or undefined if not found. + * @syscap SystemCapability.Test.UiTest + * @since 8 + * @deprecated since 9 + * @useinstead ohos.UiTest.Component#scrollSearch + * @test + */ + scrollSearch(by: By): Promise; +} +/** + * The unified facade of UiTest framework,can be used to find {@link UiComponent},trigger keyEvents,perform + * coordinates-based UI actions,capture screen and so on. + * + * @syscap SystemCapability.Test.UiTest + * @since 8 + * @deprecated since 9 + * @useinstead ohos.uitest.Driver + * @test + */ +declare class UiDriver { + /** + * Create an {@link UiDriver} object. + * + * @returns { UiDriver } the {@link UiDriver} object. + * @syscap SystemCapability.Test.UiTest + * @since 8 + * @deprecated since 9 + * @useinstead ohos.UiTest.Driver#create + * @test + */ + static create(): UiDriver; + /** + * Delay with specified duration. + * + * @param { number } duration The delay duration in milliseconds. + * @returns { Promise } + * @syscap SystemCapability.Test.UiTest + * @since 8 + * @deprecated since 9 + * @useinstead ohos.UiTest.Driver#delayMs + * @test + */ + delayMs(duration: number): Promise; + /** + * Find the first matched {@link UiComponent} on current UI. + * + * @param { By } by The attribute requirements of the target {@link UiComponent}. + * @returns { Promise } the first matched {@link UiComponent} or undefined. + * @syscap SystemCapability.Test.UiTest + * @since 8 + * @deprecated since 9 + * @useinstead ohos.UiTest.Driver#findComponent + * @test + */ + findComponent(by: By): Promise; + /** + * Find all the matched {@link UiComponent}s on current UI. + * + * @param { By } by The attribute requirements of the target {@link UiComponent}. + * @returns { Promise> } the matched {@link UiComponent}s list. + * @syscap SystemCapability.Test.UiTest + * @since 8 + * @deprecated since 9 + * @useinstead ohos.UiTest.Driver#findComponents + * @test + */ + findComponents(by: By): Promise>; + /** + * Assert the matched {@link UiComponent}s exists on current UI;if not,assertError will be raised. + * + * @param { By } by The attribute requirements of the target {@link UiComponent}. + * @returns { Promise } + * @throws {BusinessError} 401 - if the input parameters are invalid. + * @throws {BusinessError} 17000002 - if the async function was not called with await. + * @throws {BusinessError} 17000003 - if the assertion failed. + * @syscap SystemCapability.Test.UiTest + * @since 8 + * @deprecated since 9 + * @useinstead ohos.UiTest.Driver#assertComponentExist + * @test + */ + assertComponentExist(by: By): Promise; + /** + * Press the BACK key. + * + * @returns { Promise } + * @syscap SystemCapability.Test.UiTest + * @since 8 + * @deprecated since 9 + * @useinstead ohos.UiTest.Driver#pressBack + * @test + */ + pressBack(): Promise; + /** + * Press the specified key. + * + * @param { number } keyCode the target keyCode. + * @returns { Promise } + * @syscap SystemCapability.Test.UiTest + * @since 8 + * @deprecated since 9 + * @useinstead ohos.UiTest.Driver#triggerKey + * @test + */ + triggerKey(keyCode: number): Promise; + /** + * Click on the specified location on the screen. + * + * @param { number } x The x-coordinate. + * @param { number } y The y-coordinate. + * @returns { Promise } + * @syscap SystemCapability.Test.UiTest + * @since 8 + * @deprecated since 9 + * @useinstead ohos.UiTest.Driver#click + * @test + */ + click(x: number, y: number): Promise; + /** + * DoubleClick on the specified location on the screen. + * + * @param { number } x The x-coordinate. + * @param { number } y The y-coordinate. + * @returns { Promise } + * @syscap SystemCapability.Test.UiTest + * @since 8 + * @deprecated since 9 + * @useinstead ohos.UiTest.Driver#doubleClick + * @test + */ + doubleClick(x: number, y: number): Promise; + /** + * LongClick on the specified location on the screen. + * + * @param { number } x The x-coordinate. + * @param { number } y The y-coordinate. + * @returns { Promise } + * @syscap SystemCapability.Test.UiTest + * @since 8 + * @deprecated since 9 + * @useinstead ohos.UiTest.Driver#longClick + * @test + */ + longClick(x: number, y: number): Promise; + /** + * Swipe on the screen between the specified points. + * + * @param { number } startx The x-coordinate of the starting point. + * @param { number } starty The y-coordinate of the starting point. + * @param { number } endx The x-coordinate of the ending point. + * @param { number } endy The y-coordinate of the ending point. + * @returns { Promise } + * @syscap SystemCapability.Test.UiTest + * @since 8 + * @deprecated since 9 + * @useinstead ohos.UiTest.Driver#swipe + * @test + */ + swipe(startx: number, starty: number, endx: number, endy: number): Promise; + /** + * Capture current screen and save as picture which PNG format. + * + * @param { string } savePath the path where to store the picture. + * @returns { Promise } true if screen-capturing and file-storing are completed successfully,false otherwise. + * @syscap SystemCapability.Test.UiTest + * @since 8 + * @deprecated since 9 + * @useinstead ohos.uitest.Driver#screenCap + * @test + */ + screenCap(savePath: string): Promise; +} +/** + * Enumerates the window mode of the tested window. + * + * @enum { number } + * @syscap SystemCapability.Test.UiTest + * @since 9 + */ +/** + * Enumerates the window mode of the tested window. + * + * @enum { number } + * @syscap SystemCapability.Test.UiTest + * @atomicservice + * @since 11 + */ +declare enum WindowMode { + /** + * The test window is a full screen window. + * + * @syscap SystemCapability.Test.UiTest + * @since 9 + * @test + */ + /** + * The test window is a full screen window. + * + * @syscap SystemCapability.Test.UiTest + * @atomicservice + * @since 11 + * @test + */ + FULLSCREEN = 0, + /** + * The test window is the first window in the split screen state. + * + * @syscap SystemCapability.Test.UiTest + * @since 9 + * @test + */ + /** + * The test window is the first window in the split screen state. + * + * @syscap SystemCapability.Test.UiTest + * @atomicservice + * @since 11 + * @test + */ + PRIMARY = 1, + /** + * The test window is the second window in the split screen state. + * + * @syscap SystemCapability.Test.UiTest + * @since 9 + * @test + */ + /** + * The test window is the second window in the split screen state. + * + * @syscap SystemCapability.Test.UiTest + * @atomicservice + * @since 11 + * @test + */ + SECONDARY = 2, + /** + * The test window is a floating window. + * + * @syscap SystemCapability.Test.UiTest + * @since 9 + * @test + */ + /** + * The test window is a floating window. + * + * @syscap SystemCapability.Test.UiTest + * @atomicservice + * @since 11 + * @test + */ + FLOATING = 3 +} +/** + * Enumerates the resize direction for the window. + * + * @enum { number } + * @syscap SystemCapability.Test.UiTest + * @since 9 + */ +/** + * Enumerates the resize direction for the window. + * + * @enum { number } + * @syscap SystemCapability.Test.UiTest + * @atomicservice + * @since 11 + */ +declare enum ResizeDirection { + /** + * Left. + * + * @syscap SystemCapability.Test.UiTest + * @since 9 + * @test + */ + /** + * Left. + * + * @syscap SystemCapability.Test.UiTest + * @atomicservice + * @since 11 + * @test + */ + LEFT = 0, + /** + * Right. + * + * @syscap SystemCapability.Test.UiTest + * @since 9 + * @test + */ + /** + * Right. + * + * @syscap SystemCapability.Test.UiTest + * @atomicservice + * @since 11 + * @test + */ + RIGHT = 1, + /** + * Up. + * + * @syscap SystemCapability.Test.UiTest + * @since 9 + * @test + */ + /** + * Up. + * + * @syscap SystemCapability.Test.UiTest + * @atomicservice + * @since 11 + * @test + */ + UP = 2, + /** + * Down. + * + * @syscap SystemCapability.Test.UiTest + * @since 9 + * @test + */ + /** + * Down. + * + * @syscap SystemCapability.Test.UiTest + * @atomicservice + * @since 11 + * @test + */ + DOWN = 3, + /** + * Upper left. + * + * @syscap SystemCapability.Test.UiTest + * @since 9 + * @test + */ + /** + * Upper left. + * + * @syscap SystemCapability.Test.UiTest + * @atomicservice + * @since 11 + * @test + */ + LEFT_UP = 4, + /** + * Lower left. + * + * @syscap SystemCapability.Test.UiTest + * @since 9 + * @test + */ + /** + * Lower left. + * + * @syscap SystemCapability.Test.UiTest + * @atomicservice + * @since 11 + * @test + */ + LEFT_DOWN = 5, + /** + * Upper right. + * + * @syscap SystemCapability.Test.UiTest + * @since 9 + * @test + */ + /** + * Upper right. + * + * @syscap SystemCapability.Test.UiTest + * @atomicservice + * @since 11 + * @test + */ + RIGHT_UP = 6, + /** + * Lower right. + * + * @syscap SystemCapability.Test.UiTest + * @since 9 + * @test + */ + /** + * Lower right. + * + * @syscap SystemCapability.Test.UiTest + * @atomicservice + * @since 11 + * @test + */ + RIGHT_DOWN = 7 +} +/** + * Enumerates the rotation of the device display. + * + * @enum { number } + * @syscap SystemCapability.Test.UiTest + * @since 9 + */ +/** + * Enumerates the rotation of the device display. + * + * @enum { number } + * @syscap SystemCapability.Test.UiTest + * @atomicservice + * @since 11 + */ +declare enum DisplayRotation { + /** + * Device display does not rotate to display vertically. + * + * @syscap SystemCapability.Test.UiTest + * @since 9 + * @test + */ + /** + * Device display does not rotate to display vertically. + * + * @syscap SystemCapability.Test.UiTest + * @atomicservice + * @since 11 + * @test + */ + ROTATION_0 = 0, + /** + * Device display rotates 90 degrees clockwise to display horizontally. + * + * @syscap SystemCapability.Test.UiTest + * @since 9 + * @test + */ + /** + * Device display rotates 90 degrees clockwise to display horizontally. + * + * @syscap SystemCapability.Test.UiTest + * @atomicservice + * @since 11 + * @test + */ + ROTATION_90 = 1, + /** + * Device display rotates clockwise 180 degrees to display vertically in reverse. + * + * @syscap SystemCapability.Test.UiTest + * @since 9 + * @test + */ + /** + * Device display rotates clockwise 180 degrees to display vertically in reverse. + * + * @syscap SystemCapability.Test.UiTest + * @atomicservice + * @since 11 + * @test + */ + ROTATION_180 = 2, + /** + * Device display rotates 270 degrees clockwise to display horizontally in reverse. + * + * @syscap SystemCapability.Test.UiTest + * @since 9 + * @test + */ + /** + * Device display rotates 270 degrees clockwise to display horizontally in reverse. + * + * @syscap SystemCapability.Test.UiTest + * @atomicservice + * @since 11 + * @test + */ + ROTATION_270 = 3 +} +/** + * Represents the point on the device screen. + * + * @typedef Point + * @syscap SystemCapability.Test.UiTest + * @since 9 + */ +/** + * Represents the point on the device screen. + * + * @typedef Point + * @syscap SystemCapability.Test.UiTest + * @crossplatform + * @since 10 + */ +/** + * Represents the point on the device screen. + * + * @typedef Point + * @syscap SystemCapability.Test.UiTest + * @crossplatform + * @atomicservice + * @since 11 + */ +declare interface Point { + /** + * The x-coordinate of the coordinate point. + * + * @type { number } + * @syscap SystemCapability.Test.UiTest + * @since 9 + */ + /** + * The x-coordinate of the coordinate point. + * + * @type { number } + * @syscap SystemCapability.Test.UiTest + * @crossplatform + * @since 10 + */ + /** + * The x-coordinate of the coordinate point. + * + * @type { number } + * @syscap SystemCapability.Test.UiTest + * @crossplatform + * @atomicservice + * @since 11 + */ + readonly x: number; + /** + * The y-coordinate of the coordinate point. + * + * @type { number } + * @syscap SystemCapability.Test.UiTest + * @since 9 + */ + /** + * The y-coordinate of the coordinate point. + * + * @type { number } + * @syscap SystemCapability.Test.UiTest + * @crossplatform + * @since 10 + */ + /** + * The y-coordinate of the coordinate point. + * + * @type { number } + * @syscap SystemCapability.Test.UiTest + * @crossplatform + * @atomicservice + * @since 11 + */ + readonly y: number; +} +/** + * Represents the rectangle area on the device screen. + * + * @typedef Rect + * @syscap SystemCapability.Test.UiTest + * @since 9 + */ +/** + * Represents the rectangle area on the device screen. + * + * @typedef Rect + * @syscap SystemCapability.Test.UiTest + * @atomicservice + * @since 11 + */ +/** + * Represents the rectangle area on the device screen. + * + * @typedef Rect + * @syscap SystemCapability.Test.UiTest + * @crossplatform + * @atomicservice + * @since 12 + */ +declare interface Rect { + /** + * The x-coordinate of the top left corner of the rectangle. + * + * @type { number } + * @syscap SystemCapability.Test.UiTest + * @since 9 + */ + /** + * The x-coordinate of the top left corner of the rectangle. + * + * @type { number } + * @syscap SystemCapability.Test.UiTest + * @atomicservice + * @since 11 + */ + /** + * The x-coordinate of the top left corner of the rectangle. + * + * @type { number } + * @syscap SystemCapability.Test.UiTest + * @crossplatform + * @atomicservice + * @since 12 + */ + readonly left: number; + /** + * The y-coordinate of the top left corner of the rectangle. + * + * @type { number } + * @syscap SystemCapability.Test.UiTest + * @since 9 + */ + /** + * The y-coordinate of the top left corner of the rectangle. + * + * @type { number } + * @syscap SystemCapability.Test.UiTest + * @atomicservice + * @since 11 + */ + /** + * The y-coordinate of the top left corner of the rectangle. + * + * @type { number } + * @syscap SystemCapability.Test.UiTest + * @crossplatform + * @atomicservice + * @since 12 + */ + readonly top: number; + /** + * The x-coordinate at the bottom right corner of the rectangle. + * + * @type { number } + * @syscap SystemCapability.Test.UiTest + * @since 9 + */ + /** + * The x-coordinate at the bottom right corner of the rectangle. + * + * @type { number } + * @syscap SystemCapability.Test.UiTest + * @atomicservice + * @since 11 + */ + /** + * The x-coordinate at the bottom right corner of the rectangle. + * + * @type { number } + * @syscap SystemCapability.Test.UiTest + * @crossplatform + * @atomicservice + * @since 12 + */ + readonly right: number; + /** + * The y-coordinate at the bottom right corner of the rectangle. + * + * @type { number } + * @syscap SystemCapability.Test.UiTest + * @since 9 + */ + /** + * The y-coordinate at the bottom right corner of the rectangle. + * + * @type { number } + * @syscap SystemCapability.Test.UiTest + * @atomicservice + * @since 11 + */ + /** + * The y-coordinate at the bottom right corner of the rectangle. + * + * @type { number } + * @syscap SystemCapability.Test.UiTest + * @crossplatform + * @atomicservice + * @since 12 + */ + readonly bottom: number; +} +/** + * Represents filer condition to get the window . + * + * @typedef WindowFilter + * @syscap SystemCapability.Test.UiTest + * @since 9 + */ +/** + * Represents filer condition to get the window . + * + * @typedef WindowFilter + * @syscap SystemCapability.Test.UiTest + * @atomicservice + * @since 11 + */ +declare interface WindowFilter { + /** + * The package name of the application which the window belongs to. + * + * @type { ?string } + * @syscap SystemCapability.Test.UiTest + * @since 9 + */ + /** + * The package name of the application which the window belongs to. + * + * @type { ?string } + * @syscap SystemCapability.Test.UiTest + * @atomicservice + * @since 11 + */ + bundleName?: string; + /** + * The title of the window. + * + * @type { ?string } + * @syscap SystemCapability.Test.UiTest + * @since 9 + */ + /** + * The title of the window. + * + * @type { ?string } + * @syscap SystemCapability.Test.UiTest + * @atomicservice + * @since 11 + */ + title?: string; + /** + * The focal state of the window. + * + * @type { ?boolean } + * @syscap SystemCapability.Test.UiTest + * @since 9 + */ + /** + * The focal state of the window. + * + * @type { ?boolean } + * @syscap SystemCapability.Test.UiTest + * @atomicservice + * @since 11 + */ + focused?: boolean; + /** + * The active state of the window. + * + * @type { ?boolean } + * @syscap SystemCapability.Test.UiTest + * @since 9 + */ + /** + * The active state of the window. + * + * @type { ?boolean } + * @syscap SystemCapability.Test.UiTest + * @since 11 + * @deprecated since 11 + * @useinstead ohos.UiTest.WindowFilter#active + */ + actived?: boolean; + /** + * The active state of the window. + * + * @type { ?boolean } + * @syscap SystemCapability.Test.UiTest + * @atomicservice + * @since 11 + */ + active?: boolean; +} +/** + * Represents the information of an UI element, can be a component or window. + * + * @typedef UIElementInfo + * @syscap SystemCapability.Test.UiTest + * @since 10 + * @test + */ +/** + * Represents the information of an UI element, can be a component or window. + * + * @typedef UIElementInfo + * @syscap SystemCapability.Test.UiTest + * @atomicservice + * @since 11 + * @test + */ +declare interface UIElementInfo { + /** + * The bundle name of the host application. + * @type { string } + * @syscap SystemCapability.Test.UiTest + * @since 10 + * @test + */ + /** + * The bundle name of the host application. + * @type { string } + * @syscap SystemCapability.Test.UiTest + * @atomicservice + * @since 11 + * @test + */ + readonly bundleName: string; + /** + * The component type, set it as 'window' if it's a window. + * @type { string } + * @syscap SystemCapability.Test.UiTest + * @since 10 + * @test + */ + /** + * The component type, set it as 'window' if it's a window. + * @type { string } + * @syscap SystemCapability.Test.UiTest + * @atomicservice + * @since 11 + * @test + */ + readonly type: string; + /** + * The text of component, set it as window's title if it's a window. + * @type { string } + * @syscap SystemCapability.Test.UiTest + * @since 10 + * @test + */ + /** + * The text of component, set it as window's title if it's a window. + * @type { string } + * @syscap SystemCapability.Test.UiTest + * @atomicservice + * @since 11 + * @test + */ + readonly text: string; +} +/** + * Observer to monitor UI events. + * + * @typedef UIEventObserver + * @syscap SystemCapability.Test.UiTest + * @since 10 + * @test + */ +/** + * Observer to monitor UI events. + * + * @typedef UIEventObserver + * @syscap SystemCapability.Test.UiTest + * @atomicservice + * @since 11 + * @test + */ +declare interface UIEventObserver { + /** + * Listen for toast show once + * + * @param { 'toastShow' } type 'toastShow'. + * @param { Callback } callback function, returns the monitored UIElementInfo. + * @throws { BusinessError } 401 - if the input parameters are invalid. + * @syscap SystemCapability.Test.UiTest + * @since 10 + * @test + */ + /** + * Listen for toast show once + * + * @param { 'toastShow' } type -'toastShow'. + * @param { Callback } callback - function, returns the monitored UIElementInfo. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. + * @syscap SystemCapability.Test.UiTest + * @atomicservice + * @since 11 + * @test + */ + once(type: 'toastShow', callback: Callback): void; + /** + * Listen for dialog show once + * + * @param { 'dialogShow' } type 'dialogShow'. + * @param { Callback } callback function, returns the monitored UIElementInfo. + * @throws { BusinessError } 401 - if the input parameters are invalid. + * @syscap SystemCapability.Test.UiTest + * @since 10 + * @test + */ + /** + * Listen for dialog show once + * + * @param { 'dialogShow' } type - 'dialogShow'. + * @param { Callback } callback - function, returns the monitored UIElementInfo. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. + * @syscap SystemCapability.Test.UiTest + * @atomicservice + * @since 11 + * @test + */ + once(type: 'dialogShow', callback: Callback): void; +} +/** + * Enumerates the direction for the UI operation . + * + * @enum { number } + * @syscap SystemCapability.Test.UiTest + * @since 10 + */ +/** + * Enumerates the direction for the UI operation . + * + * @enum { number } + * @syscap SystemCapability.Test.UiTest + * @atomicservice + * @since 11 + */ +declare enum UiDirection { + /** + * Left. + * + * @syscap SystemCapability.Test.UiTest + * @since 10 + * @test + */ + /** + * Left. + * + * @syscap SystemCapability.Test.UiTest + * @atomicservice + * @since 11 + * @test + */ + LEFT = 0, + /** + * Right. + * + * @syscap SystemCapability.Test.UiTest + * @since 10 + * @test + */ + /** + * Right. + * + * @syscap SystemCapability.Test.UiTest + * @atomicservice + * @since 11 + * @test + */ + RIGHT = 1, + /** + * Up. + * + * @syscap SystemCapability.Test.UiTest + * @since 10 + * @test + */ + /** + * Up. + * + * @syscap SystemCapability.Test.UiTest + * @atomicservice + * @since 11 + * @test + */ + UP = 2, + /** + * Down. + * + * @syscap SystemCapability.Test.UiTest + * @since 10 + * @test + */ + /** + * Down. + * + * @syscap SystemCapability.Test.UiTest + * @atomicservice + * @since 11 + * @test + */ + DOWN = 3 +} +/** + * Enumerates the id of the button on the mouse. + * + * @enum { number } + * @syscap SystemCapability.Test.UiTest + * @since 10 + */ +/** + * Enumerates the id of the button on the mouse. + * + * @enum { number } + * @syscap SystemCapability.Test.UiTest + * @atomicservice + * @since 11 + */ +declare enum MouseButton { + /** + * Left button of the mouse. + * + * @syscap SystemCapability.Test.UiTest + * @since 10 + * @test + */ + /** + * Left button of the mouse. + * + * @syscap SystemCapability.Test.UiTest + * @atomicservice + * @since 11 + * @test + */ + MOUSE_BUTTON_LEFT = 0, + /** + * Right button of the mouse.. + * + * @syscap SystemCapability.Test.UiTest + * @since 10 + * @test + */ + /** + * Right button of the mouse.. + * + * @syscap SystemCapability.Test.UiTest + * @atomicservice + * @since 11 + * @test + */ + MOUSE_BUTTON_RIGHT = 1, + /** + * MIDDLE button of the mouse. + * + * @syscap SystemCapability.Test.UiTest + * @since 10 + * @test + */ + /** + * MIDDLE button of the mouse. + * + * @syscap SystemCapability.Test.UiTest + * @atomicservice + * @since 11 + * @test + */ + MOUSE_BUTTON_MIDDLE = 2 +} +/** + * Describes the attribute requirements for the target Components. + * + * @syscap SystemCapability.Test.UiTest + * @since 9 + */ +/** + * Describes the attribute requirements for the target Components. + * + * @syscap SystemCapability.Test.UiTest + * @atomicservice + * @since 11 + */ +/** + * Describes the attribute requirements for the target Components. + * + * @syscap SystemCapability.Test.UiTest + * @crossplatform + * @atomicservice + * @since 12 + */ +declare class On { + /** + * Specifies the text for the target Component. + * + * @param { string } txt The text value. + * @param { MatchPattern } pattern The {@link MatchPattern} of the text value, default to {@link MatchPattern.EQUALS} + * @returns { On } this {@link On} object. + * @throws { BusinessError } 401 - if the input parameters are invalid. + * @syscap SystemCapability.Test.UiTest + * @since 9 + * @test + */ + /** + * Specifies the text for the target Component. + * + * @param { string } txt The text value. + * @param { MatchPattern } pattern The {@link MatchPattern} of the text value, default to {@link MatchPattern.EQUALS} + * @returns { On } this {@link On} object. + * @throws { BusinessError } 401 - if the input parameters are invalid. + * @syscap SystemCapability.Test.UiTest + * @crossplatform + * @since 10 + * @test + */ + /** + * Specifies the text for the target Component. + * + * @param { string } txt - the text value. + * @param { MatchPattern } [pattern] - the {@link MatchPattern} of the text value,Set it default {@link MatchPattern.EQUALS} if null or undefined. + * @returns { On } this {@link On} object. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. + * @syscap SystemCapability.Test.UiTest + * @crossplatform + * @atomicservice + * @since 11 + * @test + */ + text(txt: string, pattern?: MatchPattern): On; + /** + * Specifies the id of the target Component. + * + * @param { string } id The id value. + * @returns { On } this {@link On} object. + * @throws { BusinessError } 401 - if the input parameters are invalid. + * @syscap SystemCapability.Test.UiTest + * @since 9 + * @test + */ + /** + * Specifies the id of the target Component. + * + * @param { string } id The id value. + * @returns { On } this {@link On} object. + * @throws { BusinessError } 401 - if the input parameters are invalid. + * @syscap SystemCapability.Test.UiTest + * @crossplatform + * @since 10 + * @test + */ + /** + * Specifies the id of the target Component. + * + * @param { string } id - the id value. + * @returns { On } this {@link On} object. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. + * @syscap SystemCapability.Test.UiTest + * @crossplatform + * @atomicservice + * @since 11 + * @test + */ + id(id: string): On; + /** + * Specifies the type of the target Component. + * + * @param { string } tp The type value. + * @returns { On } this {@link On} object. + * @throws { BusinessError } 401 - if the input parameters are invalid. + * @syscap SystemCapability.Test.UiTest + * @since 9 + * @test + */ + /** + * Specifies the type of the target Component. + * + * @param { string } tp The type value. + * @returns { On } this {@link On} object. + * @throws { BusinessError } 401 - if the input parameters are invalid. + * @syscap SystemCapability.Test.UiTest + * @crossplatform + * @since 10 + * @test + */ + /** + * Specifies the type of the target Component. + * + * @param { string } tp - The type value. + * @returns { On } this {@link On} object. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. + * @syscap SystemCapability.Test.UiTest + * @crossplatform + * @atomicservice + * @since 11 + * @test + */ + type(tp: string): On; + /** + * Specifies the clickable status of the target Component. + * + * @param { boolean } b The clickable status,default to true. + * @returns { On } this {@link On} object. + * @throws { BusinessError } 401 - if the input parameters are invalid. + * @syscap SystemCapability.Test.UiTest + * @since 9 + * @test + */ + /** + * Specifies the clickable status of the target Component. + * + * @param { boolean } b The clickable status,default to true. + * @returns { On } this {@link On} object. + * @throws { BusinessError } 401 - if the input parameters are invalid. + * @syscap SystemCapability.Test.UiTest + * @crossplatform + * @since 10 + * @test + */ + /** + * Specifies the clickable status of the target Component. + * + * @param { boolean } [b] - the clickable status.Set it default true if null or undefined. + * @returns { On } this {@link On} object. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Incorrect parameter types; 2. Parameter verification failed. + * @syscap SystemCapability.Test.UiTest + * @crossplatform + * @atomicservice + * @since 11 + * @test + */ + clickable(b?: boolean): On; + /** + * Specifies the longClickable status of the target Component. + * + * @param { boolean } b The clickable status,default to true. + * @returns { On } this {@link On} object. + * @throws { BusinessError } 401 - if the input parameters are invalid. + * @syscap SystemCapability.Test.UiTest + * @since 9 + * @test + */ + /** + * Specifies the longClickable status of the target Component. + * + * @param { boolean } b The clickable status,default to true. + * @returns { On } this {@link On} object. + * @throws { BusinessError } 401 - if the input parameters are invalid. + * @syscap SystemCapability.Test.UiTest + * @crossplatform + * @since 10 + * @test + */ + /** + * Specifies the longClickable status of the target Component. + * + * @param { boolean } [b] - the longClickable status.Set it default true if null or undefined. + * @returns { On } this {@link On} object. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Incorrect parameter types; 2. Parameter verification failed. + * @syscap SystemCapability.Test.UiTest + * @crossplatform + * @atomicservice + * @since 11 + * @test + */ + longClickable(b?: boolean): On; + /** + * Specifies the scrollable status of the target Component. + * + * @param { boolean } b The scrollable status,default to true. + * @returns { On } this {@link On} object. + * @throws { BusinessError } 401 - if the input parameters are invalid. + * @syscap SystemCapability.Test.UiTest + * @since 9 + * @test + */ + /** + * Specifies the scrollable status of the target Component. + * + * @param { boolean } b The scrollable status,default to true. + * @returns { On } this {@link On} object. + * @throws { BusinessError } 401 - if the input parameters are invalid. + * @syscap SystemCapability.Test.UiTest + * @crossplatform + * @since 10 + * @test + */ + /** + * Specifies the scrollable status of the target Component. + * + * @param { boolean } [b] - the scrollable status.Set it default true if null or undefined. + * @returns { On } this {@link On} object. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Incorrect parameter types; 2. Parameter verification failed. + * @syscap SystemCapability.Test.UiTest + * @crossplatform + * @atomicservice + * @since 11 + * @test + */ + scrollable(b?: boolean): On; + /** + * Specifies the enabled status of the target Component. + * + * @param { boolean } b The enabled status,default to true. + * @returns { On } this {@link On} object. + * @throws { BusinessError } 401 - if the input parameters are invalid. + * @syscap SystemCapability.Test.UiTest + * @since 9 + * @test + */ + /** + * Specifies the enabled status of the target Component. + * + * @param { boolean } b The enabled status,default to true. + * @returns { On } this {@link On} object. + * @throws { BusinessError } 401 - if the input parameters are invalid. + * @syscap SystemCapability.Test.UiTest + * @crossplatform + * @since 10 + * @test + */ + /** + * Specifies the enabled status of the target Component. + * + * @param { boolean } [b] - the enabled status.Set it default true if null or undefined. + * @returns { On } this {@link On} object. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Incorrect parameter types; 2. Parameter verification failed. + * @syscap SystemCapability.Test.UiTest + * @crossplatform + * @atomicservice + * @since 11 + * @test + */ + enabled(b?: boolean): On; + /** + * Specifies the focused status of the target Component. + * + * @param { boolean } b The focused status,default to true. + * @returns { On } this {@link On} object. + * @throws { BusinessError } 401 - if the input parameters are invalid. + * @syscap SystemCapability.Test.UiTest + * @since 9 + * @test + */ + /** + * Specifies the focused status of the target Component. + * + * @param { boolean } b The focused status,default to true. + * @returns { On } this {@link On} object. + * @throws { BusinessError } 401 - if the input parameters are invalid. + * @syscap SystemCapability.Test.UiTest + * @crossplatform + * @since 10 + * @test + */ + /** + * Specifies the focused status of the target Component. + * + * @param { boolean } [b] - the focused status.Set it default true if null or undefined. + * @returns { On } this {@link On} object. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Incorrect parameter types; 2. Parameter verification failed. + * @syscap SystemCapability.Test.UiTest + * @crossplatform + * @atomicservice + * @since 11 + * @test + */ + focused(b?: boolean): On; + /** + * Specifies the selected status of the target Component. + * + * @param { boolean } b The selected status,default to true. + * @returns { On } this {@link On} object. + * @throws { BusinessError } 401 - if the input parameters are invalid. + * @syscap SystemCapability.Test.UiTest + * @since 9 + * @test + */ + /** + * Specifies the selected status of the target Component. + * + * @param { boolean } b The selected status,default to true. + * @returns { On } this {@link On} object. + * @throws { BusinessError } 401 - if the input parameters are invalid. + * @syscap SystemCapability.Test.UiTest + * @crossplatform + * @since 10 + * @test + */ + /** + * Specifies the selected status of the target Component. + * + * @param { boolean } [b] the - selected status.Set it default true if null or undefined. + * @returns { On } this {@link On} object. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Incorrect parameter types; 2. Parameter verification failed. + * @syscap SystemCapability.Test.UiTest + * @crossplatform + * @atomicservice + * @since 11 + * @test + */ + selected(b?: boolean): On; + /** + * Specifies the checked status of the target Component. + * + * @param { boolean } b The checked status,default to false. + * @returns { On } this {@link On} object. + * @throws { BusinessError } 401 - if the input parameters are invalid. + * @syscap SystemCapability.Test.UiTest + * @since 9 + * @test + */ + /** + * Specifies the checked status of the target Component. + * + * @param { boolean } b The checked status,default to false. + * @returns { On } this {@link On} object. + * @throws { BusinessError } 401 - if the input parameters are invalid. + * @syscap SystemCapability.Test.UiTest + * @crossplatform + * @since 10 + * @test + */ + /** + * Specifies the checked status of the target Component. + * + * @param { boolean } [b] - the checked status.Set it default false if null or undefined. + * @returns { On } this {@link On} object. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Incorrect parameter types; 2. Parameter verification failed. + * @syscap SystemCapability.Test.UiTest + * @crossplatform + * @atomicservice + * @since 11 + * @test + */ + checked(b?: boolean): On; + /** + * Specifies the checkable status of the target Component. + * + * @param { boolean } b The checkable status,default to false. + * @returns { On } this {@link On} object. + * @throws { BusinessError } 401 - if the input parameters are invalid. + * @syscap SystemCapability.Test.UiTest + * @since 9 + * @test + */ + /** + * Specifies the checkable status of the target Component. + * + * @param { boolean } b The checkable status,default to false. + * @returns { On } this {@link On} object. + * @throws { BusinessError } 401 - if the input parameters are invalid. + * @syscap SystemCapability.Test.UiTest + * @crossplatform + * @since 10 + * @test + */ + /** + * Specifies the checkable status of the target Component. + * + * @param { boolean } [b] - the checkable status.Set it default false if null or undefined. + * @returns { On } this {@link On} object. + * @throws { BusinessError } 401 - Parameter error. 1. Incorrect parameter types; 2. Parameter verification failed. + * @syscap SystemCapability.Test.UiTest + * @crossplatform + * @atomicservice + * @since 11 + * @test + */ + checkable(b?: boolean): On; + /** + * Requires that the target Component which is before another Component that specified by the given {@link On} + * object,used to locate Component relatively. + * + * @param { On } on Describes the attribute requirements of Component which the target one is in front of. + * @returns { On } this {@link On} object. + * @throws { BusinessError } 401 - if the input parameters are invalid. + * @syscap SystemCapability.Test.UiTest + * @since 9 + * @test + */ + /** + * Requires that the target Component which is before another Component that specified by the given {@link On} + * object,used to locate Component relatively. + * + * @param { On } on - describes the attribute requirements of Component which the target one is in front of. + * @returns { On } this {@link On} object. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. + * @syscap SystemCapability.Test.UiTest + * @crossplatform + * @atomicservice + * @since 11 + * @test + */ + isBefore(on: On): On; + /** + * Requires that the target Component which is after another Component that specified by the given {@link On} + * object,used to locate Component relatively. + * + * @param { On } on Describes the attribute requirements of Component which the target one is in back of. + * @returns { On } this {@link On} object. + * @throws { BusinessError } 401 - if the input parameters are invalid. + * @syscap SystemCapability.Test.UiTest + * @since 9 + * @test + */ + /** + * Requires that the target Component which is after another Component that specified by the given {@link On} + * object,used to locate Component relatively. + * + * @param { On } on - describes the attribute requirements of Component which the target one is in back of. + * @returns { On } this {@link On} object. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. + * @syscap SystemCapability.Test.UiTest + * @crossplatform + * @atomicservice + * @since 11 + * @test + */ + isAfter(on: On): On; + /** + * Requires that the target Component which is inside of another Component that specified by the given {@link On} + * object,used to locate Component relatively. + * + * @param { On } on Describes the attribute requirements of Component which the target one is inside of. + * @returns { On } this {@link On} object. + * @throws { BusinessError } 401 - if the input parameters are invalid. + * @syscap SystemCapability.Test.UiTest + * @since 10 + * @test + */ + /** + * Requires that the target Component which is inside of another Component that specified by the given {@link On} + * object,used to locate Component relatively. + * + * @param { On } on - describes the attribute requirements of Component which the target one is inside of. + * @returns { On } this {@link On} object. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. + * @syscap SystemCapability.Test.UiTest + * @crossplatform + * @atomicservice + * @since 11 + * @test + */ + within(on: On): On; + /** + * Specifies the bundleName of the application which the window that the target Component is located belongs. + * + * @param { string } bundleName The bundleName of the specified window. + * @returns { On } this {@link On} object. + * @throws { BusinessError } 401 - if the input parameters are invalid. + * @syscap SystemCapability.Test.UiTest + * @since 10 + * @test + */ + /** + * Specifies the bundleName of the application which the window that the target Component is located belongs. + * + * @param { string } bundleName - the bundleName of the specified window. + * @returns { On } this {@link On} object. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. + * @syscap SystemCapability.Test.UiTest + * @atomicservice + * @since 11 + * @test + */ + inWindow(bundleName: string): On; + /** + * Specifies the description for the target Component. + * + * @param { string } val - the description value. + * @param { MatchPattern } [pattern] - the {@link MatchPattern} of description value,set it default {@link MatchPattern.EQUALS} if null or undefined. + * @returns { On } this {@link On} object. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. + * @syscap SystemCapability.Test.UiTest + * @atomicservice + * @since 11 + * @test + */ + description(val: string, pattern?: MatchPattern): On; +} +/** + * Represents an Component of the ohos application,user can perform operations or query attributes on it. + * + * @syscap SystemCapability.Test.UiTest + * @since 9 + * @test + */ +/** + * Represents an Component of the ohos application,user can perform operations or query attributes on it. + * + * @syscap SystemCapability.Test.UiTest + * @atomicservice + * @since 11 + * @test + */ +/** + * Represents an Component of the ohos application,user can perform operations or query attributes on it. + * + * @syscap SystemCapability.Test.UiTest + * @crossplatform + * @atomicservice + * @since 12 + * @test + */ +declare class Component { + /** + * Click this {@link Component}. + * + * @returns { Promise } + * @throws { BusinessError } 17000002 - if the async function was not called with await. + * @throws { BusinessError } 17000004 - if the component is invisible or destroyed. + * @syscap SystemCapability.Test.UiTest + * @since 9 + * @test + */ + /** + * Click this {@link Component}. + * + * @returns { Promise } + * @throws { BusinessError } 17000002 - if the async function was not called with await. + * @throws { BusinessError } 17000004 - if the component is invisible or destroyed. + * @syscap SystemCapability.Test.UiTest + * @crossplatform + * @since 10 + * @test + */ + /** + * Click this {@link Component}. + * + * @returns { Promise } + * @throws { BusinessError } 17000002 - if the async function was not called with await. + * @throws { BusinessError } 17000004 - if the component is invisible or destroyed. + * @syscap SystemCapability.Test.UiTest + * @crossplatform + * @atomicservice + * @since 11 + * @test + */ + click(): Promise; + /** + * Double click this {@link Component}. + * + * @returns { Promise } + * @throws { BusinessError } 17000002 - if the async function was not called with await. + * @throws { BusinessError } 17000004 - if the component is invisible or destroyed. + * @syscap SystemCapability.Test.UiTest + * @since 9 + * @test + */ + /** + * Double click this {@link Component}. + * + * @returns { Promise } + * @throws { BusinessError } 17000002 - if the async function was not called with await. + * @throws { BusinessError } 17000004 - if the component is invisible or destroyed. + * @syscap SystemCapability.Test.UiTest + * @crossplatform + * @since 10 + * @test + */ + /** + * Double click this {@link Component}. + * + * @returns { Promise } + * @throws { BusinessError } 17000002 - if the async function was not called with await. + * @throws { BusinessError } 17000004 - if the component is invisible or destroyed. + * @syscap SystemCapability.Test.UiTest + * @crossplatform + * @atomicservice + * @since 11 + * @test + */ + doubleClick(): Promise; + /** + * Long click this {@link Component}. + * + * @returns { Promise } + * @throws { BusinessError } 17000002 - if the async function was not called with await. + * @throws { BusinessError } 17000004 - if the component is invisible or destroyed. + * @syscap SystemCapability.Test.UiTest + * @since 9 + * @test + */ + /** + * Long click this {@link Component}. + * + * @returns { Promise } + * @throws { BusinessError } 17000002 - if the async function was not called with await. + * @throws { BusinessError } 17000004 - if the component is invisible or destroyed. + * @syscap SystemCapability.Test.UiTest + * @crossplatform + * @since 10 + * @test + */ + /** + * Long click this {@link Component}. + * + * @returns { Promise } + * @throws { BusinessError } 17000002 - if the async function was not called with await. + * @throws { BusinessError } 17000004 - if the component is invisible or destroyed. + * @syscap SystemCapability.Test.UiTest + * @crossplatform + * @atomicservice + * @since 11 + * @test + */ + longClick(): Promise; + /** + * Get the id attribute value. + * + * @returns { Promise } the id value. + * @throws { BusinessError } 17000002 - if the async function was not called with await. + * @throws { BusinessError } 17000004 - if the component is invisible or destroyed. + * @syscap SystemCapability.Test.UiTest + * @since 9 + * @test + */ + /** + * Get the id attribute value. + * + * @returns { Promise } the id value. + * @throws { BusinessError } 17000002 - if the async function was not called with await. + * @throws { BusinessError } 17000004 - if the component is invisible or destroyed. + * @syscap SystemCapability.Test.UiTest + * @crossplatform + * @since 10 + * @test + */ + /** + * Get the id attribute value. + * + * @returns { Promise } the id value. + * @throws { BusinessError } 17000002 - if the async function was not called with await. + * @throws { BusinessError } 17000004 - if the component is invisible or destroyed. + * @syscap SystemCapability.Test.UiTest + * @crossplatform + * @atomicservice + * @since 11 + * @test + */ + getId(): Promise; + /** + * Get the text attribute value. + * + * @returns { Promise } the text value. + * @throws { BusinessError } 17000002 - if the async function was not called with await. + * @throws { BusinessError } 17000004 - if the component is invisible or destroyed. + * @syscap SystemCapability.Test.UiTest + * @since 9 + * @test + */ + /** + * Get the text attribute value. + * + * @returns { Promise } the text value. + * @throws { BusinessError } 17000002 - if the async function was not called with await. + * @throws { BusinessError } 17000004 - if the component is invisible or destroyed. + * @syscap SystemCapability.Test.UiTest + * @crossplatform + * @since 10 + * @test + */ + /** + * Get the text attribute value. + * + * @returns { Promise } the text value. + * @throws { BusinessError } 17000002 - if the async function was not called with await. + * @throws { BusinessError } 17000004 - if the component is invisible or destroyed. + * @syscap SystemCapability.Test.UiTest + * @crossplatform + * @atomicservice + * @since 11 + * @test + */ + getText(): Promise; + /** + * Get the type name. + * + * @returns { Promise } the type name. + * @throws { BusinessError } 17000002 - if the async function was not called with await. + * @throws { BusinessError } 17000004 - if the component is invisible or destroyed. + * @syscap SystemCapability.Test.UiTest + * @since 9 + * @test + */ + /** + * Get the type name. + * + * @returns { Promise } the type name. + * @throws { BusinessError } 17000002 - if the async function was not called with await. + * @throws { BusinessError } 17000004 - if the component is invisible or destroyed. + * @syscap SystemCapability.Test.UiTest + * @crossplatform + * @since 10 + * @test + */ + /** + * Get the type name. + * + * @returns { Promise } the type name. + * @throws { BusinessError } 17000002 - if the async function was not called with await. + * @throws { BusinessError } 17000004 - if the component is invisible or destroyed. + * @syscap SystemCapability.Test.UiTest + * @crossplatform + * @atomicservice + * @since 11 + * @test + */ + getType(): Promise; + /** + * Get the clickable status of this {@link Component}. + * + * @returns { Promise } the clickable status. + * @throws { BusinessError } 17000002 - if the async function was not called with await. + * @throws { BusinessError } 17000004 - if the component is invisible or destroyed. + * @syscap SystemCapability.Test.UiTest + * @since 9 + * @test + */ + /** + * Get the clickable status of this {@link Component}. + * + * @returns { Promise } the clickable status. + * @throws { BusinessError } 17000002 - if the async function was not called with await. + * @throws { BusinessError } 17000004 - if the component is invisible or destroyed. + * @syscap SystemCapability.Test.UiTest + * @crossplatform + * @since 10 + * @test + */ + /** + * Get the clickable status of this {@link Component}. + * + * @returns { Promise } the clickable status. + * @throws { BusinessError } 17000002 - if the async function was not called with await. + * @throws { BusinessError } 17000004 - if the component is invisible or destroyed. + * @syscap SystemCapability.Test.UiTest + * @crossplatform + * @atomicservice + * @since 11 + * @test + */ + isClickable(): Promise; + /** + * Get the longClickable status of this {@link Component}. + * + * @returns { Promise } the longClickable status. + * @throws { BusinessError } 17000002 - if the async function was not called with await. + * @throws { BusinessError } 17000004 - if the component is invisible or destroyed. + * @syscap SystemCapability.Test.UiTest + * @since 9 + * @test + */ + /** + * Get the longClickable status of this {@link Component}. + * + * @returns { Promise } the longClickable status. + * @throws { BusinessError } 17000002 - if the async function was not called with await. + * @throws { BusinessError } 17000004 - if the component is invisible or destroyed. + * @syscap SystemCapability.Test.UiTest + * @crossplatform + * @since 10 + * @test + */ + /** + * Get the clickable status of this {@link Component}. + * + * @returns { Promise } the clickable status. + * @throws { BusinessError } 17000002 - if the async function was not called with await. + * @throws { BusinessError } 17000004 - if the component is invisible or destroyed. + * @syscap SystemCapability.Test.UiTest + * @crossplatform + * @atomicservice + * @since 11 + * @test + */ + isLongClickable(): Promise; + /** + * Get the scrollable status of this {@link Component}. + * + * @returns { Promise } the scrollable status. + * @throws { BusinessError } 17000002 - if the async function was not called with await. + * @throws { BusinessError } 17000004 - if the component is invisible or destroyed. + * @syscap SystemCapability.Test.UiTest + * @since 9 + * @test + */ + /** + * Get the scrollable status of this {@link Component}. + * + * @returns { Promise } the scrollable status. + * @throws { BusinessError } 17000002 - if the async function was not called with await. + * @throws { BusinessError } 17000004 - if the component is invisible or destroyed. + * @syscap SystemCapability.Test.UiTest + * @crossplatform + * @since 10 + * @test + */ + /** + * Get the scrollable status of this {@link Component}. + * + * @returns { Promise } the scrollable status. + * @throws { BusinessError } 17000002 - if the async function was not called with await. + * @throws { BusinessError } 17000004 - if the component is invisible or destroyed. + * @syscap SystemCapability.Test.UiTest + * @crossplatform + * @atomicservice + * @since 11 + * @test + */ + isScrollable(): Promise; + /** + * Get the enabled status of this {@link Component}. + * + * @returns { Promise } the enabled status. + * @throws { BusinessError } 17000002 - if the async function was not called with await. + * @throws { BusinessError } 17000004 - if the component is invisible or destroyed. + * @syscap SystemCapability.Test.UiTest + * @since 9 + * @test + */ + /** + * Get the enabled status of this {@link Component}. + * + * @returns { Promise } the enabled status. + * @throws { BusinessError } 17000002 - if the async function was not called with await. + * @throws { BusinessError } 17000004 - if the component is invisible or destroyed. + * @syscap SystemCapability.Test.UiTest + * @crossplatform + * @since 10 + * @test + */ + /** + * Get the enabled status of this {@link Component}. + * + * @returns { Promise } the enabled status. + * @throws { BusinessError } 17000002 - if the async function was not called with await. + * @throws { BusinessError } 17000004 - if the component is invisible or destroyed. + * @syscap SystemCapability.Test.UiTest + * @crossplatform + * @atomicservice + * @since 11 + * @test + */ + isEnabled(): Promise; + /** + * Get the focused status of this {@link Component}. + * + * @returns { Promise } the focused status. + * @throws { BusinessError } 17000002 - if the async function was not called with await. + * @throws { BusinessError } 17000004 - if the component is invisible or destroyed. + * @syscap SystemCapability.Test.UiTest + * @since 9 + * @test + */ + /** + * Get the focused status of this {@link Component}. + * + * @returns { Promise } the focused status. + * @throws { BusinessError } 17000002 - if the async function was not called with await. + * @throws { BusinessError } 17000004 - if the component is invisible or destroyed. + * @syscap SystemCapability.Test.UiTest + * @crossplatform + * @since 10 + * @test + */ + /** + * Get the focused status of this {@link Component}. + * + * @returns { Promise } the focused status. + * @throws { BusinessError } 17000002 - if the async function was not called with await. + * @throws { BusinessError } 17000004 - if the component is invisible or destroyed. + * @syscap SystemCapability.Test.UiTest + * @crossplatform + * @atomicservice + * @since 11 + * @test + */ + isFocused(): Promise; + /** + * Get the selected status of this {@link Component}. + * + * @returns { Promise } the selected status. + * @throws { BusinessError } 17000002 - if the async function was not called with await. + * @throws { BusinessError } 17000004 - if the component is invisible or destroyed. + * @syscap SystemCapability.Test.UiTest + * @since 9 + * @test + */ + /** + * Get the selected status of this {@link Component}. + * + * @returns { Promise } the selected status. + * @throws { BusinessError } 17000002 - if the async function was not called with await. + * @throws { BusinessError } 17000004 - if the component is invisible or destroyed. + * @syscap SystemCapability.Test.UiTest + * @crossplatform + * @since 10 + * @test + */ + /** + * Get the selected status of this {@link Component}. + * + * @returns { Promise } the selected status. + * @throws { BusinessError } 17000002 - if the async function was not called with await. + * @throws { BusinessError } 17000004 - if the component is invisible or destroyed. + * @syscap SystemCapability.Test.UiTest + * @crossplatform + * @atomicservice + * @since 11 + * @test + */ + isSelected(): Promise; + /** + * Get the checked status of this {@link Component}. + * + * @returns { Promise } the checked status. + * @throws { BusinessError } 17000002 - if the async function was not called with await. + * @throws { BusinessError } 17000004 - if the component is invisible or destroyed. + * @syscap SystemCapability.Test.UiTest + * @since 9 + * @test + */ + /** + * Get the checked status of this {@link Component}. + * + * @returns { Promise } the checked status. + * @throws { BusinessError } 17000002 - if the async function was not called with await. + * @throws { BusinessError } 17000004 - if the component is invisible or destroyed. + * @syscap SystemCapability.Test.UiTest + * @crossplatform + * @since 10 + * @test + */ + /** + * Get the checked status of this {@link Component}. + * + * @returns { Promise } the checked status. + * @throws { BusinessError } 17000002 - if the async function was not called with await. + * @throws { BusinessError } 17000004 - if the component is invisible or destroyed. + * @syscap SystemCapability.Test.UiTest + * @crossplatform + * @atomicservice + * @since 11 + * @test + */ + isChecked(): Promise; + /** + * Get the checkable status of this {@link Component}. + * + * @returns { Promise } the checkable status. + * @throws { BusinessError } 17000002 - if the async function was not called with await. + * @throws { BusinessError } 17000004 - if the component is invisible or destroyed. + * @syscap SystemCapability.Test.UiTest + * @since 9 + * @test + */ + /** + * Get the checkable status of this {@link Component}. + * + * @returns { Promise } the checkable status. + * @throws { BusinessError } 17000002 - if the async function was not called with await. + * @throws { BusinessError } 17000004 - if the component is invisible or destroyed. + * @syscap SystemCapability.Test.UiTest + * @crossplatform + * @since 10 + * @test + */ + /** + * Get the checkable status of this {@link Component}. + * + * @returns { Promise } the checkable status. + * @throws { BusinessError } 17000002 - if the async function was not called with await. + * @throws { BusinessError } 17000004 - if the component is invisible or destroyed. + * @syscap SystemCapability.Test.UiTest + * @crossplatform + * @atomicservice + * @since 11 + * @test + */ + isCheckable(): Promise; + /** + * Inject text to this {@link Component},applicable to TextInput. + * + * @param { string } text The text to inject. + * @returns { Promise } + * @throws { BusinessError } 401 - if the input parameters are invalid. + * @throws { BusinessError } 17000002 - if the async function was not called with await. + * @throws { BusinessError } 17000004 - if the component is invisible or destroyed. + * @syscap SystemCapability.Test.UiTest + * @since 9 + * @test + */ + /** + * Inject text to this {@link Component},applicable to TextInput. + * + * @param { string } text The text to inject. + * @returns { Promise } + * @throws { BusinessError } 401 - if the input parameters are invalid. + * @throws { BusinessError } 17000002 - if the async function was not called with await. + * @throws { BusinessError } 17000004 - if the component is invisible or destroyed. + * @syscap SystemCapability.Test.UiTest + * @crossplatform + * @since 10 + * @test + */ + /** + * Inject text to this {@link Component},applicable to TextInput. + * + * @param { string } text - the text to inject. + * @returns { Promise } + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. + * @throws { BusinessError } 17000002 - if the async function was not called with await. + * @throws { BusinessError } 17000004 - if the component is invisible or destroyed. + * @syscap SystemCapability.Test.UiTest + * @crossplatform + * @atomicservice + * @since 11 + * @test + */ + inputText(text: string): Promise; + /** + * Clear text of this {@link Component},applicable to TextInput. + * + * @returns { Promise } + * @throws { BusinessError } 17000002 - if the async function was not called with await. + * @throws { BusinessError } 17000004 - if the component is invisible or destroyed. + * @syscap SystemCapability.Test.UiTest + * @since 9 + * @test + */ + /** + * Clear text of this {@link Component},applicable to TextInput. + * + * @returns { Promise } + * @throws { BusinessError } 17000002 - if the async function was not called with await. + * @throws { BusinessError } 17000004 - if the component is invisible or destroyed. + * @syscap SystemCapability.Test.UiTest + * @crossplatform + * @since 10 + * @test + */ + /** + * Clear text of this {@link Component},applicable to TextInput. + * + * @returns { Promise } + * @throws { BusinessError } 17000002 - if the async function was not called with await. + * @throws { BusinessError } 17000004 - if the component is invisible or destroyed. + * @syscap SystemCapability.Test.UiTest + * @crossplatform + * @atomicservice + * @since 10 + * @test + */ + clearText(): Promise; + /** + * Scroll on this {@link Component} to the top,applicable to scrollable one. + * + * @param { number } speed The speed of swipe (pixels per second),default is 600,the value ranges from 200 to 40000,set it 600 if out of range. + * @returns { Promise } + * @throws { BusinessError } 401 - if the input parameters are invalid. + * @throws { BusinessError } 17000002 - if the async function was not called with await. + * @throws { BusinessError } 17000004 - if the component is invisible or destroyed. + * @syscap SystemCapability.Test.UiTest + * @since 9 + * @test + */ + /** + * Scroll on this {@link Component} to the top,applicable to scrollable one. + * + * @param { number } speed The speed of swipe (pixels per second),default is 600,the value ranges from 200 to 40000,set it 600 if out of range. + * @returns { Promise } + * @throws { BusinessError } 401 - if the input parameters are invalid. + * @throws { BusinessError } 17000002 - if the async function was not called with await. + * @throws { BusinessError } 17000004 - if the component is invisible or destroyed. + * @syscap SystemCapability.Test.UiTest + * @crossplatform + * @since 10 + * @test + */ + /** + * Scroll on this {@link Component} to the top,applicable to scrollable one. + * + * @param { number } [speed] - the speed of swipe(pixels per second),ranges from 200 to 40000.Set it default 600 if out of range or null or undefined. + * @returns { Promise } + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Incorrect parameter types; 2. Parameter verification failed. + * @throws { BusinessError } 17000002 - if the async function was not called with await. + * @throws { BusinessError } 17000004 - if the component is invisible or destroyed. + * @syscap SystemCapability.Test.UiTest + * @crossplatform + * @atomicservice + * @since 11 + * @test + */ + scrollToTop(speed?: number): Promise; + /** + * Scroll on this {@link Component} to the bottom,applicable to scrollable one. + * + * @param { number } speed The speed of swipe (pixels per second),default is 600,the value ranges from 200 to 40000,set it 600 if out of range. + * @returns { Promise } + * @throws { BusinessError } 401 - if the input parameters are invalid. + * @throws { BusinessError } 17000002 - if the async function was not called with await. + * @throws { BusinessError } 17000004 - if the component is invisible or destroyed. + * @syscap SystemCapability.Test.UiTest + * @since 9 + * @test + */ + /** + * Scroll on this {@link Component} to the bottom,applicable to scrollable one. + * + * @param { number } speed The speed of swipe (pixels per second),default is 600,the value ranges from 200 to 40000,set it 600 if out of range. + * @returns { Promise } + * @throws { BusinessError } 401 - if the input parameters are invalid. + * @throws { BusinessError } 17000002 - if the async function was not called with await. + * @throws { BusinessError } 17000004 - if the component is invisible or destroyed. + * @syscap SystemCapability.Test.UiTest + * @crossplatform + * @since 10 + * @test + */ + /** + * Scroll on this {@link Component} to the bottom,applicable to scrollable one. + * + * @param { number } [speed] - the speed of swipe(pixels per second),ranges from 200 to 40000. Set it default 600 if out of range or null or undefined. + * @returns { Promise } + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Incorrect parameter types; 2. Parameter verification failed. + * @throws { BusinessError } 17000002 - if the async function was not called with await. + * @throws { BusinessError } 17000004 - if the component is invisible or destroyed. + * @syscap SystemCapability.Test.UiTest + * @crossplatform + * @atomicservice + * @since 11 + * @test + */ + scrollToBottom(speed?: number): Promise; + /** + * Scroll on this {@link Component}to find matched {@link Component},applicable to scrollable one. + * + * @param { On } on The attribute requirements of the target {@link Component}. + * @returns { Promise } the found result,or undefined if not found. + * @throws { BusinessError } 401 - if the input parameters are invalid. + * @throws { BusinessError } 17000002 - if the async function was not called with await. + * @throws { BusinessError } 17000004 - if the component is invisible or destroyed. + * @syscap SystemCapability.Test.UiTest + * @since 9 + * @test + */ + /** + * Scroll on this {@link Component}to find matched {@link Component},applicable to scrollable one. + * + * @param { On } on The attribute requirements of the target {@link Component}. + * @returns { Promise } the found result,or undefined if not found. + * @throws { BusinessError } 401 - if the input parameters are invalid. + * @throws { BusinessError } 17000002 - if the async function was not called with await. + * @throws { BusinessError } 17000004 - if the component is invisible or destroyed. + * @syscap SystemCapability.Test.UiTest + * @crossplatform + * @since 10 + * @test + */ + /** + * Scroll on this {@link Component}to find matched {@link Component},applicable to scrollable one. + * + * @param { On } on - the attribute requirements of the target {@link Component}. + * @returns { Promise } the found result,or undefined if not found. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. + * @throws { BusinessError } 17000002 - if the async function was not called with await. + * @throws { BusinessError } 17000004 - if the component is invisible or destroyed. + * @syscap SystemCapability.Test.UiTest + * @crossplatform + * @atomicservice + * @since 10 + * @test + */ + scrollSearch(on: On): Promise; + /** + * Get the bounds rect of this {@link Component}. + * + * @returns { Promise } the bounds rect object. + * @throws { BusinessError } 17000002 - if the async function was not called with await. + * @throws { BusinessError } 17000004 - if the component is invisible or destroyed. + * @syscap SystemCapability.Test.UiTest + * @since 9 + * @test + */ + /** + * Get the bounds rect of this {@link Component}. + * + * @returns { Promise } the bounds rect object. + * @throws { BusinessError } 17000002 - if the async function was not called with await. + * @throws { BusinessError } 17000004 - if the component is invisible or destroyed. + * @syscap SystemCapability.Test.UiTest + * @atomicservice + * @since 11 + * @test + */ + /** + * Get the bounds rect of this {@link Component}. + * + * @returns { Promise } the bounds rect object. + * @throws { BusinessError } 17000002 - if the async function was not called with await. + * @throws { BusinessError } 17000004 - if the component is invisible or destroyed. + * @syscap SystemCapability.Test.UiTest + * @crossplatform + * @atomicservice + * @since 12 + * @test + */ + getBounds(): Promise; + /** + * Get the boundsCenter of this {@link Component}. + * + * @returns { Promise } the boundsCenter object. + * @throws { BusinessError } 17000002 - if the async function was not called with await. + * @throws { BusinessError } 17000004 - if the component is invisible or destroyed. + * @syscap SystemCapability.Test.UiTest + * @since 9 + * @test + */ + /** + * Get the boundsCenter of this {@link Component}. + * + * @returns { Promise } the boundsCenter object. + * @throws { BusinessError } 17000002 - if the async function was not called with await. + * @throws { BusinessError } 17000004 - if the component is invisible or destroyed. + * @syscap SystemCapability.Test.UiTest + * @crossplatform + * @since 10 + * @test + */ + /** + * Get the boundsCenter of this {@link Component}. + * + * @returns { Promise } the boundsCenter object. + * @throws { BusinessError } 17000002 - if the async function was not called with await. + * @throws { BusinessError } 17000004 - if the component is invisible or destroyed. + * @syscap SystemCapability.Test.UiTest + * @crossplatform + * @atomicservice + * @since 11 + * @test + */ + getBoundsCenter(): Promise; + /** + * Drag this {@link Component} to the bounds rect of target Component. + * + * @param { Component } target The target {@link Component}. + * @returns { Promise } + * @throws { BusinessError } 401 - if the input parameters are invalid. + * @throws { BusinessError } 17000002 - if the async function was not called with await. + * @throws { BusinessError } 17000004 - if the component is invisible or destroyed. + * @syscap SystemCapability.Test.UiTest + * @since 9 + * @test + */ + /** + * Drag this {@link Component} to the bounds rect of target Component. + * + * @param { Component } target - the target {@link Component}. + * @returns { Promise } + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. + * @throws { BusinessError } 17000002 - if the async function was not called with await. + * @throws { BusinessError } 17000004 - if the component is invisible or destroyed. + * @syscap SystemCapability.Test.UiTest + * @atomicservice + * @since 11 + * @test + */ + dragTo(target: Component): Promise; + /** + * Pinch enlarge this {@link Component} to the target scale. + * + * @param { number } scale The scale of the pinch enlarge this {@link Component}'s size. + * @returns { Promise } + * @throws { BusinessError } 401 - if the input parameters are invalid. + * @throws { BusinessError } 17000002 - if the async function was not called with await. + * @throws { BusinessError } 17000004 - if the component is invisible or destroyed. + * @syscap SystemCapability.Test.UiTest + * @since 9 + * @test + */ + /** + * Pinch enlarge this {@link Component} to the target scale. + * + * @param { number } scale - the scale of the pinch enlarge this {@link Component}'s size, ranges greater than 1. + * @returns { Promise } + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. + * @throws { BusinessError } 17000002 - if the async function was not called with await. + * @throws { BusinessError } 17000004 - if the component is invisible or destroyed. + * @syscap SystemCapability.Test.UiTest + * @crossplatform + * @atomicservice + * @since 11 + * @test + */ + pinchOut(scale: number): Promise; + /** + * Pinch shrink this {@link Component} to the target scale. + * + * @param { number } scale The scale of the pinch shrink this {@link Component}'s size. + * @returns { Promise } + * @throws { BusinessError } 401 - if the input parameters are invalid. + * @throws { BusinessError } 17000002 - if the async function was not called with await. + * @throws { BusinessError } 17000004 - if the component is invisible or destroyed. + * @syscap SystemCapability.Test.UiTest + * @since 9 + * @test + */ + /** + * Pinch shrink this {@link Component} to the target scale. + * + * @param { number } scale - the scale of the pinch shrink this {@link Component}'s size, ranges from 0 to 1. + * @returns { Promise } + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. + * @throws { BusinessError } 17000002 - if the async function was not called with await. + * @throws { BusinessError } 17000004 - if the component is invisible or destroyed. + * @syscap SystemCapability.Test.UiTest + * @crossplatform + * @atomicservice + * @since 11 + * @test + */ + pinchIn(scale: number): Promise; + /** + * Get the description attribute value. + * + * @returns { Promise } the description value. + * @throws { BusinessError } 17000002 - if the async function was not called with await. + * @throws { BusinessError } 17000004 - if the component is invisible or destroyed. + * @syscap SystemCapability.Test.UiTest + * @atomicservice + * @since 11 + * @test + */ + getDescription(): Promise; +} +/** + * The unified facade of UiTest framework,can be used to find {@link Component},trigger keyEvents,perform + * coordinates-based UI actions,capture screen and so on. + * + * @syscap SystemCapability.Test.UiTest + * @since 9 + * @test + */ +/** + * The unified facade of UiTest framework,can be used to find {@link Component},trigger keyEvents,perform + * coordinates-based UI actions,capture screen and so on. + * + * @syscap SystemCapability.Test.UiTest + * @atomicservice + * @since 11 + * @test + */ +/** + * The unified facade of UiTest framework,can be used to find {@link Component},trigger keyEvents,perform + * coordinates-based UI actions,capture screen and so on. + * + * @syscap SystemCapability.Test.UiTest + * @crossplatform + * @atomicservice + * @since 12 + * @test + */ +declare class Driver { + /** + * Create an {@link Driver} object. + * + * @returns { Driver } the {@link Driver} object. + * @throws { BusinessError } 17000001 - if the test framework failed to initialize. + * @syscap SystemCapability.Test.UiTest + * @since 9 + * @test + */ + /** + * Create an {@link Driver} object. + * + * @returns { Driver } the {@link Driver} object. + * @throws { BusinessError } 17000001 - if the test framework failed to initialize. + * @syscap SystemCapability.Test.UiTest + * @crossplatform + * @since 10 + * @test + */ + /** + * Create an {@link Driver} object. + * + * @returns { Driver } the {@link Driver} object. + * @throws { BusinessError } 17000001 - if the test framework failed to initialize. + * @syscap SystemCapability.Test.UiTest + * @crossplatform + * @atomicservice + * @since 11 + * @test + */ + static create(): Driver; + /** + * Delay with specified duration. + * + * @param { number } duration The delay duration in milliseconds. + * @returns { Promise } + * @throws { BusinessError } 401 - if the input parameters are invalid. + * @throws { BusinessError } 17000002 - if the async function was not called with await. + * @syscap SystemCapability.Test.UiTest + * @since 9 + * @test + */ + /** + * Delay with specified duration. + * + * @param { number } duration The delay duration in milliseconds. + * @returns { Promise } + * @throws { BusinessError } 401 - if the input parameters are invalid. + * @throws { BusinessError } 17000002 - if the async function was not called with await. + * @syscap SystemCapability.Test.UiTest + * @crossplatform + * @since 10 + * @test + */ + /** + * Delay with specified duration. + * + * @param { number } duration - the delay duration in milliseconds, not less than 0. + * @returns { Promise } + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. + * @throws { BusinessError } 17000002 - if the async function was not called with await. + * @syscap SystemCapability.Test.UiTest + * @crossplatform + * @atomicservice + * @since 11 + * @test + */ + delayMs(duration: number): Promise; + /** + * Find the first matched {@link Component} on current UI. + * + * @param { On } on The attribute requirements of the target {@link Component}. + * @returns { Promise } the first matched {@link Component} or undefined. + * @throws { BusinessError } 401 - if the input parameters are invalid. + * @throws { BusinessError } 17000002 - if the async function was not called with await. + * @syscap SystemCapability.Test.UiTest + * @since 9 + * @test + */ + /** + * Find the first matched {@link Component} on current UI. + * + * @param { On } on The attribute requirements of the target {@link Component}. + * @returns { Promise } the first matched {@link Component} or undefined. + * @throws { BusinessError } 401 - if the input parameters are invalid. + * @throws { BusinessError } 17000002 - if the async function was not called with await. + * @syscap SystemCapability.Test.UiTest + * @crossplatform + * @since 10 + * @test + */ + /** + * Find the first matched {@link Component} on current UI. + * + * @param { On } on - the attribute requirements of the target {@link Component}. + * @returns { Promise } the first matched {@link Component} or undefined. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. + * @throws { BusinessError } 17000002 - if the async function was not called with await. + * @syscap SystemCapability.Test.UiTest + * @crossplatform + * @atomicservice + * @since 11 + * @test + */ + findComponent(on: On): Promise; + /** + * Find the first matched {@link UiWindow} window. + * + * @param { WindowFilter } filter The filer condition of the target {@link UiWindow}. + * @returns { Promise } the first matched {@link UiWindow} or undefined. + * @throws { BusinessError } 401 - if the input parameters are invalid. + * @throws { BusinessError } 17000002 - if the async function was not called with await. + * @syscap SystemCapability.Test.UiTest + * @since 9 + * @test + */ + /** + * Find the first matched {@link UiWindow} window. + * + * @param { WindowFilter } filter - the filer condition of the target {@link UiWindow}. + * @returns { Promise } the first matched {@link UiWindow} or undefined. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. + * @throws { BusinessError } 17000002 - if the async function was not called with await. + * @syscap SystemCapability.Test.UiTest + * @atomicservice + * @since 11 + * @test + */ + findWindow(filter: WindowFilter): Promise; + /** + * Find the first matched {@link Component} on current UI during the time given. + * + * @param { On } on The attribute requirements of the target {@link Component}. + * @param { number } time Duration of finding in milliseconds + * @returns { Promise } the first matched {@link Component} or undefined. + * @throws { BusinessError } 401 - if the input parameters are invalid. + * @throws { BusinessError } 17000002 - if the async function was not called with await. + * @syscap SystemCapability.Test.UiTest + * @since 9 + * @test + */ + /** + * Find the first matched {@link Component} on current UI during the time given. + * + * @param { On } on - the attribute requirements of the target {@link Component}. + * @param { number } time - duration of finding in milliseconds, not less than 0. + * @returns { Promise } the first matched {@link Component} or undefined. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. + * @throws { BusinessError } 17000002 - if the async function was not called with await. + * @syscap SystemCapability.Test.UiTest + * @atomicservice + * @since 11 + * @test + */ + waitForComponent(on: On, time: number): Promise; + /** + * Find all the matched {@link Component}s on current UI. + * + * @param { On } on The attribute requirements of the target {@link Component}. + * @returns { Promise> } the matched {@link Component}s list. + * @throws { BusinessError } 401 - if the input parameters are invalid. + * @throws { BusinessError } 17000002 - if the async function was not called with await. + * @syscap SystemCapability.Test.UiTest + * @since 9 + * @test + */ + /** + * Find all the matched {@link Component}s on current UI. + * + * @param { On } on The attribute requirements of the target {@link Component}. + * @returns { Promise> } the matched {@link Component}s list. + * @throws { BusinessError } 401 - if the input parameters are invalid. + * @throws { BusinessError } 17000002 - if the async function was not called with await. + * @syscap SystemCapability.Test.UiTest + * @crossplatform + * @since 10 + * @test + */ + /** + * Find all the matched {@link Component}s on current UI. + * + * @param { On } on - the attribute requirements of the target {@link Component}. + * @returns { Promise> } the matched {@link Component}s list. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. + * @throws { BusinessError } 17000002 - if the async function was not called with await. + * @syscap SystemCapability.Test.UiTest + * @crossplatform + * @atomicservice + * @since 11 + * @test + */ + findComponents(on: On): Promise>; + /** + * Assert t the matched {@link Component}s exists on current UI;if not,assertError will be raised. + * + * @param { On } on The attribute requirements of the target {@link Component}. + * @returns { Promise } + * @throws { BusinessError } 401 - if the input parameters are invalid. + * @throws { BusinessError } 17000002 - if the async function was not called with await. + * @throws { BusinessError } 17000003 - if the assertion failed. + * @syscap SystemCapability.Test.UiTest + * @since 9 + * @test + */ + /** + * Assert t the matched {@link Component}s exists on current UI;if not,assertError will be raised. + * + * @param { On } on The attribute requirements of the target {@link Component}. + * @returns { Promise } + * @throws { BusinessError } 401 - if the input parameters are invalid. + * @throws { BusinessError } 17000002 - if the async function was not called with await. + * @throws { BusinessError } 17000003 - if the assertion failed. + * @syscap SystemCapability.Test.UiTest + * @crossplatform + * @since 10 + * @test + */ + /** + * Assert t the matched {@link Component}s exists on current UI;if not,assertError will be raised. + * + * @param { On } on - the attribute requirements of the target {@link Component}. + * @returns { Promise } + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. + * @throws { BusinessError } 17000002 - if the async function was not called with await. + * @throws { BusinessError } 17000003 - if the assertion failed. + * @syscap SystemCapability.Test.UiTest + * @crossplatform + * @atomicservice + * @since 11 + * @test + */ + assertComponentExist(on: On): Promise; + /** + * Press the BACK key. + * + * @returns { Promise } + * @throws { BusinessError } 17000002 - if the async function was not called with await. + * @syscap SystemCapability.Test.UiTest + * @since 9 + * @test + */ + /** + * Press the BACK key. + * + * @returns { Promise } + * @throws { BusinessError } 17000002 - if the async function was not called with await. + * @syscap SystemCapability.Test.UiTest + * @crossplatform + * @since 10 + * @test + */ + /** + * Press the BACK key. + * + * @returns { Promise } + * @throws { BusinessError } 17000002 - if the async function was not called with await. + * @syscap SystemCapability.Test.UiTest + * @crossplatform + * @atomicservice + * @since 11 + * @test + */ + pressBack(): Promise; + /** + * Press the specified key. + * + * @param { number } keyCode the target keyCode. + * @returns { Promise } + * @throws { BusinessError } 401 - if the input parameters are invalid. + * @throws { BusinessError } 17000002 - if the async function was not called with await. + * @syscap SystemCapability.Test.UiTest + * @since 9 + * @test + */ + /** + * Press the specified key. + * + * @param { number } keyCode - the target keyCode. + * @returns { Promise } + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. + * @throws { BusinessError } 17000002 - if the async function was not called with await. + * @syscap SystemCapability.Test.UiTest + * @crossplatform + * @atomicservice + * @since 11 + * @test + */ + triggerKey(keyCode: number): Promise; + /** + * Press two or three key combinations + * + * @param { number } key0 the first keyCode. + * @param { number } key1 the second keyCode. + * @param { number } key2 the third keyCode. + * @returns { Promise } + * @throws { BusinessError } 401 - if the input parameters are invalid. + * @throws { BusinessError } 17000002 - if the async function was not called with await. + * @syscap SystemCapability.Test.UiTest + * @since 9 + * @test + */ + /** + * Press two or three key combinations + * + * @param { number } key0 - the first keyCode. + * @param { number } key1 - the second keyCode. + * @param { number } [key2] - the third keyCode,set it default 0 if null or undefined. + * @returns { Promise } + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. + * @throws { BusinessError } 17000002 - if the async function was not called with await. + * @syscap SystemCapability.Test.UiTest + * @crossplatform + * @atomicservice + * @since 11 + * @test + */ + triggerCombineKeys(key0: number, key1: number, key2?: number): Promise; + /** + * Click on the specified location on the screen. + * + * @param { number } x The x-coordinate. + * @param { number } y The y-coordinate. + * @returns { Promise } + * @throws { BusinessError } 401 - if the input parameters are invalid. + * @throws { BusinessError } 17000002 - if the async function was not called with await. + * @syscap SystemCapability.Test.UiTest + * @since 9 + * @test + */ + /** + * Click on the specified location on the screen. + * + * @param { number } x The x-coordinate. + * @param { number } y The y-coordinate. + * @returns { Promise } + * @throws { BusinessError } 401 - if the input parameters are invalid. + * @throws { BusinessError } 17000002 - if the async function was not called with await. + * @syscap SystemCapability.Test.UiTest + * @crossplatform + * @since 10 + * @test + */ + /** + * Click on the specified location on the screen. + * + * @param { number } x - the x-coordinate, not less than 0. + * @param { number } y - the y-coordinate, not less than 0. + * @returns { Promise } + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. + * @throws { BusinessError } 17000002 - if the async function was not called with await. + * @syscap SystemCapability.Test.UiTest + * @crossplatform + * @atomicservice + * @since 11 + * @test + */ + click(x: number, y: number): Promise; + /** + * DoubleClick on the specified location on the screen. + * + * @param { number } x The x-coordinate. + * @param { number } y The y-coordinate. + * @returns { Promise } + * @throws { BusinessError } 401 - if the input parameters are invalid. + * @throws { BusinessError } 17000002 - if the async function was not called with await. + * @syscap SystemCapability.Test.UiTest + * @since 9 + * @test + */ + /** + * DoubleClick on the specified location on the screen. + * + * @param { number } x The x-coordinate. + * @param { number } y The y-coordinate. + * @returns { Promise } + * @throws { BusinessError } 401 - if the input parameters are invalid. + * @throws { BusinessError } 17000002 - if the async function was not called with await. + * @syscap SystemCapability.Test.UiTest + * @crossplatform + * @since 10 + * @test + */ + /** + * DoubleClick on the specified location on the screen. + * + * @param { number } x - the x-coordinate, not less than 0. + * @param { number } y - the y-coordinate, not less than 0. + * @returns { Promise } + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. + * @throws { BusinessError } 17000002 - if the async function was not called with await. + * @syscap SystemCapability.Test.UiTest + * @crossplatform + * @atomicservice + * @since 11 + * @test + */ + doubleClick(x: number, y: number): Promise; + /** + * LongClick on the specified location on the screen. + * + * @param { number } x The x-coordinate. + * @param { number } y The y-coordinate. + * @returns { Promise } + * @throws { BusinessError } 401 - if the input parameters are invalid. + * @throws { BusinessError } 17000002 - if the async function was not called with await. + * @syscap SystemCapability.Test.UiTest + * @since 9 + * @test + */ + /** + * LongClick on the specified location on the screen. + * + * @param { number } x The x-coordinate. + * @param { number } y The y-coordinate. + * @returns { Promise } + * @throws { BusinessError } 401 - if the input parameters are invalid. + * @throws { BusinessError } 17000002 - if the async function was not called with await. + * @syscap SystemCapability.Test.UiTest + * @crossplatform + * @since 10 + * @test + */ + /** + * LongClick on the specified location on the screen. + * + * @param { number } x - the x-coordinate, not less than 0. + * @param { number } y - the y-coordinate, not less than 0. + * @returns { Promise } + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. + * @throws { BusinessError } 17000002 - if the async function was not called with await. + * @syscap SystemCapability.Test.UiTest + * @crossplatform + * @atomicservice + * @since 11 + * @test + */ + longClick(x: number, y: number): Promise; + /** + * Swipe on the screen between the specified points. + * + * @param { number } startx The x-coordinate of the starting point. + * @param { number } starty The y-coordinate of the starting point. + * @param { number } endx The x-coordinate of the ending point. + * @param { number } endy The y-coordinate of the ending point. + * @param { number } speed The speed of swipe (pixels per second),default is 600,the value ranges from 200 to 40000,set it 600 if out of range. + * @returns { Promise } + * @throws { BusinessError } 401 - if the input parameters are invalid. + * @throws { BusinessError } 17000002 - if the async function was not called with await. + * @syscap SystemCapability.Test.UiTest + * @since 9 + * @test + */ + /** + * Swipe on the screen between the specified points. + * + * @param { number } startx The x-coordinate of the starting point. + * @param { number } starty The y-coordinate of the starting point. + * @param { number } endx The x-coordinate of the ending point. + * @param { number } endy The y-coordinate of the ending point. + * @param { number } speed The speed of swipe (pixels per second),default is 600,the value ranges from 200 to 40000,set it 600 if out of range. + * @returns { Promise } + * @throws { BusinessError } 401 - if the input parameters are invalid. + * @throws { BusinessError } 17000002 - if the async function was not called with await. + * @syscap SystemCapability.Test.UiTest + * @crossplatform + * @since 10 + * @test + */ + /** + * Swipe on the screen between the specified points. + * + * @param { number } startx - the x-coordinate of the starting point, not less than 0. + * @param { number } starty - the y-coordinate of the starting point, not less than 0. + * @param { number } endx - the x-coordinate of the ending point, not less than 0. + * @param { number } endy - the y-coordinate of the ending point, not less than 0. + * @param { number } [speed] - the speed of swipe(pixels per second),ranges from 200 to 40000. Set it default 600 if out of range or null or undefined. + * @returns { Promise } + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. + * @throws { BusinessError } 17000002 - if the async function was not called with await. + * @syscap SystemCapability.Test.UiTest + * @crossplatform + * @atomicservice + * @since 11 + * @test + */ + swipe(startx: number, starty: number, endx: number, endy: number, speed?: number): Promise; + /** + * Drag on the screen between the specified points. + * + * @param { number } startx The x-coordinate of the starting point. + * @param { number } starty The y-coordinate of the starting point. + * @param { number } endx The x-coordinate of the ending point. + * @param { number } endy The y-coordinate of the ending point. + * @param { number } speed The speed of swipe (pixels per second),default is 600,the value ranges from 200 to 40000,set it 600 if out of range. + * @returns { Promise } + * @throws { BusinessError } 401 - if the input parameters are invalid. + * @throws { BusinessError } 17000002 - if the async function was not called with await. + * @syscap SystemCapability.Test.UiTest + * @since 9 + * @test + */ + /** + * Drag on the screen between the specified points. + * + * @param { number } startx - the x-coordinate of the starting point, not less than 0. + * @param { number } starty - the y-coordinate of the starting point, not less than 0. + * @param { number } endx - the x-coordinate of the ending point, not less than 0. + * @param { number } endy - the y-coordinate of the ending point, not less than 0. + * @param { number } [speed] the speed of drag(pixels per second),ranges from 200 to 40000. Set it default 600 if out of range or null or undefined. + * @returns { Promise } + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. + * @throws { BusinessError } 17000002 - if the async function was not called with await. + * @syscap SystemCapability.Test.UiTest + * @atomicservice + * @since 11 + * @test + */ + drag(startx: number, starty: number, endx: number, endy: number, speed?: number): Promise; + /** + * Capture current screen and save as picture which PNG format. + * + * @param { string } savePath the path where to store the picture. + * @returns { Promise } true if screen-capturing and file-storing are completed successfully,false otherwise. + * @throws { BusinessError } 401 - if the input parameters are invalid. + * @throws { BusinessError } 17000002 - if the async function was not called with await. + * @syscap SystemCapability.Test.UiTest + * @since 9 + * @test + */ + /** + * Capture current screen and save as picture which PNG format. + * + * @param { string } savePath - the path where to store the picture, must be in the application sandbox directory. + * @returns { Promise } true if screen-capturing and file-storing are completed successfully,false otherwise. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. + * @throws { BusinessError } 17000002 - if the async function was not called with await. + * @syscap SystemCapability.Test.UiTest + * @atomicservice + * @since 11 + * @test + */ + screenCap(savePath: string): Promise; + /** + * Set the rotation of the device display. + * + * @param { DisplayRotation } rotation The target rotation to set. + * @returns { Promise } + * @throws { BusinessError } 401 - if the input parameters are invalid. + * @throws { BusinessError } 17000002 - if the async function was not called with await. + * @syscap SystemCapability.Test.UiTest + * @since 9 + * @test + */ + /** + * Set the rotation of the device display. + * + * @param { DisplayRotation } rotation - the target rotation to set. + * @returns { Promise } + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. + * @throws { BusinessError } 17000002 - if the async function was not called with await. + * @syscap SystemCapability.Test.UiTest + * @atomicservice + * @since 11 + * @test + */ + setDisplayRotation(rotation: DisplayRotation): Promise; + /** + * Get the rotation of the device display. + * + * @returns { Promise } the current display rotation. + * @throws { BusinessError } 17000002 - if the async function was not called with await. + * @syscap SystemCapability.Test.UiTest + * @since 9 + * @test + */ + /** + * Get the rotation of the device display. + * + * @returns { Promise } the current display rotation. + * @throws { BusinessError } 17000002 - if the async function was not called with await. + * @syscap SystemCapability.Test.UiTest + * @atomicservice + * @since 11 + * @test + */ + getDisplayRotation(): Promise; + /** + * Enable/disable the rotation of device display. + * + * @param { boolean } enabled Enable the rotation or not. + * @returns { Promise } + * @throws { BusinessError } 401 - if the input parameters are invalid. + * @throws { BusinessError } 17000002 - if the async function was not called with await. + * @syscap SystemCapability.Test.UiTest + * @since 9 + * @test + */ + /** + * Enable/disable the rotation of device display. + * + * @param { boolean } enabled - enable the rotation or not. + * @returns { Promise } + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. + * @throws { BusinessError } 17000002 - if the async function was not called with await. + * @syscap SystemCapability.Test.UiTest + * @atomicservice + * @since 11 + * @test + */ + setDisplayRotationEnabled(enabled: boolean): Promise; + /** + * Get the size of the device display. + * + * @returns { Promise } the size of the device display. + * @throws { BusinessError } 17000002 - if the async function was not called with await. + * @syscap SystemCapability.Test.UiTest + * @since 9 + * @test + */ + /** + * Get the size of the device display. + * + * @returns { Promise } the size of the device display. + * @throws { BusinessError } 17000002 - if the async function was not called with await. + * @syscap SystemCapability.Test.UiTest + * @atomicservice + * @since 11 + * @test + */ + getDisplaySize(): Promise; + /** + * Get the density of the device display. + * + * @returns { Promise } the density of the device display. + * @throws { BusinessError } 17000002 - if the async function was not called with await. + * @syscap SystemCapability.Test.UiTest + * @since 9 + * @test + */ + /** + * Get the density of the device display. + * + * @returns { Promise } the density of the device display. + * @throws { BusinessError } 17000002 - if the async function was not called with await. + * @syscap SystemCapability.Test.UiTest + * @atomicservice + * @since 11 + * @test + */ + getDisplayDensity(): Promise; + /** + * Wake up the device display. + * + * @returns { Promise } + * @throws { BusinessError } 17000002 - if the async function was not called with await. + * @syscap SystemCapability.Test.UiTest + * @since 9 + * @test + */ + /** + * Wake up the device display. + * + * @returns { Promise } + * @throws { BusinessError } 17000002 - if the async function was not called with await. + * @syscap SystemCapability.Test.UiTest + * @atomicservice + * @since 11 + * @test + */ + wakeUpDisplay(): Promise; + /** + * Press the home key. + * + * @returns { Promise } + * @throws { BusinessError } 17000002 - if the async function was not called with await. + * @syscap SystemCapability.Test.UiTest + * @since 9 + * @test + */ + /** + * Press the home key. + * + * @returns { Promise } + * @throws { BusinessError } 17000002 - if the async function was not called with await. + * @syscap SystemCapability.Test.UiTest + * @atomicservice + * @since 11 + * @test + */ + pressHome(): Promise; + /** + * Wait for the UI become idle. + * + * @param { number } idleTime the threshold of UI idle time, in millisecond. + * @param { number } timeout The maximum time to wait for idle, in millisecond. + * @returns { Promise } true if wait for idle succeed in the timeout, false otherwise. + * @throws { BusinessError } 401 - if the input parameters are invalid. + * @throws { BusinessError } 17000002 - if the async function was not called with await. + * @syscap SystemCapability.Test.UiTest + * @since 9 + * @test + */ + /** + * Wait for the UI become idle. + * + * @param { number } idleTime - the threshold of UI idle time, in millisecond, not less than 0. + * @param { number } timeout - the maximum time to wait for idle, in millisecond, not less than 0. + * @returns { Promise } true if wait for idle succeed in the timeout, false otherwise. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. + * @throws { BusinessError } 17000002 - if the async function was not called with await. + * @syscap SystemCapability.Test.UiTest + * @atomicservice + * @since 11 + * @test + */ + waitForIdle(idleTime: number, timeout: number): Promise; + /** + * Inject fling on the device display. + * + * @param { Point } from The coordinate point where the finger touches the screen. + * @param { Point } to The coordinate point where the finger leaves the screen. + * @param { number } stepLen the length of each step, in pixels. + * @param { number } speed The speed of fling (pixels per second),default is 600,the value ranges from 200 to 40000,set it 600 if out of range. + * @returns { Promise } + * @throws { BusinessError } 401 - if the input parameters are invalid. + * @throws { BusinessError } 17000002 - if the async function was not called with await. + * @syscap SystemCapability.Test.UiTest + * @since 9 + * @test + */ + /** + * Inject fling on the device display. + * + * @param { Point } from The coordinate point where the finger touches the screen. + * @param { Point } to The coordinate point where the finger leaves the screen. + * @param { number } stepLen the length of each step, in pixels. + * @param { number } speed The speed of fling (pixels per second),default is 600,the value ranges from 200 to 40000,set it 600 if out of range. + * @returns { Promise } + * @throws { BusinessError } 401 - if the input parameters are invalid. + * @throws { BusinessError } 17000002 - if the async function was not called with await. + * @syscap SystemCapability.Test.UiTest + * @crossplatform + * @since 10 + * @test + */ + /** + * Inject fling on the device display. + * + * @param { Point } from - the coordinate point where the finger touches the screen. + * @param { Point } to - the coordinate point where the finger leaves the screen. + * @param { number } stepLen - the length of each step, in pixels. + * @param { number } [speed] - the speed of fling(pixels per second),ranges from 200 to 40000. Set it default 600 if out of range or null or undefined. + * @returns { Promise } + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. + * @throws { BusinessError } 17000002 - if the async function was not called with await. + * @syscap SystemCapability.Test.UiTest + * @crossplatform + * @atomicservice + * @since 11 + * @test + */ + fling(from: Point, to: Point, stepLen: number, speed: number): Promise; + /** + * Inject multi-pointer action on the device display. + * + * @param { PointerMatrix } pointers The two-dimensional array of pointers to inject. + * @param { number } speed The speed of swipe (pixels per second),default is 600,the value ranges from 200 to 40000,set it 600 if out of range. + * @returns { Promise } true if the operation finished, false + * @throws { BusinessError } 401 - if the input parameters are invalid. + * @throws { BusinessError } 17000002 - if the async function was not called with await. + * @syscap SystemCapability.Test.UiTest + * @since 9 + * @test + */ + /** + * Inject multi-pointer action on the device display. + * + * @param { PointerMatrix } pointers - the two-dimensional array of pointers to inject. + * @param { number } [speed] - the speed of swipe(pixels per second),ranges from 200 to 40000. Set it default 600 if out of range or null or undefined. + * @returns { Promise } true if the operation finished, false + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. + * @throws { BusinessError } 17000002 - if the async function was not called with await. + * @syscap SystemCapability.Test.UiTest + * @crossplatform + * @atomicservice + * @since 11 + * @test + */ + injectMultiPointerAction(pointers: PointerMatrix, speed?: number): Promise; + /** + * Inject fling on the device display. + * + * @param { UiDirection } direction The direction of this action. + * @param { number } speed The speed of fling (pixels per second),default is 600,the value ranges from 200 to 40000,set it 600 if out of range. + * @returns { Promise } + * @throws { BusinessError } 401 - if the input parameters are invalid. + * @throws { BusinessError } 17000002 - if the async function was not called with await. + * @syscap SystemCapability.Test.UiTest + * @since 10 + * @test + */ + /** + * Inject fling on the device display. + * + * @param { UiDirection } direction - the direction of this action. + * @param { number } speed - the speed of fling (pixels per second),default is 600,the value ranges from 200 to 40000,set it 600 if out of range. + * @returns { Promise } + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. + * @throws { BusinessError } 17000002 - if the async function was not called with await. + * @syscap SystemCapability.Test.UiTest + * @atomicservice + * @since 11 + * @test + */ + fling(direction: UiDirection, speed: number): Promise; + /** + * Click on the specified location on the screen with the specified mouse button, and press the specified key simultaneously if necessary. + * + * @param { Point } p The coordinate of the specified location. + * @param { MouseButton } btnId The button of Mouse. + * @param { number } key1 the first keyCode. + * @param { number } key2 the second keyCode. + * @returns { Promise } + * @throws { BusinessError } 401 - if the input parameters are invalid. + * @throws { BusinessError } 17000002 - if the async function was not called with await. + * @syscap SystemCapability.Test.UiTest + * @since 10 + * @test + */ + /** + * Click on the specified location on the screen with the specified mouse button, and press the specified key simultaneously if necessary. + * + * @param { Point } p - the coordinate of the specified location. + * @param { MouseButton } btnId - the button of Mouse. + * @param { number } [key1] - the first keyCode,set it default 0 if null or undefined. + * @param { number } [key2] - the second keyCode,set it default 0 if null or undefined. + * @returns { Promise } + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. + * @throws { BusinessError } 17000002 - if the async function was not called with await. + * @syscap SystemCapability.Test.UiTest + * @atomicservice + * @since 11 + * @test + */ + mouseClick(p: Point, btnId: MouseButton, key1?: number, key2?: number): Promise; + /** + * Move the mouse cursor to the specified location. + * + * @param { Point } p The coordinate of the specified location. + * @returns { Promise } + * @throws { BusinessError } 401 - if the input parameters are invalid. + * @throws { BusinessError } 17000002 - if the async function was not called with await. + * @syscap SystemCapability.Test.UiTest + * @since 10 + * @test + */ + /** + * Move the mouse cursor to the specified location. + * + * @param { Point } p - the coordinate of the specified location. + * @returns { Promise } + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. + * @throws { BusinessError } 17000002 - if the async function was not called with await. + * @syscap SystemCapability.Test.UiTest + * @atomicservice + * @since 11 + * @test + */ + mouseMoveTo(p: Point): Promise; + /** + * The mouse wheel scrolls the specified cell at the specified position, and press the specified key simultaneously if necessary. + * + * @param { Point } p The coordinate of the specified location. + * @param { boolean } down Whether the mouse wheel rolls down. + * @param { number } d The number of cells that the mouse wheel scrolls, each cell will make the target point shift 120 pixels. + * @param { number } key1 the first keyCode. + * @param { number } key2 the second keyCode. + * @returns { Promise } + * @throws { BusinessError } 401 - if the input parameters are invalid. + * @throws { BusinessError } 17000002 - if the async function was not called with await. + * @syscap SystemCapability.Test.UiTest + * @since 10 + * @test + */ + /** + * The mouse wheel scrolls the specified cell at the specified position, and press the specified key simultaneously if necessary. + * + * @param { Point } p - the coordinate of the specified location. + * @param { boolean } down - whether the mouse wheel rolls down. + * @param { number } d - the number of cells that the mouse wheel scrolls, each cell will make the target point shift 120 pixels. + * @param { number } [key1] - the first keyCode,set it default 0 if null or undefined. + * @param { number } [key2] - the second keyCode,set it default 0 if null or undefined. + * @returns { Promise } + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. + * @throws { BusinessError } 17000002 - if the async function was not called with await. + * @syscap SystemCapability.Test.UiTest + * @atomicservice + * @since 11 + * @test + */ + mouseScroll(p: Point, down: boolean, d: number, key1?: number, key2?: number): Promise; + /** + * The mouse wheel scrolls the specified cell at the specified position, and press the specified key simultaneously if necessary. + * + * @param { Point } p - the coordinate of the specified location. + * @param { boolean } down - whether the mouse wheel rolls down. + * @param { number } d - the number of cells that the mouse wheel scrolls, each cell will make the target point shift 120 pixels. + * @param { number } [key1] - the first keyCode,set it default 0 if null or undefined. + * @param { number } [key2] - the second keyCode,set it default 0 if null or undefined. + * @param { number } [speed] - The Speed of mouse wheel rolls(cells per second),ranges from 1 to 500.Set it default 20 if out of range or null or undefined. + * @returns { Promise } + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. + * @throws { BusinessError } 17000002 - if the async function was not called with await. + * @syscap SystemCapability.Test.UiTest + * @atomicservice + * @since 11 + * @test + */ + mouseScroll(p: Point, down: boolean, d: number, key1?: number, key2?: number, speed?: number): Promise; + /** + * Capture the specified area of current screen and save as picture which PNG format. + * + * @param { string } savePath the path where to store the picture. + * @param { Rect } rect The specified area of current screen, default to full screen. + * @returns { Promise } true if screen-capturing and file-storing are completed successfully,false otherwise. + * @throws { BusinessError } 401 - if the input parameters are invalid. + * @throws { BusinessError } 17000002 - if the async function was not called with await. + * @syscap SystemCapability.Test.UiTest + * @since 10 + * @test + */ + /** + * Capture the specified area of current screen and save as picture which PNG format. + * + * @param { string } savePath - the path where to store the picture, must be in the application sandbox directory. + * @param { Rect } [rect] - the specified area of current screen, default to full screen.Set it default if null or undefined. + * @returns { Promise } true if screen-capturing and file-storing are completed successfully,false otherwise. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. + * @throws { BusinessError } 17000002 - if the async function was not called with await. + * @syscap SystemCapability.Test.UiTest + * @atomicservice + * @since 11 + * @test + */ + screenCapture(savePath: string, rect?: Rect): Promise; + /** + * Create an {@link UIEventObserver} object. + * + * @returns { UIEventObserver } the {@link UIEventObserver} object. + * @throws { BusinessError } 17000002 - if the async function was not called with await. + * @syscap SystemCapability.Test.UiTest + * @since 10 + * @test + */ + /** + * Create an {@link UIEventObserver} object. + * + * @returns { UIEventObserver } the {@link UIEventObserver} object. + * @throws { BusinessError } 17000002 - if the async function was not called with await. + * @syscap SystemCapability.Test.UiTest + * @atomicservice + * @since 11 + * @test + */ + createUIEventObserver(): UIEventObserver; + /** + * Double click on the specified location on the screen with the specified mouse button, and press the specified key simultaneously if necessary. + * + * @param { Point } p - the coordinate of the specified location. + * @param { MouseButton } btnId - the button of Mouse. + * @param { number } [key1] - the first keyCode,set it default 0 if null or undefined. + * @param { number } [key2] - the second keyCode,set it default 0 if null or undefined. + * @returns { Promise } + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. + * @throws { BusinessError } 17000002 - if the async function was not called with await. + * @syscap SystemCapability.Test.UiTest + * @atomicservice + * @since 11 + * @test + */ + mouseDoubleClick(p: Point, btnId: MouseButton, key1?: number, key2?: number): Promise; + /** + * Long click on the specified location on the screen with the specified mouse button, and press the specified key simultaneously if necessary. + * + * @param { Point } p - the coordinate of the specified location. + * @param { MouseButton } btnId - the button of Mouse. + * @param { number } [key1] - the first keyCode,set it default 0 if null or undefined. + * @param { number } [key2] - the second keyCode,set it default 0 if null or undefined. + * @returns { Promise } + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. + * @throws { BusinessError } 17000002 - if the async function was not called with await. + * @syscap SystemCapability.Test.UiTest + * @atomicservice + * @since 11 + * @test + */ + mouseLongClick(p: Point, btnId: MouseButton, key1?: number, key2?: number): Promise; + /** + * Swipe on the screen between the specified points with mouse. + * + * @param { Point } from - the starting point. + * @param { Point } to - the ending point. + * @param { number } [speed] - speed of swipe (pixels per second),the value ranges from 200 to 40000.Set it default 600 if out of range or null or undefined. + * @returns { Promise } + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. + * @throws { BusinessError } 17000002 - if the async function was not called with await. + * @syscap SystemCapability.Test.UiTest + * @atomicservice + * @since 11 + * @test + */ + mouseMoveWithTrack(from: Point, to: Point, speed?: number): Promise; + /** + * Hold down the left mouse button and drag on the screen between the specified points. + * + * @param { Point } from - the starting point. + * @param { Point } to - the ending point. + * @param { number } [speed] - speed of drag (pixels per second),the value ranges from 200 to 40000,Set it default 600 if out of range or null or undefined. + * @returns { Promise } + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. + * @throws { BusinessError } 17000002 - if the async function was not called with await. + * @syscap SystemCapability.Test.UiTest + * @atomicservice + * @since 11 + * @test + */ + mouseDrag(from: Point, to: Point, speed?: number): Promise; + /** + * Inject text on the specified location. + * + * @param { Point } p - the coordinate of the specified location. + * @param { string } text - the text to inject. + * @returns { Promise } + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. + * @throws { BusinessError } 17000002 - if the async function was not called with await. + * @syscap SystemCapability.Test.UiTest + * @atomicservice + * @since 11 + * @test + */ + inputText(p: Point, text: string): Promise; +} +/** + * @syscap SystemCapability.Test.UiTest + * @since 9 + * @test + */ +/** + * Represents a window of the ohos application,user can perform operations or query attributes on it. + * + * @syscap SystemCapability.Test.UiTest + * @atomicservice + * @since 11 + * @test + */ +declare class UiWindow { + /** + * Get the bundle name of this {@link UiWindow}. + * + * @returns { Promise } the bundle name. + * @throws { BusinessError } 17000002 - if the async function was not called with await. + * @throws { BusinessError } 17000004 - if the window is invisible or destroyed. + * @syscap SystemCapability.Test.UiTest + * @since 9 + * @test + */ + /** + * Get the bundle name of this {@link UiWindow}. + * + * @returns { Promise } the bundle name. + * @throws { BusinessError } 17000002 - if the async function was not called with await. + * @throws { BusinessError } 17000004 - if the window is invisible or destroyed. + * @syscap SystemCapability.Test.UiTest + * @atomicservice + * @since 11 + * @test + */ + getBundleName(): Promise; + /** + * Get the bounds rect of this {@link UiWindow}. + * + * @returns { Promise } the bounds rect object. + * @throws { BusinessError } 17000002 - if the async function was not called with await. + * @throws { BusinessError } 17000004 - if the window is invisible or destroyed. + * @syscap SystemCapability.Test.UiTest + * @since 9 + * @test + */ + /** + * Get the bounds rect of this {@link UiWindow}. + * + * @returns { Promise } the bounds rect object. + * @throws { BusinessError } 17000002 - if the async function was not called with await. + * @throws { BusinessError } 17000004 - if the window is invisible or destroyed. + * @syscap SystemCapability.Test.UiTest + * @crossplatform + * @atomicservice + * @since 11 + * @test + */ + getBounds(): Promise; + /** + * Get the title of this {@link UiWindow}. + * + * @returns { Promise } the title value. + * @throws { BusinessError } 17000002 - if the async function was not called with await. + * @throws { BusinessError } 17000004 - if the window is invisible or destroyed. + * @syscap SystemCapability.Test.UiTest + * @since 9 + * @test + */ + /** + * Get the title of this {@link UiWindow}. + * + * @returns { Promise } the title value. + * @throws { BusinessError } 17000002 - if the async function was not called with await. + * @throws { BusinessError } 17000004 - if the window is invisible or destroyed. + * @syscap SystemCapability.Test.UiTest + * @atomicservice + * @since 11 + * @test + */ + getTitle(): Promise; + /** + * Get the window mode of this {@link UiWindow}. + * + * @returns { Promise } the {@link WindowMode} object + * @throws { BusinessError } 17000002 - if the async function was not called with await. + * @throws { BusinessError } 17000004 - if the window is invisible or destroyed. + * @syscap SystemCapability.Test.UiTest + * @since 9 + * @test + */ + /** + * Get the window mode of this {@link UiWindow}. + * + * @returns { Promise } the {@link WindowMode} object + * @throws { BusinessError } 17000002 - if the async function was not called with await. + * @throws { BusinessError } 17000004 - if the window is invisible or destroyed. + * @syscap SystemCapability.Test.UiTest + * @atomicservice + * @since 11 + * @test + */ + getWindowMode(): Promise; + /** + * Get the focused status of this {@link UiWindow}. + * + * @returns { Promise } the focused status + * @throws { BusinessError } 17000002 - if the async function was not called with await. + * @throws { BusinessError } 17000004 - if the window is invisible or destroyed. + * @syscap SystemCapability.Test.UiTest + * @since 9 + * @test + */ + /** + * Get the focused status of this {@link UiWindow}. + * + * @returns { Promise } the focused status + * @throws { BusinessError } 17000002 - if the async function was not called with await. + * @throws { BusinessError } 17000004 - if the window is invisible or destroyed. + * @syscap SystemCapability.Test.UiTest + * @atomicservice + * @since 11 + * @test + */ + isFocused(): Promise; + /** + * Get the active status of this {@link UiWindow}. + * + * @returns { Promise } the actived status + * @throws { BusinessError } 17000002 - if the async function was not called with await. + * @throws { BusinessError } 17000004 - if the window is invisible or destroyed. + * @syscap SystemCapability.Test.UiTest + * @since 9 + * @test + */ + /** + * Get the active status of this {@link UiWindow}. + * + * @returns { Promise } the actived status + * @throws { BusinessError } 17000002 - if the async function was not called with await. + * @throws { BusinessError } 17000004 - if the window is invisible or destroyed. + * @syscap SystemCapability.Test.UiTest + * @since 11 + * @deprecated since 11 + * @useinstead ohos.UiTest.UiWindow#isActive + * @test + */ + isActived(): Promise; + /** + * Set the focused status of this {@link UiWindow}. + * + * @returns { Promise } + * @throws { BusinessError } 17000002 - if the async function was not called with await. + * @throws { BusinessError } 17000004 - if the window is invisible or destroyed. + * @syscap SystemCapability.Test.UiTest + * @since 9 + * @test + */ + /** + * Set the focused status of this {@link UiWindow}. + * + * @returns { Promise } + * @throws { BusinessError } 17000002 - if the async function was not called with await. + * @throws { BusinessError } 17000004 - if the window is invisible or destroyed. + * @syscap SystemCapability.Test.UiTest + * @atomicservice + * @since 11 + * @test + */ + focus(): Promise; + /** + * Move this {@link UiWindow} to the specified points. + * + * @param { number } x The x coordinate of destination. + * @param { number } y The y coordinate of destination. + * @returns { Promise } + * @throws { BusinessError } 401 - if the input parameters are invalid. + * @throws { BusinessError } 17000002 - if the async function was not called with await. + * @throws { BusinessError } 17000004 - if the window is invisible or destroyed. + * @throws { BusinessError } 17000005 - if the action is not supported on this window. + * @syscap SystemCapability.Test.UiTest + * @since 9 + * @test + */ + /** + * Move this {@link UiWindow} to the specified points. + * + * @param { number } x - the x coordinate of destination, not less than 0. + * @param { number } y - the y coordinate of destination, not less than 0. + * @returns { Promise } + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. + * @throws { BusinessError } 17000002 - if the async function was not called with await. + * @throws { BusinessError } 17000004 - if the window is invisible or destroyed. + * @throws { BusinessError } 17000005 - if the action is not supported on this window. + * @syscap SystemCapability.Test.UiTest + * @atomicservice + * @since 11 + * @test + */ + moveTo(x: number, y: number): Promise; + /** + * Resize this {@link UiWindow} to the specified size for the specified direction. + * + * @param { number } wide The expected wide of the window after resizing. + * @param { number } height The expected height of the window after resizing. + * @param { ResizeDirection } direction The expected direction of the window after resizing. + * @returns { Promise } + * @throws { BusinessError } 401 - if the input parameters are invalid. + * @throws { BusinessError } 17000002 - if the async function was not called with await. + * @throws { BusinessError } 17000004 - if the window is invisible or destroyed. + * @throws { BusinessError } 17000005 - if the action is not supported on this window. + * @syscap SystemCapability.Test.UiTest + * @since 9 + * @test + */ + /** + * Resize this {@link UiWindow} to the specified size for the specified direction. + * + * @param { number } wide - the expected wide of the window after resizing. + * @param { number } height - the expected height of the window after resizing. + * @param { ResizeDirection } direction - the expected direction of the window after resizing. + * @returns { Promise } + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. + * @throws { BusinessError } 17000002 - if the async function was not called with await. + * @throws { BusinessError } 17000004 - if the window is invisible or destroyed. + * @throws { BusinessError } 17000005 - if the action is not supported on this window. + * @syscap SystemCapability.Test.UiTest + * @atomicservice + * @since 11 + * @test + */ + resize(wide: number, height: number, direction: ResizeDirection): Promise; + /** + * Change this {@link UiWindow} into split screen mode. + * + * @returns { Promise } + * @throws { BusinessError } 17000002 - if the async function was not called with await. + * @throws { BusinessError } 17000004 - if the window is invisible or destroyed. + * @throws { BusinessError } 17000005 - if the action is not supported on this window. + * @syscap SystemCapability.Test.UiTest + * @since 9 + * @test + */ + /** + * Change this {@link UiWindow} into split screen mode. + * + * @returns { Promise } + * @throws { BusinessError } 17000002 - if the async function was not called with await. + * @throws { BusinessError } 17000004 - if the window is invisible or destroyed. + * @throws { BusinessError } 17000005 - if the action is not supported on this window. + * @syscap SystemCapability.Test.UiTest + * @atomicservice + * @since 11 + * @test + */ + split(): Promise; + /** + * Maximize this {@link UiWindow}. + * + * @returns { Promise } + * @throws { BusinessError } 17000002 - if the async function was not called with await. + * @throws { BusinessError } 17000004 - if the window is invisible or destroyed. + * @throws { BusinessError } 17000005 - if the action is not supported on this window. + * @syscap SystemCapability.Test.UiTest + * @since 9 + * @test + */ + /** + * Maximize this {@link UiWindow}. + * + * @returns { Promise } + * @throws { BusinessError } 17000002 - if the async function was not called with await. + * @throws { BusinessError } 17000004 - if the window is invisible or destroyed. + * @throws { BusinessError } 17000005 - if the action is not supported on this window. + * @syscap SystemCapability.Test.UiTest + * @atomicservice + * @since 11 + * @test + */ + maximize(): Promise; + /** + * Minimize this {@link UiWindow}. + * + * @returns { Promise } + * @throws { BusinessError } 17000002 - if the async function was not called with await. + * @throws { BusinessError } 17000004 - if the window is invisible or destroyed. + * @throws { BusinessError } 17000005 - if the action is not supported on this window. + * @syscap SystemCapability.Test.UiTest + * @since 9 + * @test + */ + /** + * Minimize this {@link UiWindow}. + * + * @returns { Promise } + * @throws { BusinessError } 17000002 - if the async function was not called with await. + * @throws { BusinessError } 17000004 - if the window is invisible or destroyed. + * @throws { BusinessError } 17000005 - if the action is not supported on this window. + * @syscap SystemCapability.Test.UiTest + * @atomicservice + * @since 11 + * @test + */ + minimize(): Promise; + /** + * Resume this {@link UiWindow}. + * + * @returns { Promise } + * @throws { BusinessError } 17000002 - if the async function was not called with await. + * @throws { BusinessError } 17000004 - if the window is invisible or destroyed. + * @throws { BusinessError } 17000005 - if the action is not supported on this window. + * @syscap SystemCapability.Test.UiTest + * @since 9 + * @test + */ + /** + * Resume this {@link UiWindow}. + * + * @returns { Promise } + * @throws { BusinessError } 17000002 - if the async function was not called with await. + * @throws { BusinessError } 17000004 - if the window is invisible or destroyed. + * @throws { BusinessError } 17000005 - if the action is not supported on this window. + * @syscap SystemCapability.Test.UiTest + * @atomicservice + * @since 11 + * @test + */ + resume(): Promise; + /** + * Close this {@link UiWindow}. + * + * @returns { Promise } + * @throws { BusinessError } 17000002 - if the async function was not called with await. + * @throws { BusinessError } 17000004 - if the window is invisible or destroyed. + * @throws { BusinessError } 17000005 - if the action is not supported on this window. + * @syscap SystemCapability.Test.UiTest + * @since 9 + * @test + */ + /** + * Close this {@link UiWindow}. + * + * @returns { Promise } + * @throws { BusinessError } 17000002 - if the async function was not called with await. + * @throws { BusinessError } 17000004 - if the window is invisible or destroyed. + * @throws { BusinessError } 17000005 - if the action is not supported on this window. + * @syscap SystemCapability.Test.UiTest + * @atomicservice + * @since 11 + * @test + */ + close(): Promise; + /** + * Get the active status of this {@link UiWindow}. + * + * @returns { Promise } the active status. + * @throws { BusinessError } 17000002 - if the async function was not called with await. + * @throws { BusinessError } 17000004 - if the window is invisible or destroyed. + * @syscap SystemCapability.Test.UiTest + * @atomicservice + * @since 11 + * @test + */ + isActive(): Promise; +} +/** + * Represents a two-dimensional array of pointers on the device display, it's used to build a + * multi-finger trace which can be injected with UiDriver. + * + * @syscap SystemCapability.Test.UiTest + * @since 9 + * @test + */ +/** + * Represents a two-dimensional array of pointers on the device display, it's used to build a + * multi-finger trace which can be injected with UiDriver. + * + * @syscap SystemCapability.Test.UiTest + * @crossplatform + * @atomicservice + * @since 11 + * @test + */ +declare class PointerMatrix { + /** + * Create an {@link PointerMatrix} object. + * + * @param { number } fingers The number of fingers. + * @param { number } steps The number of steps of each finger trace. + * @returns { PointerMatrix } the {@link PointerMatrix} object. + * @throws { BusinessError } 401 - if the input parameters are invalid. + * @syscap SystemCapability.Test.UiTest + * @since 9 + * @test + */ + /** + * Create an {@link PointerMatrix} object. + * + * @param { number } fingers - The number of fingers, ranges from 1 to 10. + * @param { number } steps - The number of steps of each finger trace, ranges from 1 to 1000. + * @returns { PointerMatrix } the {@link PointerMatrix} object. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. + * @syscap SystemCapability.Test.UiTest + * @crossplatform + * @atomicservice + * @since 11 + * @test + */ + static create(fingers: number, steps: number): PointerMatrix; + /** + * Set the point value of an element in the PointerMatrix. + * + * @param { number } finger The index of target finger to set. + * @param { number } step The index of target step to set. + * @param { Point } point The coordinate of target step to set. + * @throws { BusinessError } 401 - if the input parameters are invalid. + * @syscap SystemCapability.Test.UiTest + * @since 9 + * @test + */ + /** + * Set the point value of an element in the PointerMatrix. + * + * @param { number } finger - the index of target finger to set. + * @param { number } step - the index of target step to set. + * @param { Point } point - the coordinate of target step to set. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. + * @syscap SystemCapability.Test.UiTest + * @crossplatform + * @atomicservice + * @since 11 + * @test + */ + setPoint(finger: number, step: number, point: Point): void; +} +/** + * The static builder for building {@link By}object conveniently,usage example:BY.text('txt').enabled(true). + * + * @syscap SystemCapability.Test.UiTest + * @since 8 + * @deprecated since 9 + * @useinstead ohos.uitest.ON + * @test + */ +declare const BY: By; +/** + * The static builder for building {@link On}object conveniently,usage example:ON.text('txt').enabled(true). + * + * @syscap SystemCapability.Test.UiTest + * @since 9 + * @test + */ +/** + * The static builder for building {@link On}object conveniently,usage example:ON.text('txt').enabled(true). + * + * @syscap SystemCapability.Test.UiTest + * @crossplatform + * @atomicservice + * @since 11 + * @test + */ +declare const ON: On; +export { UiComponent, UiDriver, Component, Driver, UiWindow, ON, On, BY, By, MatchPattern, DisplayRotation, ResizeDirection, WindowMode, Point, WindowFilter, Rect, PointerMatrix, UiDirection, MouseButton, UIElementInfo, UIEventObserver }; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.WorkSchedulerExtensionAbility.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.WorkSchedulerExtensionAbility.d.ts new file mode 100755 index 00000000..efd76bf1 --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.WorkSchedulerExtensionAbility.d.ts @@ -0,0 +1,64 @@ +/* + * Copyright (c) 2022-2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit BackgroundTasksKit + */ +import workScheduler from './@ohos.resourceschedule.workScheduler'; +import _WorkSchedulerExtensionContext from './application/WorkSchedulerExtensionContext'; +/** + * The context of work scheduler extension. It allows access to + * WorkSchedulerExtensionContext-specific resources. + * + * @syscap SystemCapability.ResourceSchedule.WorkScheduler + * @StageModelOnly + * @since 10 + */ +export type WorkSchedulerExtensionContext = _WorkSchedulerExtensionContext; +/** + * Class of the work scheduler extension ability. + * + * @syscap SystemCapability.ResourceSchedule.WorkScheduler + * @StageModelOnly + * @since 9 + */ +export default class WorkSchedulerExtensionAbility { + /** + * Indicates work scheduler extension ability context. + * + * @syscap SystemCapability.ResourceSchedule.WorkScheduler + * @StageModelOnly + * @since 10 + */ + context: WorkSchedulerExtensionContext; + /** + * Called back when a work is started. + * + * @param {workScheduler.WorkInfo} work - The info of work. + * @syscap SystemCapability.ResourceSchedule.WorkScheduler + * @StageModelOnly + * @since 9 + */ + onWorkStart(work: workScheduler.WorkInfo): void; + /** + * Called back when a work is stopped. + * + * @param {workScheduler.WorkInfo} work - The info of work. + * @syscap SystemCapability.ResourceSchedule.WorkScheduler + * @StageModelOnly + * @since 9 + */ + onWorkStop(work: workScheduler.WorkInfo): void; +} diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.ability.ability.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.ability.ability.d.ts new file mode 100755 index 00000000..eb119a1d --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.ability.ability.d.ts @@ -0,0 +1,113 @@ +/* + * Copyright (c) 2022-2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit AbilityKit + */ +import { DataAbilityHelper as _DataAbilityHelper } from './ability/dataAbilityHelper'; +import { PacMap as _PacMap } from './ability/dataAbilityHelper'; +import { DataAbilityOperation as _DataAbilityOperation } from './ability/dataAbilityOperation'; +import { DataAbilityResult as _DataAbilityResult } from './ability/dataAbilityResult'; +import { AbilityResult as _AbilityResult } from './ability/abilityResult'; +import { ConnectOptions as _ConnectOptions } from './ability/connectOptions'; +import { StartAbilityParameter as _StartAbilityParameter } from './ability/startAbilityParameter'; +/** + * The class of an ability. + * + * @namespace ability + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @FAModelOnly + * @since 9 + */ +/** + * The class of an ability. + * + * @namespace ability + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @since 11 + */ +declare namespace ability { + /** + * DataAbilityHelper + * + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @FAModelOnly + * @since 9 + */ + export type DataAbilityHelper = _DataAbilityHelper; + /** + * Defines a PacMap object for storing a series of values. + * + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @FAModelOnly + * @since 9 + */ + /** + * Defines a PacMap object for storing a series of values. + * + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @since 11 + */ + export type PacMap = _PacMap; + /** + * DataAbilityOperation secondary module.Define the DataAbility data operation method, + * which can be used as an input parameter for [executeBatch] to manipulate database information. + * + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @FAModelOnly + * @since 9 + */ + export type DataAbilityOperation = _DataAbilityOperation; + /** + * DataAbilityResult secondary module.Define the DataAbility data operation result. + * When operating the database through [executeBatch], the operation result is returned + * using the DataAbility Result object. + * + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @FAModelOnly + * @since 9 + */ + export type DataAbilityResult = _DataAbilityResult; + /** + * AbilityResult secondary module.The result code and data returned after the ability is pulled + * up and exited can be defined. The ability result object returned after the ability is pulled + * up and exited can be obtained through [startAbilityForResult], and the ability object pulled up + * by startAbilityForResult can be returned through [terminateSelfWithResult]. + * + * @syscap SystemCapability.Ability.AbilityBase + * @FAModelOnly + * @since 9 + */ + export type AbilityResult = _AbilityResult; + /** + * ConnectOptions secondary module.As an input parameter when connecting to a specified backend service, + * used to receive state changes during the connection process + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @FAModelOnly + * @since 9 + */ + export type ConnectOptions = _ConnectOptions; + /** + * StartAbilityParameter secondary module.Define the Start Ability parameter, which can be used as + * an input parameter to call [startAbility] to start the specified Ability. + * + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @FAModelOnly + * @since 9 + */ + export type StartAbilityParameter = _StartAbilityParameter; +} +export default ability; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.ability.dataUriUtils.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.ability.dataUriUtils.d.ts new file mode 100755 index 00000000..04618eb2 --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.ability.dataUriUtils.d.ts @@ -0,0 +1,76 @@ +/* + * Copyright (c) 2021-2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit AbilityKit + */ +/** + * A utility class used for handling objects that use the DataAbilityHelper scheme. + * + * @namespace dataUriUtils + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.app.ability.dataUriUtils/dataUriUtils + */ +declare namespace dataUriUtils { + /** + * Obtains the ID attached to the end of the path component of the given uri. + * + * @param { string } uri - Indicates the uri object from which the ID is to be obtained. + * @returns { number } Returns the ID attached to the end of the path component; + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.app.ability.dataUriUtils/dataUriUtils#getId + */ + function getId(uri: string): number; + /** + * Attaches the given ID to the end of the path component of the given uri. + * + * @param { string } uri - Indicates the uri string from which the ID is to be obtained. + * @param { number } id - Indicates the ID to attach. + * @returns { string } Returns the uri object with the given ID attached. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.app.ability.dataUriUtils/dataUriUtils#attachId + */ + function attachId(uri: string, id: number): string; + /** + * Deletes the ID from the end of the path component of the given uri. + * + * @param { string } uri - Indicates the uri object from which the ID is to be deleted. + * @returns { string } Returns the uri object with the ID deleted. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.app.ability.dataUriUtils/dataUriUtils#deleteId + */ + function deleteId(uri: string): string; + /** + * Updates the ID in the specified uri + * + * @param { string } uri - Indicates the uri object to be updated. + * @param { number } id - Indicates the new ID. + * @returns { string } Returns the updated uri object. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.app.ability.dataUriUtils/dataUriUtils#updateId + */ + function updateId(uri: string, id: number): string; +} +export default dataUriUtils; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.ability.errorCode.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.ability.errorCode.d.ts new file mode 100755 index 00000000..2347a7d9 --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.ability.errorCode.d.ts @@ -0,0 +1,55 @@ +/* + * Copyright (c) 2022-2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit AbilityKit + */ +/** + * Defines error codes used when starting an ability, for example, featureAbility.ErrorCode.NO_ERROR. + * + * @enum { number } + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 6 + */ +export enum ErrorCode { + /** + * Permission denied. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 6 + */ + PERMISSION_DENY = -3, + /** + * Ability not found. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 6 + */ + ABILITY_NOT_FOUND = -2, + /** + * Invalid parameter. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 6 + */ + INVALID_PARAMETER = -1, + /** + * No error. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 6 + */ + NO_ERROR = 0 +} diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.ability.featureAbility.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.ability.featureAbility.d.ts new file mode 100755 index 00000000..abc469f2 --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.ability.featureAbility.d.ts @@ -0,0 +1,420 @@ +/* + * Copyright (c) 2021-2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit AbilityKit + */ +import { AsyncCallback } from './@ohos.base'; +import Want from './@ohos.app.ability.Want'; +import { StartAbilityParameter } from './ability/startAbilityParameter'; +import { AbilityResult } from './ability/abilityResult'; +import { AppVersionInfo as _AppVersionInfo } from './app/appVersionInfo'; +import { Context as _Context } from './app/context'; +import { DataAbilityHelper } from './ability/dataAbilityHelper'; +import { ConnectOptions } from './ability/connectOptions'; +import { ProcessInfo as _ProcessInfo } from './app/processInfo'; +import window from './@ohos.window'; +/** + * A Feature Ability represents an ability with a UI and is designed to interact with users. + * + * @namespace featureAbility + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @FAModelOnly + * @since 6 + */ +declare namespace featureAbility { + /** + * Obtain the want sent from the source ability. + * + * @param { AsyncCallback } callback - Indicates the ability to start. + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @FAModelOnly + * @since 6 + */ + function getWant(callback: AsyncCallback): void; + /** + * Obtain the want sent from the source ability. + * + * @returns { Promise } The promise form returns the Want result + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @FAModelOnly + * @since 6 + */ + function getWant(): Promise; + /** + * Starts a new ability. + * + * @param { StartAbilityParameter } parameter - Indicates the ability to start. + * @param { AsyncCallback } callback - Returns the result of starting Ability in the form of callback. + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @FAModelOnly + * @since 6 + */ + function startAbility(parameter: StartAbilityParameter, callback: AsyncCallback): void; + /** + * Starts a new ability. + * + * @param { StartAbilityParameter } parameter - Indicates the ability to start. + * @returns { Promise } The promise form returns the Ability result + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @FAModelOnly + * @since 6 + */ + function startAbility(parameter: StartAbilityParameter): Promise; + /** + * Obtains the application context. + * + * @returns { Context } Returns the application context. + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @FAModelOnly + * @since 6 + */ + function getContext(): Context; + /** + * Starts an ability and returns the execution result when the ability is destroyed. + * + * @param { StartAbilityParameter } parameter - Indicates the ability to start. + * @param { AsyncCallback } callback - Returns the result of starting Ability in the form of callback. + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @FAModelOnly + * @since 7 + */ + function startAbilityForResult(parameter: StartAbilityParameter, callback: AsyncCallback): void; + /** + * Starts an ability and returns the execution result when the ability is destroyed. + * + * @param { StartAbilityParameter } parameter - Indicates the ability to start. + * @returns { Promise } Returns the {@link AbilityResult}. + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @FAModelOnly + * @since 7 + */ + function startAbilityForResult(parameter: StartAbilityParameter): Promise; + /** + * Destroys the Page ability while returning the specified result code and data to the caller. + * + * @param { AbilityResult } parameter - Indicates the result to return. + * @param { AsyncCallback } callback - Return the result of stopping Ability in the form of callback. + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @FAModelOnly + * @since 7 + */ + function terminateSelfWithResult(parameter: AbilityResult, callback: AsyncCallback): void; + /** + * Destroys the Page ability while returning the specified result code and data to the caller. + * + * @param { AbilityResult } parameter - Indicates the result to return. + * @returns { Promise } the promise returned by the function. + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @FAModelOnly + * @since 7 + */ + function terminateSelfWithResult(parameter: AbilityResult): Promise; + /** + * Destroys this Page ability. + * + * @param { AsyncCallback } callback - Returns the stop ability result in the form of a callback. + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @FAModelOnly + * @since 7 + */ + function terminateSelf(callback: AsyncCallback): void; + /** + * Destroys this Page ability. + * + * @returns { Promise } the promise returned by the function. + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @FAModelOnly + * @since 7 + */ + function terminateSelf(): Promise; + /** + * Obtains the dataAbilityHelper. + * + * @param { string } uri - Indicates the path of the file to open. + * @returns { DataAbilityHelper } Returns the dataAbilityHelper. + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @FAModelOnly + * @since 7 + */ + function acquireDataAbilityHelper(uri: string): DataAbilityHelper; + /** + * Checks whether the main window of this ability has window focus. + * + * @param { AsyncCallback } callback - Returns the result in the form of callback.If this ability currently + * has window focus,return true otherwise,return false. + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @FAModelOnly + * @since 7 + */ + function hasWindowFocus(callback: AsyncCallback): void; + /** + * Checks whether the main window of this ability has window focus. + * + * @returns { Promise } Returns {@code true} if this ability currently has window focus; + * returns {@code false} otherwise. + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @FAModelOnly + * @since 7 + */ + function hasWindowFocus(): Promise; + /** + * Connects the current ability to an ability using the AbilityInfo.AbilityType.SERVICE template. + * + * @param { Want } request - The element name of the service ability + * @param { ConnectOptions } options - The remote object instance + * @returns { number } Returns the number code of the ability connected + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @FAModelOnly + * @since 7 + */ + function connectAbility(request: Want, options: ConnectOptions): number; + /** + * Disconnects ability to a Service ability. + * + * @param { number } connection - The number code of the ability connected + * @param { AsyncCallback } callback - Returns the disconnection result in the form of callback. + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @FAModelOnly + * @since 7 + */ + function disconnectAbility(connection: number, callback: AsyncCallback): void; + /** + * Disconnects ability to a Service ability. + * + * @param { number } connection - The number code of the ability connected + * @returns { Promise } the promise returned by the function. + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @FAModelOnly + * @since 7 + */ + function disconnectAbility(connection: number): Promise; + /** + * Obtains the window corresponding to the current ability. + * + * @param { AsyncCallback } callback - Returns the window corresponding to the current ability + * in the form of callback. + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @FAModelOnly + * @since 7 + */ + function getWindow(callback: AsyncCallback): void; + /** + * Obtains the window corresponding to the current ability. + * + * @returns { Promise } Returns the window corresponding to the current ability. + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @FAModelOnly + * @since 7 + */ + function getWindow(): Promise; + /** + * Enum for the window configuration. + * + * @enum { number } + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @FAModelOnly + * @since 7 + */ + export enum AbilityWindowConfiguration { + /** + * Undefined window format. + * + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @FAModelOnly + * @since 7 + */ + WINDOW_MODE_UNDEFINED = 0, + /** + * Full screen. + * + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @FAModelOnly + * @since 7 + */ + WINDOW_MODE_FULLSCREEN = 1, + /** + * If the screen is horizontally oriented, it indicates left split, and if the screen is vertically oriented, + * it indicates upper split. + * + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @FAModelOnly + * @since 7 + */ + WINDOW_MODE_SPLIT_PRIMARY = 100, + /** + * If the screen is horizontally oriented, it indicates right split, and if the screen is vertically oriented, + * it indicates bottom split. + * + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @FAModelOnly + * @since 7 + */ + WINDOW_MODE_SPLIT_SECONDARY = 101, + /** + * Suspended window. + * + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @FAModelOnly + * @since 7 + */ + WINDOW_MODE_FLOATING = 102 + } + /** + * Enum for the special start setting used in starting ability. + * + * @enum { string } + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @FAModelOnly + * @since 7 + */ + export enum AbilityStartSetting { + /** + * The parameter name for the window display size attribute. + * + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @FAModelOnly + * @since 7 + */ + BOUNDS_KEY = 'abilityBounds', + /** + * The parameter name of the window display mode attribute. + * + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @FAModelOnly + * @since 7 + */ + WINDOW_MODE_KEY = 'windowMode', + /** + * The window displays the parameter name of the device ID attribute. + * + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @FAModelOnly + * @since 7 + */ + DISPLAY_ID_KEY = 'displayId' + } + /** + * Enum for the error code. + * + * @enum { number } + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @FAModelOnly + * @since 7 + */ + export enum ErrorCode { + /** + * There are no errors. + * + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @FAModelOnly + * @since 7 + */ + NO_ERROR = 0, + /** + * Invalid parameter. + * + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @FAModelOnly + * @since 7 + */ + INVALID_PARAMETER = -1, + /** + * Unable to find ABILITY. + * + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @FAModelOnly + * @since 7 + */ + ABILITY_NOT_FOUND = -2, + /** + * Permission denied. + * + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @FAModelOnly + * @since 7 + */ + PERMISSION_DENY = -3 + } + /** + * Enum for the operation type of data. + * + * @enum { number } + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @FAModelOnly + * @since 7 + */ + export enum DataAbilityOperationType { + /** + * Insert type. + * + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @FAModelOnly + * @since 7 + */ + TYPE_INSERT = 1, + /** + * Modify the type. + * + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @FAModelOnly + * @since 7 + */ + TYPE_UPDATE = 2, + /** + * Delete type. + * + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @FAModelOnly + * @since 7 + */ + TYPE_DELETE = 3, + /** + * Declaration type. + * + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @FAModelOnly + * @since 7 + */ + TYPE_ASSERT = 4 + } + /** + * The context of an ability or an application. It allows access to + * application-specific resources, request and verification permissions. + * Can only be obtained through the ability. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @FAModelOnly + * @since 9 + */ + export type Context = _Context; + /** + * Defines an AppVersionInfo object. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @FAModelOnly + * @since 9 + */ + export type AppVersionInfo = _AppVersionInfo; + /** + * This process information about an application. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @FAModelOnly + * @since 9 + */ + export type ProcessInfo = _ProcessInfo; +} +export default featureAbility; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.ability.particleAbility.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.ability.particleAbility.d.ts new file mode 100755 index 00000000..67e1acce --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.ability.particleAbility.d.ts @@ -0,0 +1,185 @@ +/* + * Copyright (c) 2021-2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit AbilityKit + */ +import { AsyncCallback } from './@ohos.base'; +import { StartAbilityParameter } from './ability/startAbilityParameter'; +import { DataAbilityHelper } from './ability/dataAbilityHelper'; +import { NotificationRequest } from './notification/notificationRequest'; +import { ConnectOptions } from './ability/connectOptions'; +import Want from './@ohos.app.ability.Want'; +/** + * A Particle Ability represents an ability with service. + * + * @namespace particleAbility + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @FAModelOnly + * @since 7 + */ +declare namespace particleAbility { + /** + * Service ability uses this method to start a specific ability. + * + * @param { StartAbilityParameter } parameter - Indicates the ability to start. + * @param { AsyncCallback } callback - Returns the result of starting Ability in the form of callback. + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @FAModelOnly + * @since 7 + */ + function startAbility(parameter: StartAbilityParameter, callback: AsyncCallback): void; + /** + * Service ability uses this method to start a specific ability. + * + * @param { StartAbilityParameter } parameter - Indicates the ability to start. + * @returns { Promise } the promise returned by the function. + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @FAModelOnly + * @since 7 + */ + function startAbility(parameter: StartAbilityParameter): Promise; + /** + * Destroys this service ability. + * + * @param { AsyncCallback } callback - Return the result of stopping Ability in the form of callback. + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @FAModelOnly + * @since 7 + */ + function terminateSelf(callback: AsyncCallback): void; + /** + * Destroys this service ability. + * + * @returns { Promise } the promise returned by the function. + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @FAModelOnly + * @since 7 + */ + function terminateSelf(): Promise; + /** + * Obtains the dataAbilityHelper. + * + * @param { string } uri - Indicates the path of the file to open. + * @returns { DataAbilityHelper } Returns the dataAbilityHelper. + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @FAModelOnly + * @since 7 + */ + function acquireDataAbilityHelper(uri: string): DataAbilityHelper; + /** + * Keep this Service ability in the background and display a notification bar. + * + * @permission ohos.permission.KEEP_BACKGROUND_RUNNING + * @param { number } id - Identifies the notification bar information. + * @param { NotificationRequest } request - Indicates the notificationRequest instance containing information + * for displaying a notification bar. + * @param { AsyncCallback } callback - returns the result of starting a long-term task in the form of callback. + * @syscap SystemCapability.ResourceSchedule.BackgroundTaskManager.ContinuousTask + * @FAModelOnly + * @since 7 + * @deprecated since 9 + * @useinstead ohos.resourceschedule.backgroundTaskManager/backgroundTaskManager#startBackgroundRunning + */ + function startBackgroundRunning(id: number, request: NotificationRequest, callback: AsyncCallback): void; + /** + * Keep this Service ability in the background and display a notification bar. + * + * @permission ohos.permission.KEEP_BACKGROUND_RUNNING + * @param { number } id - Identifies the notification bar information. + * @param { NotificationRequest } request - Indicates the notificationRequest instance containing information + * for displaying a notification bar. + * @returns { Promise } the promise returned by the function. + * @syscap SystemCapability.ResourceSchedule.BackgroundTaskManager.ContinuousTask + * @FAModelOnly + * @since 7 + * @deprecated since 9 + * @useinstead ohos.resourceschedule.backgroundTaskManager/backgroundTaskManager#startBackgroundRunning + */ + function startBackgroundRunning(id: number, request: NotificationRequest): Promise; + /** + * Cancel background running of this ability to free up system memory. + * + * @param { AsyncCallback } callback - Returns the result of canceling a long-term task in the form of callback. + * @syscap SystemCapability.ResourceSchedule.BackgroundTaskManager.ContinuousTask + * @FAModelOnly + * @since 7 + * @deprecated since 9 + * @useinstead ohos.resourceschedule.backgroundTaskManager/backgroundTaskManager#stopBackgroundRunning + */ + function cancelBackgroundRunning(callback: AsyncCallback): void; + /** + * Cancel background running of this ability to free up system memory. + * + * @returns { Promise } the promise returned by the function. + * @syscap SystemCapability.ResourceSchedule.BackgroundTaskManager.ContinuousTask + * @FAModelOnly + * @since 7 + * @deprecated since 9 + * @useinstead ohos.resourceschedule.backgroundTaskManager/backgroundTaskManager#stopBackgroundRunning + */ + function cancelBackgroundRunning(): Promise; + /** + * Connects an ability to a Service ability. + * + * @param { Want } request - Indicates the Service ability to connect. + * @param { ConnectOptions } options - Callback object for the client. If this parameter is null, + * an exception is thrown. + * @returns { number } unique identifier of the connection between the client and the service side. + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @FAModelOnly + * @since 7 + */ + function connectAbility(request: Want, options: ConnectOptions): number; + /** + * Disconnects ability to a Service ability. + * + * @param { number } connection - the connection id returned from connectAbility api. + * @param { AsyncCallback } callback - Returns the disconnection result in the form of callback. + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @FAModelOnly + * @since 7 + */ + function disconnectAbility(connection: number, callback: AsyncCallback): void; + /** + * Disconnects ability to a Service ability. + * + * @param { number } connection - the connection id returned from connectAbility api. + * @returns { Promise } the promise returned by the function. + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @FAModelOnly + * @since 7 + */ + function disconnectAbility(connection: number): Promise; + /** + * Obtain the errorCode. + * + * @enum { number } + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @FAModelOnly + * @since 7 + */ + export enum ErrorCode { + /** + * Invalid parameter. + * + * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @FAModelOnly + * @since 7 + */ + INVALID_PARAMETER = -1 + } +} +export default particleAbility; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.ability.wantConstant.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.ability.wantConstant.d.ts new file mode 100755 index 00000000..bd431eb6 --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.ability.wantConstant.d.ts @@ -0,0 +1,423 @@ +/* + * Copyright (c) 2021-2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"), + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit AbilityKit + */ +/** + * the constant for action and entity in the want + * + * @namespace wantConstant + * @syscap SystemCapability.Ability.AbilityBase + * @since 6 + * @deprecated since 9 + * @useinstead ohos.app.ability.wantConstant/wantConstant + */ +declare namespace wantConstant { + /** + * the constant for action of the want + * + * @enum { string } + * @syscap SystemCapability.Ability.AbilityBase + * @since 6 + * @deprecated since 9 + */ + export enum Action { + /** + * Indicates the action of backing home. + * + * @syscap SystemCapability.Ability.AbilityBase + * @since 6 + * @deprecated since 9 + */ + ACTION_HOME = 'ohos.want.action.home', + /** + * Indicates the action of starting a Page ability that displays a keypad. + * + * @syscap SystemCapability.Ability.AbilityBase + * @since 6 + * @deprecated since 9 + */ + ACTION_DIAL = 'ohos.want.action.dial', + /** + * Indicates the action of starting a Page ability for search. + * + * @syscap SystemCapability.Ability.AbilityBase + * @since 6 + * @deprecated since 9 + */ + ACTION_SEARCH = 'ohos.want.action.search', + /** + * Indicates the action of starting a Page ability that provides wireless network settings, for example, + * Wi-Fi options. + * + * @syscap SystemCapability.Ability.AbilityBase + * @since 6 + * @deprecated since 9 + */ + ACTION_WIRELESS_SETTINGS = 'ohos.settings.wireless', + /** + * Indicates the action of starting a Page ability that manages installed applications. + * + * @syscap SystemCapability.Ability.AbilityBase + * @since 6 + * @deprecated since 9 + */ + ACTION_MANAGE_APPLICATIONS_SETTINGS = 'ohos.settings.manage.applications', + /** + * Indicates the action of starting a Page ability that displays details of a specified application. + *

You must specify the application bundle name in the {@code package} attribute of the {@code Intent} + * containing this action. + * + * @syscap SystemCapability.Ability.AbilityBase + * @since 6 + * @deprecated since 9 + */ + ACTION_APPLICATION_DETAILS_SETTINGS = 'ohos.settings.application.details', + /** + * Indicates the action of starting a Page ability for setting an alarm clock. + * + * @syscap SystemCapability.Ability.AbilityBase + * @since 6 + * @deprecated since 9 + */ + ACTION_SET_ALARM = 'ohos.want.action.setAlarm', + /** + * Indicates the action of starting a Page ability that displays all alarm + * clocks. + * + * @syscap SystemCapability.Ability.AbilityBase + * @since 6 + * @deprecated since 9 + */ + ACTION_SHOW_ALARMS = 'ohos.want.action.showAlarms', + /** + * Indicates the action of starting a Page ability for snoozing an alarm clock. + * + * @syscap SystemCapability.Ability.AbilityBase + * @since 6 + * @deprecated since 9 + */ + ACTION_SNOOZE_ALARM = 'ohos.want.action.snoozeAlarm', + /** + * Indicates the action of starting a Page ability for deleting an alarm clock. + * + * @syscap SystemCapability.Ability.AbilityBase + * @since 6 + * @deprecated since 9 + */ + ACTION_DISMISS_ALARM = 'ohos.want.action.dismissAlarm', + /** + * Indicates the action of starting a Page ability for dismissing a timer. + * + * @syscap SystemCapability.Ability.AbilityBase + * @since 6 + * @deprecated since 9 + */ + ACTION_DISMISS_TIMER = 'ohos.want.action.dismissTimer', + /** + * Indicates the action of starting a Page ability for sending a sms. + * + * @syscap SystemCapability.Ability.AbilityBase + * @since 6 + * @deprecated since 9 + */ + ACTION_SEND_SMS = 'ohos.want.action.sendSms', + /** + * Indicates the action of starting a Page ability for opening contacts or pictures. + * + * @syscap SystemCapability.Ability.AbilityBase + * @since 6 + * @deprecated since 9 + */ + ACTION_CHOOSE = 'ohos.want.action.choose', + /** + * Indicates the action of starting a Page ability for take a picture. + * + * @syscap SystemCapability.Ability.AbilityBase + * @since 8 + * @deprecated since 9 + */ + ACTION_IMAGE_CAPTURE = 'ohos.want.action.imageCapture', + /** + * Indicates the action of starting a Page ability for Take a video. + * + * @syscap SystemCapability.Ability.AbilityBase + * @since 8 + * @deprecated since 9 + */ + ACTION_VIDEO_CAPTURE = 'ohos.want.action.videoCapture', + /** + * Indicates the action of showing the application selection dialog box. + * + * @syscap SystemCapability.Ability.AbilityBase + * @since 6 + * @deprecated since 9 + */ + ACTION_SELECT = 'ohos.want.action.select', + /** + * Indicates the action of sending a single data record. + * + * @syscap SystemCapability.Ability.AbilityBase + * @since 6 + * @deprecated since 9 + */ + ACTION_SEND_DATA = 'ohos.want.action.sendData', + /** + * Indicates the action of sending multiple data records. + * + * @syscap SystemCapability.Ability.AbilityBase + * @since 6 + * @deprecated since 9 + */ + ACTION_SEND_MULTIPLE_DATA = 'ohos.want.action.sendMultipleData', + /** + * Indicates the action of requesting the media scanner to scan files and adding the files to the media library. + * + * @syscap SystemCapability.Ability.AbilityBase + * @since 6 + * @deprecated since 9 + */ + ACTION_SCAN_MEDIA_FILE = 'ohos.want.action.scanMediaFile', + /** + * Indicates the action of viewing data. + * + * @syscap SystemCapability.Ability.AbilityBase + * @since 6 + * @deprecated since 9 + */ + ACTION_VIEW_DATA = 'ohos.want.action.viewData', + /** + * Indicates the action of editing data. + * + * @syscap SystemCapability.Ability.AbilityBase + * @since 6 + * @deprecated since 9 + */ + ACTION_EDIT_DATA = 'ohos.want.action.editData', + /** + * Indicates the choices you will show with {@link #ACTION_PICKER}. + * + * @syscap SystemCapability.Ability.AbilityBase + * @since 6 + * @deprecated since 9 + */ + INTENT_PARAMS_INTENT = 'ability.want.params.INTENT', + /** + * Indicates the CharSequence dialog title when used with a {@link #ACTION_PICKER}. + * + * @syscap SystemCapability.Ability.AbilityBase + * @since 6 + * @deprecated since 9 + */ + INTENT_PARAMS_TITLE = 'ability.want.params.TITLE', + /** + * Indicates the action of select file. + * + * @syscap SystemCapability.Ability.AbilityBase + * @since 7 + * @deprecated since 9 + */ + ACTION_FILE_SELECT = 'ohos.action.fileSelect', + /** + * Indicates the URI holding a stream of data associated with the Intent when used with a {@link #ACTION_SEND_DATA}. + * + * @syscap SystemCapability.Ability.AbilityBase + * @since 7 + * @deprecated since 9 + */ + PARAMS_STREAM = 'ability.params.stream', + /** + * Indicates the action of providing oauth service. + * + * @syscap SystemCapability.Ability.AbilityBase + * @since 8 + * @deprecated since 9 + */ + ACTION_APP_ACCOUNT_OAUTH = 'ohos.account.appAccount.action.oauth' + } + /** + * the constant for Entity of the want + * + * @enum { string } + * @syscap SystemCapability.Ability.AbilityBase + * @since 6 + * @deprecated since 9 + */ + export enum Entity { + /** + * Indicates the default entity, which is used if the entity is not specified. + * + * @syscap SystemCapability.Ability.AbilityBase + * @since 6 + * @deprecated since 9 + */ + ENTITY_DEFAULT = 'entity.system.default', + /** + * Indicates the home screen entity. + * + * @syscap SystemCapability.Ability.AbilityBase + * @since 6 + * @deprecated since 9 + */ + ENTITY_HOME = 'entity.system.home', + /** + * Indicates the voice interaction entity. + * + * @syscap SystemCapability.Ability.AbilityBase + * @since 6 + * @deprecated since 9 + */ + ENTITY_VOICE = 'entity.system.voice', + /** + * Indicates the browser category. + * + * @syscap SystemCapability.Ability.AbilityBase + * @since 6 + * @deprecated since 9 + */ + ENTITY_BROWSABLE = 'entity.system.browsable', + /** + * Indicates the video category. + * + * @syscap SystemCapability.Ability.AbilityBase + * @since 6 + * @deprecated since 9 + */ + ENTITY_VIDEO = 'entity.system.video' + } + /** + * Used to indicate how Want is handled. + * + * @enum { number } + * @syscap SystemCapability.Ability.AbilityBase + * @since 6 + * @deprecated since 9 + * @useinstead ohos.app.ability.wantConstant/wantConstant#Flags + */ + export enum Flags { + /** + * Indicates the grant to perform read operations on the URI. + * + * @syscap SystemCapability.Ability.AbilityBase + * @since 6 + * @deprecated since 9 + * @useinstead ohos.app.ability.wantConstant/wantConstant.Flags#FLAG_AUTH_READ_URI_PERMISSION + */ + FLAG_AUTH_READ_URI_PERMISSION = 0x00000001, + /** + * Indicates the grant to perform write operations on the URI. + * + * @syscap SystemCapability.Ability.AbilityBase + * @since 6 + * @deprecated since 9 + * @useinstead ohos.app.ability.wantConstant/wantConstant.Flags#FLAG_AUTH_WRITE_URI_PERMISSION + */ + FLAG_AUTH_WRITE_URI_PERMISSION = 0x00000002, + /** + * Returns the result to the source ability. + * + * @syscap SystemCapability.Ability.AbilityBase + * @since 6 + * @deprecated since 9 + */ + FLAG_ABILITY_FORWARD_RESULT = 0x00000004, + /** + * Determines whether an ability on the local device can be migrated to a remote device. + * + * @syscap SystemCapability.Ability.AbilityBase + * @since 6 + * @deprecated since 9 + */ + FLAG_ABILITY_CONTINUATION = 0x00000008, + /** + * Specifies whether a component does not belong to OHOS. + * + * @syscap SystemCapability.Ability.AbilityBase + * @since 6 + * @deprecated since 9 + */ + FLAG_NOT_OHOS_COMPONENT = 0x00000010, + /** + * Specifies whether an ability is started. + * + * @syscap SystemCapability.Ability.AbilityBase + * @since 6 + * @deprecated since 9 + */ + FLAG_ABILITY_FORM_ENABLED = 0x00000020, + /** + * Supports multi-device startup in the distributed scheduling system. + * + * @syscap SystemCapability.Ability.AbilityBase + * @since 6 + * @deprecated since 9 + */ + FLAG_ABILITYSLICE_MULTI_DEVICE = 0x00000100, + /** + * Indicates that an ability using the Service template is started regardless of whether the host application has + * been started. + * + * @syscap SystemCapability.Ability.AbilityBase + * @since 6 + * @deprecated since 9 + */ + FLAG_START_FOREGROUND_ABILITY = 0x00000200, + /** + * Install the specified ability if it's not installed. + * + * @syscap SystemCapability.Ability.AbilityBase + * @since 6 + * @deprecated since 9 + * @useinstead ohos.app.ability.wantConstant/wantConstant.Flags#FLAG_INSTALL_ON_DEMAND + */ + FLAG_INSTALL_ON_DEMAND = 0x00000800, + /** + * Install the specified ability with background mode if it's not installed. + * + * @syscap SystemCapability.Ability.AbilityBase + * @since 6 + * @deprecated since 9 + */ + FLAG_INSTALL_WITH_BACKGROUND_MODE = 0x80000000, + /** + * Indicates the operation of clearing other missions. This flag can be set for the {@code Intent} passed to + * {@link ohos.app.Context#startAbility} and must be used together with {@link FLAG_ABILITY_NEW_MISSION}. + * + * @syscap SystemCapability.Ability.AbilityBase + * @since 6 + * @deprecated since 9 + */ + FLAG_ABILITY_CLEAR_MISSION = 0x00008000, + /** + * Indicates the operation of creating a task on the historical mission stack. + * + * @syscap SystemCapability.Ability.AbilityBase + * @since 6 + * @deprecated since 9 + */ + FLAG_ABILITY_NEW_MISSION = 0x10000000, + /** + * Indicates that the existing instance of the ability to start will be reused if it is already at the top of + * the mission stack. Otherwise, a new ability instance will be created. + * + * @syscap SystemCapability.Ability.AbilityBase + * @since 6 + * @deprecated since 9 + */ + FLAG_ABILITY_MISSION_TOP = 0x20000000 + } +} +export default wantConstant; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.abilityAccessCtrl.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.abilityAccessCtrl.d.ts new file mode 100755 index 00000000..aa2b73bd --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.abilityAccessCtrl.d.ts @@ -0,0 +1,379 @@ +/* + * Copyright (c) 2021-2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit AbilityKit + */ +import { AsyncCallback } from './@ohos.base'; +import { Permissions } from './permissions'; +import type _Context from './application/Context'; +import type _PermissionRequestResult from './security/PermissionRequestResult'; +/** + * @namespace abilityAccessCtrl + * @syscap SystemCapability.Security.AccessToken + * @since 8 + */ +/** + * @namespace abilityAccessCtrl + * @syscap SystemCapability.Security.AccessToken + * @atomicservice + * @since 11 + */ +/** + * @namespace abilityAccessCtrl + * @syscap SystemCapability.Security.AccessToken + * @crossplatform + * @atomicservice + * @since 12 + */ +declare namespace abilityAccessCtrl { + /** + * Obtains the AtManager instance. + * + * @returns { AtManager } Returns the instance of the AtManager. + * @syscap SystemCapability.Security.AccessToken + * @since 8 + */ + /** + * Obtains the AtManager instance. + * + * @returns { AtManager } returns the instance of the AtManager. + * @syscap SystemCapability.Security.AccessToken + * @crossplatform + * @since 10 + */ + /** + * Obtains the AtManager instance. + * + * @returns { AtManager } returns the instance of the AtManager. + * @syscap SystemCapability.Security.AccessToken + * @crossplatform + * @atomicservice + * @since 11 + */ + function createAtManager(): AtManager; + /** + * Provides methods for managing access_token. + * + * @interface AtManager + * @syscap SystemCapability.Security.AccessToken + * @since 8 + */ + /** + * Provides methods for managing access_token. + * + * @interface AtManager + * @syscap SystemCapability.Security.AccessToken + * @atomicservice + * @since 11 + */ + interface AtManager { + /** + * Checks whether a specified application has been granted the given permission. + * + * @param { number } tokenID - Token ID of the application. + * @param { Permissions } permissionName - Name of the permission to be verified. The Permissions type supports only valid permission names. + * @returns { Promise } Returns permission verify result. + * @syscap SystemCapability.Security.AccessToken + * @since 9 + */ + verifyAccessToken(tokenID: number, permissionName: Permissions): Promise; + /** + * Checks whether a specified application has been granted the given permission. + * + * @param { number } tokenID - Token ID of the application. + * @param { string } permissionName - Name of the permission to be verified. + * @returns { Promise } Returns permission verify result. + * @syscap SystemCapability.Security.AccessToken + * @since 8 + * @deprecated since 9 + * @useinstead ohos.abilityAccessCtrl.AtManager#checkAccessToken + */ + verifyAccessToken(tokenID: number, permissionName: string): Promise; + /** + * Checks whether a specified application has been granted the given permission synchronously. + * + * @param { number } tokenID - Token ID of the application. + * @param { Permissions } permissionName - Name of the permission to be verified. + * @returns { GrantStatus } Returns permission verify result. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. + * @throws { BusinessError } 12100001 - Invalid Parameter. The tokenID is 0, or the string size of permissionName is larger than 256. + * @syscap SystemCapability.Security.AccessToken + * @since 9 + */ + verifyAccessTokenSync(tokenID: number, permissionName: Permissions): GrantStatus; + /** + * Checks whether a specified application has been granted the given permission. + * + * @param { number } tokenID - Token ID of the application. + * @param { Permissions } permissionName - Name of the permission to be verified. + * @returns { Promise } Returns permission verify result. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. + * @throws { BusinessError } 12100001 - Invalid Parameter. The tokenID is 0, or the string size of permissionName is larger than 256. + * @syscap SystemCapability.Security.AccessToken + * @since 9 + */ + /** + * Checks whether a specified application has been granted the given permission. + * On the cross-platform, this function can be used to check the permission grant status for the current application only. + * + * @param { number } tokenID - Token ID of the application. + * @param { Permissions } permissionName - Name of the permission to be verified. + * @returns { Promise } Returns permission verify result. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. + * @throws { BusinessError } 12100001 - Invalid Parameter. The tokenID is 0, or the string size of permissionName is larger than 256. + * @syscap SystemCapability.Security.AccessToken + * @crossplatform + * @since 10 + */ + /** + * Checks whether a specified application has been granted the given permission. + * On the cross-platform, this function can be used to check the permission grant status for the current application only. + * + * @param { number } tokenID - Token ID of the application. + * @param { Permissions } permissionName - Name of the permission to be verified. + * @returns { Promise } Returns permission verify result. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. + * @throws { BusinessError } 12100001 - Invalid Parameter. The tokenID is 0, or the string size of permissionName is larger than 256. + * @syscap SystemCapability.Security.AccessToken + * @crossplatform + * @atomicservice + * @since 11 + */ + checkAccessToken(tokenID: number, permissionName: Permissions): Promise; + /** + * Checks whether a specified application has been granted the given permission. + * On the cross-platform, this function can be used to check the permission grant status for the current application only. + * + * @param { number } tokenID - Token ID of the application. + * @param { Permissions } permissionName - Name of the permission to be verified. + * @returns { GrantStatus } Returns permission verify result. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. + * @throws { BusinessError } 12100001 - Invalid Parameter. The tokenID is 0, or the string size of permissionName is larger than 256. + * @syscap SystemCapability.Security.AccessToken + * @crossplatform + * @since 10 + */ + /** + * Checks whether a specified application has been granted the given permission. + * On the cross-platform, this function can be used to check the permission grant status for the current application only. + * + * @param { number } tokenID - Token ID of the application. + * @param { Permissions } permissionName - Name of the permission to be verified. + * @returns { GrantStatus } Returns permission verify result. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. + * @throws { BusinessError } 12100001 - Invalid Parameter. The tokenID is 0, or the string size of permissionName is larger than 256. + * @syscap SystemCapability.Security.AccessToken + * @crossplatform + * @atomicservice + * @since 11 + */ + checkAccessTokenSync(tokenID: number, permissionName: Permissions): GrantStatus; + /** + * Requests certain permissions from the user. + * + * @param { Context } context - The context that initiates the permission request. + *
The context must belong to the Stage model and only supports UIAbilityContext and UIExtensionContext. + * @param { Array } permissionList - Indicates the list of permissions to be requested. This parameter cannot be null or empty. + * @param { AsyncCallback } requestCallback Callback for the result from requesting permissions. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. + * @throws { BusinessError } 12100001 - Invalid Parameter. The context is invalid when it does not belong to the application itself. + * @syscap SystemCapability.Security.AccessToken + * @stagemodelonly + * @since 9 + */ + /** + * Requests certain permissions from the user. + * + * @param { Context } context - The context that initiates the permission request. + *
The context must belong to the Stage model and only supports UIAbilityContext and UIExtensionContext. + * @param { Array } permissionList - Indicates the list of permissions to be requested. This parameter cannot be null or empty. + * @param { AsyncCallback } requestCallback Callback for the result from requesting permissions. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. + * @throws { BusinessError } 12100001 - Invalid Parameter. The context is invalid when it does not belong to the application itself. + * @syscap SystemCapability.Security.AccessToken + * @stagemodelonly + * @crossplatform + * @since 10 + */ + /** + * Requests certain permissions from the user. + * + * @param { Context } context - The context that initiates the permission request. + *
The context must belong to the Stage model and only supports UIAbilityContext and UIExtensionContext. + * @param { Array } permissionList - Indicates the list of permissions to be requested. This parameter cannot be null or empty. + * @param { AsyncCallback } requestCallback Callback for the result from requesting permissions. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. + * @throws { BusinessError } 12100001 - Invalid Parameter. The context is invalid when it does not belong to the application itself. + * @syscap SystemCapability.Security.AccessToken + * @stagemodelonly + * @crossplatform + * @atomicservice + * @since 12 + */ + requestPermissionsFromUser(context: Context, permissionList: Array, requestCallback: AsyncCallback): void; + /** + * Requests certain permissions from the user. + * + * @param { Context } context - The context that initiates the permission request. + *
The context must belong to the Stage model and only supports UIAbilityContext and UIExtensionContext. + * @param { Array } permissionList - Indicates the list of permissions to be requested. This parameter cannot be null or empty. + * @returns { Promise } Returns result of requesting permissions. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. + * @throws { BusinessError } 12100001 - Invalid Parameter. The context is invalid when it does not belong to the application itself. + * @syscap SystemCapability.Security.AccessToken + * @stagemodelonly + * @since 9 + */ + /** + * Requests certain permissions from the user. + * + * @param { Context } context - The context that initiates the permission request. + *
The context must belong to the Stage model and only supports UIAbilityContext and UIExtensionContext. + * @param { Array } permissionList - Indicates the list of permissions to be requested. This parameter cannot be null or empty. + * @returns { Promise } Returns result of requesting permissions. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. + * @throws { BusinessError } 12100001 - Invalid Parameter. The context is invalid when it does not belong to the application itself. + * @syscap SystemCapability.Security.AccessToken + * @stagemodelonly + * @crossplatform + * @since 10 + */ + /** + * Requests certain permissions from the user. + * + * @param { Context } context - The context that initiates the permission request. + *
The context must belong to the Stage model and only supports UIAbilityContext and UIExtensionContext. + * @param { Array } permissionList - Indicates the list of permissions to be requested. This parameter cannot be null or empty. + * @returns { Promise } Returns result of requesting permissions. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. + * @throws { BusinessError } 12100001 - Invalid Parameter. The context is invalid when it does not belong to the application itself. + * @syscap SystemCapability.Security.AccessToken + * @stagemodelonly + * @crossplatform + * @atomicservice + * @since 11 + */ + requestPermissionsFromUser(context: Context, permissionList: Array): Promise; + } + /** + * GrantStatus. + * + * @enum { number } + * @syscap SystemCapability.Security.AccessToken + * @since 8 + */ + /** + * GrantStatus. + * + * @enum { number } + * @syscap SystemCapability.Security.AccessToken + * @crossplatform + * @since 10 + */ + /** + * GrantStatus. + * + * @enum { number } + * @syscap SystemCapability.Security.AccessToken + * @crossplatform + * @atomicservice + * @since 11 + */ + export enum GrantStatus { + /** + * access_token permission check fail + * + * @syscap SystemCapability.Security.AccessToken + * @since 8 + */ + /** + * access_token permission check fail + * + * @syscap SystemCapability.Security.AccessToken + * @crossplatform + * @since 10 + */ + /** + * access_token permission check fail + * + * @syscap SystemCapability.Security.AccessToken + * @crossplatform + * @atomicservice + * @since 11 + */ + PERMISSION_DENIED = -1, + /** + * access_token permission check success + * + * @syscap SystemCapability.Security.AccessToken + * @since 8 + */ + /** + * access_token permission check success + * + * @syscap SystemCapability.Security.AccessToken + * @crossplatform + * @since 10 + */ + /** + * access_token permission check success + * + * @syscap SystemCapability.Security.AccessToken + * @crossplatform + * @atomicservice + * @since 11 + */ + PERMISSION_GRANTED = 0 + } +} +export default abilityAccessCtrl; +export { Permissions }; +/** + * PermissionRequestResult interface. + * + * @syscap SystemCapability.Security.AccessToken + * @stagemodelonly + * @crossplatform + * @since 10 + */ +/** + * PermissionRequestResult interface. + * + * @syscap SystemCapability.Security.AccessToken + * @stagemodelonly + * @crossplatform + * @atomicservice + * @since 11 + */ +export type PermissionRequestResult = _PermissionRequestResult; +/** + * Context interface. + * + * @syscap SystemCapability.Security.AccessToken + * @stagemodelonly + * @crossplatform + * @since 10 + */ +/** + * Context interface. + * + * @syscap SystemCapability.Security.AccessToken + * @stagemodelonly + * @crossplatform + * @atomicservice + * @since 11 + */ +export type Context = _Context; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.accessibility.GesturePath.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.accessibility.GesturePath.d.ts new file mode 100755 index 00000000..930c7648 --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.accessibility.GesturePath.d.ts @@ -0,0 +1,51 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"), + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit AccessibilityKit + */ +import type { GesturePoint } from './@ohos.accessibility.GesturePoint'; +/** + * Indicates the path of the gesture. + * + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @since 9 + */ +export declare class GesturePath { + /** + * A constructor used to create a GesturePath object. + * + * @param { number } durationTime - Indicates the duration of the gesture. + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @since 9 + */ + constructor(durationTime: number); + /** + * Indicates the position of the points that make up the gesture. + * + * @type { Array } + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @since 9 + */ + points: Array; + /** + * Indicates the duration of the gesture. + * + * @type { number } + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @since 9 + */ + durationTime: number; +} diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.accessibility.GesturePoint.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.accessibility.GesturePoint.d.ts new file mode 100755 index 00000000..49c87836 --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.accessibility.GesturePoint.d.ts @@ -0,0 +1,51 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"), + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit AccessibilityKit + */ +/** + * Indicates the point of the gesture. + * + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @since 9 + */ +export declare class GesturePoint { + /** + * A constructor used to create a GesturePoint object. + * + * @param { number } positionX - Indicates the X coordinate of point. + * @param { number } positionY - Indicates the Y coordinate of point. + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @since 9 + */ + constructor(positionX: number, positionY: number); + /** + * Indicates the X coordinate of point. + * + * @type { number } + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @since 9 + */ + positionX: number; + /** + * Indicates the Y coordinate of point. + * + * @type { number } + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @since 9 + */ + positionY: number; +} diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.accessibility.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.accessibility.d.ts new file mode 100755 index 00000000..bf2b27b8 --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.accessibility.d.ts @@ -0,0 +1,710 @@ +/* + * Copyright (C) 2021-2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit AccessibilityKit + */ +import type { AsyncCallback } from './@ohos.base'; +import type { Callback } from './@ohos.base'; +/** + * Accessibility + * + * @namespace accessibility + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @since 7 + */ +/** + * Accessibility + * + * @namespace accessibility + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @atomicservice + * @since 11 + */ +declare namespace accessibility { + /** + * The type of the Ability app. + * + *{ 'audible' | 'generic' | 'haptic' | 'spoken' | 'visual' } + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @since 7 + */ + /** + * The type of the Ability app. + * + * { 'audible' | 'generic' | 'haptic' | 'spoken' | 'visual' | 'all' } + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @since 9 + */ + type AbilityType = 'audible' | 'generic' | 'haptic' | 'spoken' | 'visual' | 'all'; + /** + * The action that the ability can execute. + * value range: { 'accessibilityFocus' | 'clearAccessibilityFocus' | 'focus' | 'clearFocus' | 'clearSelection' | + * 'click' | 'longClick' | 'cut' | 'copy' | 'paste' | 'select' | 'setText' | 'delete' | + * 'scrollForward' | 'scrollBackward' | 'setSelection' } + * + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @since 7 + */ + /** + * The action that the ability can execute. + * value range: { 'accessibilityFocus' | 'clearAccessibilityFocus' | 'focus' | 'clearFocus' | 'clearSelection' | + * 'click' | 'longClick' | 'cut' | 'copy' | 'paste' | 'select' | 'setText' | 'delete' | + * 'scrollForward' | 'scrollBackward' | 'setSelection' | 'setCursorPosition' | 'home' | + * 'back' | 'recentTask' | 'notificationCenter' | 'controlCenter' | 'common' } + * + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @since 12 + */ + type Action = 'accessibilityFocus' | 'clearAccessibilityFocus' | 'focus' | 'clearFocus' | 'clearSelection' | 'click' | 'longClick' | 'cut' | 'copy' | 'paste' | 'select' | 'setText' | 'delete' | 'scrollForward' | 'scrollBackward' | 'setSelection' | 'setCursorPosition' | 'home' | 'back' | 'recentTask' | 'notificationCenter' | 'controlCenter' | 'common'; + /** + * The type of the accessibility event. + * windowsChange/windowContentChange/windowStateChange/announcement/notificationChange/textTraversedAtMove + * value range: { 'accessibilityFocus' | 'accessibilityFocusClear' | + * 'click' | 'longClick' | 'focus' | 'select' | 'hoverEnter' | 'hoverExit' | + * 'textUpdate' | 'textSelectionUpdate' | 'scroll' } + * + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @since 7 + */ + /** + * The type of the accessibility event. + * windowsChange/windowContentChange/windowStateChange/announcement/notificationChange/textTraversedAtMove + * value range: { 'accessibilityFocus' | 'accessibilityFocusClear' | + * 'click' | 'longClick' | 'focus' | 'select' | 'hoverEnter' | 'hoverExit' | + * 'textUpdate' | 'textSelectionUpdate' | 'scroll' | 'requestFocusForAccessibility' | + * 'announceForAccessibility' } + * + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @since 12 + */ + type EventType = 'accessibilityFocus' | 'accessibilityFocusClear' | 'click' | 'longClick' | 'focus' | 'select' | 'hoverEnter' | 'hoverExit' | 'textUpdate' | 'textSelectionUpdate' | 'scroll' | 'requestFocusForAccessibility' | 'announceForAccessibility'; + /** + * The change type of the windowsChange event. + * It's used when received the {@code windowsChange} event. + * + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @since 7 + */ + type WindowUpdateType = 'add' | 'remove' | 'bounds' | 'active' | 'focus'; + /** + * The type of the ability state. + * + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @since 7 + */ + type AbilityState = 'enable' | 'disable' | 'install'; + /** + * The ability that accessibility subsystem support. + * touchExplorer: Describes the capability to talkback. + * magnification: Describes the capability to request to control the display magnification. + * gesturesSimulation: Describes the capability to request to simulate the gesture. + * windowContent: Describes the capability to search for the content of the active window. + * filterKeyEvents: Describes the capability to request to filter key events. + * fingerprintGesture: Describes the capability to request to fingerprint gesture. + * + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @since 7 + */ + type Capability = 'retrieve' | 'touchGuide' | 'keyEventObserver' | 'zoom' | 'gesture'; + /** + * The granularity of text move. + * + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @since 7 + */ + type TextMoveUnit = 'char' | 'word' | 'line' | 'page' | 'paragraph'; + /** + * Checks whether accessibility ability is enabled. + * + * @param { AsyncCallback } callback Asynchronous callback interface. + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @since 7 + * @deprecated since 10 + * @useinstead ohos.accessibility#isOpenAccessibilitySync + */ + function isOpenAccessibility(callback: AsyncCallback): void; + /** + * Checks whether accessibility ability is enabled. + * + * @returns { Promise } Returns {@code true} if the accessibility is enabled; returns {@code false} otherwise. + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @since 7 + * @deprecated since 10 + * @useinstead ohos.accessibility#isOpenAccessibilitySync + */ + function isOpenAccessibility(): Promise; + /** + * Checks whether accessibility ability is enabled. + * + * @returns { boolean } Returns true if the accessibility is enabled; returns false otherwise. + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @since 10 + */ + /** + * Checks whether accessibility ability is enabled. + * + * @returns { boolean } Returns true if the accessibility is enabled; returns false otherwise. + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @atomicservice + * @since 11 + */ + function isOpenAccessibilitySync(): boolean; + /** + * Checks touch browser ability (which is used by talkback) is enabled. + * + * @param { AsyncCallback } callback Asynchronous callback interface. + * @syscap SystemCapability.BarrierFree.Accessibility.Vision + * @since 7 + * @deprecated since 10 + * @useinstead ohos.accessibility#isOpenTouchGuideSync + */ + function isOpenTouchGuide(callback: AsyncCallback): void; + /** + * Checks touch browser ability (which is used by talkback) is enabled. + * + * @returns { Promise } Returns {@code true} if the touch browser is enabled; returns {@code false} otherwise. + * @syscap SystemCapability.BarrierFree.Accessibility.Vision + * @since 7 + * @deprecated since 10 + * @useinstead ohos.accessibility#isOpenTouchGuideSync + */ + function isOpenTouchGuide(): Promise; + /** + * Checks touch browser ability (which is used by talkback) is enabled. + * + * @returns { boolean } Returns true if the touch browser is enabled; returns false otherwise. + * @syscap SystemCapability.BarrierFree.Accessibility.Vision + * @since 10 + */ + /** + * Checks touch browser ability (which is used by talkback) is enabled. + * + * @returns { boolean } Returns true if the touch browser is enabled; returns false otherwise. + * @syscap SystemCapability.BarrierFree.Accessibility.Vision + * @atomicservice + * @since 11 + */ + function isOpenTouchGuideSync(): boolean; + /** + * Queries the list of accessibility abilities. + * + * @param { AbilityType } abilityType The type of the accessibility ability. {@code AbilityType} eg.spoken + * @param { AbilityState } stateType The state of the accessibility ability. {@code AbilityState} eg.installed + * @param { AsyncCallback> } callback + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.accessibility#getAccessibilityExtensionList + */ + function getAbilityLists(abilityType: AbilityType, stateType: AbilityState, callback: AsyncCallback>): void; + /** + * Queries the list of accessibility abilities. + * + * @param { AbilityType } abilityType The type of the accessibility ability. {@code AbilityType} eg.spoken + * @param { AbilityState } stateType The state of the accessibility ability. {@code AbilityState} eg.installed + * @returns { Promise> } Returns the list of abilityInfos. + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.accessibility#getAccessibilityExtensionList + */ + function getAbilityLists(abilityType: AbilityType, stateType: AbilityState): Promise>; + /** + * Queries the list of accessibility abilities. + * + * @param { AbilityType } abilityType The type of the accessibility ability. {@code AbilityType} eg.spoken + * @param { AbilityState } stateType The state of the accessibility ability. {@code AbilityState} eg.installed + * @returns { Promise> } Returns the list of abilityInfos. + * @throws { BusinessError } 401 - Input parameter error. + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @since 9 + */ + function getAccessibilityExtensionList(abilityType: AbilityType, stateType: AbilityState): Promise>; + /** + * Queries the list of accessibility abilities. + * + * @param { AbilityType } abilityType The type of the accessibility ability. {@code AbilityType} eg.spoken + * @param { AbilityState } stateType The state of the accessibility ability. {@code AbilityState} eg.installed + * @param { AsyncCallback> } callback + * @throws { BusinessError } 401 - Input parameter error. + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @since 9 + */ + function getAccessibilityExtensionList(abilityType: AbilityType, stateType: AbilityState, callback: AsyncCallback>): void; + /** + * Queries the list of accessibility abilities. + * + * @param { AbilityType } abilityType The type of the accessibility ability. {@code AbilityType} eg.spoken + * @param { AbilityState } stateType The state of the accessibility ability. {@code AbilityState} eg.installed + * @returns { Array } Returns the list of abilityInfos. + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @since 12 + */ + function getAccessibilityExtensionListSync(abilityType: AbilityType, stateType: AbilityState): Array; + /** + * Send accessibility Event. + * + * @param { EventInfo } event The object of the accessibility {@code EventInfo} . + * @param { AsyncCallback } callback Asynchronous callback interface. + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.accessibility#sendAccessibilityEvent + */ + function sendEvent(event: EventInfo, callback: AsyncCallback): void; + /** + * Send accessibility Event. + * + * @param { EventInfo } event The object of the accessibility {@code EventInfo} . + * @returns { Promise } Returns {@code true} if success ; returns {@code false} otherwise. + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.accessibility#sendAccessibilityEvent + */ + function sendEvent(event: EventInfo): Promise; + /** + * Send accessibility event. + * + * @param { EventInfo } event The object of the accessibility {@code EventInfo} . + * @param { AsyncCallback } callback Asynchronous callback interface. + * @throws { BusinessError } 401 - Input parameter error. + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @since 9 + */ + function sendAccessibilityEvent(event: EventInfo, callback: AsyncCallback): void; + /** + * Send accessibility event. + * + * @param { EventInfo } event The object of the accessibility {@code EventInfo} . + * @returns { Promise } Returns {@code true} if success ; returns {@code false} otherwise. + * @throws { BusinessError } 401 - Input parameter error. + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @since 9 + */ + function sendAccessibilityEvent(event: EventInfo): Promise; + /** + * Register the observe of the accessibility state changed. + * + * @param { 'accessibilityStateChange' } type state event type. + * @param { Callback } callback Asynchronous callback interface. + * @throws { BusinessError } 401 - Input parameter error. + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @since 7 + */ + function on(type: 'accessibilityStateChange', callback: Callback): void; + /** + * Register the observe of the touchGuide state changed. + * + * @param { 'touchGuideStateChange' } type state event type. + * @param { Callback } callback Asynchronous callback interface. + * @throws { BusinessError } 401 - Input parameter error. + * @syscap SystemCapability.BarrierFree.Accessibility.Vision + * @since 7 + */ + function on(type: 'touchGuideStateChange', callback: Callback): void; + /** + * Unregister the observe of the accessibility state changed. + * + * @param { 'accessibilityStateChange' } type state event type + * @param { Callback } callback Asynchronous callback interface. + * @throws { BusinessError } 401 - Input parameter error. + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @since 7 + */ + function off(type: 'accessibilityStateChange', callback?: Callback): void; + /** + * Unregister the observe of the touchGuide state changed. + * + * @param { 'touchGuideStateChange' } type state event type + * @param { Callback } callback Asynchronous callback interface. + * @throws { BusinessError } 401 - Input parameter error. + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @since 7 + */ + function off(type: 'touchGuideStateChange', callback?: Callback): void; + /** + * Get the captions manager. + * + * @returns { CaptionsManager } Returns the captions manager. + * @syscap SystemCapability.BarrierFree.Accessibility.Hearing + * @since 8 + */ + function getCaptionsManager(): CaptionsManager; + /** + * Indicates the captions manager. + * + * @typedef CaptionsManager + * @syscap SystemCapability.BarrierFree.Accessibility.Hearing + * @since 8 + */ + interface CaptionsManager { + /** + * Indicates whether captions are enabled. + * + * @syscap SystemCapability.BarrierFree.Accessibility.Hearing + * @since 8 + */ + enabled: boolean; + /** + * Indicates the style of captions. + * + * @syscap SystemCapability.BarrierFree.Accessibility.Hearing + * @since 8 + */ + style: CaptionsStyle; + /** + * Register the observe of the enable state. + * + * @param { 'enableChange' } type + * @param { Callback } callback + * @throws { BusinessError } 401 - Input parameter error. + * @syscap SystemCapability.BarrierFree.Accessibility.Hearing + * @since 8 + */ + on(type: 'enableChange', callback: Callback): void; + /** + * Register the observer of the style. + * + * @param { 'styleChange' } type + * @param { Callback } callback + * @throws { BusinessError } 401 - Input parameter error. + * @syscap SystemCapability.BarrierFree.Accessibility.Hearing + * @since 8 + */ + on(type: 'styleChange', callback: Callback): void; + /** + * Unregister the observe of the enable state. + * + * @param { 'enableChange' } type + * @param { Callback } callback + * @throws { BusinessError } 401 - Input parameter error. + * @syscap SystemCapability.BarrierFree.Accessibility.Hearing + * @since 8 + */ + off(type: 'enableChange', callback?: Callback): void; + /** + * Unregister the observer of the style. + * + * @param { 'styleChange' } type + * @param { Callback } callback + * @throws { BusinessError } 401 - Input parameter error. + * @syscap SystemCapability.BarrierFree.Accessibility.Hearing + * @since 8 + */ + off(type: 'styleChange', callback?: Callback): void; + } + /** + * Indicates the edge type of the captions font. + * + * @syscap SystemCapability.BarrierFree.Accessibility.Hearing + * @since 8 + */ + type CaptionsFontEdgeType = 'none' | 'raised' | 'depressed' | 'uniform' | 'dropShadow'; + /** + * Indicates the font family of captions. + * + * @syscap SystemCapability.BarrierFree.Accessibility.Hearing + * @since 8 + */ + type CaptionsFontFamily = 'default' | 'monospacedSerif' | 'serif' | 'monospacedSansSerif' | 'sansSerif' | 'casual' | 'cursive' | 'smallCapitals'; + /** + * Indicates the style of captions. + * + * @typedef CaptionsStyle + * @syscap SystemCapability.BarrierFree.Accessibility.Hearing + * @since 8 + */ + interface CaptionsStyle { + /** + * Indicates the font family of captions. + * + * @syscap SystemCapability.BarrierFree.Accessibility.Hearing + * @since 8 + */ + fontFamily: CaptionsFontFamily; + /** + * Indicates the font scaling of captions. + * @type { number } + * @syscap SystemCapability.BarrierFree.Accessibility.Hearing + * @since 8 + */ + fontScale: number; + /** + * Indicates the font color of captions. + * @type { number | string } + * @syscap SystemCapability.BarrierFree.Accessibility.Hearing + * @since 8 + */ + fontColor: number | string; + /** + * Indicates the edge type of the captions font. + * @type { CaptionsFontEdgeType } + * @syscap SystemCapability.BarrierFree.Accessibility.Hearing + * @since 8 + */ + fontEdgeType: CaptionsFontEdgeType; + /** + * Indicates the background color of captions. + * @type { number | string } + * @syscap SystemCapability.BarrierFree.Accessibility.Hearing + * @since 8 + */ + backgroundColor: number | string; + /** + * Indicates the window color of captions. + * @type { number | string } + * @syscap SystemCapability.BarrierFree.Accessibility.Hearing + * @since 8 + */ + windowColor: number | string; + } + /** + * Indicates the info of accessibility. + * + * @typedef AccessibilityAbilityInfo + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @since 7 + */ + interface AccessibilityAbilityInfo { + /** + * The ability id. + * @type { string } + * @readonly + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @since 7 + */ + readonly id: string; + /** + * The ability name. + * @type { string } + * @readonly + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @since 7 + */ + readonly name: string; + /** + * The bundle name of the ability. + * @type { string } + * @readonly + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @since 7 + */ + readonly bundleName: string; + /** + * The target bundle name for the observation. + * @type { Array } + * @readonly + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @since 9 + */ + readonly targetBundleNames: Array; + /** + * The type of the ability. + * @type { Array } + * @readonly + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @since 7 + */ + readonly abilityTypes: Array; + /** + * The capabilities of the ability. + * @type { Array } + * @readonly + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @since 7 + */ + readonly capabilities: Array; + /** + * The description of the ability. + * @type { string } + * @readonly + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @since 7 + */ + readonly description: string; + /** + * The events which the accessibility ability wants to observe. + * @type { Array } + * @readonly + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @since 7 + */ + readonly eventTypes: Array; + /** + * Indicates whether the extended service needs to be hidden. + * @type { boolean } + * @readonly + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @since 12 + */ + readonly needHide: boolean; + /** + * The label of the ability. + * @type { string } + * @readonly + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @since 12 + */ + readonly label: string; + } + /** + * Indicates the info of events. + * + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @since 7 + */ + class EventInfo { + /** + * A constructor used to create a EventInfo object. + * + * @param jsonObject - Character string in JSON format required for creating an object. + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @since 7 + */ + constructor(jsonObject); + /** + * A constructor used to create a EventInfo object. + * + * @param { EventType } type - The type of the accessibility event. + * @param { string } bundleName - The name of the bundle. + * @param { Action } triggerAction - The action that the ability can execute. + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @since 11 + */ + constructor(type: EventType, bundleName: string, triggerAction: Action); + /** + * The type of an accessibility event. + * @type { EventType } + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @since 7 + */ + type: EventType; + /** + * The type of the window change event. + * @type { ?WindowUpdateType } + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @since 7 + */ + windowUpdateType?: WindowUpdateType; + /** + * The bundle name of the target application. + * @type { string } + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @since 7 + */ + bundleName: string; + /** + * The type of the event source component,such as button, chart. + * @type { ?string } + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @since 7 + */ + componentType?: string; + /** + * The page id of the event source. + * @type { ?number } + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @since 7 + */ + pageId?: number; + /** + * The accessibility event description. + * @type { ?string } + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @since 7 + */ + description?: string; + /** + * The action that triggers the accessibility event, for example, clicking or focusing a view. + * @type { Action } + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @since 7 + */ + triggerAction: Action; + /** + * The movement step used for reading texts. + * @type { ?TextMoveUnit } + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @since 7 + */ + textMoveUnit?: TextMoveUnit; + /** + * The content list. + * @type { ?Array } + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @since 7 + */ + contents?: Array; + /** + * The content changed before. + * @type { ?string } + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @since 7 + */ + lastContent?: string; + /** + * The start index of listed items on the screen. + * @type { ?number } + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @since 7 + */ + beginIndex?: number; + /** + * The index of the current item on the screen. + * @type { ?number } + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @since 7 + */ + currentIndex?: number; + /** + * The end index of listed items on the screen. + * @type { ?number } + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @since 7 + */ + endIndex?: number; + /** + * The total of the items, talkback used it when scroll. + * @type { ?number } + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @since 7 + */ + itemCount?: number; + /** + * The id of element. + * @type { ?number } + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @since 12 + */ + elementId?: number; + /** + * The content of announce accessibility text. + * @type { ?string } + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @since 12 + */ + textAnnouncedForAccessibility?: string; + /** + * The customized element id. + * @type { ?string } + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @since 12 + */ + customId?: string; + } +} +export default accessibility; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.account.appAccount.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.account.appAccount.d.ts new file mode 100755 index 00000000..8fd6b7fb --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.account.appAccount.d.ts @@ -0,0 +1,2620 @@ +/* + * Copyright (c) 2021-2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit BasicServicesKit + */ +import type { AsyncCallback, Callback } from './@ohos.base'; +import type Want from './@ohos.app.ability.Want'; +import type rpc from './@ohos.rpc'; +/** + * This module provides the capability to manage application accounts. + * + * @namespace appAccount + * @syscap SystemCapability.Account.AppAccount + * @since 7 + */ +declare namespace appAccount { + /** + * Obtains the AppAccountManager instance. + * + * @returns { AppAccountManager } Returns the instance of the AppAccountManager. + * @syscap SystemCapability.Account.AppAccount + * @since 7 + */ + function createAppAccountManager(): AppAccountManager; + /** + * Provides methods for managing application accounts. + * + * @interface AppAccountManager + * @syscap SystemCapability.Account.AppAccount + * @since 7 + */ + interface AppAccountManager { + /** + * Adds the account name and extra information of this application to the account management service. + *

+ * Only the owner of the application account has the permission to call this method. + * + * @param { string } name - Indicates the name of the application account to add. + * @param { AsyncCallback } callback - Asynchronous callback interface. + * @syscap SystemCapability.Account.AppAccount + * @since 7 + * @deprecated since 9 + * @useinstead appAccount.AppAccountManager#createAccount + */ + addAccount(name: string, callback: AsyncCallback): void; + /** + * Adds the account name and extra information of this application to the account management service. + *

+ * Only the owner of the application account has the permission to call this method. + * + * @param { string } name - Indicates the name of the application account to add. + * @param { string } extraInfo - Indicates the extra information of the application account to add. + * The extra information cannot be sensitive information of the application account. + * @param { AsyncCallback } callback - Asynchronous callback interface. + * @syscap SystemCapability.Account.AppAccount + * @since 7 + * @deprecated since 9 + * @useinstead appAccount.AppAccountManager#createAccount + */ + addAccount(name: string, extraInfo: string, callback: AsyncCallback): void; + /** + * Adds the account name and extra information of this application to the account management service. + *

+ * Only the owner of the application account has the permission to call this method. + * + * @param { string } name - Indicates the name of the application account to add. + * @param { string } [extraInfo] - Indicates the extra information of the application account to add. + * The extra information cannot be sensitive information of the application account. + * @returns { Promise } The promise returned by the function. + * @syscap SystemCapability.Account.AppAccount + * @since 7 + * @deprecated since 9 + * @useinstead appAccount.AppAccountManager#createAccount + */ + addAccount(name: string, extraInfo?: string): Promise; + /** + * Creates the account name and extra information of this application to the account management service. + *

+ * Only the owner of the application account has the permission to call this method. + * + * @param { string } name - Indicates the name of the application account to add. + * @param { AsyncCallback } callback - Asynchronous callback interface. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. + * @throws { BusinessError } 12300001 - System service exception. + * @throws { BusinessError } 12300002 - Invalid name. + * @throws { BusinessError } 12300004 - Account already exists. + * @throws { BusinessError } 12300007 - The number of accounts reaches the upper limit. + * @syscap SystemCapability.Account.AppAccount + * @since 9 + */ + createAccount(name: string, callback: AsyncCallback): void; + /** + * Creates the account name and extra information of this application to the account management service. + *

+ * Only the owner of the application account has the permission to call this method. + * + * @param { string } name - Indicates the name of the application account to add. + * @param { CreateAccountOptions } options - Indicates the extra information of the application account to add. + * The extra information cannot be sensitive information of the application account. + * @param { AsyncCallback } callback - Asynchronous callback interface. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. + * @throws { BusinessError } 12300001 - System service exception. + * @throws { BusinessError } 12300002 - Invalid name or options. + * @throws { BusinessError } 12300004 - Account already exists. + * @throws { BusinessError } 12300007 - The number of accounts reaches the upper limit. + * @syscap SystemCapability.Account.AppAccount + * @since 9 + */ + createAccount(name: string, options: CreateAccountOptions, callback: AsyncCallback): void; + /** + * Creates the account name and extra information of this application to the account management service. + *

+ * Only the owner of the application account has the permission to call this method. + * + * @param { string } name - Indicates the name of the application account to add. + * @param { CreateAccountOptions } [options] - Indicates the extra information of the application account to add. + * The extra information cannot be sensitive information of the application account. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. + * @throws { BusinessError } 12300001 - System service exception. + * @throws { BusinessError } 12300002 - Invalid name or options. + * @throws { BusinessError } 12300004 - Account already exists. + * @throws { BusinessError } 12300007 - The number of accounts reaches the upper limit. + * @syscap SystemCapability.Account.AppAccount + * @since 9 + */ + createAccount(name: string, options?: CreateAccountOptions): Promise; + /** + * Adds an application account of a specified owner implicitly. + * + * @param { string } owner - Indicates the account owner of your application or third-party applications. + * @param { string } authType - Indicates the authentication type. + * @param { object } options - Indicates the authenticator-specific options for the request. + * @param { AuthenticatorCallback } callback - Indicates the authenticator callback. + * @syscap SystemCapability.Account.AppAccount + * @since 8 + * @deprecated since 9 + * @useinstead appAccount.AppAccountManager#createAccountImplicitly + */ + addAccountImplicitly(owner: string, authType: string, options: { + [key: string]: any; + }, callback: AuthenticatorCallback): void; + /** + * Creates an application account of a specified owner implicitly. + * + * @param { string } owner - Indicates the account owner of your application or third-party applications. + * @param { AuthCallback } callback - Indicates the authenticator callback. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. + * @throws { BusinessError } 12300001 - System service exception. + * @throws { BusinessError } 12300002 - Invalid owner. + * @throws { BusinessError } 12300007 - The number of accounts reaches the upper limit. + * @throws { BusinessError } 12300010 - Account service busy. + * @throws { BusinessError } 12300113 - Authenticator service not found. + * @throws { BusinessError } 12300114 - Authenticator service exception. + * @syscap SystemCapability.Account.AppAccount + * @since 9 + */ + createAccountImplicitly(owner: string, callback: AuthCallback): void; + /** + * Creates an application account of a specified owner implicitly. + * + * @param { string } owner - Indicates the account owner of your application or third-party applications. + * @param { CreateAccountImplicitlyOptions } options - Indicates the authenticator-specific options for the request. + * @param { AuthCallback } callback - Indicates the authenticator callback. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. + * @throws { BusinessError } 12300001 - System service exception. + * @throws { BusinessError } 12300002 - Invalid owner or options. + * @throws { BusinessError } 12300007 - The number of accounts reaches the upper limit. + * @throws { BusinessError } 12300010 - Account service busy. + * @throws { BusinessError } 12300113 - Authenticator service not found. + * @throws { BusinessError } 12300114 - Authenticator service exception. + * @syscap SystemCapability.Account.AppAccount + * @since 9 + */ + createAccountImplicitly(owner: string, options: CreateAccountImplicitlyOptions, callback: AuthCallback): void; + /** + * Deletes an application account from the account management service. + *

+ * Only the owner of the application account has the permission to call this method. + * + * @param { string } name - Indicates the name of the application account to delete. + * @param { AsyncCallback } callback - Asynchronous callback interface. + * @syscap SystemCapability.Account.AppAccount + * @since 7 + * @deprecated since 9 + * @useinstead appAccount.AppAccountManager#removeAccount + */ + deleteAccount(name: string, callback: AsyncCallback): void; + /** + * Deletes an application account from the account management service. + *

+ * Only the owner of the application account has the permission to call this method. + * + * @param { string } name - Indicates the name of the application account to delete. + * @returns { Promise } The promise returned by the function. + * @syscap SystemCapability.Account.AppAccount + * @since 7 + * @deprecated since 9 + * @useinstead appAccount.AppAccountManager#removeAccount + */ + deleteAccount(name: string): Promise; + /** + * Removes an application account from the account management service. + *

+ * Only the owner of the application account has the permission to call this method. + * + * @param { string } name - Indicates the name of the application account to delete. + * @param { AsyncCallback } callback - Asynchronous callback interface. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. + * @throws { BusinessError } 12300001 - System service exception. + * @throws { BusinessError } 12300002 - Invalid name. + * @throws { BusinessError } 12300003 - Account not found. + * @syscap SystemCapability.Account.AppAccount + * @since 9 + */ + removeAccount(name: string, callback: AsyncCallback): void; + /** + * Removes an application account from the account management service. + *

+ * Only the owner of the application account has the permission to call this method. + * + * @param { string } name - Indicates the name of the application account to delete. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. + * @throws { BusinessError } 12300001 - System service exception. + * @throws { BusinessError } 12300002 - Invalid name. + * @throws { BusinessError } 12300003 - Account not found. + * @syscap SystemCapability.Account.AppAccount + * @since 9 + */ + removeAccount(name: string): Promise; + /** + * Disables a third-party application with the specified bundle name from + * accessing the given application account. + * + * @param { string } name - Indicates the name of the application account to disable access from + * the third-party application. + * @param { string } bundleName - Indicates the bundle name of the third-party application. + * @param { AsyncCallback } callback - Asynchronous callback interface. + * @syscap SystemCapability.Account.AppAccount + * @since 7 + * @deprecated since 9 + * @useinstead appAccount.AppAccountManager#setAppAccess + */ + disableAppAccess(name: string, bundleName: string, callback: AsyncCallback): void; + /** + * Disables a third-party application with the specified bundle name from + * accessing the given application account. + * + * @param { string } name - Indicates the name of the application account to disable access from + * the third-party application. + * @param { string } bundleName - Indicates the bundle name of the third-party application. + * @returns { Promise } The promise returned by the function. + * @syscap SystemCapability.Account.AppAccount + * @since 7 + * @deprecated since 9 + * @useinstead appAccount.AppAccountManager#setAppAccess + */ + disableAppAccess(name: string, bundleName: string): Promise; + /** + * Enables a third-party application with the specified bundle name to access the given application + * account for data query and listening. + * + * @param { string } name - Indicates the name of the application account. + * @param { string } bundleName - Indicates the bundle name of the third-party application. + * @param { AsyncCallback } callback - Asynchronous callback interface. + * @syscap SystemCapability.Account.AppAccount + * @since 7 + * @deprecated since 9 + * @useinstead appAccount.AppAccountManager#setAppAccess + */ + enableAppAccess(name: string, bundleName: string, callback: AsyncCallback): void; + /** + * Enables a third-party application with the specified bundle name to access the given application + * account for data query and listening. + * + * @param { string } name - Indicates the name of the application account. + * @param { string } bundleName - Indicates the bundle name of the third-party application. + * @returns { Promise } The promise returned by the function. + * @syscap SystemCapability.Account.AppAccount + * @since 7 + * @deprecated since 9 + * @useinstead appAccount.AppAccountManager#setAppAccess + */ + enableAppAccess(name: string, bundleName: string): Promise; + /** + * Sets a third-party application with the specified bundle name to access the given application + * account for data query and listening. + * + * @param { string } name - Indicates the name of the application account. + * @param { string } bundleName - Indicates the bundle name of the third-party application. + * @param { boolean } isAccessible - Indicates the accessibility flag, true for accessible, false for inaccessible. + * @param { AsyncCallback } callback - Asynchronous callback interface. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. + * @throws { BusinessError } 12300001 - System service exception. + * @throws { BusinessError } 12300002 - Invalid name or bundleName. + * @throws { BusinessError } 12300003 - Account not found. + * @throws { BusinessError } 12400001 - Application not found. + * @syscap SystemCapability.Account.AppAccount + * @since 9 + */ + setAppAccess(name: string, bundleName: string, isAccessible: boolean, callback: AsyncCallback): void; + /** + * Sets a third-party application with the specified bundle name to access the given application + * account for data query and listening. + * + * @param { string } name - Indicates the name of the application account. + * @param { string } bundleName - Indicates the bundle name of the third-party application. + * @param { boolean } isAccessible - Indicates the accessibility flag, true for accessible, false for inaccessible. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. + * @throws { BusinessError } 12300001 - System service exception. + * @throws { BusinessError } 12300002 - Invalid name or bundleName. + * @throws { BusinessError } 12300003 - Account not found. + * @throws { BusinessError } 12400001 - Application not found. + * @syscap SystemCapability.Account.AppAccount + * @since 9 + */ + setAppAccess(name: string, bundleName: string, isAccessible: boolean): Promise; + /** + * Checks whether a third-party application with the specified bundle name is allowed to access + * the given application account for data query and listening. + * + * @param { string } name - Indicates the name of the application account. + * @param { string } bundleName - Indicates the bundle name of the third-party application. + * @param { AsyncCallback } callback - Asynchronous callback interface. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. + * @throws { BusinessError } 12300001 - System service exception. + * @throws { BusinessError } 12300002 - Invalid name or bundleName. + * @throws { BusinessError } 12300003 - Account not found. + * @syscap SystemCapability.Account.AppAccount + * @since 9 + */ + checkAppAccess(name: string, bundleName: string, callback: AsyncCallback): void; + /** + * Checks whether a third-party application with the specified bundle name is allowed to access + * the given application account for data query and listening. + * + * @param { string } name - Indicates the name of the application account. + * @param { string } bundleName - Indicates the bundle name of the third-party application. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. + * @throws { BusinessError } 12300001 - System service exception. + * @throws { BusinessError } 12300002 - Invalid name or bundleName. + * @throws { BusinessError } 12300003 - Account not found. + * @syscap SystemCapability.Account.AppAccount + * @since 9 + */ + checkAppAccess(name: string, bundleName: string): Promise; + /** + * Checks whether a specified application account allows application data synchronization. + *

+ * If the same OHOS account has logged in to multiple devices, these devices constitute a super device + * through the distributed networking. On the connected devices, you can call this method to check + * whether application data can be synchronized. + *

+ * + * @permission ohos.permission.DISTRIBUTED_DATASYNC + * @param { string } name - Indicates the name of the application account. + * @param { AsyncCallback } callback - Asynchronous callback interface. + * @syscap SystemCapability.Account.AppAccount + * @since 7 + * @deprecated since 9 + * @useinstead appAccount.AppAccountManager#checkDataSyncEnabled + */ + checkAppAccountSyncEnable(name: string, callback: AsyncCallback): void; + /** + * Checks whether a specified application account allows application data synchronization. + *

+ * If the same OHOS account has logged in to multiple devices, these devices constitute a super device + * through the distributed networking. On the connected devices, you can call this method to check + * whether application data can be synchronized. + *

+ * + * @permission ohos.permission.DISTRIBUTED_DATASYNC + * @param { string } name - Indicates the name of the application account. + * @returns { Promise } Returns {@code true} if application data synchronization is allowed; returns {@code false} otherwise. + * @syscap SystemCapability.Account.AppAccount + * @since 7 + * @deprecated since 9 + * @useinstead appAccount.AppAccountManager#checkDataSyncEnabled + */ + checkAppAccountSyncEnable(name: string): Promise; + /** + * Checks whether application data synchronization is enabled for the specified account. + *

+ * If the same OHOS account has logged in to multiple devices, these devices constitute a super device + * through the distributed networking. On the connected devices, you can call this method to check + * whether application data can be synchronized. + *

+ * + * @permission ohos.permission.DISTRIBUTED_DATASYNC + * @param { string } name - Indicates the name of the application account. + * @param { AsyncCallback } callback - Asynchronous callback interface. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. + * @throws { BusinessError } 12300001 - System service exception. + * @throws { BusinessError } 12300002 - Invalid name. + * @throws { BusinessError } 12300003 - Account not found. + * @syscap SystemCapability.Account.AppAccount + * @since 9 + */ + checkDataSyncEnabled(name: string, callback: AsyncCallback): void; + /** + * Checks whether application data synchronization is enabled for the specified account. + *

+ * If the same OHOS account has logged in to multiple devices, these devices constitute a super device + * through the distributed networking. On the connected devices, you can call this method to check + * whether application data can be synchronized. + *

+ * + * @permission ohos.permission.DISTRIBUTED_DATASYNC + * @param { string } name - Indicates the name of the application account. + * @returns { Promise } Returns {@code true} if application data synchronization is allowed; returns {@code false} otherwise. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. + * @throws { BusinessError } 12300001 - System service exception. + * @throws { BusinessError } 12300002 - Invalid name. + * @throws { BusinessError } 12300003 - Account not found. + * @syscap SystemCapability.Account.AppAccount + * @since 9 + */ + checkDataSyncEnabled(name: string): Promise; + /** + * Sets the credential for this application account. + * + * @param { string } name - Indicates the name of the application account. + * @param { string } credentialType - Indicates the type of the credential to set. + * @param { string } credential - Indicates the credential to set. + * @param { AsyncCallback } callback - Asynchronous callback interface. + * @syscap SystemCapability.Account.AppAccount + * @since 7 + * @deprecated since 9 + * @useinstead appAccount.AppAccountManager#setCredential + */ + setAccountCredential(name: string, credentialType: string, credential: string, callback: AsyncCallback): void; + /** + * Sets the credential for this application account. + * + * @param { string } name - Indicates the name of the application account. + * @param { string } credentialType - Indicates the type of the credential to set. + * @param { string } credential - Indicates the credential to set. + * @returns { Promise } The promise returned by the function. + * @syscap SystemCapability.Account.AppAccount + * @since 7 + * @deprecated since 9 + * @useinstead appAccount.AppAccountManager#setCredential + */ + setAccountCredential(name: string, credentialType: string, credential: string): Promise; + /** + * Sets the credential for this application account. + * + * @param { string } name - Indicates the name of the application account. + * @param { string } credentialType - Indicates the type of the credential to set. + * @param { string } credential - Indicates the credential to set. + * @param { AsyncCallback } callback - Asynchronous callback interface. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. + * @throws { BusinessError } 12300001 - System service exception. + * @throws { BusinessError } 12300002 - Invalid name, credentialType or credential. + * @throws { BusinessError } 12300003 - Account not found. + * @syscap SystemCapability.Account.AppAccount + * @since 9 + */ + setCredential(name: string, credentialType: string, credential: string, callback: AsyncCallback): void; + /** + * Sets the credential for this application account. + * + * @param { string } name - Indicates the name of the application account. + * @param { string } credentialType - Indicates the type of the credential to set. + * @param { string } credential - Indicates the credential to set. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. + * @throws { BusinessError } 12300001 - System service exception. + * @throws { BusinessError } 12300002 - Invalid name, credentialType or credential. + * @throws { BusinessError } 12300003 - Account not found. + * @syscap SystemCapability.Account.AppAccount + * @since 9 + */ + setCredential(name: string, credentialType: string, credential: string): Promise; + /** + * Sets extra information for this application account. + *

+ * You can call this method when you forget the extra information of your application account or + * need to modify the extra information. + * + * @param { string } name - Indicates the name of the application account. + * @param { string } extraInfo - Indicates the extra information to set. + * @param { AsyncCallback } callback - Asynchronous callback interface. + * @syscap SystemCapability.Account.AppAccount + * @since 7 + * @deprecated since 9 + * @useinstead appAccount.AppAccountManager#setCustomData + */ + setAccountExtraInfo(name: string, extraInfo: string, callback: AsyncCallback): void; + /** + * Sets extra information for this application account. + *

+ * You can call this method when you forget the extra information of your application account or + * need to modify the extra information. + * + * @param { string } name - Indicates the name of the application account. + * @param { string } extraInfo - Indicates the extra information to set. + * @returns { Promise } The promise returned by the function. + * @syscap SystemCapability.Account.AppAccount + * @since 7 + * @deprecated since 9 + * @useinstead appAccount.AppAccountManager#setCustomData + */ + setAccountExtraInfo(name: string, extraInfo: string): Promise; + /** + * Sets whether a specified application account allows application data synchronization. + *

+ * If the same OHOS account has logged in to multiple devices, these devices constitute a super device + * through the distributed networking. On the connected devices, you can call this method to set whether to + * allow cross-device data synchronization. If synchronization is allowed, application data can be synchronized + * among these devices in the event of any changes related to the application account. + * If synchronization is not allowed, the application data is stored only on the local device. + *

+ * Application account-related changes: adding or deleting an application account, setting extra + * information (such as updating a token), and setting data associated with this application account + *

+ * Application data that can be synchronized: application account name, token, + * and data associated with this application account + *

+ * + * @permission ohos.permission.DISTRIBUTED_DATASYNC + * @param { string } name - Indicates the name of the application account. + * @param { boolean } isEnable - Specifies whether to allow application data synchronization. + * @param { AsyncCallback } callback - Asynchronous callback interface. + * @syscap SystemCapability.Account.AppAccount + * @since 7 + * @deprecated since 9 + * @useinstead appAccount.AppAccountManager#setDataSyncEnabled + */ + setAppAccountSyncEnable(name: string, isEnable: boolean, callback: AsyncCallback): void; + /** + * Sets whether a specified application account allows application data synchronization. + *

+ * If the same OHOS account has logged in to multiple devices, these devices constitute a super device + * through the distributed networking. On the connected devices, you can call this method to set whether to + * allow cross-device data synchronization. If synchronization is allowed, application data can be synchronized + * among these devices in the event of any changes related to the application account. + * If synchronization is not allowed, the application data is stored only on the local device. + *

+ * Application account-related changes: adding or deleting an application account, setting extra + * information (such as updating a token), and setting data associated with this application account + *

+ * Application data that can be synchronized: application account name, token, + * and data associated with this application account + *

+ * + * @permission ohos.permission.DISTRIBUTED_DATASYNC + * @param { string } name - Indicates the name of the application account. + * @param { boolean } isEnable - Specifies whether to allow application data synchronization. + * @returns { Promise } The promise returned by the function. + * @syscap SystemCapability.Account.AppAccount + * @since 7 + * @deprecated since 9 + * @useinstead appAccount.AppAccountManager#setDataSyncEnabled + */ + setAppAccountSyncEnable(name: string, isEnable: boolean): Promise; + /** + * Sets whether a specified application account enables application data synchronization. + *

+ * If the same OHOS account has logged in to multiple devices, these devices constitute a super device + * through the distributed networking. On the connected devices, you can call this method to set whether to + * enable cross-device data synchronization. If synchronization is enabled, application data can be synchronized + * among these devices in the event of any changes related to the application account. + * If synchronization is not enabled, the application data is stored only on the local device. + *

+ * Application account-related changes: adding or deleting an application account, setting extra + * information (such as updating a token), and setting data associated with this application account + *

+ * Application data that can be synchronized: application account name, token, + * and data associated with this application account + *

+ * + * @permission ohos.permission.DISTRIBUTED_DATASYNC + * @param { string } name - Indicates the name of the application account. + * @param { boolean } isEnabled - Specifies whether to enable application data synchronization. + * @param { AsyncCallback } callback - Asynchronous callback interface. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. + * @throws { BusinessError } 12300001 - System service exception. + * @throws { BusinessError } 12300002 - Invalid name. + * @throws { BusinessError } 12300003 - Account not found. + * @syscap SystemCapability.Account.AppAccount + * @since 9 + */ + setDataSyncEnabled(name: string, isEnabled: boolean, callback: AsyncCallback): void; + /** + * Sets whether a specified application account enables application data synchronization. + *

+ * If the same OHOS account has logged in to multiple devices, these devices constitute a super device + * through the distributed networking. On the connected devices, you can call this method to set whether to + * enable cross-device data synchronization. If synchronization is enabled, application data can be synchronized + * among these devices in the event of any changes related to the application account. + * If synchronization is not enabled, the application data is stored only on the local device. + *

+ * Application account-related changes: adding or deleting an application account, setting extra + * information (such as updating a token), and setting data associated with this application account + *

+ * Application data that can be synchronized: application account name, token, + * and data associated with this application account + *

+ * + * @permission ohos.permission.DISTRIBUTED_DATASYNC + * @param { string } name - Indicates the name of the application account. + * @param { boolean } isEnabled - Specifies whether to enable application data synchronization. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. + * @throws { BusinessError } 12300001 - System service exception. + * @throws { BusinessError } 12300002 - Invalid name. + * @throws { BusinessError } 12300003 - Account not found. + * @syscap SystemCapability.Account.AppAccount + * @since 9 + */ + setDataSyncEnabled(name: string, isEnabled: boolean): Promise; + /** + * Sets data associated with this application account. + * + * @param { string } name - Indicates the name of the application account. + * @param { string } key - Indicates the key of the data to set. The key can be customized. + * @param { string } value - Indicates the value of the data to set. + * @param { AsyncCallback } callback - Asynchronous callback interface. + * @syscap SystemCapability.Account.AppAccount + * @since 7 + * @deprecated since 9 + * @useinstead appAccount.AppAccountManager#setCustomData + */ + setAssociatedData(name: string, key: string, value: string, callback: AsyncCallback): void; + /** + * Sets data associated with this application account. + * + * @param { string } name - Indicates the name of the application account. + * @param { string } key - Indicates the key of the data to set. The key can be customized. + * @param { string } value - Indicates the value of the data to set. + * @returns { Promise } The promise returned by the function. + * @syscap SystemCapability.Account.AppAccount + * @since 7 + * @deprecated since 9 + * @useinstead appAccount.AppAccountManager#setCustomData + */ + setAssociatedData(name: string, key: string, value: string): Promise; + /** + * Sets data associated with this application account. + * + * @param { string } name - Indicates the name of the application account. + * @param { string } key - Indicates the key of the data to set. The key can be customized. + * @param { string } value - Indicates the value of the data to set. + * @param { AsyncCallback } callback - Asynchronous callback interface. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. + * @throws { BusinessError } 12300001 - System service exception. + * @throws { BusinessError } 12300002 - Invalid name, key or value. + * @throws { BusinessError } 12300003 - Account not found. + * @throws { BusinessError } 12400003 - The number of custom data reaches the upper limit. + * @syscap SystemCapability.Account.AppAccount + * @since 9 + */ + setCustomData(name: string, key: string, value: string, callback: AsyncCallback): void; + /** + * Sets data associated with this application account. + * + * @param { string } name - Indicates the name of the application account. + * @param { string } key - Indicates the key of the data to set. The key can be customized. + * @param { string } value - Indicates the value of the data to set. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. + * @throws { BusinessError } 12300001 - System service exception. + * @throws { BusinessError } 12300002 - Invalid name, key or value. + * @throws { BusinessError } 12300003 - Account not found. + * @throws { BusinessError } 12400003 - The number of custom data reaches the upper limit. + * @syscap SystemCapability.Account.AppAccount + * @since 9 + */ + setCustomData(name: string, key: string, value: string): Promise; + /** + * Obtains information about all accessible accounts. + * This method applies to the following accounts: + *
Accounts of this application. + *
Accounts of third-party applications. To obtain such information, + *
your application must have gained authorization from the third-party applications. + * + * @permission ohos.permission.GET_ALL_APP_ACCOUNTS + * @param { AsyncCallback> } callback - Asynchronous callback interface. + * @syscap SystemCapability.Account.AppAccount + * @since 7 + * @deprecated since 9 + * @useinstead appAccount.AppAccountManager#getAllAccounts + */ + getAllAccessibleAccounts(callback: AsyncCallback>): void; + /** + * Obtains information about all accessible accounts. + * This method applies to the following accounts: + *
Accounts of this application. + *
Accounts of third-party applications. To obtain such information, + *
your application must have gained authorization from the third-party applications. + * + * @permission ohos.permission.GET_ALL_APP_ACCOUNTS + * @returns { Promise> } Returns a list of application accounts. + * @syscap SystemCapability.Account.AppAccount + * @since 7 + * @deprecated since 9 + * @useinstead appAccount.AppAccountManager#getAllAccounts + */ + getAllAccessibleAccounts(): Promise>; + /** + * Obtains information about all accessible accounts. + * This method applies to the following accounts: + *
Accounts of this application. + *
Accounts of third-party applications. To obtain such information, + *
your application must have gained authorization from the third-party applications or + *
have gained the ohos.permission.GET_ALL_APP_ACCOUNTS permission. + * + * @param { AsyncCallback> } callback - Asynchronous callback interface. Returns a list of application accounts. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. + * @throws { BusinessError } 12300001 - System service exception. + * @syscap SystemCapability.Account.AppAccount + * @since 9 + */ + getAllAccounts(callback: AsyncCallback>): void; + /** + * Obtains information about all accessible accounts. + * This method applies to the following accounts: + *
Accounts of this application. + *
Accounts of third-party applications. To obtain such information, + *
your application must have gained authorization from the third-party applications or + *
have gained the ohos.permission.GET_ALL_APP_ACCOUNTS permission. + * + * @returns { Promise> } Returns a list of application accounts. + * @throws { BusinessError } 12300001 - System service exception. + * @syscap SystemCapability.Account.AppAccount + * @since 9 + */ + getAllAccounts(): Promise>; + /** + * Obtains information about all accounts of a specified account owner. + * This method applies to the following accounts: + *
Accounts of this application. + *
Accounts of third-party applications. To obtain such information, + *
your application must have gained authorization from the third-party applications. + * + * @permission ohos.permission.GET_ALL_APP_ACCOUNTS + * @param { string } owner - Indicates the account owner of your application or third-party applications. + * @param { AsyncCallback> } callback - Asynchronous callback interface. Returns a list of application accounts. + * @syscap SystemCapability.Account.AppAccount + * @since 7 + * @deprecated since 9 + * @useinstead appAccount.AppAccountManager#getAccountsByOwner + */ + getAllAccounts(owner: string, callback: AsyncCallback>): void; + /** + * Obtains information about all accounts of a specified account owner. + * This method applies to the following accounts: + *
Accounts of this application. + *
Accounts of third-party applications. To obtain such information, + *
your application must have gained authorization from the third-party applications. + * + * @permission ohos.permission.GET_ALL_APP_ACCOUNTS + * @param { string } owner - Indicates the account owner of your application or third-party applications. + * @returns { Promise> } Returns a list of application accounts. + * @syscap SystemCapability.Account.AppAccount + * @since 7 + * @deprecated since 9 + * @useinstead appAccount.AppAccountManager#getAccountsByOwner + */ + getAllAccounts(owner: string): Promise>; + /** + * Gets information about all accounts of a specified account owner. + * This method applies to the following accounts: + *
Accounts of this application. + *
Accounts of third-party applications. To obtain such information, + *
your application must have gained authorization from the third-party applications or + *
have gained the ohos.permission.GET_ALL_APP_ACCOUNTS permission. + * + * @param { string } owner - Indicates the account owner of your application or third-party applications. + * @param { AsyncCallback> } callback - Asynchronous callback interface. Returns a list of application accounts. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. + * @throws { BusinessError } 12300001 - System service exception. + * @throws { BusinessError } 12300002 - Invalid owner. + * @throws { BusinessError } 12400001 - Application not found. + * @syscap SystemCapability.Account.AppAccount + * @since 9 + */ + getAccountsByOwner(owner: string, callback: AsyncCallback>): void; + /** + * Gets information about all accounts of a specified account owner. + * This method applies to the following accounts: + *
Accounts of this application. + *
Accounts of third-party applications. To obtain such information, + *
your application must have gained authorization from the third-party applications or + *
have gained the ohos.permission.GET_ALL_APP_ACCOUNTS permission. + * + * @param { string } owner - Indicates the account owner of your application or third-party applications. + * @returns { Promise> } Returns a list of application accounts. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. + * @throws { BusinessError } 12300001 - System service exception. + * @throws { BusinessError } 12300002 - Invalid owner. + * @throws { BusinessError } 12400001 - Application not found. + * @syscap SystemCapability.Account.AppAccount + * @since 9 + */ + getAccountsByOwner(owner: string): Promise>; + /** + * Obtains the credential of this application account. + * + * @param { string } name - Indicates the name of the application account. + * @param { string } credentialType - Indicates the type of the credential to obtain. + * @param { AsyncCallback } callback - Asynchronous callback interface. Returns the credential of the application account. + * @syscap SystemCapability.Account.AppAccount + * @since 7 + * @deprecated since 9 + * @useinstead appAccount.AppAccountManager#getCredential + */ + getAccountCredential(name: string, credentialType: string, callback: AsyncCallback): void; + /** + * Obtains the credential of this application account. + * + * @param { string } name - Indicates the name of the application account. + * @param { string } credentialType - Indicates the type of the credential to obtain. + * @returns { Promise } Returns the credential of the application account. + * @syscap SystemCapability.Account.AppAccount + * @since 7 + * @deprecated since 9 + * @useinstead appAccount.AppAccountManager#getCredential + */ + getAccountCredential(name: string, credentialType: string): Promise; + /** + * Obtains the credential of this application account. + * + * @param { string } name - Indicates the name of the application account. + * @param { string } credentialType - Indicates the type of the credential to obtain. + * @param { AsyncCallback } callback - Asynchronous callback interface. Returns the credential of the application account. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. + * @throws { BusinessError } 12300001 - System service exception. + * @throws { BusinessError } 12300002 - Invalid name or credentialType. + * @throws { BusinessError } 12300003 - Account not found. + * @throws { BusinessError } 12300102 - Credential not found. + * @syscap SystemCapability.Account.AppAccount + * @since 9 + */ + getCredential(name: string, credentialType: string, callback: AsyncCallback): void; + /** + * Obtains the credential of this application account. + * + * @param { string } name - Indicates the name of the application account. + * @param { string } credentialType - Indicates the type of the credential to obtain. + * @returns { Promise } Returns the credential of the application account. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. + * @throws { BusinessError } 12300001 - System service exception. + * @throws { BusinessError } 12300002 - Invalid name or credentialType. + * @throws { BusinessError } 12300003 - Account not found. + * @throws { BusinessError } 12300102 - Credential not found. + * @syscap SystemCapability.Account.AppAccount + * @since 9 + */ + getCredential(name: string, credentialType: string): Promise; + /** + * Obtains extra information of this application account. + * + * @param { string } name - Indicates the name of the application account. + * @param { AsyncCallback } callback - Asynchronous callback interface. + * Returns the extra information of the account; returns {@code null} in other scenarios, + * for example, if the account does not exist. + * @syscap SystemCapability.Account.AppAccount + * @since 7 + * @deprecated since 9 + * @useinstead appAccount.AppAccountManager#getCustomData + */ + getAccountExtraInfo(name: string, callback: AsyncCallback): void; + /** + * Obtains extra information of this application account. + * + * @param { string } name - Indicates the name of the application account. + * @returns { Promise } Returns the extra information of the account; returns {@code null} in other scenarios, + * for example, if the account does not exist. + * @syscap SystemCapability.Account.AppAccount + * @since 7 + * @deprecated since 9 + * @useinstead appAccount.AppAccountManager#getCustomData + */ + getAccountExtraInfo(name: string): Promise; + /** + * Obtains data associated with this application account. + * + * @param { string } name - Indicates the name of the application account. + * @param { string } key - Indicates the key of the data to obtain. + * @param { AsyncCallback } callback - Asynchronous callback interface. Returns the associated data of the application account. + * @syscap SystemCapability.Account.AppAccount + * @since 7 + * @deprecated since 9 + * @useinstead appAccount.AppAccountManager#getCustomData + */ + getAssociatedData(name: string, key: string, callback: AsyncCallback): void; + /** + * Obtains data associated with this application account. + * + * @param { string } name - Indicates the name of the application account. + * @param { string } key - Indicates the key of the data to obtain. + * @returns { Promise } Returns the associated data of the application account. + * @syscap SystemCapability.Account.AppAccount + * @since 7 + * @deprecated since 9 + * @useinstead appAccount.AppAccountManager#getCustomData + */ + getAssociatedData(name: string, key: string): Promise; + /** + * Obtains data associated with this application account. + * + * @param { string } name - Indicates the name of the application account. + * @param { string } key - Indicates the key of the data to obtain. + * @param { AsyncCallback } callback - Asynchronous callback interface. Returns the associated data of the application account. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. + * @throws { BusinessError } 12300001 - System service exception. + * @throws { BusinessError } 12300002 - Invalid name or key. + * @throws { BusinessError } 12300003 - Account not found. + * @throws { BusinessError } 12400002 - Custom data not found. + * @syscap SystemCapability.Account.AppAccount + * @since 9 + */ + getCustomData(name: string, key: string, callback: AsyncCallback): void; + /** + * Obtains data associated with this application account. + * + * @param { string } name - Indicates the name of the application account. + * @param { string } key - Indicates the key of the data to obtain. + * @returns { Promise } Returns the associated data of the application account. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. + * @throws { BusinessError } 12300001 - System service exception. + * @throws { BusinessError } 12300002 - Invalid name or key. + * @throws { BusinessError } 12300003 - Account not found. + * @throws { BusinessError } 12400002 - Custom data not found + * @syscap SystemCapability.Account.AppAccount + * @since 9 + */ + getCustomData(name: string, key: string): Promise; + /** + * Obtains data associated with the specified account synchronously. + * + * @param { string } name - Indicates the name of the application account. + * @param { string } key - Indicates the key of the data to obtain. + * @returns { string } Returns the associated data of the application account. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. + * @throws { BusinessError } 12300001 - System service exception. + * @throws { BusinessError } 12300002 - Invalid name or key. + * @throws { BusinessError } 12300003 - Account not found. + * @throws { BusinessError } 12400002 - Custom data not found. + * @syscap SystemCapability.Account.AppAccount + * @since 9 + */ + getCustomDataSync(name: string, key: string): string; + /** + * Subscribes to the change events of accounts of the specified owners. + *

+ * When the account owner updates the account, the subscriber will receive a notification + * about the account change event. + * + * @param { 'change' } type - Event type. + * @param { Array } owners - Indicates the account owners, which are specified + * by {@link AppAccount#AppAccount(String name, String owner)}. + * @param { Callback> } callback - Asynchronous callback interface. + * @syscap SystemCapability.Account.AppAccount + * @since 7 + * @deprecated since 9 + * @useinstead appAccount.AppAccountManager#on + */ + on(type: 'change', owners: Array, callback: Callback>): void; + /** + * Subscribes to the change events of accounts of the specified owners. + *

+ * When the account owner updates the account, the subscriber will receive a notification + * about the account change event. + * + * @param { 'accountChange' } type - Event type. + * @param { Array } owners - Indicates the account owners, which are specified + * by {@link AppAccount#AppAccount(String name, String owner)}. + * @param { Callback> } callback - Asynchronous callback interface. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. + * @throws { BusinessError } 12300001 - System service exception. + * @throws { BusinessError } 12300002 - Invalid type or owners. + * @throws { BusinessError } 12400001 - Application not found. + * @syscap SystemCapability.Account.AppAccount + * @since 9 + */ + on(type: 'accountChange', owners: Array, callback: Callback>): void; + /** + * Unsubscribes from account events. + * + * @param { 'change' } type - Event type. + * @param { Callback> } [callback] - Asynchronous callback interface. + * @syscap SystemCapability.Account.AppAccount + * @since 7 + * @deprecated since 9 + * @useinstead appAccount.AppAccountManager#off + */ + off(type: 'change', callback?: Callback>): void; + /** + * Unsubscribes from account events. + * + * @param { 'accountChange' } type - Event type. + * @param { Callback> } [callback] - Asynchronous callback interface. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. + * @throws { BusinessError } 12300001 - System service exception. + * @throws { BusinessError } 12300002 - Invalid type. + * @syscap SystemCapability.Account.AppAccount + * @since 9 + */ + off(type: 'accountChange', callback?: Callback>): void; + /** + * Authenticates an application account to get an oauth token. + * + * @param { string } name - Indicates the account name of your application or third-party applications. + * @param { string } owner - Indicates the account owner of your application or third-party applications. + * @param { string } authType - Indicates the authentication type. + * @param { object } options - Indicates the authenticator-specific options for the request. + * @param { AuthenticatorCallback } callback - Indicates the authenticator callback. + * @syscap SystemCapability.Account.AppAccount + * @since 8 + * @deprecated since 9 + * @useinstead appAccount.AppAccountManager#auth + */ + authenticate(name: string, owner: string, authType: string, options: { + [key: string]: any; + }, callback: AuthenticatorCallback): void; + /** + * Authenticates an application account to get an auth token. + * + * @param { string } name - Indicates the account name of your application or third-party applications. + * @param { string } owner - Indicates the account owner of your application or third-party applications. + * @param { string } authType - Indicates the authentication type. + * @param { AuthCallback } callback - Indicates the authenticator callback. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. + * @throws { BusinessError } 12300001 - System service exception. + * @throws { BusinessError } 12300002 - Invalid name, owner or authType. + * @throws { BusinessError } 12300003 - Account not found. + * @throws { BusinessError } 12300010 - Account service busy. + * @throws { BusinessError } 12300113 - Authenticator service not found. + * @throws { BusinessError } 12300114 - Authenticator service exception. + * @syscap SystemCapability.Account.AppAccount + * @since 9 + */ + auth(name: string, owner: string, authType: string, callback: AuthCallback): void; + /** + * Authenticates an application account to get an auth token. + * + * @param { string } name - Indicates the account name of your application or third-party applications. + * @param { string } owner - Indicates the account owner of your application or third-party applications. + * @param { string } authType - Indicates the authentication type. + * @param { Record } options - Indicates the authenticator-specific options for the request. + * @param { AuthCallback } callback - Indicates the authenticator callback. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. + * @throws { BusinessError } 12300001 - System service exception. + * @throws { BusinessError } 12300002 - Invalid name, owner, authType or options. + * @throws { BusinessError } 12300003 - Account not found. + * @throws { BusinessError } 12300010 - Account service busy. + * @throws { BusinessError } 12300113 - Authenticator service not found. + * @throws { BusinessError } 12300114 - Authenticator service exception. + * @syscap SystemCapability.Account.AppAccount + * @since 9 + */ + auth(name: string, owner: string, authType: string, options: Record, callback: AuthCallback): void; + /** + * Gets an oauth token with the specified authentication type from a particular application account. + * + * @param { string } name - Indicates the account name of your application or third-party applications. + * @param { string } owner - Indicates the account owner of your application or third-party applications. + * @param { string } authType - Indicates the authentication type. + * @param { AsyncCallback } callback - Asynchronous callback interface. Returns an oauth token. + * @syscap SystemCapability.Account.AppAccount + * @since 8 + * @deprecated since 9 + * @useinstead appAccount.AppAccountManager#getAuthToken + */ + getOAuthToken(name: string, owner: string, authType: string, callback: AsyncCallback): void; + /** + * Gets an oauth token with the specified authentication type from a particular application account. + * + * @param { string } name - Indicates the account name of your application or third-party applications. + * @param { string } owner - Indicates the account owner of your application or third-party applications. + * @param { string } authType - Indicates the authentication type. + * @returns { Promise } Returns an oauth token. + * @syscap SystemCapability.Account.AppAccount + * @since 8 + * @deprecated since 9 + * @useinstead appAccount.AppAccountManager#getAuthToken + */ + getOAuthToken(name: string, owner: string, authType: string): Promise; + /** + * Gets an auth token with the specified authentication type from a particular application account. + * + * @param { string } name - Indicates the account name of your application or third-party applications. + * @param { string } owner - Indicates the account owner of your application or third-party applications. + * @param { string } authType - Indicates the authentication type. + * @param { AsyncCallback } callback - Asynchronous callback interface. Returns an auth token. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. + * @throws { BusinessError } 12300001 - System service exception. + * @throws { BusinessError } 12300002 - Invalid name, owner or authType. + * @throws { BusinessError } 12300003 - Account not found. + * @throws { BusinessError } 12300107 - AuthType not found. + * @syscap SystemCapability.Account.AppAccount + * @since 9 + */ + getAuthToken(name: string, owner: string, authType: string, callback: AsyncCallback): void; + /** + * Gets an auth token with the specified authentication type from a particular application account. + * + * @param { string } name - Indicates the account name of your application or third-party applications. + * @param { string } owner - Indicates the account owner of your application or third-party applications. + * @param { string } authType - Indicates the authentication type. + * @returns { Promise } Returns an auth token. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. + * @throws { BusinessError } 12300001 - System service exception. + * @throws { BusinessError } 12300002 - Invalid name, owner or authType. + * @throws { BusinessError } 12300003 - Account not found. + * @throws { BusinessError } 12300107 - AuthType not found. + * @syscap SystemCapability.Account.AppAccount + * @since 9 + */ + getAuthToken(name: string, owner: string, authType: string): Promise; + /** + * Sets an oauth token with the specified authentication type for a particular account. + *

+ * Only the owner of the application account has the permission to call this method. + * + * @param { string } name - Indicates the account name of your application. + * @param { string } authType - Indicates the authentication type. + * @param { string } token - Indicates the oauth token. + * @param { AsyncCallback } callback - Asynchronous callback interface. + * @syscap SystemCapability.Account.AppAccount + * @since 8 + * @deprecated since 9 + * @useinstead appAccount.AppAccountManager#setAuthToken + */ + setOAuthToken(name: string, authType: string, token: string, callback: AsyncCallback): void; + /** + * Sets an oauth token with the specified authentication type for a particular account. + *

+ * Only the owner of the application account has the permission to call this method. + * + * @param { string } name - Indicates the account name of your application. + * @param { string } authType - Indicates the authentication type. + * @param { string } token - Indicates the oauth token. + * @returns { Promise } The promise returned by the function. + * @syscap SystemCapability.Account.AppAccount + * @since 8 + * @deprecated since 9 + * @useinstead appAccount.AppAccountManager#setAuthToken + */ + setOAuthToken(name: string, authType: string, token: string): Promise; + /** + * Sets an auth token with the specified authentication type for a particular account. + *

+ * Only the owner of the application account has the permission to call this method. + * + * @param { string } name - Indicates the account name of your application. + * @param { string } authType - Indicates the authentication type. + * @param { string } token - Indicates the auth token. + * @param { AsyncCallback } callback - Asynchronous callback interface. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. + * @throws { BusinessError } 12300001 - System service exception. + * @throws { BusinessError } 12300002 - Invalid name, authType or token. + * @throws { BusinessError } 12300003 - Account not found. + * @throws { BusinessError } 12400004 - The number of tokens reaches the upper limit. + * @syscap SystemCapability.Account.AppAccount + * @since 9 + */ + setAuthToken(name: string, authType: string, token: string, callback: AsyncCallback): void; + /** + * Sets an auth token with the specified authentication type for a particular account. + *

+ * Only the owner of the application account has the permission to call this method. + * + * @param { string } name - Indicates the account name of your application. + * @param { string } authType - Indicates the authentication type. + * @param { string } token - Indicates the auth token. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. + * @throws { BusinessError } 12300001 - System service exception. + * @throws { BusinessError } 12300002 - Invalid name, authType or token. + * @throws { BusinessError } 12300003 - Account not found. + * @throws { BusinessError } 12400004 - The number of tokens reaches the upper limit. + * @syscap SystemCapability.Account.AppAccount + * @since 9 + */ + setAuthToken(name: string, authType: string, token: string): Promise; + /** + * Deletes an oauth token for the specified application account. + *

+ * Only tokens visible to the caller application can be deleted. + * + * @param { string } name - Indicates the account name of your application or third-party applications. + * @param { string } owner - Indicates the account owner of your application or third-party applications. + * @param { string } authType - Indicates the authentication type. + * @param { string } token - Indicates the oauth token. + * @param { AsyncCallback } callback Asynchronous callback interface. + * @syscap SystemCapability.Account.AppAccount + * @since 8 + * @deprecated since 9 + * @useinstead appAccount.AppAccountManager#deleteAuthToken + */ + deleteOAuthToken(name: string, owner: string, authType: string, token: string, callback: AsyncCallback): void; + /** + * Deletes an oauth token for the specified application account. + *

+ * Only tokens visible to the caller application can be deleted. + * + * @param { string } name - Indicates the account name of your application or third-party applications. + * @param { string } owner - Indicates the account owner of your application or third-party applications. + * @param { string } authType - Indicates the authentication type. + * @param { string } token - Indicates the oauth token. + * @returns { Promise } The promise returned by the function. + * @syscap SystemCapability.Account.AppAccount + * @since 8 + * @deprecated since 9 + * @useinstead appAccount.AppAccountManager#deleteAuthToken + */ + deleteOAuthToken(name: string, owner: string, authType: string, token: string): Promise; + /** + * Deletes an auth token for the specified application account. + *

+ * Only tokens visible to the caller application can be deleted. + * + * @param { string } name - Indicates the account name of your application or third-party applications. + * @param { string } owner - Indicates the account owner of your application or third-party applications. + * @param { string } authType - Indicates the authentication type. + * @param { string } token - Indicates the auth token. + * @param { AsyncCallback } callback - Asynchronous callback interface. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. + * @throws { BusinessError } 12300001 - System service exception. + * @throws { BusinessError } 12300002 - Invalid name, owner, authType or token. + * @throws { BusinessError } 12300003 - Account not found. + * @throws { BusinessError } 12300107 - AuthType not found. + * @syscap SystemCapability.Account.AppAccount + * @since 9 + */ + deleteAuthToken(name: string, owner: string, authType: string, token: string, callback: AsyncCallback): void; + /** + * Deletes an auth token for the specified application account. + *

+ * Only tokens visible to the caller application can be deleted. + * + * @param { string } name - Indicates the account name of your application or third-party applications. + * @param { string } owner - Indicates the account owner of your application or third-party applications. + * @param { string } authType - Indicates the authentication type. + * @param { string } token - Indicates the auth token. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. + * @throws { BusinessError } 12300001 - System service exception. + * @throws { BusinessError } 12300002 - Invalid name, owner, authType or token. + * @throws { BusinessError } 12300003 - Account not found. + * @throws { BusinessError } 12300107 - AuthType not found. + * @syscap SystemCapability.Account.AppAccount + * @since 9 + */ + deleteAuthToken(name: string, owner: string, authType: string, token: string): Promise; + /** + * Sets the oauth token visibility of the specified authentication type to a third-party application. + *

+ * Only the owner of the application account has the permission to call this method. + * + * @param { string } name - Indicates the account name of your application. + * @param { string } authType - Indicates the authentication type. + * @param { string } bundleName - Indicates the bundle name of the third-party application. + * @param { boolean } isVisible - Indicates the bool value of visibility. + * @param { AsyncCallback } callback - Asynchronous callback interface. + * @syscap SystemCapability.Account.AppAccount + * @since 8 + * @deprecated since 9 + * @useinstead appAccount.AppAccountManager#setAuthTokenVisibility + */ + setOAuthTokenVisibility(name: string, authType: string, bundleName: string, isVisible: boolean, callback: AsyncCallback): void; + /** + * Sets the oauth token visibility of the specified authentication type to a third-party application. + *

+ * Only the owner of the application account has the permission to call this method. + * + * @param { string } name - Indicates the account name of your application. + * @param { string } authType - Indicates the authentication type. + * @param { string } bundleName - Indicates the bundle name of the third-party application. + * @param { boolean } isVisible - Indicates the bool value of visibility. + * @returns { Promise } The promise returned by the function. + * @syscap SystemCapability.Account.AppAccount + * @since 8 + * @deprecated since 9 + * @useinstead appAccount.AppAccountManager#setAuthTokenVisibility + */ + setOAuthTokenVisibility(name: string, authType: string, bundleName: string, isVisible: boolean): Promise; + /** + * Sets the auth token visibility of the specified authentication type to a third-party application. + *

+ * Only the owner of the application account has the permission to call this method. + * + * @param { string } name - Indicates the account name of your application. + * @param { string } authType - Indicates the authentication type. + * @param { string } bundleName - Indicates the bundle name of the third-party application. + * @param { boolean } isVisible - Indicates the bool value of visibility. + * @param { AsyncCallback } callback - Asynchronous callback interface. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. + * @throws { BusinessError } 12300001 - System service exception. + * @throws { BusinessError } 12300002 - Invalid name, authType or bundleName. + * @throws { BusinessError } 12300003 - Account not found. + * @throws { BusinessError } 12300107 - AuthType not found. + * @throws { BusinessError } 12400001 - Application not found. + * @throws { BusinessError } 12400005 - The size of authorization list reaches the upper limit. + * @syscap SystemCapability.Account.AppAccount + * @since 9 + */ + setAuthTokenVisibility(name: string, authType: string, bundleName: string, isVisible: boolean, callback: AsyncCallback): void; + /** + * Sets the auth token visibility of the specified authentication type to a third-party application. + *

+ * Only the owner of the application account has the permission to call this method. + * + * @param { string } name - Indicates the account name of your application. + * @param { string } authType - Indicates the authentication type. + * @param { string } bundleName - Indicates the bundle name of the third-party application. + * @param { boolean } isVisible - Indicates the bool value of visibility. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. + * @throws { BusinessError } 12300001 - System service exception. + * @throws { BusinessError } 12300002 - Invalid name, authType or bundleName. + * @throws { BusinessError } 12300003 - Account not found. + * @throws { BusinessError } 12300107 - AuthType not found. + * @throws { BusinessError } 12400001 - Application not found. + * @throws { BusinessError } 12400005 - The size of authorization list reaches the upper limit. + * @syscap SystemCapability.Account.AppAccount + * @since 9 + */ + setAuthTokenVisibility(name: string, authType: string, bundleName: string, isVisible: boolean): Promise; + /** + * Checks the oauth token visibility of the specified authentication type for a third-party application. + *

+ * Only the owner of the application account has the permission to call this method. + * + * @param { string } name - Indicates the account name of your application or third-party applications. + * @param { string } authType - Indicates the authentication type. + * @param { string } bundleName - Indicates the bundle name of the third-party application. + * @param { AsyncCallback } callback - Asynchronous callback interface. Returns the bool value of visibility. + * @syscap SystemCapability.Account.AppAccount + * @since 8 + * @deprecated since 9 + * @useinstead appAccount.AppAccountManager#checkAuthTokenVisibility + */ + checkOAuthTokenVisibility(name: string, authType: string, bundleName: string, callback: AsyncCallback): void; + /** + * Checks the oauth token visibility of the specified authentication type for a third-party application. + *

+ * Only the owner of the application account has the permission to call this method. + * + * @param { string } name - Indicates the account name of your application or third-party applications. + * @param { string } authType - Indicates the authentication type. + * @param { string } bundleName - Indicates the bundle name of the third-party application. + * @returns { Promise } Returns the bool value of visibility. + * @syscap SystemCapability.Account.AppAccount + * @since 8 + * @deprecated since 9 + * @useinstead appAccount.AppAccountManager#checkAuthTokenVisibility + */ + checkOAuthTokenVisibility(name: string, authType: string, bundleName: string): Promise; + /** + * Checks the auth token visibility of the specified authentication type for a third-party application. + *

+ * Only the owner of the application account has the permission to call this method. + * + * @param { string } name - Indicates the account name of your application or third-party applications. + * @param { string } authType - Indicates the authentication type. + * @param { string } bundleName - Indicates the bundle name of the third-party application. + * @param { AsyncCallback } callback - Asynchronous callback interface. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. + * @throws { BusinessError } 12300001 - System service exception. + * @throws { BusinessError } 12300002 - Invalid name, authType or bundleName. + * @throws { BusinessError } 12300003 - Account not found. + * @throws { BusinessError } 12300107 - AuthType not found. + * @syscap SystemCapability.Account.AppAccount + * @since 9 + */ + checkAuthTokenVisibility(name: string, authType: string, bundleName: string, callback: AsyncCallback): void; + /** + * Checks the auth token visibility of the specified authentication type for a third-party application. + *

+ * Only the owner of the application account has the permission to call this method. + * + * @param { string } name - Indicates the account name of your application or third-party applications. + * @param { string } authType - Indicates the authentication type. + * @param { string } bundleName - Indicates the bundle name of the third-party application. + * @returns { Promise } Returns the bool value of visibility. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. + * @throws { BusinessError } 12300001 - System service exception. + * @throws { BusinessError } 12300002 - Invalid name, authType or bundleName. + * @throws { BusinessError } 12300003 - Account not found. + * @throws { BusinessError } 12300107 - AuthType not found. + * @syscap SystemCapability.Account.AppAccount + * @since 9 + */ + checkAuthTokenVisibility(name: string, authType: string, bundleName: string): Promise; + /** + * Gets all oauth tokens visible to the caller application. + * + * @param { string } name - Indicates the account name of your application or third-party applications. + * @param { string } owner - Indicates the account owner of your application or third-party applications. + * @param { AsyncCallback> } callback - Asynchronous callback interface. + * @syscap SystemCapability.Account.AppAccount + * @since 8 + * @deprecated since 9 + * @useinstead appAccount.AppAccountManager#getAllAuthTokens + */ + getAllOAuthTokens(name: string, owner: string, callback: AsyncCallback>): void; + /** + * Gets all oauth tokens visible to the caller application. + * + * @param { string } name - Indicates the account name of your application or third-party applications. + * @param { string } owner - Indicates the account owner of your application or third-party applications. + * @returns { Promise> } Returns a list of oauth tokens visible to the caller application. + * @syscap SystemCapability.Account.AppAccount + * @since 8 + * @deprecated since 9 + * @useinstead appAccount.AppAccountManager#getAllAuthTokens + */ + getAllOAuthTokens(name: string, owner: string): Promise>; + /** + * Gets all auth tokens visible to the caller application. + * + * @param { string } name - Indicates the account name of your application or third-party applications. + * @param { string } owner - Indicates the account owner of your application or third-party applications. + * @param { AsyncCallback> } callback - Asynchronous callback interface. + * Returns a list of auth tokens visible to the caller application. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. + * @throws { BusinessError } 12300001 - System service exception. + * @throws { BusinessError } 12300002 - Invalid name or owner. + * @throws { BusinessError } 12300003 - Account not found. + * @syscap SystemCapability.Account.AppAccount + * @since 9 + */ + getAllAuthTokens(name: string, owner: string, callback: AsyncCallback>): void; + /** + * Gets all auth tokens visible to the caller application. + * + * @param { string } name - Indicates the account name of your application or third-party applications. + * @param { string } owner - Indicates the account owner of your application or third-party applications. + * @returns { Promise> } Returns a list of auth tokens visible to the caller application. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. + * @throws { BusinessError } 12300001 - System service exception. + * @throws { BusinessError } 12300002 - Invalid name or owner. + * @throws { BusinessError } 12300003 - Account not found. + * @syscap SystemCapability.Account.AppAccount + * @since 9 + */ + getAllAuthTokens(name: string, owner: string): Promise>; + /** + * Gets the open authorization list with a specified authentication type for a particular application account. + *

+ * Only the owner of the application account has the permission to call this method. + * + * @param { string } name - Indicates the account name of your application. + * @param { string } authType - Indicates the authentication type. + * @param { AsyncCallback> } callback - Asynchronous callback interface. + * Returns the open authorization list of the specified authentication type. + * @syscap SystemCapability.Account.AppAccount + * @since 8 + * @deprecated since 9 + * @useinstead appAccount.AppAccountManager#getAuthList + */ + getOAuthList(name: string, authType: string, callback: AsyncCallback>): void; + /** + * Gets the open authorization list with a specified authentication type for a particular application account. + *

+ * Only the owner of the application account has the permission to call this method. + * + * @param { string } name - Indicates the account name of your application. + * @param { string } authType - Indicates the authentication type. + * @returns { Promise> } Returns the open authorization list of the specified authentication type. + * @syscap SystemCapability.Account.AppAccount + * @since 8 + * @deprecated since 9 + * @useinstead appAccount.AppAccountManager#getAuthList + */ + getOAuthList(name: string, authType: string): Promise>; + /** + * Gets the open authorization list with a specified authentication type for a particular application account. + *

+ * Only the owner of the application account has the permission to call this method. + * + * @param { string } name - Indicates the account name of your application. + * @param { string } authType - Indicates the authentication type. + * @param { AsyncCallback> } callback - Asynchronous callback interface. + * Returns the open authorization list of the specified authentication type. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. + * @throws { BusinessError } 12300001 - System service exception. + * @throws { BusinessError } 12300002 - Invalid name or authType. + * @throws { BusinessError } 12300003 - Account not found. + * @throws { BusinessError } 12300107 - AuthType not found. + * @syscap SystemCapability.Account.AppAccount + * @since 9 + */ + getAuthList(name: string, authType: string, callback: AsyncCallback>): void; + /** + * Gets the open authorization list with a specified authentication type for a particular application account. + *

+ * Only the owner of the application account has the permission to call this method. + * + * @param { string } name - Indicates the account name of your application. + * @param { string } authType - Indicates the authentication type. + * @returns { Promise> } Returns the open authorization list of the specified authentication type. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. + * @throws { BusinessError } 12300001 - System service exception. + * @throws { BusinessError } 12300002 - Invalid name or authType. + * @throws { BusinessError } 12300003 - Account not found. + * @throws { BusinessError } 12300107 - AuthType not found. + * @syscap SystemCapability.Account.AppAccount + * @since 9 + */ + getAuthList(name: string, authType: string): Promise>; + /** + * Gets the authenticator callback with the specified session id. + *

+ * Only the owner of the authenticator has the permission to call this method. + * + * @param { string } sessionId - Indicates the id of a authentication session. + * @param { AsyncCallback } callback - Asynchronous callback interface. + * Returns the authenticator callback related to the session id. + * @syscap SystemCapability.Account.AppAccount + * @since 8 + * @deprecated since 9 + * @useinstead appAccount.AppAccountManager#getAuthCallback + */ + getAuthenticatorCallback(sessionId: string, callback: AsyncCallback): void; + /** + * Gets the authenticator callback with the specified session id. + *

+ * Only the owner of the authenticator has the permission to call this method. + * + * @param { string } sessionId - Indicates the id of a authentication session. + * @returns { Promise } Returns the authenticator callback related to the session id. + * @syscap SystemCapability.Account.AppAccount + * @since 8 + * @deprecated since 9 + * @useinstead appAccount.AppAccountManager#getAuthCallback + */ + getAuthenticatorCallback(sessionId: string): Promise; + /** + * Obtains the authenticator callback with the specified session id. + *

+ * Only the owner of the authenticator has the permission to call this method. + * + * @param { string } sessionId - Indicates the id of a authentication session. + * @param { AsyncCallback } callback - Asynchronous callback interface. + * Returns the authenticator callback related to the session id. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. + * @throws { BusinessError } 12300001 - System service exception. + * @throws { BusinessError } 12300002 - Invalid sessionId. + * @throws { BusinessError } 12300108 - Session not found. + * @syscap SystemCapability.Account.AppAccount + * @since 9 + */ + getAuthCallback(sessionId: string, callback: AsyncCallback): void; + /** + * Obtains the authenticator callback with the specified session id. + *

+ * Only the owner of the authenticator has the permission to call this method. + * + * @param { string } sessionId - Indicates the id of a authentication session. + * @returns { Promise } Returns the authenticator callback related to the session id. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. + * @throws { BusinessError } 12300001 - System service exception. + * @throws { BusinessError } 12300002 - Invalid sessionId. + * @throws { BusinessError } 12300108 - Session not found. + * @syscap SystemCapability.Account.AppAccount + * @since 9 + */ + getAuthCallback(sessionId: string): Promise; + /** + * Gets the authenticator information of an application account. + * + * @param { string } owner - Indicates the account owner of your application or third-party applications. + * @param { AsyncCallback } callback - Asynchronous callback interface. + * Returns the authenticator information of the application account. + * @syscap SystemCapability.Account.AppAccount + * @since 8 + * @deprecated since 9 + * @useinstead appAccount.AppAccountManager#queryAuthenticatorInfo + */ + getAuthenticatorInfo(owner: string, callback: AsyncCallback): void; + /** + * Gets the authenticator information of an application account. + * + * @param { string } owner - Indicates the account owner of your application or third-party applications. + * @returns { Promise } Returns the authenticator information of the application account. + * @syscap SystemCapability.Account.AppAccount + * @since 8 + * @deprecated since 9 + * @useinstead appAccount.AppAccountManager#queryAuthenticatorInfo + */ + getAuthenticatorInfo(owner: string): Promise; + /** + * Queries the authenticator information of an application account. + * + * @param { string } owner - Indicates the account owner of your application or third-party applications. + * @param { AsyncCallback } callback - Asynchronous callback interface. + * Returns the authenticator information of the application account. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. + * @throws { BusinessError } 12300001 - System service exception. + * @throws { BusinessError } 12300002 - Invalid owner. + * @throws { BusinessError } 12300113 - Authenticator service not found. + * @syscap SystemCapability.Account.AppAccount + * @since 9 + */ + queryAuthenticatorInfo(owner: string, callback: AsyncCallback): void; + /** + * Queries the authenticator information of an application account. + * + * @param { string } owner - Indicates the account owner of your application or third-party applications. + * @returns { Promise } Returns the authenticator information of the application account. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. + * @throws { BusinessError } 12300001 - System service exception. + * @throws { BusinessError } 12300002 - Invalid owner. + * @throws { BusinessError } 12300113 - Authenticator service not found. + * @syscap SystemCapability.Account.AppAccount + * @since 9 + */ + queryAuthenticatorInfo(owner: string): Promise; + /** + * Checks whether a particular account has all specified labels. + * + * @param { string } name - Indicates the account name. + * @param { string } owner - Indicates the account owner. + * @param { Array } labels - Indicates an array of labels to check. + * @param { AsyncCallback } callback - Asynchronous callback interface. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. + * @throws { BusinessError } 12300001 - System service exception. + * @throws { BusinessError } 12300002 - Invalid name, owner or labels. + * @throws { BusinessError } 12300003 - Account not found. + * @throws { BusinessError } 12300010 - Account service busy. + * @throws { BusinessError } 12300113 - Authenticator service not found. + * @throws { BusinessError } 12300114 - Authenticator service exception. + * @syscap SystemCapability.Account.AppAccount + * @since 9 + */ + checkAccountLabels(name: string, owner: string, labels: Array, callback: AsyncCallback): void; + /** + * Checks whether a particular account has all specified labels. + * + * @param { string } name - Indicates the account name. + * @param { string } owner - Indicates the account owner. + * @param { Array } labels - Indicates an array of labels to check. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. + * @throws { BusinessError } 12300001 - System service exception. + * @throws { BusinessError } 12300002 - Invalid name, owner or labels. + * @throws { BusinessError } 12300003 - Account not found. + * @throws { BusinessError } 12300010 - Account service busy. + * @throws { BusinessError } 12300113 - Authenticator service not found. + * @throws { BusinessError } 12300114 - Authenticator service exception. + * @syscap SystemCapability.Account.AppAccount + * @since 9 + */ + checkAccountLabels(name: string, owner: string, labels: Array): Promise; + /** + * Deletes the credential of the specified application account. + * + * @param { string } name - Indicates the account name. + * @param { string } credentialType - Indicates the type of the credential to delete. + * @param { AsyncCallback } callback - Asynchronous callback interface. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. + * @throws { BusinessError } 12300001 - System service exception. + * @throws { BusinessError } 12300002 - Invalid name or credentialType. + * @throws { BusinessError } 12300003 - Account not found. + * @throws { BusinessError } 12300102 - Credential not found. + * @syscap SystemCapability.Account.AppAccount + * @since 9 + */ + deleteCredential(name: string, credentialType: string, callback: AsyncCallback): void; + /** + * Deletes the credential of the specified application account. + * + * @param { string } name - Indicates the account name. + * @param { string } credentialType - Indicates the type of the credential to delete. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. + * @throws { BusinessError } 12300001 - System service exception. + * @throws { BusinessError } 12300002 - Invalid name or credentialType. + * @throws { BusinessError } 12300003 - Account not found. + * @throws { BusinessError } 12300102 - Credential not found. + * @syscap SystemCapability.Account.AppAccount + * @since 9 + */ + deleteCredential(name: string, credentialType: string): Promise; + /** + * Selects a list of accounts that satisfied with the specified options. + * + * @param { SelectAccountsOptions } options - Indicates the options for selecting account. + * @param { AsyncCallback> } callback - Asynchronous callback interface. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. + * @throws { BusinessError } 12300001 - System service exception. + * @throws { BusinessError } 12300002 - Invalid options. + * @throws { BusinessError } 12300010 - Account service busy. + * @throws { BusinessError } 12300114 - Authenticator service exception. + * @syscap SystemCapability.Account.AppAccount + * @since 9 + */ + selectAccountsByOptions(options: SelectAccountsOptions, callback: AsyncCallback>): void; + /** + * Selects a list of accounts that satisfied with the specified options. + * + * @param { SelectAccountsOptions } options - Indicates the options for selecting account. + * @returns { Promise> } Returns a list of accounts. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. + * @throws { BusinessError } 12300001 - System service exception. + * @throws { BusinessError } 12300002 - Invalid options. + * @throws { BusinessError } 12300010 - Account service busy. + * @throws { BusinessError } 12300114 - Authenticator service exception. + * @syscap SystemCapability.Account.AppAccount + * @since 9 + */ + selectAccountsByOptions(options: SelectAccountsOptions): Promise>; + /** + * Verifies the credential to ensure the user is the owner of the specified account. + * + * @param { string } name - Indicates the account name. + * @param { string } owner - Indicates the account owner. + * @param { AuthCallback } callback - Indicates the authenticator callback. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. + * @throws { BusinessError } 12300001 - System service exception. + * @throws { BusinessError } 12300002 - Invalid name or owner. + * @throws { BusinessError } 12300003 - Account not found. + * @throws { BusinessError } 12300010 - Account service busy. + * @throws { BusinessError } 12300113 - Authenticator service not found. + * @throws { BusinessError } 12300114 - Authenticator service exception. + * @syscap SystemCapability.Account.AppAccount + * @since 9 + */ + verifyCredential(name: string, owner: string, callback: AuthCallback): void; + /** + * Verifies the credential to ensure the user is the owner of the specified account. + * + * @param { string } name - Indicates the account name. + * @param { string } owner - Indicates the account owner. + * @param { VerifyCredentialOptions } options - Indicates the options for verifying credential. + * @param { AuthCallback } callback - Indicates the authenticator callback. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. + * @throws { BusinessError } 12300001 - System service exception. + * @throws { BusinessError } 12300002 - Invalid name, owner or options. + * @throws { BusinessError } 12300003 - Account not found. + * @throws { BusinessError } 12300010 - Account service busy. + * @throws { BusinessError } 12300113 - Authenticator service not found. + * @throws { BusinessError } 12300114 - Authenticator service exception. + * @syscap SystemCapability.Account.AppAccount + * @since 9 + */ + verifyCredential(name: string, owner: string, options: VerifyCredentialOptions, callback: AuthCallback): void; + /** + * Sets properties for the specified account authenticator. + *

+ * If the authenticator supports setting its properties, + * the caller will normally be redirected to an Ability specified by Want for property setting. + * + * @param { string } owner - Indicates the owner of authenticator. + * @param { AuthCallback } callback - Indicates the authenticator callback. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. + * @throws { BusinessError } 12300001 - System service exception. + * @throws { BusinessError } 12300002 - Invalid owner. + * @throws { BusinessError } 12300010 - Account service busy. + * @throws { BusinessError } 12300113 - Authenticator service not found. + * @throws { BusinessError } 12300114 - Authenticator service exception. + * @syscap SystemCapability.Account.AppAccount + * @since 9 + */ + setAuthenticatorProperties(owner: string, callback: AuthCallback): void; + /** + * Sets properties for the specified account authenticator. + *

+ * If the authenticator supports setting its properties, + * the caller will normally be redirected to an Ability specified by Want for property setting. + * + * @param { string } owner - Indicates the owner of authenticator. + * @param { SetPropertiesOptions } options - Indicates the options for setting properties. + * @param { AuthCallback } callback - Indicates the authenticator callback. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. + * @throws { BusinessError } 12300001 - System service exception. + * @throws { BusinessError } 12300002 - Invalid owner or options. + * @throws { BusinessError } 12300010 - Account service busy. + * @throws { BusinessError } 12300113 - Authenticator service not found. + * @throws { BusinessError } 12300114 - Authenticator service exception. + * @syscap SystemCapability.Account.AppAccount + * @since 9 + */ + setAuthenticatorProperties(owner: string, options: SetPropertiesOptions, callback: AuthCallback): void; + } + /** + * Provides basic information of an application account, including the account owner and name. + * + * @interface AppAccountInfo + * @syscap SystemCapability.Account.AppAccount + * @since 7 + */ + interface AppAccountInfo { + /** + * The owner an application account. + * + * @type { string } + * @syscap SystemCapability.Account.AppAccount + * @since 7 + */ + owner: string; + /** + * The name an application account. + * + * @type { string } + * @syscap SystemCapability.Account.AppAccount + * @since 7 + */ + name: string; + } + /** + * Provides basic information of an oauth token, including the authentication type and token value. + * + * @interface OAuthTokenInfo + * @syscap SystemCapability.Account.AppAccount + * @since 8 + * @deprecated since 9 + * @useinstead appAccount.AuthTokenInfo + */ + interface OAuthTokenInfo { + /** + * The authentication type. + * + * @type { string } + * @syscap SystemCapability.Account.AppAccount + * @since 8 + * @deprecated since 9 + */ + authType: string; + /** + * The token value. + * + * @type { string } + * @syscap SystemCapability.Account.AppAccount + * @since 8 + * @deprecated since 9 + */ + token: string; + } + /** + * Provides basic information of an auth token, including the authentication type and token value. + * + * @interface AuthTokenInfo + * @syscap SystemCapability.Account.AppAccount + * @since 9 + */ + interface AuthTokenInfo { + /** + * The authentication type. + * + * @type { string } + * @syscap SystemCapability.Account.AppAccount + * @since 9 + */ + authType: string; + /** + * The token value. + * + * @type { string } + * @syscap SystemCapability.Account.AppAccount + * @since 9 + */ + token: string; + /** + * The account to which the token belongs. + * + * @type { ?AppAccountInfo } + * @syscap SystemCapability.Account.AppAccount + * @since 9 + */ + account?: AppAccountInfo; + } + /** + * Provides basic information of an authenticator, including the authenticator owner, icon id and label id. + * + * @interface AuthenticatorInfo + * @syscap SystemCapability.Account.AppAccount + * @since 8 + */ + interface AuthenticatorInfo { + /** + * The owner of an authenticator. + * + * @type { string } + * @syscap SystemCapability.Account.AppAccount + * @since 8 + */ + owner: string; + /** + * The icon id of an authenticator. + * + * @type { number } + * @syscap SystemCapability.Account.AppAccount + * @since 8 + */ + iconId: number; + /** + * The label id of an authenticator. + * + * @type { number } + * @syscap SystemCapability.Account.AppAccount + * @since 8 + */ + labelId: number; + } + /** + * Provides the definition of the authentication result. + * + * @interface AuthResult + * @syscap SystemCapability.Account.AppAccount + * @since 9 + */ + interface AuthResult { + /** + * The account information. + * + * @type { ?AppAccountInfo } + * @syscap SystemCapability.Account.AppAccount + * @since 9 + */ + account?: AppAccountInfo; + /** + * The token information. + * + * @type { ?AuthTokenInfo } + * @syscap SystemCapability.Account.AppAccount + * @since 9 + */ + tokenInfo?: AuthTokenInfo; + } + /** + * Provides the available options for creating an account. + * + * @interface CreateAccountOptions + * @syscap SystemCapability.Account.AppAccount + * @since 9 + */ + interface CreateAccountOptions { + /** + * The custom data for creating an account, + * which can be further modified by function setCustomData. + * + * @type { ?Record } + * @syscap SystemCapability.Account.AppAccount + * @since 9 + */ + customData?: Record; + } + /** + * Provides the available options for creating an account implicitly. + * + * @interface CreateAccountImplicitlyOptions + * @syscap SystemCapability.Account.AppAccount + * @since 9 + */ + interface CreateAccountImplicitlyOptions { + /** + * The required labels for creating an account. + * + * @type { ?Array } + * @syscap SystemCapability.Account.AppAccount + * @since 9 + */ + requiredLabels?: Array; + /** + * The authentication type. + * + * @type { ?string } + * @syscap SystemCapability.Account.AppAccount + * @since 9 + */ + authType?: string; + /** + * The authenticator-specific parameters. + * The list of reserved parameter name: + * 1. Constants.KEY_CALLER_BUNDLE_NAME; + * The above parameters are set by the appAccount management service and can be used for identify the caller. + * + * @type { ?Record } + * @syscap SystemCapability.Account.AppAccount + * @since 9 + */ + parameters?: Record; + } + /** + * Provides the available options for selecting accounts. + * + * @interface SelectAccountsOptions + * @syscap SystemCapability.Account.AppAccount + * @since 9 + */ + interface SelectAccountsOptions { + /** + * The list of accounts allowed to be selected. + * + * @type { ?Array } + * @syscap SystemCapability.Account.AppAccount + * @since 9 + */ + allowedAccounts?: Array; + /** + * The list of account owners, whose accounts allowed to be selected. + * + * @type { ?Array } + * @syscap SystemCapability.Account.AppAccount + * @since 9 + */ + allowedOwners?: Array; + /** + * The labels required for the selected accounts. + * + * @type { ?Array } + * @syscap SystemCapability.Account.AppAccount + * @since 9 + */ + requiredLabels?: Array; + } + /** + * Provides the available options for verifying credential. + * + * @interface VerifyCredentialOptions + * @syscap SystemCapability.Account.AppAccount + * @since 9 + */ + interface VerifyCredentialOptions { + /** + * The credential type to be verified. + * + * @type { ?string } + * @syscap SystemCapability.Account.AppAccount + * @since 9 + */ + credentialType?: string; + /** + * The credential to be verified. + * + * @type { ?string } + * @syscap SystemCapability.Account.AppAccount + * @since 9 + */ + credential?: string; + /** + * The authenticator-specific parameters. + * The list of reserved parameter name: + * 1. Constants.KEY_CALLER_BUNDLE_NAME; + * The above parameters are set by the appAccount management service and can be used for identify the caller. + * + * @type { ?Record } + * @syscap SystemCapability.Account.AppAccount + * @since 9 + */ + parameters?: Record; + } + /** + * Provides the available options for setting properties. + * + * @interface SetPropertiesOptions + * @syscap SystemCapability.Account.AppAccount + * @since 9 + */ + interface SetPropertiesOptions { + /** + * The properties to be set. + * + * @type { ?Record } + * @syscap SystemCapability.Account.AppAccount + * @since 9 + */ + properties?: Record; + /** + * The authenticator-specific parameters. + * The list of reserved parameter name: + * 1. Constants.KEY_CALLER_BUNDLE_NAME; + * The above parameters are set by the appAccount management service and can be used for identify the caller. + * + * @type { ?Record } + * @syscap SystemCapability.Account.AppAccount + * @since 9 + */ + parameters?: Record; + } + /** + * Provides constants definition. + * + * @enum { string } Constants + * @syscap SystemCapability.Account.AppAccount + * @since 8 + */ + enum Constants { + /** + * Indicates the action for adding account implicitly. + * + * @syscap SystemCapability.Account.AppAccount + * @since 8 + * @deprecated since 9 + * @useinstead appAccount.Constants#ACTION_CREATE_ACCOUNT_IMPLICITLY + */ + ACTION_ADD_ACCOUNT_IMPLICITLY = 'addAccountImplicitly', + /** + * Indicates the action for authenticating. + * + * @syscap SystemCapability.Account.AppAccount + * @since 8 + * @deprecated since 9 + * @useinstead appAccount.Constants#ACTION_AUTH + */ + ACTION_AUTHENTICATE = 'authenticate', + /** + * Indicates the action for creating account implicitly. + * + * @syscap SystemCapability.Account.AppAccount + * @since 9 + */ + ACTION_CREATE_ACCOUNT_IMPLICITLY = 'createAccountImplicitly', + /** + * Indicates the action for authenticating. + * + * @syscap SystemCapability.Account.AppAccount + * @since 9 + */ + ACTION_AUTH = 'auth', + /** + * Indicates the action for verifying credential. + * + * @syscap SystemCapability.Account.AppAccount + * @since 9 + */ + ACTION_VERIFY_CREDENTIAL = 'verifyCredential', + /** + * Indicates the action for set authenticator properties. + * + * @syscap SystemCapability.Account.AppAccount + * @since 9 + */ + ACTION_SET_AUTHENTICATOR_PROPERTIES = 'setAuthenticatorProperties', + /** + * Indicates the key of name. + * + * @syscap SystemCapability.Account.AppAccount + * @since 8 + */ + KEY_NAME = 'name', + /** + * Indicates the key of owner. + * + * @syscap SystemCapability.Account.AppAccount + * @since 8 + */ + KEY_OWNER = 'owner', + /** + * Indicates the key of token. + * + * @syscap SystemCapability.Account.AppAccount + * @since 8 + */ + KEY_TOKEN = 'token', + /** + * Indicates the key of action. + * + * @syscap SystemCapability.Account.AppAccount + * @since 8 + */ + KEY_ACTION = 'action', + /** + * Indicates the key of authentication type. + * + * @syscap SystemCapability.Account.AppAccount + * @since 8 + */ + KEY_AUTH_TYPE = 'authType', + /** + * Indicates the key of session id. + * + * @syscap SystemCapability.Account.AppAccount + * @since 8 + */ + KEY_SESSION_ID = 'sessionId', + /** + * Indicates the key of caller pid. + * + * @syscap SystemCapability.Account.AppAccount + * @since 8 + */ + KEY_CALLER_PID = 'callerPid', + /** + * Indicates the key of caller uid. + * + * @syscap SystemCapability.Account.AppAccount + * @since 8 + */ + KEY_CALLER_UID = 'callerUid', + /** + * Indicates the key of caller bundle name. + * + * @syscap SystemCapability.Account.AppAccount + * @since 8 + */ + KEY_CALLER_BUNDLE_NAME = 'callerBundleName', + /** + * Indicates the key of required labels. + * + * @syscap SystemCapability.Account.AppAccount + * @since 9 + */ + KEY_REQUIRED_LABELS = 'requiredLabels', + /** + * Indicates the key of boolean result. + * + * @syscap SystemCapability.Account.AppAccount + * @since 9 + */ + KEY_BOOLEAN_RESULT = 'booleanResult' + } + /** + * Provides result code definition. + * + * @enum { number } ResultCode + * @syscap SystemCapability.Account.AppAccount + * @since 8 + * @deprecated since 9 + */ + enum ResultCode { + /** + * Indicates the success result. + * + * @syscap SystemCapability.Account.AppAccount + * @since 8 + * @deprecated since 9 + */ + SUCCESS = 0, + /** + * Indicates the result of account not exist. + * + * @syscap SystemCapability.Account.AppAccount + * @since 8 + * @deprecated since 9 + */ + ERROR_ACCOUNT_NOT_EXIST = 10001, + /** + * Indicates the result of account service exception. + * + * @syscap SystemCapability.Account.AppAccount + * @since 8 + * @deprecated since 9 + */ + ERROR_APP_ACCOUNT_SERVICE_EXCEPTION = 10002, + /** + * Indicates the result of password is invalid. + * + * @syscap SystemCapability.Account.AppAccount + * @since 8 + * @deprecated since 9 + */ + ERROR_INVALID_PASSWORD = 10003, + /** + * Indicates the result of request is invalid. + * + * @syscap SystemCapability.Account.AppAccount + * @since 8 + * @deprecated since 9 + */ + ERROR_INVALID_REQUEST = 10004, + /** + * Indicates the result of response is invalid. + * + * @syscap SystemCapability.Account.AppAccount + * @since 8 + * @deprecated since 9 + */ + ERROR_INVALID_RESPONSE = 10005, + /** + * Indicates the result of network exception. + * + * @syscap SystemCapability.Account.AppAccount + * @since 8 + * @deprecated since 9 + */ + ERROR_NETWORK_EXCEPTION = 10006, + /** + * Indicates the result of network exception. + * + * @syscap SystemCapability.Account.AppAccount + * @since 8 + * @deprecated since 9 + */ + ERROR_OAUTH_AUTHENTICATOR_NOT_EXIST = 10007, + /** + * Indicates the result of auth has been canceled. + * + * @syscap SystemCapability.Account.AppAccount + * @since 8 + * @deprecated since 9 + */ + ERROR_OAUTH_CANCELED = 10008, + /** + * Indicates the result of auth list is too large. + * + * @syscap SystemCapability.Account.AppAccount + * @since 8 + * @deprecated since 9 + */ + ERROR_OAUTH_LIST_TOO_LARGE = 10009, + /** + * Indicates the result of auth service is busy. + * + * @syscap SystemCapability.Account.AppAccount + * @since 8 + * @deprecated since 9 + */ + ERROR_OAUTH_SERVICE_BUSY = 10010, + /** + * Indicates the result of auth service exception. + * + * @syscap SystemCapability.Account.AppAccount + * @since 8 + * @deprecated since 9 + */ + ERROR_OAUTH_SERVICE_EXCEPTION = 10011, + /** + * Indicates the result of auth session is not exist. + * + * @syscap SystemCapability.Account.AppAccount + * @since 8 + * @deprecated since 9 + */ + ERROR_OAUTH_SESSION_NOT_EXIST = 10012, + /** + * Indicates the result of auth timeout. + * + * @syscap SystemCapability.Account.AppAccount + * @since 8 + * @deprecated since 9 + */ + ERROR_OAUTH_TIMEOUT = 10013, + /** + * Indicates the result of token is not exist. + * + * @syscap SystemCapability.Account.AppAccount + * @since 8 + * @deprecated since 9 + */ + ERROR_OAUTH_TOKEN_NOT_EXIST = 10014, + /** + * Indicates the result of token is too many. + * + * @syscap SystemCapability.Account.AppAccount + * @since 8 + * @deprecated since 9 + */ + ERROR_OAUTH_TOKEN_TOO_MANY = 10015, + /** + * Indicates the result of not supported action. + * + * @syscap SystemCapability.Account.AppAccount + * @since 8 + * @deprecated since 9 + */ + ERROR_OAUTH_UNSUPPORT_ACTION = 10016, + /** + * Indicates the result of not supported auth type. + * + * @syscap SystemCapability.Account.AppAccount + * @since 8 + * @deprecated since 9 + */ + ERROR_OAUTH_UNSUPPORT_AUTH_TYPE = 10017, + /** + * Indicates the result of permission denied. + * + * @syscap SystemCapability.Account.AppAccount + * @since 8 + * @deprecated since 9 + */ + ERROR_PERMISSION_DENIED = 10018 + } + /** + * Provides methods for authenticator callback. + * + * @interface AuthenticatorCallback + * @syscap SystemCapability.Account.AppAccount + * @since 8 + * @deprecated since 9 + * @useinstead AppAccount.AuthCallback + */ + interface AuthenticatorCallback { + /** + * Notifies the client of the authentication result. + * + * @syscap SystemCapability.Account.AppAccount + * @since 8 + * @deprecated since 9 + */ + onResult: (code: number, result: { + [key: string]: any; + }) => void; + /** + * Notifies the client that the authentication request need to be redirected. + * + * @syscap SystemCapability.Account.AppAccount + * @since 8 + * @deprecated since 9 + */ + onRequestRedirected: (request: Want) => void; + } + /** + * Provides methods for authentication callback. + * + * @interface AuthCallback + * @syscap SystemCapability.Account.AppAccount + * @since 9 + */ + interface AuthCallback { + /** + * Notifies the client of the authentication result. + * + * @syscap SystemCapability.Account.AppAccount + * @since 9 + */ + onResult: (code: number, result?: AuthResult) => void; + /** + * Notifies the client that the authentication request need to be redirected. + * + * @syscap SystemCapability.Account.AppAccount + * @since 9 + */ + onRequestRedirected: (request: Want) => void; + /** + * Notifies the client that the request is continued. + * + * @syscap SystemCapability.Account.AppAccount + * @since 9 + */ + onRequestContinued?: () => void; + } + /** + * Provides methods for authenticator. + * + * @syscap SystemCapability.Account.AppAccount + * @since 8 + * @name Authenticator + */ + class Authenticator { + /** + * Adds an application account of a specified owner implicitly. + * + * @param { string } authType - Indicates the authentication type. + * @param { string } callerBundleName - Indicates the caller bundle name. + * @param { object } options - Indicates the authenticator-specific options for the request. + * @param { AuthenticatorCallback } callback - Indicates the authenticator callback. + * @syscap SystemCapability.Account.AppAccount + * @since 8 + * @deprecated since 9 + * @useinstead appAccount.Authenticator#createAccountImplicitly + */ + addAccountImplicitly(authType: string, callerBundleName: string, options: { + [key: string]: any; + }, callback: AuthenticatorCallback): void; + /** + * Creates an application account of a specified owner implicitly. + * + * @param { CreateAccountImplicitlyOptions } options - Indicates the authenticator-specific options for the request. + * @param { AuthCallback } callback - Indicates the authenticator callback. + * @syscap SystemCapability.Account.AppAccount + * @since 9 + */ + createAccountImplicitly(options: CreateAccountImplicitlyOptions, callback: AuthCallback): void; + /** + * Authenticates an application account to get an oauth token. + * + * @param { string } name - Indicates the account name. + * @param { string } authType - Indicates the authentication type. + * @param { string } callerBundleName - Indicates the caller bundle name. + * @param { object } options - Indicates the authenticator-specific options for the request. + * @param { AuthenticatorCallback } callback - Indicates the authenticator callback. + * @syscap SystemCapability.Account.AppAccount + * @since 8 + * @deprecated since 9 + * @useinstead appAccount.Authenticator#auth + */ + authenticate(name: string, authType: string, callerBundleName: string, options: { + [key: string]: any; + }, callback: AuthenticatorCallback): void; + /** + * Authenticates an application account to get an oauth token. + * + * @param { string } name - Indicates the account name. + * @param { string } authType - Indicates the authentication type. + * @param { Record } options - Indicates the authenticator-specific options for the request. + * @param { AuthCallback } callback - Indicates the authenticator callback. + * @syscap SystemCapability.Account.AppAccount + * @since 9 + */ + auth(name: string, authType: string, options: Record, callback: AuthCallback): void; + /** + * Verifies the credential to ensure the user is the owner of the specified application account. + *

+ * The credential can be provided in the options, otherwise an Ability will normally be returned, + * which can be started by the caller to further verify credential. + * + * @param { string } name - Indicates the name of the application account. + * @param { VerifyCredentialOptions } options - Indicates the options for verifying credential. + * @param { AuthCallback } callback - Indicates the authenticator callback. + * @syscap SystemCapability.Account.AppAccount + * @since 9 + */ + verifyCredential(name: string, options: VerifyCredentialOptions, callback: AuthCallback): void; + /** + * Sets properties for the authenticator. + * + * @param { SetPropertiesOptions } options - Indicates the options for setting properties. + * @param { AuthCallback } callback - Indicates the authenticator callback. + * @syscap SystemCapability.Account.AppAccount + * @since 9 + */ + setProperties(options: SetPropertiesOptions, callback: AuthCallback): void; + /** + * Checks whether a particular account has all specified labels. + * + * @param { string } name - Indicates the account name. + * @param { Array } labels - Indicates an array of labels to check. + * @param { AuthCallback } callback - Indicates the authenticator callback. + * @syscap SystemCapability.Account.AppAccount + * @since 9 + */ + checkAccountLabels(name: string, labels: Array, callback: AuthCallback): void; + /** + * Checks whether the specified account can be removed. + * + * @param { string } name - Indicates the account name. + * @param { AuthCallback } callback - Indicates the authenticator callback. + * @syscap SystemCapability.Account.AppAccount + * @since 9 + */ + checkAccountRemovable(name: string, callback: AuthCallback): void; + /** + * Gets the remote object of the authenticator for remote procedure call. + * + * @returns { rpc.RemoteObject } Returns a remote object. + * @syscap SystemCapability.Account.AppAccount + * @since 9 + */ + getRemoteObject(): rpc.RemoteObject; + } +} +export default appAccount; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.account.distributedAccount.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.account.distributedAccount.d.ts new file mode 100755 index 00000000..c6147a19 --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.account.distributedAccount.d.ts @@ -0,0 +1,237 @@ +/* + * Copyright (c) 2021-2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit BasicServicesKit + */ +import type { AsyncCallback } from './@ohos.base'; +/** + * This module provides the capability to manage distributed accounts. + * + * @namespace distributedAccount + * @syscap SystemCapability.Account.OsAccount + * @since 7 + */ +declare namespace distributedAccount { + /** + * Gets the ability of the distributed account. + * + * @returns { DistributedAccountAbility } Ability to manage operations of distributed account. + * @syscap SystemCapability.Account.OsAccount + * @since 7 + */ + function getDistributedAccountAbility(): DistributedAccountAbility; + /** + * Defines distributed account functions and interfaces. + * + * @interface DistributedAccountAbility + * @syscap SystemCapability.Account.OsAccount + * @since 7 + */ + interface DistributedAccountAbility { + /** + * Queries the distributed information of the current OS account. + * + * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS or ohos.permission.DISTRIBUTED_DATASYNC + * @param { AsyncCallback } callback - Asynchronous callback interface. + * @syscap SystemCapability.Account.OsAccount + * @since 7 + * @deprecated since 9 + * @useinstead distributedAccount.DistributedAccountAbility#getOsAccountDistributedInfo + */ + queryOsAccountDistributedInfo(callback: AsyncCallback): void; + /** + * Queries the distributed information of the current OS account. + * + * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS or ohos.permission.DISTRIBUTED_DATASYNC + * @returns { Promise } The distributed information of the current OS account. + * @syscap SystemCapability.Account.OsAccount + * @since 7 + * @deprecated since 9 + * @useinstead distributedAccount.DistributedAccountAbility#getOsAccountDistributedInfo + */ + queryOsAccountDistributedInfo(): Promise; + /** + * Gets the distributed information of the current OS account. + * + * @permission ohos.permission.MANAGE_DISTRIBUTED_ACCOUNTS or ohos.permission.GET_DISTRIBUTED_ACCOUNTS or ohos.permission.DISTRIBUTED_DATASYNC + * @param { AsyncCallback } callback - Asynchronous callback interface. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. + * @throws { BusinessError } 12300001 - System service exception. + * @syscap SystemCapability.Account.OsAccount + * @since 9 + */ + getOsAccountDistributedInfo(callback: AsyncCallback): void; + /** + * Gets the distributed information of the current OS account. + * + * @permission ohos.permission.MANAGE_DISTRIBUTED_ACCOUNTS or ohos.permission.GET_DISTRIBUTED_ACCOUNTS or ohos.permission.DISTRIBUTED_DATASYNC + * @returns { Promise } The distributed information of the current OS account. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 12300001 - System service exception. + * @syscap SystemCapability.Account.OsAccount + * @since 9 + */ + getOsAccountDistributedInfo(): Promise; + /** + * Updates the distributed information of the OS account. + * + * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS + * @param { DistributedInfo } accountInfo - Indicates the information of the OS account used for a distributed system. + * @param { AsyncCallback } callback - Asynchronous callback interface. + * @syscap SystemCapability.Account.OsAccount + * @since 7 + * @deprecated since 9 + * @useinstead distributedAccount.DistributedAccountAbility#setOsAccountDistributedInfo + */ + updateOsAccountDistributedInfo(accountInfo: DistributedInfo, callback: AsyncCallback): void; + /** + * Updates the distributed information of the OS account. + * + * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS + * @param { DistributedInfo } accountInfo - Indicates the information of the OS account used for a distributed system. + * @returns { Promise } The promise returned by the function. + * @syscap SystemCapability.Account.OsAccount + * @since 7 + * @deprecated since 9 + * @useinstead distributedAccount.DistributedAccountAbility#setOsAccountDistributedInfo + */ + updateOsAccountDistributedInfo(accountInfo: DistributedInfo): Promise; + /** + * Sets the distributed information of the OS account. + * + * @permission ohos.permission.MANAGE_DISTRIBUTED_ACCOUNTS + * @param { DistributedInfo } accountInfo - Indicates the information of the OS account used for a distributed system. + * @param { AsyncCallback } callback - Asynchronous callback interface. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. + * @throws { BusinessError } 12300001 - System service exception. + * @throws { BusinessError } 12300002 - Invalid accountInfo. + * @throws { BusinessError } 12300003 - Account not found. + * @syscap SystemCapability.Account.OsAccount + * @since 9 + */ + setOsAccountDistributedInfo(accountInfo: DistributedInfo, callback: AsyncCallback): void; + /** + * Sets the distributed information of the OS account. + * + * @permission ohos.permission.MANAGE_DISTRIBUTED_ACCOUNTS + * @param { DistributedInfo } accountInfo - Indicates the information of the OS account used for a distributed system. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. + * @throws { BusinessError } 12300001 - System service exception. + * @throws { BusinessError } 12300002 - Invalid accountInfo. + * @throws { BusinessError } 12300003 - Account not found. + * @syscap SystemCapability.Account.OsAccount + * @since 9 + */ + setOsAccountDistributedInfo(accountInfo: DistributedInfo): Promise; + } + /** + * Enum for distributed account status. + * + * @enum { number } + * @syscap SystemCapability.Account.OsAccount + * @since 10 + */ + enum DistributedAccountStatus { + /** + * Indicates that the account is not logged in. + * + * @syscap SystemCapability.Account.OsAccount + * @since 10 + */ + NOT_LOGGED_IN = 0, + /** + * Indicates that the account is logged in. + * + * @syscap SystemCapability.Account.OsAccount + * @since 10 + */ + LOGGED_IN = 1 + } + /** + * Provides the distributed information of the OS account. + * + * @interface DistributedInfo + * @syscap SystemCapability.Account.OsAccount + * @since 7 + */ + interface DistributedInfo { + /** + * The name in the distributed information of the OS account. + * + * @type { string } + * @syscap SystemCapability.Account.OsAccount + * @since 7 + */ + name: string; + /** + * The ID in the distributed information of the OS account. + * + * @type { string } + * @syscap SystemCapability.Account.OsAccount + * @since 7 + */ + id: string; + /** + * The event string in the distributed information of the OS account. + * + * @type { string } + * @syscap SystemCapability.Account.OsAccount + * @since 7 + */ + event: string; + /** + * The nickname in the distributed information of the OS account. + * + * @type { ?string } + * @syscap SystemCapability.Account.OsAccount + * @since 9 + */ + nickname?: string; + /** + * The avatar in the distributed information of the OS account. + * + * @type { ?string } + * @syscap SystemCapability.Account.OsAccount + * @since 9 + */ + avatar?: string; + /** + * The status in the distributed information of the OS account. + * + * @type { ?DistributedAccountStatus } + * @readonly + * @syscap SystemCapability.Account.OsAccount + * @since 10 + */ + readonly status?: DistributedAccountStatus; + /** + * The scalable data in the distributed information of the OS account. + * + * @type { ?object } + * @syscap SystemCapability.Account.OsAccount + * @since 8 + */ + scalableData?: object; + } +} +export default distributedAccount; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.account.osAccount.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.account.osAccount.d.ts new file mode 100755 index 00000000..f3574194 --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.account.osAccount.d.ts @@ -0,0 +1,1170 @@ +/* + * Copyright (c) 2021-2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit BasicServicesKit + */ +import type distributedAccount from './@ohos.account.distributedAccount'; +import type { AsyncCallback } from './@ohos.base'; +/** + * This module provides the capability to manage os accounts. + * + * @namespace osAccount + * @syscap SystemCapability.Account.OsAccount + * @since 7 + */ +declare namespace osAccount { + /** + * Obtains the AccountManager instance. + * + * @returns { AccountManager } Returns the instance of the AccountManager. + * @syscap SystemCapability.Account.OsAccount + * @since 7 + */ + function getAccountManager(): AccountManager; + /** + * Provides abilities for you to manage and perform operations on your OS accounts. + * + * @interface AccountManager + * @syscap SystemCapability.Account.OsAccount + * @since 7 + */ + interface AccountManager { + /** + * Checks whether the function of supporting multiple OS accounts is enabled. + * + * @param { AsyncCallback } callback - Returns {@code true} if this function is enabled; returns {@code false} otherwise. + * @syscap SystemCapability.Account.OsAccount + * @since 7 + * @deprecated since 9 + * @useinstead osAccount.AccountManager#checkMultiOsAccountEnabled + */ + isMultiOsAccountEnable(callback: AsyncCallback): void; + /** + * Checks whether the function of supporting multiple OS accounts is enabled. + * + * @returns { Promise } Returns {@code true} if this function is enabled; returns {@code false} otherwise. + * @syscap SystemCapability.Account.OsAccount + * @since 7 + * @deprecated since 9 + * @useinstead osAccount.AccountManager#checkMultiOsAccountEnabled + */ + isMultiOsAccountEnable(): Promise; + /** + * Checks whether the function of supporting multiple OS accounts is enabled. + * + * @param { AsyncCallback } callback - Returns {@code true} if this function is enabled; returns {@code false} otherwise. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. + * @throws { BusinessError } 12300001 - System service exception. + * @syscap SystemCapability.Account.OsAccount + * @since 9 + */ + checkMultiOsAccountEnabled(callback: AsyncCallback): void; + /** + * Checks whether the function of supporting multiple OS accounts is enabled. + * + * @returns { Promise } Returns {@code true} if this function is enabled; returns {@code false} otherwise. + * @throws { BusinessError } 12300001 - System service exception. + * @syscap SystemCapability.Account.OsAccount + * @since 9 + */ + checkMultiOsAccountEnabled(): Promise; + /** + * Checks whether an OS account is activated based on its local ID. + * + * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS or ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS + * @param { number } localId - Indicates the local ID of the OS account. + * @param { AsyncCallback } callback - Indicates the callback for checking whether the OS account is activated. + * @syscap SystemCapability.Account.OsAccount + * @since 7 + * @deprecated since 9 + * @useinstead osAccount.AccountManager#checkOsAccountActivated + */ + isOsAccountActived(localId: number, callback: AsyncCallback): void; + /** + * Checks whether an OS account is activated based on its local ID. + * + * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS or ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS + * @param { number } localId - Indicates the local ID of the OS account. + * @returns { Promise } Returns {@code true} if the OS account is activated; returns {@code false} otherwise. + * @syscap SystemCapability.Account.OsAccount + * @since 7 + * @deprecated since 9 + * @useinstead osAccount.AccountManager#checkOsAccountActivated + */ + isOsAccountActived(localId: number): Promise; + /** + * Checks whether an OS account is activated based on its local ID. + * + * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS or ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS + * @param { number } localId - Indicates the local ID of the OS account. + * @param { AsyncCallback } callback - Indicates the callback for checking whether the OS account is activated. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. + * @throws { BusinessError } 12300001 - System service exception. + * @throws { BusinessError } 12300002 - Invalid localId. + * @throws { BusinessError } 12300003 - Account not found. + * @syscap SystemCapability.Account.OsAccount + * @since 9 + * @deprecated since 11 + */ + checkOsAccountActivated(localId: number, callback: AsyncCallback): void; + /** + * Checks whether an OS account is activated based on its local ID. + * + * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS or ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS + * @param { number } localId - Indicates the local ID of the OS account. + * @returns { Promise } - Returns {@code true} if the OS account is activated; returns {@code false} otherwise. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. + * @throws { BusinessError } 12300001 - System service exception. + * @throws { BusinessError } 12300002 - Invalid localId. + * @throws { BusinessError } 12300003 - Account not found. + * @syscap SystemCapability.Account.OsAccount + * @since 9 + * @deprecated since 11 + */ + checkOsAccountActivated(localId: number): Promise; + /** + * Checks whether a constraint has been enabled for an OS account based on its local ID. + * + * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS + * @param { number } localId - Indicates the local ID of the OS account. + * @param { string } constraint - Indicates the constraint to check. The value can be: + *
{@code constraint.wifi.set} - Indicates the constraint on configuring the Wi-Fi access point. + *
{@code constraint.sms.use} - Indicates the constraint on sending and receiving short messages. + *
{@code constraint.calls.outgoing} - Indicates the constraint on making calls. + *
{@code constraint.unknown.sources.install} - Indicates the constraint on installing applications + *
from unknown sources. + * @param { AsyncCallback } callback - Indicates the callback for checking whether the constraint is enabled for the specified OS account. + * @syscap SystemCapability.Account.OsAccount + * @since 7 + * @deprecated since 9 + * @useinstead osAccount.AccountManager#checkOsAccountConstraintEnabled + */ + isOsAccountConstraintEnable(localId: number, constraint: string, callback: AsyncCallback): void; + /** + * Checks whether a constraint has been enabled for an OS account based on its local ID. + * + * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS + * @param { number } localId - Indicates the local ID of the OS account. + * @param { string } constraint - Indicates the constraint to check. The value can be: + *
{@code constraint.wifi.set} - Indicates the constraint on configuring the Wi-Fi access point. + *
{@code constraint.sms.use} - Indicates the constraint on sending and receiving short messages. + *
{@code constraint.calls.outgoing} - Indicates the constraint on making calls. + *
{@code constraint.unknown.sources.install} - Indicates the constraint on installing applications + *
from unknown sources. + * @returns { Promise } Returns {@code true} if the constraint has been enabled for the OS account; + * returns {@code false} otherwise. + * @syscap SystemCapability.Account.OsAccount + * @since 7 + * @deprecated since 9 + * @useinstead osAccount.AccountManager#checkOsAccountConstraintEnabled + */ + isOsAccountConstraintEnable(localId: number, constraint: string): Promise; + /** + * Checks whether the given constraint is enabled for the specified OS account. + * + * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS or ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS + * @param { number } localId - Indicates the local ID of the OS account. + * @param { string } constraint - Indicates the constraint to check. For example: the value can be: + *
{@code constraint.wifi.set} - Indicates the constraint on configuring the Wi-Fi access point. + *
{@code constraint.sms.use} - Indicates the constraint on sending and receiving short messages. + *
{@code constraint.calls.outgoing} - Indicates the constraint on making calls. + *
{@code constraint.unknown.sources.install} - Indicates the constraint on installing applications + *
from unknown sources. + * @param { AsyncCallback } callback - Indicates the callback for checking whether the constraint is enabled for the specified OS account. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. + * @throws { BusinessError } 12300001 - System service exception. + * @throws { BusinessError } 12300002 - Invalid localId or constraint. + * @throws { BusinessError } 12300003 - Account not found. + * @syscap SystemCapability.Account.OsAccount + * @since 9 + * @deprecated since 11 + */ + checkOsAccountConstraintEnabled(localId: number, constraint: string, callback: AsyncCallback): void; + /** + * Checks whether the given constraint is enabled for the specified OS account. + * + * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS or ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS + * @param { number } localId - Indicates the local ID of the OS account. + * @param { string } constraint - Indicates the constraint to check. For example: the value can be: + *
{@code constraint.wifi.set} - Indicates the constraint on configuring the Wi-Fi access point. + *
{@code constraint.sms.use} - Indicates the constraint on sending and receiving short messages. + *
{@code constraint.calls.outgoing} - Indicates the constraint on making calls. + *
{@code constraint.unknown.sources.install} - Indicates the constraint on installing applications + *
from unknown sources. + * @returns { Promise } Returns whether the given constraint is enabled for the specified OS account. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. + * @throws { BusinessError } 12300001 - System service exception. + * @throws { BusinessError } 12300002 - Invalid localId or constraint. + * @throws { BusinessError } 12300003 - Account not found. + * @syscap SystemCapability.Account.OsAccount + * @since 9 + * @deprecated since 11 + */ + checkOsAccountConstraintEnabled(localId: number, constraint: string): Promise; + /** + * Checks whether the given constraint is enabled for the current OS account. + * + * @param { string } constraint - Indicates the constraint to check. For example: the value can be: + *
{@code constraint.wifi.set} - Indicates the constraint on configuring the Wi-Fi access point. + *
{@code constraint.sms.use} - Indicates the constraint on sending and receiving short messages. + *
{@code constraint.calls.outgoing} - Indicates the constraint on making calls. + *
{@code constraint.unknown.sources.install} - Indicates the constraint on installing applications + *
from unknown sources. + * @returns { Promise } Returns whether the given constraint is enabled for the current OS account. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. + * @throws { BusinessError } 12300001 - System service exception. + * @syscap SystemCapability.Account.OsAccount + * @since 11 + */ + isOsAccountConstraintEnabled(constraint: string): Promise; + /** + * Checks whether this OS account is a test OS account. + * + * @param { AsyncCallback } callback - Returns {@code true} if this OS account is a test OS account; returns {@code false} otherwise. + * @syscap SystemCapability.Account.OsAccount + * @since 7 + * @deprecated since 9 + * @useinstead osAccount.AccountManager#checkOsAccountTestable + */ + isTestOsAccount(callback: AsyncCallback): void; + /** + * Checks whether this OS account is a test OS account. + * + * @returns { Promise } Returns {@code true} if this OS account is a test OS account; returns {@code false} otherwise. + * @syscap SystemCapability.Account.OsAccount + * @since 7 + * @deprecated since 9 + * @useinstead osAccount.AccountManager#checkOsAccountTestable + */ + isTestOsAccount(): Promise; + /** + * Checks whether current OS account is testable. + * + * @param { AsyncCallback } callback - Returns {@code true} if this account is testable; returns {@code false} otherwise. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. + * @throws { BusinessError } 12300001 - System service exception. + * @syscap SystemCapability.Account.OsAccount + * @since 9 + */ + checkOsAccountTestable(callback: AsyncCallback): void; + /** + * Checks whether current OS account is testable. + * + * @returns { Promise } Returns {@code true} if this account is testable; returns {@code false} otherwise. + * @throws { BusinessError } 12300001 - System service exception. + * @syscap SystemCapability.Account.OsAccount + * @since 9 + */ + checkOsAccountTestable(): Promise; + /** + * Checks whether an OS account has been verified based on its local ID. + * + * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS or ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS + * @param { AsyncCallback } callback - Returns {@code true} if the OS account has been verified successfully; + * returns {@code false} otherwise. + * @syscap SystemCapability.Account.OsAccount + * @since 7 + * @deprecated since 9 + * @useinstead osAccount.AccountManager#checkOsAccountVerified + */ + isOsAccountVerified(callback: AsyncCallback): void; + /** + * Checks whether an OS account has been verified based on its local ID. + * + * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS or ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS + * @param { number } localId - Indicates the local ID of the OS account. + * @param { AsyncCallback } callback - Returns {@code true} if the OS account has been verified successfully; + * returns {@code false} otherwise. + * @syscap SystemCapability.Account.OsAccount + * @since 7 + * @deprecated since 9 + * @useinstead osAccount.AccountManager#checkOsAccountVerified + */ + isOsAccountVerified(localId: number, callback: AsyncCallback): void; + /** + * Checks whether an OS account has been verified based on its local ID. + * + * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS or ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS + * @param { number } localId - Indicates the local ID of the OS account. + * @returns { Promise } Returns {@code true} if the OS account has been verified successfully; + * returns {@code false} otherwise. + * @syscap SystemCapability.Account.OsAccount + * @since 7 + * @deprecated since 9 + * @useinstead osAccount.AccountManager#checkOsAccountVerified + */ + isOsAccountVerified(localId?: number): Promise; + /** + * Checks whether the current OS account is verified. + * + * @param { AsyncCallback } callback - Indicates the callback for checking whether the current OS account is verified. + * @throws { BusinessError } 12300001 - System service exception. + * @syscap SystemCapability.Account.OsAccount + * @since 9 + * @deprecated since 11 + * @useinstead osAccount.AccountManager#isOsAccountUnlocked + */ + checkOsAccountVerified(callback: AsyncCallback): void; + /** + * Checks whether the current OS account is verified. + * + * @returns { Promise } Returns whether the current OS account is verified. + * @throws { BusinessError } 12300001 - System service exception. + * @syscap SystemCapability.Account.OsAccount + * @since 9 + * @deprecated since 11 + * @useinstead osAccount.AccountManager#isOsAccountUnlocked + */ + checkOsAccountVerified(): Promise; + /** + * Checks whether the specified OS account is verified. + * + * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS or ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS + * @param { number } localId - Indicates the local ID of the OS account. + * @param { AsyncCallback } callback - Indicates the callback for checking whether the specified OS account is verified. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. + * @throws { BusinessError } 12300001 - System service exception. + * @throws { BusinessError } 12300002 - Invalid localId. + * @throws { BusinessError } 12300003 - Account not found. + * @syscap SystemCapability.Account.OsAccount + * @since 9 + * @deprecated since 11 + */ + checkOsAccountVerified(localId: number, callback: AsyncCallback): void; + /** + * Checks whether the specified OS account is verified. + * + * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS or ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS + * @param { number } localId - Indicates the local ID of the OS account. + * @returns { Promise } Returns whether the specified OS account is verified. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. + * @throws { BusinessError } 12300001 - System service exception. + * @throws { BusinessError } 12300002 - Invalid localId. + * @throws { BusinessError } 12300003 - Account not found. + * @syscap SystemCapability.Account.OsAccount + * @since 9 + * @deprecated since 11 + */ + checkOsAccountVerified(localId: number): Promise; + /** + * Checks whether the current OS account is unlocked. + * + * @returns { Promise } Returns whether the current OS account is unlocked. + * @throws { BusinessError } 12300001 - System service exception. + * @syscap SystemCapability.Account.OsAccount + * @since 11 + */ + isOsAccountUnlocked(): Promise; + /** + * Gets the name of the OS account to which the caller belongs. + * + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 12300001 - System service exception. + * @syscap SystemCapability.Account.OsAccount + * @since 12 + */ + getOsAccountName(): Promise; + /** + * Obtains the number of all OS accounts created on a device. + * + * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS + * @param { AsyncCallback } callback - Returns the number of created OS accounts. + * @syscap SystemCapability.Account.OsAccount + * @since 7 + * @deprecated since 9 + * @useinstead osAccount.AccountManager#getOsAccountCount + */ + getCreatedOsAccountsCount(callback: AsyncCallback): void; + /** + * Obtains the number of all OS accounts created on a device. + * + * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS + * @returns { Promise } Returns the number of created OS accounts. + * @syscap SystemCapability.Account.OsAccount + * @since 7 + * @deprecated since 9 + * @useinstead osAccount.AccountManager#getOsAccountCount + */ + getCreatedOsAccountsCount(): Promise; + /** + * Obtains the number of all OS accounts created on a device. + * + * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS + * @param { AsyncCallback } callback - Returns the number of created OS accounts. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. + * @throws { BusinessError } 12300001 - System service exception. + * @syscap SystemCapability.Account.OsAccount + * @since 9 + */ + getOsAccountCount(callback: AsyncCallback): void; + /** + * Obtains the number of all OS accounts created on a device. + * + * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS + * @returns { Promise } Returns the number of created OS accounts. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 12300001 - System service exception. + * @syscap SystemCapability.Account.OsAccount + * @since 9 + */ + getOsAccountCount(): Promise; + /** + * Obtains the local ID of an OS account from the current process UID. + * + * @param { AsyncCallback } callback - Returns the local ID of the OS account. + * @syscap SystemCapability.Account.OsAccount + * @since 7 + * @deprecated since 9 + * @useinstead osAccount.AccountManager#getOsAccountLocalId + */ + getOsAccountLocalIdFromProcess(callback: AsyncCallback): void; + /** + * Obtains the local ID of an OS account from the current process UID. + * + * @returns { Promise } Returns the local ID of the OS account. + * @syscap SystemCapability.Account.OsAccount + * @since 7 + * @deprecated since 9 + * @useinstead osAccount.AccountManager#getOsAccountLocalId + */ + getOsAccountLocalIdFromProcess(): Promise; + /** + * Gets the local ID of the current OS account. + * + * @param { AsyncCallback } callback - Indicates the callback for getting the local ID of the current OS account. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. + * @throws { BusinessError } 12300001 - System service exception. + * @syscap SystemCapability.Account.OsAccount + * @since 9 + */ + getOsAccountLocalId(callback: AsyncCallback): void; + /** + * Get the local ID of the current OS account. + * + * @returns { Promise } Returns the local ID of the current account. + * @throws { BusinessError } 12300001 - System service exception. + * @syscap SystemCapability.Account.OsAccount + * @since 9 + */ + getOsAccountLocalId(): Promise; + /** + * Gets the local ID of an OS account from the process UID + * + * @param { number } uid - Indicates the process UID. + * @param { AsyncCallback } callback - Returns the local ID of the OS account. + * @syscap SystemCapability.Account.OsAccount + * @since 7 + * @deprecated since 9 + * @useinstead osAccount.AccountManager#getOsAccountLocalIdForUid + */ + getOsAccountLocalIdFromUid(uid: number, callback: AsyncCallback): void; + /** + * Gets the local ID of an OS account from the process UID + * + * @param { number } uid - Indicates the process UID. + * @returns { Promise } Returns the local ID of the OS account. + * @syscap SystemCapability.Account.OsAccount + * @since 7 + * @deprecated since 9 + * @useinstead osAccount.AccountManager#getOsAccountLocalIdForUid + */ + getOsAccountLocalIdFromUid(uid: number): Promise; + /** + * Gets the local ID of the OS account associated with the specified UID. + * + * @param { number } uid - Indicates the process UID. + * @param { AsyncCallback } callback - Indicates the callback for getting the local ID of the OS account associated with the specified UID. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. + * @throws { BusinessError } 12300001 - System service exception. + * @throws { BusinessError } 12300002 - Invalid uid. + * @syscap SystemCapability.Account.OsAccount + * @since 9 + */ + getOsAccountLocalIdForUid(uid: number, callback: AsyncCallback): void; + /** + * Get the local ID of the OS account associated with the specified UID. + * + * @param { number } uid - Indicates the process UID. + * @returns { Promise } - Returns the local ID of the OS account associated with the specified UID. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. + * @throws { BusinessError } 12300001 - System service exception. + * @throws { BusinessError } 12300002 - Invalid uid. + * @syscap SystemCapability.Account.OsAccount + * @since 9 + */ + getOsAccountLocalIdForUid(uid: number): Promise; + /** + * Gets the local ID of the OS account associated with the specified UID synchronously. + * + * @param { number } uid - Indicates the process UID. + * @returns { number } Returns the local ID of the OS account associated with the specified UID. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. + * @throws { BusinessError } 12300002 - Invalid uid. + * @syscap SystemCapability.Account.OsAccount + * @since 10 + */ + getOsAccountLocalIdForUidSync(uid: number): number; + /** + * Queries the local ID of an OS account which is bound to the specified domain account. + * + * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS + * @param { DomainAccountInfo } domainInfo - Indicates the domain account info. + * @param { AsyncCallback } callback - Returns the local ID of the OS account. + * @syscap SystemCapability.Account.OsAccount + * @since 8 + * @deprecated since 9 + * @useinstead osAccount.AccountManager#getOsAccountLocalIdForDomain + */ + getOsAccountLocalIdFromDomain(domainInfo: DomainAccountInfo, callback: AsyncCallback): void; + /** + * Queries the local ID of an OS account which is bound to the specified domain account. + * + * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS + * @param { DomainAccountInfo } domainInfo - Indicates the domain account info. + * @returns { Promise } Returns the local ID of the OS account. + * @syscap SystemCapability.Account.OsAccount + * @since 8 + * @deprecated since 9 + * @useinstead osAccount.AccountManager#getOsAccountLocalIdForDomain + */ + getOsAccountLocalIdFromDomain(domainInfo: DomainAccountInfo): Promise; + /** + * Gets the local ID of the OS account associated with the specified domain account. + * + * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS + * @param { DomainAccountInfo } domainInfo - Indicates the domain account info. + * @param { AsyncCallback } callback - Indicates the callback for + * getting the local ID of the OS account associated with the specified domain account. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. + * @throws { BusinessError } 12300001 - System service exception. + * @throws { BusinessError } 12300002 - Invalid domainInfo. + * @syscap SystemCapability.Account.OsAccount + * @since 9 + */ + getOsAccountLocalIdForDomain(domainInfo: DomainAccountInfo, callback: AsyncCallback): void; + /** + * Gets the local ID of the OS account associated with the specified domain account. + * + * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS + * @param { DomainAccountInfo } domainInfo - Indicates the domain account info. + * @returns { Promise } Returns the local ID of the OS account associated with the specified domain account. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. + * @throws { BusinessError } 12300001 - System service exception. + * @throws { BusinessError } 12300002 - Invalid domainInfo. + * @syscap SystemCapability.Account.OsAccount + * @since 9 + */ + getOsAccountLocalIdForDomain(domainInfo: DomainAccountInfo): Promise; + /** + * Obtains all constraints of an OS account based on its local ID. + * + * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS + * @param { number } localId - Indicates the local ID of the OS account. + * @param { AsyncCallback> } callback - Returns a list of constraints. + * @syscap SystemCapability.Account.OsAccount + * @since 7 + * @deprecated since 9 + * @useinstead osAccount.AccountManager#getOsAccountConstraints + */ + getOsAccountAllConstraints(localId: number, callback: AsyncCallback>): void; + /** + * Obtains all constraints of an OS account based on its local ID. + * + * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS + * @param { number } localId - Indicates the local ID of the OS account. + * @returns { Promise> } Returns a list of constraints. + * @syscap SystemCapability.Account.OsAccount + * @since 7 + * @deprecated since 9 + * @useinstead osAccount.AccountManager#getOsAccountConstraints + */ + getOsAccountAllConstraints(localId: number): Promise>; + /** + * Obtains all constraints of an account based on its ID. + * + * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS + * @param { number } localId - Indicates the local ID of the OS account. + * @param { AsyncCallback> } callback - Returns a list of constraints. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. + * @throws { BusinessError } 12300001 - System service exception. + * @throws { BusinessError } 12300002 - Invalid localId. + * @throws { BusinessError } 12300003 - Account not found. + * @syscap SystemCapability.Account.OsAccount + * @since 9 + * @deprecated since 11 + */ + getOsAccountConstraints(localId: number, callback: AsyncCallback>): void; + /** + * Obtains all constraints of an account based on its ID. + * + * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS + * @param { number } localId - Indicates the local ID of the OS account. + * @returns { Promise> } Returns a list of constraints. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. + * @throws { BusinessError } 12300001 - System service exception. + * @throws { BusinessError } 12300002 - Invalid localId. + * @throws { BusinessError } 12300003 - Account not found. + * @syscap SystemCapability.Account.OsAccount + * @since 9 + * @deprecated since 11 + */ + getOsAccountConstraints(localId: number): Promise>; + /** + * Queries the id list of all activated OS accounts. + * + * @param { AsyncCallback> } callback - Returns a id list of OS accounts. + * @syscap SystemCapability.Account.OsAccount + * @since 8 + * @deprecated since 9 + * @useinstead osAccount.AccountManager#getActivatedOsAccountLocalIds + */ + queryActivatedOsAccountIds(callback: AsyncCallback>): void; + /** + * Queries the id list of all activated OS accounts. + * + * @returns { Promise> } Returns a id list of OS accounts. + * @syscap SystemCapability.Account.OsAccount + * @since 8 + * @deprecated since 9 + * @useinstead osAccount.AccountManager#getActivatedOsAccountLocalIds + */ + queryActivatedOsAccountIds(): Promise>; + /** + * Gets the local IDs of all activated OS accounts. + * + * @param { AsyncCallback> } callback - Indicates the callback for getting the local IDs of all activated OS accounts. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. + * @throws { BusinessError } 12300001 - System service exception. + * @syscap SystemCapability.Account.OsAccount + * @since 9 + */ + getActivatedOsAccountLocalIds(callback: AsyncCallback>): void; + /** + * Gets the local IDs of all activated OS accounts. + * + * @returns { Promise> } Returns all activated accounts. + * @throws { BusinessError } 12300001 - System service exception. + * @syscap SystemCapability.Account.OsAccount + * @since 9 + */ + getActivatedOsAccountLocalIds(): Promise>; + /** + * Queries information about the current OS account. + * + * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS + * @param { AsyncCallback } callback - Returns information about the current OS account; returns {@code null} if the query fails. + * @syscap SystemCapability.Account.OsAccount + * @since 7 + * @deprecated since 9 + * @useinstead osAccount.AccountManager#getCurrentOsAccount + */ + queryCurrentOsAccount(callback: AsyncCallback): void; + /** + * Queries information about the current OS account. + * + * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS + * @returns { Promise } Returns information about the current OS account; returns {@code null} if the query fails. + * @syscap SystemCapability.Account.OsAccount + * @since 7 + * @deprecated since 9 + * @useinstead osAccount.AccountManager#getCurrentOsAccount + */ + queryCurrentOsAccount(): Promise; + /** + * Gets information about the current OS account. + * + * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS + * @param { AsyncCallback } callback - Returns information about the current OS account; returns {@code null} if the query fails. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. + * @throws { BusinessError } 12300001 - System service exception. + * @syscap SystemCapability.Account.OsAccount + * @since 9 + * @deprecated since 11 + */ + /** + * Gets information about the current OS account. + * + * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS or ohos.permission.GET_LOCAL_ACCOUNTS + * @param { AsyncCallback } callback - Returns information about the current OS account; returns {@code null} if the query fails. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. + * @throws { BusinessError } 12300001 - System service exception. + * @syscap SystemCapability.Account.OsAccount + * @since 10 + * @deprecated since 11 + */ + getCurrentOsAccount(callback: AsyncCallback): void; + /** + * Gets information about the current OS account. + * + * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS + * @returns { Promise } Returns information about the current OS account; returns {@code null} if the query fails. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 12300001 - System service exception. + * @syscap SystemCapability.Account.OsAccount + * @since 9 + * @deprecated since 11 + */ + /** + * Gets information about the current OS account. + * + * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS or ohos.permission.GET_LOCAL_ACCOUNTS + * @returns { Promise } Returns information about the current OS account; returns {@code null} if the query fails. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 12300001 - System service exception. + * @syscap SystemCapability.Account.OsAccount + * @since 10 + * @deprecated since 11 + */ + getCurrentOsAccount(): Promise; + /** + * Obtains the type of this OS account from the current process. + * + * @param { AsyncCallback } callback - Returns the OS account type. The value can be {@link OsAccountType#ADMIN}, + * {@link OsAccountType#NORMAL}, and {@link OsAccountType#GUEST}. + * @syscap SystemCapability.Account.OsAccount + * @since 7 + * @deprecated since 9 + * @useinstead osAccount.AccountManager#getOsAccountType + */ + getOsAccountTypeFromProcess(callback: AsyncCallback): void; + /** + * Obtains the type of this OS account from the current process. + * + * @returns { Promise } Returns the OS account type. The value can be {@link OsAccountType#ADMIN}, + * {@link OsAccountType#NORMAL}, and {@link OsAccountType#GUEST}. + * @syscap SystemCapability.Account.OsAccount + * @since 7 + * @deprecated since 9 + * @useinstead osAccount.AccountManager#getOsAccountType + */ + getOsAccountTypeFromProcess(): Promise; + /** + * Obtains the type of this OS account from the current process. + * + * @param { AsyncCallback } callback - Returns the OS account type. The value can be {@link OsAccountType#ADMIN}, + * {@link OsAccountType#NORMAL}, and {@link OsAccountType#GUEST}. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. + * @throws { BusinessError } 12300001 - System service exception. + * @syscap SystemCapability.Account.OsAccount + * @since 9 + */ + getOsAccountType(callback: AsyncCallback): void; + /** + * Obtains the type of this OS account from the current process. + * + * @returns { Promise } Returns the OS account type. The value can be {@link OsAccountType#ADMIN}, + * {@link OsAccountType#NORMAL}, and {@link OsAccountType#GUEST}. + * @throws { BusinessError } 12300001 - System service exception. + * @syscap SystemCapability.Account.OsAccount + * @since 9 + */ + getOsAccountType(): Promise; + /** + * Obtains the distributed virtual device ID (DVID). + *

+ * If the same OHOS account has logged in to multiple devices, these devices constitute a super device + * through the distributed networking. On the connected devices, you can call this method to obtain the DVIDs. + * The same application running on different devices obtains the same DVID, whereas different applications + * obtain different DVIDs. + *

+ * + * @permission ohos.permission.DISTRIBUTED_DATASYNC or ohos.permission.MANAGE_LOCAL_ACCOUNTS + * @param { AsyncCallback } callback - Returns the DVID if obtained; returns an empty string if no OHOS account has logged in. + * @syscap SystemCapability.Account.OsAccount + * @since 7 + * @deprecated since 9 + * @useinstead osAccount.AccountManager#queryDistributedVirtualDeviceId + */ + getDistributedVirtualDeviceId(callback: AsyncCallback): void; + /** + * Obtains the distributed virtual device ID (DVID). + *

+ * If the same OHOS account has logged in to multiple devices, these devices constitute a super device + * through the distributed networking. On the connected devices, you can call this method to obtain the DVIDs. + * The same application running on different devices obtains the same DVID, whereas different applications + * obtain different DVIDs. + *

+ * + * @permission ohos.permission.DISTRIBUTED_DATASYNC or ohos.permission.MANAGE_LOCAL_ACCOUNTS + * @returns { Promise } Returns the DVID if obtained; returns an empty string if no OHOS account has logged in. + * @syscap SystemCapability.Account.OsAccount + * @since 7 + * @deprecated since 9 + * @useinstead osAccount.AccountManager#queryDistributedVirtualDeviceId + */ + getDistributedVirtualDeviceId(): Promise; + /** + * Queries the distributed virtual device ID (DVID). + *

+ * If the same OHOS account has logged in to multiple devices, these devices constitute a super device + * through the distributed networking. On the connected devices, you can call this method to obtain the DVIDs. + * The same application running on different devices obtains the same DVID, whereas different applications + * obtain different DVIDs. + *

+ * + * @permission ohos.permission.DISTRIBUTED_DATASYNC or ohos.permission.MANAGE_LOCAL_ACCOUNTS + * @param { AsyncCallback } callback - Returns the DVID if obtained; returns an empty string if no OHOS account has logged in. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. + * @throws { BusinessError } 12300001 - System service exception. + * @syscap SystemCapability.Account.OsAccount + * @since 9 + */ + queryDistributedVirtualDeviceId(callback: AsyncCallback): void; + /** + * Queries the distributed virtual device ID (DVID). + *

+ * If the same OHOS account has logged in to multiple devices, these devices constitute a super device + * through the distributed networking. On the connected devices, you can call this method to obtain the DVIDs. + * The same application running on different devices obtains the same DVID, whereas different applications + * obtain different DVIDs. + *

+ * + * @permission ohos.permission.DISTRIBUTED_DATASYNC or ohos.permission.MANAGE_LOCAL_ACCOUNTS + * @returns { Promise } Returns the DVID if obtained; returns an empty string if no OHOS account has logged in. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 12300001 - System service exception. + * @syscap SystemCapability.Account.OsAccount + * @since 9 + */ + queryDistributedVirtualDeviceId(): Promise; + /** + * Obtain localId according to serial number + * + * @param { number } serialNumber - Indicates serial number. + * @param { AsyncCallback } callback - Returns localId. + * @syscap SystemCapability.Account.OsAccount + * @since 8 + * @deprecated since 9 + * @useinstead osAccount.AccountManager#getOsAccountLocalIdForSerialNumber + */ + getOsAccountLocalIdBySerialNumber(serialNumber: number, callback: AsyncCallback): void; + /** + * Obtain localId according to serial number + * + * @param { number } serialNumber - Indicates serial number. + * @returns { Promise } Returns localId. + * @syscap SystemCapability.Account.OsAccount + * @since 8 + * @deprecated since 9 + * @useinstead osAccount.AccountManager#getOsAccountLocalIdForSerialNumber + */ + getOsAccountLocalIdBySerialNumber(serialNumber: number): Promise; + /** + * Gets the local ID of the OS account associated with the serial number. + * + * @param { number } serialNumber - Indicates serial number. + * @param { AsyncCallback } callback - Indicates the callback for getting the local ID of the OS account associated with the serial number. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. + * @throws { BusinessError } 12300001 - System service exception. + * @throws { BusinessError } 12300002 - Invalid serialNumber. + * @throws { BusinessError } 12300003 - The account indicated by serialNumber dose not exist. + * @syscap SystemCapability.Account.OsAccount + * @since 9 + */ + getOsAccountLocalIdForSerialNumber(serialNumber: number, callback: AsyncCallback): void; + /** + * Gets the local ID of the OS account associated with the serial number. + * + * @param { number } serialNumber - Indicates serial number. + * @returns { Promise } Returns the local ID of the OS account associated with the serial number. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. + * @throws { BusinessError } 12300001 - System service exception. + * @throws { BusinessError } 12300002 - Invalid serialNumber. + * @throws { BusinessError } 12300003 - The account indicated by serialNumber dose not exist. + * @syscap SystemCapability.Account.OsAccount + * @since 9 + */ + getOsAccountLocalIdForSerialNumber(serialNumber: number): Promise; + /** + * Obtain serial number according to localId. + * + * @param { number } localId - Indicates the local ID of the OS account. + * @param { AsyncCallback } callback - Returns serial number. + * @syscap SystemCapability.Account.OsAccount + * @since 8 + * @deprecated since 9 + * @useinstead osAccount.AccountManager#getSerialNumberForOsAccountLocalId + */ + getSerialNumberByOsAccountLocalId(localId: number, callback: AsyncCallback): void; + /** + * Obtain serial number according to localId. + * + * @param { number } localId - Indicates the local ID of the OS account. + * @returns { Promise } Returns serial number. + * @syscap SystemCapability.Account.OsAccount + * @since 8 + * @deprecated since 9 + * @useinstead osAccount.AccountManager#getSerialNumberForOsAccountLocalId + */ + getSerialNumberByOsAccountLocalId(localId: number): Promise; + /** + * Gets the serial number for the specified os account local id. + * + * @param { number } localId - Indicates the local ID of the OS account. + * @param { AsyncCallback } callback - Indicates the callback for getting the serial number for the specified os account local id. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. + * @throws { BusinessError } 12300001 - System service exception. + * @throws { BusinessError } 12300002 - Invalid localId. + * @throws { BusinessError } 12300003 - Account not found. + * @syscap SystemCapability.Account.OsAccount + * @since 9 + */ + getSerialNumberForOsAccountLocalId(localId: number, callback: AsyncCallback): void; + /** + * Gets the serial number for the specified os account local id. + * + * @param { number } localId - Indicates the local ID of the OS account. + * @returns { Promise } Returns the serial number according to local ID. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. + * @throws { BusinessError } 12300001 - System service exception. + * @throws { BusinessError } 12300002 - Invalid localId. + * @throws { BusinessError } 12300003 - Account not found. + * @syscap SystemCapability.Account.OsAccount + * @since 9 + */ + getSerialNumberForOsAccountLocalId(localId: number): Promise; + } + /** + * Provides information about OS accounts, including the local ID, local name, and type of an OS account. + * + * @interface OsAccountInfo + * @syscap SystemCapability.Account.OsAccount + * @since 7 + */ + interface OsAccountInfo { + /** + * The local ID of an OS account. + * + * @type { number } + * @syscap SystemCapability.Account.OsAccount + * @since 7 + */ + localId: number; + /** + * The local name of an OS account. + * + * @type { string } + * @syscap SystemCapability.Account.OsAccount + * @since 7 + */ + localName: string; + /** + * Include: ADMIN, Normal, GUEST. + * + * @type { OsAccountType } + * @syscap SystemCapability.Account.OsAccount + * @since 7 + */ + type: OsAccountType; + /** + * Account constraints information. + * + * @type { Array } + * @syscap SystemCapability.Account.OsAccount + * @since 7 + */ + constraints: Array; + /** + * The account is verified or not. + * + * @type { boolean } + * @syscap SystemCapability.Account.OsAccount + * @since 8 + * @deprecated since 11 + * @useinstead osAccount.OsAccountInfo#isUnlocked + */ + isVerified: boolean; + /** + * The OS account is unlocked or not. + * + * @type { boolean } + * @syscap SystemCapability.Account.OsAccount + * @since 11 + */ + isUnlocked: boolean; + /** + * OS account photo. + * + * @type { string } + * @syscap SystemCapability.Account.OsAccount + * @since 8 + */ + photo: string; + /** + * Os account create time. + * + * @type { number } + * @syscap SystemCapability.Account.OsAccount + * @since 8 + */ + createTime: number; + /** + * The last time to log in. + * + * @type { number } + * @syscap SystemCapability.Account.OsAccount + * @since 8 + */ + lastLoginTime: number; + /** + * Os account serial number. + * + * @type { number } + * @syscap SystemCapability.Account.OsAccount + * @since 8 + */ + serialNumber: number; + /** + * Os account is activated or not. + * + * @type { boolean } + * @syscap SystemCapability.Account.OsAccount + * @since 8 + * @deprecated since 11 + * @useinstead osAccount.OsAccountInfo#isActivated + */ + isActived: boolean; + /** + * The OS account is activated or not. + * + * @type { boolean } + * @syscap SystemCapability.Account.OsAccount + * @since 11 + */ + isActivated: boolean; + /** + * Os account create completed or not. + * + * @type { boolean } + * @syscap SystemCapability.Account.OsAccount + * @since 8 + */ + isCreateCompleted: boolean; + /** + * Distributed account info. + * + * @type { distributedAccount.DistributedInfo } + * @syscap SystemCapability.Account.OsAccount + * @since 7 + */ + distributedInfo: distributedAccount.DistributedInfo; + /** + * Domain account info. + * + * @type { DomainAccountInfo } + * @syscap SystemCapability.Account.OsAccount + * @since 8 + */ + domainInfo: DomainAccountInfo; + } + /** + * Provides information about domain accounts. + * + * @interface DomainAccountInfo + * @syscap SystemCapability.Account.OsAccount + * @since 8 + */ + interface DomainAccountInfo { + /** + * The domain name + * + * @type { string } + * @syscap SystemCapability.Account.OsAccount + * @since 8 + */ + domain: string; + /** + * The account name in the domain + * + * @type { string } + * @syscap SystemCapability.Account.OsAccount + * @since 8 + */ + accountName: string; + } + /** + * Enumerates OS account types. + * + * @enum { number } OsAccountType + * @syscap SystemCapability.Account.OsAccount + * @since 7 + */ + enum OsAccountType { + /** + * Indicates the administrator account, which has the permission to manage other OS accounts. + * + * @syscap SystemCapability.Account.OsAccount + * @since 7 + */ + ADMIN = 0, + /** + * Indicates a normal account, which has access to common functions of OS accounts. + * + * @syscap SystemCapability.Account.OsAccount + * @since 7 + */ + NORMAL, + /** + * Indicates a guest account, which is used to temporarily access the device and may be deleted at any time. + * + * @syscap SystemCapability.Account.OsAccount + * @since 7 + */ + GUEST + } +} +export default osAccount; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.advertising.AdComponent.d.ets b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.advertising.AdComponent.d.ets new file mode 100755 index 00000000..4633bbfd --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.advertising.AdComponent.d.ets @@ -0,0 +1,96 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file Defines the ad component + * @kit AdsKit + */ +import advertising from './@ohos.advertising'; +/** + * Defines the ad component. + * @syscap SystemCapability.Advertising.Ads + * @since 11 + */ +/** + * Defines the ad component. + * @syscap SystemCapability.Advertising.Ads + * @atomicservice + * @since 12 + */ +@Component +declare struct AdComponent { + /** + * The ads to display. + * @type { Advertisement[] } + * @syscap SystemCapability.Advertising.Ads + * @since 11 + */ + /** + * The ads to display. + * @type { Advertisement[] } + * @syscap SystemCapability.Advertising.Ads + * @atomicservice + * @since 12 + */ + ads: advertising.Advertisement[]; + /** + * The interaction options info for displaying ads. + * @type { AdDisplayOptions } + * @syscap SystemCapability.Advertising.Ads + * @since 11 + */ + /** + * The interaction options info for displaying ads. + * @type { AdDisplayOptions } + * @syscap SystemCapability.Advertising.Ads + * @atomicservice + * @since 12 + */ + displayOptions: advertising.AdDisplayOptions; + /** + * The interaction listener to be registered that use to show ads. + * @type { AdInteractionListener } + * @syscap SystemCapability.Advertising.Ads + * @since 11 + */ + /** + * The interaction listener to be registered that use to show ads. + * @type { AdInteractionListener } + * @syscap SystemCapability.Advertising.Ads + * @atomicservice + * @since 12 + */ + interactionListener: advertising.AdInteractionListener; + /** + * The builder param to render customized ad content. + * @type { ?() => void } + * @syscap SystemCapability.Advertising.Ads + * @since 12 + */ + @BuilderParam + adRenderer?: () => void; + /** + * The method to build ad component. + * @syscap SystemCapability.Advertising.Ads + * @since 11 + */ + /** + * The method to build ad component. + * @syscap SystemCapability.Advertising.Ads + * @atomicservice + * @since 12 + */ + build(): void; +} +export { AdComponent }; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.advertising.AdsServiceExtensionAbility.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.advertising.AdsServiceExtensionAbility.d.ts new file mode 100755 index 00000000..40ee013d --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.advertising.AdsServiceExtensionAbility.d.ts @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file Provides the capability of integrating advertising services with vendors + * @kit AdsKit + */ +import type advertising from './@ohos.advertising'; +/** + * Defines the callback of loading ad. + * @typedef RespCallback + * @syscap SystemCapability.Advertising.Ads + * @since 11 + */ +export interface RespCallback { + /** + * Defines the callback data. + * @param { Map> } respData + * @syscap SystemCapability.Advertising.Ads + * @since 11 + */ + (respData: Map>): void; +} diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.advertising.AutoAdComponent.d.ets b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.advertising.AutoAdComponent.d.ets new file mode 100755 index 00000000..36d75bf2 --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.advertising.AutoAdComponent.d.ets @@ -0,0 +1,102 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file Defines the auto ad component + * @kit AdsKit + */ +import advertising from './@ohos.advertising'; +/** + * Defines the auto ad component. + * @syscap SystemCapability.Advertising.Ads + * @since 11 + */ +/** + * Defines the auto ad component. + * @syscap SystemCapability.Advertising.Ads + * @atomicservice + * @since 12 + */ +@Component +declare struct AutoAdComponent { + /** + * The parameters in the request for loading ads. + * @type { AdRequestParams } + * @syscap SystemCapability.Advertising.Ads + * @since 11 + */ + /** + * The parameters in the request for loading ads. + * @type { AdRequestParams } + * @syscap SystemCapability.Advertising.Ads + * @atomicservice + * @since 12 + */ + adParam: advertising.AdRequestParams; + /** + * The ad options of loading ads. + * @type { AdOptions } + * @syscap SystemCapability.Advertising.Ads + * @since 11 + */ + /** + * The ad options of loading ads. + * @type { AdOptions } + * @syscap SystemCapability.Advertising.Ads + * @atomicservice + * @since 12 + */ + adOptions: advertising.AdOptions; + /** + * The interaction options info for displaying ads. + * @type { AdDisplayOptions } + * @syscap SystemCapability.Advertising.Ads + * @since 11 + */ + /** + * The interaction options info for displaying ads. + * @type { AdDisplayOptions } + * @syscap SystemCapability.Advertising.Ads + * @atomicservice + * @since 12 + */ + displayOptions: advertising.AdDisplayOptions; + /** + * The interaction listener to be registered that use to show ads. + * @type { AdInteractionListener } + * @syscap SystemCapability.Advertising.Ads + * @since 11 + */ + /** + * The interaction listener to be registered that use to show ads. + * @type { AdInteractionListener } + * @syscap SystemCapability.Advertising.Ads + * @atomicservice + * @since 12 + */ + interactionListener: advertising.AdInteractionListener; + /** + * The method to build auto ad component. + * @syscap SystemCapability.Advertising.Ads + * @since 11 + */ + /** + * The method to build auto ad component. + * @syscap SystemCapability.Advertising.Ads + * @atomicservice + * @since 12 + */ + build(): void; +} +export { AutoAdComponent }; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.advertising.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.advertising.d.ts new file mode 100755 index 00000000..ef26aa89 --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.advertising.d.ts @@ -0,0 +1,598 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file Provides the capability to load and display advertisements + * @kit AdsKit + */ +import type web_webview from './@ohos.web.webview'; +import type common from './@ohos.app.ability.common'; +import type { Advertisement as _Advertisement } from './advertising/advertisement'; +/** + * Provides the capability to load and display advertisements. + * @namespace advertising + * @syscap SystemCapability.Advertising.Ads + * @since 11 + */ +/** + * Provides the capability to load and display advertisements. + * @namespace advertising + * @syscap SystemCapability.Advertising.Ads + * @atomicservice + * @since 12 + */ +declare namespace advertising { + /** + * Indicates the advertisement data model. + * @syscap SystemCapability.Advertising.Ads + * @since 11 + */ + /** + * Indicates the advertisement data model. + * @syscap SystemCapability.Advertising.Ads + * @atomicservice + * @since 12 + */ + export type Advertisement = _Advertisement; + /** + * The parameters in the request for loading one or more advertisements. + * @typedef AdRequestParams + * @syscap SystemCapability.Advertising.Ads + * @since 11 + */ + /** + * The parameters in the request for loading one or more advertisements. + * @typedef AdRequestParams + * @syscap SystemCapability.Advertising.Ads + * @atomicservice + * @since 12 + */ + export interface AdRequestParams { + /** + * The advertisement slot id. + * @type { string } + * @syscap SystemCapability.Advertising.Ads + * @since 11 + */ + /** + * The advertisement slot id. + * @type { string } + * @syscap SystemCapability.Advertising.Ads + * @atomicservice + * @since 12 + */ + adId: string; + /** + * The advertisement type of request. + * @type { ?number } + * @syscap SystemCapability.Advertising.Ads + * @since 11 + */ + /** + * The advertisement type of request. + * @type { ?number } + * @syscap SystemCapability.Advertising.Ads + * @atomicservice + * @since 12 + */ + adType?: number; + /** + * The advertisement quantity of request. + * @type { ?number } + * @syscap SystemCapability.Advertising.Ads + * @since 11 + */ + /** + * The advertisement quantity of request. + * @type { ?number } + * @syscap SystemCapability.Advertising.Ads + * @atomicservice + * @since 12 + */ + adCount?: number; + /** + * The advertisement view size width that expects. + * @type { ?number } + * @syscap SystemCapability.Advertising.Ads + * @since 11 + */ + /** + * The advertisement view size width that expects. + * @type { ?number } + * @syscap SystemCapability.Advertising.Ads + * @atomicservice + * @since 12 + */ + adWidth?: number; + /** + * The advertisement view size height that expects. + * @type { ?number } + * @syscap SystemCapability.Advertising.Ads + * @since 11 + */ + /** + * The advertisement view size height that expects. + * @type { ?number } + * @syscap SystemCapability.Advertising.Ads + * @atomicservice + * @since 12 + */ + adHeight?: number; + /** + * The advertisement search keyword. + * @type { ?string } + * @syscap SystemCapability.Advertising.Ads + * @since 11 + */ + /** + * The advertisement search keyword. + * @type { ?string } + * @syscap SystemCapability.Advertising.Ads + * @atomicservice + * @since 12 + */ + adSearchKeyword?: string; + /** + * The extended attributes for request parameters. + * @type { number | boolean | string | undefined } + * @syscap SystemCapability.Advertising.Ads + * @since 11 + */ + /** + * The extended attributes for request parameters. + * @type { number | boolean | string | undefined } + * @syscap SystemCapability.Advertising.Ads + * @atomicservice + * @since 12 + */ + [key: string]: number | boolean | string | undefined; + } + /** + * The ad options of loading ads. + * @typedef AdOptions + * @syscap SystemCapability.Advertising.Ads + * @since 11 + */ + /** + * The ad options of loading ads. + * @typedef AdOptions + * @syscap SystemCapability.Advertising.Ads + * @atomicservice + * @since 12 + */ + export interface AdOptions { + /** + * The tags for children's content. + * @type { ?number } + * @syscap SystemCapability.Advertising.Ads + * @since 11 + */ + /** + * The tags for children's content. + * @type { ?number } + * @syscap SystemCapability.Advertising.Ads + * @atomicservice + * @since 12 + */ + tagForChildProtection?: number; + /** + * Advertisement content classification setting. + * @type { ?string } + * @syscap SystemCapability.Advertising.Ads + * @since 11 + */ + /** + * Advertisement content classification setting. + * @type { ?string } + * @syscap SystemCapability.Advertising.Ads + * @atomicservice + * @since 12 + */ + adContentClassification?: string; + /** + * Non-personalized ad settings. + * @type { ?number } + * @syscap SystemCapability.Advertising.Ads + * @since 11 + */ + /** + * Non-personalized ad settings. + * @type { ?number } + * @syscap SystemCapability.Advertising.Ads + * @atomicservice + * @since 12 + */ + nonPersonalizedAd?: number; + /** + * The extended attributes for ad options. + * @type { number | boolean | string | undefined } + * @syscap SystemCapability.Advertising.Ads + * @since 11 + */ + /** + * The extended attributes for ad options. + * @type { number | boolean | string | undefined } + * @syscap SystemCapability.Advertising.Ads + * @atomicservice + * @since 12 + */ + [key: string]: number | boolean | string | undefined; + } + /** + * The interaction options info for displaying ad. + * @typedef AdDisplayOptions + * @syscap SystemCapability.Advertising.Ads + * @since 11 + */ + /** + * The interaction options info for displaying ad. + * @typedef AdDisplayOptions + * @syscap SystemCapability.Advertising.Ads + * @atomicservice + * @since 12 + */ + export interface AdDisplayOptions { + /** + * Ad custom data. + * @type { ?string } + * @syscap SystemCapability.Advertising.Ads + * @since 11 + */ + /** + * Ad custom data. + * @type { ?string } + * @syscap SystemCapability.Advertising.Ads + * @atomicservice + * @since 12 + */ + customData?: string; + /** + * User id. + * @type { ?string } + * @syscap SystemCapability.Advertising.Ads + * @since 11 + */ + /** + * User id. + * @type { ?string } + * @syscap SystemCapability.Advertising.Ads + * @atomicservice + * @since 12 + */ + userId?: string; + /** + * Indicates whether a dialog box is displayed to notify users of video playback + * and application download in non-Wi-Fi scenarios. + * @type { ?boolean } + * @syscap SystemCapability.Advertising.Ads + * @since 11 + */ + /** + * Indicates whether a dialog box is displayed to notify users of video playback + * and application download in non-Wi-Fi scenarios. + * @type { ?boolean } + * @syscap SystemCapability.Advertising.Ads + * @atomicservice + * @since 12 + */ + useMobileDataReminder?: boolean; + /** + * Indicates whether to mute the playback of the ad video. + * @type { ?boolean } + * @syscap SystemCapability.Advertising.Ads + * @since 11 + */ + /** + * Indicates whether to mute the playback of the ad video. + * @type { ?boolean } + * @syscap SystemCapability.Advertising.Ads + * @atomicservice + * @since 12 + */ + mute?: boolean; + /** + * The type of the scenario where the audio focus is obtained during video playback. + * @type { ?number } + * @syscap SystemCapability.Advertising.Ads + * @since 11 + */ + /** + * The type of the scenario where the audio focus is obtained during video playback. + * @type { ?number } + * @syscap SystemCapability.Advertising.Ads + * @atomicservice + * @since 12 + */ + audioFocusType?: number; + /** + * The extended attributes for interaction options. + * @type { number | boolean | string | undefined } + * @syscap SystemCapability.Advertising.Ads + * @since 11 + */ + /** + * The extended attributes for interaction options. + * @type { number | boolean | string | undefined } + * @syscap SystemCapability.Advertising.Ads + * @atomicservice + * @since 12 + */ + [key: string]: number | boolean | string | undefined; + } + /** + * The listener of ad interaction. + * @interface AdInteractionListener + * @syscap SystemCapability.Advertising.Ads + * @since 11 + */ + /** + * The listener of ad interaction. + * @interface AdInteractionListener + * @syscap SystemCapability.Advertising.Ads + * @atomicservice + * @since 12 + */ + export interface AdInteractionListener { + /** + * Ads status callback. + * @param { string } status - The current ad status. The status contains onAdOpen,onAdClose,onAdReward,onAdClick,onVideoPlayBegin and onVideoPlayEnd. + * @param { Advertisement } ad - The ad which status is changed. + * @param { string } data - The data of current ad status. + * @syscap SystemCapability.Advertising.Ads + * @since 11 + */ + /** + * Ads status callback. + * @param { string } status - The current ad status. The status contains onAdOpen,onAdClose,onAdReward,onAdClick,onVideoPlayBegin and onVideoPlayEnd. + * @param { Advertisement } ad - The ad which status is changed. + * @param { string } data - The data of current ad status. + * @syscap SystemCapability.Advertising.Ads + * @atomicservice + * @since 12 + */ + onStatusChanged(status: string, ad: Advertisement, data: string); + } + /** + * The listener of loading ad. + * @interface AdLoadListener + * @syscap SystemCapability.Advertising.Ads + * @since 11 + */ + /** + * The listener of loading ad. + * @interface AdLoadListener + * @syscap SystemCapability.Advertising.Ads + * @atomicservice + * @since 12 + */ + export interface AdLoadListener { + /** + * Called by system when the ad load has been failed. + * @param { number } errorCode - code of ad loading failure. + * @param { string } errorMsg - error message. + * @syscap SystemCapability.Advertising.Ads + * @since 11 + */ + /** + * Called by system when the ad load has been failed. + * @param { number } errorCode - code of ad loading failure. + * @param { string } errorMsg - error message. + * @syscap SystemCapability.Advertising.Ads + * @atomicservice + * @since 12 + */ + onAdLoadFailure(errorCode: number, errorMsg: string): void; + /** + * Called by system when the ad load has been succeeded. + * @param { Array } ads - advertisements are loaded successfully. + * @syscap SystemCapability.Advertising.Ads + * @since 11 + */ + /** + * Called by system when the ad load has been succeeded. + * @param { Array } ads - advertisements are loaded successfully. + * @syscap SystemCapability.Advertising.Ads + * @atomicservice + * @since 12 + */ + onAdLoadSuccess(ads: Array): void; + } + /** + * The listener of loading multi-slots ad. + * @interface MultiSlotsAdLoadListener + * @syscap SystemCapability.Advertising.Ads + * @since 11 + */ + /** + * The listener of loading multi-slots ad. + * @interface MultiSlotsAdLoadListener + * @syscap SystemCapability.Advertising.Ads + * @atomicservice + * @since 12 + */ + export interface MultiSlotsAdLoadListener { + /** + * Called by system when the ad load has been failed. + * @param { number } errorCode - code of ad loading failure. + * @param { string } errorMsg - error message. + * @syscap SystemCapability.Advertising.Ads + * @since 11 + */ + /** + * Called by system when the ad load has been failed. + * @param { number } errorCode - code of ad loading failure. + * @param { string } errorMsg - error message. + * @syscap SystemCapability.Advertising.Ads + * @atomicservice + * @since 12 + */ + onAdLoadFailure(errorCode: number, errorMsg: string): void; + /** + * Called by system when the ad load has been succeeded. + * @param { Map> } adsMap - advertisements are loaded successfully. + * @syscap SystemCapability.Advertising.Ads + * @since 11 + */ + /** + * Called by system when the ad load has been succeeded. + * @param { Map> } adsMap - advertisements are loaded successfully. + * @syscap SystemCapability.Advertising.Ads + * @atomicservice + * @since 12 + */ + onAdLoadSuccess(adsMap: Map>): void; + } + /** + * Show the reward and interstitial ad. + * @param { Advertisement } ad - Indicates the advertisement content information. ad is required. + * @param { AdDisplayOptions } options - Indicates interaction option object use to show the ad. options is required. + * @param { common.UIAbilityContext } context - Indicates the ui ability context of the media application. + * @throws { BusinessError } 401 - Invalid input parameter. Possible causes: 1. Mandatory parameters are left unspecified. + * @throws { BusinessError } 21800001 - System internal error. + * @throws { BusinessError } 21800004 - Failed to display the ad. + * @syscap SystemCapability.Advertising.Ads + * @since 11 + */ + /** + * Show the reward and interstitial ad. + * @param { Advertisement } ad - Indicates the advertisement content information. ad is required. + * @param { AdDisplayOptions } options - Indicates interaction option object use to show the ad. options is required. + * @param { common.UIAbilityContext } context - Indicates the ui ability context of the media application. + * @throws { BusinessError } 401 - Invalid input parameter. Possible causes: 1. Mandatory parameters are left unspecified. + * @throws { BusinessError } 21800001 - System internal error. + * @throws { BusinessError } 21800004 - Failed to display the ad. + * @syscap SystemCapability.Advertising.Ads + * @atomicservice + * @since 12 + */ + function showAd(ad: Advertisement, options: AdDisplayOptions, context?: common.UIAbilityContext): void; + /** + * Provides the functions of loading ads. + * @syscap SystemCapability.Advertising.Ads + * @since 11 + */ + /** + * Provides the functions of loading ads. + * @syscap SystemCapability.Advertising.Ads + * @atomicservice + * @since 12 + */ + export class AdLoader { + /** + * Constructs a adLoader object, context should be transferred. + * @param { common.Context } context - Indicates the context of the media application. + * @syscap SystemCapability.Advertising.Ads + * @since 11 + */ + /** + * Constructs a adLoader object, context should be transferred. + * @param { common.Context } context - Indicates the context of the media application. + * @syscap SystemCapability.Advertising.Ads + * @atomicservice + * @since 12 + */ + constructor(context: common.Context); + /** + * Load ad. + * @param { AdRequestParams } adParam - Indicates the parameters in the request. adParam.adId is required. + *
adParam.adType must be number and valid. adParam.adWidth and adParam.adHeight must be number and greater than zero + * @param { AdOptions } adOptions - Indicates the ad options. + * @param { AdLoadListener } listener - Indicates the listener to be registered that use to load ad. + * @throws { BusinessError } 401 - Invalid input parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3.Parameter verification failed + * @throws { BusinessError } 21800001 - System internal error. + * @throws { BusinessError } 21800003 - Failed to load the ad request. + * @syscap SystemCapability.Advertising.Ads + * @since 11 + */ + /** + * Load ad. + * @param { AdRequestParams } adParam - Indicates the parameters in the request. adParam.adId is required. + *
adParam.adType must be number and valid. adParam.adWidth and adParam.adHeight must be number and greater than zero + * @param { AdOptions } adOptions - Indicates the ad options. + * @param { AdLoadListener } listener - Indicates the listener to be registered that use to load ad. + * @throws { BusinessError } 401 - Invalid input parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3.Parameter verification failed + * @throws { BusinessError } 21800001 - System internal error. + * @throws { BusinessError } 21800003 - Failed to load the ad request. + * @syscap SystemCapability.Advertising.Ads + * @atomicservice + * @since 12 + */ + loadAd(adParam: AdRequestParams, adOptions: AdOptions, listener: AdLoadListener): void; + /** + * Load ad with multi-slots. + * @param { AdRequestParams[] } adParams - Indicates the parameters in the request. adParam.adId is required. + *
adParam.adType must be number and valid. adParam.adWidth and adParam.adHeight must be number and greater than zero + * @param { AdOptions } adOptions - Indicates the ad options. + * @param { MultiSlotsAdLoadListener } listener - Indicates the listener to be registered that use to load ad. + * @throws { BusinessError } 401 - Invalid input parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3.Parameter verification failed + * @throws { BusinessError } 21800001 - System internal error. + * @throws { BusinessError } 21800003 - Failed to load the ad request. + * @syscap SystemCapability.Advertising.Ads + * @since 11 + */ + /** + * Load ad with multi-slots. + * @param { AdRequestParams[] } adParams - Indicates the parameters in the request. adParam.adId is required. + *
adParam.adType must be number and valid. adParam.adWidth,adParam.adHeight must be number and greater than zero + * @param { AdOptions } adOptions - Indicates the ad options. + * @param { MultiSlotsAdLoadListener } listener - Indicates the listener to be registered that use to load ad. + * @throws { BusinessError } 401 - Invalid input parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3.Parameter verification failed + * @throws { BusinessError } 21800001 - System internal error. + * @throws { BusinessError } 21800003 - Failed to load the ad request. + * @syscap SystemCapability.Advertising.Ads + * @atomicservice + * @since 12 + */ + loadAdWithMultiSlots(adParams: AdRequestParams[], adOptions: AdOptions, listener: MultiSlotsAdLoadListener): void; + } + /** + * Get message body for ad requesting. + * @param { AdRequestParams[] } adParams - Indicates the parameters in the request. + * @param { AdOptions } adOptions - Indicates the ad options. + * @returns { Promise } The promise of ad request message body. + * @throws { BusinessError } 401 - Invalid input parameter. Possible causes: 1. Mandatory parameters are left unspecified. + * @throws { BusinessError } 21800001 - System internal error. + * @syscap SystemCapability.Advertising.Ads + * @since 12 + */ + function getAdRequestBody(adParams: AdRequestParams[], adOptions: AdOptions): Promise; + /** + * Pass ad response message and parse into advertisements. + * @param { string } adResponse - Indicate the ad response message. + * @param { MultiSlotsAdLoadListener } listener - Indicates the listener to be registered that use to load ad. + * @param { common.UIAbilityContext } context - Indicates the ui ability context of the media application. + * @throws { BusinessError } 401 - Invalid input parameter.Possible causes: 1. Mandatory parameters are left unspecified. + * @throws { BusinessError } 21800001 - System internal error. + * @throws { BusinessError } 21800005 - Failed to parse the ad response. + * @syscap SystemCapability.Advertising.Ads + * @since 12 + */ + function parseAdResponse(adResponse: string, listener: MultiSlotsAdLoadListener, context: common.UIAbilityContext): void; + /** + * Register ad javascript proxy interface into webview in order to enable web Ad. + * @param { web_webview.WebviewController } controller - Indicates webview controller to register ad javascript proxy interface. + * @param { common.UIAbilityContext } context - Indicates the ui ability context of the media application. + * @throws { BusinessError } 401 - Invalid input parameter. Possible causes: 1. Mandatory parameters are left unspecified. + * @throws { BusinessError } 21800001 - System internal error. + * @syscap SystemCapability.Advertising.Ads + * @atomicservice + * @since 12 + */ + function registerWebAdInterface(controller: web_webview.WebviewController, context: common.UIAbilityContext): void; +} +export default advertising; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.ai.mindSporeLite.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.ai.mindSporeLite.d.ts new file mode 100755 index 00000000..f7349a17 --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.ai.mindSporeLite.d.ts @@ -0,0 +1,867 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit MindSporeLiteKit + */ +import { Callback } from './@ohos.base'; +/** + * @namespace mindSporeLite + * @syscap SystemCapability.AI.MindSporeLite + * @stagemodelonly + * @since 10 + */ +declare namespace mindSporeLite { + /** + * Create a Model instance from file path + * @param { string } model - model indicates model path to be loaded + * @param { Context } context - context indicates model context information + * @returns { Promise } the promise returned by the function. + * @syscap SystemCapability.AI.MindSporeLite + * @stagemodelonly + * @since 10 + */ + function loadModelFromFile(model: string, context?: Context): Promise; + /** + * Create a Model instance from file path. + * @param { string } model - model indicates model path to be loaded + * @param { callback: Callback } callback - the callback of model + * @syscap SystemCapability.AI.MindSporeLite + * @stagemodelonly + * @since 10 + */ + function loadModelFromFile(model: string, callback: Callback): void; + /** + * Create a Model instance from file path. + * @param { string } model - model indicates model path to be loaded + * @param { Context } [context] - context indicates model context information + * @param { callback: Callback } callback - the callback of model + * @syscap SystemCapability.AI.MindSporeLite + * @stagemodelonly + * @since 10 + */ + function loadModelFromFile(model: string, context: Context, callback: Callback): void; + /** + * Create a Model instance from buffer + * @param { ArrayBuffer } model - model indicates model buffer to be loaded + * @param { Context } context - context indicates model context information + * @returns { Promise } the promise returned by the function. + * @syscap SystemCapability.AI.MindSporeLite + * @stagemodelonly + * @since 10 + */ + function loadModelFromBuffer(model: ArrayBuffer, context?: Context): Promise; + /** + * Create a Model instance from buffer + * @param { ArrayBuffer } model - model indicates model buffer to be loaded + * @param { callback: Callback } callback - the callback of model + * @syscap SystemCapability.AI.MindSporeLite + * @stagemodelonly + * @since 10 + */ + function loadModelFromBuffer(model: ArrayBuffer, callback: Callback): void; + /** + * Create a Model instance from buffer + * @param { ArrayBuffer } model - model indicates model buffer to be loaded + * @param { Context } [context] - context indicates model context information + * @param { callback: Callback } callback - the callback of model + * @syscap SystemCapability.AI.MindSporeLite + * @stagemodelonly + * @since 10 + */ + function loadModelFromBuffer(model: ArrayBuffer, context: Context, callback: Callback): void; + /** + * Creates a Model instance file description + * @param { number } model - model indicates model file description to be loaded + * @param { Context } context - context indicates model context information + * @returns { Promise } the promise returned by the function. + * @syscap SystemCapability.AI.MindSporeLite + * @stagemodelonly + * @since 10 + */ + function loadModelFromFd(model: number, context?: Context): Promise; + /** + * Create a Model instance from file description + * @param { number } model - model indicates model file description to be loaded + * @param { callback: Callback } callback - the callback of model + * @syscap SystemCapability.AI.MindSporeLite + * @stagemodelonly + * @since 10 + */ + function loadModelFromFd(model: number, callback: Callback): void; + /** + * Create a Model instance from file description + * @param { number } model - model indicates model file description to be loaded + * @param { Context } [context] - context indicates model context information + * @param { callback: Callback } callback - the callback of model + * @syscap SystemCapability.AI.MindSporeLite + * @stagemodelonly + * @since 10 + */ + function loadModelFromFd(model: number, context: Context, callback: Callback): void; + /** + * Load train model from file + * @param { string } model - model file path + * @param { TrainCfg } [trainCfg] - model train configuration + * @param { Context } [context] - model build context + * @returns { Promise } the promise of the built model + * @syscap SystemCapability.AI.MindSporeLite + * @stagemodelonly + * @since 12 + */ + function loadTrainModelFromFile(model: string, trainCfg?: TrainCfg, context?: Context): Promise; + /** + * Load train model from buffer + * @param { ArrayBuffer } model - model buffer + * @param { TrainCfg } [trainCfg] - model train configuration + * @param { Context } [context] - model build context + * @returns { Promise } the promise of the built model + * @syscap SystemCapability.AI.MindSporeLite + * @stagemodelonly + * @since 12 + */ + function loadTrainModelFromBuffer(model: ArrayBuffer, trainCfg?: TrainCfg, context?: Context): Promise; + /** + * Load train model from file description + * @param { number } model - model file description + * @param { TrainCfg } [trainCfg] - model train configuration + * @param { Context } [context] - model build context + * @returns { Promise } the promise of the built model + * @syscap SystemCapability.AI.MindSporeLite + * @stagemodelonly + * @since 12 + */ + function loadTrainModelFromFd(model: number, trainCfg?: TrainCfg, context?: Context): Promise; + /** + * Provides manages model function. Including get inputs, predict ,resize. + * @typedef Model + * @syscap SystemCapability.AI.MindSporeLite + * @stagemodelonly + * @since 10 + */ + interface Model { + /** + * The learning rate of the training model + * @type {?number} + * @syscap SystemCapability.AI.MindSporeLite + * @stagemodelonly + * @since 12 + */ + learningRate?: number; + /** + * The running mode of the model + * @type {?boolean} + * @syscap SystemCapability.AI.MindSporeLite + * @stagemodelonly + * @since 12 + */ + trainMode?: boolean; + /** + * Get model input tensors. + * @returns { MSTensor[] } the MSTensor array of the inputs. + * @syscap SystemCapability.AI.MindSporeLite + * @stagemodelonly + * @since 10 + */ + getInputs(): MSTensor[]; + /** + * Infer model + * @param { MSTensor[] } inputs - indicates the MSTensor array of the inputs. + * @param { callback: Callback } callback - the callback of MSTensor array. + * @syscap SystemCapability.AI.MindSporeLite + * @stagemodelonly + * @since 10 + */ + predict(inputs: MSTensor[], callback: Callback): void; + /** + * Infer model + * @param { MSTensor[] } inputs - indicates the MSTensor array of the inputs. + * @returns { Promise } the promise returned by the function. + * @syscap SystemCapability.AI.MindSporeLite + * @stagemodelonly + * @since 10 + */ + predict(inputs: MSTensor[]): Promise; + /** + * resize model input + * @param { MSTensor[] } inputs - indicates the MSTensor array of the inputs. + * @param { Array> } dims - indicates the target new shape array + * @returns { boolean } the boolean result if the resize operation is successful + * @syscap SystemCapability.AI.MindSporeLite + * @stagemodelonly + * @since 10 + */ + resize(inputs: MSTensor[], dims: Array>): boolean; + /** + * Train model by step + * @param { MSTensor[] } inputs - indicates the MSTensor array of the inputs. + * @returns { boolean } the boolean result if the runStep operation is successful + * @syscap SystemCapability.AI.MindSporeLite + * @stagemodelonly + * @since 12 + */ + runStep(inputs: MSTensor[]): boolean; + /** + * Obtain all weights of the model + * @returns { MSTensor[] } the weight tensors of the model + * @syscap SystemCapability.AI.MindSporeLite + * @stagemodelonly + * @since 12 + */ + getWeights(): MSTensor[]; + /** + * Update weights of the model + * @param { MSTensor[] } weights - indicates the MSTensor array of the inputs + * @returns { boolean } the boolean result if updating weights operation is successful + * @syscap SystemCapability.AI.MindSporeLite + * @stagemodelonly + * @since 12 + */ + updateWeights(weights: MSTensor[]): boolean; + /** + * Setup training with virtual batches + * @param { number } virtualBatchMultiplier - virtual batch multiplier, use any number < 1 to disable + * @param { number } lr - learning rate to use for virtual batch, -1 for internal configuration + * @param { number } momentum - batch norm momentum to use for virtual batch, -1 for internal configuration + * @returns { boolean } the boolean result if the operation is successful + * @syscap SystemCapability.AI.MindSporeLite + * @stagemodelonly + * @since 12 + */ + setupVirtualBatch(virtualBatchMultiplier: number, lr: number, momentum: number): boolean; + /** + * Export train model to file + * @param { string } modelFile - model file path. + * @param { QuantizationType } [quantizationType] - the quantization type, default NO_QUANT. + * @param { boolean } [exportInferenceOnly] - whether to export a inference only model, default true. + * @param { string[] } [outputTensorName] - the set of name of output tensor the exported inference model, + * @returns { boolean } - the boolean result if the operation is successful + * @syscap SystemCapability.AI.MindSporeLite + * @stagemodelonly + * @since 12 + */ + exportModel(modelFile: string, quantizationType?: QuantizationType, exportInferenceOnly?: boolean, outputTensorName?: string[]): boolean; + /** + * Export model's weights, which can be used in micro only. Only valid for Lite Train + * @param { string } weightFile - weight file path + * @param { boolean } [isInference] - whether to export weights from inference model, only support this is `true` for now, default true + * @param { boolean } [enableFp16] - float-weight is whether to be saved in float16 format, default false + * @param { string[] } [changeableWeightsName] - changeable weights name + * @returns { boolean } the boolean result if the operation is successful + * @syscap SystemCapability.AI.MindSporeLite + * @stagemodelonly + * @since 12 + */ + exportWeightsCollaborateWithMicro(weightFile: string, isInference?: boolean, enableFp16?: boolean, changeableWeightsName?: string[]): boolean; + } + /** + * Enum for quantization type + * @enum {number} + * @syscap SystemCapability.AI.MindSporeLite + * @stagemodelonly + * @since 12 + */ + export enum QuantizationType { + /** + * No quantization. + * @syscap SystemCapability.AI.MindSporeLite + * @stagemodelonly + * @since 12 + */ + NO_QUANT = 0, + /** + * Weight quantization. + * @syscap SystemCapability.AI.MindSporeLite + * @stagemodelonly + * @since 12 + */ + WEIGHT_QUANT = 1, + /** + * Full quantization. + * @syscap SystemCapability.AI.MindSporeLite + * @stagemodelonly + * @since 12 + */ + FULL_QUANT = 2 + } + /** + * Enum for optimization level + * @enum {number} + * @syscap SystemCapability.AI.MindSporeLite + * @stagemodelonly + * @since 12 + */ + export enum OptimizationLevel { + /** + * Do not change + * @syscap SystemCapability.AI.MindSporeLite + * @stagemodelonly + * @since 12 + */ + O0 = 0, + /** + * Cast network to float16, keep batch norm and loss in float32 + * @syscap SystemCapability.AI.MindSporeLite + * @stagemodelonly + * @since 12 + */ + O2 = 2, + /** + * Cast network to float16, including batch norm + * @syscap SystemCapability.AI.MindSporeLite + * @stagemodelonly + * @since 12 + */ + O3 = 3, + /** + * Choose optimization based on device + * @syscap SystemCapability.AI.MindSporeLite + * @stagemodelonly + * @since 12 + */ + AUTO = 4 + } + /** + * Provides the train configuration + * @typedef TrainCfg + * @syscap SystemCapability.AI.MindSporeLite + * @stagemodelonly + * @since 12 + */ + interface TrainCfg { + /** + * Array of loss name + * @type {?string[]} + * @syscap SystemCapability.AI.MindSporeLite + * @stagemodelonly + * @since 12 + */ + lossName?: string[]; + /** + * Train optimization level + * @type {?OptimizationLevel} + * @syscap SystemCapability.AI.MindSporeLite + * @stagemodelonly + * @since 12 + */ + optimizationLevel?: OptimizationLevel; + } + /** + * Provides the device configurations + * @typedef Context + * @syscap SystemCapability.AI.MindSporeLite + * @stagemodelonly + * @since 10 + */ + interface Context { + /** + * The target device + * @type {string[]} + * @since 10 + */ + target?: string[]; + /** + * The cpu device information + * @type {CpuDevice} + * @since 10 + */ + cpu?: CpuDevice; + /** + * The NNRT device information + * @type {NNRTDevice} + * @since 10 + */ + nnrt?: NNRTDevice; + } + /** + * Provides the CPU device info + * @typedef CpuDevice + * @syscap SystemCapability.AI.MindSporeLite + * @stagemodelonly + * @since 10 + */ + interface CpuDevice { + /** + * The thread num + * @type {number} + * @since 10 + */ + threadNum?: number; + /** + * The thread affinity mode + * @type {ThreadAffinityMode} + * @since 10 + */ + threadAffinityMode?: ThreadAffinityMode; + /** + * The thread affinity core list + * @type {number[]} + * @since 10 + */ + threadAffinityCoreList?: number[]; + /** + * The precision mode + * @type {string} + * @since 10 + */ + precisionMode?: string; + } + /** + * Enum for performance mode + * @enum {number} + * @syscap SystemCapability.AI.MindSporeLite + * @stagemodelonly + * @since 12 + */ + export enum PerformanceMode { + /** + * No performance mode preference + * @syscap SystemCapability.AI.MindSporeLite + * @stagemodelonly + * @since 12 + */ + PERFORMANCE_NONE = 0, + /** + * Low power consumption mode + * @syscap SystemCapability.AI.MindSporeLite + * @stagemodelonly + * @since 12 + */ + PERFORMANCE_LOW = 1, + /** + * Medium performance mode + * @syscap SystemCapability.AI.MindSporeLite + * @stagemodelonly + * @since 12 + */ + PERFORMANCE_MEDIUM = 2, + /** + * High performance mode + * @syscap SystemCapability.AI.MindSporeLite + * @stagemodelonly + * @since 12 + */ + PERFORMANCE_HIGH = 3, + /** + * Ultimate performance mode + * @syscap SystemCapability.AI.MindSporeLite + * @stagemodelonly + * @since 12 + */ + PERFORMANCE_EXTREME = 4 + } + /** + * Enum for scheduling priority + * @enum {number} + * @syscap SystemCapability.AI.MindSporeLite + * @stagemodelonly + * @since 12 + */ + export enum Priority { + /** + * No priority preference + * @syscap SystemCapability.AI.MindSporeLite + * @stagemodelonly + * @since 12 + */ + PRIORITY_NONE = 0, + /** + * Low priority + * @syscap SystemCapability.AI.MindSporeLite + * @stagemodelonly + * @since 12 + */ + PRIORITY_LOW = 1, + /** + * Medium priority + * @syscap SystemCapability.AI.MindSporeLite + * @stagemodelonly + * @since 12 + */ + PRIORITY_MEDIUM = 2, + /** + * High priority + * @syscap SystemCapability.AI.MindSporeLite + * @stagemodelonly + * @since 12 + */ + PRIORITY_HIGH = 3 + } + /** + * Provides the extension information of nnrt device + * @typedef Extension + * @syscap SystemCapability.AI.MindSporeLite + * @stagemodelonly + * @since 12 + */ + interface Extension { + /** + * Extension name + * @type {string} + * @syscap SystemCapability.AI.MindSporeLite + * @stagemodelonly + * @since 12 + */ + name: string; + /** + * Extension array buffer + * @type {ArrayBuffer} + * @syscap SystemCapability.AI.MindSporeLite + * @stagemodelonly + * @since 12 + */ + value: ArrayBuffer; + } + /** + * Enum for nnrt device type + * @enum {number} + * @syscap SystemCapability.AI.MindSporeLite + * @stagemodelonly + * @since 12 + */ + export enum NNRTDeviceType { + /** + * Devices that are not CPU, GPU, or dedicated accelerator + * @syscap SystemCapability.AI.MindSporeLite + * @stagemodelonly + * @since 12 + */ + NNRTDEVICE_OTHERS = 0, + /** + * CPU device + * @syscap SystemCapability.AI.MindSporeLite + * @stagemodelonly + * @since 12 + */ + NNRTDEVICE_CPU = 1, + /** + * GPU device + * @syscap SystemCapability.AI.MindSporeLite + * @stagemodelonly + * @since 12 + */ + NNRTDEVICE_GPU = 2, + /** + * Dedicated hardware accelerator + * @syscap SystemCapability.AI.MindSporeLite + * @stagemodelonly + * @since 12 + */ + NNRTDEVICE_ACCELERATOR = 3 + } + /** + * Provides the nnrt device description + * @typedef NNRTDeviceDescription + * @syscap SystemCapability.AI.MindSporeLite + * @stagemodelonly + * @since 12 + */ + interface NNRTDeviceDescription { + /** + * Get device id + * @returns { bigint } the number of device id + * @syscap SystemCapability.AI.MindSporeLite + * @stagemodelonly + * @since 12 + */ + deviceID(): bigint; + /** + * Get device type. + * @returns { NNRTDeviceType } the device type + * @syscap SystemCapability.AI.MindSporeLite + * @stagemodelonly + * @since 12 + */ + deviceType(): NNRTDeviceType; + /** + * Get device name. + * @returns { string } device name + * @syscap SystemCapability.AI.MindSporeLite + * @stagemodelonly + * @since 12 + */ + deviceName(): string; + } + /** + * Obtain the all device descriptions in NNRT. + * @returns { NNRTDeviceDescription[] } the array of NNRTDeviceDescription + * @syscap SystemCapability.AI.MindSporeLite + * @stagemodelonly + * @since 12 + */ + function getAllNNRTDeviceDescriptions(): NNRTDeviceDescription[]; + /** + * Provides the NNRT device info + * @typedef NNRTDevice + * @syscap SystemCapability.AI.MindSporeLite + * @stagemodelonly + * @since 10 + */ + interface NNRTDevice { + /** + * NNRT device id. + * @type {?bigint} + * @syscap SystemCapability.AI.MindSporeLite + * @stagemodelonly + * @since 12 + */ + deviceID?: bigint; + /** + * NNRT device performance mode. + * @type {?PerformanceMode} + * @syscap SystemCapability.AI.MindSporeLite + * @stagemodelonly + * @since 12 + */ + performanceMode?: PerformanceMode; + /** + * NNRT device priority. + * @type {?Priority} + * @syscap SystemCapability.AI.MindSporeLite + * @stagemodelonly + * @since 12 + */ + priority?: Priority; + /** + * NNRT device extension array. + * @type {?Extension[]} + * @syscap SystemCapability.AI.MindSporeLite + * @stagemodelonly + * @since 12 + */ + extensions?: Extension[]; + } + /** + * Enum for provides CPU thread affinity mode + * @enum {number} + * @syscap SystemCapability.AI.MindSporeLite + * @stagemodelonly + * @since 10 + */ + export enum ThreadAffinityMode { + /** + * Thread affinity mode is no bind. + * @syscap SystemCapability.AI.MindSporeLite + * @since 10 + */ + NO_AFFINITIES = 0, + /** + * Thread affinity mode is big cores first + * @syscap SystemCapability.AI.MindSporeLite + * @since 10 + */ + BIG_CORES_FIRST = 1, + /** + * Thread affinity mode is little cores first + * @syscap SystemCapability.AI.MindSporeLite + * @since 10 + */ + LITTLE_CORES_FIRST = 2 + } + /** + * Provides MSTensor definition + * @typedef MSTensor + * @syscap SystemCapability.AI.MindSporeLite + * @stagemodelonly + * @since 10 + */ + interface MSTensor { + /** + * The name of the tensor. + * @type {string} + * @since 10 + */ + name: string; + /** + * The shape of the tensor. + * @type {number[]} + * @since 10 + */ + shape: number[]; + /** + * The number of elements in the tensor. + * @type {number} + * @since 10 + */ + elementNum: number; + /** + * The data size of the tensor. + * @type {number} + * @since 10 + */ + dataSize: number; + /** + * The data type of the tensor. + * @type {DataType} + * @since 10 + */ + dtype: DataType; + /** + * The format of the tensor. + * @type {DataType} + * @since 10 + */ + format: Format; + /** + * Get MSTensor data + * @returns { ArrayBuffer } the data of tensor + * @syscap SystemCapability.AI.MindSporeLite + * @stagemodelonly + * @since 10 + */ + getData(): ArrayBuffer; + /** + * Set MSTensor data + * @param { ArrayBuffer } inputArray - indicates the buffer of tensor + * @syscap SystemCapability.AI.MindSporeLite + * @stagemodelonly + * @since 10 + */ + setData(inputArray: ArrayBuffer): void; + } + /** + * Enum for provides MSTensor data type + * @enum {number} + * @syscap SystemCapability.AI.MindSporeLite + * @stagemodelonly + * @since 10 + */ + export enum DataType { + /** + * data type is unknown + * @syscap SystemCapability.AI.MindSporeLite + * @since 10 + */ + TYPE_UNKNOWN = 0, + /** + * data type is int8 + * @syscap SystemCapability.AI.MindSporeLite + * @since 10 + */ + NUMBER_TYPE_INT8 = 32, + /** + * data type is int16 + * @syscap SystemCapability.AI.MindSporeLite + * @since 10 + */ + NUMBER_TYPE_INT16 = 33, + /** + * data type is int32 + * @syscap SystemCapability.AI.MindSporeLite + * @since 10 + */ + NUMBER_TYPE_INT32 = 34, + /** + * data type is int64 + * @syscap SystemCapability.AI.MindSporeLite + * @since 10 + */ + NUMBER_TYPE_INT64 = 35, + /** + * data type is uint8 + * @syscap SystemCapability.AI.MindSporeLite + * @since 10 + */ + NUMBER_TYPE_UINT8 = 37, + /** + * data type is uint16 + * @syscap SystemCapability.AI.MindSporeLite + * @since 10 + */ + NUMBER_TYPE_UINT16 = 38, + /** + * data type is uint32 + * @syscap SystemCapability.AI.MindSporeLite + * @since 10 + */ + NUMBER_TYPE_UINT32 = 39, + /** + * data type is uint64 + * @syscap SystemCapability.AI.MindSporeLite + * @since 10 + */ + NUMBER_TYPE_UINT64 = 40, + /** + * data type is float16 + * @syscap SystemCapability.AI.MindSporeLite + * @since 10 + */ + NUMBER_TYPE_FLOAT16 = 42, + /** + * data type is float32 + * @syscap SystemCapability.AI.MindSporeLite + * @since 10 + */ + NUMBER_TYPE_FLOAT32 = 43, + /** + * data type is float64 + * @syscap SystemCapability.AI.MindSporeLite + * @since 10 + */ + NUMBER_TYPE_FLOAT64 = 44 + } + /** + * Enum for provides MSTensor format + * @enum {number} + * @syscap SystemCapability.AI.MindSporeLite + * @stagemodelonly + * @since 10 + */ + export enum Format { + /** + * data format is default + * @syscap SystemCapability.AI.MindSporeLite + * @since 10 + */ + DEFAULT_FORMAT = -1, + /** + * data format is NCHW + * @syscap SystemCapability.AI.MindSporeLite + * @since 10 + */ + NCHW = 0, + /** + * data format is NHWC + * @syscap SystemCapability.AI.MindSporeLite + * @since 10 + */ + NHWC = 1, + /** + * data format is NHWC4 + * @syscap SystemCapability.AI.MindSporeLite + * @since 10 + */ + NHWC4 = 2, + /** + * data format is HWKC + * @syscap SystemCapability.AI.MindSporeLite + * @since 10 + */ + HWKC = 3, + /** + * data format is HWCK + * @syscap SystemCapability.AI.MindSporeLite + * @since 10 + */ + HWCK = 4, + /** + * data format is KCHW + * @syscap SystemCapability.AI.MindSporeLite + * @since 10 + */ + KCHW = 5 + } +} +export default mindSporeLite; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.animator.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.animator.d.ts new file mode 100755 index 00000000..2b0efc4f --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.animator.d.ts @@ -0,0 +1,641 @@ +/* + * Copyright (c) 2020-2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit ArkUI + */ +/** + * Defines the animator options. + * @interface AnimatorOptions + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 6 + */ +/** + * Defines the animator options. + * @interface AnimatorOptions + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 10 + */ +/** + * Defines the animator options. + * @interface AnimatorOptions + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 11 + */ +export interface AnimatorOptions { + /** + * Duration of the animation, in milliseconds. + * The default value is 0. + * @type {number} + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 6 + */ + /** + * Duration of the animation, in milliseconds. + * The default value is 0. + * @type {number} + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 10 + */ + /** + * Duration of the animation, in milliseconds. + * The default value is 0. + * @type {number} + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 11 + */ + duration: number; + /** + * Time curve of the animation. For details about the supported types. + * linear The animation speed keeps unchanged. + * ease The animation starts and ends at a low speed, cubic-bezier(0.25, 0.1, 0.25, 1.0). + * ease-in The animation starts at a low speed, cubic-bezier(0.42, 0.0, 1.0, 1.0). + * ease-out The animation ends at a low speed, cubic-bezier(0.0, 0.0, 0.58, 1.0). + * ease-in-out The animation starts and ends at a low speed, cubic-bezier(0.42, 0.0, 0.58, 1.0). + * fast-out-slow-in Standard curve, cubic-bezier(0.4, 0.0, 0.2, 1.0). + * linear-out-slow-in Deceleration curve, cubic-bezier(0.0, 0.0, 0.2, 1.0). + * fast-out-linear-in Acceleration curve, cubic-bezier(0.4, 0.0, 1.0, 1.0). + * friction Damping curve, cubic-bezier(0.2, 0.0, 0.2, 1.0). + * extreme-deceleration Extreme deceleration curve, cubic-bezier(0.0, 0.0, 0.0, 1.0). + * sharp Sharp curve, cubic-bezier(0.33, 0.0, 0.67, 1.0). + * rhythm Rhythm curve, cubic-bezier(0.7, 0.0, 0.2, 1.0). + * smooth Smooth curve, cubic-bezier(0.4, 0.0, 0.4, 1.0). + * cubic-bezier(x1, y1, x2, y2) You can customize an animation speed curve in the cubic-bezier() function. The x and y values of each input parameter must be between 0 and 1. + * Step curve. The number must be set and only an integer is supported, step-position is optional. It can be set to start or end. The default value is end. + * The default value is ease. + * @type {string} + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 6 + */ + /** + * Time curve of the animation. For details about the supported types. + * linear The animation speed keeps unchanged. + * ease The animation starts and ends at a low speed, cubic-bezier(0.25, 0.1, 0.25, 1.0). + * ease-in The animation starts at a low speed, cubic-bezier(0.42, 0.0, 1.0, 1.0). + * ease-out The animation ends at a low speed, cubic-bezier(0.0, 0.0, 0.58, 1.0). + * ease-in-out The animation starts and ends at a low speed, cubic-bezier(0.42, 0.0, 0.58, 1.0). + * fast-out-slow-in Standard curve, cubic-bezier(0.4, 0.0, 0.2, 1.0). + * linear-out-slow-in Deceleration curve, cubic-bezier(0.0, 0.0, 0.2, 1.0). + * fast-out-linear-in Acceleration curve, cubic-bezier(0.4, 0.0, 1.0, 1.0). + * friction Damping curve, cubic-bezier(0.2, 0.0, 0.2, 1.0). + * extreme-deceleration Extreme deceleration curve, cubic-bezier(0.0, 0.0, 0.0, 1.0). + * sharp Sharp curve, cubic-bezier(0.33, 0.0, 0.67, 1.0). + * rhythm Rhythm curve, cubic-bezier(0.7, 0.0, 0.2, 1.0). + * smooth Smooth curve, cubic-bezier(0.4, 0.0, 0.4, 1.0). + * cubic-bezier(x1, y1, x2, y2) You can customize an animation speed curve in the cubic-bezier() function. The x and y values of each input parameter must be between 0 and 1. + * Step curve. The number must be set and only an integer is supported, step-position is optional. It can be set to start or end. The default value is end. + * The default value is ease. + * @type {string} + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 10 + */ + /** + * Time curve of the animation. For details about the supported types. + * linear The animation speed keeps unchanged. + * ease The animation starts and ends at a low speed, cubic-bezier(0.25, 0.1, 0.25, 1.0). + * ease-in The animation starts at a low speed, cubic-bezier(0.42, 0.0, 1.0, 1.0). + * ease-out The animation ends at a low speed, cubic-bezier(0.0, 0.0, 0.58, 1.0). + * ease-in-out The animation starts and ends at a low speed, cubic-bezier(0.42, 0.0, 0.58, 1.0). + * fast-out-slow-in Standard curve, cubic-bezier(0.4, 0.0, 0.2, 1.0). + * linear-out-slow-in Deceleration curve, cubic-bezier(0.0, 0.0, 0.2, 1.0). + * fast-out-linear-in Acceleration curve, cubic-bezier(0.4, 0.0, 1.0, 1.0). + * friction Damping curve, cubic-bezier(0.2, 0.0, 0.2, 1.0). + * extreme-deceleration Extreme deceleration curve, cubic-bezier(0.0, 0.0, 0.0, 1.0). + * sharp Sharp curve, cubic-bezier(0.33, 0.0, 0.67, 1.0). + * rhythm Rhythm curve, cubic-bezier(0.7, 0.0, 0.2, 1.0). + * smooth Smooth curve, cubic-bezier(0.4, 0.0, 0.4, 1.0). + * cubic-bezier(x1, y1, x2, y2) You can customize an animation speed curve in the cubic-bezier() function. The x and y values of each input parameter must be between 0 and 1. + * Step curve. The number must be set and only an integer is supported, step-position is optional. It can be set to start or end. The default value is end. + * interpolating-spring(velocity, mass, stiffness, damping), interpolating spring curve. + * The default value is ease. + * @type {string} + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 11 + */ + easing: string; + /** + * Delay for the animation start. The default value indicates no delay. + * The default value is 0. + * @type {number} + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 6 + */ + /** + * Delay for the animation start. The default value indicates no delay. + * The default value is 0. + * @type {number} + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 10 + */ + /** + * Delay for the animation start. The default value indicates no delay. + * The default value is 0. + * @type {number} + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 11 + */ + delay: number; + /** + * Whether to resume to the initial state after the animation is executed. + * none: The initial state is restored after the animation is executed. + * forwards: The state at the end of the animation (defined in the last key frame) is retained after the animation is executed. + * @type {"none" | "forwards" | "backwards" | "both"} + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 6 + */ + /** + * Whether to resume to the initial state after the animation is executed. + * none: The initial state is restored after the animation is executed. + * forwards: The state at the end of the animation (defined in the last key frame) is retained after the animation is executed. + * @type {"none" | "forwards" | "backwards" | "both"} + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 10 + */ + /** + * Whether to resume to the initial state after the animation is executed. + * none: The initial state is restored after the animation is executed. + * forwards: The state at the end of the animation (defined in the last key frame) is retained after the animation is executed. + * @type {"none" | "forwards" | "backwards" | "both"} + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 11 + */ + fill: "none" | "forwards" | "backwards" | "both"; + /** + * The animation playback mode. + * The default value is "normal". + * @type {"normal" | "reverse" | "alternate" | "alternate-reverse"} + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 6 + */ + /** + * The animation playback mode. + * The default value is "normal". + * @type {"normal" | "reverse" | "alternate" | "alternate-reverse"} + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 10 + */ + /** + * The animation playback mode. + * The default value is "normal". + * @type {"normal" | "reverse" | "alternate" | "alternate-reverse"} + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 11 + */ + direction: "normal" | "reverse" | "alternate" | "alternate-reverse"; + /** + * Number of times the animation will be played. number indicates a fixed number of playback operations, and -1 an unlimited number of playback operations. + * The default value is 1. + * @type {number} + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 6 + */ + /** + * Number of times the animation will be played. number indicates a fixed number of playback operations, and -1 an unlimited number of playback operations. + * The default value is 1. + * @type {number} + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 10 + */ + /** + * Number of times the animation will be played. number indicates a fixed number of playback operations, and -1 an unlimited number of playback operations. + * The default value is 1. + * @type {number} + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 11 + */ + iterations: number; + /** + * Starting point of animator interpolation. + * The default value is 0. + * @type {number} + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 6 + */ + /** + * Starting point of animator interpolation. + * The default value is 0. + * @type {number} + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 10 + */ + /** + * Starting point of animator interpolation. + * The default value is 0. + * @type {number} + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 11 + */ + begin: number; + /** + * Ending point of Dynamic Interpolation + * The default value is 1. + * @type {number} + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 6 + */ + /** + * Ending point of Dynamic Interpolation + * The default value is 1. + * @type {number} + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 10 + */ + /** + * Ending point of Dynamic Interpolation + * The default value is 1. + * @type {number} + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 11 + */ + end: number; +} +/** + * Defines the Animator result interface. + * @interface AnimatorResult + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 6 + */ +/** + * Defines the Animator result interface. + * @interface AnimatorResult + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 10 + */ +/** + * Defines the Animator result interface. + * @interface AnimatorResult + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 11 + */ +export interface AnimatorResult { + /** + * Update the options for current animator. + * @param { AnimatorOptions } options - Options. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 6 + * @deprecated since 9 + * @useinstead ohos.animator.reset + */ + update(options: AnimatorOptions): void; + /** + * Reset the options for current animator. + * @param { AnimatorOptions } options - Options. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + *
1. Mandatory parameters are left unspecified. + *
2. Incorrect parameters types. + *
3. Parameter verification failed. + * @throws { BusinessError } 100001 - if no page is found for pageId or fail to get object property list. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 9 + */ + /** + * Reset the options for current animator. + * @param { AnimatorOptions } options - Options. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + *
1. Mandatory parameters are left unspecified. + *
2. Incorrect parameters types. + *
3. Parameter verification failed. + * @throws { BusinessError } 100001 - if no page is found for pageId or fail to get object property list. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 10 + */ + /** + * Reset the options for current animator. + * @param { AnimatorOptions } options - Options. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + *
1. Mandatory parameters are left unspecified. + *
2. Incorrect parameters types. + *
3. Parameter verification failed. + * @throws { BusinessError } 100001 - if no page is found for pageId or fail to get object property list. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 11 + */ + reset(options: AnimatorOptions): void; + /** + * Starts the animation. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 6 + */ + /** + * Starts the animation. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 10 + */ + /** + * Starts the animation. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 11 + */ + play(): void; + /** + * Ends the animation. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 6 + */ + /** + * Ends the animation. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 10 + */ + /** + * Ends the animation. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 11 + */ + finish(): void; + /** + * Pauses the animation. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 6 + */ + /** + * Pauses the animation. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 10 + */ + /** + * Pauses the animation. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 11 + */ + pause(): void; + /** + * Cancels the animation. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 6 + */ + /** + * Cancels the animation. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 10 + */ + /** + * Cancels the animation. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 11 + */ + cancel(): void; + /** + * Plays the animation in reverse direction. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 6 + */ + /** + * Plays the animation in reverse direction. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 10 + */ + /** + * Plays the animation in reverse direction. + * Invalid when using interpolating-spring curve. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 11 + */ + reverse(): void; + /** + * Trigger when vsync callback. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 6 + */ + /** + * Trigger when vsync callback. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 10 + */ + /** + * Trigger when vsync callback. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 11 + * @deprecated since 12 + * @useinstead ohos.animator.onFrame + */ + onframe: (progress: number) => void; + /** + * Trigger when vSync callback. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + */ + onFrame: (progress: number) => void; + /** + * The animation is finished. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 6 + */ + /** + * The animation is finished. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 10 + */ + /** + * The animation is finished. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 11 + * @deprecated since 12 + * @useinstead ohos.animator.onFinish + */ + onfinish: () => void; + /** + * The animation is finished. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + */ + onFinish: () => void; + /** + * The animation is canceled. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 6 + */ + /** + * The animation is canceled. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 10 + */ + /** + * The animation is canceled. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 11 + * @deprecated since 12 + * @useinstead ohos.animator.onCancel + */ + oncancel: () => void; + /** + * The animation is canceled. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + */ + onCancel: () => void; + /** + * The animation is repeated. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 6 + */ + /** + * The animation is repeated. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 10 + */ + /** + * The animation is repeated. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 11 + * @deprecated since 12 + * @useinstead ohos.animator.onRepeat + */ + onrepeat: () => void; + /** + * The animation is repeated. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + */ + onRepeat: () => void; + /** + * The expected frame rate of dynamical of rate range. + * @param { ExpectedFrameRateRange } rateRange - Indicates ExpectedFrameRateRange. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 12 + */ + setExpectedFrameRateRange(rateRange: ExpectedFrameRateRange): void; +} +/** + * Defines the Animator class. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 6 + */ +/** + * Defines the Animator class. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 10 + */ +/** + * Defines the Animator class. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 11 + */ +export default class Animator { + /** + * Create an animator object for custom animation. + * @param { AnimatorOptions } options - Options. + * @returns { AnimatorResult } animator result + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 6 + * @deprecated since 9 + * @useinstead ohos.animator.create + */ + static createAnimator(options: AnimatorOptions): AnimatorResult; + /** + * Create an animator object for custom animation. + * @param { AnimatorOptions } options - Options. + * @returns { AnimatorResult } animator result + * @throws { BusinessError } 401 - Parameter error. Possible causes: + *
1. Mandatory parameters are left unspecified. + *
2. Incorrect parameters types. + *
3. Parameter verification failed. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 9 + */ + /** + * Create an animator object for custom animation. + * @param { AnimatorOptions } options - Options. + * @returns { AnimatorResult } animator result + * @throws { BusinessError } 401 - Parameter error. Possible causes: + *
1. Mandatory parameters are left unspecified. + *
2. Incorrect parameters types. + *
3. Parameter verification failed. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 10 + */ + /** + * Create an animator object for custom animation. + * @param { AnimatorOptions } options - Options. + * @returns { AnimatorResult } animator result + * @throws { BusinessError } 401 - Parameter error. Possible causes: + *
1. Mandatory parameters are left unspecified. + *
2. Incorrect parameters types. + *
3. Parameter verification failed. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 11 + */ + static create(options: AnimatorOptions): AnimatorResult; +} diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.app.ability.Ability.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.app.ability.Ability.d.ts new file mode 100755 index 00000000..16a8a2ea --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.app.ability.Ability.d.ts @@ -0,0 +1,77 @@ +/* + * Copyright (c) 2022-2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"), + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit AbilityKit + */ +import AbilityConstant from './@ohos.app.ability.AbilityConstant'; +import { Configuration } from './@ohos.app.ability.Configuration'; +/** + * The class of an ability. + * + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @StageModelOnly + * @since 9 + */ +/** + * The class of an ability. + * + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @StageModelOnly + * @atomicservice + * @since 11 + */ +export default class Ability { + /** + * Called when the system configuration is updated. + * + * @param { Configuration } newConfig - Indicates the updated configuration. + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @StageModelOnly + * @since 9 + */ + /** + * Called when the system configuration is updated. + * + * @param { Configuration } newConfig - Indicates the updated configuration. + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @StageModelOnly + * @atomicservice + * @since 11 + */ + onConfigurationUpdate(newConfig: Configuration): void; + /** + * Called when the system has determined to trim the memory, for example, when the ability is running in the + * background and there is no enough memory for running as many background processes as possible. + * + * @param { AbilityConstant.MemoryLevel } level - Indicates the memory trim level, which shows the current memory + * usage status. + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @StageModelOnly + * @since 9 + */ + /** + * Called when the system has determined to trim the memory, for example, when the ability is running in the + * background and there is no enough memory for running as many background processes as possible. + * + * @param { AbilityConstant.MemoryLevel } level - Indicates the memory trim level, which shows the current memory + * usage status. + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @StageModelOnly + * @atomicservice + * @since 11 + */ + onMemoryLevel(level: AbilityConstant.MemoryLevel): void; +} diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.app.ability.AbilityConstant.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.app.ability.AbilityConstant.d.ts new file mode 100755 index 00000000..ee947e77 --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.app.ability.AbilityConstant.d.ts @@ -0,0 +1,848 @@ +/* + * Copyright (c) 2022-2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"), + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit AbilityKit + */ +/** + * The definition of AbilityConstant. + * + * @namespace AbilityConstant + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @since 9 + */ +/** + * The definition of AbilityConstant. + * + * @namespace AbilityConstant + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @crossplatform + * @since 10 + */ +/** + * The definition of AbilityConstant. + * + * @namespace AbilityConstant + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @crossplatform + * @atomicservice + * @since 11 + */ +declare namespace AbilityConstant { + /** + * Interface of launch param. + * + * @typedef LaunchParam + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @since 9 + */ + /** + * Interface of launch param. + * + * @typedef LaunchParam + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @crossplatform + * @since 10 + */ + /** + * Interface of launch param. + * + * @typedef LaunchParam + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @crossplatform + * @atomicservice + * @since 11 + */ + export interface LaunchParam { + /** + * Indicates launch reason. + * + * @type { LaunchReason } + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @since 9 + */ + /** + * Indicates launch reason. + * + * @type { LaunchReason } + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @crossplatform + * @since 10 + */ + /** + * Indicates launch reason. + * + * @type { LaunchReason } + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @crossplatform + * @atomicservice + * @since 11 + */ + launchReason: LaunchReason; + /** + * Indicates last exit reason. + * + * @type { LastExitReason } + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @since 9 + */ + /** + * Indicates last exit reason. + * + * @type { LastExitReason } + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @crossplatform + * @since 10 + */ + /** + * Indicates last exit reason. + * + * @type { LastExitReason } + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @crossplatform + * @atomicservice + * @since 11 + */ + lastExitReason: LastExitReason; + /** + * Indicates last exit detailed reason. + * + * @type { string } + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @atomicservice + * @since 12 + */ + lastExitMessage: string; + } + /** + * Type of launch reason. + * + * @enum { number } + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @since 9 + */ + /** + * Type of launch reason. + * + * @enum { number } + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @crossplatform + * @since 10 + */ + /** + * Type of launch reason. + * + * @enum { number } + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @crossplatform + * @atomicservice + * @since 11 + */ + export enum LaunchReason { + /** + * Unknown reason. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @since 9 + */ + /** + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @crossplatform + * @since 10 + */ + /** + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @crossplatform + * @atomicservice + * @since 11 + */ + UNKNOWN = 0, + /** + * Start ability through the startAbility interface. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @since 9 + */ + /** + * Start ability through the startAbility interface. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @atomicservice + * @since 11 + */ + START_ABILITY = 1, + /** + * Start ability through the startAbilityByCall interface. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @since 9 + */ + /** + * Start ability through the startAbilityByCall interface. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @atomicservice + * @since 11 + */ + CALL = 2, + /** + * Start ability through cross-end device migration. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @since 9 + */ + /** + * Start ability through cross-end device migration. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @atomicservice + * @since 11 + */ + CONTINUATION = 3, + /** + * After the application is restored, the ability is automatically restored and started when the application fails. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @since 9 + */ + /** + * After the application is restored, the ability is automatically restored and started when the application fails. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @atomicservice + * @since 11 + */ + APP_RECOVERY = 4, + /** + * Start ability through the acquireShareData interface. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @since 10 + */ + /** + * Start ability through the acquireShareData interface. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @atomicservice + * @since 11 + */ + SHARE = 5, + /** + * Start ability by booting it up. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @since 11 + */ + AUTO_STARTUP = 8, + /** + * Start ability through the insight intent interface. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @atomicservice + * @since 11 + */ + INSIGHT_INTENT = 9 + } + /** + * Type of last exit reason. + * + * @enum { number } + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @since 9 + */ + /** + * Type of last exit reason. + * + * @enum { number } + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @crossplatform + * @since 10 + */ + /** + * Type of last exit reason. + * + * @enum { number } + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @crossplatform + * @atomicservice + * @since 11 + */ + export enum LastExitReason { + /** + * Exit reason : Unknown. The reason for the last exit of the target application is not recorded in the application + * framework. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @since 9 + */ + /** + * Exit reason : Unknown. The reason for the last exit of the target application is not recorded in the application + * framework. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @crossplatform + * @since 10 + */ + /** + * Exit reason : Unknown. The reason for the last exit of the target application is not recorded in the application + * framework. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @crossplatform + * @atomicservice + * @since 11 + */ + UNKNOWN = 0, + /** + * Exit reason : Ability is not responding. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @since 9 + * @deprecated since 10 + * @useinstead AbilityConstant.LastExitReason#APP_FREEZE + */ + ABILITY_NOT_RESPONDING = 1, + /** + * Exit reason : normally. App exit due to user active close. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @since 9 + */ + /** + * Exit reason : normally. App exit due to user active close. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @atomicservice + * @since 11 + */ + NORMAL = 2, + /** + * Exit reason : cpp crash. The app exit due to native exception signal. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @since 10 + */ + /** + * Exit reason : cpp crash. The app exit due to native exception signal. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @atomicservice + * @since 11 + */ + CPP_CRASH = 3, + /** + * Exit reason : js error. App exit due to js error. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @since 10 + */ + /** + * Exit reason : js error. App exit due to js error. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @atomicservice + * @since 11 + */ + JS_ERROR = 4, + /** + * Exit reason : app freeze. App exit due to appFreeze error. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @since 10 + */ + /** + * Exit reason : app freeze. App exit due to appFreeze error. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @atomicservice + * @since 11 + */ + APP_FREEZE = 5, + /** + * Exit reason : performance control. App exit due to system performance issues, such as device low memory. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @since 10 + */ + /** + * Exit reason : performance control. App exit due to system performance issues, such as device low memory. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @atomicservice + * @since 11 + */ + PERFORMANCE_CONTROL = 6, + /** + * Exit reason : resource control. App exit due to resource usage violation, such as exceed cpu/io/memory usage. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @since 10 + */ + /** + * Exit reason : resource control. App exit due to resource usage violation, such as exceed cpu/io/memory usage. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @atomicservice + * @since 11 + */ + RESOURCE_CONTROL = 7, + /** + * Exit reason : upgrade. App exit due to upgrade. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @since 10 + */ + /** + * Exit reason : upgrade. App exit due to upgrade. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @atomicservice + * @since 11 + */ + UPGRADE = 8 + } + /** + * Type of onContinue result. + * + * @enum { number } + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @since 9 + */ + /** + * Type of onContinue result. + * + * @enum { number } + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @atomicservice + * @since 11 + */ + export enum OnContinueResult { + /** + * Agree to the result of Ability migration. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @since 9 + */ + /** + * Agree to the result of Ability migration. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @atomicservice + * @since 11 + */ + AGREE = 0, + /** + * Reject to the result of Ability migration. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @since 9 + */ + /** + * Reject to the result of Ability migration. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @atomicservice + * @since 11 + */ + REJECT = 1, + /** + * Mismatch to the result of Ability migration. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @since 9 + */ + /** + * Mismatch to the result of Ability migration. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @atomicservice + * @since 11 + */ + MISMATCH = 2 + } + /** + * Type of memory level. + * + * @enum { number } + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @since 9 + */ + /** + * Type of memory level. + * + * @enum { number } + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @atomicservice + * @since 11 + */ + export enum MemoryLevel { + /** + * Memory footprint is moderate. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @since 9 + */ + /** + * Memory footprint is moderate. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @atomicservice + * @since 11 + */ + MEMORY_LEVEL_MODERATE = 0, + /** + * Low memory footprint. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @since 9 + */ + /** + * Low memory footprint. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @atomicservice + * @since 11 + */ + MEMORY_LEVEL_LOW = 1, + /** + * High memory footprint. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @since 9 + */ + /** + * High memory footprint. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @atomicservice + * @since 11 + */ + MEMORY_LEVEL_CRITICAL = 2 + } + /** + * Type of window mode. + * + * @enum { number } + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @since 12 + */ + export enum WindowMode { + /** + * Primary screen in split-screen mode. If the screen is horizontal, it means the left split screen. + * It is valid only in intra-app redirection scenarios. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @since 12 + */ + WINDOW_MODE_SPLIT_PRIMARY = 100, + /** + * Secondary screen in split-screen mode. If the screen is horizontal, it means the right split screen. + * It is valid only in intra-app redirection scenarios. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @since 12 + */ + WINDOW_MODE_SPLIT_SECONDARY = 101 + } + /** + * Type of onSave result. + * + * @enum { number } + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @since 9 + */ + /** + * Type of onSave result. + * + * @enum { number } + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @atomicservice + * @since 11 + */ + export enum OnSaveResult { + /** + * Always agree to save the state. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @since 9 + */ + /** + * Always agree to save the state. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @atomicservice + * @since 11 + */ + ALL_AGREE = 0, + /** + * Refuse to migrate the saved state. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @since 9 + */ + /** + * Refuse to migrate the saved state. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @atomicservice + * @since 11 + */ + CONTINUATION_REJECT = 1, + /** + * Migration mismatch. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @since 9 + */ + /** + * Migration mismatch. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @atomicservice + * @since 11 + */ + CONTINUATION_MISMATCH = 2, + /** + * Agree to restore the saved state. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @since 9 + */ + /** + * Agree to restore the saved state. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @atomicservice + * @since 11 + */ + RECOVERY_AGREE = 3, + /** + * Refuse to restore the saved state. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @since 9 + */ + /** + * Refuse to restore the saved state. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @atomicservice + * @since 11 + */ + RECOVERY_REJECT = 4, + /** + * Always refuses to save the state. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @since 9 + */ + /** + * Always refuses to save the state. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @atomicservice + * @since 11 + */ + ALL_REJECT + } + /** + * Type of save state. + * + * @enum { number } + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @since 9 + */ + /** + * Type of save state. + * + * @enum { number } + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @atomicservice + * @since 11 + */ + export enum StateType { + /** + * Migrate and save the state. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @since 9 + */ + /** + * Migrate and save the state. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @atomicservice + * @since 11 + */ + CONTINUATION = 0, + /** + * App recovery to restore the saved state. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @since 9 + */ + /** + * App recovery to restore the saved state. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @atomicservice + * @since 11 + */ + APP_RECOVERY = 1 + } + /** + * Continue state. + * + * @enum { number } + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @since 10 + */ + /** + * Continue state. + * + * @enum { number } + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @atomicservice + * @since 11 + */ + export enum ContinueState { + /** + * Mission continuable active. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @since 10 + */ + /** + * Mission continuable inactive. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @atomicservice + * @since 11 + */ + ACTIVE = 0, + /** + * Mission continuable inactive. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @since 10 + */ + /** + * Mission continuable inactive. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @atomicservice + * @since 11 + */ + INACTIVE = 1 + } +} +export default AbilityConstant; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.app.ability.AbilityLifecycleCallback.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.app.ability.AbilityLifecycleCallback.d.ts new file mode 100755 index 00000000..6619612d --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.app.ability.AbilityLifecycleCallback.d.ts @@ -0,0 +1,278 @@ +/* + * Copyright (c) 2022-2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"), + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit AbilityKit + */ +import UIAbility from './@ohos.app.ability.UIAbility'; +import window from './@ohos.window'; +/** + * The ability lifecycle callback. + * + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @StageModelOnly + * @since 9 + */ +/** + * The ability lifecycle callback. + * + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @StageModelOnly + * @crossplatform + * @since 10 + */ +/** + * The ability lifecycle callback. + * + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @StageModelOnly + * @crossplatform + * @atomicservice + * @since 11 + */ +export default class AbilityLifecycleCallback { + /** + * Called back when an ability is started for initialization. + * + * @param { UIAbility } ability - Indicates the ability to register for listening. + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @StageModelOnly + * @since 9 + */ + /** + * Called back when an ability is started for initialization. + * + * @param { UIAbility } ability - Indicates the ability to register for listening. + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @StageModelOnly + * @crossplatform + * @since 10 + */ + /** + * Called back when an ability is started for initialization. + * + * @param { UIAbility } ability - Indicates the ability to register for listening. + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @StageModelOnly + * @crossplatform + * @atomicservice + * @since 11 + */ + onAbilityCreate(ability: UIAbility): void; + /** + * Called back when a window stage is created. + * + * @param { UIAbility } ability - Indicates the ability to register for listening. + * @param { window.WindowStage } windowStage - window stage to create + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @StageModelOnly + * @since 9 + */ + /** + * Called back when a window stage is created. + * + * @param { UIAbility } ability - Indicates the ability to register for listening. + * @param { window.WindowStage } windowStage - window stage to create + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @StageModelOnly + * @crossplatform + * @since 10 + */ + /** + * Called back when a window stage is created. + * + * @param { UIAbility } ability - Indicates the ability to register for listening. + * @param { window.WindowStage } windowStage - window stage to create + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @StageModelOnly + * @crossplatform + * @atomicservice + * @since 11 + */ + onWindowStageCreate(ability: UIAbility, windowStage: window.WindowStage): void; + /** + * Called back when a window stage is active. + * + * @param { UIAbility } ability - Indicates the ability to register for listening. + * @param { window.WindowStage } windowStage - window stage to active + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @StageModelOnly + * @since 9 + */ + /** + * Called back when a window stage is active. + * + * @param { UIAbility } ability - Indicates the ability to register for listening. + * @param { window.WindowStage } windowStage - window stage to active + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @StageModelOnly + * @atomicservice + * @since 11 + */ + onWindowStageActive(ability: UIAbility, windowStage: window.WindowStage): void; + /** + * Called back when a window stage is inactive. + * + * @param { UIAbility } ability - Indicates the ability to register for listening. + * @param { window.WindowStage } windowStage - window stage to inactive + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @StageModelOnly + * @since 9 + */ + /** + * Called back when a window stage is inactive. + * + * @param { UIAbility } ability - Indicates the ability to register for listening. + * @param { window.WindowStage } windowStage - window stage to inactive + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @StageModelOnly + * @atomicservice + * @since 11 + */ + onWindowStageInactive(ability: UIAbility, windowStage: window.WindowStage): void; + /** + * Called back when a window stage is destroyed. + * + * @param { UIAbility } ability - Indicates the ability to register for listening. + * @param { window.WindowStage } windowStage - window stage to destroy + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @StageModelOnly + * @since 9 + */ + /** + * Called back when a window stage is destroyed. + * + * @param { UIAbility } ability - Indicates the ability to register for listening. + * @param { window.WindowStage } windowStage - window stage to destroy + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @StageModelOnly + * @crossplatform + * @since 10 + */ + /** + * Called back when a window stage is destroyed. + * + * @param { UIAbility } ability - Indicates the ability to register for listening. + * @param { window.WindowStage } windowStage - window stage to destroy + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @StageModelOnly + * @crossplatform + * @atomicservice + * @since 11 + */ + onWindowStageDestroy(ability: UIAbility, windowStage: window.WindowStage): void; + /** + * Called back when an ability is destroyed. + * + * @param { UIAbility } ability - Indicates the ability to register for listening. + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @StageModelOnly + * @since 9 + */ + /** + * Called back when an ability is destroyed. + * + * @param { UIAbility } ability - Indicates the ability to register for listening. + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @StageModelOnly + * @crossplatform + * @since 10 + */ + /** + * Called back when an ability is destroyed. + * + * @param { UIAbility } ability - Indicates the ability to register for listening. + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @StageModelOnly + * @crossplatform + * @atomicservice + * @since 11 + */ + onAbilityDestroy(ability: UIAbility): void; + /** + * Called back when the state of an ability changes to foreground. + * + * @param { UIAbility } ability - Indicates the ability to register for listening. + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @StageModelOnly + * @since 9 + */ + /** + * Called back when the state of an ability changes to foreground. + * + * @param { UIAbility } ability - Indicates the ability to register for listening. + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @StageModelOnly + * @crossplatform + * @since 10 + */ + /** + * Called back when the state of an ability changes to foreground. + * + * @param { UIAbility } ability - Indicates the ability to register for listening. + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @StageModelOnly + * @crossplatform + * @atomicservice + * @since 11 + */ + onAbilityForeground(ability: UIAbility): void; + /** + * Called back when the state of an ability changes to background. + * + * @param { UIAbility } ability - Indicates the ability to register for listening. + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @StageModelOnly + * @since 9 + */ + /** + * Called back when the state of an ability changes to background. + * + * @param { UIAbility } ability - Indicates the ability to register for listening. + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @StageModelOnly + * @crossplatform + * @since 10 + */ + /** + * Called back when the state of an ability changes to background. + * + * @param { UIAbility } ability - Indicates the ability to register for listening. + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @StageModelOnly + * @crossplatform + * @atomicservice + * @since 11 + */ + onAbilityBackground(ability: UIAbility): void; + /** + * Called back when an ability prepares to continue. + * + * @param { UIAbility } ability - Indicates the ability to register for listening. + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @StageModelOnly + * @since 9 + */ + /** + * Called back when an ability prepares to continue. + * + * @param { UIAbility } ability - Indicates the ability to register for listening. + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @StageModelOnly + * @atomicservice + * @since 11 + */ + onAbilityContinue(ability: UIAbility): void; +} diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.app.ability.AbilityStage.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.app.ability.AbilityStage.d.ts new file mode 100755 index 00000000..436c4b4c --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.app.ability.AbilityStage.d.ts @@ -0,0 +1,194 @@ +/* + * Copyright (c) 2022-2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"), + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit AbilityKit + */ +import AbilityConstant from './@ohos.app.ability.AbilityConstant'; +import AbilityStageContext from './application/AbilityStageContext'; +import Want from './@ohos.app.ability.Want'; +import { Configuration } from './@ohos.app.ability.Configuration'; +/** + * The class of an ability stage. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @StageModelOnly + * @since 9 + */ +/** + * The class of an ability stage. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @StageModelOnly + * @crossplatform + * @since 10 + */ +/** + * The class of an ability stage. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @StageModelOnly + * @crossplatform + * @atomicservice + * @since 11 + */ +export default class AbilityStage { + /** + * Indicates configuration information about context. + * + * @type { AbilityStageContext } + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @StageModelOnly + * @since 9 + */ + /** + * Indicates configuration information about context. + * + * @type { AbilityStageContext } + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @StageModelOnly + * @crossplatform + * @since 10 + */ + /** + * Indicates configuration information about context. + * + * @type { AbilityStageContext } + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @StageModelOnly + * @crossplatform + * @atomicservice + * @since 11 + */ + context: AbilityStageContext; + /** + * Called back when an ability stage is started for initialization. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @StageModelOnly + * @since 9 + */ + /** + * Called back when an ability stage is started for initialization. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @StageModelOnly + * @crossplatform + * @since 10 + */ + /** + * Called back when an ability stage is started for initialization. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @StageModelOnly + * @crossplatform + * @atomicservice + * @since 11 + */ + onCreate(): void; + /** + * Called back when start specified ability. + * + * @param { Want } want - Indicates the want info of started ability. + * @returns { string } The user returns an ability string ID. If the ability of this ID has been started before, + * do not create a new instance and pull it back to the top of the stack. + * Otherwise, create a new instance and start it. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @StageModelOnly + * @since 9 + */ + /** + * Called back when start specified ability. + * + * @param { Want } want - Indicates the want info of started ability. + * @returns { string } The user returns an ability string ID. If the ability of this ID has been started before, + * do not create a new instance and pull it back to the top of the stack. + * Otherwise, create a new instance and start it. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @StageModelOnly + * @atomicservice + * @since 11 + */ + onAcceptWant(want: Want): string; + /** + * Called back when start UIAbility in specified process. + * + * @param { Want } want - Indicates the want info of started ability. + * @returns { string } The user returns an process string ID. If the process of this ID has been created before, + * let the ability run in this process. Otherwise, create a new process. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @StageModelOnly + * @since 11 + */ + onNewProcessRequest(want: Want): string; + /** + * Called when the system configuration is updated. + * + * @param { Configuration } newConfig - Indicates the updated configuration. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @StageModelOnly + * @since 9 + */ + /** + * Called when the system configuration is updated. + * + * @param { Configuration } newConfig - Indicates the updated configuration. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @StageModelOnly + * @crossplatform + * @since 10 + */ + /** + * Called when the system configuration is updated. + * + * @param { Configuration } newConfig - Indicates the updated configuration. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @StageModelOnly + * @crossplatform + * @atomicservice + * @since 11 + */ + onConfigurationUpdate(newConfig: Configuration): void; + /** + * Called when the system has determined to trim the memory, for example, when the ability is running in the + * background and there is no enough memory for running as many background processes as possible. + * + * @param { AbilityConstant.MemoryLevel } level - Indicates the memory trim level, which shows the current memory usage status. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @StageModelOnly + * @since 9 + */ + /** + * Called when the system has determined to trim the memory, for example, when the ability is running in the + * background and there is no enough memory for running as many background processes as possible. + * + * @param { AbilityConstant.MemoryLevel } level - Indicates the memory trim level, which shows the current memory usage status. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @StageModelOnly + * @atomicservice + * @since 11 + */ + onMemoryLevel(level: AbilityConstant.MemoryLevel): void; + /** + * Called back when an ability stage is Destroyed. + * Will not call the onDestroy function when killing a process or crashing abnormally. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @StageModelOnly + * @atomicservice + * @since 12 + */ + onDestroy(): void; +} diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.app.ability.ActionExtensionAbility.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.app.ability.ActionExtensionAbility.d.ts new file mode 100755 index 00000000..c7ea01da --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.app.ability.ActionExtensionAbility.d.ts @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"), + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit AbilityKit + */ +import UIExtensionAbility from './@ohos.app.ability.UIExtensionAbility'; +/** + * The class of Action extension ability. + * + * @extends UIExtensionAbility + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @StageModelOnly + * @since 10 + */ +export default class ActionExtensionAbility extends UIExtensionAbility { +} diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.app.ability.ApplicationStateChangeCallback.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.app.ability.ApplicationStateChangeCallback.d.ts new file mode 100755 index 00000000..bd7fd299 --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.app.ability.ApplicationStateChangeCallback.d.ts @@ -0,0 +1,67 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"), + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit AbilityKit + */ +/** + * The application state change callback. + * + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @StageModelOnly + * @since 10 + */ +/** + * The application state change callback. + * + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @StageModelOnly + * @atomicservice + * @since 11 + */ +export default class ApplicationStateChangeCallback { + /** + * Called back when the state of the application changes to foreground. + * + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @StageModelOnly + * @since 10 + */ + /** + * Called back when the state of the application changes to foreground. + * + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @StageModelOnly + * @atomicservice + * @since 11 + */ + onApplicationForeground(): void; + /** + * Called back when the state of the application changes to background. + * + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @StageModelOnly + * @since 10 + */ + /** + * Called back when the state of the application changes to background. + * + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @StageModelOnly + * @atomicservice + * @since 11 + */ + onApplicationBackground(): void; +} diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.app.ability.AtomicServiceOptions.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.app.ability.AtomicServiceOptions.d.ts new file mode 100755 index 00000000..994cc5ea --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.app.ability.AtomicServiceOptions.d.ts @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit AbilityKit + */ +import StartOptions from './@ohos.app.ability.StartOptions'; +/** + * AtomicServiceOptions is the basic communication component of the system. + * + * @extends StartOptions + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @atomicservice + * @since 12 + */ +export default class AtomicServiceOptions extends StartOptions { + /** + * The options of the flags in this AtomicServiceOptions. + * + * @type { ?number } + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @atomicservice + * @since 12 + */ + flags?: number; + /** + * The description of the WantParams object in an AtomicServiceOptions + * + * @type { ?Record } + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @atomicservice + * @since 12 + */ + parameters?: Record; +} diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.app.ability.ChildProcess.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.app.ability.ChildProcess.d.ts new file mode 100755 index 00000000..9b59a968 --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.app.ability.ChildProcess.d.ts @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"), + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit AbilityKit + */ +/** + * The class of child process. + * Child process to be started can inherit this class. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @StageModelOnly + * @since 11 + */ +export default class ChildProcess { + /** + * Called when the child process is started. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @StageModelOnly + * @since 11 + */ + onStart(): void; +} diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.app.ability.Configuration.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.app.ability.Configuration.d.ts new file mode 100755 index 00000000..73b2a756 --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.app.ability.Configuration.d.ts @@ -0,0 +1,177 @@ +/* + * Copyright (c) 2022-2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"), + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit AbilityKit + */ +import ConfigurationConstant from './@ohos.app.ability.ConfigurationConstant'; +/** + * configuration item. + * + * @typedef Configuration + * @syscap SystemCapability.Ability.AbilityBase + * @since 9 + */ +/** + * configuration item. + * + * @typedef Configuration + * @syscap SystemCapability.Ability.AbilityBase + * @crossplatform + * @since 10 + */ +/** + * configuration item. + * + * @typedef Configuration + * @syscap SystemCapability.Ability.AbilityBase + * @crossplatform + * @atomicservice + * @since 11 + */ +export interface Configuration { + /** + * Indicates the current language of the application. + * + * @type { ?string } + * @syscap SystemCapability.Ability.AbilityBase + * @since 9 + */ + /** + * Indicates the current language of the application. + * + * @type { ?string } + * @syscap SystemCapability.Ability.AbilityBase + * @atomicservice + * @since 11 + */ + language?: string; + /** + * Indicates the current colorMode of the application. + * + * @type { ?ConfigurationConstant.ColorMode } + * @syscap SystemCapability.Ability.AbilityBase + * @since 9 + */ + /** + * Indicates the current colorMode of the application. + * + * @type { ?ConfigurationConstant.ColorMode } + * @syscap SystemCapability.Ability.AbilityBase + * @crossplatform + * @since 10 + */ + /** + * Indicates the current colorMode of the application. + * + * @type { ?ConfigurationConstant.ColorMode } + * @syscap SystemCapability.Ability.AbilityBase + * @crossplatform + * @atomicservice + * @since 11 + */ + colorMode?: ConfigurationConstant.ColorMode; + /** + * Indicates the screen direction of the current device. + * + * @type { ?ConfigurationConstant.Direction } + * @syscap SystemCapability.Ability.AbilityBase + * @since 9 + */ + /** + * Indicates the screen direction of the current device. + * + * @type { ?ConfigurationConstant.Direction } + * @syscap SystemCapability.Ability.AbilityBase + * @crossplatform + * @since 10 + */ + /** + * Indicates the screen direction of the current device. + * + * @type { ?ConfigurationConstant.Direction } + * @syscap SystemCapability.Ability.AbilityBase + * @crossplatform + * @atomicservice + * @since 11 + */ + direction?: ConfigurationConstant.Direction; + /** + * Indicates the screen density of the current device. + * + * @type { ?ConfigurationConstant.ScreenDensity } + * @syscap SystemCapability.Ability.AbilityBase + * @since 9 + */ + /** + * Indicates the screen density of the current device. + * + * @type { ?ConfigurationConstant.ScreenDensity } + * @syscap SystemCapability.Ability.AbilityBase + * @atomicservice + * @since 11 + */ + screenDensity?: ConfigurationConstant.ScreenDensity; + /** + * Indicates the displayId of the current device. + * + * @type { ?number } + * @syscap SystemCapability.Ability.AbilityBase + * @since 9 + */ + /** + * Indicates the displayId of the current device. + * + * @type { ?number } + * @syscap SystemCapability.Ability.AbilityBase + * @atomicservice + * @since 11 + */ + displayId?: number; + /** + * Indicates whether a pointer type device has connected. + * + * @type { ?boolean } + * @syscap SystemCapability.Ability.AbilityBase + * @since 9 + */ + /** + * Indicates whether a pointer type device has connected. + * + * @type { ?boolean } + * @syscap SystemCapability.Ability.AbilityBase + * @atomicservice + * @since 11 + */ + hasPointerDevice?: boolean; + /** + * Indicates the font size scale. + * + * @type { ?number } + * @syscap SystemCapability.Ability.AbilityBase + * @atomicservice + * @since 12 + */ + fontSizeScale?: number; + /** + * Indicates the font weight scale. + * + * @type { ?number } + * @syscap SystemCapability.Ability.AbilityBase + * @atomicservice + * @since 12 + */ + fontWeightScale?: number; +} diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.app.ability.ConfigurationConstant.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.app.ability.ConfigurationConstant.d.ts new file mode 100755 index 00000000..f4146813 --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.app.ability.ConfigurationConstant.d.ts @@ -0,0 +1,344 @@ +/* + * Copyright (c) 2022-2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"), + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit AbilityKit + */ +/** + * The definition of ConfigurationConstant. + * + * @namespace ConfigurationConstant + * @syscap SystemCapability.Ability.AbilityBase + * @since 9 + */ +/** + * The definition of ConfigurationConstant. + * + * @namespace ConfigurationConstant + * @syscap SystemCapability.Ability.AbilityBase + * @atomicservice + * @since 11 + */ +/** + * The definition of ConfigurationConstant. + * + * @namespace ConfigurationConstant + * @syscap SystemCapability.Ability.AbilityBase + * @crossplatform + * @atomicservice + * @since 12 + */ +declare namespace ConfigurationConstant { + /** + * Color mode + * + * @enum { number } + * @syscap SystemCapability.Ability.AbilityBase + * @since 9 + */ + /** + * Color mode + * + * @enum { number } + * @syscap SystemCapability.Ability.AbilityBase + * @crossplatform + * @since 10 + */ + /** + * Color mode + * + * @enum { number } + * @syscap SystemCapability.Ability.AbilityBase + * @crossplatform + * @atomicservice + * @since 11 + */ + export enum ColorMode { + /** + * The color mode is not set. + * + * @syscap SystemCapability.Ability.AbilityBase + * @since 9 + */ + /** + * The color mode is not set. + * + * @syscap SystemCapability.Ability.AbilityBase + * @crossplatform + * @since 10 + */ + /** + * The color mode is not set. + * + * @syscap SystemCapability.Ability.AbilityBase + * @crossplatform + * @atomicservice + * @since 11 + */ + COLOR_MODE_NOT_SET = -1, + /** + * Dark mode. + * + * @syscap SystemCapability.Ability.AbilityBase + * @since 9 + */ + /** + * Dark mode. + * + * @syscap SystemCapability.Ability.AbilityBase + * @crossplatform + * @since 10 + */ + /** + * Dark mode. + * + * @syscap SystemCapability.Ability.AbilityBase + * @crossplatform + * @atomicservice + * @since 11 + */ + COLOR_MODE_DARK = 0, + /** + * Light mode. + * + * @syscap SystemCapability.Ability.AbilityBase + * @since 9 + */ + /** + * Light mode. + * + * @syscap SystemCapability.Ability.AbilityBase + * @crossplatform + * @since 10 + */ + /** + * Light mode. + * + * @syscap SystemCapability.Ability.AbilityBase + * @crossplatform + * @atomicservice + * @since 11 + */ + COLOR_MODE_LIGHT = 1 + } + /** + * Screen direction. + * + * @enum { number } + * @syscap SystemCapability.Ability.AbilityBase + * @since 9 + */ + /** + * Screen direction. + * + * @enum { number } + * @syscap SystemCapability.Ability.AbilityBase + * @crossplatform + * @since 10 + */ + /** + * Screen direction. + * + * @enum { number } + * @syscap SystemCapability.Ability.AbilityBase + * @crossplatform + * @atomicservice + * @since 11 + */ + export enum Direction { + /** + * The direction is not set. + * + * @syscap SystemCapability.Ability.AbilityBase + * @since 9 + */ + /** + * The direction is not set. + * + * @syscap SystemCapability.Ability.AbilityBase + * @crossplatform + * @since 10 + */ + /** + * The direction is not set. + * + * @syscap SystemCapability.Ability.AbilityBase + * @crossplatform + * @atomicservice + * @since 11 + */ + DIRECTION_NOT_SET = -1, + /** + * Vertical direction. + * + * @syscap SystemCapability.Ability.AbilityBase + * @since 9 + */ + /** + * Vertical direction. + * + * @syscap SystemCapability.Ability.AbilityBase + * @crossplatform + * @since 10 + */ + /** + * Vertical direction. + * + * @syscap SystemCapability.Ability.AbilityBase + * @crossplatform + * @atomicservice + * @since 11 + */ + DIRECTION_VERTICAL = 0, + /** + * Horizontal direction. + * + * @syscap SystemCapability.Ability.AbilityBase + * @since 9 + */ + /** + * Horizontal direction. + * + * @syscap SystemCapability.Ability.AbilityBase + * @crossplatform + * @since 10 + */ + /** + * Horizontal direction. + * + * @syscap SystemCapability.Ability.AbilityBase + * @crossplatform + * @atomicservice + * @since 11 + */ + DIRECTION_HORIZONTAL = 1 + } + /** + * Screen density + * + * @enum { number } + * @syscap SystemCapability.Ability.AbilityBase + * @since 9 + */ + /** + * Screen density + * + * @enum { number } + * @syscap SystemCapability.Ability.AbilityBase + * @atomicservice + * @since 11 + */ + export enum ScreenDensity { + /** + * The screen pixel density is not set. + * + * @syscap SystemCapability.Ability.AbilityBase + * @since 9 + */ + /** + * The screen pixel density is not set. + * + * @syscap SystemCapability.Ability.AbilityBase + * @atomicservice + * @since 11 + */ + SCREEN_DENSITY_NOT_SET = 0, + /** + * Screen pixel density is 'SDPI' + * + * @syscap SystemCapability.Ability.AbilityBase + * @since 9 + */ + /** + * Screen pixel density is 'SDPI' + * + * @syscap SystemCapability.Ability.AbilityBase + * @atomicservice + * @since 11 + */ + SCREEN_DENSITY_SDPI = 120, + /** + * Screen pixel density is 'MDPI' + * + * @syscap SystemCapability.Ability.AbilityBase + * @since 9 + */ + /** + * Screen pixel density is 'MDPI' + * + * @syscap SystemCapability.Ability.AbilityBase + * @atomicservice + * @since 11 + */ + SCREEN_DENSITY_MDPI = 160, + /** + * Screen pixel density is 'LDPI' + * + * @syscap SystemCapability.Ability.AbilityBase + * @since 9 + */ + /** + * Screen pixel density is 'LDPI' + * + * @syscap SystemCapability.Ability.AbilityBase + * @atomicservice + * @since 11 + */ + SCREEN_DENSITY_LDPI = 240, + /** + * Screen pixel density is 'XLDPI' + * + * @syscap SystemCapability.Ability.AbilityBase + * @since 9 + */ + /** + * Screen pixel density is 'XLDPI' + * + * @syscap SystemCapability.Ability.AbilityBase + * @atomicservice + * @since 11 + */ + SCREEN_DENSITY_XLDPI = 320, + /** + * Screen pixel density is 'XXLDPI' + * + * @syscap SystemCapability.Ability.AbilityBase + * @since 9 + */ + /** + * Screen pixel density is 'XXLDPI' + * + * @syscap SystemCapability.Ability.AbilityBase + * @atomicservice + * @since 11 + */ + SCREEN_DENSITY_XXLDPI = 480, + /** + * Screen pixel density is 'XXXLDPI' + * + * @syscap SystemCapability.Ability.AbilityBase + * @since 9 + */ + /** + * Screen pixel density is 'XXXLDPI' + * + * @syscap SystemCapability.Ability.AbilityBase + * @atomicservice + * @since 11 + */ + SCREEN_DENSITY_XXXLDPI = 640 + } +} +export default ConfigurationConstant; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.app.ability.DriverExtensionAbility.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.app.ability.DriverExtensionAbility.d.ts new file mode 100755 index 00000000..7693d428 --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.app.ability.DriverExtensionAbility.d.ts @@ -0,0 +1,86 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"), + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit DriverDevelopmentKit + */ +import type rpc from './@ohos.rpc'; +import type Want from './@ohos.app.ability.Want'; +import _DriverExtensionContext from './application/DriverExtensionContext'; +/** + * Define a DriverExtensionContext for store context. + * + * @syscap SystemCapability.Driver.ExternalDevice + * @since 10 + */ +export type DriverExtensionContext = _DriverExtensionContext; +/** + * class of driver extension ability. + * @syscap SystemCapability.Driver.ExternalDevice + * @StageModelOnly + * @since 10 + */ +export default class DriverExtensionAbility { + /** + * Indicates driver extension ability context. + * @syscap SystemCapability.Driver.ExternalDevice + * @StageModelOnly + * @since 10 + */ + context: DriverExtensionContext; + /** + * Called back when a driver extension is started for initialization. + * @param { Want } want - Indicates the want of created driver extension. + * @syscap SystemCapability.Driver.ExternalDevice + * @StageModelOnly + * @since 10 + */ + onInit(want: Want): void; + /** + * Called back before a driver extension is destroyed. + * @syscap SystemCapability.Driver.ExternalDevice + * @StageModelOnly + * @since 10 + */ + onRelease(): void; + /** + * Called back when a driver extension is first connected to an ability. + * @param { Want } want - Indicates connection information about the Driver ability. + * @returns { rpc.RemoteObject | Promise } Rpc remoteObject. + * @syscap SystemCapability.Driver.ExternalDevice + * @StageModelOnly + * @since 10 + */ + onConnect(want: Want): rpc.RemoteObject | Promise; + /** + * Called back when all abilities connected to a driver extension are disconnected. + * @param { Want } want - Indicates disconnection information about the driver extension. + * @returns { void | Promise } + * @syscap SystemCapability.Driver.ExternalDevice + * @StageModelOnly + * @since 10 + */ + onDisconnect(want: Want): void | Promise; + /** + * Called when dump client information is required. + * It is recommended that developers don't DUMP sensitive information. + * @param { Array } params - Indicates th e params from command. + * @returns { Array } The dump info array. + * @syscap SystemCapability.Driver.ExternalDevice + * @StageModelOnly + * @since 10 + */ + onDump(params: Array): Array; +} diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.app.ability.EmbeddableUIAbility.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.app.ability.EmbeddableUIAbility.d.ts new file mode 100755 index 00000000..81efd12c --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.app.ability.EmbeddableUIAbility.d.ts @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"), + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit AbilityKit + */ +import UIAbility from './@ohos.app.ability.UIAbility'; +import type EmbeddableUIAbilityContext from './application/EmbeddableUIAbilityContext'; +/** + * class of embeddable UIAbility. + * + * @extends UIAbility + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @StageModelOnly + * @atomicservice + * @since 12 + */ +export default class EmbeddableUIAbility extends UIAbility { + /** + * Indicates accessibility embeddable UIAbility context. + * + * @type { EmbeddableUIAbilityContext } + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @StageModelOnly + * @atomicservice + * @since 12 + */ + context: EmbeddableUIAbilityContext; +} diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.app.ability.EmbeddedUIExtensionAbility.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.app.ability.EmbeddedUIExtensionAbility.d.ts new file mode 100755 index 00000000..0c6b73a5 --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.app.ability.EmbeddedUIExtensionAbility.d.ts @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"), + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit AbilityKit + */ +import UIExtensionAbility from './@ohos.app.ability.UIExtensionAbility'; +/** + * The class of embedded UI extension ability. + * + * @extends UIExtensionAbility + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @StageModelOnly + * @since 12 + */ +export default class EmbeddedUIExtensionAbility extends UIExtensionAbility { +} diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.app.ability.EnvironmentCallback.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.app.ability.EnvironmentCallback.d.ts new file mode 100755 index 00000000..333a0449 --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.app.ability.EnvironmentCallback.d.ts @@ -0,0 +1,73 @@ +/* + * Copyright (c) 2022-2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"), + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit AbilityKit + */ +import AbilityConstant from './@ohos.app.ability.AbilityConstant'; +import { Configuration } from './@ohos.app.ability.Configuration'; +/** + * The environment callback. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ +/** + * The environment callback. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @atomicservice + * @since 11 + */ +export default class EnvironmentCallback { + /** + * Called when the system configuration is updated. + * + * @param { Configuration } config - Indicates the updated configuration. + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @StageModelOnly + * @since 9 + */ + /** + * Called when the system configuration is updated. + * + * @param { Configuration } config - Indicates the updated configuration. + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @StageModelOnly + * @atomicservice + * @since 11 + */ + onConfigurationUpdated(config: Configuration): void; + /** + * Called when the system has determined to trim the memory, for example, when the ability is running in the + * background and there is no enough memory for running as many background processes as possible. + * + * @param { AbilityConstant.MemoryLevel } level - Indicates the memory trim level, which shows the current memory usage status. + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @StageModelOnly + * @since 9 + */ + /** + * Called when the system has determined to trim the memory, for example, when the ability is running in the + * background and there is no enough memory for running as many background processes as possible. + * + * @param { AbilityConstant.MemoryLevel } level - Indicates the memory trim level, which shows the current memory usage status. + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @StageModelOnly + * @atomicservice + * @since 11 + */ + onMemoryLevel(level: AbilityConstant.MemoryLevel): void; +} diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.app.ability.ExtensionAbility.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.app.ability.ExtensionAbility.d.ts new file mode 100755 index 00000000..d755efde --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.app.ability.ExtensionAbility.d.ts @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2022-2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"), + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit AbilityKit + */ +import Ability from './@ohos.app.ability.Ability'; +/** + * class of extension ability. + * + * @extends Ability + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @StageModelOnly + * @since 9 + */ +/** + * class of extension ability. + * + * @extends Ability + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @StageModelOnly + * @atomicservice + * @since 11 + */ +export default class ExtensionAbility extends Ability { +} diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.app.ability.InsightIntentContext.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.app.ability.InsightIntentContext.d.ts new file mode 100755 index 00000000..c1c1bf8e --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.app.ability.InsightIntentContext.d.ts @@ -0,0 +1,88 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"), + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit AbilityKit + */ +import type { AsyncCallback } from './@ohos.base'; +import type Want from './@ohos.app.ability.Want'; +/** + * The context of insight intent executor. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @StageModelOnly + * @atomicservice + * @since 11 + */ +export default class InsightIntentContext { + /** + * Starts a new ability. + * This interface only allows you to start abilities within the same bundle and specify the bundleName. + * This interface only allows called in UIAbility insight intent execute mode. + * + * @param { Want } want - Indicates the ability to start. + * @param { AsyncCallback } callback - The callback of startAbility. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types. + * @throws { BusinessError } 16000001 - The specified ability does not exist. + * @throws { BusinessError } 16000004 - Can not start invisible component. + * @throws { BusinessError } 16000005 - The specified process does not have the permission. + * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. + * @throws { BusinessError } 16000008 - The crowdtesting application expires. + * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode. + * @throws { BusinessError } 16000011 - The context does not exist. + * @throws { BusinessError } 16000012 - The application is controlled. + * @throws { BusinessError } 16000013 - The application is controlled by EDM. + * @throws { BusinessError } 16000050 - Internal error. + * @throws { BusinessError } 16000053 - The ability is not on the top of the UI. + * @throws { BusinessError } 16000055 - Installation-free timed out. + * @throws { BusinessError } 16000061 - Can not start component belongs to other bundle. + * @throws { BusinessError } 16200001 - The caller has been released. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @StageModelOnly + * @atomicservice + * @since 11 + */ + startAbility(want: Want, callback: AsyncCallback): void; + /** + * Starts a new ability. + * This interface only allows you to start abilities within the same bundle and specify the bundleName. + * This interface only allows called in UIAbility insight intent execute mode. + * + * @param { Want } want - Indicates the ability to start. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types. + * @throws { BusinessError } 16000001 - The specified ability does not exist. + * @throws { BusinessError } 16000004 - Can not start invisible component. + * @throws { BusinessError } 16000005 - The specified process does not have the permission. + * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. + * @throws { BusinessError } 16000008 - The crowdtesting application expires. + * @throws { BusinessError } 16000009 - An ability cannot be started or stopped in Wukong mode. + * @throws { BusinessError } 16000011 - The context does not exist. + * @throws { BusinessError } 16000012 - The application is controlled. + * @throws { BusinessError } 16000013 - The application is controlled by EDM. + * @throws { BusinessError } 16000050 - Internal error. + * @throws { BusinessError } 16000053 - The ability is not on the top of the UI. + * @throws { BusinessError } 16000055 - Installation-free timed out. + * @throws { BusinessError } 16000061 - Can not start component belongs to other bundle. + * @throws { BusinessError } 16200001 - The caller has been released. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @StageModelOnly + * @atomicservice + * @since 11 + */ + startAbility(want: Want): Promise; +} diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.app.ability.InsightIntentExecutor.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.app.ability.InsightIntentExecutor.d.ts new file mode 100755 index 00000000..f310fead --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.app.ability.InsightIntentExecutor.d.ts @@ -0,0 +1,90 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"), + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit AbilityKit + */ +import type window from './@ohos.window'; +import type insightIntent from './@ohos.app.ability.insightIntent'; +import type InsightIntentContext from './@ohos.app.ability.InsightIntentContext'; +import type UIExtensionContentSession from './@ohos.app.ability.UIExtensionContentSession'; +/** + * The class of insight intent executor. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @StageModelOnly + * @atomicservice + * @since 11 + */ +export default class InsightIntentExecutor { + /** + * Indicates context of insight intent. + * + * @type { InsightIntentContext } + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @StageModelOnly + * @atomicservice + * @since 11 + */ + context: InsightIntentContext; + /** + * Called when a UIAbility executes the insight intent in the foreground. + * + * @param { string } name - Indicates the insight intent name. + * @param { Record } param - Indicates the insight intent parameters. + * @param { window.WindowStage } pageLoader - Indicates the page loader. + * @returns { insightIntent.ExecuteResult | Promise } The result of insight intent execution, support promise. + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @StageModelOnly + * @atomicservice + * @since 11 + */ + onExecuteInUIAbilityForegroundMode(name: string, param: Record, pageLoader: window.WindowStage): insightIntent.ExecuteResult | Promise; + /** + * Called when a UIAbility executes the insight intent in the background. + * + * @param { string } name - Indicates the insight intent name. + * @param { Record } param - Indicates the insight intent parameters. + * @returns { insightIntent.ExecuteResult | Promise } The result of insight intent execution, support promise. + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @StageModelOnly + * @atomicservice + * @since 11 + */ + onExecuteInUIAbilityBackgroundMode(name: string, param: Record): insightIntent.ExecuteResult | Promise; + /** + * Called when a UIExtensionAbility executes the insight intent. + * + * @param { string } name - Indicates the insight intent name. + * @param { Record } param - Indicates the insight intent parameters. + * @param { UIExtensionContentSession } pageLoader - Indicates the page loader. + * @returns { insightIntent.ExecuteResult | Promise } The result of insight intent execution, support promise. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @StageModelOnly + * @since 11 + */ + onExecuteInUIExtensionAbility(name: string, param: Record, pageLoader: UIExtensionContentSession): insightIntent.ExecuteResult | Promise; + /** + * Called when a ServiceExtensionAbility executes the insight intent. + * + * @param { string } name - Indicates the insight intent name. + * @param { Record } param - Indicates the insight intent parameters. + * @returns { insightIntent.ExecuteResult | Promise } The result of insight intent execution, support promise. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @StageModelOnly + * @since 11 + */ + onExecuteInServiceExtensionAbility(name: string, param: Record): insightIntent.ExecuteResult | Promise; +} diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.app.ability.OpenLinkOptions.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.app.ability.OpenLinkOptions.d.ts new file mode 100755 index 00000000..e206d60a --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.app.ability.OpenLinkOptions.d.ts @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit AbilityKit + */ +/** + * Define the available options for openLink API. + * + * @interface OpenLinkOptions + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @atomicservice + * @since 12 + */ +export default interface OpenLinkOptions { + /** + * Open the URL only if the URL is a valid app linking and + * there is an installed app capable of opening that URL. + * + * @type { ?boolean } + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @atomicservice + * @since 12 + */ + appLinkingOnly?: boolean; + /** + * OpenLinkOptions parameters in the form of custom key-value pairs. + * + * @type { ?Record } + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @atomicservice + * @since 12 + */ + parameters?: Record; +} diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.app.ability.ShareExtensionAbility.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.app.ability.ShareExtensionAbility.d.ts new file mode 100755 index 00000000..cd3012e2 --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.app.ability.ShareExtensionAbility.d.ts @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"), + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit AbilityKit + */ +import UIExtensionAbility from './@ohos.app.ability.UIExtensionAbility'; +/** + * The class of Share extension ability. + * + * @extends UIExtensionAbility + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @StageModelOnly + * @since 10 + */ +export default class ShareExtensionAbility extends UIExtensionAbility { +} diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.app.ability.StartOptions.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.app.ability.StartOptions.d.ts new file mode 100755 index 00000000..1051974f --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.app.ability.StartOptions.d.ts @@ -0,0 +1,133 @@ +/* + * Copyright (c) 2022-2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit AbilityKit + */ +import contextConstant from "./@ohos.app.ability.contextConstant"; +/** + * StartOptions is the basic communication component of the system. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @since 9 + */ +/** + * StartOptions is the basic communication component of the system. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @atomicservice + * @since 11 + */ +export default class StartOptions { + /** + * The type of {@link ohos.app.ability.AbilityConstant#WindowMode} + * {@link ohos.app.ability.AbilityConstant#WindowMode.WINDOW_MODE_SPLIT_PRIMARY} and + * {@link ohos.app.ability.AbilityConstant#WindowMode.WINDOW_MODE_SPLIT_SECONDARY} are + * valid only in intra-app redirection scenarios. + * + * @type { ?number } + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @since 12 + */ + windowMode?: number; + /** + * The type of displayId + * + * @type { ?number } + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @since 9 + */ + /** + * The type of displayId + * + * @type { ?number } + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @atomicservice + * @since 11 + */ + displayId?: number; + /** + * The target ability with animation or without + * + * @type { ?boolean } + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @since 11 + */ + withAnimation?: boolean; + /** + * The left position of window rectangle + * + * @type { ?number } + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @since 11 + */ + windowLeft?: number; + /** + * The top position of window rectangle + * + * @type { ?number } + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @since 11 + */ + windowTop?: number; + /** + * The width of window rectangle + * + * @type { ?number } + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @since 11 + */ + windowWidth?: number; + /** + * The height of window rectangle + * + * @type { ?number } + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @since 11 + */ + windowHeight?: number; + /** + * The process mode. + * This property only takes effect when calling UIAbilityContext.startAbility. + * The properties processMode and startupVisibility must be set simultaneously. + * + * @type { ?contextConstant.ProcessMode } + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @since 12 + */ + processMode?: contextConstant.ProcessMode; + /** + * The ability visibility after the new process startup. + * This property only takes effect when calling UIAbilityContext.startAbility. + * The properties processMode and startupVisibility must be set simultaneously. + * + * @type { ?contextConstant.StartupVisibility } + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @since 12 + */ + startupVisibility?: contextConstant.StartupVisibility; +} diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.app.ability.UIAbility.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.app.ability.UIAbility.d.ts new file mode 100755 index 00000000..1f60c3b1 --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.app.ability.UIAbility.d.ts @@ -0,0 +1,693 @@ +/* + * Copyright (c) 2022-2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"), + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit AbilityKit + */ +import Ability from './@ohos.app.ability.Ability'; +import AbilityConstant from './@ohos.app.ability.AbilityConstant'; +import UIAbilityContext from './application/UIAbilityContext'; +import rpc from './@ohos.rpc'; +import Want from './@ohos.app.ability.Want'; +import window from './@ohos.window'; +/** + * The prototype of the listener function interface registered by the Caller. + * + * @typedef OnReleaseCallback + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @StageModelOnly + * @since 9 + */ +export interface OnReleaseCallback { + /** + * Defines the callback of OnRelease. + * + * @param { string } msg - The notification event string listened to by the OnRelease. + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @StageModelOnly + * @since 9 + */ + (msg: string): void; +} +/** + * The prototype of the listener function interface registered by the Caller. + * + * @typedef OnRemoteStateChangeCallback + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @StageModelOnly + * @since 10 + */ +export interface OnRemoteStateChangeCallback { + /** + * Defines the callback of OnRemoteStateChange. + * + * @param { string } msg - The notification event string listened to by the OnRemoteStateChange. + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @StageModelOnly + * @since 10 + */ + (msg: string): void; +} +/** + * The prototype of the message listener function interface registered by the Callee. + * + * @typedef CalleeCallback + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @StageModelOnly + * @since 9 + */ +export interface CalleeCallback { + /** + * Defines the callback of Callee. + * + * @param { rpc.MessageSequence } indata - Notification indata to the callee. + * @returns { rpc.Parcelable } Returns the callee's notification result indata. + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @StageModelOnly + * @since 9 + */ + (indata: rpc.MessageSequence): rpc.Parcelable; +} +/** + * The interface of a Caller. + * + * @interface Caller + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @StageModelOnly + * @since 9 + */ +export interface Caller { + /** + * Notify the server of Parcelable type data. + * + * @param { string } method - The notification event string listened to by the callee. + * @param { rpc.Parcelable } data - Notification data to the callee. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types. + * @throws { BusinessError } 16200001 - Caller released. The caller has been released. + * @throws { BusinessError } 16200002 - Callee invalid. The callee does not exist. + * @throws { BusinessError } 16000050 - Internal error. + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @StageModelOnly + * @since 9 + */ + call(method: string, data: rpc.Parcelable): Promise; + /** + * Notify the server of Parcelable type data and return the notification result. + * + * @param { string } method - The notification event string listened to by the callee. + * @param { rpc.Parcelable } data - Notification data to the callee. + * @returns { Promise } Returns the callee's notification result data. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types. + * @throws { BusinessError } 16200001 - Caller released. The caller has been released. + * @throws { BusinessError } 16200002 - Callee invalid. The callee does not exist. + * @throws { BusinessError } 16000050 - Internal error. + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @StageModelOnly + * @since 9 + */ + callWithResult(method: string, data: rpc.Parcelable): Promise; + /** + * Register the generic component server Stub (stub) disconnect listening notification. + * + * @throws { BusinessError } 16200001 - Caller released. The caller has been released. + * @throws { BusinessError } 16200002 - Callee invalid. The callee does not exist. + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @StageModelOnly + * @since 9 + */ + release(): void; + /** + * Register death listener notification callback. + * + * @param { OnReleaseCallback } callback - Register a callback function for listening for notifications. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types. + * @throws { BusinessError } 16200001 - Caller released. The caller has been released. + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @StageModelOnly + * @since 9 + */ + onRelease(callback: OnReleaseCallback): void; + /** + * Register state changed listener notification callback of remote ability. + * + * @param { OnRemoteStateChangeCallback } callback - Register a callback function for listening for notifications. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types. + * @throws { BusinessError } 16200001 - Caller released. The caller has been released. + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @StageModelOnly + * @since 10 + */ + onRemoteStateChange(callback: OnRemoteStateChangeCallback): void; + /** + * Register death listener notification callback. + * + * @param { 'release' } type - release. + * @param { OnReleaseCallback } callback - Register a callback function for listening for notifications. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; 3. Parameter verification failed. + * @throws { BusinessError } 16200001 - Caller released. The caller has been released. + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @StageModelOnly + * @since 9 + */ + on(type: 'release', callback: OnReleaseCallback): void; + /** + * Unregister death listener notification callback. + * + * @param { 'release' } type - release. + * @param { OnReleaseCallback } callback - Unregister a callback function for listening for notifications. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; 3. Parameter verification failed. + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @StageModelOnly + * @since 9 + */ + off(type: 'release', callback: OnReleaseCallback): void; + /** + * Unregister all death listener notification callback. + * + * @param { 'release' } type - release. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; 3. Parameter verification failed. + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @StageModelOnly + * @since 9 + */ + off(type: 'release'): void; +} +/** + * The interface of a Callee. + * + * @interface Callee + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @StageModelOnly + * @since 9 + */ +export interface Callee { + /** + * Register data listener callback. + * + * @param { string } method - A string registered to listen for notification events. + * @param { CalleeCallback } callback - Register a callback function that listens for notification events. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; 3. Parameter verification failed. + * @throws { BusinessError } 16200004 - Method registered. The method has registered. + * @throws { BusinessError } 16000050 - Internal error. + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @StageModelOnly + * @since 9 + */ + on(method: string, callback: CalleeCallback): void; + /** + * Unregister data listener callback. + * + * @param { string } method - A string registered to listen for notification events. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; 3. Parameter verification failed. + * @throws { BusinessError } 16200005 - Method not registered. The method has not registered. + * @throws { BusinessError } 16000050 - Internal error. + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @StageModelOnly + * @since 9 + */ + off(method: string): void; +} +/** + * The class of a UI ability. + * + * @extends Ability + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @StageModelOnly + * @since 9 + */ +/** + * The class of a UI ability. + * + * @extends Ability + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @StageModelOnly + * @crossplatform + * @since 10 + */ +/** + * The class of a UI ability. + * + * @extends Ability + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @StageModelOnly + * @crossplatform + * @atomicservice + * @since 11 + */ +export default class UIAbility extends Ability { + /** + * Indicates configuration information about an ability context. + * + * @type { UIAbilityContext } + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @StageModelOnly + * @since 9 + */ + /** + * Indicates configuration information about an ability context. + * + * @type { UIAbilityContext } + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @StageModelOnly + * @crossplatform + * @since 10 + */ + /** + * Indicates configuration information about an ability context. + * + * @type { UIAbilityContext } + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @StageModelOnly + * @crossplatform + * @atomicservice + * @since 11 + */ + context: UIAbilityContext; + /** + * Indicates ability launch want. + * + * @type { Want } + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @StageModelOnly + * @since 9 + */ + /** + * Indicates ability launch want. + * + * @type { Want } + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @StageModelOnly + * @atomicservice + * @since 11 + */ + launchWant: Want; + /** + * Indicates ability last request want. + * + * @type { Want } + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @StageModelOnly + * @since 9 + */ + /** + * Indicates ability last request want. + * + * @type { Want } + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @StageModelOnly + * @atomicservice + * @since 11 + */ + lastRequestWant: Want; + /** + * Call Service Stub Object. + * + * @type { Callee } + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @StageModelOnly + * @since 9 + */ + callee: Callee; + /** + * Called back when an ability is started for initialization. + * + * @param { Want } want - Indicates the want info of the created ability. + * @param { AbilityConstant.LaunchParam } launchParam - Indicates the launch param. + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @StageModelOnly + * @since 9 + */ + /** + * Called back when an ability is started for initialization. + * + * @param { Want } want - Indicates the want info of the created ability. + * @param { AbilityConstant.LaunchParam } launchParam - Indicates the launch param. + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @StageModelOnly + * @crossplatform + * @since 10 + */ + /** + * Called back when an ability is started for initialization. + * + * @param { Want } want - Indicates the want info of the created ability. + * @param { AbilityConstant.LaunchParam } launchParam - Indicates the launch param. + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @StageModelOnly + * @crossplatform + * @atomicservice + * @since 11 + */ + onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void; + /** + * Called back when an ability window stage is created. + * + * @param { window.WindowStage } windowStage - Indicates the created WindowStage. + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @StageModelOnly + * @since 9 + */ + /** + * Called back when an ability window stage is created. + * + * @param { window.WindowStage } windowStage - Indicates the created WindowStage. + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @StageModelOnly + * @crossplatform + * @since 10 + */ + /** + * Called back when an ability window stage is created. + * + * @param { window.WindowStage } windowStage - Indicates the created WindowStage. + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @StageModelOnly + * @crossplatform + * @atomicservice + * @since 11 + */ + onWindowStageCreate(windowStage: window.WindowStage): void; + /** + * Called back when an ability window stage will destroy. + * + * @param { window.WindowStage } windowStage - Indicates the WindowStage that will be destroyed. + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @StageModelOnly + * @atomicservice + * @since 12 + */ + onWindowStageWillDestroy(windowStage: window.WindowStage): void; + /** + * Called back when an ability window stage is destroyed. + * + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @StageModelOnly + * @since 9 + */ + /** + * Called back when an ability window stage is destroyed. + * + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @StageModelOnly + * @crossplatform + * @since 10 + */ + /** + * Called back when an ability window stage is destroyed. + * + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @StageModelOnly + * @crossplatform + * @atomicservice + * @since 11 + */ + onWindowStageDestroy(): void; + /** + * Called back when an ability window stage is restored. + * + * @param { window.WindowStage } windowStage - window stage to restore + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @StageModelOnly + * @since 9 + */ + /** + * Called back when an ability window stage is restored. + * + * @param { window.WindowStage } windowStage - window stage to restore + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @StageModelOnly + * @atomicservice + * @since 11 + */ + onWindowStageRestore(windowStage: window.WindowStage): void; + /** + * Called back before an ability is destroyed. + * + * @returns { void | Promise } the promise returned by the function. + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @StageModelOnly + * @since 9 + */ + /** + * Called back before an ability is destroyed. + * + * @returns { void | Promise } the promise returned by the function. + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @StageModelOnly + * @crossplatform + * @since 10 + */ + /** + * Called back before an ability is destroyed. + * + * @returns { void | Promise } the promise returned by the function. + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @StageModelOnly + * @crossplatform + * @atomicservice + * @since 11 + */ + onDestroy(): void | Promise; + /** + * Called back when the state of an ability changes to foreground. + * + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @StageModelOnly + * @since 9 + */ + /** + * Called back when the state of an ability changes to foreground. + * + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @StageModelOnly + * @crossplatform + * @since 10 + */ + /** + * Called back when the state of an ability changes to foreground. + * + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @StageModelOnly + * @crossplatform + * @atomicservice + * @since 11 + */ + onForeground(): void; + /** + * Called back when the state of an ability changes to background. + * + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @StageModelOnly + * @since 9 + */ + /** + * Called back when the state of an ability changes to background. + * + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @StageModelOnly + * @crossplatform + * @since 10 + */ + /** + * Called back when the state of an ability changes to background. + * + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @StageModelOnly + * @crossplatform + * @atomicservice + * @since 11 + */ + onBackground(): void; + /** + * Called back when an ability prepares to continue. + * + * @param { object } wantParam - Indicates the want parameter. + * @returns { AbilityConstant.OnContinueResult } Return the result of onContinue. + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @StageModelOnly + * @since 9 + */ + /** + * Called back when an ability prepares to continue. + * + * @param { Record } wantParam - Indicates the want parameter. + * @returns { AbilityConstant.OnContinueResult } Return the result of onContinue. + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @StageModelOnly + * @atomicservice + * @since 11 + */ + /** + * Called back when an ability prepares to continue. + * + * @param { Record } wantParam - Indicates the want parameter. + * @returns { AbilityConstant.OnContinueResult | Promise } Return the result of onContinue, support promise. + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @StageModelOnly + * @atomicservice + * @since 12 + */ + onContinue(wantParam: Record): AbilityConstant.OnContinueResult | Promise; + /** + * Called when the launch mode of an ability is set to singleton. + * This happens when you re-launch an ability that has been at the top of the ability stack. + * + * @param { Want } want - Indicates the want info of ability. + * @param { AbilityConstant.LaunchParam } launchParam - Indicates the launch parameters. + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @StageModelOnly + * @since 9 + */ + /** + * Called when the launch mode of an ability is set to singleton. + * This happens when you re-launch an ability that has been at the top of the ability stack. + * + * @param { Want } want - Indicates the want info of ability. + * @param { AbilityConstant.LaunchParam } launchParam - Indicates the launch parameters. + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @StageModelOnly + * @crossplatform + * @since 10 + */ + /** + * Called when the launch mode of an ability is set to singleton. + * This happens when you re-launch an ability that has been at the top of the ability stack. + * + * @param { Want } want - Indicates the want info of ability. + * @param { AbilityConstant.LaunchParam } launchParam - Indicates the launch parameters. + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @StageModelOnly + * @crossplatform + * @atomicservice + * @since 11 + */ + onNewWant(want: Want, launchParam: AbilityConstant.LaunchParam): void; + /** + * Called when dump client information is required. + * It is recommended that developers don't DUMP sensitive information. + * + * @param { Array } params - Indicates the params from command. + * @returns { Array } Return the dump info array. + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @StageModelOnly + * @since 9 + */ + /** + * Called when dump client information is required. + * It is recommended that developers don't DUMP sensitive information. + * + * @param { Array } params - Indicates the params from command. + * @returns { Array } Return the dump info array. + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @StageModelOnly + * @atomicservice + * @since 11 + */ + onDump(params: Array): Array; + /** + * Called back when an ability prepares to save. + * + * @param { AbilityConstant.StateType } reason - state type when save. + * @param { object } wantParam - Indicates the want parameter. + * @returns { AbilityConstant.OnSaveResult } agree with the current UIAbility status or not.return 0 if ability + * agrees to save data successfully, otherwise errcode. + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @StageModelOnly + * @since 9 + */ + /** + * Called back when an ability prepares to save. + * + * @param { AbilityConstant.StateType } reason - state type when save. + * @param { Record } wantParam - Indicates the want parameter. + * @returns { AbilityConstant.OnSaveResult } agree with the current UIAbility status or not.return 0 if ability + * agrees to save data successfully, otherwise errcode. + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @StageModelOnly + * @atomicservice + * @since 11 + */ + onSaveState(reason: AbilityConstant.StateType, wantParam: Record): AbilityConstant.OnSaveResult; + /** + * Called back when an ability shares data. + * + * @param { object } wantParam - Indicates the want parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @StageModelOnly + * @since 10 + */ + /** + * Called back when an ability shares data. + * + * @param { Record } wantParam - Indicates the want parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @StageModelOnly + * @atomicservice + * @since 11 + */ + onShare(wantParam: Record): void; + /** + * Called back when an ability prepare to terminate. + * + * @permission ohos.permission.PREPARE_APP_TERMINATE + * @returns { boolean } Returns {@code true} if the ability need to top terminating; returns {@code false} if the + * ability need to terminate. + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @StageModelOnly + * @since 10 + */ + /** + * Called back when an ability prepare to terminate. + * + * @permission ohos.permission.PREPARE_APP_TERMINATE + * @returns { boolean } Returns {@code true} if the ability need to top terminating; returns {@code false} if the + * ability need to terminate. + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @StageModelOnly + * @atomicservice + * @since 11 + */ + onPrepareToTerminate(): boolean; + /** + * Called back when back press is dispatched. + * + * @returns { boolean } Returns {@code true} means the ability will move to background when back is pressed; + * Returns {@code false} means the ability will be destroyed when back is pressed. + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @StageModelOnly + * @since 10 + */ + /** + * Called back when back press is dispatched. + * + * @returns { boolean } Returns {@code true} means the ability will move to background when back is pressed; + * Returns {@code false} means the ability will be destroyed when back is pressed. + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @StageModelOnly + * @atomicservice + * @since 11 + */ + onBackPressed(): boolean; +} diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.app.ability.UIExtensionAbility.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.app.ability.UIExtensionAbility.d.ts new file mode 100755 index 00000000..cb4194b7 --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.app.ability.UIExtensionAbility.d.ts @@ -0,0 +1,102 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"), + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit AbilityKit + */ +import AbilityConstant from './@ohos.app.ability.AbilityConstant'; +import ExtensionAbility from './@ohos.app.ability.ExtensionAbility'; +import type UIExtensionContentSession from './@ohos.app.ability.UIExtensionContentSession'; +import type UIExtensionContext from './application/UIExtensionContext'; +import type Want from './@ohos.app.ability.Want'; +/** + * The class of UI extension ability. + * + * @extends ExtensionAbility + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @StageModelOnly + * @since 10 + */ +export default class UIExtensionAbility extends ExtensionAbility { + /** + * Indicates configuration information about an UI extension ability context. + * + * @type { UIExtensionContext } + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @StageModelOnly + * @since 10 + */ + context: UIExtensionContext; + /** + * Called back when an UI extension is started for initialization. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @StageModelOnly + * @since 10 + */ + /** + * Called back when an UI extension is started for initialization. + * + * @param { AbilityConstant.LaunchParam } launchParam - Indicates the LaunchParam information about UIExtensionAbility. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @StageModelOnly + * @since 12 + */ + onCreate(launchParam: AbilityConstant.LaunchParam): void; + /** + * Called back when an UI extension session is created. + * + * @param { Want } want - Indicates the want info of the UI extension. + * @param { UIExtensionContentSession } session - Indicates the session of the UI extension page. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @StageModelOnly + * @since 10 + */ + onSessionCreate(want: Want, session: UIExtensionContentSession): void; + /** + * Called back when an UI extension session is destroyed. + * + * @param { UIExtensionContentSession } session - Indicates the session of the UI extension page. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @StageModelOnly + * @since 10 + */ + onSessionDestroy(session: UIExtensionContentSession): void; + /** + * Called back when the state of an UI extension changes to foreground. + * + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @StageModelOnly + * @since 10 + */ + onForeground(): void; + /** + * Called back when the state of an UI extension changes to background. + * + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @StageModelOnly + * @since 10 + */ + onBackground(): void; + /** + * Called back before an UI extension is destroyed. + * + * @returns { void | Promise } the promise returned by the function. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @StageModelOnly + * @since 10 + */ + onDestroy(): void | Promise; +} diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.app.ability.UIExtensionContentSession.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.app.ability.UIExtensionContentSession.d.ts new file mode 100755 index 00000000..34a97c6d --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.app.ability.UIExtensionContentSession.d.ts @@ -0,0 +1,200 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"), + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit AbilityKit + */ +import type { AbilityResult } from './ability/abilityResult'; +import type AbilityStartCallback from './application/AbilityStartCallback'; +import type { AsyncCallback } from './@ohos.base'; +import type uiExtension from './@ohos.arkui.uiExtension'; +/** + * class of ui extension content session. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @since 10 + */ +export default class UIExtensionContentSession { + /** + * Loads an UI extension content. + * + * @param { string } path - Path of the page to which the content will be loaded + * @param { LocalStorage } [storage] - The data object shared within the content instance loaded by the page + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types. + * @throws { BusinessError } 16000050 - Internal error. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @since 10 + */ + loadContent(path: string, storage?: LocalStorage): void; + /** + * Destroys the UI extension. + * + * @param { AsyncCallback } callback - The callback of terminateSelf. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @since 10 + */ + terminateSelf(callback: AsyncCallback): void; + /** + * Destroys the UI extension. + * + * @returns { Promise } The promise returned by the function. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @since 10 + */ + terminateSelf(): Promise; + /** + * Destroys the UI extension while returning the specified result code and data to the caller. + * + * @param { AbilityResult } parameter - Indicates the result to return. + * @param { AsyncCallback } callback - The callback of terminateSelfWithResult. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @since 10 + */ + terminateSelfWithResult(parameter: AbilityResult, callback: AsyncCallback): void; + /** + * Destroys the UI extension while returning the specified result code and data to the caller. + * + * @param { AbilityResult } parameter - Indicates the result to return. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @since 10 + */ + terminateSelfWithResult(parameter: AbilityResult): Promise; + /** + * Sets whether this window is in privacy mode. + * + * @permission ohos.permission.PRIVACY_WINDOW + * @param { boolean } isPrivacyMode - Whether the window is in privacy mode. The value true means that + * the window is in privacy mode, and false means the opposite. + * @returns { Promise } Promise that returns no value. + * @throws { BusinessError } 201 - The application does not have permission to call the interface. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @since 10 + */ + setWindowPrivacyMode(isPrivacyMode: boolean): Promise; + /** + * Sets whether this window is in privacy mode. + * + * @permission ohos.permission.PRIVACY_WINDOW + * @param { boolean } isPrivacyMode - Whether the window is in privacy mode. The value true means that + * the window is in privacy mode, and false means the opposite. + * @param { AsyncCallback } callback - Callback used to return the result. + * @throws { BusinessError } 201 - The application does not have permission to call the interface. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @since 10 + */ + setWindowPrivacyMode(isPrivacyMode: boolean, callback: AsyncCallback): void; + /** + * Starts the UIAbility or UIExtensionAbility by type. + * If the target ability is visible, you can start the target ability; If the target ability is invisible, + * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible ability. + * + * @param { string } type - The type of target ability. + * @param { Record } wantParam - Indicates the want parameter. + * @param { AbilityStartCallback } abilityStartCallback - Indicates the abilityStartCallback. + * @param { AsyncCallback } callback - The callback of startAbility. + * @throws { BusinessError } 201 - The application does not have permission to call the interface. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types. + * @throws { BusinessError } 16000001 - The specified ability does not exist. + * @throws { BusinessError } 16000002 - Incorrect ability type. + * @throws { BusinessError } 16000004 - Can not start invisible component. + * @throws { BusinessError } 16000050 - Internal error. + * @throws { BusinessError } 16200001 - The caller has been released. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @since 11 + */ + /** + * Starts the UIAbility or UIExtensionAbility by type. + * + * @param { string } type - The type of target ability. + * @param { Record } wantParam - Indicates the want parameter. + * @param { AbilityStartCallback } abilityStartCallback - Indicates the abilityStartCallback. + * @param { AsyncCallback } callback - The callback of startAbility. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @throws { BusinessError } 16000050 - Internal error. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @since 12 + */ + startAbilityByType(type: string, wantParam: Record, abilityStartCallback: AbilityStartCallback, callback: AsyncCallback): void; + /** + * Starts the UIAbility or UIExtensionAbility by type. + * If the target ability is visible, you can start the target ability; If the target ability is invisible, + * you need to apply for permission:ohos.permission.START_INVISIBLE_ABILITY to start target invisible ability. + * + * @param { string } type - The type of target ability. + * @param { Record } wantParam - Indicates the want parameter. + * @param { AbilityStartCallback } abilityStartCallback - Indicates the abilityStartCallback. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 201 - The application does not have permission to call the interface. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types. + * @throws { BusinessError } 16000001 - The specified ability does not exist. + * @throws { BusinessError } 16000002 - Incorrect ability type. + * @throws { BusinessError } 16000004 - Can not start invisible component. + * @throws { BusinessError } 16000050 - Internal error. + * @throws { BusinessError } 16200001 - The caller has been released. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @since 11 + */ + /** + * Starts the UIAbility or UIExtensionAbility by type. + * + * @param { string } type - The type of target ability. + * @param { Record } wantParam - Indicates the want parameter. + * @param { AbilityStartCallback } abilityStartCallback - Indicates the abilityStartCallback. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @throws { BusinessError } 16000050 - Internal error. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @since 12 + */ + startAbilityByType(type: string, wantParam: Record, abilityStartCallback: AbilityStartCallback): Promise; + /** + * Get the UIExtension Window proxy. + * + * @returns { uiExtension.WindowProxy } Returns the UIExtension Window proxy. + * @throws { BusinessError } 16000050 - Internal error. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @since 12 + */ + getUIExtensionWindowProxy(): uiExtension.WindowProxy; +} diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.app.ability.VpnExtensionAbility.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.app.ability.VpnExtensionAbility.d.ts new file mode 100755 index 00000000..9a3b0385 --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.app.ability.VpnExtensionAbility.d.ts @@ -0,0 +1,55 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"), + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit NetworkKit + */ +import type VpnExtensionContext from './application/VpnExtensionContext'; +import type Want from './@ohos.app.ability.Want'; +/** + * class of vpn extension ability. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @since 11 + */ +export default class VpnExtensionAbility { + /** + * Indicates service extension ability context. + * + * @type { VpnExtensionContext } + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @since 11 + */ + context: VpnExtensionContext; + /** + * Called back when a vpn extension is started for initialization. + * + * @param { Want } want - Indicates the want of created service extension. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @since 11 + */ + onCreate(want: Want): void; + /** + * Called back before a vpn extension is destroyed. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @since 11 + */ + onDestroy(): void; +} diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.app.ability.Want.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.app.ability.Want.d.ts new file mode 100755 index 00000000..93628a33 --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.app.ability.Want.d.ts @@ -0,0 +1,231 @@ +/* + * Copyright (c) 2022-2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit AbilityKit + */ +/** + * Want is the basic communication component of the system. + * + * @syscap SystemCapability.Ability.AbilityBase + * @since 9 + */ +/** + * Want is the basic communication component of the system. + * + * @syscap SystemCapability.Ability.AbilityBase + * @crossplatform + * @since 10 + */ +/** + * Want is the basic communication component of the system. + * + * @syscap SystemCapability.Ability.AbilityBase + * @crossplatform + * @atomicservice + * @since 11 + */ +export default class Want { + /** + * bundle name + * + * @type { ?string } + * @syscap SystemCapability.Ability.AbilityBase + * @since 9 + */ + /** + * bundle name + * + * @syscap SystemCapability.Ability.AbilityBase + * @crossplatform + * @since 10 + */ + /** + * bundle name + * + * @syscap SystemCapability.Ability.AbilityBase + * @crossplatform + * @atomicservice + * @since 11 + */ + bundleName?: string; + /** + * ability name + * + * @type { ?string } + * @syscap SystemCapability.Ability.AbilityBase + * @since 9 + */ + /** + * ability name + * + * @syscap SystemCapability.Ability.AbilityBase + * @crossplatform + * @since 10 + */ + /** + * ability name + * + * @syscap SystemCapability.Ability.AbilityBase + * @crossplatform + * @atomicservice + * @since 11 + */ + abilityName?: string; + /** + * device id + * + * @type { ?string } + * @syscap SystemCapability.Ability.AbilityBase + * @since 9 + */ + /** + * device id + * + * @type { ?string } + * @syscap SystemCapability.Ability.AbilityBase + * @atomicservice + * @since 11 + */ + deviceId?: string; + /** + * The description of a URI in a Want. + * + * @type { ?string } + * @syscap SystemCapability.Ability.AbilityBase + * @since 9 + */ + /** + * The description of a URI in a Want. + * + * @type { ?string } + * @syscap SystemCapability.Ability.AbilityBase + * @atomicservice + * @since 11 + */ + uri?: string; + /** + * The description of the type in this Want. + * + * @type { ?string } + * @syscap SystemCapability.Ability.AbilityBase + * @since 9 + */ + /** + * The description of the type in this Want. + * + * @type { ?string } + * @syscap SystemCapability.Ability.AbilityBase + * @atomicservice + * @since 11 + */ + type?: string; + /** + * The options of the flags in this Want. + * + * @type { ?number } + * @syscap SystemCapability.Ability.AbilityBase + * @since 9 + */ + /** + * The options of the flags in this Want. + * + * @type { ?number } + * @syscap SystemCapability.Ability.AbilityBase + * @atomicservice + * @since 11 + */ + flags?: number; + /** + * The description of an action in an want. + * + * @type { ?string } + * @syscap SystemCapability.Ability.AbilityBase + * @since 9 + */ + /** + * The description of an action in an want. + * + * @type { ?string } + * @syscap SystemCapability.Ability.AbilityBase + * @atomicservice + * @since 11 + */ + action?: string; + /** + * The description of the WantParams object in an Want + * + * @type { ?object } + * @syscap SystemCapability.Ability.AbilityBase + * @since 9 + */ + /** + * The description of the WantParams object in an Want + * + * @type { ?object } + * @syscap SystemCapability.Ability.AbilityBase + * @crossplatform + * @since 10 + */ + /** + * The description of the WantParams object in an Want + * + * @type { ?Record } + * @syscap SystemCapability.Ability.AbilityBase + * @crossplatform + * @atomicservice + * @since 11 + */ + parameters?: Record; + /** + * The description of a entities in a Want. + * + * @type { ?Array } + * @syscap SystemCapability.Ability.AbilityBase + * @since 9 + */ + /** + * The description of a entities in a Want. + * + * @type { ?Array } + * @syscap SystemCapability.Ability.AbilityBase + * @atomicservice + * @since 11 + */ + entities?: Array; + /** + * The description of an module name in an want. + * + * @type { ?string } + * @syscap SystemCapability.Ability.AbilityBase + * @since 9 + */ + /** + * The description of an module name in an want. + * + * @syscap SystemCapability.Ability.AbilityBase + * @crossplatform + * @since 10 + */ + /** + * The description of an module name in an want. + * + * @syscap SystemCapability.Ability.AbilityBase + * @crossplatform + * @atomicservice + * @since 11 + */ + moduleName?: string; +} diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.app.ability.abilityDelegatorRegistry.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.app.ability.abilityDelegatorRegistry.d.ts new file mode 100755 index 00000000..350c9586 --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.app.ability.abilityDelegatorRegistry.d.ts @@ -0,0 +1,321 @@ +/* + * Copyright (c) 2022-2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit TestKit + */ +import { AbilityDelegator as _AbilityDelegator } from './application/AbilityDelegator'; +import { AbilityDelegatorArgs as _AbilityDelegatorArgs } from './application/abilityDelegatorArgs'; +import { AbilityMonitor as _AbilityMonitor } from './application/AbilityMonitor'; +import { ShellCmdResult as _ShellCmdResult } from './application/shellCmdResult'; +/** + * A global register used to store the AbilityDelegator and AbilityDelegatorArgs objects registered + * during application startup. + * + * @namespace abilityDelegatorRegistry + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ +/** + * A global register used to store the AbilityDelegator and AbilityDelegatorArgs objects registered + * during application startup. + * + * @namespace abilityDelegatorRegistry + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @crossplatform + * @since 10 + */ +/** + * A global register used to store the AbilityDelegator and AbilityDelegatorArgs objects registered + * during application startup. + * + * @namespace abilityDelegatorRegistry + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @crossplatform + * @atomicservice + * @since 11 + */ +declare namespace abilityDelegatorRegistry { + /** + * Get the AbilityDelegator object of the application. + * + * @returns { AbilityDelegator } Return the AbilityDelegator object initialized when the application is started. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ + /** + * Get the AbilityDelegator object of the application. + * + * @returns { AbilityDelegator } Return the AbilityDelegator object initialized when the application is started. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @crossplatform + * @since 10 + */ + /** + * Get the AbilityDelegator object of the application. + * + * @returns { AbilityDelegator } Return the AbilityDelegator object initialized when the application is started. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @crossplatform + * @atomicservice + * @since 11 + */ + function getAbilityDelegator(): AbilityDelegator; + /** + * Get unit test arguments stored in the AbilityDelegatorArgs object. + * + * @returns { AbilityDelegatorArgs } Return the previously registered AbilityDelegatorArgs object. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ + /** + * Get unit test arguments stored in the AbilityDelegatorArgs object. + * + * @returns { AbilityDelegatorArgs } Return the previously registered AbilityDelegatorArgs object. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @crossplatform + * @since 10 + */ + /** + * Get unit test arguments stored in the AbilityDelegatorArgs object. + * + * @returns { AbilityDelegatorArgs } Return the previously registered AbilityDelegatorArgs object. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @crossplatform + * @atomicservice + * @since 11 + */ + function getArguments(): AbilityDelegatorArgs; + /** + * Describes all lifecycle states of an ability. + * + * @enum { number } + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ + /** + * Describes all lifecycle states of an ability. + * + * @enum { number } + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @crossplatform + * @since 10 + */ + /** + * Describes all lifecycle states of an ability. + * + * @enum { number } + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @crossplatform + * @atomicservice + * @since 11 + */ + export enum AbilityLifecycleState { + /** + * Ability is in invalid state. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ + /** + * Ability is in invalid state. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @crossplatform + * @since 10 + */ + /** + * Ability is in invalid state. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @crossplatform + * @atomicservice + * @since 11 + */ + UNINITIALIZED, + /** + * Ability is in the created state. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ + /** + * Ability is in the created state. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @crossplatform + * @since 10 + */ + /** + * Ability is in the created state. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @crossplatform + * @atomicservice + * @since 11 + */ + CREATE, + /** + * Ability is in the foreground state. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ + /** + * Ability is in the foreground state. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @crossplatform + * @since 10 + */ + /** + * Ability is in the foreground state. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @crossplatform + * @atomicservice + * @since 11 + */ + FOREGROUND, + /** + * Ability is in the background state. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ + /** + * Ability is in the background state. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @crossplatform + * @since 10 + */ + /** + * Ability is in the background state. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @crossplatform + * @atomicservice + * @since 11 + */ + BACKGROUND, + /** + * Ability is in a destroyed state. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ + /** + * Ability is in a destroyed state. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @crossplatform + * @since 10 + */ + /** + * Ability is in a destroyed state. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @crossplatform + * @atomicservice + * @since 11 + */ + DESTROY + } + /** + * A global test utility interface used for adding AbilityMonitor objects and control lifecycle states of abilities. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ + /** + * A global test utility interface used for adding AbilityMonitor objects and control lifecycle states of abilities. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @crossplatform + * @since 10 + */ + /** + * A global test utility interface used for adding AbilityMonitor objects and control lifecycle states of abilities. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @crossplatform + * @atomicservice + * @since 11 + */ + export type AbilityDelegator = _AbilityDelegator; + /** + * Store unit testing-related parameters, including test case names, and test runner name. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ + /** + * Store unit testing-related parameters, including test case names, and test runner name. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @crossplatform + * @since 10 + */ + /** + * Store unit testing-related parameters, including test case names, and test runner name. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @crossplatform + * @atomicservice + * @since 11 + */ + export type AbilityDelegatorArgs = _AbilityDelegatorArgs; + /** + * Provide methods for matching monitored Ability objects that meet specified conditions. + * The most recently matched Ability objects will be saved in the AbilityMonitor object. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ + /** + * Provide methods for matching monitored Ability objects that meet specified conditions. + * The most recently matched Ability objects will be saved in the AbilityMonitor object. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @crossplatform + * @since 10 + */ + /** + * Provide methods for matching monitored Ability objects that meet specified conditions. + * The most recently matched Ability objects will be saved in the AbilityMonitor object. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @crossplatform + * @atomicservice + * @since 11 + */ + export type AbilityMonitor = _AbilityMonitor; + /** + * A object that records the result of shell command executes. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ + /** + * A object that records the result of shell command executes. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @atomicservice + * @since 11 + */ + export type ShellCmdResult = _ShellCmdResult; +} +export default abilityDelegatorRegistry; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.app.ability.appManager.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.app.ability.appManager.d.ts new file mode 100755 index 00000000..9b725339 --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.app.ability.appManager.d.ts @@ -0,0 +1,303 @@ +/* + * Copyright (c) 2022-2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit AbilityKit + */ +import { AsyncCallback } from './@ohos.base'; +import { ProcessInformation as _ProcessInformation } from './application/ProcessInformation'; +/** + * This module provides the function of app manager service. + * + * @namespace appManager + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ +/** + * This module provides the function of app manager service. + * + * @namespace appManager + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @atomicservice + * @since 11 + */ +declare namespace appManager { + /** + * Enum for the process state + * + * @enum { number } + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 10 + */ + /** + * Enum for the process state + * + * @enum { number } + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @atomicservice + * @since 11 + */ + export enum ProcessState { + /** + * The state that the process is in when it is being created. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 10 + */ + /** + * The state that the process is in when it is being created. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @atomicservice + * @since 11 + */ + STATE_CREATE, + /** + * The state in which the process is in when it switches to the foreground. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 10 + */ + /** + * The state in which the process is in when it switches to the foreground. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @atomicservice + * @since 11 + */ + STATE_FOREGROUND, + /** + * The state in which the process is in focus. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 10 + */ + /** + * The state in which the process is in focus. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @atomicservice + * @since 11 + */ + STATE_ACTIVE, + /** + * The state in which a process is invisible in the background. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 10 + */ + /** + * The state in which a process is invisible in the background. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @atomicservice + * @since 11 + */ + STATE_BACKGROUND, + /** + * The state that the process is in when it is destroyed. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 10 + */ + /** + * The state that the process is in when it is destroyed. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @atomicservice + * @since 11 + */ + STATE_DESTROY + } + /** + * Is user running in stability test. + * + * @param { AsyncCallback } callback - The callback is used to return true if user is running stability test. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; 3. Parameter verification failed. + * @throws { BusinessError } 16000050 - Internal error. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ + /** + * Is user running in stability test. + * + * @param { AsyncCallback } callback - The callback is used to return true if user is running stability test. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; 3. Parameter verification failed. + * @throws { BusinessError } 16000050 - Internal error. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @atomicservice + * @since 11 + */ + function isRunningInStabilityTest(callback: AsyncCallback): void; + /** + * Is user running in stability test. + * + * @returns { Promise } Returns true if user is running stability test. + * @throws { BusinessError } 16000050 - Internal error. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ + /** + * Is user running in stability test. + * + * @returns { Promise } Returns true if user is running stability test. + * @throws { BusinessError } 16000050 - Internal error. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @atomicservice + * @since 11 + */ + function isRunningInStabilityTest(): Promise; + /** + * Is it a ram-constrained device + * + * @returns { Promise } Returns true if the device is ram-constrained. + * @throws { BusinessError } 16000050 - Internal error. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ + /** + * Is it a ram-constrained device + * + * @returns { Promise } Returns true if the device is ram-constrained. + * @throws { BusinessError } 16000050 - Internal error. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @atomicservice + * @since 11 + */ + function isRamConstrainedDevice(): Promise; + /** + * Is it a ram-constrained device + * + * @param { AsyncCallback } callback - The callback is used to return true if the device is ram-constrained. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; 3. Parameter verification failed. + * @throws { BusinessError } 16000050 - Internal error. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ + /** + * Is it a ram-constrained device + * + * @param { AsyncCallback } callback - The callback is used to return true if the device is ram-constrained. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; 3. Parameter verification failed. + * @throws { BusinessError } 16000050 - Internal error. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @atomicservice + * @since 11 + */ + function isRamConstrainedDevice(callback: AsyncCallback): void; + /** + * Get the memory size of the application + * + * @returns { Promise } Returns the application memory size. + * @throws { BusinessError } 16000050 - Internal error. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ + /** + * Get the memory size of the application + * + * @returns { Promise } Returns the application memory size. + * @throws { BusinessError } 16000050 - Internal error. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @atomicservice + * @since 11 + */ + function getAppMemorySize(): Promise; + /** + * Get the memory size of the application + * + * @param { AsyncCallback } callback - The callback is used to return the application memory size. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; 3. Parameter verification failed. + * @throws { BusinessError } 16000050 - Internal error. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ + /** + * Get the memory size of the application + * + * @param { AsyncCallback } callback - The callback is used to return the application memory size. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; 3. Parameter verification failed. + * @throws { BusinessError } 16000050 - Internal error. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @atomicservice + * @since 11 + */ + function getAppMemorySize(callback: AsyncCallback): void; + /** + * If you apply for permission, you can obtain information about all running processes. + * If you do not apply, you can only obtain information about the current process. + * + * @permission ohos.permission.GET_RUNNING_INFO + * @returns { Promise> } Returns the array of {@link ProcessInformation}. + * @throws { BusinessError } 16000050 - Internal error. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ + /** + * Get information about the current process. + * + * @returns { Promise> } Returns the array of {@link ProcessInformation}. + * @throws { BusinessError } 16000050 - Internal error. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @atomicservice + * @since 11 + */ + function getRunningProcessInformation(): Promise>; + /** + * If you apply for permission, you can obtain information about all running processes. + * If you do not apply, you can only obtain information about the current process. + * + * @permission ohos.permission.GET_RUNNING_INFO + * @param { AsyncCallback> } callback - The callback is used to return the array of {@link ProcessInformation}. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; 3. Parameter verification failed. + * @throws { BusinessError } 16000050 - Internal error. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ + /** + * Get information about the current process. + * + * @param { AsyncCallback> } callback - The callback is used to return the array of {@link ProcessInformation}. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; 3. Parameter verification failed. + * @throws { BusinessError } 16000050 - Internal error. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @atomicservice + * @since 11 + */ + function getRunningProcessInformation(callback: AsyncCallback>): void; + /** + * The class of a process information. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ + /** + * The class of a process information. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @atomicservice + * @since 11 + */ + export type ProcessInformation = _ProcessInformation; +} +export default appManager; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.app.ability.appRecovery.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.app.ability.appRecovery.d.ts new file mode 100755 index 00000000..dddeed42 --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.app.ability.appRecovery.d.ts @@ -0,0 +1,319 @@ +/* + * Copyright (c) 2022-2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"), + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit AbilityKit + */ +import UIAbilityContext from './application/UIAbilityContext'; +import Want from './@ohos.app.ability.Want'; +/** + * This module provides the capability of app recovery. + * You can use this capability to save state and restart the application + * which let end user continue their workflow when app error occurs. + * This api support restart the app when js crash or app freeze occurs currently. + * + * @namespace appRecovery + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ +/** + * This module provides the capability of app recovery. + * You can use this capability to save state and restart the application + * which let end user continue their workflow when app error occurs. + * This api support restart the app when js crash or app freeze occurs currently. + * + * @namespace appRecovery + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @atomicservice + * @since 11 + */ +declare namespace appRecovery { + /** + * The flag that determines when to restart you app. + * + * @enum { number } + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ + /** + * The flag that determines when to restart you app. + * + * @enum { number } + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @atomicservice + * @since 11 + */ + enum RestartFlag { + /** + * No restart restrictions. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ + /** + * No restart restrictions. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @atomicservice + * @since 11 + */ + ALWAYS_RESTART = 0, + /** + * Restart if current app process encounter uncaught js/ts/ets exception. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ + /** + * Restart if current app process encounter uncaught js/ts/ets exception. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @atomicservice + * @since 11 + */ + RESTART_WHEN_JS_CRASH = 0x0001, + /** + * Restart if the main thread of current app process block more than 6 seconds. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ + /** + * Restart if the main thread of current app process block more than 6 seconds. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @atomicservice + * @since 11 + */ + RESTART_WHEN_APP_FREEZE = 0x0002, + /** + * Do not restart in any scenario. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ + /** + * Do not restart in any scenario. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @atomicservice + * @since 11 + */ + NO_RESTART = 0xFFFF + } + /** + * The flag that determines when to save ability state. + * When start saving ability state, the { ohos.app.ability.UiAbility.onSaveState } will be called and + * the page stack of current ability will be saved automatically. + * + * @enum { number } + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ + /** + * The flag that determines when to save ability state. + * When start saving ability state, the { ohos.app.ability.UiAbility.onSaveState } will be called and + * the page stack of current ability will be saved automatically. + * + * @enum { number } + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @atomicservice + * @since 11 + */ + enum SaveOccasionFlag { + /** + * Saving ability state when an error occurs. + * The error in current situation has the same semantic with { errorManager } defines + * which means the state that the application cannot continue to work but allows developer to handle. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ + /** + * Saving ability state when an error occurs. + * The error in current situation has the same semantic with { errorManager } defines + * which means the state that the application cannot continue to work but allows developer to handle. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @atomicservice + * @since 11 + */ + SAVE_WHEN_ERROR = 0x0001, + /** + * Saving ability state when ability is in background. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ + /** + * Saving ability state when ability is in background. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @atomicservice + * @since 11 + */ + SAVE_WHEN_BACKGROUND = 0x0002 + } + /** + * The flag that determines how to save the ability state. + * + * @enum { number } + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ + /** + * The flag that determines how to save the ability state. + * + * @enum { number } + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @atomicservice + * @since 11 + */ + enum SaveModeFlag { + /** + * Save state to file immediately. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ + /** + * Save state to file immediately. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @atomicservice + * @since 11 + */ + SAVE_WITH_FILE = 0x0001, + /** + * Keep state in memory and flush to file when error occurs or { restartApp } is invoked. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ + /** + * Keep state in memory and flush to file when error occurs or { restartApp } is invoked. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @atomicservice + * @since 11 + */ + SAVE_WITH_SHARED_MEMORY = 0x0002 + } + /** + * Enable appRecovery function. + * + * @param { RestartFlag } [restart] - The flag that determines the restart cases of your app, default value is { ALWAYS_RESTART }. + * @param { SaveOccasionFlag } [saveOccasion] - The flag that determines when to save ability state, default value is { SAVE_WHEN_ERROR }. + * @param { SaveModeFlag } [saveMode] - The flag that determines how to save the ability state, default value is { SAVE_WITH_FILE }. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @StageModelOnly + * @since 9 + */ + /** + * Enable appRecovery function. + * + * @param { RestartFlag } [restart] - The flag that determines the restart cases of your app, default value is { ALWAYS_RESTART }. + * @param { SaveOccasionFlag } [saveOccasion] - The flag that determines when to save ability state, default value is { SAVE_WHEN_ERROR }. + * @param { SaveModeFlag } [saveMode] - The flag that determines how to save the ability state, default value is { SAVE_WITH_FILE }. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @StageModelOnly + * @atomicservice + * @since 11 + */ + function enableAppRecovery(restart?: RestartFlag, saveOccasion?: SaveOccasionFlag, saveMode?: SaveModeFlag): void; + /** + * Restart current process and launch the first ability(the entry ability in most cases) of current process. + * The previous saved state will be filled in the { want.wantParams } of { UIAbility.onCreate } interface. + * and the { param } of { UIAbility.onCreate } will be set to APP_RECOVERY. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @StageModelOnly + * @since 9 + */ + /** + * Restart current process and launch the first ability(the entry ability in most cases) of current process. + * The previous saved state will be filled in the { want.wantParams } of { UIAbility.onCreate } interface. + * and the { param } of { UIAbility.onCreate } will be set to APP_RECOVERY. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @StageModelOnly + * @atomicservice + * @since 11 + */ + function restartApp(): void; + /** + * Set the want that will be used when app restart initiated by appRecovery. + * + * @param { Want } want - that defines the ability you want to start + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @StageModelOnly + * @since 10 + */ + /** + * Set the want that will be used when app restart initiated by appRecovery. + * + * @param { Want } want - that defines the ability you want to start + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @StageModelOnly + * @atomicservice + * @since 11 + */ + function setRestartWant(want: Want): void; + /** + * Actively save application state. + * The ability framework will call { UIAbility.onSaveState } of first launched ability and + * persist state as { saveOccasion } flag from { enableAppRecovery } interface. + * + * @returns { boolean } true if save data successfully, otherwise false. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @StageModelOnly + * @since 9 + */ + /** + * Actively save application state. + * The ability framework will call { UIAbility.onSaveState } of first launched ability and + * persist state as { saveOccasion } flag from { enableAppRecovery } interface. + * + * @returns { boolean } true if save data successfully, otherwise false. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @StageModelOnly + * @atomicservice + * @since 11 + */ + function saveAppState(): boolean; + /** + * Save the ability state according to the context. + * + * @param { UIAbilityContext } [context] - context indicates the ability context you want to save state. + * If context is not specified, the onSaveState will be invoked on all the recoverable abilities in current process. + * @returns { boolean } true if save data successfully, otherwise false. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @StageModelOnly + * @since 10 + */ + /** + * Save the ability state according to the context. + * + * @param { UIAbilityContext } [context] - context indicates the ability context you want to save state. + * If context is not specified, the onSaveState will be invoked on all the recoverable abilities in current process. + * @returns { boolean } true if save data successfully, otherwise false. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @StageModelOnly + * @atomicservice + * @since 11 + */ + function saveAppState(context?: UIAbilityContext): boolean; +} +export default appRecovery; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.app.ability.autoFillManager.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.app.ability.autoFillManager.d.ts new file mode 100755 index 00000000..c93c6cad --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.app.ability.autoFillManager.d.ts @@ -0,0 +1,116 @@ +/* + * Copyright (c) 2023-2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit AbilityKit + */ +import type { UIContext } from './@ohos.arkui.UIContext'; +/** + * This module provides the function of auto fill manager. + * + * @namespace autoFillManager + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @stagemodelonly + * @since 11 + */ +/** + * This module provides the function of auto fill manager. + * + * @namespace autoFillManager + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @stagemodelonly + * @atomicservice + * @since 12 + */ +declare namespace autoFillManager { + /** + * Auto save callback. + * + * @interface AutoSaveCallback + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @stagemodelonly + * @since 11 + */ + /** + * Auto save callback. + * + * @interface AutoSaveCallback + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @stagemodelonly + * @atomicservice + * @since 12 + */ + export interface AutoSaveCallback { + /** + * Called when auto save request is successfully handled. + * + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @stagemodelonly + * @since 11 + */ + /** + * Called when auto save request is successfully handled. + * + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @stagemodelonly + * @atomicservice + * @since 12 + */ + onSuccess(): void; + /** + * Called when auto save request is failed to be handled. + * + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @stagemodelonly + * @since 11 + */ + /** + * Called when auto save request is failed to be handled. + * + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @stagemodelonly + * @atomicservice + * @since 12 + */ + onFailure(): void; + } + /** + * Trigger an auto save request. + * + * @param { UIContext } context - Indicates the ui context where the save operation will be performed. + * @param { AutoSaveCallback } [callback] - Indicates the callback that used to receive the result. + * @throws { BusinessError } 401 - The parameter check failed. Possible causes: 1. Get instance id failed; + *
2. Parse instance id failed; 3. The second parameter is not of type callback. + * @throws { BusinessError } 16000050 - Internal error. + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @stagemodelonly + * @since 11 + */ + /** + * Trigger an auto save request. + * + * @param { UIContext } context - Indicates the ui context where the save operation will be performed. + * @param { AutoSaveCallback } [callback] - Indicates the callback that used to receive the result. + * @throws { BusinessError } 401 - The parameter check failed. Possible causes: 1. Get instance id failed; + *
2. Parse instance id failed; 3. The second parameter is not of type callback. + * @throws { BusinessError } 16000050 - Internal error. + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @stagemodelonly + * @atomicservice + * @since 12 + */ + export function requestAutoSave(context: UIContext, callback?: AutoSaveCallback): void; +} +export default autoFillManager; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.app.ability.childProcessManager.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.app.ability.childProcessManager.d.ts new file mode 100755 index 00000000..fdffdb95 --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.app.ability.childProcessManager.d.ts @@ -0,0 +1,88 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"), + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit AbilityKit + */ +import type { AsyncCallback } from './@ohos.base'; +/** + * This module provides the capability to start and manage child process. + * + * @namespace childProcessManager + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 11 + */ +declare namespace childProcessManager { + /** + * Enum for the process start mode. + * + * @enum { number } + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @StageModelOnly + * @since 11 + */ + export const enum StartMode { + /** + * Fork child process by application self. + * Binder IPC can not be used in child process in this mode, may cause crash. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @StageModelOnly + * @since 11 + */ + SELF_FORK = 0, + /** + * Fork child process by app spawn. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @StageModelOnly + * @since 11 + */ + APP_SPAWN_FORK = 1 + } + /** + * Start child process with the given src entry and start mode. + * + * @param { string } srcEntry - Child process source file entrance to be started. + * @param { StartMode } startMode - Child process start mode. + * @returns { Promise } Returns the started child process pid. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. + * @throws { BusinessError } 16000050 - Internal error. + * @throws { BusinessError } 16000061 - Operation not supported. + * @throws { BusinessError } 16000062 - The number of child process exceeds upper bound. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @StageModelOnly + * @since 11 + */ + function startChildProcess(srcEntry: string, startMode: StartMode): Promise; + /** + * Start child process with the given src entry and mode. + * + * @param { string } srcEntry - Child process source file entrance to be started. + * @param { StartMode } startMode - Child process start mode. + * @param { AsyncCallback } callback - The callback of startChildProcess. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. + * @throws { BusinessError } 16000050 - Internal error. + * @throws { BusinessError } 16000061 - Operation not supported. + * @throws { BusinessError } 16000062 - The number of child process exceeds upper bound. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @StageModelOnly + * @since 11 + */ + function startChildProcess(srcEntry: string, startMode: StartMode, callback: AsyncCallback): void; +} +export default childProcessManager; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.app.ability.common.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.app.ability.common.d.ts new file mode 100755 index 00000000..327486ff --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.app.ability.common.d.ts @@ -0,0 +1,325 @@ +/* + * Copyright (c) 2022-2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit AbilityKit + */ +import * as _UIAbilityContext from './application/UIAbilityContext'; +import type * as _UIExtensionContext from './application/UIExtensionContext'; +import * as _AbilityStageContext from './application/AbilityStageContext'; +import * as _ApplicationContext from './application/ApplicationContext'; +import * as _BaseContext from './application/BaseContext'; +import * as _Context from './application/Context'; +import * as _ExtensionContext from './application/ExtensionContext'; +import * as _FormExtensionContext from './application/FormExtensionContext'; +import * as _EventHub from './application/EventHub'; +import { PacMap as _PacMap } from './ability/dataAbilityHelper'; +import { AbilityResult as _AbilityResult } from './ability/abilityResult'; +import type _AbilityStartCallback from './application/AbilityStartCallback'; +import { ConnectOptions as _ConnectOptions } from './ability/connectOptions'; +import type * as _VpnExtensionContext from './application/VpnExtensionContext'; +import type * as _EmbeddableUIAbilityContext from './application/EmbeddableUIAbilityContext'; +/** + * This module provides application context classes and common data structures. + * + * @namespace common + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @StageModelOnly + * @since 9 + */ +/** + * This module provides application context classes and common data structures. + * + * @namespace common + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @StageModelOnly + * @crossplatform + * @since 10 + */ +/** + * This module provides application context classes and common data structures. + * + * @namespace common + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @crossplatform + * @atomicservice + * @since 11 + */ +declare namespace common { + /** + * The context of an ability. It allows access to ability-specific resources. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @StageModelOnly + * @since 9 + */ + /** + * The context of an ability. It allows access to ability-specific resources. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @StageModelOnly + * @crossplatform + * @since 10 + */ + /** + * The context of an ability. It allows access to ability-specific resources. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @StageModelOnly + * @crossplatform + * @atomicservice + * @since 11 + */ + export type UIAbilityContext = _UIAbilityContext.default; + /** + * The context of an abilityStage. It allows access to abilityStage-specific resources. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @StageModelOnly + * @since 9 + */ + /** + * The context of an abilityStage. It allows access to abilityStage-specific resources. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @StageModelOnly + * @crossplatform + * @since 10 + */ + /** + * The context of an abilityStage. It allows access to abilityStage-specific resources. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @StageModelOnly + * @crossplatform + * @atomicservice + * @since 11 + */ + export type AbilityStageContext = _AbilityStageContext.default; + /** + * The context of an application. It allows access to application-specific resources. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @StageModelOnly + * @since 9 + */ + /** + * The context of an application. It allows access to application-specific resources. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @StageModelOnly + * @crossplatform + * @since 10 + */ + /** + * The context of an application. It allows access to application-specific resources. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @StageModelOnly + * @crossplatform + * @atomicservice + * @since 11 + */ + export type ApplicationContext = _ApplicationContext.default; + /** + * The base context of 'app.Context' for FA Mode or 'application.Context' for Stage Mode. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @StageModelOnly + * @since 9 + */ + /** + * The base context of 'app.Context' for FA Mode or 'application.Context' for Stage Mode. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @StageModelOnly + * @crossplatform + * @since 10 + */ + /** + * The base context of 'app.Context' for FA Mode or 'application.Context' for Stage Mode. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @StageModelOnly + * @crossplatform + * @atomicservice + * @since 11 + */ + export type BaseContext = _BaseContext.default; + /** + * The base context of an ability or an application. It allows access to + * application-specific resources. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @StageModelOnly + * @since 9 + */ + /** + * The base context of an ability or an application. It allows access to + * application-specific resources. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @StageModelOnly + * @crossplatform + * @since 10 + */ + /** + * The base context of an ability or an application. It allows access to + * application-specific resources. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @StageModelOnly + * @crossplatform + * @atomicservice + * @since 11 + */ + export type Context = _Context.default; + /** + * The context of an extension. It allows access to extension-specific resources. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @StageModelOnly + * @since 9 + */ + /** + * The context of an extension. It allows access to extension-specific resources. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @StageModelOnly + * @atomicservice + * @since 11 + */ + export type ExtensionContext = _ExtensionContext.default; + /** + * The context of form extension. It allows access to + * formExtension-specific resources. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @StageModelOnly + * @since 9 + */ + /** + * The context of form extension. It allows access to + * formExtension-specific resources. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @StageModelOnly + * @atomicservice + * @since 11 + */ + export type FormExtensionContext = _FormExtensionContext.default; + /** + * The event center of a context, support the subscription and publication of events. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @StageModelOnly + * @since 9 + */ + /** + * The event center of a context, support the subscription and publication of events. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @StageModelOnly + * @atomicservice + * @since 11 + */ + /** + * The event center of a context, support the subscription and publication of events. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @crossplatform + * @atomicservice + * @since 12 + */ + export type EventHub = _EventHub.default; + /** + * Defines a PacMap object for storing a series of values. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @StageModelOnly + * @since 9 + */ + /** + * Defines a PacMap object for storing a series of values. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @atomicservice + * @since 11 + */ + export type PacMap = _PacMap; + /** + * Indicates the result of startAbility. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @StageModelOnly + * @since 9 + */ + /** + * Indicates the result of startAbility. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @StageModelOnly + * @atomicservice + * @since 11 + */ + export type AbilityResult = _AbilityResult; + /** + * Indicates the callback of connection + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @StageModelOnly + * @since 9 + */ + export type ConnectOptions = _ConnectOptions; + /** + * The context of UI extension. It allows access to + * UIExtension-specific resources. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @StageModelOnly + * @since 10 + */ + export type UIExtensionContext = _UIExtensionContext.default; + /** + * The function Called when some error occurred except disconnected from UIAbility or UIExtensionAbility + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @StageModelOnly + * @atomicservice + * @since 11 + */ + export type AbilityStartCallback = _AbilityStartCallback; + /** + * The context of vpn extension. It allows access to + * vpnExtension-specific resources. + * The class of auto startup info. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @since 11 + */ + export type VpnExtensionContext = _VpnExtensionContext.default; + /** + * The context of an embeddable UIAbility. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @atomicservice + * @since 12 + */ + export type EmbeddableUIAbilityContext = _EmbeddableUIAbilityContext.default; +} +export default common; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.app.ability.contextConstant.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.app.ability.contextConstant.d.ts new file mode 100755 index 00000000..4b062b5f --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.app.ability.contextConstant.d.ts @@ -0,0 +1,165 @@ +/* + * Copyright (c) 2022-2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit AbilityKit + */ +/** + * The context of an application. It allows access to application-specific resources. + * + * @namespace contextConstant + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @StageModelOnly + * @since 9 + */ +/** + * The context of an application. It allows access to application-specific resources. + * + * @namespace contextConstant + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @StageModelOnly + * @atomicservice + * @since 11 + */ +declare namespace contextConstant { + /** + * File area mode + * + * @enum { number } + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @StageModelOnly + * @since 9 + */ + /** + * File area mode + * + * @enum { number } + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @StageModelOnly + * @atomicservice + * @since 11 + */ + export enum AreaMode { + /** + * System level device encryption area + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @StageModelOnly + * @since 9 + */ + /** + * System level device encryption area + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @StageModelOnly + * @atomicservice + * @since 11 + */ + EL1 = 0, + /** + * User credential encryption area + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @StageModelOnly + * @since 9 + */ + /** + * User credential encryption area + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @StageModelOnly + * @atomicservice + * @since 11 + */ + EL2 = 1, + /** + * User credential encryption area + * when screen locked, can read/write, and create file + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @atomicservice + * @since 11 + */ + EL3 = 2, + /** + * User credential encryption area + * when screen locked, FEB2.0 can read/write, FEB3.0 can't + * read/write, and all can't create file + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @atomicservice + * @since 11 + */ + EL4 = 3 + } + /** + * Process mode + * + * @enum { number } + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @since 12 + */ + export enum ProcessMode { + /** + * Indicates the ability started in a new process, and the process lifecycle follows the parent process. + * When using this mode, the target ability needs to have the same bundle name as the caller. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @since 12 + */ + NEW_PROCESS_ATTACH_TO_PARENT = 1, + /** + * Indicates the ability started in a new process. + * When using this mode, the caller needs to add item to status bar first, + * and the target ability needs to have the same bundle name as the caller. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @since 12 + */ + NEW_PROCESS_ATTACH_TO_STATUS_BAR_ITEM = 2 + } + /** + * Startup visibility + * + * @enum { number } + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @since 12 + */ + export enum StartupVisibility { + /** + * Indicates that the ability will hide after process startup. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @since 12 + */ + STARTUP_HIDE = 0, + /** + * Indicates that the ability will show after process startup. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @since 12 + */ + STARTUP_SHOW = 1 + } +} +export default contextConstant; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.app.ability.dataUriUtils.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.app.ability.dataUriUtils.d.ts new file mode 100755 index 00000000..7a01c4e8 --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.app.ability.dataUriUtils.d.ts @@ -0,0 +1,74 @@ +/* + * Copyright (c) 2022-2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit AbilityKit + */ +/** + * Utility class used for handling objects that use the DataAbilityHelper scheme. + * + * @namespace dataUriUtils + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ +declare namespace dataUriUtils { + /** + * Obtains the ID attached to the end of the path component of the given uri. + * + * @param { string } uri - Indicates the uri object from which the ID is to be obtained. + * @returns { number } Returns the ID attached to the end of the path component; + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; 3. Parameter verification failed. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ + function getId(uri: string): number; + /** + * Attaches the given ID to the end of the path component of the given uri. + * + * @param { string } uri - Indicates the uri string from which the ID is to be obtained. + * @param { number } id - Indicates the ID to attach. + * @returns { string } Returns the uri object with the given ID attached. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; 3. Parameter verification failed. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ + function attachId(uri: string, id: number): string; + /** + * Deletes the ID from the end of the path component of the given uri. + * + * @param { string } uri - Indicates the uri object from which the ID is to be deleted. + * @returns { string } Returns the uri object with the ID deleted. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; 3. Parameter verification failed. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ + function deleteId(uri: string): string; + /** + * Updates the ID in the specified uri + * + * @param { string } uri - Indicates the uri object to be updated. + * @param { number } id - Indicates the new ID. + * @returns { string } Returns the updated uri object. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; 3. Parameter verification failed. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ + function updateId(uri: string, id: number): string; +} +export default dataUriUtils; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.app.ability.dialogRequest.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.app.ability.dialogRequest.d.ts new file mode 100755 index 00000000..230c6042 --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.app.ability.dialogRequest.d.ts @@ -0,0 +1,186 @@ +/* + * Copyright (c) 2022-2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"), + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit AbilityKit + */ +import Want from './@ohos.app.ability.Want'; +/** + * Interface of request dialog. + * + * @namespace dialogRequest + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ +declare namespace dialogRequest { + /** + * Window Rectangle + * + * @typedef WindowRect + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @StageModelOnly + * @since 10 + */ + export interface WindowRect { + /** + * The left position of WindowRect + * + * @type { number } + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @StageModelOnly + * @since 10 + */ + left: number; + /** + * The top position of WindowRect + * + * @type { number } + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @StageModelOnly + * @since 10 + */ + top: number; + /** + * The width of WindowRect + * + * @type { number } + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @StageModelOnly + * @since 10 + */ + width: number; + /** + * The height of WindowRect + * + * @type { number } + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @StageModelOnly + * @since 10 + */ + height: number; + } + /** + * Request info of a request. + * + * @typedef RequestInfo + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ + export interface RequestInfo { + /** + * The Window of caller. + * + * @type { ?WindowRect } + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @StageModelOnly + * @since 10 + */ + windowRect?: WindowRect; + } + /** + * The modal bullet box requests the result code. + * + * @enum { number } + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ + export enum ResultCode { + /** + * The modal bullet box requests succeeded. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ + RESULT_OK = 0, + /** + * The modal bullet box requests Failed. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ + RESULT_CANCEL = 1 + } + /** + * The result of requestDialogService with asynchronous callback. + * + * @typedef RequestResult + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @StageModelOnly + * @since 9 + */ + export interface RequestResult { + /** + * The request result passed in by the user. + * + * @type { ResultCode } + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @StageModelOnly + * @since 9 + */ + result: ResultCode; + /** + * The request additional want data passed in by the user. + * + * @type { ?Want } + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @StageModelOnly + * @since 10 + */ + want?: Want; + } + /** + * Provides methods for request callback. + * + * @interface RequestCallback + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ + export interface RequestCallback { + /** + * Send request result to caller. + * + * @param { RequestResult } result - result for request. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; 3. Parameter verification failed. + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @StageModelOnly + * @since 9 + */ + setRequestResult(result: RequestResult): void; + } + /** + * Get request info from caller want. + * + * @param { Want } want - want from caller. + * @returns { RequestInfo } Returns the request info from caller. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; 3. Parameter verification failed. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ + function getRequestInfo(want: Want): RequestInfo; + /** + * Get request callback from caller want. + * + * @param { Want } want - want from caller. + * @returns { RequestCallback } Returns the request callback. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; 3. Parameter verification failed. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ + function getRequestCallback(want: Want): RequestCallback; +} +export default dialogRequest; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.app.ability.errorManager.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.app.ability.errorManager.d.ts new file mode 100755 index 00000000..1af0b752 --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.app.ability.errorManager.d.ts @@ -0,0 +1,203 @@ +/* + * Copyright (c) 2022-2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit AbilityKit + */ +import { AsyncCallback } from './@ohos.base'; +import * as _ErrorObserver from './application/ErrorObserver'; +import { LoopObserver as _LoopObserver } from './application/LoopObserver'; +/** + * This module provides the function of error manager. + * + * @namespace errorManager + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ +/** + * This module provides the function of error manager. + * + * @namespace errorManager + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @atomicservice + * @since 11 + */ +declare namespace errorManager { + /** + * Register error observer. + * + * @param { 'error' } type - error. + * @param { ErrorObserver } observer - The error observer. + * @returns { number } Returns the number code of the observer. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; 3. Parameter verification failed. + * @throws { BusinessError } 16000003 - Id does not exist. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ + /** + * Register error observer. + * + * @param { 'error' } type - error. + * @param { ErrorObserver } observer - The error observer. + * @returns { number } Returns the number code of the observer. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; 3. Parameter verification failed. + * @throws { BusinessError } 16000003 - Id does not exist. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @atomicservice + * @since 11 + */ + function on(type: 'error', observer: ErrorObserver): number; + /** + * Unregister error observer. + * + * @param { 'error' } type - error. + * @param { number } observerId - Indicates the number code of the observer. + * @param { AsyncCallback } callback - The callback of off. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; 3. Parameter verification failed. + * @throws { BusinessError } 16000003 - Id does not exist. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ + /** + * Unregister error observer. + * + * @param { 'error' } type - error. + * @param { number } observerId - Indicates the number code of the observer. + * @param { AsyncCallback } callback - The callback of off. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; 3. Parameter verification failed. + * @throws { BusinessError } 16000003 - Id does not exist. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @atomicservice + * @since 11 + */ + function off(type: 'error', observerId: number, callback: AsyncCallback): void; + /** + * Unregister error observer. + * + * @param { 'error' } type - error. + * @param { number } observerId - Indicates the number code of the observer. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; 3. Parameter verification failed. + * @throws { BusinessError } 16000003 - Id does not exist. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ + /** + * Unregister error observer. + * + * @param { 'error' } type - error. + * @param { number } observerId - Indicates the number code of the observer. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; 3. Parameter verification failed. + * @throws { BusinessError } 16000003 - Id does not exist. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @atomicservice + * @since 11 + */ + function off(type: 'error', observerId: number): Promise; + /** + * Register loop observer. This function can only by called from main thread, + * and if call this function multiple times, the last + * modification will overwrite the previous one. + * + * @param { 'loopObserver' } type - loopObserver. + * @param { number } timeout - Indicates timeout(ms) value of loop observer. + * @param { LoopObserver } observer - The loop observer. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; 3. Parameter verification failed. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @atomicservice + * @since 12 + */ + function on(type: 'loopObserver', timeout: number, observer: LoopObserver): void; + /** + * Unregister loop observer. This function can only by called from main thread. + * + * @param { 'loopObserver' } type - loopObserver. + * @param { LoopObserver } observer - The loop observer. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; 3. Parameter verification failed. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @atomicservice + * @since 12 + */ + function off(type: 'loopObserver', observer?: LoopObserver): void; + /** + * Register unhandled rejection observer. + * + * @param { 'unhandledRejection' } type - 'unhandledRejection'. + * @param { UnhandledRejectionObserver } observer - The unhandled rejection observer. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; 3. Parameter verification failed. + * @throws { BusinessError } 16200001 - If the caller is invalid. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @atomicservice + * @since 12 + */ + function on(type: 'unhandledRejection', observer: UnhandledRejectionObserver): void; + /** + * Unregister unhandled rejection observer. + * + * @param { 'unhandledRejection' } type - error. + * @param { UnhandledRejectionObserver } [observer] - the registered observer + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; 3. Parameter verification failed. + * @throws { BusinessError } 16200001 - If the caller is invalid. + * @throws { BusinessError } 16300004 - If the observer does not exist + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @atomicservice + * @since 12 + */ + function off(type: 'unhandledRejection', observer?: UnhandledRejectionObserver): void; + /** + * The observer will be called by system when an error occurs. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ + /** + * The observer will be called by system when an error occurs. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @atomicservice + * @since 11 + */ + export type ErrorObserver = _ErrorObserver.default; + /** + * The observer will be called when application main thread execute timeout. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @atomicservice + * @since 12 + */ + export type LoopObserver = _LoopObserver; + /** + * The observer will be called by system when an unhandled rejection occurs. + * + * { Error | any } reason - the reason of the rejection, typically of Error type + * { Promise } promise - the promise that is rejected + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @atomicservice + * @since 12 + */ + export type UnhandledRejectionObserver = (reason: Error | any, promise: Promise) => void; +} +export default errorManager; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.app.ability.insightIntent.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.app.ability.insightIntent.d.ts new file mode 100755 index 00000000..f54da4ce --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.app.ability.insightIntent.d.ts @@ -0,0 +1,98 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"), + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit AbilityKit + */ +/** + * interface of insightIntent. + * + * @namespace insightIntent + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @StageModelOnly + * @atomicservice + * @since 11 + */ +declare namespace insightIntent { + /** + * Enum for supported execute mode. + * + * @enum { number } + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @StageModelOnly + * @atomicservice + * @since 11 + */ + enum ExecuteMode { + /** + * UIAbility foreground. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @StageModelOnly + * @atomicservice + * @since 11 + */ + UI_ABILITY_FOREGROUND = 0, + /** + * UIAbility background. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @StageModelOnly + * @atomicservice + * @since 11 + */ + UI_ABILITY_BACKGROUND = 1, + /** + * UIExtensionAbility. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @StageModelOnly + * @since 11 + */ + UI_EXTENSION_ABILITY = 2 + } + /** + * Result of intent execution. + * + * @typedef ExecuteResult + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @StageModelOnly + * @atomicservice + * @since 11 + */ + interface ExecuteResult { + /** + * Indicates result code. + * + * @type { number } + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @StageModelOnly + * @atomicservice + * @since 11 + */ + code: number; + /** + * Indicates execute result. + * + * @type { ?Record } + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @StageModelOnly + * @atomicservice + * @since 11 + */ + result?: Record; + } +} +export default insightIntent; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.app.ability.wantAgent.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.app.ability.wantAgent.d.ts new file mode 100755 index 00000000..8ae0b144 --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.app.ability.wantAgent.d.ts @@ -0,0 +1,405 @@ +/* + * Copyright (c) 2022-2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit AbilityKit + */ +import { AsyncCallback } from './@ohos.base'; +import Want from './@ohos.app.ability.Want'; +import { WantAgentInfo as _WantAgentInfo } from './wantAgent/wantAgentInfo'; +import { TriggerInfo as _TriggerInfo } from './wantAgent/triggerInfo'; +/** + * Provide the method obtain trigger, cancel, and compare and to obtain + * the bundle name, UID of an {@link WantAgent} object. + * + * @namespace wantAgent + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ +declare namespace wantAgent { + /** + * Obtains the bundle name of a WantAgent. + * + * @param { WantAgent } agent - Indicates the WantAgent. + * @param { AsyncCallback } callback - The callback is used to return the bundle name. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types. + * @throws { BusinessError } 16000007 - Service busy, there are concurrent tasks, waiting for retry. + * @throws { BusinessError } 16000151 - Invalid wantagent object. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ + function getBundleName(agent: WantAgent, callback: AsyncCallback): void; + /** + * Obtains the bundle name of a WantAgent. + * + * @param { WantAgent } agent - Indicates the WantAgent. + * @returns { Promise } Returns the bundle name. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types. + * @throws { BusinessError } 16000007 - Service busy, there are concurrent tasks, waiting for retry. + * @throws { BusinessError } 16000151 - Invalid wantagent object. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ + function getBundleName(agent: WantAgent): Promise; + /** + * Obtains the UID of a WantAgent. + * + * @param { WantAgent } agent - Indicates the WantAgent. + * @param { AsyncCallback } callback - The callback is used to return the UID. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types. + * @throws { BusinessError } 16000007 - Service busy, there are concurrent tasks, waiting for retry. + * @throws { BusinessError } 16000151 - Invalid wantagent object. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ + function getUid(agent: WantAgent, callback: AsyncCallback): void; + /** + * Obtains the UID of a WantAgent. + * + * @param { WantAgent } agent - Indicates the WantAgent. + * @returns { Promise } Returns the UID. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types. + * @throws { BusinessError } 16000007 - Service busy, there are concurrent tasks, waiting for retry. + * @throws { BusinessError } 16000151 - Invalid wantagent object. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ + function getUid(agent: WantAgent): Promise; + /** + * Cancel a WantAgent. Only the application that creates the WantAgent can cancel it. + * + * @param { WantAgent } agent - Indicates the WantAgent. + * @param { AsyncCallback } callback - The callback of cancel. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types. + * @throws { BusinessError } 16000007 - Service busy, there are concurrent tasks, waiting for retry. + * @throws { BusinessError } 16000151 - Invalid wantagent object. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ + function cancel(agent: WantAgent, callback: AsyncCallback): void; + /** + * Cancel a WantAgent. Only the application that creates the WantAgent can cancel it. + * + * @param { WantAgent } agent - Indicates the WantAgent. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types. + * @throws { BusinessError } 16000007 - Service busy, there are concurrent tasks, waiting for retry. + * @throws { BusinessError } 16000151 - Invalid wantagent object. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ + function cancel(agent: WantAgent): Promise; + /** + * Triggers a WantAgent. + * + * @param { WantAgent } agent - Indicates the WantAgent. + * @param { TriggerInfo } triggerInfo - Indicates the information required for triggering a WantAgent. + * @param { AsyncCallback } [callback] - The callback is used to return the CompleteData. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ + function trigger(agent: WantAgent, triggerInfo: TriggerInfo, callback?: AsyncCallback): void; + /** + * Checks whether two WantAgent objects are equal. + * + * @param { WantAgent } agent - Indicates the WantAgent. + * @param { WantAgent } otherAgent - Indicates the other WantAgent. + * @param { AsyncCallback } callback - Returns true if the two WantAgents are the same. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ + function equal(agent: WantAgent, otherAgent: WantAgent, callback: AsyncCallback): void; + /** + * Checks whether two WantAgent objects are equal. + * + * @param { WantAgent } agent - Indicates the WantAgent. + * @param { WantAgent } otherAgent - Indicates the other WantAgent. + * @returns { Promise } Returns true if the two WantAgents are the same. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ + function equal(agent: WantAgent, otherAgent: WantAgent): Promise; + /** + * Obtains a WantAgent object. + * + * @param { WantAgentInfo } info - Information about the WantAgent object to obtain. + * @param { AsyncCallback } callback - The callback is used to return the created WantAgent. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types. + * @throws { BusinessError } 16000007 - Service busy, there are concurrent tasks, waiting for retry. + * @throws { BusinessError } 16000151 - Invalid wantagent object. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ + function getWantAgent(info: WantAgentInfo, callback: AsyncCallback): void; + /** + * Obtains a WantAgent object. + * + * @param { WantAgentInfo } info - Information about the WantAgent object to obtain. + * @returns { Promise } Returns the created WantAgent. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types. + * @throws { BusinessError } 16000007 - Service busy, there are concurrent tasks, waiting for retry. + * @throws { BusinessError } 16000151 - Invalid wantagent object. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ + function getWantAgent(info: WantAgentInfo): Promise; + /** + * Obtains the {@link OperationType} of a {@link WantAgent}. + * + * @param { WantAgent } agent - Indicates the WantAgent. + * @param { AsyncCallback } callback - The callback is used to return the OperationType of the WantAgent. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types. + * @throws { BusinessError } 16000007 - Service busy, there are concurrent tasks, waiting for retry. + * @throws { BusinessError } 16000015 - Service timeout. + * @throws { BusinessError } 16000151 - Invalid wantagent object. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ + function getOperationType(agent: WantAgent, callback: AsyncCallback): void; + /** + * Obtains the {@link OperationType} of a {@link WantAgent}. + * + * @param { WantAgent } agent - Indicates the WantAgent. + * @returns { Promise } Returns the OperationType of the WantAgent. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types. + * @throws { BusinessError } 16000007 - Service busy, there are concurrent tasks, waiting for retry. + * @throws { BusinessError } 16000015 - Service timeout. + * @throws { BusinessError } 16000151 - Invalid wantagent object. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ + function getOperationType(agent: WantAgent): Promise; + /** + * Enumerates flags for using a WantAgent. + * + * @enum { number } + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ + export enum WantAgentFlags { + /** + * Indicates that the WantAgent can be used only once. + * This flag is valid only when OperationType is set to START_ABILITY, START_SERVICE, or SEND_COMMON_EVENT. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ + ONE_TIME_FLAG = 0, + /** + * Indicates that null is returned if the WantAgent does not exist. + * This flag is valid only when OperationType is set to START_ABILITY, START_SERVICE, or SEND_COMMON_EVENT. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ + NO_BUILD_FLAG, + /** + * Indicates that the existing WantAgent should be canceled before a new object is generated. + * This flag is valid only when OperationType is set to START_ABILITY, START_SERVICE, or SEND_COMMON_EVENT. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ + CANCEL_PRESENT_FLAG, + /** + * Indicates that the system only replaces the extra data of the existing WantAgent with that of the new object. + * This flag is valid only when OperationType is set to START_ABILITY, START_SERVICE, or SEND_COMMON_EVENT. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ + UPDATE_PRESENT_FLAG, + /** + * Indicates that the created WantAgent should be immutable. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ + CONSTANT_FLAG, + /** + * Indicates that the current value of element can be replaced when the WantAgent is triggered. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ + REPLACE_ELEMENT, + /** + * Indicates that the current value of action can be replaced when the WantAgent is triggered. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ + REPLACE_ACTION, + /** + * Indicates that the current value of uri can be replaced when the WantAgent is triggered. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ + REPLACE_URI, + /** + * Indicates that the current value of entities can be replaced when the WantAgent is triggered. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ + REPLACE_ENTITIES, + /** + * Indicates that the current value of packageName can be replaced when the WantAgent is triggered. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ + REPLACE_BUNDLE + } + /** + * Identifies the operation for using a WantAgent, such as starting an ability or sending a common event. + * + * @enum { number } + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ + export enum OperationType { + /** + * Unknown operation. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ + UNKNOWN_TYPE = 0, + /** + * Starts an ability with a UI. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ + START_ABILITY, + /** + * Starts multiple abilities with a UI. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ + START_ABILITIES, + /** + * Starts an ability without a UI. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ + START_SERVICE, + /** + * Sends a common event. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ + SEND_COMMON_EVENT + } + /** + * Describes the data returned by after wantAgent.trigger is called. + * + * @typedef CompleteData + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ + export interface CompleteData { + /** + * Triggered WantAgent. + * + * @type { WantAgent } + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ + info: WantAgent; + /** + * Existing Want that is triggered. + * + * @type { Want } + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ + want: Want; + /** + * Request code used to trigger the WantAgent. + * + * @type { number } + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ + finalCode: number; + /** + * Final data collected by the common event. + * + * @type { string } + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ + finalData: string; + /** + * Extra data collected by the common event. + * + * @type { ?object } + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ + /** + * Extra data collected by the common event. + * + * @type { ?Record } + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 11 + */ + extraInfo?: Record; + } + /** + * Provides the information required for triggering a WantAgent. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ + export type TriggerInfo = _TriggerInfo; + /** + * Provides the information required for triggering a WantAgent. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ + export type WantAgentInfo = _WantAgentInfo; +} +/** + * WantAgent object. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ +export type WantAgent = object; +export default wantAgent; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.app.ability.wantConstant.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.app.ability.wantConstant.d.ts new file mode 100755 index 00000000..8a8a35e5 --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.app.ability.wantConstant.d.ts @@ -0,0 +1,275 @@ +/* + * Copyright (c) 2022-2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"), + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit AbilityKit + */ +/** + * the constant for params and flags in the want + * + * @namespace wantConstant + * @syscap SystemCapability.Ability.AbilityBase + * @since 9 + */ +/** + * the constant for params and flags in the want + * + * @namespace wantConstant + * @syscap SystemCapability.Ability.AbilityBase + * @atomicservice + * @since 11 + */ +declare namespace wantConstant { + /** + * The constant for params of the want + * + * @enum { string } + * @syscap SystemCapability.Ability.AbilityBase + * @since 9 + */ + /** + * The constant for params of the want + * + * @enum { string } + * @syscap SystemCapability.Ability.AbilityBase + * @atomicservice + * @since 11 + */ + export enum Params { + /** + * Indicates the ability in this want can back to the current top ability even though they are not in the same + * mission stack. + * + * @syscap SystemCapability.Ability.AbilityBase + * @since 9 + */ + /** + * Indicates the ability in this want can back to the current top ability even though they are not in the same + * mission stack. + * + * @syscap SystemCapability.Ability.AbilityBase + * @atomicservice + * @since 11 + */ + ABILITY_BACK_TO_OTHER_MISSION_STACK = 'ability.params.backToOtherMissionStack', + /** + * Indicates the param of ability failure restart recovery identification + * + * @syscap SystemCapability.Ability.AbilityBase + * @since 10 + */ + /** + * Indicates the param of ability failure restart recovery identification + * + * @syscap SystemCapability.Ability.AbilityBase + * @atomicservice + * @since 11 + */ + ABILITY_RECOVERY_RESTART = 'ohos.ability.params.abilityRecoveryRestart', + /** + * Indicates the param of extra content title + * + * @syscap SystemCapability.Ability.AbilityBase + * @since 10 + */ + /** + * Indicates the param of extra content title + * + * @syscap SystemCapability.Ability.AbilityBase + * @atomicservice + * @since 11 + */ + CONTENT_TITLE_KEY = 'ohos.extra.param.key.contentTitle', + /** + * Indicates the param of extra shared abstract + * + * @syscap SystemCapability.Ability.AbilityBase + * @since 10 + */ + /** + * Indicates the param of extra shared abstract + * + * @syscap SystemCapability.Ability.AbilityBase + * @atomicservice + * @since 11 + */ + SHARE_ABSTRACT_KEY = 'ohos.extra.param.key.shareAbstract', + /** + * Indicates the param of extra shareURL + * + * @syscap SystemCapability.Ability.AbilityBase + * @since 10 + */ + /** + * Indicates the param of extra shareURL + * + * @syscap SystemCapability.Ability.AbilityBase + * @atomicservice + * @since 11 + */ + SHARE_URL_KEY = 'ohos.extra.param.key.shareUrl', + /** + * Indicates the param of extra support continue page stack. + * The default value of the param is true, + * and the system will automatically flow the page stack information by default. + * + * @syscap SystemCapability.Ability.AbilityBase + * @since 10 + */ + /** + * Indicates the param of extra support continue page stack. + * The default value of the param is true, + * and the system will automatically flow the page stack information by default. + * + * @syscap SystemCapability.Ability.AbilityBase + * @atomicservice + * @since 11 + */ + SUPPORT_CONTINUE_PAGE_STACK_KEY = 'ohos.extra.param.key.supportContinuePageStack', + /** + * Indicates the param of extra stop source ability on continue. + * The default value of the param is true, + * and the system will exit the source application by default. + * + * @syscap SystemCapability.Ability.AbilityBase + * @since 10 + */ + /** + * Indicates the param of extra stop source ability on continue. + * The default value of the param is true, + * and the system will exit the source application by default. + * + * @syscap SystemCapability.Ability.AbilityBase + * @atomicservice + * @since 11 + */ + SUPPORT_CONTINUE_SOURCE_EXIT_KEY = 'ohos.extra.param.key.supportContinueSourceExit', + /** + * Indicates the param of show mode key. + * + * @syscap SystemCapability.Ability.AbilityBase + * @atomicservice + * @since 12 + */ + SHOW_MODE_KEY = 'ohos.extra.param.key.showMode', + /** + * Cross-application sharing of file URIs. + * + * @syscap SystemCapability.Ability.AbilityBase + * @atomicservice + * @since 12 + */ + PARAMS_STREAM = 'ability.params.stream' + } + /** + * Used to indicate how Want is handled. + * + * @enum { number } + * @syscap SystemCapability.Ability.AbilityBase + * @since 9 + */ + /** + * Used to indicate how Want is handled. + * + * @enum { number } + * @syscap SystemCapability.Ability.AbilityBase + * @atomicservice + * @since 11 + */ + export enum Flags { + /** + * Indicates the grant to perform read operations on the URI. + * + * @syscap SystemCapability.Ability.AbilityBase + * @since 9 + */ + /** + * Indicates the grant to perform read operations on the URI. + * + * @syscap SystemCapability.Ability.AbilityBase + * @atomicservice + * @since 11 + */ + FLAG_AUTH_READ_URI_PERMISSION = 0x00000001, + /** + * Indicates the grant to perform write operations on the URI. + * + * @syscap SystemCapability.Ability.AbilityBase + * @since 9 + */ + /** + * Indicates the grant to perform write operations on the URI. + * + * @syscap SystemCapability.Ability.AbilityBase + * @atomicservice + * @since 11 + */ + FLAG_AUTH_WRITE_URI_PERMISSION = 0x00000002, + /** + * Indicates that the URI can be persisted by the callee. + * @syscap SystemCapability.Ability.AbilityBase + * @since 12 + */ + FLAG_AUTH_PERSISTABLE_URI_PERMISSION = 0x00000040, + /** + * Install the specified ability if it's not installed. + * + * @syscap SystemCapability.Ability.AbilityBase + * @since 9 + */ + /** + * Install the specified ability if it's not installed. + * + * @syscap SystemCapability.Ability.AbilityBase + * @atomicservice + * @since 11 + */ + FLAG_INSTALL_ON_DEMAND = 0x00000800, + /** + * Indicates that if implicit start ability couldn't match any application, no tip dialog will be pulled up. + * + * @syscap SystemCapability.Ability.AbilityBase + * @since 11 + */ + FLAG_START_WITHOUT_TIPS = 0x40000000 + } + /** + * Used to indicate show mode. + * + * @enum { number } + * @syscap SystemCapability.Ability.AbilityBase + * @atomicservice + * @since 12 + */ + export enum ShowMode { + /** + * Indicates the window show mode. + * + * @syscap SystemCapability.Ability.AbilityBase + * @atomicservice + * @since 12 + */ + WINDOW = 0, + /** + * Indicates the embedded full show mode. + * + * @syscap SystemCapability.Ability.AbilityBase + * @atomicservice + * @since 12 + */ + EMBEDDED_FULL = 1 + } +} +export default wantConstant; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.app.appstartup.StartupConfig.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.app.appstartup.StartupConfig.d.ts new file mode 100755 index 00000000..af4d9a48 --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.app.appstartup.StartupConfig.d.ts @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"), + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import StartupListener from './@ohos.app.appstartup.StartupListener'; +/** + * @file + * @kit AbilityKit + */ +/** + * The interface of configuration for running startup tasks. + * + * @interface StartupConfig + * @syscap SystemCapability.Ability.AppStartup + * @stagemodelonly + * @since 12 + */ +export default interface StartupConfig { + /** + * Indicates timeout for executing all startup tasks. Default value is 10000 milliseconds. + * + * @type { ?number } + * @default 10000 + * @syscap SystemCapability.Ability.AppStartup + * @stagemodelonly + * @since 12 + */ + timeoutMs?: number; + /** + * Indicates a listener for startup, which will be called when all tasks complete. + * + * @type { ?StartupListener } + * @syscap SystemCapability.Ability.AppStartup + * @stagemodelonly + * @since 12 + */ + startupListener?: StartupListener; +} diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.app.appstartup.StartupConfigEntry.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.app.appstartup.StartupConfigEntry.d.ts new file mode 100755 index 00000000..984fb7fe --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.app.appstartup.StartupConfigEntry.d.ts @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"), + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import StartupConfig from './@ohos.app.appstartup.StartupConfig'; +/** + * @file + * @kit AbilityKit + */ +/** + * The configuration entry for running startup tasks. + * + * @syscap SystemCapability.Ability.AppStartup + * @stagemodelonly + * @since 12 + */ +export default class StartupConfigEntry { + /** + * Called when startup initialization to configure startup mode. + * + * @returns { StartupConfig } The developer returns a startup configuration. + * @syscap SystemCapability.Ability.AppStartup + * @stagemodelonly + * @since 12 + */ + onConfig?(): StartupConfig; +} diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.app.appstartup.StartupListener.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.app.appstartup.StartupListener.d.ts new file mode 100755 index 00000000..300a7338 --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.app.appstartup.StartupListener.d.ts @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"), + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit AbilityKit + */ +import { BusinessError } from './@ohos.base'; +/** + * The listener for running startup tasks, which will be called when all tasks complete. + * + * @syscap SystemCapability.Ability.AppStartup + * @stagemodelonly + * @since 12 + */ +export default class StartupListener { + /** + * Called when all startup tasks complete. + * + * @param { BusinessError } error - Indicates the error during execution. + * @syscap SystemCapability.Ability.AppStartup + * @stagemodelonly + * @since 12 + */ + onCompleted?(error: BusinessError): void; +} diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.app.appstartup.StartupTask.d.ets b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.app.appstartup.StartupTask.d.ets new file mode 100755 index 00000000..005a14e1 --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.app.appstartup.StartupTask.d.ets @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"), + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import AbilityStageContext from './application/AbilityStageContext'; +/** + * @file + * @kit AbilityKit + */ +/** + * The base class of startup task. + * + * @syscap SystemCapability.Ability.AppStartup + * @stagemodelonly + * @since 12 + */ +@Sendable +export default class StartupTask { + /** + * Called when specific dependent task complete. + * + * @param { string } dependency - Indicates name of specific dependent startup task. + * @param { Object } result - Indicates result of specific dependent startup task. + * @syscap SystemCapability.Ability.AppStartup + * @stagemodelonly + * @since 12 + */ + onDependencyCompleted?(dependency: string, result: Object): void; + /** + * Initializes current startup task. + * A developer could override this function to init current task and return a result for other tasks. + * + * @param { AbilityStageContext } context - Indicates ability stage context. + * @returns { Promise } The result of initialization. + * @syscap SystemCapability.Ability.AppStartup + * @stagemodelonly + * @since 12 + */ + init(context: AbilityStageContext): Promise; +} diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.app.appstartup.startupManager.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.app.appstartup.startupManager.d.ts new file mode 100755 index 00000000..34509003 --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.app.appstartup.startupManager.d.ts @@ -0,0 +1,92 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"), + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import StartupConfig from './@ohos.app.appstartup.StartupConfig'; +/** + * @file + * @kit AbilityKit + */ +/** + * Startup task manager. + * + * @namespace startupManager + * @syscap SystemCapability.Ability.AppStartup + * @stagemodelonly + * @since 12 + */ +declare namespace startupManager { + /** + * Runs startup tasks. + * + * @param { Array } startupTasks - Indicates all tasks ready to run. + * @param { StartupConfig } [config] - Indicates the configuration of startup tasks. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types. + * @throws { BusinessError } 16000050 - Internal error. + * @throws { BusinessError } 28800001 - Startup task or its dependency not found. + * @throws { BusinessError } 28800002 - The startup tasks have circular dependencies. + * @throws { BusinessError } 28800003 - An error occurred while running the startup tasks. + * @throws { BusinessError } 28800004 - Running startup tasks timeout. + * + * @syscap SystemCapability.Ability.AppStartup + * @stagemodelonly + * @since 12 + */ + function run(startupTasks: Array, config?: StartupConfig): Promise; + /** + * Removes all startup tasks result. + * + * @syscap SystemCapability.Ability.AppStartup + * @stagemodelonly + * @since 12 + */ + function removeAllStartupTaskResults(): void; + /** + * Obtains specific startup task result. + * + * @param { string } startupTask - Indicates name of specific startup task. + * @returns { Object } The result of specific startup task. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types. + * @syscap SystemCapability.Ability.AppStartup + * @stagemodelonly + * @since 12 + */ + function getStartupTaskResult(startupTask: string): Object; + /** + * Obtains whether specific startup task has already been initialized. + * + * @param { string } startupTask - Indicates name of specific startup task. + * @returns { boolean } Whether specific startup task has already been initialized. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types. + * @syscap SystemCapability.Ability.AppStartup + * @stagemodelonly + * @since 12 + */ + function isStartupTaskInitialized(startupTask: string): boolean; + /** + * Removes specific startup task result. + * + * @param { string } startupTask - Indicates name of specific startup task. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types. + * @syscap SystemCapability.Ability.AppStartup + * @stagemodelonly + * @since 12 + */ + function removeStartupTaskResult(startupTask: string): void; +} +export default startupManager; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.app.form.FormExtensionAbility.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.app.form.FormExtensionAbility.d.ts new file mode 100755 index 00000000..96e0134b --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.app.form.FormExtensionAbility.d.ts @@ -0,0 +1,263 @@ +/* + * Copyright (c) 2021-2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"), + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit FormKit + */ +import formBindingData from './@ohos.app.form.formBindingData'; +import formInfo from './@ohos.app.form.formInfo'; +import FormExtensionContext from './application/FormExtensionContext'; +import Want from './@ohos.app.ability.Want'; +import { Configuration } from './@ohos.app.ability.Configuration'; +/** + * class of form extension. + * + * @syscap SystemCapability.Ability.Form + * @stagemodelonly + * @since 9 + */ +/** + * class of form extension. + * + * @syscap SystemCapability.Ability.Form + * @stagemodelonly + * @atomicservice + * @since 11 + */ +export default class FormExtensionAbility { + /** + * Indicates form extension context. + * + * @type { FormExtensionContext } + * @syscap SystemCapability.Ability.Form + * @stagemodelonly + * @since 9 + */ + /** + * Indicates form extension context. + * + * @type { FormExtensionContext } + * @syscap SystemCapability.Ability.Form + * @stagemodelonly + * @atomicservice + * @since 11 + */ + context: FormExtensionContext; + /** + * Called to return a {@link formBindingData#FormBindingData} object. + * + * @param { Want } want - Indicates the detailed information for creating a {@link formBindingData#FormBindingData}. + * The {@code Want} object must include the form ID, form name, and grid style of the form. + * Such form information must be managed as persistent data for further form + * acquisition, update, and deletion. + * @returns { formBindingData.FormBindingData } Returns the created {@link formBindingData#FormBindingData} object. + * @syscap SystemCapability.Ability.Form + * @stagemodelonly + * @since 9 + */ + /** + * Called to return a {@link formBindingData#FormBindingData} object. + * + * @param { Want } want - Indicates the detailed information for creating a {@link formBindingData#FormBindingData}. + * The {@code Want} object must include the form ID, form name, and grid style of the form. + * Such form information must be managed as persistent data for further form + * acquisition, update, and deletion. + * @returns { formBindingData.FormBindingData } Returns the created {@link formBindingData#FormBindingData} object. + * @syscap SystemCapability.Ability.Form + * @stagemodelonly + * @atomicservice + * @since 11 + */ + onAddForm(want: Want): formBindingData.FormBindingData; + /** + * Called when the form provider is notified that a temporary form is successfully converted to a normal form. + * + * @param { string } formId - Indicates the ID of the form. + * @syscap SystemCapability.Ability.Form + * @stagemodelonly + * @since 9 + */ + /** + * Called when the form provider is notified that a temporary form is successfully converted to a normal form. + * + * @param { string } formId - Indicates the ID of the form. + * @syscap SystemCapability.Ability.Form + * @stagemodelonly + * @atomicservice + * @since 11 + */ + onCastToNormalForm(formId: string): void; + /** + * Called to notify the form provider to update a specified form. + * + * @param { string } formId - Indicates the ID of the form to update. + * @syscap SystemCapability.Ability.Form + * @stagemodelonly + * @since 9 + */ + /** + * Called to notify the form provider to update a specified form. + * + * @param { string } formId - Indicates the ID of the form to update. + * @syscap SystemCapability.Ability.Form + * @stagemodelonly + * @atomicservice + * @since 11 + */ + /** + * Called to notify the form provider to update a specified form. + * + * @param { string } formId - Indicates the ID of the form to update. + * @param { Record } [wantParams] - Indicates the detailed information for updating the form. + * @syscap SystemCapability.Ability.Form + * @stagemodelonly + * @atomicservice + * @since 12 + */ + onUpdateForm(formId: string, wantParams?: Record): void; + /** + * Called when the form provider receives form events from the system. + * + * @param { object } newStatus - Indicates the form events occurred. The key in the {@code Map} + * object indicates the form ID, and the value indicates the event + * type, which can be either + * {@link formInfo#VisibilityType#FORM_VISIBLE} or + * {@link formInfo#VisibilityType#FORM_INVISIBLE}. + * {@link formInfo#VisibilityType#FORM_VISIBLE} means that the form becomes visible, + * {@link formInfo#VisibilityType#FORM_INVISIBLE} means that the form becomes + * invisible. + * @syscap SystemCapability.Ability.Form + * @stagemodelonly + * @since 9 + */ + /** + * Called when the form provider receives form events from the system. + * + * @param { Record } newStatus - Indicates the form events occurred. The key in the {@code Map} + * object indicates the form ID, and the value indicates the event + * type, which can be either + * {@link formInfo#VisibilityType#FORM_VISIBLE} or + * {@link formInfo#VisibilityType#FORM_INVISIBLE}. + * {@link formInfo#VisibilityType#FORM_VISIBLE} + * means that the form becomes visible, + * {@link formInfo#VisibilityType#FORM_INVISIBLE} means that the form + * becomes invisible. + * @syscap SystemCapability.Ability.Form + * @stagemodelonly + * @since 11 + */ + onChangeFormVisibility(newStatus: Record): void; + /** + * Called when a specified message event defined by the form provider is triggered. This method is valid only for + * JS forms. + * + * @param { string } formId - Indicates the ID of the form on which the message event is triggered, which is + * provided by the client to the form provider. + * @param { string } message - Indicates the value of the {@code params} field of the message event. This parameter + * is used to identify the specific component on which the event is triggered. + * @syscap SystemCapability.Ability.Form + * @stagemodelonly + * @since 9 + */ + /** + * Called when a specified message event defined by the form provider is triggered. This method is valid only for + * JS forms. + * + * @param { string } formId - Indicates the ID of the form on which the message event is triggered, which is + * provided by the client to the form provider. + * @param { string } message - Indicates the value of the {@code params} field of the message event. This parameter + * is used to identify the specific component on which the event is triggered. + * @syscap SystemCapability.Ability.Form + * @stagemodelonly + * @atomicservice + * @since 11 + */ + onFormEvent(formId: string, message: string): void; + /** + * Called to notify the form provider that a specified form has been destroyed. Override this method if + * you want your application, as the form provider, to be notified of form deletion. + * + * @param { string } formId - Indicates the ID of the destroyed form. + * @syscap SystemCapability.Ability.Form + * @stagemodelonly + * @since 9 + */ + /** + * Called to notify the form provider that a specified form has been destroyed. Override this method if + * you want your application, as the form provider, to be notified of form deletion. + * + * @param { string } formId - Indicates the ID of the destroyed form. + * @syscap SystemCapability.Ability.Form + * @stagemodelonly + * @atomicservice + * @since 11 + */ + onRemoveForm(formId: string): void; + /** + * Called when the system configuration is updated. + * + * @param { Configuration } newConfig - Indicates the system configuration, such as language and color mode. + * @syscap SystemCapability.Ability.Form + * @stagemodelonly + * @since 9 + */ + /** + * Called when the system configuration is updated. + * + * @param { Configuration } newConfig - Indicates the system configuration, such as language and color mode. + * @syscap SystemCapability.Ability.Form + * @stagemodelonly + * @atomicservice + * @since 11 + */ + onConfigurationUpdate(newConfig: Configuration): void; + /** + * Called to return a {@link FormState} object. + *

You must override this callback if you want this ability to return the actual form state. Otherwise, + * this method returns {@link FormState#DEFAULT} by default.

+ * + * @param { Want } want - Indicates the description of the form for which the {@link formInfo#FormState} + * is obtained. The description covers the bundle name, ability name, module name, + * form name, and form dimensions. + * @returns { formInfo.FormState } Returns the {@link formInfo#FormState} object. + * @syscap SystemCapability.Ability.Form + * @stagemodelonly + * @since 9 + */ + /** + * Called to return a {@link FormState} object. + *

You must override this callback if you want this ability to return the actual form state. Otherwise, + * this method returns {@link FormState#DEFAULT} by default.

+ * + * @param { Want } want - Indicates the description of the form for which the {@link formInfo#FormState} + * is obtained. The description covers the bundle name, ability name, module name, + * form name, and form dimensions. + * @returns { formInfo.FormState } Returns the {@link formInfo#FormState} object. + * @syscap SystemCapability.Ability.Form + * @stagemodelonly + * @atomicservice + * @since 11 + */ + onAcquireFormState?(want: Want): formInfo.FormState; + /** + * Called when this ability breaks the last link, notifying the provider that the provider process is about to stop. + * + * @syscap SystemCapability.Ability.Form + * @stagemodelonly + * @atomicservice + * @since 12 + */ + onStop?(): void; +} diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.app.form.formBindingData.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.app.form.formBindingData.d.ts new file mode 100755 index 00000000..f933531d --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.app.form.formBindingData.d.ts @@ -0,0 +1,165 @@ +/* + * Copyright (c) 2022-2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit FormKit + */ + +/** + * Interface of formBindingData. + * + * @namespace formBindingData + * @syscap SystemCapability.Ability.Form + * @since 9 + */ +/** + * Interface of formBindingData. + * + * @namespace formBindingData + * @syscap SystemCapability.Ability.Form + * @atomicservice + * @since 11 + */ +declare namespace formBindingData { + /** + * Create an FormBindingData instance. + * + * @param { Object | string } [obj] - Indicates the FormBindingData instance data. + * @returns { FormBindingData } Returns the FormBindingData. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. + * @syscap SystemCapability.Ability.Form + * @since 9 + */ + /** + * Create an FormBindingData instance. + * + * @param { Object | string } [obj] - Indicates the FormBindingData instance data. + * @returns { FormBindingData } Returns the FormBindingData. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. + * @syscap SystemCapability.Ability.Form + * @atomicservice + * @since 11 + */ + function createFormBindingData(obj?: Object | string): FormBindingData; + /** + * Defines the createFormBindingData result interface. + * + * @typedef FormBindingData + * @syscap SystemCapability.Ability.Form + * @since 9 + */ + /** + * Defines the createFormBindingData result interface. + * + * @typedef FormBindingData + * @syscap SystemCapability.Ability.Form + * @atomicservice + * @since 11 + */ + interface FormBindingData { + /** + * Data for updating. + * + * @type { Object } + * @syscap SystemCapability.Ability.Form + * @since 9 + */ + /** + * Data for updating. + * + * @type { Object } + * @syscap SystemCapability.Ability.Form + * @atomicservice + * @since 11 + */ + data: Object; + /** + * proxies for updating. + * + * @type { ?Array } + * @syscap SystemCapability.Ability.Form + * @StageModelOnly + * @since 10 + */ + /** + * proxies for updating. + * + * @type { ?Array } + * @syscap SystemCapability.Ability.Form + * @StageModelOnly + * @atomicservice + * @since 11 + */ + proxies?: Array; + } + /** + * Defines the form proxy data. + * + * @typedef ProxyData + * @syscap SystemCapability.Ability.Form + * @StageModelOnly + * @since 10 + */ + /** + * Defines the form proxy data. + * + * @typedef ProxyData + * @syscap SystemCapability.Ability.Form + * @StageModelOnly + * @atomicservice + * @since 11 + */ + interface ProxyData { + /** + * Key for proxy. The value depend data publisher. + * + * @type { string } + * @syscap SystemCapability.Ability.Form + * @StageModelOnly + * @since 10 + */ + /** + * Key for proxy. The value depend data publisher. + * + * @type { string } + * @syscap SystemCapability.Ability.Form + * @StageModelOnly + * @atomicservice + * @since 11 + */ + key: string; + /** + * SubscriberId. The value depend data publisher. The default value is current formId. + * + * @type { ?string } + * @syscap SystemCapability.Ability.Form + * @StageModelOnly + * @since 10 + */ + /** + * SubscriberId. The value depend data publisher. The default value is current formId. + * + * @type { ?string } + * @syscap SystemCapability.Ability.Form + * @StageModelOnly + * @atomicservice + * @since 11 + */ + subscriberId?: string; + } +} +export default formBindingData; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.app.form.formInfo.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.app.form.formInfo.d.ts new file mode 100755 index 00000000..1e34cea5 --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.app.form.formInfo.d.ts @@ -0,0 +1,1218 @@ +/* + * Copyright (c) 2022-2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit FormKit + */ +import Want from './@ohos.app.ability.Want'; +/** + * interface of formInfo. + * + * @namespace formInfo + * @syscap SystemCapability.Ability.Form + * @since 9 + */ +/** + * interface of formInfo. + * + * @namespace formInfo + * @syscap SystemCapability.Ability.Form + * @atomicservice + * @since 11 + */ +declare namespace formInfo { + /** + * Provides information about a form. + * + * @typedef FormInfo + * @syscap SystemCapability.Ability.Form + * @since 9 + */ + /** + * Provides information about a form. + * + * @typedef FormInfo + * @syscap SystemCapability.Ability.Form + * @atomicservice + * @since 11 + */ + interface FormInfo { + /** + * Obtains the bundle name of the application to which this form belongs. + * + * @type { string } + * @syscap SystemCapability.Ability.Form + * @since 9 + */ + /** + * Obtains the bundle name of the application to which this form belongs. + * + * @type { string } + * @syscap SystemCapability.Ability.Form + * @atomicservice + * @since 11 + */ + bundleName: string; + /** + * Obtains the name of the application module to which this form belongs. + * + * @type { string } + * @syscap SystemCapability.Ability.Form + * @since 9 + */ + /** + * Obtains the name of the application module to which this form belongs. + * + * @type { string } + * @syscap SystemCapability.Ability.Form + * @atomicservice + * @since 11 + */ + moduleName: string; + /** + * Obtains the class name of the ability to which this form belongs. + * + * @type { string } + * @syscap SystemCapability.Ability.Form + * @since 9 + */ + /** + * Obtains the class name of the ability to which this form belongs. + * + * @type { string } + * @syscap SystemCapability.Ability.Form + * @atomicservice + * @since 11 + */ + abilityName: string; + /** + * Obtains the name of this form. + * + * @type { string } + * @syscap SystemCapability.Ability.Form + * @since 9 + */ + /** + * Obtains the name of this form. + * + * @type { string } + * @syscap SystemCapability.Ability.Form + * @atomicservice + * @since 11 + */ + name: string; + /** + * Obtains the display name of this form. + * + * @type { string } + * @syscap SystemCapability.Ability.Form + * @atomicservice + * @since 11 + */ + displayName: string; + /** + * Obtains the displayName resource id of this form. + * + * @type { number } + * @syscap SystemCapability.Ability.Form + * @atomicservice + * @since 11 + */ + displayNameId: number; + /** + * Obtains the description of this form. + * + * @type { string } + * @syscap SystemCapability.Ability.Form + * @since 9 + */ + /** + * Obtains the description of this form. + * + * @type { string } + * @syscap SystemCapability.Ability.Form + * @atomicservice + * @since 11 + */ + description: string; + /** + * Obtains the description id of this form. + * + * @type { number } + * @syscap SystemCapability.Ability.Form + * @since 10 + */ + /** + * Obtains the description id of this form. + * + * @type { number } + * @syscap SystemCapability.Ability.Form + * @atomicservice + * @since 11 + */ + descriptionId: number; + /** + * Obtains the type of this form. Currently, JS forms are supported. + * + * @type { FormType } + * @syscap SystemCapability.Ability.Form + * @since 9 + */ + /** + * Obtains the type of this form. Currently, JS forms are supported. + * + * @type { FormType } + * @syscap SystemCapability.Ability.Form + * @atomicservice + * @since 11 + */ + type: FormType; + /** + * Obtains the JS component name of this JS form. + * + * @type { string } + * @syscap SystemCapability.Ability.Form + * @since 9 + */ + /** + * Obtains the JS component name of this JS form. + * + * @type { string } + * @syscap SystemCapability.Ability.Form + * @atomicservice + * @since 11 + */ + jsComponentName: string; + /** + * Obtains the color mode of this form. + * + * @type { ColorMode } + * @syscap SystemCapability.Ability.Form + * @since 9 + */ + /** + * Obtains the color mode of this form. + * + * @type { ColorMode } + * @syscap SystemCapability.Ability.Form + * @atomicservice + * @since 11 + */ + colorMode: ColorMode; + /** + * Checks whether this form is a default form. + * + * @type { boolean } + * @syscap SystemCapability.Ability.Form + * @since 9 + */ + /** + * Checks whether this form is a default form. + * + * @type { boolean } + * @syscap SystemCapability.Ability.Form + * @atomicservice + * @since 11 + */ + isDefault: boolean; + /** + * Obtains the updateEnabled. + * + * @type { boolean } + * @syscap SystemCapability.Ability.Form + * @since 9 + */ + /** + * Obtains the updateEnabled. + * + * @type { boolean } + * @syscap SystemCapability.Ability.Form + * @atomicservice + * @since 11 + */ + updateEnabled: boolean; + /** + * Obtains whether notify visible of this form. + * + * @type { boolean } + * @syscap SystemCapability.Ability.Form + * @since 9 + */ + /** + * Obtains whether notify visible of this form. + * + * @type { boolean } + * @syscap SystemCapability.Ability.Form + * @atomicservice + * @since 11 + */ + formVisibleNotify: boolean; + /** + * Obtains the scheduledUpdateTime. + * + * @type { string } + * @syscap SystemCapability.Ability.Form + * @since 9 + */ + /** + * Obtains the scheduledUpdateTime. + * + * @type { string } + * @syscap SystemCapability.Ability.Form + * @atomicservice + * @since 11 + */ + scheduledUpdateTime: string; + /** + * Obtains the form config ability about this form. + * + * @type { string } + * @syscap SystemCapability.Ability.Form + * @since 9 + */ + /** + * Obtains the form config ability about this form. + * + * @type { string } + * @syscap SystemCapability.Ability.Form + * @atomicservice + * @since 11 + */ + formConfigAbility: string; + /** + * Obtains the updateDuration. + * + * @type { number } + * @syscap SystemCapability.Ability.Form + * @since 9 + */ + /** + * Obtains the updateDuration. + * + * @type { number } + * @syscap SystemCapability.Ability.Form + * @atomicservice + * @since 11 + */ + updateDuration: number; + /** + * Obtains the default grid style of this form. + * + * @type { number } + * @syscap SystemCapability.Ability.Form + * @since 9 + */ + /** + * Obtains the default grid style of this form. + * + * @type { number } + * @syscap SystemCapability.Ability.Form + * @atomicservice + * @since 11 + */ + defaultDimension: number; + /** + * Obtains the grid styles supported by this form. + * + * @type { Array } + * @syscap SystemCapability.Ability.Form + * @since 9 + */ + /** + * Obtains the grid styles supported by this form. + * + * @type { Array } + * @syscap SystemCapability.Ability.Form + * @atomicservice + * @since 11 + */ + supportDimensions: Array; + /** + * Obtains the custom data defined in this form. + * + * @type { object } + * @syscap SystemCapability.Ability.Form + * @since 9 + */ + /** + * Obtains the custom data defined in this form. + * + * @type { Record } + * @syscap SystemCapability.Ability.Form + * @atomicservice + * @since 11 + */ + customizeData: Record; + /** + * Obtains whether this form is a dynamic form. + * + * @type { boolean } + * @syscap SystemCapability.Ability.Form + * @since 10 + */ + /** + * Obtains whether this form is a dynamic form. + * + * @type { boolean } + * @syscap SystemCapability.Ability.Form + * @atomicservice + * @since 11 + */ + isDynamic: boolean; + /** + * Indicates whether the form can be set as a transparent background + * + * @type { boolean } + * @default false + * @syscap SystemCapability.Ability.Form + * @atomicservice + * @since 11 + */ + transparencyEnabled: boolean; + } + /** + * Type of form. + * + * @enum { number } + * @syscap SystemCapability.Ability.Form + * @since 9 + */ + /** + * Type of form. + * + * @enum { number } + * @syscap SystemCapability.Ability.Form + * @atomicservice + * @since 11 + */ + enum FormType { + /** + * JS form. + * + * @syscap SystemCapability.Ability.Form + * @since 9 + */ + /** + * JS form. + * + * @syscap SystemCapability.Ability.Form + * @atomicservice + * @since 11 + */ + JS = 1, + /** + * eTS form. + * + * @syscap SystemCapability.Ability.Form + * @since 9 + */ + /** + * eTS form. + * + * @syscap SystemCapability.Ability.Form + * @atomicservice + * @since 11 + */ + eTS = 2 + } + /** + * Color mode. + * + * @enum { number } + * @syscap SystemCapability.Ability.Form + * @since 9 + */ + /** + * Color mode. + * + * @enum { number } + * @syscap SystemCapability.Ability.Form + * @atomicservice + * @since 11 + */ + enum ColorMode { + /** + * Automatic mode. + * + * @syscap SystemCapability.Ability.Form + * @since 9 + */ + /** + * Automatic mode. + * + * @syscap SystemCapability.Ability.Form + * @atomicservice + * @since 11 + */ + MODE_AUTO = -1, + /** + * Dark mode. + * + * @syscap SystemCapability.Ability.Form + * @since 9 + */ + /** + * Dark mode. + * + * @syscap SystemCapability.Ability.Form + * @atomicservice + * @since 11 + */ + MODE_DARK = 0, + /** + * Light mode. + * + * @syscap SystemCapability.Ability.Form + * @since 9 + */ + /** + * Light mode. + * + * @syscap SystemCapability.Ability.Form + * @atomicservice + * @since 11 + */ + MODE_LIGHT = 1 + } + /** + * Provides state information about a form. + * + * @typedef FormStateInfo + * @syscap SystemCapability.Ability.Form + * @since 9 + */ + /** + * Provides state information about a form. + * + * @typedef FormStateInfo + * @syscap SystemCapability.Ability.Form + * @atomicservice + * @since 11 + */ + interface FormStateInfo { + /** + * Obtains the form state. + * + * @type { FormState } + * @syscap SystemCapability.Ability.Form + * @since 9 + */ + /** + * Obtains the form state. + * + * @type { FormState } + * @syscap SystemCapability.Ability.Form + * @atomicservice + * @since 11 + */ + formState: FormState; + /** + * Obtains the want form . + * + * @type { Want } + * @syscap SystemCapability.Ability.Form + * @since 9 + */ + /** + * Obtains the want form . + * + * @type { Want } + * @syscap SystemCapability.Ability.Form + * @atomicservice + * @since 11 + */ + want: Want; + } + /** + * Provides state about a form. + * + * @enum { number } + * @syscap SystemCapability.Ability.Form + * @since 9 + */ + /** + * Provides state about a form. + * + * @enum { number } + * @syscap SystemCapability.Ability.Form + * @atomicservice + * @since 11 + */ + enum FormState { + /** + * Indicates that the form status is unknown due to an internal error. + * + * @syscap SystemCapability.Ability.Form + * @since 9 + */ + /** + * Indicates that the form status is unknown due to an internal error. + * + * @syscap SystemCapability.Ability.Form + * @atomicservice + * @since 11 + */ + UNKNOWN = -1, + /** + * Indicates that the form is in the default state. + * + * @syscap SystemCapability.Ability.Form + * @since 9 + */ + /** + * Indicates that the form is in the default state. + * + * @syscap SystemCapability.Ability.Form + * @atomicservice + * @since 11 + */ + DEFAULT = 0, + /** + * Indicates that the form is ready. + * + * @syscap SystemCapability.Ability.Form + * @since 9 + */ + /** + * Indicates that the form is ready. + * + * @syscap SystemCapability.Ability.Form + * @atomicservice + * @since 11 + */ + READY = 1 + } + /** + * Parameter of form. + * + * @enum { string } + * @syscap SystemCapability.Ability.Form + * @since 9 + */ + /** + * Parameter of form. + * + * @enum { string } + * @syscap SystemCapability.Ability.Form + * @atomicservice + * @since 11 + */ + enum FormParam { + /** + * Indicates the key specifying the ID of the form to be obtained, which is represented as + * want: { + * "parameters": { + * IDENTITY_KEY: "119476135" + * } + * }. + * + * @syscap SystemCapability.Ability.Form + * @since 9 + */ + /** + * Indicates the key specifying the ID of the form to be obtained, which is represented as + * want: { + * "parameters": { + * IDENTITY_KEY: "119476135" + * } + * }. + * + * @syscap SystemCapability.Ability.Form + * @atomicservice + * @since 11 + */ + IDENTITY_KEY = 'ohos.extra.param.key.form_identity', + /** + * Indicates the key specifying the grid style of the form to be obtained, which is represented as + * want: { + * "parameters": { + * DIMENSION_KEY: FormDimension.Dimension_1_2 + * } + * }. + * + * @syscap SystemCapability.Ability.Form + * @since 9 + */ + /** + * Indicates the key specifying the grid style of the form to be obtained, which is represented as + * want: { + * "parameters": { + * DIMENSION_KEY: FormDimension.Dimension_1_2 + * } + * }. + * + * @syscap SystemCapability.Ability.Form + * @atomicservice + * @since 11 + */ + DIMENSION_KEY = 'ohos.extra.param.key.form_dimension', + /** + * Indicates the key specifying the name of the form to be obtained, which is represented as + * want: { + * "parameters": { + * NAME_KEY: "formName" + * } + * }. + * + * @syscap SystemCapability.Ability.Form + * @since 9 + */ + /** + * Indicates the key specifying the name of the form to be obtained, which is represented as + * want: { + * "parameters": { + * NAME_KEY: "formName" + * } + * }. + * + * @syscap SystemCapability.Ability.Form + * @atomicservice + * @since 11 + */ + NAME_KEY = 'ohos.extra.param.key.form_name', + /** + * Indicates the key specifying the name of the module to which the form to be obtained belongs, which is + * represented as + * want: { + * "parameters": { + * MODULE_NAME_KEY: "formEntry" + * } + * } + * This constant is mandatory. + * + * @syscap SystemCapability.Ability.Form + * @since 9 + */ + /** + * Indicates the key specifying the name of the module to which the form to be obtained belongs, which is + * represented as + * want: { + * "parameters": { + * MODULE_NAME_KEY: "formEntry" + * } + * } + * This constant is mandatory. + * + * @syscap SystemCapability.Ability.Form + * @atomicservice + * @since 11 + */ + MODULE_NAME_KEY = 'ohos.extra.param.key.module_name', + /** + * Indicates the key specifying the width of the form to be obtained, which is represented as + * want: { + * "parameters": { + * WIDTH_KEY: 800 + * } + * } + * + * @syscap SystemCapability.Ability.Form + * @since 9 + */ + /** + * Indicates the key specifying the width of the form to be obtained, which is represented as + * want: { + * "parameters": { + * WIDTH_KEY: 800 + * } + * } + * + * @syscap SystemCapability.Ability.Form + * @atomicservice + * @since 11 + */ + WIDTH_KEY = 'ohos.extra.param.key.form_width', + /** + * Indicates the key specifying the height of the form to be obtained, which is represented as + * want: { + * "parameters": { + * HEIGHT_KEY: 400 + * } + * } + * + * @syscap SystemCapability.Ability.Form + * @since 9 + */ + /** + * Indicates the key specifying the height of the form to be obtained, which is represented as + * want: { + * "parameters": { + * HEIGHT_KEY: 400 + * } + * } + * + * @syscap SystemCapability.Ability.Form + * @atomicservice + * @since 11 + */ + HEIGHT_KEY = 'ohos.extra.param.key.form_height', + /** + * Indicates the key specifying whether a form is temporary, which is represented as + * want: { + * "parameters": { + * TEMPORARY_KEY: true + * } + * } + * + * @syscap SystemCapability.Ability.Form + * @since 9 + */ + /** + * Indicates the key specifying whether a form is temporary, which is represented as + * want: { + * "parameters": { + * TEMPORARY_KEY: true + * } + * } + * + * @syscap SystemCapability.Ability.Form + * @atomicservice + * @since 11 + */ + TEMPORARY_KEY = 'ohos.extra.param.key.form_temporary', + /** + * Indicates the key specifying the name of the bundle to be obtained, which is represented as + * want: { + * "parameters": { + * BUNDLE_NAME_KEY: "bundleName" + * } + * } + * + * @syscap SystemCapability.Ability.Form + * @since 9 + */ + /** + * Indicates the key specifying the name of the bundle to be obtained, which is represented as + * want: { + * "parameters": { + * BUNDLE_NAME_KEY: "bundleName" + * } + * } + * + * @syscap SystemCapability.Ability.Form + * @atomicservice + * @since 11 + */ + BUNDLE_NAME_KEY = 'ohos.extra.param.key.bundle_name', + /** + * Indicates the key specifying the name of the ability to be obtained, which is represented as + * want: { + * "parameters": { + * ABILITY_NAME_KEY: "abilityName" + * } + * } + * + * @syscap SystemCapability.Ability.Form + * @since 9 + */ + /** + * Indicates the key specifying the name of the ability to be obtained, which is represented as + * want: { + * "parameters": { + * ABILITY_NAME_KEY: "abilityName" + * } + * } + * + * @syscap SystemCapability.Ability.Form + * @atomicservice + * @since 11 + */ + ABILITY_NAME_KEY = 'ohos.extra.param.key.ability_name', + /** + * Indicates the key specifying the launch reason of the form to be obtained, which is represented as + * want: { + * "parameters": { + * LAUNCH_REASON_KEY: LaunchReason.FORM_DEFAULT + * } + * } + * + * @syscap SystemCapability.Ability.Form + * @since 10 + */ + /** + * Indicates the key specifying the launch reason of the form to be obtained, which is represented as + * want: { + * "parameters": { + * LAUNCH_REASON_KEY: LaunchReason.FORM_DEFAULT + * } + * } + * + * @syscap SystemCapability.Ability.Form + * @atomicservice + * @since 11 + */ + LAUNCH_REASON_KEY = 'ohos.extra.param.key.form_launch_reason', + /** + * Indicates the key specifying the custom data of the form to be obtained, which is represented as + * want: { + * "parameters": { + * PARAM_FORM_CUSTOMIZE_KEY: { + * "key": "userData" + * } + * } + * } + * + * @syscap SystemCapability.Ability.Form + * @since 10 + */ + /** + * Indicates the key specifying the custom data of the form to be obtained, which is represented as + * want: { + * "parameters": { + * PARAM_FORM_CUSTOMIZE_KEY: { + * "key": "userData" + * } + * } + * } + * + * @syscap SystemCapability.Ability.Form + * @atomicservice + * @since 11 + */ + PARAM_FORM_CUSTOMIZE_KEY = 'ohos.extra.param.key.form_customize', + /** + * Indicates the key specifying the form location, which is represented as + * want: { + * "parameters": { + * FORM_LOCATION_KEY: FormLocation.DESKTOP + * } + * }. + * + * @syscap SystemCapability.Ability.Form + * @since 12 + */ + FORM_LOCATION_KEY = 'ohos.extra.param.key.form_location', + /** + * Indicates the key specifying the form rendering mode, which is represented as + * want: { + * "parameters": { + * FORM_RENDERING_MODE_KEY: FormRenderingMode.SINGLE_COLOR + * } + * }. + * + * @syscap SystemCapability.Ability.Form + * @since 11 + */ + /** + * Indicates the key specifying the form rendering mode, which is represented as + * want: { + * "parameters": { + * FORM_RENDERING_MODE_KEY: FormRenderingMode.SINGLE_COLOR + * } + * }. + * + * @syscap SystemCapability.Ability.Form + * @atomicservice + * @since 12 + */ + FORM_RENDERING_MODE_KEY = 'ohos.extra.param.key.form_rendering_mode', + /** + * Indicates the key specifying the inverse of the host background color, which is represented as + * want: { + * "parameters": { + * HOST_BG_INVERSE_COLOR_KEY: "#FF000000" + * } + * }. + * + * @syscap SystemCapability.Ability.Form + * @atomicservice + * @since 12 + */ + HOST_BG_INVERSE_COLOR_KEY = 'ohos.extra.param.key.host_bg_inverse_color', + /** + * Indicates the key specifying the user granted permission name, which is represented as + * want: { + * "parameters": { + * FORM_PERMISSION_NAME_KEY: "permissionName" + * } + * }. + * + * @syscap SystemCapability.Ability.Form + * @atomicservice + * @since 12 + */ + FORM_PERMISSION_NAME_KEY = 'ohos.extra.param.key.permission_name', + /** + * Indicates the key specifying whether the user granted, which is represented as + * want: { + * "parameters": { + * FORM_PERMISSION_GRANTED_KEY: true + * } + * }. + * + * @syscap SystemCapability.Ability.Form + * @atomicservice + * @since 12 + */ + FORM_PERMISSION_GRANTED_KEY = 'ohos.extra.param.key.permission_granted' + } + /** + * The optional options used as filters to ask + * getFormsInfo to return formInfos from only forms that match the options. + * + * @typedef FormInfoFilter + * @syscap SystemCapability.Ability.Form + * @since 9 + */ + /** + * The optional options used as filters to ask + * getFormsInfo to return formInfos from only forms that match the options. + * + * @typedef FormInfoFilter + * @syscap SystemCapability.Ability.Form + * @atomicservice + * @since 11 + */ + interface FormInfoFilter { + /** + * optional moduleName that used to ask getFormsInfo to return + * form infos with the same moduleName. + * + * @type { ?string } + * @syscap SystemCapability.Ability.Form + * @since 9 + */ + /** + * optional moduleName that used to ask getFormsInfo to return + * form infos with the same moduleName. + * + * @type { ?string } + * @syscap SystemCapability.Ability.Form + * @atomicservice + * @since 11 + */ + moduleName?: string; + } + /** + * Defines the FormDimension enum. + * + * @enum { number } + * @syscap SystemCapability.Ability.Form + * @since 9 + */ + /** + * Defines the FormDimension enum. + * + * @enum { number } + * @syscap SystemCapability.Ability.Form + * @atomicservice + * @since 11 + */ + enum FormDimension { + /** + * 1 x 2 form + * + * @syscap SystemCapability.Ability.Form + * @since 9 + */ + /** + * 1 x 2 form + * + * @syscap SystemCapability.Ability.Form + * @atomicservice + * @since 11 + */ + Dimension_1_2 = 1, + /** + * 2 x 2 form + * + * @syscap SystemCapability.Ability.Form + * @since 9 + */ + /** + * 2 x 2 form + * + * @syscap SystemCapability.Ability.Form + * @atomicservice + * @since 11 + */ + Dimension_2_2, + /** + * 2 x 4 form + * + * @syscap SystemCapability.Ability.Form + * @since 9 + */ + /** + * 2 x 4 form + * + * @syscap SystemCapability.Ability.Form + * @atomicservice + * @since 11 + */ + Dimension_2_4, + /** + * 4 x 4 form + * + * @syscap SystemCapability.Ability.Form + * @since 9 + */ + /** + * 4 x 4 form + * + * @syscap SystemCapability.Ability.Form + * @atomicservice + * @since 11 + */ + Dimension_4_4, + /** + * 2 x 1 form + * + * @syscap SystemCapability.Ability.Form + * @since 9 + */ + /** + * 2 x 1 form + * + * @syscap SystemCapability.Ability.Form + * @atomicservice + * @since 11 + */ + Dimension_2_1, + /** + * 1 x 1 form + * + * @syscap SystemCapability.Ability.Form + * @atomicservice + * @since 11 + */ + DIMENSION_1_1, + /** + * 6 x 4 form + * + * @syscap SystemCapability.Ability.Form + * @atomicservice + * @since 12 + */ + DIMENSION_6_4 + } + /** + * The visibility of a form. + * + * @enum { number } + * @syscap SystemCapability.Ability.Form + * @since 9 + */ + /** + * The visibility of a form. + * + * @enum { number } + * @syscap SystemCapability.Ability.Form + * @atomicservice + * @since 11 + */ + enum VisibilityType { + /** + * Indicates the type of the form type is unknown. + * Often used as a condition variable in function OnVisibilityChange to specify actions only on forms that are + * changing to unknown. + * + * @syscap SystemCapability.Ability.Form + * @since 10 + */ + /** + * Indicates the type of the form type is unknown. + * Often used as a condition variable in function OnVisibilityChange to specify actions only on forms that are + * changing to unknown. + * + * @syscap SystemCapability.Ability.Form + * @atomicservice + * @since 11 + */ + UNKNOWN = 0, + /** + * Indicates the type of the form is visible. + * Often used as a condition variable in function OnVisibilityChange to specify actions only on forms that are + * changing to visible. + * + * @syscap SystemCapability.Ability.Form + * @since 9 + */ + /** + * Indicates the type of the form is visible. + * Often used as a condition variable in function OnVisibilityChange to specify actions only on forms that are + * changing to visible. + * + * @syscap SystemCapability.Ability.Form + * @atomicservice + * @since 11 + */ + FORM_VISIBLE = 1, + /** + * Indicates the type of the form is invisible. + * Often used as a condition variable in function OnVisibilityChange to specify actions only on forms that are + * changing to invisible. + * + * @syscap SystemCapability.Ability.Form + * @since 9 + */ + /** + * Indicates the type of the form is invisible. + * Often used as a condition variable in function OnVisibilityChange to specify actions only on forms that are + * changing to invisible. + * + * @syscap SystemCapability.Ability.Form + * @atomicservice + * @since 11 + */ + FORM_INVISIBLE + } + /** + * Indicates the launch reason of a form. + * + * @enum { number } + * @syscap SystemCapability.Ability.Form + * @since 10 + */ + /** + * Indicates the launch reason of a form. + * + * @enum { number } + * @syscap SystemCapability.Ability.Form + * @atomicservice + * @since 11 + */ + enum LaunchReason { + /** + * Indicates the launch reason of a form is default. + * + * @syscap SystemCapability.Ability.Form + * @since 10 + */ + /** + * Indicates the launch reason of a form is default. + * + * @syscap SystemCapability.Ability.Form + * @atomicservice + * @since 11 + */ + FORM_DEFAULT = 1, + /** + * Indicates the launch reason of a form is share. + * + * @syscap SystemCapability.Ability.Form + * @since 10 + */ + /** + * Indicates the launch reason of a form is share. + * + * @syscap SystemCapability.Ability.Form + * @atomicservice + * @since 11 + */ + FORM_SHARE + } +} +export default formInfo; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.app.form.formProvider.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.app.form.formProvider.d.ts new file mode 100755 index 00000000..40e2fc3f --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.app.form.formProvider.d.ts @@ -0,0 +1,279 @@ +/* + * Copyright (c) 2022-2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit FormKit + */ +import { AsyncCallback } from './@ohos.base'; +import formBindingData from './@ohos.app.form.formBindingData'; +import formInfo from './@ohos.app.form.formInfo'; +/** + * Interface of formProvider. + * + * @namespace formProvider + * @syscap SystemCapability.Ability.Form + * @since 9 + */ +/** + * Interface of formProvider. + * + * @namespace formProvider + * @syscap SystemCapability.Ability.Form + * @atomicservice + * @since 11 + */ +declare namespace formProvider { + /** + * Set next update time for a specified form. + * + * @param { string } formId - Indicates the form ID. + * @param { number } minute - Indicates duration minute before next update. + * @param { AsyncCallback } callback - The callback of setFormNextRefreshTime. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. + * @throws { BusinessError } 16500050 - An IPC connection error happened. + * @throws { BusinessError } 16500060 - A service connection error happened, please try again later. + * @throws { BusinessError } 16500100 - Failed to obtain the configuration information. + * @throws { BusinessError } 16501000 - An internal functional error occurred. + * @throws { BusinessError } 16501001 - The ID of the form to be operated does not exist. + * @throws { BusinessError } 16501002 - The number of forms exceeds upper bound. + * @throws { BusinessError } 16501003 - The form can not be operated by the current application. + * @syscap SystemCapability.Ability.Form + * @since 9 + */ + /** + * Set next update time for a specified form. + * + * @param { string } formId - Indicates the form ID. + * @param { number } minute - Indicates duration minute before next update. + * @param { AsyncCallback } callback - The callback of setFormNextRefreshTime. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. + * @throws { BusinessError } 16500050 - IPC connection error. + * @throws { BusinessError } 16500060 - Service connection error. + * @throws { BusinessError } 16500100 - Failed to obtain the configuration information. + * @throws { BusinessError } 16501000 - An internal functional error occurred. + * @throws { BusinessError } 16501001 - The ID of the form to be operated does not exist. + * @throws { BusinessError } 16501002 - The number of forms exceeds the maximum allowed. + * @throws { BusinessError } 16501003 - The form cannot be operated by the current application. + * @syscap SystemCapability.Ability.Form + * @atomicservice + * @since 11 + */ + function setFormNextRefreshTime(formId: string, minute: number, callback: AsyncCallback): void; + /** + * Set next update time for a specified form. + * + * @param { string } formId - Indicates the form ID. + * @param { number } minute - Indicates duration minute before next update. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. + * @throws { BusinessError } 16500050 - An IPC connection error happened. + * @throws { BusinessError } 16500060 - A service connection error happened, please try again later. + * @throws { BusinessError } 16500100 - Failed to obtain the configuration information. + * @throws { BusinessError } 16501000 - An internal functional error occurred. + * @throws { BusinessError } 16501001 - The ID of the form to be operated does not exist. + * @throws { BusinessError } 16501002 - The number of forms exceeds upper bound. + * @throws { BusinessError } 16501003 - The form can not be operated by the current application. + * @syscap SystemCapability.Ability.Form + * @since 9 + */ + /** + * Set next update time for a specified form. + * + * @param { string } formId - Indicates the form ID. + * @param { number } minute - Indicates duration minute before next update. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. + * @throws { BusinessError } 16500050 - IPC connection error. + * @throws { BusinessError } 16500060 - Service connection error. + * @throws { BusinessError } 16500100 - Failed to obtain the configuration information. + * @throws { BusinessError } 16501000 - An internal functional error occurred. + * @throws { BusinessError } 16501001 - The ID of the form to be operated does not exist. + * @throws { BusinessError } 16501002 - The number of forms exceeds the maximum allowed. + * @throws { BusinessError } 16501003 - The form cannot be operated by the current application. + * @syscap SystemCapability.Ability.Form + * @atomicservice + * @since 11 + */ + function setFormNextRefreshTime(formId: string, minute: number): Promise; + /** + * Update a specified form. + * Client to communication with FormManagerService. + * + * @param { string } formId - Indicates the form ID. + * @param { formBindingData.FormBindingData } formBindingData - Indicates the form data. + * @param { AsyncCallback } callback - The callback of updateForm. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. + * @throws { BusinessError } 16500050 - An IPC connection error happened. + * @throws { BusinessError } 16500060 - A service connection error happened, please try again later. + * @throws { BusinessError } 16500100 - Failed to obtain the configuration information. + * @throws { BusinessError } 16501000 - An internal functional error occurred. + * @throws { BusinessError } 16501001 - The ID of the form to be operated does not exist. + * @throws { BusinessError } 16501003 - The form can not be operated by the current application. + * @syscap SystemCapability.Ability.Form + * @since 9 + */ + /** + * Update a specified form. + * Client to communication with FormManagerService. + * + * @param { string } formId - Indicates the form ID. + * @param { formBindingData.FormBindingData } formBindingData - Indicates the form data. + * @param { AsyncCallback } callback - The callback of updateForm. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. + * @throws { BusinessError } 16500050 - IPC connection error. + * @throws { BusinessError } 16500060 - Service connection error. + * @throws { BusinessError } 16500100 - Failed to obtain the configuration information. + * @throws { BusinessError } 16501000 - An internal functional error occurred. + * @throws { BusinessError } 16501001 - The ID of the form to be operated does not exist. + * @throws { BusinessError } 16501003 - The form cannot be operated by the current application. + * @syscap SystemCapability.Ability.Form + * @atomicservice + * @since 11 + */ + function updateForm(formId: string, formBindingData: formBindingData.FormBindingData, callback: AsyncCallback): void; + /** + * Update a specified form. + * Client to communication with FormManagerService. + * + * @param { string } formId - Indicates the form ID. + * @param { formBindingData.FormBindingData } formBindingData - Indicates the form data. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. + * @throws { BusinessError } 16500050 - An IPC connection error happened. + * @throws { BusinessError } 16500060 - A service connection error happened, please try again later. + * @throws { BusinessError } 16500100 - Failed to obtain the configuration information. + * @throws { BusinessError } 16501000 - An internal functional error occurred. + * @throws { BusinessError } 16501001 - The ID of the form to be operated does not exist. + * @throws { BusinessError } 16501003 - The form can not be operated by the current application. + * @syscap SystemCapability.Ability.Form + * @since 9 + */ + /** + * Update a specified form. + * Client to communication with FormManagerService. + * + * @param { string } formId - Indicates the form ID. + * @param { formBindingData.FormBindingData } formBindingData - Indicates the form data. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. + * @throws { BusinessError } 16500050 - IPC connection error. + * @throws { BusinessError } 16500060 - Service connection error. + * @throws { BusinessError } 16500100 - Failed to obtain the configuration information. + * @throws { BusinessError } 16501000 - An internal functional error occurred. + * @throws { BusinessError } 16501001 - The ID of the form to be operated does not exist. + * @throws { BusinessError } 16501003 - The form cannot be operated by the current application. + * @syscap SystemCapability.Ability.Form + * @atomicservice + * @since 11 + */ + function updateForm(formId: string, formBindingData: formBindingData.FormBindingData): Promise; + /** + * Get info of all forms belonging to current bundle. + * Client to communication with FormManagerService. + * + * @param { formInfo.FormInfoFilter } filter - Indicates the requirements the forms that the formInfos belong to have to meet. + * @param { AsyncCallback> } callback - The callback is used to return the formInfo. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. + * @throws { BusinessError } 16500050 - An IPC connection error happened. + * @throws { BusinessError } 16500100 - Failed to obtain the configuration information. + * @throws { BusinessError } 16501000 - An internal functional error occurred. + * @syscap SystemCapability.Ability.Form + * @since 9 + */ + /** + * Get info of all forms belonging to current bundle. + * Client to communication with FormManagerService. + * + * @param { formInfo.FormInfoFilter } filter - Indicates the requirements the forms that the formInfos belong to have to meet. + * @param { AsyncCallback> } callback - The callback is used to return the formInfo. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. + * @throws { BusinessError } 16500050 - IPC connection error. + * @throws { BusinessError } 16500100 - Failed to obtain the configuration information. + * @throws { BusinessError } 16501000 - An internal functional error occurred. + * @syscap SystemCapability.Ability.Form + * @atomicservice + * @since 11 + */ + function getFormsInfo(filter: formInfo.FormInfoFilter, callback: AsyncCallback>): void; + /** + * Get infos of all forms belonging to current bundle. + * Client to communication with FormManagerService. + * + * @param { AsyncCallback> } callback - The callback is used to return the formInfo. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. + * @throws { BusinessError } 16500050 - An IPC connection error happened. + * @throws { BusinessError } 16500100 - Failed to obtain the configuration information. + * @throws { BusinessError } 16501000 - An internal functional error occurred. + * @syscap SystemCapability.Ability.Form + * @since 9 + */ + /** + * Get infos of all forms belonging to current bundle. + * Client to communication with FormManagerService. + * + * @param { AsyncCallback> } callback - The callback is used to return the formInfo. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. + * @throws { BusinessError } 16500050 - IPC connection error. + * @throws { BusinessError } 16500100 - Failed to obtain the configuration information. + * @throws { BusinessError } 16501000 - An internal functional error occurred. + * @syscap SystemCapability.Ability.Form + * @atomicservice + * @since 11 + */ + function getFormsInfo(callback: AsyncCallback>): void; + /** + * Get infos of all forms belonging to current bundle. + * Client to communication with FormManagerService. + * + * @param { formInfo.FormInfoFilter } [filter] - Indicates the requirements the forms that the formInfos belong to have to meet. + * @returns { Promise> } Returns the formInfo. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. + * @throws { BusinessError } 16500050 - An IPC connection error happened. + * @throws { BusinessError } 16500100 - Failed to obtain the configuration information. + * @throws { BusinessError } 16501000 - An internal functional error occurred. + * @syscap SystemCapability.Ability.Form + * @since 9 + */ + /** + * Get infos of all forms belonging to current bundle. + * Client to communication with FormManagerService. + * + * @param { formInfo.FormInfoFilter } [filter] - Indicates the requirements the forms that the formInfos belong to have to meet. + * @returns { Promise> } Returns the formInfo. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. + * @throws { BusinessError } 16500050 - IPC connection error. + * @throws { BusinessError } 16500100 - Failed to obtain the configuration information. + * @throws { BusinessError } 16501000 - An internal functional error occurred. + * @syscap SystemCapability.Ability.Form + * @atomicservice + * @since 11 + */ + function getFormsInfo(filter?: formInfo.FormInfoFilter): Promise>; +} +export default formProvider; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.application.AccessibilityExtensionAbility.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.application.AccessibilityExtensionAbility.d.ts new file mode 100755 index 00000000..811bbb15 --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.application.AccessibilityExtensionAbility.d.ts @@ -0,0 +1,214 @@ +/* + * Copyright (c) 2022-2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"), + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit AccessibilityKit + */ +import type accessibility from './@ohos.accessibility'; +import type { KeyEvent } from './@ohos.multimodalInput.keyEvent'; +import type { AccessibilityElement as _AccessibilityElement, ElementAttributeValues as _ElementAttributeValues, FocusDirection as _FocusDirection, FocusType as _FocusType, WindowType as _WindowType, Rect as _Rect, } from './application/AccessibilityExtensionContext'; +import type * as _AccessibilityExtensionContext from './application/AccessibilityExtensionContext'; +/** + * Indicates an accessibility element. + * Supports querying element attributes, requesting execution actions, and finding child elements by condition. + * + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @since 10 + */ +export type AccessibilityElement = _AccessibilityElement; +/** + * Indicates the possible attributes of the element and the type of the attribute value. + * + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @since 10 + */ +export type ElementAttributeValues = _ElementAttributeValues; +/** + * Indicates the direction of the search focus. + * + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @since 10 + */ +export type FocusDirection = _FocusDirection; +/** + * Indicates the key of the attribute value. + * + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @since 10 + */ +export type ElementAttributeKeys = keyof ElementAttributeValues; +/** + * Indicates the type of the focus. + * + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @since 10 + */ +export type FocusType = _FocusType; +/** + * Indicates the type of the window. + * + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @since 10 + */ +export type WindowType = _WindowType; +/** + * Indicates rectangle. + * + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @since 10 + */ +export type Rect = _Rect; +/** + * The accessibility extension context. Used to configure, query information, and inject gestures. + * + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @since 10 + */ +export type AccessibilityExtensionContext = _AccessibilityExtensionContext.default; +/** + * class of accessibility extension ability. + * + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @since 9 + */ +export default class AccessibilityExtensionAbility { + /** + * Indicates accessibility extension ability context. + * + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @since 9 + */ + context: AccessibilityExtensionContext; + /** + * Called when extension ability is connected. + * + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @since 9 + */ + onConnect(): void; + /** + * Called when extension ability is disconnected. + * + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @since 9 + */ + onDisconnect(): void; + /** + * Called when an accessibility event occurs, such as when the user touches the application interface. + * + * @param { AccessibilityEvent } event Indicates an accessibility event. + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @since 9 + */ + onAccessibilityEvent(event: AccessibilityEvent): void; + /** + * Called when a physical key is pressed, such as when the user presses the volume button . + * + * @param { KeyEvent } keyEvent Indicates the physical key event. + * @returns { boolean } + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @since 9 + */ + onKeyEvent(keyEvent: KeyEvent): boolean; +} +/** + * Indicates the accessibility event. + * It provides the event type and the target element of the event if any. + * + * @typedef AccessibilityEvent + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @since 9 + */ +declare interface AccessibilityEvent { + /** + * EventType + * + * @type { accessibility.EventType | accessibility.WindowUpdateType | TouchGuideType | GestureType | PageUpdateType } + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @since 9 + */ + eventType: accessibility.EventType | accessibility.WindowUpdateType | TouchGuideType | GestureType | PageUpdateType; + /** + * Target + * + * @type { ?AccessibilityElement } + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @since 9 + */ + target?: AccessibilityElement; + /** + * TimeStamp + * + * @type { ?number } + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @since 9 + */ + timeStamp?: number; + /** + * ElementId + * + * @type { ?number } + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @since 12 + */ + elementId?: number; + /** + * The content of announce accessibility text. + * + * @type { ?string } + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @since 12 + */ + textAnnouncedForAccessibility?: string; +} +/** + * Indicates the gesture type. + * value range: { 'left' | 'leftThenRight' | 'leftThenUp' | 'leftThenDown' | + * 'right' | 'rightThenLeft' | 'rightThenUp' | 'rightThenDown' | + * 'up' | 'upThenLeft' | 'upThenRight' | 'upThenDown' | + * 'down' | 'downThenLeft' | 'downThenRight' | 'downThenUp' } + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @since 9 + */ +/** + * Indicates the gesture type. + * value range: { 'left' | 'leftThenRight' | 'leftThenUp' | 'leftThenDown' | + * 'right' | 'rightThenLeft' | 'rightThenUp' | 'rightThenDown' | + * 'up' | 'upThenLeft' | 'upThenRight' | 'upThenDown' | + * 'down' | 'downThenLeft' | 'downThenRight' | 'downThenUp' | + * 'twoFingerSingleTap' | 'twoFingerDoubleTap' | 'twoFingerDoubleTapAndHold' | 'twoFingerTripleTap' | + * 'twoFingerTripleTapAndHold' | 'threeFingerSingleTap' | 'threeFingerDoubleTap' | 'threeFingerDoubleTapAndHold' | + * 'threeFingerTripleTap' | 'threeFingerTripleTapAndHold' | 'fourFingerSingleTap' | 'fourFingerDoubleTap' | + * 'fourFingerDoubleTapAndHold' | 'fourFingerTripleTap' | 'fourFingerTripleTapAndHold' | + * 'threeFingerSwipeUp' | 'threeFingerSwipeDown' | 'threeFingerSwipeLeft' | 'threeFingerSwipeRight' | + * 'fourFingerSwipeUp' | 'fourFingerSwipeDown' | 'fourFingerSwipeLeft' | 'fourFingerSwipeRight' } +* @syscap SystemCapability.BarrierFree.Accessibility.Core +* @since 11 +*/ +type GestureType = 'left' | 'leftThenRight' | 'leftThenUp' | 'leftThenDown' | 'right' | 'rightThenLeft' | 'rightThenUp' | 'rightThenDown' | 'up' | 'upThenLeft' | 'upThenRight' | 'upThenDown' | 'down' | 'downThenLeft' | 'downThenRight' | 'downThenUp' | 'twoFingerSingleTap' | 'twoFingerDoubleTap' | 'twoFingerDoubleTapAndHold' | 'twoFingerTripleTap' | 'twoFingerTripleTapAndHold' | 'threeFingerSingleTap' | 'threeFingerDoubleTap' | 'threeFingerDoubleTapAndHold' | 'threeFingerTripleTap' | 'threeFingerTripleTapAndHold' | 'fourFingerSingleTap' | 'fourFingerDoubleTap' | 'fourFingerDoubleTapAndHold' | 'fourFingerTripleTap' | 'fourFingerTripleTapAndHold' | 'threeFingerSwipeUp' | 'threeFingerSwipeDown' | 'threeFingerSwipeLeft' | 'threeFingerSwipeRight' | 'fourFingerSwipeUp' | 'fourFingerSwipeDown' | 'fourFingerSwipeLeft' | 'fourFingerSwipeRight'; +/** + * Indicates the page update type. + * + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @since 9 + */ +type PageUpdateType = 'pageContentUpdate' | 'pageStateUpdate'; +/** + * Indicates the type of touch event during touch browsing. + * + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @since 9 + */ +type TouchGuideType = 'touchBegin' | 'touchEnd'; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.application.BackupExtensionAbility.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.application.BackupExtensionAbility.d.ts new file mode 100755 index 00000000..ffc8191c --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.application.BackupExtensionAbility.d.ts @@ -0,0 +1,92 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit CoreFileKit + */ +import type BackupExtensionContext from './@ohos.file.BackupExtensionContext'; +/** + * Describe bundle version + * + * @interface BundleVersion + * @syscap SystemCapability.FileManagement.StorageService.Backup + * @StageModelOnly + * @since 10 + */ +export interface BundleVersion { + /** + * Indicates bundle's version code. + * + * @type { number } + * @syscap SystemCapability.FileManagement.StorageService.Backup + * @StageModelOnly + * @since 10 + */ + code: number; + /** + * Indicates bundle's version name. + * + * @type { string } + * @syscap SystemCapability.FileManagement.StorageService.Backup + * @StageModelOnly + * @since 10 + */ + name: string; +} +/** + * Class to be override for backup extension ability. + * + * @syscap SystemCapability.FileManagement.StorageService.Backup + * @StageModelOnly + * @since 10 + */ +export default class BackupExtensionAbility { + /** + * Indicates backup extension ability context. + * + * @type { ExtensionContext } + * @syscap SystemCapability.FileManagement.StorageService.Backup + * @StageModelOnly + * @since 11 + */ + /** + * Indicates backup extension ability context. + * + * @type { BackupExtensionContext } + * @syscap SystemCapability.FileManagement.StorageService.Backup + * @StageModelOnly + * @since 12 + */ + context: BackupExtensionContext; + /** + * Callback to be called when the backup procedure is started. + * Developer could override this method to build files to be backup. + * + * @syscap SystemCapability.FileManagement.StorageService.Backup + * @StageModelOnly + * @since 10 + */ + onBackup(): void; + /** + * Callback to be called when the restore procedure is started. + * Developer could override this method to restore from copies for various bundle versions. + * + * @param { BundleVersion } bundleVersion Bundle version to be restore. + * @syscap SystemCapability.FileManagement.StorageService.Backup + * @StageModelOnly + * @since 10 + */ + onRestore(bundleVersion: BundleVersion): void; +} diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.application.Configuration.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.application.Configuration.d.ts new file mode 100755 index 00000000..c3fc8060 --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.application.Configuration.d.ts @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2021-2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"), + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit AbilityKit + */ +import ConfigurationConstant from './@ohos.application.ConfigurationConstant'; +/** + * configuration item. + * + * @typedef Configuration + * @syscap SystemCapability.Ability.AbilityBase + * @since 8 + * @deprecated since 9 + * @useinstead ohos.app.ability.Configuration/Configuration + */ +export interface Configuration { + /** + * Indicates the current language of the application. + * + * @type { ?string } + * @syscap SystemCapability.Ability.AbilityBase + * @since 8 + * @deprecated since 9 + * @useinstead ohos.app.ability.Configuration/Configuration#language + */ + language?: string; + /** + * Indicates the current colorMode of the application. + * + * @type { ?ConfigurationConstant.ColorMode } + * @syscap SystemCapability.Ability.AbilityBase + * @since 8 + * @deprecated since 9 + * @useinstead ohos.app.ability.Configuration/Configuration#colorMode + */ + colorMode?: ConfigurationConstant.ColorMode; +} diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.application.ConfigurationConstant.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.application.ConfigurationConstant.d.ts new file mode 100755 index 00000000..9c9b0181 --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.application.ConfigurationConstant.d.ts @@ -0,0 +1,68 @@ +/* + * Copyright (c) 2022-2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"), + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit AbilityKit + */ +/** + * The definition of ConfigurationConstant. + * + * @namespace ConfigurationConstant + * @syscap SystemCapability.Ability.AbilityBase + * @since 8 + * @deprecated since 9 + * @useinstead ohos.app.ability.ConfigurationConstant/ConfigurationConstant + */ +declare namespace ConfigurationConstant { + /** + * Color mode. + * + * @enum { number } + * @syscap SystemCapability.Ability.AbilityBase + * @since 8 + * @deprecated since 9 + * @useinstead ohos.app.ability.ConfigurationConstant/ConfigurationConstant#ColorMode + */ + export enum ColorMode { + /** + * No color mode set. + * + * @syscap SystemCapability.Ability.AbilityBase + * @since 8 + * @deprecated since 9 + * @useinstead ohos.app.ability.ConfigurationConstant/ConfigurationConstant.ColorMode#COLOR_MODE_NOT_SET + */ + COLOR_MODE_NOT_SET = -1, + /** + * Dark mode. + * + * @syscap SystemCapability.Ability.AbilityBase + * @since 8 + * @deprecated since 9 + * @useinstead ohos.app.ability.ConfigurationConstant/ConfigurationConstant.ColorMode#COLOR_MODE_DARK + */ + COLOR_MODE_DARK = 0, + /** + * Light mode. + * + * @syscap SystemCapability.Ability.AbilityBase + * @since 8 + * @deprecated since 9 + * @useinstead ohos.app.ability.ConfigurationConstant/ConfigurationConstant.ColorMode#COLOR_MODE_LIGHT + */ + COLOR_MODE_LIGHT = 1 + } +} +export default ConfigurationConstant; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.application.Want.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.application.Want.d.ts new file mode 100755 index 00000000..77bb6270 --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.application.Want.d.ts @@ -0,0 +1,120 @@ +/* + * Copyright (c) 2021-2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit AbilityKit + */ +/** + * Want is the basic communication component of the system. + * + * @syscap SystemCapability.Ability.AbilityBase + * @since 8 + * @deprecated since 9 + * @useinstead ohos.app.ability.Want/Want + */ +export default class Want { + /** + * device id + * + * @type { ?string } + * @syscap SystemCapability.Ability.AbilityBase + * @since 8 + * @deprecated since 9 + * @useinstead ohos.app.ability.Want/Want#deviceId + */ + deviceId?: string; + /** + * bundle name + * + * @type { ?string } + * @syscap SystemCapability.Ability.AbilityBase + * @since 8 + * @deprecated since 9 + * @useinstead ohos.app.ability.Want/Want#bundleName + */ + bundleName?: string; + /** + * ability name + * + * @type { ?string } + * @syscap SystemCapability.Ability.AbilityBase + * @since 8 + * @deprecated since 9 + * @useinstead ohos.app.ability.Want/Want#abilityName + */ + abilityName?: string; + /** + * The description of a URI in a Want. + * + * @type { ?string } + * @syscap SystemCapability.Ability.AbilityBase + * @since 8 + * @deprecated since 9 + * @useinstead ohos.app.ability.Want/Want#uri + */ + uri?: string; + /** + * The description of the type in this Want. + * + * @type { ?string } + * @syscap SystemCapability.Ability.AbilityBase + * @since 8 + * @deprecated since 9 + * @useinstead ohos.app.ability.Want/Want#type + */ + type?: string; + /** + * The options of the flags in this Want. + * + * @type { ?number } + * @syscap SystemCapability.Ability.AbilityBase + * @since 8 + * @deprecated since 9 + * @useinstead ohos.app.ability.Want/Want#flags + */ + flags?: number; + /** + * The description of an action in an want. + * + * @type { ?string } + * @syscap SystemCapability.Ability.AbilityBase + * @since 8 + * @deprecated since 9 + * @useinstead ohos.app.ability.Want/Want#action + */ + action?: string; + /** + * The description of the WantParams object in an Want + * + * @type { ?object } + * @syscap SystemCapability.Ability.AbilityBase + * @since 8 + * @deprecated since 9 + * @useinstead ohos.app.ability.Want/Want#parameters + */ + parameters?: { + [key: string]: any; + }; + /** + * The description of a entities in a Want. + * + * @type { ?Array } + * @syscap SystemCapability.Ability.AbilityBase + * @since 8 + * @deprecated since 9 + * @useinstead ohos.app.ability.Want/Want#entities + */ + entities?: Array; +} diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.application.abilityDelegatorRegistry.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.application.abilityDelegatorRegistry.d.ts new file mode 100755 index 00000000..15c65e90 --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.application.abilityDelegatorRegistry.d.ts @@ -0,0 +1,110 @@ +/* + * Copyright (c) 2021-2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit TestKit + */ +import { AbilityDelegator } from './application/AbilityDelegator'; +import { AbilityDelegatorArgs } from './application/abilityDelegatorArgs'; +/** + * A global register used to store the AbilityDelegator and AbilityDelegatorArgs objects registered + * during application startup. + * + * @namespace abilityDelegatorRegistry + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.app.ability.abilityDelegatorRegistry/abilityDelegatorRegistry + */ +declare namespace abilityDelegatorRegistry { + /** + * Get the AbilityDelegator object of the application. + * + * @returns { AbilityDelegator } the AbilityDelegator object initialized when the application is started. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.app.ability.abilityDelegatorRegistry/abilityDelegatorRegistry#getAbilityDelegator + */ + function getAbilityDelegator(): AbilityDelegator; + /** + * Get unit test parameters stored in the AbilityDelegatorArgs object. + * + * @returns { AbilityDelegatorArgs } the previously registered AbilityDelegatorArgs object. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.app.ability.abilityDelegatorRegistry/abilityDelegatorRegistry#getArguments + */ + function getArguments(): AbilityDelegatorArgs; + /** + * Describes all lifecycle states of an ability. + * + * @enum { string } + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.app.ability.abilityDelegatorRegistry/abilityDelegatorRegistry#AbilityLifecycleState + */ + export enum AbilityLifecycleState { + /** + * Indicates an invalid state. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.app.ability.abilityDelegatorRegistry/abilityDelegatorRegistry.AbilityLifecycleState + * #UNINITIALIZED + */ + UNINITIALIZED, + /** + * Indicates that the Ability is in the created state. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.app.ability.abilityDelegatorRegistry/abilityDelegatorRegistry.AbilityLifecycleState#CREATE + */ + CREATE, + /** + * Indicates that Ability is in the foreground state. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.app.ability.abilityDelegatorRegistry/abilityDelegatorRegistry.AbilityLifecycleState#FOREGROUND + */ + FOREGROUND, + /** + * Indicates that the Ability is in the background state. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.app.ability.abilityDelegatorRegistry/abilityDelegatorRegistry.AbilityLifecycleState#BACKGROUND + */ + BACKGROUND, + /** + * Indicates that the Ability is in a destroyed state. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.app.ability.abilityDelegatorRegistry/abilityDelegatorRegistry.AbilityLifecycleState#DESTROY + */ + DESTROY + } +} +export default abilityDelegatorRegistry; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.application.appManager.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.application.appManager.d.ts new file mode 100755 index 00000000..d88e4ea1 --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.application.appManager.d.ts @@ -0,0 +1,114 @@ +/* + * Copyright (c) 2021-2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit AbilityKit + */ +import { AsyncCallback } from './@ohos.base'; +import { ProcessRunningInfo } from './application/ProcessRunningInfo'; +/** + * This module provides the function of app manager service. + * + * @namespace appManager + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.app.ability.appManager/appManager + */ +declare namespace appManager { + /** + * Is user running in stability test. + * + * @param { AsyncCallback } callback - Returns whether the current stability testing scenario is in progress. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.app.ability.appManager/appManager#isRunningInStabilityTest + */ + function isRunningInStabilityTest(callback: AsyncCallback): void; + /** + * Is user running in stability test. + * + * @returns { Promise } Returns true if user is running stability test. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.app.ability.appManager/appManager#isRunningInStabilityTest + */ + function isRunningInStabilityTest(): Promise; + /** + * Get information about running processes + * + * @permission ohos.permission.GET_RUNNING_INFO + * @returns { Promise> } Returns the array of {@link ProcessRunningInfo}. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.app.ability.appManager/appManager#getRunningProcessInformation + */ + function getProcessRunningInfos(): Promise>; + /** + * Get information about running processes + * + * @permission ohos.permission.GET_RUNNING_INFO + * @param { AsyncCallback> } callback - Obtain information about running processes. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.app.ability.appManager/appManager#getRunningProcessInformation + */ + function getProcessRunningInfos(callback: AsyncCallback>): void; + /** + * Is it a ram-constrained device + * + * @returns { Promise } whether a ram-constrained device. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.app.ability.appManager/appManager#isRamConstrainedDevice + */ + function isRamConstrainedDevice(): Promise; + /** + * Is it a ram-constrained device + * + * @param { AsyncCallback } callback - Returns whether the current device is a RAM restricted device. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.app.ability.appManager/appManager#isRamConstrainedDevice + */ + function isRamConstrainedDevice(callback: AsyncCallback): void; + /** + * Get the memory size of the application + * + * @returns { Promise } application memory size. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.app.ability.appManager/appManager#getAppMemorySize + */ + function getAppMemorySize(): Promise; + /** + * Get the memory size of the application + * + * @param { AsyncCallback } callback - application memory size in M. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.app.ability.appManager/appManager#getAppMemorySize + */ + function getAppMemorySize(callback: AsyncCallback): void; +} +export default appManager; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.application.formBindingData.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.application.formBindingData.d.ts new file mode 100755 index 00000000..fc5ab0a1 --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.application.formBindingData.d.ts @@ -0,0 +1,63 @@ +/* + * Copyright (c) 2021-2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit FormKit + */ +/** + * interface of formBindingData. + * + * @namespace formBindingData + * @syscap SystemCapability.Ability.Form + * @since 8 + * @deprecated since 9 + * @useinstead ohos.app.form.formBindingData/formBindingData + */ +declare namespace formBindingData { + /** + * Create an FormBindingData instance. + * + * @param { Object | string } [obj] - Indicates the FormBindingData instance data. + * @returns { FormBindingData } Returns the {@link FormBindingData} instance. + * @syscap SystemCapability.Ability.Form + * @since 8 + * @deprecated since 9 + * @useinstead ohos.app.form.formBindingData/formBindingData#createFormBindingData + */ + function createFormBindingData(obj?: Object | string): FormBindingData; + /** + * Defines the createFormBindingData result interface. + * + * @typedef FormBindingData + * @syscap SystemCapability.Ability.Form + * @since 8 + * @deprecated since 9 + * @useinstead ohos.app.form.formBindingData/formBindingData#FormBindingData + */ + interface FormBindingData { + /** + * The data to be displayed on the js card. Can be a string in Object or json format that + * contains several key-value pairs. + * + * @type { Object } + * @syscap SystemCapability.Ability.Form + * @since 8 + * @deprecated since 9 + * @useinstead ohos.app.form.formBindingData/formBindingData#FormBindingData + */ + data: Object; + } +} +export default formBindingData; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.application.formError.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.application.formError.d.ts new file mode 100755 index 00000000..e9ec7983 --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.application.formError.d.ts @@ -0,0 +1,207 @@ +/* + * Copyright (c) 2022-2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit FormKit + */ +/** + * interface of formError. + * + * @namespace formError + * @syscap SystemCapability.Ability.Form + * @since 8 + */ +declare namespace formError { + /** + * Error of form. + * + * @enum { number } + * @syscap SystemCapability.Ability.Form + * @since 8 + */ + enum FormError { + /** + * A common internal error occurs during form processing. + * + * @syscap SystemCapability.Ability.Form + * @since 8 + */ + ERR_COMMON = 1, + /** + * The application does not have permission to use forms. + * Ensure that the application is granted with the ohos.permission.REQUIRE_FORM + * and ohos.permission.GET_BUNDLE_INFO_PRIVILEGED permissions. + * + * @syscap SystemCapability.Ability.Form + * @since 8 + */ + ERR_PERMISSION_DENY = 2, + /** + * Failed to obtain the configuration information about the form specified by the + * request parameters. Ensure that the parameters of the form to be added are + * consistent with those provided by the form provider. + * + * @syscap SystemCapability.Ability.Form + * @since 8 + */ + ERR_GET_INFO_FAILED = 4, + /** + * Failed to obtain the bundle to which the form belongs based on the request parameters. + * Ensure that the bundle to which the form to be added belongs is available. + * + * @syscap SystemCapability.Ability.Form + * @since 8 + */ + ERR_GET_BUNDLE_FAILED = 5, + /** + * Failed to initialize the form layout based on the request parameters. + * Ensure that the grid style of the form is supported by the form provider. + * + * @syscap SystemCapability.Ability.Form + * @since 8 + */ + ERR_GET_LAYOUT_FAILED = 6, + /** + * Invalid input parameter during form operation. Ensure that all input + * parameters are valid. + * + * @syscap SystemCapability.Ability.Form + * @since 8 + */ + ERR_ADD_INVALID_PARAM = 7, + /** + * The form configuration to be obtained using an existing form ID is + * different from that obtained for the first time. + * + * @syscap SystemCapability.Ability.Form + * @since 8 + */ + ERR_CFG_NOT_MATCH_ID = 8, + /** + * The ID of the form to be operated does not exist in the Form Manager Service. + * + * @syscap SystemCapability.Ability.Form + * @since 8 + */ + ERR_NOT_EXIST_ID = 9, + /** + * Failed to bind the Form Manager Service to the provider service. + * + * @syscap SystemCapability.Ability.Form + * @since 8 + */ + ERR_BIND_PROVIDER_FAILED = 10, + /** + * The total number of added forms exceeds the maximum allowed by the system. + * + * @syscap SystemCapability.Ability.Form + * @since 8 + */ + ERR_MAX_SYSTEM_FORMS = 11, + /** + * The number of form instances generated using the same form configuration + * exceeds the maximum allowed by the system. + * + * @syscap SystemCapability.Ability.Form + * @since 8 + */ + ERR_MAX_INSTANCES_PER_FORM = 12, + /** + * The form being requested was added by other applications and cannot be + * operated by the current application. + * + * @syscap SystemCapability.Ability.Form + * @since 8 + */ + ERR_OPERATION_FORM_NOT_SELF = 13, + /** + * The Form Manager Service failed to instruct the form provider to delete the form. + * + * @syscap SystemCapability.Ability.Form + * @since 8 + */ + ERR_PROVIDER_DEL_FAIL = 14, + /** + * The total number of added forms exceeds the maximum per client. + * + * @syscap SystemCapability.Ability.Form + * @since 8 + */ + ERR_MAX_FORMS_PER_CLIENT = 15, + /** + * The total number of added temp forms exceeds the maximum in system. + * + * @syscap SystemCapability.Ability.Form + * @since 8 + */ + ERR_MAX_SYSTEM_TEMP_FORMS = 16, + /** + * The module can not be find in system. + * + * @syscap SystemCapability.Ability.Form + * @since 8 + */ + ERR_FORM_NO_SUCH_MODULE = 17, + /** + * The ability can not be find in system. + * + * @syscap SystemCapability.Ability.Form + * @since 8 + */ + ERR_FORM_NO_SUCH_ABILITY = 18, + /** + * The dimension is not exist in the form. + * + * @syscap SystemCapability.Ability.Form + * @since 8 + */ + ERR_FORM_NO_SUCH_DIMENSION = 19, + /** + * The ability is not installed. + * + * @syscap SystemCapability.Ability.Form + * @since 8 + */ + ERR_FORM_FA_NOT_INSTALLED = 20, + /** + * Failed to obtain the RPC object of the Form Manager Service because + * the service is not started.Please try again after the service is started. + * + * @syscap SystemCapability.Ability.Form + * @since 8 + */ + ERR_SYSTEM_RESPONSES_FAILED = 30, + /** + * Failed to obtain the form requested by the client because another form + * with the same form ID is in use. Forms in use cannot have the same ID. + * To obtain and display a form that has the same configuration as an in-use + * form in the same application, you are advised to set the form ID to 0 in + * the request parameters. + * + * @syscap SystemCapability.Ability.Form + * @since 8 + */ + ERR_FORM_DUPLICATE_ADDED = 31, + /** + * The form is being restored. Perform operations on the form only after + * the restoration is complete. + * + * @syscap SystemCapability.Ability.Form + * @since 8 + */ + ERR_IN_RECOVERY = 36 + } +} +export default formError; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.application.formInfo.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.application.formInfo.d.ts new file mode 100755 index 00000000..27ce872c --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.application.formInfo.d.ts @@ -0,0 +1,449 @@ +/* + * Copyright (c) 2022-2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit FormKit + */ +import Want from './@ohos.app.ability.Want'; +/** + * interface of formInfo. + * + * @namespace formInfo + * @syscap SystemCapability.Ability.Form + * @since 8 + * @deprecated since 9 + * @useinstead ohos.app.form.formInfo/formInfo + */ +declare namespace formInfo { + /** + * Provides information about a form. + * + * @typedef FormInfo + * @syscap SystemCapability.Ability.Form + * @since 8 + * @deprecated since 9 + * @useinstead ohos.app.form.formInfo/formInfo#FormInfo + */ + interface FormInfo { + /** + * Obtains the bundle name of the application to which this form belongs. + * + * @type { string } + * @syscap SystemCapability.Ability.Form + * @since 8 + * @deprecated since 9 + * @useinstead ohos.app.form.formInfo/formInfo.FormInfo#bundleName + */ + bundleName: string; + /** + * Obtains the name of the application module to which this form belongs. + * + * @type { string } + * @syscap SystemCapability.Ability.Form + * @since 8 + * @deprecated since 9 + * @useinstead ohos.app.form.formInfo/formInfo.FormInfo#moduleName + */ + moduleName: string; + /** + * Obtains the class name of the ability to which this form belongs. + * + * @type { string } + * @syscap SystemCapability.Ability.Form + * @since 8 + * @deprecated since 9 + * @useinstead ohos.app.form.formInfo/formInfo.FormInfo#abilityName + */ + abilityName: string; + /** + * Obtains the name of this form. + * + * @type { string } + * @syscap SystemCapability.Ability.Form + * @since 8 + * @deprecated since 9 + * @useinstead ohos.app.form.formInfo/formInfo.FormInfo#name + */ + name: string; + /** + * Obtains the name of this form. + * + * @type { string } + * @syscap SystemCapability.Ability.Form + * @since 8 + * @deprecated since 9 + * @useinstead ohos.app.form.formInfo/formInfo.FormInfo#description + */ + description: string; + /** + * Obtains the type of this form. Currently, JS forms are supported. + * + * @type { FormType } + * @syscap SystemCapability.Ability.Form + * @since 8 + * @deprecated since 9 + * @useinstead ohos.app.form.formInfo/formInfo.FormInfo#type + */ + type: FormType; + /** + * Obtains the JS component name of this JS form. + * + * @type { string } + * @syscap SystemCapability.Ability.Form + * @since 8 + * @deprecated since 9 + * @useinstead ohos.app.form.formInfo/formInfo.FormInfo#jsComponentName + */ + jsComponentName: string; + /** + * Obtains the color mode of this form. + * + * @type { ColorMode } + * @syscap SystemCapability.Ability.Form + * @since 8 + * @deprecated since 9 + * @useinstead ohos.app.form.formInfo/formInfo.FormInfo#colorMode + */ + colorMode: ColorMode; + /** + * Checks whether this form is a default form. + * + * @type { boolean } + * @syscap SystemCapability.Ability.Form + * @since 8 + * @deprecated since 9 + * @useinstead ohos.app.form.formInfo/formInfo.FormInfo#isDefault + */ + isDefault: boolean; + /** + * Obtains the updateEnabled. + * + * @type { boolean } + * @syscap SystemCapability.Ability.Form + * @since 8 + * @deprecated since 9 + * @useinstead ohos.app.form.formInfo/formInfo.FormInfo#updateEnabled + */ + updateEnabled: boolean; + /** + * Obtains whether notify visible of this form. + * + * @type { boolean } + * @syscap SystemCapability.Ability.Form + * @since 8 + * @deprecated since 9 + * @useinstead ohos.app.form.formInfo/formInfo.FormInfo#formVisibleNotify + */ + formVisibleNotify: boolean; + /** + * Obtains the bundle relatedBundleName of the application to which this form belongs. + * + * @type { string } + * @syscap SystemCapability.Ability.Form + * @since 8 + * @deprecated since 9 + */ + relatedBundleName: string; + /** + * Obtains the scheduledUpdateTime. + * + * @type { string } + * @syscap SystemCapability.Ability.Form + * @since 8 + * @deprecated since 9 + * @useinstead ohos.app.form.formInfo/formInfo.FormInfo#scheduledUpdateTime + */ + scheduledUpdateTime: string; + /** + * Obtains the form config ability about this form. + * + * @type { string } + * @syscap SystemCapability.Ability.Form + * @since 8 + * @deprecated since 9 + * @useinstead ohos.app.form.formInfo/formInfo.FormInfo#formConfigAbility + */ + formConfigAbility: string; + /** + * Obtains the updateDuration. + * + * @type { number } + * @syscap SystemCapability.Ability.Form + * @since 8 + * @deprecated since 9 + * @useinstead ohos.app.form.formInfo/formInfo.FormInfo#updateDuration + */ + updateDuration: number; + /** + * Obtains the default grid style of this form. + * + * @type { number } + * @syscap SystemCapability.Ability.Form + * @since 8 + * @deprecated since 9 + * @useinstead ohos.app.form.formInfo/formInfo.FormInfo#defaultDimension + */ + defaultDimension: number; + /** + * Obtains the grid styles supported by this form. + * + * @type { Array } + * @syscap SystemCapability.Ability.Form + * @since 8 + * @deprecated since 9 + * @useinstead ohos.app.form.formInfo/formInfo.FormInfo#supportDimensions + */ + supportDimensions: Array; + /** + * Obtains the custom data defined in this form. + * + * @type { object } + * @syscap SystemCapability.Ability.Form + * @since 8 + * @deprecated since 9 + * @useinstead ohos.app.form.formInfo/formInfo.FormInfo#customizeData + */ + customizeData: { + [key: string]: [ + value: string + ]; + }; + } + /** + * Type of form. + * + * @enum { number } + * @syscap SystemCapability.Ability.Form + * @since 8 + * @deprecated since 9 + * @useinstead ohos.app.form.formInfo/formInfo#FormType + */ + enum FormType { + /** + * JS form. + * + * @syscap SystemCapability.Ability.Form + * @since 8 + * @deprecated since 9 + * @useinstead ohos.app.form.formInfo/formInfo.FormType#JS + */ + JS = 1 + } + /** + * Color mode. + * + * @enum { number } + * @syscap SystemCapability.Ability.Form + * @since 8 + * @deprecated since 9 + * @useinstead ohos.app.form.formInfo/formInfo#ColorMode + */ + enum ColorMode { + /** + * Automatic mode. + * + * @syscap SystemCapability.Ability.Form + * @since 8 + * @deprecated since 9 + * @useinstead ohos.app.form.formInfo/formInfo.ColorMode#MODE_AUTO + */ + MODE_AUTO = -1, + /** + * Dark mode. + * + * @syscap SystemCapability.Ability.Form + * @since 8 + * @deprecated since 9 + * @useinstead ohos.app.form.formInfo/formInfo.ColorMode#MODE_DARK + */ + MODE_DARK = 0, + /** + * Light mode. + * + * @syscap SystemCapability.Ability.Form + * @since 8 + * @deprecated since 9 + * @useinstead ohos.app.form.formInfo/formInfo.ColorMode#MODE_LIGHT + */ + MODE_LIGHT = 1 + } + /** + * Provides state information about a form. + * + * @typedef FormStateInfo + * @syscap SystemCapability.Ability.Form + * @since 8 + * @deprecated since 9 + * @useinstead ohos.app.form.formInfo/formInfo#FormStateInfo + */ + interface FormStateInfo { + /** + * Obtains the form state. + * + * @type { FormState } + * @syscap SystemCapability.Ability.Form + * @since 8 + * @deprecated since 9 + * @useinstead ohos.app.form.formInfo/formInfo.FormStateInfo#formState + */ + formState: FormState; + /** + * Obtains the want form . + * + * @type { Want } + * @syscap SystemCapability.Ability.Form + * @since 8 + * @deprecated since 9 + * @useinstead ohos.app.form.formInfo/formInfo.FormStateInfo#want + */ + want: Want; + } + /** + * Provides state about a form. + * + * @enum { number } + * @syscap SystemCapability.Ability.Form + * @since 8 + * @deprecated since 9 + * @useinstead ohos.app.form.formInfo/formInfo#FormState + */ + enum FormState { + /** + * Indicates that the form status is unknown due to an internal error. + * + * @syscap SystemCapability.Ability.Form + * @since 8 + * @deprecated since 9 + * @useinstead ohos.app.form.formInfo/formInfo.FormState#UNKNOWN + */ + UNKNOWN = -1, + /** + * Indicates that the form is in the default state. + * + * @syscap SystemCapability.Ability.Form + * @since 8 + * @deprecated since 9 + * @useinstead ohos.app.form.formInfo/formInfo.FormState#DEFAULT + */ + DEFAULT = 0, + /** + * Indicates that the form is ready. + * + * @syscap SystemCapability.Ability.Form + * @since 8 + * @deprecated since 9 + * @useinstead ohos.app.form.formInfo/formInfo.FormState#READY + */ + READY = 1 + } + /** + * Parameter of form. + * + * @enum { string } + * @syscap SystemCapability.Ability.Form + * @since 8 + * @deprecated since 9 + * @useinstead ohos.app.form.formInfo/formInfo#FormParam + */ + enum FormParam { + /** + * Indicates the key specifying the grid style of the form to be obtained, which is represented as + * want: { + * "parameters": { + * DIMENSION_KEY: FormDimension.Dimension_1_2 + * } + * }. + * + * @syscap SystemCapability.Ability.Form + * @since 8 + * @deprecated since 9 + * @useinstead ohos.app.form.formInfo/formInfo.FormParam#DIMENSION_KEY + */ + DIMENSION_KEY = 'ohos.extra.param.key.form_dimension', + /** + * Indicates the key specifying the name of the form to be obtained, which is represented as + * want: { + * "parameters": { + * NAME_KEY: "formName" + * } + * }. + * + * @syscap SystemCapability.Ability.Form + * @since 8 + * @deprecated since 9 + * @useinstead ohos.app.form.formInfo/formInfo.FormParam#NAME_KEY + */ + NAME_KEY = 'ohos.extra.param.key.form_name', + /** + * Indicates the key specifying the name of the module to which the form to be obtained belongs, which is + * represented as + * want: { + * "parameters": { + * MODULE_NAME_KEY: "formEntry" + * } + * } + * This constant is mandatory. + * + * @syscap SystemCapability.Ability.Form + * @since 8 + * @deprecated since 9 + * @useinstead ohos.app.form.formInfo/formInfo.FormParam#MODULE_NAME_KEY + */ + MODULE_NAME_KEY = 'ohos.extra.param.key.module_name', + /** + * Indicates the key specifying the width of the form to be obtained, which is represented as + * want: { + * "parameters": { + * WIDTH_KEY: 800 + * } + * } + * + * @syscap SystemCapability.Ability.Form + * @since 8 + * @deprecated since 9 + * @useinstead ohos.app.form.formInfo/formInfo.FormParam#WIDTH_KEY + */ + WIDTH_KEY = 'ohos.extra.param.key.form_width', + /** + * Indicates the key specifying the height of the form to be obtained, which is represented as + * want: { + * "parameters": { + * HEIGHT_KEY: 400 + * } + * } + * + * @syscap SystemCapability.Ability.Form + * @since 8 + * @deprecated since 9 + * @useinstead ohos.app.form.formInfo/formInfo.FormParam#HEIGHT_KEY + */ + HEIGHT_KEY = 'ohos.extra.param.key.form_height', + /** + * Indicates the key specifying whether a form is temporary, which is represented as + * want: { + * "parameters": { + * TEMPORARY_KEY: true + * } + * } + * + * @syscap SystemCapability.Ability.Form + * @since 8 + * @deprecated since 9 + * @useinstead ohos.app.form.formInfo/formInfo.FormParam#TEMPORARY_KEY + */ + TEMPORARY_KEY = 'ohos.extra.param.key.form_temporary' + } +} +export default formInfo; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.application.formProvider.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.application.formProvider.d.ts new file mode 100755 index 00000000..9aec6ca4 --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.application.formProvider.d.ts @@ -0,0 +1,82 @@ +/* + * Copyright (c) 2022-2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit FormKit + */ +import { AsyncCallback } from './@ohos.base'; +import formBindingData from './@ohos.application.formBindingData'; +/** + * interface of formProvider. + * + * @namespace formProvider + * @syscap SystemCapability.Ability.Form + * @since 8 + * @deprecated since 9 + * @useinstead ohos.app.form.formProvider/formProvider + */ +declare namespace formProvider { + /** + * Set next update time for a specified form. + * + * @param { string } formId - Indicates the form ID. + * @param { number } minute - Indicates duration minute before next update. + * @param { AsyncCallback } callback - Callback function. + * @syscap SystemCapability.Ability.Form + * @since 8 + * @deprecated since 9 + * @useinstead ohos.app.form.formProvider/formProvider#setFormNextRefreshTime + */ + function setFormNextRefreshTime(formId: string, minute: number, callback: AsyncCallback): void; + /** + * Set next update time for a specified form. + * + * @param { string } formId - Indicates the form ID. + * @param { number } minute - Indicates duration minute before next update. + * @returns { Promise } The promise returned by the function. + * @syscap SystemCapability.Ability.Form + * @since 8 + * @deprecated since 9 + * @useinstead ohos.app.form.formProvider/formProvider#setFormNextRefreshTime + */ + function setFormNextRefreshTime(formId: string, minute: number): Promise; + /** + * Update a specified form. + * Client to communication with FormManagerService. + * + * @param { string } formId - Indicates the form ID + * @param { formBindingData.FormBindingData } formBindingData - Indicates the form data + * @param { AsyncCallback } callback - Callback function. + * @syscap SystemCapability.Ability.Form + * @since 8 + * @deprecated since 9 + * @useinstead ohos.app.form.formProvider/formProvider#updateForm + */ + function updateForm(formId: string, formBindingData: formBindingData.FormBindingData, callback: AsyncCallback): void; + /** + * Update a specified form. + * Client to communication with FormManagerService. + * + * @param { string } formId - Indicates the form ID + * @param { formBindingData.FormBindingData } formBindingData - Indicates the form data + * @returns { Promise } The promise returned by the function. + * @syscap SystemCapability.Ability.Form + * @since 8 + * @deprecated since 9 + * @useinstead ohos.app.form.formProvider/formProvider#updateForm + */ + function updateForm(formId: string, formBindingData: formBindingData.FormBindingData): Promise; +} +export default formProvider; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.application.testRunner.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.application.testRunner.d.ts new file mode 100755 index 00000000..2292918c --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.application.testRunner.d.ts @@ -0,0 +1,66 @@ +/* + * Copyright (c) 2021-2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit TestKit + */ +/** + * Base class for the test framework. + * If you want to implement your own unit test framework, you must inherit this class and overrides all its methods. + * + * @interface TestRunner + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 8 + */ +/** + * Base class for the test framework. + * If you want to implement your own unit test framework, you must inherit this class and overrides all its methods. + * + * @interface TestRunner + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @atomicservice + * @since 11 + */ +export interface TestRunner { + /** + * Prepare the unit testing environment for running test cases. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 8 + */ + /** + * Prepare the unit testing environment for running test cases. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @atomicservice + * @since 11 + */ + onPrepare(): void; + /** + * Run all test cases. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 8 + */ + /** + * Run all test cases. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @atomicservice + * @since 11 + */ + onRun(): void; +} +export default TestRunner; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.application.uriPermissionManager.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.application.uriPermissionManager.d.ts new file mode 100755 index 00000000..f224b191 --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.application.uriPermissionManager.d.ts @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"), + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit AbilityKit + */ + +/** + * This module provides the capability to authorize URI. + * + * @namespace uriPermissionManager + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 10 + */ +declare namespace uriPermissionManager { +} +export default uriPermissionManager; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.arkui.UIContext.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.arkui.UIContext.d.ts new file mode 100755 index 00000000..e8d8897d --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.arkui.UIContext.d.ts @@ -0,0 +1,2594 @@ +/* + * Copyright (c) 2023-2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit ArkUI + */ + +/// +/// +/// +/// +/// +/// +/// +import font from './@ohos.font'; +import mediaQuery from './@ohos.mediaquery'; +import type inspector from './@ohos.arkui.inspector'; +import type observer from './@ohos.arkui.observer'; +import promptAction from './@ohos.promptAction'; +import router from './@ohos.router'; +import type componentUtils from './@ohos.arkui.componentUtils'; +import { ComponentContent, FrameNode } from './@ohos.arkui.node'; +import type { AnimatorOptions, AnimatorResult } from './@ohos.animator'; +import type { Callback, AsyncCallback } from './@ohos.base'; +import type { Color, FontStyle, Nullable } from 'CommonEnums'; +import type { AnimateParam, KeyframeAnimateParam, KeyframeState } from 'AnimateToParam'; +import { ActionSheetOptions } from 'actionSheetParam'; +import { AlertDialogParamWithConfirm, AlertDialogParamWithButtons, AlertDialogParamWithOptions } from 'AlertDialogParam'; +import { DatePickerDialogOptions } from 'DatePickerDialogParam'; +import { TimePickerDialogOptions } from 'TimePickerDialogParam'; +import { TextPickerDialogOptions } from 'textPickerDialogParam'; +import type { CustomBuilder, DragItemInfo, DragEvent } from 'DragControllerParam'; +import { MeasureOptions } from './@ohos.measure'; +import type dragController from './@ohos.arkui.dragController'; +import image from './@ohos.multimedia.image'; +import { ClickEvent } from 'ClickEventModule'; +import type common from './@ohos.app.ability.common'; +import type pointer from './@ohos.multimodalInput.pointer'; +/** + * class Font + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 10 + */ +/** + * class Font + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 11 + */ +export class Font { + /** + * Register a customized font in the FontManager. + * + * @param { font.FontOptions } options - FontOptions + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 10 + */ + /** + * Register a customized font in the FontManager. + * + * @param { font.FontOptions } options - FontOptions + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 11 + */ + registerFont(options: font.FontOptions): void; + /** + * Gets a list of fonts supported by system. + * @returns { Array } A list of font names + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * Gets a list of fonts supported by system. + * @returns { Array } A list of font names + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + getSystemFontList(): Array; + /** + * Get font details according to the font name. + * @param { string } fontName - font name + * @returns { font.FontInfo } Returns the font info + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * Get font details according to the font name. + * @param { string } fontName - font name + * @returns { font.FontInfo } Returns the font info + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + getFontByName(fontName: string): font.FontInfo; +} +/** + * class MediaQuery + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 10 + */ +/** + * class MediaQuery + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 11 + */ +export class MediaQuery { + /** + * Sets the media query criteria and returns the corresponding listening handle + * + * @param { string } condition - media conditions + * @returns { mediaQuery.MediaQueryListener } the corresponding listening handle + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 10 + */ + /** + * Sets the media query criteria and returns the corresponding listening handle + * + * @param { string } condition - media conditions + * @returns { mediaQuery.MediaQueryListener } the corresponding listening handle + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 11 + */ + matchMediaSync(condition: string): mediaQuery.MediaQueryListener; +} +/** + * class UIInspector + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 10 + */ +/** + * class UIInspector + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 11 + */ +export class UIInspector { + /** + * Sets the component after layout or draw criteria and returns the corresponding listening handle + * @param { string } id - component id. + * @returns { inspector.ComponentObserver } create listener for observer component event. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 10 + */ + /** + * Sets the component after layout or draw criteria and returns the corresponding listening handle + * @param { string } id - component id. + * @returns { inspector.ComponentObserver } create listener for observer component event. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 11 + */ + createComponentObserver(id: string): inspector.ComponentObserver; +} +/** + * class Router + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 10 + */ +/** + * class Router + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 11 + */ +export class Router { + /** + * Navigates to a specified page in the application based on the page URL and parameters. + * + * @param { router.RouterOptions } options - Options. + * @param { AsyncCallback } callback - the callback of pushUrl. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + *
1. Mandatory parameters are left unspecified. + *
2. Incorrect parameters types. + *
3. Parameter verification failed. + * @throws { BusinessError } 100001 - Internal error. + * @throws { BusinessError } 100002 - Uri error. The URI of the page to redirect is incorrect or does not exist + * @throws { BusinessError } 100003 - Page stack error. Too many pages are pushed. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 10 + */ + /** + * Navigates to a specified page in the application based on the page URL and parameters. + * + * @param { router.RouterOptions } options - Options. + * @param { AsyncCallback } callback - the callback of pushUrl. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + *
1. Mandatory parameters are left unspecified. + *
2. Incorrect parameters types. + *
3. Parameter verification failed. + * @throws { BusinessError } 100001 - Internal error. + * @throws { BusinessError } 100002 - Uri error. The URI of the page to redirect is incorrect or does not exist + * @throws { BusinessError } 100003 - Page stack error. Too many pages are pushed. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 11 + */ + pushUrl(options: router.RouterOptions, callback: AsyncCallback): void; + /** + * Navigates to a specified page in the application based on the page URL and parameters. + * + * @param { router.RouterOptions } options - Options. + * @returns { Promise } the promise returned by the function. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + *
1. Mandatory parameters are left unspecified. + *
2. Incorrect parameters types. + *
3. Parameter verification failed. + * @throws { BusinessError } 100001 - Internal error. + * @throws { BusinessError } 100002 - Uri error. The URI of the page to redirect is incorrect or does not exist + * @throws { BusinessError } 100003 - Page stack error. Too many pages are pushed. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 10 + */ + /** + * Navigates to a specified page in the application based on the page URL and parameters. + * + * @param { router.RouterOptions } options - Options. + * @returns { Promise } the promise returned by the function. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + *
1. Mandatory parameters are left unspecified. + *
2. Incorrect parameters types. + *
3. Parameter verification failed. + * @throws { BusinessError } 100001 - Internal error. + * @throws { BusinessError } 100002 - Uri error. The URI of the page to redirect is incorrect or does not exist + * @throws { BusinessError } 100003 - Page stack error. Too many pages are pushed. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 11 + */ + pushUrl(options: router.RouterOptions): Promise; + /** + * Navigates to a specified page in the application based on the page URL and parameters. + * + * @param { router.RouterOptions } options - Options. + * @param { router.RouterMode } mode - RouterMode. + * @param { AsyncCallback } callback - the callback of pushUrl. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + *
1. Mandatory parameters are left unspecified. + *
2. Incorrect parameters types. + *
3. Parameter verification failed. + * @throws { BusinessError } 100001 - Internal error. + * @throws { BusinessError } 100002 - Uri error. The URI of the page to redirect is incorrect or does not exist + * @throws { BusinessError } 100003 - Page stack error. Too many pages are pushed. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 10 + */ + /** + * Navigates to a specified page in the application based on the page URL and parameters. + * + * @param { router.RouterOptions } options - Options. + * @param { router.RouterMode } mode - RouterMode. + * @param { AsyncCallback } callback - the callback of pushUrl. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + *
1. Mandatory parameters are left unspecified. + *
2. Incorrect parameters types. + *
3. Parameter verification failed. + * @throws { BusinessError } 100001 - Internal error. + * @throws { BusinessError } 100002 - Uri error. The URI of the page to redirect is incorrect or does not exist + * @throws { BusinessError } 100003 - Page stack error. Too many pages are pushed. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 11 + */ + pushUrl(options: router.RouterOptions, mode: router.RouterMode, callback: AsyncCallback): void; + /** + * Navigates to a specified page in the application based on the page URL and parameters. + * + * @param { router.RouterOptions } options - Options. + * @param { router.RouterMode } mode - RouterMode. + * @returns { Promise } the promise returned by the function. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + *
1. Mandatory parameters are left unspecified. + *
2. Incorrect parameters types. + *
3. Parameter verification failed. + * @throws { BusinessError } 100001 - Internal error. + * @throws { BusinessError } 100002 - Uri error. The URI of the page to redirect is incorrect or does not exist + * @throws { BusinessError } 100003 - Page stack error. Too many pages are pushed. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 10 + */ + /** + * Navigates to a specified page in the application based on the page URL and parameters. + * + * @param { router.RouterOptions } options - Options. + * @param { router.RouterMode } mode - RouterMode. + * @returns { Promise } the promise returned by the function. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + *
1. Mandatory parameters are left unspecified. + *
2. Incorrect parameters types. + *
3. Parameter verification failed. + * @throws { BusinessError } 100001 - Internal error. + * @throws { BusinessError } 100002 - Uri error. The URI of the page to redirect is incorrect or does not exist + * @throws { BusinessError } 100003 - Page stack error. Too many pages are pushed. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 11 + */ + pushUrl(options: router.RouterOptions, mode: router.RouterMode): Promise; + /** + * Replaces the current page with another one in the application. The current page is destroyed after replacement. + * + * @param { router.RouterOptions } options - Options. + * @param { AsyncCallback } callback - the callback of replaceUrl. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + *
1. Mandatory parameters are left unspecified. + *
2. Incorrect parameters types. + *
3. Parameter verification failed. + * @throws { BusinessError } 100001 - if UI execution context not found, only throw in standard system. + * @throws { BusinessError } 200002 - Uri error. The URI of the page to be used for replacement is incorrect or does not exist. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 10 + */ + /** + * Replaces the current page with another one in the application. The current page is destroyed after replacement. + * + * @param { router.RouterOptions } options - Options. + * @param { AsyncCallback } callback - the callback of replaceUrl. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + *
1. Mandatory parameters are left unspecified. + *
2. Incorrect parameters types. + *
3. Parameter verification failed. + * @throws { BusinessError } 100001 - if UI execution context not found, only throw in standard system. + * @throws { BusinessError } 200002 - Uri error. The URI of the page to be used for replacement is incorrect or does not exist. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 11 + */ + replaceUrl(options: router.RouterOptions, callback: AsyncCallback): void; + /** + * Replaces the current page with another one in the application. The current page is destroyed after replacement. + * + * @param { router.RouterOptions } options - Options. + * @returns { Promise } the promise returned by the function. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + *
1. Mandatory parameters are left unspecified. + *
2. Incorrect parameters types. + *
3. Parameter verification failed. + * @throws { BusinessError } 100001 - if UI execution context not found, only throw in standard system. + * @throws { BusinessError } 200002 - Uri error. The URI of the page to be used for replacement is incorrect or does not exist. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 10 + */ + /** + * Replaces the current page with another one in the application. The current page is destroyed after replacement. + * + * @param { router.RouterOptions } options - Options. + * @returns { Promise } the promise returned by the function. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + *
1. Mandatory parameters are left unspecified. + *
2. Incorrect parameters types. + *
3. Parameter verification failed. + * @throws { BusinessError } 100001 - if UI execution context not found, only throw in standard system. + * @throws { BusinessError } 200002 - Uri error. The URI of the page to be used for replacement is incorrect or does not exist. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 11 + */ + replaceUrl(options: router.RouterOptions): Promise; + /** + * Replaces the current page with another one in the application. The current page is destroyed after replacement. + * + * @param { router.RouterOptions } options - Options. + * @param { router.RouterMode } mode - RouterMode. + * @param { AsyncCallback } callback - the callback of replaceUrl. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + *
1. Mandatory parameters are left unspecified. + *
2. Incorrect parameters types. + *
3. Parameter verification failed. + * @throws { BusinessError } 100001 - if UI execution context not found, only throw in standard system. + * @throws { BusinessError } 200002 - Uri error. The URI of the page to be used for replacement is incorrect or does not exist. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 10 + */ + /** + * Replaces the current page with another one in the application. The current page is destroyed after replacement. + * + * @param { router.RouterOptions } options - Options. + * @param { router.RouterMode } mode - RouterMode. + * @param { AsyncCallback } callback - the callback of replaceUrl. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + *
1. Mandatory parameters are left unspecified. + *
2. Incorrect parameters types. + *
3. Parameter verification failed. + * @throws { BusinessError } 100001 - if UI execution context not found, only throw in standard system. + * @throws { BusinessError } 200002 - Uri error. The URI of the page to be used for replacement is incorrect or does not exist. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 11 + */ + replaceUrl(options: router.RouterOptions, mode: router.RouterMode, callback: AsyncCallback): void; + /** + * Replaces the current page with another one in the application. The current page is destroyed after replacement. + * + * @param { router.RouterOptions } options - Options. + * @param { router.RouterMode } mode - RouterMode. + * @returns { Promise } the promise returned by the function. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + *
1. Mandatory parameters are left unspecified. + *
2. Incorrect parameters types. + *
3. Parameter verification failed. + * @throws { BusinessError } 100001 - if can not get the delegate, only throw in standard system. + * @throws { BusinessError } 200002 - Uri error. The URI of the page to be used for replacement is incorrect or does not exist. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 10 + */ + /** + * Replaces the current page with another one in the application. The current page is destroyed after replacement. + * + * @param { router.RouterOptions } options - Options. + * @param { router.RouterMode } mode - RouterMode. + * @returns { Promise } the promise returned by the function. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + *
1. Mandatory parameters are left unspecified. + *
2. Incorrect parameters types. + *
3. Parameter verification failed. + * @throws { BusinessError } 100001 - if can not get the delegate, only throw in standard system. + * @throws { BusinessError } 200002 - Uri error. The URI of the page to be used for replacement is incorrect or does not exist. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 11 + */ + replaceUrl(options: router.RouterOptions, mode: router.RouterMode): Promise; + /** + * Returns to the previous page or a specified page. + * + * @param { router.RouterOptions } options - Options. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 10 + */ + /** + * Returns to the previous page or a specified page. + * + * @param { router.RouterOptions } options - Options. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 11 + */ + back(options?: router.RouterOptions): void; + /** + * Returns to the specified page. + * + * @param { number } index - index of page. + * @param { Object } [params] - params of page. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + */ + back(index: number, params?: Object): void; + /** + * Clears all historical pages and retains only the current page at the top of the stack. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 10 + */ + /** + * Clears all historical pages and retains only the current page at the top of the stack. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 11 + */ + clear(): void; + /** + * Obtains the number of pages in the current stack. + * + * @returns { string } Number of pages in the stack. The maximum value is 32. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 10 + */ + /** + * Obtains the number of pages in the current stack. + * + * @returns { string } Number of pages in the stack. The maximum value is 32. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 11 + */ + getLength(): string; + /** + * Obtains information about the current page state. + * + * @returns { router.RouterState } Page state. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 10 + */ + /** + * Obtains information about the current page state. + * + * @returns { router.RouterState } Page state. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 11 + */ + getState(): router.RouterState; + /** + * Obtains page information by index. + * + * @param { number } index - Index of page. + * @returns { router.RouterState | undefined } Page state. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + */ + getStateByIndex(index: number): router.RouterState | undefined; + /** + * Obtains page information by url. + * + * @param { string } url - URL of page. + * @returns { Array } Page state. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + */ + getStateByUrl(url: string): Array; + /** + * Pop up alert dialog to ask whether to back. + * + * @param { router.EnableAlertOptions } options - Options. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + *
1. Mandatory parameters are left unspecified. + *
2. Incorrect parameters types. + *
3. Parameter verification failed. + * @throws { BusinessError } 100001 - Internal error. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 10 + */ + /** + * Pop up alert dialog to ask whether to back. + * + * @param { router.EnableAlertOptions } options - Options. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + *
1. Mandatory parameters are left unspecified. + *
2. Incorrect parameters types. + *
3. Parameter verification failed. + * @throws { BusinessError } 100001 - Internal error. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 11 + */ + showAlertBeforeBackPage(options: router.EnableAlertOptions): void; + /** + * Hide alert before back page. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 10 + */ + /** + * Hide alert before back page. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 11 + */ + hideAlertBeforeBackPage(): void; + /** + * Obtains information about the current page params. + * + * @returns { Object } Page params. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 10 + */ + /** + * Obtains information about the current page params. + * + * @returns { Object } Page params. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 11 + */ + getParams(): Object; + /** + * Navigates to a specified page in the application based on the page URL and parameters. + * @param { router.NamedRouterOptions } options - Options. + * @param { AsyncCallback } callback - the callback of pushNamedRoute. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + *
1. Mandatory parameters are left unspecified. + *
2. Incorrect parameters types. + *
3. Parameter verification failed. + * @throws { BusinessError } 100001 - Internal error. + * @throws { BusinessError } 100003 - Page stack error. Too many pages are pushed. + * @throws { BusinessError } 100004 - Named route error. The named route does not exist. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 10 + */ + /** + * Navigates to a specified page in the application based on the page URL and parameters. + * @param { router.NamedRouterOptions } options - Options. + * @param { AsyncCallback } callback - the callback of pushNamedRoute. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + *
1. Mandatory parameters are left unspecified. + *
2. Incorrect parameters types. + *
3. Parameter verification failed. + * @throws { BusinessError } 100001 - Internal error. + * @throws { BusinessError } 100003 - Page stack error. Too many pages are pushed. + * @throws { BusinessError } 100004 - Named route error. The named route does not exist. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 11 + */ + pushNamedRoute(options: router.NamedRouterOptions, callback: AsyncCallback): void; + /** + * Navigates to a specified page in the application based on the page URL and parameters. + * @param { router.NamedRouterOptions } options - Options. + * @returns { Promise } the promise returned by the function. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + *
1. Mandatory parameters are left unspecified. + *
2. Incorrect parameters types. + *
3. Parameter verification failed. + * @throws { BusinessError } 100001 - Internal error. + * @throws { BusinessError } 100003 - Page stack error. Too many pages are pushed. + * @throws { BusinessError } 100004 - Named route error. The named route does not exist. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 10 + */ + /** + * Navigates to a specified page in the application based on the page URL and parameters. + * @param { router.NamedRouterOptions } options - Options. + * @returns { Promise } the promise returned by the function. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + *
1. Mandatory parameters are left unspecified. + *
2. Incorrect parameters types. + *
3. Parameter verification failed. + * @throws { BusinessError } 100001 - Internal error. + * @throws { BusinessError } 100003 - Page stack error. Too many pages are pushed. + * @throws { BusinessError } 100004 - Named route error. The named route does not exist. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 11 + */ + pushNamedRoute(options: router.NamedRouterOptions): Promise; + /** + * Navigates to a specified page in the application based on the page URL and parameters. + * @param { router.NamedRouterOptions } options - Options. + * @param { router.RouterMode } mode - RouterMode. + * @param { AsyncCallback } callback - the callback of pushNamedRoute. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + *
1. Mandatory parameters are left unspecified. + *
2. Incorrect parameters types. + *
3. Parameter verification failed. + * @throws { BusinessError } 100001 - Internal error. + * @throws { BusinessError } 100003 - Page stack error. Too many pages are pushed. + * @throws { BusinessError } 100004 - Named route error. The named route does not exist. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 10 + */ + /** + * Navigates to a specified page in the application based on the page URL and parameters. + * @param { router.NamedRouterOptions } options - Options. + * @param { router.RouterMode } mode - RouterMode. + * @param { AsyncCallback } callback - the callback of pushNamedRoute. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + *
1. Mandatory parameters are left unspecified. + *
2. Incorrect parameters types. + *
3. Parameter verification failed. + * @throws { BusinessError } 100001 - Internal error. + * @throws { BusinessError } 100003 - Page stack error. Too many pages are pushed. + * @throws { BusinessError } 100004 - Named route error. The named route does not exist. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 11 + */ + pushNamedRoute(options: router.NamedRouterOptions, mode: router.RouterMode, callback: AsyncCallback): void; + /** + * Navigates to a specified page in the application based on the page URL and parameters. + * @param { router.NamedRouterOptions } options - Options. + * @param { router.RouterMode } mode - RouterMode. + * @returns { Promise } the promise returned by the function. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + *
1. Mandatory parameters are left unspecified. + *
2. Incorrect parameters types. + *
3. Parameter verification failed. + * @throws { BusinessError } 100001 - Internal error. + * @throws { BusinessError } 100003 - Page stack error. Too many pages are pushed. + * @throws { BusinessError } 100004 - Named route error. The named route does not exist. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 10 + */ + /** + * Navigates to a specified page in the application based on the page URL and parameters. + * @param { router.NamedRouterOptions } options - Options. + * @param { router.RouterMode } mode - RouterMode. + * @returns { Promise } the promise returned by the function. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + *
1. Mandatory parameters are left unspecified. + *
2. Incorrect parameters types. + *
3. Parameter verification failed. + * @throws { BusinessError } 100001 - Internal error. + * @throws { BusinessError } 100003 - Page stack error. Too many pages are pushed. + * @throws { BusinessError } 100004 - Named route error. The named route does not exist. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 11 + */ + pushNamedRoute(options: router.NamedRouterOptions, mode: router.RouterMode): Promise; + /** + * Replaces the current page with another one in the application. The current page is destroyed after replacement. + * @param { router.NamedRouterOptions } options - Options. + * @param { AsyncCallback } callback - the callback of replaceNamedRoute. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + *
1. Mandatory parameters are left unspecified. + *
2. Incorrect parameters types. + *
3. Parameter verification failed. + * @throws { BusinessError } 100001 - if UI execution context not found, only throw in standard system. + * @throws { BusinessError } 100004 - Named route error. The named route does not exist. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 10 + */ + /** + * Replaces the current page with another one in the application. The current page is destroyed after replacement. + * @param { router.NamedRouterOptions } options - Options. + * @param { AsyncCallback } callback - the callback of replaceNamedRoute. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + *
1. Mandatory parameters are left unspecified. + *
2. Incorrect parameters types. + *
3. Parameter verification failed. + * @throws { BusinessError } 100001 - if UI execution context not found, only throw in standard system. + * @throws { BusinessError } 100004 - Named route error. The named route does not exist. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 11 + */ + replaceNamedRoute(options: router.NamedRouterOptions, callback: AsyncCallback): void; + /** + * Replaces the current page with another one in the application. The current page is destroyed after replacement. + * @param { router.NamedRouterOptions } options - Options. + * @returns { Promise } the promise returned by the function. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + *
1. Mandatory parameters are left unspecified. + *
2. Incorrect parameters types. + *
3. Parameter verification failed. + * @throws { BusinessError } 100001 - if UI execution context not found, only throw in standard system. + * @throws { BusinessError } 100004 - Named route error. The named route does not exist. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 10 + */ + /** + * Replaces the current page with another one in the application. The current page is destroyed after replacement. + * @param { router.NamedRouterOptions } options - Options. + * @returns { Promise } the promise returned by the function. + * @throws { BusinessError } 401 - if the number of parameters is less than 1 or the type of the url parameter is not string. + * @throws { BusinessError } 100001 - if UI execution context not found, only throw in standard system. + * @throws { BusinessError } 100004 - Named route error. The named route does not exist. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 11 + */ + replaceNamedRoute(options: router.NamedRouterOptions): Promise; + /** + * Replaces the current page with another one in the application. The current page is destroyed after replacement. + * @param { router.NamedRouterOptions } options - Options. + * @param { router.RouterMode } mode - RouterMode. + * @param { AsyncCallback } callback - the callback of replaceNamedRoute. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + *
1. Mandatory parameters are left unspecified. + *
2. Incorrect parameters types. + *
3. Parameter verification failed. + * @throws { BusinessError } 100001 - if UI execution context not found, only throw in standard system. + * @throws { BusinessError } 100004 - Named route error. The named route does not exist. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 10 + */ + /** + * Replaces the current page with another one in the application. The current page is destroyed after replacement. + * @param { router.NamedRouterOptions } options - Options. + * @param { router.RouterMode } mode - RouterMode. + * @param { AsyncCallback } callback - the callback of replaceNamedRoute. + * @throws { BusinessError } 401 - if the number of parameters is less than 1 or the type of the url parameter is not string. + * @throws { BusinessError } 100001 - if UI execution context not found, only throw in standard system. + * @throws { BusinessError } 100004 - Named route error. The named route does not exist. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 11 + */ + replaceNamedRoute(options: router.NamedRouterOptions, mode: router.RouterMode, callback: AsyncCallback): void; + /** + * Replaces the current page with another one in the application. The current page is destroyed after replacement. + * @param { router.NamedRouterOptions } options - Options. + * @param { router.RouterMode } mode - RouterMode. + * @returns { Promise } the promise returned by the function. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + *
1. Mandatory parameters are left unspecified. + *
2. Incorrect parameters types. + *
3. Parameter verification failed. + * @throws { BusinessError } 100001 - if can not get the delegate, only throw in standard system. + * @throws { BusinessError } 100004 - Named route error. The named route does not exist. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 10 + */ + /** + * Replaces the current page with another one in the application. The current page is destroyed after replacement. + * @param { router.NamedRouterOptions } options - Options. + * @param { router.RouterMode } mode - RouterMode. + * @returns { Promise } the promise returned by the function. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + *
1. Mandatory parameters are left unspecified. + *
2. Incorrect parameters types. + *
3. Parameter verification failed. + * @throws { BusinessError } 100001 - if can not get the delegate, only throw in standard system. + * @throws { BusinessError } 100004 - Named route error. The named route does not exist. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 11 + */ + replaceNamedRoute(options: router.NamedRouterOptions, mode: router.RouterMode): Promise; +} +/** + * class PromptAction + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 10 + */ +/** + * class PromptAction + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 11 + */ +export class PromptAction { + /** + * Displays the notification text. + * + * @param { promptAction.ShowToastOptions } options - Options. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + *
1. Mandatory parameters are left unspecified. + *
2. Incorrect parameters types. + *
3. Parameter verification failed. + * @throws { BusinessError } 100001 - Internal error. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 10 + */ + /** + * Displays the notification text. + * + * @param { promptAction.ShowToastOptions } options - Options. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + *
1. Mandatory parameters are left unspecified. + *
2. Incorrect parameters types. + *
3. Parameter verification failed. + * @throws { BusinessError } 100001 - Internal error. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 11 + */ + showToast(options: promptAction.ShowToastOptions): void; + /** + * Displays the dialog box. + * + * @param { promptAction.ShowDialogOptions } options - Options. + * @param { AsyncCallback } callback - the callback of showDialog. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + *
1. Mandatory parameters are left unspecified. + *
2. Incorrect parameters types. + *
3. Parameter verification failed. + * @throws { BusinessError } 100001 - Internal error. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 10 + */ + /** + * Displays the dialog box. + * + * @param { promptAction.ShowDialogOptions } options - Options. + * @param { AsyncCallback } callback - the callback of showDialog. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + *
1. Mandatory parameters are left unspecified. + *
2. Incorrect parameters types. + *
3. Parameter verification failed. + * @throws { BusinessError } 100001 - Internal error. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 11 + */ + showDialog(options: promptAction.ShowDialogOptions, callback: AsyncCallback): void; + /** + * Displays the dialog box. + * + * @param { promptAction.ShowDialogOptions } options - Options. + * @returns { Promise } the promise returned by the function. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + *
1. Mandatory parameters are left unspecified. + *
2. Incorrect parameters types. + *
3. Parameter verification failed. + * @throws { BusinessError } 100001 - Internal error. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 10 + */ + /** + * Displays the dialog box. + * + * @param { promptAction.ShowDialogOptions } options - Options. + * @returns { Promise } the promise returned by the function. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + *
1. Mandatory parameters are left unspecified. + *
2. Incorrect parameters types. + *
3. Parameter verification failed. + * @throws { BusinessError } 100001 - Internal error. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 11 + */ + showDialog(options: promptAction.ShowDialogOptions): Promise; + /** + * Displays the menu. + * + * @param { promptAction.ActionMenuOptions } options - Options. + * @param { promptAction.ActionMenuSuccessResponse } callback - the callback of showActionMenu. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + *
1. Mandatory parameters are left unspecified. + *
2. Incorrect parameters types. + *
3. Parameter verification failed. + * @throws { BusinessError } 100001 - Internal error. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 10 + * @deprecated since 11 + * @useinstead showActionMenu + */ + showActionMenu(options: promptAction.ActionMenuOptions, callback: promptAction.ActionMenuSuccessResponse): void; + /** + * Displays the menu. + * + * @param { promptAction.ActionMenuOptions } options - Options. + * @param { AsyncCallback } callback - the callback of showActionMenu. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + *
1. Mandatory parameters are left unspecified. + *
2. Incorrect parameters types. + *
3. Parameter verification failed. + * @throws { BusinessError } 100001 - Internal error. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 11 + */ + showActionMenu(options: promptAction.ActionMenuOptions, callback: AsyncCallback): void; + /** + * Displays the menu. + * + * @param { promptAction.ActionMenuOptions } options - Options. + * @returns { Promise } callback - the callback of showActionMenu. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + *
1. Mandatory parameters are left unspecified. + *
2. Incorrect parameters types. + *
3. Parameter verification failed. + * @throws { BusinessError } 100001 - Internal error. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 10 + */ + /** + * Displays the menu. + * + * @param { promptAction.ActionMenuOptions } options - Options. + * @returns { Promise } callback - the callback of showActionMenu. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + *
1. Mandatory parameters are left unspecified. + *
2. Incorrect parameters types. + *
3. Parameter verification failed. + * @throws { BusinessError } 100001 - Internal error. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 11 + */ + showActionMenu(options: promptAction.ActionMenuOptions): Promise; + /** + * Open the custom dialog with frameNode. + * + * @param { ComponentContent } dialogContent - the content of custom dialog. + * @param { promptAction.BaseDialogOptions } options - Options. + * @returns { Promise } the promise returned by the function. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + *
1. Mandatory parameters are left unspecified. + *
2. Incorrect parameters types. + *
3. Parameter verification failed. + * @throws { BusinessError } 103301 - the ComponentContent is incorrect. + * @throws { BusinessError } 103302 - Dialog content already exists + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + openCustomDialog(dialogContent: ComponentContent, options?: promptAction.BaseDialogOptions): Promise; + /** + * Update the custom dialog with frameNode. + * + * @param { ComponentContent } dialogContent - the content of custom dialog. + * @param { promptAction.BaseDialogOptions } options - Options. + * @returns { Promise } the promise returned by the function. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + *
1. Mandatory parameters are left unspecified. + *
2. Incorrect parameters types. + *
3. Parameter verification failed. + * @throws { BusinessError } 103301 - the ComponentContent is incorrect. + * @throws { BusinessError } 103303 - the ComponentContent cannot be found. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + updateCustomDialog(dialogContent: ComponentContent, options: promptAction.BaseDialogOptions): Promise; + /** + * Close the custom dialog with frameNode. + * + * @param { ComponentContent } dialogContent - the content of custom dialog. + * @returns { Promise } the promise returned by the function. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + *
1. Mandatory parameters are left unspecified. + *
2. Incorrect parameters types. + *
3. Parameter verification failed. + * @throws { BusinessError } 103301 - the ComponentContent is incorrect. + * @throws { BusinessError } 103303 - the ComponentContent cannot be found. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + closeCustomDialog(dialogContent: ComponentContent): Promise; +} +/** + * Defines the callback type used in UIObserver watch click event. + * The value of event indicates the information of ClickEvent. + * The value of node indicates the frameNode which will receive the event. + * + * @typedef { function } ClickEventListenerCallback + * @param { ClickEvent } event - the information of ClickEvent + * @param { FrameNode } [node] - the information of frameNode + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + */ +declare type ClickEventListenerCallback = (event: ClickEvent, node?: FrameNode) => void; +/** + * Defines the callback type used in UIObserver watch gesture. + * The value of event indicates the information of gesture. + * The value of node indicates the frameNode which will receive the event. + * + * @typedef { function } GestureEventListenerCallback + * @param { GestureEvent } event - the information of GestureEvent + * @param { FrameNode } [node] - the information of frameNode + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + */ +declare type GestureEventListenerCallback = (event: GestureEvent, node?: FrameNode) => void; +/** + * Register callbacks to observe ArkUI behavior. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ +/** + * Register callbacks to observe ArkUI behavior. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ +export class UIObserver { + /** + * Registers a callback function to be called when the navigation destination is updated. + * + * @param { 'navDestinationUpdate' } type - The type of event to listen for. Must be 'navDestinationUpdate'. + * @param { object } options - Specify the id of observed navigation. + * @param { Callback } callback - The callback function to be called when the navigation destination is updated. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * Registers a callback function to be called when the navigation destination is updated. + * + * @param { 'navDestinationUpdate' } type - The type of event to listen for. Must be 'navDestinationUpdate'. + * @param { object } options - The options object. + * @param { Callback } callback - The callback function to be called when the navigation destination is updated. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + on(type: 'navDestinationUpdate', options: { + navigationId: ResourceStr; + }, callback: Callback): void; + /** + * Removes a callback function that was previously registered with `on()`. + * + * @param { 'navDestinationUpdate' } type - The type of event to remove the listener for. Must be 'navDestinationUpdate'. + * @param { object } options - Specify the id of observed navigation. + * @param { Callback } callback - The callback function to remove. If not provided, all callbacks for the given event type and + * navigation ID will be removed. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * Removes a callback function that was previously registered with `on()`. + * + * @param { 'navDestinationUpdate' } type - The type of event to remove the listener for. Must be 'navDestinationUpdate'. + * @param { object } options - The options object. + * @param { Callback } callback - The callback function to remove. If not provided, all callbacks for the given event type and + * navigation ID will be removed. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + off(type: 'navDestinationUpdate', options: { + navigationId: ResourceStr; + }, callback?: Callback): void; + /** + * Registers a callback function to be called when the navigation destination is updated. + * + * @param { 'navDestinationUpdate' } type - The type of event to listen for. Must be 'navDestinationUpdate'. + * @param { Callback } callback - The callback function to be called when the navigation destination is updated. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * Registers a callback function to be called when the navigation destination is updated. + * + * @param { 'navDestinationUpdate' } type - The type of event to listen for. Must be 'navDestinationUpdate'. + * @param { Callback } callback - The callback function to be called when the navigation destination is updated. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + on(type: 'navDestinationUpdate', callback: Callback): void; + /** + * Removes a callback function that was previously registered with `on()`. + * + * @param { 'navDestinationUpdate'} type - The type of event to remove the listener for. Must be 'navDestinationUpdate'. + * @param { Callback } [callback] - The callback function to remove. If not provided, all callbacks for the given event type + * will be removed. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * Removes a callback function that was previously registered with `on()`. + * + * @param { 'navDestinationUpdate'} type - The type of event to remove the listener for. Must be 'navDestinationUpdate'. + * @param { Callback } [callback] - The callback function to remove. If not provided, all callbacks for the given event type + * will be removed. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + off(type: 'navDestinationUpdate', callback?: Callback): void; + /** + * Registers a callback function to be called when the scroll event start or stop. + * + * @param { 'scrollEvent' } type - The type of event to listen for. Must be 'scrollEvent'. + * @param { observer.ObserverOptions } options - The options object. + * @param { Callback } callback - The callback function to be called when the scroll event start or stop. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + */ + on(type: 'scrollEvent', options: observer.ObserverOptions, callback: Callback): void; + /** + * Removes a callback function that was previously registered with `on()`. + * + * @param { 'scrollEvent' } type - The type of event to remove the listener for. Must be 'scrollEvent'. + * @param { observer.ObserverOptions } options - The options object. + * @param { Callback } callback - The callback function to remove. If not provided, all callbacks for the given event type and + * scroll ID will be removed. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + */ + off(type: 'scrollEvent', options: observer.ObserverOptions, callback?: Callback): void; + /** + * Registers a callback function to be called when the scroll event start or stop. + * + * @param { 'scrollEvent' } type - The type of event to listen for. Must be 'scrollEvent'. + * @param { Callback } callback - The callback function to be called when the scroll event start or stop. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + */ + on(type: 'scrollEvent', callback: Callback): void; + /** + * Removes a callback function that was previously registered with `on()`. + * + * @param { 'scrollEvent'} type - The type of event to remove the listener for. Must be 'scrollEvent'. + * @param { Callback } [callback] - The callback function to remove. If not provided, all callbacks for the given event type + * will be removed. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + */ + off(type: 'scrollEvent', callback?: Callback): void; + /** + * Registers a callback function to be called when the router page in a ui context is updated. + * + * @param { 'routerPageUpdate' } type - The type of event to listen for. Must be 'routerPageUpdate'. + * @param { Callback } callback - The callback function to be called when the router page is updated. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * Registers a callback function to be called when the router page in a ui context is updated. + * + * @param { 'routerPageUpdate' } type - The type of event to listen for. Must be 'routerPageUpdate'. + * @param { Callback } callback - The callback function to be called when the router page is updated. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + on(type: 'routerPageUpdate', callback: Callback): void; + /** + * Removes a callback function that was previously registered with `on()`. + * + * @param { 'routerPageUpdate' } type - The type of event to remove the listener for. Must be 'routerPageUpdate'. + * @param { Callback } [callback] - The callback function to remove. If not provided, all callbacks for the given event type + * will be removed. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * Removes a callback function that was previously registered with `on()`. + * + * @param { 'routerPageUpdate' } type - The type of event to remove the listener for. Must be 'routerPageUpdate'. + * @param { Callback } [callback] - The callback function to remove. If not provided, all callbacks for the given event type + * will be removed. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + off(type: 'routerPageUpdate', callback?: Callback): void; + /** + * Registers a callback function to be called when the screen density in a ui context is updated. + * + * @param { 'densityUpdate' } type - The type of event to listen for. Must be 'densityUpdate'. + * @param { Callback } callback - The callback function to be called when the screen density is updated. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + */ + on(type: 'densityUpdate', callback: Callback): void; + /** + * Removes a callback function that was previously registered with `on()`. + * + * @param { 'densityUpdate' } type - The type of event to remove the listener for. Must be 'densityUpdate'. + * @param { Callback } [callback] - The callback function to remove. If not provided, all callbacks for the given event type + * will be removed. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + */ + off(type: 'densityUpdate', callback?: Callback): void; + /** + * Registers a callback function to be called when the draw command will be drawn. + * + * @param { 'willDraw' } type - The type of event to listen for. Must be 'willDraw'. + * @param { Callback } callback - The callback function to be called when the draw command will be drawn. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + */ + on(type: 'willDraw', callback: Callback): void; + /** + * Removes a callback function that was previously registered with `on()`. + * + * @param { 'willDraw' } type - The type of event to remove the listener for. Must be 'willDraw'. + * @param { Callback } [callback] - The callback function to remove. If not provided, all callbacks for the given event type + * will be removed. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + */ + off(type: 'willDraw', callback?: Callback): void; + /** + * Registers a callback function to be called when the layout is done. + * + * @param { 'didLayout' } type - The type of event to listen for. Must be 'didLayout'. + * @param { Callback } callback - The callback function to be called when the layout is done. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + */ + on(type: 'didLayout', callback: Callback): void; + /** + * Removes a callback function that was previously registered with `on()`. + * + * @param { 'didLayout' } type - The type of event to remove the listener for. Must be 'didLayout'. + * @param { Callback } [callback] - The callback function to remove. If not provided, all callbacks for the given event type + * will be removed. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + */ + off(type: 'didLayout', callback?: Callback): void; + /** + * Registers a callback function to be called when the navigation switched to a new navDestination. + * + * @param { 'navDestinationSwitch' } type - The type of event to listen for. Must be 'navDestinationSwitch'. + * @param { Callback } callback - The callback function to be called when + * the navigation switched to a new navDestination. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + */ + on(type: 'navDestinationSwitch', callback: Callback): void; + /** + * Removes a callback function that was previously registered with `on()`. + * + * @param { 'navDestinationSwitch' } type - The type of event to remove the listener for. Must be 'navDestinationSwitch'. + * @param { Callback } [callback] - The callback function to remove. If not provided, + * all callbacks for the given event type will be removed. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + */ + off(type: 'navDestinationSwitch', callback?: Callback): void; + /** + * Registers a callback function to be called when the navigation switched to a new navDestination. + * + * @param { 'navDestinationSwitch' } type - The type of event to listen for. Must be 'navDestinationSwitch'. + * @param { observer.NavDestinationSwitchObserverOptions } observerOptions - Options. + * @param { Callback } callback - The callback function to be called when the + * navigation switched to a new navDestination. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + */ + on(type: 'navDestinationSwitch', observerOptions: observer.NavDestinationSwitchObserverOptions, callback: Callback): void; + /** + * Removes a callback function that was previously registered with `on()`. + * + * @param { 'navDestinationSwitch' } type - The type of event to remove the listener for. Must be 'navDestinationSwitch'. + * @param { observer.NavDestinationSwitchObserverOptions } observerOptions - Options. + * @param { Callback } [callback] - The callback function to remove. If not provided, + * all callbacks for the given event type will be removed. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + */ + off(type: 'navDestinationSwitch', observerOptions: observer.NavDestinationSwitchObserverOptions, callback?: Callback): void; + /** + * Registers a callback function to be called before clickEvent is called. + * + * @param { 'willClick' } type - The type of event to listen for. + * @param { ClickEventListenerCallback } callback - The callback function to be called + * when the clickEvent will be trigger or after. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + */ + on(type: 'willClick', callback: ClickEventListenerCallback): void; + /** + * Removes a callback function to be called before clickEvent is called. + * + * @param { 'willClick' } type - The type of event to remove the listener for. + * @param { ClickEventListenerCallback } [callback] - The callback function to remove. If not provided, + * all callbacks for the given event type will be removed. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + */ + off(type: 'willClick', callback?: ClickEventListenerCallback): void; + /** + * Registers a callback function to be called after clickEvent is called. + * + * @param { 'didClick' } type - The type of event to listen for. + * @param { ClickEventListenerCallback } callback - The callback function to be called + * when the clickEvent will be trigger or after. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + */ + on(type: 'didClick', callback: ClickEventListenerCallback): void; + /** + * Removes a callback function to be called after clickEvent is called. + * + * @param { 'didClick' } type - The type of event to remove the listener for. + * @param { ClickEventListenerCallback } [callback] - The callback function to remove. If not provided, + * all callbacks for the given event type will be removed. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + */ + off(type: 'didClick', callback?: ClickEventListenerCallback): void; + /** + * Registers a callback function to be called before tapGesture is called. + * + * @param { 'willClick' } type - The type of event to listen for. + * @param { GestureEventListenerCallback } callback - The callback function to be called + * when the clickEvent will be trigger or after. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + */ + on(type: 'willClick', callback: GestureEventListenerCallback): void; + /** + * Removes a callback function to be called before tapGesture is called. + * + * @param { 'willClick' } type - The type of event to remove the listener for. + * @param { GestureEventListenerCallback } [callback] - The callback function to remove. If not provided, + * all callbacks for the given event type will be removed. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + */ + off(type: 'willClick', callback?: GestureEventListenerCallback): void; + /** + * Registers a callback function to be called after tapGesture is called. + * + * @param { 'didClick' } type - The type of event to listen for. + * @param { GestureEventListenerCallback } callback - The callback function to be called + * when the clickEvent will be trigger or after. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + */ + on(type: 'didClick', callback: GestureEventListenerCallback): void; + /** + * Removes a callback function to be called after tapGesture is called. + * + * @param { 'didClick' } type - The type of event to remove the listener for. + * @param { GestureEventListenerCallback } [callback] - The callback function to remove. If not provided, + * all callbacks for the given event type will be removed. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + */ + off(type: 'didClick', callback?: GestureEventListenerCallback): void; +} +/** + * class ComponentUtils + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 10 + */ +/** + * class ComponentUtils + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 11 + */ +export class ComponentUtils { + /** + * Provide the ability to obtain the coordinates and size of component drawing areas. + * + * @param { string } id - ID of the component whose attributes are to be obtained. + * @returns { componentUtils.ComponentInfo } the object of ComponentInfo. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * Provide the ability to obtain the coordinates and size of component drawing areas. + * + * @param { string } id - ID of the component whose attributes are to be obtained. + * @returns { componentUtils.ComponentInfo } the object of ComponentInfo. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + getRectangleById(id: string): componentUtils.ComponentInfo; +} +/** + * class OverlayManager + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + */ +export class OverlayManager { + /** + * Add the ComponentContent to the OverlayManager. + * + * @param { ComponentContent } content - The content will be added to the OverlayManager. + * @param { number } [ index ] - The index at which to add the ComponentContent. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + */ + addComponentContent(content: ComponentContent, index?: number): void; + /** + * Remove the ComponentContent from the OverlayManager. + * + * @param { ComponentContent } content - The content will be removed from the OverlayManager. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + */ + removeComponentContent(content: ComponentContent): void; + /** + * Show the ComponentContent. + * + * @param { ComponentContent } content - The content will be shown. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + */ + showComponentContent(content: ComponentContent): void; + /** + * Hide the ComponentContent. + * + * @param { ComponentContent } content - The content will be hidden. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + */ + hideComponentContent(content: ComponentContent): void; + /** + * Show all ComponentContents on the OverlayManager. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + */ + showAllComponentContents(): void; + /** + * Hide all ComponentContents on the OverlayManager. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + */ + hideAllComponentContents(): void; +} +/** + * interface AtomicServiceBar + * @interface AtomicServiceBar + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ +/** + * interface AtomicServiceBar + * @interface AtomicServiceBar + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ +export interface AtomicServiceBar { + /** + * Set the visibility of the bar, except the icon. + * + * @param { boolean } visible - whether this bar is visible. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + setVisible(visible: boolean): void; + /** + * Set the background color of the bar. + * + * @param { Nullable< Color | number | string> } color - the color to set, undefined indicates using default. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 11 + */ + /** + * Set the background color of the bar. + * + * @param { Nullable< Color | number | string> } color - the color to set, undefined indicates using default. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 12 + */ + setBackgroundColor(color: Nullable): void; + /** + * Set the title of the bar. + * + * @param { string } content - the content of the bar. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 11 + */ + /** + * Set the title of the bar. + * + * @param { string } content - the content of the bar. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 12 + */ + setTitleContent(content: string): void; + /** + * Set the font style of the bar's title. + * + * @param { FontStyle } font - the font style of the bar's title. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 11 + */ + /** + * Set the font style of the bar's title. + * + * @param { FontStyle } font - the font style of the bar's title. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 12 + */ + setTitleFontStyle(font: FontStyle): void; + /** + * Set the color of the icon on the bar. + * + * @param { Nullable< Color | number | string> } color - the color to set to icon, undefined indicates using default. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 11 + */ + /** + * Set the color of the icon on the bar. + * + * @param { Nullable< Color | number | string> } color - the color to set to icon, undefined indicates using default. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 12 + */ + setIconColor(color: Nullable): void; +} +/** + * class DragController + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 11 + */ +/** + * class DragController + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 12 + */ +export class DragController { + /** + * Execute a drag event. + * @param { CustomBuilder | DragItemInfo } custom - Object used for prompts displayed when the object is dragged. + * @param { dragController.DragInfo } dragInfo - Information about the drag event. + * @param { AsyncCallback<{ event: DragEvent, extraParams: string }> } callback - Callback that contains + * the drag event information. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + *
1. Mandatory parameters are left unspecified. + *
2. Incorrect parameters types. + *
3. Parameter verification failed. + * @throws { BusinessError } 100001 - if some internal handling failed. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 11 + */ + /** + * Execute a drag event. + * @param { CustomBuilder | DragItemInfo } custom - Object used for prompts displayed when the object is dragged. + * @param { dragController.DragInfo } dragInfo - Information about the drag event. + * @param { AsyncCallback<{ event: DragEvent, extraParams: string }> } callback - Callback that contains + * the drag event information. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + *
1. Mandatory parameters are left unspecified. + *
2. Incorrect parameters types. + *
3. Parameter verification failed. + * @throws { BusinessError } 100001 - if some internal handling failed. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 12 + */ + executeDrag(custom: CustomBuilder | DragItemInfo, dragInfo: dragController.DragInfo, callback: AsyncCallback<{ + event: DragEvent; + extraParams: string; + }>): void; + /** + * Execute a drag event. + * @param { CustomBuilder | DragItemInfo } custom - Object used for prompts displayed when the object is dragged. + * @param { dragController.DragInfo } dragInfo - Information about the drag event. + * @returns { Promise<{ event: DragEvent, extraParams: string }> } A Promise with the drag event information. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + *
1. Mandatory parameters are left unspecified. + *
2. Incorrect parameters types. + *
3. Parameter verification failed. + * @throws { BusinessError } 100001 - if some internal handling failed. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 11 + */ + /** + * Execute a drag event. + * @param { CustomBuilder | DragItemInfo } custom - Object used for prompts displayed when the object is dragged. + * @param { dragController.DragInfo } dragInfo - Information about the drag event. + * @returns { Promise<{ event: DragEvent, extraParams: string }> } A Promise with the drag event information. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + *
1. Mandatory parameters are left unspecified. + *
2. Incorrect parameters types. + *
3. Parameter verification failed. + * @throws { BusinessError } 100001 - if some internal handling failed. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 12 + */ + executeDrag(custom: CustomBuilder | DragItemInfo, dragInfo: dragController.DragInfo): Promise<{ + event: DragEvent; + extraParams: string; + }>; + /** + * Create one drag action object, which can be used for starting drag later or monitoring the drag status after drag started. + * @param { Array } customArray - Objects used for prompts displayed when the objects are dragged. + * @param { dragController.DragInfo } dragInfo - Information about the drag event. + * @returns { dragController.DragAction } one drag action object + * @throws { BusinessError } 401 - Parameter error. Possible causes: + *
1. Mandatory parameters are left unspecified. + *
2. Incorrect parameters types. + *
3. Parameter verification failed. + * @throws { BusinessError } 100001 - if some internal handling failed. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 11 + */ + /** + * Create one drag action object, which can be used for starting drag later or monitoring the drag status after drag started. + * @param { Array } customArray - Objects used for prompts displayed when the objects are dragged. + * @param { dragController.DragInfo } dragInfo - Information about the drag event. + * @returns { dragController.DragAction } one drag action object + * @throws { BusinessError } 401 - Parameter error. Possible causes: + *
1. Mandatory parameters are left unspecified. + *
2. Incorrect parameters types. + *
3. Parameter verification failed. + * @throws { BusinessError } 100001 - if some internal handling failed. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 12 + */ + createDragAction(customArray: Array, dragInfo: dragController.DragInfo): dragController.DragAction; + /** + * Get a drag preview object, which provides the functions of setting color or updating animation and has no effect in OnDrop and OnDragEnd callback. + * @returns { dragController.DragPreview } A drag preview object. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 11 + */ + /** + * Get a drag preview object. + * @returns { dragController.DragPreview } A drag preview object. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 12 + */ + getDragPreview(): dragController.DragPreview; + /** + * Enable drag event strict reporting for drag enter and leave notification in nested situation. + * For example, the parent and child both register the onDragEnter/onDragLeave events, if this + * flag is enabled, the parent will be notified with leave event, and the child will notified with + * enter event at the same time, when user drag action is passing through the parent and enter the + * scope of the child. + * Please be noted, the default value of the flag is false, it means, for the same situation, the + * parent will not receive the leave notification, just the child can get the enter event, which is + * not fully strict. + * @param { boolean } enable - Indicating enable drag event strict reporting or not. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 12 + */ + setDragEventStrictReportingEnabled(enable: boolean): void; +} +/** + * class MeasureUtils + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ +export class MeasureUtils { + /** + * Obtains the width of the specified text in a single line layout. + * + * @param { MeasureOptions } options - Options. + * @returns { number } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + measureText(options: MeasureOptions): number; + /** + * Obtains the width and height of the specified text in a single line layout. + * + * @param { MeasureOptions } options - Options of measure area occupied by text. + * @returns { SizeOptions } width and height for text to display + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + measureTextSize(options: MeasureOptions): SizeOptions; +} +/** + * class FocusController + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 12 + */ +export class FocusController { + /** + * clear focus to the root container. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 12 + */ + clearFocus(): void; + /** + * request focus to the specific component. + * @param { string } key - the inspector key of the component. + * @throws { BusinessError } 150001 - the component cannot be focused. + * @throws { BusinessError } 150002 - This component has an unfocusable ancestor + * @throws { BusinessError } 150003 - the component is not on tree or does not exist. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 12 + */ + requestFocus(key: string): void; +} +/** + * Pointer style. + * + * @typedef {pointer.PointerStyle} PointerStyle + * @syscap SystemCapability.MultimodalInput.Input.Pointer + * @atomicservice + * @since 12 + */ +export type PointerStyle = pointer.PointerStyle; +/** + * class CursorController + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ +export class CursorController { + /** + * Restore default cursor. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + restoreDefault(): void; + /** + * Set cursor style. + * + * @param { PointerStyle } value - cursor style enum. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + setCursor(value: PointerStyle): void; +} +/** + * class ContextMenuController + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ +export class ContextMenuController { + /** + * Close context menu. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + close(): void; +} +/** + * The base context of an ability or an application. It allows access to + * application-specific resources. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @StageModelOnly + * @crossplatform + * @since 12 + */ +export type Context = common.Context; +/** + * class ComponentSnapshot + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 12 + */ +export class ComponentSnapshot { + /** + * Get a component snapshot by component id. + * + * @param { string } id - Target component ID, set by developer through .id attribute. + * @param { AsyncCallback } callback - Callback that contains the snapshot in PixelMap format. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + get(id: string, callback: AsyncCallback): void; + /** + * Get a component snapshot by component id. + * + * @param { string } id - Target component ID, set by developer through .id attribute. + * @returns { Promise } A Promise with the snapshot in PixelMap format. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + get(id: string): Promise; + /** + * Generate a snapshot from a custom component builder. + * + * @param { CustomBuilder } builder - Builder function of a custom component. + * @param { AsyncCallback } callback - Callback that contains the snapshot in PixelMap format. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + createFromBuilder(builder: CustomBuilder, callback: AsyncCallback): void; + /** + * Generate a snapshot from a custom component builder. + * + * @param { CustomBuilder } builder - Builder function of a custom component. + * @returns { Promise } A Promise with the snapshot in PixelMap format. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + createFromBuilder(builder: CustomBuilder): Promise; +} +/** + * class UIContext + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 10 + */ +/** + * class UIContext + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 11 + */ +export class UIContext { + /** + * get object font. + * + * @returns { Font } object Font. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 10 + */ + /** + * get object font. + * + * @returns { Font } object Font. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 11 + */ + getFont(): Font; + /** + * get object mediaQuery. + * + * @returns { MediaQuery } object MediaQuery. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 10 + */ + /** + * get object mediaQuery. + * + * @returns { MediaQuery } object MediaQuery. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 11 + */ + getMediaQuery(): MediaQuery; + /** + * get object UIInspector. + * @returns { UIInspector } object UIInspector. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 10 + */ + /** + * get object UIInspector. + * @returns { UIInspector } object UIInspector. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 11 + */ + getUIInspector(): UIInspector; + /** + * get the filtered attributes of the component tree. + * @param { Array } [filters] - the list of filters used to filter out component tree to be obtained. + * @returns { string } the specified attributes of the component tree in json string. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + *
1. Mandatory parameters are left unspecified. + *
2. Incorrect parameters types. + *
3. Parameter verification failed. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + getFilteredInspectorTree(filters?: Array): string; + /** + * get the filtered attributes of the component tree with the specified id and depth + * @param { string } id - ID of the specified component tree to be obtained. + * @param { number } depth - depth of the component tree to be obtained. + * @param { Array } [filters] - the list of filters used to filter out component tree to be obtained. + * @returns { string } the specified attributes of the component tree in json string. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + *
1. Mandatory parameters are left unspecified. + *
2. Incorrect parameters types. + *
3. Parameter verification failed. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + getFilteredInspectorTreeById(id: string, depth: number, filters?: Array): string; + /** + * get object router. + * + * @returns { Router } object Router. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 10 + */ + /** + * get object router. + * + * @returns { Router } object Router. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 11 + */ + getRouter(): Router; + /** + * get object PromptAction. + * + * @returns { PromptAction } object PromptAction. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 10 + */ + /** + * get object PromptAction. + * + * @returns { PromptAction } object PromptAction. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 11 + */ + getPromptAction(): PromptAction; + /** + * get object ComponentUtils. + * @returns { ComponentUtils } object ComponentUtils. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 10 + */ + /** + * get object ComponentUtils. + * @returns { ComponentUtils } object ComponentUtils. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 11 + */ + getComponentUtils(): ComponentUtils; + /** + * Get the UI observer. + * + * @returns { UIObserver } The UI observer. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * Get the UI observer. + * + * @returns { UIObserver } The UI observer. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + getUIObserver(): UIObserver; + /** + * Get object OverlayManager. + * + * @returns { OverlayManager } object OverlayManager. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + getOverlayManager(): OverlayManager; + /** + * Create an animator object for custom animation. + * + * @param { AnimatorOptions } options - Options. + * @returns { AnimatorResult } + * @throws { BusinessError } 401 - Parameter error. Possible causes: + *
1. Mandatory parameters are left unspecified. + *
2. Incorrect parameters types. + *
3. Parameter verification failed. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 10 + */ + /** + * Create an animator object for custom animation. + * + * @param { AnimatorOptions } options - Options. + * @returns { AnimatorResult } + * @throws { BusinessError } 401 - Parameter error. Possible causes: + *
1. Mandatory parameters are left unspecified. + *
2. Incorrect parameters types. + *
3. Parameter verification failed. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 11 + */ + createAnimator(options: AnimatorOptions): AnimatorResult; + /** + * Defining animation function + * + * @param { AnimateParam } value - parameters for animation. + * @param { function } event - the closure base on which, the system will create animation automatically + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 10 + */ + /** + * Defining animation function + * + * @param { AnimateParam } value - parameters for animation. + * @param { function } event - the closure base on which, the system will create animation automatically + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 11 + */ + animateTo(value: AnimateParam, event: () => void): void; + /** + * alertDialog display. + * + * @param { AlertDialogParamWithConfirm | AlertDialogParamWithButtons | AlertDialogParamWithOptions } options - Options. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 10 + */ + /** + * alertDialog display. + * + * @param { AlertDialogParamWithConfirm | AlertDialogParamWithButtons | AlertDialogParamWithOptions } options - Options. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 11 + */ + showAlertDialog(options: AlertDialogParamWithConfirm | AlertDialogParamWithButtons | AlertDialogParamWithOptions): void; + /** + * actionSheet display. + * + * @param { ActionSheetOptions } value - Options. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 10 + */ + /** + * actionSheet display. + * + * @param { ActionSheetOptions } value - Options. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 11 + */ + showActionSheet(value: ActionSheetOptions): void; + /** + * datePickerDialog display. + * + * @param { DatePickerDialogOptions } options - Options. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 10 + */ + /** + * datePickerDialog display. + * + * @param { DatePickerDialogOptions } options - Options. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 11 + */ + showDatePickerDialog(options: DatePickerDialogOptions): void; + /** + * timePickerDialog display. + * + * @param { TimePickerDialogOptions } options - Options. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 10 + */ + /** + * timePickerDialog display. + * + * @param { TimePickerDialogOptions } options - Options. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 11 + */ + showTimePickerDialog(options: TimePickerDialogOptions): void; + /** + * textPickerDialog display. + * + * @param { TextPickerDialogOptions } options - Options. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 10 + */ + /** + * textPickerDialog display. + * + * @param { TextPickerDialogOptions } options - Options. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 11 + */ + showTextPickerDialog(options: TextPickerDialogOptions): void; + /** + * Run custom functions inside the UIContext scope. + * + * @param { function } callback - The function called through UIContext. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 10 + */ + /** + * Run custom functions inside the UIContext scope. + * + * @param { function } callback - The function called through UIContext. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 11 + */ + runScopedTask(callback: () => void): void; + /** + * Set KeyboardAvoidMode. The default mode is KeyboardAvoidMode.OFFSET + * + * @param { KeyboardAvoidMode } value - The mode of keyboard avoid. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 11 + */ + setKeyboardAvoidMode(value: KeyboardAvoidMode): void; + /** + * Get KeyboardAvoidMode. + * @returns { KeyboardAvoidMode } The mode of keyboard avoid. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 11 + */ + getKeyboardAvoidMode(): KeyboardAvoidMode; + /** + * Get AtomicServiceBar. + * @returns { Nullable } The atomic service bar. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 11 + */ + getAtomicServiceBar(): Nullable; + /** + * Get DragController. + * @returns { DragController } the DragController + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 11 + */ + /** + * Get DragController. + * @returns { DragController } the DragController + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 12 + */ + getDragController(): DragController; + /** + * Get MeasureUtils. + * @returns { MeasureUtils } the MeasureUtils + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + getMeasureUtils(): MeasureUtils; + /** + * Defining keyframe animation function. + * + * @param { KeyframeAnimateParam } param - overall animation parameters + * @param { Array } keyframes - all keyframe states + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * Defining keyframe animation function. + * + * @param { KeyframeAnimateParam } param - overall animation parameters + * @param { Array } keyframes - all keyframe states + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + keyframeAnimateTo(param: KeyframeAnimateParam, keyframes: Array): void; + /** + * Get FocusController. + * @returns { FocusController } the FocusController + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 12 + */ + getFocusController(): FocusController; + /** + * Get FrameNode by id. + * + * @param { string } id - The id of FrameNode. + * @returns { FrameNode | null } The instance of FrameNode. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + getFrameNodeById(id: string): FrameNode | null; + /** + * Get FrameNode by uniqueId. + * + * @param { number } id - The uniqueId of the FrameNode. + * @returns { FrameNode | null } - The FrameNode with the target uniqueId, or null if the frameNode is not existed. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + getFrameNodeByUniqueId(id: number): FrameNode | null; + /** + * Get object cursor controller. + * + * @returns { CursorController } object cursor controller. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + getCursorController(): CursorController; + /** + * Get object context menu controller. + * + * @returns { ContextMenuController } object context menu controller. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + getContextMenuController(): ContextMenuController; + /** + * Get ComponentSnapshot. + * @returns { ComponentSnapshot } the ComponentSnapshot + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 12 + */ + getComponentSnapshot(): ComponentSnapshot; + /** + * Converts a value in vp units to a value in px. + * @param { number } value + * @returns { number } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 12 + */ + vp2px(value: number): number; + /** + * Converts a value in px units to a value in vp. + * @param { number } value + * @returns { number } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 12 + */ + px2vp(value: number): number; + /** + * Converts a value in fp units to a value in px. + * @param { number } value + * @returns { number } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 12 + */ + fp2px(value: number): number; + /** + * Converts a value in px units to a value in fp. + * @param { number } value + * @returns { number } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 12 + */ + px2fp(value: number): number; + /** + * Converts a value in lpx units to a value in px. + * @param { number } value + * @returns { number } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 12 + */ + lpx2px(value: number): number; + /** + * Converts a value in px units to a value in lpx. + * @param { number } value + * @returns { number } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 12 + */ + px2lpx(value: number): number; + /** + * Get current LocalStorage shared from stage. + * + * @returns { LocalStorage | undefined } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @stagemodelonly + * @crossplatform + * @atomicservice + * @since 12 + */ + getSharedLocalStorage(): LocalStorage | undefined; + /** + * Obtains context of the ability. + * + * @returns { Context | undefined } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @stagemodelonly + * @crossplatform + * @atomicservice + * @since 12 + */ + getHostContext(): Context | undefined; + /** + * Get the name of current window. + * + * @returns { string | undefined } The name of current window, or undefined if the window doesn't exist. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + getWindowName(): string | undefined; +} +/** + * Enum of KeyBoardAvoidMethodType + * + * @enum { number } KeyBoardAvoidMethodType + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 11 + */ +export const enum KeyboardAvoidMode { + /** + * Default Type, offset the whole page when keyBoard height changed. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 11 + */ + OFFSET = 0, + /** + * Resize Type, resize the page when keyBoard height changed. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 11 + */ + RESIZE = 1 +} diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.arkui.advanced.Chip.d.ets b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.arkui.advanced.Chip.d.ets new file mode 100755 index 00000000..a799e2cd --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.arkui.advanced.Chip.d.ets @@ -0,0 +1,614 @@ +/* +* Copyright (C) 2023 Huawei Device Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +/** + * @file + * @kit ArkUI + */ + +/// +import { ResourceStr } from 'GlobalResource'; +/** + * Enum for ChipSize + * + * @enum { string } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ +/** + * Enum for ChipSize + * + * @enum { string } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ +export declare enum ChipSize { + /** + * Normal type. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * Normal type. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + NORMAL = "NORMAL", + /** + * Small type. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * Small type. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + SMALL = "SMALL" +} +/** + * Defines the icon common option. + * + * @interface IconCommonOptions + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ +/** +* Defines the icon common option. +* +* @interface IconCommonOptions +* @syscap SystemCapability.ArkUI.ArkUI.Full +* @crossplatform +* @atomicservice +* @since 12 +*/ +export interface IconCommonOptions { + /** + * Image resource. + * + * @type { ResourceStr } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * Image resource. + * + * @type { ResourceStr } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + src: ResourceStr; + /** + * Image size option. + * + * @type { ?SizeOptions } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * Image size option. + * + * @type { ?SizeOptions } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + size?: SizeOptions; + /** + * Image filled color. + * + * @type { ?ResourceColor } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * Image filled color. + * + * @type { ?ResourceColor } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + fillColor?: ResourceColor; + /** + * Image filled color when chip is activated. + * + * @type { ?ResourceColor } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + */ + activatedFillColor?: ResourceColor; +} +/** + * Defines the suffix icon option. + * + * @interface SuffixIconOptions + * @extends IconCommonOptions + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ +/** +* Defines the suffix icon option. +* +* @interface SuffixIconOptions +* @extends IconCommonOptions +* @syscap SystemCapability.ArkUI.ArkUI.Full +* @crossplatform +* @atomicservice +* @since 12 +*/ +export interface SuffixIconOptions extends IconCommonOptions { + /** + * Called when the suffix icon is clicked. + * + * @type { ?function } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * Called when the suffix icon is clicked. + * + * @type { ?function } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + action?: () => void; +} +/** + * Defines the prefix icon option. + * + * @interface PrefixIconOptions + * @extends IconCommonOptions + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ +/** +* Defines the prefix icon option. +* +* @interface PrefixIconOptions +* @extends IconCommonOptions +* @syscap SystemCapability.ArkUI.ArkUI.Full +* @crossplatform +* @atomicservice +* @since 12 +*/ +export interface PrefixIconOptions extends IconCommonOptions { +} +/** + * Defines label margin. + * + * @interface LabelMarginOptions + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ +/** +* Defines label margin. +* +* @interface LabelMarginOptions +* @syscap SystemCapability.ArkUI.ArkUI.Full +* @crossplatform +* @atomicservice +* @since 12 +*/ +export interface LabelMarginOptions { + /** + * Left label margin length. + * + * @type { ?Dimension } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * Left label margin length. + * + * @type { ?Dimension } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + left?: Dimension; + /** + * Right label margin length. + * + * @type { ?Dimension } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * Right label margin length. + * + * @type { ?Dimension } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + right?: Dimension; +} +/** + * Defines label option. + * + * @interface LabelOptions + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ +/** +* Defines label option. +* +* @interface LabelOptions +* @syscap SystemCapability.ArkUI.ArkUI.Full +* @crossplatform +* @atomicservice +* @since 12 +*/ +export interface LabelOptions { + /** + * Text content. + * + * @type { string } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * Text content. + * + * @type { string } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + text: string; + /** + * Text font size. + * + * @type { ?Dimension } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * Text font size. + * + * @type { ?Dimension } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + fontSize?: Dimension; + /** + * Text font color. + * + * @type { ?ResourceColor } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * Text font color. + * + * @type { ?ResourceColor } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + fontColor?: ResourceColor; + /** + * Text font color when chip is activated. + * + * @type { ?ResourceColor } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + */ + activatedFontColor?: ResourceColor; + /** + * Text font family. + * + * @type { ?string } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * Text font family. + * + * @type { ?string } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + fontFamily?: string; + /** + * Label margin. + * + * @type { ?LabelMarginOptions } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * Label margin. + * + * @type { ?LabelMarginOptions } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + labelMargin?: LabelMarginOptions; +} +/** + * Defines chip options. + * + * @interface ChipOptions + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ +/** +* Defines chip options. +* +* @interface ChipOptions +* @syscap SystemCapability.ArkUI.ArkUI.Full +* @crossplatform +* @atomicservice +* @since 12 +*/ +export interface ChipOptions { + /** + * Chip prefix icon. + * + * @type { ?PrefixIconOptions } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * Chip prefix icon. + * + * @type { ?PrefixIconOptions } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + prefixIcon?: PrefixIconOptions; + /** + * Chip label. + * + * @type { LabelOptions } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * Chip label. + * + * @type { LabelOptions } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + label: LabelOptions; + /** + * Chip suffix icon. + * + * @type { ?SuffixIconOptions } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * Chip suffix icon. + * + * @type { ?SuffixIconOptions } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + suffixIcon?: SuffixIconOptions; + /** + * Show close icon. + * + * @type { ?boolean } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * Show close icon. + * + * @type { ?boolean } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + allowClose?: boolean; + /** + * Enable chip. + * + * @type { ?boolean } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * Enable chip. + * + * @type { ?boolean } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + enabled?: boolean; + /** + * Set whether chip is active or not. + * + * @type { ?boolean } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + */ + activated?: boolean; + /** + * Chip background color. + * + * @type { ?ResourceColor } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * Chip background color. + * + * @type { ?ResourceColor } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + backgroundColor?: ResourceColor; + /** + * Chip background color when chip is activated. + * + * @type { ?ResourceColor } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + */ + activatedBackgroundColor?: ResourceColor; + /** + * Chip radius. + * + * @type { ?Dimension } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * Chip radius. + * + * @type { ?Dimension } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + borderRadius?: Dimension; + /** + * Chip size. + * + * @type { ?ChipSize | SizeOptions } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * Chip size. + * + * @type { ?ChipSize | SizeOptions } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + size?: ChipSize | SizeOptions; + /** + * On close action. + * + * @type { ?function } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * On close action. + * + * @type { ?function } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + onClose?: () => void; + /** + * On clicked action. + * + * @type { ?Callback } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + */ + onClicked?: Callback; +} +/** + * Build function of Chip. + * + * @param { ChipOptions } options - chip option. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ +/** +* Build function of Chip. +* +* @param { ChipOptions } options - chip option. +* @syscap SystemCapability.ArkUI.ArkUI.Full +* @crossplatform +* @atomicservice +* @since 12 +*/ +@Builder +export declare function Chip(options: ChipOptions): void; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.arkui.advanced.ChipGroup.d.ets b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.arkui.advanced.ChipGroup.d.ets new file mode 100755 index 00000000..8e6ce909 --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.arkui.advanced.ChipGroup.d.ets @@ -0,0 +1,336 @@ +/* +* Copyright (C) 2024 Huawei Device Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +/** + * @file + * @kit ArkUI + */ + +/// +import { ResourceStr } from 'GlobalResource'; +import { ChipSize } from '@ohos.arkui.advanced.Chip'; +/** + * Defines icon options. + * + * @interface IconOptions + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + */ +export interface IconOptions { + /** + * Image resource. + * + * @type { ResourceStr } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + */ + src: ResourceStr; + /** + * Image size option. + * + * @type { ?SizeOptions } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + */ + size?: SizeOptions; +} +/** + * Defines label options. + * + * @interface LabelOptions + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + */ +export interface LabelOptions { + /** + * Text content. + * + * @type { string } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + */ + text: string; +} +/** + * Defines chipItem options. + * + * @interface ChipGroupItemOptions + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + */ +export interface ChipGroupItemOptions { + /** + * Prefix icon. + * + * @type { ?IconOptions } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + */ + prefixIcon?: IconOptions; + /** + * Chip label. + * + * @type { LabelOptions } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + */ + label: LabelOptions; + /** + * Suffix icon. + * + * @type { ?IconOptions } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + */ + suffixIcon?: IconOptions; + /** + * Allow close. + * + * @type { ?boolean } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + */ + allowClose?: boolean; +} +/** + * Defines ChipItemStyle. + * + * @interface ChipItemStyle + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + */ +export interface ChipItemStyle { + /** + * Chip size. + * + * @type { ?(ChipSize | SizeOptions) } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + */ + size?: ChipSize | SizeOptions; + /** + * ChipItem background color. + * + * @type { ?ResourceColor } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + */ + backgroundColor?: ResourceColor; + /** + * Text font color. + * + * @type { ?ResourceColor } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + */ + fontColor?: ResourceColor; + /** + * Selected Text font color. + * + * @type { ?ResourceColor } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + */ + selectedFontColor?: ResourceColor; + /** + * Selected chip item background color. + * + * @type { ?ResourceColor } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + */ + selectedBackgroundColor?: ResourceColor; +} +/** + * Defines chip group space. + * + * @interface ChipGroupSpaceOptions + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + */ +export interface ChipGroupSpaceOptions { + /** + * Space between items. + * + * @type { ?(string | number) } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + */ + itemSpace?: string | number; + /** + * Start space. + * + * @type { ?Length } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + */ + startSpace?: Length; + /** + * End space. + * + * @type { ?Length } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + */ + endSpace?: Length; +} +/** + * Defines IconItemOptions. + * + * @interface IconItemOptions + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + */ +export interface IconItemOptions { + /** + * IconItemOptions. + * + * @type { IconOptions } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + */ + icon: IconOptions; + /** + * Icon Action. + * + * @type { Callback } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + */ + action: Callback; +} +/** + * Defines IconGroupSuffix. + * + * @interface IconGroupSuffix + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + */ +@Component +export declare struct IconGroupSuffix { + /** + * Suffix item. + * + * @type { Array } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + */ + @Prop + items: Array; +} +/** + * Defines chipGroup. + * + * @struct ChipGroup + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + */ +@Component +export declare struct ChipGroup { + /** + * Chip item. + * + * @type { ChipGroupItemOptions[] } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + */ + @Prop + items: ChipGroupItemOptions[]; + /** + * Chip item style. + * + * @type { ?ChipItemStyle } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + */ + @Prop + itemStyle?: ChipItemStyle; + /** + * Default selected chip item indexes. + * + * @type { ?Array } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + */ + @Prop + selectedIndexes?: Array; + /** + * Support multiple chip item selection. + * + * @type { ?boolean } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + */ + @Prop + multiple?: boolean; + /** + * Chip group space. + * + * @type { ?ChipGroupSpaceOptions } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + */ + @Prop + chipGroupSpace?: ChipGroupSpaceOptions; + /** + * Chip group callback. when chip status is changed, this onChange is called. + * + * @type { ?Callback> } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + */ + onChange?: Callback>; + /** + * The builder function which will be rendered in the suffix of ChipGroup. + * + * @type { ?Callback } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + */ + @BuilderParam + suffix?: Callback; +} diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.arkui.advanced.ComposeListItem.d.ets b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.arkui.advanced.ComposeListItem.d.ets new file mode 100755 index 00000000..75810a55 --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.arkui.advanced.ComposeListItem.d.ets @@ -0,0 +1,507 @@ +/* +* Copyright (C) 2023-2023 Huawei Device Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +/** + * @file + * @kit ArkUI + */ + +/// +import { ResourceStr } from 'GlobalResource'; +/** + * Declare enum IconType + * @enum { IconType } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ +/** + * Declare enum IconType + * @enum { IconType } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ +export declare enum IconType { + /** + * Badge type. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * Badge type. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + BADGE = 1, + /** + * Normal icon type. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * Normal icon type. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + NORMAL_ICON = 2, + /** + * System icon type. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * System icon type. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + SYSTEM_ICON = 3, + /** + * HeadSculpture type. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * HeadSculpture type. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + HEAD_SCULPTURE = 4, + /** + * App icon type. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * App icon type. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + APP_ICON = 5, + /** + * Preview type. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * Preview type. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + PREVIEW = 6, + /** + * Longitudinal type. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * Longitudinal type. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + LONGITUDINAL = 7, + /** + * Vertical type. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * Vertical type. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + VERTICAL = 8 +} +/** + * Declare type OperateIcon + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ +/** + * Declare type OperateIcon + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ +export declare class OperateIcon { + /** + * The content of text or the address of icon. + * @type { ResourceStr }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * The content of text or the address of icon. + * @type { ResourceStr }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + value: ResourceStr; + /** + * Callback function when operate the icon. + * @type { ?() => void }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * Callback function when operate the icon. + * @type { ?() => void }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + action?: () => void; +} +/** + * Declare type OperateCheck + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ +/** + * Declare type OperateCheck + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ +export declare class OperateCheck { + /** + * Whether is checked on default. + * @type { ?boolean }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * Whether is checked on default. + * @type { ?boolean }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + isCheck?: boolean; + /** + * Callback function when operate the checkbox/switch/radio. + * @type { ?() => void }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * Callback function when operate the checkbox/switch/radio. + * @type { ?() => void }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + onChange?: (value: boolean) => void; +} +/** + * Declare type OperateButton + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ +/** + * Declare type OperateButton + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ +export declare class OperateButton { + /** + * The text on the button. + * @type { ?ResourceStr }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * The text on the button. + * @type { ?ResourceStr }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + text?: ResourceStr; +} +/** + * Declare ContentItem + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ +/** + * Declare ContentItem + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ +export declare class ContentItem { + /** + * The type of icon. + * @type { ?IconType } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * The type of icon. + * @type { ?IconType } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + iconStyle?: IconType; + /** + * Sets the icon. + * @type { ?ResourceStr } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * Sets the icon. + * @type { ?ResourceStr } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + icon?: ResourceStr; + /** + * Sets the primaryText. + * @type { ?ResourceStr } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * Sets the primaryText. + * @type { ?ResourceStr } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + primaryText?: ResourceStr; + /** + * Sets the secondaryText. + * @type { ?ResourceStr } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * Sets the secondaryText. + * @type { ?ResourceStr } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + secondaryText?: ResourceStr; + /** + * Sets the description. + * @type { ?ResourceStr } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * Sets the description. + * @type { ?ResourceStr } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + description?: ResourceStr; +} +/** + * Declare OperateItem + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ +/** + * Declare OperateItem + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ +export declare class OperateItem { + /** + * Sets the icon. + * @type { ?OperateIcon } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * Sets the icon. + * @type { ?OperateIcon } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + icon?: OperateIcon; + /** + * Sets the subIcon. + * @type { ?OperateIcon } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * Sets the subIcon. + * @type { ?OperateIcon } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + subIcon?: OperateIcon; + /** + * Sets the button. + * @type { ?OperateButton } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * Sets the button. + * @type { ?OperateButton } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + button?: OperateButton; + /** + * Sets the switch. + * @type { ?OperateCheck } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * Sets the switch. + * @type { ?OperateCheck } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + switch?: OperateCheck; + /** + * Sets the checkBox. + * @type { ?OperateCheck } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * Sets the checkBox. + * @type { ?OperateCheck } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + checkbox?: OperateCheck; + /** + * Sets the radio. + * @type { ?OperateCheck } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * Sets the radio. + * @type { ?OperateCheck } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + radio?: OperateCheck; + /** + * Sets the image. + * @type { ?ResourceStr } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * Sets the image. + * @type { ?ResourceStr } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + image?: ResourceStr; + /** + * Sets the text. + * @type { ?ResourceStr } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * Sets the text. + * @type { ?ResourceStr } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + text?: ResourceStr; + /** + * Sets the arrow. + * @type { ?ResourceStr } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * Sets the arrow. + * @type { ?ResourceStr } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + arrow?: OperateIcon; +} +/** + * Declare ComposeListItem + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ +/** + * Declare ComposeListItem + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ +@Component +export declare struct ComposeListItem { + /** + * The ContentItem. + * @type { ?ContentItem } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * The ContentItem. + * @type { ?ContentItem } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + @Prop + contentItem?: ContentItem; + /** + * The OperateItem. + * @type { ?OperateItem } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * The OperateItem. + * @type { ?OperateItem } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + @Prop + operateItem?: OperateItem; +} diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.arkui.advanced.ComposeTitleBar.d.ets b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.arkui.advanced.ComposeTitleBar.d.ets new file mode 100755 index 00000000..d48175a9 --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.arkui.advanced.ComposeTitleBar.d.ets @@ -0,0 +1,146 @@ +/* + * Copyright (c) 2023-2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit ArkUI + */ + +/// +import { ResourceStr } from 'GlobalResource'; +/** + * Declaration of the menu item on the right side. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ +/** + * Declaration of the menu item on the right side. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ +export declare class ComposeTitleBarMenuItem { + /** + * Icon resource for this menu item. + * @type { ResourceStr }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * Icon resource for this menu item. + * @type { ResourceStr }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + value: ResourceStr; + /** + * Whether to enable this menu item. + * @type { ?boolean }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * Whether to enable this menu item. + * @type { ?boolean }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + isEnabled?: boolean; + /** + * Callback function when click on this menu item. + * @type { ?() => void }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * Callback function when click on this menu item. + * @type { ?() => void }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + action?: () => void; +} +/** + * Declaration of the composable title bar. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ +/** + * Declaration of the composable title bar. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ +@Component +export declare struct ComposeTitleBar { + /** + * Avatar resource and event callback of this title bar. + * @type { ?ComposeTitleBarMenuItem }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * Avatar resource and event callback of this title bar. + * @type { ?ComposeTitleBarMenuItem }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + item?: ComposeTitleBarMenuItem; + /** + * Title of this title bar. + * @type { ResourceStr }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * Title of this title bar. + * @type { ResourceStr }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + title: ResourceStr; + /** + * Sub-title of this title bar. + * @type { ?ResourceStr }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * Sub-title of this title bar. + * @type { ?ResourceStr }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + subtitle?: ResourceStr; + /** + * Menu items on the right side. + * @type { ?Array }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * Menu items on the right side. + * @type { ?Array }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + menuItems?: Array; +} diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.arkui.advanced.Counter.d.ets b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.arkui.advanced.Counter.d.ets new file mode 100755 index 00000000..1edafb99 --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.arkui.advanced.Counter.d.ets @@ -0,0 +1,739 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit ArkUI + */ +/** + * Enum for the counter type. + * + * @enum { number } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ +/** +* Enum for the counter type. +* +* @enum { number } +* @syscap SystemCapability.ArkUI.ArkUI.Full +* @crossplatform +* @atomicservice +* @since 12 +*/ +declare enum CounterType { + /** + * List counter. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * List counter. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + LIST = 0, + /** + * Compact counter. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * Compact counter. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + COMPACT = 1, + /** + * Inline counter. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * Inline counter. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + INLINE = 2, + /** + * Date inline counter. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * Date inline counter. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + INLINE_DATE = 3 +} +/** + * Defines the common options. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ +/** +* Defines the common options. +* +* @syscap SystemCapability.ArkUI.ArkUI.Full +* @crossplatform +* @atomicservice +* @since 12 +*/ +declare class CommonOptions { + /** + * Set the focusable of the counter component. + * @type { ?boolean } + * @default true + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * Set the focusable of the counter component. + * @type { ?boolean } + * @default true + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + focusable?: boolean; + /** + * Set the step of the couter component, ranges greater than or equal to 1 + * + * @type { ?number } + * @default 1 + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * Set the step of the couter component, ranges greater than or equal to 1 + * + * @type { ?number } + * @default 1 + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + step?: number; + /** + * Trigger a mouse hover event at the increased button. + * + * @type { ?function } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * Trigger a mouse hover event at the increased button. + * + * @type { ?function } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + onHoverIncrease?: (isHover: boolean) => void; + /** + * Trigger a mouse hover event at the decreased button. + * + * @type { ?function } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * Trigger a mouse hover event at the decreased button. + * + * @type { ?function } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + onHoverDecrease?: (isHover: boolean) => void; +} +/** + * Defines the inline style options. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ +/** +* Defines the inline style options. +* +* @syscap SystemCapability.ArkUI.ArkUI.Full +* @crossplatform +* @atomicservice +* @since 12 +*/ +declare class InlineStyleOptions extends CommonOptions { + /** + * Set initial value of the counter component, ranges from min to max. + * + * @type { ?number } + * @default 0 + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * Set initial value of the counter component, ranges from min to max. + * + * @type { ?number } + * @default 0 + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + value?: number; + /** + * Set minimum value of the counter component + * + * @type { ?number } + * @default 0 + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * Set minimum value of the counter component + * + * @type { ?number } + * @default 0 + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + min?: number; + /** + * Set maximum value of the counter component + * + * @type { ?number } + * @default 999 + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * Set maximum value of the counter component + * + * @type { ?number } + * @default 999 + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + max?: number; + /** + * Set text width of the counter component, ranges greater than or equal to 0 + * + * @type { ?number } + * @default 0 + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * Set text width of the counter component, ranges greater than or equal to 0 + * + * @type { ?number } + * @default 0 + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + textWidth?: number; + /** + * Trigger a event when the value of the counter has been changed. + * + * @type { ?function } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * Trigger a event when the value of the counter has been changed. + * + * @type { ?function } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + onChange?: (value: number) => void; +} +/** + * Defines the number style options. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ +/** +* Defines the number style options. +* +* @syscap SystemCapability.ArkUI.ArkUI.Full +* @crossplatform +* @atomicservice +* @since 12 +*/ +declare class NumberStyleOptions extends InlineStyleOptions { + /** + * Set the label of the counter component. + * + * @type { ?ResourceStr } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * Set the label of the counter component. + * + * @type { ?ResourceStr } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + label?: ResourceStr; + /** + * Trigger a event when the increased button got focus. + * + * @type { ?function } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * Trigger a event when the increased button got focus. + * + * @type { ?function } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + onFocusIncrease?: () => void; + /** + * Trigger a event when the decreased button got focus. + * + * @type { ?function } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * Trigger a event when the decreased button got focus. + * + * @type { ?function } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + onFocusDecrease?: () => void; + /** + * Trigger a event when the increased button lose focus. + * + * @type { ?function } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * Trigger a event when the increased button lose focus. + * + * @type { ?function } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + onBlurIncrease?: () => void; + /** + * Trigger a event when the decreased button lose focus. + * + * @type { ?function } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * Trigger a event when the decreased button lose focus. + * + * @type { ?function } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + onBlurDecrease?: () => void; +} +/** + * Defines the date data. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ +/** +* Defines the date data. +* +* @syscap SystemCapability.ArkUI.ArkUI.Full +* @crossplatform +* @atomicservice +* @since 12 +*/ +declare class DateData { + /** + * The year of the DateData, ranges from 1 to 5000. + * + * @type { number } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * The year of the DateData, ranges from 1 to 5000. + * + * @type { number } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + year: number; + /** + * The month of the DateData. + * + * @type { number } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * The month of the DateData. + * + * @type { number } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + month: number; + /** + * The day of the DateData. + * + * @type { number } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * The day of the DateData. + * + * @type { number } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + day: number; + /** + * Constructor of the DateData. + * + * @param { number } year - set the year of the DateData. + * @param { number } month - set the month of the DateData. + * @param { number } day - set the day of the DateData. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * Constructor of the DateData. + * + * @param { number } year - set the year of the DateData. + * @param { number } month - set the month of the DateData. + * @param { number } day - set the day of the DateData. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + constructor(year: number, month: number, day: number); + /** + * Convert the date data to string. + * + * @returns { string } date data in string form. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * Convert the date data to string. + * + * @returns { string } date data in string form. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + toString(): string; +} +/** + * Defines the date style options. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ +/** +* Defines the date style options. +* +* @syscap SystemCapability.ArkUI.ArkUI.Full +* @crossplatform +* @atomicservice +* @since 12 +*/ +declare class DateStyleOptions extends CommonOptions { + /** + * Set the year of the counter component, ranges from 1 to 5000. + * + * @type { ?number } + * @default 1 + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * Set the year of the counter component, ranges from 1 to 5000. + * + * @type { ?number } + * @default 1 + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + year?: number; + /** + * Set the month of the counter component. + * + * @type { ?number } + * @default 1 + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * Set the month of the counter component. + * + * @type { ?number } + * @default 1 + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + month?: number; + /** + * Set the day of the counter component. + * + * @type { ?number } + * @default 1 + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * Set the day of the counter component. + * + * @type { ?number } + * @default 1 + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + day?: number; + /** + * Trigger a event when the date of the counter has been changed. + * + * @type { ?function } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * Trigger a event when the date of the counter has been changed. + * + * @type { ?function } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + onDateChange?: (date: DateData) => void; +} +/** + * Defines the counter options. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ +/** +* Defines the counter options. +* +* @syscap SystemCapability.ArkUI.ArkUI.Full +* @crossplatform +* @atomicservice +* @since 12 +*/ +declare class CounterOptions { + /** + * Set the type of the counter component. + * + * @type { CounterType } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * Set the type of the counter component. + * + * @type { CounterType } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + type: CounterType; + /** + * Set the counter attribute of the LIST or COMPACT counter component. + * + * @type { ?NumberStyleOptions } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * Set the counter attribute of the LIST or COMPACT counter component. + * + * @type { ?NumberStyleOptions } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + numberOptions?: NumberStyleOptions; + /** + * Set the counter attribute of the INLINE counter component. + * + * @type { ?InlineStyleOptions } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * Set the counter attribute of the INLINE counter component. + * + * @type { ?InlineStyleOptions } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + inlineOptions?: InlineStyleOptions; + /** + * Set the counter attribute of the INLINE_DATE counter component. + * + * @type { ?DateStyleOptions } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * Set the counter attribute of the INLINE_DATE counter component. + * + * @type { ?DateStyleOptions } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + dateOptions?: DateStyleOptions; +} +/** + * Defines Counter Component. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ +/** +* Defines Counter Component. +* +* @syscap SystemCapability.ArkUI.ArkUI.Full +* @crossplatform +* @atomicservice +* @since 12 +*/ +@Component +declare struct CounterComponent { + /** + * The options of a counter component. + * + * @type { CounterOptions } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * The options of a counter component. + * + * @type { CounterOptions } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + @Prop + options: CounterOptions; +} +export { CounterComponent, CounterOptions, DateData, CounterType }; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.arkui.advanced.Dialog.d.ets b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.arkui.advanced.Dialog.d.ets new file mode 100755 index 00000000..5e484c88 --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.arkui.advanced.Dialog.d.ets @@ -0,0 +1,728 @@ +/* +* Copyright (C) 2023-2024 Huawei Device Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +/** + * @file + * @kit ArkUI + */ + +/// +import { ResourceStr } from 'GlobalResource'; +import { Theme, CustomTheme } from '@ohos.arkui.theme'; +/** + * Declare ButtonOptions + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ +/** + * Declare ButtonOptions + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ +export declare class ButtonOptions { + /** + * Sets the Display Content of a Button. + * @type { ResourceStr }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * Sets the Display Content of a Button. + * @type { ResourceStr }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + value: ResourceStr; + /** + * Sets the Button Callback. + * @type { ?() => void }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * Sets the Button Callback. + * @type { ?() => void }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + action?: () => void; + /** + * Sets the background color of a button. + * @type { ?ResourceStr }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * Sets the background color of a button. + * @type { ?ResourceStr }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + background?: ResourceColor; + /** + * Sets the Button Text Color. + * @type { ?ResourceStr }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * Sets the Button Text Color. + * @type { ?ResourceStr }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + fontColor?: ResourceColor; + /** + * Describes the Button style. + * @type { ?ButtonStyleMode } + * @default ButtonStyleMode.TEXTUAL + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + */ + buttonStyle?: ButtonStyleMode; + /** + * Describes the Button role. + * @type { ?ButtonRole } + * @default ButtonRole.NORMAL + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + */ + role?: ButtonRole; +} +/** + * Declare CustomDialog TipsDialog + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ +/** + * Declare CustomDialog TipsDialog + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ +@CustomDialog +export declare struct TipsDialog { + /** + * Sets the TipsDialog Controller. + * @type { CustomDialogController }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * Sets the TipsDialog Controller. + * @type { CustomDialogController }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + controller: CustomDialogController; + /** + * Sets the TipsDialog imageRes. + * @type { Resource }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * Sets the TipsDialog imageRes. + * @type { Resource }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + imageRes: Resource; + /** + * Sets the TipsDialog image size. + * @type { SizeOptions }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * Sets the TipsDialog image size. + * @type { SizeOptions }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + /** + * Sets the TipsDialog image size. + * @type { ?SizeOptions }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 12 + */ + imageSize?: SizeOptions; + /** + * Sets the TipsDialog title. + * @type { ResourceStr }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * Sets the TipsDialog title. + * @type { ResourceStr }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + /** + * Sets the TipsDialog title. + * @type { ?ResourceStr }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 12 + */ + title?: ResourceStr; + /** + * Sets the TipsDialog content. + * @type { ?ResourceStr }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * Sets the TipsDialog content. + * @type { ?ResourceStr }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + content?: ResourceStr; + /** + * Sets the TipsDialog checkbox tips. + * @type { ?ResourceStr }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * Sets the TipsDialog checkbox tips. + * @type { ?ResourceStr }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + checkTips?: ResourceStr; + /** + * Sets the TipsDialog checkbox check state. + * @type { ?boolean }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * Sets the TipsDialog checkbox check state. + * @type { ?boolean }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + @Prop + isChecked?: boolean; + /** + * Sets the TipsDialog CheckBox Callback. + * @type { ?(isChecked: boolean) => void }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 12 + */ + checkAction?: (isChecked: boolean) => void; + /** + * Sets the TipsDialog primary button. + * @type { ?ButtonOptions }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * Sets the TipsDialog primary button. + * @type { ?ButtonOptions }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + primaryButton?: ButtonOptions; + /** + * Sets the TipsDialog secondary button. + * @type { ?ButtonOptions }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * Sets the TipsDialog secondary button. + * @type { ?ButtonOptions }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + secondaryButton?: ButtonOptions; + /** + * Custom Theme. + * + * @type { ?(Theme | CustomTheme) } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + theme?: Theme | CustomTheme; +} +/** + * Declare CustomDialog SelectDialog + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ +/** + * Declare CustomDialog SelectDialog + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ +@CustomDialog +export declare struct SelectDialog { + /** + * Sets the SelectDialog Controller. + * @type { CustomDialogController }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * Sets the SelectDialog Controller. + * @type { CustomDialogController }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + controller: CustomDialogController; + /** + * Sets the SelectDialog title. + * @type { ResourceStr }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * Sets the SelectDialog title. + * @type { ResourceStr }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + title: ResourceStr; + /** + * Sets the SelectDialog content. + * @type { ?ResourceStr }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * Sets the SelectDialog content. + * @type { ?ResourceStr }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + content?: ResourceStr; + /** + * Sets the SelectDialog selected index. + * @type { ?number }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * Sets the SelectDialog selected index. + * @type { ?number }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + selectedIndex?: number; + /** + * Sets the SelectDialog confirm button. + * @type { ?ButtonOptions }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * Sets the SelectDialog confirm button. + * @type { ?ButtonOptions }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + confirm?: ButtonOptions; + /** + * Sets the SelectDialog sheets. + * @type { Array }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * Sets the SelectDialog sheets. + * @type { Array }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + radioContent: Array; + /** + * Custom Theme. + * + * @type { ?(Theme | CustomTheme) } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + theme?: Theme | CustomTheme; +} +/** + * Declare CustomDialog ConfirmDialog + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ +/** + * Declare CustomDialog ConfirmDialog + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ +@CustomDialog +export declare struct ConfirmDialog { + /** + * Sets the ConfirmDialog Controller. + * @type { CustomDialogController }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * Sets the ConfirmDialog Controller. + * @type { CustomDialogController }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + controller: CustomDialogController; + /** + * Sets the ConfirmDialog title. + * @type { ResourceStr }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * Sets the ConfirmDialog title. + * @type { ResourceStr }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + title: ResourceStr; + /** + * Sets the ConfirmDialog content. + * @type { ?ResourceStr }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * Sets the ConfirmDialog content. + * @type { ?ResourceStr }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + content?: ResourceStr; + /** + * Sets the ConfirmDialog checkbox tips. + * @type { ?ResourceStr }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * Sets the ConfirmDialog checkbox tips. + * @type { ?ResourceStr }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + checkTips?: ResourceStr; + /** + * Sets the ConfirmDialog checkbox state. + * @type { ?boolean }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * Sets the ConfirmDialog checkbox state. + * @type { ?boolean }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + @Prop + isChecked?: boolean; + /** + * Sets the ConfirmDialog primary button. + * @type { ?ButtonOptions }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * Sets the ConfirmDialog primary button. + * @type { ?ButtonOptions }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + primaryButton?: ButtonOptions; + /** + * Sets the ConfirmDialog secondary button. + * @type { ?ButtonOptions }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * Sets the ConfirmDialog secondary button. + * @type { ?ButtonOptions }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + secondaryButton?: ButtonOptions; + /** + * Custom Theme. + * + * @type { ?(Theme | CustomTheme) } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + theme?: Theme | CustomTheme; +} +/** + * Declare CustomDialog AlertDialog + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ +/** + * Declare CustomDialog AlertDialog + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ +@CustomDialog +export declare struct AlertDialog { + /** + * Sets the AlertDialog Controller. + * @type { CustomDialogController }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * Sets the AlertDialog Controller. + * @type { CustomDialogController }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + controller: CustomDialogController; + /** + * Sets the AlertDialog title. + * @type { ?ResourceStr } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + */ + primaryTitle?: ResourceStr; + /** + * Sets the AlertDialog secondary title. + * @type { ?ResourceStr } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + */ + secondaryTitle?: ResourceStr; + /** + * Sets the AlertDialog content. + * @type { ResourceStr }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * Sets the AlertDialog content. + * @type { ResourceStr }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + content: ResourceStr; + /** + * Sets the AlertDialog primary button. + * @type { ?ButtonOptions }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * Sets the AlertDialog primary button. + * @type { ?ButtonOptions }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + primaryButton?: ButtonOptions; + /** + * Sets the AlertDialog secondary button. + * @type { ?ButtonOptions }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * Sets the AlertDialog secondary button. + * @type { ?ButtonOptions }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + secondaryButton?: ButtonOptions; + /** + * Custom Theme. + * + * @type { ?(Theme | CustomTheme) } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + theme?: Theme | CustomTheme; +} +/** + * Declare CustomDialog LoadingDialog + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ +/** + * Declare CustomDialog LoadingDialog + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ +@CustomDialog +export declare struct LoadingDialog { + /** + * Sets the LoadingDialog Controller. + * @type { CustomDialogController }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * Sets the LoadingDialog Controller. + * @type { CustomDialogController }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + Controller: CustomDialogController; + /** + * Sets the LoadingDialog content. + * @type { ?ResourceStr }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * Sets the LoadingDialog content. + * @type { ?ResourceStr }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + content?: ResourceStr; + /** + * Custom Theme. + * + * @type { ?(Theme | CustomTheme) } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + theme?: Theme | CustomTheme; +} +/** + * Declare custom content dialog + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + */ +@CustomDialog +export declare struct CustomContentDialog { + /** + * Sets the CustomContentDialog Controller. + * @type { CustomDialogController }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + */ + controller: CustomDialogController; + /** + * Sets the CustomContentDialog title. + * @type { ?ResourceStr } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + */ + primaryTitle?: ResourceStr; + /** + * Sets the CustomContentDialog secondary title. + * @type { ?ResourceStr } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + */ + secondaryTitle?: ResourceStr; + /** + * Sets the CustomContentDialog content. + * @type { () => void } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + */ + @BuilderParam + contentBuilder: () => void; + /** + * Sets the CustomContentDialog content area padding. + * @type { ?Padding } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + */ + contentAreaPadding?: Padding; + /** + * Sets the CustomContentDialog buttons. + * @type { ?ButtonOptions[] } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + */ + buttons?: ButtonOptions[]; + /** + * Custom Theme. + * + * @type { ?(Theme | CustomTheme) } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + theme?: Theme | CustomTheme; +} diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.arkui.advanced.DownloadFileButton.d.ets b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.arkui.advanced.DownloadFileButton.d.ets new file mode 100755 index 00000000..1b1a1db0 --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.arkui.advanced.DownloadFileButton.d.ets @@ -0,0 +1,324 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit ArkUI + */ +/** + * Enum for DownloadIconStyle + * + * @enum { number } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ +export declare enum DownloadIconStyle { + /** + * FULL_FILLED type. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + FULL_FILLED = 1, + /** + * LINES type. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + LINES = 2 +} +/** + * Enum for DownloadDescription + * + * @enum { number } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ +export declare enum DownloadDescription { + /** + * Description is DOWNLOAD. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + DOWNLOAD = 1, + /** + * Description is DOWNLOAD_FILE. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + DOWNLOAD_FILE = 2, + /** + * Description is SAVE. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + SAVE = 3, + /** + * Description is SAVE_IMAGE. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + SAVE_IMAGE = 4, + /** + * Description is SAVE_FILE. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + SAVE_FILE = 5, + /** + * Description is DOWNLOAD_AND_SHARE. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + DOWNLOAD_AND_SHARE = 6, + /** + * Description is RECEIVE. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + RECEIVE = 7, + /** + * Description is CONTINUE_TO_RECEIVE. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + CONTINUE_TO_RECEIVE = 8 +} +/** + * Enum for DownloadDescription + * + * @enum { number } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ +export declare enum DownloadLayoutDirection { + /** + * Layout direction is HORIZONTAL. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + HORIZONTAL = 0, + /** + * Layout direction is VERTICAL. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + VERTICAL = 1 +} +/** + * Defines the download content options. + * + * @interface DownloadContentOptions + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ +export interface DownloadContentOptions { + /** + * DownloadFileButton icon Style. + * + * @type { ?DownloadIconStyle } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + icon?: DownloadIconStyle; + /** + * DownloadFileButton description. + * + * @type { ?DownloadDescription } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + text?: DownloadDescription; +} +/** + * Defines the DownloadFileButton style option. + * + * @interface DownloadStyleOptions + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ +export interface DownloadStyleOptions { + /** + * Icon size. + * + * @type { ?Dimension } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + iconSize?: Dimension; + /** + * Layout direction. + * + * @type { ?DownloadLayoutDirection } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + layoutDirection?: DownloadLayoutDirection; + /** + * Font size. + * + * @type { ?Dimension } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + fontSize?: Dimension; + /** + * Font Style. + * + * @type { ?FontStyle } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + fontStyle?: FontStyle; + /** + * Font weight. + * + * @type { ?(number | FontWeight | string) } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + fontWeight?: number | FontWeight | string; + /** + * Font family. + * + * @type { ?(string | Resource) } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + fontFamily?: string | Resource; + /** + * Font color. + * + * @type { ?ResourceColor } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + fontColor?: ResourceColor; + /** + * Icon color. + * + * @type { ?ResourceColor } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + iconColor?: ResourceColor; + /** + * Text and Icon space. + * + * @type { ?Dimension } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + textIconSpace?: Dimension; +} +/** + * Declare Component DownloadFileButton + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ +@Component +export declare struct DownloadFileButton { + /** + * Set DownloadFileButton Content. + * + * @type { DownloadContentOptions }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + @State + contentOptions: DownloadContentOptions; + /** + * Set DownloadFileButton Style. + * + * @type { DownloadStyleOptions }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + @State + styleOptions: DownloadStyleOptions; +} diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.arkui.advanced.EditableTitleBar.d.ets b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.arkui.advanced.EditableTitleBar.d.ets new file mode 100755 index 00000000..07907c7b --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.arkui.advanced.EditableTitleBar.d.ets @@ -0,0 +1,286 @@ +/* + * Copyright (c) 2023-2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit ArkUI + */ + +/// +import { ResourceStr } from 'GlobalResource'; +/** + * Declaration of the menu item on the right side. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ +/** + * Declaration of the menu item on the right side. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ +export declare class EditableTitleBarMenuItem { + /** + * Icon resource for this menu item. + * @type { ResourceStr }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * Icon resource for this menu item. + * @type { ResourceStr }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + value: ResourceStr; + /** + * Whether to enable this menu item. + * @type { ?boolean }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * Whether to enable this menu item. + * @type { ?boolean }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + isEnabled?: boolean; + /** + * Callback function when click on this menu item. + * @type { ?() => void }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * Callback function when click on this menu item. + * @type { ?() => void }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + action?: () => void; +} +/** + * Declaration of the image item . + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + */ +export type EditableTitleBarItem = EditableTitleBarMenuItem; +/** + * Declaration of the left icon type. + * @enum { EditableLeftIconType }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ +/** + * Declaration of the left icon type. + * @enum { EditableLeftIconType }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ +export declare enum EditableLeftIconType { + /** + * The back type. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * The back type. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + Back = 0, + /** + * The cancel type. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * The cancel type. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + Cancel = 1 +} +/** + * Indicates the options of the editable title bar. + * + * @interface EditableTitleBarOptions + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + */ +export declare interface EditableTitleBarOptions { + /** + * Background color. + * + * @type { ?ResourceColor } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + */ + backgroundColor?: ResourceColor; + /** + * Background blur style. + * + * @type { ?BlurStyle } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + */ + backgroundBlurStyle?: BlurStyle; + /** + * Indicates the types of the safe area. + * + * @type { ?Array } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + */ + safeAreaTypes?: Array; + /** + * Indicates the edges of the safe area. + * + * @type { ?Array } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + */ + safeAreaEdges?: Array; +} +/** + * Declaration of the editable title bar. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ +/** + * Declaration of the editable title bar. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ +@Component +export declare struct EditableTitleBar { + /** + * Style of the left icon. + * @type { EditableLeftIconType }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * Style of the left icon. + * @type { EditableLeftIconType }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + leftIconStyle: EditableLeftIconType; + /** + * Image item between the left icon and the title. + * @type { ?EditableTitleBarItem } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + */ + imageItem?: EditableTitleBarItem; + /** + * Title of this title bar. + * @type { ResourceStr }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * Title of this title bar. + * @type { ResourceStr }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + title: ResourceStr; + /** + * Sub-Title of this title bar. + * @type { ?ResourceStr } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + */ + subtitle?: ResourceStr; + /** + * Whether to required the save icon. + * @type { boolean } + * @default true + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + */ + isSaveIconRequired: boolean; + /** + * Menu items on the right side. + * @type { ?Array }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * Menu items on the right side. + * @type { ?Array }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + menuItems?: Array; + /** + * Callback function when click on the save icon at the right side. + * @type { ?() => void }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * Callback function when click on the save icon at the right side. + * @type { ?() => void }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + onSave?: () => void; + /** + * Callback function when click on the cancel icon at the left side. + * @type { ?() => void }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * Callback function when click on the cancel icon at the left side. + * @type { ?() => void }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + onCancel?: () => void; + /** + * Indicates the options of titlebar. + * @type { EditableTitleBarOptions } + * @default {expandSafeAreaTypes: SafeAreaType.SYSTEM, expandSafeAreaEdges: SafeAreaEdge.TOP} + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + */ + options: EditableTitleBarOptions; +} diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.arkui.advanced.ExceptionPrompt.d.ets b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.arkui.advanced.ExceptionPrompt.d.ets new file mode 100755 index 00000000..cdf03c42 --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.arkui.advanced.ExceptionPrompt.d.ets @@ -0,0 +1,257 @@ +/* + * Copyright (C) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit ArkUI + */ +/** + * Control margin status of ExceptionPrompt. + * @enum { number } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ +/** +* Control margin status of ExceptionPrompt. +* @enum { number } +* @syscap SystemCapability.ArkUI.ArkUI.Full +* @crossplatform +* @atomicservice +* @since 12 +*/ +export declare enum MarginType { + /** + * Default margin of MarginType,Margin 1: references ohos_id_card_margin_start, margin 2: references ohos_id_card_margin_end. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * Default margin of MarginType,Margin 1: references ohos_id_card_margin_start, margin 2: references ohos_id_card_margin_end. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + DEFAULT_MARGIN = 0, + /** + * Margins can be adapted of MarginType,Margin 1: references ohos_id_max_padding_start, margin 2: references ohos_id_max_padding_end. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * Margins can be adapted of MarginType,Margin 1: references ohos_id_max_padding_start, margin 2: references ohos_id_max_padding_end. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + FIT_MARGIN = 1 +} +/** + * Configuration parameter of ExceptionPrompt. + * @interface PromptOptions + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ +/** +* Configuration parameter of ExceptionPrompt. +* @interface PromptOptions +* @syscap SystemCapability.ArkUI.ArkUI.Full +* @crossplatform +* @atomicservice +* @since 12 +*/ +export interface PromptOptions { + /** + * Icon of PromptOptions. + * @type { ?ResourceStr } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * Icon of PromptOptions. + * @type { ?ResourceStr } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + icon?: ResourceStr; + /** + * Tip text of PromptOptions. + * @type { ?ResourceStr } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * Tip text of PromptOptions. + * @type { ?ResourceStr } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + tip?: ResourceStr; + /** + * Margin Type of ExceptionPrompt. + * @type { MarginType } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * Margin Type of ExceptionPrompt. + * @type { MarginType } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + marginType: MarginType; + /** + * Right icon button text of PromptOptions. + * @type { ?ResourceStr } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * Right icon button text of PromptOptions. + * @type { ?ResourceStr } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + actionText?: ResourceStr; + /** + * Distance from the top of PromptOptions. + * @type { Dimension } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * Distance from the top of PromptOptions. + * @type { Dimension } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + marginTop: Dimension; + /** + * Control concealment of PromptOptions. + * @type { boolean } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * Control concealment of PromptOptions. + * @type { boolean } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + isShown?: boolean; +} +/** + * Declare struct ExceptionPrompt higher-order component. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ +/** +* Declare struct ExceptionPrompt higher-order component. +* @syscap SystemCapability.ArkUI.ArkUI.Full +* @crossplatform +* @atomicservice +* @since 12 +*/ +@Component +export declare struct ExceptionPrompt { + /** + * Configuration information of ExceptionPrompt. + * @type { PromptOptions } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * Configuration information of ExceptionPrompt. + * @type { PromptOptions } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + @Prop + options: PromptOptions; + /** + * Callback when clicking the text on the left. + * @type { ?function } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * Callback when clicking the text on the left. + * @type { ?function } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + onTipClick?: () => void; + /** + * Callback when click the icon button. + * @type { ?function } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * Callback when click the icon button. + * @type { ?function } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + onActionTextClick?: () => void; + /** + * The build function is a member function that must return an ArkTS component type (Element) to represent the component to be rendered as a user interface. + * @type { function } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * The build function is a member function that must return an ArkTS component type (Element) to represent the component to be rendered as a user interface. + * @type { function } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + build(): void; +} diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.arkui.advanced.Filter.d.ets b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.arkui.advanced.Filter.d.ets new file mode 100755 index 00000000..dc432dbc --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.arkui.advanced.Filter.d.ets @@ -0,0 +1,246 @@ +/* +* Copyright (C) 2023-2023 Huawei Device Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +/** + * @file + * @kit ArkUI + */ + +/// +import { ResourceStr } from 'GlobalResource'; +/** + * Declare FilterType + * @enum { FilterType } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ +/** + * Declare FilterType + * @enum { FilterType } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ +export declare enum FilterType { + /** + * The multi_line_filter type. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * The multi_line_filter type. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + MULTI_LINE_FILTER = 0, + /** + * The list_filter type. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * The list_filter type. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + LIST_FILTER = 1 +} +/** + * This parameter is used to define the input of each filtering dimension. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ +/** + * This parameter is used to define the input of each filtering dimension. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ +export declare class FilterParams { + /** + * filter item name. + * @type { ResourceStr } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * filter item name. + * @type { ResourceStr } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + name: ResourceStr; + /** + * filter options. + * @type { Array } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * filter options. + * @type { Array } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + options: Array; +} +/** + * This parameter specifies the selection result of a filtering dimension. + * The index starts from 0. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ +/** + * This parameter specifies the selection result of a filtering dimension. + * The index starts from 0. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ +export declare class FilterResult { + /** + * result name. + * @type { ResourceStr } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * result name. + * @type { ResourceStr } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + name: ResourceStr; + /** + * result index. + * @type { number } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * result index. + * @type { number } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + index: number; + /** + * result value. + * @type { ResourceStr } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * result value. + * @type { ResourceStr } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + value: ResourceStr; +} +/** + * Declare Filter.The Filter is used in scenarios where multi-dimensional filtering is required. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ +/** + * Declare Filter.The Filter is used in scenarios where multi-dimensional filtering is required. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ +@Component +export declare struct Filter { + /** + * Container in the user-defined filtering result display area. + * @type { () => void } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * Container in the user-defined filtering result display area. + * @type { () => void } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + @BuilderParam + container: () => void; + /** + * Multi-dimensional filtering parameters. + * @type { Array } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * Multi-dimensional filtering parameters. + * @type { Array } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + @Prop + multiFilters: Array; + /** + * FilterParams, Additional filter item parameter. The filter item name is displayed and can be deselected. + * @type { ?FilterParams } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * FilterParams, Additional filter item parameter. The filter item name is displayed and can be deselected. + * @type { ?FilterParams } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + @Prop + additionFilters?: FilterParams; + /** + * FilterParams, Callback method after a user clicks a filter item. + * @param { (filterResults: Array) => void } FilterType, Filter display style type. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * FilterParams, Callback method after a user clicks a filter item. + * @param { (filterResults: Array) => void } FilterType, Filter display style type. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + onFilterChanged: (filterResults: Array) => void; + /** + * FilterType, Filter display style type. + * @type { ?FilterType } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * FilterType, Filter display style type. + * @type { ?FilterType } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + @Prop + filterType?: FilterType; +} diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.arkui.advanced.FormMenu.d.ets b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.arkui.advanced.FormMenu.d.ets new file mode 100755 index 00000000..d8e312f6 --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.arkui.advanced.FormMenu.d.ets @@ -0,0 +1,82 @@ +/* +* Copyright (C) 2024 Huawei Device Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +/** + * @file Defines the form menu + * @kit ArkUI + */ +import formBindingData from './@ohos.app.form.formBindingData'; +import Want from './@ohos.app.ability.Want'; +import { AsyncCallback } from './@ohos.base'; +/** + * Defines the form menu item style. + * + * @interface FormMenuItemStyle + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 12 + */ +export interface FormMenuItemStyle { + /** + * Defines options of the form menu. + * + * @type { ?MenuItemOptions } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 12 + */ + options?: MenuItemOptions; +} +/** + * Defines the add form options. + * + * @interface AddFormOptions + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 12 + */ +export interface AddFormOptions { + /** + * Indicates the form data. + * + * @type { ?formBindingData.FormBindingData } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 12 + */ + formBindingData?: formBindingData.FormBindingData; + /** + * The callback is used to return the form id. + * + * @type { ?AsyncCallback } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 12 + */ + callback?: AsyncCallback; + /** + * The style of the menu item. + * + * @type { ?FormMenuItemStyle } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 12 + */ + style?: FormMenuItemStyle; +} +/** + * Build function of AddFormMenuItem. + * + * @param { Want } want - The want of the form to publish. + * @param { string } componentId - The id of the component used to get form snapshot. + * @param { AddFormOptions } [options] - Add form options. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 12 + */ +@Builder +export declare function AddFormMenuItem(want: Want, componentId: string, options?: AddFormOptions): void; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.arkui.advanced.FullScreenLaunchComponent.d.ets b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.arkui.advanced.FullScreenLaunchComponent.d.ets new file mode 100755 index 00000000..5a1997e5 --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.arkui.advanced.FullScreenLaunchComponent.d.ets @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** +* @file Defines the fullScreen launch component +* @kit ArkUI +*/ +import AtomicServiceOptions from '@ohos.app.ability.AtomicServiceOptions'; +import Callback from '@ohos.base'; +/** + * Declare component FullScreenLaunchComponent + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 12 + */ +@Component +export declare struct FullScreenLaunchComponent { + /** + * Sets the component content. + * @type { Callback } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 12 + */ + @BuilderParam + content: Callback; + /** + * Indicates atomic service appId. + * @type { string } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 12 + */ + appId: string; + /** + * Indicates the atomic service start options. + * @type { ?AtomicServiceOptions } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 12 + */ + options?: AtomicServiceOptions; +} diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.arkui.advanced.GridObjectSortComponent.d.ets b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.arkui.advanced.GridObjectSortComponent.d.ets new file mode 100755 index 00000000..473f8fd3 --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.arkui.advanced.GridObjectSortComponent.d.ets @@ -0,0 +1,372 @@ +/* + * Copyright (C) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit ArkUI + */ +/** + * Controls the style types of GridObjectSortComponent. + * @enum { string } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ +/** +* Controls the style types of GridObjectSortComponent. +* @enum { string } +* @syscap SystemCapability.ArkUI.ArkUI.Full +* @crossplatform +* @atomicservice +* @since 12 +*/ +export declare enum GridObjectSortComponentType { + /** + * The GridObjectSortComponent image text type. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * The GridObjectSortComponent image text type. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + IMAGE_TEXT = "image_text", + /** + * The GridObjectSortComponent text type. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * The GridObjectSortComponent text type. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + TEXT = "text" +} +/** + * Declaration of the GridObjectSortComponent item. + * @interface GridObjectSortComponentIteml + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ +/** +* Declaration of the GridObjectSortComponent item. +* @interface GridObjectSortComponentIteml +* @syscap SystemCapability.ArkUI.ArkUI.Full +* @crossplatform +* @atomicservice +* @since 12 +*/ +export interface GridObjectSortComponentItem { + /** + * id of GridObjectSortComponent item. + * @type { number | string } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * id of GridObjectSortComponent item. + * @type { number | string } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + id: number | string; + /** + * GridObjectSortComponent item text. + * @type { ResourceStr } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * GridObjectSortComponent item text. + * @type { ResourceStr } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + text: ResourceStr; + /** + * selected of GridObjectSortComponent item, true is show area, false is add area. + * @type { boolean } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * selected of GridObjectSortComponent item, true is show area, false is add area. + * @type { boolean } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + selected: boolean; + /** + * order of GridObjectSortComponentItem, Used for sorting dataList. + * @type { number } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * order of GridObjectSortComponentItem, Used for sorting dataList. + * @type { number } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + order: number; + /** + * image resource path of the GridObjectSortComponent item. + * @type { ?ResourceStr } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * image resource path of the GridObjectSortComponent item. + * @type { ?ResourceStr } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + url?: ResourceStr; +} +/** + * GridObjectSortComponentOptions of GridObjectSortComponent. + * @interface GridEditOptions + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ +/** +* GridObjectSortComponentOptions of GridObjectSortComponent. +* @interface GridEditOptions +* @syscap SystemCapability.ArkUI.ArkUI.Full +* @crossplatform +* @atomicservice +* @since 12 +*/ +export interface GridObjectSortComponentOptions { + /** + * Configuration GridObjectSortComponent type. + * @type { GridObjectSortComponentType } + * @default GridObjectSortComponentType.TEXT + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * Configuration GridObjectSortComponent type. + * @type { GridObjectSortComponentType } + * @default GridObjectSortComponentType.TEXT + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + type?: GridObjectSortComponentType; + /** + * The size of the GridObjectSortComponent image. + * @type { ?number | ?Resource } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * The size of the GridObjectSortComponent image. + * @type { ?number | ?Resource } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + imageSize?: number | Resource; + /** + * The title displayed in the unedited state of the GridObjectSortComponent. + * @type { ?ResourceStr } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * The title displayed in the unedited state of the GridObjectSortComponent. + * @type { ?ResourceStr } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + normalTitle?: ResourceStr; + /** + * The title displayed in the GridObjectSortComponent edit state. + * @type { ?ResourceStr } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * The title displayed in the GridObjectSortComponent edit state. + * @type { ?ResourceStr } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + editTitle?: ResourceStr; + /** + * Display Area Title, First subtitle of the GridObjectSortComponent. + * @type { ?ResourceStr } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * Display Area Title, First subtitle of the GridObjectSortComponent. + * @type { ?ResourceStr } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + showAreaTitle?: ResourceStr; + /** + * Add Zone Title, second subtitle of the GridObjectSortComponent. + * @type { ?ResourceStr } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * Add Zone Title, second subtitle of the GridObjectSortComponent. + * @type { ?ResourceStr } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + addAreaTitle?: ResourceStr; +} +/** + * Declare struct GridObjectSortComponent. + * @struct { GridObjectSortComponent } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ +/** +* Declare struct GridObjectSortComponent. +* @struct { GridObjectSortComponent } +* @syscap SystemCapability.ArkUI.ArkUI.Full +* @crossplatform +* @atomicservice +* @since 12 +*/ +@Component +export declare struct GridObjectSortComponent { + /** + * Component types and parameters of the GridObjectSortComponent. + * @type { GridObjectSortComponentOptions } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * Component types and parameters of the GridObjectSortComponent. + * @type { GridObjectSortComponentOptions } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + @Prop + options: GridObjectSortComponentOptions; + /** + * Data list of GridObjectSortComponent. + * @type { Array } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * Data list of GridObjectSortComponent. + * @type { Array } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + dataList: Array; + /** + * Callback when Obtain edited data. + * @type { (select: Array, unselect: Array) => void } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * Callback when Obtain edited data. + * @type { (select: Array, unselect: Array) => void } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + onSave: (select: Array, unselect: Array) => void; + /** + * Cancel callback for saving data. + * @type { () => void } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * Cancel callback for saving data. + * @type { () => void } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + onCancel: () => void; + /** + * Build function of GridObjectSortComponent. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * Build function of GridObjectSortComponent. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + build(): void; +} diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.arkui.advanced.Popup.d.ets b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.arkui.advanced.Popup.d.ets new file mode 100755 index 00000000..9e90b021 --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.arkui.advanced.Popup.d.ets @@ -0,0 +1,416 @@ +/* +* Copyright (C) 2023 Huawei Device Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +/** + * @file + * @kit ArkUI + */ +/** + * Defines the popup text options + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ +/** + * Defines the popup text options + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ +export interface PopupTextOptions { + /** + * Set the text display content. + * @type { ResourceStr }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * Set the text display content. + * @type { ResourceStr }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + text: ResourceStr; + /** + * Set the text font size. + * @type { ?(number | string | Resource) }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * Set the text font size. + * @type { ?(number | string | Resource) }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + fontSize?: number | string | Resource; + /** + * Set the text font color. + * @type { ?ResourceColor }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * Set the text font color. + * @type { ?ResourceColor }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + fontColor?: ResourceColor; + /** + * Set the text font weight. + * @type { ?(number | FontWeight | string) }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * Set the text font weight. + * @type { ?(number | FontWeight | string) }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + fontWeight?: number | FontWeight | string; +} +/** + * Defines the popup button options + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ +/** +* Defines the popup button options +* @syscap SystemCapability.ArkUI.ArkUI.Full +* @crossplatform +* @atomicservice +* @since 12 +*/ +export interface PopupButtonOptions { + /** + * Set the button display content. + * @type { ResourceStr }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * Set the button display content. + * @type { ResourceStr }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + text: ResourceStr; + /** + * Set the button callback. + * @type { ?function } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * Set the button callback. + * @type { ?function } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + action?: () => void; + /** + * Set the button font size. + * @type { ?(number | string | Resource) }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * Set the button font size. + * @type { ?(number | string | Resource) }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + fontSize?: number | string | Resource; + /** + * Set the button font color. + * @type { ?ResourceColor }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * Set the button font color. + * @type { ?ResourceColor }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + fontColor?: ResourceColor; +} +/** + * Defines the popup icon options + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ +/** +* Defines the popup icon options +* @syscap SystemCapability.ArkUI.ArkUI.Full +* @crossplatform +* @atomicservice +* @since 12 +*/ +export interface PopupIconOptions { + /** + * Set the icon image. + * @type { ResourceStr }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * Set the icon image. + * @type { ResourceStr }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + image: ResourceStr; + /** + * Set the icon width. + * @type { ?Dimension }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * Set the icon width. + * @type { ?Dimension }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + width?: Dimension; + /** + * Set the icon height. + * @type { ?Dimension }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * Set the icon height. + * @type { ?Dimension }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + height?: Dimension; + /** + * Set the icon fill color. + * @type { ?ResourceColor }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * Set the icon fill color. + * @type { ?ResourceColor }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + fillColor?: ResourceColor; + /** + * Set the icon border radius. + * @type { ?(Length | BorderRadiuses) }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * Set the icon border radius. + * @type { ?(Length | BorderRadiuses) }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + borderRadius?: Length | BorderRadiuses; +} +/** + * Defines the popup options. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ +/** +* Defines the popup options. +* @syscap SystemCapability.ArkUI.ArkUI.Full +* @crossplatform +* @atomicservice +* @since 12 +*/ +export interface PopupOptions { + /** + * The icon of Popup. + * + * @type { ?PopupIconOptions } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * The icon of Popup. + * + * @type { ?PopupIconOptions } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + icon?: PopupIconOptions; + /** + * The title of Popup. + * + * @type { ?PopupTextOptions } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * The title of Popup. + * + * @type { ?PopupTextOptions } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + title?: PopupTextOptions; + /** + * The message of Popup. + * + * @type { PopupTextOptions } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * The message of Popup. + * + * @type { PopupTextOptions } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + message: PopupTextOptions; + /** + * The show close of Popup. + * + * @type { ?(boolean | Resource) } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * The show close of Popup. + * + * @type { ?(boolean | Resource) } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + showClose?: boolean | Resource; + /** + * The close button callback of Popup. + * + * @type { ?() => void } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * The close button callback of Popup. + * + * @type { ?() => void } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + onClose?: () => void; + /** + * The buttons of Popup. + * + * @type { ?[PopupButtonOptions?, PopupButtonOptions?] } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * The buttons of Popup. + * + * @type { ?[PopupButtonOptions?, PopupButtonOptions?] } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + buttons?: [ + PopupButtonOptions?, + PopupButtonOptions? + ]; +} +/** + * Build function of popup. + * + * @param { PopupOptions } options - popup option. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ +/** +* Build function of popup. +* +* @param { PopupOptions } options - popup option. +* @syscap SystemCapability.ArkUI.ArkUI.Full +* @crossplatform +* @atomicservice +* @since 12 +*/ +@Builder +export declare function Popup(options: PopupOptions): void; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.arkui.advanced.ProgressButton.d.ets b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.arkui.advanced.ProgressButton.d.ets new file mode 100755 index 00000000..1bd9baa3 --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.arkui.advanced.ProgressButton.d.ets @@ -0,0 +1,105 @@ +/* + * Copyright (c) 2023-2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit ArkUI + */ +/** + * Declare Component ProgressButton + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ +/** + * Declare Component ProgressButton + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ +@Component +export declare struct ProgressButton { + /** + * Sets the ProgressButton progress. + * @type { number }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * Sets the ProgressButton progress. + * @type { number }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + @Prop + progress: number; + /** + * Sets the ProgressButton content. + * @type { string }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * Sets the ProgressButton content. + * @type { string }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + @Prop + content: string; + /** + * Sets the ProgressButton progressButtonWidth. + * @type { ?Length }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * Sets the ProgressButton progressButtonWidth. + * @type { ?Length }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + progressButtonWidth?: Length; + /** + * Sets the ProgressButton clickCallback. + * @type { () => void }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * Sets the ProgressButton clickCallback. + * @type { () => void }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + clickCallback: () => void; + /** + * Sets the ProgressButton enable state. + * @type { boolean }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * Sets the ProgressButton enable state. + * @type { boolean }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + @Prop + enable: boolean; +} diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.arkui.advanced.SegmentButton.d.ets b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.arkui.advanced.SegmentButton.d.ets new file mode 100755 index 00000000..e1fbcbcb --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.arkui.advanced.SegmentButton.d.ets @@ -0,0 +1,1402 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit ArkUI + */ + +/// +import { ResourceStr } from 'GlobalResource'; +/** + * Defines text only item of SegmentButton. + * + * @interface SegmentButtonTextItem + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ +/** +* Defines text only item of SegmentButton. +* +* @interface SegmentButtonTextItem +* @syscap SystemCapability.ArkUI.ArkUI.Full +* @crossplatform +* @atomicservice +* @since 12 +*/ +interface SegmentButtonTextItem { + /** + * The text of text only item. + * + * @type { ResourceStr } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * The text of text only item. + * + * @type { ResourceStr } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + text: ResourceStr; +} +/** + * Defines icon only item of SegmentButton. + * + * @interface SegmentButtonIconItem + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ +/** +* Defines icon only item of SegmentButton. +* +* @interface SegmentButtonIconItem +* @syscap SystemCapability.ArkUI.ArkUI.Full +* @crossplatform +* @atomicservice +* @since 12 +*/ +interface SegmentButtonIconItem { + /** + * The icon of icon only item. + * + * @type { ResourceStr } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * The icon of icon only item. + * + * @type { ResourceStr } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + icon: ResourceStr; + /** + * The icon of icon only item in the selected state. + * + * @type { ResourceStr } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * The icon of icon only item in the selected state. + * + * @type { ResourceStr } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + selectedIcon: ResourceStr; +} +/** + * Defines icon and text item of SegmentButton. + * + * @interface SegmentButtonIconTextItem + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ +/** +* Defines icon and text item of SegmentButton. +* +* @interface SegmentButtonIconTextItem +* @syscap SystemCapability.ArkUI.ArkUI.Full +* @crossplatform +* @atomicservice +* @since 12 +*/ +interface SegmentButtonIconTextItem { + /** + * The icon of icon and text item. + * + * @type { ResourceStr } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * The icon of icon and text item. + * + * @type { ResourceStr } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + icon: ResourceStr; + /** + * The icon of icon and text item in the selected state. + * + * @type { ResourceStr } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * The icon of icon and text item in the selected state. + * + * @type { ResourceStr } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + selectedIcon: ResourceStr; + /** + * The text of icon and text item. + * + * @type { ResourceStr } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * The text of icon and text item. + * + * @type { ResourceStr } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + text: ResourceStr; +} +/** + * Defines the DimensionNoPercentage type. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ +/** +* Defines the DimensionNoPercentage type. +* +* @syscap SystemCapability.ArkUI.ArkUI.Full +* @crossplatform +* @atomicservice +* @since 12 +*/ +declare type DimensionNoPercentage = PX | VP | FP | LPX | Resource; +/** + * Defines SegmentButton common options. + * + * @interface CommonSegmentButtonOptions + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ +/** +* Defines SegmentButton common options. +* +* @interface CommonSegmentButtonOptions +* @syscap SystemCapability.ArkUI.ArkUI.Full +* @crossplatform +* @atomicservice +* @since 12 +*/ +interface CommonSegmentButtonOptions { + /** + * The font color of buttons. + * + * @type { ?ResourceColor } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * The font color of buttons. + * + * @type { ?ResourceColor } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + fontColor?: ResourceColor; + /** + * The font color of selected button. + * + * @type { ?ResourceColor } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * The font color of selected button. + * + * @type { ?ResourceColor } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + selectedFontColor?: ResourceColor; + /** + * The font size of buttons. + * + * @type { ?DimensionNoPercentage } + * @default $r('sys.float.ohos_id_text_size_body2') + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * The font size of buttons. + * + * @type { ?DimensionNoPercentage } + * @default $r('sys.float.ohos_id_text_size_body2') + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + fontSize?: DimensionNoPercentage; + /** + * The font size of selected button. + * + * @type { ?DimensionNoPercentage } + * @default $r('sys.float.ohos_id_text_size_body2') + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * The font size of selected button. + * + * @type { ?DimensionNoPercentage } + * @default $r('sys.float.ohos_id_text_size_body2') + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + selectedFontSize?: DimensionNoPercentage; + /** + * The font weight of buttons. + * + * @type { ?FontWeight } + * @default FontWeight.Regular + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * The font weight of buttons. + * + * @type { ?FontWeight } + * @default FontWeight.Regular + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + fontWeight?: FontWeight; + /** + * The font weight of selected button. + * + * @type { ?FontWeight } + * @default FontWeight.Medium + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * The font weight of selected button. + * + * @type { ?FontWeight } + * @default FontWeight.Medium + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + selectedFontWeight?: FontWeight; + /** + * The background color of SegmentButton. + * + * @type { ?ResourceColor } + * @default $r('sys.color.ohos_id_color_button_normal') + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * The background color of SegmentButton. + * + * @type { ?ResourceColor } + * @default $r('sys.color.ohos_id_color_button_normal') + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + backgroundColor?: ResourceColor; + /** + * The background color of selected button. + * + * @type { ?ResourceColor } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * The background color of selected button. + * + * @type { ?ResourceColor } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + selectedBackgroundColor?: ResourceColor; + /** + * The image size of buttons. + * + * @type { ?SizeOptions } + * @default SizeOptions { width: 24, height: 24 } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * The image size of buttons. + * + * @type { ?SizeOptions } + * @default SizeOptions { width: 24, height: 24 } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + imageSize?: SizeOptions; + /** + * The padding of buttons. + * + * @type { ?Padding | Dimension } + * @default For text only / icon only buttons Padding { top: 4, right: 8, bottom: 4, left: 8 }. + * For text & icon buttons Padding { top: 6, right: 8, bottom: 6, left: 8 }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * The padding of buttons. + * + * @type { ?Padding | Dimension } + * @default For text only / icon only buttons Padding { top: 4, right: 8, bottom: 4, left: 8 }. + * For text & icon buttons Padding { top: 6, right: 8, bottom: 6, left: 8 }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + buttonPadding?: Padding | Dimension; + /** + * The padding of text in button. + * + * @type { ?Padding | Dimension } + * @default 0 + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * The padding of text in button. + * + * @type { ?Padding | Dimension } + * @default 0 + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + textPadding?: Padding | Dimension; + /** + * The blurStyle of background. + * + * @type { ?BlurStyle } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * The blurStyle of background. + * + * @type { ?BlurStyle } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + backgroundBlurStyle?: BlurStyle; +} +/** + * Defines the ItemRestriction type. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ +/** +* Defines the ItemRestriction type. +* +* @syscap SystemCapability.ArkUI.ArkUI.Full +* @crossplatform +* @atomicservice +* @since 12 +*/ +declare type ItemRestriction = [ + T, + T, + T?, + T?, + T? +]; +/** + * Defines the SegmentButtonItemTuple type. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ +/** +* Defines the SegmentButtonItemTuple type. +* +* @syscap SystemCapability.ArkUI.ArkUI.Full +* @crossplatform +* @atomicservice +* @since 12 +*/ +declare type SegmentButtonItemTuple = ItemRestriction | ItemRestriction | ItemRestriction; +/** + * Defines the SegmentButtonItemArray type. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ +/** +* Defines the SegmentButtonItemArray type. +* +* @syscap SystemCapability.ArkUI.ArkUI.Full +* @crossplatform +* @atomicservice +* @since 12 +*/ +declare type SegmentButtonItemArray = Array | Array | Array; +/** + * Defines SegmentButton tab options. + * + * @interface TabSegmentButtonConstructionOptions + * @extends CommonSegmentButtonOptions + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ +/** +* Defines SegmentButton tab options. +* +* @interface TabSegmentButtonConstructionOptions +* @extends CommonSegmentButtonOptions +* @syscap SystemCapability.ArkUI.ArkUI.Full +* @crossplatform +* @atomicservice +* @since 12 +*/ +interface TabSegmentButtonConstructionOptions extends CommonSegmentButtonOptions { + /** + * The items of tab type of SegmentButton. + * + * @type { ItemRestriction } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * The items of tab type of SegmentButton. + * + * @type { ItemRestriction } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + buttons: ItemRestriction; +} +/** + * Defines SegmentButton capsule options. + * + * @interface CapsuleSegmentButtonConstructionOptions + * @extends CommonSegmentButtonOptions + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ +/** +* Defines SegmentButton capsule options. +* +* @interface CapsuleSegmentButtonConstructionOptions +* @extends CommonSegmentButtonOptions +* @syscap SystemCapability.ArkUI.ArkUI.Full +* @crossplatform +* @atomicservice +* @since 11 +*/ +interface CapsuleSegmentButtonConstructionOptions extends CommonSegmentButtonOptions { + /** + * The items of capsule type of SegmentButton. + * + * @type { SegmentButtonItemTuple } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * The items of capsule type of SegmentButton. + * + * @type { SegmentButtonItemTuple } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + buttons: SegmentButtonItemTuple; + /** + * Support multiple selections flag. + * + * @type { ?boolean } + * @default false + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * Support multiple selections flag. + * + * @type { ?boolean } + * @default false + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + multiply?: boolean; +} +/** + * Defines the type of SegmentButton options of tab type. + * + * @interface TabSegmentButtonOptions + * @extends TabSegmentButtonConstructionOptions + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ +/** +* Defines the type of SegmentButton options of tab type. +* +* @interface TabSegmentButtonOptions +* @extends TabSegmentButtonConstructionOptions +* @syscap SystemCapability.ArkUI.ArkUI.Full +* @crossplatform +* @atomicservice +* @since 12 +*/ +interface TabSegmentButtonOptions extends TabSegmentButtonConstructionOptions { + /** + * The type of SegmentButton. + * + * @type { "tab" } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * The type of SegmentButton. + * + * @type { "tab" } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + type: "tab"; +} +/** + * Defines the type of SegmentButton options of capsule type. + * + * @interface CapsuleSegmentButtonOptions + * @extends CapsuleSegmentButtonConstructionOptions + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ +/** +* Defines the type of SegmentButton options of capsule type. +* +* @interface CapsuleSegmentButtonOptions +* @extends CapsuleSegmentButtonConstructionOptions +* @syscap SystemCapability.ArkUI.ArkUI.Full +* @crossplatform +* @atomicservice +* @since 12 +*/ +interface CapsuleSegmentButtonOptions extends CapsuleSegmentButtonConstructionOptions { + /** + * The type of SegmentButton. + * + * @type { "capsule" } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * The type of SegmentButton. + * + * @type { "capsule" } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + type: "capsule"; +} +/** + * Construct parameter types for SegmentButtonItemOptions. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ +/** +* Construct parameter types for SegmentButtonItemOptions. +* +* @syscap SystemCapability.ArkUI.ArkUI.Full +* @crossplatform +* @atomicservice +* @since 12 +*/ +interface SegmentButtonItemOptionsConstructorOptions { + /** + * The icon of icon and text item. + * + * @type { ?ResourceStr } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * The icon of icon and text item. + * + * @type { ?ResourceStr } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + icon?: ResourceStr; + /** + * The icon of icon and text item in the selected state. + * + * @type { ?ResourceStr } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * The icon of icon and text item in the selected state. + * + * @type { ?ResourceStr } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + selectedIcon?: ResourceStr; + /** + * The text of icon and text item. + * + * @type { ?ResourceStr } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * The text of icon and text item. + * + * @type { ?ResourceStr } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + text?: ResourceStr; +} +/** + * The options for SegmentButton items. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ +/** +* The options for SegmentButton items. +* +* @syscap SystemCapability.ArkUI.ArkUI.Full +* @crossplatform +* @atomicservice +* @since 12 +*/ +@Observed +declare class SegmentButtonItemOptions { + /** + * The icon of item. + * + * @type { ?ResourceStr } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * The icon of item. + * + * @type { ?ResourceStr } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + icon?: ResourceStr; + /** + * The icon of selected item. + * + * @type { ?ResourceStr } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * The icon of selected item. + * + * @type { ?ResourceStr } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + selectedIcon?: ResourceStr; + /** + * The text of item. + * + * @type { ?ResourceStr } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * The text of item. + * + * @type { ?ResourceStr } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + text?: ResourceStr; + /** + * The constructor used to create a SegmentButtonOptionsArray object. + * + * @param { SegmentButtonItemOptionsConstructorOptions } options - item info. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + constructor(options: SegmentButtonItemOptionsConstructorOptions); +} +/** + * The class for SegmentButton item options array. + * + * @extends Array + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ +/** +* The class for SegmentButton item options array. +* +* @extends Array +* @syscap SystemCapability.ArkUI.ArkUI.Full +* @crossplatform +* @atomicservice +* @since 12 +*/ +@Observed +declare class SegmentButtonItemOptionsArray extends Array { + /** + * The constructor used to create a SegmentButtonItemOptionsArray object. + * + * @param { SegmentButtonItemTuple } elements - The SegmentButton items. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * The constructor used to create a SegmentButtonItemOptionsArray object. + * + * @param { SegmentButtonItemTuple } elements - The SegmentButton items. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + constructor(elements: SegmentButtonItemTuple); + /** + * Appends new elements to the end of SegmentButtonItemOptionsArray. + * + * @param { SegmentButtonItemArray } items - New elements to add to SegmentButtonItemOptionsArray. + * @returns { number } Returns the new length of SegmentButtonItemOptionsArray. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * Appends new elements to the end of SegmentButtonItemOptionsArray. + * + * @param { SegmentButtonItemArray } items - New elements to add to SegmentButtonItemOptionsArray. + * @returns { number } Returns the new length of SegmentButtonItemOptionsArray. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + push(...items: SegmentButtonItemArray): number; + /** + * Removes the last element from SegmentButtonItemOptionsArray. + * + * @returns { SegmentButtonItemOptions | undefined } Returns the removed element. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * Removes the last element from SegmentButtonItemOptionsArray. + * + * @returns { SegmentButtonItemOptions | undefined } Returns the removed element. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + pop(): SegmentButtonItemOptions | undefined; + /** + * Removes the first element from SegmentButtonItemOptionsArray. + * + * @returns { SegmentButtonItemOptions | undefined } Returns the removed element. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * Removes the first element from SegmentButtonItemOptionsArray. + * + * @returns { SegmentButtonItemOptions | undefined } Returns the removed element. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + shift(): SegmentButtonItemOptions | undefined; + /** + * Appends new elements to the start of SegmentButtonItemOptionsArray. + * + * @param { SegmentButtonItemArray } items - New elements to add to SegmentButtonItemOptionsArray. + * @returns { number } Returns the new length of SegmentButtonItemOptionsArray. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * Appends new elements to the start of SegmentButtonItemOptionsArray. + * + * @param { SegmentButtonItemArray } items - New elements to add to SegmentButtonItemOptionsArray. + * @returns { number } Returns the new length of SegmentButtonItemOptionsArray. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + unshift(...items: SegmentButtonItemArray): number; + /** + * Changes the elements of SegmentButtonItemOptionsArray by removing or replacing existing elements and/or adding new elements in place. + * + * @param { number } start - The zero-based location in the array from which to start removing elements. + * @param { number } deleteCount - The number of elements to remove. + * @param { SegmentButtonItemOptions[] } items - Elements to insert into the array in place of the deleted elements. + * @returns { SegmentButtonItemOptions[] } Returns a SegmentButtonItemOptions array containing the deleted elements. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * Changes the elements of SegmentButtonItemOptionsArray by removing or replacing existing elements and/or adding new elements in place. + * + * @param { number } start - The zero-based location in the array from which to start removing elements. + * @param { number } deleteCount - The number of elements to remove. + * @param { SegmentButtonItemOptions[] } items - Elements to insert into the array in place of the deleted elements. + * @returns { SegmentButtonItemOptions[] } Returns a SegmentButtonItemOptions array containing the deleted elements. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + splice(start: number, deleteCount: number, ...items: SegmentButtonItemOptions[]): SegmentButtonItemOptions[]; + /** + * The function used to create a SegmentButtonItemOptionsArray object. + * + * @param { SegmentButtonItemTuple } elements - The SegmentButton items. + * @returns { SegmentButtonItemOptionsArray } Returns the a new SegmentButtonItemOptionsArray object. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * The function used to create a SegmentButtonItemOptionsArray object. + * + * @param { SegmentButtonItemTuple } elements - The SegmentButton items. + * @returns { SegmentButtonItemOptionsArray } Returns the a new SegmentButtonItemOptionsArray object. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + static create(elements: SegmentButtonItemTuple): SegmentButtonItemOptionsArray; +} +/** + * The class for SegmentButton options. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ +/** +* The class for SegmentButton options. +* +* @syscap SystemCapability.ArkUI.ArkUI.Full +* @crossplatform +* @atomicservice +* @since 12 +*/ +@Observed +declare class SegmentButtonOptions { + /** + * The type of SegmentButton. + * + * @type { "tab" | "capsule" } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * The type of SegmentButton. + * + * @type { "tab" | "capsule" } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + type: "tab" | "capsule"; + /** + * The support multiple selections flag of SegmentButton. + * + * @type { boolean } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * The support multiple selections flag of SegmentButton. + * + * @type { boolean } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + multiply: boolean; + /** + * The buttons information of SegmentButton. + * + * @type { SegmentButtonOptionsArray } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * The buttons information of SegmentButton. + * + * @type { SegmentButtonOptionsArray } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + buttons: SegmentButtonItemOptionsArray; + /** + * The font color of buttons. + * + * @type { ResourceColor } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * The font color of buttons. + * + * @type { ResourceColor } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + fontColor: ResourceColor; + /** + * The font color of selected button. + * + * @type { ResourceColor } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * The font color of selected button. + * + * @type { ResourceColor } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + selectedFontColor: ResourceColor; + /** + * The font size of buttons. + * + * @type { DimensionNoPercentage } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * The font size of buttons. + * + * @type { DimensionNoPercentage } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + fontSize: DimensionNoPercentage; + /** + * The font size of selected button. + * + * @type { DimensionNoPercentage } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * The font size of selected button. + * + * @type { DimensionNoPercentage } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + selectedFontSize: DimensionNoPercentage; + /** + * The font weight of buttons. + * + * @type { FontWeight } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * The font weight of buttons. + * + * @type { FontWeight } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + fontWeight: FontWeight; + /** + * The font weight of selected button. + * + * @type { FontWeight } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * The font weight of selected button. + * + * @type { FontWeight } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + selectedFontWeight: FontWeight; + /** + * The background color of SegmentButton. + * + * @type { ResourceColor } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * The background color of SegmentButton. + * + * @type { ResourceColor } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + backgroundColor: ResourceColor; + /** + * The background color of selected button. + * + * @type { ResourceColor } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * The background color of selected button. + * + * @type { ResourceColor } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + selectedBackgroundColor: ResourceColor; + /** + * The image size of buttons. + * + * @type { SizeOptions } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * The image size of buttons. + * + * @type { SizeOptions } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + imageSize: SizeOptions; + /** + * The padding of buttons. + * + * @type { Padding | Dimension } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * The padding of buttons. + * + * @type { Padding | Dimension } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + buttonPadding: Padding | Dimension; + /** + * The padding of text in button. + * + * @type { Padding | Dimension } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * The padding of text in button. + * + * @type { Padding | Dimension } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + textPadding: Padding | Dimension; + /** + * The blurStyle of background. + * + * @type { BlurStyle } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * The blurStyle of background. + * + * @type { BlurStyle } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + backgroundBlurStyle: BlurStyle; + /** + * The constructor used to create a SegmentButtonOptions object. + * + * @param { TabSegmentButtonOptions | CapsuleSegmentButtonOptions } options - The options of SegmentButton. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * The constructor used to create a SegmentButtonOptions object. + * + * @param { TabSegmentButtonOptions | CapsuleSegmentButtonOptions } options - The options of SegmentButton. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + constructor(options: TabSegmentButtonOptions | CapsuleSegmentButtonOptions); + /** + * The function used to create a SegmentButtonOptions of tab type. + * + * @param { TabSegmentButtonConstructionOptions } options - The options of SegmentButton. + * @returns { SegmentButtonOptions } Returns the a new SegmentButtonOptions object of tab type. + * @static + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * The function used to create a SegmentButtonOptions of tab type. + * + * @param { TabSegmentButtonConstructionOptions } options - The options of SegmentButton. + * @returns { SegmentButtonOptions } Returns the a new SegmentButtonOptions object of tab type. + * @static + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + static tab(options: TabSegmentButtonConstructionOptions): SegmentButtonOptions; + /** + * The function used to create a SegmentButtonOptions of capsule type. + * + * @param { CapsuleSegmentButtonConstructionOptions } options - The options of SegmentButton. + * @returns { SegmentButtonOptions } Returns the a new SegmentButtonOptions object of capsule type. + * @static + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * The function used to create a SegmentButtonOptions of capsule type. + * + * @param { CapsuleSegmentButtonConstructionOptions } options - The options of SegmentButton. + * @returns { SegmentButtonOptions } Returns the a new SegmentButtonOptions object of capsule type. + * @static + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + static capsule(options: CapsuleSegmentButtonConstructionOptions): SegmentButtonOptions; +} +/** + * Declare Component SegmentButton + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ +/** +* Declare Component SegmentButton +* +* @syscap SystemCapability.ArkUI.ArkUI.Full +* @crossplatform +* @atomicservice +* @since 12 +*/ +@Component +declare struct SegmentButton { + /** + * The options of SegmentButton. + * + * @type { SegmentButtonOptions } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * The options of SegmentButton. + * + * @type { SegmentButtonOptions } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + @ObjectLink + options: SegmentButtonOptions; + /** + * The selectedIndex. + * + * @type { number[] } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * The selectedIndex. + * + * @type { number[] } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + @Link + selectedIndexes: number[]; +} +export { SegmentButton, SegmentButtonOptions, SegmentButtonItemOptionsArray, TabSegmentButtonOptions, TabSegmentButtonConstructionOptions, CapsuleSegmentButtonOptions, CapsuleSegmentButtonConstructionOptions, SegmentButtonTextItem, SegmentButtonIconItem, SegmentButtonIconTextItem, DimensionNoPercentage, CommonSegmentButtonOptions, ItemRestriction, SegmentButtonItemTuple, SegmentButtonItemArray, SegmentButtonItemOptionsConstructorOptions, SegmentButtonItemOptions }; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.arkui.advanced.SelectTitleBar.d.ets b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.arkui.advanced.SelectTitleBar.d.ets new file mode 100755 index 00000000..a567be7e --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.arkui.advanced.SelectTitleBar.d.ets @@ -0,0 +1,191 @@ +/* + * Copyright (c) 2023-2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit ArkUI + */ + +/// +import { ResourceStr } from 'GlobalResource'; +/** + * Declaration of the menu item on the right side. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ +/** + * Declaration of the menu item on the right side. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ +export declare class SelectTitleBarMenuItem { + /** + * Icon resource for this menu item. + * @type { ResourceStr }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * Icon resource for this menu item. + * @type { ResourceStr }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + value: ResourceStr; + /** + * Whether to enable this menu item. + * @type { ?boolean }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * Whether to enable this menu item. + * @type { ?boolean }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + isEnabled?: boolean; + /** + * Callback function when click on this menu item. + * @type { ?() => void }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * Callback function when click on this menu item. + * @type { ?() => void }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + action?: () => void; +} +/** + * Declaration of the selectable title bar. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ +/** + * Declaration of the selectable title bar. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ +@Component +export declare struct SelectTitleBar { + /** + * Selected index of the initial options in the drop-down menu. The index of the first item is 0. + * If this attribute is not set, the default value is -1. Which means, no menu item is selected. + * @type { number }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * Selected index of the initial options in the drop-down menu. The index of the first item is 0. + * If this attribute is not set, the default value is -1. Which means, no menu item is selected. + * @type { number }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + @Prop + selected: number; + /** + * Options inside the drop-down list. + * @type { Array }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * Options inside the drop-down list. + * @type { Array }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + options: Array; + /** + * Menu items on the right side. + * @type { ?Array }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * Menu items on the right side. + * @type { ?Array }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + menuItems?: Array; + /** + * Sub-title of this title bar. + * @type { ?ResourceStr }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * Sub-title of this title bar. + * @type { ?ResourceStr }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + subtitle?: ResourceStr; + /** + * The number displayed in a badge. + * @type { ?number }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * The number displayed in a badge. + * @type { ?number }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + badgeValue?: number; + /** + * Whether to hide the back arrow at the left side. + * @type { ?boolean }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * Whether to hide the back arrow at the left side. + * @type { ?boolean }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + hidesBackButton?: boolean; + /** + * Callback function when an option is selected + * @type { ?(index: number) => void }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * Callback function when an option is selected + * @type { ?(index: number) => void }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + onSelected?: ((index: number) => void); +} diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.arkui.advanced.SelectionMenu.d.ets b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.arkui.advanced.SelectionMenu.d.ets new file mode 100755 index 00000000..433844e2 --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.arkui.advanced.SelectionMenu.d.ets @@ -0,0 +1,327 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit ArkUI + */ +/** + * Construct parameter types for EditorMenuOptions. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ +/** + * Construct parameter types for EditorMenuOptions. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ +export interface EditorMenuOptions { + /** + * The icon of icon and text item. + * + * @type { ResourceStr } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * The icon of icon and text item. + * + * @type { ResourceStr } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + icon: ResourceStr; + /** + * Callback function when click the icon. + * + * @type { ?function } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * Callback function when click the icon. + * + * @type { ?function } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + action?: () => void; + /** + * Callback builder when click the icon. + * + * @type { ?function } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * Callback builder when click the icon. + * + * @type { ?function } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + builder?: () => void; +} +/** + * Construct parameter types for ExpandedMenuOptions. + * + * @extends MenuItemOptions + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ +/** +* Construct parameter types for ExpandedMenuOptions. +* +* @extends MenuItemOptions +* @syscap SystemCapability.ArkUI.ArkUI.Full +* @crossplatform +* @atomicservice +* @since 12 +*/ +export interface ExpandedMenuOptions extends MenuItemOptions { + /** + * Callback function when click the option. + * + * @type { ?function } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * Callback function when click the option. + * + * @type { ?function } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + action?: () => void; +} +/** + * Defines the editor event info. + * + * @interface EditorEventInfo + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ +/** +* Defines the editor event info. +* +* @interface EditorEventInfo +* @syscap SystemCapability.ArkUI.ArkUI.Full +* @crossplatform +* @atomicservice +* @since 12 +*/ +export interface EditorEventInfo { + /** + * Edit information. + * + * @type { ?RichEditorSelection } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * Edit information. + * + * @type { ?RichEditorSelection } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + content?: RichEditorSelection; +} +/** + * Construct parameter types for SelectionMenuOptions. + * + * @extends MenuItemOptions + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ +/** +* Construct parameter types for SelectionMenuOptions. +* +* @extends MenuItemOptions +* @syscap SystemCapability.ArkUI.ArkUI.Full +* @crossplatform +* @atomicservice +* @since 12 +*/ +export interface SelectionMenuOptions { + /** + * The options of EditorMenu. + * + * @type { ?Array } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * The options of EditorMenu. + * + * @type { ?Array } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + editorMenuOptions?: Array; + /** + * Expansion of SelectionMenu. + * + * @type { ?Array } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * Expansion of SelectionMenu. + * + * @type { ?Array } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + expandedMenuOptions?: Array; + /** + * Expansion of SelectionMenu. + * + * @type { ?RichEditorController } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * Expansion of SelectionMenu. + * + * @type { ?RichEditorController } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + controller?: RichEditorController; + /** + * Replace the built-in paste function. + * + * @type { ?function } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * Replace the built-in paste function. + * + * @type { ?function } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + onPaste?: (event?: EditorEventInfo) => void; + /** + * Replace the built-in replication feature. + * + * @type { ?function } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * Replace the built-in replication feature. + * + * @type { ?function } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + onCopy?: (event?: EditorEventInfo) => void; + /** + * Replace the built-in cut function. + * + * @type { ?function } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * Replace the built-in cut function. + * + * @type { ?function } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + onCut?: (event?: EditorEventInfo) => void; + /** + * Replace the built-in select all function. + * + * @type { ?function } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * Replace the built-in select all function. + * + * @type { ?function } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + onSelectAll?: (event?: EditorEventInfo) => void; +} +/** + * Declare Builder SelectionMenu. + * + * @param { SelectionMenuOptions } options - Selection menu options. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ +/** +* Declare Builder SelectionMenu. +* +* @param { SelectionMenuOptions } options - Selection menu options. +* @syscap SystemCapability.ArkUI.ArkUI.Full +* @crossplatform +* @atomicservice +* @since 12 +*/ +@Builder +export declare function SelectionMenu(options: SelectionMenuOptions): void; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.arkui.advanced.SplitLayout.d.ets b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.arkui.advanced.SplitLayout.d.ets new file mode 100755 index 00000000..d88e4dad --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.arkui.advanced.SplitLayout.d.ets @@ -0,0 +1,110 @@ +/* + * Copyright (c) 2023-2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit ArkUI + */ + +/// +import { ResourceStr } from 'GlobalResource'; +/** + * Declare SplitLayout.The SplitLayout is used for upper and lower graphic layouts. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ +/** + * Declare SplitLayout.The SplitLayout is used for upper and lower graphic layouts. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ +@Component +export declare struct SplitLayout { + /** + * Container in the user-defined splitlayout display area. + * @type { container: () => void }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * Container in the user-defined splitlayout display area. + * @type { container: () => void }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + @BuilderParam + container: () => void; + /** + * Image in the layout. + * @type { ResourceStr }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * Image in the layout. + * @type { ResourceStr }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + @State + mainImage: ResourceStr; + /** + * Title text in the layout. + * @type { ResourceStr }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * Title text in the layout. + * @type { ResourceStr }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + @Prop + primaryText: ResourceStr; + /** + * Description text in the layout. + * @type { ?ResourceStr }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * Description text in the layout. + * @type { ?ResourceStr }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + @Prop + secondaryText?: ResourceStr; + /** + * Auxiliary text in the layout. + * @type { ?ResourceStr }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * Auxiliary text in the layout. + * @type { ?ResourceStr }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + @Prop + tertiaryText?: ResourceStr; +} diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.arkui.advanced.SubHeader.d.ets b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.arkui.advanced.SubHeader.d.ets new file mode 100755 index 00000000..64521c15 --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.arkui.advanced.SubHeader.d.ets @@ -0,0 +1,434 @@ +/* + * Copyright (c) 2023-2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit ArkUI + */ + +/// +import { ResourceStr } from 'GlobalResource'; +/** + * Control style of operation element + * @enum { OperationStyle } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ +/** + * Control style of operation element + * @enum { OperationStyle } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ +export declare enum OperationType { + /** + * The TextArrow style. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * The TextArrow style. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + TEXT_ARROW = 0, + /** + * The Button style. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * The Button style. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + BUTTON = 1, + /** + * The IconGroup style. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * The IconGroup style. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + ICON_GROUP = 2, + /** + * The LoadingProgress style. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * The LoadingProgress style. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + LOADING = 3 +} +/** + * Declare type OperationOption + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ +/** + * Declare type OperationOption + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ +export declare class OperationOption { + /** + * The content of text or the address of icon. + * @type { ResourceStr }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * The content of text or the address of icon. + * @type { ResourceStr }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + value: ResourceStr; + /** + * callback function when operate the text or icon. + * @type { () => void }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * callback function when operate the text or icon. + * @type { () => void }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + action?: () => void; +} +/** + * Declare type SelectOption + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ +/** + * Declare type SelectOption + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ +export declare class SelectOptions { + /** + * SubOption array of the select. + * @type { Array }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * SubOption array of the select. + * @type { Array }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + options: Array; + /** + * The default selected index. + * @type { number }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * The default selected index. + * @type { number }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + selected?: number; + /** + * The default text value. + * @type { string }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * The default text value. + * @type { string }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + value?: string; + /** + * Callback when the select is selected. + * @type { (index: number, value?: string) => void }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * Callback when the select is selected. + * @type { (index: number, value?: string) => void }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + onSelect?: (index: number, value?: string) => void; +} +/** + * The symbol rendering strategy. + * + * @enum { number } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ +declare enum SymbolRenderingStrategy { + /** + * The single rendering strategy. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + SINGLE = 0, + /** + * The multiple color rendering strategy. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + MULTIPLE_COLOR = 1, + /** + * The multiple opacity rendering strategy. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + MULTIPLE_OPACITY = 2 +} +/** + * The symbol effect strategy. + * + * @enum { number } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ +declare enum SymbolEffectStrategy { + /** + * There is no effect strategy. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + NONE = 0, + /** + * The scale effect strategy. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + SCALE = 1, + /** + * The hierarchical effect strategy. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + HIERARCHICAL = 2 +} +/** + * Declare type SymbolOptions + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 12 + */ +export declare class SymbolOptions { + /** + * The size of symbol icon. + * @type { ?(number | string | Resource) }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 12 + */ + fontSize?: number | string | Resource; + /** + * The color of symbol icon. + * @type { ?(Array) }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 12 + */ + fontColor?: Array; + /** + * The fontWeight of symbol icon. + * @type { ?(number | FontWeight | string) }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 12 + */ + fontWeight?: number | FontWeight | string; + /** + * The effect strategy of symbol icon. + * @type { ?(SymbolEffectStrategy) }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 12 + */ + effectStrategy?: SymbolEffectStrategy; + /** + * The rendering strategy of symbol icon. + * @type { ?(SymbolRenderingStrategy) }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 12 + */ + renderingStrategy?: SymbolRenderingStrategy; +} +/** + * Declare struct SubHeader + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ +/** + * Declare struct SubHeader + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ +@Component +export declare struct SubHeader { + /** + * Icon resource of content area. + * @type { ResourceStr }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * Icon resource of content area. + * @type { ResourceStr }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + @Prop + icon?: ResourceStr; + /** + * Attributes of Symbol icon. + * @type { SymbolOptions}. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 12 + */ + iconSymbolOptions?: SymbolOptions; + /** + * The first line text of content area. + * @type { ResourceStr }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * The first line text of content area. + * @type { ResourceStr }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + @Prop + primaryTitle?: ResourceStr; + /** + * The secondary line text of content area. + * @type { ResourceStr }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * The secondary line text of content area. + * @type { ResourceStr }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + @Prop + secondaryTitle?: ResourceStr; + /** + * Select option of content area. + * @type { SelectOptions }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * Select option of content area. + * @type { SelectOptions }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + select?: SelectOptions; + /** + * Operation style of SubHeader. + * @type { OperationStyle }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * Operation style of SubHeader. + * @type { OperationStyle }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + @Prop + operationType?: OperationType; + /** + * operation item. + * @type { Array }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * operation item. + * @type { Array }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + operationItem?: Array; + /** + * Attributes of Symbol icons in operation area. + * @type { Array }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 12 + */ + operationSymbolOptions?: Array; +} diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.arkui.advanced.SwipeRefresher.d.ets b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.arkui.advanced.SwipeRefresher.d.ets new file mode 100755 index 00000000..cab67caf --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.arkui.advanced.SwipeRefresher.d.ets @@ -0,0 +1,62 @@ +/* + * Copyright (c) 2023-2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit ArkUI + */ +/** + * Declare component SwipeRefresher + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ +/** + * Declare component SwipeRefresher + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ +@Component +export declare struct SwipeRefresher { + /** + * Sets the content when loading. + * @type { string } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * Sets the content when loading. + * @type { string } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + @Prop + content?: string; + /** + * Whether the component is loading. + * type { boolean } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * Whether the component is loading. + * type { boolean } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + @Prop + isLoading: boolean; +} diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.arkui.advanced.TabTitleBar.d.ets b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.arkui.advanced.TabTitleBar.d.ets new file mode 100755 index 00000000..bc937e4d --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.arkui.advanced.TabTitleBar.d.ets @@ -0,0 +1,176 @@ +/* + * Copyright (c) 2023-2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit ArkUI + */ + +/// +import { ResourceStr } from 'GlobalResource'; +/** + * Declaration of the menu item on the right side. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ +/** + * Declaration of the menu item on the right side. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ +export declare class TabTitleBarMenuItem { + /** + * Icon resource for this menu item. + * @type { ResourceStr }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * Icon resource for this menu item. + * @type { ResourceStr }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + value: ResourceStr; + /** + * Whether to enable this menu item. + * @type { ?boolean }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * Whether to enable this menu item. + * @type { ?boolean }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + isEnabled?: boolean; + /** + * Callback function when click on this menu item. + * @type { ?() => void }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * Callback function when click on this menu item. + * @type { ?() => void }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + action?: () => void; +} +/** + * Declaration of the tab item. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ +/** + * Declaration of the tab item. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ +export declare class TabTitleBarTabItem { + /** + * Text description for this tab item. + * @type { ResourceStr }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * Text description for this tab item. + * @type { ResourceStr }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + title: ResourceStr; + /** + * Icon resource for this tab item. + * @type { ?ResourceStr }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * Icon resource for this tab item. + * @type { ?ResourceStr }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + icon?: ResourceStr; +} +/** + * Declaration of the tabbed title bar. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ +/** + * Declaration of the tabbed title bar. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ +@Component +export declare struct TabTitleBar { + /** + * Tab items on the left side. + * @type { ?Array }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * Tab items on the left side. + * @type { ?Array }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + tabItems: Array; + /** + * Menu items on the right side. + * @type { Array }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * Menu items on the right side. + * @type { Array }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + menuItems?: Array; + /** + * Content builder. Each component corresponds to a tab item. + * The builder needs to be transferred. + * @type { () => void }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * Content builder. Each component corresponds to a tab item. + * The builder needs to be transferred. + * @type { () => void }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + @BuilderParam + swiperContent: () => void; +} diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.arkui.advanced.ToolBar.d.ets b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.arkui.advanced.ToolBar.d.ets new file mode 100755 index 00000000..9b8e0161 --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.arkui.advanced.ToolBar.d.ets @@ -0,0 +1,214 @@ +/* + * Copyright (c) 2023-2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit ArkUI + */ + +/// +import { ResourceStr } from 'GlobalResource'; +/** + * Declare enum ItemState + * @enum { ItemState } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ +/** + * Declare enum ItemState + * @enum { ItemState } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ +export declare enum ItemState { + /** + * Enable type. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * Enable type. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + ENABLE = 1, + /** + * Disable type. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * Disable type. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + DISABLE = 2, + /** + * Activate type. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * Activate type. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + ACTIVATE = 3 +} +/** + * Declare type ToolBarOption + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ +/** + * Declare type ToolBarOption + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ +@Observed +export declare class ToolBarOption { + /** + * Define text content. + * @type { ResourceStr }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * Define text content. + * @type { ResourceStr }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + content: ResourceStr; + /** + * Define the action event. + * @type { ?() => void }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * Define the action event. + * @type { ?() => void }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + action?: () => void; + /** + * Define icon resource. + * @type { ?Resource }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * Define icon resource. + * @type { ?Resource }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + icon?: Resource; + /** + * Define item type. + * @type { ?ItemState }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * Define item type. + * @type { ?ItemState }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + state?: ItemState; +} +/** + * Declare ToolBarOptions use in ToolBar + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ +/** + * Declare ToolBarOptions use in ToolBar + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ +@Observed +export declare class ToolBarOptions extends Array { +} +/** + * Declare Component ToolBar + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ +/** + * Declare Component ToolBar + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ +@Component +export declare struct ToolBar { + /** + * Define toolbar list array. + * @type { ToolBarOptions }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * Define toolbar list array. + * @type { ToolBarOptions }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + @ObjectLink + toolBarList: ToolBarOptions; + /** + * Define toolbar activate item index, default is -1. + * @type { ?number }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * Define toolbar activate item index, default is -1. + * @type { ?number }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + @Prop + activateIndex?: number; + /** + * Define toolbar controller. + * @type { TabsController }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * Define toolbar controller. + * @type { TabsController }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + controller: TabsController; +} diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.arkui.advanced.TreeView.d.ets b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.arkui.advanced.TreeView.d.ets new file mode 100755 index 00000000..5d2a8e61 --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.arkui.advanced.TreeView.d.ets @@ -0,0 +1,545 @@ +/* +* Copyright (C) 2023-2023 Huawei Device Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +/** + * @file + * @kit ArkUI + */ + +/// +import { ResourceStr } from 'GlobalResource'; +/** + * Control style of operation element + * @enum { TreeListenType } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ +/** + * Control style of operation element + * @enum { TreeListenType } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ +export declare enum TreeListenType { + /** + * register listener after a node is clicked. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * register listener after a node is clicked. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + NODE_CLICK = "NodeClick", + /** + * register listener after a node is add. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * register listener after a node is add. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + NODE_ADD = "NodeAdd", + /** + * register listener after a node is delected. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * register listener after a node is delected. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + NODE_DELETE = "NodeDelete", + /** + * register listener after a node is modified. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * register listener after a node is modified. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + NODE_MODIFY = "NodeModify", + /** + * register listener after a node is moved. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * register listener after a node is moved. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + NODE_MOVE = "NodeMove" +} +/** + * Declare class TreeListener + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ +/** + * Declare class TreeListener + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ +export declare class TreeListener { + /** + * Event registration and processing. + * The event will not be destroyed after being processed. + * + * @param { type } event Registered Events. + * @param { callback }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * Event registration and processing. + * The event will not be destroyed after being processed. + * + * @param { type } event Registered Events. + * @param { callback }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + on(type: TreeListenType, callback: (callbackParam: CallbackParam) => void): void; + /** + * Event registration and processing. + * After the event is processed once, it will be destroyed. + * + * @param { type } event Registered Events. + * @param { callback }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * Event registration and processing. + * After the event is processed once, it will be destroyed. + * + * @param { type } event Registered Events. + * @param { callback }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + once(type: TreeListenType, callback: (callbackParam: CallbackParam) => void): void; + /** + * Destroy event. + * + * @param { type } event Registered Events. + * @param { callback }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * Destroy event. + * + * @param { type } event Registered Events. + * @param { callback }. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + off(type: TreeListenType, callback?: (callbackParam: CallbackParam) => void): void; +} +/** + * Declare class TreeListenerManager + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ +/** + * Declare class TreeListenerManager + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ +export declare class TreeListenerManager { + /** + * Get instance of treeListenerManager. + * @return treeListenerManager instance + * @static + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * Get instance of treeListenerManager. + * @return treeListenerManager instance + * @static + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + static getInstance(): TreeListenerManager; + /** + * Get treeListener. + * @return treeListener object + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * Get treeListener. + * @return treeListener object + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + getTreeListener(): TreeListener; +} +/** + * Declare TreeView Component + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ +/** + * Declare TreeView Component + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 12 + */ +@Component +export declare struct TreeView { + /** + * Node data source of TreeView. + * @type TreeController + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * Node data source of TreeView. + * @type TreeController + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + treeController: TreeController; +} +/** + * Declare CallbackParam + * @typedef CallbackParam + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ +/** + * Declare CallbackParam + * @typedef CallbackParam + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ +export interface CallbackParam { + /** + * Get the currentNodeId. + * @type { number } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * Get the currentNodeId. + * @type { number } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + currentNodeId: number; + /** + * Get the parentNodeId. + * @type { number } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * Get the parentNodeId. + * @type { number } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + parentNodeId?: number; + /** + * Get the childIndex. + * @type { number } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * Get the childIndex. + * @type { number } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + childIndex?: number; +} +/** + * Declare NodeParam + * @typedef NodeParam + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ +/** + * Declare NodeParam + * @typedef NodeParam + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ +export interface NodeParam { + /** + * Set the parentNodeId. + * @type { number } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * Set the parentNodeId. + * @type { number } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + parentNodeId?: number; + /** + * Set currentNodeId. + * @type { number } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * Set currentNodeId. + * @type { number } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + currentNodeId?: number; + /** + * Set catalog whether is floder. + * @type { boolean } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * Set catalog whether is floder. + * @type { boolean } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + isFolder?: boolean; + /** + * Set the icon resource. + * @type { Resource } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * Set the icon resource. + * @type { Resource } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + icon?: ResourceStr; + /** + * Set selected icon resource. + * @type { Resource } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * Set selected icon resource. + * @type { Resource } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + selectedIcon?: ResourceStr; + /** + * Set edit icon resource. + * @type { Resource } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * Set edit icon resource. + * @type { Resource } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + editIcon?: ResourceStr; + /** + * Set primary title content. + * @type { ResourceStr } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * Set primary title content. + * @type { ResourceStr } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + primaryTitle?: ResourceStr; + /** + * Set secondary title content. + * @type { ResourceStr } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * Set secondary title content. + * @type { ResourceStr } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + secondaryTitle?: ResourceStr; + /** + * set subcomponent binded on tree item. + * @type { () => void } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * set subcomponent binded on tree item. + * @type { () => void } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + container?: () => void; +} +/** + * Declare TreeController + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ +/** + * Declare TreeController + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ +export declare class TreeController { + /** + * Delete a node. + * Register an ON_ITEM_DELETE callback through the ListTreeListener mechanism to obtain the IDs of all deleted nodes. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * Delete a node. + * Register an ON_ITEM_DELETE callback through the ListTreeListener mechanism to obtain the IDs of all deleted nodes. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + removeNode(): void; + /** + * Modify the node name. + * Register an ON_ITEM_MODIFY callback to obtain the ID, parent node ID, and node name of the modified node. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * Modify the node name. + * Register an ON_ITEM_MODIFY callback to obtain the ID, parent node ID, and node name of the modified node. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + modifyNode(): void; + /** + * Initialize the interface of the tree view. This interface is used to generate ListNodeDataSource data. + * addNode is only designed for initialization. It can only be invoked during initialization. + * + * A maximum of 50 directory levels can be added. + * + * @param nodeParam Configuration information of the newly added node. + * + * For details, see the comment description of NodeParam. + * @return ListTreeNode Tree view component proxy class. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * Initialize the interface of the tree view. This interface is used to generate ListNodeDataSource data. + * addNode is only designed for initialization. It can only be invoked during initialization. + * + * A maximum of 50 directory levels can be added. + * + * @param nodeParam Configuration information of the newly added node. + * + * For details, see the comment description of NodeParam. + * @return ListTreeNode Tree view component proxy class. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + addNode(nodeParam?: NodeParam): TreeController; + /** + * This interface is called when a secondaryTitle needs to be updated + * + * @param parentId ID of the parent node. + * @param parentSubTitle secondaryTitle of parent node. + * @param currentSubtitle secondaryTitle of current node. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * This interface is called when a secondaryTitle needs to be updated + * + * @param parentId ID of the parent node. + * @param parentSubTitle secondaryTitle of parent node. + * @param currentSubtitle secondaryTitle of current node. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + refreshNode(parentId: number, parentSubTitle: ResourceStr, currentSubtitle: ResourceStr): void; + /** + * After the initialization is complete by calling the addNode interface, + * call this interface to complete initialization. + * + * This interface must be called when you finish initializing the ListTreeView by addNode. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * After the initialization is complete by calling the addNode interface, + * call this interface to complete initialization. + * + * This interface must be called when you finish initializing the ListTreeView by addNode. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + buildDone(): void; +} diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.arkui.componentSnapshot.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.arkui.componentSnapshot.d.ts new file mode 100755 index 00000000..41b92546 --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.arkui.componentSnapshot.d.ts @@ -0,0 +1,91 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit ArkUI + */ +import { AsyncCallback } from './@ohos.base'; +import image from './@ohos.multimedia.image'; +/** + * This module allows developers to export snapshot image from a component or a custom builder. + * + * @namespace componentSnapshot + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 10 + */ +declare namespace componentSnapshot { + /** + * Take a snapshot of the target component. + * + * @param { string } id - Target component ID, set by developer through .id attribute. + * @param { AsyncCallback } callback - Callback that contains the snapshot in PixelMap format. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + *
1. Mandatory parameters are left unspecified. + *
2. Incorrect parameters types. + *
3. Parameter verification failed. + * @throws { BusinessError } 100001 - if id is not valid. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 10 + */ + function get(id: string, callback: AsyncCallback): void; + /** + * Take a snapshot of the target component. + * + * @param { string } id - Target component ID, set by developer through .id attribute. + * @returns { Promise } A Promise with the snapshot in PixelMap format. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + *
1. Mandatory parameters are left unspecified. + *
2. Incorrect parameters types. + *
3. Parameter verification failed. + * @throws { BusinessError } 100001 - if id is not valid. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 10 + */ + function get(id: string): Promise; + /** + * Generate a snapshot from a custom component builder. + * + * @param { CustomBuilder } builder - Builder function of a custom component. + * @param { AsyncCallback } callback - Callback that contains the snapshot in PixelMap format. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + *
1. Mandatory parameters are left unspecified. + *
2. Incorrect parameters types. + *
3. Parameter verification failed. + * @throws { BusinessError } 100001 - if builder is not a valid build function. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 10 + */ + function createFromBuilder(builder: CustomBuilder, callback: AsyncCallback): void; + /** + * Generate a snapshot from a custom component builder. + * + * @param { CustomBuilder } builder - Builder function of a custom component. + * @returns { Promise } A Promise with the snapshot in PixelMap format. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + *
1. Mandatory parameters are left unspecified. + *
2. Incorrect parameters types. + *
3. Parameter verification failed. + * @throws { BusinessError } 100001 - if builder is not a valid build function. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 10 + */ + function createFromBuilder(builder: CustomBuilder): Promise; +} +export default componentSnapshot; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.arkui.componentUtils.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.arkui.componentUtils.d.ts new file mode 100755 index 00000000..903954cc --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.arkui.componentUtils.d.ts @@ -0,0 +1,807 @@ +/* + * Copyright (c) 2023-2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit ArkUI + */ +/** + * This module provides functionality for component coordinates and sizes. + * @namespace componentUtils + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ +/** + * This module provides functionality for component coordinates and sizes. + * @namespace componentUtils + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ +/** + * This module provides functionality for component coordinates and sizes. + * @namespace componentUtils + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ +declare namespace componentUtils { + /** + * Component information. + * @typedef ComponentInfo + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * Component information. + * @typedef ComponentInfo + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + /** + * Component information. + * @typedef ComponentInfo + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + interface ComponentInfo { + /** + * component size. + * @type {Size} + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * component size. + * @type {Size} + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + /** + * component size. + * @type {Size} + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + size: Size; + /** + * Obtain attribute information relative to the local. + * @type {Offset} + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * Obtain attribute information relative to the local. + * @type {Offset} + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + /** + * Obtain attribute information relative to the local. + * @type {Offset} + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + localOffset: Offset; + /** + * Obtain attribute information relative to the window. + * @type {Offset} + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * Obtain attribute information relative to the window. + * @type {Offset} + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + /** + * Obtain attribute information relative to the window. + * @type {Offset} + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + windowOffset: Offset; + /** + * Obtain attribute information relative to the screen. + * @type {Offset} + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * Obtain attribute information relative to the screen. + * @type {Offset} + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + /** + * Obtain attribute information relative to the screen. + * @type {Offset} + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + screenOffset: Offset; + /** + * Obtain attribute information for translation. + * @type {TranslateResult} + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * Obtain attribute information for translation. + * @type {TranslateResult} + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + /** + * Obtain attribute information for translation. + * @type {TranslateResult} + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + translate: TranslateResult; + /** + * Obtain attribute information for scale. + * @type {ScaleResult} + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * Obtain attribute information for scale. + * @type {ScaleResult} + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + /** + * Obtain attribute information for scale. + * @type {ScaleResult} + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + scale: ScaleResult; + /** + * Obtain attribute information for rotate. + * @type {RotateResult} + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * Obtain attribute information for rotate. + * @type {RotateResult} + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + /** + * Obtain attribute information for rotate. + * @type {RotateResult} + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + rotate: RotateResult; + /** + * Obtain attribute information of the transformation matrix. + * @type {Matrix4Result} + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * Obtain attribute information of the transformation matrix. + * @type {Matrix4Result} + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + /** + * Obtain attribute information of the transformation matrix. + * @type {Matrix4Result} + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + transform: Matrix4Result; + } + /** + * Defines the size property. + * @typedef Size + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * Defines the size property. + * @typedef Size + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + /** + * Defines the size property. + * @typedef Size + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + interface Size { + /** + * Defines the width property. + * @type {number} + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * Defines the width property. + * @type {number} + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + /** + * Defines the width property. + * @type {number} + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + width: number; + /** + * Defines the height property. + * @type {number} + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * Defines the height property. + * @type {number} + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + /** + * Defines the height property. + * @type {number} + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + height: number; + } + /** + * Defines the offset property. + * @typedef Offset + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * Defines the offset property. + * @typedef Offset + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + /** + * Defines the offset property. + * @typedef Offset + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + interface Offset { + /** + * Coordinate x of the Position. + * @type {number} + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * Coordinate x of the Position. + * @type {number} + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + /** + * Coordinate x of the Position. + * @type {number} + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + x: number; + /** + * Coordinate y of the Position. + * @type {number} + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * Coordinate y of the Position. + * @type {number} + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + /** + * Coordinate y of the Position. + * @type {number} + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + y: number; + } + /** + * Translation Result + * @typedef TranslateResult + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * Translation Result + * @typedef TranslateResult + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + /** + * Translation Result + * @typedef TranslateResult + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + interface TranslateResult { + /** + * Indicates the translation distance of the x-axis, in vp. + * @type {number} + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * Indicates the translation distance of the x-axis, in vp. + * @type {number} + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + /** + * Indicates the translation distance of the x-axis, in vp. + * @type {number} + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + x: number; + /** + * Indicates the translation distance of the y-axis, in vp. + * @type {number} + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * Indicates the translation distance of the y-axis, in vp. + * @type {number} + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + /** + * Indicates the translation distance of the y-axis, in vp. + * @type {number} + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + y: number; + /** + * Indicates the translation distance of the z-axis, in vp. + * @type {number} + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * Indicates the translation distance of the z-axis, in vp. + * @type {number} + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + /** + * Indicates the translation distance of the z-axis, in vp. + * @type {number} + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + z: number; + } + /** + * Scale Result + * @typedef ScaleResult + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * Scale Result + * @typedef ScaleResult + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + /** + * Scale Result + * @typedef ScaleResult + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + interface ScaleResult { + /** + * Zoom factor of the x-axis. + * @type {number} + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * Zoom factor of the x-axis. + * @type {number} + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + /** + * Zoom factor of the x-axis. + * @type {number} + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + x: number; + /** + * Zoom factor of the y-axis. + * @type {number} + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * Zoom factor of the y-axis. + * @type {number} + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + /** + * Zoom factor of the y-axis. + * @type {number} + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + y: number; + /** + * Zoom factor of the z-axis. + * @type {number} + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * Zoom factor of the z-axis. + * @type {number} + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + /** + * Zoom factor of the z-axis. + * @type {number} + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + z: number; + /** + * Transform the x-axis coordinate of the center point. + * @type {number} + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * Transform the x-axis coordinate of the center point. + * @type {number} + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + /** + * Transform the x-axis coordinate of the center point. + * @type {number} + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + centerX: number; + /** + * Transform the y-axis coordinate of the center point. + * @type {number} + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * Transform the y-axis coordinate of the center point. + * @type {number} + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + /** + * Transform the y-axis coordinate of the center point. + * @type {number} + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + centerY: number; + } + /** + * Rotation Result. + * @typedef RotateResult + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * Rotation Result. + * @typedef RotateResult + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + /** + * Rotation Result. + * @typedef RotateResult + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + interface RotateResult { + /** + * Axis of rotation vector x coordinate. + * @type {number} + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * Axis of rotation vector x coordinate. + * @type {number} + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + /** + * Axis of rotation vector x coordinate. + * @type {number} + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + x: number; + /** + * Axis of rotation vector y coordinate. + * @type {number} + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * Axis of rotation vector y coordinate. + * @type {number} + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + /** + * Axis of rotation vector y coordinate. + * @type {number} + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + y: number; + /** + * Axis of rotation vector z coordinate. + * @type {number} + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * Axis of rotation vector z coordinate. + * @type {number} + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + /** + * Axis of rotation vector z coordinate. + * @type {number} + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + z: number; + /** + * Transform the x-axis coordinate of the center point. + * @type {number} + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * Transform the x-axis coordinate of the center point. + * @type {number} + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + /** + * Transform the x-axis coordinate of the center point. + * @type {number} + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + centerX: number; + /** + * Transform the y-axis coordinate of the center point. + * @type {number} + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * Transform the y-axis coordinate of the center point. + * @type {number} + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + /** + * Transform the y-axis coordinate of the center point. + * @type {number} + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + centerY: number; + /** + * Rotation angle. + * @type {number} + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * Rotation angle. + * @type {number} + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + /** + * Rotation angle. + * @type {number} + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + angle: number; + } + /** + * The matrix is column-first fourth-order matrix. + * @typedef Matrix4Result + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * The matrix is column-first fourth-order matrix. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + /** + * The matrix is column-first fourth-order matrix. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + type Matrix4Result = [ + number, + number, + number, + number, + number, + number, + number, + number, + number, + number, + number, + number, + number, + number, + number, + number + ]; + /** + * Provide the ability to obtain the coordinates and size of component drawing areas. + * @param {string} id - component id. + * @returns {ComponentInfo} the object of ComponentInfo. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 10 + */ + /** + * Provide the ability to obtain the coordinates and size of component drawing areas. + * @param {string} id - component id. + * @returns {ComponentInfo} the object of ComponentInfo. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 11 + */ + function getRectangleById(id: string): ComponentInfo; +} +export default componentUtils; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.arkui.dragController.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.arkui.dragController.d.ts new file mode 100755 index 00000000..48eacc05 --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.arkui.dragController.d.ts @@ -0,0 +1,448 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit ArkUI + */ + +/// +import type { AsyncCallback, Callback } from './@ohos.base'; +import type unifiedDataChannel from './@ohos.data.unifiedDataChannel'; +import type { CustomBuilder, DragItemInfo, DragEvent, DragPreviewOptions } from 'DragControllerParam'; +/** + * This module allows developers to trigger a drag event. + * @namespace dragController + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ +/** + * This module allows developers to trigger a drag event. + * @namespace dragController + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 12 + */ +declare namespace dragController { + /** + * Defines the Drag Status. + * + * @enum { number } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 11 + */ + /** + * Defines the Drag Status. + * + * @enum { number } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 12 + */ + const enum DragStatus { + /** + * Drag has started. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 11 + */ + /** + * Drag has started. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 12 + */ + STARTED = 0, + /** + * Drag has ended. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 11 + */ + /** + * Drag has ended. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 12 + */ + ENDED = 1 + } + /** + * Drag and drop information + * + * @interface DragAndDropInfo + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 11 + */ + /** + * Drag and drop information + * + * @interface DragAndDropInfo + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 12 + */ + interface DragAndDropInfo { + /** + * The drag status. + * @type { DragStatus } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 11 + */ + /** + * The drag status. + * @type { DragStatus } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 12 + */ + status: DragStatus; + /** + * The information containing the drag event. + * @type { DragEvent } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 11 + */ + /** + * The information containing the drag event. + * @type { DragEvent } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 12 + */ + event: DragEvent; + /** + * Additional information about the drag info. + * @type { ?string } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 11 + */ + /** + * Additional information about the drag info. + * @type { ?string } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 12 + */ + extraParams?: string; + } + /** + * One drag action object for drag process + * + * @interface DragAction + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 11 + */ + /** + * One drag action object for drag process + * + * @interface DragAction + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 12 + */ + interface DragAction { + /** + * trigger drag action + * + * @returns { Promise } A Promise can indicate the start result. + * @throws { BusinessError } 100001 - if some internal handling failed. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 11 + */ + /** + * trigger drag action + * + * @returns { Promise } A Promise can indicate the start result. + * @throws { BusinessError } 100001 - if some internal handling failed. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 12 + */ + startDrag(): Promise; + /** + * Registers a callback for listening on drag status changes. + * This callback is triggered when the drag status change. + * + * @param { 'statusChange' } type for status changing + * @param { Callback } callback with drag event and status information + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 11 + */ + /** + * Registers a callback for listening on drag status changes. + * This callback is triggered when the drag status change. + * + * @param { 'statusChange' } type for status changing + * @param { Callback } callback with drag event and status information + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 12 + */ + on(type: 'statusChange', callback: Callback): void; + /** + * Deregisters a callback for listening on drag status changes. + * This callback is not triggered when the drag status change. + * + * @param { 'statusChange' } type for status changing + * @param { Callback } callback with drag event and status information + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 11 + */ + /** + * Deregisters a callback for listening on drag status changes. + * This callback is not triggered when the drag status change. + * + * @param { 'statusChange' } type for status changing + * @param { Callback } callback with drag event and status information + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 12 + */ + off(type: 'statusChange', callback?: Callback): void; + } + /** + * DragInfo object description + * + * @interface DragInfo + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * DragInfo object description + * + * @interface DragInfo + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 12 + */ + interface DragInfo { + /** + * A unique identifier to identify which touch point. + * @type { number } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + pointerId: number; + /** + * Drag data. + * @type { ?unifiedDataChannel.UnifiedData } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + data?: unifiedDataChannel.UnifiedData; + /** + * Additional information about the drag info. + * @type { ?string } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + extraParams?: string; + /** + * Touch point coordinates. + * @type { ?TouchPoint } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 11 + */ + /** + * Touch point coordinates. + * @type { ?TouchPoint } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 12 + */ + touchPoint?: TouchPoint; + /** + * Drag preview options. + * @type { ?DragPreviewOptions } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 11 + */ + /** + * Drag preview options. + * @type { ?DragPreviewOptions } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 12 + */ + previewOptions?: DragPreviewOptions; + } + /** + * Defines the animation options for drag preview. + * + * @interface AnimationOptions + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 11 + */ + /** + * Defines the animation options for drag preview. + * + * @interface AnimationOptions + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 12 + */ + interface AnimationOptions { + /** + * Animation duration, in ms. + * @type { ?number } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 11 + */ + /** + * Animation duration, in ms. + * @type { ?number } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 12 + */ + duration?: number; + /** + * Animation curve. + * @type { ?(Curve | ICurve) } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 11 + */ + /** + * Animation curve. + * @type { ?(Curve | ICurve) } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 12 + */ + curve?: Curve | ICurve; + } + /** + * Provides the functions of setting color or updating animation. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 11 + */ + /** + * Provides the functions of setting color or updating animation. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 12 + */ + export class DragPreview { + /** + * change foreground color of preview + * @param { ResourceColor } color - color value + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 11 + */ + /** + * change foreground color of preview + * @param { ResourceColor } color - color value + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 12 + */ + setForegroundColor(color: ResourceColor): void; + /** + * update preview style with animation + * @param { AnimationOptions } options - animation options + * @param { function } handler - change style functions + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 11 + */ + /** + * update preview style with animation + * @param { AnimationOptions } options - animation options + * @param { function } handler - change style functions + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 12 + */ + animate(options: AnimationOptions, handler: () => void): void; + } + /** + * Execute a drag event. + * @param { CustomBuilder | DragItemInfo } custom - Object used for prompts displayed when the object is dragged. + * @param { DragInfo } dragInfo - Information about the drag event. + * @param { AsyncCallback<{ event: DragEvent, extraParams: string }> } callback - Callback that contains the drag event information. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + *
1. Mandatory parameters are left unspecified. + *
2. Incorrect parameters types. + *
3. Parameter verification failed. + * @throws { BusinessError } 100001 - if some internal handling failed. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + function executeDrag(custom: CustomBuilder | DragItemInfo, dragInfo: DragInfo, callback: AsyncCallback<{ + event: DragEvent; + extraParams: string; + }>): void; + /** + * Execute a drag event. + * @param { CustomBuilder | DragItemInfo } custom - Object used for prompts displayed when the object is dragged. + * @param { DragInfo } dragInfo - Information about the drag event. + * @returns { Promise<{ event: DragEvent, extraParams: string }> } A Promise with the drag event information. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + *
1. Mandatory parameters are left unspecified. + *
2. Incorrect parameters types. + *
3. Parameter verification failed. + * @throws { BusinessError } 100001 - if some internal handling failed. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + function executeDrag(custom: CustomBuilder | DragItemInfo, dragInfo: DragInfo): Promise<{ + event: DragEvent; + extraParams: string; + }>; + /** + * Create one drag action object, which can be used for starting drag later or monitoring + * the drag status after drag started. + * @param { Array } customArray - Objects used for prompts + * displayed when the objects are dragged. + * @param { DragInfo } dragInfo - Information about the drag event. + * @returns { DragAction } one drag action object + * @throws { BusinessError } 401 - Parameter error. Possible causes: + *
1. Mandatory parameters are left unspecified. + *
2. Incorrect parameters types. + *
3. Parameter verification failed. + * @throws { BusinessError } 100001 - if some internal handling failed. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 11 + */ + /** + * Create one drag action object, which can be used for starting drag later or monitoring + * the drag status after drag started. + * @param { Array } customArray - Objects used for prompts + * displayed when the objects are dragged. + * @param { DragInfo } dragInfo - Information about the drag event. + * @returns { DragAction } one drag action object + * @throws { BusinessError } 401 - Parameter error. Possible causes: + *
1. Mandatory parameters are left unspecified. + *
2. Incorrect parameters types. + *
3. Parameter verification failed. + * @throws { BusinessError } 100001 - if some internal handling failed. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 12 + */ + function createDragAction(customArray: Array, dragInfo: DragInfo): DragAction; + /** + * Get drag preview object. + * @returns { DragPreview } An drag preview object. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 11 + */ + /** + * Get drag preview object. + * @returns { DragPreview } An drag preview object. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 12 + */ + function getDragPreview(): DragPreview; +} +export default dragController; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.arkui.drawableDescriptor.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.arkui.drawableDescriptor.d.ts new file mode 100755 index 00000000..6dfd22da --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.arkui.drawableDescriptor.d.ts @@ -0,0 +1,205 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit ArkUI + */ +import image from './@ohos.multimedia.image'; +/** + * Use the DrawableDescriptor class to get drawable image. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ +/** + * Use the DrawableDescriptor class to get drawable image. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ +export class DrawableDescriptor { + /** + * Get pixelMap of drawable image. + * + * @returns { image.PixelMap } Return the PixelMap of the calling DrawableDescriptor object. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * Get pixelMap of drawable image. + * + * @returns { image.PixelMap } Return the PixelMap of the calling DrawableDescriptor object. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + getPixelMap(): image.PixelMap; +} +/** + * Use the LayeredDrawableDescriptor class to get the foreground, the background and the mask DrawableDescriptor. + * + * @extends DrawableDescriptor + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ +/** + * Use the LayeredDrawableDescriptor class to get the foreground, the background and the mask DrawableDescriptor. + * + * @extends DrawableDescriptor + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ +export class LayeredDrawableDescriptor extends DrawableDescriptor { + /** + * Creates a new LayeredDrawableDescriptor. + * + * @param { DrawableDescriptor } [foreground] - Indicates the foreground option to create LayeredDrawableDescriptor. + * @param { DrawableDescriptor } [background] - Indicates the background option to create LayeredDrawableDescriptor. + * @param { DrawableDescriptor } [mask] - Indicates the mask option to create LayeredDrawableDescriptor. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 12 + */ + constructor(foreground?: DrawableDescriptor, background?: DrawableDescriptor, mask?: DrawableDescriptor); + /** + * Get DrawableDescriptor for the foreground. + * + * @returns { DrawableDescriptor } Return the DrawableDescriptor object of foreground. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * Get DrawableDescriptor for the foreground. + * + * @returns { DrawableDescriptor } Return the DrawableDescriptor object of foreground. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + getForeground(): DrawableDescriptor; + /** + * Get DrawableDescriptor for the background. + * + * @returns { DrawableDescriptor } Return the DrawableDescriptor object of background. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * Get DrawableDescriptor for the background. + * + * @returns { DrawableDescriptor } Return the DrawableDescriptor object of background. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + getBackground(): DrawableDescriptor; + /** + * Get DrawableDescriptor for the mask. + * + * @returns { DrawableDescriptor } Return the DrawableDescriptor object of mask. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * Get DrawableDescriptor for the mask. + * + * @returns { DrawableDescriptor } Return the DrawableDescriptor object of mask. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + getMask(): DrawableDescriptor; + /** + * Get the clip path info of the adaptive icon mask. + * + * @returns { string } Return the clip path info of mask. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * Get the clip path info of the adaptive icon mask. + * + * @returns { string } Return the clip path info of mask. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + static getMaskClipPath(): string; +} +/** + * Use the PixelMapDrawableDescriptor class to get the resource of pixelmap or resource descriptor information. + * + * @extends DrawableDescriptor + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 12 + */ +export class PixelMapDrawableDescriptor extends DrawableDescriptor { + /** + * Creates a new PixelMapDrawableDescriptor. + * @param { image.PixelMap } src - Indicates the resource to create PixelMapDrawableDescriptor. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 12 + */ + constructor(src?: image.PixelMap); +} +/** + * Animation control options + * + * @interface AnimationOptions + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + */ +declare interface AnimationOptions { + /** + * The duration of animation playback once. + * + * @type { ?number } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + */ + duration?: number; + /** + * Animation playback times. + * + * @type { ?number } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + */ + iterations?: number; +} +/** + * Define the data structure for PixelMap animations. + * + * @extends DrawableDescriptor + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + */ +export class AnimatedDrawableDescriptor extends DrawableDescriptor { + /** + * Creates a new AnimatedDrawableDescriptor. + * + * @param { Array } pixelMaps - PixelMap List. + * @param { AnimationOptions } [options] - Animation control options. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + */ + constructor(pixelMaps: Array, options?: AnimationOptions); +} diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.arkui.inspector.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.arkui.inspector.d.ts new file mode 100755 index 00000000..6bc967c2 --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.arkui.inspector.d.ts @@ -0,0 +1,151 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit ArkUI + */ +/** + * Used to do observer layout and draw event for component. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 10 + */ +/** + * Used to do observer layout and draw event for component. + * + * @namespace inspector + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ +declare namespace inspector { + /** + * The ComponentObserver is used to listen for layout and draw events. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 10 + */ + /** + * The ComponentObserver is used to listen for layout and draw events. + * + * @interface ComponentObserver + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + interface ComponentObserver { + /** + * Registers a callback with the corresponding query condition by using the handle. + * This callback is triggered when the component layout complete. + * @param { string } type - type of the listened event. + * @param { ()=>void } callback - callback of the listened event. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 10 + */ + /** + * Registers a callback with the corresponding query condition by using the handle. + * This callback is triggered when the component layout complete. + * @param { 'layout' } type - type of the listened event. + * @param { function } callback - callback of the listened event. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + on(type: 'layout', callback: () => void): void; + /** + * Deregisters a callback with the corresponding query condition by using the handle. + * This callback is not triggered when the component layout complete. + * @param { string } type - type of the listened event. + * @param { ()=>void } callback - callback of the listened event. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 10 + */ + /** + * Deregisters a callback with the corresponding query condition by using the handle. + * This callback is not triggered when the component layout complete. + * @param { 'layout' } type - type of the listened event. + * @param { function } callback - callback of the listened event. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + off(type: 'layout', callback?: () => void): void; + /** + * Registers a callback with the corresponding query condition by using the handle. + * This callback is triggered when the component draw complete. + * @param { string } type - type of the listened event. + * @param { ()=>void } callback - callback of the listened event. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 10 + */ + /** + * Registers a callback with the corresponding query condition by using the handle. + * This callback is triggered when the component draw complete. + * @param { 'draw' } type - type of the listened event. + * @param { function } callback - callback of the listened event. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + on(type: 'draw', callback: () => void): void; + /** + * Deregisters a callback with the corresponding query condition by using the handle. + * This callback is not triggered when the component draw complete. + * @param { string } type - type of the listened event. + * @param { ()=>void } callback - callback of the listened event. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 10 + */ + /** + * Deregisters a callback with the corresponding query condition by using the handle. + * This callback is not triggered when the component draw complete. + * @param { 'draw' } type - type of the listened event. + * @param { function } callback - callback of the listened event. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + off(type: 'draw', callback?: () => void): void; + } + /** + * Sets the component after layout or draw criteria and returns the corresponding listening handle + * @param { string } id - component id. + * @returns { ComponentObserver } create listener for observer component event. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 10 + */ + /** + * Sets the component after layout or draw criteria and returns the corresponding listening handle + * @param { string } id - component id. + * @returns { ComponentObserver } create listener for observer component event. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + function createComponentObserver(id: string): ComponentObserver; +} +export default inspector; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.arkui.modifier.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.arkui.modifier.d.ts new file mode 100755 index 00000000..6e73ad5b --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.arkui.modifier.d.ts @@ -0,0 +1,518 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * Export CommonModifier, which is used to expose applyNormalAttribute function. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + */ +export { CommonModifier } from './arkui/CommonModifier'; +/** + * Export AlphabetIndexerModifier, which is used to expose applyNormalAttribute function. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + */ +export { AlphabetIndexerModifier } from './arkui/AlphabetIndexerModifier'; +/** + * Export BlankModifier, which is used to expose applyNormalAttribute function. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + */ +export { BlankModifier } from './arkui/BlankModifier'; +/** + * Export ButtonModifier, which is used to expose applyNormalAttribute function. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + */ +export { ButtonModifier } from './arkui/ButtonModifier'; +/** + * Export CalendarPickerModifier, which is used to expose applyNormalAttribute function. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + */ +export { CalendarPickerModifier } from './arkui/CalendarPickerModifier'; +/** + * Export CheckboxModifier, which is used to expose applyNormalAttribute function. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + */ +export { CheckboxModifier } from './arkui/CheckboxModifier'; +/** + * Export CheckboxGroupModifier, which is used to expose applyNormalAttribute function. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + */ +export { CheckboxGroupModifier } from './arkui/CheckboxGroupModifier'; +/** + * Export ColumnModifier, which is used to expose applyNormalAttribute function. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + */ +export { ColumnModifier } from './arkui/ColumnModifier'; +/** + * Export ColumnSplitModifier, which is used to expose applyNormalAttribute function. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + */ +export { ColumnSplitModifier } from './arkui/ColumnSplitModifier'; +/** + * Export CounterModifier, which is used to expose applyNormalAttribute function. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + */ +export { CounterModifier } from './arkui/CounterModifier'; +/** + * Export DataPanelModifier, which is used to expose applyNormalAttribute function. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + */ +export { DataPanelModifier } from './arkui/DataPanelModifier'; +/** + * Export DatePickerModifier, which is used to expose applyNormalAttribute function. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + */ +export { DatePickerModifier } from './arkui/DatePickerModifier'; +/** + * Export DividerModifier, which is used to expose applyNormalAttribute function. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + */ +export { DividerModifier } from './arkui/DividerModifier'; +/** + * Export FormComponentModifier, which is used to expose applyNormalAttribute function. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + */ +export { FormComponentModifier } from './arkui/FormComponentModifier'; +/** + * Export GaugeModifier, which is used to expose applyNormalAttribute function. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + */ +export { GaugeModifier } from './arkui/GaugeModifier'; +/** + * Export GridModifier, which is used to expose applyNormalAttribute function. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + */ +export { GridModifier } from './arkui/GridModifier'; +/** + * Export GridColModifier, which is used to expose applyNormalAttribute function. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + */ +export { GridColModifier } from './arkui/GridColModifier'; +/** + * Export GridItemModifier, which is used to expose applyNormalAttribute function. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + */ +export { GridItemModifier } from './arkui/GridItemModifier'; +/** + * Export GridRowModifier, which is used to expose applyNormalAttribute function. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + */ +export { GridRowModifier } from './arkui/GridRowModifier'; +/** + * Export HyperlinkModifier, which is used to expose applyNormalAttribute function. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + */ +export { HyperlinkModifier } from './arkui/HyperlinkModifier'; +/** + * Export ImageAnimatorModifier, which is used to expose applyNormalAttribute function. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + */ +export { ImageAnimatorModifier } from './arkui/ImageAnimatorModifier'; +/** + * Export ImageModifier, which is used to expose applyNormalAttribute function. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + */ +export { ImageModifier } from './arkui/ImageModifier'; +/** + * Export SymbolGlyphModifier, which is used to expose applyNormalAttribute function. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + */ +export { SymbolGlyphModifier } from './arkui/SymbolGlyphModifier'; +/** + * Export ImageSpanModifier, which is used to expose applyNormalAttribute function. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + */ +export { ImageSpanModifier } from './arkui/ImageSpanModifier'; +/** + * Export LineModifier, which is used to expose applyNormalAttribute function. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + */ +export { LineModifier } from './arkui/LineModifier'; +/** + * Export ListModifier, which is used to expose applyNormalAttribute function. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + */ +export { ListModifier } from './arkui/ListModifier'; +/** + * Export ListItemModifier, which is used to expose applyNormalAttribute function. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + */ +export { ListItemModifier } from './arkui/ListItemModifier'; +/** + * Export ListItemGroupModifier, which is used to expose applyNormalAttribute function. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + */ +export { ListItemGroupModifier } from './arkui/ListItemGroupModifier'; +/** + * Export LoadingProgressModifier, which is used to expose applyNormalAttribute function. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + */ +export { LoadingProgressModifier } from './arkui/LoadingProgressModifier'; +/** + * Export MarqueeModifier, which is used to expose applyNormalAttribute function. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + */ +export { MarqueeModifier } from './arkui/MarqueeModifier'; +/** + * Export MenuModifier, which is used to expose applyNormalAttribute function. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + */ +export { MenuModifier } from './arkui/MenuModifier'; +/** + * Export MenuItemModifier, which is used to expose applyNormalAttribute function. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + */ +export { MenuItemModifier } from './arkui/MenuItemModifier'; +/** + * Export NavDestinationModifier, which is used to expose applyNormalAttribute function. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + */ +export { NavDestinationModifier } from './arkui/NavDestinationModifier'; +/** + * Export NavigationModifier, which is used to expose applyNormalAttribute function. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + */ +export { NavigationModifier } from './arkui/NavigationModifier'; +/** + * Export NavigatorModifier, which is used to expose applyNormalAttribute function. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + */ +export { NavigatorModifier } from './arkui/NavigatorModifier'; +/** + * Export NavRouterModifier, which is used to expose applyNormalAttribute function. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + */ +export { NavRouterModifier } from './arkui/NavRouterModifier'; +/** + * Export PanelModifier, which is used to expose applyNormalAttribute function. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + */ +export { PanelModifier } from './arkui/PanelModifier'; +/** + * Export PathModifier, which is used to expose applyNormalAttribute function. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + */ +export { PathModifier } from './arkui/PathModifier'; +/** + * Export PatternLockModifier, which is used to expose applyNormalAttribute function. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + */ +export { PatternLockModifier } from './arkui/PatternLockModifier'; +/** + * Export PolygonModifier, which is used to expose applyNormalAttribute function. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + */ +export { PolygonModifier } from './arkui/PolygonModifier'; +/** + * Export PolylineModifier, which is used to expose applyNormalAttribute function. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + */ +export { PolylineModifier } from './arkui/PolylineModifier'; +/** + * Export ProgressModifier, which is used to expose applyNormalAttribute function. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + */ +export { ProgressModifier } from './arkui/ProgressModifier'; +/** + * Export QRCodeModifier, which is used to expose applyNormalAttribute function. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + */ +export { QRCodeModifier } from './arkui/QRCodeModifier'; +/** + * Export RadioModifier, which is used to expose applyNormalAttribute function. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + */ +export { RadioModifier } from './arkui/RadioModifier'; +/** + * Export RatingModifier, which is used to expose applyNormalAttribute function. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + */ +export { RatingModifier } from './arkui/RatingModifier'; +/** + * Export RectModifier, which is used to expose applyNormalAttribute function. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + */ +export { RectModifier } from './arkui/RectModifier'; +/** + * Export RefreshModifier, which is used to expose applyNormalAttribute function. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + */ +export { RefreshModifier } from './arkui/RefreshModifier'; +/** + * Export RichEditorModifier, which is used to expose applyNormalAttribute function. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + */ +export { RichEditorModifier } from './arkui/RichEditorModifier'; +/** + * Export RowModifier, which is used to expose applyNormalAttribute function. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + */ +export { RowModifier } from './arkui/RowModifier'; +/** + * Export RowSplitModifier, which is used to expose applyNormalAttribute function. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + */ +export { RowSplitModifier } from './arkui/RowSplitModifier'; +/** + * Export ScrollModifier, which is used to expose applyNormalAttribute function. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + */ +export { ScrollModifier } from './arkui/ScrollModifier'; +/** + * Export SearchModifier, which is used to expose applyNormalAttribute function. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + */ +export { SearchModifier } from './arkui/SearchModifier'; +/** + * Export SelectModifier, which is used to expose applyNormalAttribute function. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + */ +export { SelectModifier } from './arkui/SelectModifier'; +/** + * Export ShapeModifier, which is used to expose applyNormalAttribute function. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + */ +export { ShapeModifier } from './arkui/ShapeModifier'; +/** + * Export SideBarContainerModifier, which is used to expose applyNormalAttribute function. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + */ +export { SideBarContainerModifier } from './arkui/SideBarContainerModifier'; +/** + * Export SliderModifier, which is used to expose applyNormalAttribute function. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + */ +export { SliderModifier } from './arkui/SliderModifier'; +/** + * Export SpanModifier, which is used to expose applyNormalAttribute function. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + */ +export { SpanModifier } from './arkui/SpanModifier'; +/** + * Export StackModifier, which is used to expose applyNormalAttribute function. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + */ +export { StackModifier } from './arkui/StackModifier'; +/** + * Export StepperItemModifier, which is used to expose applyNormalAttribute function. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + */ +export { StepperItemModifier } from './arkui/StepperItemModifier'; +/** + * Export SwiperModifier, which is used to expose applyNormalAttribute function. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + */ +export { SwiperModifier } from './arkui/SwiperModifier'; +/** + * Export TabsModifier, which is used to expose applyNormalAttribute function. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + */ +export { TabsModifier } from './arkui/TabsModifier'; +/** + * Export TextAreaModifier, which is used to expose applyNormalAttribute function. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + */ +export { TextAreaModifier } from './arkui/TextAreaModifier'; +/** + * Export TextModifier, which is used to expose applyNormalAttribute function. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + */ +export { TextModifier } from './arkui/TextModifier'; +/** + * Export TextClockModifier, which is used to expose applyNormalAttribute function. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + */ +export { TextClockModifier } from './arkui/TextClockModifier'; +/** + * Export TextInputModifier, which is used to expose applyNormalAttribute function. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + */ +export { TextInputModifier } from './arkui/TextInputModifier'; +/** + * Export TextPickerModifier, which is used to expose applyNormalAttribute function. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + */ +export { TextPickerModifier } from './arkui/TextPickerModifier'; +/** + * Export TextTimerModifier, which is used to expose applyNormalAttribute function. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + */ +export { TextTimerModifier } from './arkui/TextTimerModifier'; +/** + * Export TimePickerModifier, which is used to expose applyNormalAttribute function. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + */ +export { TimePickerModifier } from './arkui/TimePickerModifier'; +/** + * Export ToggleModifier, which is used to expose applyNormalAttribute function. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + */ +export { ToggleModifier } from './arkui/ToggleModifier'; +/** + * Export VideoModifier, which is used to expose applyNormalAttribute function. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + */ +export { VideoModifier } from './arkui/VideoModifier'; +/** + * Export WaterFlowModifier, which is used to expose applyNormalAttribute function. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + */ +export { WaterFlowModifier } from './arkui/WaterFlowModifier'; +/** + * Export AttributeUpdater, which is used to update attributes to native side. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + */ +export { AttributeUpdater } from './arkui/AttributeUpdater'; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.arkui.node.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.arkui.node.d.ts new file mode 100755 index 00000000..e1cd0ff6 --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.arkui.node.d.ts @@ -0,0 +1,106 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit ArkUI + */ +/** + * Export NodeRenderType, RenderOptions, BuilderNode, which is used to create a node trees by builder function and manage the update of the tree. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ +export { NodeRenderType, RenderOptions, BuilderNode } from './arkui/BuilderNode'; +/** + * Export NodeController, which defines the controller of node container. Provides lifecycle callbacks for the associated NodeContainer + * and methods to control the child node of the NodeContainer. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ +export { NodeController } from './arkui/NodeController'; +/** + * Export FrameNode. FrameNode defines a basic type of node which contains a RenderNode. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ +export { FrameNode, LayoutConstraint } from './arkui/FrameNode'; +/** + * Export FrameNode. FrameNode defines a basic type of node which contains a RenderNode. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + */ +export { typeNode } from './arkui/FrameNode'; +/** + * Export Graphics. Defines the basic types related to the Graphics. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ +export { DrawContext, Size, Offset, Position, Pivot, Scale, Translation, Matrix4, Rotation, Frame, RoundRect, Circle, CommandPath, ShapeMask, BorderRadiuses, CornerRadius, Rect, Edges, edgeColors, edgeWidths, borderStyles, borderRadiuses, LengthMetricsUnit } from './arkui/Graphics'; +/** + * Export Graphics. Defines the basic types related to the Graphics. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + */ +export { LengthUnit, SizeT, LengthMetric, LengthMetrics, ColorMetrics } from './arkui/Graphics'; +/** + * Export RenderNode. RenderNode contains node tree operations and render property operations on node. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ +export { RenderNode } from './arkui/RenderNode'; +/** + * Export XComponentNode, which extends FrameNode. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ +export { XComponentNode } from './arkui/XComponentNode'; +/** + * Export Content. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + */ +export { Content } from './arkui/Content'; +/** + * Export ComponentContent. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + */ +export { ComponentContent } from './arkui/ComponentContent'; +/** + * Export NodeContent. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + */ +export { NodeContent } from './arkui/NodeContent'; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.arkui.observer.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.arkui.observer.d.ts new file mode 100755 index 00000000..58a298aa --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.arkui.observer.d.ts @@ -0,0 +1,1033 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit ArkUI + */ +import type { Callback } from './@ohos.base'; +import type UIAbilityContext from './application/UIAbilityContext'; +/** + * Register callbacks to observe ArkUI behavior. + * + * @namespace uiObserver + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ +/** + * Register callbacks to observe ArkUI behavior. + * + * @namespace uiObserver + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ +declare namespace uiObserver { + /** + * NavDestination state. + * + * @enum { number } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + * @form + */ + /** + * NavDestination state. + * + * @enum { number } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + * @form + */ + export enum NavDestinationState { + /** + * When the NavDestination is displayed. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + * @form + */ + /** + * When the NavDestination displayed. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + * @form + */ + ON_SHOWN = 0, + /** + * When the NavDestination is hidden. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + * @form + */ + /** + * When the NavDestination is hidden. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + * @form + */ + ON_HIDDEN = 1, + /** + * When the NavDestination appear. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + * @form + */ + ON_APPEAR = 2, + /** + * When the NavDestination disappear. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + * @form + */ + ON_DISAPPEAR = 3, + /** + * Before the NavDestination is displayed. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @form + * @atomicservice + * @since 12 + */ + ON_WILL_SHOW = 4, + /** + * Before the NavDestination is hidden. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @form + * @atomicservice + * @since 12 + */ + ON_WILL_HIDE = 5, + /** + * Before the NavDestination is appeared. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @form + * @atomicservice + * @since 12 + */ + ON_WILL_APPEAR = 6, + /** + * Before the NavDestination is disappeared. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @form + * @atomicservice + * @since 12 + */ + ON_WILL_DISAPPEAR = 7, + /** + * When back press event happened in NavDestination. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + * @form + */ + ON_BACKPRESS = 100 + } + /** + * Router page state. + * + * @enum { number } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * Router page state. + * + * @enum { number } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + export enum RouterPageState { + /** + * When the router page create. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * When the router page create. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + ABOUT_TO_APPEAR = 0, + /** + * When the router page destroy. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * When the router page destroy. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + ABOUT_TO_DISAPPEAR = 1, + /** + * When the router page show. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * When the router page show. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + ON_PAGE_SHOW = 2, + /** + * When the router page hide. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * When the router page hide. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + ON_PAGE_HIDE = 3, + /** + * When back press event happened in the router page. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * When back press event happened in the router page. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + ON_BACK_PRESS = 4 + } + /** + * ScrollEvent type. + * + * @enum { number } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + export enum ScrollEventType { + /** + * When the ScrollEvent start. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + SCROLL_START = 0, + /** + * When the ScrollEvent stop. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + SCROLL_STOP = 1 + } + /** + * NavDestination info. + * + * @interface NavDestinationInfo + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * NavDestination info. + * + * @interface NavDestinationInfo + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + export interface NavDestinationInfo { + /** + * Navigation id. + * + * @type { ResourceStr } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * Navigation id. + * + * @type { ResourceStr } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + navigationId: ResourceStr; + /** + * Changed NavDestination name. + * + * @type { ResourceStr } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * Changed NavDestination name. + * + * @type { ResourceStr } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + name: ResourceStr; + /** + * Changed NavDestination state. + * + * @type { NavDestinationState } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * Changed NavDestination state. + * + * @type { NavDestinationState } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + state: NavDestinationState; + /** + * NavDestination index. + * + * @type { number } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + index: number; + /** + * The detailed parameter of NavDestination. + * + * @type { ?Object } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + param?: Object; + /** + * Auto-generated navDestination id, which is different from common property id of Component. + * + * @type { string } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + navDestinationId: string; + } + /** + * Navigation info. + * + * @interface NavigationInfo + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + export interface NavigationInfo { + /** + * Navigation id. + * + * @type { string } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + navigationId: string; + /** + * Navigation path stack. + * + * @type { NavPathStack } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + pathStack: NavPathStack; + } + /** + * ScrollEvent info. + * + * @interface ScrollEventInfo + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + export interface ScrollEventInfo { + /** + * Scroll id. + * + * @type { string } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + id: string; + /** + * The uniqueId of the scrollable component. + * + * @type { number } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + uniqueId: number; + /** + * Changed ScrollEvent type. + * + * @type { ScrollEventType } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + scrollEvent: ScrollEventType; + /** + * Changed ScrollEvent offset. + * + * @type { number } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + offset: number; + } + /** + * observer options. + * + * @interface ObserverOptions + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + export interface ObserverOptions { + /** + * component id. + * + * @type { string } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + id: string; + } + /** + * Router page info. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * Router page info. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + export class RouterPageInfo { + /** + * The context of the changed router page. + * + * @type { UIAbilityContext | UIContext } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * The context of the changed router page. + * + * @type { UIAbilityContext | UIContext } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + context: UIAbilityContext | UIContext; + /** + * The index of the changed router page in router stack. + * + * @type { number } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * The index of the changed router page in router stack. + * + * @type { number } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + index: number; + /** + * The name of the changed router page. + * + * @type { string } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * The name of the changed router page. + * + * @type { string } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + name: string; + /** + * The path of the changed router page. + * + * @type { string } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * The path of the changed router page. + * + * @type { string } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + path: string; + /** + * The state of the changed router page. + * + * @type { RouterPageState } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * The state of the changed router page. + * + * @type { RouterPageState } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + state: RouterPageState; + /** + * The unique identifier of the router page. + * + * @type { string } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + pageId: string; + } + /** + * Density info. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + export class DensityInfo { + /** + * The context of the changed screen density. + * + * @type { UIContext } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + context: UIContext; + /** + * The changed screen density. + * + * @type { number } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + density: number; + } + /** + * NavDestination switch info + * + * @interface NavDestinationSwitchInfo + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + export interface NavDestinationSwitchInfo { + /** + * The context of the navigation operation. + * + * @type { UIAbilityContext | UIContext } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + context: UIAbilityContext | UIContext; + /** + * From navigation content info. + * + * @type { NavDestinationInfo | NavBar } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + from: NavDestinationInfo | NavBar; + /** + * To navigation content info. + * + * @type { NavDestinationInfo | NavBar } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + to: NavDestinationInfo | NavBar; + /** + * The operation type. + * + * @type { NavigationOperation } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + operation: NavigationOperation; + } + /** + * Indicates the options of NavDestination switch. + * + * @interface NavDestinationSwitchObserverOptions + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + export interface NavDestinationSwitchObserverOptions { + /** + * The navigationId that need observation + * + * @type { ResourceStr } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + navigationId: ResourceStr; + } + /** + * Registers a callback function to be called when the navigation destination is updated. + * + * @param { 'navDestinationUpdate' } type - The type of event to listen for. Must be 'navDestinationUpdate'. + * @param { object } options - The options object. + * @param { Callback } callback - The callback function to be called when the navigation destination is updated. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * Registers a callback function to be called when the navigation destination is updated. + * + * @param { 'navDestinationUpdate' } type - The type of event to listen for. Must be 'navDestinationUpdate'. + * @param { object } options - The options object. + * @param { Callback } callback - The callback function to be called when the navigation destination is updated. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + export function on(type: 'navDestinationUpdate', options: { + navigationId: ResourceStr; + }, callback: Callback): void; + /** + * Removes a callback function that was previously registered with `on()`. + * + * @param { 'navDestinationUpdate' } type - The type of event to remove the listener for. Must be 'navDestinationUpdate'. + * @param { object } options - The options object. + * @param { Callback } callback - The callback function to remove. If not provided, all callbacks for the given event type and + * navigation ID will be removed. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * Removes a callback function that was previously registered with `on()`. + * + * @param { 'navDestinationUpdate' } type - The type of event to remove the listener for. Must be 'navDestinationUpdate'. + * @param { object } options - The options object. + * @param { Callback } callback - The callback function to remove. If not provided, all callbacks for the given event type and + * navigation ID will be removed. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + export function off(type: 'navDestinationUpdate', options: { + navigationId: ResourceStr; + }, callback?: Callback): void; + /** + * Registers a callback function to be called when the navigation destination is updated. + * + * @param { 'navDestinationUpdate' } type - The type of event to listen for. Must be 'navDestinationUpdate'. + * @param { Callback } callback - The callback function to be called when the navigation destination is updated. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * Registers a callback function to be called when the navigation destination is updated. + * + * @param { 'navDestinationUpdate' } type - The type of event to listen for. Must be 'navDestinationUpdate'. + * @param { Callback } callback - The callback function to be called when the navigation destination is updated. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + export function on(type: 'navDestinationUpdate', callback: Callback): void; + /** + * Removes a callback function that was previously registered with `on()`. + * + * @param { 'navDestinationUpdate'} type - The type of event to remove the listener for. Must be 'navDestinationUpdate'. + * @param { Callback } [callback] - The callback function to remove. If not provided, all callbacks for the given event type + * will be removed. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * Removes a callback function that was previously registered with `on()`. + * + * @param { 'navDestinationUpdate'} type - The type of event to remove the listener for. Must be 'navDestinationUpdate'. + * @param { Callback } [callback] - The callback function to remove. If not provided, all callbacks for the given event type + * will be removed. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + export function off(type: 'navDestinationUpdate', callback?: Callback): void; + /** + * Registers a callback function to be called when the scroll event start or stop. + * + * @param { 'scrollEvent' } type - The type of event to listen for. Must be 'scrollEvent'. + * @param { ObserverOptions } options - The options object. + * @param { Callback } callback - The callback function to be called when the scroll event start or stop. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + export function on(type: 'scrollEvent', options: ObserverOptions, callback: Callback): void; + /** + * Removes a callback function that was previously registered with `on()`. + * + * @param { 'scrollEvent' } type - The type of event to remove the listener for. Must be 'scrollEvent'. + * @param { ObserverOptions } options - The options object. + * @param { Callback } callback - The callback function to remove. If not provided, all callbacks for the given event type and + * scroll ID will be removed. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + export function off(type: 'scrollEvent', options: ObserverOptions, callback?: Callback): void; + /** + * Registers a callback function to be called when the scroll event start or stop. + * + * @param { 'scrollEvent' } type - The type of event to listen for. Must be 'scrollEvent'. + * @param { Callback } callback - The callback function to be called when the scroll event start or stop. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + export function on(type: 'scrollEvent', callback: Callback): void; + /** + * Removes a callback function that was previously registered with `on()`. + * + * @param { 'scrollEvent'} type - The type of event to remove the listener for. Must be 'scrollEvent'. + * @param { Callback } [callback] - The callback function to remove. If not provided, all callbacks for the given event type + * will be removed. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + export function off(type: 'scrollEvent', callback?: Callback): void; + /** + * Registers a callback function to be called when the router page is updated. + * + * @param { 'routerPageUpdate' } type - The type of event to listen for. Must be 'routerPageUpdate'. + * @param { UIAbilityContext | UIContext } context - The context scope of the observer. + * @param { Callback } callback - The callback function to be called when the router page is updated. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * Registers a callback function to be called when the router page is updated. + * + * @param { 'routerPageUpdate' } type - The type of event to listen for. Must be 'routerPageUpdate'. + * @param { UIAbilityContext | UIContext } context - The context scope of the observer. + * @param { Callback } callback - The callback function to be called when the router page is updated. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + export function on(type: 'routerPageUpdate', context: UIAbilityContext | UIContext, callback: Callback): void; + /** + * Removes a callback function that was previously registered with `on()`. + * + * @param { 'routerPageUpdate' } type - The type of event to remove the listener for. Must be 'routerPageUpdate'. + * @param { UIAbilityContext | UIContext } context - The context scope of the observer. + * @param { Callback } [callback] - The callback function to remove. If not provided, all callbacks for the given event type + * will be removed. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * Removes a callback function that was previously registered with `on()`. + * + * @param { 'routerPageUpdate' } type - The type of event to remove the listener for. Must be 'routerPageUpdate'. + * @param { UIAbilityContext | UIContext } context - The context scope of the observer. + * @param { Callback } [callback] - The callback function to remove. If not provided, all callbacks for the given event type + * will be removed. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + export function off(type: 'routerPageUpdate', context: UIAbilityContext | UIContext, callback?: Callback): void; + /** + * Registers a callback function to be called when the screen density is updated. + * + * @param { 'densityUpdate' } type - The type of event to listen for. Must be 'densityUpdate'. + * @param { UIContext } context - The context scope of the observer. + * @param { Callback } callback - The callback function to be called when the screen density is updated. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + export function on(type: 'densityUpdate', context: UIContext, callback: Callback): void; + /** + * Removes a callback function that was previously registered with `on()`. + * + * @param { 'densityUpdate' } type - The type of event to remove the listener for. Must be 'densityUpdate'. + * @param { UIContext } context - The context scope of the observer. + * @param { Callback } [callback] - The callback function to remove. If not provided, all callbacks for the given event type + * will be removed. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + export function off(type: 'densityUpdate', context: UIContext, callback?: Callback): void; + /** + * Registers a callback function to be called when the draw command will be drawn. + * + * @param { 'willDraw' } type - The type of event to listen for. Must be 'willDraw'. + * @param { UIContext } context - The context scope of the observer. + * @param { Callback } callback - The callback function to be called when the draw command will be drawn. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + export function on(type: 'willDraw', context: UIContext, callback: Callback): void; + /** + * Removes a callback function that was previously registered with `on()`. + * + * @param { 'willDraw' } type - The type of event to remove the listener for. Must be 'willDraw'. + * @param { UIContext } context - The context scope of the observer. + * @param { Callback } [callback] - The callback function to remove. If not provided, all callbacks for the given event type + * will be removed. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + export function off(type: 'willDraw', context: UIContext, callback?: Callback): void; + /** + * Registers a callback function to be called when the layout is done. + * + * @param { 'didLayout' } type - The type of event to listen for. Must be 'didLayout'. + * @param { UIContext } context - The context scope of the observer. + * @param { Callback } callback - The callback function to be called when the layout is done. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + export function on(type: 'didLayout', context: UIContext, callback: Callback): void; + /** + * Removes a callback function that was previously registered with `on()`. + * + * @param { 'didLayout' } type - The type of event to remove the listener for. Must be 'didLayout'. + * @param { UIContext } context - The context scope of the observer. + * @param { Callback } [callback] - The callback function to remove. If not provided, all callbacks for the given event type + * will be removed. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + export function off(type: 'didLayout', context: UIContext, callback?: Callback): void; + /** + * Registers a callback function to be called when the navigation switched to a new navDestination. + * + * @param { 'navDestinationSwitch' } type - The type of event to listen for. Must be 'navDestinationSwitch'. + * @param { UIAbilityContext | UIContext } context - The context scope of the observer. + * @param { Callback } callback - The callback function to be called when the navigation switched to a new navDestination. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + export function on(type: 'navDestinationSwitch', context: UIAbilityContext | UIContext, callback: Callback): void; + /** + * Removes a callback function that was previously registered with `on()`. + * + * @param { 'navDestinationSwitch' } type - The type of event to remove the listener for. Must be 'navDestinationSwitch'. + * @param { UIAbilityContext | UIContext } context - The context scope of the observer. + * @param { Callback } [callback] - The callback function to remove. If not provided, all callbacks for the given event type + * will be removed. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + export function off(type: 'navDestinationSwitch', context: UIAbilityContext | UIContext, callback?: Callback): void; + /** + * Registers a callback function to be called when the navigation switched to a new navDestination. + * + * @param { 'navDestinationSwitch' } type - The type of event to listen for. Must be 'navDestinationSwitch'. + * @param { UIAbilityContext | UIContext } context - The context scope of the observer. + * @param { NavDestinationSwitchObserverOptions } observerOptions - Options. + * @param { Callback } callback - The callback function to be called when the navigation switched to a new navDestination. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + export function on(type: 'navDestinationSwitch', context: UIAbilityContext | UIContext, observerOptions: NavDestinationSwitchObserverOptions, callback: Callback): void; + /** + * Removes a callback function that was previously registered with `on()`. + * + * @param { 'navDestinationSwitch' } type - The type of event to remove the listener for. Must be 'navDestinationSwitch'. + * @param { UIAbilityContext | UIContext } context - The context scope of the observer. + * @param { NavDestinationSwitchObserverOptions } observerOptions - Options. + * @param { Callback } [callback] - The callback function to remove. If not provided, all callbacks for the given event type + * will be removed. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + export function off(type: 'navDestinationSwitch', context: UIAbilityContext | UIContext, observerOptions: NavDestinationSwitchObserverOptions, callback?: Callback): void; +} +export default uiObserver; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.arkui.shape.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.arkui.shape.d.ts new file mode 100755 index 00000000..21c4f216 --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.arkui.shape.d.ts @@ -0,0 +1,325 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit ArkUI + */ +/** + * Interface for shape size properties. + * + * @interface ShapeSize + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + * @form + */ +interface ShapeSize { + /** + * Defines the width of Shape. + * @type { ? (number | string) } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 12 + * @form + */ + width?: number | string; + /** + * Defines the height of Shape. + * @type { ? (number | string) } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 12 + * @form + */ + height?: number | string; +} +/** + * Interface for RectShape constructor parameters. + * + * @interface RectShapeOptions + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + * @form + */ +interface RectShapeOptions extends ShapeSize { + /** + * Defines the corner radius of the RectShape. + * @type { ? (number | string | Array) } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 12 + * @form + */ + radius?: number | string | Array; +} +/** + * Interface for RectShape constructor parameters with separate radius values. + * + * @interface RoundRectShapeOptions + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + * @form + */ +interface RoundRectShapeOptions extends ShapeSize { + /** + * Defines the width of the corner radius for RectShape. + * @type { ? (number | string) } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 12 + * @form + */ + radiusWidth?: number | string; + /** + * Defines the height of the corner radius for RectShape. + * @type { ? (number | string) } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 12 + * @form + */ + radiusHeight?: number | string; +} +/** + * Interface for PathShape constructor parameters. + * + * @interface PathShapeOptions + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + * @form + */ +interface PathShapeOptions { + /** + * Defines the commands for drawing the PathShape. + * @type { ?string } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 12 + * @form + */ + commands?: string; +} +/** + * Common shape method class + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + * @form + */ +declare class CommonShapeMethod { + /** + * Sets coordinate offset relative to the layout completion position. + * + * @param { Position } offset + * @returns { T } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + * @form + */ + offset(offset: Position): T; + /** + * Sets the fill color of the shape. + * + * @param { ResourceColor } color + * @returns { T } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + * @form + */ + fill(color: ResourceColor): T; + /** + * Sets the position of the shape. + * + * @param { Position } position + * @returns { T } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + * @form + */ + position(position: Position): T; +} +/** + * Base shape class + * + * @extends CommonShapeMethod + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + * @form + */ +declare class BaseShape extends CommonShapeMethod { + /** + * Sets the width of the shape. + * + * @param { Length } width + * @returns { T } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + * @form + */ + width(width: Length): T; + /** + * Sets the height of the shape. + * + * @param { Length } height + * @returns { T } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + * @form + */ + height(height: Length): T; + /** + * Sets the size of the shape. + * + * @param { SizeOptions } size + * @returns { T } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + * @form + */ + size(size: SizeOptions): T; +} +/** + * Defines a rect drawing class. + * + * @extends BaseShape + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + * @form + */ +export declare class RectShape extends BaseShape { + /** + * Constructor. + * + * @param { RectShapeOptions | RoundRectShapeOptions } options + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + * @form + */ + constructor(options?: RectShapeOptions | RoundRectShapeOptions); + /** + * Sets the width of the corner radius for RectShape. + * + * @param { number | string } rWidth + * @returns { RectShape } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + * @form + */ + radiusWidth(rWidth: number | string): RectShape; + /** + * Sets the height of the corner radius for RectShape. + * + * @param { number | string } rHeight + * @returns { RectShape } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + * @form + */ + radiusHeight(rHeight: number | string): RectShape; + /** + * Sets the corner radius for RectShape. + * + * @param { number | string | Array } radius + * @returns { RectShape } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + * @form + */ + radius(radius: number | string | Array): RectShape; +} +/** + * Defines a circle drawing class. + * + * @extends BaseShape + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + * @form + */ +export declare class CircleShape extends BaseShape { + /** + * Constructor. + * + * @param { ShapeSize } options + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + * @form + */ + constructor(options?: ShapeSize); +} +/** + * Defines an ellipse drawing class. + * + * @extends BaseShape + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + * @form + */ +export declare class EllipseShape extends BaseShape { + /** + * Constructor. + * + * @param { ShapeSize } options + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + * @form + */ + constructor(options?: ShapeSize); +} +/** + * Defines a path drawing class. + * + * @extends CommonShapeMethod + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + * @form + */ +export declare class PathShape extends CommonShapeMethod { + /** + * Constructor. + * + * @param { PathShapeOptions } options + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + * @form + */ + constructor(options?: PathShapeOptions); + /** + * Sets the commands for drawing the PathShape. + * + * @param { string } commands + * @returns { PathShape } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + * @form + */ + commands(commands: string): PathShape; +} diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.arkui.theme.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.arkui.theme.d.ts new file mode 100755 index 00000000..d73962e0 --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.arkui.theme.d.ts @@ -0,0 +1,613 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit ArkUI + */ +/** + * Defines the struct of Theme. + * + * @interface Theme + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ +export declare interface Theme { + /** + * Define tokens associated with color resources. + * + * @type { Colors } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + colors: Colors; +} +/** + * Defines the struct of Colors. + * + * @interface Colors + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ +export declare interface Colors { + /** + * System brand Color. + * + * @type { ResourceColor } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + brand: ResourceColor; + /** + * System warning Color. + * + * @type { ResourceColor } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + warning: ResourceColor; + /** + * System alert Color. + * + * @type { ResourceColor } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + alert: ResourceColor; + /** + * System confirm Color. + * + * @type { ResourceColor } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + confirm: ResourceColor; + /** + * First level text color. + * + * @type { ResourceColor } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + fontPrimary: ResourceColor; + /** + * Secondary text color. + * + * @type { ResourceColor } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + fontSecondary: ResourceColor; + /** + * tertiary text color. + * + * @type { ResourceColor } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + fontTertiary: ResourceColor; + /** + * Fourth text color. + * + * @type { ResourceColor } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + fontFourth: ResourceColor; + /** + * Emphasize text color. + * + * @type { ResourceColor } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + fontEmphasize: ResourceColor; + /** + * First level text inversion, used on colored backgrounds. + * + * @type { ResourceColor } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + fontOnPrimary: ResourceColor; + /** + * Secondary level text inversion, used on colored backgrounds. + * + * @type { ResourceColor } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + fontOnSecondary: ResourceColor; + /** + * Tertiary level text inversion, used on colored backgrounds. + * + * @type { ResourceColor } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + fontOnTertiary: ResourceColor; + /** + * Fourth level text inversion, used on colored backgrounds. + * + * @type { ResourceColor } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + fontOnFourth: ResourceColor; + /** + * First level icon color. + * + * @type { ResourceColor } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + iconPrimary: ResourceColor; + /** + * Secondary level icon color. + * + * @type { ResourceColor } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + iconSecondary: ResourceColor; + /** + * Tertiary level icon color. + * + * @type { ResourceColor } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + iconTertiary: ResourceColor; + /** + * Fourth level icon color. + * + * @type { ResourceColor } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + iconFourth: ResourceColor; + /** + * Emphasize level icon color. + * + * @type { ResourceColor } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + iconEmphasize: ResourceColor; + /** + * Secondary emphasize level icon color. + * + * @type { ResourceColor } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + iconSubEmphasize: ResourceColor; + /** + * First level icon reversed, used on a colored background. + * + * @type { ResourceColor } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + iconOnPrimary: ResourceColor; + /** + * Secondary level icon reversed, used on a colored background. + * + * @type { ResourceColor } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + iconOnSecondary: ResourceColor; + /** + * Tertiary level icon reversed, used on a colored background. + * + * @type { ResourceColor } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + iconOnTertiary: ResourceColor; + /** + * Fourth level icon reversed, used on a colored background. + * + * @type { ResourceColor } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + iconOnFourth: ResourceColor; + /** + * System Primary level background color. + * + * @type { ResourceColor } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + backgroundPrimary: ResourceColor; + /** + * System Secondary level background color. + * + * @type { ResourceColor } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + backgroundSecondary: ResourceColor; + /** + * System tertiary level background color. + * + * @type { ResourceColor } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + backgroundTertiary: ResourceColor; + /** + * System fourth level background color. + * + * @type { ResourceColor } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + backgroundFourth: ResourceColor; + /** + * System emphasize level background color. + * + * @type { ResourceColor } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + backgroundEmphasize: ResourceColor; + /** + * CompForegroundPrimary color. + * + * @type { ResourceColor } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + compForegroundPrimary: ResourceColor; + /** + * CompBackgroundPrimary color. + * + * @type { ResourceColor } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + compBackgroundPrimary: ResourceColor; + /** + * CompBackgroundPrimaryTran color. + * + * @type { ResourceColor } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + compBackgroundPrimaryTran: ResourceColor; + /** + * CompBackgroundPrimaryContrary color. + * + * @type { ResourceColor } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + compBackgroundPrimaryContrary: ResourceColor; + /** + * CompBackgroundGray color. + * + * @type { ResourceColor } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + compBackgroundGray: ResourceColor; + /** + * 10% black universal control background. + * + * @type { ResourceColor } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + compBackgroundSecondary: ResourceColor; + /** + * 5% black universal control background. + * + * @type { ResourceColor } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + compBackgroundTertiary: ResourceColor; + /** + * 100% bright brand background color. + * + * @type { ResourceColor } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + compBackgroundEmphasize: ResourceColor; + /** + * Black neutral high gloss color. + * + * @type { ResourceColor } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + compBackgroundNeutral: ResourceColor; + /** + * 20% High gloss brand background color. + * + * @type { ResourceColor } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + compEmphasizeSecondary: ResourceColor; + /** + * 10% High gloss brand background color. + * + * @type { ResourceColor } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + compEmphasizeTertiary: ResourceColor; + /** + * Universal Division Line Color + * + * @type { ResourceColor } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + compDivider: ResourceColor; + /** + * CompCommonContrary Color + * + * @type { ResourceColor } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + compCommonContrary: ResourceColor; + /** + * CompBackgroundFocus Color + * + * @type { ResourceColor } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + compBackgroundFocus: ResourceColor; + /** + * CompFocusedPrimary Color + * + * @type { ResourceColor } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + compFocusedPrimary: ResourceColor; + /** + * CompFocusedSecondary Color + * + * @type { ResourceColor } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + compFocusedSecondary: ResourceColor; + /** + * CompFocusedTertiary Color + * + * @type { ResourceColor } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + compFocusedTertiary: ResourceColor; + /** + * Hover interactive color + * + * @type { ResourceColor } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + interactiveHover: ResourceColor; + /** + * Pressed interactive color + * + * @type { ResourceColor } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + interactivePressed: ResourceColor; + /** + * Focus interactive color + * + * @type { ResourceColor } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + interactiveFocus: ResourceColor; + /** + * Active interactive color + * + * @type { ResourceColor } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + interactiveActive: ResourceColor; + /** + * Select interactive color + * + * @type { ResourceColor } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + interactiveSelect: ResourceColor; + /** + * Click interactive color + * + * @type { ResourceColor } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + interactiveClick: ResourceColor; +} +/** + * Defines the struct of CustomTheme. + * + * @interface CustomTheme + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ +export declare interface CustomTheme { + /** + * Define tokens associated with color resources.. + * + * @type { ?CustomColors } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + colors?: CustomColors; +} +/** + * Defines the struct of CustomColors. + * + * @typedef { Partial } CustomColors + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ +export declare type CustomColors = Partial; +/** + * Class ThemeControl provides the Theme management for whole Ability and pages. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ +export declare class ThemeControl { + /** + * Sets the default Theme: + * - for whole Ability when invoked from the Ability level code. + * - for the ArkUI page and for later opened pages when invoked at the ArkUI page level. + * + * @param { CustomTheme } theme + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + static setDefaultTheme(theme: CustomTheme): void; +} diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.arkui.uiExtension.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.arkui.uiExtension.d.ts new file mode 100755 index 00000000..42125cf2 --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.arkui.uiExtension.d.ts @@ -0,0 +1,147 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit ArkUI + */ +import { Callback } from './@ohos.base'; +import window from './@ohos.window'; +/** + * uiExtension. + * + * @namespace uiExtension + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 12 + */ +declare namespace uiExtension { + /** + * The proxy of the UIExtension window. + * + * @interface WindowProxy + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 12 + */ + interface WindowProxy { + /** + * Get the avoid area. + * + * @param { window.AvoidAreaType } type - Type of the avoid area. + * @returns { window.AvoidArea } Area where the window cannot be displayed. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + *
1. Mandatory parameters are left unspecified. + *
2. Incorrect parameters types. + *
3. Parameter verification failed. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 12 + */ + getWindowAvoidArea(type: window.AvoidAreaType): window.AvoidArea; + /** + * Register the callback of avoidAreaChange. + * + * @param { 'avoidAreaChange' } type - The value is fixed at 'avoidAreaChange', indicating the event of changes to the avoid area. + * @param { Callback } callback - Callback used to return the avoid area information. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + *
1. Mandatory parameters are left unspecified. + *
2. Incorrect parameters types. + *
3. Parameter verification failed. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 12 + */ + on(type: 'avoidAreaChange', callback: Callback): void; + /** + * Unregister the callback of avoidAreaChange. + * + * @param { 'avoidAreaChange' } type - The value is fixed at 'avoidAreaChange', indicating the event of changes to the avoid area. + * @param { Callback } callback - Callback used to return the avoid area information. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + *
1. Mandatory parameters are left unspecified. + *
2. Incorrect parameters types. + *
3. Parameter verification failed. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 12 + */ + off(type: 'avoidAreaChange', callback?: Callback): void; + /** + * Register the callback of windowSizeChange. + * + * @param { 'windowSizeChange' } type - The value is fixed at 'windowSizeChange', indicating the window size change event. + * @param { Callback } callback - Callback used to return the window size. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + *
1. Mandatory parameters are left unspecified. + *
2. Incorrect parameters types. + *
3. Parameter verification failed. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 12 + */ + on(type: 'windowSizeChange', callback: Callback): void; + /** + * Unregister the callback of windowSizeChange. + * + * @param { 'windowSizeChange' } type - The value is fixed at 'windowSizeChange', indicating the window size change event. + * @param { Callback } callback - Callback used to return the window size. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + *
1. Mandatory parameters are left unspecified. + *
2. Incorrect parameters types. + *
3. Parameter verification failed. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 12 + */ + off(type: 'windowSizeChange', callback?: Callback): void; + /** + * Create sub window. + * + * @param { string } name - window name of sub window. + * @param { window.SubWindowOptions } subWindowOptions - options of sub window creation. + * @returns { Promise } Promise used to return the subwindow. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + *
1. Mandatory parameters are left unspecified. + *
2. Incorrect parameters types. + *
3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported on this device. + * @throws { BusinessError } 1300002 - This window state is abnormal. + * @throws { BusinessError } 1300005 - This window proxy is abnormal. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @StageModelOnly + * @since 12 + */ + createSubWindowWithOptions(name: string, subWindowOptions: window.SubWindowOptions): Promise; + } + /** + * Defines the avoid area information. + * + * @interface AvoidAreaInfo + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 12 + */ + interface AvoidAreaInfo { + /** + * Describes the type of avoid area. + * + * @type { window.AvoidAreaType } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 12 + */ + type: window.AvoidAreaType; + /** + * Describes the position and size of avoid area. + * + * @type { window.AvoidArea } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 12 + */ + area: window.AvoidArea; + } +} +export default uiExtension; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.backgroundTaskManager.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.backgroundTaskManager.d.ts new file mode 100755 index 00000000..b3721989 --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.backgroundTaskManager.d.ts @@ -0,0 +1,216 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit BackgroundTasksKit + */ +import { AsyncCallback, Callback } from './@ohos.base'; +import { WantAgent } from './@ohos.wantAgent'; +import Context from './application/BaseContext'; +/** + * Manages background tasks. + * + * @since 7 + * @syscap SystemCapability.ResourceSchedule.BackgroundTaskManager.TransientTask + * @deprecated since 9 + * @useinstead ohos.resourceschedule.backgroundTaskManager + */ +declare namespace backgroundTaskManager { + /** + * The info of delay suspend. + * + * @name DelaySuspendInfo + * @interface DelaySuspendInfo + * @since 7 + * @syscap SystemCapability.ResourceSchedule.BackgroundTaskManager.TransientTask + * @deprecated since 9 + * @useinstead ohos.resourceschedule.backgroundTaskManager.DelaySuspendInfo + */ + interface DelaySuspendInfo { + /** + * The unique identifier of the delay request. + * + * @since 7 + * @syscap SystemCapability.ResourceSchedule.BackgroundTaskManager.TransientTask + * @deprecated since 9 + * @useinstead ohos.resourceschedule.backgroundTaskManager.DelaySuspendInfo + */ + requestId: number; + /** + * The actual delay duration (ms). + * + * @since 7 + * @syscap SystemCapability.ResourceSchedule.BackgroundTaskManager.TransientTask + * @deprecated since 9 + * @useinstead ohos.resourceschedule.backgroundTaskManager.DelaySuspendInfo + */ + actualDelayTime: number; + } + /** + * Cancels delayed transition to the suspended state. + * + * @since 7 + * @syscap SystemCapability.ResourceSchedule.BackgroundTaskManager.TransientTask + * @param { number } requestId Indicates the identifier of the delay request. + * @deprecated since 9 + * @useinstead ohos.resourceschedule.backgroundTaskManager.cancelSuspendDelay + */ + function cancelSuspendDelay(requestId: number): void; + /** + * Obtains the remaining time before an application enters the suspended state. + * + * @param { number } requestId Indicates the identifier of the delay request. + * @param { AsyncCallback } callback - The callback of the remaining delay time. + * @syscap SystemCapability.ResourceSchedule.BackgroundTaskManager.TransientTask + * @since 7 + * @deprecated since 9 + * @useinstead ohos.resourceschedule.backgroundTaskManager.getRemainingDelayTime + */ + function getRemainingDelayTime(requestId: number, callback: AsyncCallback): void; + /** + * Obtains the remaining time before an application enters the suspended state. + * + * @param { number } requestId Indicates the identifier of the delay request. + * @syscap SystemCapability.ResourceSchedule.BackgroundTaskManager.TransientTask + * @since 7 + * @deprecated since 9 + * @useinstead ohos.resourceschedule.backgroundTaskManager.getRemainingDelayTime + */ + function getRemainingDelayTime(requestId: number): Promise; + /** + * Requests delayed transition to the suspended state. + * + * @since 7 + * @syscap SystemCapability.ResourceSchedule.BackgroundTaskManager.TransientTask + * @param { string } reason Indicates the reason for delayed transition to the suspended state. + * @param { Callback } callback The callback delay time expired. + * @returns { DelaySuspendInfo } Info of delay request + * @deprecated since 9 + * @useinstead ohos.resourceschedule.backgroundTaskManager.requestSuspendDelay + */ + function requestSuspendDelay(reason: string, callback: Callback): DelaySuspendInfo; + /** + * Service ability uses this method to request start running in background. + * system will publish a notification related to the this service. + * + * @permission ohos.permission.KEEP_BACKGROUND_RUNNING + * @param { Context } context app running context. + * @param { BackgroundMode } bgMode Indicates which background mode to request. + * @param { WantAgent } wantAgent Indicates which ability to start when user click the notification bar. + * @param { AsyncCallback } callback - The callback of the function. + * @syscap SystemCapability.ResourceSchedule.BackgroundTaskManager.ContinuousTask + * @since 8 + * @deprecated since 9 + * @useinstead ohos.resourceschedule.backgroundTaskManager.startBackgroundRunning + */ + function startBackgroundRunning(context: Context, bgMode: BackgroundMode, wantAgent: WantAgent, callback: AsyncCallback): void; + /** + * Service ability uses this method to request start running in background. + * system will publish a notification related to the this service. + * + * @permission ohos.permission.KEEP_BACKGROUND_RUNNING + * @param { Context } context app running context. + * @param { BackgroundMode } bgMode Indicates which background mode to request. + * @param { WantAgent } wantAgent Indicates which ability to start when user click the notification bar. + * @syscap SystemCapability.ResourceSchedule.BackgroundTaskManager.ContinuousTask + * @since 8 + * @deprecated since 9 + * @useinstead ohos.resourceschedule.backgroundTaskManager.startBackgroundRunning + */ + function startBackgroundRunning(context: Context, bgMode: BackgroundMode, wantAgent: WantAgent): Promise; + /** + * Service ability uses this method to request stop running in background. + * + * @param { Context } context - App running context. + * @param { AsyncCallback } callback - The callback of the function. + * @syscap SystemCapability.ResourceSchedule.BackgroundTaskManager.ContinuousTask + * @since 8 + * @deprecated since 9 + * @useinstead ohos.resourceschedule.backgroundTaskManager.stopBackgroundRunning + */ + function stopBackgroundRunning(context: Context, callback: AsyncCallback): void; + /** + * Service ability uses this method to request stop running in background. + * + * @param { Context } context - App running context. + * @syscap SystemCapability.ResourceSchedule.BackgroundTaskManager.ContinuousTask + * @since 8 + * @deprecated since 9 + * @useinstead ohos.resourceschedule.backgroundTaskManager.stopBackgroundRunning + */ + function stopBackgroundRunning(context: Context): Promise; + /** + * Supported background mode. + * + * @enum { number } + * @since 8 + * @syscap SystemCapability.ResourceSchedule.BackgroundTaskManager.ContinuousTask + * @deprecated since 9 + * @useinstead ohos.resourceschedule.backgroundTaskManager.BackgroundMode + */ + export enum BackgroundMode { + /** + * data transfer mode + * + * @since 8 + * @syscap SystemCapability.ResourceSchedule.BackgroundTaskManager.ContinuousTask + */ + DATA_TRANSFER = 1, + /** + * audio playback mode + * + * @since 8 + * @syscap SystemCapability.ResourceSchedule.BackgroundTaskManager.ContinuousTask + */ + AUDIO_PLAYBACK = 2, + /** + * audio recording mode + * + * @since 8 + * @syscap SystemCapability.ResourceSchedule.BackgroundTaskManager.ContinuousTask + */ + AUDIO_RECORDING = 3, + /** + * location mode + * + * @since 8 + * @syscap SystemCapability.ResourceSchedule.BackgroundTaskManager.ContinuousTask + */ + LOCATION = 4, + /** + * bluetooth interaction mode + * + * @since 8 + * @syscap SystemCapability.ResourceSchedule.BackgroundTaskManager.ContinuousTask + */ + BLUETOOTH_INTERACTION = 5, + /** + * multi-device connection mode + * + * @since 8 + * @syscap SystemCapability.ResourceSchedule.BackgroundTaskManager.ContinuousTask + */ + MULTI_DEVICE_CONNECTION = 6, + /** + * background continuous calculate mode, for example 3D render. + * only supported in particular device + * + * @since 8 + * @syscap SystemCapability.ResourceSchedule.BackgroundTaskManager.ContinuousTask + */ + TASK_KEEPING = 9 + } +} +export default backgroundTaskManager; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.base.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.base.d.ts new file mode 100755 index 00000000..053f8e4f --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.base.d.ts @@ -0,0 +1,287 @@ +/* + * Copyright (c) 2021-2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit BasicServicesKit + */ +/** + * Defines the basic callback. + * @typedef Callback + * @syscap SystemCapability.Base + * @since 6 + */ +/** + * Defines the basic callback. + * @typedef Callback + * @syscap SystemCapability.Base + * @crossplatform + * @since 10 + */ +/** + * Defines the basic callback. + * @typedef Callback + * @syscap SystemCapability.Base + * @crossplatform + * @atomicservice + * @since 11 + */ +/** + * Defines the basic callback. + * @typedef Callback + * @syscap SystemCapability.Base + * @crossplatform + * @form + * @atomicservice + * @since 12 + */ +export interface Callback { + /** + * Defines the callback info. + * @param { T } data + * @syscap SystemCapability.Base + * @since 6 + */ + /** + * Defines the callback info. + * @param { T } data + * @syscap SystemCapability.Base + * @crossplatform + * @since 10 + */ + /** + * Defines the callback info. + * @param { T } data + * @syscap SystemCapability.Base + * @crossplatform + * @atomicservice + * @since 11 + */ + /** + * Defines the callback info. + * @param { T } data + * @syscap SystemCapability.Base + * @crossplatform + * @form + * @atomicservice + * @since 12 + */ + (data: T): void; +} +/** + * Defines the basic error callback. + * @typedef ErrorCallback + * @syscap SystemCapability.Base + * @since 6 + */ +/** + * Defines the basic error callback. + * @typedef ErrorCallback + * @syscap SystemCapability.Base + * @crossplatform + * @since 10 + */ +/** + * Defines the basic error callback. + * @typedef ErrorCallback + * @syscap SystemCapability.Base + * @crossplatform + * @atomicservice + * @since 11 + */ +export interface ErrorCallback { + /** + * Defines the basic error callback. + * @param { T } err + * @syscap SystemCapability.Base + * @since 6 + */ + /** + * Defines the basic error callback. + * @param { T } err + * @syscap SystemCapability.Base + * @crossplatform + * @since 10 + */ + /** + * Defines the basic error callback. + * @param { T } err + * @syscap SystemCapability.Base + * @crossplatform + * @atomicservice + * @since 11 + */ + (err: T): void; +} +/** + * Defines the basic async callback. + * @typedef AsyncCallback + * @syscap SystemCapability.Base + * @since 6 + */ +/** + * Defines the basic async callback. + * @typedef AsyncCallback + * @syscap SystemCapability.Base + * @crossplatform + * @since 10 + */ +/** + * Defines the basic async callback. + * @typedef AsyncCallback + * @syscap SystemCapability.Base + * @crossplatform + * @atomicservice + * @since 11 + */ +/** + * Defines the basic async callback. + * @typedef AsyncCallback + * @syscap SystemCapability.Base + * @crossplatform + * @form + * @atomicservice + * @since 12 + */ +export interface AsyncCallback { + /** + * Defines the callback data. + * @param { BusinessError } err + * @param { T } data + * @syscap SystemCapability.Base + * @since 6 + */ + /** + * Defines the callback data. + * @param { BusinessError } err + * @param { T } data + * @syscap SystemCapability.Base + * @crossplatform + * @since 10 + */ + /** + * Defines the callback data. + * @param { BusinessError } err + * @param { T } data + * @syscap SystemCapability.Base + * @crossplatform + * @atomicservice + * @since 11 + */ + /** + * Defines the callback data. + * @param { BusinessError } err + * @param { T } data + * @syscap SystemCapability.Base + * @crossplatform + * @form + * @atomicservice + * @since 12 + */ + (err: BusinessError, data: T): void; +} +/** + * Defines the error interface. + * @typedef BusinessError + * @syscap SystemCapability.Base + * @since 6 + */ +/** + * Defines the error interface. + * @typedef BusinessError + * @syscap SystemCapability.Base + * @crossplatform + * @since 10 + */ +/** + * Defines the error interface. + * @typedef BusinessError + * @syscap SystemCapability.Base + * @crossplatform + * @atomicservice + * @since 11 + */ +/** + * Defines the error interface. + * @typedef BusinessError + * @syscap SystemCapability.Base + * @crossplatform + * @form + * @atomicservice + * @since 12 + */ +export interface BusinessError extends Error { + /** + * Defines the basic error code. + * @type { number } code + * @syscap SystemCapability.Base + * @since 6 + */ + /** + * Defines the basic error code. + * @type { number } code + * @syscap SystemCapability.Base + * @crossplatform + * @since 10 + */ + /** + * Defines the basic error code. + * @type { number } code + * @syscap SystemCapability.Base + * @crossplatform + * @atomicservice + * @since 11 + */ + /** + * Defines the basic error code. + * @type { number } code + * @syscap SystemCapability.Base + * @crossplatform + * @form + * @atomicservice + * @since 12 + */ + code: number; + /** + * Defines the additional information for business + * @type { ?T } data + * @syscap SystemCapability.Base + * @since 9 + */ + /** + * Defines the additional information for business + * @type { ?T } data + * @syscap SystemCapability.Base + * @crossplatform + * @since 10 + */ + /** + * Defines the additional information for business + * @type { ?T } data + * @syscap SystemCapability.Base + * @crossplatform + * @atomicservice + * @since 11 + */ + /** + * Defines the additional information for business + * @type { ?T } data + * @syscap SystemCapability.Base + * @crossplatform + * @form + * @atomicservice + * @since 12 + */ + data?: T; +} diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.batteryInfo.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.batteryInfo.d.ts new file mode 100755 index 00000000..a28f2811 --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.batteryInfo.d.ts @@ -0,0 +1,419 @@ +/* + * Copyright (c) 2021-2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit BasicServicesKit + */ +/** + * Obtains battery information of a device. + *

Battery information includes the remaining battery power, + * voltage, temperature, model, and charger type. + * + * @namespace batteryInfo + * @syscap SystemCapability.PowerManager.BatteryManager.Core + * @since 6 + */ +/** + * Obtains battery information of a device. + *

Battery information includes the remaining battery power, + * voltage, temperature, model, and charger type. + * + * @namespace batteryInfo + * @syscap SystemCapability.PowerManager.BatteryManager.Core + * @atomicservice + * @since 12 + */ +declare namespace batteryInfo { + /** + * Battery state of charge (SoC) of the current device, in percent. + * + * @constant + * @syscap SystemCapability.PowerManager.BatteryManager.Core + * @since 6 + */ + /** + * Battery state of charge (SoC) of the current device, in percent. + * + * @constant + * @syscap SystemCapability.PowerManager.BatteryManager.Core + * @atomicservice + * @since 12 + */ + const batterySOC: number; + /** + * Battery charging status of the current device. + * + * @constant + * @syscap SystemCapability.PowerManager.BatteryManager.Core + * @since 6 + */ + /** + * Battery charging status of the current device. + * + * @constant + * @syscap SystemCapability.PowerManager.BatteryManager.Core + * @atomicservice + * @since 12 + */ + const chargingStatus: BatteryChargeState; + /** + * Battery health state of the current device. + * + * @constant + * @syscap SystemCapability.PowerManager.BatteryManager.Core + * @since 6 + */ + const healthStatus: BatteryHealthState; + /** + * Charger type of the current device. + * + * @constant + * @syscap SystemCapability.PowerManager.BatteryManager.Core + * @since 6 + */ + const pluggedType: BatteryPluggedType; + /** + * Battery voltage of the current device, in µV. + * + * @constant + * @syscap SystemCapability.PowerManager.BatteryManager.Core + * @since 6 + */ + const voltage: number; + /** + * Battery technology of the current device. + * + * @constant + * @syscap SystemCapability.PowerManager.BatteryManager.Core + * @since 6 + */ + const technology: string; + /** + * Battery temperature of the current device, in 0.1℃. + * + * @constant + * @syscap SystemCapability.PowerManager.BatteryManager.Core + * @since 6 + */ + const batteryTemperature: number; + /** + * Battery present state of the current device. + * + * @constant + * @syscap SystemCapability.PowerManager.BatteryManager.Core + * @since 7 + */ + const isBatteryPresent: boolean; + /** + * Battery capacity level of the current device. + * + * @constant + * @syscap SystemCapability.PowerManager.BatteryManager.Core + * @since 9 + */ + const batteryCapacityLevel: BatteryCapacityLevel; + /** + * Charger type of a device. + * + * @enum { number } + * @syscap SystemCapability.PowerManager.BatteryManager.Core + * @since 6 + */ + export enum BatteryPluggedType { + /** + * Unknown type + * + * @syscap SystemCapability.PowerManager.BatteryManager.Core + * @since 6 + */ + NONE, + /** + * AC charger + * + * @syscap SystemCapability.PowerManager.BatteryManager.Core + * @since 6 + */ + AC, + /** + * USB charger + * + * @syscap SystemCapability.PowerManager.BatteryManager.Core + * @since 6 + */ + USB, + /** + * Wireless charger + * + * @syscap SystemCapability.PowerManager.BatteryManager.Core + * @since 6 + */ + WIRELESS + } + /** + * Battery charging status of a device. + * + * @enum { number } + * @syscap SystemCapability.PowerManager.BatteryManager.Core + * @since 6 + */ + /** + * Battery charging status of a device. + * + * @enum { number } + * @syscap SystemCapability.PowerManager.BatteryManager.Core + * @atomicservice + * @since 12 + */ + export enum BatteryChargeState { + /** + * Unknown state. + * + * @syscap SystemCapability.PowerManager.BatteryManager.Core + * @since 6 + */ + /** + * Unknown state. + * + * @syscap SystemCapability.PowerManager.BatteryManager.Core + * @atomicservice + * @since 12 + */ + NONE, + /** + * The battery is being charged. + * + * @syscap SystemCapability.PowerManager.BatteryManager.Core + * @since 6 + */ + /** + * The battery is being charged. + * + * @syscap SystemCapability.PowerManager.BatteryManager.Core + * @atomicservice + * @since 12 + */ + ENABLE, + /** + * The battery is not being charged. + * + * @syscap SystemCapability.PowerManager.BatteryManager.Core + * @since 6 + */ + /** + * The battery is not being charged. + * + * @syscap SystemCapability.PowerManager.BatteryManager.Core + * @atomicservice + * @since 12 + */ + DISABLE, + /** + * The battery is fully charged. + * + * @syscap SystemCapability.PowerManager.BatteryManager.Core + * @since 6 + */ + /** + * The battery is fully charged. + * + * @syscap SystemCapability.PowerManager.BatteryManager.Core + * @atomicservice + * @since 12 + */ + FULL + } + /** + * Battery health status of a device. + * + * @enum { number } + * @syscap SystemCapability.PowerManager.BatteryManager.Core + * @since 6 + */ + export enum BatteryHealthState { + /** + * Unknown state. + * + * @syscap SystemCapability.PowerManager.BatteryManager.Core + * @since 6 + */ + UNKNOWN, + /** + * The battery is in healthy state. + * + * @syscap SystemCapability.PowerManager.BatteryManager.Core + * @since 6 + */ + GOOD, + /** + * The battery is overheated. + * + * @syscap SystemCapability.PowerManager.BatteryManager.Core + * @since 6 + */ + OVERHEAT, + /** + * The battery voltage is over high. + * + * @syscap SystemCapability.PowerManager.BatteryManager.Core + * @since 6 + */ + OVERVOLTAGE, + /** + * The battery temperature is low. + * + * @syscap SystemCapability.PowerManager.BatteryManager.Core + * @since 6 + */ + COLD, + /** + * The battery is dead. + * + * @syscap SystemCapability.PowerManager.BatteryManager.Core + * @since 6 + */ + DEAD + } + /** + * Battery capacity level of a device. + * + * @enum { number } + * @syscap SystemCapability.PowerManager.BatteryManager.Core + * @since 9 + */ + export enum BatteryCapacityLevel { + /** + * The battery is in full capacity level. + * + * @syscap SystemCapability.PowerManager.BatteryManager.Core + * @since 9 + */ + LEVEL_FULL, + /** + * The battery is in high capacity level. + * + * @syscap SystemCapability.PowerManager.BatteryManager.Core + * @since 9 + */ + LEVEL_HIGH, + /** + * The battery is in normal capacity level. + * + * @syscap SystemCapability.PowerManager.BatteryManager.Core + * @since 9 + */ + LEVEL_NORMAL, + /** + * The battery is in low capacity level. + * + * @syscap SystemCapability.PowerManager.BatteryManager.Core + * @since 9 + */ + LEVEL_LOW, + /** + * The battery is in warning low capacity level. + * + * @syscap SystemCapability.PowerManager.BatteryManager.Core + * @since 9 + */ + LEVEL_WARNING, + /** + * The battery is in critical low capacity level. + * + * @syscap SystemCapability.PowerManager.BatteryManager.Core + * @since 9 + */ + LEVEL_CRITICAL, + /** + * The battery is in the lowest capacity level, system will shut down automatically in a few seconds. + * + * @syscap SystemCapability.PowerManager.BatteryManager.Core + * @since 9 + */ + LEVEL_SHUTDOWN + } + /** + * Extra key of common event COMMON_EVENT_BATTERY_CHANGED. + * + * @enum { string } + * @syscap SystemCapability.PowerManager.BatteryManager.Core + * @since 9 + */ + export enum CommonEventBatteryChangedKey { + /** + * Extra code of batterySOC. + * + * @syscap SystemCapability.PowerManager.BatteryManager.Core + * @since 9 + */ + EXTRA_SOC = 'soc', + /** + * Extra code of chargingStatus. + * + * @syscap SystemCapability.PowerManager.BatteryManager.Core + * @since 9 + */ + EXTRA_CHARGE_STATE = 'chargeState', + /** + * Extra code of healthStatus. + * + * @syscap SystemCapability.PowerManager.BatteryManager.Core + * @since 9 + */ + EXTRA_HEALTH_STATE = 'healthState', + /** + * Extra code of pluggedType. + * + * @syscap SystemCapability.PowerManager.BatteryManager.Core + * @since 9 + */ + EXTRA_PLUGGED_TYPE = 'pluggedType', + /** + * Extra code of voltage. + * + * @syscap SystemCapability.PowerManager.BatteryManager.Core + * @since 9 + */ + EXTRA_VOLTAGE = 'voltage', + /** + * Extra code of technology. + * + * @syscap SystemCapability.PowerManager.BatteryManager.Core + * @since 9 + */ + EXTRA_TECHNOLOGY = 'technology', + /** + * Extra code of batteryTemperature. + * + * @syscap SystemCapability.PowerManager.BatteryManager.Core + * @since 9 + */ + EXTRA_TEMPERATURE = 'temperature', + /** + * Extra code of isBatteryPresent. + * + * @syscap SystemCapability.PowerManager.BatteryManager.Core + * @since 9 + */ + EXTRA_PRESENT = 'present', + /** + * Extra code of batteryCapacityLevel. + * + * @syscap SystemCapability.PowerManager.BatteryManager.Core + * @since 9 + */ + EXTRA_CAPACITY_LEVEL = 'capacityLevel' + } +} +export default batteryInfo; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.bluetooth.a2dp.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.bluetooth.a2dp.d.ts new file mode 100755 index 00000000..e2ef2810 --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.bluetooth.a2dp.d.ts @@ -0,0 +1,298 @@ +/* + * Copyright (C) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit ConnectivityKit + */ + +import type baseProfile from './@ohos.bluetooth.baseProfile'; +/** + * Provides methods to accessing bluetooth audio related capabilities. + * + * @namespace a2dp + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ +declare namespace a2dp { + /** + * Base interface of profile. + * + * @typedef { baseProfile.BaseProfile } BaseProfile + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + type BaseProfile = baseProfile.BaseProfile; + /** + * create the instance of a2dp profile. + * + * @returns { A2dpSourceProfile } Returns the instance of profile. + * @throws { BusinessError } 401 - Invalid parameter.Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + function createA2dpSrcProfile(): A2dpSourceProfile; + /** + * Manager a2dp source profile. + * + * @typedef A2dpSourceProfile + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + interface A2dpSourceProfile extends BaseProfile { + /** + * Obtains the playing state of device. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF". + * @returns { PlayingState } Returns the playing state. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth switch is off. + * @throws { BusinessError } 2900004 - Profile is not supported. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + getPlayingState(deviceId: string): PlayingState; + } + /** + * Describes the codec information. + * + * @typedef CodecInfo + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 11 + */ + interface CodecInfo { + /** + * codec type + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 11 + */ + codecType: CodecType; + /** + * codec bits per sample. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 11 + */ + codecBitsPerSample: CodecBitsPerSample; + /** + * codec channel mode. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 11 + */ + codecChannelMode: CodecChannelMode; + /** + * codec sample rate. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 11 + */ + codecSampleRate: CodecSampleRate; + } + /** + * The enum of a2dp playing state. + * + * @enum { number } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + enum PlayingState { + /** + * Not playing. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + STATE_NOT_PLAYING, + /** + * Playing. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + STATE_PLAYING + } + /** + * Describes the codec type. + * + * @enum { number } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 11 + */ + enum CodecType { + /** + * invalid codec type. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 11 + */ + CODEC_TYPE_INVALID = -1, + /** + * SBC - Sub-band coding. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 11 + */ + CODEC_TYPE_SBC = 0, + /** + * AAC -Advanced Audio Coding. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 11 + */ + CODEC_TYPE_AAC = 1, + /** + * L2HC. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 11 + */ + CODEC_TYPE_L2HC = 2 + } + /** + * Describes the codec channel mode. + * + * @enum { number } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 11 + */ + enum CodecChannelMode { + /** + * Codec channel mode none. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 11 + */ + CODEC_CHANNEL_MODE_NONE = 0, + /** + * Codec channel mode MONO. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 11 + */ + CODEC_CHANNEL_MODE_MONO = 1, + /** + * Codec channel mode STEREO. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 11 + */ + CODEC_CHANNEL_MODE_STEREO = 2 + } + /** + * Describes the codec bits per sample. + * + * @enum { number } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 11 + */ + enum CodecBitsPerSample { + /** + * Codec bits per sample none. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 11 + */ + CODEC_BITS_PER_SAMPLE_NONE = 0, + /** + * Codec 16 bits per sample. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 11 + */ + CODEC_BITS_PER_SAMPLE_16 = 1, + /** + * Codec 24 bits per sample. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 11 + */ + CODEC_BITS_PER_SAMPLE_24 = 2, + /** + * Codec 32 bits per sample. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 11 + */ + CODEC_BITS_PER_SAMPLE_32 = 3 + } + /** + * Describes the codec sample rate. + * + * @enum { number } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 11 + */ + enum CodecSampleRate { + /** + * Codec sample rate none. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 11 + */ + CODEC_SAMPLE_RATE_NONE = 0, + /** + * Codec sample rate 44.1k. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 11 + */ + CODEC_SAMPLE_RATE_44100 = 1, + /** + * Codec sample rate 48k. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 11 + */ + CODEC_SAMPLE_RATE_48000 = 2, + /** + * Codec sample rate 88.2k. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 11 + */ + CODEC_SAMPLE_RATE_88200 = 3, + /** + * Codec sample rate 96k. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 11 + */ + CODEC_SAMPLE_RATE_96000 = 4, + /** + * Codec sample rate 176.4k. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 11 + */ + CODEC_SAMPLE_RATE_176400 = 5, + /** + * Codec sample rate 192k. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 11 + */ + CODEC_SAMPLE_RATE_192000 = 6 + } +} +export default a2dp; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.bluetooth.access.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.bluetooth.access.d.ts new file mode 100755 index 00000000..866a770d --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.bluetooth.access.d.ts @@ -0,0 +1,286 @@ +/* + * Copyright (C) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit ConnectivityKit + */ +import type { Callback } from './@ohos.base'; +/** + * Provides methods for enabling/disabling bluetooth or monitoring bluetooth state. + * + * @namespace access + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ +/** + * Provides methods for enabling/disabling bluetooth or monitoring bluetooth state. + * + * @namespace access + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 11 + */ +declare namespace access { + /** + * Enables Bluetooth on a device. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Enables Bluetooth on a device. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + function enableBluetooth(): void; + /** + * Disables Bluetooth on a device. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Disables Bluetooth on a device. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + function disableBluetooth(): void; + /** + * Obtains the Bluetooth status of a device. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @returns { BluetoothState } Returns the Bluetooth status. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Obtains the Bluetooth status of a device. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @returns { BluetoothState } Returns the Bluetooth status. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 11 + */ + function getState(): BluetoothState; + /** + * Subscribe the event reported when the Bluetooth state changes. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { 'stateChange' } type - Type of the Bluetooth state changes event to listen for. + * @param { Callback } callback - Callback used to listen for the Bluetooth state event. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Subscribe the event reported when the Bluetooth state changes. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { 'stateChange' } type - Type of the Bluetooth state changes event to listen for. + * @param { Callback } callback - Callback used to listen for the Bluetooth state event. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + function on(type: 'stateChange', callback: Callback): void; + /** + * Unsubscribe the event reported when the Bluetooth state changes. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { 'stateChange' } type - Type of the Bluetooth state changes event to listen for. + * @param { Callback } callback - Callback used to listen for the Bluetooth state event. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Unsubscribe the event reported when the Bluetooth state changes. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { 'stateChange' } type - Type of the Bluetooth state changes event to listen for. + * @param { Callback } callback - Callback used to listen for the Bluetooth state event. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + function off(type: 'stateChange', callback?: Callback): void; + /** + * The enum of bluetooth state. + * + * @enum { number } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * The enum of bluetooth state. + * + * @enum { number } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 11 + */ + export enum BluetoothState { + /** + * Indicates the local Bluetooth is off + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Indicates the local Bluetooth is off + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 11 + */ + STATE_OFF = 0, + /** + * Indicates the local Bluetooth is turning on + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Indicates the local Bluetooth is turning on + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 11 + */ + STATE_TURNING_ON = 1, + /** + * Indicates the local Bluetooth is on, and ready for use + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Indicates the local Bluetooth is on, and ready for use + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 11 + */ + STATE_ON = 2, + /** + * Indicates the local Bluetooth is turning off + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Indicates the local Bluetooth is turning off + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 11 + */ + STATE_TURNING_OFF = 3, + /** + * Indicates the local Bluetooth is turning LE mode on + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Indicates the local Bluetooth is turning LE mode on + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 11 + */ + STATE_BLE_TURNING_ON = 4, + /** + * Indicates the local Bluetooth is in LE only mode + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Indicates the local Bluetooth is in LE only mode + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 11 + */ + STATE_BLE_ON = 5, + /** + * Indicates the local Bluetooth is turning off LE only mode + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Indicates the local Bluetooth is turning off LE only mode + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 11 + */ + STATE_BLE_TURNING_OFF = 6 + } +} +export default access; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.bluetooth.baseProfile.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.bluetooth.baseProfile.d.ts new file mode 100755 index 00000000..05411afd --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.bluetooth.baseProfile.d.ts @@ -0,0 +1,190 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit ConnectivityKit + */ +import type { Callback } from './@ohos.base'; +import type constant from './@ohos.bluetooth.constant'; +/** + * Provides basic profile methods. + * + * @namespace baseProfile + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ +declare namespace baseProfile { + /** + * Indicate the profile connection state. + * + * @typedef { constant.ProfileConnectionState } ProfileConnectionState + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + type ProfileConnectionState = constant.ProfileConnectionState; + /** + * Enum for cause of disconnect. + * + * @enum { number } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 12 + */ + enum DisconnectCause { + /** + * User disconnect device. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 12 + */ + USER_DISCONNECT = 0, + /** + * The connection needs to be initiated from the keyboard side. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 12 + */ + CONNECT_FROM_KEYBOARD = 1, + /** + * The connection needs to be initiated from the mouse side. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 12 + */ + CONNECT_FROM_MOUSE = 2, + /** + * The connection needs to be initiated from the car side. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 12 + */ + CONNECT_FROM_CAR = 3, + /** + * Too many devices are currently connected. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 12 + */ + TOO_MANY_CONNECTED_DEVICES = 4, + /** + * Connection failed due to an internal error. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 12 + */ + CONNECT_FAIL_INTERNAL = 5 + } + /** + * Profile state change parameters. + * + * @typedef StateChangeParam + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + export interface StateChangeParam { + /** + * The address of device + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + deviceId: string; + /** + * Profile state value + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + state: ProfileConnectionState; + /** + * Cause of disconnect + * + * @type { DisconnectCause } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 12 + */ + cause: DisconnectCause; + } + /** + * Base interface of profile. + * + * @typedef BaseProfile + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + export interface BaseProfile { + /** + * Obtains the connected devices list of profile. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @returns { Array } Returns the address of connected devices list. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth switch is off. + * @throws { BusinessError } 2900004 - Profile is not supported. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + getConnectedDevices(): Array; + /** + * Obtains the profile connection state. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF". + * @returns { ProfileConnectionState } Returns the connection state. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth switch is off. + * @throws { BusinessError } 2900004 - Profile is not supported. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + getConnectionState(deviceId: string): ProfileConnectionState; + /** + * Subscribe the event reported when the profile connection state changes . + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { 'connectionStateChange' } type - Type of the profile connection state changes event to listen for. + * @param { Callback } callback - Callback used to listen for event. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + on(type: 'connectionStateChange', callback: Callback): void; + /** + * Unsubscribe the event reported when the profile connection state changes . + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { 'connectionStateChange' } type - Type of the profile connection state changes event to listen for. + * @param { Callback } callback - Callback used to listen for event. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + off(type: 'connectionStateChange', callback?: Callback): void; + } +} +export default baseProfile; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.bluetooth.ble.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.bluetooth.ble.d.ts new file mode 100755 index 00000000..4fb23c0c --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.bluetooth.ble.d.ts @@ -0,0 +1,3756 @@ +/* + * Copyright (C) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit ConnectivityKit + */ +import type { AsyncCallback, Callback } from './@ohos.base'; +import type constant from './@ohos.bluetooth.constant'; +/** + * Provides methods to operate or manage Bluetooth. + * + * @namespace ble + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ +/** + * Provides methods to operate or manage Bluetooth. + * + * @namespace ble + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ +declare namespace ble { + /** + * Indicate the profile connection state. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Indicate the profile connection state. + * + * @typedef { constant.ProfileConnectionState } ProfileConnectionState + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + type ProfileConnectionState = constant.ProfileConnectionState; + /** + * create a Gatt server instance. + * + * @returns { GattServer } Returns a Gatt server instance {@code GattServer}. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * create a Gatt server instance. + * + * @returns { GattServer } Returns a Gatt server instance {@code GattServer}. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + function createGattServer(): GattServer; + /** + * create a Gatt client device instance. + * + * @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF". + * @returns { GattClientDevice } Returns a Gatt client device instance {@code GattClientDevice}. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * create a Gatt client device instance. + * + * @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF". + * @returns { GattClientDevice } Returns a Gatt client device instance {@code GattClientDevice}. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + function createGattClientDevice(deviceId: string): GattClientDevice; + /** + * Obtains the list of devices in the connected status. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @returns { Array } Returns the list of device address. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth switch is off. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + function getConnectedBLEDevices(): Array; + /** + * Starts scanning for specified BLE devices with filters. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { Array } filters - Indicates the list of filters used to filter out specified devices. + * If you do not want to use filter, set this parameter to {@code null}. + * @param { ScanOptions } options - Indicates the parameters for scanning and if the user does not assign a value, the default value will be used. + * {@link ScanOptions#interval} set to 0, {@link ScanOptions#dutyMode} set to {@link SCAN_MODE_LOW_POWER} + * and {@link ScanOptions#matchMode} set to {@link MATCH_MODE_AGGRESSIVE}. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth switch is off. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Starts scanning for specified BLE devices with filters. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { Array } filters - Indicates the list of filters used to filter out specified devices. + * If you do not want to use filter, set this parameter to {@code null}. + * @param { ScanOptions } options - Indicates the parameters for scanning and if the user does not assign a value, the default value will be used. + * {@link ScanOptions#interval} set to 0, {@link ScanOptions#dutyMode} set to {@link SCAN_MODE_LOW_POWER} + * and {@link ScanOptions#matchMode} set to {@link MATCH_MODE_AGGRESSIVE}. + * and {@link ScanOptions#phyType} set to {@link PHY_LE_ALL_SUPPORTED}. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth switch is off. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + function startBLEScan(filters: Array, options?: ScanOptions): void; + /** + * Stops BLE scanning. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth switch is off. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Stops BLE scanning. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth switch is off. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + function stopBLEScan(): void; + /** + * Starts BLE advertising. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { AdvertiseSetting } setting - Indicates the settings for BLE advertising. + * @param { AdvertiseData } advData - Indicates the advertising data. + * @param { AdvertiseData } advResponse - Indicates the scan response associated with the advertising data. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth switch is off. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Starts BLE advertising. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { AdvertiseSetting } setting - Indicates the settings for BLE advertising. + * @param { AdvertiseData } advData - Indicates the advertising data. + * @param { AdvertiseData } advResponse - Indicates the scan response associated with the advertising data. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth switch is off. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + function startAdvertising(setting: AdvertiseSetting, advData: AdvertiseData, advResponse?: AdvertiseData): void; + /** + * Stops BLE advertising. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth switch is off. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Stops BLE advertising. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth switch is off. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + function stopAdvertising(): void; + /** + * Starts BLE advertising. + * The API returns a advertising ID. The ID can be used to temporarily enable or disable this advertising + * using the API {@link enableAdvertising} or {@link disableAdvertising}. + * To completely stop the advertising corresponding to the ID, invoke the API {@link stopAdvertising} with ID. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { AdvertisingParams } advertisingParams - Indicates the params for BLE advertising. + * @param { AsyncCallback } callback - the callback of advertise ID. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth switch is off. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 11 + */ + function startAdvertising(advertisingParams: AdvertisingParams, callback: AsyncCallback): void; + /** + * Starts BLE advertising. + * The API returns a advertising ID. The ID can be used to temporarily enable or disable this advertising + * using the API {@link enableAdvertising} or {@link disableAdvertising}. + * To completely stop the advertising corresponding to the ID, invoke the API {@link stopAdvertising} with ID. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { AdvertisingParams } advertisingParams - Indicates the param for BLE advertising. + * @returns { Promise } Returns the promise object. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth switch is off. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 11 + */ + function startAdvertising(advertisingParams: AdvertisingParams): Promise; + /** + * Enable the advertising with a specific ID temporarily. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { AdvertisingEnableParams } advertisingEnableParams - Indicates the params for enable advertising. + * @param { AsyncCallback } callback - the callback result. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth switch is off. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 11 + */ + function enableAdvertising(advertisingEnableParams: AdvertisingEnableParams, callback: AsyncCallback): void; + /** + * Enable the advertising with a specific ID temporarily. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { AdvertisingEnableParams } advertisingEnableParams - Indicates the params for enable advertising. + * @returns { Promise } Returns the promise object. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth switch is off. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 11 + */ + function enableAdvertising(advertisingEnableParams: AdvertisingEnableParams): Promise; + /** + * Disable the advertising with a specific ID temporarily. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { AdvertisingDisableParams } advertisingDisableParams - Indicates the params for disable advertising. + * @param { AsyncCallback } callback - the callback result. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth switch is off. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 11 + */ + function disableAdvertising(advertisingDisableParams: AdvertisingDisableParams, callback: AsyncCallback): void; + /** + * Disable the advertising with a specific ID temporarily. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { AdvertisingDisableParams } advertisingDisableParams - Indicates the params for disable advertising. + * @returns { Promise } Returns the promise object. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth switch is off. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 11 + */ + function disableAdvertising(advertisingDisableParams: AdvertisingDisableParams): Promise; + /** + * Stops BLE advertising. + * Completely stop the advertising corresponding to the ID. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { number } advertisingId - Indicates the ID for this BLE advertising. + * @param { AsyncCallback } callback - the callback result. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth switch is off. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 11 + */ + function stopAdvertising(advertisingId: number, callback: AsyncCallback): void; + /** + * Stops BLE advertising. + * Completely stop the advertising corresponding to the ID. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { number } advertisingId - Indicates the ID for this BLE advertising. + * @returns { Promise } Returns the promise object. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth switch is off. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 11 + */ + function stopAdvertising(advertisingId: number): Promise; + /** + * Subscribing to advertising state change event. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { 'advertisingStateChange' } type - Type of the advertising state to listen for. + * @param { Callback } callback - Callback used to listen for the advertising state. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 11 + */ + function on(type: 'advertisingStateChange', callback: Callback): void; + /** + * Unsubscribe from advertising state change event. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { 'advertisingStateChange' } type - Type of the advertising state to listen for. + * @param { Callback } callback - Callback used to listen for the advertising state. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 11 + */ + function off(type: 'advertisingStateChange', callback?: Callback): void; + /** + * Subscribe BLE scan result. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { 'BLEDeviceFind' } type - Type of the scan result event to listen for. + * @param { Callback> } callback - Callback used to listen for the scan result event. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Subscribe BLE scan result. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { 'BLEDeviceFind' } type - Type of the scan result event to listen for. + * @param { Callback> } callback - Callback used to listen for the scan result event. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + function on(type: 'BLEDeviceFind', callback: Callback>): void; + /** + * Unsubscribe BLE scan result. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { 'BLEDeviceFind' } type - Type of the scan result event to listen for. + * @param { Callback> } callback - Callback used to listen for the scan result event. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Unsubscribe BLE scan result. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { 'BLEDeviceFind' } type - Type of the scan result event to listen for. + * @param { Callback> } callback - Callback used to listen for the scan result event. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + function off(type: 'BLEDeviceFind', callback?: Callback>): void; + /** + * Manages GATT server. Before calling an Gatt server method, you must use {@link createGattServer} to create an GattServer instance. + * + * @typedef GattServer + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Manages GATT server. Before calling an Gatt server method, you must use {@link createGattServer} to create an GattServer instance. + * + * @typedef GattServer + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + interface GattServer { + /** + * Adds a specified service to be hosted. + *

The added service and its characteristics are provided by the local device. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { GattService } service - Indicates the service to add. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth switch is off. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Adds a specified service to be hosted. + *

The added service and its characteristics are provided by the local device. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { GattService } service - Indicates the service to add. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth switch is off. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + addService(service: GattService): void; + /** + * Removes a specified service from the list of GATT services provided by this device. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { string } serviceUuid - Indicates the UUID of the service to remove. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth switch is off. + * @throws { BusinessError } 2900004 - Profile is not supported. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Removes a specified service from the list of GATT services provided by this device. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { string } serviceUuid - Indicates the UUID of the service to remove. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth switch is off. + * @throws { BusinessError } 2900004 - Profile is not supported. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + removeService(serviceUuid: string): void; + /** + * Closes this {@code GattServer} object and unregisters its callbacks. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth switch is off. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Closes this {@code GattServer} object and unregisters its callbacks. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth switch is off. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + close(): void; + /** + * Sends a notification of a change in a specified local characteristic with a asynchronous callback. + *

This method should be called for every BLE peripheral device that has requested notifications. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF". + * @param { NotifyCharacteristic } notifyCharacteristic - Indicates the local characteristic that has changed. + * @param { AsyncCallback } callback - Callback used to return the result. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth switch is off. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Sends a notification of a change in a specified local characteristic with a asynchronous callback. + *

This method should be called for every BLE peripheral device that has requested notifications. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF". + * @param { NotifyCharacteristic } notifyCharacteristic - Indicates the local characteristic that has changed. + * @param { AsyncCallback } callback - Callback used to return the result. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth switch is off. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + notifyCharacteristicChanged(deviceId: string, notifyCharacteristic: NotifyCharacteristic, callback: AsyncCallback): void; + /** + * Sends a notification of a change in a specified local characteristic with a asynchronous callback. + *

This method should be called for every BLE peripheral device that has requested notifications. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF". + * @param { NotifyCharacteristic } notifyCharacteristic - Indicates the local characteristic that has changed. + * @returns { Promise } Promise used to return the result. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth switch is off. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Sends a notification of a change in a specified local characteristic with a asynchronous callback. + *

This method should be called for every BLE peripheral device that has requested notifications. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF". + * @param { NotifyCharacteristic } notifyCharacteristic - Indicates the local characteristic that has changed. + * @returns { Promise } Promise used to return the result. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth switch is off. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + notifyCharacteristicChanged(deviceId: string, notifyCharacteristic: NotifyCharacteristic): Promise; + /** + * Sends a response to a specified read or write request to a given BLE peripheral device. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { ServerResponse } serverResponse - Indicates the response parameters {@link ServerResponse}. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth switch is off. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Sends a response to a specified read or write request to a given BLE peripheral device. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { ServerResponse } serverResponse - Indicates the response parameters {@link ServerResponse}. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth switch is off. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + sendResponse(serverResponse: ServerResponse): void; + /** + * Subscribe characteristic read event. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { 'characteristicRead' } type - Type of the characteristic read event to listen for. + * @param { Callback } callback - Callback used to listen for the characteristic read event. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Subscribe characteristic read event. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { 'characteristicRead' } type - Type of the characteristic read event to listen for. + * @param { Callback } callback - Callback used to listen for the characteristic read event. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + on(type: 'characteristicRead', callback: Callback): void; + /** + * Unsubscribe characteristic read event. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { 'characteristicRead' } type - Type of the characteristic read event to listen for. + * @param { Callback } callback - Callback used to listen for the characteristic read event. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Unsubscribe characteristic read event. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { 'characteristicRead' } type - Type of the characteristic read event to listen for. + * @param { Callback } callback - Callback used to listen for the characteristic read event. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + off(type: 'characteristicRead', callback?: Callback): void; + /** + * Subscribe characteristic write event. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { 'characteristicWrite' } type - Type of the characteristic write event to listen for. + * @param { Callback } callback - Callback used to listen for the characteristic write event. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Subscribe characteristic write event. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { 'characteristicWrite' } type - Type of the characteristic write event to listen for. + * @param { Callback } callback - Callback used to listen for the characteristic write event. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + on(type: 'characteristicWrite', callback: Callback): void; + /** + * Unsubscribe characteristic write event. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { 'characteristicWrite' } type - Type of the characteristic write event to listen for. + * @param { Callback } callback - Callback used to listen for the characteristic write event. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Unsubscribe characteristic write event. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { 'characteristicWrite' } type - Type of the characteristic write event to listen for. + * @param { Callback } callback - Callback used to listen for the characteristic write event. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + off(type: 'characteristicWrite', callback?: Callback): void; + /** + * Subscribe descriptor read event. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { 'descriptorRead' } type - Type of the descriptor read event to listen for. + * @param { Callback } callback - Callback used to listen for the descriptor read event. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Subscribe descriptor read event. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { 'descriptorRead' } type - Type of the descriptor read event to listen for. + * @param { Callback } callback - Callback used to listen for the descriptor read event. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + on(type: 'descriptorRead', callback: Callback): void; + /** + * Unsubscribe descriptor read event. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { 'descriptorRead' } type - Type of the descriptor read event to listen for. + * @param { Callback } callback - Callback used to listen for the descriptor read event. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Unsubscribe descriptor read event. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { 'descriptorRead' } type - Type of the descriptor read event to listen for. + * @param { Callback } callback - Callback used to listen for the descriptor read event. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + off(type: 'descriptorRead', callback?: Callback): void; + /** + * Subscribe descriptor write event. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { 'descriptorWrite' } type - Type of the descriptor write event to listen for. + * @param { Callback } callback - Callback used to listen for the descriptor write event. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Subscribe descriptor write event. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { 'descriptorWrite' } type - Type of the descriptor write event to listen for. + * @param { Callback } callback - Callback used to listen for the descriptor write event. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + on(type: 'descriptorWrite', callback: Callback): void; + /** + * Unsubscribe descriptor write event. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { 'descriptorWrite' } type - Type of the descriptor write event to listen for. + * @param { Callback } callback - Callback used to listen for the descriptor write event. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Unsubscribe descriptor write event. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { 'descriptorWrite' } type - Type of the descriptor write event to listen for. + * @param { Callback } callback - Callback used to listen for the descriptor write event. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + off(type: 'descriptorWrite', callback?: Callback): void; + /** + * Subscribe server connection state changed event. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { 'connectionStateChange' } type - Type of the connection state changed event to listen for. + * @param { Callback } callback - Callback used to listen for the connection state changed event. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Subscribe server connection state changed event. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { 'connectionStateChange' } type - Type of the connection state changed event to listen for. + * @param { Callback } callback - Callback used to listen for the connection state changed event. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + on(type: 'connectionStateChange', callback: Callback): void; + /** + * Unsubscribe server connection state changed event. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { 'connectionStateChange' } type - Type of the connection state changed event to listen for. + * @param { Callback } callback - Callback used to listen for the connection state changed event. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Unsubscribe server connection state changed event. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { 'connectionStateChange' } type - Type of the connection state changed event to listen for. + * @param { Callback } callback - Callback used to listen for the connection state changed event. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + off(type: 'connectionStateChange', callback?: Callback): void; + /** + * Subscribe mtu changed event. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { 'BLEMtuChange' } type - Type of the mtu changed event to listen for. + * @param { Callback } callback - Callback used to listen for the mtu changed event. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + on(type: 'BLEMtuChange', callback: Callback): void; + /** + * Unsubscribe mtu changed event. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { 'BLEMtuChange' } type - Type of the mtu changed event to listen for. + * @param { Callback } callback - Callback used to listen for the mtu changed event. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + off(type: 'BLEMtuChange', callback?: Callback): void; + } + /** + * Manages GATT client. Before calling an Gatt client method, you must use {@link createGattClientDevice} to create an GattClientDevice instance. + * + * @typedef GattClientDevice + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Manages GATT client. Before calling an Gatt client method, you must use {@link createGattClientDevice} to create an GattClientDevice instance. + * + * @typedef GattClientDevice + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + interface GattClientDevice { + /** + * Connects to a BLE peripheral device. + *

The 'BLEConnectionStateChange' event is subscribed to return the connection state. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth switch is off. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Connects to a BLE peripheral device. + *

The 'BLEConnectionStateChange' event is subscribed to return the connection state. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth switch is off. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + connect(): void; + /** + * Disconnects from or stops an ongoing connection to a BLE peripheral device. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth switch is off. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Disconnects from or stops an ongoing connection to a BLE peripheral device. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth switch is off. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + disconnect(): void; + /** + * Disables a BLE peripheral device. + *

This method unregisters the device and clears the registered callbacks and handles. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth switch is off. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Disables a BLE peripheral device. + *

This method unregisters the device and clears the registered callbacks and handles. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth switch is off. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + close(): void; + /** + * Obtains the name of BLE peripheral device. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { AsyncCallback } callback - Callback used to obtain the device name. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Obtains the name of BLE peripheral device. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { AsyncCallback } callback - Callback used to obtain the device name. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + getDeviceName(callback: AsyncCallback): void; + /** + * Obtains the name of BLE peripheral device. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @returns { Promise } Returns a string representation of the name if obtained; + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter.Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Obtains the name of BLE peripheral device. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @returns { Promise } Returns a string representation of the name if obtained; + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter.Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + getDeviceName(): Promise; + /** + * Starts discovering services. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { AsyncCallback> } callback - Callback used to catch the services. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Starts discovering services. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { AsyncCallback> } callback - Callback used to catch the services. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + getServices(callback: AsyncCallback>): void; + /** + * Starts discovering services. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @returns { Promise> } Returns the list of services {@link GattService} of the BLE peripheral device. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Starts discovering services. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @returns { Promise> } Returns the list of services {@link GattService} of the BLE peripheral device. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + getServices(): Promise>; + /** + * Reads the characteristic of a BLE peripheral device. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { BLECharacteristic } characteristic - Indicates the characteristic to read. + * @param { AsyncCallback } callback - Callback invoked to return the characteristic value read. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2901000 - Read forbidden. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Reads the characteristic of a BLE peripheral device. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { BLECharacteristic } characteristic - Indicates the characteristic to read. + * @param { AsyncCallback } callback - Callback invoked to return the characteristic value read. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2901000 - Read forbidden. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + readCharacteristicValue(characteristic: BLECharacteristic, callback: AsyncCallback): void; + /** + * Reads the characteristic of a BLE peripheral device. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { BLECharacteristic } characteristic - Indicates the characteristic to read. + * @returns { Promise } - Promise used to return the characteristic value read. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2901000 - Read forbidden. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Reads the characteristic of a BLE peripheral device. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { BLECharacteristic } characteristic - Indicates the characteristic to read. + * @returns { Promise } - Promise used to return the characteristic value read. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2901000 - Read forbidden. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + readCharacteristicValue(characteristic: BLECharacteristic): Promise; + /** + * Reads the descriptor of a BLE peripheral device. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { BLEDescriptor } descriptor - Indicates the descriptor to read. + * @param { AsyncCallback } callback - Callback invoked to return the descriptor read. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2901000 - Read forbidden. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Reads the descriptor of a BLE peripheral device. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { BLEDescriptor } descriptor - Indicates the descriptor to read. + * @param { AsyncCallback } callback - Callback invoked to return the descriptor read. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2901000 - Read forbidden. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + readDescriptorValue(descriptor: BLEDescriptor, callback: AsyncCallback): void; + /** + * Reads the descriptor of a BLE peripheral device. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { BLEDescriptor } descriptor - Indicates the descriptor to read. + * @returns { Promise } - Promise used to return the descriptor read. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2901000 - Read forbidden. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Reads the descriptor of a BLE peripheral device. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { BLEDescriptor } descriptor - Indicates the descriptor to read. + * @returns { Promise } - Promise used to return the descriptor read. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2901000 - Read forbidden. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + readDescriptorValue(descriptor: BLEDescriptor): Promise; + /** + * Writes the characteristic of a BLE peripheral device. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { BLECharacteristic } characteristic - Indicates the characteristic to write. + * @param { GattWriteType } writeType - Write type of the characteristic. + * @param { AsyncCallback } callback - Callback used to return the result. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2901001 - Write forbidden. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Writes the characteristic of a BLE peripheral device. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { BLECharacteristic } characteristic - Indicates the characteristic to write. + * @param { GattWriteType } writeType - Write type of the characteristic. + * @param { AsyncCallback } callback - Callback used to return the result. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2901001 - Write forbidden. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + writeCharacteristicValue(characteristic: BLECharacteristic, writeType: GattWriteType, callback: AsyncCallback): void; + /** + * Writes the characteristic of a BLE peripheral device. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { BLECharacteristic } characteristic - Indicates the characteristic to write. + * @param { GattWriteType } writeType - Write type of the characteristic. + * @returns { Promise } Promise used to return the result. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2901001 - Write forbidden. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Writes the characteristic of a BLE peripheral device. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { BLECharacteristic } characteristic - Indicates the characteristic to write. + * @param { GattWriteType } writeType - Write type of the characteristic. + * @returns { Promise } Promise used to return the result. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2901001 - Write forbidden. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + writeCharacteristicValue(characteristic: BLECharacteristic, writeType: GattWriteType): Promise; + /** + * Writes the descriptor of a BLE peripheral device. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { BLEDescriptor } descriptor - Indicates the descriptor to write. + * @param { AsyncCallback } callback - Callback used to return the result. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2901001 - Write forbidden. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Writes the descriptor of a BLE peripheral device. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { BLEDescriptor } descriptor - Indicates the descriptor to write. + * @param { AsyncCallback } callback - Callback used to return the result. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2901001 - Write forbidden. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + writeDescriptorValue(descriptor: BLEDescriptor, callback: AsyncCallback): void; + /** + * Writes the descriptor of a BLE peripheral device. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { BLEDescriptor } descriptor - Indicates the descriptor to write. + * @returns { Promise } Promise used to return the result. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2901001 - Write forbidden. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Writes the descriptor of a BLE peripheral device. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { BLEDescriptor } descriptor - Indicates the descriptor to write. + * @returns { Promise } Promise used to return the result. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2901001 - Write forbidden. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + writeDescriptorValue(descriptor: BLEDescriptor): Promise; + /** + * Get the RSSI value of this BLE peripheral device. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { AsyncCallback } callback - Callback invoked to return the RSSI, in dBm. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Get the RSSI value of this BLE peripheral device. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { AsyncCallback } callback - Callback invoked to return the RSSI, in dBm. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + getRssiValue(callback: AsyncCallback): void; + /** + * Get the RSSI value of this BLE peripheral device. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @returns { Promise } Returns the RSSI value. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Get the RSSI value of this BLE peripheral device. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @returns { Promise } Returns the RSSI value. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + getRssiValue(): Promise; + /** + * Set the mtu size of a BLE peripheral device. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { number } mtu - The maximum transmission unit. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Set the mtu size of a BLE peripheral device. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { number } mtu - The maximum transmission unit. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + setBLEMtuSize(mtu: number): void; + /** + * Enables or disables notification of a characteristic when value changed. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { BLECharacteristic } characteristic - Indicates the characteristic to indicate. + * @param { boolean } enable - Specifies whether to enable indication of the characteristic. The value {@code true} indicates + * that notification is enabled, and the value {@code false} indicates that indication is disabled. + * @param { AsyncCallback } callback - the callback of setCharacteristicChangeNotification. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Enables or disables notification of a characteristic when value changed. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { BLECharacteristic } characteristic - Indicates the characteristic to indicate. + * @param { boolean } enable - Specifies whether to enable indication of the characteristic. The value {@code true} indicates + * that notification is enabled, and the value {@code false} indicates that indication is disabled. + * @param { AsyncCallback } callback - the callback of setCharacteristicChangeNotification. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + setCharacteristicChangeNotification(characteristic: BLECharacteristic, enable: boolean, callback: AsyncCallback): void; + /** + * Enables or disables indication of a characteristic when value changed. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { BLECharacteristic } characteristic - Indicates the characteristic to indicate. + * @param { boolean } enable - Specifies whether to enable indication of the characteristic. The value {@code true} indicates + * that indication is enabled, and the value {@code false} indicates that indication is disabled. + * @returns { Promise } Returns the promise object. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Enables or disables indication of a characteristic when value changed. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { BLECharacteristic } characteristic - Indicates the characteristic to indicate. + * @param { boolean } enable - Specifies whether to enable indication of the characteristic. The value {@code true} indicates + * that indication is enabled, and the value {@code false} indicates that indication is disabled. + * @returns { Promise } Returns the promise object. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + setCharacteristicChangeNotification(characteristic: BLECharacteristic, enable: boolean): Promise; + /** + * Enables or disables indication of a characteristic when value changed. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { BLECharacteristic } characteristic - Indicates the characteristic to indicate. + * @param { boolean } enable - Specifies whether to enable indication of the characteristic. The value {@code true} indicates + * that indication is enabled, and the value {@code false} indicates that indication is disabled. + * @param { AsyncCallback } callback - the callback of setCharacteristicChangeIndication. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Enables or disables indication of a characteristic when value changed. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { BLECharacteristic } characteristic - Indicates the characteristic to indicate. + * @param { boolean } enable - Specifies whether to enable indication of the characteristic. The value {@code true} indicates + * that indication is enabled, and the value {@code false} indicates that indication is disabled. + * @param { AsyncCallback } callback - the callback of setCharacteristicChangeIndication. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + setCharacteristicChangeIndication(characteristic: BLECharacteristic, enable: boolean, callback: AsyncCallback): void; + /** + * Enables or disables indication of a characteristic when value changed. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { BLECharacteristic } characteristic - Indicates the characteristic to indicate. + * @param { boolean } enable - Specifies whether to enable indication of the characteristic. The value {@code true} indicates + * that indication is enabled, and the value {@code false} indicates that indication is disabled. + * @returns { Promise } Returns the promise object. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Enables or disables indication of a characteristic when value changed. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { BLECharacteristic } characteristic - Indicates the characteristic to indicate. + * @param { boolean } enable - Specifies whether to enable indication of the characteristic. The value {@code true} indicates + * that indication is enabled, and the value {@code false} indicates that indication is disabled. + * @returns { Promise } Returns the promise object. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + setCharacteristicChangeIndication(characteristic: BLECharacteristic, enable: boolean): Promise; + /** + * Subscribe characteristic value changed event. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { 'BLECharacteristicChange' } type - Type of the characteristic value changed event to listen for. + * @param { Callback } callback - Callback used to listen for the characteristic value changed event. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Subscribe characteristic value changed event. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { 'BLECharacteristicChange' } type - Type of the characteristic value changed event to listen for. + * @param { Callback } callback - Callback used to listen for the characteristic value changed event. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + on(type: 'BLECharacteristicChange', callback: Callback): void; + /** + * Unsubscribe characteristic value changed event. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { 'BLECharacteristicChange' } type - Type of the characteristic value changed event to listen for. + * @param { Callback } callback - Callback used to listen for the characteristic value changed event. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Unsubscribe characteristic value changed event. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { 'BLECharacteristicChange' } type - Type of the characteristic value changed event to listen for. + * @param { Callback } callback - Callback used to listen for the characteristic value changed event. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + off(type: 'BLECharacteristicChange', callback?: Callback): void; + /** + * Subscribe client connection state changed event. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { 'BLEConnectionStateChange' } type - Type of the connection state changed event to listen for. + * @param { Callback } callback - Callback used to listen for the connection state changed event. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Subscribe client connection state changed event. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { 'BLEConnectionStateChange' } type - Type of the connection state changed event to listen for. + * @param { Callback } callback - Callback used to listen for the connection state changed event. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + on(type: 'BLEConnectionStateChange', callback: Callback): void; + /** + * Unsubscribe client connection state changed event. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { 'BLEConnectionStateChange' } type - Type of the connection state changed event to listen for. + * @param { Callback } callback - Callback used to listen for the connection state changed event. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Unsubscribe client connection state changed event. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { 'BLEConnectionStateChange' } type - Type of the connection state changed event to listen for. + * @param { Callback } callback - Callback used to listen for the connection state changed event. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + off(type: 'BLEConnectionStateChange', callback?: Callback): void; + /** + * Subscribe mtu changed event. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { 'BLEMtuChange' } type - Type of the mtu changed event to listen for. + * @param { Callback } callback - Callback used to listen for the mtu changed event. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Subscribe mtu changed event. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { 'BLEMtuChange' } type - Type of the mtu changed event to listen for. + * @param { Callback } callback - Callback used to listen for the mtu changed event. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + on(type: 'BLEMtuChange', callback: Callback): void; + /** + * Unsubscribe mtu changed event. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { 'BLEMtuChange' } type - Type of the mtu changed event to listen for. + * @param { Callback } callback - Callback used to listen for the mtu changed event. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Unsubscribe mtu changed event. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { 'BLEMtuChange' } type - Type of the mtu changed event to listen for. + * @param { Callback } callback - Callback used to listen for the mtu changed event. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + off(type: 'BLEMtuChange', callback?: Callback): void; + } + /** + * Describes the Gatt service. + * + * @typedef GattService + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Describes the Gatt service. + * + * @typedef GattService + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + interface GattService { + /** + * The UUID of a GattService instance + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * The UUID of a GattService instance + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + serviceUuid: string; + /** + * Indicates whether the GattService instance is primary or secondary. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Indicates whether the GattService instance is primary or secondary. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + isPrimary: boolean; + /** + * The {@link BLECharacteristic} list belongs to this GattService instance + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * The {@link BLECharacteristic} list belongs to this GattService instance + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + characteristics: Array; + /** + * The list of GATT services contained in the service + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * The list of GATT services contained in the service + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + includeServices?: Array; + } + /** + * Describes the Gatt characteristic. + * + * @typedef BLECharacteristic + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Describes the Gatt characteristic. + * + * @typedef BLECharacteristic + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + interface BLECharacteristic { + /** + * The UUID of the {@link GattService} instance to which the characteristic belongs + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * The UUID of the {@link GattService} instance to which the characteristic belongs + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + serviceUuid: string; + /** + * The UUID of a BLECharacteristic instance + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * The UUID of a BLECharacteristic instance + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + characteristicUuid: string; + /** + * The value of a BLECharacteristic instance + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * The value of a BLECharacteristic instance + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + characteristicValue: ArrayBuffer; + /** + * The list of {@link BLEDescriptor} contained in the characteristic + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * The list of {@link BLEDescriptor} contained in the characteristic + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + descriptors: Array; + /** + * The properties of a BLECharacteristic instance + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * The properties of a BLECharacteristic instance + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + properties?: GattProperties; + } + /** + * Describes the Gatt descriptor. + * + * @typedef BLEDescriptor + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Describes the Gatt descriptor. + * + * @typedef BLEDescriptor + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + interface BLEDescriptor { + /** + * The UUID of the {@link GattService} instance to which the descriptor belongs + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * The UUID of the {@link GattService} instance to which the descriptor belongs + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + serviceUuid: string; + /** + * The UUID of the {@link BLECharacteristic} instance to which the descriptor belongs + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * The UUID of the {@link BLECharacteristic} instance to which the descriptor belongs + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + characteristicUuid: string; + /** + * The UUID of the BLEDescriptor instance + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * The UUID of the BLEDescriptor instance + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + descriptorUuid: string; + /** + * The value of the BLEDescriptor instance + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * The value of the BLEDescriptor instance + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + descriptorValue: ArrayBuffer; + } + /** + * Describes the value of the indication or notification sent by the Gatt server. + * + * @typedef NotifyCharacteristic + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Describes the value of the indication or notification sent by the Gatt server. + * + * @typedef NotifyCharacteristic + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + interface NotifyCharacteristic { + /** + * The UUID of the {@link GattService} instance to which the characteristic belongs + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * The UUID of the {@link GattService} instance to which the characteristic belongs + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + serviceUuid: string; + /** + * The UUID of a NotifyCharacteristic instance + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * The UUID of a NotifyCharacteristic instance + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + characteristicUuid: string; + /** + * The value of a NotifyCharacteristic instance + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * The value of a NotifyCharacteristic instance + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + characteristicValue: ArrayBuffer; + /** + * Specifies whether to request confirmation from the BLE peripheral device (indication) or + * send a notification. Value {@code true} indicates the former and {@code false} indicates the latter. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Specifies whether to request confirmation from the BLE peripheral device (indication) or + * send a notification. Value {@code true} indicates the former and {@code false} indicates the latter. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + confirm: boolean; + } + /** + * Describes the parameters of the Gatt client's characteristic read request. + * + * @typedef CharacteristicReadRequest + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Describes the parameters of the Gatt client's characteristic read request. + * + * @typedef CharacteristicReadRequest + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + interface CharacteristicReadRequest { + /** + * Indicates the address of the client that initiates the read request + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Indicates the address of the client that initiates the read request + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + deviceId: string; + /** + * The Id of the read request + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * The Id of the read request + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + transId: number; + /** + * Indicates the byte offset of the start position for reading characteristic value + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Indicates the byte offset of the start position for reading characteristic value + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + offset: number; + /** + * The UUID of a CharacteristicReadRequest instance + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * The UUID of a CharacteristicReadRequest instance + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + characteristicUuid: string; + /** + * The UUID of the service to which the characteristic belongs + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * The UUID of the service to which the characteristic belongs + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + serviceUuid: string; + } + /** + * Describes the parameters of the of the Gatt client's characteristic write request. + * + * @typedef CharacteristicWriteRequest + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Describes the parameters of the of the Gatt client's characteristic write request. + * + * @typedef CharacteristicWriteRequest + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + interface CharacteristicWriteRequest { + /** + * Indicates the address of the client that initiates the write request + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Indicates the address of the client that initiates the write request + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + deviceId: string; + /** + * The Id of the write request + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * The Id of the write request + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + transId: number; + /** + * Indicates the byte offset of the start position for writing characteristic value + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Indicates the byte offset of the start position for writing characteristic value + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + offset: number; + /** + * Whether this request should be pending for later operation + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Whether this request should be pending for later operation + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + isPrepared: boolean; + /** + * Whether the remote client need a response + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Whether the remote client need a response + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + needRsp: boolean; + /** + * Indicates the value to be written + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Indicates the value to be written + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + value: ArrayBuffer; + /** + * The UUID of a CharacteristicWriteRequest instance + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * The UUID of a CharacteristicWriteRequest instance + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + characteristicUuid: string; + /** + * The UUID of the service to which the characteristic belongs + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * The UUID of the service to which the characteristic belongs + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + serviceUuid: string; + } + /** + * Describes the parameters of the Gatt client's descriptor read request. + * + * @typedef DescriptorReadRequest + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Describes the parameters of the Gatt client's descriptor read request. + * + * @typedef DescriptorReadRequest + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + interface DescriptorReadRequest { + /** + * Indicates the address of the client that initiates the read request + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Indicates the address of the client that initiates the read request + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + deviceId: string; + /** + * The Id of the read request + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * The Id of the read request + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + transId: number; + /** + * Indicates the byte offset of the start position for reading characteristic value + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Indicates the byte offset of the start position for reading characteristic value + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + offset: number; + /** + * The UUID of a DescriptorReadRequest instance + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * The UUID of a DescriptorReadRequest instance + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + descriptorUuid: string; + /** + * The UUID of the characteristic to which the descriptor belongs + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * The UUID of the characteristic to which the descriptor belongs + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + characteristicUuid: string; + /** + * The UUID of the service to which the descriptor belongs + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * The UUID of the service to which the descriptor belongs + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + serviceUuid: string; + } + /** + * Describes the parameters of the Gatt client's characteristic write request. + * + * @typedef DescriptorWriteRequest + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Describes the parameters of the Gatt client's characteristic write request. + * + * @typedef DescriptorWriteRequest + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + interface DescriptorWriteRequest { + /** + * Indicates the address of the client that initiates the write request + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Indicates the address of the client that initiates the write request + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + deviceId: string; + /** + * The Id of the write request + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * The Id of the write request + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + transId: number; + /** + * Indicates the byte offset of the start position for writing characteristic value + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Indicates the byte offset of the start position for writing characteristic value + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + offset: number; + /** + * Whether this request should be pending for later operation + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Whether this request should be pending for later operation + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + isPrepared: boolean; + /** + * Whether the remote client need a response + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Whether the remote client need a response + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + needRsp: boolean; + /** + * Indicates the value to be written + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Indicates the value to be written + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + value: ArrayBuffer; + /** + * The UUID of a DescriptorWriteRequest instance + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * The UUID of a DescriptorWriteRequest instance + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + descriptorUuid: string; + /** + * The UUID of the characteristic to which the descriptor belongs + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * The UUID of the characteristic to which the descriptor belongs + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + characteristicUuid: string; + /** + * The UUID of the service to which the descriptor belongs + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * The UUID of the service to which the descriptor belongs + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + serviceUuid: string; + } + /** + * Describes the parameters of a response send by the server to a specified read or write request. + * + * @typedef ServerResponse + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Describes the parameters of a response send by the server to a specified read or write request. + * + * @typedef ServerResponse + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + interface ServerResponse { + /** + * Indicates the address of the client to which to send the response + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Indicates the address of the client to which to send the response + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + deviceId: string; + /** + * The Id of the write request + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * The Id of the write request + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + transId: number; + /** + * Indicates the status of the read or write request, set this parameter to '0' in normal cases + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Indicates the status of the read or write request, set this parameter to '0' in normal cases + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + status: number; + /** + * Indicates the byte offset of the start position for reading or writing operation + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Indicates the byte offset of the start position for reading or writing operation + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + offset: number; + /** + * Indicates the value to be sent + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Indicates the value to be sent + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + value: ArrayBuffer; + } + /** + * Describes the Gatt profile connection state. + * + * @typedef BLEConnectionChangeState + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Describes the Gatt profile connection state. + * + * @typedef BLEConnectionChangeState + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + interface BLEConnectionChangeState { + /** + * Indicates the peer device address + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Indicates the peer device address + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + deviceId: string; + /** + * Connection state of the Gatt profile + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Connection state of the Gatt profile + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + state: ProfileConnectionState; + } + /** + * Describes the contents of the scan results. + * + * @typedef ScanResult + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Describes the contents of the scan results. + * + * @typedef ScanResult + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + interface ScanResult { + /** + * Address of the scanned device + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Address of the scanned device + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + deviceId: string; + /** + * RSSI of the remote device + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * RSSI of the remote device + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + rssi: number; + /** + * The raw data of broadcast packet + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * The raw data of broadcast packet + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + data: ArrayBuffer; + /** + * The local name of the BLE device + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * The local name of the BLE device + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + deviceName: string; + /** + * Connectable of the remote device + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Connectable of the remote device + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + connectable: boolean; + } + /** + * Describes the settings for BLE advertising. + * + * @typedef AdvertiseSetting + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Describes the settings for BLE advertising. + * + * @typedef AdvertiseSetting + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + interface AdvertiseSetting { + /** + * Minimum slot value for the advertising interval, which is {@code 32} (20 ms) + * Maximum slot value for the advertising interval, which is {@code 16777215} (10485.759375s) + * Default slot value for the advertising interval, which is {@code 1600} (1s) + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Minimum slot value for the advertising interval, which is {@code 32} (20 ms) + * Maximum slot value for the advertising interval, which is {@code 16777215} (10485.759375s) + * Default slot value for the advertising interval, which is {@code 1600} (1s) + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + interval?: number; + /** + * Minimum transmission power level for advertising, which is {@code -127} + * Maximum transmission power level for advertising, which is {@code 1} + * Default transmission power level for advertising, which is {@code -7} + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Minimum transmission power level for advertising, which is {@code -127} + * Maximum transmission power level for advertising, which is {@code 1} + * Default transmission power level for advertising, which is {@code -7} + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + txPower?: number; + /** + * Indicates whether the BLE is connectable, default is {@code true} + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Indicates whether the BLE is connectable, default is {@code true} + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + connectable?: boolean; + } + /** + * Describes the advertising data. + * + * @typedef AdvertiseData + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Describes the advertising data. + * + * @typedef AdvertiseData + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + interface AdvertiseData { + /** + * The specified service UUID list to this advertisement + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * The specified service UUID list to this advertisement + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + serviceUuids: Array; + /** + * The specified manufacturer data list to this advertisement + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * The specified manufacturer data list to this advertisement + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + manufactureData: Array; + /** + * The specified service data list to this advertisement + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * The specified service data list to this advertisement + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + serviceData: Array; + /** + * Indicates whether the device name will be included in the advertisement packet. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Indicates whether the device name will be included in the advertisement packet. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + includeDeviceName?: boolean; + } + /** + * Describes the advertising parameters. + * + * @typedef AdvertisingParams + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 11 + */ + interface AdvertisingParams { + /** + * Indicates the advertising settings. + * + * @type { AdvertiseSetting } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 11 + */ + advertisingSettings: AdvertiseSetting; + /** + * Indicates the advertising data. + * + * @type { AdvertiseData } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 11 + */ + advertisingData: AdvertiseData; + /** + * Indicates the advertising response. + * + * @type { ?AdvertiseData } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 11 + */ + advertisingResponse?: AdvertiseData; + /** + * Indicates the duration for advertising continuously. + * The duration, in 10ms unit. Valid range is from 1 (10ms) to 65535 (655,350 ms). + * If this parameter is not specified or is set to 0, advertisement is continuously sent. + * + * @type { ?number } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 11 + */ + duration?: number; + } + /** + * Parameter for dynamically enable advertising. + * + * @typedef AdvertisingEnableParams + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 11 + */ + interface AdvertisingEnableParams { + /** + * Indicates the ID of current advertising. + * + * @type { number } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 11 + */ + advertisingId: number; + /** + * Indicates the duration for advertising continuously. + * The duration, in 10ms unit. Valid range is from 1 (10ms) to 65535 (655,350 ms). + * If this parameter is not specified or is set to 0, advertise is continuously sent. + * + * @type { ?number } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 11 + */ + duration?: number; + } + /** + * Parameter for dynamically disable advertising. + * + * @typedef AdvertisingDisableParams + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 11 + */ + interface AdvertisingDisableParams { + /** + * Indicates the ID of current advertising. + * + * @type { number } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 11 + */ + advertisingId: number; + } + /** + * Advertising state change information. + * + * @typedef AdvertisingStateChangeInfo + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 11 + */ + interface AdvertisingStateChangeInfo { + /** + * Indicates the ID of current advertising. + * + * @type { number } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 11 + */ + advertisingId: number; + /** + * Indicates the advertising state. + * + * @type { AdvertisingState } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 11 + */ + state: AdvertisingState; + } + /** + * Describes the manufacturer data. + * + * @typedef ManufactureData + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Describes the manufacturer data. + * + * @typedef ManufactureData + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + interface ManufactureData { + /** + * Indicates the manufacturer ID assigned by Bluetooth SIG + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Indicates the manufacturer ID assigned by Bluetooth SIG + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + manufactureId: number; + /** + * Indicates the manufacturer data to add + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Indicates the manufacturer data to add + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + manufactureValue: ArrayBuffer; + } + /** + * Describes the service data. + * + * @typedef ServiceData + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Describes the service data. + * + * @typedef ServiceData + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + interface ServiceData { + /** + * Indicates the UUID of the service data to add + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Indicates the UUID of the service data to add + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + serviceUuid: string; + /** + * Indicates the service data to add + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Indicates the service data to add + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + serviceValue: ArrayBuffer; + } + /** + * Describes the criteria for filtering scanning results can be set. + * + * @typedef ScanFilter + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Describes the criteria for filtering scanning results can be set. + * + * @typedef ScanFilter + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + interface ScanFilter { + /** + * The address of a BLE peripheral device + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * The address of a BLE peripheral device + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + deviceId?: string; + /** + * The name of a BLE peripheral device + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * The name of a BLE peripheral device + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + name?: string; + /** + * The service UUID of a BLE peripheral device + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * The service UUID of a BLE peripheral device + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + serviceUuid?: string; + /** + * Service UUID mask. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Service UUID mask. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + serviceUuidMask?: string; + /** + * Service solicitation UUID. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Service solicitation UUID. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + serviceSolicitationUuid?: string; + /** + * Service solicitation UUID mask. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Service solicitation UUID mask. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + serviceSolicitationUuidMask?: string; + /** + * Service data. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Service data. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + serviceData?: ArrayBuffer; + /** + * Service data mask. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Service data mask. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + serviceDataMask?: ArrayBuffer; + /** + * Manufacture id. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Manufacture id. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + manufactureId?: number; + /** + * Manufacture data. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Manufacture data. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + manufactureData?: ArrayBuffer; + /** + * Manufacture data mask. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Manufacture data mask. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + manufactureDataMask?: ArrayBuffer; + } + /** + * Describes the parameters for scan. + * + * @typedef ScanOptions + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Describes the parameters for scan. + * + * @typedef ScanOptions + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + interface ScanOptions { + /** + * Time of delay for reporting the scan result + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Time of delay for reporting the scan result + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + interval?: number; + /** + * Bluetooth LE scan mode + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Bluetooth LE scan mode + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + dutyMode?: ScanDuty; + /** + * Match mode for Bluetooth LE scan filters hardware match + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Match mode for Bluetooth LE scan filters hardware match + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + matchMode?: MatchMode; + /** + * Physical Layer used during scan. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + phyType?: PhyType; + } + /** + * Describes the properties of a gatt characteristic. + * + * @typedef GattProperties + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Describes the properties of a gatt characteristic. + * + * @typedef GattProperties + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + interface GattProperties { + /** + * Support write property of the characteristic. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Support write property of the characteristic. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + write?: boolean; + /** + * Support write no response property of the characteristic. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Support write no response property of the characteristic. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + writeNoResponse?: boolean; + /** + * Support read property of the characteristic. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Support read property of the characteristic. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + read?: boolean; + /** + * Support notify property of the characteristic. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Support notify property of the characteristic. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + notify?: boolean; + /** + * Support indicate property of the characteristic. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Support indicate property of the characteristic. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + indicate?: boolean; + } + /** + * The enum of gatt characteristic write type + * + * @enum { number } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * The enum of gatt characteristic write type + * + * @enum { number } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + enum GattWriteType { + /** + * Write characteristic with response. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Write characteristic with response. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + WRITE = 1, + /** + * Write characteristic without response. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Write characteristic without response. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + WRITE_NO_RESPONSE = 2 + } + /** + * The enum of scan duty. + * + * @enum { number } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * The enum of scan duty. + * + * @enum { number } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + enum ScanDuty { + /** + * low power mode + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * low power mode + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + SCAN_MODE_LOW_POWER = 0, + /** + * balanced power mode + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * balanced power mode + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + SCAN_MODE_BALANCED = 1, + /** + * Scan using highest duty cycle + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Scan using highest duty cycle + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + SCAN_MODE_LOW_LATENCY = 2 + } + /** + * The enum of BLE match mode. + * + * @enum { number } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * The enum of BLE match mode. + * + * @enum { number } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + enum MatchMode { + /** + * aggressive mode + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * aggressive mode + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + MATCH_MODE_AGGRESSIVE = 1, + /** + * sticky mode + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * sticky mode + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + MATCH_MODE_STICKY = 2 + } + /** + * The enum of BLE advertising state. + * + * @enum { number } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 11 + */ + enum AdvertisingState { + /** + * advertising started. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 11 + */ + STARTED = 1, + /** + * advertising temporarily enabled. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 11 + */ + ENABLED = 2, + /** + * advertising temporarily disabled. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 11 + */ + DISABLED = 3, + /** + * advertising stopped. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 11 + */ + STOPPED = 4 + } + /** + * Phy type used during scan. + * + * @enum { number } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + enum PhyType { + /** + * Use 1M phy for scanning. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + PHY_LE_1M = 1, + /** + * Use all supported Phys for scanning. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + PHY_LE_ALL_SUPPORTED = 255 + } +} +export default ble; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.bluetooth.connection.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.bluetooth.connection.d.ts new file mode 100755 index 00000000..3466fe66 --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.bluetooth.connection.d.ts @@ -0,0 +1,999 @@ +/* + * Copyright (C) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit ConnectivityKit + */ +import type { AsyncCallback, Callback } from './@ohos.base'; +import type constant from './@ohos.bluetooth.constant'; +/** + * Provides methods to operate or manage Bluetooth. + * + * @namespace connection + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ +/** + * Provides methods to operate or manage Bluetooth. + * + * @namespace connection + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ +declare namespace connection { + /** + * Indicate the profile connection state. + * + * @typedef { constant.ProfileConnectionState } ProfileConnectionState + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + type ProfileConnectionState = constant.ProfileConnectionState; + /** + * Indicate the profile id. + * + * @typedef { constant.ProfileId } ProfileId + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + type ProfileId = constant.ProfileId; + /** + * Indicate the major class of a bluetooth device. + * + * @typedef { constant.MajorClass } MajorClass + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + type MajorClass = constant.MajorClass; + /** + * Indicate the major minor class of a bluetooth device. + * + * @typedef { constant.MajorMinorClass } MajorMinorClass + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + type MajorMinorClass = constant.MajorMinorClass; + /** + * Get the profile connection state of the current device. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { ProfileId } [profileId] - Indicate the profile id. This is an optional parameter. + * With profileId, returns the current connection state of this profile, {@link ProfileConnectionState}. + * Without profileId, if any profile is connected, {@link ProfileConnectionState#STATE_CONNECTED} is returned. + * Otherwise, {@link ProfileConnectionState#STATE_DISCONNECTED} is returned. + * @returns { ProfileConnectionState } Returns the connection state. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Incorrect parameter types. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth switch is off. + * @throws { BusinessError } 2900004 - Profile is not supported. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + function getProfileConnectionState(profileId?: ProfileId): ProfileConnectionState; + /** + * Starts pairing with a remote Bluetooth device. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF". + * @param { AsyncCallback } callback - the callback of pairDevice. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth switch is off. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Starts pairing with a remote Bluetooth device. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF". + * @param { AsyncCallback } callback - the callback of pairDevice. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth switch is off. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + function pairDevice(deviceId: string, callback: AsyncCallback): void; + /** + * Starts pairing with a remote Bluetooth device. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF". + * @returns { Promise } Returns the promise object. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth switch is off. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Starts pairing with a remote Bluetooth device. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF". + * @returns { Promise } Returns the promise object. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth switch is off. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + function pairDevice(deviceId: string): Promise; + /** + * Obtains the name of a peer Bluetooth device. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF". + * @returns { string } Returns the device name in character string format. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth switch is off. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Obtains the name of a peer Bluetooth device. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF". + * @returns { string } Returns the device name in character string format. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth switch is off. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + function getRemoteDeviceName(deviceId: string): string; + /** + * Obtains the class of a peer Bluetooth device. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF". + * @returns { DeviceClass } The class of the remote device. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth switch is off. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + function getRemoteDeviceClass(deviceId: string): DeviceClass; + /** + * Obtains the Bluetooth local name of a device. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @returns { string } Returns the name the device. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + function getLocalName(): string; + /** + * Obtains the list of Bluetooth devices that have been paired with the current device. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @returns { Array } Returns a list of paired Bluetooth devices's address. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth switch is off. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Obtains the list of Bluetooth devices that have been paired with the current device. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @returns { Array } Returns a list of paired Bluetooth devices's address. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth switch is off. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + function getPairedDevices(): Array; + /** + * Obtains the pair state of a specified device. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF". + * @returns { BondState } Returns the pair state. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth switch is off. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 11 + */ + /** + * Obtains the pair state of a specified device. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF". + * @returns { BondState } Returns the pair state. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth switch is off. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + function getPairState(deviceId: string): BondState; + /** + * Sets the confirmation of pairing with a certain device. + * + * @permission ohos.permission.ACCESS_BLUETOOTH and ohos.permission.MANAGE_BLUETOOTH + * @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF". + * @param { boolean } accept - Indicates whether to accept the pairing request, {@code true} indicates accept or {@code false} otherwise. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth switch is off. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + function setDevicePairingConfirmation(deviceId: string, accept: boolean): void; + /** + * Set the pin during pairing when the pin type is PIN_TYPE_ENTER_PIN_CODE. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF". + * @param { string } code - The pin code entered by the user. + * @param { AsyncCallback } callback - the callback of setDevicePinCode. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth switch is off. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + function setDevicePinCode(deviceId: string, code: string, callback: AsyncCallback): void; + /** + * Set the pin during pairing when the pin type is PIN_TYPE_ENTER_PIN_CODE. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF". + * @param { string } code - The pin code entered by the user. + * @returns { Promise } Returns the promise object. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth switch is off. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + function setDevicePinCode(deviceId: string, code: string): Promise; + /** + * Sets the Bluetooth friendly name of a device. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { string } name - Indicates a valid Bluetooth name. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth switch is off. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + function setLocalName(name: string): void; + /** + * Sets the Bluetooth scan mode for a device. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { ScanMode } mode - Indicates the Bluetooth scan mode to set. + * @param { number } duration - Indicates the duration in seconds, in which the host is discoverable. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth switch is off. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + function setBluetoothScanMode(mode: ScanMode, duration: number): void; + /** + * Obtains the Bluetooth scanning mode of a device. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @returns { ScanMode } Returns the Bluetooth scanning mode. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth switch is off. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + function getBluetoothScanMode(): ScanMode; + /** + * Starts scanning Bluetooth devices. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth switch is off. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Starts scanning Bluetooth devices. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth switch is off. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + function startBluetoothDiscovery(): void; + /** + * Stops Bluetooth device scanning. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth switch is off. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Stops Bluetooth device scanning. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth switch is off. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + function stopBluetoothDiscovery(): void; + /** + * Check if bluetooth is discovering. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @returns { boolean } Returns {@code true} if the local device is discovering; returns {@code false} otherwise. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth switch is off. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 11 + */ + function isBluetoothDiscovering(): boolean; + /** + * Get remote device battery information. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF". + * @returns { Promise } Returns battery info. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth switch is off. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 12 + */ + function getRemoteDeviceBatteryInfo(deviceId: string): Promise; + /** + * Modify remote device name. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF". + * @param { string } name - New device name. Max length is 64 bytes. + * @returns { Promise } Returns the promise object. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth switch is off. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 12 + */ + /** + * Modify remote device name. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF". + * @param { string } name - New device name. Max length is 64 bytes. + * @returns { Promise } Returns the promise object. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth switch is off. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + function setRemoteDeviceName(deviceId: string, name: string): Promise; + /** + * Subscribe the event reported when a remote Bluetooth device is discovered. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { 'bluetoothDeviceFind' } type - Type of the discovering event to listen for. + * @param { Callback> } callback - Callback used to listen for the discovering event. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Subscribe the event reported when a remote Bluetooth device is discovered. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { 'bluetoothDeviceFind' } type - Type of the discovering event to listen for. + * @param { Callback> } callback - Callback used to listen for the discovering event. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + function on(type: 'bluetoothDeviceFind', callback: Callback>): void; + /** + * Unsubscribe the event reported when a remote Bluetooth device is discovered. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { 'bluetoothDeviceFind' } type - Type of the discovering event to listen for. + * @param { Callback> } callback - Callback used to listen for the discovering event. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Unsubscribe the event reported when a remote Bluetooth device is discovered. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { 'bluetoothDeviceFind' } type - Type of the discovering event to listen for. + * @param { Callback> } callback - Callback used to listen for the discovering event. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + function off(type: 'bluetoothDeviceFind', callback?: Callback>): void; + /** + * Subscribe the event reported when a remote Bluetooth device is bonded. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { 'bondStateChange' } type - Type of the bond state event to listen for. + * @param { Callback } callback - Callback used to listen for the bond state event. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + function on(type: 'bondStateChange', callback: Callback): void; + /** + * Unsubscribe the event reported when a remote Bluetooth device is bonded. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { 'bondStateChange' } type - Type of the bond state event to listen for. + * @param { Callback } callback - Callback used to listen for the bond state event. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + function off(type: 'bondStateChange', callback?: Callback): void; + /** + * Subscribe the event of a pairing request from a remote Bluetooth device. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { 'pinRequired' } type - Type of the pairing request event to listen for. + * @param { Callback } callback - Callback used to listen for the pairing request event. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + function on(type: 'pinRequired', callback: Callback): void; + /** + * Unsubscribe the event of a pairing request from a remote Bluetooth device. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { 'pinRequired' } type - Type of the pairing request event to listen for. + * @param { Callback } callback - Callback used to listen for the pairing request event. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + function off(type: 'pinRequired', callback?: Callback): void; + /** + * Subscribe the event of battery state changed from a remote device. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { 'batteryChange' } type - Type of the battery event to listen for. + * @param { Callback } callback - Callback used to listen. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 12 + */ + function on(type: 'batteryChange', callback: Callback): void; + /** + * Unsubscribe the event of battery state changed from a remote device. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { 'batteryChange' } type - Type of the battery event to listen for. + * @param { Callback } callback - Callback used to listen. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 12 + */ + function off(type: 'batteryChange', callback?: Callback): void; + /** + * Describes the class of a bluetooth device. + * + * @typedef BondStateParam + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + interface BondStateParam { + /** + * Address of a Bluetooth device. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + deviceId: string; + /** + * Profile connection state of the device. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + state: BondState; + /** + * Cause of unbond. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 12 + */ + cause: UnbondCause; + } + /** + * Describes the bond key param. + * + * @typedef PinRequiredParam + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + interface PinRequiredParam { + /** + * ID of the device to pair. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + deviceId: string; + /** + * Key for the device pairing. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + pinCode: string; + } + /** + * Describes the class of a bluetooth device. + * + * @typedef DeviceClass + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + interface DeviceClass { + /** + * Major classes of Bluetooth devices. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + majorClass: MajorClass; + /** + * Major and minor classes of Bluetooth devices. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + majorMinorClass: MajorMinorClass; + /** + * Class of the device. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + classOfDevice: number; + } + /** + * Enum for the transport of a remote device + * + * @enum { number } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + enum BluetoothTransport { + /** + * The value of bluetooth transport BR/EDR. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + TRANSPORT_BR_EDR = 0, + /** + * The value of bluetooth transport LE. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + TRANSPORT_LE = 1 + } + /** + * The enum of BR scan mode. + * + * @enum { number } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + enum ScanMode { + /** + * Indicates the scan mode is none + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + SCAN_MODE_NONE = 0, + /** + * Indicates the scan mode is connectable + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + SCAN_MODE_CONNECTABLE = 1, + /** + * Indicates the scan mode is general discoverable + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + SCAN_MODE_GENERAL_DISCOVERABLE = 2, + /** + * Indicates the scan mode is limited discoverable + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + SCAN_MODE_LIMITED_DISCOVERABLE = 3, + /** + * Indicates the scan mode is connectable and general discoverable + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + SCAN_MODE_CONNECTABLE_GENERAL_DISCOVERABLE = 4, + /** + * Indicates the scan mode is connectable and limited discoverable + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + SCAN_MODE_CONNECTABLE_LIMITED_DISCOVERABLE = 5 + } + /** + * The enum of bond state. + * + * @enum { number } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * The enum of bond state. + * + * @enum { number } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + enum BondState { + /** + * Indicate the bond state is invalid + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Indicate the bond state is invalid + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + BOND_STATE_INVALID = 0, + /** + * Indicate the bond state is bonding + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Indicate the bond state is bonding + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + BOND_STATE_BONDING = 1, + /** + * Indicate the bond state is bonded + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * Indicate the bond state is bonded + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + BOND_STATE_BONDED = 2 + } + /** + * Describes the contents of the battery information. + * + * @typedef BatteryInfo + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 12 + */ + interface BatteryInfo { + /** + * Electricity value of the general device. {@code -1} means no power information. + * + * @type { number } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 12 + */ + batteryLevel: number; + /** + * Electricity value of the left ear. {@code -1} means no power information. + * + * @type { number } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 12 + */ + leftEarBatteryLevel: number; + /** + * The charge state of the left ear. + * + * @type { DeviceChargeState } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 12 + */ + leftEarChargeState: DeviceChargeState; + /** + * Electricity value of the right ear. {@code -1} means no power information. + * + * @type { number } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 12 + */ + rightEarBatteryLevel: number; + /** + * The charge state of the right ear. + * + * @type { DeviceChargeState } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 12 + */ + rightEarChargeState: DeviceChargeState; + /** + * Electricity value of the box. {@code -1} means no power information. + * + * @type { number } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 12 + */ + boxBatteryLevel: number; + /** + * The charge state of the box. + * + * @type { DeviceChargeState } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 12 + */ + boxChargeState: DeviceChargeState; + } + /** + * Enum for the charge state. + * + * @enum { number } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 12 + */ + enum DeviceChargeState { + /** + * Not support super charge, and not charged. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 12 + */ + DEVICE_NORMAL_CHARGE_NOT_CHARGED = 0, + /** + * Not support super charge, and in charging. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 12 + */ + DEVICE_NORMAL_CHARGE_IN_CHARGING = 1, + /** + * Support super charge, and not charged. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 12 + */ + DEVICE_SUPER_CHARGE_NOT_CHARGED = 2, + /** + * Support super charge, and in charging. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 12 + */ + DEVICE_SUPER_CHARGE_IN_CHARGING = 3 + } + /** + * Enum for cause of unbond. + * + * @enum { number } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 12 + */ + enum UnbondCause { + /** + * User proactively removed device. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 12 + */ + USER_REMOVED = 0, + /** + * Remote device shut down. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 12 + */ + REMOTE_DEVICE_DOWN = 1, + /** + * Wrong PIN code. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 12 + */ + AUTH_FAILURE = 2, + /** + * Remote device rejected. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 12 + */ + AUTH_REJECTED = 3, + /** + * Internal error. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 12 + */ + INTERNAL_ERROR = 4 + } +} +export default connection; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.bluetooth.constant.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.bluetooth.constant.d.ts new file mode 100755 index 00000000..2cd2ebfe --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.bluetooth.constant.d.ts @@ -0,0 +1,844 @@ +/* + * Copyright (C) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit ConnectivityKit + */ +/** + * The definition of constant. + * + * @namespace constant + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ +/** + * The definition of constant. + * + * @namespace constant + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ +declare namespace constant { + /** + * The enum of profile id. + * + * @enum { number } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + export enum ProfileId { + /** + * A2DP profile. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + PROFILE_A2DP_SOURCE = 1, + /** + * HFP profile. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + PROFILE_HANDSFREE_AUDIO_GATEWAY = 4, + /** + * Human Interface Device (HID) profile. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + PROFILE_HID_HOST = 6, + /** + * PAN profile. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + PROFILE_PAN_NETWORK = 7 + } + /** + * The enum of profile connection state. + * + * @enum { number } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * The enum of profile connection state. + * + * @enum { number } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + export enum ProfileConnectionState { + /** + * the current profile is disconnected + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * the current profile is disconnected + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + STATE_DISCONNECTED = 0, + /** + * the current profile is being connected + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * the current profile is being connected + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + STATE_CONNECTING = 1, + /** + * the current profile is connected + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * the current profile is connected + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + STATE_CONNECTED = 2, + /** + * the current profile is being disconnected + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + /** + * the current profile is being disconnected + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @atomicservice + * @since 12 + */ + STATE_DISCONNECTING = 3 + } + /** + * The enum of major class of a bluetooth device. + * + * @enum { number } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + export enum MajorClass { + /** + * Miscellaneous device. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + MAJOR_MISC = 0x0000, + /** + * Computer. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + MAJOR_COMPUTER = 0x0100, + /** + * Mobile phone. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + MAJOR_PHONE = 0x0200, + /** + * Network device. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + MAJOR_NETWORKING = 0x0300, + /** + * Audio or video device. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + MAJOR_AUDIO_VIDEO = 0x0400, + /** + * Peripheral device. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + MAJOR_PERIPHERAL = 0x0500, + /** + * Imaging device. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + MAJOR_IMAGING = 0x0600, + /** + * Wearable device. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + MAJOR_WEARABLE = 0x0700, + /** + * Toy. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + MAJOR_TOY = 0x0800, + /** + * Health device. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + MAJOR_HEALTH = 0x0900, + /** + * Unclassified device. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + MAJOR_UNCATEGORIZED = 0x1F00 + } + /** + * The enum of major minor class of a bluetooth device. + * + * @enum { number } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + export enum MajorMinorClass { + /** + * The Minor Device Class field + * Computer Major Class + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + COMPUTER_UNCATEGORIZED = 0x0100, + /** + * Desktop computer. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + COMPUTER_DESKTOP = 0x0104, + /** + * Server. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + COMPUTER_SERVER = 0x0108, + /** + * Laptop. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + COMPUTER_LAPTOP = 0x010C, + /** + * Hand-held computer. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + COMPUTER_HANDHELD_PC_PDA = 0x0110, + /** + * Palmtop computer. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + COMPUTER_PALM_SIZE_PC_PDA = 0x0114, + /** + * Wearable computer. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + COMPUTER_WEARABLE = 0x0118, + /** + * Tablet. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + COMPUTER_TABLET = 0x011C, + /** + * Phone Major Class + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + PHONE_UNCATEGORIZED = 0x0200, + /** + * Portable phone. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + PHONE_CELLULAR = 0x0204, + /** + * Cordless phone. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + PHONE_CORDLESS = 0x0208, + /** + * Smartphone. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + PHONE_SMART = 0x020C, + /** + * Modem or gateway phone. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + PHONE_MODEM_OR_GATEWAY = 0x0210, + /** + * ISDN phone. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + PHONE_ISDN = 0x0214, + /** + * LAN/Network Access Point Major Class + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + NETWORK_FULLY_AVAILABLE = 0x0300, + /** + * Device used on network 1 to 17. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + NETWORK_1_TO_17_UTILIZED = 0x0320, + /** + * Device used on network 17 to 33. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + NETWORK_17_TO_33_UTILIZED = 0x0340, + /** + * Device used on network 33 to 50. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + NETWORK_33_TO_50_UTILIZED = 0x0360, + /** + * Device used on network 60 to 67. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + NETWORK_60_TO_67_UTILIZED = 0x0380, + /** + * Device used on network 67 to 83. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + NETWORK_67_TO_83_UTILIZED = 0x03A0, + /** + * Device used on network 83 to 99. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + NETWORK_83_TO_99_UTILIZED = 0x03C0, + /** + * Device without network service. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + NETWORK_NO_SERVICE = 0x03E0, + /** + * Unclassified audio or video device. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + AUDIO_VIDEO_UNCATEGORIZED = 0x0400, + /** + * Wearable audio or video headset. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + AUDIO_VIDEO_WEARABLE_HEADSET = 0x0404, + /** + * Hands-free audio or video device. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + AUDIO_VIDEO_HANDSFREE = 0x0408, + /** + * Audio or video microphone. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + AUDIO_VIDEO_MICROPHONE = 0x0410, + /** + * Audio or video loudspeaker. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + AUDIO_VIDEO_LOUDSPEAKER = 0x0414, + /** + * Audio or video headphones. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + AUDIO_VIDEO_HEADPHONES = 0x0418, + /** + * Portable audio or video device. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + AUDIO_VIDEO_PORTABLE_AUDIO = 0x041C, + /** + * In-vehicle audio or video device. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + AUDIO_VIDEO_CAR_AUDIO = 0x0420, + /** + * Audio or video STB device. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + AUDIO_VIDEO_SET_TOP_BOX = 0x0424, + /** + * High-fidelity speaker device. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + AUDIO_VIDEO_HIFI_AUDIO = 0x0428, + /** + * Video cassette recording (VCR) device. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + AUDIO_VIDEO_VCR = 0x042C, + /** + * Camera. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + AUDIO_VIDEO_VIDEO_CAMERA = 0x0430, + /** + * Camcorder. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + AUDIO_VIDEO_CAMCORDER = 0x0434, + /** + * Audio or video monitor. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + AUDIO_VIDEO_VIDEO_MONITOR = 0x0438, + /** + * Video display or loudspeaker. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + AUDIO_VIDEO_VIDEO_DISPLAY_AND_LOUDSPEAKER = 0x043C, + /** + * Video conferencing device. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + AUDIO_VIDEO_VIDEO_CONFERENCING = 0x0440, + /** + * Audio or video gaming toy. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + AUDIO_VIDEO_VIDEO_GAMING_TOY = 0x0448, + /** + * Peripheral Major Class + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + PERIPHERAL_NON_KEYBOARD_NON_POINTING = 0x0500, + /** + * Keyboard device. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + PERIPHERAL_KEYBOARD = 0x0540, + /** + * Pointing peripheral device. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + PERIPHERAL_POINTING_DEVICE = 0x0580, + /** + * Keyboard pointing device. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + PERIPHERAL_KEYBOARD_POINTING = 0x05C0, + /** + * Unclassified peripheral device. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + PERIPHERAL_UNCATEGORIZED = 0x0500, + /** + * Peripheral joystick. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + PERIPHERAL_JOYSTICK = 0x0504, + /** + * Peripheral game pad. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + PERIPHERAL_GAMEPAD = 0x0508, + /** + * Peripheral remote control device. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + PERIPHERAL_REMOTE_CONTROL = 0x05C0, + /** + * Peripheral sensing device. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + PERIPHERAL_SENSING_DEVICE = 0x0510, + /** + * Peripheral digitizer tablet. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + PERIPHERAL_DIGITIZER_TABLET = 0x0514, + /** + * Peripheral card reader. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + PERIPHERAL_CARD_READER = 0x0518, + /** + * Peripheral digital pen. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + PERIPHERAL_DIGITAL_PEN = 0x051C, + /** + * Peripheral RFID scanner. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + PERIPHERAL_SCANNER_RFID = 0x0520, + /** + * Gesture input device. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + PERIPHERAL_GESTURAL_INPUT = 0x0522, + /** + * Imaging Major Class + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + IMAGING_UNCATEGORIZED = 0x0600, + /** + * Imaging display device. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + IMAGING_DISPLAY = 0x0610, + /** + * Imaging camera device. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + IMAGING_CAMERA = 0x0620, + /** + * Imaging scanner. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + IMAGING_SCANNER = 0x0640, + /** + * Imaging printer. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + IMAGING_PRINTER = 0x0680, + /** + * Wearable Major Class + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + WEARABLE_UNCATEGORIZED = 0x0700, + /** + * Smart watch. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + WEARABLE_WRIST_WATCH = 0x0704, + /** + * Wearable pager. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + WEARABLE_PAGER = 0x0708, + /** + * Smart jacket. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + WEARABLE_JACKET = 0x070C, + /** + * Wearable helmet. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + WEARABLE_HELMET = 0x0710, + /** + * Wearable glasses. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + WEARABLE_GLASSES = 0x0714, + /** + * Minor Device Class field - Toy Major Class + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + TOY_UNCATEGORIZED = 0x0800, + /** + * Toy robot. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + TOY_ROBOT = 0x0804, + /** + * Toy vehicle. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + TOY_VEHICLE = 0x0808, + /** + * Humanoid toy doll. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + TOY_DOLL_ACTION_FIGURE = 0x080C, + /** + * Toy controller. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + TOY_CONTROLLER = 0x0810, + /** + * Toy gaming device. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + TOY_GAME = 0x0814, + /** + * Minor Device Class field - Health + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + HEALTH_UNCATEGORIZED = 0x0900, + /** + * Blood pressure device. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + HEALTH_BLOOD_PRESSURE = 0x0904, + /** + * Thermometer. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + HEALTH_THERMOMETER = 0x0908, + /** + * Body scale. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + HEALTH_WEIGHING = 0x090C, + /** + * Blood glucose monitor. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + HEALTH_GLUCOSE = 0x0910, + /** + * Pulse oximeter. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + HEALTH_PULSE_OXIMETER = 0x0914, + /** + * Heart rate monitor. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + HEALTH_PULSE_RATE = 0x0918, + /** + * Health data display. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + HEALTH_DATA_DISPLAY = 0x091C, + /** + * Step counter. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + HEALTH_STEP_COUNTER = 0x0920, + /** + * Body composition analyzer. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + HEALTH_BODY_COMPOSITION_ANALYZER = 0x0924, + /** + * Hygrometer. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + HEALTH_PEAK_FLOW_MONITOR = 0x0928, + /** + * Medication monitor. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + HEALTH_MEDICATION_MONITOR = 0x092C, + /** + * Prosthetic knee. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + HEALTH_KNEE_PROSTHESIS = 0x0930, + /** + * Prosthetic ankle. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + HEALTH_ANKLE_PROSTHESIS = 0x0934, + /** + * Generic health management device. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + HEALTH_GENERIC_HEALTH_MANAGER = 0x0938, + /** + * Personal mobility device. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + HEALTH_PERSONAL_MOBILITY_DEVICE = 0x093C + } +} +export default constant; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.bluetooth.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.bluetooth.d.ts new file mode 100755 index 00000000..173ad9fb --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.bluetooth.d.ts @@ -0,0 +1,3189 @@ +/* + * Copyright (C) 2021-2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit ConnectivityKit + */ +import type { AsyncCallback, Callback } from './@ohos.base'; +/** + * Provides methods to operate or manage Bluetooth. + * + * @namespace bluetooth + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.bluetoothManager + */ +declare namespace bluetooth { + /** + * Obtains the Bluetooth status of a device. + * + * @permission ohos.permission.USE_BLUETOOTH + * @returns { BluetoothState } Returns the Bluetooth status, which can be {@link BluetoothState#STATE_OFF}, + * {@link BluetoothState#STATE_TURNING_ON}, {@link BluetoothState#STATE_ON}, {@link BluetoothState#STATE_TURNING_OFF}, + * {@link BluetoothState#STATE_BLE_TURNING_ON}, {@link BluetoothState#STATE_BLE_ON}, + * or {@link BluetoothState#STATE_BLE_TURNING_OFF}. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.bluetoothManager/bluetoothManager.getState + */ + function getState(): BluetoothState; + /** + * Get the local device connection state to any profile of any remote device. + * + * @permission ohos.permission.USE_BLUETOOTH + * @returns { ProfileConnectionState } One of {@link ProfileConnectionState#STATE_DISCONNECTED}, + * {@link ProfileConnectionState#STATE_CONNECTING}, {@link ProfileConnectionState#STATE_CONNECTED}, + * {@link ProfileConnectionState#STATE_DISCONNECTING}. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.bluetoothManager/bluetoothManager.getBtConnectionState + */ + function getBtConnectionState(): ProfileConnectionState; + /** + * Starts pairing with a remote Bluetooth device. + * + * @permission ohos.permission.DISCOVER_BLUETOOTH + * @param { string } deviceId - The address of the remote device to pair. + * @returns { boolean } Returns {@code true} if the pairing process is started; returns {@code false} otherwise. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.bluetoothManager/bluetoothManager.pairDevice + */ + function pairDevice(deviceId: string): boolean; + /** + * Obtains the name of a peer Bluetooth device. + * + * @permission ohos.permission.USE_BLUETOOTH + * @param { string } deviceId - The address of the remote device. + * @returns { string } Returns the device name in character string format. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.bluetoothManager/bluetoothManager.getRemoteDeviceName + */ + function getRemoteDeviceName(deviceId: string): string; + /** + * Obtains the class of a peer Bluetooth device. + * + * @permission ohos.permission.USE_BLUETOOTH + * @param { string } deviceId - The address of the remote device. + * @returns { DeviceClass } The class of the remote device, {@link DeviceClass}. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.bluetoothManager/bluetoothManager.getRemoteDeviceClass + */ + function getRemoteDeviceClass(deviceId: string): DeviceClass; + /** + * Enables Bluetooth on a device. + * + * @permission ohos.permission.DISCOVER_BLUETOOTH + * @returns { boolean } Returns {@code true} if Bluetooth is being enabled; returns {@code false} if an error occurs. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.bluetoothManager/bluetoothManager.enableBluetooth + */ + function enableBluetooth(): boolean; + /** + * Disables Bluetooth on a device. + * + * @permission ohos.permission.DISCOVER_BLUETOOTH + * @returns { boolean } Returns {@code true} if Bluetooth is being disabled; returns {@code false} if an error occurs. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.bluetoothManager/bluetoothManager.disableBluetooth + */ + function disableBluetooth(): boolean; + /** + * Obtains the Bluetooth local name of a device. + * + * @permission ohos.permission.USE_BLUETOOTH + * @returns { string } Returns the name the device. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.bluetoothManager/bluetoothManager.getLocalName + */ + function getLocalName(): string; + /** + * Obtains the list of Bluetooth devices that have been paired with the current device. + * + * @permission ohos.permission.USE_BLUETOOTH + * @returns { Array } Returns a list of paired Bluetooth devices's address. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.bluetoothManager/bluetoothManager.getPairedDevices + */ + function getPairedDevices(): Array; + /** + * Obtains the connection state of profile. + * + * @permission ohos.permission.USE_BLUETOOTH + * @param { ProfileId } profileId - The profile id. + * @returns { ProfileConnectionState } Returns the connection state. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.bluetoothManager/bluetoothManager.getProfileConnectionState + */ + function getProfileConnState(profileId: ProfileId): ProfileConnectionState; + /** + * Sets the confirmation of pairing with a certain device. + * + * @permission ohos.permission.MANAGE_BLUETOOTH + * @param { string } device - The address of the remote device. + * @param { boolean } accept - Indicates whether to accept the pairing request, {@code true} indicates accept or {@code false} otherwise. + * @returns { boolean } Returns {@code true} if the pairing confirmation is set; returns {@code false} otherwise. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.bluetoothManager/bluetoothManager.setDevicePairingConfirmation + */ + function setDevicePairingConfirmation(device: string, accept: boolean): boolean; + /** + * Sets the Bluetooth friendly name of a device. + * + * @permission ohos.permission.DISCOVER_BLUETOOTH + * @param { string } name - Indicates a valid Bluetooth name. + * @returns { boolean } Returns {@code true} if the Bluetooth name is set successfully; returns {@code false} otherwise. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.bluetoothManager/bluetoothManager.setLocalName + */ + function setLocalName(name: string): boolean; + /** + * Sets the Bluetooth scan mode for a device. + * + * @permission ohos.permission.USE_BLUETOOTH + * @param { ScanMode } mode - Indicates the Bluetooth scan mode to set, {@link ScanMode}. + * @param { number } duration - Indicates the duration in seconds, in which the host is discoverable. + * @returns { boolean } Returns {@code true} if the Bluetooth scan mode is set; returns {@code false} otherwise. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.bluetoothManager/bluetoothManager.setBluetoothScanMode + */ + function setBluetoothScanMode(mode: ScanMode, duration: number): boolean; + /** + * Obtains the Bluetooth scanning mode of a device. + * + * @permission ohos.permission.USE_BLUETOOTH + * @returns { ScanMode } Returns the Bluetooth scanning mode, {@link ScanMode}. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.bluetoothManager/bluetoothManager.getBluetoothScanMode + */ + function getBluetoothScanMode(): ScanMode; + /** + * Starts scanning Bluetooth devices. + * + * @permission ohos.permission.DISCOVER_BLUETOOTH and ohos.permission.LOCATION + * @returns { boolean } Returns {@code true} if the scan is started successfully; returns {@code false} otherwise. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.bluetoothManager/bluetoothManager.startBluetoothDiscovery + */ + function startBluetoothDiscovery(): boolean; + /** + * Stops Bluetooth device scanning. + * + * @permission ohos.permission.DISCOVER_BLUETOOTH + * @returns { boolean } Returns {@code true} if scanning is stopped successfully; returns {@code false} otherwise. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.bluetoothManager/bluetoothManager.stopBluetoothDiscovery + */ + function stopBluetoothDiscovery(): boolean; + /** + * Subscribe the event reported when a remote Bluetooth device is discovered. + * + * @permission ohos.permission.USE_BLUETOOTH + * @param { 'bluetoothDeviceFind' } type - Type of the discovering event to listen for. + * @param { Callback> } callback - Callback used to listen for the discovering event. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.bluetoothManager/bluetoothManager.on#event:bluetoothDeviceFind + */ + function on(type: 'bluetoothDeviceFind', callback: Callback>): void; + /** + * Unsubscribe the event reported when a remote Bluetooth device is discovered. + * + * @permission ohos.permission.USE_BLUETOOTH + * @param { 'bluetoothDeviceFind' } type - Type of the discovering event to listen for. + * @param { Callback> } callback - Callback used to listen for the discovering event. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.bluetoothManager/bluetoothManager.off#event:bluetoothDeviceFind + */ + function off(type: 'bluetoothDeviceFind', callback?: Callback>): void; + /** + * Subscribe the event reported when a remote Bluetooth device is bonded. + * + * @permission ohos.permission.USE_BLUETOOTH + * @param { 'bondStateChange' } type - Type of the bond state event to listen for. + * @param { Callback } callback - Callback used to listen for the bond state event, {@link BondStateParam}. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.bluetoothManager/bluetoothManager.on#event:bondStateChange + */ + function on(type: 'bondStateChange', callback: Callback): void; + /** + * Unsubscribe the event reported when a remote Bluetooth device is bonded. + * + * @permission ohos.permission.USE_BLUETOOTH + * @param { 'bondStateChange' } type - Type of the bond state event to listen for. + * @param { Callback } callback - Callback used to listen for the bond state event. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.bluetoothManager/bluetoothManager.off#event:bondStateChange + */ + function off(type: 'bondStateChange', callback?: Callback): void; + /** + * Subscribe the event of a pairing request from a remote Bluetooth device. + * + * @permission ohos.permission.DISCOVER_BLUETOOTH + * @param { 'pinRequired' } type - Type of the pairing request event to listen for. + * @param { Callback } callback - Callback used to listen for the pairing request event. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.bluetoothManager/bluetoothManager.on#event:pinRequired + */ + function on(type: 'pinRequired', callback: Callback): void; + /** + * Unsubscribe the event of a pairing request from a remote Bluetooth device. + * + * @permission ohos.permission.DISCOVER_BLUETOOTH + * @param { 'pinRequired' } type - Type of the pairing request event to listen for. + * @param { Callback } callback - Callback used to listen for the pairing request event. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.bluetoothManager/bluetoothManager.off#event:pinRequired + */ + function off(type: 'pinRequired', callback?: Callback): void; + /** + * Subscribe the event reported when the Bluetooth state changes. + * + * @permission ohos.permission.USE_BLUETOOTH + * @param { 'stateChange' } type - Type of the Bluetooth state changes event to listen for. + * @param { Callback } callback - Callback used to listen for the Bluetooth state event. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.bluetoothManager/bluetoothManager.on#event:stateChange + */ + function on(type: 'stateChange', callback: Callback): void; + /** + * Unsubscribe the event reported when the Bluetooth state changes. + * + * @permission ohos.permission.USE_BLUETOOTH + * @param { 'stateChange' } type - Type of the Bluetooth state changes event to listen for. + * @param { Callback } callback - Callback used to listen for the Bluetooth state event. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.bluetoothManager/bluetoothManager.off#event:stateChange + */ + function off(type: 'stateChange', callback?: Callback): void; + /** + * Creates a Bluetooth server listening socket. + * + * @permission ohos.permission.USE_BLUETOOTH + * @param { string } name - Indicates the service name. + * @param { SppOption } option - Indicates the listen parameters {@link SppOption}. + * @param { AsyncCallback } callback - Callback used to return a server socket ID. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.bluetoothManager/bluetoothManager.sppListen + */ + function sppListen(name: string, option: SppOption, callback: AsyncCallback): void; + /** + * Waits for a remote device to connect. + * + * @param { number } serverSocket - Indicates the server socket ID, returned by {@link sppListen}. + * @param { AsyncCallback } callback - Callback used to return a client socket ID. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.bluetoothManager/bluetoothManager.sppAccept + */ + function sppAccept(serverSocket: number, callback: AsyncCallback): void; + /** + * Connects to a remote device over the socket. + * + * @permission ohos.permission.USE_BLUETOOTH + * @param { string } device - The address of the remote device to connect. + * @param { SppOption } option - Indicates the connect parameters {@link SppOption}. + * @param { AsyncCallback } callback - Callback used to return a client socket ID. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.bluetoothManager/bluetoothManager.sppConnect + */ + function sppConnect(device: string, option: SppOption, callback: AsyncCallback): void; + /** + * Disables an spp server socket and releases related resources. + * + * @param { number } socket - Indicates the server socket ID, returned by {@link sppListen}. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.bluetoothManager/bluetoothManager.sppCloseServerSocket + */ + function sppCloseServerSocket(socket: number): void; + /** + * Disables an spp client socket and releases related resources. + * + * @param { number } socket - Indicates the client socket ID, returned by {@link sppAccept} or {@link sppConnect}. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.bluetoothManager/bluetoothManager.sppCloseClientSocket + */ + function sppCloseClientSocket(socket: number): void; + /** + * Write data through the socket. + * + * @param { number } clientSocket - Indicates the client socket ID, returned by {@link sppAccept} or {@link sppConnect}. + * @param { ArrayBuffer } data - Indicates the data to write. + * @returns { boolean } Returns {@code true} if the data is write successfully; returns {@code false} otherwise. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.bluetoothManager/bluetoothManager.sppWrite + */ + function sppWrite(clientSocket: number, data: ArrayBuffer): boolean; + /** + * Subscribe the event reported when data is read from the socket. + * + * @param { 'sppRead' } type - Type of the spp read event to listen for. + * @param { number } clientSocket - Client socket ID, which is obtained by sppAccept or sppConnect. + * @param { Callback } callback - Callback used to listen for the spp read event. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.bluetoothManager/bluetoothManager.on#event:sppRead + */ + function on(type: 'sppRead', clientSocket: number, callback: Callback): void; + /** + * Unsubscribe the event reported when data is read from the socket. + * + * @param { 'sppRead' } type - Type of the spp read event to listen for. + * @param { number } clientSocket - Client socket ID, which is obtained by sppAccept or sppConnect. + * @param { Callback } callback - Callback used to listen for the spp read event. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.bluetoothManager/bluetoothManager.off#event:sppRead + */ + function off(type: 'sppRead', clientSocket: number, callback?: Callback): void; + /** + * Obtains the instance of profile. + * + * @param { ProfileId } profileId - The profile id.. + * @returns { A2dpSourceProfile | HandsFreeAudioGatewayProfile } Returns instance of profile. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.bluetoothManager/bluetoothManager.getProfileInstance + */ + function getProfile(profileId: ProfileId): A2dpSourceProfile | HandsFreeAudioGatewayProfile; + /** + * Base interface of profile. + * + * @typedef BaseProfile + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.bluetoothManager/bluetoothManager.BaseProfile + */ + interface BaseProfile { + /** + * Obtains the connected devices list of profile. + * + * @permission ohos.permission.USE_BLUETOOTH + * @returns { Array } Returns the address of connected devices list. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.bluetoothManager/bluetoothManager.BaseProfile#getConnectionDevices + */ + getConnectionDevices(): Array; + /** + * Obtains the profile state of device. + * + * @permission ohos.permission.USE_BLUETOOTH + * @param { string } device - The address of bluetooth device. + * @returns { ProfileConnectionState } Returns {@link ProfileConnectionState} of device. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.bluetoothManager/bluetoothManager.BaseProfile#getDeviceState + */ + getDeviceState(device: string): ProfileConnectionState; + } + /** + * Manager a2dp source profile. + * + * @typedef A2dpSourceProfile + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.bluetoothManager/bluetoothManager.A2dpSourceProfile + */ + interface A2dpSourceProfile extends BaseProfile { + /** + * Connect to device with a2dp. + * + * @permission ohos.permission.DISCOVER_BLUETOOTH + * @param { string } device - The address of the remote device to connect. + * @returns { boolean } Returns {@code true} if the connect is in process; returns {@code false} otherwise. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.bluetoothManager/bluetoothManager.A2dpSourceProfile#connect + */ + connect(device: string): boolean; + /** + * Disconnect to device with a2dp. + * + * @permission ohos.permission.DISCOVER_BLUETOOTH + * @param { string } device - The address of the remote device to disconnect. + * @returns { boolean } Returns {@code true} if the disconnect is in process; returns {@code false} otherwise. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.bluetoothManager/bluetoothManager.A2dpSourceProfile#disconnect + */ + disconnect(device: string): boolean; + /** + * Subscribe the event reported when the profile connection state changes . + * + * @param { 'connectionStateChange' } type - Type of the profile connection state changes event to listen for . + * @param { Callback } callback - Callback used to listen for event. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.bluetoothManager/bluetoothManager.A2dpSourceProfile.on#event:connectionStateChange + */ + on(type: 'connectionStateChange', callback: Callback): void; + /** + * Unsubscribe the event reported when the profile connection state changes . + * + * @param { 'connectionStateChange' } type - Type of the profile connection state changes event to listen for . + * @param { Callback } callback - Callback used to listen for event. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.bluetoothManager/bluetoothManager.A2dpSourceProfile.off#event:connectionStateChange + */ + off(type: 'connectionStateChange', callback?: Callback): void; + /** + * Obtains the playing state of device. + * + * @param { string } device - The address of the remote device. + * @returns { PlayingState } Returns {@link PlayingState} of the remote device. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.bluetoothManager/bluetoothManager.A2dpSourceProfile#getPlayingState + */ + getPlayingState(device: string): PlayingState; + } + /** + * Manager handsfree AG profile. + * + * @typedef HandsFreeAudioGatewayProfile + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.bluetoothManager/bluetoothManager.HandsFreeAudioGatewayProfile + */ + interface HandsFreeAudioGatewayProfile extends BaseProfile { + /** + * Connect to device with hfp. + * + * @permission ohos.permission.DISCOVER_BLUETOOTH + * @param { string } device - The address of the remote device to connect. + * @returns { boolean } Returns {@code true} if the connect is in process; returns {@code false} otherwise. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.bluetoothManager/bluetoothManager.HandsFreeAudioGatewayProfile#connect + */ + connect(device: string): boolean; + /** + * Disconnect to device with hfp. + * + * @permission ohos.permission.DISCOVER_BLUETOOTH + * @param { string } device - The address of the remote device to disconnect. + * @returns { boolean } Returns {@code true} if the disconnect is in process; returns {@code false} otherwise. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.bluetoothManager/bluetoothManager.HandsFreeAudioGatewayProfile#disconnect + */ + disconnect(device: string): boolean; + /** + * Subscribe the event reported when the profile connection state changes . + * + * @param { 'connectionStateChange' } type - Type of the profile connection state changes event to listen for . + * @param { Callback } callback - Callback used to listen for event. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.bluetoothManager/bluetoothManager.HandsFreeAudioGatewayProfile.on#event:connectionStateChange + */ + on(type: 'connectionStateChange', callback: Callback): void; + /** + * Unsubscribe the event reported when the profile connection state changes . + * + * @param { 'connectionStateChange' } type - Type of the profile connection state changes event to listen for . + * @param { Callback } callback - Callback used to listen for event. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.bluetoothManager/bluetoothManager.HandsFreeAudioGatewayProfile.off#event:connectionStateChange + */ + off(type: 'connectionStateChange', callback?: Callback): void; + } + /** + * Provides methods to operate or manage Bluetooth. + * + * @namespace BLE + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.bluetoothManager/bluetoothManager.BLE + */ + namespace BLE { + /** + * create a JavaScript Gatt server instance. + * + * @returns { GattServer } Returns a JavaScript Gatt server instance {@code GattServer}. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.bluetoothManager/bluetoothManager.BLE.createGattServer + */ + function createGattServer(): GattServer; + /** + * create a JavaScript Gatt client device instance. + * + * @param { string } deviceId - The address of the remote device. + * @returns { GattClientDevice } Returns a JavaScript Gatt client device instance {@code GattClientDevice}. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.bluetoothManager/bluetoothManager.BLE.createGattClientDevice + */ + function createGattClientDevice(deviceId: string): GattClientDevice; + /** + * Obtains the list of devices in the connected status. + * + * @permission ohos.permission.USE_BLUETOOTH + * @returns { Array } Returns the list of device address. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.bluetoothManager/bluetoothManager.BLE.getConnectedBLEDevices + */ + function getConnectedBLEDevices(): Array; + /** + * Starts scanning for specified BLE devices with filters. + * + * @permission ohos.permission.DISCOVER_BLUETOOTH and ohos.permission.MANAGE_BLUETOOTH and ohos.permission.LOCATION + * @param { Array } filters - Indicates the list of filters used to filter out specified devices. + * If you do not want to use filter, set this parameter to {@code null}. + * @param { ScanOptions } options - Indicates the parameters for scanning and if the user does not assign a value, the default value will be used. + * {@link ScanOptions#interval} set to 0, {@link ScanOptions#dutyMode} set to {@link SCAN_MODE_LOW_POWER} + * and {@link ScanOptions#matchMode} set to {@link MATCH_MODE_AGGRESSIVE}. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.bluetoothManager/bluetoothManager.BLE.startBLEScan + */ + function startBLEScan(filters: Array, options?: ScanOptions): void; + /** + * Stops BLE scanning. + * + * @permission ohos.permission.DISCOVER_BLUETOOTH + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.bluetoothManager/bluetoothManager.BLE.stopBLEScan + */ + function stopBLEScan(): void; + /** + * Subscribe BLE scan result. + * + * @permission ohos.permission.USE_BLUETOOTH + * @param { 'BLEDeviceFind' } type - Type of the scan result event to listen for. + * @param { Callback> } callback - Callback used to listen for the scan result event. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.bluetoothManager/bluetoothManager.BLE.on#event:BLEDeviceFind + */ + function on(type: 'BLEDeviceFind', callback: Callback>): void; + /** + * Unsubscribe BLE scan result. + * + * @permission ohos.permission.USE_BLUETOOTH + * @param { 'BLEDeviceFind' } type - Type of the scan result event to listen for. + * @param { Callback> } callback - Callback used to listen for the scan result event. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.bluetoothManager/bluetoothManager.BLE.off#event:BLEDeviceFind + */ + function off(type: 'BLEDeviceFind', callback?: Callback>): void; + } + /** + * Manages GATT server. Before calling an Gatt server method, you must use {@link createGattServer} to create an GattServer instance. + * + * @typedef GattServer + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.bluetoothManager/bluetoothManager.GattServer + */ + interface GattServer { + /** + * Starts BLE advertising. + * + * @permission ohos.permission.DISCOVER_BLUETOOTH + * @param { AdvertiseSetting } setting - Indicates the settings for BLE advertising. + * If you need to use the default value, set this parameter to {@code null}. + * @param { AdvertiseData } advData - Indicates the advertising data. + * @param { AdvertiseData } advResponse - Indicates the scan response associated with the advertising data. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.bluetoothManager/bluetoothManager.GattServer#startAdvertising + */ + startAdvertising(setting: AdvertiseSetting, advData: AdvertiseData, advResponse?: AdvertiseData): void; + /** + * Stops BLE advertising. + * + * @permission ohos.permission.DISCOVER_BLUETOOTH + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.bluetoothManager/bluetoothManager.GattServer#stopAdvertising + */ + stopAdvertising(): void; + /** + * Adds a specified service to be hosted. + *

The added service and its characteristics are provided by the local device. + * + * @permission ohos.permission.USE_BLUETOOTH + * @param { GattService } service - Indicates the service to add. + * @returns { boolean } Returns {@code true} if the service is added; returns {@code false} otherwise. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.bluetoothManager/bluetoothManager.GattServer#addService + */ + addService(service: GattService): boolean; + /** + * Removes a specified service from the list of GATT services provided by this device. + * + * @permission ohos.permission.USE_BLUETOOTH + * @param { string } serviceUuid - Indicates the UUID of the service to remove. + * @returns { boolean } Returns {@code true} if the service is removed; returns {@code false} otherwise. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.bluetoothManager/bluetoothManager.GattServer#removeService + */ + removeService(serviceUuid: string): boolean; + /** + * Closes this {@code GattServer} object and unregisters its callbacks. + * + * @permission ohos.permission.USE_BLUETOOTH + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.bluetoothManager/bluetoothManager.GattServer#close + */ + close(): void; + /** + * Sends a notification of a change in a specified local characteristic. + *

This method should be called for every BLE peripheral device that has requested notifications. + * + * @permission ohos.permission.USE_BLUETOOTH + * @param { string } deviceId - Indicates the address of the BLE peripheral device to receive the notification. + * @param { NotifyCharacteristic } notifyCharacteristic - Indicates the local characteristic that has changed. + * @returns { boolean } Returns {@code true} if the notification is sent successfully; returns {@code false} otherwise. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.bluetoothManager/bluetoothManager.GattServer#notifyCharacteristicChanged + */ + notifyCharacteristicChanged(deviceId: string, notifyCharacteristic: NotifyCharacteristic): boolean; + /** + * Sends a response to a specified read or write request to a given BLE peripheral device. + * + * @permission ohos.permission.USE_BLUETOOTH + * @param { ServerResponse } serverResponse - Indicates the response parameters {@link ServerResponse}. + * @returns { boolean } Returns {@code true} if the response is sent successfully; returns {@code false} otherwise. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.bluetoothManager/bluetoothManager.GattServer#sendResponse + */ + sendResponse(serverResponse: ServerResponse): boolean; + /** + * Subscribe characteristic read event. + * + * @permission ohos.permission.USE_BLUETOOTH + * @param { 'characteristicRead' } type - Type of the characteristic read event to listen for. + * @param { Callback } callback - Callback used to listen for the characteristic read event. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.bluetoothManager/bluetoothManager.GattServer.on#event:characteristicRead + */ + on(type: 'characteristicRead', callback: Callback): void; + /** + * Unsubscribe characteristic read event. + * + * @permission ohos.permission.USE_BLUETOOTH + * @param { 'characteristicRead' } type - Type of the characteristic read event to listen for. + * @param { Callback } callback - Callback used to listen for the characteristic read event. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.bluetoothManager/bluetoothManager.GattServer.off#event:characteristicRead + */ + off(type: 'characteristicRead', callback?: Callback): void; + /** + * Subscribe characteristic write event. + * + * @permission ohos.permission.USE_BLUETOOTH + * @param { 'characteristicWrite' } type - Type of the characteristic write event to listen for. + * @param { Callback } callback - Callback used to listen for the characteristic write event. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.bluetoothManager/bluetoothManager.GattServer.on#event:characteristicWrite + */ + on(type: 'characteristicWrite', callback: Callback): void; + /** + * Unsubscribe characteristic write event. + * + * @permission ohos.permission.USE_BLUETOOTH + * @param { 'characteristicWrite' } type - Type of the characteristic write event to listen for. + * @param { Callback } callback - Callback used to listen for the characteristic write event. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.bluetoothManager/bluetoothManager.GattServer.off#event:characteristicWrite + */ + off(type: 'characteristicWrite', callback?: Callback): void; + /** + * Subscribe descriptor read event. + * + * @permission ohos.permission.USE_BLUETOOTH + * @param { 'descriptorRead' } type - Type of the descriptor read event to listen for. + * @param { Callback } callback - Callback used to listen for the descriptor read event. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.bluetoothManager/bluetoothManager.GattServer.on#event:descriptorRead + */ + on(type: 'descriptorRead', callback: Callback): void; + /** + * Unsubscribe descriptor read event. + * + * @permission ohos.permission.USE_BLUETOOTH + * @param { 'descriptorRead' } type - Type of the descriptor read event to listen for. + * @param { Callback } callback - Callback used to listen for the descriptor read event. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.bluetoothManager/bluetoothManager.GattServer.off#event:descriptorRead + */ + off(type: 'descriptorRead', callback?: Callback): void; + /** + * Subscribe descriptor write event. + * + * @permission ohos.permission.USE_BLUETOOTH + * @param { 'descriptorWrite' } type - Type of the descriptor write event to listen for. + * @param { Callback } callback - Callback used to listen for the descriptor write event. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.bluetoothManager/bluetoothManager.GattServer.on#event:descriptorWrite + */ + on(type: 'descriptorWrite', callback: Callback): void; + /** + * Unsubscribe descriptor write event. + * + * @permission ohos.permission.USE_BLUETOOTH + * @param { 'descriptorWrite' } type - Type of the descriptor write event to listen for. + * @param { Callback } callback - Callback used to listen for the descriptor write event. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.bluetoothManager/bluetoothManager.GattServer.off#event:descriptorWrite + */ + off(type: 'descriptorWrite', callback?: Callback): void; + /** + * Subscribe server connection state changed event. + * + * @permission ohos.permission.USE_BLUETOOTH + * @param { 'connectStateChange' } type - Type of the connection state changed event to listen for. + * @param { Callback } callback - Callback used to listen for the connection state changed event. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.bluetoothManager/bluetoothManager.GattServer.on#event:connectStateChange + */ + on(type: 'connectStateChange', callback: Callback): void; + /** + * Unsubscribe server connection state changed event. + * + * @permission ohos.permission.USE_BLUETOOTH + * @param { 'connectStateChange' } type - Type of the connection state changed event to listen for. + * @param { Callback } callback - Callback used to listen for the connection state changed event. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.bluetoothManager/bluetoothManager.GattServer.off#event:connectStateChange + */ + off(type: 'connectStateChange', callback?: Callback): void; + } + /** + * Manages GATT client. Before calling an Gatt client method, you must use {@link createGattClientDevice} to create an GattClientDevice instance. + * + * @typedef GattClientDevice + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.bluetoothManager/bluetoothManager.GattClientDevice + */ + interface GattClientDevice { + /** + * Connects to a BLE peripheral device. + *

The 'BLEConnectionStateChange' event is subscribed to return the connection state. + * + * @permission ohos.permission.USE_BLUETOOTH + * @returns { boolean } Returns {@code true} if the connection process starts; returns {@code false} otherwise. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.bluetoothManager/bluetoothManager.GattClientDevice#connect + */ + connect(): boolean; + /** + * Disconnects from or stops an ongoing connection to a BLE peripheral device. + * + * @permission ohos.permission.USE_BLUETOOTH + * @returns { boolean } Returns {@code true} if the disconnection process starts; returns {@code false} otherwise. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.bluetoothManager/bluetoothManager.GattClientDevice#disconnect + */ + disconnect(): boolean; + /** + * Disables a BLE peripheral device. + *

This method unregisters the device and clears the registered callbacks and handles. + * + * @permission ohos.permission.USE_BLUETOOTH + * @returns { boolean } Returns {@code true} if the the device is disabled; returns {@code false} otherwise. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.bluetoothManager/bluetoothManager.GattClientDevice#close + */ + close(): boolean; + /** + * Obtains the name of BLE peripheral device. + * + * @permission ohos.permission.USE_BLUETOOTH + * @param { AsyncCallback } callback - Callback used to obtain the device name. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.bluetoothManager/bluetoothManager.GattClientDevice#getDeviceName + */ + getDeviceName(callback: AsyncCallback): void; + /** + * Obtains the name of BLE peripheral device. + * + * @permission ohos.permission.USE_BLUETOOTH + * @returns { Promise } Returns a string representation of the name if obtained; + * returns {@code null} if the name fails to be obtained or the name does not exist. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.bluetoothManager/bluetoothManager.GattClientDevice#getDeviceName + */ + getDeviceName(): Promise; + /** + * Starts discovering services. + * + * @permission ohos.permission.USE_BLUETOOTH + * @param { AsyncCallback> } callback - Callback used to catch the services. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.bluetoothManager/bluetoothManager.GattClientDevice#getServices + */ + getServices(callback: AsyncCallback>): void; + /** + * Starts discovering services. + * + * @permission ohos.permission.USE_BLUETOOTH + * @returns { Promise> } Returns the list of services {@link GattService} of the BLE peripheral device. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.bluetoothManager/bluetoothManager.GattClientDevice#getServices + */ + getServices(): Promise>; + /** + * Reads the characteristic of a BLE peripheral device. + * + * @permission ohos.permission.USE_BLUETOOTH + * @param { BLECharacteristic } characteristic - Indicates the characteristic to read. + * @param { AsyncCallback } callback - Callback invoked to return the characteristic value read. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.bluetoothManager/bluetoothManager.GattClientDevice#readCharacteristicValue + */ + readCharacteristicValue(characteristic: BLECharacteristic, callback: AsyncCallback): void; + /** + * Reads the characteristic of a BLE peripheral device. + * + * @permission ohos.permission.USE_BLUETOOTH + * @param { BLECharacteristic } characteristic - Indicates the characteristic to read. + * @returns { Promise } - Promise used to return the characteristic value read. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.bluetoothManager/bluetoothManager.GattClientDevice#readCharacteristicValue + */ + readCharacteristicValue(characteristic: BLECharacteristic): Promise; + /** + * Reads the descriptor of a BLE peripheral device. + * + * @permission ohos.permission.USE_BLUETOOTH + * @param { BLEDescriptor } descriptor - Indicates the descriptor to read. + * @param { AsyncCallback } callback - Callback invoked to return the descriptor read. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.bluetoothManager/bluetoothManager.GattClientDevice#readDescriptorValue + */ + readDescriptorValue(descriptor: BLEDescriptor, callback: AsyncCallback): void; + /** + * Reads the descriptor of a BLE peripheral device. + * + * @permission ohos.permission.USE_BLUETOOTH + * @param { BLEDescriptor } descriptor - Indicates the descriptor to read. + * @returns { Promise } - Promise used to return the descriptor read. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.bluetoothManager/bluetoothManager.GattClientDevice#readDescriptorValue + */ + readDescriptorValue(descriptor: BLEDescriptor): Promise; + /** + * Writes the characteristic of a BLE peripheral device. + * + * @permission ohos.permission.USE_BLUETOOTH + * @param { BLECharacteristic } characteristic - Indicates the characteristic to write. + * @returns { boolean } Returns {@code true} if the characteristic is written successfully; returns {@code false} otherwise. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.bluetoothManager/bluetoothManager.GattClientDevice#writeCharacteristicValue + */ + writeCharacteristicValue(characteristic: BLECharacteristic): boolean; + /** + * Writes the descriptor of a BLE peripheral device. + * + * @permission ohos.permission.USE_BLUETOOTH + * @param { BLEDescriptor } descriptor - Indicates the descriptor to write. + * @returns { boolean } Returns {@code true} if the descriptor is written successfully; returns {@code false} otherwise. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.bluetoothManager/bluetoothManager.GattClientDevice#writeDescriptorValue + */ + writeDescriptorValue(descriptor: BLEDescriptor): boolean; + /** + * Get the RSSI value of this BLE peripheral device. + * + * @permission ohos.permission.USE_BLUETOOTH + * @param { AsyncCallback } callback - Callback invoked to return the RSSI, in dBm. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.bluetoothManager/bluetoothManager.GattClientDevice#getRssiValue + */ + getRssiValue(callback: AsyncCallback): void; + /** + * Get the RSSI value of this BLE peripheral device. + * + * @permission ohos.permission.USE_BLUETOOTH + * @returns { Promise } Returns the RSSI value. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.bluetoothManager/bluetoothManager.GattClientDevice#getRssiValue + */ + getRssiValue(): Promise; + /** + * Set the mtu size of a BLE peripheral device. + * + * @permission ohos.permission.USE_BLUETOOTH + * @param { number } mtu - The maximum transmission unit. + * @returns { boolean } Returns {@code true} if the set mtu is successfully; returns {@code false} otherwise. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.bluetoothManager/bluetoothManager.GattClientDevice#setBLEMtuSize + */ + setBLEMtuSize(mtu: number): boolean; + /** + * Enables or disables notification of a characteristic when value changed. + * + * @permission ohos.permission.USE_BLUETOOTH + * @param { BLECharacteristic } characteristic - BLE characteristic to listen for. + * @param { boolean } enable - Specifies whether to enable notification of the characteristic. The value {@code true} indicates + * that notification is enabled, and the value {@code false} indicates that notification is disabled. + * @returns { boolean } Returns {@code true} if notification of the characteristic is enabled or disabled; + * returns {@code false} otherwise. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.bluetoothManager/bluetoothManager.GattClientDevice#setNotifyCharacteristicChanged + */ + setNotifyCharacteristicChanged(characteristic: BLECharacteristic, enable: boolean): boolean; + /** + * Subscribe characteristic value changed event. + * + * @permission ohos.permission.USE_BLUETOOTH + * @param { 'BLECharacteristicChange' } type - Type of the characteristic value changed event to listen for. + * @param { Callback } callback - Callback used to listen for the characteristic value changed event. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.bluetoothManager/bluetoothManager.GattClientDevice.on#event:BLECharacteristicChange + */ + on(type: 'BLECharacteristicChange', callback: Callback): void; + /** + * Unsubscribe characteristic value changed event. + * + * @permission ohos.permission.USE_BLUETOOTH + * @param { 'BLECharacteristicChange' } type - Type of the characteristic value changed event to listen for. + * @param { Callback } callback - Callback used to listen for the characteristic value changed event. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.bluetoothManager/bluetoothManager.GattClientDevice.off#event:BLECharacteristicChange + */ + off(type: 'BLECharacteristicChange', callback?: Callback): void; + /** + * Subscribe client connection state changed event. + * + * @permission ohos.permission.USE_BLUETOOTH + * @param { 'BLEConnectionStateChange' } type - Type of the connection state changed event to listen for. + * @param { Callback } callback - Callback used to listen for the connection state changed event. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.bluetoothManager/bluetoothManager.GattClientDevice.on#event:BLEConnectionStateChange + */ + on(type: 'BLEConnectionStateChange', callback: Callback): void; + /** + * Unsubscribe client connection state changed event. + * + * @permission ohos.permission.USE_BLUETOOTH + * @param { 'BLEConnectionStateChange' } type - Type of the connection state changed event to listen for. + * @param { Callback } callback - Callback used to listen for the connection state changed event. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.bluetoothManager/bluetoothManager.GattClientDevice.off#event:BLEConnectionStateChange + */ + off(type: 'BLEConnectionStateChange', callback?: Callback): void; + } + /** + * Describes the Gatt service. + * + * @typedef GattService + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.bluetoothManager/bluetoothManager.GattService + */ + interface GattService { + /** + * The UUID of a GattService instance + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 7 + * @deprecated since 9 + */ + serviceUuid: string; + /** + * Indicates whether the GattService instance is primary or secondary. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 7 + * @deprecated since 9 + */ + isPrimary: boolean; + /** + * The {@link BLECharacteristic} list belongs to this GattService instance + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 7 + * @deprecated since 9 + */ + characteristics: Array; + /** + * The list of GATT services contained in the service + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 7 + * @deprecated since 9 + */ + includeServices?: Array; + } + /** + * Describes the Gatt characteristic. + * + * @typedef BLECharacteristic + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.bluetoothManager/bluetoothManager.BLECharacteristic + */ + interface BLECharacteristic { + /** + * The UUID of the {@link GattService} instance to which the characteristic belongs + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 7 + * @deprecated since 9 + */ + serviceUuid: string; + /** + * The UUID of a BLECharacteristic instance + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 7 + * @deprecated since 9 + */ + characteristicUuid: string; + /** + * The value of a BLECharacteristic instance + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 7 + * @deprecated since 9 + */ + characteristicValue: ArrayBuffer; + /** + * The list of {@link BLEDescriptor} contained in the characteristic + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 7 + * @deprecated since 9 + */ + descriptors: Array; + } + /** + * Describes the Gatt descriptor. + * + * @typedef BLEDescriptor + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.bluetoothManager/bluetoothManager.BLEDescriptor + */ + interface BLEDescriptor { + /** + * The UUID of the {@link GattService} instance to which the descriptor belongs + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 7 + * @deprecated since 9 + */ + serviceUuid: string; + /** + * The UUID of the {@link BLECharacteristic} instance to which the descriptor belongs + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 7 + * @deprecated since 9 + */ + characteristicUuid: string; + /** + * The UUID of the BLEDescriptor instance + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 7 + * @deprecated since 9 + */ + descriptorUuid: string; + /** + * The value of the BLEDescriptor instance + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 7 + * @deprecated since 9 + */ + descriptorValue: ArrayBuffer; + } + /** + * Describes the value of the indication or notification sent by the Gatt server. + * + * @typedef NotifyCharacteristic + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.bluetoothManager/bluetoothManager.NotifyCharacteristic + */ + interface NotifyCharacteristic { + /** + * The UUID of the {@link GattService} instance to which the characteristic belongs + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 7 + * @deprecated since 9 + */ + serviceUuid: string; + /** + * The UUID of a NotifyCharacteristic instance + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 7 + * @deprecated since 9 + */ + characteristicUuid: string; + /** + * The value of a NotifyCharacteristic instance + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 7 + * @deprecated since 9 + */ + characteristicValue: ArrayBuffer; + /** + * Specifies whether to request confirmation from the BLE peripheral device (indication) or + * send a notification. Value {@code true} indicates the former and {@code false} indicates the latter. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 7 + * @deprecated since 9 + */ + confirm: boolean; + } + /** + * Describes the parameters of the Gatt client's characteristic read request. + * + * @typedef CharacteristicReadReq + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.bluetoothManager/bluetoothManager.CharacteristicReadRequest + */ + interface CharacteristicReadReq { + /** + * Indicates the address of the client that initiates the read request + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 7 + * @deprecated since 9 + */ + deviceId: string; + /** + * The Id of the read request + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 7 + * @deprecated since 9 + */ + transId: number; + /** + * Indicates the byte offset of the start position for reading characteristic value + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 7 + * @deprecated since 9 + */ + offset: number; + /** + * The UUID of a CharacteristicReadReq instance + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 7 + * @deprecated since 9 + */ + characteristicUuid: string; + /** + * The UUID of the service to which the characteristic belongs + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 7 + * @deprecated since 9 + */ + serviceUuid: string; + } + /** + * Describes the parameters of the of the Gatt client's characteristic write request. + * + * @typedef CharacteristicWriteReq + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.bluetoothManager/bluetoothManager.CharacteristicWriteRequest + */ + interface CharacteristicWriteReq { + /** + * Indicates the address of the client that initiates the write request + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 7 + * @deprecated since 9 + */ + deviceId: string; + /** + * The Id of the write request + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 7 + * @deprecated since 9 + */ + transId: number; + /** + * Indicates the byte offset of the start position for writing characteristic value + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 7 + * @deprecated since 9 + */ + offset: number; + /** + * Whether this request should be pending for later operation + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 7 + * @deprecated since 9 + */ + isPrep: boolean; + /** + * Whether the remote client need a response + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 7 + * @deprecated since 9 + */ + needRsp: boolean; + /** + * Indicates the value to be written + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 7 + * @deprecated since 9 + */ + value: ArrayBuffer; + /** + * The UUID of a CharacteristicWriteReq instance + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 7 + * @deprecated since 9 + */ + characteristicUuid: string; + /** + * The UUID of the service to which the characteristic belongs + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 7 + * @deprecated since 9 + */ + serviceUuid: string; + } + /** + * Describes the parameters of the Gatt client's descriptor read request. + * + * @typedef DescriptorReadReq + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.bluetoothManager/bluetoothManager.DescriptorReadRequest + */ + interface DescriptorReadReq { + /** + * Indicates the address of the client that initiates the read request + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 7 + * @deprecated since 9 + */ + deviceId: string; + /** + * The Id of the read request + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 7 + * @deprecated since 9 + */ + transId: number; + /** + * Indicates the byte offset of the start position for reading characteristic value + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 7 + * @deprecated since 9 + */ + offset: number; + /** + * The UUID of a DescriptorReadReq instance + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 7 + * @deprecated since 9 + */ + descriptorUuid: string; + /** + * The UUID of the characteristic to which the descriptor belongs + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 7 + * @deprecated since 9 + */ + characteristicUuid: string; + /** + * The UUID of the service to which the descriptor belongs + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 7 + * @deprecated since 9 + */ + serviceUuid: string; + } + /** + * Describes the parameters of the Gatt client's characteristic write request. + * + * @typedef DescriptorWriteReq + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.bluetoothManager/bluetoothManager.DescriptorWriteRequest + */ + interface DescriptorWriteReq { + /** + * Indicates the address of the client that initiates the write request + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 7 + * @deprecated since 9 + */ + deviceId: string; + /** + * The Id of the write request + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 7 + * @deprecated since 9 + */ + transId: number; + /** + * Indicates the byte offset of the start position for writing characteristic value + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 7 + * @deprecated since 9 + */ + offset: number; + /** + * Whether this request should be pending for later operation + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 7 + * @deprecated since 9 + */ + isPrep: boolean; + /** + * Whether the remote client need a response + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 7 + * @deprecated since 9 + */ + needRsp: boolean; + /** + * Indicates the value to be written + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 7 + * @deprecated since 9 + */ + value: ArrayBuffer; + /** + * The UUID of a DescriptorWriteReq instance + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 7 + * @deprecated since 9 + */ + descriptorUuid: string; + /** + * The UUID of the characteristic to which the descriptor belongs + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 7 + * @deprecated since 9 + */ + characteristicUuid: string; + /** + * The UUID of the service to which the descriptor belongs + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 7 + * @deprecated since 9 + */ + serviceUuid: string; + } + /** + * Describes the parameters of a response send by the server to a specified read or write request. + * + * @typedef ServerResponse + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.bluetoothManager/bluetoothManager.ServerResponse + */ + interface ServerResponse { + /** + * Indicates the address of the client to which to send the response + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 7 + * @deprecated since 9 + */ + deviceId: string; + /** + * The Id of the write request + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 7 + * @deprecated since 9 + */ + transId: number; + /** + * Indicates the status of the read or write request, set this parameter to '0' in normal cases + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 7 + * @deprecated since 9 + */ + status: number; + /** + * Indicates the byte offset of the start position for reading or writing operation + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 7 + * @deprecated since 9 + */ + offset: number; + /** + * Indicates the value to be sent + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 7 + * @deprecated since 9 + */ + value: ArrayBuffer; + } + /** + * Describes the Gatt profile connection state. + * + * @typedef BLEConnectChangedState + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.bluetoothManager/bluetoothManager.BLEConnectChangedState + */ + interface BLEConnectChangedState { + /** + * Indicates the peer device address + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 7 + * @deprecated since 9 + */ + deviceId: string; + /** + * Connection state of the Gatt profile + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 7 + * @deprecated since 9 + */ + state: ProfileConnectionState; + } + /** + * Describes the contents of the scan results. + * + * @typedef ScanResult + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.bluetoothManager/bluetoothManager.ScanResult + */ + interface ScanResult { + /** + * Address of the scanned device + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 7 + * @deprecated since 9 + */ + deviceId: string; + /** + * RSSI of the remote device + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 7 + * @deprecated since 9 + */ + rssi: number; + /** + * The raw data of broadcast packet + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 7 + * @deprecated since 9 + */ + data: ArrayBuffer; + } + /** + * Describes the settings for BLE advertising. + * + * @typedef AdvertiseSetting + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.bluetoothManager/bluetoothManager.AdvertiseSetting + */ + interface AdvertiseSetting { + /** + * Minimum slot value for the advertising interval, which is {@code 32} (20 ms) + * Maximum slot value for the advertising interval, which is {@code 16777215} (10485.759375s) + * Default slot value for the advertising interval, which is {@code 1600} (1s) + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 7 + * @deprecated since 9 + */ + interval?: number; + /** + * Minimum transmission power level for advertising, which is {@code -127} + * Maximum transmission power level for advertising, which is {@code 1} + * Default transmission power level for advertising, which is {@code -7} + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 7 + * @deprecated since 9 + */ + txPower?: number; + /** + * Indicates whether the BLE is connectable, default is {@code true} + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 7 + * @deprecated since 9 + */ + connectable?: boolean; + } + /** + * Describes the advertising data. + * + * @typedef AdvertiseData + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.bluetoothManager/bluetoothManager.AdvertiseData + */ + interface AdvertiseData { + /** + * The specified service UUID list to this advertisement + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 7 + * @deprecated since 9 + */ + serviceUuids: Array; + /** + * The specified manufacturer data list to this advertisement + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 7 + * @deprecated since 9 + */ + manufactureData: Array; + /** + * The specified service data list to this advertisement + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 7 + * @deprecated since 9 + */ + serviceData: Array; + } + /** + * Describes the manufacturer data. + * + * @typedef ManufactureData + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.bluetoothManager/bluetoothManager.ManufactureData + */ + interface ManufactureData { + /** + * Indicates the manufacturer ID assigned by Bluetooth SIG + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 7 + * @deprecated since 9 + */ + manufactureId: number; + /** + * Indicates the manufacturer data to add + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 7 + * @deprecated since 9 + */ + manufactureValue: ArrayBuffer; + } + /** + * Describes the service data. + * + * @typedef ServiceData + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.bluetoothManager/bluetoothManager.ServiceData + */ + interface ServiceData { + /** + * Indicates the UUID of the service data to add + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 7 + * @deprecated since 9 + */ + serviceUuid: string; + /** + * Indicates the service data to add + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 7 + * @deprecated since 9 + */ + serviceValue: ArrayBuffer; + } + /** + * Describes the criteria for filtering scanning results can be set. + * + * @typedef ScanFilter + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.bluetoothManager/bluetoothManager.ScanFilter + */ + interface ScanFilter { + /** + * The address of a BLE peripheral device + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 7 + * @deprecated since 9 + */ + deviceId?: string; + /** + * The name of a BLE peripheral device + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 7 + * @deprecated since 9 + */ + name?: string; + /** + * The service UUID of a BLE peripheral device + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 7 + * @deprecated since 9 + */ + serviceUuid?: string; + } + /** + * Describes the parameters for scan. + * + * @typedef ScanOptions + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.bluetoothManager/bluetoothManager.ScanOptions + */ + interface ScanOptions { + /** + * Time of delay for reporting the scan result + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 7 + * @deprecated since 9 + */ + interval?: number; + /** + * Bluetooth LE scan mode + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 7 + * @deprecated since 9 + */ + dutyMode?: ScanDuty; + /** + * Match mode for Bluetooth LE scan filters hardware match + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 7 + * @deprecated since 9 + */ + matchMode?: MatchMode; + } + /** + * Describes the spp parameters. + * + * @typedef SppOption + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.bluetoothManager/bluetoothManager.SppOption + */ + interface SppOption { + /** + * Indicates the UUID in the SDP record. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 8 + * @deprecated since 9 + */ + uuid: string; + /** + * Indicates secure channel or not + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 8 + * @deprecated since 9 + */ + secure: boolean; + /** + * Spp link type {@link SppType} + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 8 + * @deprecated since 9 + */ + type: SppType; + } + /** + * Describes the bond key param. + * + * @typedef PinRequiredParam + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.bluetoothManager/bluetoothManager.PinRequiredParam + */ + interface PinRequiredParam { + /** + * ID of the device to pair. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 8 + * @deprecated since 9 + */ + deviceId: string; + /** + * Key for the device pairing. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 8 + * @deprecated since 9 + */ + pinCode: string; + } + /** + * Describes the class of a bluetooth device. + * + * @typedef DeviceClass + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.bluetoothManager/bluetoothManager.DeviceClass + */ + interface DeviceClass { + /** + * Major classes of Bluetooth devices. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 8 + * @deprecated since 9 + */ + majorClass: MajorClass; + /** + * Major and minor classes of Bluetooth devices. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 8 + * @deprecated since 9 + */ + majorMinorClass: MajorMinorClass; + /** + * Class of the device. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 8 + * @deprecated since 9 + */ + classOfDevice: number; + } + /** + * Describes the class of a bluetooth device. + * + * @typedef BondStateParam + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.bluetoothManager/bluetoothManager.BondStateParam + */ + interface BondStateParam { + /** + * Address of a Bluetooth device. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 8 + * @deprecated since 9 + */ + deviceId: string; + /** + * Profile connection state of the device. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 8 + * @deprecated since 9 + */ + state: BondState; + } + /** + * The enum of scan duty. + * + * @enum { number } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.bluetoothManager/bluetoothManager.ScanDuty + */ + enum ScanDuty { + /** + * low power mode + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 7 + * @deprecated since 9 + */ + SCAN_MODE_LOW_POWER = 0, + /** + * balanced power mode + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 7 + * @deprecated since 9 + */ + SCAN_MODE_BALANCED = 1, + /** + * Scan using highest duty cycle + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 7 + * @deprecated since 9 + */ + SCAN_MODE_LOW_LATENCY = 2 + } + /** + * The enum of BLE match mode. + * + * @enum { number } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.bluetoothManager/bluetoothManager.MatchMode + */ + enum MatchMode { + /** + * aggressive mode + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 7 + * @deprecated since 9 + */ + MATCH_MODE_AGGRESSIVE = 1, + /** + * sticky mode + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 7 + * @deprecated since 9 + */ + MATCH_MODE_STICKY = 2 + } + /** + * The enum of profile connection state. + * + * @enum { number } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.bluetoothManager/bluetoothManager.ProfileConnectionState + */ + enum ProfileConnectionState { + /** + * the current profile is disconnected + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 7 + * @deprecated since 9 + */ + STATE_DISCONNECTED = 0, + /** + * the current profile is being connected + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 7 + * @deprecated since 9 + */ + STATE_CONNECTING = 1, + /** + * the current profile is connected + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 7 + * @deprecated since 9 + */ + STATE_CONNECTED = 2, + /** + * the current profile is being disconnected + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 7 + * @deprecated since 9 + */ + STATE_DISCONNECTING = 3 + } + /** + * The enum of bluetooth state. + * + * @enum { number } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.bluetoothManager/bluetoothManager.BluetoothState + */ + enum BluetoothState { + /** + * Indicates the local Bluetooth is off + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 7 + * @deprecated since 9 + */ + STATE_OFF = 0, + /** + * Indicates the local Bluetooth is turning on + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 7 + * @deprecated since 9 + */ + STATE_TURNING_ON = 1, + /** + * Indicates the local Bluetooth is on, and ready for use + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 7 + * @deprecated since 9 + */ + STATE_ON = 2, + /** + * Indicates the local Bluetooth is turning off + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 7 + * @deprecated since 9 + */ + STATE_TURNING_OFF = 3, + /** + * Indicates the local Bluetooth is turning LE mode on + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 7 + * @deprecated since 9 + */ + STATE_BLE_TURNING_ON = 4, + /** + * Indicates the local Bluetooth is in LE only mode + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 7 + * @deprecated since 9 + */ + STATE_BLE_ON = 5, + /** + * Indicates the local Bluetooth is turning off LE only mode + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 7 + * @deprecated since 9 + */ + STATE_BLE_TURNING_OFF = 6 + } + /** + * The enum of SPP type. + * + * @enum { number } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.bluetoothManager/bluetoothManager.SppType + */ + enum SppType { + /** + * RFCOMM + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 8 + * @deprecated since 9 + */ + SPP_RFCOMM + } + /** + * The enum of BR scan mode. + * + * @enum { number } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.bluetoothManager/bluetoothManager.ScanMode + */ + enum ScanMode { + /** + * Indicates the scan mode is none + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 8 + * @deprecated since 9 + */ + SCAN_MODE_NONE = 0, + /** + * Indicates the scan mode is connectable + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 8 + * @deprecated since 9 + */ + SCAN_MODE_CONNECTABLE = 1, + /** + * Indicates the scan mode is general discoverable + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 8 + * @deprecated since 9 + */ + SCAN_MODE_GENERAL_DISCOVERABLE = 2, + /** + * Indicates the scan mode is limited discoverable + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 8 + * @deprecated since 9 + */ + SCAN_MODE_LIMITED_DISCOVERABLE = 3, + /** + * Indicates the scan mode is connectable and general discoverable + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 8 + * @deprecated since 9 + */ + SCAN_MODE_CONNECTABLE_GENERAL_DISCOVERABLE = 4, + /** + * Indicates the scan mode is connectable and limited discoverable + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 8 + * @deprecated since 9 + */ + SCAN_MODE_CONNECTABLE_LIMITED_DISCOVERABLE = 5 + } + /** + * The enum of bond state. + * + * @enum { number } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.bluetoothManager/bluetoothManager.BondState + */ + enum BondState { + /** + * Indicate the bond state is invalid + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 8 + * @deprecated since 9 + */ + BOND_STATE_INVALID = 0, + /** + * Indicate the bond state is bonding + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 8 + * @deprecated since 9 + */ + BOND_STATE_BONDING = 1, + /** + * Indicate the bond state is bonded + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 8 + * @deprecated since 9 + */ + BOND_STATE_BONDED = 2 + } + /** + * The enum of major class of a bluetooth device. + * + * @enum { number } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.bluetoothManager/bluetoothManager.MajorClass + */ + enum MajorClass { + /** + * Miscellaneous device. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 8 + * @deprecated since 9 + */ + MAJOR_MISC = 0x0000, + /** + * Computer. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 8 + * @deprecated since 9 + */ + MAJOR_COMPUTER = 0x0100, + /** + * Mobile phone. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 8 + * @deprecated since 9 + */ + MAJOR_PHONE = 0x0200, + /** + * Network device. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 8 + * @deprecated since 9 + */ + MAJOR_NETWORKING = 0x0300, + /** + * Audio or video device. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 8 + * @deprecated since 9 + */ + MAJOR_AUDIO_VIDEO = 0x0400, + /** + * Peripheral device. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 8 + * @deprecated since 9 + */ + MAJOR_PERIPHERAL = 0x0500, + /** + * Imaging device. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 8 + * @deprecated since 9 + */ + MAJOR_IMAGING = 0x0600, + /** + * Wearable device. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 8 + * @deprecated since 9 + */ + MAJOR_WEARABLE = 0x0700, + /** + * Toy. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 8 + * @deprecated since 9 + */ + MAJOR_TOY = 0x0800, + /** + * Health device. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 8 + * @deprecated since 9 + */ + MAJOR_HEALTH = 0x0900, + /** + * Unclassified device. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 8 + * @deprecated since 9 + */ + MAJOR_UNCATEGORIZED = 0x1F00 + } + /** + * The enum of major minor class of a bluetooth device. + * + * @enum { number } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.bluetoothManager/bluetoothManager.MajorMinorClass + */ + enum MajorMinorClass { + /** + * The Minor Device Class field + * Computer Major Class + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 8 + * @deprecated since 9 + */ + COMPUTER_UNCATEGORIZED = 0x0100, + /** + * Desktop computer. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 8 + * @deprecated since 9 + */ + COMPUTER_DESKTOP = 0x0104, + /** + * Server. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 8 + * @deprecated since 9 + */ + COMPUTER_SERVER = 0x0108, + /** + * Laptop. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 8 + * @deprecated since 9 + */ + COMPUTER_LAPTOP = 0x010C, + /** + * Hand-held computer. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 8 + * @deprecated since 9 + */ + COMPUTER_HANDHELD_PC_PDA = 0x0110, + /** + * Palmtop computer. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 8 + * @deprecated since 9 + */ + COMPUTER_PALM_SIZE_PC_PDA = 0x0114, + /** + * Wearable computer. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 8 + * @deprecated since 9 + */ + COMPUTER_WEARABLE = 0x0118, + /** + * Tablet. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 8 + * @deprecated since 9 + */ + COMPUTER_TABLET = 0x011C, + /** + * Phone Major Class + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 8 + * @deprecated since 9 + */ + PHONE_UNCATEGORIZED = 0x0200, + /** + * Portable phone. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 8 + * @deprecated since 9 + */ + PHONE_CELLULAR = 0x0204, + /** + * Cordless phone. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 8 + * @deprecated since 9 + */ + PHONE_CORDLESS = 0x0208, + /** + * Smartphone. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 8 + * @deprecated since 9 + */ + PHONE_SMART = 0x020C, + /** + * Modem or gateway phone. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 8 + * @deprecated since 9 + */ + PHONE_MODEM_OR_GATEWAY = 0x0210, + /** + * ISDN phone. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 8 + * @deprecated since 9 + */ + PHONE_ISDN = 0x0214, + /** + * LAN/Network Access Point Major Class + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 8 + * @deprecated since 9 + */ + NETWORK_FULLY_AVAILABLE = 0x0300, + /** + * Device used on network 1 to 17. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 8 + * @deprecated since 9 + */ + NETWORK_1_TO_17_UTILIZED = 0x0320, + /** + * Device used on network 17 to 33. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 8 + * @deprecated since 9 + */ + NETWORK_17_TO_33_UTILIZED = 0x0340, + /** + * Device used on network 33 to 50. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 8 + * @deprecated since 9 + */ + NETWORK_33_TO_50_UTILIZED = 0x0360, + /** + * Device used on network 60 to 67. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 8 + * @deprecated since 9 + */ + NETWORK_60_TO_67_UTILIZED = 0x0380, + /** + * Device used on network 67 to 83. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 8 + * @deprecated since 9 + */ + NETWORK_67_TO_83_UTILIZED = 0x03A0, + /** + * Device used on network 83 to 99. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 8 + * @deprecated since 9 + */ + NETWORK_83_TO_99_UTILIZED = 0x03C0, + /** + * Device without network service. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 8 + * @deprecated since 9 + */ + NETWORK_NO_SERVICE = 0x03E0, + /** + * Unclassified audio or video device. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 8 + * @deprecated since 9 + */ + AUDIO_VIDEO_UNCATEGORIZED = 0x0400, + /** + * Wearable audio or video headset. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 8 + * @deprecated since 9 + */ + AUDIO_VIDEO_WEARABLE_HEADSET = 0x0404, + /** + * Hands-free audio or video device. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 8 + * @deprecated since 9 + */ + AUDIO_VIDEO_HANDSFREE = 0x0408, + /** + * Audio or video microphone. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 8 + * @deprecated since 9 + */ + AUDIO_VIDEO_MICROPHONE = 0x0410, + /** + * Audio or video loudspeaker. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 8 + * @deprecated since 9 + */ + AUDIO_VIDEO_LOUDSPEAKER = 0x0414, + /** + * Audio or video headphones. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 8 + * @deprecated since 9 + */ + AUDIO_VIDEO_HEADPHONES = 0x0418, + /** + * Portable audio or video device. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 8 + * @deprecated since 9 + */ + AUDIO_VIDEO_PORTABLE_AUDIO = 0x041C, + /** + * In-vehicle audio or video device. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 8 + * @deprecated since 9 + */ + AUDIO_VIDEO_CAR_AUDIO = 0x0420, + /** + * Audio or video STB device. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 8 + * @deprecated since 9 + */ + AUDIO_VIDEO_SET_TOP_BOX = 0x0424, + /** + * High-fidelity speaker device. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 8 + * @deprecated since 9 + */ + AUDIO_VIDEO_HIFI_AUDIO = 0x0428, + /** + * Video cassette recording (VCR) device. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 8 + * @deprecated since 9 + */ + AUDIO_VIDEO_VCR = 0x042C, + /** + * Camera. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 8 + * @deprecated since 9 + */ + AUDIO_VIDEO_VIDEO_CAMERA = 0x0430, + /** + * Camcorder. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 8 + * @deprecated since 9 + */ + AUDIO_VIDEO_CAMCORDER = 0x0434, + /** + * Audio or video monitor. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 8 + * @deprecated since 9 + */ + AUDIO_VIDEO_VIDEO_MONITOR = 0x0438, + /** + * Video display or loudspeaker. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 8 + * @deprecated since 9 + */ + AUDIO_VIDEO_VIDEO_DISPLAY_AND_LOUDSPEAKER = 0x043C, + /** + * Video conferencing device. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 8 + * @deprecated since 9 + */ + AUDIO_VIDEO_VIDEO_CONFERENCING = 0x0440, + /** + * Audio or video gaming toy. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 8 + * @deprecated since 9 + */ + AUDIO_VIDEO_VIDEO_GAMING_TOY = 0x0448, + /** + * Peripheral Major Class + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 8 + * @deprecated since 9 + */ + PERIPHERAL_NON_KEYBOARD_NON_POINTING = 0x0500, + /** + * Keyboard device. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 8 + * @deprecated since 9 + */ + PERIPHERAL_KEYBOARD = 0x0540, + /** + * Pointing peripheral device. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 8 + * @deprecated since 9 + */ + PERIPHERAL_POINTING_DEVICE = 0x0580, + /** + * Keyboard pointing device. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 8 + * @deprecated since 9 + */ + PERIPHERAL_KEYBOARD_POINTING = 0x05C0, + /** + * Unclassified peripheral device. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 8 + * @deprecated since 9 + */ + PERIPHERAL_UNCATEGORIZED = 0x0500, + /** + * Peripheral joystick. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 8 + * @deprecated since 9 + */ + PERIPHERAL_JOYSTICK = 0x0504, + /** + * Peripheral game pad. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 8 + * @deprecated since 9 + */ + PERIPHERAL_GAMEPAD = 0x0508, + /** + * Peripheral remote control device. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 8 + * @deprecated since 9 + */ + PERIPHERAL_REMOTE_CONTROL = 0x05C0, + /** + * Peripheral sensing device. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 8 + * @deprecated since 9 + */ + PERIPHERAL_SENSING_DEVICE = 0x0510, + /** + * Peripheral digitizer tablet. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 8 + * @deprecated since 9 + */ + PERIPHERAL_DIGITIZER_TABLET = 0x0514, + /** + * Peripheral card reader. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 8 + * @deprecated since 9 + */ + PERIPHERAL_CARD_READER = 0x0518, + /** + * Peripheral digital pen. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 8 + * @deprecated since 9 + */ + PERIPHERAL_DIGITAL_PEN = 0x051C, + /** + * Peripheral RFID scanner. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 8 + * @deprecated since 9 + */ + PERIPHERAL_SCANNER_RFID = 0x0520, + /** + * Gesture input device. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 8 + * @deprecated since 9 + */ + PERIPHERAL_GESTURAL_INPUT = 0x0522, + /** + * Imaging Major Class + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 8 + * @deprecated since 9 + */ + IMAGING_UNCATEGORIZED = 0x0600, + /** + * Imaging display device. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 8 + * @deprecated since 9 + */ + IMAGING_DISPLAY = 0x0610, + /** + * Imaging camera device. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 8 + * @deprecated since 9 + */ + IMAGING_CAMERA = 0x0620, + /** + * Imaging scanner. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 8 + * @deprecated since 9 + */ + IMAGING_SCANNER = 0x0640, + /** + * Imaging printer. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 8 + * @deprecated since 9 + */ + IMAGING_PRINTER = 0x0680, + /** + * Wearable Major Class + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 8 + * @deprecated since 9 + */ + WEARABLE_UNCATEGORIZED = 0x0700, + /** + * Smart watch. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 8 + * @deprecated since 9 + */ + WEARABLE_WRIST_WATCH = 0x0704, + /** + * Wearable pager. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 8 + * @deprecated since 9 + */ + WEARABLE_PAGER = 0x0708, + /** + * Smart jacket. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 8 + * @deprecated since 9 + */ + WEARABLE_JACKET = 0x070C, + /** + * Wearable helmet. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 8 + * @deprecated since 9 + */ + WEARABLE_HELMET = 0x0710, + /** + * Wearable glasses. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 8 + * @deprecated since 9 + */ + WEARABLE_GLASSES = 0x0714, + /** + * Minor Device Class field - Toy Major Class + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 8 + * @deprecated since 9 + */ + TOY_UNCATEGORIZED = 0x0800, + /** + * Toy robot. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 8 + * @deprecated since 9 + */ + TOY_ROBOT = 0x0804, + /** + * Toy vehicle. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 8 + * @deprecated since 9 + */ + TOY_VEHICLE = 0x0808, + /** + * Humanoid toy doll. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 8 + * @deprecated since 9 + */ + TOY_DOLL_ACTION_FIGURE = 0x080C, + /** + * Toy controller. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 8 + * @deprecated since 9 + */ + TOY_CONTROLLER = 0x0810, + /** + * Toy gaming device. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 8 + * @deprecated since 9 + */ + TOY_GAME = 0x0814, + /** + * Minor Device Class field - Health + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 8 + * @deprecated since 9 + */ + HEALTH_UNCATEGORIZED = 0x0900, + /** + * Blood pressure device. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 8 + * @deprecated since 9 + */ + HEALTH_BLOOD_PRESSURE = 0x0904, + /** + * Thermometer. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 8 + * @deprecated since 9 + */ + HEALTH_THERMOMETER = 0x0908, + /** + * Body scale. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 8 + * @deprecated since 9 + */ + HEALTH_WEIGHING = 0x090C, + /** + * Blood glucose monitor. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 8 + * @deprecated since 9 + */ + HEALTH_GLUCOSE = 0x0910, + /** + * Pulse oximeter. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 8 + * @deprecated since 9 + */ + HEALTH_PULSE_OXIMETER = 0x0914, + /** + * Heart rate monitor. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 8 + * @deprecated since 9 + */ + HEALTH_PULSE_RATE = 0x0918, + /** + * Health data display. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 8 + * @deprecated since 9 + */ + HEALTH_DATA_DISPLAY = 0x091C, + /** + * Step counter. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 8 + * @deprecated since 9 + */ + HEALTH_STEP_COUNTER = 0x0920, + /** + * Body composition analyzer. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 8 + * @deprecated since 9 + */ + HEALTH_BODY_COMPOSITION_ANALYZER = 0x0924, + /** + * Hygrometer. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 8 + * @deprecated since 9 + */ + HEALTH_PEAK_FLOW_MOITOR = 0x0928, + /** + * Medication monitor. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 8 + * @deprecated since 9 + */ + HEALTH_MEDICATION_MONITOR = 0x092C, + /** + * Prosthetic knee. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 8 + * @deprecated since 9 + */ + HEALTH_KNEE_PROSTHESIS = 0x0930, + /** + * Prosthetic ankle. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 8 + * @deprecated since 9 + */ + HEALTH_ANKLE_PROSTHESIS = 0x0934, + /** + * Generic health management device. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 8 + * @deprecated since 9 + */ + HEALTH_GENERIC_HEALTH_MANAGER = 0x0938, + /** + * Personal mobility device. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 8 + * @deprecated since 9 + */ + HEALTH_PERSONAL_MOBILITY_DEVICE = 0x093C + } + /** + * Profile state change parameters. + * + * @typedef StateChangeParam + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.bluetoothManager/bluetoothManager.StateChangeParam + */ + interface StateChangeParam { + /** + * The address of device + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 8 + * @deprecated since 9 + */ + deviceId: string; + /** + * Profile state value + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 8 + * @deprecated since 9 + */ + state: ProfileConnectionState; + } + /** + * The enum of a2dp playing state. + * + * @enum { number } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.bluetoothManager/bluetoothManager.PlayingState + */ + enum PlayingState { + /** + * Not playing. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 8 + * @deprecated since 9 + */ + STATE_NOT_PLAYING, + /** + * Playing. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 8 + * @deprecated since 9 + */ + STATE_PLAYING + } + /** + * The enum of profile id. + * + * @enum { number } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.bluetoothManager/bluetoothManager.ProfileId + */ + enum ProfileId { + /** + * A2DP profile. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 8 + * @deprecated since 9 + */ + PROFILE_A2DP_SOURCE = 1, + /** + * HFP profile. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 8 + * @deprecated since 9 + */ + PROFILE_HANDS_FREE_AUDIO_GATEWAY = 4 + } +} +export default bluetooth; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.bluetooth.hfp.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.bluetooth.hfp.d.ts new file mode 100755 index 00000000..ce2950de --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.bluetooth.hfp.d.ts @@ -0,0 +1,57 @@ +/* + * Copyright (C) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit ConnectivityKit + */ +import type baseProfile from './@ohos.bluetooth.baseProfile'; +/** + * Provides methods to accessing bluetooth call-related capabilities. + * + * @namespace hfp + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ +declare namespace hfp { + /** + * Base interface of profile. + * + * @typedef { baseProfile.BaseProfile } BaseProfile + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + type BaseProfile = baseProfile.BaseProfile; + /** + * create the instance of hfp profile. + * + * @returns { HandsFreeAudioGatewayProfile } Returns the instance of profile. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + function createHfpAgProfile(): HandsFreeAudioGatewayProfile; + /** + * Manager hfp source profile. + * + * @typedef HandsFreeAudioGatewayProfile + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + interface HandsFreeAudioGatewayProfile extends BaseProfile { + } +} +export default hfp; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.bluetooth.hid.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.bluetooth.hid.d.ts new file mode 100755 index 00000000..46a3bcb3 --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.bluetooth.hid.d.ts @@ -0,0 +1,57 @@ +/* + * Copyright (C) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit ConnectivityKit + */ +import type baseProfile from './@ohos.bluetooth.baseProfile'; +/** + * Provides methods to accessing bluetooth HID(Human Interface Device)-related capabilities. + * + * @namespace hid + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ +declare namespace hid { + /** + * Base interface of profile. + * + * @typedef { baseProfile.BaseProfile } BaseProfile + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + type BaseProfile = baseProfile.BaseProfile; + /** + * create the instance of hid profile. + * + * @returns { HidHostProfile } Returns the instance of hid profile. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + function createHidHostProfile(): HidHostProfile; + /** + * Manager hid host profile. + * + * @typedef HidHostProfile + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + interface HidHostProfile extends BaseProfile { + } +} +export default hid; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.bluetooth.map.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.bluetooth.map.d.ts new file mode 100755 index 00000000..2179ea24 --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.bluetooth.map.d.ts @@ -0,0 +1,57 @@ +/* + * Copyright (C) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit ConnectivityKit + */ +import type baseProfile from './@ohos.bluetooth.baseProfile'; +/** + * Provides methods to accessing bluetooth MAP(Message Access Profile)-related capabilities. + * + * @namespace map + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 11 + */ +declare namespace map { + /** + * Base interface of profile. + * + * @typedef { baseProfile.BaseProfile } BaseProfile + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 11 + */ + type BaseProfile = baseProfile.BaseProfile; + /** + * create the instance of MAP MSE profile. + * + * @returns { MapMseProfile } Returns the instance of map mse profile. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 11 + */ + function createMapMseProfile(): MapMseProfile; + /** + * Manager MAP MSE profile. + * + * @typedef MapMseProfile + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 11 + */ + interface MapMseProfile extends BaseProfile { + } +} +export default map; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.bluetooth.pan.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.bluetooth.pan.d.ts new file mode 100755 index 00000000..5e906e4c --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.bluetooth.pan.d.ts @@ -0,0 +1,57 @@ +/* + * Copyright (C) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit ConnectivityKit + */ +import type baseProfile from './@ohos.bluetooth.baseProfile'; +/** + * Provides methods to accessing bluetooth PAN(Personal Area Networking Profile)-related capabilities. + * + * @namespace pan + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ +declare namespace pan { + /** + * Base interface of profile. + * + * @typedef { baseProfile.BaseProfile } BaseProfile + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + type BaseProfile = baseProfile.BaseProfile; + /** + * create the instance of pan profile. + * + * @returns { PanProfile } Returns the instance of pan profile. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + function createPanProfile(): PanProfile; + /** + * Manager pan host profile. + * + * @typedef PanProfile + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + interface PanProfile extends BaseProfile { + } +} +export default pan; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.bluetooth.pbap.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.bluetooth.pbap.d.ts new file mode 100755 index 00000000..7284d456 --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.bluetooth.pbap.d.ts @@ -0,0 +1,58 @@ +/* + * Copyright (C) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit ConnectivityKit + */ + +import type baseProfile from './@ohos.bluetooth.baseProfile'; +/** + * Provides methods to accessing bluetooth PBAP(Phone Book Access Profile)-related capabilities. + * + * @namespace pbap + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 11 + */ +declare namespace pbap { + /** + * Base interface of profile. + * + * @typedef { baseProfile.BaseProfile } BaseProfile + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 11 + */ + type BaseProfile = baseProfile.BaseProfile; + /** + * create the instance of PBAP server profile. + * + * @returns { PbapServerProfile } Returns the instance of pan profile. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 11 + */ + function createPbapServerProfile(): PbapServerProfile; + /** + * Manager PBAP server profile. + * + * @typedef PbapServerProfile + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 11 + */ + interface PbapServerProfile extends BaseProfile { + } +} +export default pbap; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.bluetooth.socket.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.bluetooth.socket.d.ts new file mode 100755 index 00000000..05ee1f87 --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.bluetooth.socket.d.ts @@ -0,0 +1,197 @@ +/* + * Copyright (C) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit ConnectivityKit + */ +import type { AsyncCallback, Callback } from './@ohos.base'; +/** + * Provides methods to operate or manage bluetooth socket connection. + * + * @namespace socket + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ +declare namespace socket { + /** + * Creates a Bluetooth server listening socket. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { string } name - Indicates the service name. + * @param { SppOptions } options - Indicates the listen parameters. + * @param { AsyncCallback } callback - Callback used to return a server socket ID. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth switch is off. + * @throws { BusinessError } 2900004 - Profile is not supported. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + function sppListen(name: string, options: SppOptions, callback: AsyncCallback): void; + /** + * Waits for a remote device to connect. + * + * @param { number } serverSocket - Indicates the server socket ID, returned by {@link sppListen}. + * @param { AsyncCallback } callback - Callback used to return a client socket ID. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth switch is off. + * @throws { BusinessError } 2900004 - Profile is not supported. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + function sppAccept(serverSocket: number, callback: AsyncCallback): void; + /** + * Connects to a remote device over the socket. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF". + * @param { SppOptions } options - Indicates the connect parameters {@link SppOptions}. + * @param { AsyncCallback } callback - Callback used to return a client socket ID. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth switch is off. + * @throws { BusinessError } 2900004 - Profile is not supported. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + function sppConnect(deviceId: string, options: SppOptions, callback: AsyncCallback): void; + /** + * Disables an spp server socket and releases related resources. + * + * @param { number } socket - Indicates the server socket ID, returned by {@link sppListen}. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + function sppCloseServerSocket(socket: number): void; + /** + * Disables an spp client socket and releases related resources. + * + * @param { number } socket - Indicates the client socket ID, returned by {@link sppAccept} or {@link sppConnect}. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + function sppCloseClientSocket(socket: number): void; + /** + * Write data through the socket. + * + * @param { number } clientSocket - Indicates the client socket ID, returned by {@link sppAccept} or {@link sppConnect}. + * @param { ArrayBuffer } data - Indicates the data to write. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2901054 - IO error. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + function sppWrite(clientSocket: number, data: ArrayBuffer): void; + /** + * Subscribe the event reported when data is read from the socket. + * + * @param { 'sppRead' } type - Type of the spp read event to listen for. + * @param { number } clientSocket - Client socket ID, which is obtained by sppAccept or sppConnect. + * @param { Callback } callback - Callback used to listen for the spp read event. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2901054 - IO error. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + function on(type: 'sppRead', clientSocket: number, callback: Callback): void; + /** + * Unsubscribe the event reported when data is read from the socket. + * + * @param { 'sppRead' } type - Type of the spp read event to listen for. + * @param { number } clientSocket - Client socket ID, which is obtained by sppAccept or sppConnect. + * @param { Callback } callback - Callback used to listen for the spp read event. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + function off(type: 'sppRead', clientSocket: number, callback?: Callback): void; + /** + * Describes the spp parameters. + * + * @typedef SppOptions + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + interface SppOptions { + /** + * Indicates the UUID in the SDP record. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + uuid: string; + /** + * Indicates secure channel or not + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + secure: boolean; + /** + * Spp link type + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + type: SppType; + } + /** + * The enum of SPP type. + * + * @enum { number } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + enum SppType { + /** + * RFCOMM + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + */ + SPP_RFCOMM + } +} +export default socket; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.bluetooth.wearDetection.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.bluetooth.wearDetection.d.ts new file mode 100755 index 00000000..4413706d --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.bluetooth.wearDetection.d.ts @@ -0,0 +1,29 @@ +/* + * Copyright (C) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit ConnectivityKit + */ + +/** + * Provides methods to manage the wearing detection function. + * + * @namespace wearDetection + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 11 + */ +declare namespace wearDetection { +} +export default wearDetection; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.bluetoothManager.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.bluetoothManager.d.ts new file mode 100755 index 00000000..60cb2bbe --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.bluetoothManager.d.ts @@ -0,0 +1,5438 @@ +/* + * Copyright (C) 2022-2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit ConnectivityKit + */ +import type { AsyncCallback, Callback } from './@ohos.base'; +/** + * Provides methods to operate or manage Bluetooth. + * + * @namespace bluetoothManager + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + */ +declare namespace bluetoothManager { + /** + * Obtains the Bluetooth status of a device. + * + * @permission ohos.permission.USE_BLUETOOTH + * @returns { BluetoothState } Returns the Bluetooth status, which can be {@link BluetoothState#STATE_OFF}, + * {@link BluetoothState#STATE_TURNING_ON}, {@link BluetoothState#STATE_ON}, {@link BluetoothState#STATE_TURNING_OFF}, + * {@link BluetoothState#STATE_BLE_TURNING_ON}, {@link BluetoothState#STATE_BLE_ON}, + * or {@link BluetoothState#STATE_BLE_TURNING_OFF}. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.access/access#getState + */ + /** + * Obtains the Bluetooth status of a device. + * The permission required by this interface is changed from USE_BLUETOOTH to ACCESS_BLUETOOTH. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @returns { BluetoothState } Returns the Bluetooth status, which can be {@link BluetoothState#STATE_OFF}, + * {@link BluetoothState#STATE_TURNING_ON}, {@link BluetoothState#STATE_ON}, {@link BluetoothState#STATE_TURNING_OFF}, + * {@link BluetoothState#STATE_BLE_TURNING_ON}, {@link BluetoothState#STATE_BLE_ON}, + * or {@link BluetoothState#STATE_BLE_TURNING_OFF}. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + * @deprecated since 10 + * @useinstead ohos.bluetooth.access/access#getState + */ + function getState(): BluetoothState; + /** + * Get the local device connection state to any profile of any remote device. + * + * @permission ohos.permission.USE_BLUETOOTH + * @returns { ProfileConnectionState } One of {@link ProfileConnectionState#STATE_DISCONNECTED}, + * {@link ProfileConnectionState#STATE_CONNECTING}, {@link ProfileConnectionState#STATE_CONNECTED}, + * {@link ProfileConnectionState#STATE_DISCONNECTING}. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth switch is off. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.connection/connection#getProfileConnectionState + */ + /** + * Get the local device connection state to any profile of any remote device. + * The permission required by this interface is changed from USE_BLUETOOTH to ACCESS_BLUETOOTH. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @returns { ProfileConnectionState } One of {@link ProfileConnectionState#STATE_DISCONNECTED}, + * {@link ProfileConnectionState#STATE_CONNECTING}, {@link ProfileConnectionState#STATE_CONNECTED}, + * {@link ProfileConnectionState#STATE_DISCONNECTING}. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth switch is off. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + * @deprecated since 10 + * @useinstead ohos.bluetooth.connection/connection#getProfileConnectionState + */ + function getBtConnectionState(): ProfileConnectionState; + /** + * Starts pairing with a remote Bluetooth device. + * + * @permission ohos.permission.DISCOVER_BLUETOOTH + * @param { string } deviceId - The address of the remote device to pair. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth switch is off. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.connection/connection#pairDevice + */ + /** + * Starts pairing with a remote Bluetooth device. + * The permission required by this interface is changed from DISCOVER_BLUETOOTH to ACCESS_BLUETOOTH. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { string } deviceId - The address of the remote device to pair. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth switch is off. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + * @deprecated since 10 + * @useinstead ohos.bluetooth.connection/connection#pairDevice + */ + function pairDevice(deviceId: string): void; + /** + * Obtains the name of a peer Bluetooth device. + * + * @permission ohos.permission.USE_BLUETOOTH + * @param { string } deviceId - The address of the remote device. + * @returns { string } Returns the device name in character string format. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth switch is off. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.connection/connection#getRemoteDeviceName + */ + /** + * Obtains the name of a peer Bluetooth device. + * The permission required by this interface is changed from USE_BLUETOOTH to ACCESS_BLUETOOTH. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { string } deviceId - The address of the remote device. + * @returns { string } Returns the device name in character string format. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth switch is off. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + * @deprecated since 10 + * @useinstead ohos.bluetooth.connection/connection#getRemoteDeviceName + */ + function getRemoteDeviceName(deviceId: string): string; + /** + * Obtains the class of a peer Bluetooth device. + * + * @permission ohos.permission.USE_BLUETOOTH + * @param { string } deviceId - The address of the remote device. + * @returns { DeviceClass } The class of the remote device, {@link DeviceClass}. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth switch is off. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.connection/connection#getRemoteDeviceClass + */ + /** + * Obtains the class of a peer Bluetooth device. + * The permission required by this interface is changed from USE_BLUETOOTH to ACCESS_BLUETOOTH. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { string } deviceId - The address of the remote device. + * @returns { DeviceClass } The class of the remote device, {@link DeviceClass}. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth switch is off. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + * @deprecated since 10 + * @useinstead ohos.bluetooth.connection/connection#getRemoteDeviceClass + */ + function getRemoteDeviceClass(deviceId: string): DeviceClass; + /** + * Enables Bluetooth on a device. + * + * @permission ohos.permission.DISCOVER_BLUETOOTH + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.access/access#enableBluetooth + */ + /** + * Enables Bluetooth on a device. + * The permission required by this interface is changed from DISCOVER_BLUETOOTH to ACCESS_BLUETOOTH. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + * @deprecated since 10 + * @useinstead ohos.bluetooth.access/access#enableBluetooth + */ + function enableBluetooth(): void; + /** + * Disables Bluetooth on a device. + * + * @permission ohos.permission.DISCOVER_BLUETOOTH + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.access/access#disableBluetooth + */ + /** + * Disables Bluetooth on a device. + * The permission required by this interface is changed from DISCOVER_BLUETOOTH to ACCESS_BLUETOOTH. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + * @deprecated since 10 + * @useinstead ohos.bluetooth.access/access#disableBluetooth + */ + function disableBluetooth(): void; + /** + * Obtains the Bluetooth local name of a device. + * + * @permission ohos.permission.USE_BLUETOOTH + * @returns { string } Returns the name the device. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.connection/connection#getLocalName + */ + /** + * Obtains the Bluetooth local name of a device. + * The permission required by this interface is changed from USE_BLUETOOTH to ACCESS_BLUETOOTH. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @returns { string } Returns the name the device. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + * @deprecated since 10 + * @useinstead ohos.bluetooth.connection/connection#getLocalName + */ + function getLocalName(): string; + /** + * Obtains the list of Bluetooth devices that have been paired with the current device. + * + * @permission ohos.permission.USE_BLUETOOTH + * @returns { Array } Returns a list of paired Bluetooth devices's address. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth switch is off. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.connection/connection#getPairedDevices + */ + /** + * Obtains the list of Bluetooth devices that have been paired with the current device. + * The permission required by this interface is changed from USE_BLUETOOTH to ACCESS_BLUETOOTH. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @returns { Array } Returns a list of paired Bluetooth devices's address. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth switch is off. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + * @deprecated since 10 + * @useinstead ohos.bluetooth.connection/connection#getPairedDevices + */ + function getPairedDevices(): Array; + /** + * Obtains the connection state of profile. + * + * @permission ohos.permission.USE_BLUETOOTH + * @param { ProfileId } profileId - The profile id. + * @returns { ProfileConnectionState } Returns the connection state. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth switch is off. + * @throws { BusinessError } 2900004 - Profile is not supported. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.connection/connection#getProfileConnectionState + */ + /** + * Obtains the connection state of profile. + * The permission required by this interface is changed from USE_BLUETOOTH to ACCESS_BLUETOOTH. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { ProfileId } profileId - The profile id. + * @returns { ProfileConnectionState } Returns the connection state. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth switch is off. + * @throws { BusinessError } 2900004 - Profile is not supported. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + * @deprecated since 10 + * @useinstead ohos.bluetooth.connection/connection#getProfileConnectionState + */ + function getProfileConnectionState(profileId: ProfileId): ProfileConnectionState; + /** + * Sets the confirmation of pairing with a certain device. + * + * @permission ohos.permission.MANAGE_BLUETOOTH + * @param { string } device - The address of the remote device. + * @param { boolean } accept - Indicates whether to accept the pairing request, {@code true} indicates accept or {@code false} otherwise. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth switch is off. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.connection/connection#setDevicePairingConfirmation + */ + /** + * Sets the confirmation of pairing with a certain device. + * The permission required by this interface is changed from MANAGE_BLUETOOTH to ACCESS_BLUETOOTH and MANAGE_BLUETOOTH. + * + * @permission ohos.permission.ACCESS_BLUETOOTH and ohos.permission.MANAGE_BLUETOOTH + * @param { string } device - The address of the remote device. + * @param { boolean } accept - Indicates whether to accept the pairing request, {@code true} indicates accept or {@code false} otherwise. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth switch is off. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + * @deprecated since 10 + * @useinstead ohos.bluetooth.connection/connection#setDevicePairingConfirmation + */ + function setDevicePairingConfirmation(device: string, accept: boolean): void; + /** + * Sets the Bluetooth friendly name of a device. + * + * @permission ohos.permission.DISCOVER_BLUETOOTH + * @param { string } name - Indicates a valid Bluetooth name. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth switch is off. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.connection/connection#setLocalName + */ + /** + * Sets the Bluetooth friendly name of a device. + * The permission required by this interface is changed from DISCOVER_BLUETOOTH to ACCESS_BLUETOOTH. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { string } name - Indicates a valid Bluetooth name. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth switch is off. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + * @deprecated since 10 + * @useinstead ohos.bluetooth.connection/connection#setLocalName + */ + function setLocalName(name: string): void; + /** + * Sets the Bluetooth scan mode for a device. + * + * @permission ohos.permission.USE_BLUETOOTH + * @param { ScanMode } mode - Indicates the Bluetooth scan mode to set, {@link ScanMode}. + * @param { number } duration - Indicates the duration in seconds, in which the host is discoverable. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth switch is off. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.connection/connection#setBluetoothScanMode + */ + /** + * Sets the Bluetooth scan mode for a device. + * The permission required by this interface is changed from USE_BLUETOOTH to ACCESS_BLUETOOTH. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { ScanMode } mode - Indicates the Bluetooth scan mode to set, {@link ScanMode}. + * @param { number } duration - Indicates the duration in seconds, in which the host is discoverable. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth switch is off. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + * @deprecated since 10 + * @useinstead ohos.bluetooth.connection/connection#setBluetoothScanMode + */ + function setBluetoothScanMode(mode: ScanMode, duration: number): void; + /** + * Obtains the Bluetooth scanning mode of a device. + * + * @permission ohos.permission.USE_BLUETOOTH + * @returns { ScanMode } Returns the Bluetooth scanning mode, {@link ScanMode}. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth switch is off. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.connection/connection#getBluetoothScanMode + */ + /** + * Obtains the Bluetooth scanning mode of a device. + * The permission required by this interface is changed from USE_BLUETOOTH to ACCESS_BLUETOOTH. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @returns { ScanMode } Returns the Bluetooth scanning mode, {@link ScanMode}. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth switch is off. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + * @deprecated since 10 + * @useinstead ohos.bluetooth.connection/connection#getBluetoothScanMode + */ + function getBluetoothScanMode(): ScanMode; + /** + * Starts scanning Bluetooth devices. + * + * @permission ohos.permission.DISCOVER_BLUETOOTH and ohos.permission.LOCATION + * and ohos.permission.APPROXIMATELY_LOCATION + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth switch is off. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.connection/connection#startBluetoothDiscovery + */ + /** + * Starts scanning Bluetooth devices. + * The permission required by this interface is changed from DISCOVER_BLUETOOTH and LOCATION and APPROXIMATELY_LOCATION to ACCESS_BLUETOOTH. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth switch is off. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + * @deprecated since 10 + * @useinstead ohos.bluetooth.connection/connection#startBluetoothDiscovery + */ + function startBluetoothDiscovery(): void; + /** + * Stops Bluetooth device scanning. + * + * @permission ohos.permission.DISCOVER_BLUETOOTH + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth switch is off. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.connection/connection#stopBluetoothDiscovery + */ + /** + * Stops Bluetooth device scanning. + * The permission required by this interface is changed from DISCOVER_BLUETOOTH to ACCESS_BLUETOOTH. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth switch is off. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + * @deprecated since 10 + * @useinstead ohos.bluetooth.connection/connection#stopBluetoothDiscovery + */ + function stopBluetoothDiscovery(): void; + /** + * Subscribe the event reported when a remote Bluetooth device is discovered. + * + * @permission ohos.permission.USE_BLUETOOTH + * @param { 'bluetoothDeviceFind' } type - Type of the discovering event to listen for. + * @param { Callback> } callback - Callback used to listen for the discovering event. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.connection/connection.on#event:bluetoothDeviceFind + */ + /** + * Subscribe the event reported when a remote Bluetooth device is discovered. + * The permission required by this interface is changed from USE_BLUETOOTH to ACCESS_BLUETOOTH. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { 'bluetoothDeviceFind' } type - Type of the discovering event to listen for. + * @param { Callback> } callback - Callback used to listen for the discovering event. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + * @deprecated since 10 + * @useinstead ohos.bluetooth.connection/connection.on#event:bluetoothDeviceFind + */ + function on(type: 'bluetoothDeviceFind', callback: Callback>): void; + /** + * Unsubscribe the event reported when a remote Bluetooth device is discovered. + * + * @permission ohos.permission.USE_BLUETOOTH + * @param { 'bluetoothDeviceFind' } type - Type of the discovering event to listen for. + * @param { Callback> } callback - Callback used to listen for the discovering event. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.connection/connection.off#event:bluetoothDeviceFind + */ + /** + * Unsubscribe the event reported when a remote Bluetooth device is discovered. + * The permission required by this interface is changed from USE_BLUETOOTH to ACCESS_BLUETOOTH. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { 'bluetoothDeviceFind' } type - Type of the discovering event to listen for. + * @param { Callback> } callback - Callback used to listen for the discovering event. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + * @deprecated since 10 + * @useinstead ohos.bluetooth.connection/connection.off#event:bluetoothDeviceFind + */ + function off(type: 'bluetoothDeviceFind', callback?: Callback>): void; + /** + * Subscribe the event reported when a remote Bluetooth device is bonded. + * + * @permission ohos.permission.USE_BLUETOOTH + * @param { 'bondStateChange' } type - Type of the bond state event to listen for. + * @param { Callback } callback - Callback used to listen for the bond state event, {@link BondStateParam}. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.connection/connection.on#event:bondStateChange + */ + /** + * Subscribe the event reported when a remote Bluetooth device is bonded. + * The permission required by this interface is changed from USE_BLUETOOTH to ACCESS_BLUETOOTH. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { 'bondStateChange' } type - Type of the bond state event to listen for. + * @param { Callback } callback - Callback used to listen for the bond state event, {@link BondStateParam}. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + * @deprecated since 10 + * @useinstead ohos.bluetooth.connection/connection.on#event:bondStateChange + */ + function on(type: 'bondStateChange', callback: Callback): void; + /** + * Unsubscribe the event reported when a remote Bluetooth device is bonded. + * + * @permission ohos.permission.USE_BLUETOOTH + * @param { 'bondStateChange' } type - Type of the bond state event to listen for. + * @param { Callback } callback - Callback used to listen for the bond state event. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.connection/connection.off#event:bondStateChange + */ + /** + * Unsubscribe the event reported when a remote Bluetooth device is bonded. + * The permission required by this interface is changed from USE_BLUETOOTH to ACCESS_BLUETOOTH. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { 'bondStateChange' } type - Type of the bond state event to listen for. + * @param { Callback } callback - Callback used to listen for the bond state event. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + * @deprecated since 10 + * @useinstead ohos.bluetooth.connection/connection.off#event:bondStateChange + */ + function off(type: 'bondStateChange', callback?: Callback): void; + /** + * Subscribe the event of a pairing request from a remote Bluetooth device. + * + * @permission ohos.permission.DISCOVER_BLUETOOTH + * @param { 'pinRequired' } type - Type of the pairing request event to listen for. + * @param { Callback } callback - Callback used to listen for the pairing request event. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.connection/connection.on#event:pinRequired + */ + /** + * Subscribe the event of a pairing request from a remote Bluetooth device. + * The permission required by this interface is changed from DISCOVER_BLUETOOTH to ACCESS_BLUETOOTH. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { 'pinRequired' } type - Type of the pairing request event to listen for. + * @param { Callback } callback - Callback used to listen for the pairing request event. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + * @deprecated since 10 + * @useinstead ohos.bluetooth.connection/connection.on#event:pinRequired + */ + function on(type: 'pinRequired', callback: Callback): void; + /** + * Unsubscribe the event of a pairing request from a remote Bluetooth device. + * + * @permission ohos.permission.DISCOVER_BLUETOOTH + * @param { 'pinRequired' } type - Type of the pairing request event to listen for. + * @param { Callback } callback - Callback used to listen for the pairing request event. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.connection/connection.off#event:pinRequired + */ + /** + * Unsubscribe the event of a pairing request from a remote Bluetooth device. + * The permission required by this interface is changed from DISCOVER_BLUETOOTH to ACCESS_BLUETOOTH. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { 'pinRequired' } type - Type of the pairing request event to listen for. + * @param { Callback } callback - Callback used to listen for the pairing request event. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + * @deprecated since 10 + * @useinstead ohos.bluetooth.connection/connection.off#event:pinRequired + */ + function off(type: 'pinRequired', callback?: Callback): void; + /** + * Subscribe the event reported when the Bluetooth state changes. + * + * @permission ohos.permission.USE_BLUETOOTH + * @param { 'stateChange' } type - Type of the Bluetooth state changes event to listen for. + * @param { Callback } callback - Callback used to listen for the Bluetooth state event. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.access/access.on#event:stateChange + */ + /** + * Subscribe the event reported when the Bluetooth state changes. + * The permission required by this interface is changed from USE_BLUETOOTH to ACCESS_BLUETOOTH. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { 'stateChange' } type - Type of the Bluetooth state changes event to listen for. + * @param { Callback } callback - Callback used to listen for the Bluetooth state event. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + * @deprecated since 10 + * @useinstead ohos.bluetooth.access/access.on#event:stateChange + */ + function on(type: 'stateChange', callback: Callback): void; + /** + * Unsubscribe the event reported when the Bluetooth state changes. + * + * @permission ohos.permission.USE_BLUETOOTH + * @param { 'stateChange' } type - Type of the Bluetooth state changes event to listen for. + * @param { Callback } callback - Callback used to listen for the Bluetooth state event. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.access/access.off#event:stateChange + */ + /** + * Unsubscribe the event reported when the Bluetooth state changes. + * The permission required by this interface is changed from USE_BLUETOOTH to ACCESS_BLUETOOTH. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { 'stateChange' } type - Type of the Bluetooth state changes event to listen for. + * @param { Callback } callback - Callback used to listen for the Bluetooth state event. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + * @deprecated since 10 + * @useinstead ohos.bluetooth.access/access.off#event:stateChange + */ + function off(type: 'stateChange', callback?: Callback): void; + /** + * Creates a Bluetooth server listening socket. + * + * @permission ohos.permission.USE_BLUETOOTH + * @param { string } name - Indicates the service name. + * @param { SppOption } option - Indicates the listen parameters {@link SppOption}. + * @param { AsyncCallback } callback - Callback used to return a server socket ID. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth switch is off. + * @throws { BusinessError } 2900004 - Profile is not supported. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.socket/socket#sppListen + */ + /** + * Creates a Bluetooth server listening socket. + * The permission required by this interface is changed from USE_BLUETOOTH to ACCESS_BLUETOOTH. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { string } name - Indicates the service name. + * @param { SppOption } option - Indicates the listen parameters {@link SppOption}. + * @param { AsyncCallback } callback - Callback used to return a server socket ID. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth switch is off. + * @throws { BusinessError } 2900004 - Profile is not supported. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + * @deprecated since 10 + * @useinstead ohos.bluetooth.socket/socket#sppListen + */ + function sppListen(name: string, option: SppOption, callback: AsyncCallback): void; + /** + * Waits for a remote device to connect. + * + * @param { number } serverSocket - Indicates the server socket ID, returned by {@link sppListen}. + * @param { AsyncCallback } callback - Callback used to return a client socket ID. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth switch is off. + * @throws { BusinessError } 2900004 - Profile is not supported. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.socket/socket#sppAccept + */ + function sppAccept(serverSocket: number, callback: AsyncCallback): void; + /** + * Connects to a remote device over the socket. + * + * @permission ohos.permission.USE_BLUETOOTH + * @param { string } device - The address of the remote device to connect. + * @param { SppOption } option - Indicates the connect parameters {@link SppOption}. + * @param { AsyncCallback } callback - Callback used to return a client socket ID. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth switch is off. + * @throws { BusinessError } 2900004 - Profile is not supported. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.socket/socket#sppConnect + */ + /** + * Connects to a remote device over the socket. + * The permission required by this interface is changed from USE_BLUETOOTH to ACCESS_BLUETOOTH. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { string } device - The address of the remote device to connect. + * @param { SppOption } option - Indicates the connect parameters {@link SppOption}. + * @param { AsyncCallback } callback - Callback used to return a client socket ID. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth switch is off. + * @throws { BusinessError } 2900004 - Profile is not supported. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + * @deprecated since 10 + * @useinstead ohos.bluetooth.socket/socket#sppConnect + */ + function sppConnect(device: string, option: SppOption, callback: AsyncCallback): void; + /** + * Disables an spp server socket and releases related resources. + * + * @param { number } socket - Indicates the server socket ID, returned by {@link sppListen}. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.socket/socket#sppCloseServerSocket + */ + function sppCloseServerSocket(socket: number): void; + /** + * Disables an spp client socket and releases related resources. + * + * @param { number } socket - Indicates the client socket ID, returned by {@link sppAccept} or {@link sppConnect}. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.socket/socket#sppCloseClientSocket + */ + function sppCloseClientSocket(socket: number): void; + /** + * Write data through the socket. + * + * @param { number } clientSocket - Indicates the client socket ID, returned by {@link sppAccept} or {@link sppConnect}. + * @param { ArrayBuffer } data - Indicates the data to write. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2901054 - IO error. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.socket/socket#sppWrite + */ + function sppWrite(clientSocket: number, data: ArrayBuffer): void; + /** + * Subscribe the event reported when data is read from the socket. + * + * @param { 'sppRead' } type - Type of the spp read event to listen for. + * @param { number } clientSocket - Client socket ID, which is obtained by sppAccept or sppConnect. + * @param { Callback } callback - Callback used to listen for the spp read event. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2901054 - IO error. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.socket/socket.on#event:sppRead + */ + function on(type: 'sppRead', clientSocket: number, callback: Callback): void; + /** + * Unsubscribe the event reported when data is read from the socket. + * + * @param { 'sppRead' } type - Type of the spp read event to listen for. + * @param { number } clientSocket - Client socket ID, which is obtained by sppAccept or sppConnect. + * @param { Callback } callback - Callback used to listen for the spp read event. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.socket/socket.off#event:sppRead + */ + function off(type: 'sppRead', clientSocket: number, callback?: Callback): void; + /** + * Obtains the instance of profile. + * + * @param { ProfileId } profileId - The profile id.. + * @returns { A2dpSourceProfile | HandsFreeAudioGatewayProfile | HidHostProfile | PanProfile } Returns the instance of profile. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + */ + function getProfileInstance(profileId: ProfileId): A2dpSourceProfile | HandsFreeAudioGatewayProfile | HidHostProfile | PanProfile; + /** + * Base interface of profile. + * + * @typedef BaseProfile + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.baseProfile/baseProfile.BaseProfile + */ + interface BaseProfile { + /** + * Obtains the connected devices list of profile. + * + * @permission ohos.permission.USE_BLUETOOTH + * @returns { Array } Returns the address of connected devices list. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth switch is off. + * @throws { BusinessError } 2900004 - Profile is not supported. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.baseProfile/baseProfile#getConnectedDevices + */ + /** + * Obtains the connected devices list of profile. + * The permission required by this interface is changed from USE_BLUETOOTH to ACCESS_BLUETOOTH. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @returns { Array } Returns the address of connected devices list. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth switch is off. + * @throws { BusinessError } 2900004 - Profile is not supported. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + * @deprecated since 10 + * @useinstead ohos.bluetooth.baseProfile/baseProfile#getConnectedDevices + */ + getConnectionDevices(): Array; + /** + * Obtains the profile state of device. + * + * @permission ohos.permission.USE_BLUETOOTH + * @param { string } device - The address of bluetooth device. + * @returns { ProfileConnectionState } Returns {@link ProfileConnectionState} of device. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth switch is off. + * @throws { BusinessError } 2900004 - Profile is not supported. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.baseProfile/baseProfile#getConnectionState + */ + /** + * Obtains the profile state of device. + * The permission required by this interface is changed from USE_BLUETOOTH to ACCESS_BLUETOOTH. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { string } device - The address of bluetooth device. + * @returns { ProfileConnectionState } Returns {@link ProfileConnectionState} of device. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth switch is off. + * @throws { BusinessError } 2900004 - Profile is not supported. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + * @deprecated since 10 + * @useinstead ohos.bluetooth.baseProfile/baseProfile#getConnectionState + */ + getDeviceState(device: string): ProfileConnectionState; + } + /** + * Manager a2dp source profile. + * + * @typedef A2dpSourceProfile + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.a2dp/a2dp.A2dpSourceProfile + */ + interface A2dpSourceProfile extends BaseProfile { + /** + * Connect to device with a2dp. + * + * @permission ohos.permission.DISCOVER_BLUETOOTH + * @param { string } device - The address of the remote device to connect. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth switch is off. + * @throws { BusinessError } 2900004 - Profile is not supported. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.a2dp/a2dp.A2dpSourceProfile#connect + */ + /** + * Connect to device with a2dp. + * The permission required by this interface is changed from DISCOVER_BLUETOOTH to ACCESS_BLUETOOTH. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { string } device - The address of the remote device to connect. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth switch is off. + * @throws { BusinessError } 2900004 - Profile is not supported. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + * @deprecated since 10 + * @useinstead ohos.bluetooth.a2dp/a2dp.A2dpSourceProfile#connect + */ + connect(device: string): void; + /** + * Disconnect to device with a2dp. + * + * @permission ohos.permission.DISCOVER_BLUETOOTH + * @param { string } device - The address of the remote device to disconnect. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth switch is off. + * @throws { BusinessError } 2900004 - Profile is not supported. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.a2dp/a2dp.A2dpSourceProfile#disconnect + */ + /** + * Disconnect to device with a2dp. + * The permission required by this interface is changed from DISCOVER_BLUETOOTH to ACCESS_BLUETOOTH. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { string } device - The address of the remote device to disconnect. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth switch is off. + * @throws { BusinessError } 2900004 - Profile is not supported. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + * @deprecated since 10 + * @useinstead ohos.bluetooth.a2dp/a2dp.A2dpSourceProfile#disconnect + */ + disconnect(device: string): void; + /** + * Subscribe the event reported when the profile connection state changes . + * + * @param { 'connectionStateChange' } type - Type of the profile connection state changes event to listen for . + * @param { Callback } callback - Callback used to listen for event. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.a2dp/a2dp.A2dpSourceProfile.on#event:connectionStateChange + */ + /** + * Subscribe the event reported when the profile connection state changes. + * The permission required by this interface is changed to ACCESS_BLUETOOTH. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { 'connectionStateChange' } type - Type of the profile connection state changes event to listen for . + * @param { Callback } callback - Callback used to listen for event. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + * @deprecated since 10 + * @useinstead ohos.bluetooth.a2dp/a2dp.A2dpSourceProfile.on#event:connectionStateChange + */ + on(type: 'connectionStateChange', callback: Callback): void; + /** + * Unsubscribe the event reported when the profile connection state changes . + * + * @param { 'connectionStateChange' } type - Type of the profile connection state changes event to listen for . + * @param { Callback } callback - Callback used to listen for event. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.a2dp/a2dp.A2dpSourceProfile.off#event:connectionStateChange + */ + /** + * Unsubscribe the event reported when the profile connection state changes. + * The permission required by this interface is changed to ACCESS_BLUETOOTH. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { 'connectionStateChange' } type - Type of the profile connection state changes event to listen for . + * @param { Callback } callback - Callback used to listen for event. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + * @deprecated since 10 + * @useinstead ohos.bluetooth.a2dp/a2dp.A2dpSourceProfile.off#event:connectionStateChange + */ + off(type: 'connectionStateChange', callback?: Callback): void; + /** + * Obtains the playing state of device. + * + * @param { string } device - The address of the remote device. + * @returns { PlayingState } Returns {@link PlayingState} of the remote device. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth switch is off. + * @throws { BusinessError } 2900004 - Profile is not supported. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.a2dp/a2dp.A2dpSourceProfile#getPlayingState + */ + /** + * Obtains the playing state of device. + * The permission required by this interface is changed to ACCESS_BLUETOOTH. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { string } device - The address of the remote device. + * @returns { PlayingState } Returns {@link PlayingState} of the remote device. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth switch is off. + * @throws { BusinessError } 2900004 - Profile is not supported. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + * @deprecated since 10 + * @useinstead ohos.bluetooth.a2dp/a2dp.A2dpSourceProfile#getPlayingState + */ + getPlayingState(device: string): PlayingState; + } + /** + * Manager handsfree AG profile. + * + * @typedef HandsFreeAudioGatewayProfile + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.hfp/hfp.HandsFreeAudioGatewayProfile + */ + interface HandsFreeAudioGatewayProfile extends BaseProfile { + /** + * Connect to device with hfp. + * + * @permission ohos.permission.DISCOVER_BLUETOOTH + * @param { string } device - The address of the remote device to connect. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth switch is off. + * @throws { BusinessError } 2900004 - Profile is not supported. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.hfp/hfp.HandsFreeAudioGatewayProfile#connect + */ + /** + * Connect to device with hfp. + * The permission required by this interface is changed from DISCOVER_BLUETOOTH to ACCESS_BLUETOOTH. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { string } device - The address of the remote device to connect. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth switch is off. + * @throws { BusinessError } 2900004 - Profile is not supported. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + * @deprecated since 10 + * @useinstead ohos.bluetooth.hfp/hfp.HandsFreeAudioGatewayProfile#connect + */ + connect(device: string): void; + /** + * Disconnect to device with hfp. + * + * @permission ohos.permission.DISCOVER_BLUETOOTH + * @param { string } device - The address of the remote device to disconnect. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth switch is off. + * @throws { BusinessError } 2900004 - Profile is not supported. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.hfp/hfp.HandsFreeAudioGatewayProfile#disconnect + */ + /** + * Disconnect to device with hfp. + * The permission required by this interface is changed from DISCOVER_BLUETOOTH to ACCESS_BLUETOOTH. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { string } device - The address of the remote device to disconnect. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth switch is off. + * @throws { BusinessError } 2900004 - Profile is not supported. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + * @deprecated since 10 + * @useinstead ohos.bluetooth.hfp/hfp.HandsFreeAudioGatewayProfile#disconnect + */ + disconnect(device: string): void; + /** + * Subscribe the event reported when the profile connection state changes . + * + * @param { 'connectionStateChange' } type - Type of the profile connection state changes event to listen for . + * @param { Callback } callback - Callback used to listen for event. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.hfp/hfp.HandsFreeAudioGatewayProfile.on#event:connectionStateChange + */ + /** + * Subscribe the event reported when the profile connection state changes. + * The permission required by this interface is changed to ACCESS_BLUETOOTH. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { 'connectionStateChange' } type - Type of the profile connection state changes event to listen for . + * @param { Callback } callback - Callback used to listen for event. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + * @deprecated since 10 + * @useinstead ohos.bluetooth.hfp/hfp.HandsFreeAudioGatewayProfile.on#event:connectionStateChange + */ + on(type: 'connectionStateChange', callback: Callback): void; + /** + * Unsubscribe the event reported when the profile connection state changes . + * + * @param { 'connectionStateChange' } type - Type of the profile connection state changes event to listen for . + * @param { Callback } callback - Callback used to listen for event. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.hfp/hfp.HandsFreeAudioGatewayProfile.off#event:connectionStateChange + */ + /** + * Unsubscribe the event reported when the profile connection state changes. + * The permission required by this interface is changed to ACCESS_BLUETOOTH. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { 'connectionStateChange' } type - Type of the profile connection state changes event to listen for . + * @param { Callback } callback - Callback used to listen for event. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + * @deprecated since 10 + * @useinstead ohos.bluetooth.hfp/hfp.HandsFreeAudioGatewayProfile.off#event:connectionStateChange + */ + off(type: 'connectionStateChange', callback?: Callback): void; + } + /** + * Manager hid host profile. + * + * @typedef HidHostProfile + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.hid/hid.HidHostProfile + */ + interface HidHostProfile extends BaseProfile { + /** + * Subscribe the event reported when the profile connection state changes . + * + * @param { 'connectionStateChange' } type - Type of the profile connection state changes event to listen for . + * @param { Callback } callback - Callback used to listen for event. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.hid/hid.HidHostProfile.on#event:connectionStateChange + */ + /** + * Subscribe the event reported when the profile connection state changes. + * The permission required by this interface is changed to ACCESS_BLUETOOTH. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { 'connectionStateChange' } type - Type of the profile connection state changes event to listen for . + * @param { Callback } callback - Callback used to listen for event. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + * @deprecated since 10 + * @useinstead ohos.bluetooth.hid/hid.HidHostProfile.on#event:connectionStateChange + */ + on(type: 'connectionStateChange', callback: Callback): void; + /** + * Unsubscribe the event reported when the profile connection state changes. + * + * @param { 'connectionStateChange' } type - Type of the profile connection state changes event to listen for. + * @param { Callback } callback - Callback used to listen for event. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.hid/hid.HidHostProfile.off#event:connectionStateChange + */ + /** + * Unsubscribe the event reported when the profile connection state changes. + * The permission required by this interface is changed to ACCESS_BLUETOOTH. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { 'connectionStateChange' } type - Type of the profile connection state changes event to listen for. + * @param { Callback } callback - Callback used to listen for event. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + * @deprecated since 10 + * @useinstead ohos.bluetooth.hid/hid.HidHostProfile.off#event:connectionStateChange + */ + off(type: 'connectionStateChange', callback?: Callback): void; + } + /** + * Manager pan profile. + * + * @typedef PanProfile + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.pan/pan.PanProfile + */ + interface PanProfile extends BaseProfile { + /** + * Subscribe the event reported when the profile connection state changes . + * + * @param { 'connectionStateChange' } type - Type of the profile connection state changes event to listen for . + * @param { Callback } callback - Callback used to listen for event. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.pan/pan.PanProfile.on#event:connectionStateChange + */ + /** + * Subscribe the event reported when the profile connection state changes. + * The permission required by this interface is changed to ACCESS_BLUETOOTH. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { 'connectionStateChange' } type - Type of the profile connection state changes event to listen for . + * @param { Callback } callback - Callback used to listen for event. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + * @deprecated since 10 + * @useinstead ohos.bluetooth.pan/pan.PanProfile.on#event:connectionStateChange + */ + on(type: 'connectionStateChange', callback: Callback): void; + /** + * Unsubscribe the event reported when the profile connection state changes. + * + * @param { 'connectionStateChange' } type - Type of the profile connection state changes event to listen for. + * @param { Callback } callback - Callback used to listen for event. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.pan/pan.PanProfile.off#event:connectionStateChange + */ + /** + * Unsubscribe the event reported when the profile connection state changes. + * The permission required by this interface is changed to ACCESS_BLUETOOTH. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { 'connectionStateChange' } type - Type of the profile connection state changes event to listen for. + * @param { Callback } callback - Callback used to listen for event. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + * @deprecated since 10 + * @useinstead ohos.bluetooth.pan/pan.PanProfile.off#event:connectionStateChange + */ + off(type: 'connectionStateChange', callback?: Callback): void; + } + /** + * Provides methods to operate or manage Bluetooth. + * + * @namespace BLE + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.ble/ble + */ + namespace BLE { + /** + * create a JavaScript Gatt server instance. + * + * @returns { GattServer } Returns a JavaScript Gatt server instance {@code GattServer}. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.ble/ble#createGattServer + */ + function createGattServer(): GattServer; + /** + * create a JavaScript Gatt client device instance. + * + * @param { string } deviceId - The address of the remote device. + * @returns { GattClientDevice } Returns a JavaScript Gatt client device instance {@code GattClientDevice}. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.ble/ble#createGattClientDevice + */ + function createGattClientDevice(deviceId: string): GattClientDevice; + /** + * Obtains the list of devices in the connected status. + * + * @permission ohos.permission.USE_BLUETOOTH + * @returns { Array } Returns the list of device address. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth switch is off. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.ble/ble#getConnectedBLEDevices + */ + /** + * Obtains the list of devices in the connected status. + * The permission required by this interface is changed from USE_BLUETOOTH to ACCESS_BLUETOOTH. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @returns { Array } Returns the list of device address. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth switch is off. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + * @deprecated since 10 + * @useinstead ohos.bluetooth.ble/ble#getConnectedBLEDevices + */ + function getConnectedBLEDevices(): Array; + /** + * Starts scanning for specified BLE devices with filters. + * + * @permission ohos.permission.DISCOVER_BLUETOOTH and ohos.permission.MANAGE_BLUETOOTH and ohos.permission.LOCATION + * and ohos.permission.APPROXIMATELY_LOCATION + * @param { Array } filters - Indicates the list of filters used to filter out specified devices. + * If you do not want to use filter, set this parameter to {@code null}. + * @param { ScanOptions } options - Indicates the parameters for scanning and if the user does not assign a value, the default value will be used. + * {@link ScanOptions#interval} set to 0, {@link ScanOptions#dutyMode} set to {@link SCAN_MODE_LOW_POWER} + * and {@link ScanOptions#matchMode} set to {@link MATCH_MODE_AGGRESSIVE}. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth switch is off. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.ble/ble#startBLEScan + */ + /** + * Starts scanning for specified BLE devices with filters. + * The permission required by this interface is changed from DISCOVER_BLUETOOTH and MANAGE_BLUETOOTH and LOCATION to ACCESS_BLUETOOTH. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { Array } filters - Indicates the list of filters used to filter out specified devices. + * If you do not want to use filter, set this parameter to {@code null}. + * @param { ScanOptions } options - Indicates the parameters for scanning and if the user does not assign a value, the default value will be used. + * {@link ScanOptions#interval} set to 0, {@link ScanOptions#dutyMode} set to {@link SCAN_MODE_LOW_POWER} + * and {@link ScanOptions#matchMode} set to {@link MATCH_MODE_AGGRESSIVE}. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth switch is off. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + * @deprecated since 10 + * @useinstead ohos.bluetooth.ble/ble#startBLEScan + */ + function startBLEScan(filters: Array, options?: ScanOptions): void; + /** + * Stops BLE scanning. + * + * @permission ohos.permission.DISCOVER_BLUETOOTH + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth switch is off. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.ble/ble#stopBLEScan + */ + /** + * Stops BLE scanning. + * The permission required by this interface is changed from DISCOVER_BLUETOOTH to ACCESS_BLUETOOTH. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth switch is off. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + * @deprecated since 10 + * @useinstead ohos.bluetooth.ble/ble#stopBLEScan + */ + function stopBLEScan(): void; + /** + * Subscribe BLE scan result. + * + * @permission ohos.permission.USE_BLUETOOTH + * @param { 'BLEDeviceFind' } type - Type of the scan result event to listen for. + * @param { Callback> } callback - Callback used to listen for the scan result event. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.ble/ble.on#event:BLEDeviceFind + */ + /** + * Subscribe BLE scan result. + * The permission required by this interface is changed from USE_BLUETOOTH to ACCESS_BLUETOOTH. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { 'BLEDeviceFind' } type - Type of the scan result event to listen for. + * @param { Callback> } callback - Callback used to listen for the scan result event. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + * @deprecated since 10 + * @useinstead ohos.bluetooth.ble/ble.on#event:BLEDeviceFind + */ + function on(type: 'BLEDeviceFind', callback: Callback>): void; + /** + * Unsubscribe BLE scan result. + * + * @permission ohos.permission.USE_BLUETOOTH + * @param { 'BLEDeviceFind' } type - Type of the scan result event to listen for. + * @param { Callback> } callback - Callback used to listen for the scan result event. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.ble/ble.off#event:BLEDeviceFind + */ + /** + * Unsubscribe BLE scan result. + * The permission required by this interface is changed from USE_BLUETOOTH to ACCESS_BLUETOOTH. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { 'BLEDeviceFind' } type - Type of the scan result event to listen for. + * @param { Callback> } callback - Callback used to listen for the scan result event. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + * @deprecated since 10 + * @useinstead ohos.bluetooth.ble/ble.off#event:BLEDeviceFind + */ + function off(type: 'BLEDeviceFind', callback?: Callback>): void; + } + /** + * Manages GATT server. Before calling an Gatt server method, you must use {@link createGattServer} to create an GattServer instance. + * + * @typedef GattServer + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.ble/ble.GattServer + */ + interface GattServer { + /** + * Starts BLE advertising. + * + * @permission ohos.permission.DISCOVER_BLUETOOTH + * @param { AdvertiseSetting } setting - Indicates the settings for BLE advertising. + * If you need to use the default value, set this parameter to {@code null}. + * @param { AdvertiseData } advData - Indicates the advertising data. + * @param { AdvertiseData } advResponse - Indicates the scan response associated with the advertising data. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth switch is off. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.ble/ble#startAdvertising + */ + /** + * Starts BLE advertising. + * The permission required by this interface is changed from DISCOVER_BLUETOOTH to ACCESS_BLUETOOTH. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { AdvertiseSetting } setting - Indicates the settings for BLE advertising. + * If you need to use the default value, set this parameter to {@code null}. + * @param { AdvertiseData } advData - Indicates the advertising data. + * @param { AdvertiseData } advResponse - Indicates the scan response associated with the advertising data. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth switch is off. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + * @deprecated since 10 + * @useinstead ohos.bluetooth.ble/ble#startAdvertising + */ + startAdvertising(setting: AdvertiseSetting, advData: AdvertiseData, advResponse?: AdvertiseData): void; + /** + * Stops BLE advertising. + * + * @permission ohos.permission.DISCOVER_BLUETOOTH + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth switch is off. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.ble/ble#stopAdvertising + */ + /** + * Stops BLE advertising. + * The permission required by this interface is changed from DISCOVER_BLUETOOTH to ACCESS_BLUETOOTH. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth switch is off. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + * @deprecated since 10 + * @useinstead ohos.bluetooth.ble/ble#stopAdvertising + */ + stopAdvertising(): void; + /** + * Adds a specified service to be hosted. + *

The added service and its characteristics are provided by the local device. + * + * @permission ohos.permission.USE_BLUETOOTH + * @param { GattService } service - Indicates the service to add. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth switch is off. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.ble/ble.GattServer#addService + */ + /** + * Adds a specified service to be hosted. + *

The added service and its characteristics are provided by the local device. + * The permission required by this interface is changed from USE_BLUETOOTH to ACCESS_BLUETOOTH. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { GattService } service - Indicates the service to add. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth switch is off. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + * @deprecated since 10 + * @useinstead ohos.bluetooth.ble/ble.GattServer#addService + */ + addService(service: GattService): void; + /** + * Removes a specified service from the list of GATT services provided by this device. + * + * @permission ohos.permission.USE_BLUETOOTH + * @param { string } serviceUuid - Indicates the UUID of the service to remove. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth switch is off. + * @throws { BusinessError } 2900004 - Profile is not supported. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.ble/ble.GattServer#removeService + */ + /** + * Removes a specified service from the list of GATT services provided by this device. + * The permission required by this interface is changed from USE_BLUETOOTH to ACCESS_BLUETOOTH. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { string } serviceUuid - Indicates the UUID of the service to remove. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth switch is off. + * @throws { BusinessError } 2900004 - Profile is not supported. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + * @deprecated since 10 + * @useinstead ohos.bluetooth.ble/ble.GattServer#removeService + */ + removeService(serviceUuid: string): void; + /** + * Closes this {@code GattServer} object and unregisters its callbacks. + * + * @permission ohos.permission.USE_BLUETOOTH + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth switch is off. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.ble/ble.GattServer#close + */ + /** + * Closes this {@code GattServer} object and unregisters its callbacks. + * The permission required by this interface is changed from USE_BLUETOOTH to ACCESS_BLUETOOTH. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth switch is off. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + * @deprecated since 10 + * @useinstead ohos.bluetooth.ble/ble.GattServer#close + */ + close(): void; + /** + * Sends a notification of a change in a specified local characteristic. + *

This method should be called for every BLE peripheral device that has requested notifications. + * + * @permission ohos.permission.USE_BLUETOOTH + * @param { string } deviceId - Indicates the address of the BLE peripheral device to receive the notification. + * @param { NotifyCharacteristic } notifyCharacteristic - Indicates the local characteristic that has changed. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth switch is off. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.ble/ble.GattServer#notifyCharacteristicChanged + */ + /** + * Sends a notification of a change in a specified local characteristic. + *

This method should be called for every BLE peripheral device that has requested notifications. + * The permission required by this interface is changed from USE_BLUETOOTH to ACCESS_BLUETOOTH. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { string } deviceId - Indicates the address of the BLE peripheral device to receive the notification. + * @param { NotifyCharacteristic } notifyCharacteristic - Indicates the local characteristic that has changed. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth switch is off. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + * @deprecated since 10 + * @useinstead ohos.bluetooth.ble/ble.GattServer#notifyCharacteristicChanged + */ + notifyCharacteristicChanged(deviceId: string, notifyCharacteristic: NotifyCharacteristic): void; + /** + * Sends a response to a specified read or write request to a given BLE peripheral device. + * + * @permission ohos.permission.USE_BLUETOOTH + * @param { ServerResponse } serverResponse - Indicates the response parameters {@link ServerResponse}. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth switch is off. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.ble/ble.GattServer#sendResponse + */ + /** + * Sends a response to a specified read or write request to a given BLE peripheral device. + * The permission required by this interface is changed from USE_BLUETOOTH to ACCESS_BLUETOOTH. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { ServerResponse } serverResponse - Indicates the response parameters {@link ServerResponse}. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth switch is off. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + * @deprecated since 10 + * @useinstead ohos.bluetooth.ble/ble.GattServer#sendResponse + */ + sendResponse(serverResponse: ServerResponse): void; + /** + * Subscribe characteristic read event. + * + * @permission ohos.permission.USE_BLUETOOTH + * @param { 'characteristicRead' } type - Type of the characteristic read event to listen for. + * @param { Callback } callback - Callback used to listen for the characteristic read event. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.ble/ble.GattServer.on#event:characteristicRead + */ + /** + * Subscribe characteristic read event. + * The permission required by this interface is changed from USE_BLUETOOTH to ACCESS_BLUETOOTH. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { 'characteristicRead' } type - Type of the characteristic read event to listen for. + * @param { Callback } callback - Callback used to listen for the characteristic read event. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + * @deprecated since 10 + * @useinstead ohos.bluetooth.ble/ble.GattServer.on#event:characteristicRead + */ + on(type: 'characteristicRead', callback: Callback): void; + /** + * Unsubscribe characteristic read event. + * + * @permission ohos.permission.USE_BLUETOOTH + * @param { 'characteristicRead' } type - Type of the characteristic read event to listen for. + * @param { Callback } callback - Callback used to listen for the characteristic read event. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.ble/ble.GattServer.off#event:characteristicRead + */ + /** + * Unsubscribe characteristic read event. + * The permission required by this interface is changed from USE_BLUETOOTH to ACCESS_BLUETOOTH. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { 'characteristicRead' } type - Type of the characteristic read event to listen for. + * @param { Callback } callback - Callback used to listen for the characteristic read event. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + * @deprecated since 10 + * @useinstead ohos.bluetooth.ble/ble.GattServer.off#event:characteristicRead + */ + off(type: 'characteristicRead', callback?: Callback): void; + /** + * Subscribe characteristic write event. + * + * @permission ohos.permission.USE_BLUETOOTH + * @param { 'characteristicWrite' } type - Type of the characteristic write event to listen for. + * @param { Callback } callback - Callback used to listen for the characteristic write event. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.ble/ble.GattServer.on#event:characteristicWrite + */ + /** + * Subscribe characteristic write event. + * The permission required by this interface is changed from USE_BLUETOOTH to ACCESS_BLUETOOTH. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { 'characteristicWrite' } type - Type of the characteristic write event to listen for. + * @param { Callback } callback - Callback used to listen for the characteristic write event. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + * @deprecated since 10 + * @useinstead ohos.bluetooth.ble/ble.GattServer.on#event:characteristicWrite + */ + on(type: 'characteristicWrite', callback: Callback): void; + /** + * Unsubscribe characteristic write event. + * + * @permission ohos.permission.USE_BLUETOOTH + * @param { 'characteristicWrite' } type - Type of the characteristic write event to listen for. + * @param { Callback } callback - Callback used to listen for the characteristic write event. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.ble/ble.GattServer.off#event:characteristicWrite + */ + /** + * Unsubscribe characteristic write event. + * The permission required by this interface is changed from USE_BLUETOOTH to ACCESS_BLUETOOTH. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { 'characteristicWrite' } type - Type of the characteristic write event to listen for. + * @param { Callback } callback - Callback used to listen for the characteristic write event. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + * @deprecated since 10 + * @useinstead ohos.bluetooth.ble/ble.GattServer.off#event:characteristicWrite + */ + off(type: 'characteristicWrite', callback?: Callback): void; + /** + * Subscribe descriptor read event. + * + * @permission ohos.permission.USE_BLUETOOTH + * @param { 'descriptorRead' } type - Type of the descriptor read event to listen for. + * @param { Callback } callback - Callback used to listen for the descriptor read event. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.ble/ble.GattServer.on#event:descriptorRead + */ + /** + * Subscribe descriptor read event. + * The permission required by this interface is changed from USE_BLUETOOTH to ACCESS_BLUETOOTH. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { 'descriptorRead' } type - Type of the descriptor read event to listen for. + * @param { Callback } callback - Callback used to listen for the descriptor read event. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + * @deprecated since 10 + * @useinstead ohos.bluetooth.ble/ble.GattServer.on#event:descriptorRead + */ + on(type: 'descriptorRead', callback: Callback): void; + /** + * Unsubscribe descriptor read event. + * + * @permission ohos.permission.USE_BLUETOOTH + * @param { 'descriptorRead' } type - Type of the descriptor read event to listen for. + * @param { Callback } callback - Callback used to listen for the descriptor read event. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.ble/ble.GattServer.off#event:descriptorRead + */ + /** + * Unsubscribe descriptor read event. + * The permission required by this interface is changed from USE_BLUETOOTH to ACCESS_BLUETOOTH. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { 'descriptorRead' } type - Type of the descriptor read event to listen for. + * @param { Callback } callback - Callback used to listen for the descriptor read event. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + * @deprecated since 10 + * @useinstead ohos.bluetooth.ble/ble.GattServer.off#event:descriptorRead + */ + off(type: 'descriptorRead', callback?: Callback): void; + /** + * Subscribe descriptor write event. + * + * @permission ohos.permission.USE_BLUETOOTH + * @param { 'descriptorWrite' } type - Type of the descriptor write event to listen for. + * @param { Callback } callback - Callback used to listen for the descriptor write event. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.ble/ble.GattServer.on#event:descriptorWrite + */ + /** + * Subscribe descriptor write event. + * The permission required by this interface is changed from USE_BLUETOOTH to ACCESS_BLUETOOTH. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { 'descriptorWrite' } type - Type of the descriptor write event to listen for. + * @param { Callback } callback - Callback used to listen for the descriptor write event. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + * @deprecated since 10 + * @useinstead ohos.bluetooth.ble/ble.GattServer.on#event:descriptorWrite + */ + on(type: 'descriptorWrite', callback: Callback): void; + /** + * Unsubscribe descriptor write event. + * + * @permission ohos.permission.USE_BLUETOOTH + * @param { 'descriptorWrite' } type - Type of the descriptor write event to listen for. + * @param { Callback } callback - Callback used to listen for the descriptor write event. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.ble/ble.GattServer.off#event:descriptorWrite + */ + /** + * Unsubscribe descriptor write event. + * The permission required by this interface is changed from USE_BLUETOOTH to ACCESS_BLUETOOTH. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { 'descriptorWrite' } type - Type of the descriptor write event to listen for. + * @param { Callback } callback - Callback used to listen for the descriptor write event. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + * @deprecated since 10 + * @useinstead ohos.bluetooth.ble/ble.GattServer.off#event:descriptorWrite + */ + off(type: 'descriptorWrite', callback?: Callback): void; + /** + * Subscribe server connection state changed event. + * + * @permission ohos.permission.USE_BLUETOOTH + * @param { 'connectStateChange' } type - Type of the connection state changed event to listen for. + * @param { Callback } callback - Callback used to listen for the connection state changed event. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.ble/ble.GattServer.on#event:connectionStateChange + */ + /** + * Subscribe server connection state changed event. + * The permission required by this interface is changed from USE_BLUETOOTH to ACCESS_BLUETOOTH. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { 'connectStateChange' } type - Type of the connection state changed event to listen for. + * @param { Callback } callback - Callback used to listen for the connection state changed event. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + * @deprecated since 10 + * @useinstead ohos.bluetooth.ble/ble.GattServer.on#event:connectionStateChange + */ + on(type: 'connectStateChange', callback: Callback): void; + /** + * Unsubscribe server connection state changed event. + * + * @permission ohos.permission.USE_BLUETOOTH + * @param { 'connectStateChange' } type - Type of the connection state changed event to listen for. + * @param { Callback } callback - Callback used to listen for the connection state changed event. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.ble/ble.GattServer.off#event:connectionStateChange + */ + /** + * Unsubscribe server connection state changed event. + * The permission required by this interface is changed from USE_BLUETOOTH to ACCESS_BLUETOOTH. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { 'connectStateChange' } type - Type of the connection state changed event to listen for. + * @param { Callback } callback - Callback used to listen for the connection state changed event. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + * @deprecated since 10 + * @useinstead ohos.bluetooth.ble/ble.GattServer.off#event:connectionStateChange + */ + off(type: 'connectStateChange', callback?: Callback): void; + } + /** + * Manages GATT client. Before calling an Gatt client method, you must use {@link createGattClientDevice} to create an GattClientDevice instance. + * + * @typedef GattClientDevice + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.ble/ble.GattClientDevice + */ + interface GattClientDevice { + /** + * Connects to a BLE peripheral device. + *

The 'BLEConnectionStateChange' event is subscribed to return the connection state. + * + * @permission ohos.permission.USE_BLUETOOTH + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth switch is off. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.ble/ble.GattClientDevice#connect + */ + /** + * Connects to a BLE peripheral device. + *

The 'BLEConnectionStateChange' event is subscribed to return the connection state. + * The permission required by this interface is changed from USE_BLUETOOTH to ACCESS_BLUETOOTH. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth switch is off. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + * @deprecated since 10 + * @useinstead ohos.bluetooth.ble/ble.GattClientDevice#connect + */ + connect(): void; + /** + * Disconnects from or stops an ongoing connection to a BLE peripheral device. + * + * @permission ohos.permission.USE_BLUETOOTH + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth switch is off. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.ble/ble.GattClientDevice#disconnect + */ + /** + * Disconnects from or stops an ongoing connection to a BLE peripheral device. + * The permission required by this interface is changed from USE_BLUETOOTH to ACCESS_BLUETOOTH. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth switch is off. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + * @deprecated since 10 + * @useinstead ohos.bluetooth.ble/ble.GattClientDevice#disconnect + */ + disconnect(): void; + /** + * Disables a BLE peripheral device. + *

This method unregisters the device and clears the registered callbacks and handles. + * + * @permission ohos.permission.USE_BLUETOOTH + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth switch is off. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.ble/ble.GattClientDevice#close + */ + /** + * Disables a BLE peripheral device. + *

This method unregisters the device and clears the registered callbacks and handles. + * The permission required by this interface is changed from USE_BLUETOOTH to ACCESS_BLUETOOTH. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900003 - Bluetooth switch is off. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + * @deprecated since 10 + * @useinstead ohos.bluetooth.ble/ble.GattClientDevice#close + */ + close(): void; + /** + * Obtains the name of BLE peripheral device. + * + * @permission ohos.permission.USE_BLUETOOTH + * @param { AsyncCallback } callback - Callback used to obtain the device name. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.ble/ble.GattClientDevice#getDeviceName + */ + /** + * Obtains the name of BLE peripheral device. + * The permission required by this interface is changed from USE_BLUETOOTH to ACCESS_BLUETOOTH. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { AsyncCallback } callback - Callback used to obtain the device name. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + * @deprecated since 10 + * @useinstead ohos.bluetooth.ble/ble.GattClientDevice#getDeviceName + */ + getDeviceName(callback: AsyncCallback): void; + /** + * Obtains the name of BLE peripheral device. + * + * @permission ohos.permission.USE_BLUETOOTH + * @returns { Promise } Returns a string representation of the name if obtained; + * returns {@code null} if the name fails to be obtained or the name does not exist. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.ble/ble.GattClientDevice#getDeviceName + */ + /** + * Obtains the name of BLE peripheral device. + * The permission required by this interface is changed from USE_BLUETOOTH to ACCESS_BLUETOOTH. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @returns { Promise } Returns a string representation of the name if obtained; + * returns {@code null} if the name fails to be obtained or the name does not exist. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + * @deprecated since 10 + * @useinstead ohos.bluetooth.ble/ble.GattClientDevice#getDeviceName + */ + getDeviceName(): Promise; + /** + * Starts discovering services. + * + * @permission ohos.permission.USE_BLUETOOTH + * @param { AsyncCallback> } callback - Callback used to catch the services. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.ble/ble.GattClientDevice#getServices + */ + /** + * Starts discovering services. + * The permission required by this interface is changed from USE_BLUETOOTH to ACCESS_BLUETOOTH. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { AsyncCallback> } callback - Callback used to catch the services. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + * @deprecated since 10 + * @useinstead ohos.bluetooth.ble/ble.GattClientDevice#getServices + */ + getServices(callback: AsyncCallback>): void; + /** + * Starts discovering services. + * + * @permission ohos.permission.USE_BLUETOOTH + * @returns { Promise> } Returns the list of services {@link GattService} of the BLE peripheral device. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.ble/ble.GattClientDevice#getServices + */ + /** + * Starts discovering services. + * The permission required by this interface is changed from USE_BLUETOOTH to ACCESS_BLUETOOTH. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @returns { Promise> } Returns the list of services {@link GattService} of the BLE peripheral device. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + * @deprecated since 10 + * @useinstead ohos.bluetooth.ble/ble.GattClientDevice#getServices + */ + getServices(): Promise>; + /** + * Reads the characteristic of a BLE peripheral device. + * + * @permission ohos.permission.USE_BLUETOOTH + * @param { BLECharacteristic } characteristic - Indicates the characteristic to read. + * @param { AsyncCallback } callback - Callback invoked to return the characteristic value read. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2901000 - Read forbidden. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.ble/ble.GattClientDevice#readCharacteristicValue + */ + /** + * Reads the characteristic of a BLE peripheral device. + * The permission required by this interface is changed from USE_BLUETOOTH to ACCESS_BLUETOOTH. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { BLECharacteristic } characteristic - Indicates the characteristic to read. + * @param { AsyncCallback } callback - Callback invoked to return the characteristic value read. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2901000 - Read forbidden. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + * @deprecated since 10 + * @useinstead ohos.bluetooth.ble/ble.GattClientDevice#readCharacteristicValue + */ + readCharacteristicValue(characteristic: BLECharacteristic, callback: AsyncCallback): void; + /** + * Reads the characteristic of a BLE peripheral device. + * + * @permission ohos.permission.USE_BLUETOOTH + * @param { BLECharacteristic } characteristic - Indicates the characteristic to read. + * @returns { Promise } - Promise used to return the characteristic value read. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2901000 - Read forbidden. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.ble/ble.GattClientDevice#readCharacteristicValue + */ + /** + * Reads the characteristic of a BLE peripheral device. + * The permission required by this interface is changed from USE_BLUETOOTH to ACCESS_BLUETOOTH. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { BLECharacteristic } characteristic - Indicates the characteristic to read. + * @returns { Promise } - Promise used to return the characteristic value read. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2901000 - Read forbidden. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + * @deprecated since 10 + * @useinstead ohos.bluetooth.ble/ble.GattClientDevice#readCharacteristicValue + */ + readCharacteristicValue(characteristic: BLECharacteristic): Promise; + /** + * Reads the descriptor of a BLE peripheral device. + * + * @permission ohos.permission.USE_BLUETOOTH + * @param { BLEDescriptor } descriptor - Indicates the descriptor to read. + * @param { AsyncCallback } callback - Callback invoked to return the descriptor read. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2901000 - Read forbidden. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.ble/ble.GattClientDevice#readDescriptorValue + */ + /** + * Reads the descriptor of a BLE peripheral device. + * The permission required by this interface is changed from USE_BLUETOOTH to ACCESS_BLUETOOTH. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { BLEDescriptor } descriptor - Indicates the descriptor to read. + * @param { AsyncCallback } callback - Callback invoked to return the descriptor read. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2901000 - Read forbidden. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + * @deprecated since 10 + * @useinstead ohos.bluetooth.ble/ble.GattClientDevice#readDescriptorValue + */ + readDescriptorValue(descriptor: BLEDescriptor, callback: AsyncCallback): void; + /** + * Reads the descriptor of a BLE peripheral device. + * + * @permission ohos.permission.USE_BLUETOOTH + * @param { BLEDescriptor } descriptor - Indicates the descriptor to read. + * @returns { Promise } - Promise used to return the descriptor read. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2901000 - Read forbidden. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.ble/ble.GattClientDevice#readDescriptorValue + */ + /** + * Reads the descriptor of a BLE peripheral device. + * The permission required by this interface is changed from USE_BLUETOOTH to ACCESS_BLUETOOTH. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { BLEDescriptor } descriptor - Indicates the descriptor to read. + * @returns { Promise } - Promise used to return the descriptor read. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2901000 - Read forbidden. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + * @deprecated since 10 + * @useinstead ohos.bluetooth.ble/ble.GattClientDevice#readDescriptorValue + */ + readDescriptorValue(descriptor: BLEDescriptor): Promise; + /** + * Writes the characteristic of a BLE peripheral device. + * + * @permission ohos.permission.USE_BLUETOOTH + * @param { BLECharacteristic } characteristic - Indicates the characteristic to write. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2901001 - Write forbidden. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.ble/ble.GattClientDevice#writeCharacteristicValue + */ + /** + * Writes the characteristic of a BLE peripheral device. + * The permission required by this interface is changed from USE_BLUETOOTH to ACCESS_BLUETOOTH. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { BLECharacteristic } characteristic - Indicates the characteristic to write. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2901001 - Write forbidden. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + * @deprecated since 10 + * @useinstead ohos.bluetooth.ble/ble.GattClientDevice#writeCharacteristicValue + */ + writeCharacteristicValue(characteristic: BLECharacteristic): void; + /** + * Writes the descriptor of a BLE peripheral device. + * + * @permission ohos.permission.USE_BLUETOOTH + * @param { BLEDescriptor } descriptor - Indicates the descriptor to write. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2901001 - Write forbidden. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.ble/ble.GattClientDevice#writeDescriptorValue + */ + /** + * Writes the descriptor of a BLE peripheral device. + * The permission required by this interface is changed from USE_BLUETOOTH to ACCESS_BLUETOOTH. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { BLEDescriptor } descriptor - Indicates the descriptor to write. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2901001 - Write forbidden. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + * @deprecated since 10 + * @useinstead ohos.bluetooth.ble/ble.GattClientDevice#writeDescriptorValue + */ + writeDescriptorValue(descriptor: BLEDescriptor): void; + /** + * Get the RSSI value of this BLE peripheral device. + * + * @permission ohos.permission.USE_BLUETOOTH + * @param { AsyncCallback } callback - Callback invoked to return the RSSI, in dBm. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.ble/ble.GattClientDevice#getRssiValue + */ + /** + * Get the RSSI value of this BLE peripheral device. + * The permission required by this interface is changed from USE_BLUETOOTH to ACCESS_BLUETOOTH. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { AsyncCallback } callback - Callback invoked to return the RSSI, in dBm. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + * @deprecated since 10 + * @useinstead ohos.bluetooth.ble/ble.GattClientDevice#getRssiValue + */ + getRssiValue(callback: AsyncCallback): void; + /** + * Get the RSSI value of this BLE peripheral device. + * + * @permission ohos.permission.USE_BLUETOOTH + * @returns { Promise } Returns the RSSI value. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.ble/ble.GattClientDevice#getRssiValue + */ + /** + * Get the RSSI value of this BLE peripheral device. + * The permission required by this interface is changed from USE_BLUETOOTH to ACCESS_BLUETOOTH. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @returns { Promise } Returns the RSSI value. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + * @deprecated since 10 + * @useinstead ohos.bluetooth.ble/ble.GattClientDevice#getRssiValue + */ + getRssiValue(): Promise; + /** + * Set the mtu size of a BLE peripheral device. + * + * @permission ohos.permission.USE_BLUETOOTH + * @param { number } mtu - The maximum transmission unit. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.ble/ble.GattClientDevice#setBLEMtuSize + */ + /** + * Set the mtu size of a BLE peripheral device. + * The permission required by this interface is changed from USE_BLUETOOTH to ACCESS_BLUETOOTH. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { number } mtu - The maximum transmission unit. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + * @deprecated since 10 + * @useinstead ohos.bluetooth.ble/ble.GattClientDevice#setBLEMtuSize + */ + setBLEMtuSize(mtu: number): void; + /** + * Enables or disables notification of a characteristic when value changed. + * + * @permission ohos.permission.USE_BLUETOOTH + * @param { BLECharacteristic } characteristic - BLE characteristic to listen for. + * @param { boolean } enable - Specifies whether to enable notification of the characteristic. The value {@code true} indicates + * that notification is enabled, and the value {@code false} indicates that notification is disabled. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.ble/ble.GattClientDevice#setCharacteristicChangeNotification + */ + /** + * Enables or disables notification of a characteristic when value changed. + * The permission required by this interface is changed from USE_BLUETOOTH to ACCESS_BLUETOOTH. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { BLECharacteristic } characteristic - BLE characteristic to listen for. + * @param { boolean } enable - Specifies whether to enable notification of the characteristic. The value {@code true} indicates + * that notification is enabled, and the value {@code false} indicates that notification is disabled. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 2900001 - Service stopped. + * @throws { BusinessError } 2900099 - Operation failed. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + * @deprecated since 10 + * @useinstead ohos.bluetooth.ble/ble.GattClientDevice#setCharacteristicChangeNotification + */ + setNotifyCharacteristicChanged(characteristic: BLECharacteristic, enable: boolean): void; + /** + * Subscribe characteristic value changed event. + * + * @permission ohos.permission.USE_BLUETOOTH + * @param { 'BLECharacteristicChange' } type - Type of the characteristic value changed event to listen for. + * @param { Callback } callback - Callback used to listen for the characteristic value changed event. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.ble/ble.GattClientDevice.on#event:BLECharacteristicChange + */ + /** + * Subscribe characteristic value changed event. + * The permission required by this interface is changed from USE_BLUETOOTH to ACCESS_BLUETOOTH. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { 'BLECharacteristicChange' } type - Type of the characteristic value changed event to listen for. + * @param { Callback } callback - Callback used to listen for the characteristic value changed event. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + * @deprecated since 10 + * @useinstead ohos.bluetooth.ble/ble.GattClientDevice.on#event:BLECharacteristicChange + */ + on(type: 'BLECharacteristicChange', callback: Callback): void; + /** + * Unsubscribe characteristic value changed event. + * + * @permission ohos.permission.USE_BLUETOOTH + * @param { 'BLECharacteristicChange' } type - Type of the characteristic value changed event to listen for. + * @param { Callback } callback - Callback used to listen for the characteristic value changed event. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.ble/ble.GattClientDevice.off#event:BLECharacteristicChange + */ + /** + * Unsubscribe characteristic value changed event. + * The permission required by this interface is changed from USE_BLUETOOTH to ACCESS_BLUETOOTH. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { 'BLECharacteristicChange' } type - Type of the characteristic value changed event to listen for. + * @param { Callback } callback - Callback used to listen for the characteristic value changed event. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + * @deprecated since 10 + * @useinstead ohos.bluetooth.ble/ble.GattClientDevice.off#event:BLECharacteristicChange + */ + off(type: 'BLECharacteristicChange', callback?: Callback): void; + /** + * Subscribe client connection state changed event. + * + * @permission ohos.permission.USE_BLUETOOTH + * @param { 'BLEConnectionStateChange' } type - Type of the connection state changed event to listen for. + * @param { Callback } callback - Callback used to listen for the connection state changed event. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.ble/ble.GattClientDevice.on#event:BLEConnectionStateChange + */ + /** + * Subscribe client connection state changed event. + * The permission required by this interface is changed from USE_BLUETOOTH to ACCESS_BLUETOOTH. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { 'BLEConnectionStateChange' } type - Type of the connection state changed event to listen for. + * @param { Callback } callback - Callback used to listen for the connection state changed event. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + * @deprecated since 10 + * @useinstead ohos.bluetooth.ble/ble.GattClientDevice.on#event:BLEConnectionStateChange + */ + on(type: 'BLEConnectionStateChange', callback: Callback): void; + /** + * Unsubscribe client connection state changed event. + * + * @permission ohos.permission.USE_BLUETOOTH + * @param { 'BLEConnectionStateChange' } type - Type of the connection state changed event to listen for. + * @param { Callback } callback - Callback used to listen for the connection state changed event. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.ble/ble.GattClientDevice.off#event:BLEConnectionStateChange + */ + /** + * Unsubscribe client connection state changed event. + * The permission required by this interface is changed from USE_BLUETOOTH to ACCESS_BLUETOOTH. + * + * @permission ohos.permission.ACCESS_BLUETOOTH + * @param { 'BLEConnectionStateChange' } type - Type of the connection state changed event to listen for. + * @param { Callback } callback - Callback used to listen for the connection state changed event. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 10 + * @deprecated since 10 + * @useinstead ohos.bluetooth.ble/ble.GattClientDevice.off#event:BLEConnectionStateChange + */ + off(type: 'BLEConnectionStateChange', callback?: Callback): void; + } + /** + * Describes the Gatt service. + * + * @typedef GattService + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.ble/ble.GattService + */ + interface GattService { + /** + * The UUID of a GattService instance + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.ble/ble.GattService#serviceUuid + */ + serviceUuid: string; + /** + * Indicates whether the GattService instance is primary or secondary. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.ble/ble.GattService#isPrimary + */ + isPrimary: boolean; + /** + * The {@link BLECharacteristic} list belongs to this GattService instance + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.ble/ble.GattService#characteristics + */ + characteristics: Array; + /** + * The list of GATT services contained in the service + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.ble/ble.GattService#includeServices + */ + includeServices?: Array; + } + /** + * Describes the Gatt characteristic. + * + * @typedef BLECharacteristic + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.ble/ble.BLECharacteristic + */ + interface BLECharacteristic { + /** + * The UUID of the {@link GattService} instance to which the characteristic belongs + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.ble/ble.BLECharacteristic#serviceUuid + */ + serviceUuid: string; + /** + * The UUID of a BLECharacteristic instance + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.ble/ble.BLECharacteristic#characteristicUuid + */ + characteristicUuid: string; + /** + * The value of a BLECharacteristic instance + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.ble/ble.BLECharacteristic#characteristicValue + */ + characteristicValue: ArrayBuffer; + /** + * The list of {@link BLEDescriptor} contained in the characteristic + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.ble/ble.BLECharacteristic#descriptors + */ + descriptors: Array; + } + /** + * Describes the Gatt descriptor. + * + * @typedef BLEDescriptor + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.ble/ble.BLEDescriptor + */ + interface BLEDescriptor { + /** + * The UUID of the {@link GattService} instance to which the descriptor belongs + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.ble/ble.BLEDescriptor#serviceUuid + */ + serviceUuid: string; + /** + * The UUID of the {@link BLECharacteristic} instance to which the descriptor belongs + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.ble/ble.BLEDescriptor#characteristicUuid + */ + characteristicUuid: string; + /** + * The UUID of the BLEDescriptor instance + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.ble/ble.BLEDescriptor#descriptorUuid + */ + descriptorUuid: string; + /** + * The value of the BLEDescriptor instance + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.ble/ble.BLEDescriptor#descriptorValue + */ + descriptorValue: ArrayBuffer; + } + /** + * Describes the value of the indication or notification sent by the Gatt server. + * + * @typedef NotifyCharacteristic + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.ble/ble.NotifyCharacteristic + */ + interface NotifyCharacteristic { + /** + * The UUID of the {@link GattService} instance to which the characteristic belongs + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.ble/ble.NotifyCharacteristic#serviceUuid + */ + serviceUuid: string; + /** + * The UUID of a NotifyCharacteristic instance + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.ble/ble.NotifyCharacteristic#characteristicUuid + */ + characteristicUuid: string; + /** + * The value of a NotifyCharacteristic instance + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.ble/ble.NotifyCharacteristic#characteristicValue + */ + characteristicValue: ArrayBuffer; + /** + * Specifies whether to request confirmation from the BLE peripheral device (indication) or + * send a notification. Value {@code true} indicates the former and {@code false} indicates the latter. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.ble/ble.NotifyCharacteristic#confirm + */ + confirm: boolean; + } + /** + * Describes the parameters of the Gatt client's characteristic read request. + * + * @typedef CharacteristicReadRequest + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.ble/ble.CharacteristicReadRequest + */ + interface CharacteristicReadRequest { + /** + * Indicates the address of the client that initiates the read request + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.ble/ble.CharacteristicReadRequest#deviceId + */ + deviceId: string; + /** + * The Id of the read request + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.ble/ble.CharacteristicReadRequest#transId + */ + transId: number; + /** + * Indicates the byte offset of the start position for reading characteristic value + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.ble/ble.CharacteristicReadRequest#offset + */ + offset: number; + /** + * The UUID of a CharacteristicReadRequest instance + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.ble/ble.CharacteristicReadRequest#characteristicUuid + */ + characteristicUuid: string; + /** + * The UUID of the service to which the characteristic belongs + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.ble/ble.CharacteristicReadRequest#serviceUuid + */ + serviceUuid: string; + } + /** + * Describes the parameters of the of the Gatt client's characteristic write request. + * + * @typedef CharacteristicWriteRequest + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.ble/ble.CharacteristicWriteRequest + */ + interface CharacteristicWriteRequest { + /** + * Indicates the address of the client that initiates the write request + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.ble/ble.CharacteristicWriteRequest#deviceId + */ + deviceId: string; + /** + * The Id of the write request + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.ble/ble.CharacteristicWriteRequest#transId + */ + transId: number; + /** + * Indicates the byte offset of the start position for writing characteristic value + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.ble/ble.CharacteristicWriteRequest#offset + */ + offset: number; + /** + * Whether this request should be pending for later operation + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.ble/ble.CharacteristicWriteRequest#isPrepared + */ + isPrep: boolean; + /** + * Whether the remote client need a response + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.ble/ble.CharacteristicWriteRequest#needRsp + */ + needRsp: boolean; + /** + * Indicates the value to be written + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.ble/ble.CharacteristicWriteRequest#value + */ + value: ArrayBuffer; + /** + * The UUID of a CharacteristicWriteRequest instance + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.ble/ble.CharacteristicWriteRequest#characteristicUuid + */ + characteristicUuid: string; + /** + * The UUID of the service to which the characteristic belongs + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.ble/ble.CharacteristicWriteRequest#serviceUuid + */ + serviceUuid: string; + } + /** + * Describes the parameters of the Gatt client's descriptor read request. + * + * @typedef DescriptorReadRequest + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.ble/ble.DescriptorReadRequest + */ + interface DescriptorReadRequest { + /** + * Indicates the address of the client that initiates the read request + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.ble/ble.DescriptorReadRequest#deviceId + */ + deviceId: string; + /** + * The Id of the read request + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.ble/ble.DescriptorReadRequest#transId + */ + transId: number; + /** + * Indicates the byte offset of the start position for reading characteristic value + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.ble/ble.DescriptorReadRequest#offset + */ + offset: number; + /** + * The UUID of a DescriptorReadRequest instance + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.ble/ble.DescriptorReadRequest#descriptorUuid + */ + descriptorUuid: string; + /** + * The UUID of the characteristic to which the descriptor belongs + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.ble/ble.DescriptorReadRequest#characteristicUuid + */ + characteristicUuid: string; + /** + * The UUID of the service to which the descriptor belongs + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.ble/ble.DescriptorReadRequest#serviceUuid + */ + serviceUuid: string; + } + /** + * Describes the parameters of the Gatt client's characteristic write request. + * + * @typedef DescriptorWriteRequest + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.ble/ble.DescriptorWriteRequest + */ + interface DescriptorWriteRequest { + /** + * Indicates the address of the client that initiates the write request + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.ble/ble.DescriptorWriteRequest#deviceId + */ + deviceId: string; + /** + * The Id of the write request + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.ble/ble.DescriptorWriteRequest#transId + */ + transId: number; + /** + * Indicates the byte offset of the start position for writing characteristic value + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.ble/ble.DescriptorWriteRequest#offset + */ + offset: number; + /** + * Whether this request should be pending for later operation + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.ble/ble.DescriptorWriteRequest#isPrepared + */ + isPrep: boolean; + /** + * Whether the remote client need a response + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.ble/ble.DescriptorWriteRequest#needRsp + */ + needRsp: boolean; + /** + * Indicates the value to be written + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.ble/ble.DescriptorWriteRequest#value + */ + value: ArrayBuffer; + /** + * The UUID of a DescriptorWriteRequest instance + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.ble/ble.DescriptorWriteRequest#descriptorUuid + */ + descriptorUuid: string; + /** + * The UUID of the characteristic to which the descriptor belongs + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.ble/ble.DescriptorWriteRequest#characteristicUuid + */ + characteristicUuid: string; + /** + * The UUID of the service to which the descriptor belongs + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.ble/ble.DescriptorWriteRequest#serviceUuid + */ + serviceUuid: string; + } + /** + * Describes the parameters of a response send by the server to a specified read or write request. + * + * @typedef ServerResponse + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.ble/ble.ServerResponse + */ + interface ServerResponse { + /** + * Indicates the address of the client to which to send the response + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.ble/ble.ServerResponse#deviceId + */ + deviceId: string; + /** + * The Id of the write request + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.ble/ble.ServerResponse#transId + */ + transId: number; + /** + * Indicates the status of the read or write request, set this parameter to '0' in normal cases + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.ble/ble.ServerResponse#status + */ + status: number; + /** + * Indicates the byte offset of the start position for reading or writing operation + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.ble/ble.ServerResponse#offset + */ + offset: number; + /** + * Indicates the value to be sent + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.ble/ble.ServerResponse#value + */ + value: ArrayBuffer; + } + /** + * Describes the Gatt profile connection state. + * + * @typedef BLEConnectChangedState + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.ble/ble.BLEConnectionChangeState + */ + interface BLEConnectChangedState { + /** + * Indicates the peer device address + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.ble/ble.BLEConnectionChangeState#deviceId + */ + deviceId: string; + /** + * Connection state of the Gatt profile + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.ble/ble.BLEConnectionChangeState#state + */ + state: ProfileConnectionState; + } + /** + * Describes the contents of the scan results. + * + * @typedef ScanResult + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.ble/ble.ScanResult + */ + interface ScanResult { + /** + * Address of the scanned device + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.ble/ble.ScanResult#deviceId + */ + deviceId: string; + /** + * RSSI of the remote device + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.ble/ble.ScanResult#rssi + */ + rssi: number; + /** + * The raw data of broadcast packet + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.ble/ble.ScanResult#data + */ + data: ArrayBuffer; + } + /** + * Describes the settings for BLE advertising. + * + * @typedef AdvertiseSetting + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.ble/ble.AdvertiseSetting + */ + interface AdvertiseSetting { + /** + * Minimum slot value for the advertising interval, which is {@code 32} (20 ms) + * Maximum slot value for the advertising interval, which is {@code 16777215} (10485.759375s) + * Default slot value for the advertising interval, which is {@code 1600} (1s) + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.ble/ble.AdvertiseSetting#interval + */ + interval?: number; + /** + * Minimum transmission power level for advertising, which is {@code -127} + * Maximum transmission power level for advertising, which is {@code 1} + * Default transmission power level for advertising, which is {@code -7} + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.ble/ble.AdvertiseSetting#txPower + */ + txPower?: number; + /** + * Indicates whether the BLE is connectable, default is {@code true} + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.ble/ble.AdvertiseSetting#connectable + */ + connectable?: boolean; + } + /** + * Describes the advertising data. + * + * @typedef AdvertiseData + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.ble/ble.AdvertiseData + */ + interface AdvertiseData { + /** + * The specified service UUID list to this advertisement + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.ble/ble.AdvertiseData#serviceUuids + */ + serviceUuids: Array; + /** + * The specified manufacturer data list to this advertisement + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.ble/ble.AdvertiseData#manufactureData + */ + manufactureData: Array; + /** + * The specified service data list to this advertisement + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.ble/ble.AdvertiseData#serviceData + */ + serviceData: Array; + } + /** + * Describes the manufacturer data. + * + * @typedef ManufactureData + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.ble/ble.ManufactureData + */ + interface ManufactureData { + /** + * Indicates the manufacturer ID assigned by Bluetooth SIG + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.ble/ble.ManufactureData#manufactureId + */ + manufactureId: number; + /** + * Indicates the manufacturer data to add + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.ble/ble.ManufactureData#manufactureValue + */ + manufactureValue: ArrayBuffer; + } + /** + * Describes the service data. + * + * @typedef ServiceData + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.ble/ble.ServiceData + */ + interface ServiceData { + /** + * Indicates the UUID of the service data to add + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.ble/ble.ServiceData#serviceUuid + */ + serviceUuid: string; + /** + * Indicates the service data to add + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.ble/ble.ServiceData#serviceValue + */ + serviceValue: ArrayBuffer; + } + /** + * Describes the criteria for filtering scanning results can be set. + * + * @typedef ScanFilter + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.ble/ble.ScanFilter + */ + interface ScanFilter { + /** + * The address of a BLE peripheral device + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.ble/ble.ScanFilter#deviceId + */ + deviceId?: string; + /** + * The name of a BLE peripheral device + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.ble/ble.ScanFilter#name + */ + name?: string; + /** + * The service UUID of a BLE peripheral device + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.ble/ble.ScanFilter#serviceUuid + */ + serviceUuid?: string; + /** + * Service UUID mask. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.ble/ble.ScanFilter#serviceUuidMask + */ + serviceUuidMask?: string; + /** + * Service solicitation UUID. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.ble/ble.ScanFilter#serviceSolicitationUuid + */ + serviceSolicitationUuid?: string; + /** + * Service solicitation UUID mask. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.ble/ble.ScanFilter#serviceSolicitationUuidMask + */ + serviceSolicitationUuidMask?: string; + /** + * Service data. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.ble/ble.ScanFilter#serviceData + */ + serviceData?: ArrayBuffer; + /** + * Service data mask. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.ble/ble.ScanFilter#serviceDataMask + */ + serviceDataMask?: ArrayBuffer; + /** + * Manufacture id. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.ble/ble.ScanFilter#manufactureId + */ + manufactureId?: number; + /** + * Manufacture data. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.ble/ble.ScanFilter#manufactureData + */ + manufactureData?: ArrayBuffer; + /** + * Manufacture data mask. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.ble/ble.ScanFilter#manufactureDataMask + */ + manufactureDataMask?: ArrayBuffer; + } + /** + * Describes the parameters for scan. + * + * @typedef ScanOptions + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.ble/ble.ScanOptions + */ + interface ScanOptions { + /** + * Time of delay for reporting the scan result + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.ble/ble.ScanOptions#interval + */ + interval?: number; + /** + * Bluetooth LE scan mode + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.ble/ble.ScanOptions#dutyMode + */ + dutyMode?: ScanDuty; + /** + * Match mode for Bluetooth LE scan filters hardware match + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.ble/ble.ScanOptions#matchMode + */ + matchMode?: MatchMode; + } + /** + * Describes the spp parameters. + * + * @typedef SppOption + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.socket/socket.SppOptions + */ + interface SppOption { + /** + * Indicates the UUID in the SDP record. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.socket/socket.SppOptions#uuid + */ + uuid: string; + /** + * Indicates secure channel or not + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.socket/socket.SppOptions#secure + */ + secure: boolean; + /** + * Spp link type {@link SppType} + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.socket/socket.SppOptions#type + */ + type: SppType; + } + /** + * Describes the bond key param. + * + * @typedef PinRequiredParam + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.connection/connection.PinRequiredParam + */ + interface PinRequiredParam { + /** + * ID of the device to pair. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.connection/connection.PinRequiredParam#deviceId + */ + deviceId: string; + /** + * Key for the device pairing. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.connection/connection.PinRequiredParam#pinCode + */ + pinCode: string; + } + /** + * Describes the class of a bluetooth device. + * + * @typedef DeviceClass + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.connection/connection.DeviceClass + */ + interface DeviceClass { + /** + * Major classes of Bluetooth devices. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.connection/connection.DeviceClass#majorClass + */ + majorClass: MajorClass; + /** + * Major and minor classes of Bluetooth devices. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.connection/connection.DeviceClass#majorMinorClass + */ + majorMinorClass: MajorMinorClass; + /** + * Class of the device. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.connection/connection.DeviceClass#classOfDevice + */ + classOfDevice: number; + } + /** + * Describes the class of a bluetooth device. + * + * @typedef BondStateParam + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.connection/connection.BondStateParam + */ + interface BondStateParam { + /** + * Address of a Bluetooth device. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.connection/connection.BondStateParam#deviceId + */ + deviceId: string; + /** + * Profile connection state of the device. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.connection/connection.BondStateParam#state + */ + state: BondState; + } + /** + * Profile state change parameters. + * + * @typedef StateChangeParam + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.baseProfile/baseProfile.StateChangeParam + */ + interface StateChangeParam { + /** + * The address of device + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.baseProfile/baseProfile.StateChangeParam#deviceId + */ + deviceId: string; + /** + * Profile state value + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.baseProfile/baseProfile.StateChangeParam#state + */ + state: ProfileConnectionState; + } + /** + * The enum of scan duty. + * + * @enum { number } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.ble/ble.ScanDuty + */ + enum ScanDuty { + /** + * low power mode + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.ble/ble.ScanDuty#SCAN_MODE_LOW_POWER + */ + SCAN_MODE_LOW_POWER = 0, + /** + * balanced power mode + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.ble/ble.ScanDuty#SCAN_MODE_BALANCED + */ + SCAN_MODE_BALANCED = 1, + /** + * Scan using highest duty cycle + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.ble/ble.ScanDuty#SCAN_MODE_LOW_LATENCY + */ + SCAN_MODE_LOW_LATENCY = 2 + } + /** + * The enum of BLE match mode. + * + * @enum { number } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.ble/ble.MatchMode + */ + enum MatchMode { + /** + * aggressive mode + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.ble/ble.MatchMode#MATCH_MODE_AGGRESSIVE + */ + MATCH_MODE_AGGRESSIVE = 1, + /** + * sticky mode + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.ble/ble.MatchMode#MATCH_MODE_STICKY + */ + MATCH_MODE_STICKY = 2 + } + /** + * The enum of profile connection state. + * + * @enum { number } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.constant/constant.ProfileConnectionState + */ + enum ProfileConnectionState { + /** + * the current profile is disconnected + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.constant/constant.ProfileConnectionState#STATE_DISCONNECTED + */ + STATE_DISCONNECTED = 0, + /** + * the current profile is being connected + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.constant/constant.ProfileConnectionState#STATE_CONNECTING + */ + STATE_CONNECTING = 1, + /** + * the current profile is connected + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.constant/constant.ProfileConnectionState#STATE_CONNECTED + */ + STATE_CONNECTED = 2, + /** + * the current profile is being disconnected + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.constant/constant.ProfileConnectionState#STATE_DISCONNECTING + */ + STATE_DISCONNECTING = 3 + } + /** + * The enum of bluetooth state. + * + * @enum { number } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.access/access.BluetoothState + */ + enum BluetoothState { + /** + * Indicates the local Bluetooth is off + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.access/access.BluetoothState#STATE_OFF + */ + STATE_OFF = 0, + /** + * Indicates the local Bluetooth is turning on + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.access/access.BluetoothState#STATE_TURNING_ON + */ + STATE_TURNING_ON = 1, + /** + * Indicates the local Bluetooth is on, and ready for use + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.access/access.BluetoothState#STATE_ON + */ + STATE_ON = 2, + /** + * Indicates the local Bluetooth is turning off + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.access/access.BluetoothState#STATE_TURNING_OFF + */ + STATE_TURNING_OFF = 3, + /** + * Indicates the local Bluetooth is turning LE mode on + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.access/access.BluetoothState#STATE_BLE_TURNING_ON + */ + STATE_BLE_TURNING_ON = 4, + /** + * Indicates the local Bluetooth is in LE only mode + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.access/access.BluetoothState#STATE_BLE_ON + */ + STATE_BLE_ON = 5, + /** + * Indicates the local Bluetooth is turning off LE only mode + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.access/access.BluetoothState#STATE_BLE_TURNING_OFF + */ + STATE_BLE_TURNING_OFF = 6 + } + /** + * The enum of SPP type. + * + * @enum { number } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.socket/socket.SppType + */ + enum SppType { + /** + * RFCOMM + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.socket/socket.SppType#SPP_RFCOMM + */ + SPP_RFCOMM + } + /** + * The enum of BR scan mode. + * + * @enum { number } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.connection/connection.ScanMode + */ + enum ScanMode { + /** + * Indicates the scan mode is none + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.connection/connection.ScanMode#SCAN_MODE_NONE + */ + SCAN_MODE_NONE = 0, + /** + * Indicates the scan mode is connectable + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.connection/connection.ScanMode#SCAN_MODE_CONNECTABLE + */ + SCAN_MODE_CONNECTABLE = 1, + /** + * Indicates the scan mode is general discoverable + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.connection/connection.ScanMode#SCAN_MODE_GENERAL_DISCOVERABLE + */ + SCAN_MODE_GENERAL_DISCOVERABLE = 2, + /** + * Indicates the scan mode is limited discoverable + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.connection/connection.ScanMode#SCAN_MODE_LIMITED_DISCOVERABLE + */ + SCAN_MODE_LIMITED_DISCOVERABLE = 3, + /** + * Indicates the scan mode is connectable and general discoverable + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.connection/connection.ScanMode#SCAN_MODE_CONNECTABLE_GENERAL_DISCOVERABLE + */ + SCAN_MODE_CONNECTABLE_GENERAL_DISCOVERABLE = 4, + /** + * Indicates the scan mode is connectable and limited discoverable + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.connection/connection.ScanMode#SCAN_MODE_CONNECTABLE_LIMITED_DISCOVERABLE + */ + SCAN_MODE_CONNECTABLE_LIMITED_DISCOVERABLE = 5 + } + /** + * The enum of bond state. + * + * @enum { number } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.connection/connection.BondState + */ + enum BondState { + /** + * Indicate the bond state is invalid + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.connection/connection.BondState#BOND_STATE_INVALID + */ + BOND_STATE_INVALID = 0, + /** + * Indicate the bond state is bonding + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.connection/connection.BondState#BOND_STATE_BONDING + */ + BOND_STATE_BONDING = 1, + /** + * Indicate the bond state is bonded + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.connection/connection.BondState#BOND_STATE_BONDED + */ + BOND_STATE_BONDED = 2 + } + /** + * The enum of major class of a bluetooth device. + * + * @enum { number } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.constant/constant.MajorClass + */ + enum MajorClass { + /** + * Miscellaneous device. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.constant/constant.MajorClass#MAJOR_MISC + */ + MAJOR_MISC = 0x0000, + /** + * Computer. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.constant/constant.MajorClass#MAJOR_COMPUTER + */ + MAJOR_COMPUTER = 0x0100, + /** + * Mobile phone. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.constant/constant.MajorClass#MAJOR_PHONE + */ + MAJOR_PHONE = 0x0200, + /** + * Network device. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.constant/constant.MajorClass#MAJOR_NETWORKING + */ + MAJOR_NETWORKING = 0x0300, + /** + * Audio or video device. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.constant/constant.MajorClass#MAJOR_AUDIO_VIDEO + */ + MAJOR_AUDIO_VIDEO = 0x0400, + /** + * Peripheral device. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.constant/constant.MajorClass#MAJOR_PERIPHERAL + */ + MAJOR_PERIPHERAL = 0x0500, + /** + * Imaging device. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.constant/constant.MajorClass#MAJOR_IMAGING + */ + MAJOR_IMAGING = 0x0600, + /** + * Wearable device. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.constant/constant.MajorClass#MAJOR_WEARABLE + */ + MAJOR_WEARABLE = 0x0700, + /** + * Toy. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.constant/constant.MajorClass#MAJOR_TOY + */ + MAJOR_TOY = 0x0800, + /** + * Health device. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.constant/constant.MajorClass#MAJOR_HEALTH + */ + MAJOR_HEALTH = 0x0900, + /** + * Unclassified device. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.constant/constant.MajorClass#MAJOR_UNCATEGORIZED + */ + MAJOR_UNCATEGORIZED = 0x1F00 + } + /** + * The enum of major minor class of a bluetooth device. + * + * @enum { number } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.constant/constant.MajorMinorClass + */ + enum MajorMinorClass { + /** + * The Minor Device Class field + * Computer Major Class + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.constant/constant.MajorMinorClass#COMPUTER_UNCATEGORIZED + */ + COMPUTER_UNCATEGORIZED = 0x0100, + /** + * Desktop computer. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.constant/constant.MajorMinorClass#COMPUTER_DESKTOP + */ + COMPUTER_DESKTOP = 0x0104, + /** + * Server. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.constant/constant.MajorMinorClass#COMPUTER_SERVER + */ + COMPUTER_SERVER = 0x0108, + /** + * Laptop. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.constant/constant.MajorMinorClass#COMPUTER_LAPTOP + */ + COMPUTER_LAPTOP = 0x010C, + /** + * Hand-held computer. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.constant/constant.MajorMinorClass#COMPUTER_HANDHELD_PC_PDA + */ + COMPUTER_HANDHELD_PC_PDA = 0x0110, + /** + * Palmtop computer. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.constant/constant.MajorMinorClass#COMPUTER_PALM_SIZE_PC_PDA + */ + COMPUTER_PALM_SIZE_PC_PDA = 0x0114, + /** + * Wearable computer. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.constant/constant.MajorMinorClass#COMPUTER_WEARABLE + */ + COMPUTER_WEARABLE = 0x0118, + /** + * Tablet. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.constant/constant.MajorMinorClass#COMPUTER_TABLET + */ + COMPUTER_TABLET = 0x011C, + /** + * Phone Major Class + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.constant/constant.MajorMinorClass#PHONE_UNCATEGORIZED + */ + PHONE_UNCATEGORIZED = 0x0200, + /** + * Portable phone. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.constant/constant.MajorMinorClass#PHONE_CELLULAR + */ + PHONE_CELLULAR = 0x0204, + /** + * Cordless phone. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.constant/constant.MajorMinorClass#PHONE_CORDLESS + */ + PHONE_CORDLESS = 0x0208, + /** + * Smartphone. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.constant/constant.MajorMinorClass#PHONE_SMART + */ + PHONE_SMART = 0x020C, + /** + * Modem or gateway phone. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.constant/constant.MajorMinorClass#PHONE_MODEM_OR_GATEWAY + */ + PHONE_MODEM_OR_GATEWAY = 0x0210, + /** + * ISDN phone. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.constant/constant.MajorMinorClass#PHONE_ISDN + */ + PHONE_ISDN = 0x0214, + /** + * LAN/Network Access Point Major Class + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.constant/constant.MajorMinorClass#NETWORK_FULLY_AVAILABLE + */ + NETWORK_FULLY_AVAILABLE = 0x0300, + /** + * Device used on network 1 to 17. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.constant/constant.MajorMinorClass#NETWORK_1_TO_17_UTILIZED + */ + NETWORK_1_TO_17_UTILIZED = 0x0320, + /** + * Device used on network 17 to 33. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.constant/constant.MajorMinorClass#NETWORK_17_TO_33_UTILIZED + */ + NETWORK_17_TO_33_UTILIZED = 0x0340, + /** + * Device used on network 33 to 50. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.constant/constant.MajorMinorClass#NETWORK_33_TO_50_UTILIZED + */ + NETWORK_33_TO_50_UTILIZED = 0x0360, + /** + * Device used on network 60 to 67. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.constant/constant.MajorMinorClass#NETWORK_60_TO_67_UTILIZED + */ + NETWORK_60_TO_67_UTILIZED = 0x0380, + /** + * Device used on network 67 to 83. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.constant/constant.MajorMinorClass#NETWORK_67_TO_83_UTILIZED + */ + NETWORK_67_TO_83_UTILIZED = 0x03A0, + /** + * Device used on network 83 to 99. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.constant/constant.MajorMinorClass#NETWORK_83_TO_99_UTILIZED + */ + NETWORK_83_TO_99_UTILIZED = 0x03C0, + /** + * Device without network service. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.constant/constant.MajorMinorClass#NETWORK_NO_SERVICE + */ + NETWORK_NO_SERVICE = 0x03E0, + /** + * Unclassified audio or video device. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.constant/constant.MajorMinorClass#AUDIO_VIDEO_UNCATEGORIZED + */ + AUDIO_VIDEO_UNCATEGORIZED = 0x0400, + /** + * Wearable audio or video headset. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.constant/constant.MajorMinorClass#AUDIO_VIDEO_WEARABLE_HEADSET + */ + AUDIO_VIDEO_WEARABLE_HEADSET = 0x0404, + /** + * Hands-free audio or video device. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.constant/constant.MajorMinorClass#AUDIO_VIDEO_HANDSFREE + */ + AUDIO_VIDEO_HANDSFREE = 0x0408, + /** + * Audio or video microphone. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.constant/constant.MajorMinorClass#AUDIO_VIDEO_MICROPHONE + */ + AUDIO_VIDEO_MICROPHONE = 0x0410, + /** + * Audio or video loudspeaker. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.constant/constant.MajorMinorClass#AUDIO_VIDEO_LOUDSPEAKER + */ + AUDIO_VIDEO_LOUDSPEAKER = 0x0414, + /** + * Audio or video headphones. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.constant/constant.MajorMinorClass#AUDIO_VIDEO_HEADPHONES + */ + AUDIO_VIDEO_HEADPHONES = 0x0418, + /** + * Portable audio or video device. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.constant/constant.MajorMinorClass#AUDIO_VIDEO_PORTABLE_AUDIO + */ + AUDIO_VIDEO_PORTABLE_AUDIO = 0x041C, + /** + * In-vehicle audio or video device. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.constant/constant.MajorMinorClass#AUDIO_VIDEO_CAR_AUDIO + */ + AUDIO_VIDEO_CAR_AUDIO = 0x0420, + /** + * Audio or video STB device. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.constant/constant.MajorMinorClass#AUDIO_VIDEO_SET_TOP_BOX + */ + AUDIO_VIDEO_SET_TOP_BOX = 0x0424, + /** + * High-fidelity speaker device. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.constant/constant.MajorMinorClass#AUDIO_VIDEO_HIFI_AUDIO + */ + AUDIO_VIDEO_HIFI_AUDIO = 0x0428, + /** + * Video cassette recording (VCR) device. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.constant/constant.MajorMinorClass#AUDIO_VIDEO_VCR + */ + AUDIO_VIDEO_VCR = 0x042C, + /** + * Camera. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.constant/constant.MajorMinorClass#AUDIO_VIDEO_VIDEO_CAMERA + */ + AUDIO_VIDEO_VIDEO_CAMERA = 0x0430, + /** + * Camcorder. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.constant/constant.MajorMinorClass#AUDIO_VIDEO_CAMCORDER + */ + AUDIO_VIDEO_CAMCORDER = 0x0434, + /** + * Audio or video monitor. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.constant/constant.MajorMinorClass#AUDIO_VIDEO_VIDEO_MONITOR + */ + AUDIO_VIDEO_VIDEO_MONITOR = 0x0438, + /** + * Video display or loudspeaker. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.constant/constant.MajorMinorClass#AUDIO_VIDEO_VIDEO_DISPLAY_AND_LOUDSPEAKER + */ + AUDIO_VIDEO_VIDEO_DISPLAY_AND_LOUDSPEAKER = 0x043C, + /** + * Video conferencing device. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.constant/constant.MajorMinorClass#AUDIO_VIDEO_VIDEO_CONFERENCING + */ + AUDIO_VIDEO_VIDEO_CONFERENCING = 0x0440, + /** + * Audio or video gaming toy. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.constant/constant.MajorMinorClass#AUDIO_VIDEO_VIDEO_GAMING_TOY + */ + AUDIO_VIDEO_VIDEO_GAMING_TOY = 0x0448, + /** + * Peripheral Major Class + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.constant/constant.MajorMinorClass#PERIPHERAL_NON_KEYBOARD_NON_POINTING + */ + PERIPHERAL_NON_KEYBOARD_NON_POINTING = 0x0500, + /** + * Keyboard device. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.constant/constant.MajorMinorClass#PERIPHERAL_KEYBOARD + */ + PERIPHERAL_KEYBOARD = 0x0540, + /** + * Pointing peripheral device. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.constant/constant.MajorMinorClass#PERIPHERAL_POINTING_DEVICE + */ + PERIPHERAL_POINTING_DEVICE = 0x0580, + /** + * Keyboard pointing device. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.constant/constant.MajorMinorClass#PERIPHERAL_KEYBOARD_POINTING + */ + PERIPHERAL_KEYBOARD_POINTING = 0x05C0, + /** + * Unclassified peripheral device. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.constant/constant.MajorMinorClass#PERIPHERAL_UNCATEGORIZED + */ + PERIPHERAL_UNCATEGORIZED = 0x0500, + /** + * Peripheral joystick. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.constant/constant.MajorMinorClass#PERIPHERAL_JOYSTICK + */ + PERIPHERAL_JOYSTICK = 0x0504, + /** + * Peripheral game pad. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.constant/constant.MajorMinorClass#PERIPHERAL_GAMEPAD + */ + PERIPHERAL_GAMEPAD = 0x0508, + /** + * Peripheral remote control device. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.constant/constant.MajorMinorClass#PERIPHERAL_REMOTE_CONTROL + */ + PERIPHERAL_REMOTE_CONTROL = 0x05C0, + /** + * Peripheral sensing device. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.constant/constant.MajorMinorClass#PERIPHERAL_SENSING_DEVICE + */ + PERIPHERAL_SENSING_DEVICE = 0x0510, + /** + * Peripheral digitizer tablet. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.constant/constant.MajorMinorClass#PERIPHERAL_DIGITIZER_TABLET + */ + PERIPHERAL_DIGITIZER_TABLET = 0x0514, + /** + * Peripheral card reader. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.constant/constant.MajorMinorClass#PERIPHERAL_CARD_READER + */ + PERIPHERAL_CARD_READER = 0x0518, + /** + * Peripheral digital pen. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.constant/constant.MajorMinorClass#PERIPHERAL_DIGITAL_PEN + */ + PERIPHERAL_DIGITAL_PEN = 0x051C, + /** + * Peripheral RFID scanner. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.constant/constant.MajorMinorClass#PERIPHERAL_SCANNER_RFID + */ + PERIPHERAL_SCANNER_RFID = 0x0520, + /** + * Gesture input device. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.constant/constant.MajorMinorClass#PERIPHERAL_GESTURAL_INPUT + */ + PERIPHERAL_GESTURAL_INPUT = 0x0522, + /** + * Imaging Major Class + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.constant/constant.MajorMinorClass#IMAGING_UNCATEGORIZED + */ + IMAGING_UNCATEGORIZED = 0x0600, + /** + * Imaging display device. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.constant/constant.MajorMinorClass#IMAGING_DISPLAY + */ + IMAGING_DISPLAY = 0x0610, + /** + * Imaging camera device. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.constant/constant.MajorMinorClass#IMAGING_CAMERA + */ + IMAGING_CAMERA = 0x0620, + /** + * Imaging scanner. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.constant/constant.MajorMinorClass#IMAGING_SCANNER + */ + IMAGING_SCANNER = 0x0640, + /** + * Imaging printer. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.constant/constant.MajorMinorClass#IMAGING_PRINTER + */ + IMAGING_PRINTER = 0x0680, + /** + * Wearable Major Class + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.constant/constant.MajorMinorClass#WEARABLE_UNCATEGORIZED + */ + WEARABLE_UNCATEGORIZED = 0x0700, + /** + * Smart watch. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.constant/constant.MajorMinorClass#WEARABLE_WRIST_WATCH + */ + WEARABLE_WRIST_WATCH = 0x0704, + /** + * Wearable pager. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.constant/constant.MajorMinorClass#WEARABLE_PAGER + */ + WEARABLE_PAGER = 0x0708, + /** + * Smart jacket. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.constant/constant.MajorMinorClass#WEARABLE_JACKET + */ + WEARABLE_JACKET = 0x070C, + /** + * Wearable helmet. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.constant/constant.MajorMinorClass#WEARABLE_HELMET + */ + WEARABLE_HELMET = 0x0710, + /** + * Wearable glasses. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.constant/constant.MajorMinorClass#WEARABLE_GLASSES + */ + WEARABLE_GLASSES = 0x0714, + /** + * Minor Device Class field - Toy Major Class + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.constant/constant.MajorMinorClass#TOY_UNCATEGORIZED + */ + TOY_UNCATEGORIZED = 0x0800, + /** + * Toy robot. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.constant/constant.MajorMinorClass#TOY_ROBOT + */ + TOY_ROBOT = 0x0804, + /** + * Toy vehicle. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.constant/constant.MajorMinorClass#TOY_VEHICLE + */ + TOY_VEHICLE = 0x0808, + /** + * Humanoid toy doll. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.constant/constant.MajorMinorClass#TOY_DOLL_ACTION_FIGURE + */ + TOY_DOLL_ACTION_FIGURE = 0x080C, + /** + * Toy controller. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.constant/constant.MajorMinorClass#TOY_CONTROLLER + */ + TOY_CONTROLLER = 0x0810, + /** + * Toy gaming device. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.constant/constant.MajorMinorClass#TOY_GAME + */ + TOY_GAME = 0x0814, + /** + * Minor Device Class field - Health + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.constant/constant.MajorMinorClass#HEALTH_UNCATEGORIZED + */ + HEALTH_UNCATEGORIZED = 0x0900, + /** + * Blood pressure device. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.constant/constant.MajorMinorClass#HEALTH_BLOOD_PRESSURE + */ + HEALTH_BLOOD_PRESSURE = 0x0904, + /** + * Thermometer. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.constant/constant.MajorMinorClass#HEALTH_THERMOMETER + */ + HEALTH_THERMOMETER = 0x0908, + /** + * Body scale. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.constant/constant.MajorMinorClass#HEALTH_WEIGHING + */ + HEALTH_WEIGHING = 0x090C, + /** + * Blood glucose monitor. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.constant/constant.MajorMinorClass#HEALTH_GLUCOSE + */ + HEALTH_GLUCOSE = 0x0910, + /** + * Pulse oximeter. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.constant/constant.MajorMinorClass#HEALTH_PULSE_OXIMETER + */ + HEALTH_PULSE_OXIMETER = 0x0914, + /** + * Heart rate monitor. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.constant/constant.MajorMinorClass#HEALTH_PULSE_RATE + */ + HEALTH_PULSE_RATE = 0x0918, + /** + * Health data display. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.constant/constant.MajorMinorClass#HEALTH_DATA_DISPLAY + */ + HEALTH_DATA_DISPLAY = 0x091C, + /** + * Step counter. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.constant/constant.MajorMinorClass#HEALTH_STEP_COUNTER + */ + HEALTH_STEP_COUNTER = 0x0920, + /** + * Body composition analyzer. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.constant/constant.MajorMinorClass#HEALTH_BODY_COMPOSITION_ANALYZER + */ + HEALTH_BODY_COMPOSITION_ANALYZER = 0x0924, + /** + * Hygrometer. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.constant/constant.MajorMinorClass#HEALTH_PEAK_FLOW_MONITOR + */ + HEALTH_PEAK_FLOW_MONITOR = 0x0928, + /** + * Medication monitor. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.constant/constant.MajorMinorClass#HEALTH_MEDICATION_MONITOR + */ + HEALTH_MEDICATION_MONITOR = 0x092C, + /** + * Prosthetic knee. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.constant/constant.MajorMinorClass#HEALTH_KNEE_PROSTHESIS + */ + HEALTH_KNEE_PROSTHESIS = 0x0930, + /** + * Prosthetic ankle. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.constant/constant.MajorMinorClass#HEALTH_ANKLE_PROSTHESIS + */ + HEALTH_ANKLE_PROSTHESIS = 0x0934, + /** + * Generic health management device. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.constant/constant.MajorMinorClass#HEALTH_GENERIC_HEALTH_MANAGER + */ + HEALTH_GENERIC_HEALTH_MANAGER = 0x0938, + /** + * Personal mobility device. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.constant/constant.MajorMinorClass#HEALTH_PERSONAL_MOBILITY_DEVICE + */ + HEALTH_PERSONAL_MOBILITY_DEVICE = 0x093C + } + /** + * The enum of a2dp playing state. + * + * @enum { number } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.a2dp/a2dp.PlayingState + */ + enum PlayingState { + /** + * Not playing. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.a2dp/a2dp.PlayingState#STATE_NOT_PLAYING + */ + STATE_NOT_PLAYING, + /** + * Playing. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.a2dp/a2dp.PlayingState#STATE_PLAYING + */ + STATE_PLAYING + } + /** + * The enum of profile id. + * + * @enum { number } + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.constant/constant.ProfileId + */ + enum ProfileId { + /** + * A2DP profile. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.constant/constant.ProfileId#PROFILE_A2DP_SOURCE + */ + PROFILE_A2DP_SOURCE = 1, + /** + * HFP profile. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.constant/constant.ProfileId#PROFILE_HANDSFREE_AUDIO_GATEWAY + */ + PROFILE_HANDS_FREE_AUDIO_GATEWAY = 4, + /** + * Human Interface Device (HID) profile. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.constant/constant.ProfileId#PROFILE_HID_HOST + */ + PROFILE_HID_HOST = 6, + /** + * PAN profile. + * + * @syscap SystemCapability.Communication.Bluetooth.Core + * @since 9 + * @deprecated since 10 + * @useinstead ohos.bluetooth.constant/constant.ProfileId#PROFILE_PAN_NETWORK + */ + PROFILE_PAN_NETWORK = 7 + } +} +export default bluetoothManager; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.buffer.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.buffer.d.ts new file mode 100755 index 00000000..53cd6623 --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.buffer.d.ts @@ -0,0 +1,3396 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (The type of "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit ArkTS + */ +/** + * The Buffer class is a global type for dealing with binary data directly. It can be constructed in a variety of ways. + * + * @namespace buffer + * @syscap SystemCapability.Utils.Lang + * @since 9 + */ +/** + * The Buffer class is a global type for dealing with binary data directly. It can be constructed in a variety of ways. + * + * @namespace buffer + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @since 10 + */ +/** + * The Buffer class is a global type for dealing with binary data directly. It can be constructed in a variety of ways. + * + * @namespace buffer + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 11 + */ +declare namespace buffer { + /** + * This parameter specifies the type of a common encoding format. + * + * @syscap SystemCapability.Utils.Lang + * @since 9 + */ + /** + * This parameter specifies the type of a common encoding format. + * + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @since 10 + */ + /** + * This parameter specifies the type of a common encoding format. + * + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 11 + */ + type BufferEncoding = 'ascii' | 'utf8' | 'utf-8' | 'utf16le' | 'ucs2' | 'ucs-2' | 'base64' | 'base64url' | 'latin1' | 'binary' | 'hex'; + /** + * TypedArray inherits the features and methods of Int8Array + * + * @syscap SystemCapability.Utils.Lang + * @since 9 + */ + /** + * TypedArray inherits the features and methods of Int8Array + * + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @since 10 + */ + /** + * TypedArray inherits the features and methods of Int8Array + * @interface TypedArray + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 11 + */ + interface TypedArray extends Int8Array { + } + /** + * Allocates a new Buffer for a fixed size bytes. If fill is undefined, the Buffer will be zero-filled. + * + * @param { number } size - size size The desired length of the new Buffer + * @param { string | Buffer | number } [fill] - fill [fill=0] A value to pre-fill the new Buffer with + * @param { BufferEncoding } [encoding] - encoding [encoding='utf8'] If `fill` is a string, this is its encoding + * @returns { Buffer } Return a new allocated Buffer + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types; + * 3.Parameter verification failed. + * @syscap SystemCapability.Utils.Lang + * @since 9 + */ + /** + * Allocates a new Buffer for a fixed size bytes. If fill is undefined, the Buffer will be zero-filled. + * + * @param { number } size - size size The desired length of the new Buffer + * @param { string | Buffer | number } [fill] - fill [fill=0] A value to pre-fill the new Buffer with + * @param { BufferEncoding } [encoding] - encoding [encoding='utf8'] If `fill` is a string, this is its encoding + * @returns { Buffer } Return a new allocated Buffer + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types; + * 3.Parameter verification failed. + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @since 10 + */ + /** + * Allocates a new Buffer for a fixed size bytes. If fill is undefined, the Buffer will be zero-filled. + * + * @param { number } size - size size The desired length of the new Buffer + * @param { string | Buffer | number } [fill] - fill [fill=0] A value to pre-fill the new Buffer with + * @param { BufferEncoding } [encoding] - encoding [encoding='utf8'] If `fill` is a string, this is its encoding + * @returns { Buffer } Return a new allocated Buffer + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types; + * 3.Parameter verification failed. + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 11 + */ + function alloc(size: number, fill?: string | Buffer | number, encoding?: BufferEncoding): Buffer; + /** + * Allocates a new Buffer for a fixed size bytes. The Buffer will not be initially filled. + * + * @param { number } size - size size The desired length of the new Buffer + * @returns { Buffer } Return a new allocated Buffer + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types; + * 3.Parameter verification failed. + * @syscap SystemCapability.Utils.Lang + * @since 9 + */ + /** + * Allocates a new Buffer for a fixed size bytes. The Buffer will not be initially filled. + * + * @param { number } size - size size The desired length of the new Buffer + * @returns { Buffer } Return a new allocated Buffer + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types; + * 3.Parameter verification failed. + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @since 10 + */ + /** + * Allocates a new Buffer for a fixed size bytes. The Buffer will not be initially filled. + * + * @param { number } size - size size The desired length of the new Buffer + * @returns { Buffer } Return a new allocated Buffer + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types; + * 3.Parameter verification failed. + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 11 + */ + function allocUninitializedFromPool(size: number): Buffer; + /** + * Allocates a new un-pooled Buffer for a fixed size bytes. The Buffer will not be initially filled. + * + * @param { number } size - size size The desired length of the new Buffer + * @returns { Buffer } Return a new allocated Buffer + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types; + * 3.Parameter verification failed. + * @syscap SystemCapability.Utils.Lang + * @since 9 + */ + /** + * Allocates a new un-pooled Buffer for a fixed size bytes. The Buffer will not be initially filled. + * + * @param { number } size - size size The desired length of the new Buffer + * @returns { Buffer } Return a new allocated Buffer + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types; + * 3.Parameter verification failed. + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @since 10 + */ + /** + * Allocates a new un-pooled Buffer for a fixed size bytes. The Buffer will not be initially filled. + * + * @param { number } size - size size The desired length of the new Buffer + * @returns { Buffer } Return a new allocated Buffer + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types; + * 3.Parameter verification failed. + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 11 + */ + function allocUninitialized(size: number): Buffer; + /** + * Returns the byte length of a string when encoded using `encoding`. + * This is not the same as [`String.prototype.length`], which does not account + * for the encoding that is used to convert the string into bytes. + * + * @param { string | Buffer | TypedArray | DataView | ArrayBuffer | SharedArrayBuffer } string - string string A value to calculate the length of + * @param { BufferEncoding } [encoding] - encoding [encoding='utf8'] If `string` is a string, this is its encoding + * @returns { number } The number of bytes contained within `string` + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @syscap SystemCapability.Utils.Lang + * @since 9 + */ + /** + * Returns the byte length of a string when encoded using `encoding`. + * This is not the same as [`String.prototype.length`], which does not account + * for the encoding that is used to convert the string into bytes. + * + * @param { string | Buffer | TypedArray | DataView | ArrayBuffer | SharedArrayBuffer } string - string string A value to calculate the length of + * @param { BufferEncoding } [encoding] - encoding [encoding='utf8'] If `string` is a string, this is its encoding + * @returns { number } The number of bytes contained within `string` + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @since 10 + */ + /** + * Returns the byte length of a string when encoded using `encoding`. + * This is not the same as [`String.prototype.length`], which does not account + * for the encoding that is used to convert the string into bytes. + * + * @param { string | Buffer | TypedArray | DataView | ArrayBuffer | SharedArrayBuffer } string - string string A value to calculate the length of + * @param { BufferEncoding } [encoding] - encoding [encoding='utf8'] If `string` is a string, this is its encoding + * @returns { number } The number of bytes contained within `string` + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 11 + */ + function byteLength(string: string | Buffer | TypedArray | DataView | ArrayBuffer | SharedArrayBuffer, encoding?: BufferEncoding): number; + /** + * Returns a new `Buffer` which is the result of concatenating all the `Buffer`instances in the `list` together. + * + * @param { Buffer[] | Uint8Array[] } list - list list List of `Buffer` or Uint8Array instances to concatenate + * @param { number } [totalLength] - totalLength totalLength Total length of the `Buffer` instances in `list` when concatenated + * @returns { Buffer } Return a new allocated Buffer + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types; + * 3.Parameter verification failed. + * @throws { BusinessError } 10200001 - The value of "length" is out of range. It must be >= 0 and <= uint32 max. Received value is: [length] + * @syscap SystemCapability.Utils.Lang + * @since 9 + */ + /** + * Returns a new `Buffer` which is the result of concatenating all the `Buffer`instances in the `list` together. + * + * @param { Buffer[] | Uint8Array[] } list - list list List of `Buffer` or Uint8Array instances to concatenate + * @param { number } [totalLength] - totalLength totalLength Total length of the `Buffer` instances in `list` when concatenated + * @returns { Buffer } Return a new allocated Buffer + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types; + * 3.Parameter verification failed. + * @throws { BusinessError } 10200001 - The value of "length" is out of range. It must be >= 0 and <= uint32 max. Received value is: [length] + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @since 10 + */ + /** + * Returns a new `Buffer` which is the result of concatenating all the `Buffer`instances in the `list` together. + * + * @param { Buffer[] | Uint8Array[] } list - list list List of `Buffer` or Uint8Array instances to concatenate + * @param { number } [totalLength] - totalLength totalLength Total length of the `Buffer` instances in `list` when concatenated + * @returns { Buffer } Return a new allocated Buffer + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types; + * 3.Parameter verification failed. + * @throws { BusinessError } 10200001 - The value of "length" is out of range. It must be >= 0 and <= uint32 max. Received value is: [length] + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 11 + */ + function concat(list: Buffer[] | Uint8Array[], totalLength?: number): Buffer; + /** + * Allocates a new Buffer using an array of bytes in the range 0 – 255. Array entries outside that range will be truncated to fit into it. + * + * @param { number[] } array - array array an array of bytes in the range 0 – 255 + * @returns { Buffer } Return a new allocated Buffer + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @syscap SystemCapability.Utils.Lang + * @since 9 + */ + /** + * Allocates a new Buffer using an array of bytes in the range 0 – 255. Array entries outside that range will be truncated to fit into it. + * + * @param { number[] } array - array array an array of bytes in the range 0 – 255 + * @returns { Buffer } Return a new allocated Buffer + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @since 10 + */ + /** + * Allocates a new Buffer using an array of bytes in the range 0 – 255. Array entries outside that range will be truncated to fit into it. + * + * @param { number[] } array - array array an array of bytes in the range 0 – 255 + * @returns { Buffer } Return a new allocated Buffer + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 11 + */ + function from(array: number[]): Buffer; + /** + * This creates a view of the ArrayBuffer without copying the underlying memory. + * + * @param { ArrayBuffer | SharedArrayBuffer } arrayBuffer - arrayBuffer arrayBuffer An ArrayBuffer, + * SharedArrayBuffer, for example the .buffer property of a TypedArray. + * @param { number } [byteOffset] - byteOffset [byteOffset = 0] Index of first byte to expose + * @param { number } [length] - length [length = arrayBuffer.byteLength - byteOffset] Number of bytes to expose + * @returns { Buffer } Return a view of the ArrayBuffer + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @throws { BusinessError } 10200001 - The value of "[byteOffset/length]" is out of range. + * It must be >= [left range] and <= [right range]. Received value is: [byteOffset/length] + * @syscap SystemCapability.Utils.Lang + * @since 9 + */ + /** + * This creates a view of the ArrayBuffer without copying the underlying memory. + * + * @param { ArrayBuffer | SharedArrayBuffer } arrayBuffer - arrayBuffer arrayBuffer An ArrayBuffer, + * SharedArrayBuffer, for example the .buffer property of a TypedArray. + * @param { number } [byteOffset] - byteOffset [byteOffset = 0] Index of first byte to expose + * @param { number } [length] - length [length = arrayBuffer.byteLength - byteOffset] Number of bytes to expose + * @returns { Buffer } Return a view of the ArrayBuffer + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @throws { BusinessError } 10200001 - The value of "[byteOffset/length]" is out of range. + * It must be >= [left range] and <= [right range]. Received value is: [byteOffset/length] + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @since 10 + */ + /** + * This creates a view of the ArrayBuffer without copying the underlying memory. + * + * @param { ArrayBuffer | SharedArrayBuffer } arrayBuffer - arrayBuffer arrayBuffer An ArrayBuffer, + * SharedArrayBuffer, for example the .buffer property of a TypedArray. + * @param { number } [byteOffset] - byteOffset [byteOffset = 0] Index of first byte to expose + * @param { number } [length] - length [length = arrayBuffer.byteLength - byteOffset] Number of bytes to expose + * @returns { Buffer } Return a view of the ArrayBuffer + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @throws { BusinessError } 10200001 - The value of "[byteOffset/length]" is out of range. + * It must be >= [left range] and <= [right range]. Received value is: [byteOffset/length] + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 11 + */ + function from(arrayBuffer: ArrayBuffer | SharedArrayBuffer, byteOffset?: number, length?: number): Buffer; + /** + * Copies the passed buffer data onto a new Buffer instance. + * + * @param { Buffer | Uint8Array } buffer - buffer buffer An existing Buffer or Uint8Array from which to copy data + * @returns { Buffer } Return a new allocated Buffer + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @syscap SystemCapability.Utils.Lang + * @since 9 + */ + /** + * Copies the passed buffer data onto a new Buffer instance. + * + * @param { Buffer | Uint8Array } buffer - buffer buffer An existing Buffer or Uint8Array from which to copy data + * @returns { Buffer } Return a new allocated Buffer + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @since 10 + */ + /** + * Copies the passed buffer data onto a new Buffer instance. + * + * @param { Buffer | Uint8Array } buffer - buffer buffer An existing Buffer or Uint8Array from which to copy data + * @returns { Buffer } Return a new allocated Buffer + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 11 + */ + function from(buffer: Buffer | Uint8Array): Buffer; + /** + * For the object whose value returned by valueof() function is strictly equal to object + * or supports symbol To primitive object, a new buffer instance is created. + * + * @param { Object } object - object object An object supporting Symbol.toPrimitive or valueOf() + * @param { number | string } offsetOrEncoding - offsetOrEncoding offsetOrEncoding A byte-offset or encoding + * @param { number } length - length length A length + * @returns { Buffer } Return a new allocated Buffer + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @syscap SystemCapability.Utils.Lang + * @since 9 + */ + /** + * For the object whose value returned by valueof() function is strictly equal to object + * or supports symbol To primitive object, a new buffer instance is created. + * + * @param { Object } object - object object An object supporting Symbol.toPrimitive or valueOf() + * @param { number | string } offsetOrEncoding - offsetOrEncoding offsetOrEncoding A byte-offset or encoding + * @param { number } length - length length A length + * @returns { Buffer } Return a new allocated Buffer + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @since 10 + */ + /** + * For the object whose value returned by valueof() function is strictly equal to object + * or supports symbol To primitive object, a new buffer instance is created. + * + * @param { Object } object - object object An object supporting Symbol.toPrimitive or valueOf() + * @param { number | string } offsetOrEncoding - offsetOrEncoding offsetOrEncoding A byte-offset or encoding + * @param { number } length - length length A length + * @returns { Buffer } Return a new allocated Buffer + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 11 + */ + function from(object: Object, offsetOrEncoding: number | string, length: number): Buffer; + /** + * Creates a new Buffer containing string. The encoding parameter identifies the character encoding + * to be used when converting string into bytes. + * + * @param { String } string - string string A string to encode + * @param { BufferEncoding } [encoding] - encoding [encoding='utf8'] The encoding of string + * @returns { Buffer } Return a new Buffer containing string + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @syscap SystemCapability.Utils.Lang + * @since 9 + */ + /** + * Creates a new Buffer containing string. The encoding parameter identifies the character encoding + * to be used when converting string into bytes. + * + * @param { String } string - string string A string to encode + * @param { BufferEncoding } [encoding] - encoding [encoding='utf8'] The encoding of string + * @returns { Buffer } Return a new Buffer containing string + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @since 10 + */ + /** + * Creates a new Buffer containing string. The encoding parameter identifies the character encoding + * to be used when converting string into bytes. + * + * @param { String } string - string string A string to encode + * @param { BufferEncoding } [encoding] - encoding [encoding='utf8'] The encoding of string + * @returns { Buffer } Return a new Buffer containing string + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 11 + */ + function from(string: String, encoding?: BufferEncoding): Buffer; + /** + * Returns true if obj is a Buffer, false otherwise + * + * @param { Object } obj - obj obj Objects to be judged + * @returns { boolean } true or false + * @syscap SystemCapability.Utils.Lang + * @since 9 + */ + /** + * Returns true if obj is a Buffer, false otherwise + * + * @param { Object } obj - obj obj Objects to be judged + * @returns { boolean } true or false + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @since 10 + */ + /** + * Returns true if obj is a Buffer, false otherwise + * + * @param { Object } obj - obj obj Objects to be judged + * @returns { boolean } true or false + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 11 + */ + function isBuffer(obj: Object): boolean; + /** + * Returns true if encoding is the name of a supported character encoding, or false otherwise. + * + * @param { string } encoding - encoding encoding A character encoding name to check + * @returns { boolean } true or false + * @syscap SystemCapability.Utils.Lang + * @since 9 + */ + /** + * Returns true if encoding is the name of a supported character encoding, or false otherwise. + * + * @param { string } encoding - encoding encoding A character encoding name to check + * @returns { boolean } true or false + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @since 10 + */ + /** + * Returns true if encoding is the name of a supported character encoding, or false otherwise. + * + * @param { string } encoding - encoding encoding A character encoding name to check + * @returns { boolean } true or false + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 11 + */ + function isEncoding(encoding: string): boolean; + /** + * Compares buf1 to buf2 + * + * @param { Buffer | Uint8Array } buf1 - buf1 buf1 A Buffer or Uint8Array instance. + * @param { Buffer | Uint8Array } buf2 - buf2 buf2 A Buffer or Uint8Array instance. + * @returns { -1 | 0 | 1 } 0 is returned if target is the same as buf + * 1 is returned if target should come before buf when sorted. + * -1 is returned if target should come after buf when sorted. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @syscap SystemCapability.Utils.Lang + * @since 9 + */ + /** + * Compares buf1 to buf2 + * + * @param { Buffer | Uint8Array } buf1 - buf1 buf1 A Buffer or Uint8Array instance. + * @param { Buffer | Uint8Array } buf2 - buf2 buf2 A Buffer or Uint8Array instance. + * @returns { -1 | 0 | 1 } 0 is returned if target is the same as buf + * 1 is returned if target should come before buf when sorted. + * -1 is returned if target should come after buf when sorted. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @since 10 + */ + /** + * Compares buf1 to buf2 + * + * @param { Buffer | Uint8Array } buf1 - buf1 buf1 A Buffer or Uint8Array instance. + * @param { Buffer | Uint8Array } buf2 - buf2 buf2 A Buffer or Uint8Array instance. + * @returns { -1 | 0 | 1 } 0 is returned if target is the same as buf + * 1 is returned if target should come before buf when sorted. + * -1 is returned if target should come after buf when sorted. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 11 + */ + function compare(buf1: Buffer | Uint8Array, buf2: Buffer | Uint8Array): -1 | 0 | 1; + /** + * Re-encodes the given Buffer or Uint8Array instance from one character encoding to another. + * + * @param { Buffer | Uint8Array } source - source source A Buffer or Uint8Array instance. + * @param { string } fromEnc - fromEnc fromEnc The current encoding + * @param { string } toEnc - toEnc toEnc To target encoding + * @returns { Buffer } Returns a new Buffer instance + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @syscap SystemCapability.Utils.Lang + * @since 9 + */ + /** + * Re-encodes the given Buffer or Uint8Array instance from one character encoding to another. + * + * @param { Buffer | Uint8Array } source - source source A Buffer or Uint8Array instance. + * @param { string } fromEnc - fromEnc fromEnc The current encoding + * @param { string } toEnc - toEnc toEnc To target encoding + * @returns { Buffer } Returns a new Buffer instance + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @since 10 + */ + /** + * Re-encodes the given Buffer or Uint8Array instance from one character encoding to another. + * + * @param { Buffer | Uint8Array } source - source source A Buffer or Uint8Array instance. + * @param { string } fromEnc - fromEnc fromEnc The current encoding + * @param { string } toEnc - toEnc toEnc To target encoding + * @returns { Buffer } Returns a new Buffer instance + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 11 + */ + function transcode(source: Buffer | Uint8Array, fromEnc: string, toEnc: string): Buffer; + /** + * The Buffer object is a method of handling buffers dedicated to binary data. + * + * @syscap SystemCapability.Utils.Lang + * @since 9 + */ + /** + * The Buffer object is a method of handling buffers dedicated to binary data. + * + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @since 10 + */ + /** + * The Buffer object is a method of handling buffers dedicated to binary data. + * + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 11 + */ + class Buffer { + /** + * Returns the number of bytes in buf + * + * @throws { BusinessError } 10200013 - Cannot set property length of Buffer which has only a getter + * @syscap SystemCapability.Utils.Lang + * @since 9 + */ + /** + * Returns the number of bytes in buf + * + * @throws { BusinessError } 10200013 - Cannot set property length of Buffer which has only a getter + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @since 10 + */ + /** + * Returns the number of bytes in buf + * + * @throws { BusinessError } 10200013 - Cannot set property length of Buffer which has only a getter + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 11 + */ + length: number; + /** + * The underlying ArrayBuffer object based on which this Buffer object is created. + * + * @throws { BusinessError } 10200013 - Cannot set property buffer of Buffer which has only a getter + * @syscap SystemCapability.Utils.Lang + * @since 9 + */ + /** + * The underlying ArrayBuffer object based on which this Buffer object is created. + * + * @throws { BusinessError } 10200013 - Cannot set property buffer of Buffer which has only a getter + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @since 10 + */ + /** + * The underlying ArrayBuffer object based on which this Buffer object is created. + * + * @throws { BusinessError } 10200013 - Cannot set property buffer of Buffer which has only a getter + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 11 + */ + buffer: ArrayBuffer; + /** + * The byteOffset of the Buffers underlying ArrayBuffer object + * + * @throws { BusinessError } 10200013 - Cannot set property byteOffset of Buffer which has only a getter + * @syscap SystemCapability.Utils.Lang + * @since 9 + */ + /** + * The byteOffset of the Buffers underlying ArrayBuffer object + * + * @throws { BusinessError } 10200013 - Cannot set property byteOffset of Buffer which has only a getter + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @since 10 + */ + /** + * The byteOffset of the Buffers underlying ArrayBuffer object + * + * @throws { BusinessError } 10200013 - Cannot set property byteOffset of Buffer which has only a getter + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 11 + */ + byteOffset: number; + /** + * Fills buf with the specified value. If the offset and end are not given, the entire buf will be filled. + * + * @param { string | Buffer | Uint8Array | number } value - value value The value with which to fill buf + * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to fill buf + * @param { number } [end] - end [end = buf.length] Where to stop filling buf (not inclusive) + * @param { BufferEncoding } [encoding] - encoding [encoding='utf8'] The encoding for value if value is a string + * @returns { Buffer } A reference to buf + * @throws { BusinessError } 10200001 - The value of "[offset/end]" is out of range. It must be >= 0 and <= [right range]. Received value is: [offset/end] + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Incorrect parameter types; + * 2.Parameter verification failed. + * @syscap SystemCapability.Utils.Lang + * @since 9 + */ + /** + * Fills buf with the specified value. If the offset and end are not given, the entire buf will be filled. + * + * @param { string | Buffer | Uint8Array | number } value - value value The value with which to fill buf + * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to fill buf + * @param { number } [end] - end [end = buf.length] Where to stop filling buf (not inclusive) + * @param { BufferEncoding } [encoding] - encoding [encoding='utf8'] The encoding for value if value is a string + * @returns { Buffer } A reference to buf + * @throws { BusinessError } 10200001 - The value of "[offset/end]" is out of range. It must be >= 0 and <= [right range]. Received value is: [offset/end] + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Incorrect parameter types; + * 2.Parameter verification failed. + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @since 10 + */ + /** + * Fills buf with the specified value. If the offset and end are not given, the entire buf will be filled. + * + * @param { string | Buffer | Uint8Array | number } value - value value The value with which to fill buf + * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to fill buf + * @param { number } [end] - end [end = buf.length] Where to stop filling buf (not inclusive) + * @param { BufferEncoding } [encoding] - encoding [encoding='utf8'] The encoding for value if value is a string + * @returns { Buffer } A reference to buf + * @throws { BusinessError } 10200001 - The value of "[offset/end]" is out of range. It must be >= 0 and <= [right range]. Received value is: [offset/end] + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Incorrect parameter types; + * 2.Parameter verification failed. + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 11 + */ + fill(value: string | Buffer | Uint8Array | number, offset?: number, end?: number, encoding?: BufferEncoding): Buffer; + /** + * Compares buf with target and returns a number indicating whether buf comes before, after, + * or is the same as target in sort order. Comparison is based on the actual sequence of bytes in each Buffer. + * + * @param { Buffer | Uint8Array } target - target target A Buffer or Uint8Array with which to compare buf + * @param { number } [targetStart] - targetStart [targetStart = 0] The offset within target at which to begin comparison + * @param { number } [targetEnd] - targetEnd [targetEnd = target.length] The offset within target at which to end comparison (not inclusive) + * @param { number } [sourceStart] - sourceStart [sourceStart = 0] The offset within buf at which to begin comparison + * @param { number } [sourceEnd] - sourceEnd [sourceEnd = buf.length] The offset within buf at which to end comparison (not inclusive) + * @returns { -1 | 0 | 1 } 0 is returned if target is the same as buf + * 1 is returned if target should come before buf when sorted. + * -1 is returned if target should come after buf when sorted. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @throws { BusinessError } 10200001 - The value of "[targetStart/targetEnd/sourceStart/sourceEnd]" is out of range. + * It must be >= 0 and <= [right range]. Received value is: [targetStart/targetEnd/sourceStart/sourceEnd] + * @syscap SystemCapability.Utils.Lang + * @since 9 + */ + /** + * Compares buf with target and returns a number indicating whether buf comes before, after, + * or is the same as target in sort order. Comparison is based on the actual sequence of bytes in each Buffer. + * + * @param { Buffer | Uint8Array } target - target target A Buffer or Uint8Array with which to compare buf + * @param { number } [targetStart] - targetStart [targetStart = 0] The offset within target at which to begin comparison + * @param { number } [targetEnd] - targetEnd [targetEnd = target.length] The offset within target at which to end comparison (not inclusive) + * @param { number } [sourceStart] - sourceStart [sourceStart = 0] The offset within buf at which to begin comparison + * @param { number } [sourceEnd] - sourceEnd [sourceEnd = buf.length] The offset within buf at which to end comparison (not inclusive) + * @returns { -1 | 0 | 1 } 0 is returned if target is the same as buf + * 1 is returned if target should come before buf when sorted. + * -1 is returned if target should come after buf when sorted. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @throws { BusinessError } 10200001 - The value of "[targetStart/targetEnd/sourceStart/sourceEnd]" is out of range. + * It must be >= 0 and <= [right range]. Received value is: [targetStart/targetEnd/sourceStart/sourceEnd] + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @since 10 + */ + /** + * Compares buf with target and returns a number indicating whether buf comes before, after, + * or is the same as target in sort order. Comparison is based on the actual sequence of bytes in each Buffer. + * + * @param { Buffer | Uint8Array } target - target target A Buffer or Uint8Array with which to compare buf + * @param { number } [targetStart] - targetStart [targetStart = 0] The offset within target at which to begin comparison + * @param { number } [targetEnd] - targetEnd [targetEnd = target.length] The offset within target at which to end comparison (not inclusive) + * @param { number } [sourceStart] - sourceStart [sourceStart = 0] The offset within buf at which to begin comparison + * @param { number } [sourceEnd] - sourceEnd [sourceEnd = buf.length] The offset within buf at which to end comparison (not inclusive) + * @returns { -1 | 0 | 1 } 0 is returned if target is the same as buf + * 1 is returned if target should come before buf when sorted. + * -1 is returned if target should come after buf when sorted. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @throws { BusinessError } 10200001 - The value of "[targetStart/targetEnd/sourceStart/sourceEnd]" is out of range. + * It must be >= 0 and <= [right range]. Received value is: [targetStart/targetEnd/sourceStart/sourceEnd] + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 11 + */ + compare(target: Buffer | Uint8Array, targetStart?: number, targetEnd?: number, sourceStart?: number, sourceEnd?: number): -1 | 0 | 1; + /** + * Copies data from a region of buf to a region in target, even if the target memory region overlaps with buf. + * If sourceEnd is greater than the length of the target, the length of the target shall prevail, and the extra part will not be overwritten. + * + * @param { Buffer | Uint8Array } target - target target A Buffer or Uint8Array to copy into + * @param { number } [targetStart] - targetStart [targetStart = 0] The offset within target at which to begin writing + * @param { number } [sourceStart] - sourceStart [sourceStart = 0] The offset within buf from which to begin copying + * @param { number } [sourceEnd] - sourceEnd [sourceEnd = buf.length] The offset within buf at which to stop copying (not inclusive) + * @returns { number } The number of bytes copied + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @throws { BusinessError } 10200001 - The value of "[targetStart/sourceStart/sourceEnd]" is out of range. It must be >= 0. + * Received value is: [targetStart/sourceStart/sourceEnd] + * @syscap SystemCapability.Utils.Lang + * @since 9 + */ + /** + * Copies data from a region of buf to a region in target, even if the target memory region overlaps with buf. + * If sourceEnd is greater than the length of the target, the length of the target shall prevail, and the extra part will not be overwritten. + * + * @param { Buffer | Uint8Array } target - target target A Buffer or Uint8Array to copy into + * @param { number } [targetStart] - targetStart [targetStart = 0] The offset within target at which to begin writing + * @param { number } [sourceStart] - sourceStart [sourceStart = 0] The offset within buf from which to begin copying + * @param { number } [sourceEnd] - sourceEnd [sourceEnd = buf.length] The offset within buf at which to stop copying (not inclusive) + * @returns { number } The number of bytes copied + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @throws { BusinessError } 10200001 - The value of "[targetStart/sourceStart/sourceEnd]" is out of range. It must be >= 0. + * Received value is: [targetStart/sourceStart/sourceEnd] + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @since 10 + */ + /** + * Copies data from a region of buf to a region in target, even if the target memory region overlaps with buf. + * If sourceEnd is greater than the length of the target, the length of the target shall prevail, and the extra part will not be overwritten. + * + * @param { Buffer | Uint8Array } target - target target A Buffer or Uint8Array to copy into + * @param { number } [targetStart] - targetStart [targetStart = 0] The offset within target at which to begin writing + * @param { number } [sourceStart] - sourceStart [sourceStart = 0] The offset within buf from which to begin copying + * @param { number } [sourceEnd] - sourceEnd [sourceEnd = buf.length] The offset within buf at which to stop copying (not inclusive) + * @returns { number } The number of bytes copied + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @throws { BusinessError } 10200001 - The value of "[targetStart/sourceStart/sourceEnd]" is out of range. It must be >= 0. + * Received value is: [targetStart/sourceStart/sourceEnd] + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 11 + */ + copy(target: Buffer | Uint8Array, targetStart?: number, sourceStart?: number, sourceEnd?: number): number; + /** + * Returns true if both buf and otherBuffer have exactly the same bytes, false otherwise + * + * @param { Uint8Array | Buffer } otherBuffer - otherBuffer otherBuffer A Buffer or Uint8Array with which to compare buf + * @returns { boolean } true or false + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. + * @syscap SystemCapability.Utils.Lang + * @since 9 + */ + /** + * Returns true if both buf and otherBuffer have exactly the same bytes, false otherwise + * + * @param { Uint8Array | Buffer } otherBuffer - otherBuffer otherBuffer A Buffer or Uint8Array with which to compare buf + * @returns { boolean } true or false + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @since 10 + */ + /** + * Returns true if both buf and otherBuffer have exactly the same bytes, false otherwise + * + * @param { Uint8Array | Buffer } otherBuffer - otherBuffer otherBuffer A Buffer or Uint8Array with which to compare buf + * @returns { boolean } true or false + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 11 + */ + equals(otherBuffer: Uint8Array | Buffer): boolean; + /** + * Returns true if value was found in buf, false otherwise + * + * @param { string | number | Buffer | Uint8Array } value - value value What to search for + * @param { number } [byteOffset] - byteOffset [byteOffset = 0] Where to begin searching in buf. If negative, then offset is calculated from the end of buf + * @param { BufferEncoding } [encoding] - encoding [encoding='utf8'] If value is a string, this is its encoding + * @returns { boolean } true or false + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @syscap SystemCapability.Utils.Lang + * @since 9 + */ + /** + * Returns true if value was found in buf, false otherwise + * + * @param { string | number | Buffer | Uint8Array } value - value value What to search for + * @param { number } [byteOffset] - byteOffset [byteOffset = 0] Where to begin searching in buf. If negative, then offset is calculated from the end of buf + * @param { BufferEncoding } [encoding] - encoding [encoding='utf8'] If value is a string, this is its encoding + * @returns { boolean } true or false + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @since 10 + */ + /** + * Returns true if value was found in buf, false otherwise + * + * @param { string | number | Buffer | Uint8Array } value - value value What to search for + * @param { number } [byteOffset] - byteOffset [byteOffset = 0] Where to begin searching in buf. If negative, then offset is calculated from the end of buf + * @param { BufferEncoding } [encoding] - encoding [encoding='utf8'] If value is a string, this is its encoding + * @returns { boolean } true or false + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 11 + */ + includes(value: string | number | Buffer | Uint8Array, byteOffset?: number, encoding?: BufferEncoding): boolean; + /** + * The index of the first occurrence of value in buf + * + * @param { string | number | Buffer | Uint8Array } value - value value What to search for + * @param { number } [byteOffset] - byteOffset [byteOffset = 0] Where to begin searching in buf + * @param { BufferEncoding } [encoding] - encoding [encoding='utf8'] If value is a string, + * this is the encoding used to determine the binary representation of the string that will be searched for in buf + * @returns { number } The index of the first occurrence of value in buf, or -1 if buf does not contain value + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @syscap SystemCapability.Utils.Lang + * @since 9 + */ + /** + * The index of the first occurrence of value in buf + * + * @param { string | number | Buffer | Uint8Array } value - value value What to search for + * @param { number } [byteOffset] - byteOffset [byteOffset = 0] Where to begin searching in buf + * @param { BufferEncoding } [encoding] - encoding [encoding='utf8'] If value is a string, + * this is the encoding used to determine the binary representation of the string that will be searched for in buf + * @returns { number } The index of the first occurrence of value in buf, or -1 if buf does not contain value + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @since 10 + */ + /** + * The index of the first occurrence of value in buf + * + * @param { string | number | Buffer | Uint8Array } value - value value What to search for + * @param { number } [byteOffset] - byteOffset [byteOffset = 0] Where to begin searching in buf + * @param { BufferEncoding } [encoding] - encoding [encoding='utf8'] If value is a string, + * this is the encoding used to determine the binary representation of the string that will be searched for in buf + * @returns { number } The index of the first occurrence of value in buf, or -1 if buf does not contain value + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 11 + */ + indexOf(value: string | number | Buffer | Uint8Array, byteOffset?: number, encoding?: BufferEncoding): number; + /** + * Creates and returns an iterator of buf keys (indices). + * + * @returns { IterableIterator } + * @syscap SystemCapability.Utils.Lang + * @since 9 + */ + /** + * Creates and returns an iterator of buf keys (indices). + * + * @returns { IterableIterator } + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @since 10 + */ + /** + * Creates and returns an iterator of buf keys (indices). + * + * @returns { IterableIterator } + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 11 + */ + keys(): IterableIterator; + /** + * Creates and returns an iterator for buf values (bytes). + * + * @returns { IterableIterator } + * @syscap SystemCapability.Utils.Lang + * @since 9 + */ + /** + * Creates and returns an iterator for buf values (bytes). + * + * @returns { IterableIterator } + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @since 10 + */ + /** + * Creates and returns an iterator for buf values (bytes). + * + * @returns { IterableIterator } + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 11 + */ + values(): IterableIterator; + /** + * Creates and returns an iterator of [index, byte] pairs from the contents of buf. + * + * @returns { IterableIterator<[number, number]> } + * @syscap SystemCapability.Utils.Lang + * @since 9 + */ + /** + * Creates and returns an iterator of [index, byte] pairs from the contents of buf. + * + * @returns { IterableIterator<[number, number]> } + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @since 10 + */ + /** + * Creates and returns an iterator of [index, byte] pairs from the contents of buf. + * + * @returns { IterableIterator<[number, number]> } + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 11 + */ + entries(): IterableIterator<[ + number, + number + ]>; + /** + * The index of the last occurrence of value in buf + * + * @param { string | number | Buffer | Uint8Array } value - value value What to search for + * @param { number } [byteOffset] - byteOffset [byteOffset = 0] Where to begin searching in buf + * @param { BufferEncoding } [encoding] - encoding [encoding='utf8'] If value is a string, + * this is the encoding used to determine the binary representation of the string that will be searched for in buf + * @returns { number } The index of the last occurrence of value in buf, or -1 if buf does not contain value + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @syscap SystemCapability.Utils.Lang + * @since 9 + */ + /** + * The index of the last occurrence of value in buf + * + * @param { string | number | Buffer | Uint8Array } value - value value What to search for + * @param { number } [byteOffset] - byteOffset [byteOffset = 0] Where to begin searching in buf + * @param { BufferEncoding } [encoding] - encoding [encoding='utf8'] If value is a string, + * this is the encoding used to determine the binary representation of the string that will be searched for in buf + * @returns { number } The index of the last occurrence of value in buf, or -1 if buf does not contain value + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @since 10 + */ + /** + * The index of the last occurrence of value in buf + * + * @param { string | number | Buffer | Uint8Array } value - value value What to search for + * @param { number } [byteOffset] - byteOffset [byteOffset = 0] Where to begin searching in buf + * @param { BufferEncoding } [encoding] - encoding [encoding='utf8'] If value is a string, + * this is the encoding used to determine the binary representation of the string that will be searched for in buf + * @returns { number } The index of the last occurrence of value in buf, or -1 if buf does not contain value + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 11 + */ + lastIndexOf(value: string | number | Buffer | Uint8Array, byteOffset?: number, encoding?: BufferEncoding): number; + /** + * Reads a signed, big-endian 64-bit integer from buf at the specified offset + * + * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to read. Must satisfy: 0 <= offset <= buf.length - 8 + * @returns { bigint } Return a signed, big-endian 64-bit integer + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Incorrect parameter types. + * @throws { BusinessError } 10200001 - The value of "offset" is out of range. It must be >= 0 and <= buf.length - 8. Received value is: [offset] + * @syscap SystemCapability.Utils.Lang + * @since 9 + */ + /** + * Reads a signed, big-endian 64-bit integer from buf at the specified offset + * + * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to read. Must satisfy: 0 <= offset <= buf.length - 8 + * @returns { bigint } Return a signed, big-endian 64-bit integer + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Incorrect parameter types. + * @throws { BusinessError } 10200001 - The value of "offset" is out of range. It must be >= 0 and <= buf.length - 8. Received value is: [offset] + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @since 10 + */ + /** + * Reads a signed, big-endian 64-bit integer from buf at the specified offset + * + * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to read. Must satisfy: 0 <= offset <= buf.length - 8 + * @returns { bigint } Return a signed, big-endian 64-bit integer + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Incorrect parameter types. + * @throws { BusinessError } 10200001 - The value of "offset" is out of range. It must be >= 0 and <= buf.length - 8. Received value is: [offset] + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 11 + */ + readBigInt64BE(offset?: number): bigint; + /** + * Reads a signed, little-endian 64-bit integer from buf at the specified offset + * + * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to read. Must satisfy: 0 <= offset <= buf.length - 8 + * @returns { bigint } Return a signed, little-endian 64-bit integer + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Incorrect parameter types. + * @throws { BusinessError } 10200001 - The value of "offset" is out of range. It must be >= 0 and <= buf.length - 8. Received value is: [offset] + * @syscap SystemCapability.Utils.Lang + * @since 9 + */ + /** + * Reads a signed, little-endian 64-bit integer from buf at the specified offset + * + * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to read. Must satisfy: 0 <= offset <= buf.length - 8 + * @returns { bigint } Return a signed, little-endian 64-bit integer + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Incorrect parameter types. + * @throws { BusinessError } 10200001 - The value of "offset" is out of range. It must be >= 0 and <= buf.length - 8. Received value is: [offset] + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @since 10 + */ + /** + * Reads a signed, little-endian 64-bit integer from buf at the specified offset + * + * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to read. Must satisfy: 0 <= offset <= buf.length - 8 + * @returns { bigint } Return a signed, little-endian 64-bit integer + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Incorrect parameter types. + * @throws { BusinessError } 10200001 - The value of "offset" is out of range. It must be >= 0 and <= buf.length - 8. Received value is: [offset] + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 11 + */ + readBigInt64LE(offset?: number): bigint; + /** + * Reads a unsigned, big-endian 64-bit integer from buf at the specified offset + * + * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to read. Must satisfy: 0 <= offset <= buf.length - 8 + * @returns { bigint } Return a unsigned, big-endian 64-bit integer + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Incorrect parameter types. + * @throws { BusinessError } 10200001 - The value of "offset" is out of range. It must be >= 0 and <= buf.length - 8. Received value is: [offset] + * @syscap SystemCapability.Utils.Lang + * @since 9 + */ + /** + * Reads a unsigned, big-endian 64-bit integer from buf at the specified offset + * + * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to read. Must satisfy: 0 <= offset <= buf.length - 8 + * @returns { bigint } Return a unsigned, big-endian 64-bit integer + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Incorrect parameter types. + * @throws { BusinessError } 10200001 - The value of "offset" is out of range. It must be >= 0 and <= buf.length - 8. Received value is: [offset] + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @since 10 + */ + /** + * Reads a unsigned, big-endian 64-bit integer from buf at the specified offset + * + * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to read. Must satisfy: 0 <= offset <= buf.length - 8 + * @returns { bigint } Return a unsigned, big-endian 64-bit integer + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Incorrect parameter types. + * @throws { BusinessError } 10200001 - The value of "offset" is out of range. It must be >= 0 and <= buf.length - 8. Received value is: [offset] + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 11 + */ + readBigUInt64BE(offset?: number): bigint; + /** + * Reads a unsigned, little-endian 64-bit integer from buf at the specified offset + * + * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to read. Must satisfy: 0 <= offset <= buf.length - 8 + * @returns { bigint } Return a unsigned, little-endian 64-bit integer + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Incorrect parameter types. + * @throws { BusinessError } 10200001 - The value of "offset" is out of range. It must be >= 0 and <= buf.length - 8. Received value is: [offset] + * @syscap SystemCapability.Utils.Lang + * @since 9 + */ + /** + * Reads a unsigned, little-endian 64-bit integer from buf at the specified offset + * + * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to read. Must satisfy: 0 <= offset <= buf.length - 8 + * @returns { bigint } Return a unsigned, little-endian 64-bit integer + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Incorrect parameter types. + * @throws { BusinessError } 10200001 - The value of "offset" is out of range. It must be >= 0 and <= buf.length - 8. Received value is: [offset] + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @since 10 + */ + /** + * Reads a unsigned, little-endian 64-bit integer from buf at the specified offset + * + * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to read. Must satisfy: 0 <= offset <= buf.length - 8 + * @returns { bigint } Return a unsigned, little-endian 64-bit integer + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Incorrect parameter types. + * @throws { BusinessError } 10200001 - The value of "offset" is out of range. It must be >= 0 and <= buf.length - 8. Received value is: [offset] + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 11 + */ + readBigUInt64LE(offset?: number): bigint; + /** + * Reads a 64-bit, big-endian double from buf at the specified offset + * + * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to read. Must satisfy: 0 <= offset <= buf.length - 8 + * @returns { number } Return a 64-bit, big-endian double + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Incorrect parameter types. + * @throws { BusinessError } 10200001 - The value of "offset" is out of range. It must be >= 0 and <= buf.length - 8. Received value is: [offset] + * @syscap SystemCapability.Utils.Lang + * @since 9 + */ + /** + * Reads a 64-bit, big-endian double from buf at the specified offset + * + * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to read. Must satisfy: 0 <= offset <= buf.length - 8 + * @returns { number } Return a 64-bit, big-endian double + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Incorrect parameter types. + * @throws { BusinessError } 10200001 - The value of "offset" is out of range. It must be >= 0 and <= buf.length - 8. Received value is: [offset] + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @since 10 + */ + /** + * Reads a 64-bit, big-endian double from buf at the specified offset + * + * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to read. Must satisfy: 0 <= offset <= buf.length - 8 + * @returns { number } Return a 64-bit, big-endian double + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Incorrect parameter types. + * @throws { BusinessError } 10200001 - The value of "offset" is out of range. It must be >= 0 and <= buf.length - 8. Received value is: [offset] + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 11 + */ + readDoubleBE(offset?: number): number; + /** + * Reads a 64-bit, little-endian double from buf at the specified offset + * + * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to read. Must satisfy: 0 <= offset <= buf.length - 8 + * @returns { number } Return a 64-bit, little-endian double + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Incorrect parameter types. + * @throws { BusinessError } 10200001 - The value of "offset" is out of range. It must be >= 0 and <= buf.length - 8. Received value is: [offset] + * @syscap SystemCapability.Utils.Lang + * @since 9 + */ + /** + * Reads a 64-bit, little-endian double from buf at the specified offset + * + * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to read. Must satisfy: 0 <= offset <= buf.length - 8 + * @returns { number } Return a 64-bit, little-endian double + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Incorrect parameter types. + * @throws { BusinessError } 10200001 - The value of "offset" is out of range. It must be >= 0 and <= buf.length - 8. Received value is: [offset] + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @since 10 + */ + /** + * Reads a 64-bit, little-endian double from buf at the specified offset + * + * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to read. Must satisfy: 0 <= offset <= buf.length - 8 + * @returns { number } Return a 64-bit, little-endian double + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Incorrect parameter types. + * @throws { BusinessError } 10200001 - The value of "offset" is out of range. It must be >= 0 and <= buf.length - 8. Received value is: [offset] + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 11 + */ + readDoubleLE(offset?: number): number; + /** + * Reads a 32-bit, big-endian float from buf at the specified offset + * + * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to read. Must satisfy: 0 <= offset <= buf.length - 4 + * @returns { number } Return a 32-bit, big-endian float + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Incorrect parameter types. + * @throws { BusinessError } 10200001 - The value of "offset" is out of range. It must be >= 0 and <= buf.length - 4. Received value is: [offset] + * @syscap SystemCapability.Utils.Lang + * @since 9 + */ + /** + * Reads a 32-bit, big-endian float from buf at the specified offset + * + * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to read. Must satisfy: 0 <= offset <= buf.length - 4 + * @returns { number } Return a 32-bit, big-endian float + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Incorrect parameter types. + * @throws { BusinessError } 10200001 - The value of "offset" is out of range. It must be >= 0 and <= buf.length - 4. Received value is: [offset] + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @since 10 + */ + /** + * Reads a 32-bit, big-endian float from buf at the specified offset + * + * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to read. Must satisfy: 0 <= offset <= buf.length - 4 + * @returns { number } Return a 32-bit, big-endian float + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Incorrect parameter types. + * @throws { BusinessError } 10200001 - The value of "offset" is out of range. It must be >= 0 and <= buf.length - 4. Received value is: [offset] + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 11 + */ + readFloatBE(offset?: number): number; + /** + * Reads a 32-bit, little-endian float from buf at the specified offset + * + * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to read. Must satisfy: 0 <= offset <= buf.length - 4 + * @returns { number } Return a 32-bit, little-endian float + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Incorrect parameter types. + * @throws { BusinessError } 10200001 - The value of "offset" is out of range. It must be >= 0 and <= buf.length - 4. Received value is: [offset] + * @syscap SystemCapability.Utils.Lang + * @since 9 + */ + /** + * Reads a 32-bit, little-endian float from buf at the specified offset + * + * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to read. Must satisfy: 0 <= offset <= buf.length - 4 + * @returns { number } Return a 32-bit, little-endian float + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Incorrect parameter types. + * @throws { BusinessError } 10200001 - The value of "offset" is out of range. It must be >= 0 and <= buf.length - 4. Received value is: [offset] + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @since 10 + */ + /** + * Reads a 32-bit, little-endian float from buf at the specified offset + * + * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to read. Must satisfy: 0 <= offset <= buf.length - 4 + * @returns { number } Return a 32-bit, little-endian float + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Incorrect parameter types. + * @throws { BusinessError } 10200001 - The value of "offset" is out of range. It must be >= 0 and <= buf.length - 4. Received value is: [offset] + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 11 + */ + readFloatLE(offset?: number): number; + /** + * Reads a signed 8-bit integer from buf at the specified offset + * + * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to read. Must satisfy: 0 <= offset <= buf.length - 1 + * @returns { number } Return a signed 8-bit integer + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Incorrect parameter types. + * @throws { BusinessError } 10200001 - The value of "offset" is out of range. It must be >= 0 and <= buf.length - 1. Received value is: [offset] + * @syscap SystemCapability.Utils.Lang + * @since 9 + */ + /** + * Reads a signed 8-bit integer from buf at the specified offset + * + * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to read. Must satisfy: 0 <= offset <= buf.length - 1 + * @returns { number } Return a signed 8-bit integer + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Incorrect parameter types. + * @throws { BusinessError } 10200001 - The value of "offset" is out of range. It must be >= 0 and <= buf.length - 1. Received value is: [offset] + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @since 10 + */ + /** + * Reads a signed 8-bit integer from buf at the specified offset + * + * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to read. Must satisfy: 0 <= offset <= buf.length - 1 + * @returns { number } Return a signed 8-bit integer + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Incorrect parameter types. + * @throws { BusinessError } 10200001 - The value of "offset" is out of range. It must be >= 0 and <= buf.length - 1. Received value is: [offset] + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 11 + */ + readInt8(offset?: number): number; + /** + * Reads a signed, big-endian 16-bit integer from buf at the specified offset + * + * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to read. Must satisfy: 0 <= offset <= buf.length - 2 + * @returns { number } Return a signed, big-endian 16-bit integer + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Incorrect parameter types. + * @throws { BusinessError } 10200001 - The value of "offset" is out of range. It must be >= 0 and <= buf.length - 2. Received value is: [offset] + * @syscap SystemCapability.Utils.Lang + * @since 9 + */ + /** + * Reads a signed, big-endian 16-bit integer from buf at the specified offset + * + * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to read. Must satisfy: 0 <= offset <= buf.length - 2 + * @returns { number } Return a signed, big-endian 16-bit integer + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Incorrect parameter types. + * @throws { BusinessError } 10200001 - The value of "offset" is out of range. It must be >= 0 and <= buf.length - 2. Received value is: [offset] + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @since 10 + */ + /** + * Reads a signed, big-endian 16-bit integer from buf at the specified offset + * + * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to read. Must satisfy: 0 <= offset <= buf.length - 2 + * @returns { number } Return a signed, big-endian 16-bit integer + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Incorrect parameter types. + * @throws { BusinessError } 10200001 - The value of "offset" is out of range. It must be >= 0 and <= buf.length - 2. Received value is: [offset] + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 11 + */ + readInt16BE(offset?: number): number; + /** + * Reads a signed, little-endian 16-bit integer from buf at the specified offset + * + * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to read. Must satisfy: 0 <= offset <= buf.length - 2 + * @returns { number } Return a signed, little-endian 16-bit integer + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Incorrect parameter types. + * @throws { BusinessError } 10200001 - The value of "offset" is out of range. It must be >= 0 and <= buf.length - 2. Received value is: [offset] + * @syscap SystemCapability.Utils.Lang + * @since 9 + */ + /** + * Reads a signed, little-endian 16-bit integer from buf at the specified offset + * + * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to read. Must satisfy: 0 <= offset <= buf.length - 2 + * @returns { number } Return a signed, little-endian 16-bit integer + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Incorrect parameter types. + * @throws { BusinessError } 10200001 - The value of "offset" is out of range. It must be >= 0 and <= buf.length - 2. Received value is: [offset] + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @since 10 + */ + /** + * Reads a signed, little-endian 16-bit integer from buf at the specified offset + * + * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to read. Must satisfy: 0 <= offset <= buf.length - 2 + * @returns { number } Return a signed, little-endian 16-bit integer + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Incorrect parameter types. + * @throws { BusinessError } 10200001 - The value of "offset" is out of range. It must be >= 0 and <= buf.length - 2. Received value is: [offset] + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 11 + */ + readInt16LE(offset?: number): number; + /** + * Reads a signed, big-endian 32-bit integer from buf at the specified offset + * + * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to read. Must satisfy: 0 <= offset <= buf.length - 4 + * @returns { number } Return a signed, big-endian 32-bit integer + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Incorrect parameter types. + * @throws { BusinessError } 10200001 - The value of "offset" is out of range. It must be >= 0 and <= buf.length - 4. Received value is: [offset] + * @syscap SystemCapability.Utils.Lang + * @since 9 + */ + /** + * Reads a signed, big-endian 32-bit integer from buf at the specified offset + * + * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to read. Must satisfy: 0 <= offset <= buf.length - 4 + * @returns { number } Return a signed, big-endian 32-bit integer + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Incorrect parameter types. + * @throws { BusinessError } 10200001 - The value of "offset" is out of range. It must be >= 0 and <= buf.length - 4. Received value is: [offset] + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @since 10 + */ + /** + * Reads a signed, big-endian 32-bit integer from buf at the specified offset + * + * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to read. Must satisfy: 0 <= offset <= buf.length - 4 + * @returns { number } Return a signed, big-endian 32-bit integer + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Incorrect parameter types. + * @throws { BusinessError } 10200001 - The value of "offset" is out of range. It must be >= 0 and <= buf.length - 4. Received value is: [offset] + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 11 + */ + readInt32BE(offset?: number): number; + /** + * Reads a signed, little-endian 32-bit integer from buf at the specified offset + * + * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to read. Must satisfy: 0 <= offset <= buf.length - 4 + * @returns { number } Return a signed, little-endian 32-bit integer + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Incorrect parameter types. + * @throws { BusinessError } 10200001 - The value of "offset" is out of range. It must be >= 0 and <= buf.length - 4. Received value is: [offset] + * @syscap SystemCapability.Utils.Lang + * @since 9 + */ + /** + * Reads a signed, little-endian 32-bit integer from buf at the specified offset + * + * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to read. Must satisfy: 0 <= offset <= buf.length - 4 + * @returns { number } Return a signed, little-endian 32-bit integer + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Incorrect parameter types. + * @throws { BusinessError } 10200001 - The value of "offset" is out of range. It must be >= 0 and <= buf.length - 4. Received value is: [offset] + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @since 10 + */ + /** + * Reads a signed, little-endian 32-bit integer from buf at the specified offset + * + * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to read. Must satisfy: 0 <= offset <= buf.length - 4 + * @returns { number } Return a signed, little-endian 32-bit integer + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Incorrect parameter types. + * @throws { BusinessError } 10200001 - The value of "offset" is out of range. It must be >= 0 and <= buf.length - 4. Received value is: [offset] + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 11 + */ + readInt32LE(offset?: number): number; + /** + * Reads byteLength number of bytes from buf at the specified offset and interprets the result as a big-endian, + * two's complement signed value supporting up to 48 bits of accuracy + * + * @param { number } offset - offset offset Number of bytes to skip before starting to read. Must satisfy: 0 <= offset <= buf.length - byteLength + * @param { number } byteLength - byteLength byteLength Number of bytes to read. Must satisfy 0 < byteLength <= 6 + * @returns { number } + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @throws { BusinessError } 10200001 - The value of "[param]" is out of range. It must be >= [left range] and <= [right range]. Received value is: [param] + * @syscap SystemCapability.Utils.Lang + * @since 9 + */ + /** + * Reads byteLength number of bytes from buf at the specified offset and interprets the result as a big-endian, + * two's complement signed value supporting up to 48 bits of accuracy + * + * @param { number } offset - offset offset Number of bytes to skip before starting to read. Must satisfy: 0 <= offset <= buf.length - byteLength + * @param { number } byteLength - byteLength byteLength Number of bytes to read. Must satisfy 0 < byteLength <= 6 + * @returns { number } + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @throws { BusinessError } 10200001 - The value of "[param]" is out of range. It must be >= [left range] and <= [right range]. Received value is: [param] + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @since 10 + */ + /** + * Reads byteLength number of bytes from buf at the specified offset and interprets the result as a big-endian, + * two's complement signed value supporting up to 48 bits of accuracy + * + * @param { number } offset - offset offset Number of bytes to skip before starting to read. Must satisfy: 0 <= offset <= buf.length - byteLength + * @param { number } byteLength - byteLength byteLength Number of bytes to read. Must satisfy 0 < byteLength <= 6 + * @returns { number } + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @throws { BusinessError } 10200001 - The value of "[param]" is out of range. It must be >= [left range] and <= [right range]. Received value is: [param] + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 11 + */ + readIntBE(offset: number, byteLength: number): number; + /** + * Reads byteLength number of bytes from buf at the specified offset and interprets the result as a little-endian, + * two's complement signed value supporting up to 48 bits of accuracy. + * + * @param { number } offset - offset offset Number of bytes to skip before starting to read. Must satisfy: 0 <= offset <= buf.length - byteLength + * @param { number } byteLength - byteLength byteLength Number of bytes to read. Must satisfy 0 < byteLength <= 6 + * @returns { number } + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @throws { BusinessError } 10200001 - The value of "[param]" is out of range. It must be >= [left range] and <= [right range]. Received value is: [param] + * @syscap SystemCapability.Utils.Lang + * @since 9 + */ + /** + * Reads byteLength number of bytes from buf at the specified offset and interprets the result as a little-endian, + * two's complement signed value supporting up to 48 bits of accuracy. + * + * @param { number } offset - offset offset Number of bytes to skip before starting to read. Must satisfy: 0 <= offset <= buf.length - byteLength + * @param { number } byteLength - byteLength byteLength Number of bytes to read. Must satisfy 0 < byteLength <= 6 + * @returns { number } + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @throws { BusinessError } 10200001 - The value of "[param]" is out of range. It must be >= [left range] and <= [right range]. Received value is: [param] + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @since 10 + */ + /** + * Reads byteLength number of bytes from buf at the specified offset and interprets the result as a little-endian, + * two's complement signed value supporting up to 48 bits of accuracy. + * + * @param { number } offset - offset offset Number of bytes to skip before starting to read. Must satisfy: 0 <= offset <= buf.length - byteLength + * @param { number } byteLength - byteLength byteLength Number of bytes to read. Must satisfy 0 < byteLength <= 6 + * @returns { number } + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @throws { BusinessError } 10200001 - The value of "[param]" is out of range. It must be >= [left range] and <= [right range]. Received value is: [param] + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 11 + */ + readIntLE(offset: number, byteLength: number): number; + /** + * Reads an unsigned 8-bit integer from buf at the specified offset + * + * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to read. Must satisfy 0 <= offset <= buf.length - 1 + * @returns { number } Reads an unsigned 8-bit integer + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Incorrect parameter types. + * @throws { BusinessError } 10200001 - The value of "offset" is out of range. It must be >= 0 and <= buf.length - 1. Received value is: [offset] + * @syscap SystemCapability.Utils.Lang + * @since 9 + */ + /** + * Reads an unsigned 8-bit integer from buf at the specified offset + * + * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to read. Must satisfy 0 <= offset <= buf.length - 1 + * @returns { number } Reads an unsigned 8-bit integer + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Incorrect parameter types. + * @throws { BusinessError } 10200001 - The value of "offset" is out of range. It must be >= 0 and <= buf.length - 1. Received value is: [offset] + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @since 10 + */ + /** + * Reads an unsigned 8-bit integer from buf at the specified offset + * + * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to read. Must satisfy 0 <= offset <= buf.length - 1 + * @returns { number } Reads an unsigned 8-bit integer + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Incorrect parameter types. + * @throws { BusinessError } 10200001 - The value of "offset" is out of range. It must be >= 0 and <= buf.length - 1. Received value is: [offset] + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 11 + */ + readUInt8(offset?: number): number; + /** + * Reads an unsigned, big-endian 16-bit integer from buf at the specified offset + * + * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to read. Must satisfy 0 <= offset <= buf.length - 2 + * @returns { number } Reads an unsigned, big-endian 16-bit integer + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Incorrect parameter types. + * @throws { BusinessError } 10200001 - The value of "offset" is out of range. It must be >= 0 and <= buf.length - 2. Received value is: [offset] + * @syscap SystemCapability.Utils.Lang + * @since 9 + */ + /** + * Reads an unsigned, big-endian 16-bit integer from buf at the specified offset + * + * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to read. Must satisfy 0 <= offset <= buf.length - 2 + * @returns { number } Reads an unsigned, big-endian 16-bit integer + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Incorrect parameter types. + * @throws { BusinessError } 10200001 - The value of "offset" is out of range. It must be >= 0 and <= buf.length - 2. Received value is: [offset] + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @since 10 + */ + /** + * Reads an unsigned, big-endian 16-bit integer from buf at the specified offset + * + * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to read. Must satisfy 0 <= offset <= buf.length - 2 + * @returns { number } Reads an unsigned, big-endian 16-bit integer + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Incorrect parameter types. + * @throws { BusinessError } 10200001 - The value of "offset" is out of range. It must be >= 0 and <= buf.length - 2. Received value is: [offset] + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 11 + */ + readUInt16BE(offset?: number): number; + /** + * Reads an unsigned, little-endian 16-bit integer from buf at the specified offset + * + * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to read. Must satisfy 0 <= offset <= buf.length - 2 + * @returns { number } Reads an unsigned, little-endian 16-bit integer + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Incorrect parameter types. + * @throws { BusinessError } 10200001 - The value of "offset" is out of range. It must be >= 0 and <= buf.length - 2. Received value is: [offset] + * @syscap SystemCapability.Utils.Lang + * @since 9 + */ + /** + * Reads an unsigned, little-endian 16-bit integer from buf at the specified offset + * + * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to read. Must satisfy 0 <= offset <= buf.length - 2 + * @returns { number } Reads an unsigned, little-endian 16-bit integer + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Incorrect parameter types. + * @throws { BusinessError } 10200001 - The value of "offset" is out of range. It must be >= 0 and <= buf.length - 2. Received value is: [offset] + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @since 10 + */ + /** + * Reads an unsigned, little-endian 16-bit integer from buf at the specified offset + * + * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to read. Must satisfy 0 <= offset <= buf.length - 2 + * @returns { number } Reads an unsigned, little-endian 16-bit integer + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Incorrect parameter types. + * @throws { BusinessError } 10200001 - The value of "offset" is out of range. It must be >= 0 and <= buf.length - 2. Received value is: [offset] + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 11 + */ + readUInt16LE(offset?: number): number; + /** + * Reads an unsigned, big-endian 32-bit integer from buf at the specified offset + * + * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to read. Must satisfy 0 <= offset <= buf.length - 4 + * @returns { number } Reads an unsigned, big-endian 32-bit integer + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Incorrect parameter types. + * @throws { BusinessError } 10200001 - The value of "offset" is out of range. It must be >= 0 and <= buf.length - 4. Received value is: [offset] + * @syscap SystemCapability.Utils.Lang + * @since 9 + */ + /** + * Reads an unsigned, big-endian 32-bit integer from buf at the specified offset + * + * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to read. Must satisfy 0 <= offset <= buf.length - 4 + * @returns { number } Reads an unsigned, big-endian 32-bit integer + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Incorrect parameter types. + * @throws { BusinessError } 10200001 - The value of "offset" is out of range. It must be >= 0 and <= buf.length - 4. Received value is: [offset] + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @since 10 + */ + /** + * Reads an unsigned, big-endian 32-bit integer from buf at the specified offset + * + * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to read. Must satisfy 0 <= offset <= buf.length - 4 + * @returns { number } Reads an unsigned, big-endian 32-bit integer + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Incorrect parameter types. + * @throws { BusinessError } 10200001 - The value of "offset" is out of range. It must be >= 0 and <= buf.length - 4. Received value is: [offset] + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 11 + */ + readUInt32BE(offset?: number): number; + /** + * Reads an unsigned, little-endian 32-bit integer from buf at the specified offset + * + * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to read. Must satisfy 0 <= offset <= buf.length - 4 + * @returns { number } Reads an unsigned, little-endian 32-bit integer + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Incorrect parameter types. + * @throws { BusinessError } 10200001 - The value of "offset" is out of range. It must be >= 0 and <= buf.length - 4. Received value is: [offset] + * @syscap SystemCapability.Utils.Lang + * @since 9 + */ + /** + * Reads an unsigned, little-endian 32-bit integer from buf at the specified offset + * + * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to read. Must satisfy 0 <= offset <= buf.length - 4 + * @returns { number } Reads an unsigned, little-endian 32-bit integer + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Incorrect parameter types. + * @throws { BusinessError } 10200001 - The value of "offset" is out of range. It must be >= 0 and <= buf.length - 4. Received value is: [offset] + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @since 10 + */ + /** + * Reads an unsigned, little-endian 32-bit integer from buf at the specified offset + * + * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to read. Must satisfy 0 <= offset <= buf.length - 4 + * @returns { number } Reads an unsigned, little-endian 32-bit integer + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Incorrect parameter types. + * @throws { BusinessError } 10200001 - The value of "offset" is out of range. It must be >= 0 and <= buf.length - 4. Received value is: [offset] + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 11 + */ + readUInt32LE(offset?: number): number; + /** + * Reads byteLength number of bytes from buf at the specified offset and interprets the result as + * an unsigned big-endian integer supporting up to 48 bits of accuracy. + * + * @param { number } offset - offset offset Number of bytes to skip before starting to read. Must satisfy: 0 <= offset <= buf.length - byteLength + * @param { number } byteLength - byteLength byteLength Number of bytes to read. Must satisfy 0 < byteLength <= 6 + * @returns { number } + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @throws { BusinessError } 10200001 - The value of "[param]" is out of range. It must be >= [left range] and <= [right range]. Received value is: [param] + * @syscap SystemCapability.Utils.Lang + * @since 9 + */ + /** + * Reads byteLength number of bytes from buf at the specified offset and interprets the result as + * an unsigned big-endian integer supporting up to 48 bits of accuracy. + * + * @param { number } offset - offset offset Number of bytes to skip before starting to read. Must satisfy: 0 <= offset <= buf.length - byteLength + * @param { number } byteLength - byteLength byteLength Number of bytes to read. Must satisfy 0 < byteLength <= 6 + * @returns { number } + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @throws { BusinessError } 10200001 - The value of "[param]" is out of range. It must be >= [left range] and <= [right range]. Received value is: [param] + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @since 10 + */ + /** + * Reads byteLength number of bytes from buf at the specified offset and interprets the result as + * an unsigned big-endian integer supporting up to 48 bits of accuracy. + * + * @param { number } offset - offset offset Number of bytes to skip before starting to read. Must satisfy: 0 <= offset <= buf.length - byteLength + * @param { number } byteLength - byteLength byteLength Number of bytes to read. Must satisfy 0 < byteLength <= 6 + * @returns { number } + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @throws { BusinessError } 10200001 - The value of "[param]" is out of range. It must be >= [left range] and <= [right range]. Received value is: [param] + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 11 + */ + readUIntBE(offset: number, byteLength: number): number; + /** + * Reads byteLength number of bytes from buf at the specified offset and interprets the result as an unsigned, + * little-endian integer supporting up to 48 bits of accuracy. + * + * @param { number } offset - offset offset Number of bytes to skip before starting to read. Must satisfy: 0 <= offset <= buf.length - byteLength + * @param { number } byteLength - byteLength byteLength Number of bytes to read. Must satisfy 0 < byteLength <= 6 + * @returns { number } + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @throws { BusinessError } 10200001 - The value of "[param]" is out of range. It must be >= [left range] and <= [right range]. Received value is: [param] + * @syscap SystemCapability.Utils.Lang + * @since 9 + */ + /** + * Reads byteLength number of bytes from buf at the specified offset and interprets the result as an unsigned, + * little-endian integer supporting up to 48 bits of accuracy. + * + * @param { number } offset - offset offset Number of bytes to skip before starting to read. Must satisfy: 0 <= offset <= buf.length - byteLength + * @param { number } byteLength - byteLength byteLength Number of bytes to read. Must satisfy 0 < byteLength <= 6 + * @returns { number } + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @throws { BusinessError } 10200001 - The value of "[param]" is out of range. It must be >= [left range] and <= [right range]. Received value is: [param] + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @since 10 + */ + /** + * Reads byteLength number of bytes from buf at the specified offset and interprets the result as an unsigned, + * little-endian integer supporting up to 48 bits of accuracy. + * + * @param { number } offset - offset offset Number of bytes to skip before starting to read. Must satisfy: 0 <= offset <= buf.length - byteLength + * @param { number } byteLength - byteLength byteLength Number of bytes to read. Must satisfy 0 < byteLength <= 6 + * @returns { number } + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @throws { BusinessError } 10200001 - The value of "[param]" is out of range. It must be >= [left range] and <= [right range]. Received value is: [param] + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 11 + */ + readUIntLE(offset: number, byteLength: number): number; + /** + * Returns a new Buffer that references the same memory as the original, but offset and cropped by the start and end indices. + * + * @param { number } [start] - start [start = 0] Where the new Buffer will start + * @param { number } [end] - end [end = buf.length] Where the new Buffer will end (not inclusive) + * @returns { Buffer } Returns a new Buffer that references the same memory as the original + * @syscap SystemCapability.Utils.Lang + * @since 9 + */ + /** + * Returns a new Buffer that references the same memory as the original, but offset and cropped by the start and end indices. + * + * @param { number } [start] - start [start = 0] Where the new Buffer will start + * @param { number } [end] - end [end = buf.length] Where the new Buffer will end (not inclusive) + * @returns { Buffer } Returns a new Buffer that references the same memory as the original + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @since 10 + */ + /** + * Returns a new Buffer that references the same memory as the original, but offset and cropped by the start and end indices. + * + * @param { number } [start] - start [start = 0] Where the new Buffer will start + * @param { number } [end] - end [end = buf.length] Where the new Buffer will end (not inclusive) + * @returns { Buffer } Returns a new Buffer that references the same memory as the original + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 11 + */ + subarray(start?: number, end?: number): Buffer; + /** + * Interprets buf as an array of unsigned 16-bit integers and swaps the byte order in-place. + * + * @returns { Buffer } A reference to buf + * @throws { BusinessError } 10200009 - Buffer size must be a multiple of 16-bits + * @syscap SystemCapability.Utils.Lang + * @since 9 + */ + /** + * Interprets buf as an array of unsigned 16-bit integers and swaps the byte order in-place. + * + * @returns { Buffer } A reference to buf + * @throws { BusinessError } 10200009 - Buffer size must be a multiple of 16-bits + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @since 10 + */ + /** + * Interprets buf as an array of unsigned 16-bit integers and swaps the byte order in-place. + * + * @returns { Buffer } A reference to buf + * @throws { BusinessError } 10200009 - Buffer size must be a multiple of 16-bits + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 11 + */ + swap16(): Buffer; + /** + * Interprets buf as an array of unsigned 32-bit integers and swaps the byte order in-place. + * + * @returns { Buffer } A reference to buf + * @throws { BusinessError } 10200009 - Buffer size must be a multiple of 32-bits + * @syscap SystemCapability.Utils.Lang + * @since 9 + */ + /** + * Interprets buf as an array of unsigned 32-bit integers and swaps the byte order in-place. + * + * @returns { Buffer } A reference to buf + * @throws { BusinessError } 10200009 - Buffer size must be a multiple of 32-bits + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @since 10 + */ + /** + * Interprets buf as an array of unsigned 32-bit integers and swaps the byte order in-place. + * + * @returns { Buffer } A reference to buf + * @throws { BusinessError } 10200009 - Buffer size must be a multiple of 32-bits + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 11 + */ + swap32(): Buffer; + /** + * Interprets buf as an array of unsigned 64-bit integers and swaps the byte order in-place. + * + * @returns { Buffer } A reference to buf + * @throws { BusinessError } 10200009 - Buffer size must be a multiple of 64-bits + * @syscap SystemCapability.Utils.Lang + * @since 9 + */ + /** + * Interprets buf as an array of unsigned 64-bit integers and swaps the byte order in-place. + * + * @returns { Buffer } A reference to buf + * @throws { BusinessError } 10200009 - Buffer size must be a multiple of 64-bits + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @since 10 + */ + /** + * Interprets buf as an array of unsigned 64-bit integers and swaps the byte order in-place. + * + * @returns { Buffer } A reference to buf + * @throws { BusinessError } 10200009 - Buffer size must be a multiple of 64-bits + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 11 + */ + swap64(): Buffer; + /** + * Returns a JSON representation of buf + * + * @returns { Object } Returns a JSON + * @syscap SystemCapability.Utils.Lang + * @since 9 + */ + /** + * Returns a JSON representation of buf + * + * @returns { Object } Returns a JSON + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @since 10 + */ + /** + * Returns a JSON representation of buf + * + * @returns { Object } Returns a JSON + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 11 + */ + toJSON(): Object; + /** + * Decodes buf to a string according to the specified character encoding in encoding + * + * @param { string } [encoding] - encoding [encoding='utf8'] The character encoding to use + * @param { number } [start] - start [start = 0] The byte offset to start decoding at + * @param { number } [end] - end [end = buf.length] The byte offset to stop decoding at (not inclusive) + * @returns { string } + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Incorrect parameter types. + * @syscap SystemCapability.Utils.Lang + * @since 9 + */ + /** + * Decodes buf to a string according to the specified character encoding in encoding + * + * @param { string } [encoding] - encoding [encoding='utf8'] The character encoding to use + * @param { number } [start] - start [start = 0] The byte offset to start decoding at + * @param { number } [end] - end [end = buf.length] The byte offset to stop decoding at (not inclusive) + * @returns { string } + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Incorrect parameter types. + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @since 10 + */ + /** + * Decodes buf to a string according to the specified character encoding in encoding + * + * @param { string } [encoding] - encoding [encoding='utf8'] The character encoding to use + * @param { number } [start] - start [start = 0] The byte offset to start decoding at + * @param { number } [end] - end [end = buf.length] The byte offset to stop decoding at (not inclusive) + * @returns { string } + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Incorrect parameter types. + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 11 + */ + toString(encoding?: string, start?: number, end?: number): string; + /** + * Writes string to buf at offset according to the character encoding in encoding + * + * @param { string } str - str str Writes string to buf at offset according to the character encoding in encoding + * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to write string + * @param { number } [length] - length [length = buf.length - offset] Maximum number of bytes to write (written bytes will not exceed buf.length - offset) + * @param { string } [encoding] - encoding [encoding='utf8'] The character encoding of string. + * @returns { number } Number of bytes written. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @throws { BusinessError } 10200001 - The value of "[offset/length]" is out of range. It must be >= 0 and <= buf.length. Received value is: [offset/length] + * @syscap SystemCapability.Utils.Lang + * @since 9 + */ + /** + * Writes string to buf at offset according to the character encoding in encoding + * + * @param { string } str - str str Writes string to buf at offset according to the character encoding in encoding + * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to write string + * @param { number } [length] - length [length = buf.length - offset] Maximum number of bytes to write (written bytes will not exceed buf.length - offset) + * @param { string } [encoding] - encoding [encoding='utf8'] The character encoding of string. + * @returns { number } Number of bytes written. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @throws { BusinessError } 10200001 - The value of "[offset/length]" is out of range. It must be >= 0 and <= buf.length. Received value is: [offset/length] + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @since 10 + */ + /** + * Writes string to buf at offset according to the character encoding in encoding + * + * @param { string } str - str str Writes string to buf at offset according to the character encoding in encoding + * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to write string + * @param { number } [length] - length [length = buf.length - offset] Maximum number of bytes to write (written bytes will not exceed buf.length - offset) + * @param { string } [encoding] - encoding [encoding='utf8'] The character encoding of string. + * @returns { number } Number of bytes written. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @throws { BusinessError } 10200001 - The value of "[offset/length]" is out of range. It must be >= 0 and <= buf.length. Received value is: [offset/length] + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 11 + */ + write(str: string, offset?: number, length?: number, encoding?: string): number; + /** + * Writes value to buf at the specified offset as big-endian. + * + * @param { bigint } value - value value Number to be written to buf + * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to write. Must satisfy: 0 <= offset <= buf.length - 8 + * @returns { number } offset plus the number of bytes written + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types; 3.Parameter verification failed. + * @throws { BusinessError } 10200001 - The value of "[param]" is out of range. It must be >= [left range] and <= [right range]. Received value is: [param] + * @syscap SystemCapability.Utils.Lang + * @since 9 + */ + /** + * Writes value to buf at the specified offset as big-endian. + * + * @param { bigint } value - value value Number to be written to buf + * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to write. Must satisfy: 0 <= offset <= buf.length - 8 + * @returns { number } offset plus the number of bytes written + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types; + * 3.Parameter verification failed. + * @throws { BusinessError } 10200001 - The value of "[param]" is out of range. It must be >= [left range] and <= [right range]. Received value is: [param] + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @since 10 + */ + /** + * Writes value to buf at the specified offset as big-endian. + * + * @param { bigint } value - value value Number to be written to buf + * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to write. Must satisfy: 0 <= offset <= buf.length - 8 + * @returns { number } offset plus the number of bytes written + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types; + * 3.Parameter verification failed. + * @throws { BusinessError } 10200001 - The value of "[param]" is out of range. It must be >= [left range] and <= [right range]. Received value is: [param] + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 11 + */ + writeBigInt64BE(value: bigint, offset?: number): number; + /** + * Writes value to buf at the specified offset as little-endian. + * + * @param { bigint } value - value value Number to be written to buf + * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to write. Must satisfy: 0 <= offset <= buf.length - 8 + * @returns { number } offset plus the number of bytes written + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types; + * 3.Parameter verification failed. + * @throws { BusinessError } 10200001 - The value of "[param]" is out of range. It must be >= [left range] and <= [right range]. Received value is: [param] + * @syscap SystemCapability.Utils.Lang + * @since 9 + */ + /** + * Writes value to buf at the specified offset as little-endian. + * + * @param { bigint } value - value value Number to be written to buf + * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to write. Must satisfy: 0 <= offset <= buf.length - 8 + * @returns { number } offset plus the number of bytes written + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types; + * 3.Parameter verification failed. + * @throws { BusinessError } 10200001 - The value of "[param]" is out of range. It must be >= [left range] and <= [right range]. Received value is: [param] + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @since 10 + */ + /** + * Writes value to buf at the specified offset as little-endian. + * + * @param { bigint } value - value value Number to be written to buf + * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to write. Must satisfy: 0 <= offset <= buf.length - 8 + * @returns { number } offset plus the number of bytes written + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types; + * 3.Parameter verification failed. + * @throws { BusinessError } 10200001 - The value of "[param]" is out of range. It must be >= [left range] and <= [right range]. Received value is: [param] + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 11 + */ + writeBigInt64LE(value: bigint, offset?: number): number; + /** + * Writes value to buf at the specified offset as big-endian. + * + * @param { bigint } value - value value Number to be written to buf + * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to write. Must satisfy: 0 <= offset <= buf.length - 8 + * @returns { number } offset plus the number of bytes written + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types; + * 3.Parameter verification failed. + * @throws { BusinessError } 10200001 - The value of "[param]" is out of range. It must be >= [left range] and <= [right range]. Received value is: [param] + * @syscap SystemCapability.Utils.Lang + * @since 9 + */ + /** + * Writes value to buf at the specified offset as big-endian. + * + * @param { bigint } value - value value Number to be written to buf + * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to write. Must satisfy: 0 <= offset <= buf.length - 8 + * @returns { number } offset plus the number of bytes written + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types; + * 3.Parameter verification failed. + * @throws { BusinessError } 10200001 - The value of "[param]" is out of range. It must be >= [left range] and <= [right range]. Received value is: [param] + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @since 10 + */ + /** + * Writes value to buf at the specified offset as big-endian. + * + * @param { bigint } value - value value Number to be written to buf + * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to write. Must satisfy: 0 <= offset <= buf.length - 8 + * @returns { number } offset plus the number of bytes written + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types; + * 3.Parameter verification failed. + * @throws { BusinessError } 10200001 - The value of "[param]" is out of range. It must be >= [left range] and <= [right range]. Received value is: [param] + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 11 + */ + writeBigUInt64BE(value: bigint, offset?: number): number; + /** + * Writes value to buf at the specified offset as little-endian. + * + * @param { bigint } value - value value Number to be written to buf + * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to write. Must satisfy: 0 <= offset <= buf.length - 8 + * @returns { number } offset plus the number of bytes written + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types; + * 3.Parameter verification failed. + * @throws { BusinessError } 10200001 - The value of "[param]" is out of range. It must be >= [left range] and <= [right range]. Received value is: [param] + * @syscap SystemCapability.Utils.Lang + * @since 9 + */ + /** + * Writes value to buf at the specified offset as little-endian. + * + * @param { bigint } value - value value Number to be written to buf + * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to write. Must satisfy: 0 <= offset <= buf.length - 8 + * @returns { number } offset plus the number of bytes written + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types; + * 3.Parameter verification failed. + * @throws { BusinessError } 10200001 - The value of "[param]" is out of range. It must be >= [left range] and <= [right range]. Received value is: [param] + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @since 10 + */ + /** + * Writes value to buf at the specified offset as little-endian. + * + * @param { bigint } value - value value Number to be written to buf + * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to write. Must satisfy: 0 <= offset <= buf.length - 8 + * @returns { number } offset plus the number of bytes written + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types; + * 3.Parameter verification failed. + * @throws { BusinessError } 10200001 - The value of "[param]" is out of range. It must be >= [left range] and <= [right range]. Received value is: [param] + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 11 + */ + writeBigUInt64LE(value: bigint, offset?: number): number; + /** + * Writes value to buf at the specified offset as big-endian. + * + * @param { number } value - value value Number to be written to buf + * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to write. Must satisfy: 0 <= offset <= buf.length - 8 + * @returns { number } offset plus the number of bytes written + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @throws { BusinessError } 10200001 - The value of "offset" is out of range. It must be >= 0 and <= buf.length - 8. Received value is: [offset] + * @syscap SystemCapability.Utils.Lang + * @since 9 + */ + /** + * Writes value to buf at the specified offset as big-endian. + * + * @param { number } value - value value Number to be written to buf + * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to write. Must satisfy: 0 <= offset <= buf.length - 8 + * @returns { number } offset plus the number of bytes written + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @throws { BusinessError } 10200001 - The value of "offset" is out of range. It must be >= 0 and <= buf.length - 8. Received value is: [offset] + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @since 10 + */ + /** + * Writes value to buf at the specified offset as big-endian. + * + * @param { number } value - value value Number to be written to buf + * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to write. Must satisfy: 0 <= offset <= buf.length - 8 + * @returns { number } offset plus the number of bytes written + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @throws { BusinessError } 10200001 - The value of "offset" is out of range. It must be >= 0 and <= buf.length - 8. Received value is: [offset] + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 11 + */ + writeDoubleBE(value: number, offset?: number): number; + /** + * Writes value to buf at the specified offset as little-endian. + * + * @param { number } value - value value Number to be written to buf + * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to write. Must satisfy: 0 <= offset <= buf.length - 8 + * @returns { number } offset plus the number of bytes written + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @throws { BusinessError } 10200001 - The value of "offset" is out of range. It must be >= 0 and <= buf.length - 8. Received value is: [offset] + * @syscap SystemCapability.Utils.Lang + * @since 9 + */ + /** + * Writes value to buf at the specified offset as little-endian. + * + * @param { number } value - value value Number to be written to buf + * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to write. Must satisfy: 0 <= offset <= buf.length - 8 + * @returns { number } offset plus the number of bytes written + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @throws { BusinessError } 10200001 - The value of "offset" is out of range. It must be >= 0 and <= buf.length - 8. Received value is: [offset] + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @since 10 + */ + /** + * Writes value to buf at the specified offset as little-endian. + * + * @param { number } value - value value Number to be written to buf + * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to write. Must satisfy: 0 <= offset <= buf.length - 8 + * @returns { number } offset plus the number of bytes written + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @throws { BusinessError } 10200001 - The value of "offset" is out of range. It must be >= 0 and <= buf.length - 8. Received value is: [offset] + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 11 + */ + writeDoubleLE(value: number, offset?: number): number; + /** + * Writes value to buf at the specified offset as big-endian. + * + * @param { number } value - value value Number to be written to buf + * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to write. Must satisfy: 0 <= offset <= buf.length - 4 + * @returns { number } offset plus the number of bytes written + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @throws { BusinessError } 10200001 - The value of "offset" is out of range. It must be >= 0 and <= buf.length - 4. Received value is: [offset] + * @syscap SystemCapability.Utils.Lang + * @since 9 + */ + /** + * Writes value to buf at the specified offset as big-endian. + * + * @param { number } value - value value Number to be written to buf + * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to write. Must satisfy: 0 <= offset <= buf.length - 4 + * @returns { number } offset plus the number of bytes written + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @throws { BusinessError } 10200001 - The value of "offset" is out of range. It must be >= 0 and <= buf.length - 4. Received value is: [offset] + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @since 10 + */ + /** + * Writes value to buf at the specified offset as big-endian. + * + * @param { number } value - value value Number to be written to buf + * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to write. Must satisfy: 0 <= offset <= buf.length - 4 + * @returns { number } offset plus the number of bytes written + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @throws { BusinessError } 10200001 - The value of "offset" is out of range. It must be >= 0 and <= buf.length - 4. Received value is: [offset] + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 11 + */ + writeFloatBE(value: number, offset?: number): number; + /** + * Writes value to buf at the specified offset as little-endian. + * + * @param { number } value - value value Number to be written to buf + * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to write. Must satisfy: 0 <= offset <= buf.length - 4 + * @returns { number } offset plus the number of bytes written + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @throws { BusinessError } 10200001 - The value of "offset" is out of range. It must be >= 0 and <= buf.length - 4. Received value is: [offset] + * @syscap SystemCapability.Utils.Lang + * @since 9 + */ + /** + * Writes value to buf at the specified offset as little-endian. + * + * @param { number } value - value value Number to be written to buf + * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to write. Must satisfy: 0 <= offset <= buf.length - 4 + * @returns { number } offset plus the number of bytes written + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @throws { BusinessError } 10200001 - The value of "offset" is out of range. It must be >= 0 and <= buf.length - 4. Received value is: [offset] + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @since 10 + */ + /** + * Writes value to buf at the specified offset as little-endian. + * + * @param { number } value - value value Number to be written to buf + * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to write. Must satisfy: 0 <= offset <= buf.length - 4 + * @returns { number } offset plus the number of bytes written + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @throws { BusinessError } 10200001 - The value of "offset" is out of range. It must be >= 0 and <= buf.length - 4. Received value is: [offset] + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 11 + */ + writeFloatLE(value: number, offset?: number): number; + /** + * Writes value to buf at the specified offset. value must be a valid signed 8-bit integer. + * + * @param { number } value - value value Number to be written to buf + * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to write. Must satisfy: 0 <= offset <= buf.length - 1 + * @returns { number } offset plus the number of bytes written + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types; + * 3.Parameter verification failed. + * @throws { BusinessError } 10200001 - The value of "[param]" is out of range. It must be >= [left range] and <= [right range]. Received value is: [param] + * @syscap SystemCapability.Utils.Lang + * @since 9 + */ + /** + * Writes value to buf at the specified offset. value must be a valid signed 8-bit integer. + * + * @param { number } value - value value Number to be written to buf + * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to write. Must satisfy: 0 <= offset <= buf.length - 1 + * @returns { number } offset plus the number of bytes written + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types; + * 3.Parameter verification failed. + * @throws { BusinessError } 10200001 - The value of "[param]" is out of range. It must be >= [left range] and <= [right range]. Received value is: [param] + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @since 10 + */ + /** + * Writes value to buf at the specified offset. value must be a valid signed 8-bit integer. + * + * @param { number } value - value value Number to be written to buf + * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to write. Must satisfy: 0 <= offset <= buf.length - 1 + * @returns { number } offset plus the number of bytes written + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types; + * 3.Parameter verification failed. + * @throws { BusinessError } 10200001 - The value of "[param]" is out of range. It must be >= [left range] and <= [right range]. Received value is: [param] + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 11 + */ + writeInt8(value: number, offset?: number): number; + /** + * Writes value to buf at the specified offset as big-endian. The value must be a valid signed 16-bit integer + * + * @param { number } value - value value Number to be written to buf + * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to write. Must satisfy: 0 <= offset <= buf.length - 2 + * @returns { number } offset plus the number of bytes written + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types; + * 3.Parameter verification failed. + * @throws { BusinessError } 10200001 - The value of "[param]" is out of range. It must be >= [left range] and <= [right range]. Received value is: [param] + * @syscap SystemCapability.Utils.Lang + * @since 9 + */ + /** + * Writes value to buf at the specified offset as big-endian. The value must be a valid signed 16-bit integer + * + * @param { number } value - value value Number to be written to buf + * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to write. Must satisfy: 0 <= offset <= buf.length - 2 + * @returns { number } offset plus the number of bytes written + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types; + * 3.Parameter verification failed. + * @throws { BusinessError } 10200001 - The value of "[param]" is out of range. It must be >= [left range] and <= [right range]. Received value is: [param] + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @since 10 + */ + /** + * Writes value to buf at the specified offset as big-endian. The value must be a valid signed 16-bit integer + * + * @param { number } value - value value Number to be written to buf + * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to write. Must satisfy: 0 <= offset <= buf.length - 2 + * @returns { number } offset plus the number of bytes written + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types; + * 3.Parameter verification failed. + * @throws { BusinessError } 10200001 - The value of "[param]" is out of range. It must be >= [left range] and <= [right range]. Received value is: [param] + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 11 + */ + writeInt16BE(value: number, offset?: number): number; + /** + * Writes value to buf at the specified offset as little-endian. The value must be a valid signed 16-bit integer + * + * @param { number } value - value value Number to be written to buf + * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to write. Must satisfy: 0 <= offset <= buf.length - 2 + * @returns { number } offset plus the number of bytes written + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types; + * 3.Parameter verification failed. + * @throws { BusinessError } 10200001 - The value of "[param]" is out of range. It must be >= [left range] and <= [right range]. Received value is: [param] + * @syscap SystemCapability.Utils.Lang + * @since 9 + */ + /** + * Writes value to buf at the specified offset as little-endian. The value must be a valid signed 16-bit integer + * + * @param { number } value - value value Number to be written to buf + * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to write. Must satisfy: 0 <= offset <= buf.length - 2 + * @returns { number } offset plus the number of bytes written + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types; + * 3.Parameter verification failed. + * @throws { BusinessError } 10200001 - The value of "[param]" is out of range. It must be >= [left range] and <= [right range]. Received value is: [param] + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @since 10 + */ + /** + * Writes value to buf at the specified offset as little-endian. The value must be a valid signed 16-bit integer + * + * @param { number } value - value value Number to be written to buf + * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to write. Must satisfy: 0 <= offset <= buf.length - 2 + * @returns { number } offset plus the number of bytes written + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types; + * 3.Parameter verification failed. + * @throws { BusinessError } 10200001 - The value of "[param]" is out of range. It must be >= [left range] and <= [right range]. Received value is: [param] + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 11 + */ + writeInt16LE(value: number, offset?: number): number; + /** + * Writes value to buf at the specified offset as big-endian. The value must be a valid signed 32-bit integer. + * + * @param { number } value - value value Number to be written to buf + * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to write. Must satisfy: 0 <= offset <= buf.length - 4 + * @returns { number } offset plus the number of bytes written + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types; + * 3.Parameter verification failed. + * @throws { BusinessError } 10200001 - The value of "[param]" is out of range. It must be >= [left range] and <= [right range]. Received value is: [param] + * @syscap SystemCapability.Utils.Lang + * @since 9 + */ + /** + * Writes value to buf at the specified offset as big-endian. The value must be a valid signed 32-bit integer. + * + * @param { number } value - value value Number to be written to buf + * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to write. Must satisfy: 0 <= offset <= buf.length - 4 + * @returns { number } offset plus the number of bytes written + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types; + * 3.Parameter verification failed. + * @throws { BusinessError } 10200001 - The value of "[param]" is out of range. It must be >= [left range] and <= [right range]. Received value is: [param] + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @since 10 + */ + /** + * Writes value to buf at the specified offset as big-endian. The value must be a valid signed 32-bit integer. + * + * @param { number } value - value value Number to be written to buf + * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to write. Must satisfy: 0 <= offset <= buf.length - 4 + * @returns { number } offset plus the number of bytes written + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types; + * 3.Parameter verification failed. + * @throws { BusinessError } 10200001 - The value of "[param]" is out of range. It must be >= [left range] and <= [right range]. Received value is: [param] + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 11 + */ + writeInt32BE(value: number, offset?: number): number; + /** + * Writes value to buf at the specified offset as little-endian. The value must be a valid signed 32-bit integer. + * + * @param { number } value - value value Number to be written to buf + * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to write. Must satisfy: 0 <= offset <= buf.length - 4 + * @returns { number } offset plus the number of bytes written + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types; + * 3.Parameter verification failed. + * @throws { BusinessError } 10200001 - The value of "[param]" is out of range. It must be >= [left range] and <= [right range]. Received value is: [param] + * @syscap SystemCapability.Utils.Lang + * @since 9 + */ + /** + * Writes value to buf at the specified offset as little-endian. The value must be a valid signed 32-bit integer. + * + * @param { number } value - value value Number to be written to buf + * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to write. Must satisfy: 0 <= offset <= buf.length - 4 + * @returns { number } offset plus the number of bytes written + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types; + * 3.Parameter verification failed. + * @throws { BusinessError } 10200001 - The value of "[param]" is out of range. It must be >= [left range] and <= [right range]. Received value is: [param] + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @since 10 + */ + /** + * Writes value to buf at the specified offset as little-endian. The value must be a valid signed 32-bit integer. + * + * @param { number } value - value value Number to be written to buf + * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to write. Must satisfy: 0 <= offset <= buf.length - 4 + * @returns { number } offset plus the number of bytes written + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types; + * 3.Parameter verification failed. + * @throws { BusinessError } 10200001 - The value of "[param]" is out of range. It must be >= [left range] and <= [right range]. Received value is: [param] + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 11 + */ + writeInt32LE(value: number, offset?: number): number; + /** + * Writes byteLength bytes of value to buf at the specified offset as big-endian + * + * @param { number } value - value value Number to be written to buf + * @param { number } offset - offset offset Number of bytes to skip before starting to write. Must satisfy 0 <= offset <= buf.length - byteLength + * @param { number } byteLength - byteLength byteLength Number of bytes to write. Must satisfy 0 < byteLength <= 6 + * @returns { number } offset plus the number of bytes written + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @throws { BusinessError } 10200001 - The value of "[param]" is out of range. It must be >= [left range] and <= [right range]. Received value is: [param] + * @syscap SystemCapability.Utils.Lang + * @since 9 + */ + /** + * Writes byteLength bytes of value to buf at the specified offset as big-endian + * + * @param { number } value - value value Number to be written to buf + * @param { number } offset - offset offset Number of bytes to skip before starting to write. Must satisfy 0 <= offset <= buf.length - byteLength + * @param { number } byteLength - byteLength byteLength Number of bytes to write. Must satisfy 0 < byteLength <= 6 + * @returns { number } offset plus the number of bytes written + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @throws { BusinessError } 10200001 - The value of "[param]" is out of range. It must be >= [left range] and <= [right range]. Received value is: [param] + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @since 10 + */ + /** + * Writes byteLength bytes of value to buf at the specified offset as big-endian + * + * @param { number } value - value value Number to be written to buf + * @param { number } offset - offset offset Number of bytes to skip before starting to write. Must satisfy 0 <= offset <= buf.length - byteLength + * @param { number } byteLength - byteLength byteLength Number of bytes to write. Must satisfy 0 < byteLength <= 6 + * @returns { number } offset plus the number of bytes written + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @throws { BusinessError } 10200001 - The value of "[param]" is out of range. It must be >= [left range] and <= [right range]. Received value is: [param] + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 11 + */ + writeIntBE(value: number, offset: number, byteLength: number): number; + /** + * Writes byteLength bytes of value to buf at the specified offset as little-endian + * + * @param { number } value - value value Number to be written to buf + * @param { number } offset - offset offset Number of bytes to skip before starting to write. Must satisfy 0 <= offset <= buf.length - byteLength + * @param { number } byteLength - byteLength byteLength Number of bytes to write. Must satisfy 0 < byteLength <= 6 + * @returns { number } offset plus the number of bytes written + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @throws { BusinessError } 10200001 - The value of "[param]" is out of range. It must be >= [left range] and <= [right range]. Received value is: [param] + * @syscap SystemCapability.Utils.Lang + * @since 9 + */ + /** + * Writes byteLength bytes of value to buf at the specified offset as little-endian + * + * @param { number } value - value value Number to be written to buf + * @param { number } offset - offset offset Number of bytes to skip before starting to write. Must satisfy 0 <= offset <= buf.length - byteLength + * @param { number } byteLength - byteLength byteLength Number of bytes to write. Must satisfy 0 < byteLength <= 6 + * @returns { number } offset plus the number of bytes written + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @throws { BusinessError } 10200001 - The value of "[param]" is out of range. It must be >= [left range] and <= [right range]. Received value is: [param] + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @since 10 + */ + /** + * Writes byteLength bytes of value to buf at the specified offset as little-endian + * + * @param { number } value - value value Number to be written to buf + * @param { number } offset - offset offset Number of bytes to skip before starting to write. Must satisfy 0 <= offset <= buf.length - byteLength + * @param { number } byteLength - byteLength byteLength Number of bytes to write. Must satisfy 0 < byteLength <= 6 + * @returns { number } offset plus the number of bytes written + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @throws { BusinessError } 10200001 - The value of "[param]" is out of range. It must be >= [left range] and <= [right range]. Received value is: [param] + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 11 + */ + writeIntLE(value: number, offset: number, byteLength: number): number; + /** + * Writes value to buf at the specified offset. value must be a valid unsigned 8-bit integer + * + * @param { number } value - value value Number to be written to buf + * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to write. Must satisfy 0 <= offset <= buf.length - 1 + * @returns { number } offset plus the number of bytes written + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types; + * 3.Parameter verification failed. + * @throws { BusinessError } 10200001 - The value of "[param]" is out of range. It must be >= [left range] and <= [right range]. Received value is: [param] + * @syscap SystemCapability.Utils.Lang + * @since 9 + */ + /** + * Writes value to buf at the specified offset. value must be a valid unsigned 8-bit integer + * + * @param { number } value - value value Number to be written to buf + * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to write. Must satisfy 0 <= offset <= buf.length - 1 + * @returns { number } offset plus the number of bytes written + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types; + * 3.Parameter verification failed. + * @throws { BusinessError } 10200001 - The value of "[param]" is out of range. It must be >= [left range] and <= [right range]. Received value is: [param] + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @since 10 + */ + /** + * Writes value to buf at the specified offset. value must be a valid unsigned 8-bit integer + * + * @param { number } value - value value Number to be written to buf + * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to write. Must satisfy 0 <= offset <= buf.length - 1 + * @returns { number } offset plus the number of bytes written + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types; + * 3.Parameter verification failed. + * @throws { BusinessError } 10200001 - The value of "[param]" is out of range. It must be >= [left range] and <= [right range]. Received value is: [param] + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 11 + */ + writeUInt8(value: number, offset?: number): number; + /** + * Writes value to buf at the specified offset as big-endian. The value must be a valid unsigned 16-bit integer. + * + * @param { number } value - value value Number to be written to buf + * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to write. Must satisfy 0 <= offset <= buf.length - 2 + * @returns { number } offset plus the number of bytes written + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types; + * 3.Parameter verification failed. + * @throws { BusinessError } 10200001 - The value of "[param]" is out of range. It must be >= [left range] and <= [right range]. Received value is: [param] + * @syscap SystemCapability.Utils.Lang + * @since 9 + */ + /** + * Writes value to buf at the specified offset as big-endian. The value must be a valid unsigned 16-bit integer. + * + * @param { number } value - value value Number to be written to buf + * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to write. Must satisfy 0 <= offset <= buf.length - 2 + * @returns { number } offset plus the number of bytes written + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types; + * 3.Parameter verification failed. + * @throws { BusinessError } 10200001 - The value of "[param]" is out of range. It must be >= [left range] and <= [right range]. Received value is: [param] + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @since 10 + */ + /** + * Writes value to buf at the specified offset as big-endian. The value must be a valid unsigned 16-bit integer. + * + * @param { number } value - value value Number to be written to buf + * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to write. Must satisfy 0 <= offset <= buf.length - 2 + * @returns { number } offset plus the number of bytes written + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types; + * 3.Parameter verification failed. + * @throws { BusinessError } 10200001 - The value of "[param]" is out of range. It must be >= [left range] and <= [right range]. Received value is: [param] + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 11 + */ + writeUInt16BE(value: number, offset?: number): number; + /** + * Writes value to buf at the specified offset as little-endian. The value must be a valid unsigned 16-bit integer. + * + * @param { number } value - value value Number to be written to buf + * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to write. Must satisfy 0 <= offset <= buf.length - 2 + * @returns { number } offset plus the number of bytes written + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types; + * 3.Parameter verification failed. + * @throws { BusinessError } 10200001 - The value of "[param]" is out of range. It must be >= [left range] and <= [right range]. Received value is: [param] + * @syscap SystemCapability.Utils.Lang + * @since 9 + */ + /** + * Writes value to buf at the specified offset as little-endian. The value must be a valid unsigned 16-bit integer. + * + * @param { number } value - value value Number to be written to buf + * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to write. Must satisfy 0 <= offset <= buf.length - 2 + * @returns { number } offset plus the number of bytes written + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types; + * 3.Parameter verification failed. + * @throws { BusinessError } 10200001 - The value of "[param]" is out of range. It must be >= [left range] and <= [right range]. Received value is: [param] + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @since 10 + */ + /** + * Writes value to buf at the specified offset as little-endian. The value must be a valid unsigned 16-bit integer. + * + * @param { number } value - value value Number to be written to buf + * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to write. Must satisfy 0 <= offset <= buf.length - 2 + * @returns { number } offset plus the number of bytes written + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types; + * 3.Parameter verification failed. + * @throws { BusinessError } 10200001 - The value of "[param]" is out of range. It must be >= [left range] and <= [right range]. Received value is: [param] + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 11 + */ + writeUInt16LE(value: number, offset?: number): number; + /** + * Writes value to buf at the specified offset as big-endian. The value must be a valid unsigned 32-bit integer. + * + * @param { number } value - value value Number to be written to buf + * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to write. Must satisfy 0 <= offset <= buf.length - 4 + * @returns { number } offset plus the number of bytes written + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types; + * 3.Parameter verification failed. + * @throws { BusinessError } 10200001 - The value of "[param]" is out of range. It must be >= [left range] and <= [right range]. Received value is: [param] + * @syscap SystemCapability.Utils.Lang + * @since 9 + */ + /** + * Writes value to buf at the specified offset as big-endian. The value must be a valid unsigned 32-bit integer. + * + * @param { number } value - value value Number to be written to buf + * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to write. Must satisfy 0 <= offset <= buf.length - 4 + * @returns { number } offset plus the number of bytes written + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types; + * 3.Parameter verification failed. + * @throws { BusinessError } 10200001 - The value of "[param]" is out of range. It must be >= [left range] and <= [right range]. Received value is: [param] + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @since 10 + */ + /** + * Writes value to buf at the specified offset as big-endian. The value must be a valid unsigned 32-bit integer. + * + * @param { number } value - value value Number to be written to buf + * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to write. Must satisfy 0 <= offset <= buf.length - 4 + * @returns { number } offset plus the number of bytes written + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types; + * 3.Parameter verification failed. + * @throws { BusinessError } 10200001 - The value of "[param]" is out of range. It must be >= [left range] and <= [right range]. Received value is: [param] + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 11 + */ + writeUInt32BE(value: number, offset?: number): number; + /** + * Writes value to buf at the specified offset as little-endian. The value must be a valid unsigned 32-bit integer. + * + * @param { number } value - value value Number to be written to buf + * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to write. Must satisfy 0 <= offset <= buf.length - 4 + * @returns { number } offset plus the number of bytes written + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types; + * 3.Parameter verification failed. + * @throws { BusinessError } 10200001 - The value of "[param]" is out of range. It must be >= [left range] and <= [right range]. Received value is: [param] + * @syscap SystemCapability.Utils.Lang + * @since 9 + */ + /** + * Writes value to buf at the specified offset as little-endian. The value must be a valid unsigned 32-bit integer. + * + * @param { number } value - value value Number to be written to buf + * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to write. Must satisfy 0 <= offset <= buf.length - 4 + * @returns { number } offset plus the number of bytes written + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types; + * 3.Parameter verification failed. + * @throws { BusinessError } 10200001 - The value of "[param]" is out of range. It must be >= [left range] and <= [right range]. Received value is: [param] + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @since 10 + */ + /** + * Writes value to buf at the specified offset as little-endian. The value must be a valid unsigned 32-bit integer. + * + * @param { number } value - value value Number to be written to buf + * @param { number } [offset] - offset [offset = 0] Number of bytes to skip before starting to write. Must satisfy 0 <= offset <= buf.length - 4 + * @returns { number } offset plus the number of bytes written + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types; + * 3.Parameter verification failed. + * @throws { BusinessError } 10200001 - The value of "[param]" is out of range. It must be >= [left range] and <= [right range]. Received value is: [param] + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 11 + */ + writeUInt32LE(value: number, offset?: number): number; + /** + * Writes byteLength bytes of value to buf at the specified offset as big-endian + * + * @param { number } value - value value Number to be written to buf + * @param { number } offset - offset offset Number of bytes to skip before starting to write. Must satisfy 0 <= offset <= buf.length - byteLength + * @param { number } byteLength - byteLength byteLength Number of bytes to write. Must satisfy 0 < byteLength <= 6 + * @returns { number } offset plus the number of bytes written + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @throws { BusinessError } 10200001 - The value of "[param]" is out of range. It must be >= [left range] and <= [right range]. Received value is: [param] + * @syscap SystemCapability.Utils.Lang + * @since 9 + */ + /** + * Writes byteLength bytes of value to buf at the specified offset as big-endian + * + * @param { number } value - value value Number to be written to buf + * @param { number } offset - offset offset Number of bytes to skip before starting to write. Must satisfy 0 <= offset <= buf.length - byteLength + * @param { number } byteLength - byteLength byteLength Number of bytes to write. Must satisfy 0 < byteLength <= 6 + * @returns { number } offset plus the number of bytes written + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @throws { BusinessError } 10200001 - The value of "[param]" is out of range. It must be >= [left range] and <= [right range]. Received value is: [param] + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @since 10 + */ + /** + * Writes byteLength bytes of value to buf at the specified offset as big-endian + * + * @param { number } value - value value Number to be written to buf + * @param { number } offset - offset offset Number of bytes to skip before starting to write. Must satisfy 0 <= offset <= buf.length - byteLength + * @param { number } byteLength - byteLength byteLength Number of bytes to write. Must satisfy 0 < byteLength <= 6 + * @returns { number } offset plus the number of bytes written + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @throws { BusinessError } 10200001 - The value of "[param]" is out of range. It must be >= [left range] and <= [right range]. Received value is: [param] + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 11 + */ + writeUIntBE(value: number, offset: number, byteLength: number): number; + /** + * Writes byteLength bytes of value to buf at the specified offset as little-endian + * + * @param { number } value - value value Number to be written to buf + * @param { number } offset - offset offset Number of bytes to skip before starting to write. Must satisfy 0 <= offset <= buf.length - byteLength + * @param { number } byteLength - byteLength byteLength Number of bytes to write. Must satisfy 0 < byteLength <= 6 + * @returns { number } offset plus the number of bytes written + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @throws { BusinessError } 10200001 - The value of "[param]" is out of range. It must be >= [left range] and <= [right range]. Received value is: [param] + * @syscap SystemCapability.Utils.Lang + * @since 9 + */ + /** + * Writes byteLength bytes of value to buf at the specified offset as little-endian + * + * @param { number } value - value value Number to be written to buf + * @param { number } offset - offset offset Number of bytes to skip before starting to write. Must satisfy 0 <= offset <= buf.length - byteLength + * @param { number } byteLength - byteLength byteLength Number of bytes to write. Must satisfy 0 < byteLength <= 6 + * @returns { number } offset plus the number of bytes written + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @throws { BusinessError } 10200001 - The value of "[param]" is out of range. It must be >= [left range] and <= [right range]. Received value is: [param] + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @since 10 + */ + /** + * Writes byteLength bytes of value to buf at the specified offset as little-endian + * + * @param { number } value - value value Number to be written to buf + * @param { number } offset - offset offset Number of bytes to skip before starting to write. Must satisfy 0 <= offset <= buf.length - byteLength + * @param { number } byteLength - byteLength byteLength Number of bytes to write. Must satisfy 0 < byteLength <= 6 + * @returns { number } offset plus the number of bytes written + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @throws { BusinessError } 10200001 - The value of "[param]" is out of range. It must be >= [left range] and <= [right range]. Received value is: [param] + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 11 + */ + writeUIntLE(value: number, offset: number, byteLength: number): number; + } + /** + * Process data as blob type + * + * @syscap SystemCapability.Utils.Lang + * @since 9 + */ + /** + * Process data as blob type + * + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @since 10 + */ + /** + * Process data as blob type + * + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 11 + */ + class Blob { + /** + * Creates a new Blob object containing a concatenation of the given sources. + * + * @param { string[] | ArrayBuffer[] | TypedArray[] | DataView[] | Blob[] } sources - sources sources An array of string, , + * , , or objects, or any mix of such objects, that will be stored within the Blob + * @param { Object } [options] - options options {endings: string, type: string} + * endings: One of either 'transparent' or 'native'. + * type: The Blob content-type + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @syscap SystemCapability.Utils.Lang + * @since 9 + */ + /** + * Creates a new Blob object containing a concatenation of the given sources. + * + * @param { string[] | ArrayBuffer[] | TypedArray[] | DataView[] | Blob[] } sources - sources sources An array of string, , + * , , or objects, or any mix of such objects, that will be stored within the Blob + * @param { Object } [options] - options options {endings: string, type: string} + * endings: One of either 'transparent' or 'native'. + * type: The Blob content-type + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @since 10 + */ + /** + * Creates a new Blob object containing a concatenation of the given sources. + * + * @param { string[] | ArrayBuffer[] | TypedArray[] | DataView[] | Blob[] } sources - sources sources An array of string, , + * , , or objects, or any mix of such objects, that will be stored within the Blob + * @param { Object } [options] - options options {endings: string, type: string} + * endings: One of either 'transparent' or 'native'. + * type: The Blob content-type + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 11 + */ + constructor(sources: string[] | ArrayBuffer[] | TypedArray[] | DataView[] | Blob[], options?: Object); + /** + * The total size of the Blob in bytes + * + * @syscap SystemCapability.Utils.Lang + * @since 9 + */ + /** + * The total size of the Blob in bytes + * + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @since 10 + */ + /** + * The total size of the Blob in bytes + * + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 11 + */ + size: number; + /** + * The content-type of the Blob + * + * @syscap SystemCapability.Utils.Lang + * @since 9 + */ + /** + * The content-type of the Blob + * + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @since 10 + */ + /** + * The content-type of the Blob + * + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 11 + */ + type: string; + /** + * Returns a promise that fulfills with an containing a copy of the Blob data. + * + * @returns { Promise } + * @syscap SystemCapability.Utils.Lang + * @since 9 + */ + /** + * Returns a promise that fulfills with an containing a copy of the Blob data. + * + * @returns { Promise } + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @since 10 + */ + /** + * Returns a promise that fulfills with an containing a copy of the Blob data. + * + * @returns { Promise } + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 11 + */ + arrayBuffer(): Promise; + /** + * Creates and returns a new Blob containing a subset of this Blob objects data. The original Blob is not altered + * + * @param { number } [start] - start start The starting index + * @param { number } [end] - end end The ending index + * @param { string } [type] - type type The content-type for the new Blob + * @returns { Blob } + * @syscap SystemCapability.Utils.Lang + * @since 9 + */ + /** + * Creates and returns a new Blob containing a subset of this Blob objects data. The original Blob is not altered + * + * @param { number } [start] - start start The starting index + * @param { number } [end] - end end The ending index + * @param { string } [type] - type type The content-type for the new Blob + * @returns { Blob } + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @since 10 + */ + /** + * Creates and returns a new Blob containing a subset of this Blob objects data. The original Blob is not altered + * + * @param { number } [start] - start start The starting index + * @param { number } [end] - end end The ending index + * @param { string } [type] - type type The content-type for the new Blob + * @returns { Blob } + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 11 + */ + slice(start?: number, end?: number, type?: string): Blob; + /** + * Returns a promise that fulfills with the contents of the Blob decoded as a UTF-8 string. + * + * @returns { Promise } + * @syscap SystemCapability.Utils.Lang + * @since 9 + */ + /** + * Returns a promise that fulfills with the contents of the Blob decoded as a UTF-8 string. + * + * @returns { Promise } + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @since 10 + */ + /** + * Returns a promise that fulfills with the contents of the Blob decoded as a UTF-8 string. + * + * @returns { Promise } + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 11 + */ + text(): Promise; + } +} +export default buffer; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.bundle.bundleManager.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.bundle.bundleManager.d.ts new file mode 100755 index 00000000..bea16465 --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.bundle.bundleManager.d.ts @@ -0,0 +1,1579 @@ +/* + * Copyright (c) 2022-2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit AbilityKit + */ +import { AsyncCallback } from './@ohos.base'; +import type { ApplicationInfo as _ApplicationInfo, ModuleMetadata as _ModuleMetadata } from './bundleManager/ApplicationInfo'; +import { Metadata as _Metadata } from './bundleManager/Metadata'; +import { ElementName as _ElementName } from './bundleManager/ElementName'; +import * as _AbilityInfo from './bundleManager/AbilityInfo'; +import * as _BundleInfo from './bundleManager/BundleInfo'; +import * as _HapModuleInfo from './bundleManager/HapModuleInfo'; +import * as _ExtensionAbilityInfo from './bundleManager/ExtensionAbilityInfo'; +import * as _Skill from './bundleManager/Skill'; +/** + * This module is used to obtain package information of various applications installed on the current device. + * + * @namespace bundleManager + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ +/** + * This module is used to obtain package information of various applications installed on the current device. + * + * @namespace bundleManager + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @atomicservice + * @since 11 + */ +/** + * This module is used to obtain package information of various applications installed on the current device. + * + * @namespace bundleManager + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @crossplatform + * @atomicservice + * @since 12 + */ +declare namespace bundleManager { + /** + * Used to query the enumeration value of bundleInfo. Multiple values can be passed in the form. + * + * @enum { number } + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + /** + * Used to query the enumeration value of bundleInfo. Multiple values can be passed in the form. + * + * @enum { number } + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @atomicservice + * @since 11 + */ + enum BundleFlag { + /** + * Used to obtain the default bundleInfo. The obtained bundleInfo does not contain information of + * signatureInfo, applicationInfo, hapModuleInfo, ability, extensionAbility and permission. + * + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + /** + * Used to obtain the default bundleInfo. The obtained bundleInfo does not contain information of + * signatureInfo, applicationInfo, hapModuleInfo, ability, extensionAbility and permission. + * + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @atomicservice + * @since 11 + */ + GET_BUNDLE_INFO_DEFAULT = 0x00000000, + /** + * Used to obtain the bundleInfo containing applicationInfo. The obtained bundleInfo does not + * contain the information of signatureInfo, hapModuleInfo, ability, extensionAbility and permission. + * + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + /** + * Used to obtain the bundleInfo containing applicationInfo. The obtained bundleInfo does not + * contain the information of signatureInfo, hapModuleInfo, ability, extensionAbility and permission. + * + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @atomicservice + * @since 11 + */ + GET_BUNDLE_INFO_WITH_APPLICATION = 0x00000001, + /** + * Used to obtain the bundleInfo containing hapModuleInfo. The obtained bundleInfo does not + * contain the information of signatureInfo, applicationInfo, ability, extensionAbility and permission. + * + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + /** + * Used to obtain the bundleInfo containing hapModuleInfo. The obtained bundleInfo does not + * contain the information of signatureInfo, applicationInfo, ability, extensionAbility and permission. + * + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @atomicservice + * @since 11 + */ + GET_BUNDLE_INFO_WITH_HAP_MODULE = 0x00000002, + /** + * Used to obtain the bundleInfo containing ability. The obtained bundleInfo does not + * contain the information of signatureInfo, applicationInfo, extensionAbility and permission. + * It can't be used alone, it needs to be used with GET_BUNDLE_INFO_WITH_HAP_MODULE. + * + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + /** + * Used to obtain the bundleInfo containing ability. The obtained bundleInfo does not + * contain the information of signatureInfo, applicationInfo, extensionAbility and permission. + * It can't be used alone, it needs to be used with GET_BUNDLE_INFO_WITH_HAP_MODULE. + * + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @atomicservice + * @since 11 + */ + GET_BUNDLE_INFO_WITH_ABILITY = 0x00000004, + /** + * Used to obtain the bundleInfo containing extensionAbility. The obtained bundleInfo does not + * contain the information of signatureInfo, applicationInfo, ability and permission. + * It can't be used alone, it needs to be used with GET_BUNDLE_INFO_WITH_HAP_MODULE. + * + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + /** + * Used to obtain the bundleInfo containing extensionAbility. The obtained bundleInfo does not + * contain the information of signatureInfo, applicationInfo, ability and permission. + * It can't be used alone, it needs to be used with GET_BUNDLE_INFO_WITH_HAP_MODULE. + * + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @atomicservice + * @since 11 + */ + GET_BUNDLE_INFO_WITH_EXTENSION_ABILITY = 0x00000008, + /** + * Used to obtain the bundleInfo containing permission. The obtained bundleInfo does not + * contain the information of signatureInfo, applicationInfo, hapModuleInfo, extensionAbility and ability. + * + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + /** + * Used to obtain the bundleInfo containing permission. The obtained bundleInfo does not + * contain the information of signatureInfo, applicationInfo, hapModuleInfo, extensionAbility and ability. + * + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @atomicservice + * @since 11 + */ + GET_BUNDLE_INFO_WITH_REQUESTED_PERMISSION = 0x00000010, + /** + * Used to obtain the metadata contained in applicationInfo, moduleInfo and abilityInfo. + * It can't be used alone, it needs to be used with GET_BUNDLE_INFO_WITH_APPLICATION, + * GET_BUNDLE_INFO_WITH_HAP_MODULE, GET_BUNDLE_INFO_WITH_ABILITIES, GET_BUNDLE_INFO_WITH_EXTENSION_ABILITY. + * + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + /** + * Used to obtain the metadata contained in applicationInfo, moduleInfo and abilityInfo. + * It can't be used alone, it needs to be used with GET_BUNDLE_INFO_WITH_APPLICATION, + * GET_BUNDLE_INFO_WITH_HAP_MODULE, GET_BUNDLE_INFO_WITH_ABILITIES, GET_BUNDLE_INFO_WITH_EXTENSION_ABILITY. + * + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @atomicservice + * @since 11 + */ + GET_BUNDLE_INFO_WITH_METADATA = 0x00000020, + /** + * Used to obtain the default bundleInfo containing disabled application and ability. + * The obtained bundleInfo does not contain information of signatureInfo, applicationInfo, + * hapModuleInfo, ability, extensionAbility and permission. + * + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + /** + * Used to obtain the default bundleInfo containing disabled application and ability. + * The obtained bundleInfo does not contain information of signatureInfo, applicationInfo, + * hapModuleInfo, ability, extensionAbility and permission. + * + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @atomicservice + * @since 11 + */ + GET_BUNDLE_INFO_WITH_DISABLE = 0x00000040, + /** + * Used to obtain the bundleInfo containing signatureInfo. The obtained bundleInfo does not + * contain the information of applicationInfo, hapModuleInfo, extensionAbility, ability and permission. + * + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + /** + * Used to obtain the bundleInfo containing signatureInfo. The obtained bundleInfo does not + * contain the information of applicationInfo, hapModuleInfo, extensionAbility, ability and permission. + * + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @atomicservice + * @since 11 + */ + GET_BUNDLE_INFO_WITH_SIGNATURE_INFO = 0x00000080, + /** + * Used to obtain the bundleInfo containing menu configuration in hapModuleInfo. + * The obtained bundleInfo does not contain the information of applicationInfo, extensionAbility, ability and permission. + * It can't be used alone, it needs to be used with GET_BUNDLE_INFO_WITH_HAP_MODULE. + * + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @atomicservice + * @since 11 + */ + GET_BUNDLE_INFO_WITH_MENU = 0x00000100, + /** + * Used to obtain the bundleInfo containing router map configuration in hapModuleInfo. + * The obtained bundleInfo does not contain the information of applicationInfo, extensionAbility, ability and permission. + * It can't be used alone, it needs to be used with GET_BUNDLE_INFO_WITH_HAP_MODULE. + * + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @atomicservice + * @since 12 + */ + GET_BUNDLE_INFO_WITH_ROUTER_MAP = 0x00000200, + /** + * Used to obtain the skillInfo contained in abilityInfo and extensionInfo. + * It can't be used alone, it needs to be used with GET_BUNDLE_INFO_WITH_HAP_MODULE, + * GET_BUNDLE_INFO_WITH_ABILITIES, GET_BUNDLE_INFO_WITH_EXTENSION_ABILITY. + * + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @atomicservice + * @since 12 + */ + GET_BUNDLE_INFO_WITH_SKILL = 0x00000800 + } + /** + * This enumeration value is used to identify various types of extension ability + * + * @enum { number } + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + /** + * This enumeration value is used to identify various types of extension ability + * + * @enum { number } + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @atomicservice + * @since 11 + */ + export enum ExtensionAbilityType { + /** + * Indicates extension info with type of form + * + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + /** + * Indicates extension info with type of form + * + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @atomicservice + * @since 11 + */ + FORM = 0, + /** + * Indicates extension info with type of work schedule + * + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + WORK_SCHEDULER = 1, + /** + * Indicates extension info with type of input method + * + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + INPUT_METHOD = 2, + /** + * Indicates extension info with type of service + * + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + SERVICE = 3, + /** + * Indicates extension info with type of accessibility + * + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + ACCESSIBILITY = 4, + /** + * Indicates extension info with type of dataShare + * + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + DATA_SHARE = 5, + /** + * Indicates extension info with type of filesShare + * + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + FILE_SHARE = 6, + /** + * Indicates extension info with type of staticSubscriber + * + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + STATIC_SUBSCRIBER = 7, + /** + * Indicates extension info with type of wallpaper + * + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + WALLPAPER = 8, + /** + * Indicates extension info with type of backup + * + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + BACKUP = 9, + /** + * Indicates extension info with type of window + * + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + WINDOW = 10, + /** + * Indicates extension info with type of enterprise admin + * + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + ENTERPRISE_ADMIN = 11, + /** + * Indicates extension info with type of thumbnail + * + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + THUMBNAIL = 13, + /** + * Indicates extension info with type of preview + * + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + PREVIEW = 14, + /** + * Indicates extension info with type of print + * + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 10 + */ + PRINT = 15, + /** + * Indicates extension info with type of share + * + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 10 + */ + SHARE = 16, + /** + * Indicates extension info with type of push + * + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 10 + */ + PUSH = 17, + /** + * Indicates extension info with type of driver + * + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 10 + */ + DRIVER = 18, + /** + * Indicates extension info with type of action + * + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 10 + */ + ACTION = 19, + /** + * Indicates extension info with type of ads service + * + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 11 + */ + ADS_SERVICE = 20, + /** + * Indicates extension info with type of embedded UI + * + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 12 + */ + EMBEDDED_UI = 21, + /** + * Indicates extension info with type of insight intent UI + * + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 12 + */ + INSIGHT_INTENT_UI = 22, + /** + * Indicates extension info with type of unspecified + * + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + UNSPECIFIED = 255 + } + /** + * PermissionGrantState + * + * @enum { number } + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + /** + * PermissionGrantState + * + * @enum { number } + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @atomicservice + * @since 11 + */ + export enum PermissionGrantState { + /** + * PERMISSION_DENIED + * + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + /** + * PERMISSION_DENIED + * + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @atomicservice + * @since 11 + */ + PERMISSION_DENIED = -1, + /** + * PERMISSION_GRANTED + * + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + /** + * PERMISSION_GRANTED + * + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @atomicservice + * @since 11 + */ + PERMISSION_GRANTED = 0 + } + /** + * Support window mode + * + * @enum { number } + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + /** + * Support window mode + * + * @enum { number } + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @atomicservice + * @since 11 + */ + export enum SupportWindowMode { + /** + * Indicates supported window mode of full screen mode + * + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + /** + * Indicates supported window mode of full screen mode + * + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @atomicservice + * @since 11 + */ + FULL_SCREEN = 0, + /** + * Indicates supported window mode of split mode + * + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + /** + * Indicates supported window mode of split mode + * + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @atomicservice + * @since 11 + */ + SPLIT = 1, + /** + * Indicates supported window mode of floating mode + * + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + /** + * Indicates supported window mode of floating mode + * + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @atomicservice + * @since 11 + */ + FLOATING = 2 + } + /** + * Launch type + * + * @enum { number } + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + /** + * Launch type + * + * @enum { number } + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @crossplatform + * @since 10 + */ + /** + * Launch type + * + * @enum { number } + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @crossplatform + * @atomicservice + * @since 11 + */ + export enum LaunchType { + /** + * Indicates that the ability has only one instance + * + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + /** + * Indicates that the ability has only one instance + * + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @crossplatform + * @since 10 + */ + /** + * Indicates that the ability has only one instance + * + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @crossplatform + * @atomicservice + * @since 11 + */ + SINGLETON = 0, + /** + * Indicates that the ability can have multiple instances + * + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + /** + * Indicates that the ability can have multiple instances + * + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @crossplatform + * @since 10 + */ + /** + * Indicates that the ability can have multiple instances + * + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @crossplatform + * @atomicservice + * @since 11 + */ + MULTITON = 1, + /** + * Indicates that the ability can have specified instances + * + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + /** + * Indicates that the ability can have specified instances + * + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @atomicservice + * @since 11 + */ + SPECIFIED = 2 + } + /** + * Indicates ability type + * + * @enum { number } + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @FAModelOnly + * @since 9 + */ + export enum AbilityType { + /** + * Indicates that the ability has a UI + * + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @FAModelOnly + * @since 9 + */ + PAGE = 1, + /** + * Indicates that the ability does not have a UI + * + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @FAModelOnly + * @since 9 + */ + SERVICE = 2, + /** + * Indicates that the ability is used to provide data access services + * + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @FAModelOnly + * @since 9 + */ + DATA = 3 + } + /** + * Display orientation + * + * @enum { number } + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + /** + * Display orientation + * + * @enum { number } + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @atomicservice + * @since 11 + */ + export enum DisplayOrientation { + /** + * Indicates that the system automatically determines the display orientation + * + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + /** + * Indicates that the system automatically determines the display orientation + * + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @atomicservice + * @since 11 + */ + UNSPECIFIED, + /** + * Indicates the landscape orientation + * + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + /** + * Indicates the landscape orientation + * + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @atomicservice + * @since 11 + */ + LANDSCAPE, + /** + * Indicates the portrait orientation + * + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + /** + * Indicates the portrait orientation + * + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @atomicservice + * @since 11 + */ + PORTRAIT, + /** + * Indicates the page ability orientation is the same as that of the nearest ability in the stack + * + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + /** + * Indicates the page ability orientation is the same as that of the nearest ability in the stack + * + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @atomicservice + * @since 11 + */ + FOLLOW_RECENT, + /** + * Indicates the inverted landscape orientation + * + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + /** + * Indicates the inverted landscape orientation + * + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @atomicservice + * @since 11 + */ + LANDSCAPE_INVERTED, + /** + * Indicates the inverted portrait orientation + * + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + /** + * Indicates the inverted portrait orientation + * + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @atomicservice + * @since 11 + */ + PORTRAIT_INVERTED, + /** + * Indicates the orientation can be auto-rotated + * + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + /** + * Indicates the orientation can be auto-rotated + * + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @atomicservice + * @since 11 + */ + AUTO_ROTATION, + /** + * Indicates the landscape orientation rotated with sensor + * + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + /** + * Indicates the landscape orientation rotated with sensor + * + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @atomicservice + * @since 11 + */ + AUTO_ROTATION_LANDSCAPE, + /** + * Indicates the portrait orientation rotated with sensor + * + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + /** + * Indicates the portrait orientation rotated with sensor + * + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @atomicservice + * @since 11 + */ + AUTO_ROTATION_PORTRAIT, + /** + * Indicates the sensor restricted mode + * + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + /** + * Indicates the sensor restricted mode + * + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @atomicservice + * @since 11 + */ + AUTO_ROTATION_RESTRICTED, + /** + * Indicates the sensor landscape restricted mode + * + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + /** + * Indicates the sensor landscape restricted mode + * + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @atomicservice + * @since 11 + */ + AUTO_ROTATION_LANDSCAPE_RESTRICTED, + /** + * Indicates the sensor portrait restricted mode + * + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + /** + * Indicates the sensor portrait restricted mode + * + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @atomicservice + * @since 11 + */ + AUTO_ROTATION_PORTRAIT_RESTRICTED, + /** + * Indicates the locked orientation mode + * + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + /** + * Indicates the locked orientation mode + * + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @atomicservice + * @since 11 + */ + LOCKED, + /** + * Indicates the system automatically determines the sensor restricted mode + * + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @atomicservice + * @since 12 + */ + AUTO_ROTATION_UNSPECIFIED, + /** + * Indicates the orientation follow the desktop rotate mode + * + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @atomicservice + * @since 12 + */ + FOLLOW_DESKTOP + } + /** + * Indicates module type + * + * @enum { number } + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + /** + * Indicates module type + * + * @enum { number } + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @atomicservice + * @since 11 + */ + export enum ModuleType { + /** + * Indicates entry type + * + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + /** + * Indicates entry type + * + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @atomicservice + * @since 11 + */ + ENTRY = 1, + /** + * Indicates feature type + * + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + /** + * Indicates feature type + * + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @atomicservice + * @since 11 + */ + FEATURE = 2, + /** + * Indicates shared type + * + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + /** + * Indicates shared type + * + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @atomicservice + * @since 11 + */ + SHARED = 3 + } + /** + * Indicates bundle type + * + * @enum { number } + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + /** + * Indicates bundle type + * + * @enum { number } + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @atomicservice + * @since 11 + */ + export enum BundleType { + /** + * Indicates app + * + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + /** + * Indicates app + * + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @atomicservice + * @since 11 + */ + APP = 0, + /** + * Indicates atomic service + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + /** + * Indicates atomic service + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @atomicservice + * @since 11 + */ + ATOMIC_SERVICE = 1 + } + /** + * Shared bundle compatible policy + * + * @enum { number } + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 10 + */ + /** + * Shared bundle compatible policy + * + * @enum { number } + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @atomicservice + * @since 11 + */ + export enum CompatiblePolicy { + /** + * Indicates that the app is a shared bundle and the shared bundle type is backward compatibility + * + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 10 + */ + /** + * Indicates that the app is a shared bundle and the shared bundle type is backward compatibility + * + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @atomicservice + * @since 11 + */ + BACKWARD_COMPATIBILITY = 1 + } + /** + * Obtains own bundleInfo. + * + * @param { number } bundleFlags - Indicates the flag used to specify information contained in the BundleInfo objects that will be returned. + * @returns { Promise } The result of getting the bundle info. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types. + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + /** + * Obtains own bundleInfo. + * + * @param { number } bundleFlags - Indicates the flag used to specify information contained in the BundleInfo objects that will be returned. + * @returns { Promise } The result of getting the bundle info. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types. + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @atomicservice + * @since 11 + */ + function getBundleInfoForSelf(bundleFlags: number): Promise; + /** + * Obtains own bundleInfo. + * + * @param { number } bundleFlags - Indicates the flag used to specify information contained in the BundleInfo objects that will be returned. + * @param { AsyncCallback } callback - The callback of getting bundle info result. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types. + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + /** + * Obtains own bundleInfo. + * + * @param { number } bundleFlags - Indicates the flag used to specify information contained in the BundleInfo objects that will be returned. + * @param { AsyncCallback } callback - The callback of getting bundle info result. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types. + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @atomicservice + * @since 11 + */ + function getBundleInfoForSelf(bundleFlags: number, callback: AsyncCallback): void; + /** + * Obtains own bundleInfo. + * + * @param { number } bundleFlags - Indicates the flag used to specify information contained in the BundleInfo objects that will be returned. + * @returns { BundleInfo } The result of getting the bundle info. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types. + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 10 + */ + /** + * Obtains own bundleInfo. + * + * @param { number } bundleFlags - Indicates the flag used to specify information contained in the BundleInfo objects that will be returned. + * @returns { BundleInfo } The result of getting the bundle info. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types. + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @atomicservice + * @since 11 + */ + function getBundleInfoForSelfSync(bundleFlags: number): BundleInfo; + /** + * Obtains the profile designated by metadata name, abilityName and moduleName from the current application. + * + * @param { string } moduleName - Indicates the moduleName of the application. + * @param { string } abilityName - Indicates the abilityName of the application. + * @param { string } metadataName - Indicates the name of metadata in ability. + * @param { AsyncCallback> } callback - The callback of returning string in json-format of the corresponding config file. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types. + * @throws { BusinessError } 17700002 - The specified moduleName is not existed. + * @throws { BusinessError } 17700003 - The specified abilityName is not existed. + * @throws { BusinessError } 17700024 - Failed to get the profile because there is no profile in the HAP. + * @throws { BusinessError } 17700026 - The specified bundle is disabled. + * @throws { BusinessError } 17700029 - The specified ability is disabled. + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + /** + * Obtains the profile designated by metadata name, abilityName and moduleName from the current application. + * + * @param { string } moduleName - Indicates the moduleName of the application. + * @param { string } abilityName - Indicates the abilityName of the application. + * @param { string } metadataName - Indicates the name of metadata in ability. + * @param { AsyncCallback> } callback - The callback of returning string in json-format of the corresponding config file. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types. + * @throws { BusinessError } 17700002 - The specified moduleName is not existed. + * @throws { BusinessError } 17700003 - The specified abilityName is not existed. + * @throws { BusinessError } 17700024 - Failed to get the profile because there is no profile in the HAP. + * @throws { BusinessError } 17700026 - The specified bundle is disabled. + * @throws { BusinessError } 17700029 - The specified ability is disabled. + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @atomicservice + * @since 11 + */ + function getProfileByAbility(moduleName: string, abilityName: string, metadataName: string, callback: AsyncCallback>): void; + /** + * Obtains the profile designated by metadata name, abilityName and moduleName from the current application. + * + * @param { string } moduleName - Indicates the moduleName of the application. + * @param { string } abilityName - Indicates the abilityName of the application. + * @param { string } metadataName - Indicates the name of metadata in ability. + * @returns { Promise> } Returns string in json-format of the corresponding config file. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types. + * @throws { BusinessError } 17700002 - The specified moduleName is not existed. + * @throws { BusinessError } 17700003 - The specified abilityName is not existed. + * @throws { BusinessError } 17700024 - Failed to get the profile because there is no profile in the HAP. + * @throws { BusinessError } 17700026 - The specified bundle is disabled. + * @throws { BusinessError } 17700029 - The specified ability is disabled. + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + /** + * Obtains the profile designated by metadata name, abilityName and moduleName from the current application. + * + * @param { string } moduleName - Indicates the moduleName of the application. + * @param { string } abilityName - Indicates the abilityName of the application. + * @param { string } metadataName - Indicates the name of metadata in ability. + * @returns { Promise> } Returns string in json-format of the corresponding config file. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types. + * @throws { BusinessError } 17700002 - The specified moduleName is not existed. + * @throws { BusinessError } 17700003 - The specified abilityName is not existed. + * @throws { BusinessError } 17700024 - Failed to get the profile because there is no profile in the HAP. + * @throws { BusinessError } 17700026 - The specified bundle is disabled. + * @throws { BusinessError } 17700029 - The specified ability is disabled. + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @atomicservice + * @since 11 + */ + function getProfileByAbility(moduleName: string, abilityName: string, metadataName?: string): Promise>; + /** + * Obtains the profile designated by metadata name, abilityName and moduleName from the current application. + * + * @param { string } moduleName - Indicates the moduleName of the application. + * @param { string } abilityName - Indicates the abilityName of the application. + * @param { string } metadataName - Indicates the name of metadata in ability. + * @returns { Array } Returns string in json-format of the corresponding config file. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types. + * @throws { BusinessError } 17700002 - The specified moduleName is not existed. + * @throws { BusinessError } 17700003 - The specified abilityName is not existed. + * @throws { BusinessError } 17700024 - Failed to get the profile because there is no profile in the HAP. + * @throws { BusinessError } 17700026 - The specified bundle is disabled. + * @throws { BusinessError } 17700029 - The specified ability is disabled. + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 10 + */ + /** + * Obtains the profile designated by metadata name, abilityName and moduleName from the current application. + * + * @param { string } moduleName - Indicates the moduleName of the application. + * @param { string } abilityName - Indicates the abilityName of the application. + * @param { string } metadataName - Indicates the name of metadata in ability. + * @returns { Array } Returns string in json-format of the corresponding config file. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types. + * @throws { BusinessError } 17700002 - The specified moduleName is not existed. + * @throws { BusinessError } 17700003 - The specified abilityName is not existed. + * @throws { BusinessError } 17700024 - Failed to get the profile because there is no profile in the HAP. + * @throws { BusinessError } 17700026 - The specified bundle is disabled. + * @throws { BusinessError } 17700029 - The specified ability is disabled. + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @atomicservice + * @since 11 + */ + function getProfileByAbilitySync(moduleName: string, abilityName: string, metadataName?: string): Array; + /** + * Obtains the profile designated by metadata name, extensionAbilityName and moduleName from the current application. + * + * @param { string } moduleName - Indicates the moduleName of the application. + * @param { string } extensionAbilityName - Indicates the extensionAbilityName of the application. + * @param { string } metadataName - Indicates the name of metadata in ability. + * @param { AsyncCallback> } callback - The callback of returning string in json-format of the corresponding config file. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types. + * @throws { BusinessError } 17700002 - The specified moduleName is not existed. + * @throws { BusinessError } 17700003 - The specified extensionAbilityName not existed. + * @throws { BusinessError } 17700024 - Failed to get the profile because there is no profile in the HAP. + * @throws { BusinessError } 17700026 - The specified bundle is disabled. + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + /** + * Obtains the profile designated by metadata name, extensionAbilityName and moduleName from the current application. + * + * @param { string } moduleName - Indicates the moduleName of the application. + * @param { string } extensionAbilityName - Indicates the extensionAbilityName of the application. + * @param { string } metadataName - Indicates the name of metadata in ability. + * @param { AsyncCallback> } callback - The callback of returning string in json-format of the corresponding config file. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types. + * @throws { BusinessError } 17700002 - The specified moduleName is not existed. + * @throws { BusinessError } 17700003 - The specified extensionAbilityName not existed. + * @throws { BusinessError } 17700024 - Failed to get the profile because there is no profile in the HAP. + * @throws { BusinessError } 17700026 - The specified bundle is disabled. + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @atomicservice + * @since 11 + */ + function getProfileByExtensionAbility(moduleName: string, extensionAbilityName: string, metadataName: string, callback: AsyncCallback>): void; + /** + * Obtains the profile designated by metadata name, extensionAbilityName and moduleName from the current application. + * + * @param { string } moduleName - Indicates the moduleName of the application. + * @param { string } extensionAbilityName - Indicates the extensionAbilityName of the application. + * @param { string } metadataName - Indicates the name of metadata in ability. + * @returns { Promise> } Returns string in json-format of the corresponding config file. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types. + * @throws { BusinessError } 17700002 - The specified moduleName is not existed. + * @throws { BusinessError } 17700003 - The specified extensionAbilityName not existed. + * @throws { BusinessError } 17700024 - Failed to get the profile because there is no profile in the HAP. + * @throws { BusinessError } 17700026 - The specified bundle is disabled. + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + /** + * Obtains the profile designated by metadata name, extensionAbilityName and moduleName from the current application. + * + * @param { string } moduleName - Indicates the moduleName of the application. + * @param { string } extensionAbilityName - Indicates the extensionAbilityName of the application. + * @param { string } metadataName - Indicates the name of metadata in ability. + * @returns { Promise> } Returns string in json-format of the corresponding config file. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types. + * @throws { BusinessError } 17700002 - The specified moduleName is not existed. + * @throws { BusinessError } 17700003 - The specified extensionAbilityName not existed. + * @throws { BusinessError } 17700024 - Failed to get the profile because there is no profile in the HAP. + * @throws { BusinessError } 17700026 - The specified bundle is disabled. + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @atomicservice + * @since 11 + */ + function getProfileByExtensionAbility(moduleName: string, extensionAbilityName: string, metadataName?: string): Promise>; + /** + * Obtains the profile designated by metadata name, extensionAbilityName and moduleName from the current application. + * + * @param { string } moduleName - Indicates the moduleName of the application. + * @param { string } extensionAbilityName - Indicates the extensionAbilityName of the application. + * @param { string } metadataName - Indicates the name of metadata in ability. + * @returns { Array } Returns string in json-format of the corresponding config file. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types. + * @throws { BusinessError } 17700002 - The specified moduleName is not existed. + * @throws { BusinessError } 17700003 - The specified extensionAbilityName not existed. + * @throws { BusinessError } 17700024 - Failed to get the profile because there is no profile in the HAP. + * @throws { BusinessError } 17700026 - The specified bundle is disabled. + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 10 + */ + /** + * Obtains the profile designated by metadata name, extensionAbilityName and moduleName from the current application. + * + * @param { string } moduleName - Indicates the moduleName of the application. + * @param { string } extensionAbilityName - Indicates the extensionAbilityName of the application. + * @param { string } metadataName - Indicates the name of metadata in ability. + * @returns { Array } Returns string in json-format of the corresponding config file. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types. + * @throws { BusinessError } 17700002 - The specified moduleName is not existed. + * @throws { BusinessError } 17700003 - The specified extensionAbilityName not existed. + * @throws { BusinessError } 17700024 - Failed to get the profile because there is no profile in the HAP. + * @throws { BusinessError } 17700026 - The specified bundle is disabled. + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @atomicservice + * @since 11 + */ + function getProfileByExtensionAbilitySync(moduleName: string, extensionAbilityName: string, metadataName?: string): Array; + /** + * Verifies the validity of .abc files. Only .abc files passed the verification can run on the restricted VM. + * + * @permission ohos.permission.RUN_DYN_CODE + * @param { Array } abcPaths - The abc path. + * @param { boolean } deleteOriginalFiles - Used to decide whether to delete the original files. + * @param { AsyncCallback } callback - Indicates the callback of verifyAbc result. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types. + * @throws { BusinessError } 17700201 - Failed to verify the abc file. + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 11 + */ + function verifyAbc(abcPaths: Array, deleteOriginalFiles: boolean, callback: AsyncCallback): void; + /** + * Verifies the validity of .abc files. Only .abc files passed the verification can run on the restricted VM. + * + * @permission ohos.permission.RUN_DYN_CODE + * @param { Array } abcPaths - The abc path. + * @param { boolean } deleteOriginalFiles - Used to decide whether to delete the original files. + * @returns { Promise } Returns verifyAbc result. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types. + * @throws { BusinessError } 17700201 - Failed to verify the abc file. + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 11 + */ + function verifyAbc(abcPaths: Array, deleteOriginalFiles: boolean): Promise; + /** + * Delete the verified .abc file. + * + * @permission ohos.permission.RUN_DYN_CODE + * @param { string } abcPath - The abc path. + * @returns { Promise } Returns deleteAbc result. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types. + * @throws { BusinessError } 17700202 - Failed to delete the abc file. + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 11 + */ + function deleteAbc(abcPath: string): Promise; + /** + * Check whether the link can be opened. + * + * @param { string } link - Indicates the link to be opened. + * @returns { boolean } Returns true if the link can be opened; returns false otherwise. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types. + * @throws { BusinessError } 17700055 - The specified link is invalid. + * @throws { BusinessError } 17700056 - The scheme of the specified link is not in the querySchemes. + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @atomicservice + * @since 12 + */ + function canOpenLink(link: string): boolean; + /** + * Obtains configuration information about an application. + * + * @typedef { _ApplicationInfo } + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + /** + * Obtains configuration information about an application. + * + * @typedef { _ApplicationInfo } + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @atomicservice + * @since 11 + */ + export type ApplicationInfo = _ApplicationInfo; + /** + * Indicates the metadata information about a module. + * + * @typedef { _ModuleMetadata } + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 10 + */ + /** + * Indicates the metadata information about a module. + * + * @typedef { _ModuleMetadata } + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @atomicservice + * @since 11 + */ + export type ModuleMetadata = _ModuleMetadata; + /** + * Indicates the Metadata. + * + * @typedef { _Metadata } + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + /** + * Indicates the Metadata. + * + * @typedef { _Metadata } + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @atomicservice + * @since 11 + */ + export type Metadata = _Metadata; + /** + * Obtains configuration information about a bundle. + * + * @typedef { _BundleInfo.BundleInfo } + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + /** + * Obtains configuration information about a bundle. + * + * @typedef { _BundleInfo.BundleInfo } + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @atomicservice + * @since 11 + */ + export type BundleInfo = _BundleInfo.BundleInfo; + /** + * The scene which is used. + * + * @typedef { _BundleInfo.UsedScene } + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + /** + * The scene which is used. + * + * @typedef { _BundleInfo.UsedScene } + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @atomicservice + * @since 11 + */ + export type UsedScene = _BundleInfo.UsedScene; + /** + * Indicates the required permissions details defined in file config.json. + * + * @typedef { _BundleInfo.ReqPermissionDetail } + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + /** + * Indicates the required permissions details defined in file config.json. + * + * @typedef { _BundleInfo.ReqPermissionDetail } + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @atomicservice + * @since 11 + */ + export type ReqPermissionDetail = _BundleInfo.ReqPermissionDetail; + /** + * Indicates the SignatureInfo. + * + * @typedef { _BundleInfo.SignatureInfo } + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + /** + * Indicates the SignatureInfo. + * + * @typedef { _BundleInfo.SignatureInfo } + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @atomicservice + * @since 11 + */ + export type SignatureInfo = _BundleInfo.SignatureInfo; + /** + * Obtains configuration information about a module. + * + * @typedef { _HapModuleInfo.HapModuleInfo } + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + /** + * Obtains configuration information about a module. + * + * @typedef { _HapModuleInfo.HapModuleInfo } + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @atomicservice + * @since 11 + */ + export type HapModuleInfo = _HapModuleInfo.HapModuleInfo; + /** + * Obtains preload information about a module. + * + * @typedef { _HapModuleInfo.PreloadItem } + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + /** + * Obtains preload information about a module. + * + * @typedef { _HapModuleInfo.PreloadItem } + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @atomicservice + * @since 11 + */ + export type PreloadItem = _HapModuleInfo.PreloadItem; + /** + * Obtains dependency information about a module. + * + * @typedef { _HapModuleInfo.Dependency } + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + /** + * Obtains dependency information about a module. + * + * @typedef { _HapModuleInfo.Dependency } + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @atomicservice + * @since 11 + */ + export type Dependency = _HapModuleInfo.Dependency; + /** + * Obtains the router item about a module. + * + * @typedef { _HapModuleInfo.RouterItem} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @atomicservice + * @since 12 + */ + export type RouterItem = _HapModuleInfo.RouterItem; + /** + * Obtains the data item within router item. + * + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @atomicservice + * @since 12 + */ + export type DataItem = _HapModuleInfo.DataItem; + /** + * Obtains configuration information about an ability. + * + * @typedef { _AbilityInfo.AbilityInfo } + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + /** + * Obtains configuration information about an ability. + * + * @typedef { _AbilityInfo.AbilityInfo } + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @atomicservice + * @since 11 + */ + export type AbilityInfo = _AbilityInfo.AbilityInfo; + /** + * Contains basic Ability information. Indicates the window size.. + * + * @typedef { _AbilityInfo.WindowSize } + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + /** + * Contains basic Ability information. Indicates the window size.. + * + * @typedef { _AbilityInfo.WindowSize } + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @atomicservice + * @since 11 + */ + export type WindowSize = _AbilityInfo.WindowSize; + /** + * Obtains extension information about a bundle. + * + * @typedef { _ExtensionAbilityInfo.ExtensionAbilityInfo } + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + /** + * Obtains extension information about a bundle. + * + * @typedef { _ExtensionAbilityInfo.ExtensionAbilityInfo } + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @atomicservice + * @since 11 + */ + export type ExtensionAbilityInfo = _ExtensionAbilityInfo.ExtensionAbilityInfo; + /** + * Contains basic Ability information, which uniquely identifies an ability. + * + * @typedef { _ElementName } + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + /** + * Contains basic Ability information, which uniquely identifies an ability. + * + * @typedef { _ElementName } + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @atomicservice + * @since 11 + */ + export type ElementName = _ElementName; + /** + * Obtains configuration information about an skill + * + * @typedef { _Skill.Skill } + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @atomicservice + * @since 12 + */ + export type Skill = _Skill.Skill; + /** + * Obtains configuration information about an skillUri + * + * @typedef { _Skill.SkillUri } + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @atomicservice + * @since 12 + */ + export type SkillUrl = _Skill.SkillUri; +} +export default bundleManager; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.bundle.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.bundle.d.ts new file mode 100755 index 00000000..9975a129 --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.bundle.d.ts @@ -0,0 +1,840 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit AbilityKit + */ +import { AsyncCallback } from './@ohos.base'; +import { ApplicationInfo } from './bundle/applicationInfo'; +import { AbilityInfo } from './bundle/abilityInfo'; +import Want from './@ohos.app.ability.Want'; +import image from './@ohos.multimedia.image'; +import { BundleInfo } from './bundle/bundleInfo'; +/** + * bundle. + * + * @namespace bundle + * @syscap SystemCapability.BundleManager.BundleFramework + * @since 7 + * @deprecated since 9 + * @useinstead ohos.bundle.bundleManager + */ +declare namespace bundle { + /** + * BundleFlag + * + * @enum { number } + * @syscap SystemCapability.BundleManager.BundleFramework + * @since 7 + * @deprecated since 9 + * @useinstead ohos.bundle.bundleManager.BundleFlag + */ + enum BundleFlag { + /** + * @syscap SystemCapability.BundleManager.BundleFramework + * @since 7 + * @deprecated since 9 + */ + GET_BUNDLE_DEFAULT = 0x00000000, + /** + * @syscap SystemCapability.BundleManager.BundleFramework + * @since 7 + * @deprecated since 9 + */ + GET_BUNDLE_WITH_ABILITIES = 0x00000001, + /** + * @syscap SystemCapability.BundleManager.BundleFramework + * @since 7 + * @deprecated since 9 + */ + GET_ABILITY_INFO_WITH_PERMISSION = 0x00000002, + /** + * @syscap SystemCapability.BundleManager.BundleFramework + * @since 7 + * @deprecated since 9 + */ + GET_ABILITY_INFO_WITH_APPLICATION = 0x00000004, + /** + * @syscap SystemCapability.BundleManager.BundleFramework + * @since 7 + * @deprecated since 9 + */ + GET_APPLICATION_INFO_WITH_PERMISSION = 0x00000008, + /** + * @syscap SystemCapability.BundleManager.BundleFramework + * @since 7 + * @deprecated since 9 + */ + GET_BUNDLE_WITH_REQUESTED_PERMISSION = 0x00000010, + /** + * @syscap SystemCapability.BundleManager.BundleFramework + * @since 7 + * @deprecated since 9 + */ + GET_ALL_APPLICATION_INFO = 0xFFFF0000, + /** + * @syscap SystemCapability.BundleManager.BundleFramework + * @since 8 + * @deprecated since 9 + */ + GET_ABILITY_INFO_WITH_METADATA = 0x00000020, + /** + * @syscap SystemCapability.BundleManager.BundleFramework + * @since 8 + * @deprecated since 9 + */ + GET_APPLICATION_INFO_WITH_METADATA = 0x00000040, + /** + * @syscap SystemCapability.BundleManager.BundleFramework + * @since 8 + * @deprecated since 9 + */ + GET_ABILITY_INFO_SYSTEMAPP_ONLY = 0x00000080, + /** + * @syscap SystemCapability.BundleManager.BundleFramework + * @since 8 + * @deprecated since 9 + */ + GET_ABILITY_INFO_WITH_DISABLE = 0x00000100, + /** + * @syscap SystemCapability.BundleManager.BundleFramework + * @since 8 + * @deprecated since 9 + */ + GET_APPLICATION_INFO_WITH_DISABLE = 0x00000200 + } + /** + * ColorMode + * + * @enum { number } + * @syscap SystemCapability.BundleManager.BundleFramework + * @since 7 + * @deprecated since 9 + */ + export enum ColorMode { + /** + * @syscap SystemCapability.BundleManager.BundleFramework + * @since 7 + * @deprecated since 9 + */ + AUTO_MODE = -1, + /** + * @syscap SystemCapability.BundleManager.BundleFramework + * @since 7 + * @deprecated since 9 + */ + DARK_MODE = 0, + /** + * @syscap SystemCapability.BundleManager.BundleFramework + * @since 7 + * @deprecated since 9 + */ + LIGHT_MODE = 1 + } + /** + * GrantStatus + * + * @enum { number } + * @syscap SystemCapability.BundleManager.BundleFramework + * @since 7 + * @deprecated since 9 + * @useinstead ohos.bundle.bundleManager.PermissionGrantState + */ + export enum GrantStatus { + /** + * @syscap SystemCapability.BundleManager.BundleFramework + * @since 7 + * @deprecated since 9 + */ + PERMISSION_DENIED = -1, + /** + * @syscap SystemCapability.BundleManager.BundleFramework + * @since 7 + * @deprecated since 9 + */ + PERMISSION_GRANTED = 0 + } + /** + * AbilityType + * + * @enum { number } + * @syscap SystemCapability.BundleManager.BundleFramework + * @since 7 + * @deprecated since 9 + * @useinstead ohos.bundle.bundleManager.AbilityType + */ + export enum AbilityType { + /** + * Indicates an unknown ability type + * + * @syscap SystemCapability.BundleManager.BundleFramework + * @since 7 + * @deprecated since 9 + */ + UNKNOWN, + /** + * Indicates that the ability has a UI + * + * @syscap SystemCapability.BundleManager.BundleFramework + * @since 7 + * @deprecated since 9 + */ + PAGE, + /** + * Indicates that the ability does not have a UI + * + * @syscap SystemCapability.BundleManager.BundleFramework + * @since 7 + * @deprecated since 9 + */ + SERVICE, + /** + * Indicates that the ability is used to provide data access services + * + * @syscap SystemCapability.BundleManager.BundleFramework + * @since 7 + * @deprecated since 9 + */ + DATA + } + /** + * AbilitySubType + * + * @enum { number } + * @syscap SystemCapability.BundleManager.BundleFramework + * @since 7 + * @deprecated since 9 + */ + export enum AbilitySubType { + /** + * @syscap SystemCapability.BundleManager.BundleFramework + * @since 7 + * @deprecated since 9 + */ + UNSPECIFIED = 0, + /** + * @syscap SystemCapability.BundleManager.BundleFramework + * @since 7 + * @deprecated since 9 + */ + CA = 1 + } + /** + * DisplayOrientation + * + * @enum { number } + * @syscap SystemCapability.BundleManager.BundleFramework + * @since 7 + * @deprecated since 9 + * @useinstead ohos.bundle.bundleManager.DisplayOrientation + */ + export enum DisplayOrientation { + /** + * Indicates that the system automatically determines the display orientation + * + * @syscap SystemCapability.BundleManager.BundleFramework + * @since 7 + * @deprecated since 9 + */ + UNSPECIFIED, + /** + * Indicates the landscape orientation + * + * @syscap SystemCapability.BundleManager.BundleFramework + * @since 7 + * @deprecated since 9 + */ + LANDSCAPE, + /** + * Indicates the portrait orientation + * + * @syscap SystemCapability.BundleManager.BundleFramework + * @since 7 + * @deprecated since 9 + */ + PORTRAIT, + /** + * Indicates the page ability orientation is the same as that of the nearest ability in the stack + * + * @syscap SystemCapability.BundleManager.BundleFramework + * @since 7 + * @deprecated since 9 + */ + FOLLOW_RECENT + } + /** + * LaunchMode + * + * @enum { number } + * @syscap SystemCapability.BundleManager.BundleFramework + * @since 7 + * @deprecated since 9 + * @useinstead ohos.bundle.bundleManager.LaunchType + */ + export enum LaunchMode { + /** + * Indicates that the ability has only one instance + * + * @syscap SystemCapability.BundleManager.BundleFramework + * @since 7 + * @deprecated since 9 + */ + SINGLETON = 0, + /** + * Indicates that the ability can have multiple instances + * + * @syscap SystemCapability.BundleManager.BundleFramework + * @since 7 + * @deprecated since 9 + */ + STANDARD = 1 + } + /** + * BundleOptions + * + * @typedef BundleOptions + * @syscap SystemCapability.BundleManager.BundleFramework + * @since 7 + * @deprecated since 9 + */ + export interface BundleOptions { + /** + * Indicates the user id + * + * @syscap SystemCapability.BundleManager.BundleFramework + * @since 7 + * @deprecated since 9 + */ + userId?: number; + } + /** + * InstallErrorCode + * + * @enum { number } + * @syscap SystemCapability.BundleManager.BundleFramework + * @since 7 + * @deprecated since 9 + */ + export enum InstallErrorCode { + /** + * @syscap SystemCapability.BundleManager.BundleFramework + * @since 7 + * @deprecated since 9 + */ + SUCCESS = 0, + /** + * @syscap SystemCapability.BundleManager.BundleFramework + * @since 7 + * @deprecated since 9 + */ + STATUS_INSTALL_FAILURE = 1, + /** + * @syscap SystemCapability.BundleManager.BundleFramework + * @since 7 + * @deprecated since 9 + */ + STATUS_INSTALL_FAILURE_ABORTED = 2, + /** + * @syscap SystemCapability.BundleManager.BundleFramework + * @since 7 + * @deprecated since 9 + */ + STATUS_INSTALL_FAILURE_INVALID = 3, + /** + * @syscap SystemCapability.BundleManager.BundleFramework + * @since 7 + * @deprecated since 9 + */ + STATUS_INSTALL_FAILURE_CONFLICT = 4, + /** + * @syscap SystemCapability.BundleManager.BundleFramework + * @since 7 + * @deprecated since 9 + */ + STATUS_INSTALL_FAILURE_STORAGE = 5, + /** + * @syscap SystemCapability.BundleManager.BundleFramework + * @since 7 + * @deprecated since 9 + */ + STATUS_INSTALL_FAILURE_INCOMPATIBLE = 6, + /** + * @syscap SystemCapability.BundleManager.BundleFramework + * @since 7 + * @deprecated since 9 + */ + STATUS_UNINSTALL_FAILURE = 7, + /** + * @syscap SystemCapability.BundleManager.BundleFramework + * @since 7 + * @deprecated since 9 + */ + STATUS_UNINSTALL_FAILURE_BLOCKED = 8, + /** + * @syscap SystemCapability.BundleManager.BundleFramework + * @since 7 + * @deprecated since 9 + */ + STATUS_UNINSTALL_FAILURE_ABORTED = 9, + /** + * @syscap SystemCapability.BundleManager.BundleFramework + * @since 7 + * @deprecated since 9 + */ + STATUS_UNINSTALL_FAILURE_CONFLICT = 10, + /** + * @syscap SystemCapability.BundleManager.BundleFramework + * @since 7 + * @deprecated since 9 + */ + STATUS_INSTALL_FAILURE_DOWNLOAD_TIMEOUT = 0x0B, + /** + * @syscap SystemCapability.BundleManager.BundleFramework + * @since 7 + * @deprecated since 9 + */ + STATUS_INSTALL_FAILURE_DOWNLOAD_FAILED = 0x0C, + /** + * @syscap SystemCapability.BundleManager.BundleFramework + * @since 8 + * @deprecated since 9 + */ + STATUS_RECOVER_FAILURE_INVALID = 0x0D, + /** + * @syscap SystemCapability.BundleManager.BundleFramework + * @since 7 + * @deprecated since 9 + */ + STATUS_ABILITY_NOT_FOUND = 0x40, + /** + * @syscap SystemCapability.BundleManager.BundleFramework + * @since 7 + * @deprecated since 9 + */ + STATUS_BMS_SERVICE_ERROR = 0x41, + /** + * @syscap SystemCapability.BundleManager.BundleFramework + * @since 8 + * @deprecated since 9 + */ + STATUS_FAILED_NO_SPACE_LEFT = 0x42, + /** + * @syscap SystemCapability.BundleManager.BundleFramework + * @since 8 + * @deprecated since 9 + */ + STATUS_GRANT_REQUEST_PERMISSIONS_FAILED = 0x43, + /** + * @syscap SystemCapability.BundleManager.BundleFramework + * @since 8 + * @deprecated since 9 + */ + STATUS_INSTALL_PERMISSION_DENIED = 0x44, + /** + * @syscap SystemCapability.BundleManager.BundleFramework + * @since 8 + * @deprecated since 9 + */ + STATUS_UNINSTALL_PERMISSION_DENIED = 0x45 + } + /** + * Obtains bundleInfo based on bundleName, bundleFlags and options. + * + * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO + * @param { string } bundleName - Indicates the application bundle name to be queried. + * @param { number } bundleFlags - Indicates the application bundle flags to be queried. + * @param { BundleOptions } options Indicates the bundle options object. + * @param { AsyncCallback } callback + * @syscap SystemCapability.BundleManager.BundleFramework + * @since 7 + * @deprecated since 9 + */ + function getBundleInfo(bundleName: string, bundleFlags: number, options: BundleOptions, callback: AsyncCallback): void; + /** + * Obtains bundleInfo based on bundleName, bundleFlags and options. + * + * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO + * @param { string } bundleName - Indicates the application bundle name to be queried. + * @param { number } bundleFlags - Indicates the application bundle flags to be queried. + * @param { AsyncCallback } callback + * @syscap SystemCapability.BundleManager.BundleFramework + * @since 7 + * @deprecated since 9 + */ + function getBundleInfo(bundleName: string, bundleFlags: number, callback: AsyncCallback): void; + /** + * Obtains bundleInfo based on bundleName, bundleFlags and options. + * + * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO + * @param { string } bundleName - Indicates the application bundle name to be queried. + * @param { number } bundleFlags - Indicates the application bundle flags to be queried. + * @param { BundleOptions } options Indicates the bundle options object. + * @returns { Promise } Returns the BundleInfo object. + * @syscap SystemCapability.BundleManager.BundleFramework + * @since 7 + * @deprecated since 9 + */ + function getBundleInfo(bundleName: string, bundleFlags: number, options?: BundleOptions): Promise; + /** + * Obtains information about the current ability. + * + * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO + * @param { string } bundleName - Indicates the application bundle name to be queried. + * @param { string } abilityName - Indicates the ability name. + * @param { AsyncCallback } callback + * @syscap SystemCapability.BundleManager.BundleFramework + * @since 7 + * @deprecated since 9 + */ + function getAbilityInfo(bundleName: string, abilityName: string, callback: AsyncCallback): void; + /** + * Obtains information about the current ability. + * + * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO + * @param { string } bundleName - Indicates the application bundle name to be queried. + * @param { string } abilityName - Indicates the ability name. + * @returns { Promise } Returns the AbilityInfo object for the current ability. + * @syscap SystemCapability.BundleManager.BundleFramework + * @since 7 + * @deprecated since 9 + */ + function getAbilityInfo(bundleName: string, abilityName: string): Promise; + /** + * Obtains based on a given bundle name. + * + * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO + * @param { string } bundleName - Indicates the application bundle name to be queried. + * @param { number } bundleFlags - Indicates the flag used to specify information contained + * in the ApplicationInfo object that will be returned. + * @param { number } userId - Indicates the user ID or do not pass user ID. + * @param { AsyncCallback } callback + * @syscap SystemCapability.BundleManager.BundleFramework + * @since 7 + * @deprecated since 9 + */ + function getApplicationInfo(bundleName: string, bundleFlags: number, userId: number, callback: AsyncCallback): void; + /** + * Obtains based on a given bundle name. + * + * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO + * @param { string } bundleName - Indicates the application bundle name to be queried. + * @param { number } bundleFlags - Indicates the flag used to specify information contained + * in the ApplicationInfo object that will be returned. + * @param { AsyncCallback } callback + * @syscap SystemCapability.BundleManager.BundleFramework + * @since 7 + * @deprecated since 9 + */ + function getApplicationInfo(bundleName: string, bundleFlags: number, callback: AsyncCallback): void; + /** + * Obtains based on a given bundle name. + * + * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO + * @param { string } bundleName - Indicates the application bundle name to be queried. + * @param { number } bundleFlags - Indicates the flag used to specify information contained + * in the ApplicationInfo object that will be returned. + * @param { number } userId - Indicates the user ID or do not pass user ID. + * @returns { Promise } Returns the ApplicationInfo object. + * @syscap SystemCapability.BundleManager.BundleFramework + * @since 7 + * @deprecated since 9 + */ + function getApplicationInfo(bundleName: string, bundleFlags: number, userId?: number): Promise; + /** + * Query the AbilityInfo by the given Want. + * + * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO + * @param { Want } want - Indicates the Want containing the application bundle name + * to be queried. + * @param { number } bundleFlags - Indicates the flag used to specify information contained in the AbilityInfo objects that + * will be returned. + * @param { number } userId - Indicates the user ID. + * @param { AsyncCallback> } callback + * @syscap SystemCapability.BundleManager.BundleFramework + * @since 7 + * @deprecated since 9 + */ + function queryAbilityByWant(want: Want, bundleFlags: number, userId: number, callback: AsyncCallback>): void; + /** + * Query the AbilityInfo by the given Want. + * + * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO + * @param { Want } want - Indicates the Want containing the application bundle name + * to be queried. + * @param { number } bundleFlags - Indicates the flag used to specify information contained in the AbilityInfo objects that + * will be returned. + * @param { AsyncCallback> } callback + * @syscap SystemCapability.BundleManager.BundleFramework + * @since 7 + * @deprecated since 9 + */ + function queryAbilityByWant(want: Want, bundleFlags: number, callback: AsyncCallback>): void; + /** + * Query the AbilityInfo by the given Want. + * + * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO + * @param { Want } want - Indicates the Want containing the application bundle name + * to be queried. + * @param { number } bundleFlags - Indicates the flag used to specify information contained in the AbilityInfo objects that + * will be returned. + * @param { number } userId - Indicates the user ID. + * @returns { Promise> } Returns a list of AbilityInfo objects. + * @syscap SystemCapability.BundleManager.BundleFramework + * @since 7 + * @deprecated since 9 + */ + function queryAbilityByWant(want: Want, bundleFlags: number, userId?: number): Promise>; + /** + * Obtains BundleInfo of all bundles available in the system. + * + * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED + * @param { BundleFlag } bundleFlag - Indicates the flag used to specify information contained + * in the BundleInfo that will be returned. + * @param { number } userId - Indicates the user ID. + * @param { AsyncCallback> } callback + * @syscap SystemCapability.BundleManager.BundleFramework + * @since 7 + * @deprecated since 9 + */ + function getAllBundleInfo(bundleFlag: BundleFlag, userId: number, callback: AsyncCallback>): void; + /** + * Obtains BundleInfo of all bundles available in the system. + * + * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED + * @param { BundleFlag } bundleFlag - Indicates the flag used to specify information contained + * in the BundleInfo that will be returned. + * @param { AsyncCallback> } callback + * @syscap SystemCapability.BundleManager.BundleFramework + * @since 7 + * @deprecated since 9 + */ + function getAllBundleInfo(bundleFlag: BundleFlag, callback: AsyncCallback>): void; + /** + * Obtains BundleInfo of all bundles available in the system. + * + * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED + * @param { BundleFlag } bundleFlag - Indicates the flag used to specify information contained + * in the BundleInfo that will be returned. + * @param { number } userId - Indicates the user ID. + * @returns { Promise> } Returns a list of BundleInfo objects. + * @syscap SystemCapability.BundleManager.BundleFramework + * @since 7 + * @deprecated since 9 + */ + function getAllBundleInfo(bundleFlag: BundleFlag, userId?: number): Promise>; + /** + * Obtains information about all installed applications of a specified user. + * + * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED + * @param { number } bundleFlags - Indicates the flag used to specify information contained + * in the ApplicationInfo objects that will be returned. + * @param { number } userId - Indicates the user ID. + * @param { AsyncCallback> } callback + * @syscap SystemCapability.BundleManager.BundleFramework + * @since 7 + * @deprecated since 9 + */ + function getAllApplicationInfo(bundleFlags: number, userId: number, callback: AsyncCallback>): void; + /** + * Obtains information about all installed applications of a specified user. + * + * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED + * @param { number } bundleFlags - Indicates the flag used to specify information contained + * in the ApplicationInfo objects that will be returned. + * @param { AsyncCallback> } callback + * @syscap SystemCapability.BundleManager.BundleFramework + * @since 7 + * @deprecated since 9 + */ + function getAllApplicationInfo(bundleFlags: number, callback: AsyncCallback>): void; + /** + * Obtains information about all installed applications of a specified user. + * + * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED + * @param { number } bundleFlags - Indicates the flag used to specify information contained + * in the ApplicationInfo objects that will be returned. + * @param { number } userId - Indicates the user ID or do not pass user ID. + * @returns { Promise> } Returns a list of ApplicationInfo objects. + * @syscap SystemCapability.BundleManager.BundleFramework + * @since 7 + * @deprecated since 9 + */ + function getAllApplicationInfo(bundleFlags: number, userId?: number): Promise>; + /** + * Obtains bundle name by the given uid. + * + * @param { number } uid - Indicates the UID of an application. + * @param { AsyncCallback } callback + * @syscap SystemCapability.BundleManager.BundleFramework + * @since 8 + * @deprecated since 9 + */ + function getNameForUid(uid: number, callback: AsyncCallback): void; + /** + * Obtains bundle name by the given uid. + * + * @param { number } uid - Indicates the UID of an application. + * @returns { Promise } Returns the bundle name. + * @syscap SystemCapability.BundleManager.BundleFramework + * @since 8 + * @deprecated since 9 + */ + function getNameForUid(uid: number): Promise; + /** + * Obtains information about an application bundle contained in an ohos Ability Package (HAP). + * + * @param { string } hapFilePath - Indicates the path storing the HAP. The path should be the relative path + * to the data directory of the current application. + * @param { number } bundleFlags - Indicates the flag used to specify information contained in the + * BundleInfo object to be returned. + * @param { AsyncCallback } callback + * @syscap SystemCapability.BundleManager.BundleFramework + * @since 7 + * @deprecated since 9 + */ + function getBundleArchiveInfo(hapFilePath: string, bundleFlags: number, callback: AsyncCallback): void; + /** + * Obtains information about an application bundle contained in an ohos Ability Package (HAP). + * + * @param { string } hapFilePath - Indicates the path storing the HAP. The path should be the relative path + * to the data directory of the current application. + * @param { number } bundleFlags - Indicates the flag used to specify information contained in the + * BundleInfo object to be returned. + * @returns { Promise } - Returns the BundleInfo object. + * @syscap SystemCapability.BundleManager.BundleFramework + * @since 7 + * @deprecated since 9 + */ + function getBundleArchiveInfo(hapFilePath: string, bundleFlags: number): Promise; + /** + * Obtains the Want for starting the main ability of an application based on the + * given bundle name. The main ability of an application is the ability that has the + * #ACTION_HOME and #ENTITY_HOME Want + * filters set in the application's config.json file. + * + * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED + * @param { string } bundleName - Indicates the bundle name of the application. + * @param { AsyncCallback } callback + * @syscap SystemCapability.BundleManager.BundleFramework + * @since 7 + * @deprecated since 9 + */ + function getLaunchWantForBundle(bundleName: string, callback: AsyncCallback): void; + /** + * Obtains the Want for starting the main ability of an application based on the + * given bundle name. The main ability of an application is the ability that has the + * #ACTION_HOME and #ENTITY_HOME Want + * filters set in the application's config.json file. + * + * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED + * @param { string } bundleName - Indicates the bundle name of the application. + * @returns { Promise } Returns the Want for starting the application's main ability if any. + * @syscap SystemCapability.BundleManager.BundleFramework + * @since 7 + * @deprecated since 9 + */ + function getLaunchWantForBundle(bundleName: string): Promise; + /** + * Obtains the label of a specified ability. + * + * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO + * @param { string } bundleName - Indicates the bundle name of the application to which the ability belongs. + * @param { string } abilityName - Indicates the ability name. + * @param { AsyncCallback } callback + * @syscap SystemCapability.BundleManager.BundleFramework + * @since 8 + * @deprecated since 9 + */ + function getAbilityLabel(bundleName: string, abilityName: string, callback: AsyncCallback): void; + /** + * Obtains the label of a specified ability. + * + * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO + * @param { string } bundleName - Indicates the bundle name of the application to which the ability belongs. + * @param { string } abilityName - Indicates the ability name. + * @returns { Promise } Returns the label representing the label of the specified ability. + * @syscap SystemCapability.BundleManager.BundleFramework + * @since 8 + * @deprecated since 9 + */ + function getAbilityLabel(bundleName: string, abilityName: string): Promise; + /** + * Obtains the icon of a specified ability. + * + * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO + * @param { string } bundleName - Indicates the bundle name of the application to which the ability belongs. + * @param { string } abilityName - Indicates the ability name. + * @param { AsyncCallback } callback + * @syscap SystemCapability.BundleManager.BundleFramework + * @since 8 + * @deprecated since 9 + * @useinstead ohos.resourceManager#getMediaContent + */ + function getAbilityIcon(bundleName: string, abilityName: string, callback: AsyncCallback): void; + /** + * Obtains the icon of a specified ability. + * + * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO + * @param { string } bundleName - Indicates the bundle name of the application to which the ability belongs. + * @param { string } abilityName - Indicates the ability name. + * @returns { Promise } Returns the PixelMap object representing the icon of the specified ability. + * @syscap SystemCapability.BundleManager.BundleFramework + * @since 8 + * @deprecated since 9 + * @useinstead ohos.resourceManager#getMediaContent + */ + function getAbilityIcon(bundleName: string, abilityName: string): Promise; + /** + * Checks whether a specified ability is enabled. + * + * @param { AbilityInfo } info - Indicates information about the ability to check. + * @param { AsyncCallback } callback + * @syscap SystemCapability.BundleManager.BundleFramework + * @since 8 + * @deprecated since 9 + */ + function isAbilityEnabled(info: AbilityInfo, callback: AsyncCallback): void; + /** + * Checks whether a specified ability is enabled. + * + * @param { AbilityInfo } info - Indicates information about the ability to check. + * @returns { Promise } Returns true if the ability is enabled; returns false otherwise. + * @syscap SystemCapability.BundleManager.BundleFramework + * @since 8 + * @deprecated since 9 + */ + function isAbilityEnabled(info: AbilityInfo): Promise; + /** + * Checks whether a specified application is enabled. + * + * @param { string } bundleName - Indicates the bundle name of the application. + * @param { AsyncCallback } callback + * @syscap SystemCapability.BundleManager.BundleFramework + * @since 8 + * @deprecated since 9 + */ + function isApplicationEnabled(bundleName: string, callback: AsyncCallback): void; + /** + * Checks whether a specified application is enabled. + * + * @param { string } bundleName - Indicates the bundle name of the application. + * @returns { Promise } Returns true if the application is enabled; returns false otherwise. + * @syscap SystemCapability.BundleManager.BundleFramework + * @since 8 + * @deprecated since 9 + */ + function isApplicationEnabled(bundleName: string): Promise; +} +export default bundle; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.bundle.defaultAppManager.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.bundle.defaultAppManager.d.ts new file mode 100755 index 00000000..70f8fb70 --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.bundle.defaultAppManager.d.ts @@ -0,0 +1,134 @@ +/* + * Copyright (c) 2022-2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit AbilityKit + */ +import { AsyncCallback } from './@ohos.base'; +/** + * Default application manager. + * + * @namespace defaultAppManager + * @syscap SystemCapability.BundleManager.BundleFramework.DefaultApp + * @since 9 + */ +declare namespace defaultAppManager { + /** + * The constant for application type. + * + * @enum { number } + * @syscap SystemCapability.BundleManager.BundleFramework.DefaultApp + * @since 9 + */ + export enum ApplicationType { + /** + * Default browser identifier. + * + * @syscap SystemCapability.BundleManager.BundleFramework.DefaultApp + * @since 9 + */ + BROWSER = 'Web Browser', + /** + * Default image identifier. + * + * @syscap SystemCapability.BundleManager.BundleFramework.DefaultApp + * @since 9 + */ + IMAGE = 'Image Gallery', + /** + * Default audio identifier. + * + * @syscap SystemCapability.BundleManager.BundleFramework.DefaultApp + * @since 9 + */ + AUDIO = 'Audio Player', + /** + * Default video identifier. + * + * @syscap SystemCapability.BundleManager.BundleFramework.DefaultApp + * @since 9 + */ + VIDEO = 'Video Player', + /** + * Default PDF identifier. + * + * @syscap SystemCapability.BundleManager.BundleFramework.DefaultApp + * @since 9 + */ + PDF = 'PDF Viewer', + /** + * Default word identifier. + * + * @syscap SystemCapability.BundleManager.BundleFramework.DefaultApp + * @since 9 + */ + WORD = 'Word Viewer', + /** + * Default excel identifier. + * + * @syscap SystemCapability.BundleManager.BundleFramework.DefaultApp + * @since 9 + */ + EXCEL = 'Excel Viewer', + /** + * Default PPT identifier. + * + * @syscap SystemCapability.BundleManager.BundleFramework.DefaultApp + * @since 9 + */ + PPT = 'PPT Viewer', + /** + * Default email identifier. + * + * @syscap SystemCapability.BundleManager.BundleFramework.DefaultApp + * @since 12 + */ + EMAIL = 'Email' + } + /** + * Query whether the caller is default application based on type. + * + * @param { string } type - Application type or a file type that conforms to media type format. + * @param { AsyncCallback } callback - The callback of querying default application result. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.BundleManager.BundleFramework.DefaultApp + * @since 9 + */ + function isDefaultApplication(type: string, callback: AsyncCallback): void; + /** + * Query whether the caller is default application based on type. + * + * @param { string } type - Application type or a file type that conforms to media type format. + * @returns { Promise } Return true if caller is default application; return false otherwise. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.BundleManager.BundleFramework.DefaultApp + * @since 9 + */ + function isDefaultApplication(type: string): Promise; + /** + * Query whether the caller is default application based on type. + * + * @param { string } type - Application type or a file type that conforms to media type format. + * @returns { boolean } Return true if caller is default application; return false otherwise. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.BundleManager.BundleFramework.DefaultApp + * @since 10 + */ + function isDefaultApplicationSync(type: string): boolean; +} +export default defaultAppManager; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.bundle.overlay.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.bundle.overlay.d.ts new file mode 100755 index 00000000..08980d0c --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.bundle.overlay.d.ts @@ -0,0 +1,113 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit AbilityKit + */ +import { AsyncCallback } from './@ohos.base'; +import * as _OverlayModuleInfo from './bundleManager/OverlayModuleInfo'; +/** + * Used for application interception overlay + * + * @namespace overlay + * @syscap SystemCapability.BundleManager.BundleFramework.Overlay + * @since 10 + */ +declare namespace overlay { + /** + * Set enabled state of overlay module based on specified moduleName. + * + * @param { string } moduleName - Indicates the module name of the overlay module to be set. + * @param { boolean } isEnabled - The value true means to enable overlay feature, and the value false means to disable overlay feature. + * @param { AsyncCallback } callback - The callback of setting specified overlay module enabled state result. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types. + * @throws { BusinessError } 17700002 - The specified module name is not found. + * @throws { BusinessError } 17700033 - The specified module is not an overlay module. + * @syscap SystemCapability.BundleManager.BundleFramework.Overlay + * @since 10 + */ + function setOverlayEnabled(moduleName: string, isEnabled: boolean, callback: AsyncCallback): void; + /** + * Set enabled state of overlay module based on specified moduleName. + * + * @param { string } moduleName - Indicates the module name of the overlay module to be set. + * @param { boolean } isEnabled - The value true means to enable overlay feature, and the value false means to disable overlay feature. + * @returns { Promise } + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types. + * @throws { BusinessError } 17700002 - The specified module name is not found. + * @throws { BusinessError } 17700033 - The specified module is not an overlay module. + * @syscap SystemCapability.BundleManager.BundleFramework.Overlay + * @since 10 + */ + function setOverlayEnabled(moduleName: string, isEnabled: boolean): Promise; + /** + * Obtain the OverlayModuleInfo of current application based on moduleName. + * + * @param { string } moduleName - Indicates the module name of the overlay module to be queried. + * @param { AsyncCallback } callback - The callback of getting OverlayModuleInfo object. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types. + * @throws { BusinessError } 17700002 - The specified module name is not found. + * @throws { BusinessError } 17700032 - The specified bundle does not contain any overlay module. + * @throws { BusinessError } 17700033 - The specified module is not an overlay module. + * @syscap SystemCapability.BundleManager.BundleFramework.Overlay + * @since 10 + */ + function getOverlayModuleInfo(moduleName: string, callback: AsyncCallback): void; + /** + * Obtain the OverlayModuleInfo of current application based on moduleName. + * + * @param { string } moduleName - Indicates the module name of the overlay module to be queried. + * @returns { Promise } + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types. + * @throws { BusinessError } 17700002 - The specified module name is not found. + * @throws { BusinessError } 17700032 - The specified bundle does not contain any overlay module. + * @throws { BusinessError } 17700033 - The specified module is not an overlay module. + * @syscap SystemCapability.BundleManager.BundleFramework.Overlay + * @since 10 + */ + function getOverlayModuleInfo(moduleName: string): Promise; + /** + * Obtain the OverlayModuleInfo of current application based on moduleName. + * + * @param { string } targetModuleName - Indicates the target module name of the target module to be queried. + * @param { AsyncCallback> } callback - The callback of getting a list of OverlayModuleInfo object. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types. + * @throws { BusinessError } 17700002 - The specified module name is not found. + * @throws { BusinessError } 17700034 - The specified module is an overlay module. + * @syscap SystemCapability.BundleManager.BundleFramework.Overlay + * @since 10 + */ + function getTargetOverlayModuleInfos(targetModuleName: string, callback: AsyncCallback>): void; + /** + * Obtain the OverlayModuleInfo of current application based on moduleName. + * + * @param { string } targetModuleName - Indicates the target module name of the target module to be queried. + * @returns { Promise> } + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types. + * @throws { BusinessError } 17700002 - The specified module name is not found. + * @throws { BusinessError } 17700034 - The specified module is an overlay module. + * @syscap SystemCapability.BundleManager.BundleFramework.Overlay + * @since 10 + */ + function getTargetOverlayModuleInfos(targetModuleName: string): Promise>; + /** + * Obtains configuration information about a overlay hap module. + * + * @syscap SystemCapability.BundleManager.BundleFramework.Overlay + * @since 10 + */ + export type OverlayModuleInfo = _OverlayModuleInfo.OverlayModuleInfo; +} +export default overlay; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.bundleState.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.bundleState.d.ts new file mode 100755 index 00000000..c638538d --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.bundleState.d.ts @@ -0,0 +1,332 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit BackgroundTasksKit + */ +import { AsyncCallback } from './@ohos.base'; +/** + * Provides methods for managing bundle usage statistics, + * including the methods for querying bundle usage information and state data. + *

You can use the methods defined in this class to query + * the usage history and states of bundles in a specified period. + * The system stores the query result in a {@link BundleStateInfo} or {@link BundleActiveState} instance and + * then returns it to you. + * + * @namespace bundleState + * @syscap SystemCapability.ResourceSchedule.UsageStatistics.App + * @since 7 + * @deprecated since 9 + * @useinstead ohos.resourceschedule.usageStatistics + */ +declare namespace bundleState { + /** + * @interface BundleStateInfo + * @syscap SystemCapability.ResourceSchedule.UsageStatistics.App + * @since 7 + * @deprecated since 9 + * @useinstead ohos.resourceschedule.usageStatistics.BundleStatsInfo + */ + interface BundleStateInfo { + /** + * The identifier of BundleStateInfo. + * + * @syscap SystemCapability.ResourceSchedule.UsageStatistics.App + * @since 7 + * @deprecated since 9 + */ + id: number; + /** + * The total duration, in milliseconds. + * + * @syscap SystemCapability.ResourceSchedule.UsageStatistics.App + * @since 7 + * @deprecated since 9 + */ + abilityInFgTotalTime?: number; + /** + * The last time when the application was accessed, in milliseconds. + * + * @syscap SystemCapability.ResourceSchedule.UsageStatistics.App + * @since 7 + * @deprecated since 9 + */ + abilityPrevAccessTime?: number; + /** + * The last time when the application was visible in the foreground, in milliseconds. + * + * @syscap SystemCapability.ResourceSchedule.UsageStatistics.App + * @since 7 + * @deprecated since 9 + */ + abilityPrevSeenTime?: number; + /** + * The total duration, in milliseconds. + * + * @syscap SystemCapability.ResourceSchedule.UsageStatistics.App + * @since 7 + * @deprecated since 9 + */ + abilitySeenTotalTime?: number; + /** + * The bundle name of the application. + * + * @syscap SystemCapability.ResourceSchedule.UsageStatistics.App + * @since 7 + * @deprecated since 9 + */ + bundleName?: string; + /** + * The total duration, in milliseconds. + * + * @syscap SystemCapability.ResourceSchedule.UsageStatistics.App + * @since 7 + * @deprecated since 9 + */ + fgAbilityAccessTotalTime?: number; + /** + * The last time when the foreground application was accessed, in milliseconds. + * + * @syscap SystemCapability.ResourceSchedule.UsageStatistics.App + * @since 7 + * @deprecated since 9 + */ + fgAbilityPrevAccessTime?: number; + /** + * The time of the first bundle usage record in this {@code BundleActiveInfo} object, + * in milliseconds. + * + * @syscap SystemCapability.ResourceSchedule.UsageStatistics.App + * @since 7 + * @deprecated since 9 + */ + infosBeginTime?: number; + /** + * The time of the last bundle usage record in this {@code BundleActiveInfo} object, + * in milliseconds. + * + * @syscap SystemCapability.ResourceSchedule.UsageStatistics.App + * @since 7 + * @deprecated since 9 + */ + infosEndTime?: number; + /** + * Merges a specified {@link BundleActiveInfo} object with this {@link BundleActiveInfo} object. + * The bundle name of both objects must be the same. + * + * @param { BundleStateInfo } toMerge Indicates the {@link BundleActiveInfo} object to merge. + * If the bundle names of the two {@link BundleActiveInfo} objects are different. + * @syscap SystemCapability.ResourceSchedule.UsageStatistics.App + * @since 7 + * @deprecated since 9 + */ + merge(toMerge: BundleStateInfo): void; + } + /** + * @typedef BundleActiveState + * @syscap SystemCapability.ResourceSchedule.UsageStatistics.App + * @since 7 + * @deprecated since 9 + * @useinstead ohos.resourceschedule.usageStatistics.BundleEvents + */ + interface BundleActiveState { + /** + * The usage priority group of the application. + * + * @syscap SystemCapability.ResourceSchedule.UsageStatistics.App + * @since 7 + * @deprecated since 9 + */ + appUsagePriorityGroup?: number; + /** + * The bundle name. + * + * @syscap SystemCapability.ResourceSchedule.UsageStatistics.App + * @since 7 + * @deprecated since 9 + */ + bundleName?: string; + /** + * The shortcut ID. + * + * @syscap SystemCapability.ResourceSchedule.UsageStatistics.App + * @since 7 + * @deprecated since 9 + */ + indexOfLink?: string; + /** + * The class name. + * + * @syscap SystemCapability.ResourceSchedule.UsageStatistics.App + * @since 7 + * @deprecated since 9 + */ + nameOfClass?: string; + /** + * The time when this state occurred, in milliseconds. + * + * @syscap SystemCapability.ResourceSchedule.UsageStatistics.App + * @since 7 + * @deprecated since 9 + */ + stateOccurredTime?: number; + /** + * The state type. + * + * @syscap SystemCapability.ResourceSchedule.UsageStatistics.App + * @since 7 + * @deprecated since 9 + */ + stateType?: number; + } + /** + * Checks whether the application with a specified bundle name is in the idle state. + * + * @param { string } bundleName Indicates the bundle name of the application to query. + * @param { AsyncCallback } callback - the callback of isIdleState. + *

boolean value is true mean the application is idle in a particular period; false mean otherwise. + * The time range of the particular period is defined by the system, which may be hours or days.

+ * @syscap SystemCapability.ResourceSchedule.UsageStatistics.AppGroup + * @since 7 + * @deprecated since 9 + * @useinstead ohos.resourceschedule.usageStatistics.isIdleState + */ + function isIdleState(bundleName: string, callback: AsyncCallback): void; + /** + * Checks whether the application with a specified bundle name is in the idle state. + * + * @param { string } bundleName Indicates the bundle name of the application to query. + * @returns { Promise } the promise returned by isIdleState. + *

boolean value is true mean the application is idle in a particular period; false mean otherwise. + * The time range of the particular period is defined by the system, which may be hours or days.

+ * @syscap SystemCapability.ResourceSchedule.UsageStatistics.AppGroup + * @since 7 + * @deprecated since 9 + * @useinstead ohos.resourceschedule.usageStatistics.isIdleState + */ + function isIdleState(bundleName: string): Promise; + /** + * Queries the usage priority group of the calling application. + *

The priority defined in a priority group restricts the resource usage of an application, + * for example, restricting the running of background tasks.

+ * + * @param { AsyncCallback } callback - the callback of queryAppUsagePriorityGroup. + *

Returns the app group of the calling application.

+ * @syscap SystemCapability.ResourceSchedule.UsageStatistics.AppGroup + * @since 7 + * @deprecated since 9 + * @useinstead ohos.resourceschedule.usageStatistics.queryAppGroup + */ + function queryAppUsagePriorityGroup(callback: AsyncCallback): void; + /** + * Queries the usage priority group of the calling application. + *

The priority defined in a priority group restricts the resource usage of an application, + * for example, restricting the running of background tasks.

+ * + * @returns { Promise } the promise returned by queryAppUsagePriorityGroup. + *

Returns the app group of the calling application.

+ * @syscap SystemCapability.ResourceSchedule.UsageStatistics.AppGroup + * @since 7 + * @deprecated since 9 + * @useinstead ohos.resourceschedule.usageStatistics.queryAppGroup + */ + function queryAppUsagePriorityGroup(): Promise; + /** + * @typedef BundleActiveInfoResponse + * @syscap SystemCapability.ResourceSchedule.UsageStatistics.App + * @since 7 + * @deprecated since 9 + * @useinstead ohos.resourceschedule.usageStatistics.BundleStatsMap + */ + interface BundleActiveInfoResponse { + [key: string]: BundleStateInfo; + } + /** + * Declares interval type. + * + * @enum { number } + * @syscap SystemCapability.ResourceSchedule.UsageStatistics.App + * @since 7 + * @deprecated since 9 + * @useinstead ohos.resourceschedule.usageStatistics.IntervalType + */ + export enum IntervalType { + /** + * Indicates the interval type that will determine the optimal interval based on the start and end time. + * + * @syscap SystemCapability.ResourceSchedule.UsageStatistics.App + * @since 7 + * @deprecated since 9 + */ + BY_OPTIMIZED = 0, + /** + * Indicates the daily interval. + * + * @syscap SystemCapability.ResourceSchedule.UsageStatistics.App + * @since 7 + * @deprecated since 9 + */ + BY_DAILY = 1, + /** + * Indicates the weekly interval. + * + * @syscap SystemCapability.ResourceSchedule.UsageStatistics.App + * @since 7 + * @deprecated since 9 + */ + BY_WEEKLY = 2, + /** + * Indicates the monthly interval. + * + * @syscap SystemCapability.ResourceSchedule.UsageStatistics.App + * @since 7 + * @deprecated since 9 + */ + BY_MONTHLY = 3, + /** + * Indicates the annually interval. + * + * @syscap SystemCapability.ResourceSchedule.UsageStatistics.App + * @since 7 + * @deprecated since 9 + */ + BY_ANNUALLY = 4 + } + /** + * Queries state data of the current bundle within a specified period. + * + * @param { number } begin Indicates the start time of the query period, in milliseconds. + * @param { number } end Indicates the end time of the query period, in milliseconds. + * @param { AsyncCallback> } callback - the state data of the current bundle. + * @syscap SystemCapability.ResourceSchedule.UsageStatistics.App + * @since 7 + * @deprecated since 9 + * @useinstead ohos.resourceschedule.usageStatistics.queryCurrentBundleEvents + */ + function queryCurrentBundleActiveStates(begin: number, end: number, callback: AsyncCallback>): void; + /** + * Queries state data of the current bundle within a specified period. + * + * @param { number } begin Indicates the start time of the query period, in milliseconds. + * @param { number } end Indicates the end time of the query period, in milliseconds. + * @returns { Promise> } the state data of the current bundle. + * @syscap SystemCapability.ResourceSchedule.UsageStatistics.App + * @since 7 + * @deprecated since 9 + * @useinstead ohos.resourceschedule.usageStatistics.queryCurrentBundleEvents + */ + function queryCurrentBundleActiveStates(begin: number, end: number): Promise>; +} +export default bundleState; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.bytrace.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.bytrace.d.ts new file mode 100755 index 00000000..97b7517c --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.bytrace.d.ts @@ -0,0 +1,90 @@ +/* + * Copyright (C) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit PerformanceAnalysisKit + */ +/** + * Provides interfaces to trace a task for performance measure, the logs can be capture by the + * bytrace cmdline available on the device. + * + *

This interfaces trace the start, end, and value changes of key processes that last for at least 3 ms. + * + *

Example: + * To trace a name verification that is expected to complete within 5 ms: + *

{@code
+ * bytrace.startTrace("checkName", 111, 5);
+ * //your process
+ * bytrace.finishTrace("checkName", 111);
+ * }
+ * To trace the number of layers, which is 3: + *
{@code
+ * bytrace.traceByValue("curLayer", 3);
+ * }
+ * + *

Each {@code startTrace} matches one {@code finishTrace}, and they must have the same name + * and taskId. + * + * @namespace bytrace + * @syscap SystemCapability.HiviewDFX.HiTrace + * @since 7 + * @deprecated since 8 + * @useinstead ohos.hiTraceMeter + */ +declare namespace bytrace { + /** + * Records a trace marking it as the start of a task, can with the expected completion time between + * startTrace and finishTrace. + * This method is invoked at the start of a transaction to indicate that a task has started, whose name + * is specified by {@code name}, and the taskId is used to distinguish the tasks. It must be followed by + * {@link #finishTrace}, the name and taskId need to be the same. + * + * @param { string } name Indicates the task name. + * @param { number } taskId The unique id used to distinguish the tasks and match with the id in follow finishTrace. + * @param { number } expectedTime Indicates the expected time required for completing the task, in milliseconds. + * @syscap SystemCapability.HiviewDFX.HiTrace + * @since 7 + * @deprecated since 8 + * @useinstead ohos.hiTraceMeter.startTrace + */ + function startTrace(name: string, taskId: number, expectedTime?: number): void; + /** + * Records a trace and marks it as the end of a task. + * + * This method is invoked at the end of a transaction to indicate that a task has ended, whose name + * is specified by {@code name}. This method must be invoked after the the startTrace. + * + * @param { string } name Indicates the task name. It must be the same with the {@code name} of startTrace. + * @param { number } taskId The unique id used to distinguish the tasks and must be the same with the . + * {@code taskId} of startTrace. + * @syscap SystemCapability.HiviewDFX.HiTrace + * @since 7 + * @deprecated since 8 + * @useinstead ohos.hiTraceMeter.finishTrace + */ + function finishTrace(name: string, taskId: number): void; + /** + * Records a trace for generating a count, such as clock pulse and the number of layers. + * + * @param { string } name Indicates the name used to identify the count. + * @param { number } count Indicates the number of the count. + * @syscap SystemCapability.HiviewDFX.HiTrace + * @since 7 + * @deprecated since 8 + * @useinstead ohos.hiTraceMeter.traceByValue + */ + function traceByValue(name: string, count: number): void; +} +export default bytrace; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.calendarManager.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.calendarManager.d.ts new file mode 100755 index 00000000..8894dd19 --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.calendarManager.d.ts @@ -0,0 +1,1289 @@ +/* + * Copyright (c) 2022-2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit CalendarKit + */ +import { AsyncCallback } from './@ohos.base'; +import type Context from './application/Context'; +/** + * This provides calendar data access abilities. + * @namespace calendarManager + * @syscap SystemCapability.Applications.CalendarData + * @since 10 + */ +/** + * This provides calendar data access abilities. + * @namespace calendarManager + * @syscap SystemCapability.Applications.CalendarData + * @atomicservice + * @since 11 + */ +declare namespace calendarManager { + /** + * Returns an instance of CalendarManager + * + * @param { Context } context - Hap context information + * @returns { CalendarManager } Instance of CalendarManager + * @syscap SystemCapability.Applications.CalendarData + * @StageModelOnly + * @since 10 + */ + /** + * Returns an instance of CalendarManager + * + * @param { Context } context - Hap context information + * @returns { CalendarManager } Instance of CalendarManager + * @syscap SystemCapability.Applications.CalendarData + * @StageModelOnly + * @atomicservice + * @since 11 + */ + function getCalendarManager(context: Context): CalendarManager; + /** + * Defines the CalendarManager class and provides functions to access the calendar data. + * + * @interface CalendarManager + * @syscap SystemCapability.Applications.CalendarData + * @since 10 + */ + /** + * Defines the CalendarManager class and provides functions to access the calendar data. + * + * @interface CalendarManager + * @syscap SystemCapability.Applications.CalendarData + * @atomicservice + * @since 11 + */ + export interface CalendarManager { + /** + * Create calendar instance. + * @permission ohos.permission.WRITE_CALENDAR or ohos.permission.WRITE_WHOLE_CALENDAR + * @param { CalendarAccount } calendarAccount - calendar account to create calendar + * @returns { Promise } the promise with calendar corresponding to account + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - The parameter check failed. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.Applications.CalendarData + * @since 10 + */ + createCalendar(calendarAccount: CalendarAccount): Promise; + /** + * Create calendar instance. + * + * @permission ohos.permission.WRITE_CALENDAR or ohos.permission.WRITE_WHOLE_CALENDAR + * @param { CalendarAccount } calendarAccount - calendar account to create calendar + * @param { AsyncCallback } callback - the callback of createCalendar + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - The parameter check failed. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.Applications.CalendarData + * @since 10 + */ + createCalendar(calendarAccount: CalendarAccount, callback: AsyncCallback): void; + /** + * Delete calendar instance. + * + * @permission ohos.permission.WRITE_CALENDAR or ohos.permission.WRITE_WHOLE_CALENDAR + * @param { Calendar } calendar - calendar to be deleted + * @returns { Promise } the promise returned by the function. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - The parameter check failed. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.Applications.CalendarData + * @since 10 + */ + deleteCalendar(calendar: Calendar): Promise; + /** + * Delete calendar instance. + * + * @permission ohos.permission.WRITE_CALENDAR or ohos.permission.WRITE_WHOLE_CALENDAR + * @param { Calendar } calendar - calendar to be deleted + * @param { AsyncCallback } callback - the callback of deleteCalendar + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - The parameter check failed. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.Applications.CalendarData + * @since 10 + */ + deleteCalendar(calendar: Calendar, callback: AsyncCallback): void; + /** + * Get calendar instance from database. + * + * @permission ohos.permission.READ_CALENDAR or ohos.permission.READ_WHOLE_CALENDAR + * @param { CalendarAccount } calendarAccount - specify calendar account to retrieve + * @returns { Promise } the promise returned by the function. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - The parameter check failed. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.Applications.CalendarData + * @since 10 + */ + /** + * Get calendar instance from database. + * + * @permission ohos.permission.READ_CALENDAR or ohos.permission.READ_WHOLE_CALENDAR + * @param { CalendarAccount } calendarAccount - specify calendar account to retrieve + * @returns { Promise } the promise returned by the function. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - The parameter check failed. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.Applications.CalendarData + * @atomicservice + * @since 11 + */ + getCalendar(calendarAccount?: CalendarAccount): Promise; + /** + * Get calendar instance from database by specified account. + * + * @permission ohos.permission.READ_CALENDAR or ohos.permission.READ_WHOLE_CALENDAR + * @param { CalendarAccount } calendarAccount - specify calendar account to retrieve + * @param { AsyncCallback } callback - the callback of getCalendar + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - The parameter check failed. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.Applications.CalendarData + * @since 10 + */ + /** + * Get calendar instance from database by specified account. + * + * @permission ohos.permission.READ_CALENDAR or ohos.permission.READ_WHOLE_CALENDAR + * @param { CalendarAccount } calendarAccount - specify calendar account to retrieve + * @param { AsyncCallback } callback - the callback of getCalendar + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - The parameter check failed. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.Applications.CalendarData + * @atomicservice + * @since 11 + */ + getCalendar(calendarAccount: CalendarAccount, callback: AsyncCallback): void; + /** + * Get default calendar instance from database. + * + * @permission ohos.permission.READ_CALENDAR or ohos.permission.READ_WHOLE_CALENDAR + * @param { AsyncCallback } callback - the callback of getCalendar with default calendar instance + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - The parameter check failed. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.Applications.CalendarData + * @since 10 + */ + /** + * Get default calendar instance from database. + * + * @permission ohos.permission.READ_CALENDAR or ohos.permission.READ_WHOLE_CALENDAR + * @param { AsyncCallback } callback - the callback of getCalendar with default calendar instance + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - The parameter check failed. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.Applications.CalendarData + * @atomicservice + * @since 11 + */ + getCalendar(callback: AsyncCallback): void; + /** + * Get all calendar instance. + * + * @permission ohos.permission.READ_CALENDAR or ohos.permission.WRITE_WHOLE_CALENDAR + * @returns { Promise } the promise returned by the function. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - The parameter check failed. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.Applications.CalendarData + * @since 10 + */ + getAllCalendars(): Promise; + /** + * Get all calendar instance. + * + * @permission ohos.permission.READ_CALENDAR or ohos.permission.READ_WHOLE_CALENDAR + * @param {AsyncCallback} callback - the callback of getAllCalendars + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - The parameter check failed. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.Applications.CalendarData + * @since 10 + */ + getAllCalendars(callback: AsyncCallback): void; + /** + * Create a single event,invoking this interface will open the event creation page. + * + * @param { Event } event - Indicates the information about a single event. + * @returns { Promise } the promise with event id. + * @syscap SystemCapability.Applications.CalendarData + * @atomicservice + * @since 12 + */ + editEvent(event: Event): Promise; + } + /** + * Describes a calendar instance. + * @interface Calendar + * @syscap SystemCapability.Applications.CalendarData + * @since 10 + */ + /** + * Describes a calendar instance. + * @interface Calendar + * @syscap SystemCapability.Applications.CalendarData + * @atomicservice + * @since 11 + */ + export interface Calendar { + /** + * Id of the calendar + * @type { number } + * @readonly + * @syscap SystemCapability.Applications.CalendarData + * @since 10 + */ + /** + * Id of the calendar + * @type { number } + * @readonly + * @syscap SystemCapability.Applications.CalendarData + * @atomicservice + * @since 11 + */ + readonly id: number; + /** + * Add a single event. + * @param { Event } event - Indicates the information about a single event. + * @returns { Promise } The event ID. + * @syscap SystemCapability.Applications.CalendarData + * @since 10 + */ + /** + * Add a single event. + * @param { Event } event - Indicates the information about a single event. + * @returns { Promise } The event ID. + * @syscap SystemCapability.Applications.CalendarData + * @atomicservice + * @since 11 + */ + addEvent(event: Event): Promise; + /** + * Add a single event. + * @param { Event } event - a single event to add. + * @param { AsyncCallback } callback - callback of addEvent. + * @syscap SystemCapability.Applications.CalendarData + * @since 10 + */ + /** + * Add a single event. + * @param { Event } event - a single event to add. + * @param { AsyncCallback } callback - callback of addEvent. + * @syscap SystemCapability.Applications.CalendarData + * @atomicservice + * @since 11 + */ + addEvent(event: Event, callback: AsyncCallback): void; + /** + * Add multiple events. + * @param { Event[] } events - multiple events to add. + * @returns { Promise } The promise returned by function. + * @syscap SystemCapability.Applications.CalendarData + * @since 10 + */ + addEvents(events: Event[]): Promise; + /** + * Add multiple events. + * @param { Event[] } events - Indicates the information about multiple events. + * @param { AsyncCallback } callback - The callback of addEvents + * @syscap SystemCapability.Applications.CalendarData + * @since 10 + */ + addEvents(events: Event[], callback: AsyncCallback): void; + /** + * Delete a single event. + * @param { number } id - Indicates the ID of an event. + * @returns { Promise } The promise returned by function. + * @syscap SystemCapability.Applications.CalendarData + * @since 10 + */ + deleteEvent(id: number): Promise; + /** + * Delete a single event. + * @param { number } id - Indicates the ID of an event. + * @param {AsyncCallback} callback - The callback of deleteEvent. + * @syscap SystemCapability.Applications.CalendarData + * @since 10 + */ + deleteEvent(id: number, callback: AsyncCallback): void; + /** + * Delete multiple events. + * @param { number[] } ids - The id array of multiple events. + * @returns { Promise } The promise returned by function. + * @syscap SystemCapability.Applications.CalendarData + * @since 10 + */ + deleteEvents(ids: number[]): Promise; + /** + * Delete multiple events. + * @param { number[] } ids - Indicates the IDs of multiple events. + * @param {AsyncCallback} callback - The callback of deleteEvents. + * @syscap SystemCapability.Applications.CalendarData + * @since 10 + */ + deleteEvents(ids: number[], callback: AsyncCallback): void; + /** + * Update a single event. + * @param { Event } event - Indicates the information about a single event. + * @returns { Promise } The promise returned by function. + * @syscap SystemCapability.Applications.CalendarData + * @since 10 + */ + updateEvent(event: Event): Promise; + /** + * Update a single event. + * @param { Event } event - Indicates the information about a single event. + * @param { AsyncCallback } callback - The callback of updateEvent. + * @syscap SystemCapability.Applications.CalendarData + * @since 10 + */ + updateEvent(event: Event, callback: AsyncCallback): void; + /** + * Query events based on filter conditions. + * @param { EventFilter } eventFilter - Indicates the filtering conditions of events. + * @param { (keyof Event)[] } eventKey - Expected column to be returned. + * @returns { Promise } Information about events that match the filter conditions. + * @syscap SystemCapability.Applications.CalendarData + * @since 10 + */ + getEvents(eventFilter?: EventFilter, eventKey?: (keyof Event)[]): Promise; + /** + * Query events based on filter conditions. + * @param { EventFilter } eventFilter - Indicates the filtering conditions of events. + * @param { (keyof Event)[] } eventKey - Expected column to be returned. + * @param { AsyncCallback } callback - The callback of getEvents. + * @syscap SystemCapability.Applications.CalendarData + * @since 10 + */ + getEvents(eventFilter: EventFilter, eventKey: (keyof Event)[], callback: AsyncCallback): void; + /** + * Query all events with all column from current calendar instance. + * @param { AsyncCallback } callback - The callback of getEvents with all events. + * @syscap SystemCapability.Applications.CalendarData + * @since 10 + */ + getEvents(callback: AsyncCallback): void; + /** + * Get calendar configure. + * @returns { CalendarConfig } configure of current calendar. + * @syscap SystemCapability.Applications.CalendarData + * @since 10 + */ + getConfig(): CalendarConfig; + /** + * Set calendar configure. + * @param { CalendarConfig } config - calendar config to set + * @returns { Promise } The promise returned by function. + * @syscap SystemCapability.Applications.CalendarData + * @since 10 + */ + setConfig(config: CalendarConfig): Promise; + /** + * Set calendar configure. + * @param { CalendarConfig } config - calendar config to set + * @param { AsyncCallback } callback - callback of setConfig + * @syscap SystemCapability.Applications.CalendarData + * @since 10 + */ + setConfig(config: CalendarConfig, callback: AsyncCallback): void; + /** + * Get calendar account. + * @returns { CalendarAccount } calendar account of current calendar. + * @syscap SystemCapability.Applications.CalendarData + * @since 10 + */ + getAccount(): CalendarAccount; + } + /** + * Describes a calendar account. + * @interface CalendarAccount + * @syscap SystemCapability.Applications.CalendarData + * @since 10 + */ + /** + * Describes a calendar account. + * @interface CalendarAccount + * @syscap SystemCapability.Applications.CalendarData + * @atomicservice + * @since 11 + */ + interface CalendarAccount { + /** + * Name of the calendar + * @type { string } + * @readonly + * @syscap SystemCapability.Applications.CalendarData + * @since 10 + */ + /** + * Name of the calendar + * @type { string } + * @readonly + * @syscap SystemCapability.Applications.CalendarData + * @atomicservice + * @since 11 + */ + readonly name: string; + /** + * Type of the calendar + * @type { CalendarType } + * @syscap SystemCapability.Applications.CalendarData + * @since 10 + */ + /** + * Type of the calendar + * @type { CalendarType } + * @syscap SystemCapability.Applications.CalendarData + * @atomicservice + * @since 11 + */ + type: CalendarType; + /** + * DisplayName of the calendar + * @type { ?string } + * @syscap SystemCapability.Applications.CalendarData + * @since 10 + */ + /** + * DisplayName of the calendar + * @type { ?string } + * @syscap SystemCapability.Applications.CalendarData + * @atomicservice + * @since 11 + */ + displayName?: string; + } + /** + * Describes a calendar configuration. + * @interface CalendarConfig + * @syscap SystemCapability.Applications.CalendarData + * @since 10 + */ + interface CalendarConfig { + /** + * Whether the calendar provides a reminder + * @type { ?boolean } + * @syscap SystemCapability.Applications.CalendarData + * @since 10 + */ + enableReminder?: boolean; + /** + * Color of the calendar + * @type { ?(number | string) } + * @syscap SystemCapability.Applications.CalendarData + * @since 10 + */ + color?: number | string; + } + /** + * Describes an event information. + * @interface Event + * @syscap SystemCapability.Applications.CalendarData + * @since 10 + */ + /** + * Describes an event information. + * @interface Event + * @syscap SystemCapability.Applications.CalendarData + * @atomicservice + * @since 11 + */ + interface Event { + /** + * Id of the event + * @type { ?number } + * @syscap SystemCapability.Applications.CalendarData + * @since 10 + */ + /** + * Id of the event + * @type { ?number } + * @syscap SystemCapability.Applications.CalendarData + * @atomicservice + * @since 11 + */ + id?: number; + /** + * Type of the event + * @type { EventType } + * @syscap SystemCapability.Applications.CalendarData + * @since 10 + */ + /** + * Type of the event + * @type { EventType } + * @syscap SystemCapability.Applications.CalendarData + * @atomicservice + * @since 11 + */ + type: EventType; + /** + * Title of the event + * @type { ?string } + * @syscap SystemCapability.Applications.CalendarData + * @since 10 + */ + /** + * Title of the event + * @type { ?string } + * @syscap SystemCapability.Applications.CalendarData + * @atomicservice + * @since 11 + */ + title?: string; + /** + * Location of the event + * @type { ?Location } + * @syscap SystemCapability.Applications.CalendarData + * @since 10 + */ + /** + * Location of the event + * @type { ?Location } + * @syscap SystemCapability.Applications.CalendarData + * @atomicservice + * @since 11 + */ + location?: Location; + /** + * start time of the event + * @type { number } + * @syscap SystemCapability.Applications.CalendarData + * @since 10 + */ + /** + * start time of the event + * @type { number } + * @syscap SystemCapability.Applications.CalendarData + * @atomicservice + * @since 11 + */ + startTime: number; + /** + * end time of the event + * @type { number } + * @syscap SystemCapability.Applications.CalendarData + * @since 10 + */ + /** + * end time of the event + * @type { number } + * @syscap SystemCapability.Applications.CalendarData + * @atomicservice + * @since 11 + */ + endTime: number; + /** + * Whether the event is allDay + * @type { ?boolean } + * @syscap SystemCapability.Applications.CalendarData + * @since 10 + */ + /** + * Whether the event is allDay + * @type { ?boolean } + * @syscap SystemCapability.Applications.CalendarData + * @atomicservice + * @since 11 + */ + isAllDay?: boolean; + /** + * Attendees of the event + * @type { ?Attendee[] } + * @syscap SystemCapability.Applications.CalendarData + * @since 10 + */ + /** + * Attendees of the event + * @type { ?Attendee[] } + * @syscap SystemCapability.Applications.CalendarData + * @atomicservice + * @since 11 + */ + attendee?: Attendee[]; + /** + * TimeZone of the event + * @type { ?string } + * @syscap SystemCapability.Applications.CalendarData + * @since 10 + */ + /** + * TimeZone of the event + * @type { ?string } + * @syscap SystemCapability.Applications.CalendarData + * @atomicservice + * @since 11 + */ + timeZone?: string; + /** + * Reminder time of the event + * @type { ?number[] } + * @syscap SystemCapability.Applications.CalendarData + * @since 10 + */ + /** + * Reminder time of the event + * @type { ?number[] } + * @syscap SystemCapability.Applications.CalendarData + * @atomicservice + * @since 11 + */ + reminderTime?: number[]; + /** + * RecurrenceRule of the event + * @type { ?RecurrenceRule } + * @syscap SystemCapability.Applications.CalendarData + * @since 10 + */ + /** + * RecurrenceRule of the event + * @type { ?RecurrenceRule } + * @syscap SystemCapability.Applications.CalendarData + * @atomicservice + * @since 11 + */ + recurrenceRule?: RecurrenceRule; + /** + * Description of the event + * @type { ?string } + * @syscap SystemCapability.Applications.CalendarData + * @since 10 + */ + /** + * Description of the event + * @type { ?string } + * @syscap SystemCapability.Applications.CalendarData + * @atomicservice + * @since 11 + */ + description?: string; + /** + * Service of the event + * @type { ?EventService } + * @syscap SystemCapability.Applications.CalendarData + * @since 10 + */ + /** + * Service of the event + * @type { ?EventService } + * @syscap SystemCapability.Applications.CalendarData + * @atomicservice + * @since 11 + */ + service?: EventService; + /** + * Unique identifier of the event + * @type { ?string } + * @syscap SystemCapability.Applications.CalendarData + * @atomicservice + * @since 12 + */ + identifier?: string; + } + /** + * Enum for all calendar type. + * @enum { string } + * @syscap SystemCapability.Applications.CalendarData + * @since 10 + */ + /** + * Enum for all calendar type. + * @enum { string } + * @syscap SystemCapability.Applications.CalendarData + * @atomicservice + * @since 11 + */ + enum CalendarType { + /** + * Local calendar + * @syscap SystemCapability.Applications.CalendarData + * @since 10 + */ + /** + * Local calendar + * @syscap SystemCapability.Applications.CalendarData + * @atomicservice + * @since 11 + */ + LOCAL = 'local', + /** + * Email calendar + * @syscap SystemCapability.Applications.CalendarData + * @since 10 + */ + /** + * Email calendar + * @syscap SystemCapability.Applications.CalendarData + * @atomicservice + * @since 11 + */ + EMAIL = 'email', + /** + * Birthday calendar + * @syscap SystemCapability.Applications.CalendarData + * @since 10 + */ + /** + * Birthday calendar + * @syscap SystemCapability.Applications.CalendarData + * @atomicservice + * @since 11 + */ + BIRTHDAY = 'birthday', + /** + * CalDAV calendar + * @syscap SystemCapability.Applications.CalendarData + * @since 10 + */ + /** + * CalDAV calendar + * @syscap SystemCapability.Applications.CalendarData + * @atomicservice + * @since 11 + */ + CALDAV = 'caldav', + /** + * Subscribed calendar + * @syscap SystemCapability.Applications.CalendarData + * @since 10 + */ + /** + * Subscribed calendar + * @syscap SystemCapability.Applications.CalendarData + * @atomicservice + * @since 11 + */ + SUBSCRIBED = 'subscribed' + } + /** + * Location of an event. + * @interface Location + * @syscap SystemCapability.Applications.CalendarData + * @since 10 + */ + /** + * Location of an event. + * @interface Location + * @syscap SystemCapability.Applications.CalendarData + * @atomicservice + * @since 11 + */ + interface Location { + /** + * Location of the event + * @type { ?string } + * @syscap SystemCapability.Applications.CalendarData + * @since 10 + */ + /** + * Location of the event + * @type { ?string } + * @syscap SystemCapability.Applications.CalendarData + * @atomicservice + * @since 11 + */ + location?: string; + /** + * Longitude of the location + * @type { ?number } + * @syscap SystemCapability.Applications.CalendarData + * @since 10 + */ + /** + * Longitude of the location + * @type { ?number } + * @syscap SystemCapability.Applications.CalendarData + * @atomicservice + * @since 11 + */ + longitude?: number; + /** + * Latitude of the location + * @type { ?number } + * @syscap SystemCapability.Applications.CalendarData + * @since 10 + */ + /** + * Latitude of the location + * @type { ?number } + * @syscap SystemCapability.Applications.CalendarData + * @atomicservice + * @since 11 + */ + latitude?: number; + } + /** + * Provides the abilities to retrive event filter. + * @syscap SystemCapability.Applications.CalendarData + * @since 10 + */ + class EventFilter { + /** + * Filter events by event id. + * @param {number[]} ids id array to retrieve + * @returns { EventFilter } Returns the EventFilter with ids. + * @syscap SystemCapability.Applications.CalendarData + * @since 10 + */ + static filterById(ids: number[]): EventFilter; + /** + * Filter events by event start time and end time. + * @param { number } start - start time of query range + * @param { number } end - end time of query range + * @returns { EventFilter } Returns the EventFilter with time range. + * @syscap SystemCapability.Applications.CalendarData + * @since 10 + */ + static filterByTime(start: number, end: number): EventFilter; + /** + * Filter events by event title. + * @param { string } title - event title to query + * @returns {EventFilter } Returns the EventFilter with title. + * @syscap SystemCapability.Applications.CalendarData + * @since 10 + */ + static filterByTitle(title: string): EventFilter; + } + /** + * Enum for supported events type. + * @enum { number } + * @syscap SystemCapability.Applications.CalendarData + * @since 10 + */ + /** + * Enum for supported events type. + * @enum { number } + * @syscap SystemCapability.Applications.CalendarData + * @atomicservice + * @since 11 + */ + enum EventType { + /** + * normal event. + * @syscap SystemCapability.Applications.CalendarData + * @since 10 + */ + /** + * normal event. + * @syscap SystemCapability.Applications.CalendarData + * @atomicservice + * @since 11 + */ + NORMAL = 0, + /** + * important event. + * @syscap SystemCapability.Applications.CalendarData + * @since 10 + */ + /** + * important event. + * @syscap SystemCapability.Applications.CalendarData + * @atomicservice + * @since 11 + */ + IMPORTANT = 1 + } + /** + * Defines the recurrence rule of event + * @interface RecurrenceRule + * @syscap SystemCapability.Applications.CalendarData + * @since 10 + */ + /** + * Defines the recurrence rule of event + * @interface RecurrenceRule + * @syscap SystemCapability.Applications.CalendarData + * @atomicservice + * @since 11 + */ + export interface RecurrenceRule { + /** + * RecurrenceFrequency of recurrence event. + * @type { RecurrenceFrequency } + * @syscap SystemCapability.Applications.CalendarData + * @since 10 + */ + /** + * RecurrenceFrequency of recurrence event. + * @type { RecurrenceFrequency } + * @syscap SystemCapability.Applications.CalendarData + * @atomicservice + * @since 11 + */ + recurrenceFrequency: RecurrenceFrequency; + /** + * Expiration time of recurrence event. + * @type { ?number } + * @syscap SystemCapability.Applications.CalendarData + * @since 10 + */ + /** + * Expiration time of recurrence event. + * @type { ?number } + * @syscap SystemCapability.Applications.CalendarData + * @atomicservice + * @since 11 + */ + expire?: number; + /** + * Repetition count of recurrence event. + * @type { ?number } + * @syscap SystemCapability.Applications.CalendarData + * @atomicservice + * @since 12 + */ + count?: number; + /** + * Repeat interval of recurrence event. + * @type { ?number } + * @syscap SystemCapability.Applications.CalendarData + * @atomicservice + * @since 12 + */ + interval?: number; + /** + * Excluded dates of recurrence event. + * @type { ?number[] } + * @syscap SystemCapability.Applications.CalendarData + * @atomicservice + * @since 12 + */ + excludedDates?: number[]; + } + /** + * Enum for the recurrence type by different period + * @enum { number } + * @syscap SystemCapability.Applications.CalendarData + * @since 10 + */ + /** + * Enum for the recurrence type by different period + * @enum { number } + * @syscap SystemCapability.Applications.CalendarData + * @atomicservice + * @since 11 + */ + export enum RecurrenceFrequency { + /** + * The event repeats every year. + * @syscap SystemCapability.Applications.CalendarData + * @since 10 + */ + /** + * The event repeats every year. + * @syscap SystemCapability.Applications.CalendarData + * @atomicservice + * @since 11 + */ + YEARLY = 0, + /** + * The event repeats every month. + * @syscap SystemCapability.Applications.CalendarData + * @since 10 + */ + /** + * The event repeats every month. + * @syscap SystemCapability.Applications.CalendarData + * @atomicservice + * @since 11 + */ + MONTHLY = 1, + /** + * The event repeats every week. + * @syscap SystemCapability.Applications.CalendarData + * @since 10 + */ + /** + * The event repeats every week. + * @syscap SystemCapability.Applications.CalendarData + * @atomicservice + * @since 11 + */ + WEEKLY = 2, + /** + * The event repeats every day. + * @syscap SystemCapability.Applications.CalendarData + * @since 10 + */ + /** + * The event repeats every day. + * @syscap SystemCapability.Applications.CalendarData + * @atomicservice + * @since 11 + */ + DAILY = 3 + } + /** + * Defines the attendee information + * @interface Attendee + * @syscap SystemCapability.Applications.CalendarData + * @since 10 + */ + /** + * Defines the attendee information + * @interface Attendee + * @syscap SystemCapability.Applications.CalendarData + * @atomicservice + * @since 11 + */ + export interface Attendee { + /** + * Name of the Attendee. + * @type { string } + * @syscap SystemCapability.Applications.CalendarData + * @since 10 + */ + /** + * Name of the Attendee. + * @type { string } + * @syscap SystemCapability.Applications.CalendarData + * @atomicservice + * @since 11 + */ + name: string; + /** + * Email of the Attendee. + * @type { string } + * @syscap SystemCapability.Applications.CalendarData + * @since 10 + */ + /** + * Email of the Attendee. + * @type { string } + * @syscap SystemCapability.Applications.CalendarData + * @atomicservice + * @since 11 + */ + email: string; + /** + * Role of the Attendee. + * @type { ?AttendeeRole } + * @syscap SystemCapability.Applications.CalendarData + * @atomicservice + * @since 12 + */ + role?: AttendeeRole; + } + /** + * Enum for the attendee role + * @enum { string } + * @syscap SystemCapability.Applications.CalendarData + * @atomicservice + * @since 12 + */ + export enum AttendeeRole { + /** + * The organizer of a meeting. + * @syscap SystemCapability.Applications.CalendarData + * @atomicservice + * @since 12 + */ + ORGANIZER = 'organizer', + /** + * The participant of a meeting. + * @syscap SystemCapability.Applications.CalendarData + * @atomicservice + * @since 12 + */ + PARTICIPANT = 'participant' + } + /** + * Defines event service information + * @interface EventService + * @syscap SystemCapability.Applications.CalendarData + * @since 10 + */ + /** + * Defines event service information + * @interface EventService + * @syscap SystemCapability.Applications.CalendarData + * @atomicservice + * @since 11 + */ + export interface EventService { + /** + * Type of the EventService. + * @type { ServiceType } + * @syscap SystemCapability.Applications.CalendarData + * @since 10 + */ + /** + * Type of the EventService. + * @type { ServiceType } + * @syscap SystemCapability.Applications.CalendarData + * @atomicservice + * @since 11 + */ + type: ServiceType; + /** + * Uri of the EventService. + * @type { string } + * @syscap SystemCapability.Applications.CalendarData + * @since 10 + */ + /** + * Uri of the EventService. + * @type { string } + * @syscap SystemCapability.Applications.CalendarData + * @atomicservice + * @since 11 + */ + uri: string; + /** + * Description of the EventService. + * @type { ?string } + * @syscap SystemCapability.Applications.CalendarData + * @since 10 + */ + /** + * Description of the EventService. + * @type { ?string } + * @syscap SystemCapability.Applications.CalendarData + * @atomicservice + * @since 11 + */ + description?: string; + } + /** + * Defines event service type + * @enum { string } + * @syscap SystemCapability.Applications.CalendarData + * @since 10 + */ + /** + * Defines event service type + * @enum { string } + * @syscap SystemCapability.Applications.CalendarData + * @atomicservice + * @since 11 + */ + export enum ServiceType { + /** + * Meeting event. + * @syscap SystemCapability.Applications.CalendarData + * @since 10 + */ + /** + * Meeting event. + * @syscap SystemCapability.Applications.CalendarData + * @atomicservice + * @since 11 + */ + MEETING = 'Meeting', + /** + * Watch drama event. + * @syscap SystemCapability.Applications.CalendarData + * @since 10 + */ + /** + * Watch drama event. + * @syscap SystemCapability.Applications.CalendarData + * @atomicservice + * @since 11 + */ + WATCHING = 'Watching', + /** + * Repayment event. + * @syscap SystemCapability.Applications.CalendarData + * @since 10 + */ + /** + * Repayment event. + * @syscap SystemCapability.Applications.CalendarData + * @atomicservice + * @since 11 + */ + REPAYMENT = 'Repayment', + /** + * Live event. + * @syscap SystemCapability.Applications.CalendarData + * @since 10 + */ + /** + * Live event. + * @syscap SystemCapability.Applications.CalendarData + * @atomicservice + * @since 11 + */ + LIVE = 'Live', + /** + * Shopping event. + * @syscap SystemCapability.Applications.CalendarData + * @since 10 + */ + /** + * Shopping event. + * @syscap SystemCapability.Applications.CalendarData + * @atomicservice + * @since 11 + */ + SHOPPING = 'Shopping', + /** + * trip event. + * @syscap SystemCapability.Applications.CalendarData + * @since 10 + */ + /** + * trip event. + * @syscap SystemCapability.Applications.CalendarData + * @atomicservice + * @since 11 + */ + TRIP = 'Trip', + /** + * Class event. + * @syscap SystemCapability.Applications.CalendarData + * @since 10 + */ + /** + * Class event. + * @syscap SystemCapability.Applications.CalendarData + * @atomicservice + * @since 11 + */ + CLASS = 'Class', + /** + * Sports game event. + * @syscap SystemCapability.Applications.CalendarData + * @since 10 + */ + /** + * Sports game event. + * @syscap SystemCapability.Applications.CalendarData + * @atomicservice + * @since 11 + */ + SPORTS_EVENTS = 'SportsEvents', + /** + * Sports exercise event. + * @syscap SystemCapability.Applications.CalendarData + * @since 10 + */ + /** + * Sports exercise event. + * @syscap SystemCapability.Applications.CalendarData + * @atomicservice + * @since 11 + */ + SPORTS_EXERCISE = 'SportsExercise' + } +} +export default calendarManager; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.commonEvent.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.commonEvent.d.ts new file mode 100755 index 00000000..fcb90130 --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.commonEvent.d.ts @@ -0,0 +1,1436 @@ +/* + * Copyright (c) 2021-2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { AsyncCallback } from './@ohos.base'; +import { CommonEventData } from './commonEvent/commonEventData'; +import { CommonEventSubscriber } from './commonEvent/commonEventSubscriber'; +import { CommonEventSubscribeInfo } from './commonEvent/commonEventSubscribeInfo'; +import { CommonEventPublishData } from './commonEvent/commonEventPublishData'; +/** + * Common event definition + * + * @namespace commonEvent + * @syscap SystemCapability.Notification.CommonEvent + * @since 7 + * @deprecated since 9 + * @useinstead ohos.commonEventManager/commonEventManager + */ +declare namespace commonEvent { + /** + * Publishes an ordered, sticky, or standard common event. + * + * @param { string } event - name of the common event. + * @param { AsyncCallback } callback - Specified callback method. + * @syscap SystemCapability.Notification.CommonEvent + * @since 7 + * @deprecated since 9 + * @useinstead ohos.commonEventManager/commonEventManager#publish + */ + function publish(event: string, callback: AsyncCallback): void; + /** + * Publishes an ordered, sticky, or standard common event. + * + * @param { string } event - name of the common event. + * @param { CommonEventPublishData } options - Indicate the CommonEventPublishData containing the common event content + * and attributes. + * @param { AsyncCallback } callback - Specified callback method. + * @syscap SystemCapability.Notification.CommonEvent + * @since 7 + * @deprecated since 9 + * @useinstead ohos.commonEventManager/commonEventManager#publish + */ + function publish(event: string, options: CommonEventPublishData, callback: AsyncCallback): void; + /** + * creates a CommonEventSubscriber for the SubscriberInfo. + * + * @param { CommonEventSubscribeInfo } subscribeInfo - Indicates the information of the subscriber. + * @param { AsyncCallback } callback - Specified callback method. + * @syscap SystemCapability.Notification.CommonEvent + * @since 7 + * @deprecated since 9 + * @useinstead ohos.commonEventManager/commonEventManager#createSubscriber + */ + function createSubscriber(subscribeInfo: CommonEventSubscribeInfo, callback: AsyncCallback): void; + /** + * create the CommonEventSubscriber for the SubscriberInfo. + * + * @param { CommonEventSubscribeInfo } subscribeInfo - Indicates the information of the subscriber. + * @returns { Promise } Returns common event subscriber object + * @syscap SystemCapability.Notification.CommonEvent + * @since 7 + * @deprecated since 9 + * @useinstead ohos.commonEventManager/commonEventManager#createSubscriber + */ + function createSubscriber(subscribeInfo: CommonEventSubscribeInfo): Promise; + /** + * subscribe an ordered, sticky, or standard common event. + * + * @param { CommonEventSubscriber } subscriber - Indicate the subscriber of the common event. + * @param { AsyncCallback } callback - Specified callback method. + * @syscap SystemCapability.Notification.CommonEvent + * @since 7 + * @deprecated since 9 + * @useinstead ohos.commonEventManager/commonEventManager#subscribe + */ + function subscribe(subscriber: CommonEventSubscriber, callback: AsyncCallback): void; + /** + * unsubscribe from an ordered, sticky, or standard common event. + * + * @param { CommonEventSubscriber } subscriber - Indicate the subscriber of the common event. + * @param { AsyncCallback } [callback] - Specified callback method. + * @syscap SystemCapability.Notification.CommonEvent + * @since 7 + * @deprecated since 9 + * @useinstead ohos.commonEventManager/commonEventManager#unsubscribe + */ + function unsubscribe(subscriber: CommonEventSubscriber, callback?: AsyncCallback): void; + /** + * the event type that the commonEvent supported + * + * @enum { string } + * @syscap SystemCapability.Notification.CommonEvent + * @since 7 + * @deprecated since 9 + * @useinstead ohos.commonEventManager/commonEventManager#Support + */ + export enum Support { + /** + * This commonEvent means when the device is booted or system upgrade completed, and only be sent by system. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 7 + * @deprecated since 9 + * @useinstead ohos.commonEventManager/commonEventManager.Support#COMMON_EVENT_BOOT_COMPLETED + */ + COMMON_EVENT_BOOT_COMPLETED = 'usual.event.BOOT_COMPLETED', + /** + * This commonEvent means when the device finnish booting, but still in the locked state. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 7 + * @deprecated since 9 + * @useinstead ohos.commonEventManager/commonEventManager.Support#COMMON_EVENT_LOCKED_BOOT_COMPLETED + */ + COMMON_EVENT_LOCKED_BOOT_COMPLETED = 'usual.event.LOCKED_BOOT_COMPLETED', + /** + * This commonEvent means when the device is shutting down, note: turn off, not sleeping. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 7 + * @deprecated since 9 + * @useinstead ohos.commonEventManager/commonEventManager.Support#COMMON_EVENT_SHUTDOWN + */ + COMMON_EVENT_SHUTDOWN = 'usual.event.SHUTDOWN', + /** + * This commonEvent means when the charging state, level and so on about the battery. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 7 + * @deprecated since 9 + * @useinstead ohos.commonEventManager/commonEventManager.Support#COMMON_EVENT_BATTERY_CHANGED + */ + COMMON_EVENT_BATTERY_CHANGED = 'usual.event.BATTERY_CHANGED', + /** + * This commonEvent means when the device in low battery state.. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 7 + * @deprecated since 9 + * @useinstead ohos.commonEventManager/commonEventManager.Support#COMMON_EVENT_BATTERY_LOW + */ + COMMON_EVENT_BATTERY_LOW = 'usual.event.BATTERY_LOW', + /** + * This commonEvent means when the battery level is an ok state. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 7 + * @deprecated since 9 + * @useinstead ohos.commonEventManager/commonEventManager.Support#COMMON_EVENT_BATTERY_OKAY + */ + COMMON_EVENT_BATTERY_OKAY = 'usual.event.BATTERY_OKAY', + /** + * This commonEvent means when the other power is connected to the device. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 7 + * @deprecated since 9 + * @useinstead ohos.commonEventManager/commonEventManager.Support#COMMON_EVENT_POWER_CONNECTED + */ + COMMON_EVENT_POWER_CONNECTED = 'usual.event.POWER_CONNECTED', + /** + * This commonEvent means when the other power is removed from the device. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 7 + * @deprecated since 9 + * @useinstead ohos.commonEventManager/commonEventManager.Support#COMMON_EVENT_POWER_DISCONNECTED + */ + COMMON_EVENT_POWER_DISCONNECTED = 'usual.event.POWER_DISCONNECTED', + /** + * This commonEvent means when the screen is turned off. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 7 + * @deprecated since 9 + * @useinstead ohos.commonEventManager/commonEventManager.Support#COMMON_EVENT_SCREEN_OFF + */ + COMMON_EVENT_SCREEN_OFF = 'usual.event.SCREEN_OFF', + /** + * This commonEvent means when the device is awakened and interactive. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 7 + * @deprecated since 9 + * @useinstead ohos.commonEventManager/commonEventManager.Support#COMMON_EVENT_SCREEN_ON + */ + COMMON_EVENT_SCREEN_ON = 'usual.event.SCREEN_ON', + /** + * This commonEvent means when the thermal state level change + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 8 + * @deprecated since 9 + * @useinstead ohos.commonEventManager/commonEventManager.Support#COMMON_EVENT_THERMAL_LEVEL_CHANGED + */ + COMMON_EVENT_THERMAL_LEVEL_CHANGED = 'usual.event.THERMAL_LEVEL_CHANGED', + /** + * This commonEvent means when the user is present after the device is awakened. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 7 + * @deprecated since 9 + * @useinstead ohos.commonEventManager/commonEventManager.Support#COMMON_EVENT_USER_PRESENT + */ + COMMON_EVENT_USER_PRESENT = 'usual.event.USER_PRESENT', + /** + * This commonEvent means when the current time is changed. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 7 + * @deprecated since 9 + * @useinstead ohos.commonEventManager/commonEventManager.Support#COMMON_EVENT_TIME_TICK + */ + COMMON_EVENT_TIME_TICK = 'usual.event.TIME_TICK', + /** + * This commonEvent means when the time is set. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 7 + * @deprecated since 9 + * @useinstead ohos.commonEventManager/commonEventManager.Support#COMMON_EVENT_TIME_CHANGED + */ + COMMON_EVENT_TIME_CHANGED = 'usual.event.TIME_CHANGED', + /** + * This commonEvent means when the current date is changed. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 7 + * @deprecated since 9 + * @useinstead ohos.commonEventManager/commonEventManager.Support#COMMON_EVENT_DATE_CHANGED + */ + COMMON_EVENT_DATE_CHANGED = 'usual.event.DATE_CHANGED', + /** + * This commonEvent means when the time zone is changed. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 7 + * @deprecated since 9 + * @useinstead ohos.commonEventManager/commonEventManager.Support#COMMON_EVENT_TIMEZONE_CHANGED + */ + COMMON_EVENT_TIMEZONE_CHANGED = 'usual.event.TIMEZONE_CHANGED', + /** + * This commonEvent means when the dialog to dismiss. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 7 + * @deprecated since 9 + * @useinstead ohos.commonEventManager/commonEventManager.Support#COMMON_EVENT_CLOSE_SYSTEM_DIALOGS + */ + COMMON_EVENT_CLOSE_SYSTEM_DIALOGS = 'usual.event.CLOSE_SYSTEM_DIALOGS', + /** + * This commonEvent means when a new application package is installed on the device. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 7 + * @deprecated since 9 + * @useinstead ohos.commonEventManager/commonEventManager.Support#COMMON_EVENT_PACKAGE_ADDED + */ + COMMON_EVENT_PACKAGE_ADDED = 'usual.event.PACKAGE_ADDED', + /** + * This commonEvent means when a new version application package is installed on the device and + * replace the old version.the data contains the name of the package. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 7 + * @deprecated since 9 + * @useinstead ohos.commonEventManager/commonEventManager.Support#COMMON_EVENT_PACKAGE_REPLACED + */ + COMMON_EVENT_PACKAGE_REPLACED = 'usual.event.PACKAGE_REPLACED', + /** + * This commonEvent means when a new version application package is installed on the device and + * replace the old version, it does not contain additional data and only be sent to the replaced application. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 7 + * @deprecated since 9 + * @useinstead ohos.commonEventManager/commonEventManager.Support#COMMON_EVENT_MY_PACKAGE_REPLACED + */ + COMMON_EVENT_MY_PACKAGE_REPLACED = 'usual.event.MY_PACKAGE_REPLACED', + /** + * This commonEvent means when an existing application package is removed from the device. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 7 + * @deprecated since 9 + * @useinstead ohos.commonEventManager/commonEventManager.Support#COMMON_EVENT_PACKAGE_REMOVED + */ + COMMON_EVENT_PACKAGE_REMOVED = 'usual.event.PACKAGE_REMOVED', + /** + * This commonEvent means when an existing application package is removed from the device. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 7 + * @deprecated since 9 + * @useinstead ohos.commonEventManager/commonEventManager.Support#COMMON_EVENT_BUNDLE_REMOVED + */ + COMMON_EVENT_BUNDLE_REMOVED = 'usual.event.BUNDLE_REMOVED', + /** + * This commonEvent means when an existing application package is completely removed from the device. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 7 + * @deprecated since 9 + * @useinstead ohos.commonEventManager/commonEventManager.Support#COMMON_EVENT_PACKAGE_FULLY_REMOVED + */ + COMMON_EVENT_PACKAGE_FULLY_REMOVED = 'usual.event.PACKAGE_FULLY_REMOVED', + /** + * This commonEvent means when an existing application package has been changed. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 7 + * @deprecated since 9 + * @useinstead ohos.commonEventManager/commonEventManager.Support#COMMON_EVENT_PACKAGE_CHANGED + */ + COMMON_EVENT_PACKAGE_CHANGED = 'usual.event.PACKAGE_CHANGED', + /** + * This commonEvent means the user has restarted a package, and all of its processes have been killed. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 7 + * @deprecated since 9 + * @useinstead ohos.commonEventManager/commonEventManager.Support#COMMON_EVENT_PACKAGE_RESTARTED + */ + COMMON_EVENT_PACKAGE_RESTARTED = 'usual.event.PACKAGE_RESTARTED', + /** + * This commonEvent means the user has cleared the package data. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 7 + * @deprecated since 9 + * @useinstead ohos.commonEventManager/commonEventManager.Support#COMMON_EVENT_PACKAGE_DATA_CLEARED + */ + COMMON_EVENT_PACKAGE_DATA_CLEARED = 'usual.event.PACKAGE_DATA_CLEARED', + /** + * This commonEvent means the packages have been suspended. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 7 + * @deprecated since 9 + * @useinstead ohos.commonEventManager/commonEventManager.Support#COMMON_EVENT_PACKAGES_SUSPENDED + */ + COMMON_EVENT_PACKAGES_SUSPENDED = 'usual.event.PACKAGES_SUSPENDED', + /** + * This commonEvent means the packages have been un-suspended. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 7 + * @deprecated since 9 + * @useinstead ohos.commonEventManager/commonEventManager.Support#COMMON_EVENT_PACKAGES_UNSUSPENDED + */ + COMMON_EVENT_PACKAGES_UNSUSPENDED = 'usual.event.PACKAGES_UNSUSPENDED', + /** + * This commonEvent Sent to a package that has been suspended by the system. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 7 + * @deprecated since 9 + * @useinstead ohos.commonEventManager/commonEventManager.Support#COMMON_EVENT_MY_PACKAGE_SUSPENDED + */ + COMMON_EVENT_MY_PACKAGE_SUSPENDED = 'usual.event.MY_PACKAGE_SUSPENDED', + /** + * Sent to a package that has been un-suspended. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 7 + * @deprecated since 9 + * @useinstead ohos.commonEventManager/commonEventManager.Support#COMMON_EVENT_MY_PACKAGE_UNSUSPENDED + */ + COMMON_EVENT_MY_PACKAGE_UNSUSPENDED = 'usual.event.MY_PACKAGE_UNSUSPENDED', + /** + * A user id has been removed from the system. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 7 + * @deprecated since 9 + * @useinstead ohos.commonEventManager/commonEventManager.Support#COMMON_EVENT_UID_REMOVED + */ + COMMON_EVENT_UID_REMOVED = 'usual.event.UID_REMOVED', + /** + * The application is first launched after installed. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 7 + * @deprecated since 9 + * @useinstead ohos.commonEventManager/commonEventManager.Support#COMMON_EVENT_PACKAGE_FIRST_LAUNCH + */ + COMMON_EVENT_PACKAGE_FIRST_LAUNCH = 'usual.event.PACKAGE_FIRST_LAUNCH', + /** + * Sent by system package verifier when a package need to be verified. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 7 + * @deprecated since 9 + * @useinstead ohos.commonEventManager/commonEventManager.Support#COMMON_EVENT_PACKAGE_NEEDS_VERIFICATION + */ + COMMON_EVENT_PACKAGE_NEEDS_VERIFICATION = 'usual.event.PACKAGE_NEEDS_VERIFICATION', + /** + * Sent by system package verifier when a package is verified. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 7 + * @deprecated since 9 + * @useinstead ohos.commonEventManager/commonEventManager.Support#COMMON_EVENT_PACKAGE_VERIFIED + */ + COMMON_EVENT_PACKAGE_VERIFIED = 'usual.event.PACKAGE_VERIFIED', + /** + * Resources for a set of packages (which were previously unavailable) are currently + * available since the media on which they exist is available. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 7 + * @deprecated since 9 + * @useinstead ohos.commonEventManager/commonEventManager.Support#COMMON_EVENT_EXTERNAL_APPLICATIONS_AVAILABLE + */ + COMMON_EVENT_EXTERNAL_APPLICATIONS_AVAILABLE = 'usual.event.EXTERNAL_APPLICATIONS_AVAILABLE', + /** + * Resources for a set of packages are currently unavailable since the media on which they exist is unavailable. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 7 + * @deprecated since 9 + * @useinstead ohos.commonEventManage/commonEventManager.Support#COMMON_EVENT_EXTERNAL_APPLICATIONS_UNAVAILABLE + */ + COMMON_EVENT_EXTERNAL_APPLICATIONS_UNAVAILABLE = 'usual.event.EXTERNAL_APPLICATIONS_UNAVAILABLE', + /** + * The device configuration such as orientation,locale have been changed. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 7 + * @deprecated since 9 + * @useinstead ohos.commonEventManager/commonEventManager.Support#COMMON_EVENT_CONFIGURATION_CHANGED + */ + COMMON_EVENT_CONFIGURATION_CHANGED = 'usual.event.CONFIGURATION_CHANGED', + /** + * The current device's locale has changed. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 7 + * @deprecated since 9 + * @useinstead ohos.commonEventManager/commonEventManager.Support#COMMON_EVENT_LOCALE_CHANGED + */ + COMMON_EVENT_LOCALE_CHANGED = 'usual.event.LOCALE_CHANGED', + /** + * Indicates low memory condition notification acknowledged by user and package management should be started. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 7 + * @deprecated since 9 + * @useinstead ohos.commonEventManager/commonEventManager.Support#COMMON_EVENT_MANAGE_PACKAGE_STORAGE + */ + COMMON_EVENT_MANAGE_PACKAGE_STORAGE = 'usual.event.MANAGE_PACKAGE_STORAGE', + /** + * Sent by the smart function when the system in drive mode. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 7 + * @deprecated since 9 + * @useinstead ohos.commonEventManager/commonEventManager.Support#COMMON_EVENT_DRIVE_MODE + */ + COMMON_EVENT_DRIVE_MODE = 'common.event.DRIVE_MODE', + /** + * Sent by the smart function when the system in home mode. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 7 + * @deprecated since 9 + * @useinstead ohos.commonEventManager/commonEventManager.Support#COMMON_EVENT_HOME_MODE + */ + COMMON_EVENT_HOME_MODE = 'common.event.HOME_MODE', + /** + * Sent by the smart function when the system in office mode. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 7 + * @deprecated since 9 + * @useinstead ohos.commonEventManager/commonEventManager.Support#COMMON_EVENT_OFFICE_MODE + */ + COMMON_EVENT_OFFICE_MODE = 'common.event.OFFICE_MODE', + /** + * Remind new user of preparing to start. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 7 + * @deprecated since 9 + * @useinstead ohos.commonEventManager/commonEventManager.Support#COMMON_EVENT_USER_STARTED + */ + COMMON_EVENT_USER_STARTED = 'usual.event.USER_STARTED', + /** + * Remind previous user of that the service has been the background. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 7 + * @deprecated since 9 + * @useinstead ohos.commonEventManager/commonEventManager.Support#COMMON_EVENT_USER_BACKGROUND + */ + COMMON_EVENT_USER_BACKGROUND = 'usual.event.USER_BACKGROUND', + /** + * Remind new user of that the service has been the foreground. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 7 + * @deprecated since 9 + * @useinstead ohos.commonEventManager/commonEventManager.Support#COMMON_EVENT_USER_FOREGROUND + */ + COMMON_EVENT_USER_FOREGROUND = 'usual.event.USER_FOREGROUND', + /** + * Remind new user of that the service has been switched to new user. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 7 + * @deprecated since 9 + * @useinstead ohos.commonEventManager/commonEventManager.Support#COMMON_EVENT_USER_SWITCHED + */ + COMMON_EVENT_USER_SWITCHED = 'usual.event.USER_SWITCHED', + /** + * Remind new user of that the service has been starting. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 7 + * @deprecated since 9 + * @useinstead ohos.commonEventManager/commonEventManager.Support#COMMON_EVENT_USER_STARTING + */ + COMMON_EVENT_USER_STARTING = 'usual.event.USER_STARTING', + /** + * Remind new user of that the service has been unlocked. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 7 + * @deprecated since 9 + * @useinstead ohos.commonEventManager/commonEventManager.Support#COMMON_EVENT_USER_UNLOCKED + */ + COMMON_EVENT_USER_UNLOCKED = 'usual.event.USER_UNLOCKED', + /** + * Remind new user of that the service has been stopping. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 7 + * @deprecated since 9 + * @useinstead ohos.commonEventManager/commonEventManager.Support#COMMON_EVENT_USER_STOPPING + */ + COMMON_EVENT_USER_STOPPING = 'usual.event.USER_STOPPING', + /** + * Remind new user of that the service has stopped. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 7 + * @deprecated since 9 + * @useinstead ohos.commonEventManager/commonEventManager.Support#COMMON_EVENT_USER_STOPPED + */ + COMMON_EVENT_USER_STOPPED = 'usual.event.USER_STOPPED', + /** + * HW id login successfully. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 7 + * @deprecated since 9 + * @useinstead ohos.commonEventManager/commonEventManager.Support#COMMON_EVENT_HWID_LOGIN + */ + COMMON_EVENT_HWID_LOGIN = 'common.event.HWID_LOGIN', + /** + * HW id logout successfully. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 7 + * @deprecated since 9 + * @useinstead ohos.commonEventManager/commonEventManager.Support#COMMON_EVENT_HWID_LOGOUT + */ + COMMON_EVENT_HWID_LOGOUT = 'common.event.HWID_LOGOUT', + /** + * HW id is invalid. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 7 + * @deprecated since 9 + * @useinstead ohos.commonEventManager/commonEventManager.Support#COMMON_EVENT_HWID_TOKEN_INVALID + */ + COMMON_EVENT_HWID_TOKEN_INVALID = 'common.event.HWID_TOKEN_INVALID', + /** + * HW id logs off. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 7 + * @deprecated since 9 + * @useinstead ohos.commonEventManager/commonEventManager.Support#COMMON_EVENT_HWID_LOGOFF + */ + COMMON_EVENT_HWID_LOGOFF = 'common.event.HWID_LOGOFF', + /** + * WIFI state. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 7 + * @deprecated since 9 + * @useinstead ohos.commonEventManager/commonEventManager.Support#COMMON_EVENT_WIFI_POWER_STATE + */ + COMMON_EVENT_WIFI_POWER_STATE = 'usual.event.wifi.POWER_STATE', + /** + * WIFI scan results. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 7 + * @deprecated since 9 + * @useinstead ohos.commonEventManager/commonEventManager.Support#COMMON_EVENT_WIFI_SCAN_FINISHED + */ + COMMON_EVENT_WIFI_SCAN_FINISHED = 'usual.event.wifi.SCAN_FINISHED', + /** + * WIFI RSSI change. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 7 + * @deprecated since 9 + * @useinstead ohos.commonEventManager/commonEventManager.Support#COMMON_EVENT_WIFI_RSSI_VALUE + */ + COMMON_EVENT_WIFI_RSSI_VALUE = 'usual.event.wifi.RSSI_VALUE', + /** + * WIFI connect state. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 7 + * @deprecated since 9 + * @useinstead ohos.commonEventManager/commonEventManager.Support#COMMON_EVENT_WIFI_CONN_STATE + */ + COMMON_EVENT_WIFI_CONN_STATE = 'usual.event.wifi.CONN_STATE', + /** + * WIFI hotspot state. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 7 + * @deprecated since 9 + * @useinstead ohos.commonEventManager/commonEventManager.Support#COMMON_EVENT_WIFI_HOTSPOT_STATE + */ + COMMON_EVENT_WIFI_HOTSPOT_STATE = 'usual.event.wifi.HOTSPOT_STATE', + /** + * WIFI ap sta join. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 7 + * @deprecated since 9 + * @useinstead ohos.commonEventManager/commonEventManager.Support#COMMON_EVENT_WIFI_AP_STA_JOIN + */ + COMMON_EVENT_WIFI_AP_STA_JOIN = 'usual.event.wifi.WIFI_HS_STA_JOIN', + /** + * WIFI ap sta join. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 7 + * @deprecated since 9 + * @useinstead ohos.commonEventManager/commonEventManager.Support#COMMON_EVENT_WIFI_AP_STA_LEAVE + */ + COMMON_EVENT_WIFI_AP_STA_LEAVE = 'usual.event.wifi.WIFI_HS_STA_LEAVE', + /** + * Indicates Wi-Fi MpLink state notification acknowledged by binding or unbinding MpLink. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 7 + * @deprecated since 9 + * @useinstead ohos.commonEventManager/commonEventManager.Support#COMMON_EVENT_WIFI_MPLINK_STATE_CHANGE + */ + COMMON_EVENT_WIFI_MPLINK_STATE_CHANGE = 'usual.event.wifi.mplink.STATE_CHANGE', + /** + * Indicates Wi-Fi P2P connection state notification acknowledged by connecting or disconnected P2P. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 7 + * @deprecated since 9 + * @useinstead ohos.commonEventManager/commonEventManager.Support#COMMON_EVENT_WIFI_P2P_CONN_STATE + */ + COMMON_EVENT_WIFI_P2P_CONN_STATE = 'usual.event.wifi.p2p.CONN_STATE_CHANGE', + /** + * Indicates that the Wi-Fi P2P state change. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 7 + * @deprecated since 9 + * @useinstead ohos.commonEventManager/commonEventManager.Support#COMMON_EVENT_WIFI_P2P_STATE_CHANGED + */ + COMMON_EVENT_WIFI_P2P_STATE_CHANGED = 'usual.event.wifi.p2p.STATE_CHANGE', + /** + * Indicates that the Wi-Fi P2P peers state change. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 7 + * @deprecated since 9 + * @useinstead ohos.commonEventManager/commonEventManager.Support#COMMON_EVENT_WIFI_P2P_PEERS_STATE_CHANGED + */ + COMMON_EVENT_WIFI_P2P_PEERS_STATE_CHANGED = 'usual.event.wifi.p2p.DEVICES_CHANGE', + /** + * Indicates that the Wi-Fi P2P discovery state change. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 7 + * @deprecated since 9 + * @useinstead ohos.commonEventManager/commonEventManager.Support#COMMON_EVENT_WIFI_P2P_PEERS_DISCOVERY_STATE_CHANGED + */ + COMMON_EVENT_WIFI_P2P_PEERS_DISCOVERY_STATE_CHANGED = 'usual.event.wifi.p2p.PEER_DISCOVERY_STATE_CHANGE', + /** + * Indicates that the Wi-Fi P2P current device state change. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 7 + * @deprecated since 9 + * @useinstead ohos.commonEventManager/commonEventManager.Support#COMMON_EVENT_WIFI_P2P_CURRENT_DEVICE_STATE_CHANGED + */ + COMMON_EVENT_WIFI_P2P_CURRENT_DEVICE_STATE_CHANGED = 'usual.event.wifi.p2p.CURRENT_DEVICE_CHANGE', + /** + * Indicates that the Wi-Fi P2P group info is changed. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 7 + * @deprecated since 9 + * @useinstead ohos.commonEventManager/commonEventManager.Support#COMMON_EVENT_WIFI_P2P_GROUP_STATE_CHANGED + */ + COMMON_EVENT_WIFI_P2P_GROUP_STATE_CHANGED = 'usual.event.wifi.p2p.GROUP_STATE_CHANGED', + /** + * bluetooth.handsfree.ag.connect.state.update. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 7 + * @deprecated since 9 + * @useinstead ohos.commonEventManager/commonEventManager.Support#COMMON_EVENT_BLUETOOTH_HANDSFREE_AG_CONNECT_STATE_UPDATE + */ + COMMON_EVENT_BLUETOOTH_HANDSFREE_AG_CONNECT_STATE_UPDATE = 'usual.event.bluetooth.handsfree.ag.CONNECT_STATE_UPDATE', + /** + * bluetooth.handsfree.ag.current.device.update. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 7 + * @deprecated since 9 + * @useinstead ohos.commonEventManager/commonEventManager.Support#COMMON_EVENT_BLUETOOTH_HANDSFREE_AG_CURRENT_DEVICE_UPDATE + */ + COMMON_EVENT_BLUETOOTH_HANDSFREE_AG_CURRENT_DEVICE_UPDATE = 'usual.event.bluetooth.handsfree.ag.CURRENT_DEVICE_UPDATE', + /** + * bluetooth.handsfree.ag.audio.state.update. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 7 + * @deprecated since 9 + * @useinstead ohos.commonEventManager/commonEventManager.Support#COMMON_EVENT_BLUETOOTH_HANDSFREE_AG_AUDIO_STATE_UPDATE + */ + COMMON_EVENT_BLUETOOTH_HANDSFREE_AG_AUDIO_STATE_UPDATE = 'usual.event.bluetooth.handsfree.ag.AUDIO_STATE_UPDATE', + /** + * bluetooth.a2dpsource.connect.state.update. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 7 + * @deprecated since 9 + * @useinstead ohos.commonEventManager/commonEventManager.Support#COMMON_EVENT_BLUETOOTH_A2DPSOURCE_CONNECT_STATE_UPDATE + */ + COMMON_EVENT_BLUETOOTH_A2DPSOURCE_CONNECT_STATE_UPDATE = 'usual.event.bluetooth.a2dpsource.CONNECT_STATE_UPDATE', + /** + * bluetooth.a2dpsource.current.device.update. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 7 + * @deprecated since 9 + * @useinstead ohos.commonEventManager/commonEventManager.Support#COMMON_EVENT_BLUETOOTH_A2DPSOURCE_CURRENT_DEVICE_UPDATE + */ + COMMON_EVENT_BLUETOOTH_A2DPSOURCE_CURRENT_DEVICE_UPDATE = 'usual.event.bluetooth.a2dpsource.CURRENT_DEVICE_UPDATE', + /** + * bluetooth.a2dpsource.playing.state.update. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 7 + * @deprecated since 9 + * @useinstead ohos.commonEventManager/commonEventManager.Support#COMMON_EVENT_BLUETOOTH_A2DPSOURCE_PLAYING_STATE_UPDATE + */ + COMMON_EVENT_BLUETOOTH_A2DPSOURCE_PLAYING_STATE_UPDATE = 'usual.event.bluetooth.a2dpsource.PLAYING_STATE_UPDATE', + /** + * bluetooth.a2dpsource.avrcp.connect.state.update. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 7 + * @deprecated since 9 + * @useinstead ohos.commonEventManager/commonEventManager.Support#COMMON_EVENT_BLUETOOTH_A2DPSOURCE_AVRCP_CONNECT_STATE_UPDATE + */ + COMMON_EVENT_BLUETOOTH_A2DPSOURCE_AVRCP_CONNECT_STATE_UPDATE = 'usual.event.bluetooth.a2dpsource.AVRCP_CONNECT_STATE_UPDATE', + /** + * bluetooth.a2dpsource.codec.value.update. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 7 + * @deprecated since 9 + * @useinstead ohos.commonEventManager/commonEventManager.Support#COMMON_EVENT_BLUETOOTH_A2DPSOURCE_CODEC_VALUE_UPDATE + */ + COMMON_EVENT_BLUETOOTH_A2DPSOURCE_CODEC_VALUE_UPDATE = 'usual.event.bluetooth.a2dpsource.CODEC_VALUE_UPDATE', + /** + * bluetooth.remotedevice.discovered. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 7 + * @deprecated since 9 + * @useinstead ohos.commonEventManager/commonEventManager.Support#COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_DISCOVERED + */ + COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_DISCOVERED = 'usual.event.bluetooth.remotedevice.DISCOVERED', + /** + * bluetooth.remotedevice.class.value.update. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 7 + * @deprecated since 9 + * @useinstead ohos.commonEventManager/commonEventManager.Support#COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_CLASS_VALUE_UPDATE + */ + COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_CLASS_VALUE_UPDATE = 'usual.event.bluetooth.remotedevice.CLASS_VALUE_UPDATE', + /** + * bluetooth.remotedevice.acl.connected. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 7 + * @deprecated since 9 + * @useinstead ohos.commonEventManager/commonEventManager.Support#COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_ACL_CONNECTED + */ + COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_ACL_CONNECTED = 'usual.event.bluetooth.remotedevice.ACL_CONNECTED', + /** + * bluetooth.remotedevice.acl.disconnected. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 7 + * @deprecated since 9 + * @useinstead ohos.commonEventManager/commonEventManager.Support#COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_ACL_DISCONNECTED + */ + COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_ACL_DISCONNECTED = 'usual.event.bluetooth.remotedevice.ACL_DISCONNECTED', + /** + * bluetooth.remotedevice.name.update. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 7 + * @deprecated since 9 + * @useinstead ohos.commonEventManager/commonEventManager.Support#COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_NAME_UPDATE + */ + COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_NAME_UPDATE = 'usual.event.bluetooth.remotedevice.NAME_UPDATE', + /** + * bluetooth.remotedevice.pair.state. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 7 + * @deprecated since 9 + * @useinstead ohos.commonEventManager/commonEventManager.Support#COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_PAIR_STATE + */ + COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_PAIR_STATE = 'usual.event.bluetooth.remotedevice.PAIR_STATE', + /** + * bluetooth.remotedevice.battery.value.update. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 7 + * @deprecated since 9 + * @useinstead ohos.commonEventManager/commonEventManager.Support#COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_BATTERY_VALUE_UPDATE + */ + COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_BATTERY_VALUE_UPDATE = 'usual.event.bluetooth.remotedevice.BATTERY_VALUE_UPDATE', + /** + * bluetooth.remotedevice.sdp.result. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 7 + * @deprecated since 9 + * @useinstead ohos.commonEventManager/commonEventManager.Support#COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_SDP_RESULT + */ + COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_SDP_RESULT = 'usual.event.bluetooth.remotedevice.SDP_RESULT', + /** + * bluetooth.remotedevice.uuid.value. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 7 + * @deprecated since 9 + * @useinstead ohos.commonEventManager/commonEventManager.Support#COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_UUID_VALUE + */ + COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_UUID_VALUE = 'usual.event.bluetooth.remotedevice.UUID_VALUE', + /** + * bluetooth.remotedevice.pairing.req. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 7 + * @deprecated since 9 + * @useinstead ohos.commonEventManager/commonEventManager.Support#COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_PAIRING_REQ + */ + COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_PAIRING_REQ = 'usual.event.bluetooth.remotedevice.PAIRING_REQ', + /** + * bluetooth.remotedevice.pairing.cancel. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 7 + * @deprecated since 9 + * @useinstead ohos.commonEventManager/commonEventManager.Support#COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_PAIRING_CANCEL + */ + COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_PAIRING_CANCEL = 'usual.event.bluetooth.remotedevice.PAIRING_CANCEL', + /** + * bluetooth.remotedevice.connect.req. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 7 + * @deprecated since 9 + * @useinstead ohos.commonEventManager/commonEventManager.Support#COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_CONNECT_REQ + */ + COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_CONNECT_REQ = 'usual.event.bluetooth.remotedevice.CONNECT_REQ', + /** + * bluetooth.remotedevice.connect.reply. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 7 + * @deprecated since 9 + * @useinstead ohos.commonEventManager/commonEventManager.Support#COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_CONNECT_REPLY + */ + COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_CONNECT_REPLY = 'usual.event.bluetooth.remotedevice.CONNECT_REPLY', + /** + * bluetooth.remotedevice.connect.cancel. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 7 + * @deprecated since 9 + * @useinstead ohos.commonEventManager/commonEventManager.Support#COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_CONNECT_CANCEL + */ + COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_CONNECT_CANCEL = 'usual.event.bluetooth.remotedevice.CONNECT_CANCEL', + /** + * bluetooth.handsfreeunit.connect.state.update. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 7 + * @deprecated since 9 + * @useinstead ohos.commonEventManager/commonEventManager.Support#COMMON_EVENT_BLUETOOTH_HANDSFREEUNIT_CONNECT_STATE_UPDATE + */ + COMMON_EVENT_BLUETOOTH_HANDSFREEUNIT_CONNECT_STATE_UPDATE = 'usual.event.bluetooth.handsfreeunit.CONNECT_STATE_UPDATE', + /** + * bluetooth.handsfreeunit.audio.state.update. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 7 + * @deprecated since 9 + * @useinstead ohos.commonEventManager/commonEventManager.Support#COMMON_EVENT_BLUETOOTH_HANDSFREEUNIT_AUDIO_STATE_UPDATE + */ + COMMON_EVENT_BLUETOOTH_HANDSFREEUNIT_AUDIO_STATE_UPDATE = 'usual.event.bluetooth.handsfreeunit.AUDIO_STATE_UPDATE', + /** + * bluetooth.handsfreeunit.ag.common.event. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 7 + * @deprecated since 9 + * @useinstead ohos.commonEventManager/commonEventManager.Support#COMMON_EVENT_BLUETOOTH_HANDSFREEUNIT_AG_COMMON_EVENT + */ + COMMON_EVENT_BLUETOOTH_HANDSFREEUNIT_AG_COMMON_EVENT = 'usual.event.bluetooth.handsfreeunit.AG_COMMON_EVENT', + /** + * bluetooth.handsfreeunit.ag.call.state.update. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 7 + * @deprecated since 9 + * @useinstead ohos.commonEventManager/commonEventManager.Support#COMMON_EVENT_BLUETOOTH_HANDSFREEUNIT_AG_CALL_STATE_UPDATE + */ + COMMON_EVENT_BLUETOOTH_HANDSFREEUNIT_AG_CALL_STATE_UPDATE = 'usual.event.bluetooth.handsfreeunit.AG_CALL_STATE_UPDATE', + /** + * bluetooth.host.state.update. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 7 + * @deprecated since 9 + * @useinstead ohos.commonEventManager/commonEventManager.Support#COMMON_EVENT_BLUETOOTH_HOST_STATE_UPDATE + */ + COMMON_EVENT_BLUETOOTH_HOST_STATE_UPDATE = 'usual.event.bluetooth.host.STATE_UPDATE', + /** + * bluetooth.host.req.discoverable. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 7 + * @deprecated since 9 + * @useinstead ohos.commonEventManager/commonEventManager.Support#COMMON_EVENT_BLUETOOTH_HOST_REQ_DISCOVERABLE + */ + COMMON_EVENT_BLUETOOTH_HOST_REQ_DISCOVERABLE = 'usual.event.bluetooth.host.REQ_DISCOVERABLE', + /** + * bluetooth.host.req.enable. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 7 + * @deprecated since 9 + * @useinstead ohos.commonEventManager/commonEventManager.Support#COMMON_EVENT_BLUETOOTH_HOST_REQ_ENABLE + */ + COMMON_EVENT_BLUETOOTH_HOST_REQ_ENABLE = 'usual.event.bluetooth.host.REQ_ENABLE', + /** + * bluetooth.host.req.disable. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 7 + * @deprecated since 9 + * @useinstead ohos.commonEventManager/commonEventManager.Support#COMMON_EVENT_BLUETOOTH_HOST_REQ_DISABLE + */ + COMMON_EVENT_BLUETOOTH_HOST_REQ_DISABLE = 'usual.event.bluetooth.host.REQ_DISABLE', + /** + * bluetooth.host.scan.mode.update. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 7 + * @deprecated since 9 + * @useinstead ohos.commonEventManager/commonEventManager.Support#COMMON_EVENT_BLUETOOTH_HOST_SCAN_MODE_UPDATE + */ + COMMON_EVENT_BLUETOOTH_HOST_SCAN_MODE_UPDATE = 'usual.event.bluetooth.host.SCAN_MODE_UPDATE', + /** + * bluetooth.host.discovery.stated. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 7 + * @deprecated since 9 + * @useinstead ohos.commonEventManager/commonEventManager.Support#COMMON_EVENT_BLUETOOTH_HOST_DISCOVERY_STARTED + */ + COMMON_EVENT_BLUETOOTH_HOST_DISCOVERY_STARTED = 'usual.event.bluetooth.host.DISCOVERY_STARTED', + /** + * bluetooth.host.discovery.finished. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 7 + * @deprecated since 9 + * @useinstead ohos.commonEventManager/commonEventManager.Support#COMMON_EVENT_BLUETOOTH_HOST_DISCOVERY_FINISHED + */ + COMMON_EVENT_BLUETOOTH_HOST_DISCOVERY_FINISHED = 'usual.event.bluetooth.host.DISCOVERY_FINISHED', + /** + * bluetooth.host.name.update. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 7 + * @deprecated since 9 + * @useinstead ohos.commonEventManager/commonEventManager.Support#COMMON_EVENT_BLUETOOTH_HOST_NAME_UPDATE + */ + COMMON_EVENT_BLUETOOTH_HOST_NAME_UPDATE = 'usual.event.bluetooth.host.NAME_UPDATE', + /** + * bluetooth.a2dp.connect.state.update. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 7 + * @deprecated since 9 + * @useinstead ohos.commonEventManager/commonEventManager.Support#COMMON_EVENT_BLUETOOTH_A2DPSINK_CONNECT_STATE_UPDATE + */ + COMMON_EVENT_BLUETOOTH_A2DPSINK_CONNECT_STATE_UPDATE = 'usual.event.bluetooth.a2dpsink.CONNECT_STATE_UPDATE', + /** + * bluetooth.a2dp.playing.state.update. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 7 + * @deprecated since 9 + * @useinstead ohos.commonEventManager/commonEventManager.Support#COMMON_EVENT_BLUETOOTH_A2DPSINK_PLAYING_STATE_UPDATE + */ + COMMON_EVENT_BLUETOOTH_A2DPSINK_PLAYING_STATE_UPDATE = 'usual.event.bluetooth.a2dpsink.PLAYING_STATE_UPDATE', + /** + * bluetooth.a2dp.audio.state.update. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 7 + * @deprecated since 9 + * @useinstead ohos.commonEventManager/commonEventManager.Support#COMMON_EVENT_BLUETOOTH_A2DPSINK_AUDIO_STATE_UPDATE + */ + COMMON_EVENT_BLUETOOTH_A2DPSINK_AUDIO_STATE_UPDATE = 'usual.event.bluetooth.a2dpsink.AUDIO_STATE_UPDATE', + /** + * Nfc state change. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 7 + * @deprecated since 9 + * @useinstead ohos.commonEventManager/commonEventManager.Support#COMMON_EVENT_NFC_ACTION_ADAPTER_STATE_CHANGED + */ + COMMON_EVENT_NFC_ACTION_ADAPTER_STATE_CHANGED = 'usual.event.nfc.action.ADAPTER_STATE_CHANGED', + /** + * Nfc field on detected. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 7 + * @deprecated since 9 + * @useinstead ohos.commonEventManager/commonEventManager.Support#COMMON_EVENT_NFC_ACTION_RF_FIELD_ON_DETECTED + */ + COMMON_EVENT_NFC_ACTION_RF_FIELD_ON_DETECTED = 'usual.event.nfc.action.RF_FIELD_ON_DETECTED', + /** + * Nfc field off detected. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 7 + * @deprecated since 9 + * @useinstead ohos.commonEventManager/commonEventManager.Support#COMMON_EVENT_NFC_ACTION_RF_FIELD_OFF_DETECTED + */ + COMMON_EVENT_NFC_ACTION_RF_FIELD_OFF_DETECTED = 'usual.event.nfc.action.RF_FIELD_OFF_DETECTED', + /** + * Sent when stop charging battery. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 7 + * @deprecated since 9 + * @useinstead ohos.commonEventManager/commonEventManager.Support#COMMON_EVENT_DISCHARGING + */ + COMMON_EVENT_DISCHARGING = 'usual.event.DISCHARGING', + /** + * Sent when start charging battery. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 7 + * @deprecated since 9 + * @useinstead ohos.commonEventManager/commonEventManager.Support#COMMON_EVENT_CHARGING + */ + COMMON_EVENT_CHARGING = 'usual.event.CHARGING', + /** + * Sent when device's idle mode changed + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 7 + * @deprecated since 9 + * @useinstead ohos.commonEventManager/commonEventManager.Support#COMMON_EVENT_DEVICE_IDLE_MODE_CHANGED + */ + COMMON_EVENT_DEVICE_IDLE_MODE_CHANGED = 'usual.event.DEVICE_IDLE_MODE_CHANGED', + /** + * Sent when device's power save mode changed + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 7 + * @deprecated since 9 + * @useinstead ohos.commonEventManager/commonEventManager.Support#COMMON_EVENT_POWER_SAVE_MODE_CHANGED + */ + COMMON_EVENT_POWER_SAVE_MODE_CHANGED = 'usual.event.POWER_SAVE_MODE_CHANGED', + /** + * User added. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 7 + * @deprecated since 9 + * @useinstead ohos.commonEventManager/commonEventManager.Support#COMMON_EVENT_USER_ADDED + */ + COMMON_EVENT_USER_ADDED = 'usual.event.USER_ADDED', + /** + * User removed. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 7 + * @deprecated since 9 + * @useinstead ohos.commonEventManager/commonEventManager.Support#COMMON_EVENT_USER_REMOVED + */ + COMMON_EVENT_USER_REMOVED = 'usual.event.USER_REMOVED', + /** + * Sent when ability is added. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 7 + * @deprecated since 9 + * @useinstead ohos.commonEventManager/commonEventManager.Support#COMMON_EVENT_ABILITY_ADDED + */ + COMMON_EVENT_ABILITY_ADDED = 'common.event.ABILITY_ADDED', + /** + * Sent when ability is removed. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 7 + * @deprecated since 9 + * @useinstead ohos.commonEventManager/commonEventManager.Support#COMMON_EVENT_ABILITY_REMOVED + */ + COMMON_EVENT_ABILITY_REMOVED = 'common.event.ABILITY_REMOVED', + /** + * Sent when ability is updated. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 7 + * @deprecated since 9 + * @useinstead ohos.commonEventManager/commonEventManager.Support#COMMON_EVENT_ABILITY_UPDATED + */ + COMMON_EVENT_ABILITY_UPDATED = 'common.event.ABILITY_UPDATED', + /** + * Gps mode state changed. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 7 + * @deprecated since 9 + * @useinstead ohos.commonEventManager/commonEventManager.Support#COMMON_EVENT_LOCATION_MODE_STATE_CHANGED + */ + COMMON_EVENT_LOCATION_MODE_STATE_CHANGED = 'usual.event.location.MODE_STATE_CHANGED', + /** + * The ivi is about to go into sleep state when the ivi is turned off power. + * This is a protected common event that can only be sent by system. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 7 + * @deprecated since 9 + * @useinstead ohos.commonEventManager/commonEventManager.Support#COMMON_EVENT_IVI_SLEEP + */ + COMMON_EVENT_IVI_SLEEP = 'common.event.IVI_SLEEP', + /** + * The ivi is slept and notify the app stop playing. + * This is a protected common event that can only be sent by system. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 7 + * @deprecated since 9 + * @useinstead ohos.commonEventManager/commonEventManager.Support#COMMON_EVENT_IVI_PAUSE + */ + COMMON_EVENT_IVI_PAUSE = 'common.event.IVI_PAUSE', + /** + * The ivi is standby and notify the app stop playing. + * This is a protected common event that can only be sent by system. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 7 + * @deprecated since 9 + * @useinstead ohos.commonEventManager/commonEventManager.Support#COMMON_EVENT_IVI_STANDBY + */ + COMMON_EVENT_IVI_STANDBY = 'common.event.IVI_STANDBY', + /** + * The app stop playing and save state. + * This is a protected common event that can only be sent by system. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 7 + * @deprecated since 9 + * @useinstead ohos.commonEventManager/commonEventManager.Support#COMMON_EVENT_IVI_LASTMODE_SAVE + */ + COMMON_EVENT_IVI_LASTMODE_SAVE = 'common.event.IVI_LASTMODE_SAVE', + /** + * The ivi is voltage abnormal. + * This is a protected common event that can only be sent by system. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 7 + * @deprecated since 9 + * @useinstead ohos.commonEventManager/commonEventManager.Support#COMMON_EVENT_IVI_VOLTAGE_ABNORMAL + */ + COMMON_EVENT_IVI_VOLTAGE_ABNORMAL = 'common.event.IVI_VOLTAGE_ABNORMAL', + /** + * The ivi temperature is too high. + * This is a protected common event that can only be sent by system.this common event will be delete later, + * please use COMMON_EVENT_IVI_TEMPERATURE_ABNORMAL. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 7 + * @deprecated since 9 + * @useinstead ohos.commonEventManager/commonEventManager.Support#COMMON_EVENT_IVI_HIGH_TEMPERATURE + */ + COMMON_EVENT_IVI_HIGH_TEMPERATURE = 'common.event.IVI_HIGH_TEMPERATURE', + /** + * The ivi temperature is extreme high. + * This is a protected common event that can only be sent by system.this common event will be delete later, + * please use COMMON_EVENT_IVI_TEMPERATURE_ABNORMAL. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 7 + * @deprecated since 9 + * @useinstead ohos.commonEventManager/commonEventManager.Support#COMMON_EVENT_IVI_EXTREME_TEMPERATURE + */ + COMMON_EVENT_IVI_EXTREME_TEMPERATURE = 'common.event.IVI_EXTREME_TEMPERATURE', + /** + * The ivi temperature is abnormal. + * This is a protected common event that can only be sent by system. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 7 + * @deprecated since 9 + * @useinstead ohos.commonEventManager/commonEventManager.Support#COMMON_EVENT_IVI_TEMPERATURE_ABNORMAL + */ + COMMON_EVENT_IVI_TEMPERATURE_ABNORMAL = 'common.event.IVI_TEMPERATURE_ABNORMAL', + /** + * The ivi voltage is recovery. + * This is a protected common event that can only be sent by system. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 7 + * @deprecated since 9 + * @useinstead ohos.commonEventManager/commonEventManager.Support#COMMON_EVENT_IVI_VOLTAGE_RECOVERY + */ + COMMON_EVENT_IVI_VOLTAGE_RECOVERY = 'common.event.IVI_VOLTAGE_RECOVERY', + /** + * The ivi temperature is recovery. + * This is a protected common event that can only be sent by system. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 7 + * @deprecated since 9 + * @useinstead ohos.commonEventManager/commonEventManager.Support#COMMON_EVENT_IVI_TEMPERATURE_RECOVERY + */ + COMMON_EVENT_IVI_TEMPERATURE_RECOVERY = 'common.event.IVI_TEMPERATURE_RECOVERY', + /** + * The battery service is active. + * This is a protected common event that can only be sent by system. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 7 + * @deprecated since 9 + * @useinstead ohos.commonEventManager/commonEventManager.Support#COMMON_EVENT_IVI_ACTIVE + */ + COMMON_EVENT_IVI_ACTIVE = 'common.event.IVI_ACTIVE', + /** + * The usb device attached. + * This is a protected common event that can only be sent by system. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 7 + * @deprecated since 9 + * @useinstead ohos.commonEventManager/commonEventManager.Support#COMMON_EVENT_USB_DEVICE_ATTACHED + */ + COMMON_EVENT_USB_DEVICE_ATTACHED = 'usual.event.hardware.usb.action.USB_DEVICE_ATTACHED', + /** + * The usb device detached. + * This is a protected common event that can only be sent by system. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 7 + * @deprecated since 9 + * @useinstead ohos.commonEventManager/commonEventManager.Support#COMMON_EVENT_USB_DEVICE_DETACHED + */ + COMMON_EVENT_USB_DEVICE_DETACHED = 'usual.event.hardware.usb.action.USB_DEVICE_DETACHED', + /** + * The usb accessory attached. + * This is a protected common event that can only be sent by system. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 7 + * @deprecated since 9 + * @useinstead ohos.commonEventManager/commonEventManager.Support#COMMON_EVENT_USB_ACCESSORY_ATTACHED + */ + COMMON_EVENT_USB_ACCESSORY_ATTACHED = 'usual.event.hardware.usb.action.USB_ACCESSORY_ATTACHED', + /** + * The usb accessory detached. + * This is a protected common event that can only be sent by system. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 7 + * @deprecated since 9 + * @useinstead ohos.commonEventManager/commonEventManager.Support#COMMON_EVENT_USB_ACCESSORY_DETACHED + */ + COMMON_EVENT_USB_ACCESSORY_DETACHED = 'usual.event.hardware.usb.action.USB_ACCESSORY_DETACHED', + /** + * The external storage was removed. + * This is a protected common event that can only be sent by system. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 7 + * @deprecated since 9 + * @useinstead ohos.commonEventManager/commonEventManager.Support#COMMON_EVENT_DISK_REMOVED + */ + COMMON_EVENT_DISK_REMOVED = 'usual.event.data.DISK_REMOVED', + /** + * The external storage was unmounted. + * This is a protected common event that can only be sent by system. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 7 + * @deprecated since 9 + * @useinstead ohos.commonEventManager/commonEventManager.Support#COMMON_EVENT_DISK_UNMOUNTED + */ + COMMON_EVENT_DISK_UNMOUNTED = 'usual.event.data.DISK_UNMOUNTED', + /** + * The external storage was mounted. + * This is a protected common event that can only be sent by system. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 7 + * @deprecated since 9 + * @useinstead ohos.commonEventManager/commonEventManager.Support#COMMON_EVENT_DISK_MOUNTED + */ + COMMON_EVENT_DISK_MOUNTED = 'usual.event.data.DISK_MOUNTED', + /** + * The external storage was bad removal. + * This is a protected common event that can only be sent by system. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 7 + * @deprecated since 9 + * @useinstead ohos.commonEventManager/commonEventManager.Support#COMMON_EVENT_DISK_BAD_REMOVAL + */ + COMMON_EVENT_DISK_BAD_REMOVAL = 'usual.event.data.DISK_BAD_REMOVAL', + /** + * The external storage was unmountable. + * This is a protected common event that can only be sent by system. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 7 + * @deprecated since 9 + * @useinstead ohos.commonEventManager/commonEventManager.Support#COMMON_EVENT_DISK_UNMOUNTABLE + */ + COMMON_EVENT_DISK_UNMOUNTABLE = 'usual.event.data.DISK_UNMOUNTABLE', + /** + * The external storage was eject. + * This is a protected common event that can only be sent by system. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 7 + * @deprecated since 9 + * @useinstead ohos.commonEventManager/commonEventManager.Support#COMMON_EVENT_DISK_EJECT + */ + COMMON_EVENT_DISK_EJECT = 'usual.event.data.DISK_EJECT', + /** + * The visible of account was updated. + * This is a protected common event that can only be sent by system. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 7 + * @deprecated since 9 + * @useinstead ohos.commonEventManager/commonEventManager.Support#COMMON_EVENT_VISIBLE_ACCOUNTS_UPDATED + */ + COMMON_EVENT_VISIBLE_ACCOUNTS_UPDATED = 'usual.event.data.VISIBLE_ACCOUNTS_UPDATED', + /** + * Account was deleted. + * This is a protected common event that can only be sent by system. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 7 + * @deprecated since 9 + * @useinstead ohos.commonEventManager/commonEventManager.Support#COMMON_EVENT_ACCOUNT_DELETED + */ + COMMON_EVENT_ACCOUNT_DELETED = 'usual.event.data.ACCOUNT_DELETED', + /** + * Foundation was ready. + * This is a protected common event that can only be sent by system. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 7 + * @deprecated since 9 + * @useinstead ohos.commonEventManager/commonEventManager.Support#COMMON_EVENT_FOUNDATION_READY + */ + COMMON_EVENT_FOUNDATION_READY = 'common.event.FOUNDATION_READY', + /** + * Indicates the common event Action indicating that the airplane mode status of the device changes. + * Users can register this event to listen to the change of the airplane mode status of the device. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 7 + * @deprecated since 9 + * @useinstead ohos.commonEventManager/commonEventManager.Support#COMMON_EVENT_AIRPLANE_MODE_CHANGED + */ + COMMON_EVENT_AIRPLANE_MODE_CHANGED = 'usual.event.AIRPLANE_MODE', + /** + * sent by the window manager service when the window mode is split. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 8 + * @deprecated since 9 + * @useinstead ohos.commonEventManager/commonEventManager.Support#COMMON_EVENT_SPLIT_SCREEN + */ + COMMON_EVENT_SPLIT_SCREEN = 'common.event.SPLIT_SCREEN' + } +} +export default commonEvent; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.commonEventManager.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.commonEventManager.d.ts new file mode 100755 index 00000000..b06bba10 --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.commonEventManager.d.ts @@ -0,0 +1,1637 @@ +/* + * Copyright (c) 2022-2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit BasicServicesKit + */ +import { AsyncCallback } from './@ohos.base'; +import { CommonEventData as _CommonEventData } from './commonEvent/commonEventData'; +import { CommonEventSubscriber as _CommonEventSubscriber } from './commonEvent/commonEventSubscriber'; +import { CommonEventSubscribeInfo as _CommonEventSubscribeInfo } from './commonEvent/commonEventSubscribeInfo'; +import { CommonEventPublishData as _CommonEventPublishData } from './commonEvent/commonEventPublishData'; +/** + * Common event definition + * + * @namespace commonEventManager + * @syscap SystemCapability.Notification.CommonEvent + * @since 9 + */ +/** + * Common event definition + * + * @namespace commonEventManager + * @syscap SystemCapability.Notification.CommonEvent + * @crossplatform + * @atomicservice + * @since 11 + */ +declare namespace commonEventManager { + /** + * Publishes an ordered, sticky, or standard common event. + * + * @param { string } event - name of the common event. + * @param { AsyncCallback } callback - The callback of publish. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 1500004 - not System services + * @throws { BusinessError } 1500007 - error sending message to Common Event Service + * @throws { BusinessError } 1500008 - Common Event Service does not complete initialization + * @throws { BusinessError } 1500009 - error obtaining system parameters + * @syscap SystemCapability.Notification.CommonEvent + * @since 9 + */ + /** + * Publishes an ordered, sticky, or standard common event. + * + * @param { string } event - name of the common event. + * @param { AsyncCallback } callback - The callback of publish. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 1500004 - not System services + * @throws { BusinessError } 1500007 - error sending message to Common Event Service + * @throws { BusinessError } 1500008 - Common Event Service does not complete initialization + * @throws { BusinessError } 1500009 - error obtaining system parameters + * @syscap SystemCapability.Notification.CommonEvent + * @atomicservice + * @since 11 + */ + /** + * Publishes an ordered, sticky, or standard common event. + * + * @param { string } event - name of the common event. + * @param { AsyncCallback } callback - The callback of publish. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 1500004 - not System services + * @throws { BusinessError } 1500007 - error sending message to Common Event Service + * @throws { BusinessError } 1500008 - Common Event Service does not complete initialization + * @throws { BusinessError } 1500009 - error obtaining system parameters + * @syscap SystemCapability.Notification.CommonEvent + * @crossplatform + * @atomicservice + * @since 12 + */ + function publish(event: string, callback: AsyncCallback): void; + /** + * Publishes an ordered, sticky, or standard common event. + * + * @param { string } event - name of the common event. + * @param { CommonEventPublishData } options - Indicate the CommonEventPublishData containing the common event + * content and attributes. + * @param { AsyncCallback } callback - The callback of publish. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 1500004 - not System services + * @throws { BusinessError } 1500007 - error sending message to Common Event Service + * @throws { BusinessError } 1500008 - Common Event Service does not complete initialization + * @throws { BusinessError } 1500009 - error obtaining system parameters + * @syscap SystemCapability.Notification.CommonEvent + * @since 9 + */ + /** + * Publishes an ordered, sticky, or standard common event. + * + * @param { string } event - name of the common event. + * @param { CommonEventPublishData } options - Indicate the CommonEventPublishData containing the common event + * content and attributes. + * @param { AsyncCallback } callback - The callback of publish. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 1500004 - not System services + * @throws { BusinessError } 1500007 - error sending message to Common Event Service + * @throws { BusinessError } 1500008 - Common Event Service does not complete initialization + * @throws { BusinessError } 1500009 - error obtaining system parameters + * @syscap SystemCapability.Notification.CommonEvent + * @atomicservice + * @since 11 + */ + /** + * Publishes an ordered, sticky, or standard common event. + * + * @param { string } event - name of the common event. + * @param { CommonEventPublishData } options - Indicate the CommonEventPublishData containing the common event + * content and attributes. + * @param { AsyncCallback } callback - The callback of publish. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 1500004 - not System services + * @throws { BusinessError } 1500007 - error sending message to Common Event Service + * @throws { BusinessError } 1500008 - Common Event Service does not complete initialization + * @throws { BusinessError } 1500009 - error obtaining system parameters + * @syscap SystemCapability.Notification.CommonEvent + * @crossplatform + * @atomicservice + * @since 12 + */ + function publish(event: string, options: CommonEventPublishData, callback: AsyncCallback): void; + /** + * Creates a CommonEventSubscriber for the SubscriberInfo. + * + * @param { CommonEventSubscribeInfo } subscribeInfo - Indicates the information of the subscriber. + * @param { AsyncCallback } callback - The callback is used to return the + * CommonEventSubscriber object. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @syscap SystemCapability.Notification.CommonEvent + * @since 9 + */ + /** + * Creates a CommonEventSubscriber for the SubscriberInfo. + * + * @param { CommonEventSubscribeInfo } subscribeInfo - Indicates the information of the subscriber. + * @param { AsyncCallback } callback - The callback is used to return the + * CommonEventSubscriber object. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @syscap SystemCapability.Notification.CommonEvent + * @crossplatform + * @atomicservice + * @since 11 + */ + function createSubscriber(subscribeInfo: CommonEventSubscribeInfo, callback: AsyncCallback): void; + /** + * Creates a CommonEventSubscriber for the SubscriberInfo. + * + * @param { CommonEventSubscribeInfo } subscribeInfo - Indicates the information of the subscriber. + * @returns { Promise } Returns the CommonEventSubscriber object. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @syscap SystemCapability.Notification.CommonEvent + * @since 9 + */ + /** + * Creates a CommonEventSubscriber for the SubscriberInfo. + * + * @param { CommonEventSubscribeInfo } subscribeInfo - Indicates the information of the subscriber. + * @returns { Promise } Returns the CommonEventSubscriber object. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @syscap SystemCapability.Notification.CommonEvent + * @crossplatform + * @atomicservice + * @since 11 + */ + function createSubscriber(subscribeInfo: CommonEventSubscribeInfo): Promise; + /** + * Creates a CommonEventSubscriber for the SubscriberInfo. + * + * @param { CommonEventSubscribeInfo } subscribeInfo - Indicates the information of the subscriber. + * @returns { CommonEventSubscriber } Returns the CommonEventSubscriber object. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @syscap SystemCapability.Notification.CommonEvent + * @since 10 + */ + /** + * Creates a CommonEventSubscriber for the SubscriberInfo. + * + * @param { CommonEventSubscribeInfo } subscribeInfo - Indicates the information of the subscriber. + * @returns { CommonEventSubscriber } Returns the CommonEventSubscriber object. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @syscap SystemCapability.Notification.CommonEvent + * @atomicservice + * @since 11 + */ + function createSubscriberSync(subscribeInfo: CommonEventSubscribeInfo): CommonEventSubscriber; + /** + * Subscribe an ordered, sticky, or standard common event. + * + * @param { CommonEventSubscriber } subscriber - Indicate the subscriber of the common event. + * @param { AsyncCallback } callback - The callback is used to return the CommonEventData object. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - capability not supported + * @throws { BusinessError } 1500007 - error sending message to Common Event Service + * @throws { BusinessError } 1500008 - Common Event Service does not complete initialization + * @syscap SystemCapability.Notification.CommonEvent + * @since 9 + */ + /** + * Subscribe an ordered, sticky, or standard common event. + * + * @param { CommonEventSubscriber } subscriber - Indicate the subscriber of the common event. + * @param { AsyncCallback } callback - The callback is used to return the CommonEventData object. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - capability not supported + * @throws { BusinessError } 1500007 - error sending message to Common Event Service + * @throws { BusinessError } 1500008 - Common Event Service does not complete initialization + * @syscap SystemCapability.Notification.CommonEvent + * @crossplatform + * @atomicservice + * @since 11 + */ + function subscribe(subscriber: CommonEventSubscriber, callback: AsyncCallback): void; + /** + * Unsubscribe from an ordered, sticky, or standard common event. + * + * @param { CommonEventSubscriber } subscriber - Indicate the subscriber of the common event. + * @param { AsyncCallback } [callback] - The callback of unsubscribe. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - capability not supported + * @throws { BusinessError } 1500007 - error sending message to Common Event Service + * @throws { BusinessError } 1500008 - Common Event Service does not complete initialization + * @syscap SystemCapability.Notification.CommonEvent + * @since 9 + */ + /** + * Unsubscribe from an ordered, sticky, or standard common event. + * + * @param { CommonEventSubscriber } subscriber - Indicate the subscriber of the common event. + * @param { AsyncCallback } [callback] - The callback of unsubscribe. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 801 - capability not supported + * @throws { BusinessError } 1500007 - error sending message to Common Event Service + * @throws { BusinessError } 1500008 - Common Event Service does not complete initialization + * @syscap SystemCapability.Notification.CommonEvent + * @crossplatform + * @atomicservice + * @since 11 + */ + function unsubscribe(subscriber: CommonEventSubscriber, callback?: AsyncCallback): void; + /** + * The event type that the commonEvent supported. + * + * @enum { string } + * @syscap SystemCapability.Notification.CommonEvent + * @since 9 + */ + /** + * The event type that the commonEvent supported. + * + * @enum { string } + * @syscap SystemCapability.Notification.CommonEvent + * @atomicservice + * @since 11 + */ + export enum Support { + /** + * This commonEvent means when the device is booted or system upgrade completed, and only be sent by system. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 9 + */ + COMMON_EVENT_BOOT_COMPLETED = 'usual.event.BOOT_COMPLETED', + /** + * This commonEvent means when the device finnish booting, but still in the locked state. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 9 + */ + COMMON_EVENT_LOCKED_BOOT_COMPLETED = 'usual.event.LOCKED_BOOT_COMPLETED', + /** + * This commonEvent means when the device is shutting down, note: turn off, not sleeping. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 9 + */ + COMMON_EVENT_SHUTDOWN = 'usual.event.SHUTDOWN', + /** + * This commonEvent means when the charging state, level and so on about the battery. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 9 + */ + COMMON_EVENT_BATTERY_CHANGED = 'usual.event.BATTERY_CHANGED', + /** + * This commonEvent means when the device in low battery state.. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 9 + */ + COMMON_EVENT_BATTERY_LOW = 'usual.event.BATTERY_LOW', + /** + * This commonEvent means when the battery level is an ok state. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 9 + */ + COMMON_EVENT_BATTERY_OKAY = 'usual.event.BATTERY_OKAY', + /** + * This commonEvent means when the other power is connected to the device. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 9 + */ + COMMON_EVENT_POWER_CONNECTED = 'usual.event.POWER_CONNECTED', + /** + * This commonEvent means when the other power is removed from the device. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 9 + */ + COMMON_EVENT_POWER_DISCONNECTED = 'usual.event.POWER_DISCONNECTED', + /** + * This commonEvent means when the screen is turned off. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 9 + */ + COMMON_EVENT_SCREEN_OFF = 'usual.event.SCREEN_OFF', + /** + * This commonEvent means when the device is awakened and interactive. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 9 + */ + COMMON_EVENT_SCREEN_ON = 'usual.event.SCREEN_ON', + /** + * This commonEvent means when the thermal state level change + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 9 + */ + COMMON_EVENT_THERMAL_LEVEL_CHANGED = 'usual.event.THERMAL_LEVEL_CHANGED', + /** + * This commonEvent means when the user is present after the device is awakened. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 9 + * @deprecated since 10 + */ + COMMON_EVENT_USER_PRESENT = 'usual.event.USER_PRESENT', + /** + * This commonEvent means when the current time is changed. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 9 + */ + COMMON_EVENT_TIME_TICK = 'usual.event.TIME_TICK', + /** + * This commonEvent means when the time is set. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 9 + */ + COMMON_EVENT_TIME_CHANGED = 'usual.event.TIME_CHANGED', + /** + * This commonEvent means when the current date is changed. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 9 + */ + COMMON_EVENT_DATE_CHANGED = 'usual.event.DATE_CHANGED', + /** + * This commonEvent means when the time zone is changed. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 9 + */ + COMMON_EVENT_TIMEZONE_CHANGED = 'usual.event.TIMEZONE_CHANGED', + /** + * This commonEvent means when the dialog to dismiss. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 9 + */ + COMMON_EVENT_CLOSE_SYSTEM_DIALOGS = 'usual.event.CLOSE_SYSTEM_DIALOGS', + /** + * This commonEvent means when a new application package is installed on the device. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 9 + */ + COMMON_EVENT_PACKAGE_ADDED = 'usual.event.PACKAGE_ADDED', + /** + * This commonEvent means when a new version application package is installed on the device and + * replace the old version.the data contains the name of the package. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 9 + */ + COMMON_EVENT_PACKAGE_REPLACED = 'usual.event.PACKAGE_REPLACED', + /** + * This commonEvent means when a new version application package is installed on the device and + * replace the old version, it does not contain additional data and only be sent to the replaced application. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 9 + */ + COMMON_EVENT_MY_PACKAGE_REPLACED = 'usual.event.MY_PACKAGE_REPLACED', + /** + * This commonEvent means when an existing application package is removed from the device. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 9 + */ + COMMON_EVENT_PACKAGE_REMOVED = 'usual.event.PACKAGE_REMOVED', + /** + * This commonEvent means when an existing application package is removed from the device. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 9 + */ + COMMON_EVENT_BUNDLE_REMOVED = 'usual.event.BUNDLE_REMOVED', + /** + * This commonEvent means when an existing application package is completely removed from the device. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 9 + */ + COMMON_EVENT_PACKAGE_FULLY_REMOVED = 'usual.event.PACKAGE_FULLY_REMOVED', + /** + * This commonEvent means when an existing application package has been changed. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 9 + */ + COMMON_EVENT_PACKAGE_CHANGED = 'usual.event.PACKAGE_CHANGED', + /** + * This commonEvent means the user has restarted a package, and all of its processes have been killed. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 9 + */ + COMMON_EVENT_PACKAGE_RESTARTED = 'usual.event.PACKAGE_RESTARTED', + /** + * This commonEvent means the user has cleared the package data. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 9 + */ + COMMON_EVENT_PACKAGE_DATA_CLEARED = 'usual.event.PACKAGE_DATA_CLEARED', + /** + * This commonEvent means the user has cleared the package cache. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 9 + */ + COMMON_EVENT_PACKAGE_CACHE_CLEARED = 'usual.event.PACKAGE_CACHE_CLEARED', + /** + * This commonEvent means the packages have been suspended. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 9 + */ + COMMON_EVENT_PACKAGES_SUSPENDED = 'usual.event.PACKAGES_SUSPENDED', + /** + * This commonEvent means the packages have been un-suspended. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 9 + */ + COMMON_EVENT_PACKAGES_UNSUSPENDED = 'usual.event.PACKAGES_UNSUSPENDED', + /** + * This commonEvent Sent to a package that has been suspended by the system. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 9 + */ + COMMON_EVENT_MY_PACKAGE_SUSPENDED = 'usual.event.MY_PACKAGE_SUSPENDED', + /** + * Sent to a package that has been un-suspended. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 9 + */ + COMMON_EVENT_MY_PACKAGE_UNSUSPENDED = 'usual.event.MY_PACKAGE_UNSUSPENDED', + /** + * A user id has been removed from the system. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 9 + */ + COMMON_EVENT_UID_REMOVED = 'usual.event.UID_REMOVED', + /** + * The application is first launched after installed. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 9 + */ + COMMON_EVENT_PACKAGE_FIRST_LAUNCH = 'usual.event.PACKAGE_FIRST_LAUNCH', + /** + * Sent by system package verifier when a package need to be verified. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 9 + */ + COMMON_EVENT_PACKAGE_NEEDS_VERIFICATION = 'usual.event.PACKAGE_NEEDS_VERIFICATION', + /** + * Sent by system package verifier when a package is verified. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 9 + */ + COMMON_EVENT_PACKAGE_VERIFIED = 'usual.event.PACKAGE_VERIFIED', + /** + * Resources for a set of packages (which were previously unavailable) are currently + * available since the media on which they exist is available. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 9 + */ + COMMON_EVENT_EXTERNAL_APPLICATIONS_AVAILABLE = 'usual.event.EXTERNAL_APPLICATIONS_AVAILABLE', + /** + * Resources for a set of packages are currently unavailable since the media on which they exist is unavailable. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 9 + */ + COMMON_EVENT_EXTERNAL_APPLICATIONS_UNAVAILABLE = 'usual.event.EXTERNAL_APPLICATIONS_UNAVAILABLE', + /** + * The device configuration such as orientation,locale have been changed. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 9 + */ + COMMON_EVENT_CONFIGURATION_CHANGED = 'usual.event.CONFIGURATION_CHANGED', + /** + * The current device's locale has changed. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 9 + */ + COMMON_EVENT_LOCALE_CHANGED = 'usual.event.LOCALE_CHANGED', + /** + * Indicates low memory condition notification acknowledged by user and package management should be started. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 9 + */ + COMMON_EVENT_MANAGE_PACKAGE_STORAGE = 'usual.event.MANAGE_PACKAGE_STORAGE', + /** + * Send by the smart function when the system in drive mode. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 9 + */ + COMMON_EVENT_DRIVE_MODE = 'common.event.DRIVE_MODE', + /** + * Send by the smart function when the system in home mode. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 9 + */ + COMMON_EVENT_HOME_MODE = 'common.event.HOME_MODE', + /** + * Send by the smart function when the system in office mode. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 9 + */ + COMMON_EVENT_OFFICE_MODE = 'common.event.OFFICE_MODE', + /** + * Remind new user of preparing to start. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 9 + */ + COMMON_EVENT_USER_STARTED = 'usual.event.USER_STARTED', + /** + * Remind previous user of that the service has been the background. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 9 + */ + COMMON_EVENT_USER_BACKGROUND = 'usual.event.USER_BACKGROUND', + /** + * Remind new user of that the service has been the foreground. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 9 + */ + COMMON_EVENT_USER_FOREGROUND = 'usual.event.USER_FOREGROUND', + /** + * Remind new user of that the service has been switched to new user. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 9 + */ + COMMON_EVENT_USER_SWITCHED = 'usual.event.USER_SWITCHED', + /** + * Remind new user of that the service has been starting. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 9 + */ + COMMON_EVENT_USER_STARTING = 'usual.event.USER_STARTING', + /** + * Remind new user of that the service has been unlocked. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 9 + */ + COMMON_EVENT_USER_UNLOCKED = 'usual.event.USER_UNLOCKED', + /** + * Remind new user of that the service has been stopping. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 9 + */ + COMMON_EVENT_USER_STOPPING = 'usual.event.USER_STOPPING', + /** + * Remind new user of that the service has stopped. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 9 + */ + COMMON_EVENT_USER_STOPPED = 'usual.event.USER_STOPPED', + /** + * Distributed account login successfully. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 9 + */ + /** + * Distributed account login successfully. + * + * @syscap SystemCapability.Notification.CommonEvent + * @atomicservice + * @since 12 + */ + COMMON_EVENT_DISTRIBUTED_ACCOUNT_LOGIN = 'common.event.DISTRIBUTED_ACCOUNT_LOGIN', + /** + * Distributed account logout successfully. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 9 + */ + /** + * Distributed account logout successfully. + * + * @syscap SystemCapability.Notification.CommonEvent + * @atomicservice + * @since 12 + */ + COMMON_EVENT_DISTRIBUTED_ACCOUNT_LOGOUT = 'common.event.DISTRIBUTED_ACCOUNT_LOGOUT', + /** + * Distributed account is invalid. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 9 + */ + /** + * Distributed account is invalid. + * + * @syscap SystemCapability.Notification.CommonEvent + * @atomicservice + * @since 12 + */ + COMMON_EVENT_DISTRIBUTED_ACCOUNT_TOKEN_INVALID = 'common.event.DISTRIBUTED_ACCOUNT_TOKEN_INVALID', + /** + * Distributed account logs off. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 9 + */ + /** + * Distributed account logs off. + * + * @syscap SystemCapability.Notification.CommonEvent + * @atomicservice + * @since 12 + */ + COMMON_EVENT_DISTRIBUTED_ACCOUNT_LOGOFF = 'common.event.DISTRIBUTED_ACCOUNT_LOGOFF', + /** + * WIFI state. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 9 + */ + COMMON_EVENT_WIFI_POWER_STATE = 'usual.event.wifi.POWER_STATE', + /** + * WIFI scan results. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 9 + */ + COMMON_EVENT_WIFI_SCAN_FINISHED = 'usual.event.wifi.SCAN_FINISHED', + /** + * WIFI RSSI change. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 9 + */ + COMMON_EVENT_WIFI_RSSI_VALUE = 'usual.event.wifi.RSSI_VALUE', + /** + * WIFI connect state. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 9 + */ + COMMON_EVENT_WIFI_CONN_STATE = 'usual.event.wifi.CONN_STATE', + /** + * WIFI hotspot state. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 9 + */ + COMMON_EVENT_WIFI_HOTSPOT_STATE = 'usual.event.wifi.HOTSPOT_STATE', + /** + * WIFI ap sta join. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 9 + */ + COMMON_EVENT_WIFI_AP_STA_JOIN = 'usual.event.wifi.WIFI_HS_STA_JOIN', + /** + * WIFI ap sta join. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 9 + */ + COMMON_EVENT_WIFI_AP_STA_LEAVE = 'usual.event.wifi.WIFI_HS_STA_LEAVE', + /** + * Indicates Wi-Fi MpLink state notification acknowledged by binding or unbinding MpLink. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 9 + */ + COMMON_EVENT_WIFI_MPLINK_STATE_CHANGE = 'usual.event.wifi.mplink.STATE_CHANGE', + /** + * Indicates Wi-Fi P2P connection state notification acknowledged by connecting or disconnected P2P. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 9 + */ + COMMON_EVENT_WIFI_P2P_CONN_STATE = 'usual.event.wifi.p2p.CONN_STATE_CHANGE', + /** + * Indicates that the Wi-Fi P2P state change. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 9 + */ + COMMON_EVENT_WIFI_P2P_STATE_CHANGED = 'usual.event.wifi.p2p.STATE_CHANGE', + /** + * Indicates that the Wi-Fi P2P peers state change. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 9 + */ + COMMON_EVENT_WIFI_P2P_PEERS_STATE_CHANGED = 'usual.event.wifi.p2p.DEVICES_CHANGE', + /** + * Indicates that the Wi-Fi P2P discovery state change. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 9 + */ + COMMON_EVENT_WIFI_P2P_PEERS_DISCOVERY_STATE_CHANGED = 'usual.event.wifi.p2p.PEER_DISCOVERY_STATE_CHANGE', + /** + * Indicates that the Wi-Fi P2P current device state change. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 9 + */ + COMMON_EVENT_WIFI_P2P_CURRENT_DEVICE_STATE_CHANGED = 'usual.event.wifi.p2p.CURRENT_DEVICE_CHANGE', + /** + * Indicates that the Wi-Fi P2P group info is changed. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 9 + */ + COMMON_EVENT_WIFI_P2P_GROUP_STATE_CHANGED = 'usual.event.wifi.p2p.GROUP_STATE_CHANGED', + /** + * Bluetooth.handsfree.ag.connect.state.update. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 9 + */ + COMMON_EVENT_BLUETOOTH_HANDSFREE_AG_CONNECT_STATE_UPDATE = 'usual.event.bluetooth.handsfree.ag.CONNECT_STATE_UPDATE', + /** + * Bluetooth.handsfree.ag.current.device.update. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 9 + */ + COMMON_EVENT_BLUETOOTH_HANDSFREE_AG_CURRENT_DEVICE_UPDATE = 'usual.event.bluetooth.handsfree.ag.CURRENT_DEVICE_UPDATE', + /** + * Bluetooth.handsfree.ag.audio.state.update. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 9 + */ + COMMON_EVENT_BLUETOOTH_HANDSFREE_AG_AUDIO_STATE_UPDATE = 'usual.event.bluetooth.handsfree.ag.AUDIO_STATE_UPDATE', + /** + * Bluetooth.a2dpsource.connect.state.update. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 9 + */ + COMMON_EVENT_BLUETOOTH_A2DPSOURCE_CONNECT_STATE_UPDATE = 'usual.event.bluetooth.a2dpsource.CONNECT_STATE_UPDATE', + /** + * Bluetooth.a2dpsource.current.device.update. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 9 + */ + COMMON_EVENT_BLUETOOTH_A2DPSOURCE_CURRENT_DEVICE_UPDATE = 'usual.event.bluetooth.a2dpsource.CURRENT_DEVICE_UPDATE', + /** + * Bluetooth.a2dpsource.playing.state.update. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 9 + */ + COMMON_EVENT_BLUETOOTH_A2DPSOURCE_PLAYING_STATE_UPDATE = 'usual.event.bluetooth.a2dpsource.PLAYING_STATE_UPDATE', + /** + * Bluetooth.a2dpsource.avrcp.connect.state.update. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 9 + */ + COMMON_EVENT_BLUETOOTH_A2DPSOURCE_AVRCP_CONNECT_STATE_UPDATE = 'usual.event.bluetooth.a2dpsource.AVRCP_CONNECT_STATE_UPDATE', + /** + * Bluetooth.a2dpsource.codec.value.update. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 9 + */ + COMMON_EVENT_BLUETOOTH_A2DPSOURCE_CODEC_VALUE_UPDATE = 'usual.event.bluetooth.a2dpsource.CODEC_VALUE_UPDATE', + /** + * Bluetooth.remotedevice.discovered. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 9 + */ + COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_DISCOVERED = 'usual.event.bluetooth.remotedevice.DISCOVERED', + /** + * Bluetooth.remotedevice.class.value.update. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 9 + */ + COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_CLASS_VALUE_UPDATE = 'usual.event.bluetooth.remotedevice.CLASS_VALUE_UPDATE', + /** + * Bluetooth.remotedevice.acl.connected. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 9 + */ + COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_ACL_CONNECTED = 'usual.event.bluetooth.remotedevice.ACL_CONNECTED', + /** + * Bluetooth.remotedevice.acl.disconnected. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 9 + */ + COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_ACL_DISCONNECTED = 'usual.event.bluetooth.remotedevice.ACL_DISCONNECTED', + /** + * Bluetooth.remotedevice.name.update. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 9 + */ + COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_NAME_UPDATE = 'usual.event.bluetooth.remotedevice.NAME_UPDATE', + /** + * Bluetooth.remotedevice.pair.state. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 9 + */ + COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_PAIR_STATE = 'usual.event.bluetooth.remotedevice.PAIR_STATE', + /** + * Bluetooth.remotedevice.battery.value.update. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 9 + */ + COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_BATTERY_VALUE_UPDATE = 'usual.event.bluetooth.remotedevice.BATTERY_VALUE_UPDATE', + /** + * Bluetooth.remotedevice.sdp.result. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 9 + */ + COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_SDP_RESULT = 'usual.event.bluetooth.remotedevice.SDP_RESULT', + /** + * Bluetooth.remotedevice.uuid.value. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 9 + */ + COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_UUID_VALUE = 'usual.event.bluetooth.remotedevice.UUID_VALUE', + /** + * Bluetooth.remotedevice.pairing.req. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 9 + */ + COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_PAIRING_REQ = 'usual.event.bluetooth.remotedevice.PAIRING_REQ', + /** + * Bluetooth.remotedevice.pairing.cancel. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 9 + */ + COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_PAIRING_CANCEL = 'usual.event.bluetooth.remotedevice.PAIRING_CANCEL', + /** + * Bluetooth.remotedevice.connect.req. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 9 + */ + COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_CONNECT_REQ = 'usual.event.bluetooth.remotedevice.CONNECT_REQ', + /** + * Bluetooth.remotedevice.connect.reply. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 9 + */ + COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_CONNECT_REPLY = 'usual.event.bluetooth.remotedevice.CONNECT_REPLY', + /** + * Bluetooth.remotedevice.connect.cancel. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 9 + */ + COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_CONNECT_CANCEL = 'usual.event.bluetooth.remotedevice.CONNECT_CANCEL', + /** + * Bluetooth.handsfreeunit.connect.state.update. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 9 + */ + COMMON_EVENT_BLUETOOTH_HANDSFREEUNIT_CONNECT_STATE_UPDATE = 'usual.event.bluetooth.handsfreeunit.CONNECT_STATE_UPDATE', + /** + * Bluetooth.handsfreeunit.audio.state.update. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 9 + */ + COMMON_EVENT_BLUETOOTH_HANDSFREEUNIT_AUDIO_STATE_UPDATE = 'usual.event.bluetooth.handsfreeunit.AUDIO_STATE_UPDATE', + /** + * Bluetooth.handsfreeunit.ag.common.event. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 9 + */ + COMMON_EVENT_BLUETOOTH_HANDSFREEUNIT_AG_COMMON_EVENT = 'usual.event.bluetooth.handsfreeunit.AG_COMMON_EVENT', + /** + * Bluetooth.handsfreeunit.ag.call.state.update. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 9 + */ + COMMON_EVENT_BLUETOOTH_HANDSFREEUNIT_AG_CALL_STATE_UPDATE = 'usual.event.bluetooth.handsfreeunit.AG_CALL_STATE_UPDATE', + /** + * Bluetooth.host.state.update. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 9 + */ + COMMON_EVENT_BLUETOOTH_HOST_STATE_UPDATE = 'usual.event.bluetooth.host.STATE_UPDATE', + /** + * Bluetooth.host.req.discoverable. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 9 + */ + COMMON_EVENT_BLUETOOTH_HOST_REQ_DISCOVERABLE = 'usual.event.bluetooth.host.REQ_DISCOVERABLE', + /** + * Bluetooth.host.req.enable. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 9 + */ + COMMON_EVENT_BLUETOOTH_HOST_REQ_ENABLE = 'usual.event.bluetooth.host.REQ_ENABLE', + /** + * Bluetooth.host.req.disable. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 9 + */ + COMMON_EVENT_BLUETOOTH_HOST_REQ_DISABLE = 'usual.event.bluetooth.host.REQ_DISABLE', + /** + * Bluetooth.host.scan.mode.update. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 9 + */ + COMMON_EVENT_BLUETOOTH_HOST_SCAN_MODE_UPDATE = 'usual.event.bluetooth.host.SCAN_MODE_UPDATE', + /** + * Bluetooth.host.discovery.stated. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 9 + */ + COMMON_EVENT_BLUETOOTH_HOST_DISCOVERY_STARTED = 'usual.event.bluetooth.host.DISCOVERY_STARTED', + /** + * Bluetooth.host.discovery.finished. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 9 + */ + COMMON_EVENT_BLUETOOTH_HOST_DISCOVERY_FINISHED = 'usual.event.bluetooth.host.DISCOVERY_FINISHED', + /** + * Bluetooth.host.name.update. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 9 + */ + COMMON_EVENT_BLUETOOTH_HOST_NAME_UPDATE = 'usual.event.bluetooth.host.NAME_UPDATE', + /** + * Bluetooth.a2dp.connect.state.update. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 9 + */ + COMMON_EVENT_BLUETOOTH_A2DPSINK_CONNECT_STATE_UPDATE = 'usual.event.bluetooth.a2dpsink.CONNECT_STATE_UPDATE', + /** + * Bluetooth.a2dp.playing.state.update. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 9 + */ + COMMON_EVENT_BLUETOOTH_A2DPSINK_PLAYING_STATE_UPDATE = 'usual.event.bluetooth.a2dpsink.PLAYING_STATE_UPDATE', + /** + * Bluetooth.a2dp.audio.state.update. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 9 + */ + COMMON_EVENT_BLUETOOTH_A2DPSINK_AUDIO_STATE_UPDATE = 'usual.event.bluetooth.a2dpsink.AUDIO_STATE_UPDATE', + /** + * Nfc state change. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 9 + */ + COMMON_EVENT_NFC_ACTION_ADAPTER_STATE_CHANGED = 'usual.event.nfc.action.ADAPTER_STATE_CHANGED', + /** + * Nfc field on detected. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 9 + */ + COMMON_EVENT_NFC_ACTION_RF_FIELD_ON_DETECTED = 'usual.event.nfc.action.RF_FIELD_ON_DETECTED', + /** + * Nfc field off detected. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 9 + */ + COMMON_EVENT_NFC_ACTION_RF_FIELD_OFF_DETECTED = 'usual.event.nfc.action.RF_FIELD_OFF_DETECTED', + /** + * Sent when stop charging battery. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 9 + */ + COMMON_EVENT_DISCHARGING = 'usual.event.DISCHARGING', + /** + * Sent when start charging battery. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 9 + */ + COMMON_EVENT_CHARGING = 'usual.event.CHARGING', + /** + * Sent when device's idle mode changed + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 9 + */ + COMMON_EVENT_DEVICE_IDLE_MODE_CHANGED = 'usual.event.DEVICE_IDLE_MODE_CHANGED', + /** + * Sent when device's charge idle mode changed. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 10 + */ + COMMON_EVENT_CHARGE_IDLE_MODE_CHANGED = 'usual.event.CHARGE_IDLE_MODE_CHANGED', + /** + * Sent when device's power save mode changed + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 9 + */ + COMMON_EVENT_POWER_SAVE_MODE_CHANGED = 'usual.event.POWER_SAVE_MODE_CHANGED', + /** + * User added. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 9 + */ + COMMON_EVENT_USER_ADDED = 'usual.event.USER_ADDED', + /** + * User removed. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 9 + */ + COMMON_EVENT_USER_REMOVED = 'usual.event.USER_REMOVED', + /** + * Sent when ability is added. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 9 + */ + COMMON_EVENT_ABILITY_ADDED = 'common.event.ABILITY_ADDED', + /** + * Sent when ability is removed. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 9 + */ + COMMON_EVENT_ABILITY_REMOVED = 'common.event.ABILITY_REMOVED', + /** + * Sent when ability is updated. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 9 + */ + COMMON_EVENT_ABILITY_UPDATED = 'common.event.ABILITY_UPDATED', + /** + * Gps mode state changed. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 9 + */ + COMMON_EVENT_LOCATION_MODE_STATE_CHANGED = 'usual.event.location.MODE_STATE_CHANGED', + /** + * The ivi is about to go into sleep state when the ivi is turned off power. + * This is a protected common event that can only be sent by system. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 9 + */ + COMMON_EVENT_IVI_SLEEP = 'common.event.IVI_SLEEP', + /** + * The ivi is slept and notify the app stop playing. + * This is a protected common event that can only be sent by system. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 9 + */ + COMMON_EVENT_IVI_PAUSE = 'common.event.IVI_PAUSE', + /** + * The ivi is standby and notify the app stop playing. + * This is a protected common event that can only be sent by system. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 9 + */ + COMMON_EVENT_IVI_STANDBY = 'common.event.IVI_STANDBY', + /** + * The app stop playing and save state. + * This is a protected common event that can only be sent by system. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 9 + */ + COMMON_EVENT_IVI_LASTMODE_SAVE = 'common.event.IVI_LASTMODE_SAVE', + /** + * The ivi is voltage abnormal. + * This is a protected common event that can only be sent by system. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 9 + */ + COMMON_EVENT_IVI_VOLTAGE_ABNORMAL = 'common.event.IVI_VOLTAGE_ABNORMAL', + /** + * The ivi temperature is too high. + * This is a protected common event that can only be sent by system.this common event will be delete later, + * please use COMMON_EVENT_IVI_TEMPERATURE_ABNORMAL. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 9 + */ + COMMON_EVENT_IVI_HIGH_TEMPERATURE = 'common.event.IVI_HIGH_TEMPERATURE', + /** + * The ivi temperature is extreme high. + * This is a protected common event that can only be sent by system.this common event will be delete later, + * please use COMMON_EVENT_IVI_TEMPERATURE_ABNORMAL. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 9 + */ + COMMON_EVENT_IVI_EXTREME_TEMPERATURE = 'common.event.IVI_EXTREME_TEMPERATURE', + /** + * The ivi temperature is abnormal. + * This is a protected common event that can only be sent by system. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 9 + */ + COMMON_EVENT_IVI_TEMPERATURE_ABNORMAL = 'common.event.IVI_TEMPERATURE_ABNORMAL', + /** + * The ivi voltage is recovery. + * This is a protected common event that can only be sent by system. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 9 + */ + COMMON_EVENT_IVI_VOLTAGE_RECOVERY = 'common.event.IVI_VOLTAGE_RECOVERY', + /** + * The ivi temperature is recovery. + * This is a protected common event that can only be sent by system. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 9 + */ + COMMON_EVENT_IVI_TEMPERATURE_RECOVERY = 'common.event.IVI_TEMPERATURE_RECOVERY', + /** + * The battery service is active. + * This is a protected common event that can only be sent by system. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 9 + */ + COMMON_EVENT_IVI_ACTIVE = 'common.event.IVI_ACTIVE', + /** + * The usb state change events. + * This is a protected common event that can only be sent by system. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 9 + */ + COMMON_EVENT_USB_STATE = 'usual.event.hardware.usb.action.USB_STATE', + /** + * The usb port changed. + * This is a protected common event that can only be sent by system. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 9 + */ + COMMON_EVENT_USB_PORT_CHANGED = 'usual.event.hardware.usb.action.USB_PORT_CHANGED', + /** + * The usb device attached. + * This is a protected common event that can only be sent by system. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 9 + */ + COMMON_EVENT_USB_DEVICE_ATTACHED = 'usual.event.hardware.usb.action.USB_DEVICE_ATTACHED', + /** + * The usb device detached. + * This is a protected common event that can only be sent by system. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 9 + */ + COMMON_EVENT_USB_DEVICE_DETACHED = 'usual.event.hardware.usb.action.USB_DEVICE_DETACHED', + /** + * The usb accessory attached. + * This is a protected common event that can only be sent by system. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 9 + */ + COMMON_EVENT_USB_ACCESSORY_ATTACHED = 'usual.event.hardware.usb.action.USB_ACCESSORY_ATTACHED', + /** + * The usb accessory detached. + * This is a protected common event that can only be sent by system. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 9 + */ + COMMON_EVENT_USB_ACCESSORY_DETACHED = 'usual.event.hardware.usb.action.USB_ACCESSORY_DETACHED', + /** + * The external storage was removed. + * This is a protected common event that can only be sent by system. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 9 + */ + COMMON_EVENT_DISK_REMOVED = 'usual.event.data.DISK_REMOVED', + /** + * The external storage was unmounted. + * This is a protected common event that can only be sent by system. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 9 + */ + COMMON_EVENT_DISK_UNMOUNTED = 'usual.event.data.DISK_UNMOUNTED', + /** + * The external storage was mounted. + * This is a protected common event that can only be sent by system. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 9 + */ + COMMON_EVENT_DISK_MOUNTED = 'usual.event.data.DISK_MOUNTED', + /** + * The external storage was bad removal. + * This is a protected common event that can only be sent by system. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 9 + */ + COMMON_EVENT_DISK_BAD_REMOVAL = 'usual.event.data.DISK_BAD_REMOVAL', + /** + * The external storage was unmountable. + * This is a protected common event that can only be sent by system. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 9 + */ + COMMON_EVENT_DISK_UNMOUNTABLE = 'usual.event.data.DISK_UNMOUNTABLE', + /** + * The external storage was eject. + * This is a protected common event that can only be sent by system. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 9 + */ + COMMON_EVENT_DISK_EJECT = 'usual.event.data.DISK_EJECT', + /** + * The external storage was removed. + * This is a protected common event that can only be sent by system. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 9 + */ + COMMON_EVENT_VOLUME_REMOVED = 'usual.event.data.VOLUME_REMOVED', + /** + * The external storage was unmounted. + * This is a protected common event that can only be sent by system. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 9 + */ + COMMON_EVENT_VOLUME_UNMOUNTED = 'usual.event.data.VOLUME_UNMOUNTED', + /** + * The external storage was mounted. + * This is a protected common event that can only be sent by system. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 9 + */ + COMMON_EVENT_VOLUME_MOUNTED = 'usual.event.data.VOLUME_MOUNTED', + /** + * The external storage was bad removal. + * This is a protected common event that can only be sent by system. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 9 + */ + COMMON_EVENT_VOLUME_BAD_REMOVAL = 'usual.event.data.VOLUME_BAD_REMOVAL', + /** + * The external storage was eject. + * This is a protected common event that can only be sent by system. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 9 + */ + COMMON_EVENT_VOLUME_EJECT = 'usual.event.data.VOLUME_EJECT', + /** + * The visible of account was updated. + * This is a protected common event that can only be sent by system. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 9 + */ + COMMON_EVENT_VISIBLE_ACCOUNTS_UPDATED = 'usual.event.data.VISIBLE_ACCOUNTS_UPDATED', + /** + * Account was deleted. + * This is a protected common event that can only be sent by system. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 9 + */ + COMMON_EVENT_ACCOUNT_DELETED = 'usual.event.data.ACCOUNT_DELETED', + /** + * Foundation was ready. + * This is a protected common event that can only be sent by system. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 9 + */ + COMMON_EVENT_FOUNDATION_READY = 'common.event.FOUNDATION_READY', + /** + * Indicates the common event Action indicating that the airplane mode status of the device changes. + * Users can register this event to listen to the change of the airplane mode status of the device. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 9 + */ + COMMON_EVENT_AIRPLANE_MODE_CHANGED = 'usual.event.AIRPLANE_MODE', + /** + * sent by the window manager service when the window mode is split. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 9 + */ + /** + * sent by the window manager service when the window mode is split. + * + * @syscap SystemCapability.Notification.CommonEvent + * @atomicservice + * @since 11 + */ + COMMON_EVENT_SPLIT_SCREEN = 'common.event.SPLIT_SCREEN', + /** + * The notification slot has been updated. + * This is a protected common event that can only be sent by system. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 9 + */ + COMMON_EVENT_SLOT_CHANGE = 'usual.event.SLOT_CHANGE', + /** + * Indicate the action of a common event that the spn display information has been updated. + * This common event can be triggered only by system. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 9 + */ + COMMON_EVENT_SPN_INFO_CHANGED = 'usual.event.SPN_INFO_CHANGED', + /** + * Indicate the result of quick fix apply. + * This common event can be triggered only by system. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 9 + */ + COMMON_EVENT_QUICK_FIX_APPLY_RESULT = 'usual.event.QUICK_FIX_APPLY_RESULT', + /** + * Indicate the result of quick fix revoke. + * This common event can be triggered only by system. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 10 + */ + COMMON_EVENT_QUICK_FIX_REVOKE_RESULT = 'usual.event.QUICK_FIX_REVOKE_RESULT', + /** + * Indicate the action of a common event that the user information has been updated. + * This common event can be triggered only by system. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 9 + */ + COMMON_EVENT_USER_INFO_UPDATED = 'usual.event.USER_INFO_UPDATED', + /** + * Indicate http proxy has been changed. + * This is a protected common event that can only be sent by system. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 10 + */ + COMMON_EVENT_HTTP_PROXY_CHANGE = 'usual.event.HTTP_PROXY_CHANGE', + /** + * Indicates the action of a common event that the phone SIM card state has changed. + * This is a protected common event that can only be sent by system. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 10 + */ + COMMON_EVENT_SIM_STATE_CHANGED = 'usual.event.SIM_STATE_CHANGED', + /** + * Indicates the action of a common event that the call state has been changed. + * To subscribe to this protected common event, your application must have the ohos.permission.GET_TELEPHONY_STATE + * permission. + * This is a protected common event that can only be sent by system. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 10 + */ + COMMON_EVENT_CALL_STATE_CHANGED = 'usual.event.CALL_STATE_CHANGED', + /** + * Indicates the action of a common event that the network state has been changed. + * This is a protected common event that can only be sent by system. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 10 + */ + COMMON_EVENT_NETWORK_STATE_CHANGED = 'usual.event.NETWORK_STATE_CHANGED', + /** + * Indicates the action of a common event that the signal info has been changed. + * This is a protected common event that can only be sent by system. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 10 + */ + COMMON_EVENT_SIGNAL_INFO_CHANGED = 'usual.event.SIGNAL_INFO_CHANGED', + /** + * This commonEvent means when the screen is unlocked. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 10 + */ + /** + * This commonEvent means when the screen is unlocked. + * + * @syscap SystemCapability.Notification.CommonEvent + * @atomicservice + * @since 11 + */ + COMMON_EVENT_SCREEN_UNLOCKED = 'usual.event.SCREEN_UNLOCKED', + /** + * This commonEvent means when the screen is locked. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 10 + */ + /** + * This commonEvent means when the screen is locked. + * + * @syscap SystemCapability.Notification.CommonEvent + * @atomicservice + * @since 11 + */ + COMMON_EVENT_SCREEN_LOCKED = 'usual.event.SCREEN_LOCKED', + /** + * Indicates the action of a common event that the network connectivity changed. + * This is a protected common event that can only be sent by system. + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 10 + */ + /** + * Indicates the action of a common event that the network connectivity changed. + * This is a protected common event that can only be sent by system. + * + * @syscap SystemCapability.Notification.CommonEvent + * @atomicservice + * @since 11 + */ + COMMON_EVENT_CONNECTIVITY_CHANGE = 'usual.event.CONNECTIVITY_CHANGE', + /** + * This common event means that minors mode is enabled. + * This is a protected common event that can only be sent by system. + * + * @syscap SystemCapability.Notification.CommonEvent + * @atomicservice + * @since 12 + */ + COMMON_EVENT_MINORSMODE_ON = 'usual.event.MINORSMODE_ON', + /** + * This common event means that minors mode is disabled. + * This is a protected common event that can only be sent by system. + * + * @syscap SystemCapability.Notification.CommonEvent + * @atomicservice + * @since 12 + */ + COMMON_EVENT_MINORSMODE_OFF = 'usual.event.MINORSMODE_OFF' + } + /** + * Describes the data of the common event + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 10 + */ + /** + * Describes the data of the common event + * + * @syscap SystemCapability.Notification.CommonEvent + * @atomicservice + * @since 11 + */ + export type CommonEventData = _CommonEventData; + /** + * Describes the subscriber of common event + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 10 + */ + /** + * Describes the subscriber of common event + * + * @syscap SystemCapability.Notification.CommonEvent + * @atomicservice + * @since 11 + */ + export type CommonEventSubscriber = _CommonEventSubscriber; + /** + * Describes the information of the subscriber + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 10 + */ + /** + * Describes the information of the subscriber + * + * @syscap SystemCapability.Notification.CommonEvent + * @atomicservice + * @since 11 + */ + export type CommonEventSubscribeInfo = _CommonEventSubscribeInfo; + /** + * Describes the information of the subscriber + * + * @syscap SystemCapability.Notification.CommonEvent + * @since 10 + */ + /** + * Describes the information of the subscriber + * + * @syscap SystemCapability.Notification.CommonEvent + * @atomicservice + * @since 11 + */ + /** + * Describes the information of the subscriber + * + * @syscap SystemCapability.Notification.CommonEvent + * @crossplatform + * @atomicservice + * @since 12 + */ + export type CommonEventPublishData = _CommonEventPublishData; +} +export default commonEventManager; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.connectedTag.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.connectedTag.d.ts new file mode 100755 index 00000000..47775cc5 --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.connectedTag.d.ts @@ -0,0 +1,221 @@ +/* + * Copyright (C) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit ConnectivityKit + */ +import type { AsyncCallback, Callback } from './@ohos.base'; +/** + * Provides methods to operate or manage Connected Tag. + * + * @namespace connectedTag + * @syscap SystemCapability.Communication.ConnectedTag + * @since 8 + */ +declare namespace connectedTag { + /** + * Initializes Connected Tag. + * + * @permission ohos.permission.NFC_TAG + * @returns { boolean } Returns true if init success, otherwise returns false. + * @syscap SystemCapability.Communication.ConnectedTag + * @since 8 + * @deprecated since 9 + * @useinstead ohos.connectedTag/connectedTag#initialize + */ + function init(): boolean; + /** + * Initializes the connected NFC tag. + * + * @permission ohos.permission.NFC_TAG + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 3200101 - Connected NFC tag running state is abnormal in service. + * @syscap SystemCapability.Communication.ConnectedTag + * @since 9 + */ + function initialize(): void; + /** + * UnInitializes Connected Tag. + * + * @permission ohos.permission.NFC_TAG + * @returns { boolean } Returns true if uninit success, otherwise returns false. + * @syscap SystemCapability.Communication.ConnectedTag + * @since 8 + * @deprecated since 9 + * @useinstead ohos.connectedTag/connectedTag#uninitialize + */ + function uninit(): boolean; + /** + * Uninitializes the connected NFC tag. + * + * @permission ohos.permission.NFC_TAG + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 3200101 - Connected NFC tag running state is abnormal in service. + * @syscap SystemCapability.Communication.ConnectedTag + * @since 9 + */ + function uninitialize(): void; + /** + * Reads the NDEF Data. + * + * @permission ohos.permission.NFC_TAG + * @returns { Promise } Returns the NDEF Data. + * @syscap SystemCapability.Communication.ConnectedTag + * @since 8 + * @deprecated since 9 + * @useinstead ohos.connectedTag/connectedTag#read + */ + function readNdefTag(): Promise; + /** + * Reads the NDEF Data. + * + * @permission ohos.permission.NFC_TAG + * @param { AsyncCallback } callback + * @syscap SystemCapability.Communication.ConnectedTag + * @since 8 + * @deprecated since 9 + * @useinstead ohos.connectedTag/connectedTag#read + */ + function readNdefTag(callback: AsyncCallback): void; + /** + * Reads the NDEF data from the connected NFC tag. + * + * @permission ohos.permission.NFC_TAG + * @returns { Promise } The reponse NDEF data. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 3200101 - Connected NFC tag running state is abnormal in service. + * @syscap SystemCapability.Communication.ConnectedTag + * @since 9 + */ + function read(): Promise; + /** + * Reads the NDEF data from the connected NFC tag. + * + * @permission ohos.permission.NFC_TAG + * @param { AsyncCallback } callback The callback to receive the data. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 3200101 - Connected NFC tag running state is abnormal in service. + * @syscap SystemCapability.Communication.ConnectedTag + * @since 9 + */ + function read(callback: AsyncCallback): void; + /** + * Writes the NDEF Data. + * + * @permission ohos.permission.NFC_TAG + * @param { string } data The Data to write. + * @returns { Promise } The void. + * @syscap SystemCapability.Communication.ConnectedTag + * @since 8 + * @deprecated since 9 + * @useinstead ohos.connectedTag/connectedTag#write + */ + function writeNdefTag(data: string): Promise; + /** + * Writes the NDEF Data. + * + * @permission ohos.permission.NFC_TAG + * @param { string } data The Data to write. + * @param { AsyncCallback } callback + * @syscap SystemCapability.Communication.ConnectedTag + * @since 8 + * @deprecated since 9 + * @useinstead ohos.connectedTag/connectedTag#write + */ + function writeNdefTag(data: string, callback: AsyncCallback): void; + /** + * Writes the NDEF data to the connected NFC tag. + * + * @permission ohos.permission.NFC_TAG + * @param { number[] } data Indicates the NDEF data to send, which is a byte array. + * @returns { Promise } The void. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - The parameter check failed. Possible causes: + *
1. Mandatory parameters are left unspecified. + *
2. Incorrect parameters types. + *
3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 3200101 - Connected NFC tag running state is abnormal in service. + * @syscap SystemCapability.Communication.ConnectedTag + * @since 9 + */ + function write(data: number[]): Promise; + /** + * Writes the NDEF data to the connected NFC tag. + * + * @permission ohos.permission.NFC_TAG + * @param { number[] } data Indicates the NDEF data to send, which is a byte array. + * @param { AsyncCallback } callback + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - The parameter check failed. Possible causes: + *
1. Mandatory parameters are left unspecified. + *
2. Incorrect parameters types. + *
3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 3200101 - Connected NFC tag running state is abnormal in service. + * @syscap SystemCapability.Communication.ConnectedTag + * @since 9 + */ + function write(data: number[], callback: AsyncCallback): void; + /** + * Subscribes NFC RF status change events. + * + * @permission ohos.permission.NFC_TAG + * @param {'notify'} type The callback type. + * @param { Callback } callback The callback function to be registered. + * @syscap SystemCapability.Communication.ConnectedTag + * @since 8 + */ + function on(type: 'notify', callback: Callback): void; + /** + * Unsubscribes NFC RF status change events. + *

All callback functions will be unregistered If there is no specific callback parameter.

+ * + * @permission ohos.permission.NFC_TAG + * @param { 'notify' } type The callback type. + * @param { Callback } callback The callback function to be unregistered. + * @syscap SystemCapability.Communication.ConnectedTag + * @since 8 + */ + function off(type: 'notify', callback?: Callback): void; + /** + * Describes the NFC RF type. + * + * @enum { number } + * @syscap SystemCapability.Communication.ConnectedTag + * @since 8 + */ + enum NfcRfType { + /** + * NFC RF LEAVE + * + * @syscap SystemCapability.Communication.ConnectedTag + * @since 8 + */ + NFC_RF_LEAVE = 0, + /** + * NFC RF ENTER + * + * @syscap SystemCapability.Communication.ConnectedTag + * @since 8 + */ + NFC_RF_ENTER = 1 + } +} +export default connectedTag; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.contact.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.contact.d.ts new file mode 100755 index 00000000..f1ac7abf --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.contact.d.ts @@ -0,0 +1,4115 @@ +/* + * Copyright (C) 2021-2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit ContactsKit + */ +import { AsyncCallback } from './@ohos.base'; +import type Context from './application/BaseContext'; +/** + * Contains variety of system contact, provides functions for adding, updating and deleting these system contact + * and provides methods for querying the information of contact. + * + * @namespace contact + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + */ +/** + * Contains variety of system contact, provides functions for adding, updating and deleting these system contact + * and provides methods for querying the information of contact. + * + * @namespace contact + * @syscap SystemCapability.Applications.ContactsData + * @atomicservice + * @since 11 + */ +declare namespace contact { + /** + * Creates a contact. + * + * @permission ohos.permission.WRITE_CONTACTS + * @param { Contact } contact - Indicates the contact information. + * @param { AsyncCallback } callback - Returns the contact ID (which can be obtained + * by {@link Contact#getId()}) if the creation is successful. returns {@link Contact#INVALID_CONTACT_ID} if the + * creation fails. + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + * @deprecated since 10 + * @useinstead contact.addContact#addContact + */ + function addContact(contact: Contact, callback: AsyncCallback): void; + /** + * Creates a contact. + * + * @permission ohos.permission.WRITE_CONTACTS + * @param { Context } context - Indicates the context of application or capability. + * @param { Contact } contact - Indicates the contact information. + * @param { AsyncCallback } callback - Returns the contact ID (which can be obtained + * by {@link Contact#getId()}) if the creation is successful. returns {@link Contact#INVALID_CONTACT_ID} if the + * creation fails. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Parameter error. + * @syscap SystemCapability.Applications.ContactsData + * @since 10 + */ + /** + * Creates a contact. + * + * @permission ohos.permission.WRITE_CONTACTS + * @param { Context } context - Indicates the context of application or capability. + * @param { Contact } contact - Indicates the contact information. + * @param { AsyncCallback } callback - Returns the contact ID (which can be obtained + * by {@link Contact#getId()}) if the creation is successful. returns {@link Contact#INVALID_CONTACT_ID} if the + * creation fails. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Parameter error. + * @syscap SystemCapability.Applications.ContactsData + * @atomicservice + * @since 12 + */ + function addContact(context: Context, contact: Contact, callback: AsyncCallback): void; + /** + * Creates a contact. + * + * @permission ohos.permission.WRITE_CONTACTS + * @param { Contact } contact - Indicates the contact information. + * @returns { Promise } Returns the contact ID (which can be obtained by {@link Contact#getId()}) if the + * creation is successful. returns {@link Contact#INVALID_CONTACT_ID} if the creation fails. + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + * @deprecated since 10 + * @useinstead contact.addContact#addContact + */ + function addContact(contact: Contact): Promise; + /** + * Creates a contact. + * + * @permission ohos.permission.WRITE_CONTACTS + * @param { Context } context - Indicates the context of application or capability. + * @param { Contact } contact - Indicates the contact information. + * @returns { Promise } Returns the contact ID (which can be obtained by {@link Contact#getId()}) if the + * creation is successful. returns {@link Contact#INVALID_CONTACT_ID} if the creation fails. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Parameter error. + * @syscap SystemCapability.Applications.ContactsData + * @since 10 + */ + /** + * Creates a contact. + * + * @permission ohos.permission.WRITE_CONTACTS + * @param { Context } context - Indicates the context of application or capability. + * @param { Contact } contact - Indicates the contact information. + * @returns { Promise } Returns the contact ID (which can be obtained by {@link Contact#getId()}) if the + * creation is successful. returns {@link Contact#INVALID_CONTACT_ID} if the creation fails. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Parameter error. + * @syscap SystemCapability.Applications.ContactsData + * @atomicservice + * @since 12 + */ + function addContact(context: Context, contact: Contact): Promise; + /** + * Select contact. + * + * @permission ohos.permission.READ_CONTACTS + * @param { AsyncCallback> } callback - Indicates the callback for getting the result of the call. + * Returns the contact list which user select; returns empty contact list if user not select. + * @syscap SystemCapability.Applications.Contacts + * @since 7 + * @deprecated since 10 + * @useinstead contact.selectContact#selectContacts + */ + function selectContact(callback: AsyncCallback>): void; + /** + * Select contact. + * + * @param { AsyncCallback> } callback - Indicates the callback for getting the result of the call. + * Returns the contact list which user select; returns empty contact list if user not select. + * @throws { BusinessError } 401 - Parameter error. + * @syscap SystemCapability.Applications.Contacts + * @since 10 + */ + /** + * Select contact. + * + * @param { AsyncCallback> } callback - Indicates the callback for getting the result of the call. + * Returns the contact list which user select; returns empty contact list if user not select. + * @throws { BusinessError } 401 - Parameter error. + * @syscap SystemCapability.Applications.Contacts + * @atomicservice + * @since 11 + */ + function selectContacts(callback: AsyncCallback>): void; + /** + * Select contact. + * + * @permission ohos.permission.READ_CONTACTS + * @returns { Promise> } Returns the contact list which user select; + * returns empty contact list if user not select. + * @syscap SystemCapability.Applications.Contacts + * @since 7 + * @deprecated since 10 + * @useinstead contact.selectContact#selectContacts + */ + function selectContact(): Promise>; + /** + * Select contact. + * + * @returns { Promise> } Returns the contact list which user select; + * returns empty contact list if user not select. + * @syscap SystemCapability.Applications.Contacts + * @since 10 + */ + /** + * Select contact. + * + * @returns { Promise> } Returns the contact list which user select; + * returns empty contact list if user not select. + * @syscap SystemCapability.Applications.Contacts + * @atomicservice + * @since 11 + */ + function selectContacts(): Promise>; + /** + * Select contact with option. + * + * @param { ContactSelectionOptions } options - Indicates the Single-select or multiple-select. + * @param { AsyncCallback> } callback - Indicates the callback for getting the result of the call. + * @throws { BusinessError } 401 - Parameter error. + * @syscap SystemCapability.Applications.Contacts + * @since 10 + */ + /** + * Select contact with option. + * + * @param { ContactSelectionOptions } options - Indicates the Single-select or multiple-select. + * @param { AsyncCallback> } callback - Indicates the callback for getting the result of the call. + * @throws { BusinessError } 401 - Parameter error. + * @syscap SystemCapability.Applications.Contacts + * @atomicservice + * @since 11 + */ + function selectContacts(options: ContactSelectionOptions, callback: AsyncCallback>): void; + /** + * Select contact with option. + * + * @param { ContactSelectionOptions } options - Indicates the Single-select or multiple-select. + * @returns { Promise> } Returns the contact list which user select; + * returns empty contact list if user not select. + * @throws { BusinessError } 401 - Parameter error. + * @syscap SystemCapability.Applications.Contacts + * @since 10 + */ + /** + * Select contact with option. + * + * @param { ContactSelectionOptions } options - Indicates the Single-select or multiple-select. + * @returns { Promise> } Returns the contact list which user select; + * returns empty contact list if user not select. + * @throws { BusinessError } 401 - Parameter error. + * @syscap SystemCapability.Applications.Contacts + * @atomicservice + * @since 11 + */ + function selectContacts(options: ContactSelectionOptions): Promise>; + /** + * Deletes a specified contact. + * + * @permission ohos.permission.WRITE_CONTACTS + * @param { string } key - Indicates the unique query key of a contact to delete. + * @param { AsyncCallback } callback - Return the callback function. + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + * @deprecated since 10 + * @useinstead contact.deleteContact#deleteContact + */ + function deleteContact(key: string, callback: AsyncCallback): void; + /** + * Deletes a specified contact. + * + * @permission ohos.permission.WRITE_CONTACTS + * @param { Context } context - Indicates the context of application or capability. + * @param { string } key - Indicates the unique query key of a contact to delete. + * @param { AsyncCallback } callback - Return the callback function. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Parameter error. + * @syscap SystemCapability.Applications.ContactsData + * @since 10 + */ + function deleteContact(context: Context, key: string, callback: AsyncCallback): void; + /** + * Deletes a specified contact. + * + * @permission ohos.permission.WRITE_CONTACTS + * @param { string } key - Indicates the unique query key of a contact to delete. + * @returns { Promise } The promise returned by the function. + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + * @deprecated since 10 + * @useinstead contact.deleteContact#deleteContact + */ + function deleteContact(key: string): Promise; + /** + * Deletes a specified contact. + * + * @permission ohos.permission.WRITE_CONTACTS + * @param { Context } context - Indicates the context of application or capability. + * @param { string } key - Indicates the unique query key of a contact to delete. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Parameter error. + * @syscap SystemCapability.Applications.ContactsData + * @since 10 + */ + function deleteContact(context: Context, key: string): Promise; + /** + * Queries a specified contact of specified attributes. + * + * @permission ohos.permission.READ_CONTACTS + * @param { string } key - Indicates the unique query key of a contact. + * @param { AsyncCallback } callback - Returns the specified contact. + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + * @deprecated since 10 + * @useinstead contact.queryContact#queryContact + */ + function queryContact(key: string, callback: AsyncCallback): void; + /** + * Queries a specified contact of specified attributes. + * + * @permission ohos.permission.READ_CONTACTS + * @param { Context } context - Indicates the context of application or capability. + * @param { string } key - Indicates the unique query key of a contact. + * @param { AsyncCallback } callback - Returns the specified contact. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Parameter error. + * @syscap SystemCapability.Applications.ContactsData + * @since 10 + */ + function queryContact(context: Context, key: string, callback: AsyncCallback): void; + /** + * Queries a specified contact of specified attributes. + * + * @permission ohos.permission.READ_CONTACTS + * @param { string } key - Indicates the unique query key of a contact. + * @param { Holder } holder - Indicates the contact holder. + * If this parameter is null, the default holder is used for matching. + * @param { AsyncCallback } callback - Returns the specified contact. + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + * @deprecated since 10 + * @useinstead contact.queryContact#queryContact + */ + function queryContact(key: string, holder: Holder, callback: AsyncCallback): void; + /** + * Queries a specified contact of specified attributes. + * + * @permission ohos.permission.READ_CONTACTS + * @param { Context } context - Indicates the context of application or capability. + * @param { string } key - Indicates the unique query key of a contact. + * @param { Holder } holder - Indicates the contact holder. + * If this parameter is null, the default holder is used for matching. + * @param { AsyncCallback } callback - Returns the specified contact. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Parameter error. + * @syscap SystemCapability.Applications.ContactsData + * @since 10 + */ + function queryContact(context: Context, key: string, holder: Holder, callback: AsyncCallback): void; + /** + * Queries a specified contact of specified attributes. + * + * @permission ohos.permission.READ_CONTACTS + * @param { string } key - Indicates the unique query key of a contact. + * @param { ContactAttributes } attrs - Indicates the contact attributes. + * If this parameter is null, all attributes are used for matching. + * @param { AsyncCallback } callback - Returns the specified contact. + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + * @deprecated since 10 + * @useinstead contact.queryContact#queryContact + */ + function queryContact(key: string, attrs: ContactAttributes, callback: AsyncCallback): void; + /** + * Queries a specified contact of specified attributes. + * + * @permission ohos.permission.READ_CONTACTS + * @param { Context } context - Indicates the context of application or capability. + * @param { string } key - Indicates the unique query key of a contact. + * @param { ContactAttributes } attrs - Indicates the contact attributes. + * If this parameter is null, all attributes are used for matching. + * @param { AsyncCallback } callback - Returns the specified contact. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Parameter error. + * @syscap SystemCapability.Applications.ContactsData + * @since 10 + */ + function queryContact(context: Context, key: string, attrs: ContactAttributes, callback: AsyncCallback): void; + /** + * Queries a specified contact of specified attributes. + * + * @permission ohos.permission.READ_CONTACTS + * @param { string } key - Indicates the unique query key of a contact. + * @param { Holder } holder - Indicates the contact holder. + * @param { ContactAttributes } attrs - Indicates the contact attributes. + * If this parameter is null, all attributes are used for matching. + * @param { AsyncCallback } callback - Returns the specified contact. + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + * @deprecated since 10 + * @useinstead contact.queryContact#queryContact + */ + function queryContact(key: string, holder: Holder, attrs: ContactAttributes, callback: AsyncCallback): void; + /** + * Queries a specified contact of specified attributes. + * + * @permission ohos.permission.READ_CONTACTS + * @param { Context } context - Indicates the context of application or capability. + * @param { string } key - Indicates the unique query key of a contact. + * @param { Holder } holder - Indicates the contact holder. + * @param { ContactAttributes } attrs - Indicates the contact attributes. + * If this parameter is null, all attributes are used for matching. + * @param { AsyncCallback } callback - Returns the specified contact. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Parameter error. + * @syscap SystemCapability.Applications.ContactsData + * @since 10 + */ + function queryContact(context: Context, key: string, holder: Holder, attrs: ContactAttributes, callback: AsyncCallback): void; + /** + * Queries a specified contact of specified attributes. + * + * @permission ohos.permission.READ_CONTACTS + * @param { string } key - Indicates the unique query key of a contact. + * @param { Holder } holder - Indicates the contact holder. + * @param { ContactAttributes } attrs - Indicates the contact attributes. + * If this parameter is null, all attributes are used for matching. + * @returns { Promise } Returns the specified contact. + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + * @deprecated since 10 + * @useinstead contact.queryContact#queryContact + */ + function queryContact(key: string, holder?: Holder, attrs?: ContactAttributes): Promise; + /** + * Queries a specified contact of specified attributes. + * + * @permission ohos.permission.READ_CONTACTS + * @param { Context } context - Indicates the context of application or capability. + * @param { string } key - Indicates the unique query key of a contact. + * @param { Holder } holder - Indicates the contact holder. + * @param { ContactAttributes } attrs - Indicates the contact attributes. + * If this parameter is null, all attributes are used for matching. + * @returns { Promise } Returns the specified contact. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Parameter error. + * @syscap SystemCapability.Applications.ContactsData + * @since 10 + */ + function queryContact(context: Context, key: string, holder?: Holder, attrs?: ContactAttributes): Promise; + /** + * Queries contacts with query conditions. + * + * @permission ohos.permission.READ_CONTACTS + * @param { AsyncCallback> } callback - Returns the {@code Contact} list object. + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + * @deprecated since 10 + * @useinstead contact.queryContacts#queryContacts + */ + function queryContacts(callback: AsyncCallback>): void; + /** + * Queries contacts with query conditions. + * + * @permission ohos.permission.READ_CONTACTS + * @param { Context } context - Indicates the context of application or capability. + * @param { AsyncCallback> } callback - Returns the {@code Contact} list object. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Parameter error. + * @syscap SystemCapability.Applications.ContactsData + * @since 10 + */ + function queryContacts(context: Context, callback: AsyncCallback>): void; + /** + * Queries contacts with query conditions. + * + * @permission ohos.permission.READ_CONTACTS + * @param { Holder } holder - Indicates the contact holder. + * If this parameter is null, the default holder is used for matching. + * @param { AsyncCallback> } callback - Returns the {@code Contact} list object. + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + * @deprecated since 10 + * @useinstead contact.queryContacts#queryContacts + */ + function queryContacts(holder: Holder, callback: AsyncCallback>): void; + /** + * Queries contacts with query conditions. + * + * @permission ohos.permission.READ_CONTACTS + * @param { Context } context - Indicates the context of application or capability. + * @param { Holder } holder - Indicates the contact holder. + * If this parameter is null, the default holder is used for matching. + * @param { AsyncCallback> } callback - Returns the {@code Contact} list object. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Parameter error. + * @syscap SystemCapability.Applications.ContactsData + * @since 10 + */ + function queryContacts(context: Context, holder: Holder, callback: AsyncCallback>): void; + /** + * Queries contacts with query conditions. + * + * @permission ohos.permission.READ_CONTACTS + * @param { ContactAttributes } attrs - Indicates the contact attributes. + * If this parameter is null, all attributes are used for matching. + * @param { AsyncCallback> } callback - Returns the {@code Contact} list object. + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + * @deprecated since 10 + * @useinstead contact.queryContacts#queryContacts + */ + function queryContacts(attrs: ContactAttributes, callback: AsyncCallback>): void; + /** + * Queries contacts with query conditions. + * + * @permission ohos.permission.READ_CONTACTS + * @param { Context } context - Indicates the context of application or capability. + * @param { ContactAttributes } attrs - Indicates the contact attributes. + * If this parameter is null, all attributes are used for matching. + * @param { AsyncCallback> } callback - Returns the {@code Contact} list object. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Parameter error. + * @syscap SystemCapability.Applications.ContactsData + * @since 10 + */ + function queryContacts(context: Context, attrs: ContactAttributes, callback: AsyncCallback>): void; + /** + * Queries contacts with query conditions. + * + * @permission ohos.permission.READ_CONTACTS + * @param { Holder } holder - Indicates the contact holder. + * If this parameter is null, the default holder is used for matching. + * @param { ContactAttributes } attrs - Indicates the contact attributes. + * If this parameter is null, all attributes are used for matching. + * @param { AsyncCallback> } callback - Returns the {@code Contact} list object. + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + * @deprecated since 10 + * @useinstead contact.queryContacts#queryContacts + */ + function queryContacts(holder: Holder, attrs: ContactAttributes, callback: AsyncCallback>): void; + /** + * Queries contacts with query conditions. + * + * @permission ohos.permission.READ_CONTACTS + * @param { Context } context - Indicates the context of application or capability. + * @param { Holder } holder - Indicates the contact holder. + * If this parameter is null, the default holder is used for matching. + * @param { ContactAttributes } attrs - Indicates the contact attributes. + * If this parameter is null, all attributes are used for matching. + * @param { AsyncCallback> } callback - Returns the {@code Contact} list object. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Parameter error. + * @syscap SystemCapability.Applications.ContactsData + * @since 10 + */ + function queryContacts(context: Context, holder: Holder, attrs: ContactAttributes, callback: AsyncCallback>): void; + /** + * Queries contacts with query conditions. + * + * @permission ohos.permission.READ_CONTACTS + * @param { Holder } holder - Indicates the contact holder. + * If this parameter is null, the default holder is used for matching. + * @param { ContactAttributes } attrs - Indicates the contact attributes. + * If this parameter is null, all attributes are used for matching. + * @returns { Promise> } Returns the {@code Contact} list object. + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + * @deprecated since 10 + * @useinstead contact.queryContacts#queryContacts + */ + function queryContacts(holder?: Holder, attrs?: ContactAttributes): Promise>; + /** + * Queries contacts with query conditions. + * + * @permission ohos.permission.READ_CONTACTS + * @param { Context } context - Indicates the context of application or capability. + * @param { Holder } holder - Indicates the contact holder. + * If this parameter is null, the default holder is used for matching. + * @param { ContactAttributes } attrs - Indicates the contact attributes. + * If this parameter is null, all attributes are used for matching. + * @returns { Promise> } Returns the {@code Contact} list object. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Parameter error. + * @syscap SystemCapability.Applications.ContactsData + * @since 10 + */ + function queryContacts(context: Context, holder?: Holder, attrs?: ContactAttributes): Promise>; + /** + * Queries contacts by a specified email address. + * + * @permission ohos.permission.READ_CONTACTS + * @param { string } email - Indicates the email address. + * @param { AsyncCallback> } callback - Returns a {@code Contact} list object. + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + * @deprecated since 10 + * @useinstead contact.queryContactsByEmail#queryContactsByEmail + */ + function queryContactsByEmail(email: string, callback: AsyncCallback>): void; + /** + * Queries contacts by a specified email address. + * + * @permission ohos.permission.READ_CONTACTS + * @param { Context } context - Indicates the context of application or capability. + * @param { string } email - Indicates the email address. + * @param { AsyncCallback> } callback - Returns a {@code Contact} list object. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Parameter error. + * @syscap SystemCapability.Applications.ContactsData + * @since 10 + */ + function queryContactsByEmail(context: Context, email: string, callback: AsyncCallback>): void; + /** + * Queries contacts by a specified email address and contact holder. + * + * @permission ohos.permission.READ_CONTACTS + * @param { string } email - Indicates the email address. + * @param { Holder } holder - Indicates the contact holder. + * If this parameter is null, the default holder is used for matching. + * @param { AsyncCallback> } callback - Returns a {@code Contact} list object. + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + * @deprecated since 10 + * @useinstead contact.queryContactsByEmail#queryContactsByEmail + */ + function queryContactsByEmail(email: string, holder: Holder, callback: AsyncCallback>): void; + /** + * Queries contacts by a specified email address and contact holder. + * + * @permission ohos.permission.READ_CONTACTS + * @param { Context } context - Indicates the context of application or capability. + * @param { string } email - Indicates the email address. + * @param { Holder } holder - Indicates the contact holder. + * If this parameter is null, the default holder is used for matching. + * @param { AsyncCallback> } callback - Returns a {@code Contact} list object. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Parameter error. + * @syscap SystemCapability.Applications.ContactsData + * @since 10 + */ + function queryContactsByEmail(context: Context, email: string, holder: Holder, callback: AsyncCallback>): void; + /** + * Queries contacts by a specified email address and contact attributes. + * + * @permission ohos.permission.READ_CONTACTS + * @param { string } email - Indicates the email address. + * @param { ContactAttributes } attrs - Indicates the contact attributes. + * If this parameter is null, all attributes are used for matching. + * @param { AsyncCallback> } callback - Returns a {@code Contact} list object. + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + * @deprecated since 10 + * @useinstead contact.queryContactsByEmail#queryContactsByEmail + */ + function queryContactsByEmail(email: string, attrs: ContactAttributes, callback: AsyncCallback>): void; + /** + * Queries contacts by a specified email address and contact attributes. + * + * @permission ohos.permission.READ_CONTACTS + * @param { Context } context - Indicates the context of application or capability. + * @param { string } email - Indicates the email address. + * @param { ContactAttributes } attrs - Indicates the contact attributes. + * If this parameter is null, all attributes are used for matching. + * @param { AsyncCallback> } callback - Returns a {@code Contact} list object. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Parameter error. + * @syscap SystemCapability.Applications.ContactsData + * @since 10 + */ + function queryContactsByEmail(context: Context, email: string, attrs: ContactAttributes, callback: AsyncCallback>): void; + /** + * Queries contacts by a specified email address, contact holder, and contact attributes. + * + * @permission ohos.permission.READ_CONTACTS + * @param { string } email - Indicates the email address. + * @param { Holder } holder - Indicates the contact holder. + * If this parameter is null, the default holder is used for matching. + * @param { ContactAttributes } attrs - Indicates the contact attributes. + * If this parameter is null, all attributes are used for matching. + * @param { AsyncCallback> } callback - Returns a {@code Contact} list object. + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + * @deprecated since 10 + * @useinstead contact.queryContactsByEmail#queryContactsByEmail + */ + function queryContactsByEmail(email: string, holder: Holder, attrs: ContactAttributes, callback: AsyncCallback>): void; + /** + * Queries contacts by a specified email address, contact holder, and contact attributes. + * + * @permission ohos.permission.READ_CONTACTS + * @param { Context } context - Indicates the context of application or capability. + * @param { string } email - Indicates the email address. + * @param { Holder } holder - Indicates the contact holder. + * If this parameter is null, the default holder is used for matching. + * @param { ContactAttributes } attrs - Indicates the contact attributes. + * If this parameter is null, all attributes are used for matching. + * @param { AsyncCallback> } callback - Returns a {@code Contact} list object. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Parameter error. + * @syscap SystemCapability.Applications.ContactsData + * @since 10 + */ + function queryContactsByEmail(context: Context, email: string, holder: Holder, attrs: ContactAttributes, callback: AsyncCallback>): void; + /** + * Queries contacts by a specified email address, contact holder, and contact attributes. + * + * @permission ohos.permission.READ_CONTACTS + * @param { string } email - Indicates the email address. + * @param { Holder } holder - Indicates the contact holder. + * If this parameter is null, the default holder is used for matching. + * @param { ContactAttributes } attrs - Indicates the contact attributes. + * If this parameter is null, all attributes are used for matching. + * @returns { Promise> } Returns a {@code Contact} list object. + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + * @deprecated since 10 + * @useinstead contact.queryContactsByEmail#queryContactsByEmail + */ + function queryContactsByEmail(email: string, holder?: Holder, attrs?: ContactAttributes): Promise>; + /** + * Queries contacts by a specified email address, contact holder, and contact attributes. + * + * @permission ohos.permission.READ_CONTACTS + * @param { Context } context - Indicates the context of application or capability. + * @param { string } email - Indicates the email address. + * @param { Holder } holder - Indicates the contact holder. + * If this parameter is null, the default holder is used for matching. + * @param { ContactAttributes } attrs - Indicates the contact attributes. + * If this parameter is null, all attributes are used for matching. + * @returns { Promise> } Returns a {@code Contact} list object. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Parameter error. + * @syscap SystemCapability.Applications.ContactsData + * @since 10 + */ + function queryContactsByEmail(context: Context, email: string, holder?: Holder, attrs?: ContactAttributes): Promise>; + /** + * Queries contacts by a phone number. + * + * @permission ohos.permission.READ_CONTACTS + * @param { string } phoneNumber - Indicates the phone number. + * Only full match is supported, and wildcards are not supported. + * @param { AsyncCallback> } callback - Returns the {@code Contact} list object. + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + * @deprecated since 10 + * @useinstead contact.queryContactsByPhoneNumber#queryContactsByPhoneNumber + */ + function queryContactsByPhoneNumber(phoneNumber: string, callback: AsyncCallback>): void; + /** + * Queries contacts by a phone number. + * + * @permission ohos.permission.READ_CONTACTS + * @param { Context } context - Indicates the context of application or capability. + * @param { string } phoneNumber - Indicates the phone number. + * Only full match is supported, and wildcards are not supported. + * @param { AsyncCallback> } callback - Returns the {@code Contact} list object. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Parameter error. + * @syscap SystemCapability.Applications.ContactsData + * @since 10 + */ + function queryContactsByPhoneNumber(context: Context, phoneNumber: string, callback: AsyncCallback>): void; + /** + * Queries contacts by a phone number and contact holder. + * + * @permission ohos.permission.READ_CONTACTS + * @param { string } phoneNumber - Indicates the phone number. + * Only full match is supported, and wildcards are not supported. + * @param { Holder } holder - Indicates the contact holder. + * If this parameter is null, the default holder is used for matching. + * @param { AsyncCallback> } callback - Returns the {@code Contact} list object. + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + * @deprecated since 10 + * @useinstead contact.queryContactsByPhoneNumber#queryContactsByPhoneNumber + */ + function queryContactsByPhoneNumber(phoneNumber: string, holder: Holder, callback: AsyncCallback>): void; + /** + * Queries contacts by a phone number and contact holder. + * + * @permission ohos.permission.READ_CONTACTS + * @param { Context } context - Indicates the context of application or capability. + * @param { string } phoneNumber - Indicates the phone number. + * Only full match is supported, and wildcards are not supported. + * @param { Holder } holder - Indicates the contact holder. + * If this parameter is null, the default holder is used for matching. + * @param { AsyncCallback> } callback - Returns the {@code Contact} list object. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Parameter error. + * @syscap SystemCapability.Applications.ContactsData + * @since 10 + */ + function queryContactsByPhoneNumber(context: Context, phoneNumber: string, holder: Holder, callback: AsyncCallback>): void; + /** + * Queries contacts by a phone number and contact attribute. + * + * @permission ohos.permission.READ_CONTACTS + * @param { string } phoneNumber - Indicates the phone number. + * Only full match is supported, and wildcards are not supported. + * @param { ContactAttributes } attrs - Indicates the contact attribute. + * If this parameter is null, all attributes will be used for matching. + * @param { AsyncCallback> } callback - Returns the {@code Contact} list object. + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + * @deprecated since 10 + * @useinstead contact.queryContactsByPhoneNumber#queryContactsByPhoneNumber + */ + function queryContactsByPhoneNumber(phoneNumber: string, attrs: ContactAttributes, callback: AsyncCallback>): void; + /** + * Queries contacts by a phone number and contact attribute. + * + * @permission ohos.permission.READ_CONTACTS + * @param { Context } context - Indicates the context of application or capability. + * @param { string } phoneNumber - Indicates the phone number. + * Only full match is supported, and wildcards are not supported. + * @param { ContactAttributes } attrs - Indicates the contact attribute. + * If this parameter is null, all attributes will be used for matching. + * @param { AsyncCallback> } callback - Returns the {@code Contact} list object. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Parameter error. + * @syscap SystemCapability.Applications.ContactsData + * @since 10 + */ + function queryContactsByPhoneNumber(context: Context, phoneNumber: string, attrs: ContactAttributes, callback: AsyncCallback>): void; + /** + * Queries contacts by a phone number, contact holder and contact attribute. + * + * @permission ohos.permission.READ_CONTACTS + * @param { string } phoneNumber - Indicates the phone number. + * Only full match is supported, and wildcards are not supported. + * @param { Holder } holder - Indicates the contact holder. + * If this parameter is null, the default holder is used for matching. + * @param { ContactAttributes } attrs - Indicates the contact attribute. + * If this parameter is null, all attributes will be used for matching. + * @param { AsyncCallback> } callback - Returns the {@code Contact} list object. + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + * @deprecated since 10 + * @useinstead contact.queryContactsByPhoneNumber#queryContactsByPhoneNumber + */ + function queryContactsByPhoneNumber(phoneNumber: string, holder: Holder, attrs: ContactAttributes, callback: AsyncCallback>): void; + /** + * Queries contacts by a phone number, contact holder and contact attribute. + * + * @permission ohos.permission.READ_CONTACTS + * @param { Context } context - Indicates the context of application or capability. + * @param { string } phoneNumber - Indicates the phone number. + * Only full match is supported, and wildcards are not supported. + * @param { Holder } holder - Indicates the contact holder. + * If this parameter is null, the default holder is used for matching. + * @param { ContactAttributes } attrs - Indicates the contact attribute. + * If this parameter is null, all attributes will be used for matching. + * @param { AsyncCallback> } callback - Returns the {@code Contact} list object. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Parameter error. + * @syscap SystemCapability.Applications.ContactsData + * @since 10 + */ + function queryContactsByPhoneNumber(context: Context, phoneNumber: string, holder: Holder, attrs: ContactAttributes, callback: AsyncCallback>): void; + /** + * Queries contacts by a phone number, contact holder and contact attribute. + * + * @permission ohos.permission.READ_CONTACTS + * @param { string } phoneNumber - Indicates the phone number. + * Only full match is supported, and wildcards are not supported. + * @param { Holder } holder - Indicates the contact holder. + * If this parameter is null, the default holder is used for matching. + * @param { ContactAttributes } attrs - Indicates the contact attribute. + * If this parameter is null, all attributes will be used for matching. + * @returns { Promise> } Returns the {@code Contact} list object. + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + * @deprecated since 10 + * @useinstead contact.queryContactsByPhoneNumber#queryContactsByPhoneNumber + */ + function queryContactsByPhoneNumber(phoneNumber: string, holder?: Holder, attrs?: ContactAttributes): Promise>; + /** + * Queries contacts by a phone number, contact holder and contact attribute. + * + * @permission ohos.permission.READ_CONTACTS + * @param { Context } context - Indicates the context of application or capability. + * @param { string } phoneNumber - Indicates the phone number. + * Only full match is supported, and wildcards are not supported. + * @param { Holder } holder - Indicates the contact holder. + * If this parameter is null, the default holder is used for matching. + * @param { ContactAttributes } attrs - Indicates the contact attribute. + * If this parameter is null, all attributes will be used for matching. + * @returns { Promise> } Returns the {@code Contact} list object. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Parameter error. + * @syscap SystemCapability.Applications.ContactsData + * @since 10 + */ + function queryContactsByPhoneNumber(context: Context, phoneNumber: string, holder?: Holder, attrs?: ContactAttributes): Promise>; + /** + * Queries contact groups. + * + * @permission ohos.permission.READ_CONTACTS + * @param { AsyncCallback> } callback - Returns the contact group list object. + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + * @deprecated since 10 + * @useinstead contact.queryGroups#queryGroups + */ + function queryGroups(callback: AsyncCallback>): void; + /** + * Queries contact groups. + * + * @permission ohos.permission.READ_CONTACTS + * @param { Context } context - Indicates the context of application or capability. + * @param { AsyncCallback> } callback - Returns the contact group list object. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Parameter error. + * @syscap SystemCapability.Applications.ContactsData + * @since 10 + */ + function queryGroups(context: Context, callback: AsyncCallback>): void; + /** + * Queries contact groups by contact holder. + * + * @permission ohos.permission.READ_CONTACTS + * @param { Holder } holder - Indicates the contact holder. + * If this parameter is null, the default holder is used for matching. + * @param { AsyncCallback> } callback - Returns the contact group list object. + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + * @deprecated since 10 + * @useinstead contact.queryGroups#queryGroups + */ + function queryGroups(holder: Holder, callback: AsyncCallback>): void; + /** + * Queries contact groups by contact holder. + * + * @permission ohos.permission.READ_CONTACTS + * @param { Context } context - Indicates the context of application or capability. + * @param { Holder } holder - Indicates the contact holder. + * If this parameter is null, the default holder is used for matching. + * @param { AsyncCallback> } callback - Returns the contact group list object. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Parameter error. + * @syscap SystemCapability.Applications.ContactsData + * @since 10 + */ + function queryGroups(context: Context, holder: Holder, callback: AsyncCallback>): void; + /** + * Queries contact groups by contact holder. + * + * @permission ohos.permission.READ_CONTACTS + * @param { Holder } holder - Indicates the contact holder. + * If this parameter is null, the default holder is used for matching. + * @returns { Promise> } Returns the contact group list object. + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + * @deprecated since 10 + * @useinstead contact.queryGroups#queryGroups + */ + function queryGroups(holder?: Holder): Promise>; + /** + * Queries contact groups by contact holder. + * + * @permission ohos.permission.READ_CONTACTS + * @param { Context } context - Indicates the context of application or capability. + * @param { Holder } holder - Indicates the contact holder. + * If this parameter is null, the default holder is used for matching. + * @returns { Promise> } Returns the contact group list object. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Parameter error. + * @syscap SystemCapability.Applications.ContactsData + * @since 10 + */ + function queryGroups(context: Context, holder?: Holder): Promise>; + /** + * Queries contact holders. + * + * @permission ohos.permission.READ_CONTACTS + * @param { AsyncCallback> } callback - Returns the {@code Holder} list object. + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + * @deprecated since 10 + * @useinstead contact.queryHolders#queryHolders + */ + function queryHolders(callback: AsyncCallback>): void; + /** + * Queries contact holders. + * + * @permission ohos.permission.READ_CONTACTS + * @param { Context } context - Indicates the context of application or capability. + * @param { AsyncCallback> } callback - Returns the {@code Holder} list object. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Parameter error. + * @syscap SystemCapability.Applications.ContactsData + * @since 10 + */ + function queryHolders(context: Context, callback: AsyncCallback>): void; + /** + * Queries contact holders. + * + * @permission ohos.permission.READ_CONTACTS + * @returns { Promise> } Returns the {@code Holder} list object. + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + * @deprecated since 10 + * @useinstead contact.queryHolders#queryHolders + */ + function queryHolders(): Promise>; + /** + * Queries contact holders. + * + * @permission ohos.permission.READ_CONTACTS + * @param { Context } context - Indicates the context of application or capability. + * @returns { Promise> } Returns the {@code Holder} list object. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Parameter error. + * @syscap SystemCapability.Applications.ContactsData + * @since 10 + */ + function queryHolders(context: Context): Promise>; + /** + * Obtains the query key of a contact based on a specified ID. + * + * @permission ohos.permission.READ_CONTACTS + * @param { number } id - Indicates the contact ID. + * @param { AsyncCallback } callback - Returns the query key of the contact. + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + * @deprecated since 10 + * @useinstead contact.queryKey#queryKey + */ + function queryKey(id: number, callback: AsyncCallback): void; + /** + * Obtains the query key of a contact based on a specified ID. + * + * @permission ohos.permission.READ_CONTACTS + * @param { Context } context - Indicates the context of application or capability. + * @param { number } id - Indicates the contact ID. + * @param { AsyncCallback } callback - Returns the query key of the contact. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Parameter error. + * @syscap SystemCapability.Applications.ContactsData + * @since 10 + */ + function queryKey(context: Context, id: number, callback: AsyncCallback): void; + /** + * Obtains the query key of a contact based on a specified ID and holder. + * + * @permission ohos.permission.READ_CONTACTS + * @param { number } id - Indicates the contact ID. + * @param { Holder } holder - Indicates the contact holder. + * If this parameter is null, the default holder is used for matching. + * @param { AsyncCallback } callback - Returns the query key of the contact. + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + * @deprecated since 10 + * @useinstead contact.queryKey#queryKey + */ + function queryKey(id: number, holder: Holder, callback: AsyncCallback): void; + /** + * Obtains the query key of a contact based on a specified ID and holder. + * + * @permission ohos.permission.READ_CONTACTS + * @param { Context } context - Indicates the context of application or capability. + * @param { number } id - Indicates the contact ID. + * @param { Holder } holder - Indicates the contact holder. + * If this parameter is null, the default holder is used for matching. + * @param { AsyncCallback } callback - Returns the query key of the contact. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Parameter error. + * @syscap SystemCapability.Applications.ContactsData + * @since 10 + */ + function queryKey(context: Context, id: number, holder: Holder, callback: AsyncCallback): void; + /** + * Obtains the query key of a contact based on a specified ID and holder. + * + * @permission ohos.permission.READ_CONTACTS + * @param { number } id - Indicates the contact ID. + * @param { Holder } holder - Indicates the contact holder. + * If this parameter is null, the default holder is used for matching. + * @returns { Promise } Returns the query key of the contact. + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + * @deprecated since 10 + * @useinstead contact.queryKey#queryKey + */ + function queryKey(id: number, holder?: Holder): Promise; + /** + * Obtains the query key of a contact based on a specified ID and holder. + * + * @permission ohos.permission.READ_CONTACTS + * @param { Context } context - Indicates the context of application or capability. + * @param { number } id - Indicates the contact ID. + * @param { Holder } holder - Indicates the contact holder. + * If this parameter is null, the default holder is used for matching. + * @returns { Promise } Returns the query key of the contact. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Parameter error. + * @syscap SystemCapability.Applications.ContactsData + * @since 10 + */ + function queryKey(context: Context, id: number, holder?: Holder): Promise; + /** + * Queries information about "my card". + * + * @permission ohos.permission.READ_CONTACTS + * @param { AsyncCallback } callback - Returns information about "my card". + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + * @deprecated since 10 + * @useinstead contact.queryMyCard#queryMyCard + */ + function queryMyCard(callback: AsyncCallback): void; + /** + * Queries information about "my card". + * + * @permission ohos.permission.READ_CONTACTS + * @param { Context } context - Indicates the context of application or capability. + * @param { AsyncCallback } callback - Returns information about "my card". + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Parameter error. + * @syscap SystemCapability.Applications.ContactsData + * @since 10 + */ + function queryMyCard(context: Context, callback: AsyncCallback): void; + /** + * Queries information about "my card". + * + * @permission ohos.permission.READ_CONTACTS + * @param { ContactAttributes } attrs - Indicates the contact attribute. + * If this parameter is null, all attributes are used for matching. + * @param { AsyncCallback } callback - Returns information about "my card". + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + * @deprecated since 10 + * @useinstead contact.queryMyCard#queryMyCard + */ + function queryMyCard(attrs: ContactAttributes, callback: AsyncCallback): void; + /** + * Queries information about "my card". + * + * @permission ohos.permission.READ_CONTACTS + * @param { Context } context - Indicates the context of application or capability. + * @param { ContactAttributes } attrs - Indicates the contact attribute. + * If this parameter is null, all attributes are used for matching. + * @param { AsyncCallback } callback - Returns information about "my card". + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Parameter error. + * @syscap SystemCapability.Applications.ContactsData + * @since 10 + */ + function queryMyCard(context: Context, attrs: ContactAttributes, callback: AsyncCallback): void; + /** + * Queries information about "my card". + * + * @permission ohos.permission.READ_CONTACTS + * @param { ContactAttributes } attrs - Indicates the contact attribute. + * If this parameter is null, all attributes are used for matching. + * @returns { Promise } Returns information about "my card". + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + * @deprecated since 10 + * @useinstead contact.queryMyCard#queryMyCard + */ + function queryMyCard(attrs?: ContactAttributes): Promise; + /** + * Queries information about "my card". + * + * @permission ohos.permission.READ_CONTACTS + * @param { Context } context - Indicates the context of application or capability. + * @param { ContactAttributes } attrs - Indicates the contact attribute. + * If this parameter is null, all attributes are used for matching. + * @returns { Promise } Returns information about "my card". + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Parameter error. + * @syscap SystemCapability.Applications.ContactsData + * @since 10 + */ + function queryMyCard(context: Context, attrs?: ContactAttributes): Promise; + /** + * Updates specified attributes of a contact. + * + * @permission ohos.permission.WRITE_CONTACTS + * @param { Contact } contact - Indicates the contact whose information is to update. + * @param { AsyncCallback } callback - The callback of updateContact. + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + * @deprecated since 10 + * @useinstead contact.updateContact#updateContact + */ + function updateContact(contact: Contact, callback: AsyncCallback): void; + /** + * Updates specified attributes of a contact. + * + * @permission ohos.permission.WRITE_CONTACTS + * @param { Context } context - Indicates the context of application or capability. + * @param { Contact } contact - Indicates the contact whose information is to update. + * @param { AsyncCallback } callback - The callback of updateContact. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Parameter error. + * @syscap SystemCapability.Applications.ContactsData + * @since 10 + */ + function updateContact(context: Context, contact: Contact, callback: AsyncCallback): void; + /** + * Updates specified attributes of a contact. + * + * @permission ohos.permission.WRITE_CONTACTS + * @param { Contact } contact - Indicates the contact whose information is to update. + * @param { ContactAttributes } attrs - Indicates the contact attribute. + * If this parameter is null, all attributes are used for matching. + * @param { AsyncCallback } callback - The callback of updateContact. + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + * @deprecated since 10 + * @useinstead contact.updateContact#updateContact + */ + function updateContact(contact: Contact, attrs: ContactAttributes, callback: AsyncCallback): void; + /** + * Updates specified attributes of a contact. + * + * @permission ohos.permission.WRITE_CONTACTS + * @param { Context } context - Indicates the context of application or capability. + * @param { Contact } contact - Indicates the contact whose information is to update. + * @param { ContactAttributes } attrs - Indicates the contact attribute. + * If this parameter is null, all attributes are used for matching. + * @param { AsyncCallback } callback - The callback of updateContact. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Parameter error. + * @syscap SystemCapability.Applications.ContactsData + * @since 10 + */ + function updateContact(context: Context, contact: Contact, attrs: ContactAttributes, callback: AsyncCallback): void; + /** + * Updates specified attributes of a contact. + * + * @permission ohos.permission.WRITE_CONTACTS + * @param { Contact } contact - Indicates the contact whose information is to update. + * @param { ContactAttributes } attrs - Indicates the contact attribute. + * If this parameter is null, all attributes are used for matching. + * @returns { Promise } The promise returned by the function. + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + * @deprecated since 10 + * @useinstead contact.updateContact#updateContact + */ + function updateContact(contact: Contact, attrs?: ContactAttributes): Promise; + /** + * Updates specified attributes of a contact. + * + * @permission ohos.permission.WRITE_CONTACTS + * @param { Context } context - Indicates the context of application or capability. + * @param { Contact } contact - Indicates the contact whose information is to update. + * @param { ContactAttributes } attrs - Indicates the contact attribute. + * If this parameter is null, all attributes are used for matching. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Parameter error. + * @syscap SystemCapability.Applications.ContactsData + * @since 10 + */ + function updateContact(context: Context, contact: Contact, attrs?: ContactAttributes): Promise; + /** + * Checks whether the contact ID is in the local phone book. + * + * @permission ohos.permission.READ_CONTACTS + * @param { number } id - Indicates the contact ID. + * @param { AsyncCallback } callback - The callback of isLocalContact. + * Returns {@code true} if the contact ID is in the local phone book; returns {@code false} otherwise. + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + * @deprecated since 10 + * @useinstead contact.isLocalContact#isLocalContact + */ + function isLocalContact(id: number, callback: AsyncCallback): void; + /** + * Checks whether the contact ID is in the local phone book. + * + * @permission ohos.permission.READ_CONTACTS + * @param { Context } context - Indicates the context of application or capability. + * @param { number } id - Indicates the contact ID. + * @param { AsyncCallback } callback - The callback of isLocalContact. + * Returns {@code true} if the contact ID is in the local phone book; returns {@code false} otherwise. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Parameter error. + * @syscap SystemCapability.Applications.ContactsData + * @since 10 + */ + function isLocalContact(context: Context, id: number, callback: AsyncCallback): void; + /** + * Checks whether the contact ID is in the local phone book. + * + * @permission ohos.permission.READ_CONTACTS + * @param { number } id - Indicates the contact ID. + * @returns { Promise } Returns {@code true} if the contact ID is in the local phone book, + * returns {@code false} otherwise. + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + * @deprecated since 10 + * @useinstead contact.isLocalContact#isLocalContact + */ + function isLocalContact(id: number): Promise; + /** + * Checks whether the contact ID is in the local phone book. + * + * @permission ohos.permission.READ_CONTACTS + * @param { Context } context - Indicates the context of application or capability. + * @param { number } id - Indicates the contact ID. + * @returns { Promise } Returns {@code true} if the contact ID is in the local phone book, + * returns {@code false} otherwise. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Parameter error. + * @syscap SystemCapability.Applications.ContactsData + * @since 10 + */ + function isLocalContact(context: Context, id: number): Promise; + /** + * Checks whether the contact ID is of "my card". + * + * @permission ohos.permission.READ_CONTACTS + * @param { number } id - Indicates the contact ID. + * @param { AsyncCallback } callback - The callback of isMyCard. + * Returns {@code true} if the contact ID is of "my card"; returns {@code false} otherwise. + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + * @deprecated since 10 + * @useinstead contact.deleteContact#deleteContact + */ + function isMyCard(id: number, callback: AsyncCallback): void; + /** + * Checks whether the contact ID is of "my card". + * + * @permission ohos.permission.READ_CONTACTS + * @param { Context } context - Indicates the context of application or capability. + * @param { number } id - Indicates the contact ID. + * @param { AsyncCallback } callback - The callback of isMyCard. + * Returns {@code true} if the contact ID is of "my card"; returns {@code false} otherwise. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Parameter error. + * @syscap SystemCapability.Applications.ContactsData + * @since 10 + */ + function isMyCard(context: Context, id: number, callback: AsyncCallback): void; + /** + * Checks whether the contact ID is of "my card". + * + * @permission ohos.permission.READ_CONTACTS + * @param { number } id - Indicates the contact ID. + * @returns { Promise } Returns true if the contact ID is of "my card", returns false otherwise. + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + * @deprecated since 10 + * @useinstead contact.isMyCard#isMyCard + */ + function isMyCard(id: number): Promise; + /** + * Checks whether the contact ID is of "my card". + * + * @permission ohos.permission.READ_CONTACTS + * @param { Context } context - Indicates the context of application or capability. + * @param { number } id - Indicates the contact ID. + * @returns { Promise } Returns true if the contact ID is of "my card", returns false otherwise. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Parameter error. + * @syscap SystemCapability.Applications.ContactsData + * @since 10 + */ + function isMyCard(context: Context, id: number): Promise; + /** + * ContactSelectionOptions Object + * + * @interface ContactSelectionOptions + * @syscap SystemCapability.Applications.Contacts + * @since 10 + */ + /** + * ContactSelectionOptions Object + * + * @interface ContactSelectionOptions + * @syscap SystemCapability.Applications.Contacts + * @atomicservice + * @since 11 + */ + interface ContactSelectionOptions { + /** + * Indicates the Single-select or multiple-select. + * + * @type { ?boolean } + * @syscap SystemCapability.Applications.Contacts + * @since 10 + */ + /** + * Indicates the Single-select or multiple-select. + * + * @type { ?boolean } + * @syscap SystemCapability.Applications.Contacts + * @atomicservice + * @since 11 + */ + isMultiSelect?: boolean; + } + /** + * Provides methods for contact information + * + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + */ + /** + * Provides methods for contact information + * + * @syscap SystemCapability.Applications.ContactsData + * @atomicservice + * @since 11 + */ + class Contact { + /** + * Indicates the contact invalid ID. + * + * @readonly + * @static + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + */ + /** + * Indicates the contact invalid ID. + * + * @readonly + * @static + * @syscap SystemCapability.Applications.ContactsData + * @atomicservice + * @since 11 + */ + static readonly INVALID_CONTACT_ID: -1; + /** + * Indicates the contact ID. + * + * @type { ?number } + * @readonly + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + */ + /** + * Indicates the contact ID. + * + * @type { ?number } + * @readonly + * @syscap SystemCapability.Applications.ContactsData + * @atomicservice + * @since 11 + */ + readonly id?: number; + /** + * Indicates the query key that identifies the contact. + * + * @type { ?string } + * @readonly + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + */ + /** + * Indicates the query key that identifies the contact. + * + * @type { ?string } + * @readonly + * @syscap SystemCapability.Applications.ContactsData + * @atomicservice + * @since 11 + */ + readonly key?: string; + /** + * Indicates the contact attributes. + * + * @type { ?ContactAttributes } + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + */ + /** + * Indicates the contact attributes. + * + * @type { ?ContactAttributes } + * @syscap SystemCapability.Applications.ContactsData + * @atomicservice + * @since 11 + */ + contactAttributes?: ContactAttributes; + /** + * Indicates list of contact email addresses. + * + * @type { ?Email[] } + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + */ + /** + * Indicates list of contact email addresses. + * + * @type { ?Email[] } + * @syscap SystemCapability.Applications.ContactsData + * @atomicservice + * @since 11 + */ + emails?: Email[]; + /** + * Indicates an event (special date) of the contact. + * + * @type { ?Event[] } + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + */ + /** + * Indicates an event (special date) of the contact. + * + * @type { ?Event[] } + * @syscap SystemCapability.Applications.ContactsData + * @atomicservice + * @since 11 + */ + events?: Event[]; + /** + * Indicates a group of the contact. + * + * @type { ?Group[] } + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + */ + /** + * Indicates a group of the contact. + * + * @type { ?Group[] } + * @syscap SystemCapability.Applications.ContactsData + * @atomicservice + * @since 11 + */ + groups?: Group[]; + /** + * Indicates an IM address of the contact. + * + * @type { ?ImAddress[] } + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + */ + /** + * Indicates an IM address of the contact. + * + * @type { ?ImAddress[] } + * @syscap SystemCapability.Applications.ContactsData + * @atomicservice + * @since 11 + */ + imAddresses?: ImAddress[]; + /** + * Indicates a phone number of the contact. + * + * @type { ?PhoneNumber[] } + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + */ + /** + * Indicates a phone number of the contact. + * + * @type { ?PhoneNumber[] } + * @syscap SystemCapability.Applications.ContactsData + * @atomicservice + * @since 11 + */ + phoneNumbers?: PhoneNumber[]; + /** + * Indicates the contact portrait. + * + * @type { ?Portrait } + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + */ + /** + * Indicates the contact portrait. + * + * @type { ?Portrait } + * @syscap SystemCapability.Applications.ContactsData + * @atomicservice + * @since 11 + */ + portrait?: Portrait; + /** + * Indicates a postal address of the contact. + * + * @type { ?PostalAddress[] } + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + */ + /** + * Indicates a postal address of the contact. + * + * @type { ?PostalAddress[] } + * @syscap SystemCapability.Applications.ContactsData + * @atomicservice + * @since 11 + */ + postalAddresses?: PostalAddress[]; + /** + * Indicates a relation of the contact. + * + * @type { ?Relation[] } + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + */ + /** + * Indicates a relation of the contact. + * + * @type { ?Relation[] } + * @syscap SystemCapability.Applications.ContactsData + * @atomicservice + * @since 11 + */ + relations?: Relation[]; + /** + * Indicates a Session Initiation Protocol (SIP) address of the contact. + * + * @type { ?SipAddress[] } + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + */ + /** + * Indicates a Session Initiation Protocol (SIP) address of the contact. + * + * @type { ?SipAddress[] } + * @syscap SystemCapability.Applications.ContactsData + * @atomicservice + * @since 11 + */ + sipAddresses?: SipAddress[]; + /** + * Indicates a website of the contact. + * + * @type { ?Website[] } + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + */ + /** + * Indicates a website of the contact. + * + * @type { ?Website[] } + * @syscap SystemCapability.Applications.ContactsData + * @atomicservice + * @since 11 + */ + websites?: Website[]; + /** + * Indicates the contact name. + * + * @type { ?Name } + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + */ + /** + * Indicates the contact name. + * + * @type { ?Name } + * @syscap SystemCapability.Applications.ContactsData + * @atomicservice + * @since 11 + */ + name?: Name; + /** + * Indicates the contact nickname. + * + * @type { ?NickName } + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + */ + /** + * Indicates the contact nickname. + * + * @type { ?NickName } + * @syscap SystemCapability.Applications.ContactsData + * @atomicservice + * @since 11 + */ + nickName?: NickName; + /** + * Indicates the contact note. + * + * @type { ?Note } + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + */ + /** + * Indicates the contact note. + * + * @type { ?Note } + * @syscap SystemCapability.Applications.ContactsData + * @atomicservice + * @since 11 + */ + note?: Note; + /** + * Indicates organization information about the contact. + * + * @type { ?Organization } + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + */ + /** + * Indicates organization information about the contact. + * + * @type { ?Organization } + * @syscap SystemCapability.Applications.ContactsData + * @atomicservice + * @since 11 + */ + organization?: Organization; + } + /** + * Provides methods for contact attributes information + * + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + */ + /** + * Provides methods for contact attributes information + * + * @syscap SystemCapability.Applications.ContactsData + * @atomicservice + * @since 11 + */ + class ContactAttributes { + /** + * Indicates the contact attributes. + * + * @type { Attribute[] } + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + */ + /** + * Indicates the contact attributes. + * + * @type { Attribute[] } + * @syscap SystemCapability.Applications.ContactsData + * @atomicservice + * @since 11 + */ + attributes: Attribute[]; + } + /** + * Provides methods for attribute information + * + * @enum { number } + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + */ + /** + * Provides methods for attribute information + * + * @enum { number } + * @syscap SystemCapability.Applications.ContactsData + * @atomicservice + * @since 11 + */ + enum Attribute { + /** + * Indicates the contact event. + * + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + */ + /** + * Indicates the contact event. + * + * @syscap SystemCapability.Applications.ContactsData + * @atomicservice + * @since 11 + */ + ATTR_CONTACT_EVENT, + /** + * Indicates the email address. + * + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + */ + /** + * Indicates the email address. + * + * @syscap SystemCapability.Applications.ContactsData + * @atomicservice + * @since 11 + */ + ATTR_EMAIL, + /** + * Indicates the contact group. + * + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + */ + /** + * Indicates the contact group. + * + * @syscap SystemCapability.Applications.ContactsData + * @atomicservice + * @since 11 + */ + ATTR_GROUP_MEMBERSHIP, + /** + * Indicates the instant messaging (IM) address. + * + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + */ + /** + * Indicates the instant messaging (IM) address. + * + * @syscap SystemCapability.Applications.ContactsData + * @atomicservice + * @since 11 + */ + ATTR_IM, + /** + * Indicates the name. + * + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + */ + /** + * Indicates the name. + * + * @syscap SystemCapability.Applications.ContactsData + * @atomicservice + * @since 11 + */ + ATTR_NAME, + /** + * Indicates the nickname. + * + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + */ + /** + * Indicates the nickname. + * + * @syscap SystemCapability.Applications.ContactsData + * @atomicservice + * @since 11 + */ + ATTR_NICKNAME, + /** + * Indicates the note. + * + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + */ + /** + * Indicates the note. + * + * @syscap SystemCapability.Applications.ContactsData + * @atomicservice + * @since 11 + */ + ATTR_NOTE, + /** + * Indicates the organization. + * + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + */ + /** + * Indicates the organization. + * + * @syscap SystemCapability.Applications.ContactsData + * @atomicservice + * @since 11 + */ + ATTR_ORGANIZATION, + /** + * Indicates the phone number. + * + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + */ + /** + * Indicates the phone number. + * + * @syscap SystemCapability.Applications.ContactsData + * @atomicservice + * @since 11 + */ + ATTR_PHONE, + /** + * Indicates the portrait. + * + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + */ + /** + * Indicates the portrait. + * + * @syscap SystemCapability.Applications.ContactsData + * @atomicservice + * @since 11 + */ + ATTR_PORTRAIT, + /** + * Indicates the postal address. + * + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + */ + /** + * Indicates the postal address. + * + * @syscap SystemCapability.Applications.ContactsData + * @atomicservice + * @since 11 + */ + ATTR_POSTAL_ADDRESS, + /** + * Indicates the relation. + * + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + */ + /** + * Indicates the relation. + * + * @syscap SystemCapability.Applications.ContactsData + * @atomicservice + * @since 11 + */ + ATTR_RELATION, + /** + * Indicates the Session Initiation Protocol (SIP) address. + * + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + */ + /** + * Indicates the Session Initiation Protocol (SIP) address. + * + * @syscap SystemCapability.Applications.ContactsData + * @atomicservice + * @since 11 + */ + ATTR_SIP_ADDRESS, + /** + * Indicates the website. + * + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + */ + /** + * Indicates the website. + * + * @syscap SystemCapability.Applications.ContactsData + * @atomicservice + * @since 11 + */ + ATTR_WEBSITE + } + /** + * Provides methods for email information + * + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + */ + /** + * Provides methods for email information + * + * @syscap SystemCapability.Applications.ContactsData + * @atomicservice + * @since 11 + */ + class Email { + /** + * Indicates a custom label. + * + * @readonly + * @static + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + */ + /** + * Indicates a custom label. + * + * @readonly + * @static + * @syscap SystemCapability.Applications.ContactsData + * @atomicservice + * @since 11 + */ + static readonly CUSTOM_LABEL: 0; + /** + * Indicates a home email. + * + * @readonly + * @static + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + */ + /** + * Indicates a home email. + * + * @readonly + * @static + * @syscap SystemCapability.Applications.ContactsData + * @atomicservice + * @since 11 + */ + static readonly EMAIL_HOME: 1; + /** + * Indicates a work email. + * + * @readonly + * @static + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + */ + /** + * Indicates a work email. + * + * @readonly + * @static + * @syscap SystemCapability.Applications.ContactsData + * @atomicservice + * @since 11 + */ + static readonly EMAIL_WORK: 2; + /** + * Indicates an email of the OTHER type. + * + * @readonly + * @static + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + */ + /** + * Indicates an email of the OTHER type. + * + * @readonly + * @static + * @syscap SystemCapability.Applications.ContactsData + * @atomicservice + * @since 11 + */ + static readonly EMAIL_OTHER: 3; + /** + * Indicates an invalid label ID. + * + * @readonly + * @static + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + */ + /** + * Indicates an invalid label ID. + * + * @readonly + * @static + * @syscap SystemCapability.Applications.ContactsData + * @atomicservice + * @since 11 + */ + static readonly INVALID_LABEL_ID: -1; + /** + * Indicates the email address. + * + * @type { string } + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + */ + /** + * Indicates the email address. + * + * @type { string } + * @syscap SystemCapability.Applications.ContactsData + * @atomicservice + * @since 11 + */ + email: string; + /** + * Indicates the label name of an attribute. + * + * @type { ?string } + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + */ + /** + * Indicates the label name of an attribute. + * + * @type { ?string } + * @syscap SystemCapability.Applications.ContactsData + * @atomicservice + * @since 11 + */ + labelName?: string; + /** + * Indicates the displayed email name. + * + * @type { ?string } + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + */ + /** + * Indicates the displayed email name. + * + * @type { ?string } + * @syscap SystemCapability.Applications.ContactsData + * @atomicservice + * @since 11 + */ + displayName?: string; + /** + * Indicates the label id. + * + * @type { ?number } + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + */ + /** + * Indicates the label id. + * + * @type { ?number } + * @syscap SystemCapability.Applications.ContactsData + * @atomicservice + * @since 11 + */ + labelId?: number; + } + /** + * Provides methods for event information + * + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + */ + /** + * Provides methods for event information + * + * @syscap SystemCapability.Applications.ContactsData + * @atomicservice + * @since 11 + */ + class Event { + /** + * Indicates a custom label. + * + * @readonly + * @static + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + */ + /** + * Indicates a custom label. + * + * @readonly + * @static + * @syscap SystemCapability.Applications.ContactsData + * @atomicservice + * @since 11 + */ + static readonly CUSTOM_LABEL: 0; + /** + * Indicates an anniversary event. + * + * @readonly + * @static + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + */ + /** + * Indicates an anniversary event. + * + * @readonly + * @static + * @syscap SystemCapability.Applications.ContactsData + * @atomicservice + * @since 11 + */ + static readonly EVENT_ANNIVERSARY: 1; + /** + * Indicates an event of the OTHER type. + * + * @readonly + * @static + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + */ + /** + * Indicates an event of the OTHER type. + * + * @readonly + * @static + * @syscap SystemCapability.Applications.ContactsData + * @atomicservice + * @since 11 + */ + static readonly EVENT_OTHER: 2; + /** + * Indicates an birthday event. + * + * @readonly + * @static + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + */ + /** + * Indicates an birthday event. + * + * @readonly + * @static + * @syscap SystemCapability.Applications.ContactsData + * @atomicservice + * @since 11 + */ + static readonly EVENT_BIRTHDAY: 3; + /** + * Indicates an invalid label ID. + * + * @readonly + * @static + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + */ + /** + * Indicates an invalid label ID. + * + * @readonly + * @static + * @syscap SystemCapability.Applications.ContactsData + * @atomicservice + * @since 11 + */ + static readonly INVALID_LABEL_ID: -1; + /** + * Indicates the event date. + * + * @type { string } + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + */ + /** + * Indicates the event date. + * + * @type { string } + * @syscap SystemCapability.Applications.ContactsData + * @atomicservice + * @since 11 + */ + eventDate: string; + /** + * Indicates the label name of an attribute. + * + * @type { ?string } + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + */ + /** + * Indicates the label name of an attribute. + * + * @type { ?string } + * @syscap SystemCapability.Applications.ContactsData + * @atomicservice + * @since 11 + */ + labelName?: string; + /** + * Indicates the label id. + * + * @type { ?number } + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + */ + /** + * Indicates the label id. + * + * @type { ?number } + * @syscap SystemCapability.Applications.ContactsData + * @atomicservice + * @since 11 + */ + labelId?: number; + } + /** + * Provides methods for group information + * + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + */ + /** + * Provides methods for group information + * + * @syscap SystemCapability.Applications.ContactsData + * @atomicservice + * @since 11 + */ + class Group { + /** + * Indicates the contact group ID. + * + * @type { ?number } + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + */ + /** + * Indicates the contact group ID. + * + * @type { ?number } + * @syscap SystemCapability.Applications.ContactsData + * @atomicservice + * @since 11 + */ + groupId?: number; + /** + * Indicates the contact group title. + * + * @type { string } + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + */ + /** + * Indicates the contact group title. + * + * @type { string } + * @syscap SystemCapability.Applications.ContactsData + * @atomicservice + * @since 11 + */ + title: string; + } + /** + * Provides methods for holder information + * + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + */ + class Holder { + /** + * Indicates the bundle name of a contact holder. + * + * @type { string } + * @readonly + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + */ + readonly bundleName: string; + /** + * Indicates the displayed name of a contact holder. + * + * @type { ?string } + * @readonly + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + */ + readonly displayName?: string; + /** + * Indicates the holder ID. + * + * @type { ?number } + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + */ + holderId?: number; + } + /** + * Provides methods for ImAddress information + * + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + */ + /** + * Provides methods for ImAddress information + * + * @syscap SystemCapability.Applications.ContactsData + * @atomicservice + * @since 11 + */ + class ImAddress { + /** + * Indicates a custom label. + * + * @readonly + * @static + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + */ + /** + * Indicates a custom label. + * + * @readonly + * @static + * @syscap SystemCapability.Applications.ContactsData + * @atomicservice + * @since 11 + */ + static readonly CUSTOM_LABEL: -1; + /** + * Indicates an AIM instant message. + * + * @readonly + * @static + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + */ + /** + * Indicates an AIM instant message. + * + * @readonly + * @static + * @syscap SystemCapability.Applications.ContactsData + * @atomicservice + * @since 11 + */ + static readonly IM_AIM: 0; + /** + * Indicates a Windows Live instant message. + * + * @readonly + * @static + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + */ + /** + * Indicates a Windows Live instant message. + * + * @readonly + * @static + * @syscap SystemCapability.Applications.ContactsData + * @atomicservice + * @since 11 + */ + static readonly IM_MSN: 1; + /** + * Indicates a Yahoo instant message. + * + * @readonly + * @static + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + */ + /** + * Indicates a Yahoo instant message. + * + * @readonly + * @static + * @syscap SystemCapability.Applications.ContactsData + * @atomicservice + * @since 11 + */ + static readonly IM_YAHOO: 2; + /** + * Indicates a Skype instant message. + * + * @readonly + * @static + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + */ + /** + * Indicates a Skype instant message. + * + * @readonly + * @static + * @syscap SystemCapability.Applications.ContactsData + * @atomicservice + * @since 11 + */ + static readonly IM_SKYPE: 3; + /** + * Indicates a QQ instant message. + * + * @readonly + * @static + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + */ + /** + * Indicates a QQ instant message. + * + * @readonly + * @static + * @syscap SystemCapability.Applications.ContactsData + * @atomicservice + * @since 11 + */ + static readonly IM_QQ: 4; + /** + * Indicates an ICQ instant message. + * + * @readonly + * @static + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + */ + /** + * Indicates an ICQ instant message. + * + * @readonly + * @static + * @syscap SystemCapability.Applications.ContactsData + * @atomicservice + * @since 11 + */ + static readonly IM_ICQ: 6; + /** + * Indicates a Jabber instant message. + * + * @readonly + * @static + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + */ + /** + * Indicates a Jabber instant message. + * + * @readonly + * @static + * @syscap SystemCapability.Applications.ContactsData + * @atomicservice + * @since 11 + */ + static readonly IM_JABBER: 7; + /** + * Indicates an invalid label ID. + * + * @readonly + * @static + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + */ + /** + * Indicates an invalid label ID. + * + * @readonly + * @static + * @syscap SystemCapability.Applications.ContactsData + * @atomicservice + * @since 11 + */ + static readonly INVALID_LABEL_ID: -2; + /** + * Indicates the IM address. + * + * @type { string } + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + */ + /** + * Indicates the IM address. + * + * @type { string } + * @syscap SystemCapability.Applications.ContactsData + * @atomicservice + * @since 11 + */ + imAddress: string; + /** + * Indicates the label name of an attribute. + * + * @type { ?string } + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + */ + /** + * Indicates the label name of an attribute. + * + * @type { ?string } + * @syscap SystemCapability.Applications.ContactsData + * @atomicservice + * @since 11 + */ + labelName?: string; + /** + * Indicates the label id. + * + * @type { ?number } + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + */ + /** + * Indicates the label id. + * + * @type { ?number } + * @syscap SystemCapability.Applications.ContactsData + * @atomicservice + * @since 11 + */ + labelId?: number; + } + /** + * Provides methods for name information + * + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + */ + /** + * Provides methods for name information + * + * @syscap SystemCapability.Applications.ContactsData + * @atomicservice + * @since 11 + */ + class Name { + /** + * Indicates the family name of the contact. + * + * @type { ?string } + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + */ + /** + * Indicates the family name of the contact. + * + * @type { ?string } + * @syscap SystemCapability.Applications.ContactsData + * @atomicservice + * @since 11 + */ + familyName?: string; + /** + * Indicates the phonetic family name of the contact. + * + * @type { ?string } + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + */ + /** + * Indicates the phonetic family name of the contact. + * + * @type { ?string } + * @syscap SystemCapability.Applications.ContactsData + * @atomicservice + * @since 11 + */ + familyNamePhonetic?: string; + /** + * Indicates the full name of the contact. + * + * @type { string } + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + */ + /** + * Indicates the full name of the contact. + * + * @type { string } + * @syscap SystemCapability.Applications.ContactsData + * @atomicservice + * @since 11 + */ + fullName: string; + /** + * Indicates the given name of the contact. + * + * @type { ?string } + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + */ + /** + * Indicates the given name of the contact. + * + * @type { ?string } + * @syscap SystemCapability.Applications.ContactsData + * @atomicservice + * @since 11 + */ + givenName?: string; + /** + * Indicates the phonetic given name of the contact. + * + * @type { ?string } + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + */ + /** + * Indicates the phonetic given name of the contact. + * + * @type { ?string } + * @syscap SystemCapability.Applications.ContactsData + * @atomicservice + * @since 11 + */ + givenNamePhonetic?: string; + /** + * Indicates the middle name of the contact. + * + * @type { ?string } + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + */ + /** + * Indicates the middle name of the contact. + * + * @type { ?string } + * @syscap SystemCapability.Applications.ContactsData + * @atomicservice + * @since 11 + */ + middleName?: string; + /** + * Indicates the phonetic middle name of the contact. + * + * @type { ?string } + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + */ + /** + * Indicates the phonetic middle name of the contact. + * + * @type { ?string } + * @syscap SystemCapability.Applications.ContactsData + * @atomicservice + * @since 11 + */ + middleNamePhonetic?: string; + /** + * Indicates the prefix of the contact name. + * + * @type { ?string } + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + */ + /** + * Indicates the prefix of the contact name. + * + * @type { ?string } + * @syscap SystemCapability.Applications.ContactsData + * @atomicservice + * @since 11 + */ + namePrefix?: string; + /** + * Indicates the suffix of this contact name. + * + * @type { ?string } + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + */ + /** + * Indicates the suffix of this contact name. + * + * @type { ?string } + * @syscap SystemCapability.Applications.ContactsData + * @atomicservice + * @since 11 + */ + nameSuffix?: string; + } + /** + * Provides methods for nick name information + * + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + */ + /** + * Provides methods for nick name information + * + * @syscap SystemCapability.Applications.ContactsData + * @atomicservice + * @since 11 + */ + class NickName { + /** + * Indicates the nickname of the contact. + * + * @type { string } + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + */ + /** + * Indicates the nickname of the contact. + * + * @type { string } + * @syscap SystemCapability.Applications.ContactsData + * @atomicservice + * @since 11 + */ + nickName: string; + } + /** + * Provides methods for note information + * + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + */ + /** + * Provides methods for note information + * + * @syscap SystemCapability.Applications.ContactsData + * @atomicservice + * @since 11 + */ + class Note { + /** + * Indicates the note content. + * + * @type { string } + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + */ + /** + * Indicates the note content. + * + * @type { string } + * @syscap SystemCapability.Applications.ContactsData + * @atomicservice + * @since 11 + */ + noteContent: string; + } + /** + * Provides methods for organization information + * + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + */ + /** + * Provides methods for organization information + * + * @syscap SystemCapability.Applications.ContactsData + * @atomicservice + * @since 11 + */ + class Organization { + /** + * Indicates the name of the organization to which the contact belongs. + * + * @type { string } + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + */ + /** + * Indicates the name of the organization to which the contact belongs. + * + * @type { string } + * @syscap SystemCapability.Applications.ContactsData + * @atomicservice + * @since 11 + */ + name: string; + /** + * Indicates the title of the organization. + * + * @type { ?string } + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + */ + /** + * Indicates the title of the organization. + * + * @type { ?string } + * @syscap SystemCapability.Applications.ContactsData + * @atomicservice + * @since 11 + */ + title?: string; + } + /** + * Provides methods for phone number information + * + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + */ + /** + * Provides methods for phone number information + * + * @syscap SystemCapability.Applications.ContactsData + * @atomicservice + * @since 11 + */ + class PhoneNumber { + /** + * Indicates a custom label. + * + * @readonly + * @static + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + */ + /** + * Indicates a custom label. + * + * @readonly + * @static + * @syscap SystemCapability.Applications.ContactsData + * @atomicservice + * @since 11 + */ + static readonly CUSTOM_LABEL: 0; + /** + * Indicates a home number. + * + * @readonly + * @static + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + */ + /** + * Indicates a home number. + * + * @readonly + * @static + * @syscap SystemCapability.Applications.ContactsData + * @atomicservice + * @since 11 + */ + static readonly NUM_HOME: 1; + /** + * Indicates a mobile phone number. + * + * @readonly + * @static + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + */ + /** + * Indicates a mobile phone number. + * + * @readonly + * @static + * @syscap SystemCapability.Applications.ContactsData + * @atomicservice + * @since 11 + */ + static readonly NUM_MOBILE: 2; + /** + * Indicates a work number. + * + * @readonly + * @static + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + */ + /** + * Indicates a work number. + * + * @readonly + * @static + * @syscap SystemCapability.Applications.ContactsData + * @atomicservice + * @since 11 + */ + static readonly NUM_WORK: 3; + /** + * Indicates a work fax number. + * + * @readonly + * @static + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + */ + /** + * Indicates a work fax number. + * + * @readonly + * @static + * @syscap SystemCapability.Applications.ContactsData + * @atomicservice + * @since 11 + */ + static readonly NUM_FAX_WORK: 4; + /** + * Indicates a home fax number. + * + * @readonly + * @static + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + */ + /** + * Indicates a home fax number. + * + * @readonly + * @static + * @syscap SystemCapability.Applications.ContactsData + * @atomicservice + * @since 11 + */ + static readonly NUM_FAX_HOME: 5; + /** + * Indicates a pager number. + * + * @readonly + * @static + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + */ + /** + * Indicates a pager number. + * + * @readonly + * @static + * @syscap SystemCapability.Applications.ContactsData + * @atomicservice + * @since 11 + */ + static readonly NUM_PAGER: 6; + /** + * Indicates a number of the OTHER type. + * + * @readonly + * @static + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + */ + /** + * Indicates a number of the OTHER type. + * + * @readonly + * @static + * @syscap SystemCapability.Applications.ContactsData + * @atomicservice + * @since 11 + */ + static readonly NUM_OTHER: 7; + /** + * Indicates a callback number. + * + * @readonly + * @static + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + */ + /** + * Indicates a callback number. + * + * @readonly + * @static + * @syscap SystemCapability.Applications.ContactsData + * @atomicservice + * @since 11 + */ + static readonly NUM_CALLBACK: 8; + /** + * Indicates a car number. + * + * @readonly + * @static + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + */ + /** + * Indicates a car number. + * + * @readonly + * @static + * @syscap SystemCapability.Applications.ContactsData + * @atomicservice + * @since 11 + */ + static readonly NUM_CAR: 9; + /** + * Indicates a company director number. + * + * @readonly + * @static + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + */ + /** + * Indicates a company director number. + * + * @readonly + * @static + * @syscap SystemCapability.Applications.ContactsData + * @atomicservice + * @since 11 + */ + static readonly NUM_COMPANY_MAIN: 10; + /** + * Indicates an Integrated Services Digital Network (ISDN) number. + * + * @readonly + * @static + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + */ + /** + * Indicates an Integrated Services Digital Network (ISDN) number. + * + * @readonly + * @static + * @syscap SystemCapability.Applications.ContactsData + * @atomicservice + * @since 11 + */ + static readonly NUM_ISDN: 11; + /** + * Indicates a main number. + * + * @readonly + * @static + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + */ + /** + * Indicates a main number. + * + * @readonly + * @static + * @syscap SystemCapability.Applications.ContactsData + * @atomicservice + * @since 11 + */ + static readonly NUM_MAIN: 12; + /** + * Indicates a number of the OTHER_FAX type. + * + * @readonly + * @static + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + */ + /** + * Indicates a number of the OTHER_FAX type. + * + * @readonly + * @static + * @syscap SystemCapability.Applications.ContactsData + * @atomicservice + * @since 11 + */ + static readonly NUM_OTHER_FAX: 13; + /** + * Indicates a radio number. + * + * @readonly + * @static + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + */ + /** + * Indicates a radio number. + * + * @readonly + * @static + * @syscap SystemCapability.Applications.ContactsData + * @atomicservice + * @since 11 + */ + static readonly NUM_RADIO: 14; + /** + * Indicates a telex number. + * + * @readonly + * @static + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + */ + /** + * Indicates a telex number. + * + * @readonly + * @static + * @syscap SystemCapability.Applications.ContactsData + * @atomicservice + * @since 11 + */ + static readonly NUM_TELEX: 15; + /** + * Indicates a teletypewriter (TTY) or test-driven development (TDD) number. + * + * @readonly + * @static + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + */ + /** + * Indicates a teletypewriter (TTY) or test-driven development (TDD) number. + * + * @readonly + * @static + * @syscap SystemCapability.Applications.ContactsData + * @atomicservice + * @since 11 + */ + static readonly NUM_TTY_TDD: 16; + /** + * Indicates a work mobile phone number. + * + * @readonly + * @static + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + */ + /** + * Indicates a work mobile phone number. + * + * @readonly + * @static + * @syscap SystemCapability.Applications.ContactsData + * @atomicservice + * @since 11 + */ + static readonly NUM_WORK_MOBILE: 17; + /** + * Indicates a work pager number. + * + * @readonly + * @static + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + */ + /** + * Indicates a work pager number. + * + * @readonly + * @static + * @syscap SystemCapability.Applications.ContactsData + * @atomicservice + * @since 11 + */ + static readonly NUM_WORK_PAGER: 18; + /** + * Indicates an assistant number. + * + * @readonly + * @static + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + */ + /** + * Indicates an assistant number. + * + * @readonly + * @static + * @syscap SystemCapability.Applications.ContactsData + * @atomicservice + * @since 11 + */ + static readonly NUM_ASSISTANT: 19; + /** + * Indicates an MMS number. + * + * @readonly + * @static + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + */ + /** + * Indicates an MMS number. + * + * @readonly + * @static + * @syscap SystemCapability.Applications.ContactsData + * @atomicservice + * @since 11 + */ + static readonly NUM_MMS: 20; + /** + * Indicates an invalid label ID. + * + * @readonly + * @static + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + */ + /** + * Indicates an invalid label ID. + * + * @readonly + * @static + * @syscap SystemCapability.Applications.ContactsData + * @atomicservice + * @since 11 + */ + static readonly INVALID_LABEL_ID: -1; + /** + * Indicates the label name of an attribute. + * + * @type { ?string } + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + */ + /** + * Indicates the label name of an attribute. + * + * @type { ?string } + * @syscap SystemCapability.Applications.ContactsData + * @atomicservice + * @since 11 + */ + labelName?: string; + /** + * Indicates the phone number of the contact. + * + * @type { string } + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + */ + /** + * Indicates the phone number of the contact. + * + * @type { string } + * @syscap SystemCapability.Applications.ContactsData + * @atomicservice + * @since 11 + */ + phoneNumber: string; + /** + * Indicates the label id. + * + * @type { ?number } + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + */ + /** + * Indicates the label id. + * + * @type { ?number } + * @syscap SystemCapability.Applications.ContactsData + * @atomicservice + * @since 11 + */ + labelId?: number; + } + /** + * Provides methods for portrait information + * + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + */ + /** + * Provides methods for portrait information + * + * @syscap SystemCapability.Applications.ContactsData + * @atomicservice + * @since 11 + */ + class Portrait { + /** + * Indicates the uri of the contact portrait. + * + * @type { string } + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + */ + /** + * Indicates the uri of the contact portrait. + * + * @type { string } + * @syscap SystemCapability.Applications.ContactsData + * @atomicservice + * @since 11 + */ + uri: string; + } + /** + * Provides methods for postal address information + * + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + */ + /** + * Provides methods for postal address information + * + * @syscap SystemCapability.Applications.ContactsData + * @atomicservice + * @since 11 + */ + class PostalAddress { + /** + * Indicates a custom label. + * + * @readonly + * @static + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + */ + /** + * Indicates a custom label. + * + * @readonly + * @static + * @syscap SystemCapability.Applications.ContactsData + * @atomicservice + * @since 11 + */ + static readonly CUSTOM_LABEL: 0; + /** + * Indicates a home address. + * + * @readonly + * @static + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + */ + /** + * Indicates a home address. + * + * @readonly + * @static + * @syscap SystemCapability.Applications.ContactsData + * @atomicservice + * @since 11 + */ + static readonly ADDR_HOME: 1; + /** + * Indicates a work address. + * + * @readonly + * @static + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + */ + /** + * Indicates a work address. + * + * @readonly + * @static + * @syscap SystemCapability.Applications.ContactsData + * @atomicservice + * @since 11 + */ + static readonly ADDR_WORK: 2; + /** + * Indicates an address of the OTHER type. + * + * @readonly + * @static + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + */ + /** + * Indicates an address of the OTHER type. + * + * @readonly + * @static + * @syscap SystemCapability.Applications.ContactsData + * @atomicservice + * @since 11 + */ + static readonly ADDR_OTHER: 3; + /** + * Indicates an invalid label ID. + * + * @readonly + * @static + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + */ + /** + * Indicates an invalid label ID. + * + * @readonly + * @static + * @syscap SystemCapability.Applications.ContactsData + * @atomicservice + * @since 11 + */ + static readonly INVALID_LABEL_ID: -1; + /** + * Indicates the city where this contact is located. + * + * @type { ?string } + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + */ + /** + * Indicates the city where this contact is located. + * + * @type { ?string } + * @syscap SystemCapability.Applications.ContactsData + * @atomicservice + * @since 11 + */ + city?: string; + /** + * Indicates the country/region where this contact is located. + * + * @type { ?string } + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + */ + /** + * Indicates the country/region where this contact is located. + * + * @type { ?string } + * @syscap SystemCapability.Applications.ContactsData + * @atomicservice + * @since 11 + */ + country?: string; + /** + * Indicates the label name of an attribute. + * + * @type { ?string } + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + */ + /** + * Indicates the label name of an attribute. + * + * @type { ?string } + * @syscap SystemCapability.Applications.ContactsData + * @atomicservice + * @since 11 + */ + labelName?: string; + /** + * Indicates the neighborhood where this contact is located. + * + * @type { ?string } + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + */ + /** + * Indicates the neighborhood where this contact is located. + * + * @type { ?string } + * @syscap SystemCapability.Applications.ContactsData + * @atomicservice + * @since 11 + */ + neighborhood?: string; + /** + * Indicates the post box of this contact. + * + * @type { ?string } + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + */ + /** + * Indicates the post box of this contact. + * + * @type { ?string } + * @syscap SystemCapability.Applications.ContactsData + * @atomicservice + * @since 11 + */ + pobox?: string; + /** + * Indicates the postal address of this contact. + * + * @type { string } + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + */ + /** + * Indicates the postal address of this contact. + * + * @type { string } + * @syscap SystemCapability.Applications.ContactsData + * @atomicservice + * @since 11 + */ + postalAddress: string; + /** + * Indicates the postal code of this contact. + * + * @type { ?string } + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + */ + /** + * Indicates the postal code of this contact. + * + * @type { ?string } + * @syscap SystemCapability.Applications.ContactsData + * @atomicservice + * @since 11 + */ + postcode?: string; + /** + * Indicates the area where this contact is located. + * + * @type { ?string } + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + */ + /** + * Indicates the area where this contact is located. + * + * @type { ?string } + * @syscap SystemCapability.Applications.ContactsData + * @atomicservice + * @since 11 + */ + region?: string; + /** + * Indicates the street where this contact is located. + * + * @type { ?string } + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + */ + /** + * Indicates the street where this contact is located. + * + * @type { ?string } + * @syscap SystemCapability.Applications.ContactsData + * @atomicservice + * @since 11 + */ + street?: string; + /** + * Indicates the label id. + * + * @type { ?number } + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + */ + /** + * Indicates the label id. + * + * @type { ?number } + * @syscap SystemCapability.Applications.ContactsData + * @atomicservice + * @since 11 + */ + labelId?: number; + } + /** + * Provides methods for relation information + * + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + */ + /** + * Provides methods for relation information + * + * @syscap SystemCapability.Applications.ContactsData + * @atomicservice + * @since 11 + */ + class Relation { + /** + * Indicates custom relationship type. + * + * @readonly + * @static + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + */ + /** + * Indicates custom relationship type. + * + * @readonly + * @static + * @syscap SystemCapability.Applications.ContactsData + * @atomicservice + * @since 11 + */ + static readonly CUSTOM_LABEL: 0; + /** + * Indicates assistant relationship type. + * + * @readonly + * @static + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + */ + /** + * Indicates assistant relationship type. + * + * @readonly + * @static + * @syscap SystemCapability.Applications.ContactsData + * @atomicservice + * @since 11 + */ + static readonly RELATION_ASSISTANT: 1; + /** + * Indicates brother relationship type. + * + * @readonly + * @static + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + */ + /** + * Indicates brother relationship type. + * + * @readonly + * @static + * @syscap SystemCapability.Applications.ContactsData + * @atomicservice + * @since 11 + */ + static readonly RELATION_BROTHER: 2; + /** + * Indicates child relationship type. + * + * @readonly + * @static + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + */ + /** + * Indicates child relationship type. + * + * @readonly + * @static + * @syscap SystemCapability.Applications.ContactsData + * @atomicservice + * @since 11 + */ + static readonly RELATION_CHILD: 3; + /** + * Indicates domestic partner relationship type. + * + * @readonly + * @static + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + */ + /** + * Indicates domestic partner relationship type. + * + * @readonly + * @static + * @syscap SystemCapability.Applications.ContactsData + * @atomicservice + * @since 11 + */ + static readonly RELATION_DOMESTIC_PARTNER: 4; + /** + * Indicates father relationship type. + * + * @readonly + * @static + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + */ + /** + * Indicates father relationship type. + * + * @readonly + * @static + * @syscap SystemCapability.Applications.ContactsData + * @atomicservice + * @since 11 + */ + static readonly RELATION_FATHER: 5; + /** + * Indicates friend relationship type. + * + * @readonly + * @static + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + */ + /** + * Indicates friend relationship type. + * + * @readonly + * @static + * @syscap SystemCapability.Applications.ContactsData + * @atomicservice + * @since 11 + */ + static readonly RELATION_FRIEND: 6; + /** + * Indicates manager relationship type. + * + * @readonly + * @static + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + */ + /** + * Indicates manager relationship type. + * + * @readonly + * @static + * @syscap SystemCapability.Applications.ContactsData + * @atomicservice + * @since 11 + */ + static readonly RELATION_MANAGER: 7; + /** + * Indicates mother relationship type. + * + * @readonly + * @static + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + */ + /** + * Indicates mother relationship type. + * + * @readonly + * @static + * @syscap SystemCapability.Applications.ContactsData + * @atomicservice + * @since 11 + */ + static readonly RELATION_MOTHER: 8; + /** + * Indicates parent relationship type. + * + * @readonly + * @static + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + */ + /** + * Indicates parent relationship type. + * + * @readonly + * @static + * @syscap SystemCapability.Applications.ContactsData + * @atomicservice + * @since 11 + */ + static readonly RELATION_PARENT: 9; + /** + * Indicates partner relationship type. + * + * @readonly + * @static + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + */ + /** + * Indicates partner relationship type. + * + * @readonly + * @static + * @syscap SystemCapability.Applications.ContactsData + * @atomicservice + * @since 11 + */ + static readonly RELATION_PARTNER: 10; + /** + * Indicates referrer relationship type. + * + * @readonly + * @static + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + */ + /** + * Indicates referrer relationship type. + * + * @readonly + * @static + * @syscap SystemCapability.Applications.ContactsData + * @atomicservice + * @since 11 + */ + static readonly RELATION_REFERRED_BY: 11; + /** + * Indicates relative relationship type. + * + * @readonly + * @static + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + */ + /** + * Indicates relative relationship type. + * + * @readonly + * @static + * @syscap SystemCapability.Applications.ContactsData + * @atomicservice + * @since 11 + */ + static readonly RELATION_RELATIVE: 12; + /** + * Indicates sister relationship type. + * + * @readonly + * @static + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + */ + /** + * Indicates sister relationship type. + * + * @readonly + * @static + * @syscap SystemCapability.Applications.ContactsData + * @atomicservice + * @since 11 + */ + static readonly RELATION_SISTER: 13; + /** + * Indicates spouse relationship type. + * + * @readonly + * @static + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + */ + /** + * Indicates spouse relationship type. + * + * @readonly + * @static + * @syscap SystemCapability.Applications.ContactsData + * @atomicservice + * @since 11 + */ + static readonly RELATION_SPOUSE: 14; + /** + * Indicates invalid relationship type. + * + * @readonly + * @static + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + */ + /** + * Indicates invalid relationship type. + * + * @readonly + * @static + * @syscap SystemCapability.Applications.ContactsData + * @atomicservice + * @since 11 + */ + static readonly INVALID_LABEL_ID: -1; + /** + * Indicates the label name of an attribute. + * + * @type { ?string } + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + */ + /** + * Indicates the label name of an attribute. + * + * @type { ?string } + * @syscap SystemCapability.Applications.ContactsData + * @atomicservice + * @since 11 + */ + labelName?: string; + /** + * Indicates the relation name. + * + * @type { string } + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + */ + /** + * Indicates the relation name. + * + * @type { string } + * @syscap SystemCapability.Applications.ContactsData + * @atomicservice + * @since 11 + */ + relationName: string; + /** + * Indicates the label id. + * + * @type { ?number } + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + */ + /** + * Indicates the label id. + * + * @type { ?number } + * @syscap SystemCapability.Applications.ContactsData + * @atomicservice + * @since 11 + */ + labelId?: number; + } + /** + * Provides methods for sip address information + * + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + */ + /** + * Provides methods for sip address information + * + * @syscap SystemCapability.Applications.ContactsData + * @atomicservice + * @since 11 + */ + class SipAddress { + /** + * Indicates a custom label. + * + * @readonly + * @static + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + */ + /** + * Indicates a custom label. + * + * @readonly + * @static + * @syscap SystemCapability.Applications.ContactsData + * @atomicservice + * @since 11 + */ + static readonly CUSTOM_LABEL: 0; + /** + * Indicates a home SIP address. + * + * @readonly + * @static + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + */ + /** + * Indicates a home SIP address. + * + * @readonly + * @static + * @syscap SystemCapability.Applications.ContactsData + * @atomicservice + * @since 11 + */ + static readonly SIP_HOME: 1; + /** + * Indicates a work SIP address. + * + * @readonly + * @static + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + */ + /** + * Indicates a work SIP address. + * + * @readonly + * @static + * @syscap SystemCapability.Applications.ContactsData + * @atomicservice + * @since 11 + */ + static readonly SIP_WORK: 2; + /** + * Indicates an SIP address of the OTHER type. + * + * @readonly + * @static + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + */ + /** + * Indicates an SIP address of the OTHER type. + * + * @readonly + * @static + * @syscap SystemCapability.Applications.ContactsData + * @atomicservice + * @since 11 + */ + static readonly SIP_OTHER: 3; + /** + * Indicates an invalid label ID. + * + * @readonly + * @static + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + */ + /** + * Indicates an invalid label ID. + * + * @readonly + * @static + * @syscap SystemCapability.Applications.ContactsData + * @atomicservice + * @since 11 + */ + static readonly INVALID_LABEL_ID: -1; + /** + * Indicates the label name of an attribute. + * + * @type { ?string } + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + */ + /** + * Indicates the label name of an attribute. + * + * @type { ?string } + * @syscap SystemCapability.Applications.ContactsData + * @atomicservice + * @since 11 + */ + labelName?: string; + /** + * Indicates the SIP address. + * + * @type { string } + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + */ + /** + * Indicates the SIP address. + * + * @type { string } + * @syscap SystemCapability.Applications.ContactsData + * @atomicservice + * @since 11 + */ + sipAddress: string; + /** + * Indicates the label id. + * + * @type { ?number } + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + */ + /** + * Indicates the label id. + * + * @type { ?number } + * @syscap SystemCapability.Applications.ContactsData + * @atomicservice + * @since 11 + */ + labelId?: number; + } + /** + * Provides methods for website information + * + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + */ + /** + * Provides methods for website information + * + * @syscap SystemCapability.Applications.ContactsData + * @atomicservice + * @since 11 + */ + class Website { + /** + * Indicates the website. + * + * @type { string } + * @syscap SystemCapability.Applications.ContactsData + * @since 7 + */ + /** + * Indicates the website. + * + * @type { string } + * @syscap SystemCapability.Applications.ContactsData + * @atomicservice + * @since 11 + */ + website: string; + } +} +export default contact; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.continuation.continuationManager.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.continuation.continuationManager.d.ts new file mode 100755 index 00000000..c6f90a4f --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.continuation.continuationManager.d.ts @@ -0,0 +1,832 @@ +/* + * Copyright (c) 2022-2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"), + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit AbilityKit + */ +import { Callback } from './@ohos.base'; +import { AsyncCallback } from './@ohos.base'; +import type { ContinuationResult as _ContinuationResult } from './continuation/continuationResult'; +import type { ContinuationExtraParams as _ContinuationExtraParams } from './continuation/continuationExtraParams'; +/** + * Provides methods for interacting with the continuation manager service, including methods for registering and + * Unregister the ability to hop, updating the device connection state, and showing the list of devices + * that can be selected for hopping. + * + * @namespace continuationManager + * @syscap SystemCapability.Ability.DistributedAbilityManager + * @since 8 + */ +/** + * Provides methods for interacting with the continuation manager service, including methods for registering and + * Unregister the ability to hop, updating the device connection state, and showing the list of devices + * that can be selected for hopping. + * + * @namespace continuationManager + * @syscap SystemCapability.Ability.DistributedAbilityManager + * @atomicservice + * @since 11 + */ +declare namespace continuationManager { + /** + * Called when the user selects devices from the candidate device list. + * You can implement your own processing logic in this callback to initiate the hop process. + * + * @permission ohos.permission.DISTRIBUTED_DATASYNC + * @param { 'deviceSelected' } type - deviceSelected. + * @param { number } token - Registered token. + * @param { Callback> } callback - Called when the user selects a device from the device + * selection module, returning the device ID,device type, + * and device name for developers to use + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - The parameter check failed. + * @throws { BusinessError } 16600001 - The system ability works abnormally. + * @throws { BusinessError } 16600002 - The specified token or callback is not registered. + * @throws { BusinessError } 16600004 - The specified callback has been registered. + * @syscap SystemCapability.Ability.DistributedAbilityManager + * @since 9 + */ + /** + * Called when the user selects devices from the candidate device list. + * You can implement your own processing logic in this callback to initiate the hop process. + * + * @permission ohos.permission.DISTRIBUTED_DATASYNC + * @param { 'deviceSelected' } type - deviceSelected. + * @param { number } token - Registered token. + * @param { Callback> } callback - Called when the user selects a device from the device + * selection module, returning the device ID,device type, + * and device name for developers to use + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - The parameter check failed. + * @throws { BusinessError } 16600001 - The system ability works abnormally. + * @throws { BusinessError } 16600002 - The specified token or callback is not registered. + * @throws { BusinessError } 16600004 - The specified callback has been registered. + * @syscap SystemCapability.Ability.DistributedAbilityManager + * @atomicservice + * @since 11 + */ + function on(type: 'deviceSelected', token: number, callback: Callback>): void; + /** + * Called when devices are disconnected from the continuation manager service. + * You can implement your own processing logic in this callback, such as notifying the user of the disconnection. + * + * @permission ohos.permission.DISTRIBUTED_DATASYNC + * @param { 'deviceSelected' } type - deviceSelected. + * @param { number } token - Registered token. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - The parameter check failed. + * @throws { BusinessError } 16600001 - The system ability works abnormally. + * @throws { BusinessError } 16600002 - The specified token or callback is not registered. + * @throws { BusinessError } 16600004 - The specified callback has been registered. + * @syscap SystemCapability.Ability.DistributedAbilityManager + * @since 9 + */ + /** + * Called when devices are disconnected from the continuation manager service. + * You can implement your own processing logic in this callback, such as notifying the user of the disconnection. + * + * @permission ohos.permission.DISTRIBUTED_DATASYNC + * @param { 'deviceSelected' } type - deviceSelected. + * @param { number } token - Registered token. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - The parameter check failed. + * @throws { BusinessError } 16600001 - The system ability works abnormally. + * @throws { BusinessError } 16600002 - The specified token or callback is not registered. + * @throws { BusinessError } 16600004 - The specified callback has been registered. + * @syscap SystemCapability.Ability.DistributedAbilityManager + * @atomicservice + * @since 11 + */ + function off(type: 'deviceSelected', token: number): void; + /** + * Called when devices are disconnected from the continuation manager service. + * You can implement your own processing logic in this callback, such as notifying the user of the disconnection. + * + * @permission ohos.permission.DISTRIBUTED_DATASYNC + * @param { 'deviceUnselected' } type - deviceUnselected. + * @param { number } token - Registered token. + * @param { Callback> } callback - Called when the user disconnects the device from the + * device selection module, returning the device ID, + * device type, and device name for developers to use + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - The parameter check failed. + * @throws { BusinessError } 16600001 - The system ability works abnormally. + * @throws { BusinessError } 16600002 - The specified token or callback is not registered. + * @throws { BusinessError } 16600004 - The specified callback has been registered. + * @syscap SystemCapability.Ability.DistributedAbilityManager + * @since 9 + */ + /** + * Called when devices are disconnected from the continuation manager service. + * You can implement your own processing logic in this callback, such as notifying the user of the disconnection. + * + * @permission ohos.permission.DISTRIBUTED_DATASYNC + * @param { 'deviceUnselected' } type - deviceUnselected. + * @param { number } token - Registered token. + * @param { Callback> } callback - Called when the user disconnects the device from the + * device selection module, returning the device ID, + * device type, and device name for developers to use + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - The parameter check failed. + * @throws { BusinessError } 16600001 - The system ability works abnormally. + * @throws { BusinessError } 16600002 - The specified token or callback is not registered. + * @throws { BusinessError } 16600004 - The specified callback has been registered. + * @syscap SystemCapability.Ability.DistributedAbilityManager + * @atomicservice + * @since 11 + */ + function on(type: 'deviceUnselected', token: number, callback: Callback>): void; + /** + * Called when devices are disconnected from the continuation manager service. + * You can implement your own processing logic in this callback, such as notifying the user of the disconnection. + * + * @permission ohos.permission.DISTRIBUTED_DATASYNC + * @param { 'deviceUnselected' } type - deviceUnselected. + * @param { number } token - Registered token. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - The parameter check failed. + * @throws { BusinessError } 16600001 - The system ability works abnormally. + * @throws { BusinessError } 16600002 - The specified token or callback is not registered. + * @throws { BusinessError } 16600004 - The specified callback has been registered. + * @syscap SystemCapability.Ability.DistributedAbilityManager + * @since 9 + */ + /** + * Called when devices are disconnected from the continuation manager service. + * You can implement your own processing logic in this callback, such as notifying the user of the disconnection. + * + * @permission ohos.permission.DISTRIBUTED_DATASYNC + * @param { 'deviceUnselected' } type - deviceUnselected. + * @param { number } token - Registered token. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - The parameter check failed. + * @throws { BusinessError } 16600001 - The system ability works abnormally. + * @throws { BusinessError } 16600002 - The specified token or callback is not registered. + * @throws { BusinessError } 16600004 - The specified callback has been registered. + * @syscap SystemCapability.Ability.DistributedAbilityManager + * @atomicservice + * @since 11 + */ + function off(type: 'deviceUnselected', token: number): void; + /** + * Called when the user selects a device from the candidate device list. + * You can implement your own processing logic in this callback to initiate the hop process. + * + * @param { 'deviceConnect' } type - deviceConnect. + * @param { Callback } callback - Called when the user selects a device from the device selection + * module, returning the device ID,device type, and device name for + * developers to use. + * @syscap SystemCapability.Ability.DistributedAbilityManager + * @since 8 + * @deprecated since 9 + * @useinstead ohos.continuation.continuationManager/continuationManager#on + */ + function on(type: 'deviceConnect', callback: Callback): void; + /** + * Called when the user selects a device from the candidate device list. + * You can implement your own processing logic in this callback to initiate the hop process. + * + * @param { 'deviceConnect' } type - deviceConnect. + * @param { Callback } [callback] - Called when the user selects a device from the device + * selection module, returning the device ID,device type, + * and device name for developers to use. + * @syscap SystemCapability.Ability.DistributedAbilityManager + * @since 8 + * @deprecated since 9 + * @useinstead ohos.continuation.continuationManager/continuationManager#off + */ + function off(type: 'deviceConnect', callback?: Callback): void; + /** + * Called when a device is disconnected from the continuation manager service. + * You can implement your own processing logic in this callback, such as notifying the user of the disconnection. + * + * @param { 'deviceDisconnect' } type - deviceDisconnect. + * @param { Callback } callback - Called when the user disconnects the device from the device selection + * module, returning the device ID for developers to use. + * @syscap SystemCapability.Ability.DistributedAbilityManager + * @since 8 + * @deprecated since 9 + * @useinstead ohos.continuation.continuationManager/continuationManager#on + */ + function on(type: 'deviceDisconnect', callback: Callback): void; + /** + * Called when a device is disconnected from the continuation manager service. + * You can implement your own processing logic in this callback, such as notifying the user of the disconnection. + * + * @param { 'deviceDisconnect' } type - deviceDisconnect. + * @param { Callback } [callback] - Called when the user selects a device from the device selection module, + * returning the device ID,device type, and device name for developers to use. + * @syscap SystemCapability.Ability.DistributedAbilityManager + * @since 8 + * @deprecated since 9 + * @useinstead ohos.continuation.continuationManager/continuationManager#off + */ + function off(type: 'deviceDisconnect', callback?: Callback): void; + /** + * Registers an ability to be hopped with the continuation manager service and obtains the registration token + * assigned to the ability. + * + * @param { AsyncCallback } callback - The AsyncCallback form returns the token generated after connecting to + * the flow management service. + * @syscap SystemCapability.Ability.DistributedAbilityManager + * @since 8 + * @deprecated since 9 + * @useinstead ohos.continuation.continuationManager/continuationManager#registerContinuation + */ + function register(callback: AsyncCallback): void; + /** + * Registers an ability to be hopped with the continuation manager service and obtains the registration token + * assigned to the ability. + * + * @param { ContinuationExtraParams } options - Indicates the {@link ExtraParams} object containing the extra + * parameters used to filter the list of available devices. + * @param { AsyncCallback } callback - The AsyncCallback form returns the token generated after + * connecting to the flow management service. + * @syscap SystemCapability.Ability.DistributedAbilityManager + * @since 8 + * @deprecated since 9 + * @useinstead ohos.continuation.continuationManager/continuationManager#registerContinuation + */ + function register(options: ContinuationExtraParams, callback: AsyncCallback): void; + /** + * Registers an ability to be hopped with the continuation manager service and obtains the registration token + * assigned to the ability. + * + * @param { ContinuationExtraParams } [options] - Indicates the {@link ExtraParams} object containing the extra + * parameters used to filter the list of available devices. + * @returns { Promise } callback Indicates the callback to be invoked when the continuation manager service + * is connected. + * @syscap SystemCapability.Ability.DistributedAbilityManager + * @since 8 + * @deprecated since 9 + * @useinstead ohos.continuation.continuationManager/continuationManager#registerContinuation + */ + function register(options?: ContinuationExtraParams): Promise; + /** + * Unregisters a specified ability from the continuation manager service based on the token obtained during ability + * registration. + * + * @param { number } token - Indicates the registration token of the ability. + * @param { AsyncCallback } callback - AsyncCallback returns the interface call result. + * @syscap SystemCapability.Ability.DistributedAbilityManager + * @since 8 + * @deprecated since 9 + * @useinstead ohos.continuation.continuationManager/continuationManager#unregisterContinuation + */ + function unregister(token: number, callback: AsyncCallback): void; + /** + * Unregisters a specified ability from the continuation manager service based on the token obtained during ability + * registration. + * + * @param { number } token - Indicates the registration token of the ability. + * @returns { Promise } callback Indicates the callback to be invoked when the continuation manager + * service is connected. + * @syscap SystemCapability.Ability.DistributedAbilityManager + * @since 8 + * @deprecated since 9 + * @useinstead ohos.continuation.continuationManager/continuationManager#unregisterContinuation + */ + function unregister(token: number): Promise; + /** + * Updates the connection state of the device where the specified ability is successfully hopped. + * + * @param { number } token - Indicates the registration token of the ability. + * @param { string } deviceId - Indicates the ID of the device whose connection state is to be updated. + * @param { DeviceConnectState } status - Indicates the connection state to update. + * @param { AsyncCallback } callback - AsyncCallback returns the interface call result. + * @syscap SystemCapability.Ability.DistributedAbilityManager + * @since 8 + * @deprecated since 9 + * @useinstead ohos.continuation.continuationManager/continuationManager#updateContinuationState + */ + function updateConnectStatus(token: number, deviceId: string, status: DeviceConnectState, callback: AsyncCallback): void; + /** + * Updates the connection state of the device where the specified ability is successfully hopped. + * + * @param { number } token - Indicates the registration token of the ability. + * @param { string } deviceId - Indicates the ID of the device whose connection state is to be updated. + * @param { DeviceConnectState } status - Indicates the connection state to update. + * @returns { Promise } callback Indicates the callback to be invoked when the continuation + * manager service is connected. + * @syscap SystemCapability.Ability.DistributedAbilityManager + * @since 8 + * @deprecated since 9 + * @useinstead ohos.continuation.continuationManager/continuationManager#updateContinuationState + */ + function updateConnectStatus(token: number, deviceId: string, status: DeviceConnectState): Promise; + /** + * Start to manage the devices that can be selected for continuation. + * + * @param { number } token - Indicates the registration token of the ability. + * @param { AsyncCallback } callback - AsyncCallback returns the interface call result. + * @syscap SystemCapability.Ability.DistributedAbilityManager + * @since 8 + * @deprecated since 9 + * @useinstead ohos.continuation.continuationManager/continuationManager#startContinuationDeviceManager + */ + function startDeviceManager(token: number, callback: AsyncCallback): void; + /** + * Start to manage the devices that can be selected for continuation. + * + * @param { number } token - Indicates the registration token of the ability. + * @param { ContinuationExtraParams } options - Indicates the extraParams object containing the extra parameters + * used to filter the list of available devices. This parameter is null. + * @param { AsyncCallback } callback - AsyncCallback returns the interface call result. + * @syscap SystemCapability.Ability.DistributedAbilityManager + * @since 8 + * @deprecated since 9 + * @useinstead ohos.continuation.continuationManager/continuationManager#startContinuationDeviceManager + */ + function startDeviceManager(token: number, options: ContinuationExtraParams, callback: AsyncCallback): void; + /** + * Start to manage the devices that can be selected for continuation. + * + * @param { number } token - Indicates the registration token of the ability. + * @param { ContinuationExtraParams } [options] - Indicates the extraParams object containing the extra parameters + * used to filter the list of available devices. This parameter is null. + * @returns { Promise } callback Indicates the callback to be invoked when the continuation manager service + * is connected. + * @syscap SystemCapability.Ability.DistributedAbilityManager + * @since 8 + * @deprecated since 9 + * @useinstead ohos.continuation.continuationManager/continuationManager#startContinuationDeviceManager + */ + function startDeviceManager(token: number, options?: ContinuationExtraParams): Promise; + /** + * Registers an ability to be hopped with the continuation manager service and obtains the registration token + * assigned to the ability. + * + * @permission ohos.permission.DISTRIBUTED_DATASYNC + * @param { AsyncCallback } callback - The AsyncCallback form returns the token generated after connecting to + * the flow management service. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - The parameter check failed. + * @throws { BusinessError } 16600001 - The system ability works abnormally. + * @throws { BusinessError } 16600003 - The number of token registration times has reached the upper limit. + * @syscap SystemCapability.Ability.DistributedAbilityManager + * @since 9 + */ + /** + * Registers an ability to be hopped with the continuation manager service and obtains the registration token + * assigned to the ability. + * + * @permission ohos.permission.DISTRIBUTED_DATASYNC + * @param { AsyncCallback } callback - The AsyncCallback form returns the token generated after connecting to + * the flow management service. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - The parameter check failed. + * @throws { BusinessError } 16600001 - The system ability works abnormally. + * @throws { BusinessError } 16600003 - The number of token registration times has reached the upper limit. + * @syscap SystemCapability.Ability.DistributedAbilityManager + * @atomicservice + * @since 11 + */ + function registerContinuation(callback: AsyncCallback): void; + /** + * Registers an ability to be hopped with the continuation manager service and obtains the registration token + * assigned to the ability. + * + * @permission ohos.permission.DISTRIBUTED_DATASYNC + * @param { ContinuationExtraParams } options - Indicates the {@link ExtraParams} object containing extra parameters + * used to filter the list of available devices. + * @param { AsyncCallback } callback - The AsyncCallback form returns the token generated after connecting to + * flow management service. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - The parameter check failed. + * @throws { BusinessError } 16600001 - The system ability works abnormally. + * @throws { BusinessError } 16600003 - The number of token registration times has reached the upper limit. + * @syscap SystemCapability.Ability.DistributedAbilityManager + * @since 9 + */ + /** + * Registers an ability to be hopped with the continuation manager service and obtains the registration token + * assigned to the ability. + * + * @permission ohos.permission.DISTRIBUTED_DATASYNC + * @param { ContinuationExtraParams } options - Indicates the {@link ExtraParams} object containing extra parameters + * used to filter the list of available devices. + * @param { AsyncCallback } callback - The AsyncCallback form returns the token generated after connecting to + * flow management service. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - The parameter check failed. + * @throws { BusinessError } 16600001 - The system ability works abnormally. + * @throws { BusinessError } 16600003 - The number of token registration times has reached the upper limit. + * @syscap SystemCapability.Ability.DistributedAbilityManager + * @atomicservice + * @since 11 + */ + function registerContinuation(options: ContinuationExtraParams, callback: AsyncCallback): void; + /** + * Registers an ability to be hopped with the continuation manager service and obtains the registration token + * assigned to the ability. + * + * @permission ohos.permission.DISTRIBUTED_DATASYNC + * @param { ContinuationExtraParams } [options] - Indicates the {@link ExtraParams} object containing the extra + * parameters used to filter the list of available devices. + * @returns { Promise } callback Indicates the callback to be invoked when the continuation manager + * service is connected. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - The parameter check failed. + * @throws { BusinessError } 16600001 - The system ability works abnormally. + * @throws { BusinessError } 16600003 - The number of token registration times has reached the upper limit. + * @syscap SystemCapability.Ability.DistributedAbilityManager + * @since 9 + */ + /** + * Registers an ability to be hopped with the continuation manager service and obtains the registration token + * assigned to the ability. + * + * @permission ohos.permission.DISTRIBUTED_DATASYNC + * @param { ContinuationExtraParams } [options] - Indicates the {@link ExtraParams} object containing the extra + * parameters used to filter the list of available devices. + * @returns { Promise } callback Indicates the callback to be invoked when the continuation manager + * service is connected. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - The parameter check failed. + * @throws { BusinessError } 16600001 - The system ability works abnormally. + * @throws { BusinessError } 16600003 - The number of token registration times has reached the upper limit. + * @syscap SystemCapability.Ability.DistributedAbilityManager + * @atomicservice + * @since 11 + */ + function registerContinuation(options?: ContinuationExtraParams): Promise; + /** + * Unregisters a specified ability from the continuation manager service based on the token obtained during ability + * registration. + * + * @permission ohos.permission.DISTRIBUTED_DATASYNC + * @param { number } token - Indicates the registration token of the ability. + * @param { AsyncCallback } callback - The AsyncCallback form returns token generated after connecting to flow + * management service. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - The parameter check failed. + * @throws { BusinessError } 16600001 - The system ability works abnormally. + * @throws { BusinessError } 16600002 - The specified token or callback is not registered. + * @syscap SystemCapability.Ability.DistributedAbilityManager + * @since 9 + */ + /** + * Unregisters a specified ability from the continuation manager service based on the token obtained during ability + * registration. + * + * @permission ohos.permission.DISTRIBUTED_DATASYNC + * @param { number } token - Indicates the registration token of the ability. + * @param { AsyncCallback } callback - The AsyncCallback form returns token generated after connecting to flow + * management service. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - The parameter check failed. + * @throws { BusinessError } 16600001 - The system ability works abnormally. + * @throws { BusinessError } 16600002 - The specified token or callback is not registered. + * @syscap SystemCapability.Ability.DistributedAbilityManager + * @atomicservice + * @since 11 + */ + function unregisterContinuation(token: number, callback: AsyncCallback): void; + /** + * Unregisters a specified ability from the continuation manager service based on the token obtained during ability + * registration. + * + * @permission ohos.permission.DISTRIBUTED_DATASYNC + * @param { number } token - Indicates the registration token of the ability. + * @returns { Promise } the promise returned by the function. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - The parameter check failed. + * @throws { BusinessError } 16600001 - The system ability works abnormally. + * @throws { BusinessError } 16600002 - The specified token or callback is not registered. + * @syscap SystemCapability.Ability.DistributedAbilityManager + * @since 9 + */ + /** + * Unregisters a specified ability from the continuation manager service based on the token obtained during ability + * registration. + * + * @permission ohos.permission.DISTRIBUTED_DATASYNC + * @param { number } token - Indicates the registration token of the ability. + * @returns { Promise } the promise returned by the function. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - The parameter check failed. + * @throws { BusinessError } 16600001 - The system ability works abnormally. + * @throws { BusinessError } 16600002 - The specified token or callback is not registered. + * @syscap SystemCapability.Ability.DistributedAbilityManager + * @atomicservice + * @since 11 + */ + function unregisterContinuation(token: number): Promise; + /** + * Updates the connection state of the device where the specified ability is successfully hopped. + * + * @permission ohos.permission.DISTRIBUTED_DATASYNC + * @param { number } token - Indicates the registration token of the ability. + * @param { string } deviceId - Indicates the ID of the device whose connection state is to be updated. + * @param { DeviceConnectState } status - Indicates the connection state to update. + * @param { AsyncCallback } callback - AsyncCallback returns the interface call result. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - The parameter check failed. + * @throws { BusinessError } 16600001 - The system ability works abnormally. + * @throws { BusinessError } 16600002 - The specified token or callback is not registered. + * @syscap SystemCapability.Ability.DistributedAbilityManager + * @since 9 + */ + /** + * Updates the connection state of the device where the specified ability is successfully hopped. + * + * @permission ohos.permission.DISTRIBUTED_DATASYNC + * @param { number } token - Indicates the registration token of the ability. + * @param { string } deviceId - Indicates the ID of the device whose connection state is to be updated. + * @param { DeviceConnectState } status - Indicates the connection state to update. + * @param { AsyncCallback } callback - AsyncCallback returns the interface call result. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - The parameter check failed. + * @throws { BusinessError } 16600001 - The system ability works abnormally. + * @throws { BusinessError } 16600002 - The specified token or callback is not registered. + * @syscap SystemCapability.Ability.DistributedAbilityManager + * @atomicservice + * @since 11 + */ + function updateContinuationState(token: number, deviceId: string, status: DeviceConnectState, callback: AsyncCallback): void; + /** + * Updates the connection state of the device where the specified ability is successfully hopped. + * + * @permission ohos.permission.DISTRIBUTED_DATASYNC + * @param { number } token - Indicates the registration token of the ability. + * @param { string } deviceId - Indicates the ID of the device whose connection state is to be updated. + * @param { DeviceConnectState } status - Indicates the connection state to update. + * @returns { Promise } callback Indicates the callback to be invoked when the continuation manager service + * is connected. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - The parameter check failed. + * @throws { BusinessError } 16600001 - The system ability works abnormally. + * @throws { BusinessError } 16600002 - The specified token or callback is not registered. + * @syscap SystemCapability.Ability.DistributedAbilityManager + * @since 9 + */ + /** + * Updates the connection state of the device where the specified ability is successfully hopped. + * + * @permission ohos.permission.DISTRIBUTED_DATASYNC + * @param { number } token - Indicates the registration token of the ability. + * @param { string } deviceId - Indicates the ID of the device whose connection state is to be updated. + * @param { DeviceConnectState } status - Indicates the connection state to update. + * @returns { Promise } callback Indicates the callback to be invoked when the continuation manager service + * is connected. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - The parameter check failed. + * @throws { BusinessError } 16600001 - The system ability works abnormally. + * @throws { BusinessError } 16600002 - The specified token or callback is not registered. + * @syscap SystemCapability.Ability.DistributedAbilityManager + * @atomicservice + * @since 11 + */ + function updateContinuationState(token: number, deviceId: string, status: DeviceConnectState): Promise; + /** + * Start to manage the devices that can be selected for continuation. + * + * @permission ohos.permission.DISTRIBUTED_DATASYNC + * @param { number } token - Indicates the registration token of the ability. + * @param { AsyncCallback } callback - AsyncCallback returns the interface call result. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - The parameter check failed. + * @throws { BusinessError } 16600001 - The system ability works abnormally. + * @throws { BusinessError } 16600002 - The specified token or callback is not registered. + * @syscap SystemCapability.Ability.DistributedAbilityManager + * @since 9 + */ + /** + * Start to manage the devices that can be selected for continuation. + * + * @permission ohos.permission.DISTRIBUTED_DATASYNC + * @param { number } token - Indicates the registration token of the ability. + * @param { AsyncCallback } callback - AsyncCallback returns the interface call result. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - The parameter check failed. + * @throws { BusinessError } 16600001 - The system ability works abnormally. + * @throws { BusinessError } 16600002 - The specified token or callback is not registered. + * @syscap SystemCapability.Ability.DistributedAbilityManager + * @atomicservice + * @since 11 + */ + function startContinuationDeviceManager(token: number, callback: AsyncCallback): void; + /** + * Start to manage the devices that can be selected for continuation. + * + * @permission ohos.permission.DISTRIBUTED_DATASYNC + * @param { number } token - Indicates the registration token of the ability. + * @param { ContinuationExtraParams } options - Indicates the extraParams object containing the extra parameters + * used to filter list of available devices. This parameter can be null. + * @param { AsyncCallback } callback - AsyncCallback form returns the interface call result. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - The parameter check failed. + * @throws { BusinessError } 16600001 - The system ability works abnormally. + * @throws { BusinessError } 16600002 - The specified token or callback is not registered. + * @syscap SystemCapability.Ability.DistributedAbilityManager + * @since 9 + */ + /** + * Start to manage the devices that can be selected for continuation. + * + * @permission ohos.permission.DISTRIBUTED_DATASYNC + * @param { number } token - Indicates the registration token of the ability. + * @param { ContinuationExtraParams } options - Indicates the extraParams object containing the extra parameters + * used to filter list of available devices. This parameter can be null. + * @param { AsyncCallback } callback - AsyncCallback form returns the interface call result. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - The parameter check failed. + * @throws { BusinessError } 16600001 - The system ability works abnormally. + * @throws { BusinessError } 16600002 - The specified token or callback is not registered. + * @syscap SystemCapability.Ability.DistributedAbilityManager + * @atomicservice + * @since 11 + */ + function startContinuationDeviceManager(token: number, options: ContinuationExtraParams, callback: AsyncCallback): void; + /** + * Start to manage the devices that can be selected for continuation. + * + * @permission ohos.permission.DISTRIBUTED_DATASYNC + * @param { number } token - Indicates the registration token of the ability. + * @param { ContinuationExtraParams } [options] - Indicates extraParams object containing extra parameters used to + * filter the list of available devices. This parameter can be null. + * @returns { Promise } callback Indicates the callback to be invoked when continuation manager service is connected. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - The parameter check failed. + * @throws { BusinessError } 16600001 - The system ability works abnormally. + * @throws { BusinessError } 16600002 - The specified token or callback is not registered. + * @syscap SystemCapability.Ability.DistributedAbilityManager + * @since 9 + */ + /** + * Start to manage the devices that can be selected for continuation. + * + * @permission ohos.permission.DISTRIBUTED_DATASYNC + * @param { number } token - Indicates the registration token of the ability. + * @param { ContinuationExtraParams } [options] - Indicates extraParams object containing extra parameters used to + * filter the list of available devices. This parameter can be null. + * @returns { Promise } callback Indicates the callback to be invoked when continuation manager service is connected. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - The parameter check failed. + * @throws { BusinessError } 16600001 - The system ability works abnormally. + * @throws { BusinessError } 16600002 - The specified token or callback is not registered. + * @syscap SystemCapability.Ability.DistributedAbilityManager + * @atomicservice + * @since 11 + */ + function startContinuationDeviceManager(token: number, options?: ContinuationExtraParams): Promise; + /** + * Device connection status data structure. + * + * @enum { number } + * @syscap SystemCapability.Ability.DistributedAbilityManager + * @since 8 + */ + /** + * Device connection status data structure. + * + * @enum { number } + * @syscap SystemCapability.Ability.DistributedAbilityManager + * @atomicservice + * @since 11 + */ + export enum DeviceConnectState { + /** + * Initial state of device connection. + * + * @syscap SystemCapability.Ability.DistributedAbilityManager + * @since 8 + */ + /** + * Initial state of device connection. + * + * @syscap SystemCapability.Ability.DistributedAbilityManager + * @atomicservice + * @since 11 + */ + IDLE = 0, + /** + * Device connection status. + * + * @syscap SystemCapability.Ability.DistributedAbilityManager + * @since 8 + */ + /** + * Device connection status. + * + * @syscap SystemCapability.Ability.DistributedAbilityManager + * @atomicservice + * @since 11 + */ + CONNECTING = 1, + /** + * The device is connected. + * + * @syscap SystemCapability.Ability.DistributedAbilityManager + * @since 8 + */ + /** + * The device is connected. + * + * @syscap SystemCapability.Ability.DistributedAbilityManager + * @atomicservice + * @since 11 + */ + CONNECTED = 2, + /** + * The device is disconnected. + * + * @syscap SystemCapability.Ability.DistributedAbilityManager + * @since 8 + */ + /** + * The device is disconnected. + * + * @syscap SystemCapability.Ability.DistributedAbilityManager + * @atomicservice + * @since 11 + */ + DISCONNECTING = 3 + } + /** + * Indicates the description of additional parameters for continuation. + * + * @enum { number } + * @syscap SystemCapability.Ability.DistributedAbilityManager + * @since 8 + */ + /** + * Indicates the description of additional parameters for continuation. + * + * @enum { number } + * @syscap SystemCapability.Ability.DistributedAbilityManager + * @atomicservice + * @since 11 + */ + export enum ContinuationMode { + /** + * Collaboration with a single device. + * + * @syscap SystemCapability.Ability.DistributedAbilityManager + * @since 8 + */ + /** + * Collaboration with a single device. + * + * @syscap SystemCapability.Ability.DistributedAbilityManager + * @atomicservice + * @since 11 + */ + COLLABORATION_SINGLE = 0, + /** + * Collaboration with multiple devices. + * + * @syscap SystemCapability.Ability.DistributedAbilityManager + * @since 8 + */ + /** + * Collaboration with multiple devices. + * + * @syscap SystemCapability.Ability.DistributedAbilityManager + * @atomicservice + * @since 11 + */ + COLLABORATION_MULTIPLE = 1 + } + /** + * Indicates the description of transfer results for continuation. + * + * @syscap SystemCapability.Ability.DistributedAbilityManager + * @since 10 + */ + /** + * Indicates the description of transfer results for continuation. + * + * @syscap SystemCapability.Ability.DistributedAbilityManager + * @atomicservice + * @since 11 + */ + export type ContinuationResult = _ContinuationResult; + /** + * Indicates the description of additional parameters for continuation. + * + * @syscap SystemCapability.Ability.DistributedAbilityManager + * @since 10 + */ + /** + * Indicates the description of additional parameters for continuation. + * + * @syscap SystemCapability.Ability.DistributedAbilityManager + * @atomicservice + * @since 11 + */ + export type ContinuationExtraParams = _ContinuationExtraParams; +} +export default continuationManager; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.convertxml.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.convertxml.d.ts new file mode 100755 index 00000000..b98bdcd3 --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.convertxml.d.ts @@ -0,0 +1,569 @@ +/* + * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit ArkTS + */ +/** + * The convertxml module provides utilities for converting XML text to Javascript object. + * + * @namespace xml + * @syscap SystemCapability.Utils.Lang + * @since 8 + */ +/** + * The convertxml module provides utilities for converting XML text to Javascript object. + * + * @namespace xml + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @since 10 + */ +/** + * The convertxml module provides utilities for converting XML text to Javascript object. + * + * @namespace xml + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 11 + */ +declare namespace xml { + /** + * The options for conversion. + * + * @interface ConvertOptions + * @syscap SystemCapability.Utils.Lang + * @since 8 + */ + /** + * The options for conversion. + * + * @interface ConvertOptions + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @since 10 + */ + /** + * The options for conversion. + * + * @interface ConvertOptions + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 11 + */ + interface ConvertOptions { + /** + * Whether to trim whitespace characters that may exist before and after the text, default false. + * + * @syscap SystemCapability.Utils.Lang + * @since 8 + */ + /** + * Whether to trim whitespace characters that may exist before and after the text, default false. + * + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @since 10 + */ + /** + * Whether to trim whitespace characters that may exist before and after the text, default false. + * + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 11 + */ + trim: boolean; + /** + * Whether to ignore writing declaration directives of xml. + * + * @syscap SystemCapability.Utils.Lang + * @since 8 + */ + /** + * Whether to ignore writing declaration directives of xml. + * + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @since 10 + */ + /** + * Whether to ignore writing declaration directives of xml. + * + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 11 + */ + ignoreDeclaration?: boolean; + /** + * Whether to ignore writing processing instruction of xml. + * + * @syscap SystemCapability.Utils.Lang + * @since 8 + */ + /** + * Whether to ignore writing processing instruction of xml. + * + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @since 10 + */ + /** + * Whether to ignore writing processing instruction of xml. + * + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 11 + */ + ignoreInstruction?: boolean; + /** + * Whether to print attributes across multiple lines and indent them. + * + * @syscap SystemCapability.Utils.Lang + * @since 8 + */ + /** + * Whether to print attributes across multiple lines and indent them. + * + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @since 10 + */ + /** + * Whether to print attributes across multiple lines and indent them. + * + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 11 + */ + ignoreAttributes?: boolean; + /** + * Whether to ignore writing comments of the elements. + * + * @syscap SystemCapability.Utils.Lang + * @since 8 + */ + /** + * Whether to ignore writing comments of the elements. + * + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @since 10 + */ + /** + * Whether to ignore writing comments of the elements. + * + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 11 + */ + ignoreComment?: boolean; + /** + * Whether to ignore writing CDATA of the elements. + * + * @syscap SystemCapability.Utils.Lang + * @since 8 + */ + /** + * Whether to ignore writing CDATA of the elements. + * + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @since 10 + */ + /** + * Whether to ignore writing CDATA of the elements. + * + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 11 + */ + ignoreCDATA?: boolean; + /** + * Whether to ignore writing Doctype of the elements. + * + * @syscap SystemCapability.Utils.Lang + * @since 8 + */ + /** + * Whether to ignore writing Doctype of the elements. + * + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @since 10 + */ + /** + * Whether to ignore writing Doctype of the elements. + * + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 11 + */ + ignoreDoctype?: boolean; + /** + * Whether to ignore writing texts of the elements. + * + * @syscap SystemCapability.Utils.Lang + * @since 8 + */ + /** + * Whether to ignore writing texts of the elements. + * + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @since 10 + */ + /** + * Whether to ignore writing texts of the elements. + * + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 11 + */ + ignoreText?: boolean; + /** + * Name of the property key which will be used for the declaration. + * + * @syscap SystemCapability.Utils.Lang + * @since 8 + */ + /** + * Name of the property key which will be used for the declaration. + * + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @since 10 + */ + /** + * Name of the property key which will be used for the declaration. + * + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 11 + */ + declarationKey: string; + /** + * Name of the property key which will be used for the processing instruction. + * + * @syscap SystemCapability.Utils.Lang + * @since 8 + */ + /** + * Name of the property key which will be used for the processing instruction. + * + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @since 10 + */ + /** + * Name of the property key which will be used for the processing instruction. + * + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 11 + */ + instructionKey: string; + /** + * Name of the property key which will be used for the attributes. + * + * @syscap SystemCapability.Utils.Lang + * @since 8 + */ + /** + * Name of the property key which will be used for the attributes. + * + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @since 10 + */ + /** + * Name of the property key which will be used for the attributes. + * + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 11 + */ + attributesKey: string; + /** + * Name of the property key which will be used for the text. + * + * @syscap SystemCapability.Utils.Lang + * @since 8 + */ + /** + * Name of the property key which will be used for the text. + * + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @since 10 + */ + /** + * Name of the property key which will be used for the text. + * + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 11 + */ + textKey: string; + /** + * Name of the property key which will be used for the cdata. + * + * @syscap SystemCapability.Utils.Lang + * @since 8 + */ + /** + * Name of the property key which will be used for the cdata. + * + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @since 10 + */ + /** + * Name of the property key which will be used for the cdata. + * + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 11 + */ + cdataKey: string; + /** + * Name of the property key which will be used for the doctype. + * + * @syscap SystemCapability.Utils.Lang + * @since 8 + */ + /** + * Name of the property key which will be used for the doctype. + * + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @since 10 + */ + /** + * Name of the property key which will be used for the doctype. + * + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 11 + */ + doctypeKey: string; + /** + * Name of the property key which will be used for the comment. + * + * @syscap SystemCapability.Utils.Lang + * @since 8 + */ + /** + * Name of the property key which will be used for the comment. + * + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @since 10 + */ + /** + * Name of the property key which will be used for the comment. + * + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 11 + */ + commentKey: string; + /** + * Name of the property key which will be used for the parent. + * + * @syscap SystemCapability.Utils.Lang + * @since 8 + */ + /** + * Name of the property key which will be used for the parent. + * + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @since 10 + */ + /** + * Name of the property key which will be used for the parent. + * + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 11 + */ + parentKey: string; + /** + * Name of the property key which will be used for the type. + * + * @syscap SystemCapability.Utils.Lang + * @since 8 + */ + /** + * Name of the property key which will be used for the type. + * + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @since 10 + */ + /** + * Name of the property key which will be used for the type. + * + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 11 + */ + typeKey: string; + /** + * Name of the property key which will be used for the name. + * + * @syscap SystemCapability.Utils.Lang + * @since 8 + */ + /** + * Name of the property key which will be used for the name. + * + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @since 10 + */ + /** + * Name of the property key which will be used for the name. + * + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 11 + */ + nameKey: string; + /** + * Name of the property key which will be used for the elements. + * + * @syscap SystemCapability.Utils.Lang + * @since 8 + */ + /** + * Name of the property key which will be used for the elements. + * + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @since 10 + */ + /** + * Name of the property key which will be used for the elements. + * + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 11 + */ + elementsKey: string; + } + /** + * ConvertXML representation refers to extensible markup language. + * + * @syscap SystemCapability.Utils.Lang + * @since 8 + * @name ConvertXML + */ + /** + * ConvertXML representation refers to extensible markup language. + * + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @since 10 + * @name ConvertXML + */ + /** + * ConvertXML representation refers to extensible markup language. + * + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 11 + */ + class ConvertXML { + /** + * To convert XML text to JavaScript object. + * + * @param { string } xml - xml xml The xml text to be converted. + * @param { ConvertOptions } options - options option Option Inputted by user to set. + * @returns { Object } Returns a JavaScript object converting from XML text. + * @syscap SystemCapability.Utils.Lang + * @since 8 + * @deprecated since 9 + * @useinstead ohos.convertxml.ConvertXML.convertToJSObject + */ + convert(xml: string, options?: ConvertOptions): Object; + /** + * To convert XML text to JavaScript object. + * + * @param { string } xml - xml xml The xml text to be converted. + * @param { ConvertOptions } [options] - options option Option Inputted by user to set. + * @returns { Object } Returns a JavaScript object converting from XML text. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @throws { BusinessError } 10200002 - Invalid xml string. + * @syscap SystemCapability.Utils.Lang + * @since 9 + */ + /** + * To convert XML text to JavaScript object. + * + * @param { string } xml - xml xml The xml text to be converted. + * @param { ConvertOptions } [options] - options option Option Inputted by user to set. + * @returns { Object } Returns a JavaScript object converting from XML text. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @throws { BusinessError } 10200002 - Invalid xml string. + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @since 10 + */ + /** + * To convert XML text to JavaScript object. + * + * @param { string } xml - xml xml The xml text to be converted. + * @param { ConvertOptions } [options] - options option Option Inputted by user to set. + * @returns { Object } Returns a JavaScript object converting from XML text. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @throws { BusinessError } 10200002 - Invalid xml string. + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 11 + */ + convertToJSObject(xml: string, options?: ConvertOptions): Object; + } +} +export default xml; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.curves.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.curves.d.ts new file mode 100755 index 00000000..ca47a06e --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.curves.d.ts @@ -0,0 +1,758 @@ +/* + * Copyright (c) 2021-2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit ArkUI + */ +/** + * Contains interpolator functions such as initialization, third-order Bezier curves, and spring curves. + * + * @namespace curves + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 7 + */ +/** + * Contains interpolator functions such as initialization, third-order Bezier curves, and spring curves. + * + * @namespace curves + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 10 + */ +/** + * Contains interpolator functions such as initialization, third-order Bezier curves, and spring curves. + * + * @namespace curves + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 11 + */ +declare namespace curves { + /** + * enum Curve. + * + * @enum { number } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 7 + */ + /** + * enum Curve. + * + * @enum { number } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 10 + */ + /** + * enum Curve. + * + * @enum { number } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 11 + */ + enum Curve { + /** + * Linear. Indicates that the animation has the same velocity from start to finish. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 7 + */ + /** + * Linear. Indicates that the animation has the same velocity from start to finish. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 10 + */ + /** + * Linear. Indicates that the animation has the same velocity from start to finish. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 11 + */ + Linear, + /** + * Ease. Indicates that the animation starts at a low speed, then speeds up, and slows down before the end, + * CubicBezier(0.25, 0.1, 0.25, 1.0). + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 7 + */ + /** + * Ease. Indicates that the animation starts at a low speed, then speeds up, and slows down before the end, + * CubicBezier(0.25, 0.1, 0.25, 1.0). + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 10 + */ + /** + * Ease. Indicates that the animation starts at a low speed, then speeds up, and slows down before the end, + * CubicBezier(0.25, 0.1, 0.25, 1.0). + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 11 + */ + Ease, + /** + * EaseIn. Indicates that the animation starts at a low speed, Cubic Bezier (0.42, 0.0, 1.0, 1.0). + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 7 + */ + /** + * EaseIn. Indicates that the animation starts at a low speed, Cubic Bezier (0.42, 0.0, 1.0, 1.0). + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 10 + */ + /** + * EaseIn. Indicates that the animation starts at a low speed, Cubic Bezier (0.42, 0.0, 1.0, 1.0). + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 11 + */ + EaseIn, + /** + * EaseOut. Indicates that the animation ends at low speed, CubicBezier (0.0, 0.0, 0.58, 1.0). + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 7 + */ + /** + * EaseOut. Indicates that the animation ends at low speed, CubicBezier (0.0, 0.0, 0.58, 1.0). + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 10 + */ + /** + * EaseOut. Indicates that the animation ends at low speed, CubicBezier (0.0, 0.0, 0.58, 1.0). + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 11 + */ + EaseOut, + /** + * EaseInOut. Indicates that the animation starts and ends at low speed, CubicBezier (0.42, 0.0, 0.58, 1.0). + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 7 + */ + /** + * EaseInOut. Indicates that the animation starts and ends at low speed, CubicBezier (0.42, 0.0, 0.58, 1.0). + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 10 + */ + /** + * EaseInOut. Indicates that the animation starts and ends at low speed, CubicBezier (0.42, 0.0, 0.58, 1.0). + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 11 + */ + EaseInOut, + /** + * FastOutSlowIn. Standard curve, cubic-bezier (0.4, 0.0, 0.2, 1.0). + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 7 + */ + /** + * FastOutSlowIn. Standard curve, cubic-bezier (0.4, 0.0, 0.2, 1.0). + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 10 + */ + /** + * FastOutSlowIn. Standard curve, cubic-bezier (0.4, 0.0, 0.2, 1.0). + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 11 + */ + FastOutSlowIn, + /** + * LinearOutSlowIn. Deceleration curve, cubic-bezier (0.0, 0.0, 0.2, 1.0). + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 7 + */ + /** + * LinearOutSlowIn. Deceleration curve, cubic-bezier (0.0, 0.0, 0.2, 1.0). + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 10 + */ + /** + * LinearOutSlowIn. Deceleration curve, cubic-bezier (0.0, 0.0, 0.2, 1.0). + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 11 + */ + LinearOutSlowIn, + /** + * FastOutLinearIn. Acceleration curve, cubic-bezier (0.4, 0.0, 1.0, 1.0). + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 7 + */ + /** + * FastOutLinearIn. Acceleration curve, cubic-bezier (0.4, 0.0, 1.0, 1.0). + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 10 + */ + /** + * FastOutLinearIn. Acceleration curve, cubic-bezier (0.4, 0.0, 1.0, 1.0). + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 11 + */ + FastOutLinearIn, + /** + * ExtremeDeceleration. Abrupt curve, cubic-bezier (0.0, 0.0, 0.0, 1.0). + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 7 + */ + /** + * ExtremeDeceleration. Abrupt curve, cubic-bezier (0.0, 0.0, 0.0, 1.0). + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 10 + */ + /** + * ExtremeDeceleration. Abrupt curve, cubic-bezier (0.0, 0.0, 0.0, 1.0). + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 11 + */ + ExtremeDeceleration, + /** + * Sharp. Sharp curves, cubic-bezier (0.33, 0.0, 0.67, 1.0). + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 7 + */ + /** + * Sharp. Sharp curves, cubic-bezier (0.33, 0.0, 0.67, 1.0). + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 10 + */ + /** + * Sharp. Sharp curves, cubic-bezier (0.33, 0.0, 0.67, 1.0). + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 11 + */ + Sharp, + /** + * Rhythm. Rhythmic curve, cubic-bezier (0.7, 0.0, 0.2, 1.0). + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 7 + */ + /** + * Rhythm. Rhythmic curve, cubic-bezier (0.7, 0.0, 0.2, 1.0). + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 10 + */ + /** + * Rhythm. Rhythmic curve, cubic-bezier (0.7, 0.0, 0.2, 1.0). + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 11 + */ + Rhythm, + /** + * Smooth. Smooth curves, cubic-bezier (0.4, 0.0, 0.4, 1.0). + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 7 + */ + /** + * Smooth. Smooth curves, cubic-bezier (0.4, 0.0, 0.4, 1.0). + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 10 + */ + /** + * Smooth. Smooth curves, cubic-bezier (0.4, 0.0, 0.4, 1.0). + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 11 + */ + Smooth, + /** + * Friction. Damping curves, CubicBezier (0.2, 0.0, 0.2, 1.0). + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 7 + */ + /** + * Friction. Damping curves, CubicBezier (0.2, 0.0, 0.2, 1.0). + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 10 + */ + /** + * Friction. Damping curves, CubicBezier (0.2, 0.0, 0.2, 1.0). + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 11 + */ + Friction + } + /** + * Interface for curve object. + * + * @typedef ICurve + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 9 + */ + /** + * Interface for curve object. + * + * @typedef ICurve + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 10 + */ + /** + * Interface for curve object. + * + * @typedef ICurve + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 11 + */ + interface ICurve { + /** + * Get curve value by fraction.params,the parameter value range is from 0 to 1. + * 1 is taken when the value is greater than 1 and 0 is taken when it is less than 0. + * + * @param { number } fraction -Indicates the current normalized time parameter. Value range: [0, 1]. + * Note: If the value is less than 0, it will be processed as 0. If the value is greater than 1, 1 is used. + * @returns { number } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 9 + */ + /** + * Get curve value by fraction,the parameter value range is from 0 to 1. + * 1 is taken when the value is greater than 1 and 0 is taken when it is less than 0. + * + * @param { number } fraction -Indicates the current normalized time parameter. Value range: [0, 1]. + * Note: If the value is less than 0, it will be processed as 0. If the value is greater than 1, 1 is used. + * @returns { number } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 10 + */ + /** + * Get curve value by fraction,the parameter value range is from 0 to 1. + * 1 is taken when the value is greater than 1 and 0 is taken when it is less than 0. + * + * @param { number } fraction -Indicates the current normalized time parameter. Value range: [0, 1]. + * Note: If the value is less than 0, it will be processed as 0. If the value is greater than 1, 1 is used. + * @returns { number } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 11 + */ + interpolate(fraction: number): number; + } + /** + * Initializes the interpolator curve when called. + * + * @param { Curve } [curve] The default value is Curve.Linear + * @returns { ICurve } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 9 + */ + /** + * Initializes the interpolator curve when called. + * + * @param { Curve } [curve] The default value is Curve.Linear + * @returns { ICurve } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 10 + */ + /** + * Initializes the interpolator curve when called. + * + * @param { Curve } [curve] The default value is Curve.Linear + * @returns { ICurve } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 11 + */ + function initCurve(curve?: Curve): ICurve; + /** + * Initializes the interpolator curve when called. + * + * @param { Curve } [curve] + * @returns { string } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 7 + * @deprecated since 9 + * @useinstead initCurve + */ + function init(curve?: Curve): string; + /** + * Constructs a step curve when called. + * + * @param { number } count -The number of steps. The range of this value is [1, +∞). + * @param { boolean } end -A step change occurs at the start or end of each interval. + * @returns { ICurve } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 9 + */ + /** + * Constructs a step curve when called. + * + * @param { number } count -The number of steps. The range of this value is [1, +∞). + * @param { boolean } end -A step change occurs at the start or end of each interval. + * @returns { ICurve } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 10 + */ + /** + * Constructs a step curve when called. + * + * @param { number } count -The number of steps. The range of this value is [1, +∞). + * @param { boolean } end -A step change occurs at the start or end of each interval. + * @returns { ICurve } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 11 + */ + function stepsCurve(count: number, end: boolean): ICurve; + /** + * Constructs a custom curve when called. + * + * @param { function } interpolate - fraction range is [0,1], the return number must between [0,1]. + * @returns { ICurve } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 10 + */ + /** + * Constructs a custom curve when called. + * + * @param { function } interpolate - fraction range is [0,1], the return number must between [0,1]. + * @returns { ICurve } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 11 + */ + function customCurve(interpolate: (fraction: number) => number): ICurve; + /** + * Constructs a step curve when called. + * + * @param { number } count + * @param { boolean } end + * @returns { string } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 7 + * @deprecated since 9 + * @useinstead stepsCurve + */ + function steps(count: number, end: boolean): string; + /** + * Constructs a third-order Bezier curve when called. + * @param { number } x1 -Value range [0, 1]. + * Note: If the value is less than 0, 0 is used. If the value is greater than 1, 1 is used. + * @param { number } y1 -Value range (-∞, +∞). + * @param { number } x2 -Value range [0, 1]. + * Note: If the value is less than 0, 0 is used. If the value is greater than 1, 1 is used. + * @param { number } y2 -Value range (-∞, +∞). + * @returns { ICurve } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 9 + */ + /** + * Constructs a third-order Bezier curve when called. + * + * @param { number } x1 -Value range [0, 1]. + * Note: If the value is less than 0, 0 is used. If the value is greater than 1, 1 is used. + * @param { number } y1 -Value range (-∞, +∞). + * @param { number } x2 -Value range [0, 1]. + * Note: If the value is less than 0, 0 is used. If the value is greater than 1, 1 is used. + * @param { number } y2 -Value range (-∞, +∞). + * @returns { ICurve } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 10 + */ + /** + * Constructs a third-order Bezier curve when called. + * + * @param { number } x1 -Value range [0, 1]. + * Note: If the value is less than 0, 0 is used. If the value is greater than 1, 1 is used. + * @param { number } y1 -Value range (-∞, +∞). + * @param { number } x2 -Value range [0, 1]. + * Note: If the value is less than 0, 0 is used. If the value is greater than 1, 1 is used. + * @param { number } y2 -Value range (-∞, +∞). + * @returns { ICurve } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 11 + */ + function cubicBezierCurve(x1: number, y1: number, x2: number, y2: number): ICurve; + /** + * Constructs a third-order Bezier curve when called. + * + * @param { number } x1 -Value range [0, 1]. + * Note: If the value is less than 0, 0 is used. If the value is greater than 1, 1 is used. + * @param { number } y1 -Value range (-∞, +∞). + * @param { number } x2 -Value range [0, 1]. + * Note: If the value is less than 0, 0 is used. If the value is greater than 1, 1 is used. + * @param { number } y2 -Value range (-∞, +∞). + * @returns { string } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 7 + * @deprecated since 9 + * @useinstead cubicBezierCurve + */ + function cubicBezier(x1: number, y1: number, x2: number, y2: number): string; + /** + * Constructs a spring curve when called. For more information about the meaning of the parameter, see spring(). + * + * @param { number } velocity -Value range (-∞, +∞). + * @param { number } mass -Value range (0, +∞). Note: If the value is less than or equal to 0, 1 is used. + * @param { number } stiffness -Value range (0, +∞). Note: If the value is less than or equal to 0, 1 is used. + * @param { number } damping -Value range (0, +∞). Note: If the value is less than or equal to 0, 1 is used. + * @returns { ICurve } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 9 + */ + /** + * Constructs a spring curve when called. + * + * @param { number } velocity -Value range (-∞, +∞). + * @param { number } mass -Value range (0, +∞). Note: If the value is less than or equal to 0, 1 is used. + * @param { number } stiffness -Value range (0, +∞). Note: If the value is less than or equal to 0, 1 is used. + * @param { number } damping -Value range (0, +∞). Note: If the value is less than or equal to 0, 1 is used. + * @returns { ICurve } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 10 + */ + /** + * Constructs a spring curve when called. + * + * @param { number } velocity -Value range (-∞, +∞). + * @param { number } mass -Value range (0, +∞). Note: If the value is less than or equal to 0, 1 is used. + * @param { number } stiffness -Value range (0, +∞). Note: If the value is less than or equal to 0, 1 is used. + * @param { number } damping -Value range (0, +∞). Note: If the value is less than or equal to 0, 1 is used. + * @returns { ICurve } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 11 + */ + function springCurve(velocity: number, mass: number, stiffness: number, damping: number): ICurve; + /** + * Constructs a spring curve when called. + * + * @param { number } velocity -Initial velocity. An influence parameter of external factors on elastic dynamics, + * purpose is to ensure a smooth transition of the object from the previous state of motion to the elastic dynamics. + * @param { number } mass -Quality. The force object of the elastic system will have an inertial effect on elastic + * system. The greater the mass, the greater the amplitude of the oscillation. + * @param { number } stiffness -The degree to which an object is deformed by resisting the applied force. + * @param { number } damping -Pure number, Used to describe oscillation and decay of a system after being disturbed. + * @returns { string } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 7 + * @deprecated since 9 + * @useinstead springCurve + */ + function spring(velocity: number, mass: number, stiffness: number, damping: number): string; + /** + * Constructs a spring motion when called. + * + * @param { number } [response] The default value is 0.15. Unit: seconds. Value range: (0, +∞). + * Note: If a value is set to 0 or less, the default value of 0.15 is used. + * @param { number } [dampingFraction] The default value is 0.86. Unit: seconds. Value range: [0, +∞). + * Note: If a value is set to 0 or less, the default value of 0.86 is used. + * @param { number } [overlapDuration] The default value is 0.25. Unit: seconds. Value range: [0, +∞). + * Note: If a value is set to 0 or less, the default value of 0.25 is used. + * @returns { ICurve } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 9 + */ + /** + * Constructs a spring motion when called. + * + * @param { number } [response] The default value is 0.15. Unit: seconds. Value range: (0, +∞). + * Note: If a value is set to 0 or less, the default value of 0.15 is used. + * @param { number } [dampingFraction] The default value is 0.86. Unit: seconds. Value range: [0, +∞). + * Note: If a value is set to 0 or less, the default value of 0.86 is used. + * @param { number } [overlapDuration] The default value is 0.25. Unit: seconds. Value range: [0, +∞). + * Note: If a value is set to 0 or less, the default value of 0.25 is used. + * @returns { ICurve } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 10 + */ + /** + * Constructs a spring motion when called. + * + * @param { number } [response] The default value is 0.15. Unit: seconds. Value range: (0, +∞). + * Note: If a value is set to 0 or less, the default value of 0.15 is used. + * @param { number } [dampingFraction] The default value is 0.86. Unit: seconds. Value range: [0, +∞). + * Note: If a value is set to 0 or less, the default value of 0.86 is used. + * @param { number } [overlapDuration] The default value is 0.25. Unit: seconds. Value range: [0, +∞). + * Note: If a value is set to 0 or less, the default value of 0.25 is used. + * @returns { ICurve } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 11 + */ + function springMotion(response?: number, dampingFraction?: number, overlapDuration?: number): ICurve; + /** + * Constructs a responsive spring motion when called. + * + * @param { number } [response] The default value is 0.15. Unit: seconds. Value range: (0, +∞). + * Note: If a value is set to 0 or less, the default value of 0.15 is used. + * @param { number } [dampingFraction] The default value is 0.86. Unit: seconds. Value range: [0, +∞). + * Note: If a value is set to 0 or less, the default value of 0.86 is used. + * @param { number } [overlapDuration] The default value is 0.25. Unit: seconds. Value range: [0, +∞). + * Note: If a value is set to 0 or less, the default value of 0.25 is used. + * @returns { ICurve } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 9 + */ + /** + * Constructs a responsive spring motion when called. + * + * @param { number } [response] The default value is 0.15. Unit: seconds. Value range: (0, +∞). + * Note: If a value is set to 0 or less, the default value of 0.15 is used. + * @param { number } [dampingFraction] The default value is 0.86. Unit: seconds. Value range: [0, +∞). + * Note: If a value is set to 0 or less, the default value of 0.86 is used. + * @param { number } [overlapDuration] The default value is 0.25. Unit: seconds. Value range: [0, +∞). + * Note: If a value is set to 0 or less, the default value of 0.25 is used. + * @returns { ICurve } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 10 + */ + /** + * Constructs a responsive spring motion when called. + * The parameters are interpreted as in springMotion. + * + * @param { number } [response] The default value is 0.15. Unit: seconds. Value range: (0, +∞). + * Note: If a value is set to 0 or less, the default value of 0.15 is used. + * @param { number } [dampingFraction] The default value is 0.86. Unit: seconds. Value range: [0, +∞). + * Note: If a value is set to 0 or less, the default value of 0.86 is used. + * @param { number } [overlapDuration] The default value is 0.25. Unit: seconds. Value range: [0, +∞). + * Note: If a value is set to 0 or less, the default value of 0.25 is used. + * @returns { ICurve } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 11 + */ + function responsiveSpringMotion(response?: number, dampingFraction?: number, overlapDuration?: number): ICurve; + /** + * Constructs an interpolating spring curve when called, the animation duration can not be specified manually, + * and is determined by parameters of the curve. It produces values change from 0 to 1, and then uses interpolator + * to calculate the actual animation values. + * + * @param { number } velocity - the initial velocity of the spring, and is a normalized speed corresponding to the + * value changes from 0 to 1,specific value range (-∞, ∞). + * @param { number } mass - the mass of object in the mass-damper-spring system, value range (0, +∞). + * Note: If the value is less than or equal to 0, the value 1 is used. + * @param { number } stiffness - the stiffness of spring, value range (0, +∞). + * Note: If the value is less than or equal to 0, the value 1 is used. + * @param { number } damping - the damping value of spring, value range (0, +∞). + * Note: If the value is less than or equal to 0, the value 1 is used. + * @returns { ICurve } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 10 + */ + /** + * Constructs an interpolating spring curve when called, the animation duration can not be specified manually, + * and is determined by parameters of the curve. It produces values change from 0 to 1, and then uses interpolator + * to calculate the actual animation values. + * + * @param { number } velocity - the initial velocity of the spring, and is a normalized speed corresponding to the + * value changes from 0 to 1,specific value range (-∞, ∞). + * @param { number } mass - the mass of object in the mass-damper-spring system, value range (0, +∞). + * Note: If the value is less than or equal to 0, the value 1 is used. + * @param { number } stiffness - the stiffness of spring, value range (0, +∞). + * Note: If the value is less than or equal to 0, the value 1 is used. + * @param { number } damping - the damping value of spring, value range (0, +∞). + * Note: If the value is less than or equal to 0, the value 1 is used. + * @returns { ICurve } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 11 + */ + function interpolatingSpring(velocity: number, mass: number, stiffness: number, damping: number): ICurve; +} +export default curves; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.data.ValuesBucket.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.data.ValuesBucket.d.ts new file mode 100755 index 00000000..f82829c4 --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.data.ValuesBucket.d.ts @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit ArkData + */ +/** + * Indicates possible value types + * + * @syscap SystemCapability.DistributedDataManager.DataShare.Core + * @stagemodelonly + * @since 10 + */ +export type ValueType = number | string | boolean; +/** + * Values in buckets are stored in key-value pairs + * + * @syscap SystemCapability.DistributedDataManager.DataShare.Core + * @stagemodelonly + * @since 10 + */ +export type ValuesBucket = Record; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.data.cloudData.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.data.cloudData.d.ts new file mode 100755 index 00000000..c3633f99 --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.data.cloudData.d.ts @@ -0,0 +1,82 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit ArkData + */ + +import commonType from './@ohos.data.commonType'; +/** + * Provides methods for cloud capabilities. + * + * @namespace cloudData + * @syscap SystemCapability.DistributedDataManager.CloudSync.Config + * @since 10 + */ +declare namespace cloudData { + /** + * Enumerates the strategy types of cloud sync. + * + * @enum { number } + * @syscap SystemCapability.DistributedDataManager.CloudSync.Client + * @since 12 + */ + enum StrategyType { + /** + * Sync via the network. + * + * @syscap SystemCapability.DistributedDataManager.CloudSync.Client + * @since 12 + */ + NETWORK + } + /** + * Enumerates the types of cloud sync via the network. + * + * @enum { number } + * @syscap SystemCapability.DistributedDataManager.CloudSync.Client + * @since 12 + */ + enum NetWorkStrategy { + /** + * Sync using WiFi. + * + * @syscap SystemCapability.DistributedDataManager.CloudSync.Client + * @since 12 + */ + WIFI = 1, + /** + * Sync using the cellular network. + * + * @syscap SystemCapability.DistributedDataManager.CloudSync.Client + * @since 12 + */ + CELLULAR = 2 + } + /** + * Sets cloud strategy. + * + * @param { StrategyType } strategy - Indicates the strategy type of the cloud sync. + * @param { Array } param - Indicates specific strategy of the cloud sync. + * @returns { Promise } Promise used to return the result. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; + * 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.DistributedDataManager.CloudSync.Client + * @since 12 + */ + function setCloudStrategy(strategy: StrategyType, param?: Array): Promise; +} +export default cloudData; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.data.cloudExtension.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.data.cloudExtension.d.ts new file mode 100755 index 00000000..17b76e10 --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.data.cloudExtension.d.ts @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit ArkData + */ + +/** + * Provides interfaces to implement extended cloud capabilities. + * + * @namespace cloudExtension + * @syscap SystemCapability.DistributedDataManager.CloudSync.Server + * @since 11 + */ +declare namespace cloudExtension { +} +export default cloudExtension; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.data.commonType.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.data.commonType.d.ts new file mode 100755 index 00000000..132d7375 --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.data.commonType.d.ts @@ -0,0 +1,238 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit ArkData + */ +/** + * Indicates the common data types. + * + * @namespace commonType + * @syscap SystemCapability.DistributedDataManager.CommonType + * @crossplatform + * @since 11 + */ +declare namespace commonType { + /** + * Describes the status of asset. + * + * @enum { number } + * @syscap SystemCapability.DistributedDataManager.CommonType + * @crossplatform + * @since 11 + */ + enum AssetStatus { + /** + * Means the status of asset is normal. + * + * @syscap SystemCapability.DistributedDataManager.CommonType + * @crossplatform + * @since 11 + */ + ASSET_NORMAL, + /** + * Means the asset needs to be inserted. + * + * @syscap SystemCapability.DistributedDataManager.CommonType + * @crossplatform + * @since 11 + */ + ASSET_INSERT, + /** + * Means the asset needs to be updated. + * + * @syscap SystemCapability.DistributedDataManager.CommonType + * @crossplatform + * @since 11 + */ + ASSET_UPDATE, + /** + * Means the asset needs to be deleted. + * + * @syscap SystemCapability.DistributedDataManager.CommonType + * @crossplatform + * @since 11 + */ + ASSET_DELETE, + /** + * Means the status of asset is abnormal. + * + * @syscap SystemCapability.DistributedDataManager.CommonType + * @crossplatform + * @since 11 + */ + ASSET_ABNORMAL, + /** + * Means the status of asset is downloading. + * + * @syscap SystemCapability.DistributedDataManager.CommonType + * @crossplatform + * @since 11 + */ + ASSET_DOWNLOADING + } + /** + * Information of the asset. + * + * @interface Asset + * @syscap SystemCapability.DistributedDataManager.CommonType + * @crossplatform + * @since 11 + */ + interface Asset { + /** + * The name of asset. + * @type { string } + * @syscap SystemCapability.DistributedDataManager.CommonType + * @crossplatform + * @since 11 + */ + /** + * The name of asset. + * @type { string | undefined } + * @syscap SystemCapability.DistributedDataManager.CommonType + * @crossplatform + * @since 12 + */ + name: string | undefined; + /** + * The uri of asset. + * + * @type { string } + * @syscap SystemCapability.DistributedDataManager.CommonType + * @crossplatform + * @since 11 + */ + /** + * The uri of asset. + * + * @type { string | undefined } + * @syscap SystemCapability.DistributedDataManager.CommonType + * @crossplatform + * @since 12 + */ + uri: string | undefined; + /** + * The path of asset. + * + * @type { string } + * @syscap SystemCapability.DistributedDataManager.CommonType + * @crossplatform + * @since 11 + */ + /** + * The path of asset. + * + * @type { string | undefined } + * @syscap SystemCapability.DistributedDataManager.CommonType + * @crossplatform + * @since 12 + */ + path: string | undefined; + /** + * The created time of asset. + * + * @type { string } + * @syscap SystemCapability.DistributedDataManager.CommonType + * @crossplatform + * @since 11 + */ + /** + * The created time of asset. + * + * @type { string | undefined } + * @syscap SystemCapability.DistributedDataManager.CommonType + * @crossplatform + * @since 12 + */ + createTime: string | undefined; + /** + * The modified time of asset. If this field changes, the asset is considered to have changed. + * + * @type { string } + * @syscap SystemCapability.DistributedDataManager.CommonType + * @crossplatform + * @since 11 + */ + /** + * The modified time of asset. If this field changes, the asset is considered to have changed. + * + * @type { string | undefined } + * @syscap SystemCapability.DistributedDataManager.CommonType + * @crossplatform + * @since 12 + */ + modifyTime: string | undefined; + /** + * The size of asset. If this field changes, the asset is considered to have changed. + * + * @type { string } + * @syscap SystemCapability.DistributedDataManager.CommonType + * @crossplatform + * @since 11 + */ + /** + * The size of asset. If this field changes, the asset is considered to have changed. + * + * @type { string | undefined } + * @syscap SystemCapability.DistributedDataManager.CommonType + * @crossplatform + * @since 12 + */ + size: string | undefined; + /** + * The status of asset. + * + * @type { ?AssetStatus } + * @syscap SystemCapability.DistributedDataManager.CommonType + * @crossplatform + * @since 11 + */ + /** + * The status of asset. + * + * @type { ?(AssetStatus | undefined) } + * @syscap SystemCapability.DistributedDataManager.CommonType + * @crossplatform + * @since 12 + */ + status?: AssetStatus | undefined; + } + /** + * Indicates several assets + * + * @syscap SystemCapability.DistributedDataManager.CommonType + * @crossplatform + * @since 11 + */ + type Assets = Array; + /** + * Indicates possible value types. + * + * @syscap SystemCapability.DistributedDataManager.CommonType + * @crossplatform + * @since 11 + */ + type ValueType = null | number | string | boolean | Uint8Array | Asset | Assets; + /** + * Values in buckets are stored in key-value pairs. + * + * @syscap SystemCapability.DistributedDataManager.CommonType + * @crossplatform + * @since 11 + */ + type ValuesBucket = Record; +} +export default commonType; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.data.dataAbility.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.data.dataAbility.d.ts new file mode 100755 index 00000000..a76c4b77 --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.data.dataAbility.d.ts @@ -0,0 +1,351 @@ +/* + * Copyright (c) 2021-2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit ArkData + */ + +import rdb from './@ohos.data.rdb'; +/** + * Provides predicates for implementing diverse query methods. + * + * @namespace dataAbility + * @syscap SystemCapability.DistributedDataManager.DataShare.Core + * @since 7 + */ +declare namespace dataAbility { + /** + * Create an RdbPredicates by table name and DataAbilityPredicates. + * This method is similar to = of the SQL statement. + * + * @param { string } name - Indicates the table name. + * @param { DataAbilityPredicates } dataAbilityPredicates - Indicates the dataAbility predicates. + * @returns { rdb.RdbPredicates } Returns an RdbPredicates. + * @syscap SystemCapability.DistributedDataManager.DataShare.Core + * @since 7 + */ + function createRdbPredicates(name: string, dataAbilityPredicates: DataAbilityPredicates): rdb.RdbPredicates; + /** + * Manages relational database configurations. + * + * @syscap SystemCapability.DistributedDataManager.DataShare.Core + * @since 7 + */ + class DataAbilityPredicates { + /** + * Configure the DataAbilityPredicates to match the field whose data type is ValueType and value is equal + * to a specified value. + * This method is similar to = of the SQL statement. + * + * @param { string } field - Indicates the column name in the database table. + * @param { ValueType } value - Indicates the value to match with the DataAbilityPredicates. + * @returns { DataAbilityPredicates } Returns the DataAbilityPredicates that match the specified field. + * @syscap SystemCapability.DistributedDataManager.DataShare.Core + * @since 7 + */ + equalTo(field: string, value: ValueType): DataAbilityPredicates; + /** + * Configure the DataAbilityPredicates to match the field whose data type is ValueType and value is unequal to + * a specified value. + * Configure the data capability predicate to match a field where the data type is a value type and the value is + * not equal to the specified value. + * This method is similar to != of the SQL statement. + * + * @param { string } field - Indicates the column name in the database table. + * @param { ValueType } value - Indicates the value to match with the DataAbilityPredicates. + * @returns { DataAbilityPredicates } Returns the DataAbilityPredicates that match the specified field. + * @syscap SystemCapability.DistributedDataManager.DataShare.Core + * @since 7 + */ + notEqualTo(field: string, value: ValueType): DataAbilityPredicates; + /** + * Adds a left parenthesis to the DataAbilityPredicates. + * This method is similar to ( of the SQL statement and needs to be used together with endWrap(). + * + * @returns { DataAbilityPredicates } Returns the DataAbilityPredicates with the left parenthesis. + * @syscap SystemCapability.DistributedDataManager.DataShare.Core + * @since 7 + */ + beginWrap(): DataAbilityPredicates; + /** + * Adds a right parenthesis to the DataAbilityPredicates. + * This method is similar to ) of the SQL statement and needs to be used together + * with beginWrap(). + * + * @returns { DataAbilityPredicates } Returns the DataAbilityPredicates with the right parenthesis. + * @syscap SystemCapability.DistributedDataManager.DataShare.Core + * @since 7 + */ + endWrap(): DataAbilityPredicates; + /** + * Adds an or condition to the DataAbilityPredicates. + * This method is similar to or of the SQL statement. + * + * @returns { DataAbilityPredicates } Returns the DataAbilityPredicates with the or condition. + * @syscap SystemCapability.DistributedDataManager.DataShare.Core + * @since 7 + */ + or(): DataAbilityPredicates; + /** + * Adds an and condition to the DataAbilityPredicates. + * This method is similar to and of the SQL statement. + * + * @returns { DataAbilityPredicates } Returns the DataAbilityPredicates with the and condition. + * @syscap SystemCapability.DistributedDataManager.DataShare.Core + * @since 7 + */ + and(): DataAbilityPredicates; + /** + * Configure the DataAbilityPredicates to match the field whose data type is string and value + * contains a specified value. + * This method is similar to contains of the SQL statement. + * + * @param { string } field - Indicates the column name in the database table. + * @param { string } value - Indicates the value to match with the DataAbilityPredicates. + * @returns { DataAbilityPredicates } Returns the DataAbilityPredicates that match the specified field. + * @syscap SystemCapability.DistributedDataManager.DataShare.Core + * @since 7 + */ + contains(field: string, value: string): DataAbilityPredicates; + /** + * Configure the DataAbilityPredicates to match the field whose data type is string and value starts + * with a specified string. + * This method is similar to value% of the SQL statement. + * + * @param { string } field - Indicates the column name in the database table. + * @param { string } value - Indicates the value to match with the DataAbilityPredicates. + * @returns { DataAbilityPredicates } Returns the DataAbilityPredicates that match the specified field. + * @syscap SystemCapability.DistributedDataManager.DataShare.Core + * @since 7 + */ + beginsWith(field: string, value: string): DataAbilityPredicates; + /** + * Configure the DataAbilityPredicates to match the field whose data type is string and value + * ends with a specified string. + * This method is similar to %value of the SQL statement. + * + * @param { string } field - Indicates the column name in the database table. + * @param { string } value - Indicates the value to match with the DataAbilityPredicates. + * @returns { DataAbilityPredicates } Returns the DataAbilityPredicates that match the specified field. + * @syscap SystemCapability.DistributedDataManager.DataShare.Core + * @since 7 + */ + endsWith(field: string, value: string): DataAbilityPredicates; + /** + * Configure the DataAbilityPredicates to match the fields whose value is null. + * This method is similar to is null of the SQL statement. + * + * @param { string } field - Indicates the column name in the database table. + * @returns { DataAbilityPredicates } Returns the DataAbilityPredicates that match the specified field. + * @syscap SystemCapability.DistributedDataManager.DataShare.Core + * @since 7 + */ + isNull(field: string): DataAbilityPredicates; + /** + * Configure the DataAbilityPredicates to match the specified fields whose value is not null. + * This method is similar to is not null of the SQL statement. + * + * @param { string } field - Indicates the column name in the database table. + * @returns { DataAbilityPredicates } Returns the DataAbilityPredicates that match the specified field. + * @syscap SystemCapability.DistributedDataManager.DataShare.Core + * @since 7 + */ + isNotNull(field: string): DataAbilityPredicates; + /** + * Configure the DataAbilityPredicates to match the fields whose data type is string and value is + * similar to a specified string. + * This method is similar to like of the SQL statement. + * + * @param { string } field - Indicates the column name in the database table. + * @param { string } value - Indicates the value to match with the DataAbilityPredicates. The percent sign (%) + * in the value is a wildcard (like * in a regular expression). + * @returns { DataAbilityPredicates } Returns the DataAbilityPredicates that match the specified field. + * @syscap SystemCapability.DistributedDataManager.DataShare.Core + * @since 7 + */ + like(field: string, value: string): DataAbilityPredicates; + /** + * Configure DataAbilityPredicates to match the specified field whose data type is string and the value contains + * a wildcard.Different from like, the input parameters of this method are case-sensitive. + * + * @param { string } field - Indicates the column name in the database table. + * @param { string } value - Indicates the value to match with DataAbilityPredicates. + * @returns { DataAbilityPredicates } Returns the SQL statement with the specified DataAbilityPredicates. + * @syscap SystemCapability.DistributedDataManager.DataShare.Core + * @since 7 + */ + glob(field: string, value: string): DataAbilityPredicates; + /** + * Restricts the value of the field to the range between low value and high value. + * + * @param { string } field - Indicates the column name. + * @param { ValueType } low - Indicates the minimum value. + * @param { ValueType } high - Indicates the maximum value. + * @returns { DataAbilityPredicates } Returns the SQL query statement with the specified DataAbilityPredicates. + * @syscap SystemCapability.DistributedDataManager.DataShare.Core + * @since 7 + */ + between(field: string, low: ValueType, high: ValueType): DataAbilityPredicates; + /** + * Configure DataAbilityPredicates to match the specified field whose data type is int and value is + * out of a given range. + * + * @param { string } field - Indicates the column name in the database table. + * @param { ValueType } low - Indicates the minimum value to match with DataAbilityPredicates}. + * @param { ValueType } high - Indicates the maximum value to match with DataAbilityPredicates}. + * @returns { DataAbilityPredicates } Returns the SQL query statement with the specified DataAbilityPredicates. + * @syscap SystemCapability.DistributedDataManager.DataShare.Core + * @since 7 + */ + notBetween(field: string, low: ValueType, high: ValueType): DataAbilityPredicates; + /** + * Restricts the value of the field to be greater than the specified value. + * + * @param { string } field - Indicates the column name. + * @param { ValueType } value - Indicates the String field. + * @returns { DataAbilityPredicates } Returns the SQL query statement with the specified DataAbilityPredicates. + * @syscap SystemCapability.DistributedDataManager.DataShare.Core + * @since 7 + */ + greaterThan(field: string, value: ValueType): DataAbilityPredicates; + /** + * Restricts the value of the field to be smaller than the specified value. + * + * @param { string } field - Indicates the column name. + * @param { ValueType } value - Indicates the String field. + * @returns { DataAbilityPredicates } Returns the SQL query statement with the specified DataAbilityPredicates. + * @syscap SystemCapability.DistributedDataManager.DataShare.Core + * @since 7 + */ + lessThan(field: string, value: ValueType): DataAbilityPredicates; + /** + * Restricts the value of the field to be greater than or equal to the specified value. + * + * @param { string } field - Indicates the column name. + * @param { ValueType } value - Indicates the String field. + * @returns { DataAbilityPredicates } Returns the SQL query statement with the specified DataAbilityPredicates. + * @syscap SystemCapability.DistributedDataManager.DataShare.Core + * @since 7 + */ + greaterThanOrEqualTo(field: string, value: ValueType): DataAbilityPredicates; + /** + * Restricts the value of the field to be smaller than or equal to the specified value. + * + * @param { string } field - Indicates the column name. + * @param { ValueType } value - Indicates the String field. + * @returns { DataAbilityPredicates } Returns the SQL query statement with the specified DataAbilityPredicates. + * @syscap SystemCapability.DistributedDataManager.DataShare.Core + * @since 7 + */ + lessThanOrEqualTo(field: string, value: ValueType): DataAbilityPredicates; + /** + * Restricts the ascending order of the return list. When there are several orders, + * the one close to the head has the highest priority. + * + * @param { string } field - Indicates the column name for sorting the return list. + * @returns { DataAbilityPredicates } Returns the SQL query statement with the specified DataAbilityPredicates. + * @syscap SystemCapability.DistributedDataManager.DataShare.Core + * @since 7 + */ + orderByAsc(field: string): DataAbilityPredicates; + /** + * Restricts the descending order of the return list. When there are several orders, + * the one close to the head has the highest priority. + * + * @param { string } field - Indicates the column name for sorting the return list. + * @returns { DataAbilityPredicates } Returns the SQL query statement with the specified DataAbilityPredicates. + * @syscap SystemCapability.DistributedDataManager.DataShare.Core + * @since 7 + */ + orderByDesc(field: string): DataAbilityPredicates; + /** + * Restricts each row of the query result to be unique. + * + * @returns { DataAbilityPredicates } Returns the SQL query statement with the specified DataAbilityPredicates. + * @syscap SystemCapability.DistributedDataManager.DataShare.Core + * @since 7 + */ + distinct(): DataAbilityPredicates; + /** + * Restricts the max number of return records. + * + * @param { number } value - Indicates the max length of the return list. + * @returns { DataAbilityPredicates } Returns the SQL query statement with the specified DataAbilityPredicates. + * @syscap SystemCapability.DistributedDataManager.DataShare.Core + * @since 7 + */ + limitAs(value: number): DataAbilityPredicates; + /** + * Configure DataAbilityPredicates to specify the start position of the returned result. + * Use this method together with limit(int). + * + * @param { number } rowOffset - Indicates the start position of the returned result. The value is a positive integer. + * @returns { DataAbilityPredicates } Returns the SQL query statement with the specified AbsPredicates. + * @syscap SystemCapability.DistributedDataManager.DataShare.Core + * @since 7 + */ + offsetAs(rowOffset: number): DataAbilityPredicates; + /** + * Configure DataAbilityPredicates to group query results by specified columns. + * + * @param { Array } fields - Indicates the specified columns by which query results are grouped. + * @returns { DataAbilityPredicates } Returns the DataAbilityPredicates with the specified columns by which query + * results are grouped. + * @syscap SystemCapability.DistributedDataManager.DataShare.Core + * @since 7 + */ + groupBy(fields: Array): DataAbilityPredicates; + /** + * Configure DataAbilityPredicates to specify the index column. + * Before using this method, you need to create an index column. + * + * @param { string } field - Indicates the name of the index column. + * @returns { DataAbilityPredicates } Returns DataAbilityPredicates with the specified index column. + * @syscap SystemCapability.DistributedDataManager.DataShare.Core + * @since 7 + */ + indexedBy(field: string): DataAbilityPredicates; + /** + * Configure DataAbilityPredicates to match the specified field whose data type is ValueType array and values + * are within a given range. + * + * @param { string } field - Indicates the column name in the database table. + * @param { Array } value - Indicates the values to match with DataAbilityPredicates. + * @returns { DataAbilityPredicates } Returns DataAbilityPredicates that matches the specified field. + * @syscap SystemCapability.DistributedDataManager.DataShare.Core + * @since 7 + */ + in(field: string, value: Array): DataAbilityPredicates; + /** + * Configure {@code DataAbilityPredicates} to match the specified field whose data type is String array and values + * are out of a given range. + * + * @param { string } field - Indicates the column name in the database table. + * @param { Array } value - Indicates the values to match with DataAbilityPredicates. + * @returns { DataAbilityPredicates } Returns DataAbilityPredicates that matches the specified field. + * @syscap SystemCapability.DistributedDataManager.DataShare.Core + * @since 7 + */ + notIn(field: string, value: Array): DataAbilityPredicates; + } + /** + * Indicates possible value types + * + * @syscap SystemCapability.DistributedDataManager.DataShare.Core + * @since 7 + */ + type ValueType = number | string | boolean; +} +export default dataAbility; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.data.dataSharePredicates.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.data.dataSharePredicates.d.ts new file mode 100755 index 00000000..f231a209 --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.data.dataSharePredicates.d.ts @@ -0,0 +1,107 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit ArkData + */ +import { ValueType } from './@ohos.data.ValuesBucket'; +/** + * This module provides data share services based on the ExtensionAbility. + * + * @namespace dataSharePredicates + * @syscap SystemCapability.DistributedDataManager.DataShare.Core + * @StageModelOnly + * @since 10 + */ +declare namespace dataSharePredicates { + /** + * Manages relational database configurations. + * + * @syscap SystemCapability.DistributedDataManager.DataShare.Core + * @StageModelOnly + * @since 10 + */ + class DataSharePredicates { + /** + * Configure the DataSharePredicates to match the field whose data type is ValueType and value is equal + * to a specified value. + * This method is similar to = of the SQL statement. + * + * @param { string } field - Indicates the column name in the database table. + * @param { ValueType } value - Indicates the value to match with the DataSharePredicates. + * @returns { DataSharePredicates } Returns the DataSharePredicates that match the specified field. + * @syscap SystemCapability.DistributedDataManager.DataShare.Core + * @StageModelOnly + * @since 10 + */ + equalTo(field: string, value: ValueType): DataSharePredicates; + /** + * Adds an and condition to the DataSharePredicates. + * This method is similar to and of the SQL statement. + * + * @returns { DataSharePredicates } Returns the DataSharePredicates with the and condition. + * @syscap SystemCapability.DistributedDataManager.DataShare.Core + * @StageModelOnly + * @since 10 + */ + and(): DataSharePredicates; + /** + * Restricts the ascending order of the return list. When there are several orders, + * the one close to the head has the highest priority. + * + * @param { string } field - Indicates the column name for sorting the return list. + * @returns { DataSharePredicates } Returns the SQL query statement with the specified DataSharePredicates. + * @syscap SystemCapability.DistributedDataManager.DataShare.Core + * @StageModelOnly + * @since 10 + */ + orderByAsc(field: string): DataSharePredicates; + /** + * Restricts the descending order of the return list. When there are several orders, + * the one close to the head has the highest priority. + * + * @param { string } field - Indicates the column name for sorting the return list. + * @returns { DataSharePredicates } Returns the SQL query statement with the specified DataSharePredicates. + * @syscap SystemCapability.DistributedDataManager.DataShare.Core + * @StageModelOnly + * @since 10 + */ + orderByDesc(field: string): DataSharePredicates; + /** + * Construct a query object to specify the number of results and the starting position. + * + * @param { number } total - Represents the specified number of results. + * @param { number } offset - Indicates the starting position. + * @returns { DataSharePredicates } Returns the query object. + * @syscap SystemCapability.DistributedDataManager.DataShare.Core + * @StageModelOnly + * @since 10 + */ + limit(total: number, offset: number): DataSharePredicates; + /** + * Configure {@code DataSharePredicates} to match the specified field whose data type is ValueType array and values + * are within a given range. + * + * @param { string } field - Indicates the column name in the database table. + * @param { Array } value - Indicates the values to match with DataSharePredicates. + * @returns { DataSharePredicates } Returns DataSharePredicates that matches the specified field. + * @syscap SystemCapability.DistributedDataManager.DataShare.Core + * @StageModelOnly + * @since 10 + */ + in(field: string, value: Array): DataSharePredicates; + } +} +export default dataSharePredicates; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.data.distributedData.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.data.distributedData.d.ts new file mode 100755 index 00000000..1e38a4ca --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.data.distributedData.d.ts @@ -0,0 +1,1975 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit ArkData + */ +import { AsyncCallback, Callback } from './@ohos.base'; +/** + * Providers interfaces to creat a {@link KVManager} instance. + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore + */ +declare namespace distributedData { + /** + * Provides configuration information for {@link KVManager} instances, + * including the caller's package name and distributed network type. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.KVManagerConfig + */ + interface KVManagerConfig { + /** + * Indicates the user information + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 7 + * @deprecated since 9 + */ + userInfo: UserInfo; + /** + * Indicates the bundleName + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.KVManagerConfig#bundleName + */ + bundleName: string; + } + /** + * Manages user information. + * + *

This class provides methods for obtaining the user ID and type, setting the user ID and type, + * and checking whether two users are the same. + * + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 7 + * @deprecated since 9 + */ + interface UserInfo { + /** + * Indicates the user ID to set + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 7 + * @deprecated since 9 + */ + userId?: string; + /** + * Indicates the user type to set + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 7 + * @deprecated since 9 + */ + userType?: UserType; + } + /** + * Enumerates user types. + * + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 7 + * @deprecated since 9 + */ + enum UserType { + /** + * Indicates a user that logs in to different devices using the same account. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 7 + * @deprecated since 9 + */ + SAME_USER_ID = 0 + } + /** + * KVStore constants + * + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.Constants + */ + namespace Constants { + /** + * max key length. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.Constants#MAX_KEY_LENGTH + */ + const MAX_KEY_LENGTH = 1024; + /** + * max value length. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.Constants#MAX_VALUE_LENGTH + */ + const MAX_VALUE_LENGTH = 4194303; + /** + * max device coordinate key length. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.Constants#MAX_KEY_LENGTH_DEVICEs + */ + const MAX_KEY_LENGTH_DEVICE = 896; + /** + * max store id length. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.Constants#MAX_STORE_ID_LENGTH + */ + const MAX_STORE_ID_LENGTH = 128; + /** + * max query length. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.Constants#MAX_QUERY_LENGTH + */ + const MAX_QUERY_LENGTH = 512000; + /** + * max batch operation size. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.Constants#MAX_BATCH_SIZE + */ + const MAX_BATCH_SIZE = 128; + } + /** + * Indicates the {@code ValueType}. + * + *

{@code ValueType} is obtained based on the value. + * + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.ValueType + */ + enum ValueType { + /** + * Indicates that the value type is string. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.ValueType#STRING + */ + STRING = 0, + /** + * Indicates that the value type is int. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.ValueType#INTEGER + */ + INTEGER = 1, + /** + * Indicates that the value type is float. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.ValueType#FLOAT + */ + FLOAT = 2, + /** + * Indicates that the value type is byte array. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.ValueType#BYTE_ARRAY + * */ + BYTE_ARRAY = 3, + /** + * Indicates that the value type is boolean. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.ValueType#BOOLEAN + * */ + BOOLEAN = 4, + /** + * Indicates that the value type is double. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.ValueType#DOUBLE + */ + DOUBLE = 5 + } + /** + * Obtains {@code Value} objects stored in a {@link KVStore} database. + * + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.Value + */ + interface Value { + /** + * Indicates value type + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @see ValueType + * @type {number} + * @memberof Value + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.Value#type + */ + type: ValueType; + /** + * Indicates value + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.Value#value + */ + value: Uint8Array | string | number | boolean; + } + /** + * Provides key-value pairs stored in the distributed database. + * + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.Entry + */ + interface Entry { + /** + * Indicates key + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.Entry#key + */ + key: string; + /** + * Indicates value + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.Entry#value + */ + value: Value; + } + /** + * Receives notifications of all data changes, including data insertion, update, and deletion. + * + *

If you have subscribed to {@code KVStore}, you will receive data change notifications and obtain the changed data + * from the parameters in callback methods upon data insertion, update, or deletion. + * + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.ChangeNotification + */ + interface ChangeNotification { + /** + * Indicates data addition records. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.ChangeNotification#insertEntries + */ + insertEntries: Entry[]; + /** + * Indicates data update records. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.ChangeNotification#updateEntries + */ + updateEntries: Entry[]; + /** + * Indicates data deletion records. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.ChangeNotification#deleteEntries + */ + deleteEntries: Entry[]; + /** + * Indicates from device id. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.ChangeNotification#deviceId + */ + deviceId: string; + } + /** + * Indicates the database synchronization mode. + * + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.SyncMode + */ + enum SyncMode { + /** + * Indicates that data is only pulled from the remote end. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.SyncMode#PULL_ONLY + */ + PULL_ONLY = 0, + /** + * Indicates that data is only pushed from the local end. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.SyncMode#PUSH_ONLY + */ + PUSH_ONLY = 1, + /** + * Indicates that data is pushed from the local end, and then pulled from the remote end. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.SyncMode#PUSH_PULL + */ + PUSH_PULL = 2 + } + /** + * Describes the subscription type. + * + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.SubscribeType + */ + enum SubscribeType { + /** + * Subscription to local data changes + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.SubscribeType#SUBSCRIBE_TYPE_LOCAL + */ + SUBSCRIBE_TYPE_LOCAL = 0, + /** + * Subscription to remote data changes + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.SubscribeType#SUBSCRIBE_TYPE_REMOTE + */ + SUBSCRIBE_TYPE_REMOTE = 1, + /** + * Subscription to both local and remote data changes + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.SubscribeType#SUBSCRIBE_TYPE_ALL + */ + SUBSCRIBE_TYPE_ALL = 2 + } + /** + * Describes the {@code KVStore} type. + * + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.KVStoreType + */ + enum KVStoreType { + /** + * Device-collaboration database, as specified by {@code DeviceKVStore} + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.KVStoreType#DEVICE_COLLABORATION + */ + DEVICE_COLLABORATION = 0, + /** + * Single-version database, as specified by {@code SingleKVStore} + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.KVStoreType#SINGLE_VERSION + */ + SINGLE_VERSION = 1, + /** + * Multi-version database, as specified by {@code MultiKVStore} + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 7 + * @deprecated since 9 + */ + MULTI_VERSION = 2 + } + /** + * Describes the {@code KVStore} type. + * + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.SecurityLevel + */ + enum SecurityLevel { + /** + * NO_LEVEL: mains not set the security level. + * + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 7 + * @deprecated since 9 + */ + NO_LEVEL = 0, + /** + * S0: mains the db is public. + * There is no impact even if the data is leaked. + * + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 7 + * @deprecated since 9 + */ + S0 = 1, + /** + * S1: mains the db is low level security + * There are some low impact, when the data is leaked. + * + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.SecurityLevel#S1 + */ + S1 = 2, + /** + * S2: mains the db is middle level security + * There are some major impact, when the data is leaked. + * + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.SecurityLevel#S2 + */ + S2 = 3, + /** + * S3: mains the db is high level security + * There are some severity impact, when the data is leaked. + * + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.SecurityLevel#S3 + */ + S3 = 5, + /** + * S4: mains the db is critical level security + * There are some critical impact, when the data is leaked. + * + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.SecurityLevel#S4 + */ + S4 = 6 + } + /** + * Provides configuration options for creating a {@code KVStore}. + * + *

You can determine whether to create another database if a {@code KVStore} database is missing, + * whether to encrypt the database, and the database type. + * + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.Options + */ + interface Options { + /** + * Indicates whether to create a database when the database file does not exist + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.Options#createIfMissing + */ + createIfMissing?: boolean; + /** + * Indicates setting whether database files are encrypted + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.Options#encrypt + */ + encrypt?: boolean; + /** + * Indicates setting whether to back up database files + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.Options#backup + */ + backup?: boolean; + /** + * Indicates setting whether database files are automatically synchronized + * @permission ohos.permission.DISTRIBUTED_DATASYNC + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.Options#autoSync + */ + autoSync?: boolean; + /** + * Indicates setting the database type + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.Options#kvStoreType + */ + kvStoreType?: KVStoreType; + /** + * Indicates setting the database security level + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.Options#securityLevel + */ + securityLevel?: SecurityLevel; + /** + * Indicates schema object + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.Options#schema + */ + schema?: Schema; + } + /** + * Represents the database schema. + * + * You can create Schema objects and put them in Options when creating or opening the database. + * + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.Schema + */ + class Schema { + /** + * A constructor used to create a Schema instance. + * + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.Schema#constructor + */ + constructor(); + /** + * Indicates the root json object. + * + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.Schema#root + */ + root: FieldNode; + /** + * Indicates the string array of json. + * + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.Schema#indexes + */ + indexes: Array; + /** + * Indicates the mode of schema. + * + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.Schema#mode + */ + mode: number; + /** + * Indicates the skip size of schema. + * + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.Schema#skip + */ + skip: number; + } + /** + * Represents a node of a {@link Schema} instance. + * + *

Through the {@link Schema} instance, you can define the fields contained in the values stored in a database. + * + *

A FieldNode of the {@link Schema} instance is either a leaf or a non-leaf node. + * + *

The leaf node must have a value; the non-leaf node must have a child {@code FieldNode}. + * + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.FieldNode + */ + class FieldNode { + /** + * A constructor used to create a FieldNode instance with the specified field. + * name Indicates the field node name. + * + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.FieldNode#constructor + */ + constructor(name: string); + /** + * Adds a child node to this {@code FieldNode}. + * + *

Adding a child node makes this node a non-leaf node. Field value will be ignored if it has child node. + * + * @param child The field node to append. + * @returns Returns true if the child node is successfully added to this {@code FieldNode}; returns false otherwise. + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.FieldNode#appendChild + */ + appendChild(child: FieldNode): boolean; + /** + * Indicates the default value of field node. + * + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.FieldNode#default + */ + default: string; + /** + * Indicates the nullable of database field. + * + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.FieldNode#nullable + */ + nullable: boolean; + /** + * Indicates the type of value. + * + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.FieldNode#type + */ + type: number; + } + /** + * Provide methods to obtain the result set of the {@code KvStore} database. + * + *

The result set is created by using the {@code getResultSet} method in the {@code DeviceKVStore} class. This interface also provides + * methods for moving the data read position in the result set. + * + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.KVStoreResultSet + */ + interface KvStoreResultSet { + /** + * Obtains the number of lines in a result set. + * + * @returns Returns the number of lines. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.KVStoreResultSet#getCount + */ + getCount(): number; + /** + * Obtains the current read position in a result set. + * + * @returns Returns the current read position. The read position starts with 0. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.KVStoreResultSet#getPosition + */ + getPosition(): number; + /** + * Moves the read position to the first line. + * + *

If the result set is empty, false is returned. + * + * @returns Returns true if the operation succeeds; return false otherwise. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.KVStoreResultSet#moveToFirst + */ + moveToFirst(): boolean; + /** + * Moves the read position to the last line. + * + *

If the result set is empty, false is returned. + * + * @returns Returns true if the operation succeeds; return false otherwise. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.KVStoreResultSet#moveToLast + */ + moveToLast(): boolean; + /** + * Moves the read position to the next line. + * + *

If the result set is empty or the data in the last line is being read, false is returned. + * + * @returns Returns true if the operation succeeds; return false otherwise. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.KVStoreResultSet#moveToNext + */ + moveToNext(): boolean; + /** + * Moves the read position to the previous line. + * + *

If the result set is empty or the data in the first line is being read, false is returned. + * + * @returns Returns true if the operation succeeds; return false otherwise. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.KVStoreResultSet#moveToPrevious + */ + moveToPrevious(): boolean; + /** + * Moves the read position by a relative offset to the current position. + * + * @param offset Indicates the relative offset to the current position. A negative offset indicates moving backwards, and a + * positive offset indicates moving forwards. For example, if the current position is entry 1 and this offset is 2, + * the destination position will be entry 3; if the current position is entry 3 and this offset is -2, + * the destination position will be entry 1. The valid final position after moving forwards starts with 0. If the + * final position is invalid, false will be returned. + * @returns Returns true if the operation succeeds; return false otherwise. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.KVStoreResultSet#move + */ + move(offset: number): boolean; + /** + * Moves the read position from 0 to an absolute position. + * + * @param position Indicates the absolute position. + * @returns Returns true if the operation succeeds; return false otherwise. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.KVStoreResultSet#moveToPosition + */ + moveToPosition(position: number): boolean; + /** + * Checks whether the read position is the first line. + * + * @returns Returns true if the read position is the first line; returns false otherwise. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.KVStoreResultSet#isFirst + */ + isFirst(): boolean; + /** + * Checks whether the read position is the last line. + * + * @returns Returns true if the read position is the last line; returns false otherwise. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.KVStoreResultSet#isLast + */ + isLast(): boolean; + /** + * Checks whether the read position is before the last line. + * + * @returns Returns true if the read position is before the first line; returns false otherwise. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.KVStoreResultSet#isBeforeFirst + */ + isBeforeFirst(): boolean; + /** + * Checks whether the read position is after the last line. + * + * @returns Returns true if the read position is after the last line; returns false otherwise. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.KVStoreResultSet#isAfterLast + */ + isAfterLast(): boolean; + /** + * Obtains a key-value pair. + * + * @returns Returns a key-value pair. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.KVStoreResultSet#getEntry + */ + getEntry(): Entry; + } + /** + * Represents a database query using a predicate. + * + *

This class provides a constructor used to create a {@code Query} instance, which is used to query data matching specified + * conditions in the database. + * + *

This class also provides methods for adding predicates to the {@code Query} instance. + * + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.Query + */ + class Query { + /** + * A constructor used to create a Query instance. + * + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.Query#constructor + */ + constructor(); + /** + * Resets this {@code Query} object. + * + * @returns Returns the reset {@code Query} object. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.Query#reset + */ + reset(): Query; + /** + * Constructs a {@code Query} object to query entries with the specified field whose value is equal to the specified long value. + * + * @param field Indicates the field, which must start with $. and cannot contain ^. + * @param value IIndicates the long value. + * @returns Returns the {@coed Query} object. + * @throws Throws this exception if input is invalid. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.Query#equalTo + */ + equalTo(field: string, value: number | string | boolean): Query; + /** + * Constructs a {@code Query} object to query entries with the specified field whose value is not equal to the specified int value. + * + * @param field Indicates the field, which must start with $. and cannot contain ^. + * @param value Indicates the int value. + * @returns Returns the {@coed Query} object. + * @throws Throws this exception if input is invalid. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.Query#notEqualTo + */ + notEqualTo(field: string, value: number | string | boolean): Query; + /** + * Constructs a {@code Query} object to query entries with the specified field whose value is greater than or equal to the + * specified int value. + * + * @param field Indicates the field, which must start with $. and cannot contain ^. + * @param value Indicates the int value. + * @returns Returns the {@coed Query} object. + * @throws Throws this exception if input is invalid. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.Query#greaterThan + */ + greaterThan(field: string, value: number | string | boolean): Query; + /** + * Constructs a {@code Query} object to query entries with the specified field whose value is less than the specified int value. + * + * @param field Indicates the field, which must start with $. and cannot contain ^. + * @param value Indicates the int value. + * @returns Returns the {@coed Query} object. + * @throws Throws this exception if input is invalid. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.Query#lessThan + */ + lessThan(field: string, value: number | string): Query; + /** + * Constructs a {@code Query} object to query entries with the specified field whose value is greater than or equal to the + * specified int value. + * + * @param field Indicates the field, which must start with $. and cannot contain ^. + * @param value Indicates the int value. + * @returns Returns the {@coed Query} object. + * @throws Throws this exception if input is invalid. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.Query#greaterThanOrEqualTo + */ + greaterThanOrEqualTo(field: string, value: number | string): Query; + /** + * Constructs a {@code Query} object to query entries with the specified field whose value is less than or equal to the + * specified int value. + * + * @param field Indicates the field, which must start with $. and cannot contain ^. + * @param value Indicates the int value. + * @returns Returns the {@coed Query} object. + * @throws Throws this exception if input is invalid. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.Query#lessThanOrEqualTo + */ + lessThanOrEqualTo(field: string, value: number | string): Query; + /** + * Constructs a {@code Query} object to query entries with the specified field whose value is null. + * + * @param field Indicates the field, which must start with $. and cannot contain ^. + * @returns Returns the {@coed Query} object. + * @throws Throws this exception if input is invalid. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.Query#isNull + */ + isNull(field: string): Query; + /** + * Constructs a {@code Query} object to query entries with the specified field whose value is within the specified int value list. + * + * @param field Indicates the field, which must start with $. and cannot contain ^. + * @param valueList Indicates the int value list. + * @returns Returns the {@coed Query} object. + * @throws Throws this exception if input is invalid. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.Query#inNumber + */ + inNumber(field: string, valueList: number[]): Query; + /** + * Constructs a {@code Query} object to query entries with the specified field whose value is within the specified string value list. + * + * @param field Indicates the field, which must start with $. and cannot contain ^. + * @param valueList Indicates the string value list. + * @returns Returns the {@coed Query} object. + * @throws Throws this exception if input is invalid. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.Query#inString + */ + inString(field: string, valueList: string[]): Query; + /** + * Constructs a {@code Query} object to query entries with the specified field whose value is not within the specified int value list. + * + * @param field Indicates the field, which must start with $. and cannot contain ^. + * @param valueList Indicates the int value list. + * @returns Returns the {@coed Query} object. + * @throws Throws this exception if input is invalid. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.Query#notInNumber + */ + notInNumber(field: string, valueList: number[]): Query; + /** + * Constructs a {@code Query} object to query entries with the specified field whose value is not within the specified string value list. + * + * @param field Indicates the field, which must start with $. and cannot contain ^. + * @param valueList Indicates the string value list. + * @returns Returns the {@coed Query} object. + * @throws Throws this exception if input is invalid. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.Query#notInString + */ + notInString(field: string, valueList: string[]): Query; + /** + * Constructs a {@code Query} object to query entries with the specified field whose value is similar to the specified string value. + * + * @param field Indicates the field, which must start with $. and cannot contain ^. + * @param value Indicates the string value. + * @returns Returns the {@coed Query} object. + * @throws Throws this exception if input is invalid. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.Query#like + */ + like(field: string, value: string): Query; + /** + * Constructs a {@code Query} object to query entries with the specified field whose value is not similar to the specified string value. + * + * @param field Indicates the field, which must start with $. and cannot contain ^. + * @param value Indicates the string value. + * @returns Returns the {@coed Query} object. + * @throws Throws this exception if input is invalid. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.Query#unlike + */ + unlike(field: string, value: string): Query; + /** + * Constructs a {@code Query} object with the and condition. + * + *

Multiple predicates should be connected using the and or or condition. + * + * @returns Returns the {@coed Query} object. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.Query#and + */ + and(): Query; + /** + * Constructs a {@code Query} object with the or condition. + * + *

Multiple predicates should be connected using the and or or condition. + * + * @returns Returns the {@coed Query} object. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.Query#or + */ + or(): Query; + /** + * Constructs a {@code Query} object to sort the query results in ascending order. + * + * @param field Indicates the field, which must start with $. and cannot contain ^. + * @returns Returns the {@coed Query} object. + * @throws Throws this exception if input is invalid. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.Query#orderByAsc + */ + orderByAsc(field: string): Query; + /** + * Constructs a {@code Query} object to sort the query results in descending order. + * + * @param field Indicates the field, which must start with $. and cannot contain ^. + * @returns Returns the {@coed Query} object. + * @throws Throws this exception if input is invalid. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.Query#orderByDesc + */ + orderByDesc(field: string): Query; + /** + * Constructs a {@code Query} object to specify the number of results and the start position. + * + * @param total Indicates the number of results. + * @param offset Indicates the start position. + * @returns Returns the {@coed Query} object. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.Query#limit + */ + limit(total: number, offset: number): Query; + /** + * Creates a {@code query} condition with a specified field that is not null. + * + * @param field Indicates the specified field. + * @returns Returns the {@coed Query} object. + * @throws Throws this exception if input is invalid. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.Query#isNotNull + */ + isNotNull(field: string): Query; + /** + * Creates a query condition group with a left bracket. + * + *

Multiple query conditions in an {@code Query} object can be grouped. The query conditions in a group can be used as a + * whole to combine with other query conditions. + * + * @returns Returns the {@coed Query} object. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.Query#beginGroup + */ + beginGroup(): Query; + /** + * Creates a query condition group with a right bracket. + * + *

Multiple query conditions in an {@code Query} object can be grouped. The query conditions in a group can be used as a + * whole to combine with other query conditions. + * + * @returns Returns the {@coed Query} object. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.Query#endGroup + */ + endGroup(): Query; + /** + * Creates a query condition with a specified key prefix. + * + * @param prefix Indicates the specified key prefix. + * @returns Returns the {@coed Query} object. + * @throws Throws this exception if input is invalid. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.Query#prefixKey + */ + prefixKey(prefix: string): Query; + /** + * Sets a specified index that will be preferentially used for query. + * + * @param index Indicates the index to set. + * @returns Returns the {@coed Query} object. + * @throws Throws this exception if input is invalid. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.Query#setSuggestIndex + */ + setSuggestIndex(index: string): Query; + /** + * Add device ID key prefix.Used by {@code DeviceKVStore}. + * + * @param deviceId Specify device id to query from. + * @returns Returns the {@code Query} object with device ID prefix added. + * @throws Throws this exception if input is invalid. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.Query#deviceId + */ + deviceId(deviceId: string): Query; + /** + * Get a String that represents this {@code Query}. + * + *

The String would be parsed to DB query format. + * The String length should be no longer than 500kb. + * + * @returns String representing this {@code Query}. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.Query#getSqlLike + */ + getSqlLike(): string; + } + /** + * Represents a key-value distributed database and provides methods for adding, deleting, modifying, querying, + * and subscribing to distributed data. + * + *

You can create distributed databases of different types by {@link KVManager#getKVStore (Options, String)} + * with input parameter {@code Options}. Distributed database types are defined in {@code KVStoreType}, + * including {@code SingleKVStore}. + * + * + * @version 1 + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.SingleKVStore + */ + interface KVStore { + /** + * Writes a key-value pair of the string type into the {@code KvStore} database. + * + *

If you do not want to synchronize this key-value pair to other devices, set the write option in the local database. + * + * @param key Indicates the key. The length must be less than {@code MAX_KEY_LENGTH}. + * Spaces before and after the key will be cleared. + * @param value Indicates the string value, which must be less than 4 MB as a UTF-8 byte array. + * @throws Throws this exception if any of the following errors + * occurs: {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, and {@code DB_ERROR}. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.SingleKVStore#put + */ + put(key: string, value: Uint8Array | string | number | boolean, callback: AsyncCallback): void; + put(key: string, value: Uint8Array | string | number | boolean): Promise; + /** + * Deletes the key-value pair based on a specified key. + * + * @param key Indicates the key. The length must be less than {@code MAX_KEY_LENGTH}. + * Spaces before and after the key will be cleared. + * @throws Throws this exception if any of the following errors + * occurs: {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, and + * {@code DB_ERROR}, and {@code KEY_NOT_FOUND}. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.SingleKVStore#delete + */ + delete(key: string, callback: AsyncCallback): void; + delete(key: string): Promise; + /** + * Registers a {@code KvStoreObserver} for the database. When data in the distributed database changes, the callback in + * {@code KvStoreObserver} will be invoked. + * + * @param type Indicates the subscription type, which is defined in {@code SubscribeType}. + * @param listener Indicates the observer of data change events in the distributed database. + * @throws Throws this exception if any of the following errors + * occurs: {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, + * {@code DB_ERROR}, and {@code STORE_ALREADY_SUBSCRIBE}. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.SingleKVStore#on + */ + on(event: 'dataChange', type: SubscribeType, listener: Callback): void; + /** + * Subscribe the {@code KvStore} database based on the specified subscribeType and {@code KvStoreObserver}. + * + * @throws Throws this exception if any of the following errors + * occurs: {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, + * {@code DB_ERROR}, and {@code STORE_ALREADY_SUBSCRIBE}. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.SingleKVStore#on + */ + on(event: 'syncComplete', syncCallback: Callback>): void; + /** + * Unsubscribe the {@code KvStore} database based on the specified subscribeType and {@code KvStoreObserver}. + * + * @param listener Indicates the data change observer registered by {#subscribe(SubscribeType, KvStoreObserver)}. + * @throws Throws this exception if any of the following errors + * occurs: {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, + * {@code DB_ERROR}, and {@code STORE_ALREADY_SUBSCRIBE}. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.SingleKVStore#off + */ + off(event: 'dataChange', listener?: Callback): void; + /** + * UnRegister the {@code KvStore} database synchronization callback. + * + * @param syncCallback Indicates the callback used to send the synchronization result to caller. + * @throws Throws this exception if any of the following errors + * occurs: {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, + * {@code DB_ERROR}, and {@code STORE_ALREADY_SUBSCRIBE}. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.SingleKVStore#off + */ + off(event: 'syncComplete', syncCallback?: Callback>): void; + /** + * Inserts key-value pairs into the {@code KvStore} database in batches. + * + * @param entries Indicates the key-value pairs to be inserted in batches. + * @throws Throws this exception if a database error occurs. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.SingleKVStore#putBatch + */ + putBatch(entries: Entry[], callback: AsyncCallback): void; + putBatch(entries: Entry[]): Promise; + /** + * Deletes key-value pairs in batches from the {@code KvStore} database. + * + * @param keys Indicates the key-value pairs to be deleted in batches. + * @throws Throws this exception if a database error occurs. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.SingleKVStore#deleteBatch + */ + deleteBatch(keys: string[], callback: AsyncCallback): void; + deleteBatch(keys: string[]): Promise; + /** + * Starts a transaction operation in the {@code KvStore} database. + * + *

After the database transaction is started, you can submit or roll back the operation. + * + * @throws Throws this exception if a database error occurs. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.SingleKVStore#startTransaction + */ + startTransaction(callback: AsyncCallback): void; + startTransaction(): Promise; + /** + * Submits a transaction operation in the {@code KvStore} database. + * + * @param callback + * @throws Throws this exception if a database error occurs. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.SingleKVStore#commit + */ + commit(callback: AsyncCallback): void; + commit(): Promise; + /** + * Rolls back a transaction operation in the {@code KvStore} database. + * + * @throws Throws this exception if a database error occurs. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.SingleKVStore#rollback + */ + rollback(callback: AsyncCallback): void; + rollback(): Promise; + /** + * Sets whether to enable synchronization. + * + * @param enabled Specifies whether to enable synchronization. The value true means to enable + * synchronization, and false means the opposite. + * @throws Throws this exception if an internal service error occurs. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.SingleKVStore#enableSync + */ + enableSync(enabled: boolean, callback: AsyncCallback): void; + enableSync(enabled: boolean): Promise; + /** + * Sets synchronization range labels. + * + *

The labels determine the devices with which data will be synchronized. + * + * @param localLabels Indicates the synchronization labels of the local device. + * @param remoteSupportLabels Indicates the labels of the devices with which data will be synchronized. + * @throws Throws this exception if an internal service error occurs. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.SingleKVStore#setSyncRange + */ + setSyncRange(localLabels: string[], remoteSupportLabels: string[], callback: AsyncCallback): void; + setSyncRange(localLabels: string[], remoteSupportLabels: string[]): Promise; + } + /** + * Provides methods related to single-version distributed databases. + * + *

To create a {@code SingleKVStore} database, + * you can use the {@link data.distributed.common.KVManager#getKVStore​(Options, String)} method + * with {@code KVStoreType} set to {@code SINGLE_VERSION} for the input parameter {@code Options}. + * This database synchronizes data to other databases in time sequence. + * The {@code SingleKVStore} database does not support + * synchronous transactions, or data search using snapshots. + * + * @version 1 + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.SingleKVStore + */ + interface SingleKVStore extends KVStore { + /** + * Obtains the {@code String} value of a specified key. + * + * @param key Indicates the key of the boolean value to be queried. + * @throws Throws this exception if any of the following errors occurs:{@code INVALID_ARGUMENT}, + * {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, {@code DB_ERROR}, and {@code KEY_NOT_FOUND}. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.SingleKVStore#get + */ + get(key: string, callback: AsyncCallback): void; + get(key: string): Promise; + /** + * Obtains all key-value pairs that match a specified key prefix. + * + * @param keyPrefix Indicates the key prefix to match. + * @returns Returns the list of all key-value pairs that match the specified key prefix. + * @throws Throws this exception if any of the following errors occurs:{@code INVALID_ARGUMENT}, + * {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, and {@code DB_ERROR}. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.SingleKVStore#getEntries + */ + getEntries(keyPrefix: string, callback: AsyncCallback): void; + getEntries(keyPrefix: string): Promise; + /** + * Obtains the list of key-value pairs matching the specified {@code Query} object. + * + * @param query Indicates the {@code Query} object. + * @returns Returns the list of key-value pairs matching the specified {@code Query} object. + * @throws Throws this exception if any of the following errors occurs: {@code INVALID_ARGUMENT}, + * {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, and {@code DB_ERROR}. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.SingleKVStore#getEntries + */ + getEntries(query: Query, callback: AsyncCallback): void; + getEntries(query: Query): Promise; + /** + * Obtains the result sets with a specified prefix from a {@code KvStore} database. The {@code KvStoreResultSet} object can be used to + * query all key-value pairs that meet the search criteria. Each {@code KvStore} instance can have a maximum of four + * {@code KvStoreResultSet} objects at the same time. If you have created four objects, calling this method will return a + * failure. Therefore, you are advised to call the closeResultSet method to close unnecessary {@code KvStoreResultSet} objects + * in a timely manner. + * + * @param keyPrefix Indicates the key prefix to match. + * @throws Throws this exception if any of the following errors occurs:{@code INVALID_ARGUMENT}, + * {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, and {@code DB_ERROR}. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.SingleKVStore#getResultSet + */ + getResultSet(keyPrefix: string, callback: AsyncCallback): void; + getResultSet(keyPrefix: string): Promise; + /** + * Obtains the {@code KvStoreResultSet} object matching the specified {@code Query} object. + * + * @param query Indicates the {@code Query} object. + * @throws Throws this exception if any of the following errors occurs:{@code INVALID_ARGUMENT}, + * {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, and {@code DB_ERROR}. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.SingleKVStore#getResultSet + */ + getResultSet(query: Query, callback: AsyncCallback): void; + getResultSet(query: Query): Promise; + /** + * Closes a {@code KvStoreResultSet} object returned by getResultSet. + * + * @param resultSet Indicates the {@code KvStoreResultSet} object to close. + * @throws Throws this exception if any of the following errors occurs:{@code INVALID_ARGUMENT}, + * {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, and {@code DB_ERROR}. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.SingleKVStore#closeResultSet + */ + closeResultSet(resultSet: KvStoreResultSet, callback: AsyncCallback): void; + closeResultSet(resultSet: KvStoreResultSet): Promise; + /** + * Obtains the number of results matching the specified {@code Query} object. + * + * @param query Indicates the {@code Query} object. + * @returns Returns the number of results matching the specified {@code Query} object. + * @throws Throws this exception if any of the following errors occurs:{@code INVALID_ARGUMENT}, + * {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, and {@code DB_ERROR}. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.SingleKVStore#getResultSize + */ + getResultSize(query: Query, callback: AsyncCallback): void; + getResultSize(query: Query): Promise; + /** + * void removeDeviceData​({@link String} deviceId) throws {@link KvStoreException} + * + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.SingleKVStore#removeDeviceData + */ + removeDeviceData(deviceId: string, callback: AsyncCallback): void; + removeDeviceData(deviceId: string): Promise; + /** + * Synchronize the database to the specified devices with the specified delay allowed. + * + * @param deviceIds Indicates the list of devices to which to synchronize the database. + * @param mode Indicates the synchronization mode. The value can be {@code PUSH}, {@code PULL}, or {@code PUSH_PULL}. + * @param delayMs Indicates the delay allowed for the synchronization, in milliseconds. + * @throws Throws this exception if any of the following errors occurs: {@code INVALID_ARGUMENT}, + * {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, and {@code DB_ERROR}. + * @permission ohos.permission.DISTRIBUTED_DATASYNC + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.SingleKVStore#sync + */ + sync(deviceIds: string[], mode: SyncMode, delayMs?: number): void; + /** + * Register a {@code KvStoreObserver} for the database. When data in the distributed database changes, the callback + * in the {@code KvStoreObserver} will be invoked. + * + * @param type Indicates the subscription type, which is defined in {@code SubscribeType}. + * @param listener Indicates the observer of data change events in the distributed database. + * @throws Throws this exception if no {@code SingleKvStore} database is available. + * {@code DB_ERROR}, and {@code STORE_ALREADY_SUBSCRIBE}. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.SingleKVStore#on + */ + on(event: 'dataChange', type: SubscribeType, listener: Callback): void; + /** + * Register a SingleKvStore database synchronization callback. + *

Sync result is returned through asynchronous callback. + * + * @param syncCallback Indicates the callback used to send the synchronization result to the caller. + * @throws Throws this exception if no {@code SingleKvStore} database is available. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.SingleKVStore#on + */ + on(event: 'syncComplete', syncCallback: Callback>): void; + /** + * Unsubscribe the SingleKvStore database based on the specified subscribeType and {@code KvStoreObserver}. + * + * @param listener Indicates the data change observer registered by {#subscribe(SubscribeType, KvStoreObserver)}. + * @throws Throws this exception if any of the following errors + * occurs: {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, + * {@code DB_ERROR}, and {@code STORE_ALREADY_SUBSCRIBE}. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.SingleKVStore#off + */ + off(event: 'dataChange', listener?: Callback): void; + /** + * UnRegister the SingleKvStore database synchronization callback. + * + * @throws Throws this exception if no {@code SingleKvStore} database is available. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.SingleKVStore#off + */ + off(event: 'syncComplete', syncCallback?: Callback>): void; + /** + * Sets the default delay allowed for database synchronization + * + * @param defaultAllowedDelayMs Indicates the default delay allowed for the database synchronization, in milliseconds. + * @throws Throws this exception if any of the following errors occurs:{@code INVALID_ARGUMENT}, + * {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, and {@code DB_ERROR}. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.SingleKVStore#setSyncParam + */ + setSyncParam(defaultAllowedDelayMs: number, callback: AsyncCallback): void; + setSyncParam(defaultAllowedDelayMs: number): Promise; + /** + * Get the security level of the database. + * + * @returns SecurityLevel {@code SecurityLevel} the security level of the database. + * @throws Throws this exception if any of the following errors occurs:{@code SERVER_UNAVAILABLE}, + * {@code IPC_ERROR}, and {@code DB_ERROR}. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.SingleKVStore#getSecurityLevel + */ + getSecurityLevel(callback: AsyncCallback): void; + getSecurityLevel(): Promise; + } + /** + * Manages distributed data by device in a distributed system. + * + *

To create a {@code DeviceKVStore} database, you can use the {@link data.distributed.common.KVManager.getKvStore(Options, String)} + * method with {@code KvStoreType} set to {@code DEVICE_COLLABORATION} for the input parameter Options. This database manages distributed + * data by device, and cannot modify data synchronized from remote devices. When an application writes a key-value pair entry + * into the database, the system automatically adds the ID of the device running the application to the key. + * + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.DeviceKVStore + */ + interface DeviceKVStore extends KVStore { + /** + * Obtains the {@code String} value matching a specified device ID and key. + * + * @param deviceId Indicates the device to be queried. + * @param key Indicates the key of the value to be queried. + * @returns Returns the value matching the given criteria. + * @throws Throws this exception if any of the following errors occurs: {@code INVALID_ARGUMENT}, + * {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, {@code DB_ERROR}, and {@code KEY_NOT_FOUND}. + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.DeviceKVStore#get + */ + get(deviceId: string, key: string, callback: AsyncCallback): void; + get(deviceId: string, key: string): Promise; + /** + * Obtains all key-value pairs matching a specified device ID and key prefix. + * + * @param deviceId Identifies the device whose data is to be queried. + * @param keyPrefix Indicates the key prefix to match. + * @returns Returns the list of all key-value pairs meeting the given criteria. + * @throws Throws this exception if any of the following errors occurs: {@code INVALID_ARGUMENT}, + * {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, {@code DB_ERROR}. + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.DeviceKVStore#getEntries + */ + getEntries(deviceId: string, keyPrefix: string, callback: AsyncCallback): void; + getEntries(deviceId: string, keyPrefix: string): Promise; + /** + * Obtains the list of key-value pairs matching the specified {@code Query} object. + * + * @param query Indicates the {@code Query} object. + * @returns Returns the list of key-value pairs matching the specified {@code Query} object. + * @throws Throws this exception if any of the following errors occurs: {@code INVALID_ARGUMENT}, + * {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, {@code DB_ERROR}. + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.DeviceKVStore#getEntries + */ + getEntries(query: Query, callback: AsyncCallback): void; + getEntries(query: Query): Promise; + /** + * Obtains the list of key-value pairs matching a specified device ID and {@code Query} object. + * + * @param deviceId Indicates the ID of the device to which the key-value pairs belong. + * @param query Indicates the {@code Query} object. + * @returns Returns the list of key-value pairs matching the specified {@code Query} object. + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.DeviceKVStore#getEntries + */ + getEntries(deviceId: string, query: Query, callback: AsyncCallback): void; + getEntries(deviceId: string, query: Query): Promise; + /** + * Obtains the {@code KvStoreResultSet} object matching the specified device ID and key prefix. + * + *

The {@code KvStoreResultSet} object can be used to query all key-value pairs that meet the search criteria. Each {@code KvStore} + * instance can have a maximum of four {@code KvStoreResultSet} objects at the same time. If you have created four objects, + * calling this method will return a failure. Therefore, you are advised to call the closeResultSet method to close unnecessary + * {@code KvStoreResultSet} objects in a timely manner. + * + * @param deviceId Identifies the device whose data is to be queried. + * @param keyPrefix Indicates the key prefix to match. + * @returns Returns the {@code KvStoreResultSet} objects. + * @throws Throws this exception if any of the following errors occurs: {@code INVALID_ARGUMENT}, + * {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, {@code DB_ERROR}. + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.DeviceKVStore#getResultSet + */ + getResultSet(deviceId: string, keyPrefix: string, callback: AsyncCallback): void; + getResultSet(deviceId: string, keyPrefix: string): Promise; + /** + * Obtains the {@code KvStoreResultSet} object matching the specified {@code Query} object. + * + * @param query Indicates the {@code Query} object. + * @returns Returns the {@code KvStoreResultSet} object matching the specified {@code Query} object. + * @throws Throws this exception if any of the following errors occurs: {@code INVALID_ARGUMENT}, + * {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, {@code DB_ERROR}. + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.DeviceKVStore#getResultSet + */ + getResultSet(query: Query, callback: AsyncCallback): void; + getResultSet(query: Query): Promise; + /** + * Obtains the {@code KvStoreResultSet} object matching a specified device ID and {@code Query} object. + * + * @param deviceId Indicates the ID of the device to which the {@code KvStoreResultSet} object belongs. + * @param query Indicates the {@code Query} object. + * @returns Returns the {@code KvStoreResultSet} object matching the specified {@code Query} object. + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.DeviceKVStore#getResultSet + */ + getResultSet(deviceId: string, query: Query, callback: AsyncCallback): void; + getResultSet(deviceId: string, query: Query): Promise; + /** + * Closes a {@code KvStoreResultSet} object returned by getResultSet. + * + * @param resultSet Indicates the {@code KvStoreResultSet} object to close. + * @throws Throws this exception if any of the following errors occurs: {@code INVALID_ARGUMENT}, + * {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, {@code DB_ERROR}. + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.DeviceKVStore#closeResultSet + */ + closeResultSet(resultSet: KvStoreResultSet, callback: AsyncCallback): void; + closeResultSet(resultSet: KvStoreResultSet): Promise; + /** + * Obtains the number of results matching the specified {@code Query} object. + * + * @param query Indicates the {@code Query} object. + * @returns Returns the number of results matching the specified {@code Query} object. + * @throws Throws this exception if any of the following errors occurs: {@code INVALID_ARGUMENT}, + * {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, {@code DB_ERROR}. + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.DeviceKVStore#getResultSize + */ + getResultSize(query: Query, callback: AsyncCallback): void; + getResultSize(query: Query): Promise; + /** + * Obtains the number of results matching a specified device ID and {@code Query} object. + * + * @param deviceId Indicates the ID of the device to which the results belong. + * @param query Indicates the {@code Query} object. + * @returns Returns the number of results matching the specified {@code Query} object. + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.DeviceKVStore#getResultSize + */ + getResultSize(deviceId: string, query: Query, callback: AsyncCallback): void; + getResultSize(deviceId: string, query: Query): Promise; + /** + * Removes data of a specified device from the current database. This method is used to remove only the data + * synchronized from remote devices. This operation does not synchronize data to other databases or affect + * subsequent data synchronization. + * + * @param deviceId Identifies the device whose data is to be removed. The value cannot be the current device ID. + * @throws Throws this exception if any of the following errors occurs: {@code INVALID_ARGUMENT}, + * {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, {@code DB_ERROR}. + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.DeviceKVStore#removeDeviceData + */ + removeDeviceData(deviceId: string, callback: AsyncCallback): void; + removeDeviceData(deviceId: string): Promise; + /** + * Synchronize the {@code DeviceKVStore} databases. + * + *

This method returns immediately and sync result will be returned through asynchronous callback. + * + * @permission ohos.permission.DISTRIBUTED_DATASYNC + * @param deviceIds Indicates the list of IDs of devices whose + * @param delayMs Indicates the delay allowed for the synchronization, in milliseconds. + * {@code DeviceKVStore} databases are to be synchronized. + * @param mode Indicates the synchronization mode, {@code PUSH}, {@code PULL}, or + * {@code PUSH_PULL}. + * @throws Throws this exception if no DeviceKVStore database is available. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.DeviceKVStore#sync + */ + sync(deviceIds: string[], mode: SyncMode, delayMs?: number): void; + /** + * Register a {@code KvStoreObserver} for the database. When data in the distributed database changes, the + * callback in the {@code KvStoreObserver} will be invoked. + * + * @param type Indicates the subscription type, which is defined in {@code SubscribeType}. + * @param listener Indicates the observer of data change events in the distributed database. + * @throws Throws this exception if any of the following errors + * occurs: {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, + * {@code DB_ERROR}, and {@code STORE_ALREADY_SUBSCRIBE}. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.DeviceKVStore#on + */ + on(event: 'dataChange', type: SubscribeType, listener: Callback): void; + /** + * Register a DeviceKVStore database synchronization callback. + * + *

Sync result is returned through asynchronous callback. + * + * @param syncCallback Indicates the callback used to send the synchronization result to the caller. + * @throws Throws this exception if no DeviceKVStore database is available. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.DeviceKVStore#on + */ + on(event: 'syncComplete', syncCallback: Callback>): void; + /** + * Unsubscribe the DeviceKVStore database based on the specified subscribeType and {@code KvStoreObserver}. + * + * @param listener Indicates the data change observer registered by {#subscribe(SubscribeType, KvStoreObserver)}. + * @throws Throws this exception if any of the following errors + * occurs: {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, + * {@code DB_ERROR}, and {@code STORE_ALREADY_SUBSCRIBE}. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.DeviceKVStore#off + */ + off(event: 'dataChange', listener?: Callback): void; + /** + * UnRegister the DeviceKVStore database synchronization callback. + * + * @throws Throws this exception if no DeviceKVStore database is available. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.DeviceKVStore#off + */ + off(event: 'syncComplete', syncCallback?: Callback>): void; + } + /** + * Creates a {@link KVManager} instance based on the configuration information. + * + *

You must pass {@link KVManagerConfig} to provide configuration information + * for creating the {@link KVManager} instance. + * + * @param config Indicates the {@link KVStore} configuration information, + * including the user information and package name. + * @returns Returns the {@code KVManager} instance. + * @throws Throws exception if input is invalid. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore#createKVManager + */ + function createKVManager(config: KVManagerConfig, callback: AsyncCallback): void; + function createKVManager(config: KVManagerConfig): Promise; + /** + * Provides interfaces to manage a {@code KVStore} database, including obtaining, closing, and deleting the {@code KVStore}. + * + * @version 1 + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.KVManager + */ + interface KVManager { + /** + * Creates and obtains a {@code KVStore} database by specifying {@code Options} and {@code storeId}. + * + * @param options Indicates the options used for creating and obtaining the {@code KVStore} database, + * including {@code isCreateIfMissing}, {@code isEncrypt}, and {@code KVStoreType}. + * @param storeId Identifies the {@code KVStore} database. + * The value of this parameter must be unique for the same application, + * and different applications can share the same value. + * @returns Returns a {@code KVStore}, or {@code SingleKVStore}. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.KVManager#getKVStore + */ + getKVStore(storeId: string, options: Options): Promise; + getKVStore(storeId: string, options: Options, callback: AsyncCallback): void; + /** + * Closes the {@code KvStore} database. + * + *

Warning: This method is not thread-safe. If you call this method to stop a KvStore database that is running, your + * thread may crash. + * + *

The {@code KvStore} database to close must be an object created by using the {@code getKvStore} method. Before using this + * method, release the resources created for the database, for example, {@code KvStoreResultSet} for {@code SingleKvStore}, + * otherwise closing the database will fail. If you are attempting to close a database that is already closed, an error + * will be returned. + * + * @param kvStore Indicates the {@code KvStore} database to close. + * @throws Throws this exception if any of the following errors + * occurs:{@code INVALID_ARGUMENT}, {@code SERVER_UNAVAILABLE}, + * {@code STORE_NOT_OPEN}, {@code STORE_NOT_FOUND}, {@code DB_ERROR}, + * {@code PERMISSION_DENIED}, and {@code IPC_ERROR}. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.KVManager#closeKVStore + */ + closeKVStore(appId: string, storeId: string, kvStore: KVStore, callback: AsyncCallback): void; + closeKVStore(appId: string, storeId: string, kvStore: KVStore): Promise; + /** + * Deletes the {@code KvStore} database identified by storeId. + * + *

Before using this method, close all {@code KvStore} instances in use that are identified by the same storeId. + * + *

You can use this method to delete a {@code KvStore} database not in use. After the database is deleted, all its data will be + * lost. + * + * @param storeId Identifies the {@code KvStore} database to delete. + * @throws Throws this exception if any of the following errors + * occurs: {@code INVALID_ARGUMENT}, + * {@code SERVER_UNAVAILABLE}, {@code STORE_NOT_FOUND}, + * {@code DB_ERROR}, {@code PERMISSION_DENIED}, and {@code IPC_ERROR}. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.KVManager#deleteKVStore + */ + deleteKVStore(appId: string, storeId: string, callback: AsyncCallback): void; + deleteKVStore(appId: string, storeId: string): Promise; + /** + * Obtains the storeId of all {@code KvStore} databases that are created by using the {@code getKvStore} method and not deleted by + * calling the {@code deleteKvStore} method. + * + * @returns Returns the storeId of all created {@code KvStore} databases. + * @throws Throws this exception if any of the following errors + * occurs: {@code SERVER_UNAVAILABLE}, {@code DB_ERROR}, + * {@code PERMISSION_DENIED}, and {@code IPC_ERROR}. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.KVManager#getAllKVStoreId + */ + getAllKVStoreId(appId: string, callback: AsyncCallback): void; + getAllKVStoreId(appId: string): Promise; + /** + * register DeviceChangeCallback to get notification when device's status changed + * + * @param deathCallback device change callback {@code DeviceChangeCallback} + * @throws exception maybe occurs. + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.KVManager#on + */ + on(event: 'distributedDataServiceDie', deathCallback: Callback): void; + /** + * unRegister DeviceChangeCallback and can not receive notification + * + * @param deathCallback device change callback {@code DeviceChangeCallback} which has been registered. + * @throws exception maybe occurs. + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.KVManager#off + */ + off(event: 'distributedDataServiceDie', deathCallback?: Callback): void; + } +} +export default distributedData; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.data.distributedDataObject.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.data.distributedDataObject.d.ts new file mode 100755 index 00000000..509954a6 --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.data.distributedDataObject.d.ts @@ -0,0 +1,451 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit ArkData + */ +import { AsyncCallback } from './@ohos.base'; +import type Context from './application/BaseContext'; +import commonType from '@ohos.data.commonType'; +/** + * Provides interfaces to sync distributed object. + * + * @namespace distributedDataObject + * @syscap SystemCapability.DistributedDataManager.DataObject.DistributedObject + * @since 8 + */ +declare namespace distributedDataObject { + /** + * The information about the database bound to the asset. + * + * @interface BindInfo + * @syscap SystemCapability.DistributedDataManager.DataObject.DistributedObject + * @since 11 + */ + interface BindInfo { + /** + * The name of store where the asset resides. + * + * @type { string } + * @syscap SystemCapability.DistributedDataManager.DataObject.DistributedObject + * @since 11 + */ + storeName: string; + /** + * The name of table where the asset resides. + * + * @type { string } + * @syscap SystemCapability.DistributedDataManager.DataObject.DistributedObject + * @since 11 + */ + tableName: string; + /** + * The Primary key of the rdb table where the asset resides. + * + * @type { commonType.ValuesBucket } + * @syscap SystemCapability.DistributedDataManager.DataObject.DistributedObject + * @since 11 + */ + primaryKey: commonType.ValuesBucket; + /** + * The field(column) name of the rdb table where the asset resides. + * + * @type { string } + * @syscap SystemCapability.DistributedDataManager.DataObject.DistributedObject + * @since 11 + */ + field: string; + /** + * Name of the asset to be bound. When the column type is Assets, this field refers to the asset name of + * one of the assets. + * + * @type { string } + * @syscap SystemCapability.DistributedDataManager.DataObject.DistributedObject + * @since 11 + */ + assetName: string; + } + /** + * Create distributed object. + * + * @param { object } source - Source Init data of distributed object. + * @returns { DistributedObject } - Return the distributed object. + * @syscap SystemCapability.DistributedDataManager.DataObject.DistributedObject + * @since 8 + * @deprecated since 9 + * @useinstead ohos.distributedDataObject.create + */ + function createDistributedObject(source: object): DistributedObject; + /** + * Create distributed object. + * + * @param { Context } context - Indicates the application context. + * @param { object } source - Source Init data of distributed object. + * @returns { DataObject } - Return the distributed object. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types. + * @syscap SystemCapability.DistributedDataManager.DataObject.DistributedObject + * @since 9 + */ + function create(context: Context, source: object): DataObject; + /** + * Generate a random sessionId. + * + * @returns { string } - Return generated sessionId. + * @syscap SystemCapability.DistributedDataManager.DataObject.DistributedObject + * @since 8 + */ + function genSessionId(): string; + /** + * The response of save. + * Contains the parameter information of the save object. + * + * @interface SaveSuccessResponse + * @syscap SystemCapability.DistributedDataManager.DataObject.DistributedObject + * @since 9 + */ + interface SaveSuccessResponse { + /** + * sessionId of saved object + * + * @syscap SystemCapability.DistributedDataManager.DataObject.DistributedObject + * @since 9 + */ + sessionId: string; + /** + * version of saved object, can compare with DistributedObject.__version + * + * @syscap SystemCapability.DistributedDataManager.DataObject.DistributedObject + * @since 9 + */ + version: number; + /** + * deviceid that data saved + * data is "local", means save in local device + * otherwise, means the deviceId of others device + * + * @syscap SystemCapability.DistributedDataManager.DataObject.DistributedObject + * @since 9 + */ + deviceId: string; + } + /** + * The response of revokeSave. + * Contains the sessionId of the changed object. + * + * @interface RevokeSaveSuccessResponse + * @syscap SystemCapability.DistributedDataManager.DataObject.DistributedObject + * @since 9 + */ + interface RevokeSaveSuccessResponse { + /** + * The sessionId of the changed object. + * + * @syscap SystemCapability.DistributedDataManager.DataObject.DistributedObject + * @since 9 + */ + sessionId: string; + } + /** + * Object create by {@link createDistributedObject}. + * + * @interface DistributedObject + * @syscap SystemCapability.DistributedDataManager.DataObject.DistributedObject + * @since 8 + * @deprecated since 9 + * @useinstead ohos.distributedDataObject.DataObject + */ + interface DistributedObject { + /** + * Change object session + * + * @permission ohos.permission.DISTRIBUTED_DATASYNC + * @param { string } sessionId - sessionId The sessionId to be joined, if empty, leave all session. + * @returns { boolean } - Return a result of function. + * @syscap SystemCapability.DistributedDataManager.DataObject.DistributedObject + * @since 8 + * @deprecated since 9 + * @useinstead ohos.distributedDataObject.DataObject.setSessionId + */ + setSessionId(sessionId?: string): boolean; + /** + * On watch of change + * + * @param { 'change' } type - Event type, fixed as 'change', indicates data change. + * @param { Function } callback + * Indicates the observer of object data changed. + * {string} sessionId - The sessionId of the changed object. + * {Array} fields - Attribute names of changed data. + * @syscap SystemCapability.DistributedDataManager.DataObject.DistributedObject + * @since 8 + * @deprecated since 9 + * @useinstead ohos.distributedDataObject.DataObject.on + */ + on(type: 'change', callback: (sessionId: string, fields: Array) => void): void; + /** + * Off watch of change + * + * @param { 'change' } type - Event type, fixed as 'change', indicates data change. + * @param { Function } callback + * Indicates the observer of object data changed. + * {string} sessionId - The sessionId of the changed object. + * {Array} fields - Attribute names of changed data. + * callback If not null, off the callback, if undefined, off all callbacks. + * @syscap SystemCapability.DistributedDataManager.DataObject.DistributedObject + * @since 8 + * @deprecated since 9 + * @useinstead ohos.distributedDataObject.DataObject.off + */ + off(type: 'change', callback?: (sessionId: string, fields: Array) => void): void; + /** + * On watch of status + * + * @param { 'status' } type - Event type, fixed as 'status', indicates the online and offline of the object. + * @param { Function } callback + * Indicates the observer of object status changed. + * {string} sessionId - The sessionId of the changed object. + * {string} networkId - NetworkId of the changed device. + * {string} status + * 'online' The object became online on the device and data can be synced to the device. + * 'offline' The object became offline on the device and the object can not sync any data. + * @syscap SystemCapability.DistributedDataManager.DataObject.DistributedObject + * @since 8 + * @deprecated since 9 + * @useinstead ohos.distributedDataObject.DataObject.on + */ + on(type: 'status', callback: (sessionId: string, networkId: string, status: 'online' | 'offline') => void): void; + /** + * Off watch of status + * + * @param { 'status' } type - Event type, fixed as 'status', indicates the online and offline of the object. + * @param { Function } callback + * Indicates the observer of object status changed. + * {string} sessionId - The sessionId of the changed object. + * {string} networkId - NetworkId of the changed device. + * {string} status + * 'online' The object became online on the device and data can be synced to the device. + * 'offline' The object became offline on the device and the object can not sync any data. + * callback If not null, off the callback, if undefined, off all callbacks. + * @syscap SystemCapability.DistributedDataManager.DataObject.DistributedObject + * @since 8 + * @deprecated since 9 + * @useinstead ohos.distributedDataObject.DataObject.off + */ + off(type: 'status', callback?: (sessionId: string, networkId: string, status: 'online' | 'offline') => void): void; + } + /** + * Object create by {@link create}. + * + * @interface DataObject + * @syscap SystemCapability.DistributedDataManager.DataObject.DistributedObject + * @since 9 + */ + interface DataObject { + /** + * Change object session. + * + * @permission ohos.permission.DISTRIBUTED_DATASYNC + * @param {string} sessionId - sessionId The sessionId to be joined, if empty, leave all session. + * @param {AsyncCallback} callback - The callback of setSessionId. + * @throws {BusinessError} 201 - Permission verification failed. + * @throws {BusinessError} 401 - Parameter error. Incorrect parameter types. + * @throws {BusinessError} 15400001 - Create table failed. + * @syscap SystemCapability.DistributedDataManager.DataObject.DistributedObject + * @since 9 + */ + setSessionId(sessionId: string, callback: AsyncCallback): void; + /** + * Leave all session. + * + * @permission ohos.permission.DISTRIBUTED_DATASYNC + * @param {AsyncCallback} callback - The callback of setSessionId. + * @throws {BusinessError} 201 - Permission verification failed. + * @throws {BusinessError} 401 - Parameter error. Incorrect parameter types. + * @throws {BusinessError} 15400001 - Create table failed. + * @syscap SystemCapability.DistributedDataManager.DataObject.DistributedObject + * @since 9 + */ + setSessionId(callback: AsyncCallback): void; + /** + * Change object session. + * + * @permission ohos.permission.DISTRIBUTED_DATASYNC + * @param {string} sessionId - sessionId The sessionId to be joined, if empty, leave all session. + * @returns {Promise} - The promise returned by the function. + * @throws {BusinessError} 201 - Permission verification failed. + * @throws {BusinessError} 401 - Parameter error. Incorrect parameter types. + * @throws {BusinessError} 15400001 - Create table failed. + * @syscap SystemCapability.DistributedDataManager.DataObject.DistributedObject + * @since 9 + */ + setSessionId(sessionId?: string): Promise; + /** + * On watch of change. + * + * @param { 'change' } type - event type, fixed as 'change', indicates data change. + * @param { Function } callback + * indicates the observer of object data changed. + * {string} sessionId - the sessionId of the changed object. + * {Array} fields - Attribute names of changed data. + * sessionId The sessionId of the changed object. + * @throws {BusinessError} 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types. + * @syscap SystemCapability.DistributedDataManager.DataObject.DistributedObject + * @since 9 + */ + on(type: 'change', callback: (sessionId: string, fields: Array) => void): void; + /** + * Off watch of change. + * + * @param { 'change' } type - Event type, fixed as 'change', indicates data change. + * @param { Function } callback + * indicates the observer of object data changed. + * {string} sessionId - The sessionId of the changed object. + * {Array} fields - Attribute names of changed data. + * callback If not null, off the callback, if undefined, off all callbacks. + * @throws {BusinessError} 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types. + * @syscap SystemCapability.DistributedDataManager.DataObject.DistributedObject + * @since 9 + */ + off(type: 'change', callback?: (sessionId: string, fields: Array) => void): void; + /** + * On watch of status. + * + * @param { 'status' } type - Event type, fixed as 'status', indicates the online and offline of the object. + * @param { Function } callback + * indicates the observer of object status changed. + * {string} sessionId - The sessionId of the changed object. + * {string} networkId - NetworkId of the changed device. + * {string} status + * 'online' The object became online on the device and data can be synced to the device. + * 'offline' The object became offline on the device and the object can not sync any data. + * 'restored' The object restored success. + * @throws {BusinessError} 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types. + * @syscap SystemCapability.DistributedDataManager.DataObject.DistributedObject + * @since 9 + */ + on(type: 'status', callback: (sessionId: string, networkId: string, status: 'online' | 'offline') => void): void; + /** + * Off watch of status. + * + * @param { 'status' } type - Event type, fixed as 'status', indicates the online and offline of the object. + * @param { Function } callback + * Indicates the observer of object status changed. + * {string} sessionId - The sessionId of the changed object. + * {string} networkId - NetworkId of the changed device. + * {string} status + * 'online' The object became online on the device and data can be synced to the device. + * 'offline' The object became offline on the device and the object can not sync any data. + * callback If not null, off the callback, if undefined, off all callbacks. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types. + * @syscap SystemCapability.DistributedDataManager.DataObject.DistributedObject + * @since 9 + */ + off(type: 'status', callback?: (sessionId: string, networkId: string, status: 'online' | 'offline') => void): void; + /** + * Save object, after save object data successfully, the object data will not release when app existed, + * and resume data on saved device after app existed. + * the saved data secure level is S0, it is not safe, can only save public data, if there is privacy data, + * you should encrypt it + * The saved data will be released when + * 1. saved after 24h. + * 2. app uninstalled. + * 3. after resume data success, system will auto delete the saved data. + * + * @param { string } deviceId - Indicates the device that will resume the object data. + * @param { AsyncCallback } callback + * {SaveSuccessResponse}: The response of save. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.DistributedDataManager.DataObject.DistributedObject + * @since 9 + */ + save(deviceId: string, callback: AsyncCallback): void; + /** + * Save object, after save object data successfully, the object data will not release when app existed, + * and resume data on saved device after app existed. + * the saved data secure level is S0, it is not safe, can only save public data, if there is privacy data, + * you should encrypt it. + * The saved data will be released when + * 1. saved after 24h. + * 2. app uninstalled. + * 3. after resume data success, system will auto delete the saved data. + * + * @param { string } deviceId - Indicates the device that will resume the object data. + * @returns { Promise } {SaveSuccessResponse}: The response of save. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.DistributedDataManager.DataObject.DistributedObject + * @since 9 + */ + save(deviceId: string): Promise; + /** + * Revoke save object, delete saved object immediately, if object is saved in local device, + * it will delete saved data on all trusted device. + * if object is saved in other device, it will delete data in local device. + * + * @param { AsyncCallback } callback + * {RevokeSaveSuccessResponse}: The response of revokeSave. + * @throws { BusinessError } 401 - Parameter error. Incorrect parameter types. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.DistributedDataManager.DataObject.DistributedObject + * @since 9 + */ + revokeSave(callback: AsyncCallback): void; + /** + * Revoke save object, delete saved object immediately, if object is saved in local device, + * it will delete saved data on all trusted device. + * if object is saved in other device, it will delete data in local device. + * + * @returns { Promise } {RevokeSaveSuccessResponse}: The response of revokeSave. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.DistributedDataManager.DataObject.DistributedObject + * @since 9 + */ + revokeSave(): Promise; + /** + * Bind an Asset of a distributed object to an asset in rdb that points to the same asset file, which means that + * both assets have the same uri. + * @param { string } assetKey - Indicates the key of the asset type in Object. + * @param { BindInfo } bindInfo - Indicates the information of the asset in RelationalStore. + * @param { AsyncCallback } callback - The callback of bindAssetStore. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.DistributedDataManager.DataObject.DistributedObject + * @since 11 + */ + bindAssetStore(assetKey: string, bindInfo: BindInfo, callback: AsyncCallback): void; + /** + * Bind an Asset of a distributed object to an asset in rdb that points to the same asset file, which means that + * both assets have the same uri. + * @param { string } assetKey - Indicates the key of the asset type in Object. + * @param { BindInfo } bindInfo - Indicates the information of the asset in RelationalStore. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.DistributedDataManager.DataObject.DistributedObject + * @since 11 + */ + bindAssetStore(assetKey: string, bindInfo: BindInfo): Promise; + } +} +export default distributedDataObject; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.data.distributedKVStore.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.data.distributedKVStore.d.ts new file mode 100755 index 00000000..59f8ef02 --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.data.distributedKVStore.d.ts @@ -0,0 +1,2601 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit ArkData + */ +import { AsyncCallback, Callback } from './@ohos.base'; +import BaseContext from './application/BaseContext'; +/** + * Provider interfaces to create a {@link KVManager} instance. + * + * @namespace distributedKVStore + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 9 + */ +declare namespace distributedKVStore { + /** + * Provides configuration information to create a {@link KVManager} instance, + * which includes the caller's package name and ability or hap context. + * + * @interface KVManagerConfig + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + interface KVManagerConfig { + /** + * Indicates the bundleName + * + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + bundleName: string; + /** + * Indicates the ability or hap context + * + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * if swap the area, you should close all the KV store and use the new Context to create the KVManager + * @since 9 + */ + /** + * Indicates the ability or hap context + * + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * if swap the area, you should close all the KV store and use the new BaseContext to create the KVManager + * @since 10 + */ + context: BaseContext; + } + /** + * KVStore constants + * + * @interface Constants + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + interface Constants { + /** + * Max key length is 1024. + * + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + readonly MAX_KEY_LENGTH: number; + /** + * Max value length is 4194303. + * + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + readonly MAX_VALUE_LENGTH: number; + /** + * Max device coordinate key length is 896. + * + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + readonly MAX_KEY_LENGTH_DEVICE: number; + /** + * Max store id length is 128. + * + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + readonly MAX_STORE_ID_LENGTH: number; + /** + * Max query length is 512000. + * + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + readonly MAX_QUERY_LENGTH: number; + /** + * Max batch operation size is 128. + * + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + readonly MAX_BATCH_SIZE: number; + } + /** + * Indicates the {@code ValueType}. + *

{@code ValueType} is obtained based on the value. + * + * @enum { number } + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + enum ValueType { + /** + * Indicates that the value type is string. + * + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + STRING, + /** + * Indicates that the value type is int. + * + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + INTEGER, + /** + * Indicates that the value type is float. + * + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + FLOAT, + /** + * Indicates that the value type is byte array. + * + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + BYTE_ARRAY, + /** + * Indicates that the value type is boolean. + * + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + BOOLEAN, + /** + * Indicates that the value type is double. + * + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + DOUBLE + } + /** + * Obtains {@code Value} objects stored in a {@link SingleKVStore} or {@link DeviceKVStore} database. + * + * @interface Value + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + interface Value { + /** + * Indicates the value type + * + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + * @see ValueType + */ + type: ValueType; + /** + * Indicates the value + * + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + value: Uint8Array | string | number | boolean; + } + /** + * Provides key-value pairs stored in the distributedKVStore. + * + * @interface Entry + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + interface Entry { + /** + * Indicates the key + * + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + key: string; + /** + * Indicates the value + * + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + value: Value; + } + /** + * Receive notifications of all data changes, including data insertion, update, and deletion. + *

If you have subscribed to {@code SingleKVStore} or {@code DeviceKVStore}, you will receive + * data change notifications and obtain the changed data from the parameters in callback methods + * upon data insertion, update or deletion. + * + * @interface ChangeNotification + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + interface ChangeNotification { + /** + * Indicates data insertion records. + * + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + insertEntries: Entry[]; + /** + * Indicates data update records. + * + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + updateEntries: Entry[]; + /** + * Indicates data deletion records. + * + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + deleteEntries: Entry[]; + /** + * Indicates the device id which brings the data change. + * + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + deviceId: string; + } + /** + * Indicates the database synchronization mode. + * + * @enum { number } + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + enum SyncMode { + /** + * Indicates that data is only pulled from the remote end. + * + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + PULL_ONLY, + /** + * Indicates that data is only pushed from the local end. + * + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + PUSH_ONLY, + /** + * Indicates that data is pushed from the local end, and then pulled from the remote end. + * + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + PUSH_PULL + } + /** + * Describes the subscription type. + * + * @enum { number } + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + enum SubscribeType { + /** + * Subscription to local data changes + * + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + SUBSCRIBE_TYPE_LOCAL, + /** + * Subscription to remote data changes + * + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + SUBSCRIBE_TYPE_REMOTE, + /** + * Subscription to both local and remote data changes + * + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + SUBSCRIBE_TYPE_ALL + } + /** + * Describes the KVStore type. + * + * @enum { number } + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + enum KVStoreType { + /** + * Device-collaboration database, as specified by {@code DeviceKVStore} + * + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 9 + */ + DEVICE_COLLABORATION, + /** + * Single-version database, as specified by {@code SingleKVStore} + * + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + SINGLE_VERSION + } + /** + * Describes the KVStore security level. + * + * @enum { number } + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + enum SecurityLevel { + /** + * S1: means the db is in the low security level + * There are some low impact when the data is leaked. + * + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + S1, + /** + * S2: means the db is in the middle security level + * There are some major impact when the data is leaked. + * + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + S2, + /** + * S3: means the db is in the high security level + * There are some severity impact when the data is leaked. + * + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + S3, + /** + * S4: means the db is in the critical security level + * There are some critical impact when the data is leaked. + * + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + S4 + } + /** + * Provides configuration options to create a {@code SingleKVStore} or {@code DeviceKVStore}. + * + * @interface Options + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + interface Options { + /** + * Indicates whether to create a database when the database file does not exist + * + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + createIfMissing?: boolean; + /** + * Indicates whether database files to be encrypted + * + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + encrypt?: boolean; + /** + * Indicates whether to back up database files + * + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + backup?: boolean; + /** + * Indicates whether database files are automatically synchronized + * + * @permission ohos.permission.DISTRIBUTED_DATASYNC + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + autoSync?: boolean; + /** + * Indicates the database type + * + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + kvStoreType?: KVStoreType; + /** + * Indicates the database security level + * + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + securityLevel: SecurityLevel; + /** + * Indicates the database schema + * + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 9 + */ + schema?: Schema; + } + /** + * Represents the database schema. + * You can set the schema object in options when create or open the database. + * + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 9 + */ + class Schema { + /** + * A constructor used to create a Schema instance. + * + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 9 + */ + constructor(); + /** + * Indicates the root json object. + * + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 9 + */ + root: FieldNode; + /** + * Indicates the string array of json. + * + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 9 + */ + indexes: Array; + /** + * Indicates the mode of schema. + * + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 9 + */ + mode: number; + /** + * Indicates the skip size of schema. + * + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 9 + */ + skip: number; + } + /** + * Represents a node of a {@link Schema} instance. + *

With a {@link Schema} instance, you can define the value fields which stored in the database. + *

A FieldNode of the {@link Schema} instance is either a leaf or a non-leaf node. + *

The leaf node must have a value; the non-leaf node must have a child {@code FieldNode}. + * + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 9 + */ + class FieldNode { + /** + * A constructor used to create a FieldNode instance with the specified field. + * name Indicates the field node name. + * + * @param { string } name - It can not be empty. + * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; + *
2.Parameter verification failed. + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 9 + */ + constructor(name: string); + /** + * Adds a child node to this {@code FieldNode}. + *

Add a child node to makes this node a non-leaf node and field value will be ignored if it has a child node. + * + * @param { FieldNode } child - The field node to append. + * @returns { boolean } Returns true if the child node is successfully added to this {@code FieldNode} and false otherwise. + * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; + *
2.Incorrect Parameters types. + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 9 + */ + appendChild(child: FieldNode): boolean; + /** + * Indicates the default value of field node. + * + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 9 + */ + default: string; + /** + * Indicates the nullable of database field. + * + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 9 + */ + nullable: boolean; + /** + * Indicates the type of value. + * + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 9 + */ + type: number; + } + /** + * Provides methods to operate the result set of the {@code SingleKVStore} or {@code DeviceKVStore} database. + *

The result set is created by using the {@code getResultSet} method in the {@code SingleKVStore} or + * {@code DeviceKVStore} class. This interface also provides methods to move the data read + * position in the result set. + * + * @interface KVStoreResultSet + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + interface KVStoreResultSet { + /** + * Obtains the number of lines in a result set. + * + * @returns { number } Returns the number of lines. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + getCount(): number; + /** + * Obtains the current read position in a result set. + * + * @returns { number } Returns the current read position. The read position starts with 0. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + getPosition(): number; + /** + * Moves the read position to the first line. + *

If the result set is empty, false is returned. + * + * @returns { boolean } Returns true if the operation succeeds; return false otherwise. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + moveToFirst(): boolean; + /** + * Moves the read position to the last line. + *

If the result set is empty, false is returned. + * + * @returns { boolean } Returns true if the operation succeeds; return false otherwise. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + moveToLast(): boolean; + /** + * Moves the read position to the next line. + *

If the result set is empty or the data in the last line is being read, false is returned. + * + * @returns { boolean } Returns true if the operation succeeds; return false otherwise. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + moveToNext(): boolean; + /** + * Moves the read position to the previous line. + *

If the result set is empty or the data in the first line is being read, false is returned. + * + * @returns { boolean } Returns true if the operation succeeds; return false otherwise. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + moveToPrevious(): boolean; + /** + * Moves the read position by a relative offset to the current position. + * + * @param { number } offset - Indicates the relative offset to the current position. A negative offset indicates moving + * backwards, and a positive offset indicates moving forwards. For example, if the current position is entry 1 and + * this offset is 2, the destination position will be entry 3; if the current position is entry 3 and this offset is -2, + * the destination position will be entry 1. The valid final position after moving forwards starts with 0. If the + * final position is invalid, false will be returned. + * @returns { boolean } Returns true if the operation succeeds; return false otherwise. + * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; + *
2.Incorrect parameters types. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + move(offset: number): boolean; + /** + * Moves the read position from 0 to an absolute position. + * + * @param { number } position - Indicates the absolute position. + * @returns { boolean } Returns true if the operation succeeds; return false otherwise. + * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; + *
2.Incorrect parameters types. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + moveToPosition(position: number): boolean; + /** + * Checks whether the read position is the first line. + * + * @returns { boolean } Returns true if the read position is the first line; returns false otherwise. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + isFirst(): boolean; + /** + * Checks whether the read position is the last line. + * + * @returns { boolean } Returns true if the read position is the last line; returns false otherwise. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + isLast(): boolean; + /** + * Checks whether the read position is before the last line. + * + * @returns { boolean } Returns true if the read position is before the first line; returns false otherwise. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + isBeforeFirst(): boolean; + /** + * Checks whether the read position is after the last line. + * + * @returns { boolean } Returns true if the read position is after the last line; returns false otherwise. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + isAfterLast(): boolean; + /** + * Obtains a key-value pair. + * + * @returns { Entry } Returns a key-value pair. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + getEntry(): Entry; + } + /** + * Represents a database query using predicates. + *

This class provides a constructor used to create a {@code Query} instance, which is used to query data + * matching specified conditions in the database. + *

This class also provides methods to add predicates to the {@code Query} instance. + * + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + class Query { + /** + * A constructor used to create a Query instance. + * + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + constructor(); + /** + * Resets this {@code Query} object. + * + * @returns { Query } Returns the reset {@code Query} object. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + reset(): Query; + /** + * Constructs a {@code Query} object to query entries with the specified field whose value is equal to the specified long value. + * + * @param { string } field - Indicates the field, which cannot contain ^. + * @param { number | string | boolean } value - Indicates the value to be compared. + * @returns { Query } Returns the {@coed Query} object. + * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; + *
2.Incorrect parameters types; + *
3.Parameter verification failed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + equalTo(field: string, value: number | string | boolean): Query; + /** + * Constructs a {@code Query} object to query entries with the specified field whose value is not equal to the specified int value. + * + * @param { string } field - Indicates the field, which cannot contain ^. + * @param { number | string | boolean } value - Indicates the value to be compared. + * @returns { Query } Returns the {@coed Query} object. + * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; + *
2.Incorrect parameters types; + *
3.Parameter verification failed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + notEqualTo(field: string, value: number | string | boolean): Query; + /** + * Constructs a {@code Query} object to query entries with the specified field whose value is greater than or equal to the + * specified int value. + * + * @param { string } field - Indicates the field, which cannot contain ^. + * @param { number | string | boolean } value - Indicates the value to be compared. + * @returns { Query } Returns the {@coed Query} object. + * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; + *
2.Incorrect parameters types; + *
3.Parameter verification failed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + greaterThan(field: string, value: number | string | boolean): Query; + /** + * Constructs a {@code Query} object to query entries with the specified field whose value is less than the specified int value. + * + * @param { string } field - Indicates the field, which cannot contain ^. + * @param { number | string } value - Indicates the value to be compared. + * @returns { Query } Returns the {@coed Query} object. + * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; + *
2.Incorrect parameters types; + *
3.Parameter verification failed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + lessThan(field: string, value: number | string): Query; + /** + * Constructs a {@code Query} object to query entries with the specified field whose value is greater than or + * equal to the specified int value. + * + * @param { string } field - Indicates the field, which cannot contain ^. + * @param { number | string } value - Indicates the value to be compared. + * @returns { Query } Returns the {@coed Query} object. + * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; + *
2.Incorrect parameters types; + *
3.Parameter verification failed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + greaterThanOrEqualTo(field: string, value: number | string): Query; + /** + * Constructs a {@code Query} object to query entries with the specified field whose value is less than or equal to the + * specified int value. + * + * @param { string } field - Indicates the field, which cannot contain ^. + * @param { number | string } value - Indicates the value to be compared. + * @returns { Query } Returns the {@coed Query} object. + * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; + *
2.Incorrect parameters types; + *
3.Parameter verification failed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + lessThanOrEqualTo(field: string, value: number | string): Query; + /** + * Constructs a {@code Query} object to query entries with the specified field whose value is null. + * + * @param { string } field - Indicates the field, which cannot contain ^. + * @returns { Query } Returns the {@coed Query} object. + * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; + *
2.Incorrect parameters types; + *
3.Parameter verification failed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + isNull(field: string): Query; + /** + * Constructs a {@code Query} object to query entries with the specified field whose value is within the specified int value list. + * + * @param { string } field - Indicates the field, which cannot contain ^. + * @param { number[] } valueList - Indicates the int value list. + * @returns { Query } Returns the {@coed Query} object. + * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; + *
2.Incorrect parameters types; + *
3.Parameter verification failed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + inNumber(field: string, valueList: number[]): Query; + /** + * Constructs a {@code Query} object to query entries with the specified field whose value is within the specified string value list. + * + * @param { string } field - Indicates the field, which cannot contain ^. + * @param { string[] } valueList - Indicates the string value list. + * @returns { Query } Returns the {@coed Query} object. + * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; + *
2.Incorrect parameters types; + *
3.Parameter verification failed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + inString(field: string, valueList: string[]): Query; + /** + * Constructs a {@code Query} object to query entries with the specified field whose value is not within the specified int value list. + * + * @param { string } field - Indicates the field, which cannot contain ^. + * @param { number[] } valueList - Indicates the int value list. + * @returns { Query } Returns the {@coed Query} object. + * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; + *
2.Incorrect parameters types; + *
3.Parameter verification failed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + notInNumber(field: string, valueList: number[]): Query; + /** + * Constructs a {@code Query} object to query entries with the specified field whose value is not within the specified string value list. + * + * @param { string } field - Indicates the field, which cannot contain ^. + * @param { string[] } valueList - Indicates the string value list. + * @returns { Query } Returns the {@coed Query} object. + * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; + *
2.Incorrect parameters types; + *
3.Parameter verification failed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + notInString(field: string, valueList: string[]): Query; + /** + * Constructs a {@code Query} object to query entries with the specified field whose value is similar to the specified string value. + * + * @param { string } field - Indicates the field, which cannot contain ^. + * @param { string } value - Indicates the string value. + * @returns { Query } Returns the {@coed Query} object. + * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; + *
2.Incorrect parameters types; + *
3.Parameter verification failed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + like(field: string, value: string): Query; + /** + * Constructs a {@code Query} object to query entries with the specified field whose value is not similar to the specified string value. + * + * @param { string } field - Indicates the field, which cannot contain ^. + * @param { string } value - Indicates the string value. + * @returns { Query } Returns the {@coed Query} object. + * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; + *
2.Incorrect parameters types; + *
3.Parameter verification failed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + unlike(field: string, value: string): Query; + /** + * Constructs a {@code Query} object with the and condition. + *

Multiple predicates should be connected using the and or or condition. + * + * @returns { Query } Returns the {@coed Query} object. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + and(): Query; + /** + * Constructs a {@code Query} object with the or condition. + *

Multiple predicates should be connected using the and or or condition. + * + * @returns { Query } Returns the {@coed Query} object. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + or(): Query; + /** + * Constructs a {@code Query} object to sort the query results in ascending order. + * + * @param { string } field - Indicates the field, which cannot contain ^. + * @returns { Query } Returns the {@coed Query} object. + * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; + *
2.Incorrect parameters types; + *
3.Parameter verification failed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + orderByAsc(field: string): Query; + /** + * Constructs a {@code Query} object to sort the query results in descending order. + * + * @param { string } field - Indicates the field, which cannot contain ^. + * @returns { Query } Returns the {@coed Query} object. + * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; + *
2.Incorrect parameters types; + *
3.Parameter verification failed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + orderByDesc(field: string): Query; + /** + * Constructs a {@code Query} object to specify the number of results and the start position. + * + * @param { number } total - Indicates the number of results. + * @param { number } offset - Indicates the start position. + * @returns { Query } Returns the {@coed Query} object. + * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; + *
2.Incorrect parameters types. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + limit(total: number, offset: number): Query; + /** + * Creates a {@code Query} condition with a specified field that is not null. + * + * @param { string } field - Indicates the specified field. + * @returns { Query } Returns the {@coed Query} object. + * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; + *
2.Incorrect parameters types. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + isNotNull(field: string): Query; + /** + * Creates a query condition group with a left bracket. + *

Multiple query conditions in an {@code Query} object can be grouped. The query conditions in a group can be used as a + * whole to combine with other query conditions. + * + * @returns { Query } Returns the {@coed Query} object. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + beginGroup(): Query; + /** + * Creates a query condition group with a right bracket. + *

Multiple query conditions in an {@code Query} object can be grouped. The query conditions in a group can be used as a + * whole to combine with other query conditions. + * + * @returns { Query } Returns the {@coed Query} object. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + endGroup(): Query; + /** + * Creates a query condition with a specified key prefix. + * + * @param { string } prefix - Indicates the specified key prefix. + * @returns { Query } Returns the {@coed Query} object. + * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; + *
2.Incorrect parameters types. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + prefixKey(prefix: string): Query; + /** + * Sets a specified index that will be preferentially used for query. + * + * @param { string } index - Indicates the index to set. + * @returns { Query } Returns the {@coed Query} object. + * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; + *
2.Incorrect parameters types. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + setSuggestIndex(index: string): Query; + /** + * Add device ID key prefix.Used by {@code DeviceKVStore}. + * + * @param { string } deviceId - Specify device id to query from, It can not be empty. + * @returns { Query } Returns the {@code Query} object with device ID prefix added. + * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; + *
2.Incorrect parameters types; + *
3.Parameter verification failed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + deviceId(deviceId: string): Query; + /** + * Get a String that represents this {@code Query}. + *

The String would be parsed to DB query format. + * The String length should be no longer than 500kb. + * + * @returns { string } String representing this {@code Query}. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + getSqlLike(): string; + } + /** + * Provides methods related to single-version distributed databases. + *

To create a {@code SingleKVStore} database, + * you can use the {@link data.distributed.common.KVManager#getKVStore​(Options, String)} method + * with {@code KVStoreType} set to {@code SINGLE_VERSION} for the input parameter {@code Options}. + * This database synchronizes data to other databases in time sequence. + * The {@code SingleKVStore} database does not support + * synchronous transactions, or data search using snapshots. + * + * @interface SingleKVStore + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + interface SingleKVStore { + /** + * Writes a key-value pair of the string type into the {@code SingleKVStore} database. + *

If you do not want to synchronize this key-value pair to other devices, set the write option in the local database. + * + * @param { string } key - Indicates the key. Length must be less than {@code MAX_KEY_LENGTH}. + * Spaces before and after the key will be cleared. + * @param { Uint8Array | string | number | boolean } value - Indicates the value to be inserted. + * @param { AsyncCallback } callback - the callback of put. + * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; + *
2.Incorrect parameters types; + *
3.Parameter verification failed. + * @throws { BusinessError } 15100003 - Database corrupted. + * @throws { BusinessError } 15100005 - Database or result set already closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + /** + * Writes a key-value pair of the string type into the {@code SingleKVStore} database. + *

If you do not want to synchronize this key-value pair to other devices, set the write option in the local database. + * + * @param { string } key - Indicates the key. Length must be less than {@code MAX_KEY_LENGTH}. + * Spaces before and after the key will be cleared. + * @param { Uint8Array | string | number | boolean } value - Indicates the value to be inserted. + * @param { AsyncCallback } callback - the callback of put. + * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; + *
2.Incorrect parameters types; + *
3.Parameter verification failed. + * @throws { BusinessError } 15100003 - Database corrupted. + * @throws { BusinessError } 15100005 - Database or result set already closed. + * @throws { BusinessError } 14800047 - The WAL file size exceeds the default limit. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 10 + */ + put(key: string, value: Uint8Array | string | number | boolean, callback: AsyncCallback): void; + /** + * Writes a key-value pair of the string type into the {@code SingleKVStore} database. + *

If you do not want to synchronize this key-value pair to other devices, set the write option in the local database. + * + * @param { string } key - Indicates the key. Length must be less than {@code MAX_KEY_LENGTH}. + * Spaces before and after the key will be cleared. + * @param { Uint8Array | string | number | boolean } value - Indicates the value to be inserted. + * @returns { Promise } the promise returned by the function. + * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; + *
2.Incorrect parameters types; + *
3.Parameter verification failed. + * @throws { BusinessError } 15100003 - Database corrupted. + * @throws { BusinessError } 15100005 - Database or result set already closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + /** + * Writes a key-value pair of the string type into the {@code SingleKVStore} database. + *

If you do not want to synchronize this key-value pair to other devices, set the write option in the local database. + * + * @param { string } key - Indicates the key. Length must be less than {@code MAX_KEY_LENGTH}. + * Spaces before and after the key will be cleared. + * @param { Uint8Array | string | number | boolean } value - Indicates the value to be inserted. + * @returns { Promise } the promise returned by the function. + * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; + *
2.Incorrect parameters types; + *
3.Parameter verification failed. + * @throws { BusinessError } 15100003 - Database corrupted. + * @throws { BusinessError } 15100005 - Database or result set already closed. + * @throws { BusinessError } 14800047 - The WAL file size exceeds the default limit. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 10 + */ + put(key: string, value: Uint8Array | string | number | boolean): Promise; + /** + * Inserts key-value pairs into the {@code SingleKVStore} database in batches. + * + * @param { Entry[] } entries - Indicates the key-value pairs to be inserted in batches. + * @param { AsyncCallback } callback - the callback of putBatch. + * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; + *
2.Incorrect parameters types. + * @throws { BusinessError } 15100003 - Database corrupted. + * @throws { BusinessError } 15100005 - Database or result set already closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + /** + * Inserts key-value pairs into the {@code SingleKVStore} database in batches. + * + * @param { Entry[] } entries - Indicates the key-value pairs to be inserted in batches. + * @param { AsyncCallback } callback - the callback of putBatch. + * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; + *
2.Incorrect parameters types. + * @throws { BusinessError } 15100003 - Database corrupted. + * @throws { BusinessError } 15100005 - Database or result set already closed. + * @throws { BusinessError } 14800047 - The WAL file size exceeds the default limit. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 10 + */ + putBatch(entries: Entry[], callback: AsyncCallback): void; + /** + * Inserts key-value pairs into the {@code SingleKVStore} database in batches. + * + * @param { Entry[] } entries - Indicates the key-value pairs to be inserted in batches. + * @returns { Promise } the promise returned by the function. + * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; + *
2.Incorrect parameters types. + * @throws { BusinessError } 15100003 - Database corrupted. + * @throws { BusinessError } 15100005 - Database or result set already closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + /** + * Inserts key-value pairs into the {@code SingleKVStore} database in batches. + * + * @param { Entry[] } entries - Indicates the key-value pairs to be inserted in batches. + * @returns { Promise } the promise returned by the function. + * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; + *
2.Incorrect parameters types. + * @throws { BusinessError } 15100003 - Database corrupted. + * @throws { BusinessError } 15100005 - Database or result set already closed. + * @throws { BusinessError } 14800047 - The WAL file size exceeds the default limit. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 10 + */ + putBatch(entries: Entry[]): Promise; + /** + * Deletes the key-value pair based on a specified key. + * + * @param { string } key - Indicates the key. Length must be less than {@code MAX_KEY_LENGTH}. + * Spaces before and after the key will be cleared. + * @param { AsyncCallback } callback - the callback of delete. + * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; + *
2.Incorrect parameters types; + *
3.Parameter verification failed. + * @throws { BusinessError } 15100003 - Database corrupted. + * @throws { BusinessError } 15100005 - Database or result set already closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + /** + * Deletes the key-value pair based on a specified key. + * + * @param { string } key - Indicates the key. Length must be less than {@code MAX_KEY_LENGTH}. + * Spaces before and after the key will be cleared. + * @param { AsyncCallback } callback - the callback of delete. + * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; + *
2.Incorrect parameters types; + *
3.Parameter verification failed. + * @throws { BusinessError } 15100003 - Database corrupted. + * @throws { BusinessError } 15100005 - Database or result set already closed. + * @throws { BusinessError } 14800047 - The WAL file size exceeds the default limit. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 10 + */ + delete(key: string, callback: AsyncCallback): void; + /** + * Deletes the key-value pair based on a specified key. + * + * @param { string } key - Indicates the key. Length must be less than {@code MAX_KEY_LENGTH}. + * Spaces before and after the key will be cleared. + * @returns { Promise } the promise returned by the function. + * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; + *
2.Incorrect parameters types; + *
3.Parameter verification failed. + * @throws { BusinessError } 15100003 - Database corrupted. + * @throws { BusinessError } 15100005 - Database or result set already closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + /** + * Deletes the key-value pair based on a specified key. + * + * @param { string } key - Indicates the key. Length must be less than {@code MAX_KEY_LENGTH}. + * Spaces before and after the key will be cleared. + * @returns { Promise } the promise returned by the function. + * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; + *
2.Incorrect parameters types; + *
3.Parameter verification failed. + * @throws { BusinessError } 15100003 - Database corrupted. + * @throws { BusinessError } 15100005 - Database or result set already closed. + * @throws { BusinessError } 14800047 - The WAL file size exceeds the default limit. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 10 + */ + delete(key: string): Promise; + /** + * Deletes key-value pairs in batches from the {@code SingleKVStore} database. + * + * @param { string[] } keys - Indicates the key-value pairs to be deleted in batches, It can not be empty. + * @param { AsyncCallback } callback - the callback of deleteBatch. + * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; + *
2.Incorrect parameters types; + *
3.Parameter verification failed. + * @throws { BusinessError } 15100003 - Database corrupted. + * @throws { BusinessError } 15100005 - Database or result set already closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + /** + * Deletes key-value pairs in batches from the {@code SingleKVStore} database. + * + * @param { string[] } keys - Indicates the key-value pairs to be deleted in batches, It can not be empty. + * @param { AsyncCallback } callback - the callback of deleteBatch. + * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; + *
2.Incorrect parameters types; + *
3.Parameter verification failed. + * @throws { BusinessError } 15100003 - Database corrupted. + * @throws { BusinessError } 15100005 - Database or result set already closed. + * @throws { BusinessError } 14800047 - The WAL file size exceeds the default limit. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 10 + */ + deleteBatch(keys: string[], callback: AsyncCallback): void; + /** + * Deletes key-value pairs in batches from the {@code SingleKVStore} database. + * + * @param { string[] } keys - Indicates the key-value pairs to be deleted in batches, It can not be empty. + * @returns { Promise } the promise returned by the function. + * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; + *
2.Incorrect parameters types; + *
3.Parameter verification failed. + * @throws { BusinessError } 15100003 - Database corrupted. + * @throws { BusinessError } 15100005 - Database or result set already closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + /** + * Deletes key-value pairs in batches from the {@code SingleKVStore} database. + * + * @param { string[] } keys - Indicates the key-value pairs to be deleted in batches, It can not be empty. + * @returns { Promise } the promise returned by the function. + * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; + *
2.Incorrect parameters types; + *
3.Parameter verification failed. + * @throws { BusinessError } 15100003 - Database corrupted. + * @throws { BusinessError } 15100005 - Database or result set already closed. + * @throws { BusinessError } 14800047 - The WAL file size exceeds the default limit. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 10 + */ + deleteBatch(keys: string[]): Promise; + /** + * Removes data of the specified device from current database. This method is used to remove only the data + * synchronized from remote devices. This operation does not synchronize data to other databases or affect + * subsequent data synchronization. + * + * @param { string } deviceId - Identifies the device whose data is to be removed and the value cannot be the current device ID. + * @param { AsyncCallback } callback - the callback of removeDeviceData. + * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; + *
2.Parameter verification failed. + * @throws { BusinessError } 15100005 - Database or result set already closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 9 + */ + removeDeviceData(deviceId: string, callback: AsyncCallback): void; + /** + * Removes data of the specified device from current database. This method is used to remove only the data + * synchronized from remote devices. This operation does not synchronize data to other databases or affect + * subsequent data synchronization. + * + * @param { string } deviceId - Identifies the device whose data is to be removed and the value cannot be the current device ID. + * @returns { Promise } the promise returned by the function. + * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; + *
2.Parameter verification failed. + * @throws { BusinessError } 15100005 - Database or result set already closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 9 + */ + removeDeviceData(deviceId: string): Promise; + /** + * Obtains the value of a specified key. + * + * @param { string } key - Indicates the key. The length must be less than {@code MAX_KEY_LENGTH}. + * @param { AsyncCallback } callback - + * {Uint8Array|string|boolean|number}: the returned value specified by the key. + * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; + *
2.Incorrect parameters types; + *
3.Parameter verification failed. + * @throws { BusinessError } 15100003 - Database corrupted. + * @throws { BusinessError } 15100004 - Not found. + * @throws { BusinessError } 15100005 - Database or result set already closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + get(key: string, callback: AsyncCallback): void; + /** + * Obtains the value of a specified key. + * + * @param { string } key - Indicates the key. The length must be less than {@code MAX_KEY_LENGTH}. + * @returns { Promise } + * {Uint8Array|string|boolean|number}: the returned value specified by the key. + * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; + *
2.Incorrect parameters types; + *
3.Parameter verification failed. + * @throws { BusinessError } 15100003 - Database corrupted. + * @throws { BusinessError } 15100004 - Not found. + * @throws { BusinessError } 15100005 - Database or result set already closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + get(key: string): Promise; + /** + * Obtains all key-value pairs that match a specified key prefix. + * + * @param { string } keyPrefix - Indicates the key prefix to match. + * @param { AsyncCallback } callback - {Entry[]}: the list of all key-value pairs + * that match the specified key prefix. + * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; + *
2.Incorrect parameters types. + * @throws { BusinessError } 15100003 - Database corrupted. + * @throws { BusinessError } 15100005 - Database or result set already closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + getEntries(keyPrefix: string, callback: AsyncCallback): void; + /** + * Obtains all key-value pairs that match a specified key prefix. + * + * @param { string } keyPrefix - Indicates the key prefix to match. + * @returns { Promise } {Entry[]}: the list of all key-value pairs that match the + * specified key prefix. + * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; + *
2.Incorrect parameters types. + * @throws { BusinessError } 15100003 - Database corrupted. + * @throws { BusinessError } 15100005 - Database or result set already closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + getEntries(keyPrefix: string): Promise; + /** + * Obtains the list of key-value pairs matching the specified {@code Query} object. + * + * @param { Query } query - Indicates the {@code Query} object. + * @param { AsyncCallback } callback - {Entry[]}: the list of all key-value pairs + * matching the specified {@code Query} object. + * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; + *
2.Incorrect parameters types. + * @throws { BusinessError } 15100003 - Database corrupted. + * @throws { BusinessError } 15100005 - Database or result set already closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + getEntries(query: Query, callback: AsyncCallback): void; + /** + * Obtains the list of key-value pairs matching the specified {@code Query} object. + * + * @param { Query } query - Indicates the {@code Query} object. + * @returns { Promise } {Entry[]}: the list of all key-value pairs matching the + * specified {@code Query} object. + * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; + *
2.Incorrect parameters types. + * @throws { BusinessError } 15100003 - Database corrupted. + * @throws { BusinessError } 15100005 - Database or result set already closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + getEntries(query: Query): Promise; + /** + * Obtains the result set with a specified prefix from a {@code SingleKVStore} database. The {@code KVStoreResultSet} + * object can be used to query all key-value pairs that meet the search criteria. Each {@code SingleKVStore} + * instance can have a maximum of four {@code KVStoreResultSet} objects at the same time. If you have created + * four objects, calling this method will return a failure. Therefore, you are advised to call the closeResultSet + * method to close unnecessary {@code KVStoreResultSet} objects in a timely manner. + * + * @param { string } keyPrefix - Indicates the key prefix to match. + * @param { AsyncCallback } callback - {KVStoreResultSet}: the {@code KVStoreResultSet} + * object matching the specified keyPrefix. + * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; + *
2.Incorrect parameters types. + * @throws { BusinessError } 15100003 - Database corrupted. + * @throws { BusinessError } 15100005 - Database or result set already closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + /** + * Obtains the result set with a specified prefix from a {@code SingleKVStore} database. The {@code KVStoreResultSet} + * object can be used to query all key-value pairs that meet the search criteria. Each {@code SingleKVStore} + * instance can have a maximum of four {@code KVStoreResultSet} objects at the same time. If you have created + * four objects, calling this method will return a failure. Therefore, you are advised to call the closeResultSet + * method to close unnecessary {@code KVStoreResultSet} objects in a timely manner. + * + * @param { string } keyPrefix - Indicates the key prefix to match. + * @param { AsyncCallback } callback - {KVStoreResultSet}: the {@code KVStoreResultSet} + * object matching the specified keyPrefix. + * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; + *
2.Incorrect parameters types. + * @throws { BusinessError } 15100001 - Over max limits. + * @throws { BusinessError } 15100003 - Database corrupted. + * @throws { BusinessError } 15100005 - Database or result set already closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 10 + */ + getResultSet(keyPrefix: string, callback: AsyncCallback): void; + /** + * Obtains the result set with a specified prefix from a {@code SingleKVStore} database. The {@code KVStoreResultSet} + * object can be used to query all key-value pairs that meet the search criteria. Each {@code SingleKVStore} + * instance can have a maximum of four {@code KVStoreResultSet} objects at the same time. If you have created + * four objects, calling this method will return a failure. Therefore, you are advised to call the closeResultSet + * method to close unnecessary {@code KVStoreResultSet} objects in a timely manner. + * + * @param { string } keyPrefix - Indicates the key prefix to match. + * @returns { Promise } {KVStoreResultSet}: the {@code KVStoreResultSet} + * object matching the specified keyPrefix. + * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; + *
2.Incorrect parameters types. + * @throws { BusinessError } 15100003 - Database corrupted. + * @throws { BusinessError } 15100005 - Database or result set already closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + /** + * Obtains the result set with a specified prefix from a {@code SingleKVStore} database. The {@code KVStoreResultSet} + * object can be used to query all key-value pairs that meet the search criteria. Each {@code SingleKVStore} + * instance can have a maximum of four {@code KVStoreResultSet} objects at the same time. If you have created + * four objects, calling this method will return a failure. Therefore, you are advised to call the closeResultSet + * method to close unnecessary {@code KVStoreResultSet} objects in a timely manner. + * + * @param { string } keyPrefix - Indicates the key prefix to match. + * @returns { Promise } {KVStoreResultSet}: the {@code KVStoreResultSet} + * object matching the specified keyPrefix. + * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; + *
2.Incorrect parameters types. + * @throws { BusinessError } 15100001 - Over max limits. + * @throws { BusinessError } 15100003 - Database corrupted. + * @throws { BusinessError } 15100005 - Database or result set already closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 10 + */ + getResultSet(keyPrefix: string): Promise; + /** + * Obtains the {@code KVStoreResultSet} object matching the specified {@code Query} object. + * + * @param { Query } query - Indicates the {@code Query} object. + * @param { AsyncCallback } callback - {KVStoreResultSet}: the {@code KVStoreResultSet} + * object matching the specified {@code Query} object. + * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; + *
2.Incorrect parameters types. + * @throws { BusinessError } 15100003 - Database corrupted. + * @throws { BusinessError } 15100005 - Database or result set already closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + /** + * Obtains the {@code KVStoreResultSet} object matching the specified {@code Query} object. + * + * @param { Query } query - Indicates the {@code Query} object. + * @param { AsyncCallback } callback - {KVStoreResultSet}: the {@code KVStoreResultSet} + * object matching the specified {@code Query} object. + * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; + *
2.Incorrect parameters types. + * @throws { BusinessError } 15100001 - Over max limits. + * @throws { BusinessError } 15100003 - Database corrupted. + * @throws { BusinessError } 15100005 - Database or result set already closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 10 + */ + getResultSet(query: Query, callback: AsyncCallback): void; + /** + * Obtains the {@code KVStoreResultSet} object matching the specified {@code Query} object. + * + * @param { Query } query - Indicates the {@code Query} object. + * @returns { Promise } {KVStoreResultSet}: the {@code KVStoreResultSet} + * object matching the specified {@code Query} object. + * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; + *
2.Incorrect parameters types. + * @throws { BusinessError } 15100003 - Database corrupted. + * @throws { BusinessError } 15100005 - Database or result set already closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + /** + * Obtains the {@code KVStoreResultSet} object matching the specified {@code Query} object. + * + * @param { Query } query - Indicates the {@code Query} object. + * @returns { Promise } {KVStoreResultSet}: the {@code KVStoreResultSet} + * object matching the specified {@code Query} object. + * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; + *
2.Incorrect parameters types. + * @throws { BusinessError } 15100001 - Over max limits. + * @throws { BusinessError } 15100003 - Database corrupted. + * @throws { BusinessError } 15100005 - Database or result set already closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 10 + */ + getResultSet(query: Query): Promise; + /** + * Closes a {@code KVStoreResultSet} object returned by getResultSet method. + * + * @param { KVStoreResultSet } resultSet - Indicates the {@code KVStoreResultSet} object to close. + * @param { AsyncCallback } callback - the callback of closeResultSet. + * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; + *
2.Incorrect parameters types. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + closeResultSet(resultSet: KVStoreResultSet, callback: AsyncCallback): void; + /** + * Closes a {@code KVStoreResultSet} object returned by getResultSet method. + * + * @param { KVStoreResultSet } resultSet - Indicates the {@code KVStoreResultSet} object to close. + * @returns { Promise } the promise returned by the function. + * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; + *
2.Incorrect parameters types. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + closeResultSet(resultSet: KVStoreResultSet): Promise; + /** + * Obtains the number of results matching the specified {@code Query} object. + * + * @param { Query } query - Indicates the {@code Query} object. + * @param { AsyncCallback } callback - {number}: the number of results matching the + * specified {@code Query} object. + * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; + *
2.Incorrect parameters types. + * @throws { BusinessError } 15100003 - Database corrupted. + * @throws { BusinessError } 15100005 - Database or result set already closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + getResultSize(query: Query, callback: AsyncCallback): void; + /** + * Obtains the number of results matching the specified {@code Query} object. + * + * @param { Query } query - Indicates the {@code Query} object. + * @returns { Promise } {number}: the number of results matching the specified + * {@code Query} object. + * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; + *
2.Incorrect parameters types. + * @throws { BusinessError } 15100003 - Database corrupted. + * @throws { BusinessError } 15100005 - Database or result set already closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + getResultSize(query: Query): Promise; + /** + * Backs up a database in the specified filename. + * + * @param { string } file - Indicates the database backup filename, It can not be empty and + * The length must be less than {@code MAX_KEY_LENGTH}. + * @param { AsyncCallback } callback - the callback of backup. + * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; + *
2.Parameter verification failed. + * @throws { BusinessError } 15100005 - Database or result set already closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + backup(file: string, callback: AsyncCallback): void; + /** + * Backs up a database in the specified filename. + * + * @param { string } file - Indicates the database backup filename, It can not be empty and + * The length must be less than {@code MAX_KEY_LENGTH}. + * @returns { Promise } the promise returned by the function. + * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; + *
2.Parameter verification failed. + * @throws { BusinessError } 15100005 - Database or result set already closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + backup(file: string): Promise; + /** + * Restores a database from a specified database file. + * + * @param { string } file - Indicates the database backup filename, It can not be empty and + * The length must be less than {@code MAX_KEY_LENGTH}. + * @param { AsyncCallback } callback - the callback of restore. + * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; + *
2.Parameter verification failed. + * @throws { BusinessError } 15100005 - Database or result set already closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + restore(file: string, callback: AsyncCallback): void; + /** + * Restores a database from a specified database file. + * + * @param { string } file - Indicates the database backup filename, It can not be empty and + * The length must be less than {@code MAX_KEY_LENGTH}. + * @returns { Promise } the promise returned by the function. + * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; + *
2.Parameter verification failed. + * @throws { BusinessError } 15100005 - Database or result set already closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + restore(file: string): Promise; + /** + * Delete database backup files based on the specified filenames. + * + * @param { Array } files - Indicates the backup filenames to be deleted, It can not be empty and + * The length must be less than {@code MAX_KEY_LENGTH}. + * @param { AsyncCallback> } callback - {Array<[string, number]>}: + * the list of backup file and it's corresponding delete result which 0 means delete success + * and otherwise failed. + * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; + *
2.Parameter verification failed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + deleteBackup(files: Array, callback: AsyncCallback>): void; + /** + * Delete database backup files based on the specified filenames. + * + * @param { Array } files - Indicates the backup filenames to be deleted, It can not be empty and + * The length must be less than {@code MAX_KEY_LENGTH}. + * @returns { Promise> } {Array<[string, number]>}: the list of backup + * file and it's corresponding delete result which 0 means delete success and otherwise failed. + * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; + *
2.Parameter verification failed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + deleteBackup(files: Array): Promise>; + /** + * Starts a transaction operation in the {@code SingleKVStore} database. + *

After the database transaction is started, you can submit or roll back the operation. + * + * @param { AsyncCallback } callback - the callback of startTransaction. + * @throws { BusinessError } 15100005 - Database or result set already closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + /** + * Starts a transaction operation in the {@code SingleKVStore} database. + *

After the database transaction is started, you can submit or roll back the operation. + * + * @param { AsyncCallback } callback - the callback of startTransaction. + * @throws { BusinessError } 15100005 - Database or result set already closed. + * @throws { BusinessError } 14800047 - The WAL file size exceeds the default limit. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 10 + */ + startTransaction(callback: AsyncCallback): void; + /** + * Starts a transaction operation in the {@code SingleKVStore} database. + *

After the database transaction is started, you can submit or roll back the operation. + * + * @returns { Promise } the promise returned by the function. + * @throws { BusinessError } 15100005 - Database or result set already closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + /** + * Starts a transaction operation in the {@code SingleKVStore} database. + *

After the database transaction is started, you can submit or roll back the operation. + * + * @returns { Promise } the promise returned by the function. + * @throws { BusinessError } 15100005 - Database or result set already closed. + * @throws { BusinessError } 14800047 - The WAL file size exceeds the default limit. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 10 + */ + startTransaction(): Promise; + /** + * Submits a transaction operation in the {@code SingleKVStore} database. + * + * @param { AsyncCallback } callback - the callback of commit. + * @throws { BusinessError } 15100005 - Database or result set already closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + commit(callback: AsyncCallback): void; + /** + * Submits a transaction operation in the {@code SingleKVStore} database. + * + * @returns { Promise } the promise returned by the function. + * @throws { BusinessError } 15100005 - Database or result set already closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + commit(): Promise; + /** + * Rolls back a transaction operation in the {@code SingleKVStore} database. + * + * @param { AsyncCallback } callback - the callback of rollback. + * @throws { BusinessError } 15100005 - Database or result set already closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + rollback(callback: AsyncCallback): void; + /** + * Rolls back a transaction operation in the {@code SingleKVStore} database. + * + * @returns { Promise } the promise returned by the function. + * @throws { BusinessError } 15100005 - Database or result set already closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + rollback(): Promise; + /** + * Sets whether to enable synchronization. + * + * @param { boolean } enabled - Specifies whether to enable synchronization. The value true + * means to enable synchronization, and false means the opposite. + * @param { AsyncCallback } callback - the callback of enableSync. + * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; + *
2.Incorrect parameters types. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + enableSync(enabled: boolean, callback: AsyncCallback): void; + /** + * Sets whether to enable synchronization. + * + * @param { boolean } enabled - Specifies whether to enable synchronization. The value true + * means to enable synchronization, and false means the opposite. + * @returns { Promise } the promise returned by the function. + * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; + *
2.Incorrect parameters types. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + enableSync(enabled: boolean): Promise; + /** + * Sets synchronization range labels. + *

The labels determine the devices with which data will be synchronized. + * + * @param { string[] } localLabels - Indicates the synchronization labels of the local device. + * @param { string[] } remoteSupportLabels - Indicates the labels of the devices with which + * data will be synchronized. + * @param { AsyncCallback } callback - the callback of setSyncRange. + * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; + *
2.Incorrect parameters types. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + setSyncRange(localLabels: string[], remoteSupportLabels: string[], callback: AsyncCallback): void; + /** + * Sets synchronization range labels. + *

The labels determine the devices with which data will be synchronized. + * + * @param { string[] } localLabels - Indicates the synchronization labels of the local device. + * @param { string[] } remoteSupportLabels - Indicates the labels of the devices with which + * data will be synchronized. + * @returns { Promise } the promise returned by the function. + * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; + *
2.Incorrect parameters types. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + setSyncRange(localLabels: string[], remoteSupportLabels: string[]): Promise; + /** + * Sets the default delay allowed for database synchronization + * + * @param { number } defaultAllowedDelayMs - Indicates the default delay allowed for the + * database synchronization, in milliseconds. + * @param { AsyncCallback } callback - the callback of setSyncParam. + * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; + *
2.Incorrect parameters types. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + setSyncParam(defaultAllowedDelayMs: number, callback: AsyncCallback): void; + /** + * Sets the default delay allowed for database synchronization + * + * @param { number } defaultAllowedDelayMs - Indicates the default delay allowed for the + * database synchronization, in milliseconds. + * @returns { Promise } the promise returned by the function. + * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; + *
2.Incorrect parameters types. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + setSyncParam(defaultAllowedDelayMs: number): Promise; + /** + * Synchronize the database to the specified devices with the specified delay allowed. + * + * @permission ohos.permission.DISTRIBUTED_DATASYNC + * @param { string[] } deviceIds - Indicates the list of devices to which to synchronize the database. + * @param { SyncMode } mode - Indicates the synchronization mode. The value can be {@code PUSH}, + * {@code PULL}, or {@code PUSH_PULL}. + * @param { number } delayMs - Indicates the delay allowed for the synchronization, in milliseconds. + * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; + *
2.Incorrect parameters types. + * @throws { BusinessError } 15100003 - Database corrupted. + * @throws { BusinessError } 15100004 - Not found. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + sync(deviceIds: string[], mode: SyncMode, delayMs?: number): void; + /** + * Synchronize the database to the specified devices with the specified delay allowed. + * + * @permission ohos.permission.DISTRIBUTED_DATASYNC + * @param { string[] } deviceIds - Indicates the list of devices to which to synchronize the database. + * @param { Query } query - Indicates the {@code Query} object. + * @param { SyncMode } mode - Indicates the synchronization mode. The value can be {@code PUSH}, + * {@code PULL}, or {@code PUSH_PULL}. + * @param { number } delayMs - Indicates the delay allowed for the synchronization, in milliseconds. + * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; + *
2.Incorrect parameters types. + * @throws { BusinessError } 15100003 - Database corrupted. + * @throws { BusinessError } 15100004 - Not found. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + sync(deviceIds: string[], query: Query, mode: SyncMode, delayMs?: number): void; + /** + * Register a callback to the database and when data in the distributed database has changed, + * the callback will be invoked. + * + * @param { 'dataChange' } event - Subscribed event name, fixed as 'dataChange', indicates the data change event. + * @param { SubscribeType } type - Indicates the subscription type, which is defined in {@code SubscribeType}. + * @param { Callback } listener - {ChangeNotification}: the {@code ChangeNotification} + * object indicates the data change events in the distributed database. + * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; + *
2.Incorrect parameters types. + * @throws { BusinessError } 15100001 - Over max limits. + * @throws { BusinessError } 15100005 - Database or result set already closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + /** + * Register a callback to the database and when data in the distributed database has changed, + * the callback will be invoked. + * + * @param { 'dataChange' } event - Subscribed event name, fixed as 'dataChange', indicates the data change event. + * @param { SubscribeType } type - Indicates the subscription type, which is defined in {@code SubscribeType}. + * @param { Callback } listener - {ChangeNotification}: the {@code ChangeNotification} + * object indicates the data change events in the distributed database. + * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; + *
2.Incorrect parameters types. + * @throws { BusinessError } 15100001 - Over max limits. + * @throws { BusinessError } 15100005 - Database or result set already closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 10 + */ + on(event: 'dataChange', type: SubscribeType, listener: Callback): void; + /** + * Register a databases synchronization callback to the database. + *

Sync result is returned through asynchronous callback. + * + * @param { 'syncComplete' } event - Subscribed event name, fixed as 'syncComplete', indicates the synchronization completion event. + * @param { Callback> } syncCallback - {Array<[string, number]>}: the + * deviceId and it's corresponding synchronization result which 0 means synchronization success + * and otherwise failed. + * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; + *
2.Incorrect parameters types. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + on(event: 'syncComplete', syncCallback: Callback>): void; + /** + * Unsubscribe from the SingleKVStore database based on the specified subscribeType and listener. + * + * @param { 'dataChange' } event - The unsubscribe event name, fixed as 'dataChange', indicates the data change event. + * @param { Callback } listener - {ChangeNotification}: the {@code ChangeNotification} + * object indicates the data change events in the distributed database. + * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; + *
2.Incorrect parameters types. + * @throws { BusinessError } 15100005 - Database or result set already closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + off(event: 'dataChange', listener?: Callback): void; + /** + * Unregister the database synchronization callback. + * + * @param { 'syncComplete' } event - The unsubscribe event name, fixed as 'syncComplete', indicates the synchronization completion event. + * @param { Callback> } syncCallback - {Array<[string, number]>}: the + * deviceId and it's corresponding synchronization result which 0 means synchronization success + * and otherwise failed. + * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; + *
2.Incorrect parameters types. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + off(event: 'syncComplete', syncCallback?: Callback>): void; + /** + * Get the security level of the database. + * + * @param { AsyncCallback } callback - {SecurityLevel}: the {@code SecurityLevel} + * object indicates the security level of the database. + * @throws { BusinessError } 15100005 - Database or result set already closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + getSecurityLevel(callback: AsyncCallback): void; + /** + * Get the security level of the database. + * + * @returns { Promise } {SecurityLevel}: the {@code SecurityLevel} object indicates + * the security level of the database. + * @throws { BusinessError } 15100005 - Database or result set already closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + getSecurityLevel(): Promise; + } + /** + * Provides methods related to device-collaboration distributed databases. + *

To create a {@code DeviceKVStore} database, you can use the {@link data.distributed.common.KVManager.getKVStore(Options, String)} + * method with {@code KVStoreType} set to {@code DEVICE_COLLABORATION} for the input parameter Options. This database manages distributed + * data by device, and cannot modify data synchronized from remote devices. When an application writes a key-value pair entry + * into the database, the system automatically adds the ID of the device running the application to the key. + * + * @interface DeviceKVStore + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 9 + */ + interface DeviceKVStore extends SingleKVStore { + /** + * Obtains the value matching the local device ID and specified key. + * + * @param { string } key - Indicates the key. The length must be less than {@code MAX_KEY_LENGTH}. + * @param { AsyncCallback } callback - + * {Uint8Array|string|boolean|number}: the returned value specified by the local device ID and specified key. + * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; + *
2.Incorrect parameters types; + *
3.Parameter verification failed. + * @throws { BusinessError } 15100003 - Database corrupted. + * @throws { BusinessError } 15100004 - Not found. + * @throws { BusinessError } 15100005 - Database or result set already closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + get(key: string, callback: AsyncCallback): void; + /** + * Obtains the value matching the local device ID and specified key. + * + * @param { string } key - Indicates the key. The length must be less than {@code MAX_KEY_LENGTH}. + * @returns { Promise } + * {Uint8Array|string|boolean|number}: the returned value specified by the local device ID and specified key. + * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; + *
2.Incorrect parameters types; + *
3.Parameter verification failed. + * @throws { BusinessError } 15100003 - Database corrupted. + * @throws { BusinessError } 15100004 - Not found. + * @throws { BusinessError } 15100005 - Database or result set already closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + get(key: string): Promise; + /** + * Obtains the value matching a specified device ID and key. + * + * @param { string } deviceId - Indicates the device to be queried. + * @param { string } key - Indicates the key of the value to be queried. The length must be less than {@code MAX_KEY_LENGTH}. + * @param { AsyncCallback } callback - + * {boolean | string | number | Uint8Array}: the returned value specified by the deviceId and key. + * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; + *
2.Incorrect parameters types; + *
3.Parameter verification failed. + * @throws { BusinessError } 15100003 - Database corrupted. + * @throws { BusinessError } 15100004 - Not found. + * @throws { BusinessError } 15100005 - Database or result set already closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 9 + */ + get(deviceId: string, key: string, callback: AsyncCallback): void; + /** + * Obtains the value matching a specified device ID and key. + * + * @param { string } deviceId - Indicates the device to be queried. + * @param { string } key - Indicates the key of the value to be queried. The length must be less than {@code MAX_KEY_LENGTH}. + * @returns { Promise } + * {Uint8Array|string|boolean|number}: the returned value specified by the deviceId and key. + * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; + *
2.Incorrect parameters types; + *
3.Parameter verification failed. + * @throws { BusinessError } 15100003 - Database corrupted. + * @throws { BusinessError } 15100004 - Not found. + * @throws { BusinessError } 15100005 - Database or result set already closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 9 + */ + get(deviceId: string, key: string): Promise; + /** + * Obtains all key-value pairs that match the local device ID and specified key prefix. + * + * @param { string } keyPrefix - Indicates the key prefix to match. + * @param { AsyncCallback } callback - {Entry[]}: the list of all key-value pairs + * that match the local device ID and specified key prefix. + * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; + *
2.Incorrect parameters types. + * @throws { BusinessError } 15100003 - Database corrupted. + * @throws { BusinessError } 15100005 - Database or result set already closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + getEntries(keyPrefix: string, callback: AsyncCallback): void; + /** + * Obtains all key-value pairs that match the local device ID and specified key prefix. + * + * @param { string } keyPrefix - Indicates the key prefix to match. + * @returns { Promise } {Entry[]}: the list of all key-value pairs that match the + * local device ID and specified key prefix. + * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; + *
2.Incorrect parameters types. + * @throws { BusinessError } 15100003 - Database corrupted. + * @throws { BusinessError } 15100005 - Database or result set already closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + getEntries(keyPrefix: string): Promise; + /** + * Obtains all key-value pairs matching a specified device ID and key prefix. + * + * @param { string } deviceId - Identifies the device whose data is to be queried. + * @param { string } keyPrefix - Indicates the key prefix to match. + * @param { AsyncCallback } callback - {Entry[]}: the list of all key-value pairs + * that match the specified deviceId and key prefix. + * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; + *
2.Incorrect parameters types. + * @throws { BusinessError } 15100003 - Database corrupted. + * @throws { BusinessError } 15100005 - Database or result set already closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 9 + */ + getEntries(deviceId: string, keyPrefix: string, callback: AsyncCallback): void; + /** + * Obtains all key-value pairs matching a specified device ID and key prefix. + * + * @param { string } deviceId - Identifies the device whose data is to be queried. + * @param { string } keyPrefix - Indicates the key prefix to match. + * @returns { Promise } {Entry[]}: the list of all key-value pairs that match the + * specified deviceId and key prefix. + * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; + *
2.Incorrect parameters types. + * @throws { BusinessError } 15100003 - Database corrupted. + * @throws { BusinessError } 15100005 - Database or result set already closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 9 + */ + getEntries(deviceId: string, keyPrefix: string): Promise; + /** + * Obtains the list of key-value pairs matching the local device ID and specified {@code Query} object. + * + * @param { Query } query - Indicates the {@code Query} object. + * @param { AsyncCallback } callback - {Entry[]}: the list of all key-value pairs + * matching the local device ID and specified {@code Query} object. + * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; + *
2.Incorrect parameters types. + * @throws { BusinessError } 15100003 - Database corrupted. + * @throws { BusinessError } 15100005 - Database or result set already closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + getEntries(query: Query, callback: AsyncCallback): void; + /** + * Obtains the list of key-value pairs matching the local device ID and specified {@code Query} object. + * + * @param { Query } query - Indicates the {@code Query} object. + * @returns { Promise } {Entry[]}: the list of all key-value pairs matching the local device ID and + * specified {@code Query} object. + * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; + *
2.Incorrect parameters types. + * @throws { BusinessError } 15100003 - Database corrupted. + * @throws { BusinessError } 15100005 - Database or result set already closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + getEntries(query: Query): Promise; + /** + * Obtains the list of key-value pairs matching a specified device ID and {@code Query} object. + * + * @param { string } deviceId - Indicates the ID of the device to which the key-value pairs belong. + * @param { Query } query - Indicates the {@code Query} object. + * @param { AsyncCallback } callback - {Entry[]}: the list of all key-value pairs + * matching the specified deviceId and {@code Query} object. + * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; + *
2.Incorrect parameters types. + * @throws { BusinessError } 15100003 - Database corrupted. + * @throws { BusinessError } 15100005 - Database or result set already closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 9 + */ + getEntries(deviceId: string, query: Query, callback: AsyncCallback): void; + /** + * Obtains the list of key-value pairs matching a specified device ID and {@code Query} object. + * + * @param { string } deviceId - Indicates the ID of the device to which the key-value pairs belong. + * @param { Query } query - Indicates the {@code Query} object. + * @returns { Promise } {Entry[]}: the list of all key-value pairs matching the + * specified deviceId and {@code Query} object. + * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; + *
2.Incorrect parameters types. + * @throws { BusinessError } 15100003 - Database corrupted. + * @throws { BusinessError } 15100005 - Database or result set already closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 9 + */ + getEntries(deviceId: string, query: Query): Promise; + /** + * Obtains the result set with the local device ID and specified prefix from a {@code DeviceKVStore} database. + * The {@code KVStoreResultSet} object can be used to query all key-value pairs that meet the search criteria. + * Each {@code DeviceKVStore} instance can have a maximum of four {@code KVStoreResultSet} objects at the same time. + * If you have created four objects, calling this method will return a failure. Therefore, you are advised to + * call the closeResultSet method to close unnecessary {@code KVStoreResultSet} objects in a timely manner. + * + * @param { string } keyPrefix - Indicates the key prefix to match. + * @param { AsyncCallback } callback - {KVStoreResultSet}: the {@code KVStoreResultSet} + * object matching the local device ID and specified keyPrefix. + * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; + *
2.Incorrect parameters types. + * @throws { BusinessError } 15100003 - Database corrupted. + * @throws { BusinessError } 15100005 - Database or result set already closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + /** + * Obtains the result set with the local device ID and specified prefix from a {@code DeviceKVStore} database. + * The {@code KVStoreResultSet} object can be used to query all key-value pairs that meet the search criteria. + * Each {@code DeviceKVStore} instance can have a maximum of four {@code KVStoreResultSet} objects at the same time. + * If you have created four objects, calling this method will return a failure. Therefore, you are advised to + * call the closeResultSet method to close unnecessary {@code KVStoreResultSet} objects in a timely manner. + * + * @param { string } keyPrefix - Indicates the key prefix to match. + * @param { AsyncCallback } callback - {KVStoreResultSet}: the {@code KVStoreResultSet} + * object matching the local device ID and specified keyPrefix. + * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; + *
2.Incorrect parameters types. + * @throws { BusinessError } 15100001 - Over max limits. + * @throws { BusinessError } 15100003 - Database corrupted. + * @throws { BusinessError } 15100005 - Database or result set already closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 10 + */ + getResultSet(keyPrefix: string, callback: AsyncCallback): void; + /** + * Obtains the result set with the local device ID and specified prefix from a {@code DeviceKVStore} database. + * The {@code KVStoreResultSet} object can be used to query all key-value pairs that meet the search criteria. + * Each {@code DeviceKVStore} instance can have a maximum of four {@code KVStoreResultSet} objects at the same time. + * If you have created four objects, calling this method will return a failure. Therefore, you are advised to + * call the closeResultSet method to close unnecessary {@code KVStoreResultSet} objects in a timely manner. + * + * @param { string } keyPrefix - Indicates the key prefix to match. + * @returns { Promise } {KVStoreResultSet}: the {@code KVStoreResultSet} + * object matching the local device ID and specified keyPrefix. + * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; + *
2.Incorrect parameters types. + * @throws { BusinessError } 15100003 - Database corrupted. + * @throws { BusinessError } 15100005 - Database or result set already closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + /** + * Obtains the result set with the local device ID and specified prefix from a {@code DeviceKVStore} database. + * The {@code KVStoreResultSet} object can be used to query all key-value pairs that meet the search criteria. + * Each {@code DeviceKVStore} instance can have a maximum of four {@code KVStoreResultSet} objects at the same time. + * If you have created four objects, calling this method will return a failure. Therefore, you are advised to + * call the closeResultSet method to close unnecessary {@code KVStoreResultSet} objects in a timely manner. + * + * @param { string } keyPrefix - Indicates the key prefix to match. + * @returns { Promise } {KVStoreResultSet}: the {@code KVStoreResultSet} + * object matching the local device ID and specified keyPrefix. + * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; + *
2.Incorrect parameters types. + * @throws { BusinessError } 15100001 - Over max limits. + * @throws { BusinessError } 15100003 - Database corrupted. + * @throws { BusinessError } 15100005 - Database or result set already closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 10 + */ + getResultSet(keyPrefix: string): Promise; + /** + * Obtains the {@code KVStoreResultSet} object matching the specified device ID and key prefix. + *

The {@code KVStoreResultSet} object can be used to query all key-value pairs that meet the search criteria. Each {@code DeviceKVStore} + * instance can have a maximum of four {@code KVStoreResultSet} objects at the same time. If you have created four objects, + * calling this method will return a failure. Therefore, you are advised to call the closeResultSet method to close unnecessary + * {@code KVStoreResultSet} objects in a timely manner. + * + * @param { string } deviceId - Identifies the device whose data is to be queried. + * @param { string } keyPrefix - Indicates the key prefix to match. + * @param { AsyncCallback } callback - {KVStoreResultSet}: the {@code KVStoreResultSet} + * object matching the specified deviceId and keyPrefix. + * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; + *
2.Incorrect parameters types. + * @throws { BusinessError } 15100003 - Database corrupted. + * @throws { BusinessError } 15100005 - Database or result set already closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 9 + */ + /** + * Obtains the {@code KVStoreResultSet} object matching the specified device ID and key prefix. + *

The {@code KVStoreResultSet} object can be used to query all key-value pairs that meet the search criteria. Each {@code DeviceKVStore} + * instance can have a maximum of four {@code KVStoreResultSet} objects at the same time. If you have created four objects, + * calling this method will return a failure. Therefore, you are advised to call the closeResultSet method to close unnecessary + * {@code KVStoreResultSet} objects in a timely manner. + * + * @param { string } deviceId - Identifies the device whose data is to be queried. + * @param { string } keyPrefix - Indicates the key prefix to match. + * @param { AsyncCallback } callback - {KVStoreResultSet}: the {@code KVStoreResultSet} + * object matching the specified deviceId and keyPrefix. + * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; + *
2.Incorrect parameters types. + * @throws { BusinessError } 15100001 - Over max limits. + * @throws { BusinessError } 15100003 - Database corrupted. + * @throws { BusinessError } 15100005 - Database or result set already closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 10 + */ + getResultSet(deviceId: string, keyPrefix: string, callback: AsyncCallback): void; + /** + * Obtains the {@code KVStoreResultSet} object matching the specified device ID and key prefix. + *

The {@code KVStoreResultSet} object can be used to query all key-value pairs that meet the search criteria. Each {@code DeviceKVStore} + * instance can have a maximum of four {@code KVStoreResultSet} objects at the same time. If you have created four objects, + * calling this method will return a failure. Therefore, you are advised to call the closeResultSet method to close unnecessary + * {@code KVStoreResultSet} objects in a timely manner. + * + * @param { string } deviceId - Identifies the device whose data is to be queried. + * @param { string } keyPrefix - Indicates the key prefix to match. + * @returns { Promise } {KVStoreResultSet}: the {@code KVStoreResultSet} + * object matching the specified deviceId and keyPrefix. + * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; + *
2.Incorrect parameters types. + * @throws { BusinessError } 15100003 - Database corrupted. + * @throws { BusinessError } 15100005 - Database or result set already closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 9 + */ + /** + * Obtains the {@code KVStoreResultSet} object matching the specified device ID and key prefix. + *

The {@code KVStoreResultSet} object can be used to query all key-value pairs that meet the search criteria. Each {@code DeviceKVStore} + * instance can have a maximum of four {@code KVStoreResultSet} objects at the same time. If you have created four objects, + * calling this method will return a failure. Therefore, you are advised to call the closeResultSet method to close unnecessary + * {@code KVStoreResultSet} objects in a timely manner. + * + * @param { string } deviceId - Identifies the device whose data is to be queried. + * @param { string } keyPrefix - Indicates the key prefix to match. + * @returns { Promise } {KVStoreResultSet}: the {@code KVStoreResultSet} + * object matching the specified deviceId and keyPrefix. + * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; + *
2.Incorrect parameters types. + * @throws { BusinessError } 15100001 - Over max limits. + * @throws { BusinessError } 15100003 - Database corrupted. + * @throws { BusinessError } 15100005 - Database or result set already closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 10 + */ + getResultSet(deviceId: string, keyPrefix: string): Promise; + /** + * Obtains the {@code KVStoreResultSet} object matching the local device ID and specified {@code Query} object. + * + * @param { Query } query - Indicates the {@code Query} object. + * @param { AsyncCallback } callback - {KVStoreResultSet}: the {@code KVStoreResultSet} + * object matching the local device ID and specified {@code Query} object. + * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; + *
2.Incorrect parameters types. + * @throws { BusinessError } 15100003 - Database corrupted. + * @throws { BusinessError } 15100005 - Database or result set already closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + /** + * Obtains the {@code KVStoreResultSet} object matching the local device ID and specified {@code Query} object. + * + * @param { Query } query - Indicates the {@code Query} object. + * @param { AsyncCallback } callback - {KVStoreResultSet}: the {@code KVStoreResultSet} + * object matching the local device ID and specified {@code Query} object. + * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; + *
2.Incorrect parameters types. + * @throws { BusinessError } 15100001 - Over max limits. + * @throws { BusinessError } 15100003 - Database corrupted. + * @throws { BusinessError } 15100005 - Database or result set already closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 10 + */ + getResultSet(query: Query, callback: AsyncCallback): void; + /** + * Obtains the {@code KVStoreResultSet} object matching the local device ID and specified {@code Query} object. + * + * @param { Query } query - Indicates the {@code Query} object. + * @returns { Promise } {KVStoreResultSet}: the {@code KVStoreResultSet} + * object matching the local device ID and specified {@code Query} object. + * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; + *
2.Incorrect parameters types. + * @throws { BusinessError } 15100003 - Database corrupted. + * @throws { BusinessError } 15100005 - Database or result set already closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + /** + * Obtains the {@code KVStoreResultSet} object matching the local device ID and specified {@code Query} object. + * + * @param { Query } query - Indicates the {@code Query} object. + * @returns { Promise } {KVStoreResultSet}: the {@code KVStoreResultSet} + * object matching the local device ID and specified {@code Query} object. + * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; + *
2.Incorrect parameters types. + * @throws { BusinessError } 15100001 - Over max limits. + * @throws { BusinessError } 15100003 - Database corrupted. + * @throws { BusinessError } 15100005 - Database or result set already closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 10 + */ + getResultSet(query: Query): Promise; + /** + * Obtains the {@code KVStoreResultSet} object matching a specified device ID and {@code Query} object. + * + * @param { string } deviceId - Indicates the ID of the device to which the {@code KVStoreResultSet} object belongs. + * @param { Query } query - Indicates the {@code Query} object. + * @param { AsyncCallback } callback - {KVStoreResultSet}: the {@code KVStoreResultSet} + * object matching the specified deviceId and {@code Query} object. + * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; + *
2.Incorrect parameters types. + * @throws { BusinessError } 15100003 - Database corrupted. + * @throws { BusinessError } 15100005 - Database or result set already closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 9 + */ + /** + * Obtains the {@code KVStoreResultSet} object matching a specified device ID and {@code Query} object. + * + * @param { string } deviceId - Indicates the ID of the device to which the {@code KVStoreResultSet} object belongs. + * @param { Query } query - Indicates the {@code Query} object. + * @param { AsyncCallback } callback - {KVStoreResultSet}: the {@code KVStoreResultSet} + * object matching the specified deviceId and {@code Query} object. + * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; + *
2.Incorrect parameters types. + * @throws { BusinessError } 15100001 - Over max limits. + * @throws { BusinessError } 15100003 - Database corrupted. + * @throws { BusinessError } 15100005 - Database or result set already closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 10 + */ + getResultSet(deviceId: string, query: Query, callback: AsyncCallback): void; + /** + * Obtains the {@code KVStoreResultSet} object matching a specified device ID and {@code Query} object. + * + * @param { string } deviceId - Indicates the ID of the device to which the {@code KVStoreResultSet} object belongs. + * @param { Query } query - Indicates the {@code Query} object. + * @returns { Promise } {KVStoreResultSet}: the {@code KVStoreResultSet} + * object matching the specified deviceId and {@code Query} object. + * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; + *
2.Incorrect parameters types. + * @throws { BusinessError } 15100003 - Database corrupted. + * @throws { BusinessError } 15100005 - Database or result set already closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 9 + */ + /** + * Obtains the {@code KVStoreResultSet} object matching a specified device ID and {@code Query} object. + * + * @param { string } deviceId - Indicates the ID of the device to which the {@code KVStoreResultSet} object belongs. + * @param { Query } query - Indicates the {@code Query} object. + * @returns { Promise } {KVStoreResultSet}: the {@code KVStoreResultSet} + * object matching the specified deviceId and {@code Query} object. + * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; + *
2.Incorrect parameters types. + * @throws { BusinessError } 15100001 - Over max limits. + * @throws { BusinessError } 15100003 - Database corrupted. + * @throws { BusinessError } 15100005 - Database or result set already closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 10 + */ + getResultSet(deviceId: string, query: Query): Promise; + /** + * Obtains the number of results matching the local device ID and specified {@code Query} object. + * + * @param { Query } query - Indicates the {@code Query} object. + * @param { AsyncCallback } callback - {number}: the number of results matching the + * local device ID and specified {@code Query} object. + * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; + *
2.Incorrect parameters types. + * @throws { BusinessError } 15100003 - Database corrupted. + * @throws { BusinessError } 15100005 - Database or result set already closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + getResultSize(query: Query, callback: AsyncCallback): void; + /** + * Obtains the number of results matching the local device ID and specified {@code Query} object. + * + * @param { Query } query - Indicates the {@code Query} object. + * @returns { Promise } {number}: the number of results matching the local device ID and specified + * {@code Query} object. + * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; + *
2.Incorrect parameters types. + * @throws { BusinessError } 15100003 - Database corrupted. + * @throws { BusinessError } 15100005 - Database or result set already closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + getResultSize(query: Query): Promise; + /** + * Obtains the number of results matching a specified device ID and {@code Query} object. + * + * @param { string } deviceId - Indicates the ID of the device to which the results belong. + * @param { Query } query - Indicates the {@code Query} object. + * @param { AsyncCallback } callback - {number}: the number of results matching the + * specified deviceId and {@code Query} object. + * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; + *
2.Incorrect parameters types. + * @throws { BusinessError } 15100003 - Database corrupted. + * @throws { BusinessError } 15100005 - Database or result set already closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 9 + */ + getResultSize(deviceId: string, query: Query, callback: AsyncCallback): void; + /** + * Obtains the number of results matching a specified device ID and {@code Query} object. + * + * @param { string } deviceId - Indicates the ID of the device to which the results belong. + * @param { Query } query - Indicates the {@code Query} object. + * @returns { Promise } {number}: the number of results matching the specified + * deviceId and {@code Query} object. + * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; + *
2.Incorrect parameters types. + * @throws { BusinessError } 15100003 - Database corrupted. + * @throws { BusinessError } 15100005 - Database or result set already closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 9 + */ + getResultSize(deviceId: string, query: Query): Promise; + } + /** + * Creates a {@link KVManager} instance based on the configuration information. + *

You must pass {@link KVManagerConfig} to provide configuration information + * to create a {@link KVManager} instance. + * + * @param { KVManagerConfig } config - Indicates the KVStore configuration information, + * including the package name and context, and package name can not be empty. + * @returns { KVManager } : the {@code KVManager} instance. + * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; + *
2.Incorrect parameters types; + *
3.Parameter verification failed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + function createKVManager(config: KVManagerConfig): KVManager; + /** + * Provides interfaces to manage a {@code SingleKVStore} database, including obtaining, closing, and deleting the {@code SingleKVStore}. + * + * @interface KVManager + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + interface KVManager { + /** + * Creates and obtains a KVStore database by specifying {@code Options} and {@code storeId}. + * + * @param { string } storeId - Identifies the KVStore database. The value of this parameter must be unique + * for the same application, and different applications can share the same value. The storeId can consist + * of only letters, digits, and underscores (_), and cannot exceed 128 characters. + * @param { Options } options - Indicates the {@code Options} object used for creating and + * obtaining the KVStore database. + * @param { AsyncCallback } callback - {T}: the {@code SingleKVStore} or {@code DeviceKVStore} instance. + * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; + *
2.Incorrect parameters types; + *
3.Parameter verification failed. + * @throws { BusinessError } 15100002 - Open existed database with changed options. + * @throws { BusinessError } 15100003 - Database corrupted. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + getKVStore(storeId: string, options: Options, callback: AsyncCallback): void; + /** + * Creates and obtains a KVStore database by specifying {@code Options} and {@code storeId}. + * + * @param { string } storeId - Identifies the KVStore database. The value of this parameter must be unique + * for the same application, and different applications can share the same value. The storeId can consist + * of only letters, digits, and underscores (_), and cannot exceed 128 characters. + * @param { Options } options - Indicates the {@code Options} object used for creating and + * obtaining the KVStore database. + * @returns { Promise } {T}: the {@code SingleKVStore} or {@code DeviceKVStore} instance. + * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; + *
2.Incorrect parameters types; + *
3.Parameter verification failed. + * @throws { BusinessError } 15100002 - Open existed database with changed options. + * @throws { BusinessError } 15100003 - Database corrupted. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + getKVStore(storeId: string, options: Options): Promise; + /** + * Closes the KVStore database. + *

Warning: This method is not thread-safe. If you call this method to stop a KVStore database that is running, your + * thread may crash. + *

The KVStore database to close must be an object created by using the {@code getKVStore} method. Before using this + * method, release the resources created for the database, for example, {@code KVStoreResultSet} for KVStore, otherwise + * closing the database will fail. + * + * @param { string } appId - Identifies the application that the database belong to, and cannot exceed 256 characters. + * @param { string } storeId - Identifies the KVStore database to close. The storeId can consist of only letters, digits, + * and underscores (_), and cannot exceed 128 characters. + * @param { AsyncCallback } callback - the callback of closeKVStore. + * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; + *
2.Parameter verification failed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + closeKVStore(appId: string, storeId: string, callback: AsyncCallback): void; + /** + * Closes the KVStore database. + *

Warning: This method is not thread-safe. If you call this method to stop a KVStore database that is running, your + * thread may crash. + *

The KVStore database to close must be an object created by using the {@code getKVStore} method. Before using this + * method, release the resources created for the database, for example, {@code KVStoreResultSet} for KVStore, otherwise + * closing the database will fail. + * + * @param { string } appId - Identifies the application that the database belong to, and cannot exceed 256 characters. + * @param { string } storeId - Identifies the KVStore database to close. The storeId can consist of only letters, digits, + * and underscores (_), and cannot exceed 128 characters. + * @returns { Promise } the promise returned by the function. + * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; + *
2.Parameter verification failed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + closeKVStore(appId: string, storeId: string): Promise; + /** + * Deletes the KVStore database identified by storeId. + *

Before using this method, close all KVStore instances in use that are identified by the same storeId. + *

You can use this method to delete a KVStore database not in use. After the database is deleted, all its data will be + * lost. + * + * @param { string } appId - Identifies the application that the database belong to, and cannot exceed 256 characters. + * @param { string } storeId - Identifies the KVStore database to delete. The storeId can consist of only letters, digits, + * and underscores (_), and cannot exceed 128 characters. + * @param { AsyncCallback } callback - the callback of deleteKVStore. + * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; + *
2.Parameter verification failed. + * @throws { BusinessError } 15100004 - Not found. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + deleteKVStore(appId: string, storeId: string, callback: AsyncCallback): void; + /** + * Deletes the KVStore database identified by storeId. + *

Before using this method, close all KVStore instances in use that are identified by the same storeId. + *

You can use this method to delete a KVStore database not in use. After the database is deleted, all its data will be + * lost. + * + * @param { string } appId - Identifies the application that the database belong to, and cannot exceed 256 characters. + * @param { string } storeId - Identifies the KVStore database to delete. The storeId can consist of only letters, digits, + * and underscores (_), and cannot exceed 128 characters. + * @returns { Promise } the promise returned by the function. + * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; + *
2.Parameter verification failed. + * @throws { BusinessError } 15100004 - Not found. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + deleteKVStore(appId: string, storeId: string): Promise; + /** + * Obtains the storeId of all KVStore databases that are created by using the {@code getKVStore} method and not deleted by + * calling the {@code deleteKVStore} method. + * + * @param { string } appId - Identifies the application that obtains the databases, and cannot exceed 256 characters. + * @param { AsyncCallback } callback - {string[]}: the storeId of all created KVStore databases. + * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; + *
2.Parameter verification failed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + getAllKVStoreId(appId: string, callback: AsyncCallback): void; + /** + * Obtains the storeId of all KVStore databases that are created by using the {@code getKVStore} method and not deleted by + * calling the {@code deleteKVStore} method. + * + * @param { string } appId - Identifies the application that obtains the databases, and cannot exceed 256 characters. + * @returns { Promise } {string[]}: the storeId of all created KVStore databases. + * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified. + *
2.Parameter verification failed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + getAllKVStoreId(appId: string): Promise; + /** + * Register a death callback to get notification when the data manager service is terminated. + *

If the data manager service is terminated,you need to re-subscribe to data change notifications and synchronization + * completion notifications, and calling the sync method will return a failure. + * + * @param { 'distributedDataServiceDie' } event - Subscribed event name, fixed as 'distributedDataServiceDie', as a service status change events. + * @param { Callback } deathCallback - callback to be invoked when the data manager service is terminated. + * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; + *
2.Incorrect parameters types; + *
3.Parameter verification failed. + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 9 + */ + on(event: 'distributedDataServiceDie', deathCallback: Callback): void; + /** + * Unregister the death callback. Not notification will be received when the data manager service is terminated. + *

The unregistered death callback must be a registered death callback of the database. If no death callback parameter + * is passed, all database death callbacks will be unregistered. + * + * @param { 'distributedDataServiceDie' } event - Unsubscribe event name, fixed as 'distributedDataServiceDie', as a service status change events. + * @param { Callback } deathCallback - the data manager service is terminated callback which has been registered. + * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; + *
2.Incorrect parameters types; + *
3.Parameter verification failed. + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 9 + */ + off(event: 'distributedDataServiceDie', deathCallback?: Callback): void; + } +} +export default distributedKVStore; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.data.preferences.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.data.preferences.d.ts new file mode 100755 index 00000000..5996052e --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.data.preferences.d.ts @@ -0,0 +1,1809 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit ArkData + */ +import { AsyncCallback, Callback } from './@ohos.base'; +import Context from './application/BaseContext'; +/** + * Provides interfaces to obtain and modify preferences data. + * + * @namespace preferences + * @syscap SystemCapability.DistributedDataManager.Preferences.Core + * @since 9 + * @name preferences + */ +/** + * Provides interfaces to obtain and modify preferences data. + * + * @namespace preferences + * @syscap SystemCapability.DistributedDataManager.Preferences.Core + * @crossplatform + * @since 10 + * @name preferences + */ +/** + * Provides interfaces to obtain and modify preferences data. + * + * @namespace preferences + * @syscap SystemCapability.DistributedDataManager.Preferences.Core + * @crossplatform + * @atomicservice + * @since 11 + * @name preferences + */ +declare namespace preferences { + /** + * Indicates possible value types + * + * @typedef {number | string | boolean | Array | Array | Array} + * @syscap SystemCapability.DistributedDataManager.Preferences.Core + * @since 9 + */ + /** + * Indicates possible value types + * + * @typedef {number | string | boolean | Array | Array | Array} + * @syscap SystemCapability.DistributedDataManager.Preferences.Core + * @since 10 + */ + /** + * Indicates possible value types + * + * @typedef {number | string | boolean | Array | Array | Array | Uint8Array} + * @syscap SystemCapability.DistributedDataManager.Preferences.Core + * @atomicservice + * @since 11 + */ + /** + * Indicates possible value types + * + * @typedef {number | string | boolean | Array | Array | Array | Uint8Array | object | bigint} + * @syscap SystemCapability.DistributedDataManager.Preferences.Core + * @atomicservice + * @since 12 + */ + type ValueType = number | string | boolean | Array | Array | Array | Uint8Array | object | bigint; + /** + * Indicates the maximum length of a key (80 characters). + * + * @constant + * @syscap SystemCapability.DistributedDataManager.Preferences.Core + * @since 9 + */ + /** + * Indicates the maximum length of a key (80 characters). + * + * @constant + * @syscap SystemCapability.DistributedDataManager.Preferences.Core + * @crossplatform + * @since 10 + */ + /** + * Indicates the maximum length of a key (80 characters). + * + * @constant + * @syscap SystemCapability.DistributedDataManager.Preferences.Core + * @crossplatform + * @atomicservice + * @since 11 + */ + const MAX_KEY_LENGTH: 80; + /** + * Indicates the maximum length of a string (8192 characters). + * + * @constant + * @syscap SystemCapability.DistributedDataManager.Preferences.Core + * @since 9 + */ + /** + * Indicates the maximum length of a string (8192 characters). + * + * @constant + * @syscap SystemCapability.DistributedDataManager.Preferences.Core + * @crossplatform + * @since 10 + */ + /** + * Indicates the maximum length of a string (8192 characters). + * + * @constant + * @syscap SystemCapability.DistributedDataManager.Preferences.Core + * @crossplatform + * @atomicservice + * @since 11 + */ + const MAX_VALUE_LENGTH: 8192; + /** + * Manages preferences file configurations. + * + * @interface Options + * @syscap SystemCapability.DistributedDataManager.Preferences.Core + * @crossplatform + * @since 10 + */ + /** + * Manages preferences file configurations. + * + * @interface Options + * @syscap SystemCapability.DistributedDataManager.Preferences.Core + * @crossplatform + * @atomicservice + * @since 11 + */ + interface Options { + /** + * The preferences file name. + * + * @syscap SystemCapability.DistributedDataManager.Preferences.Core + * @crossplatform + * @since 10 + */ + /** + * The preferences file name. + * + * @syscap SystemCapability.DistributedDataManager.Preferences.Core + * @crossplatform + * @atomicservice + * @since 11 + */ + name: string; + /** + * Application Group Id. + * + * @syscap SystemCapability.DistributedDataManager.Preferences.Core + * @StageModelOnly + * @since 10 + */ + /** + * Application Group Id. + * + * @syscap SystemCapability.DistributedDataManager.Preferences.Core + * @StageModelOnly + * @atomicservice + * @since 11 + */ + dataGroupId?: string | null | undefined; + } + /** + * Obtains a {@link Preferences} instance matching a specified preferences file name. + *

The {@link references} instance loads all data of the preferences file and + * resides in the memory. You can use removePreferencesFromCache to remove the instance from the memory. + * + * @param { Context } context - Indicates the context of application or capability. + * @param { string } name - Indicates the preferences file name. + * @param { AsyncCallback } callback - The {@link Preferences} instance matching the specified + * preferences file name. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; + * 3. Parameter verification failed. + * @syscap SystemCapability.DistributedDataManager.Preferences.Core + * @since 9 + */ + /** + * Obtains a {@link Preferences} instance matching a specified preferences file name. + *

The {@link references} instance loads all data of the preferences file and + * resides in the memory. You can use removePreferencesFromCache to remove the instance from the memory. + * + * @param { Context } context - Indicates the context of application or capability. + * @param { string } name - Indicates the preferences file name. + * @param { AsyncCallback } callback - The {@link Preferences} instance matching the specified + * preferences file name. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; + * 3. Parameter verification failed. + * @syscap SystemCapability.DistributedDataManager.Preferences.Core + * @crossplatform + * @since 10 + */ + /** + * Obtains a {@link Preferences} instance matching a specified preferences file name. + *

The {@link references} instance loads all data of the preferences file and + * resides in the memory. You can use removePreferencesFromCache to remove the instance from the memory. + * + * @param { Context } context - Indicates the context of application or capability. + * @param { string } name - Indicates the preferences file name. + * @param { AsyncCallback } callback - The {@link Preferences} instance matching the specified + * preferences file name. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; + * 3. Parameter verification failed. + * @throws { BusinessError } 15500000 - Inner error. + * @syscap SystemCapability.DistributedDataManager.Preferences.Core + * @crossplatform + * @atomicservice + * @since 11 + */ + function getPreferences(context: Context, name: string, callback: AsyncCallback): void; + /** + * Obtains a {@link Preferences} instance matching a specified preferences file name. + *

The {@link references} instance loads all data of the preferences file and + * resides in the memory. You can use removePreferencesFromCache to remove the instance from the memory. + * + * @param { Context } context - Indicates the context of application or capability. + * @param { Options } options - Indicates the {@link Options} option of preferences file position. + * @param { AsyncCallback } callback - The {@link Preferences} instance matching the specified + * preferences file name. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; + * 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 15501001 - Only supported in stage mode. + * @throws { BusinessError } 15501002 - The data group id is not valid. + * @syscap SystemCapability.DistributedDataManager.Preferences.Core + * @crossplatform + * @since 10 + */ + /** + * Obtains a {@link Preferences} instance matching a specified preferences file name. + *

The {@link references} instance loads all data of the preferences file and + * resides in the memory. You can use removePreferencesFromCache to remove the instance from the memory. + * + * @param { Context } context - Indicates the context of application or capability. + * @param { Options } options - Indicates the {@link Options} option of preferences file position. + * @param { AsyncCallback } callback - The {@link Preferences} instance matching the specified + * preferences file name. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; + * 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 15500000 - Inner error. + * @throws { BusinessError } 15501001 - Only supported in stage mode. + * @throws { BusinessError } 15501002 - The data group id is not valid. + * @syscap SystemCapability.DistributedDataManager.Preferences.Core + * @crossplatform + * @atomicservice + * @since 11 + */ + function getPreferences(context: Context, options: Options, callback: AsyncCallback): void; + /** + * Obtains a {@link Preferences} instance matching a specified preferences file name. + *

The {@link references} instance loads all data of the preferences file and + * resides in the memory. You can use removePreferencesFromCache to remove the instance from the memory. + * + * @param { Context } context - Indicates the context of application or capability. + * @param { string } name - Indicates the preferences file name. + * @returns { Promise } The {@link Preferences} instance matching the specified preferences file name. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; + * 3. Parameter verification failed. + * @syscap SystemCapability.DistributedDataManager.Preferences.Core + * @since 9 + */ + /** + * Obtains a {@link Preferences} instance matching a specified preferences file name. + *

The {@link references} instance loads all data of the preferences file and + * resides in the memory. You can use removePreferencesFromCache to remove the instance from the memory. + * + * @param { Context } context - Indicates the context of application or capability. + * @param { string } name - Indicates the preferences file name. + * @returns { Promise } The {@link Preferences} instance matching the specified preferences file name. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; + * 3. Parameter verification failed. + * @syscap SystemCapability.DistributedDataManager.Preferences.Core + * @crossplatform + * @since 10 + */ + /** + * Obtains a {@link Preferences} instance matching a specified preferences file name. + *

The {@link references} instance loads all data of the preferences file and + * resides in the memory. You can use removePreferencesFromCache to remove the instance from the memory. + * + * @param { Context } context - Indicates the context of application or capability. + * @param { string } name - Indicates the preferences file name. + * @returns { Promise } The {@link Preferences} instance matching the specified preferences file name. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; + * 3. Parameter verification failed. + * @throws { BusinessError } 15500000 - Inner error. + * @syscap SystemCapability.DistributedDataManager.Preferences.Core + * @crossplatform + * @atomicservice + * @since 11 + */ + function getPreferences(context: Context, name: string): Promise; + /** + * Obtains a {@link Preferences} instance matching a specified preferences file name. + *

The {@link references} instance loads all data of the preferences file and + * resides in the memory. You can use removePreferencesFromCache to remove the instance from the memory. + * + * @param { Context } context - Indicates the context of application or capability. + * @param { Options } options - Indicates the {@link Options} option of preferences file position. + * @returns { Promise } The {@link Preferences} instance matching the specified preferences file name. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; + * 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 15501001 - Only supported in stage mode. + * @throws { BusinessError } 15501002 - The data group id is not valid. + * @syscap SystemCapability.DistributedDataManager.Preferences.Core + * @crossplatform + * @since 10 + */ + /** + * Obtains a {@link Preferences} instance matching a specified preferences file name. + *

The {@link references} instance loads all data of the preferences file and + * resides in the memory. You can use removePreferencesFromCache to remove the instance from the memory. + * + * @param { Context } context - Indicates the context of application or capability. + * @param { Options } options - Indicates the {@link Options} option of preferences file position. + * @returns { Promise } The {@link Preferences} instance matching the specified preferences file name. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; + * 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 15500000 - Inner error. + * @throws { BusinessError } 15501001 - Only supported in stage mode. + * @throws { BusinessError } 15501002 - The data group id is not valid. + * @syscap SystemCapability.DistributedDataManager.Preferences.Core + * @crossplatform + * @atomicservice + * @since 11 + */ + function getPreferences(context: Context, options: Options): Promise; + /** + * Obtains a {@link Preferences} instance matching a specified preferences file name. + * This interface is executed synchronously. + *

The {@link references} instance loads all data of the preferences file and + * resides in the memory. You can use removePreferencesFromCache to remove the instance from the memory. + * + * @param { Context } context - Indicates the context of application or capability. + * @param { Options } options - Indicates the {@link Options} option of preferences file position. + * @returns { Preferences } The {@link Preferences} instance matching the specified preferences file name. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; + * 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 15501001 - Only supported in stage mode. + * @throws { BusinessError } 15501002 - The data group id is not valid. + * @syscap SystemCapability.DistributedDataManager.Preferences.Core + * @crossplatform + * @since 10 + */ + /** + * Obtains a {@link Preferences} instance matching a specified preferences file name. + * This interface is executed synchronously. + *

The {@link references} instance loads all data of the preferences file and + * resides in the memory. You can use removePreferencesFromCache to remove the instance from the memory. + * + * @param { Context } context - Indicates the context of application or capability. + * @param { Options } options - Indicates the {@link Options} option of preferences file position. + * @returns { Preferences } The {@link Preferences} instance matching the specified preferences file name. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; + * 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 15500000 - Inner error. + * @throws { BusinessError } 15501001 - Only supported in stage mode. + * @throws { BusinessError } 15501002 - The data group id is not valid. + * @syscap SystemCapability.DistributedDataManager.Preferences.Core + * @crossplatform + * @atomicservice + * @since 11 + */ + function getPreferencesSync(context: Context, options: Options): Preferences; + /** + * Deletes a {@link Preferences} instance matching a specified preferences file name + * from the cache which is performed by removePreferencesFromCache and deletes the + * preferences file. + *

When deleting the {@link Preferences} instance, you must release all references + * of the instance. In addition, do not use the instance to perform data operations. Otherwise, data inconsistency + * will occur. + * + * @param { Context } context - Indicates the context of application or capability. + * @param { string } name - Indicates the preferences file name. + * @param { AsyncCallback } callback - Indicates the callback function. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; + * 3. Parameter verification failed. + * @throws { BusinessError } 15500010 - Failed to delete preferences file. + * @syscap SystemCapability.DistributedDataManager.Preferences.Core + * @since 9 + */ + /** + * Deletes a {@link Preferences} instance matching a specified preferences file name + * from the cache which is performed by removePreferencesFromCache and deletes the + * preferences file. + *

When deleting the {@link Preferences} instance, you must release all references + * of the instance. In addition, do not use the instance to perform data operations. Otherwise, data inconsistency + * will occur. + * + * @param { Context } context - Indicates the context of application or capability. + * @param { string } name - Indicates the preferences file name. + * @param { AsyncCallback } callback - Indicates the callback function. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; + * 3. Parameter verification failed. + * @throws { BusinessError } 15500010 - Failed to delete preferences file. + * @syscap SystemCapability.DistributedDataManager.Preferences.Core + * @crossplatform + * @since 10 + */ + /** + * Deletes a {@link Preferences} instance matching a specified preferences file name + * from the cache which is performed by removePreferencesFromCache and deletes the + * preferences file. + *

When deleting the {@link Preferences} instance, you must release all references + * of the instance. In addition, do not use the instance to perform data operations. Otherwise, data inconsistency + * will occur. + * + * @param { Context } context - Indicates the context of application or capability. + * @param { string } name - Indicates the preferences file name. + * @param { AsyncCallback } callback - Indicates the callback function. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; + * 3. Parameter verification failed. + * @throws { BusinessError } 15500000 - Inner error. + * @throws { BusinessError } 15500010 - Failed to delete preferences file. + * @syscap SystemCapability.DistributedDataManager.Preferences.Core + * @crossplatform + * @atomicservice + * @since 11 + */ + function deletePreferences(context: Context, name: string, callback: AsyncCallback): void; + /** + * Deletes a {@link Preferences} instance matching a specified preferences file name + * from the cache which is performed by removePreferencesFromCache and deletes the + * preferences file. + *

When deleting the {@link Preferences} instance, you must release all references + * of the instance. In addition, do not use the instance to perform data operations. Otherwise, data inconsistency + * will occur. + * + * @param { Context } context - Indicates the context of application or capability. + * @param { Options } options - Indicates the {@link Options} option of preferences file position. + * @param { AsyncCallback } callback - Indicates the callback function. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; + * 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 15500010 - Failed to delete preferences file. + * @throws { BusinessError } 15501001 - Only supported in stage mode. + * @throws { BusinessError } 15501002 - The data group id is not valid. + * @syscap SystemCapability.DistributedDataManager.Preferences.Core + * @crossplatform + * @since 10 + */ + /** + * Deletes a {@link Preferences} instance matching a specified preferences file name + * from the cache which is performed by removePreferencesFromCache and deletes the + * preferences file. + *

When deleting the {@link Preferences} instance, you must release all references + * of the instance. In addition, do not use the instance to perform data operations. Otherwise, data inconsistency + * will occur. + * + * @param { Context } context - Indicates the context of application or capability. + * @param { Options } options - Indicates the {@link Options} option of preferences file position. + * @param { AsyncCallback } callback - Indicates the callback function. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; + * 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 15500000 - Inner error. + * @throws { BusinessError } 15500010 - Failed to delete preferences file. + * @throws { BusinessError } 15501001 - Only supported in stage mode. + * @throws { BusinessError } 15501002 - The data group id is not valid. + * @syscap SystemCapability.DistributedDataManager.Preferences.Core + * @crossplatform + * @atomicservice + * @since 11 + */ + function deletePreferences(context: Context, options: Options, callback: AsyncCallback): void; + /** + * Deletes a {@link Preferences} instance matching a specified preferences file name + * from the cache which is performed by removePreferencesFromCache and deletes the + * preferences file. + *

When deleting the {@link Preferences} instance, you must release all references + * of the instance. In addition, do not use the instance to perform data operations. Otherwise, data inconsistency + * will occur. + * + * @param { Context } context - Indicates the context of application or capability. + * @param { string } name - Indicates the preferences file name. + * @returns { Promise } A promise object. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; + * 3. Parameter verification failed. + * @throws { BusinessError } 15500010 - Failed to delete preferences file. + * @syscap SystemCapability.DistributedDataManager.Preferences.Core + * @since 9 + */ + /** + * Deletes a {@link Preferences} instance matching a specified preferences file name + * from the cache which is performed by removePreferencesFromCache and deletes the + * preferences file. + *

When deleting the {@link Preferences} instance, you must release all references + * of the instance. In addition, do not use the instance to perform data operations. Otherwise, data inconsistency + * will occur. + * + * @param { Context } context - Indicates the context of application or capability. + * @param { string } name - Indicates the preferences file name. + * @returns { Promise } A promise object. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; + * 3. Parameter verification failed. + * @throws { BusinessError } 15500010 - Failed to delete preferences file. + * @syscap SystemCapability.DistributedDataManager.Preferences.Core + * @crossplatform + * @since 10 + */ + /** + * Deletes a {@link Preferences} instance matching a specified preferences file name + * from the cache which is performed by removePreferencesFromCache and deletes the + * preferences file. + *

When deleting the {@link Preferences} instance, you must release all references + * of the instance. In addition, do not use the instance to perform data operations. Otherwise, data inconsistency + * will occur. + * + * @param { Context } context - Indicates the context of application or capability. + * @param { string } name - Indicates the preferences file name. + * @returns { Promise } A promise object. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; + * 3. Parameter verification failed. + * @throws { BusinessError } 15500000 - Inner error. + * @throws { BusinessError } 15500010 - Failed to delete preferences file. + * @syscap SystemCapability.DistributedDataManager.Preferences.Core + * @crossplatform + * @atomicservice + * @since 11 + */ + function deletePreferences(context: Context, name: string): Promise; + /** + * Deletes a {@link Preferences} instance matching a specified preferences file name + * from the cache which is performed by removePreferencesFromCache and deletes the + * preferences file. + *

When deleting the {@link Preferences} instance, you must release all references + * of the instance. In addition, do not use the instance to perform data operations. Otherwise, data inconsistency + * will occur. + * + * @param { Context } context - Indicates the context of application or capability. + * @param { Options } options - Indicates the {@link Options} option of preferences file position. + * @returns { Promise } A promise object. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; + * 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 15500010 - Failed to delete preferences file. + * @throws { BusinessError } 15501001 - Only supported in stage mode. + * @throws { BusinessError } 15501002 - The data group id is not valid. + * @syscap SystemCapability.DistributedDataManager.Preferences.Core + * @crossplatform + * @since 10 + */ + /** + * Deletes a {@link Preferences} instance matching a specified preferences file name + * from the cache which is performed by removePreferencesFromCache and deletes the + * preferences file. + *

When deleting the {@link Preferences} instance, you must release all references + * of the instance. In addition, do not use the instance to perform data operations. Otherwise, data inconsistency + * will occur. + * + * @param { Context } context - Indicates the context of application or capability. + * @param { Options } options - Indicates the {@link Options} option of preferences file position. + * @returns { Promise } A promise object. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; + * 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 15500000 - Inner error. + * @throws { BusinessError } 15500010 - Failed to delete preferences file. + * @throws { BusinessError } 15501001 - Only supported in stage mode. + * @throws { BusinessError } 15501002 - The data group id is not valid. + * @syscap SystemCapability.DistributedDataManager.Preferences.Core + * @crossplatform + * @atomicservice + * @since 11 + */ + function deletePreferences(context: Context, options: Options): Promise; + /** + * Deletes a {@link Preferences} instance matching a specified preferences file name + * from the cache. + *

When deleting the {@link Preferences} instance, you must release all references + * of the instance. In addition, do not use the instance to perform data operations. Otherwise, data inconsistency + * will occur. + * + * @param { Context } context - Indicates the context of application or capability. + * @param { string } name - Indicates the preferences file name. + * @param { AsyncCallback } callback - Indicates the callback function. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; + * 3. Parameter verification failed. + * @syscap SystemCapability.DistributedDataManager.Preferences.Core + * @since 9 + */ + /** + * Deletes a {@link Preferences} instance matching a specified preferences file name + * from the cache. + *

When deleting the {@link Preferences} instance, you must release all references + * of the instance. In addition, do not use the instance to perform data operations. Otherwise, data inconsistency + * will occur. + * + * @param { Context } context - Indicates the context of application or capability. + * @param { string } name - Indicates the preferences file name. + * @param { AsyncCallback } callback - Indicates the callback function. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; + * 3. Parameter verification failed. + * @syscap SystemCapability.DistributedDataManager.Preferences.Core + * @crossplatform + * @since 10 + */ + /** + * Deletes a {@link Preferences} instance matching a specified preferences file name + * from the cache. + *

When deleting the {@link Preferences} instance, you must release all references + * of the instance. In addition, do not use the instance to perform data operations. Otherwise, data inconsistency + * will occur. + * + * @param { Context } context - Indicates the context of application or capability. + * @param { string } name - Indicates the preferences file name. + * @param { AsyncCallback } callback - Indicates the callback function. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; + * 3. Parameter verification failed. + * @throws { BusinessError } 15500000 - Inner error. + * @syscap SystemCapability.DistributedDataManager.Preferences.Core + * @crossplatform + * @atomicservice + * @since 11 + */ + function removePreferencesFromCache(context: Context, name: string, callback: AsyncCallback): void; + /** + * Deletes a {@link Preferences} instance matching a specified preferences file name + * from the cache. + *

When deleting the {@link Preferences} instance, you must release all references + * of the instance. In addition, do not use the instance to perform data operations. Otherwise, data inconsistency + * will occur. + * + * @param { Context } context - Indicates the context of application or capability. + * @param { Options } options - Indicates the {@link Options} option of preferences file position. + * @param { AsyncCallback } callback - Indicates the callback function. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; + * 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 15501001 - Only supported in stage mode. + * @throws { BusinessError } 15501002 - The data group id is not valid. + * @syscap SystemCapability.DistributedDataManager.Preferences.Core + * @crossplatform + * @since 10 + */ + /** + * Deletes a {@link Preferences} instance matching a specified preferences file name + * from the cache. + *

When deleting the {@link Preferences} instance, you must release all references + * of the instance. In addition, do not use the instance to perform data operations. Otherwise, data inconsistency + * will occur. + * + * @param { Context } context - Indicates the context of application or capability. + * @param { Options } options - Indicates the {@link Options} option of preferences file position. + * @param { AsyncCallback } callback - Indicates the callback function. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; + * 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 15500000 - Inner error. + * @throws { BusinessError } 15501001 - Only supported in stage mode. + * @throws { BusinessError } 15501002 - The data group id is not valid. + * @syscap SystemCapability.DistributedDataManager.Preferences.Core + * @crossplatform + * @atomicservice + * @since 11 + */ + function removePreferencesFromCache(context: Context, options: Options, callback: AsyncCallback): void; + /** + * Deletes a {@link Preferences} instance matching a specified preferences file name + * from the cache. + *

When deleting the {@link Preferences} instance, you must release all references + * of the instance. In addition, do not use the instance to perform data operations. Otherwise, data inconsistency + * will occur. + * + * @param { Context } context - Indicates the context of application or capability. + * @param { string } name - Indicates the preferences file name. + * @returns { Promise } A promise object. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; + * 3. Parameter verification failed. + * @syscap SystemCapability.DistributedDataManager.Preferences.Core + * @since 9 + */ + /** + * Deletes a {@link Preferences} instance matching a specified preferences file name + * from the cache. + *

When deleting the {@link Preferences} instance, you must release all references + * of the instance. In addition, do not use the instance to perform data operations. Otherwise, data inconsistency + * will occur. + * + * @param { Context } context - Indicates the context of application or capability. + * @param { string } name - Indicates the preferences file name. + * @returns { Promise } A promise object. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; + * 3. Parameter verification failed. + * @syscap SystemCapability.DistributedDataManager.Preferences.Core + * @crossplatform + * @since 10 + */ + /** + * Deletes a {@link Preferences} instance matching a specified preferences file name + * from the cache. + *

When deleting the {@link Preferences} instance, you must release all references + * of the instance. In addition, do not use the instance to perform data operations. Otherwise, data inconsistency + * will occur. + * + * @param { Context } context - Indicates the context of application or capability. + * @param { string } name - Indicates the preferences file name. + * @returns { Promise } A promise object. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; + * 3. Parameter verification failed. + * @throws { BusinessError } 15500000 - Inner error. + * @syscap SystemCapability.DistributedDataManager.Preferences.Core + * @crossplatform + * @atomicservice + * @since 11 + */ + function removePreferencesFromCache(context: Context, name: string): Promise; + /** + * Deletes a {@link Preferences} instance matching a specified preferences file name + * from the cache. + *

When deleting the {@link Preferences} instance, you must release all references + * of the instance. In addition, do not use the instance to perform data operations. Otherwise, data inconsistency + * will occur. + * + * @param { Context } context - Indicates the context of application or capability. + * @param { Options } options - Indicates the {@link Options} option of preferences file position. + * @returns { Promise } A promise object. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; + * 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 15501001 - Only supported in stage mode. + * @throws { BusinessError } 15501002 - The data group id is not valid. + * @syscap SystemCapability.DistributedDataManager.Preferences.Core + * @crossplatform + * @since 10 + */ + /** + * Deletes a {@link Preferences} instance matching a specified preferences file name + * from the cache. + *

When deleting the {@link Preferences} instance, you must release all references + * of the instance. In addition, do not use the instance to perform data operations. Otherwise, data inconsistency + * will occur. + * + * @param { Context } context - Indicates the context of application or capability. + * @param { Options } options - Indicates the {@link Options} option of preferences file position. + * @returns { Promise } A promise object. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; + * 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 15500000 - Inner error. + * @throws { BusinessError } 15501001 - Only supported in stage mode. + * @throws { BusinessError } 15501002 - The data group id is not valid. + * @syscap SystemCapability.DistributedDataManager.Preferences.Core + * @crossplatform + * @atomicservice + * @since 11 + */ + function removePreferencesFromCache(context: Context, options: Options): Promise; + /** + * Deletes a {@link Preferences} instance matching a specified preferences file name + * from the cache. This interface is executed synchronously. + *

When deleting the {@link Preferences} instance, you must release all references + * of the instance. In addition, do not use the instance to perform data operations. Otherwise, data inconsistency + * will occur. + * + * @param { Context } context - Indicates the context of application or capability. + * @param { string } name - Indicates the preferences file name. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; + * 3. Parameter verification failed. + * @syscap SystemCapability.DistributedDataManager.Preferences.Core + * @crossplatform + * @since 10 + */ + /** + * Deletes a {@link Preferences} instance matching a specified preferences file name + * from the cache. This interface is executed synchronously. + *

When deleting the {@link Preferences} instance, you must release all references + * of the instance. In addition, do not use the instance to perform data operations. Otherwise, data inconsistency + * will occur. + * + * @param { Context } context - Indicates the context of application or capability. + * @param { string } name - Indicates the preferences file name. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; + * 3. Parameter verification failed. + * @throws { BusinessError } 15500000 - Inner error. + * @syscap SystemCapability.DistributedDataManager.Preferences.Core + * @crossplatform + * @atomicservice + * @since 11 + */ + function removePreferencesFromCacheSync(context: Context, name: string): void; + /** + * Deletes a {@link Preferences} instance matching a specified preferences file name + * from the cache. This interface is executed synchronously. + *

When deleting the {@link Preferences} instance, you must release all references + * of the instance. In addition, do not use the instance to perform data operations. Otherwise, data inconsistency + * will occur. + * + * @param { Context } context - Indicates the context of application or capability. + * @param { Options } options - Indicates the {@link Options} option of preferences file position. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; + * 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 15501001 - Only supported in stage mode. + * @throws { BusinessError } 15501002 - The data group id is not valid. + * @syscap SystemCapability.DistributedDataManager.Preferences.Core + * @crossplatform + * @since 10 + */ + /** + * Deletes a {@link Preferences} instance matching a specified preferences file name + * from the cache. This interface is executed synchronously. + *

When deleting the {@link Preferences} instance, you must release all references + * of the instance. In addition, do not use the instance to perform data operations. Otherwise, data inconsistency + * will occur. + * + * @param { Context } context - Indicates the context of application or capability. + * @param { Options } options - Indicates the {@link Options} option of preferences file position. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; + * 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 15500000 - Inner error. + * @throws { BusinessError } 15501001 - Only supported in stage mode. + * @throws { BusinessError } 15501002 - The data group id is not valid. + * @syscap SystemCapability.DistributedDataManager.Preferences.Core + * @crossplatform + * @atomicservice + * @since 11 + */ + function removePreferencesFromCacheSync(context: Context, options: Options): void; + /** + * Provides interfaces to obtain and modify preferences data. + *

The preferences data is stored in a file, which matches only one {@link Preferences} instance in the memory. + * You can use getPreferences to obtain the {@link Preferences} instance matching + * the file that stores preferences data, and use movePreferencesFromCache + * to remove the {@link Preferences} instance from the memory. + * + * @interface Preferences + * @syscap SystemCapability.DistributedDataManager.Preferences.Core + * @since 9 + */ + /** + * Provides interfaces to obtain and modify preferences data. + *

The preferences data is stored in a file, which matches only one {@link Preferences} instance in the memory. + * You can use getPreferences to obtain the {@link Preferences} instance matching + * the file that stores preferences data, and use movePreferencesFromCache + * to remove the {@link Preferences} instance from the memory. + * + * @interface Preferences + * @syscap SystemCapability.DistributedDataManager.Preferences.Core + * @crossplatform + * @since 10 + */ + /** + * Provides interfaces to obtain and modify preferences data. + *

The preferences data is stored in a file, which matches only one {@link Preferences} instance in the memory. + * You can use getPreferences to obtain the {@link Preferences} instance matching + * the file that stores preferences data, and use movePreferencesFromCache + * to remove the {@link Preferences} instance from the memory. + * + * @interface Preferences + * @syscap SystemCapability.DistributedDataManager.Preferences.Core + * @crossplatform + * @atomicservice + * @since 11 + */ + interface Preferences { + /** + * Obtains the value of a preferences in the ValueType format. + *

If the value is {@code null} or not in the ValueType format, the default value is returned. + * + * @param { string } key - Indicates the key of the preferences. It cannot be {@code null} or empty. + * MAX_KEY_LENGTH. + * @param { ValueType } defValue - Indicates the default value to return. + * @param { AsyncCallback } callback - The value matching the specified key if it is found; + * returns the default value otherwise. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; + * 3. Parameter verification failed. + * @syscap SystemCapability.DistributedDataManager.Preferences.Core + * @since 9 + */ + /** + * Obtains the value of a preferences in the ValueType format. + *

If the value is {@code null} or not in the ValueType format, the default value is returned. + * + * @param { string } key - Indicates the key of the preferences. It cannot be {@code null} or empty. + * MAX_KEY_LENGTH. + * @param { ValueType } defValue - Indicates the default value to return. + * @param { AsyncCallback } callback - The value matching the specified key if it is found; + * returns the default value otherwise. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; + * 3. Parameter verification failed. + * @syscap SystemCapability.DistributedDataManager.Preferences.Core + * @crossplatform + * @since 10 + */ + /** + * Obtains the value of a preferences in the ValueType format. + *

If the value is {@code null} or not in the ValueType format, the default value is returned. + * + * @param { string } key - Indicates the key of the preferences. It cannot be {@code null} or empty. + * MAX_KEY_LENGTH. + * @param { ValueType } defValue - Indicates the default value to return. + * @param { AsyncCallback } callback - The value matching the specified key if it is found; + * returns the default value otherwise. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; + * 3. Parameter verification failed. + * @throws { BusinessError } 15500000 - Inner error. + * @syscap SystemCapability.DistributedDataManager.Preferences.Core + * @crossplatform + * @atomicservice + * @since 11 + */ + get(key: string, defValue: ValueType, callback: AsyncCallback): void; + /** + * Obtains the value of a preferences in the ValueType format. + *

If the value is {@code null} or not in the ValueType format, the default value is returned. + * + * @param { string } key - Indicates the key of the preferences. It cannot be {@code null} or empty. + * MAX_KEY_LENGTH. + * @param { ValueType } defValue - Indicates the default value to return. + * @returns { Promise } The value matching the specified key if it is found; + * returns the default value otherwise. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; + * 3. Parameter verification failed. + * @syscap SystemCapability.DistributedDataManager.Preferences.Core + * @since 9 + */ + /** + * Obtains the value of a preferences in the ValueType format. + *

If the value is {@code null} or not in the ValueType format, the default value is returned. + * + * @param { string } key - Indicates the key of the preferences. It cannot be {@code null} or empty. + * MAX_KEY_LENGTH. + * @param { ValueType } defValue - Indicates the default value to return. + * @returns { Promise } The value matching the specified key if it is found; + * returns the default value otherwise. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; + * 3. Parameter verification failed. + * @syscap SystemCapability.DistributedDataManager.Preferences.Core + * @crossplatform + * @since 10 + */ + /** + * Obtains the value of a preferences in the ValueType format. + *

If the value is {@code null} or not in the ValueType format, the default value is returned. + * + * @param { string } key - Indicates the key of the preferences. It cannot be {@code null} or empty. + * MAX_KEY_LENGTH. + * @param { ValueType } defValue - Indicates the default value to return. + * @returns { Promise } The value matching the specified key if it is found; + * returns the default value otherwise. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; + * 3. Parameter verification failed. + * @throws { BusinessError } 15500000 - Inner error. + * @syscap SystemCapability.DistributedDataManager.Preferences.Core + * @crossplatform + * @atomicservice + * @since 11 + */ + get(key: string, defValue: ValueType): Promise; + /** + * Obtains the value of a preferences in the ValueType format. This interface is executed synchronously. + *

If the value is {@code null} or not in the ValueType format, the default value is returned. + * + * @param { string } key - Indicates the key of the preferences. It cannot be {@code null} or empty. + * MAX_KEY_LENGTH. + * @param { ValueType } defValue - Indicates the default value to return. + * @returns { ValueType } The value matching the specified key if it is found; + * returns the default value otherwise. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; + * 3. Parameter verification failed. + * @syscap SystemCapability.DistributedDataManager.Preferences.Core + * @crossplatform + * @since 10 + */ + /** + * Obtains the value of a preferences in the ValueType format. This interface is executed synchronously. + *

If the value is {@code null} or not in the ValueType format, the default value is returned. + * + * @param { string } key - Indicates the key of the preferences. It cannot be {@code null} or empty. + * MAX_KEY_LENGTH. + * @param { ValueType } defValue - Indicates the default value to return. + * @returns { ValueType } The value matching the specified key if it is found; + * returns the default value otherwise. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; + * 3. Parameter verification failed. + * @throws { BusinessError } 15500000 - Inner error. + * @syscap SystemCapability.DistributedDataManager.Preferences.Core + * @crossplatform + * @atomicservice + * @since 11 + */ + getSync(key: string, defValue: ValueType): ValueType; + /** + * Obtains all the keys and values of a preferences in an object. + * + * @param { AsyncCallback } callback - The values and keys in an object. + * @throws { BusinessError } 401 - Parameter error. Mandatory parameters are left unspecified. + * @syscap SystemCapability.DistributedDataManager.Preferences.Core + * @since 9 + */ + /** + * Obtains all the keys and values of a preferences in an object. + * + * @param { AsyncCallback } callback - The values and keys in an object. + * @throws { BusinessError } 401 - Parameter error. Mandatory parameters are left unspecified. + * @syscap SystemCapability.DistributedDataManager.Preferences.Core + * @crossplatform + * @since 10 + */ + /** + * Obtains all the keys and values of a preferences in an object. + * + * @param { AsyncCallback } callback - The values and keys in an object. + * @throws { BusinessError } 401 - Parameter error. Mandatory parameters are left unspecified. + * @throws { BusinessError } 15500000 - Inner error. + * @syscap SystemCapability.DistributedDataManager.Preferences.Core + * @crossplatform + * @atomicservice + * @since 11 + */ + getAll(callback: AsyncCallback): void; + /** + * Obtains all the keys and values of a preferences in an object. + * + * @returns { Promise } The values and keys in an object. + * @syscap SystemCapability.DistributedDataManager.Preferences.Core + * @since 9 + */ + /** + * Obtains all the keys and values of a preferences in an object. + * + * @returns { Promise } The values and keys in an object. + * @syscap SystemCapability.DistributedDataManager.Preferences.Core + * @crossplatform + * @since 10 + */ + /** + * Obtains all the keys and values of a preferences in an object. + * + * @returns { Promise } The values and keys in an object. + * @throws { BusinessError } 15500000 - Inner error. + * @syscap SystemCapability.DistributedDataManager.Preferences.Core + * @crossplatform + * @atomicservice + * @since 11 + */ + getAll(): Promise; + /** + * Obtains all the keys and values of a preferences in an object. This interface + * is executed synchronously. + * + * @returns { Object } The values and keys in an object. + * @syscap SystemCapability.DistributedDataManager.Preferences.Core + * @crossplatform + * @since 10 + */ + /** + * Obtains all the keys and values of a preferences in an object. This interface + * is executed synchronously. + * + * @returns { Object } The values and keys in an object. + * @throws { BusinessError } 15500000 - Inner error. + * @syscap SystemCapability.DistributedDataManager.Preferences.Core + * @crossplatform + * @atomicservice + * @since 11 + */ + getAllSync(): Object; + /** + * Checks whether the {@link Preferences} object contains a preferences matching a specified key. + * + * @param { string } key - Indicates the key of the preferences to modify. It cannot be {@code null} or empty. + * MAX_KEY_LENGTH. + * @param { AsyncCallback } callback - {@code true} if the {@link Preferences} object contains a preferences + * with the specified key;returns {@code false} otherwise. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; + * 3. Parameter verification failed. + * @syscap SystemCapability.DistributedDataManager.Preferences.Core + * @since 9 + */ + /** + * Checks whether the {@link Preferences} object contains a preferences matching a specified key. + * + * @param { string } key - Indicates the key of the preferences to modify. It cannot be {@code null} or empty. + * MAX_KEY_LENGTH. + * @param { AsyncCallback } callback - {@code true} if the {@link Preferences} object contains a preferences + * with the specified key;returns {@code false} otherwise. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; + * 3. Parameter verification failed. + * @syscap SystemCapability.DistributedDataManager.Preferences.Core + * @crossplatform + * @since 10 + */ + /** + * Checks whether the {@link Preferences} object contains a preferences matching a specified key. + * + * @param { string } key - Indicates the key of the preferences to modify. It cannot be {@code null} or empty. + * MAX_KEY_LENGTH. + * @param { AsyncCallback } callback - {@code true} if the {@link Preferences} object contains a preferences + * with the specified key;returns {@code false} otherwise. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; + * 3. Parameter verification failed. + * @throws { BusinessError } 15500000 - Inner error. + * @syscap SystemCapability.DistributedDataManager.Preferences.Core + * @crossplatform + * @atomicservice + * @since 11 + */ + has(key: string, callback: AsyncCallback): void; + /** + * Checks whether the {@link Preferences} object contains a preferences matching a specified key. + * + * @param { string } key - Indicates the key of the preferences to modify. It cannot be {@code null} or empty. + * MAX_KEY_LENGTH. + * @returns { Promise } {@code true} if the {@link Preferences} object contains + * a preferences with the specified key; returns {@code false} otherwise. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; + * 3. Parameter verification failed. + * @syscap SystemCapability.DistributedDataManager.Preferences.Core + * @since 9 + */ + /** + * Checks whether the {@link Preferences} object contains a preferences matching a specified key. + * + * @param { string } key - Indicates the key of the preferences to modify. It cannot be {@code null} or empty. + * MAX_KEY_LENGTH. + * @returns { Promise } {@code true} if the {@link Preferences} object contains + * a preferences with the specified key; returns {@code false} otherwise. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; + * 3. Parameter verification failed. + * @syscap SystemCapability.DistributedDataManager.Preferences.Core + * @crossplatform + * @since 10 + */ + /** + * Checks whether the {@link Preferences} object contains a preferences matching a specified key. + * + * @param { string } key - Indicates the key of the preferences to modify. It cannot be {@code null} or empty. + * MAX_KEY_LENGTH. + * @returns { Promise } {@code true} if the {@link Preferences} object contains + * a preferences with the specified key; returns {@code false} otherwise. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; + * 3. Parameter verification failed. + * @throws { BusinessError } 15500000 - Inner error. + * @syscap SystemCapability.DistributedDataManager.Preferences.Core + * @crossplatform + * @atomicservice + * @since 11 + */ + has(key: string): Promise; + /** + * Checks whether the {@link Preferences} object contains a preferences matching a specified key. This interface + * is executed synchronously. + * + * @param { string } key - Indicates the key of the preferences to modify. It cannot be {@code null} or empty. + * MAX_KEY_LENGTH. + * @returns { boolean } {@code true} if the {@link Preferences} object contains + * a preferences with the specified key; returns {@code false} otherwise. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; + * 3. Parameter verification failed. + * @syscap SystemCapability.DistributedDataManager.Preferences.Core + * @crossplatform + * @since 10 + */ + /** + * Checks whether the {@link Preferences} object contains a preferences matching a specified key. This interface + * is executed synchronously. + * + * @param { string } key - Indicates the key of the preferences to modify. It cannot be {@code null} or empty. + * MAX_KEY_LENGTH. + * @returns { boolean } {@code true} if the {@link Preferences} object contains + * a preferences with the specified key; returns {@code false} otherwise. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; + * 3. Parameter verification failed. + * @throws { BusinessError } 15500000 - Inner error. + * @syscap SystemCapability.DistributedDataManager.Preferences.Core + * @crossplatform + * @atomicservice + * @since 11 + */ + hasSync(key: string): boolean; + /** + * Sets an int value for the key in the {@link Preferences} object. + *

You can call the {@link #flush} method to save the {@link Preferences} object to the + * file. + * + * @param { string } key - Indicates the key of the preferences to modify. It cannot be {@code null} or empty. + * MAX_KEY_LENGTH. + * @param { ValueType } value - Indicates the value of the preferences. + * MAX_VALUE_LENGTH. + * @param { AsyncCallback } callback - Indicates the callback function. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; + * 3. Parameter verification failed. + * @syscap SystemCapability.DistributedDataManager.Preferences.Core + * @since 9 + */ + /** + * Sets an int value for the key in the {@link Preferences} object. + *

You can call the {@link #flush} method to save the {@link Preferences} object to the + * file. + * + * @param { string } key - Indicates the key of the preferences to modify. It cannot be {@code null} or empty. + * MAX_KEY_LENGTH. + * @param { ValueType } value - Indicates the value of the preferences. + * MAX_VALUE_LENGTH. + * @param { AsyncCallback } callback - Indicates the callback function. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; + * 3. Parameter verification failed. + * @syscap SystemCapability.DistributedDataManager.Preferences.Core + * @crossplatform + * @since 10 + */ + /** + * Sets an int value for the key in the {@link Preferences} object. + *

You can call the {@link #flush} method to save the {@link Preferences} object to the + * file. + * + * @param { string } key - Indicates the key of the preferences to modify. It cannot be {@code null} or empty. + * MAX_KEY_LENGTH. + * @param { ValueType } value - Indicates the value of the preferences. + * MAX_VALUE_LENGTH. + * @param { AsyncCallback } callback - Indicates the callback function. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; + * 3. Parameter verification failed. + * @throws { BusinessError } 15500000 - Inner error. + * @syscap SystemCapability.DistributedDataManager.Preferences.Core + * @crossplatform + * @atomicservice + * @since 11 + */ + put(key: string, value: ValueType, callback: AsyncCallback): void; + /** + * Sets an int value for the key in the {@link Preferences} object. + *

You can call the {@link #flush} method to save the {@link Preferences} object to the + * file. + * + * @param { string } key - Indicates the key of the preferences to modify. It cannot be {@code null} or empty. + * MAX_KEY_LENGTH. + * @param { ValueType } value - Indicates the value of the preferences. + * MAX_VALUE_LENGTH. + * @returns { Promise } A promise object. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; + * 3. Parameter verification failed. + * @syscap SystemCapability.DistributedDataManager.Preferences.Core + * @since 9 + */ + /** + * Sets an int value for the key in the {@link Preferences} object. + *

You can call the {@link #flush} method to save the {@link Preferences} object to the + * file. + * + * @param { string } key - Indicates the key of the preferences to modify. It cannot be {@code null} or empty. + * MAX_KEY_LENGTH. + * @param { ValueType } value - Indicates the value of the preferences. + * MAX_VALUE_LENGTH. + * @returns { Promise } A promise object. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; + * 3. Parameter verification failed. + * @syscap SystemCapability.DistributedDataManager.Preferences.Core + * @crossplatform + * @since 10 + */ + /** + * Sets an int value for the key in the {@link Preferences} object. + *

You can call the {@link #flush} method to save the {@link Preferences} object to the + * file. + * + * @param { string } key - Indicates the key of the preferences to modify. It cannot be {@code null} or empty. + * MAX_KEY_LENGTH. + * @param { ValueType } value - Indicates the value of the preferences. + * MAX_VALUE_LENGTH. + * @returns { Promise } A promise object. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; + * 3. Parameter verification failed. + * @throws { BusinessError } 15500000 - Inner error. + * @syscap SystemCapability.DistributedDataManager.Preferences.Core + * @crossplatform + * @atomicservice + * @since 11 + */ + put(key: string, value: ValueType): Promise; + /** + * Sets an int value for the key in the {@link Preferences} object. This interface is executed synchronously. + *

You can call the {@link #flush} method to save the {@link Preferences} object to the + * file. + * + * @param { string } key - Indicates the key of the preferences to modify. It cannot be {@code null} or empty. + * MAX_KEY_LENGTH. + * @param { ValueType } value - Indicates the value of the preferences. + * MAX_VALUE_LENGTH. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; + * 3. Parameter verification failed. + * @syscap SystemCapability.DistributedDataManager.Preferences.Core + * @crossplatform + * @since 10 + */ + /** + * Sets an int value for the key in the {@link Preferences} object. This interface is executed synchronously. + *

You can call the {@link #flush} method to save the {@link Preferences} object to the + * file. + * + * @param { string } key - Indicates the key of the preferences to modify. It cannot be {@code null} or empty. + * MAX_KEY_LENGTH. + * @param { ValueType } value - Indicates the value of the preferences. + * MAX_VALUE_LENGTH. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; + * 3. Parameter verification failed. + * @throws { BusinessError } 15500000 - Inner error. + * @syscap SystemCapability.DistributedDataManager.Preferences.Core + * @crossplatform + * @atomicservice + * @since 11 + */ + putSync(key: string, value: ValueType): void; + /** + * Deletes the preferences with a specified key from the {@link Preferences} object. + *

You can call the {@link #flush} method to save the {@link Preferences} object to the + * file. + * + * @param { string } key - Indicates the key of the preferences to delete. It cannot be {@code null} or empty. + * MAX_KEY_LENGTH. + * @param { AsyncCallback } callback - Indicates the callback function. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; + * 3. Parameter verification failed. + * @syscap SystemCapability.DistributedDataManager.Preferences.Core + * @since 9 + */ + /** + * Deletes the preferences with a specified key from the {@link Preferences} object. + *

You can call the {@link #flush} method to save the {@link Preferences} object to the + * file. + * + * @param { string } key - Indicates the key of the preferences to delete. It cannot be {@code null} or empty. + * MAX_KEY_LENGTH. + * @param { AsyncCallback } callback - Indicates the callback function. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; + * 3. Parameter verification failed. + * @syscap SystemCapability.DistributedDataManager.Preferences.Core + * @crossplatform + * @since 10 + */ + /** + * Deletes the preferences with a specified key from the {@link Preferences} object. + *

You can call the {@link #flush} method to save the {@link Preferences} object to the + * file. + * + * @param { string } key - Indicates the key of the preferences to delete. It cannot be {@code null} or empty. + * MAX_KEY_LENGTH. + * @param { AsyncCallback } callback - Indicates the callback function. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; + * 3. Parameter verification failed. + * @throws { BusinessError } 15500000 - Inner error. + * @syscap SystemCapability.DistributedDataManager.Preferences.Core + * @crossplatform + * @atomicservice + * @since 11 + */ + delete(key: string, callback: AsyncCallback): void; + /** + * Deletes the preferences with a specified key from the {@link Preferences} object. + *

You can call the {@link #flush} method to save the {@link Preferences} object to the + * file. + * + * @param { string } key - Indicates the key of the preferences to delete. It cannot be {@code null} or empty. + * MAX_KEY_LENGTH. + * @returns { Promise } A promise object. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; + * 3. Parameter verification failed. + * @syscap SystemCapability.DistributedDataManager.Preferences.Core + * @since 9 + */ + /** + * Deletes the preferences with a specified key from the {@link Preferences} object. + *

You can call the {@link #flush} method to save the {@link Preferences} object to the + * file. + * + * @param { string } key - Indicates the key of the preferences to delete. It cannot be {@code null} or empty. + * MAX_KEY_LENGTH. + * @returns { Promise } A promise object. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; + * 3. Parameter verification failed. + * @syscap SystemCapability.DistributedDataManager.Preferences.Core + * @crossplatform + * @since 10 + */ + /** + * Deletes the preferences with a specified key from the {@link Preferences} object. + *

You can call the {@link #flush} method to save the {@link Preferences} object to the + * file. + * + * @param { string } key - Indicates the key of the preferences to delete. It cannot be {@code null} or empty. + * MAX_KEY_LENGTH. + * @returns { Promise } A promise object. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; + * 3. Parameter verification failed. + * @throws { BusinessError } 15500000 - Inner error. + * @syscap SystemCapability.DistributedDataManager.Preferences.Core + * @crossplatform + * @atomicservice + * @since 11 + */ + delete(key: string): Promise; + /** + * Deletes the preferences with a specified key from the {@link Preferences} object. This interface is + * executed synchronously.

You can call the {@link #flush} method to save the {@link Preferences} + * object to the file. + * + * @param { string } key - Indicates the key of the preferences to delete. It cannot be {@code null} or empty. + * MAX_KEY_LENGTH. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; + * 3. Parameter verification failed. + * @syscap SystemCapability.DistributedDataManager.Preferences.Core + * @crossplatform + * @since 10 + */ + /** + * Deletes the preferences with a specified key from the {@link Preferences} object. This interface is + * executed synchronously.

You can call the {@link #flush} method to save the {@link Preferences} + * object to the file. + * + * @param { string } key - Indicates the key of the preferences to delete. It cannot be {@code null} or empty. + * MAX_KEY_LENGTH. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; + * 3. Parameter verification failed. + * @throws { BusinessError } 15500000 - Inner error. + * @syscap SystemCapability.DistributedDataManager.Preferences.Core + * @crossplatform + * @atomicservice + * @since 11 + */ + deleteSync(key: string): void; + /** + * Clears all preferences from the {@link Preferences} object. + *

You can call the {@link #flush} method to save the {@link Preferences} object to the file. + * + * @param { AsyncCallback } callback - Indicates the callback function. + * @throws { BusinessError } 401 - Parameter error. Mandatory parameters are left unspecified. + * @syscap SystemCapability.DistributedDataManager.Preferences.Core + * @since 9 + */ + /** + * Clears all preferences from the {@link Preferences} object. + *

You can call the {@link #flush} method to save the {@link Preferences} object to the file. + * + * @param { AsyncCallback } callback - Indicates the callback function. + * @throws { BusinessError } 401 - Parameter error. Mandatory parameters are left unspecified. + * @syscap SystemCapability.DistributedDataManager.Preferences.Core + * @crossplatform + * @since 10 + */ + /** + * Clears all preferences from the {@link Preferences} object. + *

You can call the {@link #flush} method to save the {@link Preferences} object to the file. + * + * @param { AsyncCallback } callback - Indicates the callback function. + * @throws { BusinessError } 401 - Parameter error. Mandatory parameters are left unspecified. + * @throws { BusinessError } 15500000 - Inner error. + * @syscap SystemCapability.DistributedDataManager.Preferences.Core + * @crossplatform + * @atomicservice + * @since 11 + */ + clear(callback: AsyncCallback): void; + /** + * Clears all preferences from the {@link Preferences} object. + *

You can call the {@link #flush} method to save the {@link Preferences} object to the file. + * + * @returns { Promise } A promise object. + * @syscap SystemCapability.DistributedDataManager.Preferences.Core + * @since 9 + */ + /** + * Clears all preferences from the {@link Preferences} object. + *

You can call the {@link #flush} method to save the {@link Preferences} object to the file. + * + * @returns { Promise } A promise object. + * @syscap SystemCapability.DistributedDataManager.Preferences.Core + * @crossplatform + * @since 10 + */ + /** + * Clears all preferences from the {@link Preferences} object. + *

You can call the {@link #flush} method to save the {@link Preferences} object to the file. + * + * @returns { Promise } A promise object. + * @throws { BusinessError } 15500000 - Inner error. + * @syscap SystemCapability.DistributedDataManager.Preferences.Core + * @crossplatform + * @atomicservice + * @since 11 + */ + clear(): Promise; + /** + * Clears all preferences from the {@link Preferences} object. This interface is executed synchronously. + *

You can call the {@link #flush} method to save the {@link Preferences} object to the file. + * + * @syscap SystemCapability.DistributedDataManager.Preferences.Core + * @crossplatform + * @since 10 + */ + /** + * Clears all preferences from the {@link Preferences} object. This interface is executed synchronously. + *

You can call the {@link #flush} method to save the {@link Preferences} object to the file. + * + * @syscap SystemCapability.DistributedDataManager.Preferences.Core + * @crossplatform + * @atomicservice + * @since 11 + */ + clearSync(): void; + /** + * Asynchronously saves the {@link Preferences} object to the file. + * + * @param { AsyncCallback } callback - Indicates the callback function. + * @throws { BusinessError } 401 - Parameter error. Mandatory parameters are left unspecified; + * @syscap SystemCapability.DistributedDataManager.Preferences.Core + * @since 9 + */ + /** + * Asynchronously saves the {@link Preferences} object to the file. + * + * @param { AsyncCallback } callback - Indicates the callback function. + * @throws { BusinessError } 401 - Parameter error. Mandatory parameters are left unspecified; + * @syscap SystemCapability.DistributedDataManager.Preferences.Core + * @crossplatform + * @since 10 + */ + /** + * Asynchronously saves the {@link Preferences} object to the file. + * + * @param { AsyncCallback } callback - Indicates the callback function. + * @throws { BusinessError } 401 - Parameter error. Mandatory parameters are left unspecified; + * @throws { BusinessError } 15500000 - Inner error. + * @syscap SystemCapability.DistributedDataManager.Preferences.Core + * @crossplatform + * @atomicservice + * @since 11 + */ + flush(callback: AsyncCallback): void; + /** + * Asynchronously saves the {@link Preferences} object to the file. + * + * @returns { Promise } A promise object. + * @syscap SystemCapability.DistributedDataManager.Preferences.Core + * @since 9 + */ + /** + * Asynchronously saves the {@link Preferences} object to the file. + * + * @returns { Promise } A promise object. + * @syscap SystemCapability.DistributedDataManager.Preferences.Core + * @crossplatform + * @since 10 + */ + /** + * Asynchronously saves the {@link Preferences} object to the file. + * + * @returns { Promise } A promise object. + * @throws { BusinessError } 15500000 - Inner error. + * @syscap SystemCapability.DistributedDataManager.Preferences.Core + * @crossplatform + * @atomicservice + * @since 11 + */ + flush(): Promise; + /** + * Registers an observer to listen for the change of a {@link Preferences} object. + * + * @param { 'change' } type - Indicates the callback when preferences changes. + * @param { Callback<{ key: string }> } callback - Indicates the callback function. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; + * 3. Parameter verification failed. + * @syscap SystemCapability.DistributedDataManager.Preferences.Core + * @since 9 + */ + /** + * Registers an observer to listen for the change of a {@link Preferences} object. + * + * @param { 'change' } type - Indicates the callback when preferences changes. + * @param { Function } callback - Indicates the callback function. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; + * 3. Parameter verification failed. + * @syscap SystemCapability.DistributedDataManager.Preferences.Core + * @crossplatform + * @since 10 + */ + /** + * Registers an observer to listen for the change of a {@link Preferences} object. + * + * @param { 'change' } type - Indicates the callback when preferences changes. + * @param { Callback } callback - Indicates the callback function. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; + * 3. Parameter verification failed. + * @throws { BusinessError } 15500000 - Inner error. + * @syscap SystemCapability.DistributedDataManager.Preferences.Core + * @crossplatform + * @atomicservice + * @since 11 + */ + on(type: 'change', callback: Callback): void; + /** + * Registers an observer to listen for the change of a {@link Preferences} object. + * + * @param { 'multiProcessChange' } type - Indicates the callback when preferences changed in multiple processes. + * @param { Function } callback - Indicates the callback function. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; + * 3. Parameter verification failed. + * @throws { BusinessError } 15500019 - Failed to obtain subscription service. + * @syscap SystemCapability.DistributedDataManager.Preferences.Core + * @since 10 + */ + /** + * Registers an observer to listen for the change of a {@link Preferences} object. + * + * @param { 'multiProcessChange' } type - Indicates the callback when preferences changed in multiple processes. + * @param { Callback } callback - Indicates the callback function. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; + * 3. Parameter verification failed. + * @throws { BusinessError } 15500000 - Inner error. + * @throws { BusinessError } 15500019 - Failed to obtain subscription service. + * @syscap SystemCapability.DistributedDataManager.Preferences.Core + * @atomicservice + * @since 11 + */ + on(type: 'multiProcessChange', callback: Callback): void; + /** + * Registers an observer to listen for changes to the {@ link Preferences} object. + * + * @param { 'dataChange' } type - Indicates the type of the event to observe. + * @param { Array } keys - Indicates one or more keys to listen for. + * @param { Callback> } callback - Indicates the callback used to return the data change. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; + * 3. Parameter verification failed. + * The callback must be function. + * @throws { BusinessError } 15500000 - Inner error. + * @syscap SystemCapability.DistributedDataManager.Preferences.Core + * @atomicservice + * @since 12 + */ + on(type: 'dataChange', keys: Array, callback: Callback>): void; + /** + * Unregisters an existing observer. + * + * @param { 'change' } type - Indicates the callback when preferences changes. + * @param { Callback<{ key: string }> } callback - Indicates the callback function. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; + * 3. Parameter verification failed. + * @syscap SystemCapability.DistributedDataManager.Preferences.Core + * @since 9 + */ + /** + * Unregisters an existing observer. + * + * @param { 'change' } type - Indicates the callback when preferences changes. + * @param { Function } callback - Indicates the callback function. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; + * 3. Parameter verification failed. + * @syscap SystemCapability.DistributedDataManager.Preferences.Core + * @crossplatform + * @since 10 + */ + /** + * Unregisters an existing observer. + * + * @param { 'change' } type - Indicates the callback when preferences changes. + * @param { Callback } callback - Indicates the callback function. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; + * 3. Parameter verification failed. + * @throws { BusinessError } 15500000 - Inner error. + * @syscap SystemCapability.DistributedDataManager.Preferences.Core + * @crossplatform + * @atomicservice + * @since 11 + */ + off(type: 'change', callback?: Callback): void; + /** + * Unregisters an existing observer. + * + * @param { 'multiProcessChange' } type - Indicates the callback when preferences changed in multiple processes. + * @param { Function } callback - Indicates the callback function. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; + * 3. Parameter verification failed. + * @syscap SystemCapability.DistributedDataManager.Preferences.Core + * @since 10 + */ + /** + * Unregisters an existing observer. + * + * @param { 'multiProcessChange' } type - Indicates the callback when preferences changed in multiple processes. + * @param { Callback } callback - Indicates the callback function. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; + * 3. Parameter verification failed. + * @throws { BusinessError } 15500000 - Inner error. + * @syscap SystemCapability.DistributedDataManager.Preferences.Core + * @atomicservice + * @since 11 + */ + off(type: 'multiProcessChange', callback?: Callback): void; + /** + * Unregisters an observer for changes to the {@ link Preferences} object. + * + * @param { 'dataChange' } type - Indicates the event type. + * @param { Array } keys - Indicates the data whose changes are not observed. + * @param { Callback> } callback - Indicates the callback to unregister. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; + * 3. Parameter verification failed. + * @throws { BusinessError } 15500000 - Inner error. + * @syscap SystemCapability.DistributedDataManager.Preferences.Core + * @atomicservice + * @since 12 + */ + off(type: 'dataChange', keys: Array, callback?: Callback>): void; + } +} +export default preferences; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.data.rdb.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.data.rdb.d.ts new file mode 100755 index 00000000..f7dc058f --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.data.rdb.d.ts @@ -0,0 +1,882 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit ArkData + */ +import { AsyncCallback, Callback } from './@ohos.base'; +import { ResultSet as _ResultSet } from './data/rdb/resultSet'; +import Context from './application/BaseContext'; +/** + * Provides methods for rdbStore create and delete. + * + * @namespace rdb + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.relationalStore + */ +declare namespace rdb { + /** + * Obtains an RDB store. + * You can set parameters of the RDB store as required. In general, this method is recommended + * to obtain a rdb store. + * + * @param { Context } context - Indicates the context of application or capability. + * @param { StoreConfig } config - Indicates the {@link StoreConfig} configuration of the database related to this RDB store. + * @param { number } version - Indicates the database version for upgrade or downgrade. + * @param { AsyncCallback } callback - The RDB store {@link RdbStore}. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.relationalStore.getRdbStore + */ + function getRdbStore(context: Context, config: StoreConfig, version: number, callback: AsyncCallback): void; + /** + * Obtains an RDB store. + * You can set parameters of the RDB store as required. In general, this method is recommended + * to obtain a rdb store. + * + * @param { Context } context - Indicates the context of application or capability. + * @param { StoreConfig } config - Indicates the {@link StoreConfig} configuration of the database related to this RDB store. + * @param { number } version - Indicates the database version for upgrade or downgrade. + * @returns { Promise } The RDB store {@link RdbStore}. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.relationalStore.getRdbStore + */ + function getRdbStore(context: Context, config: StoreConfig, version: number): Promise; + /** + * Deletes the database with a specified name. + * + * @param { Context } context - Indicates the context of application or capability. + * @param { string } name - Indicates the database name. + * @param { AsyncCallback } callback - The callback of deleteRdbStore. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.relationalStore.deleteRdbStore + */ + function deleteRdbStore(context: Context, name: string, callback: AsyncCallback): void; + /** + * Deletes the database with a specified name. + * + * @param { Context } context - Indicates the context of application or capability. + * @param { string } name - Indicates the database name. + * @returns { Promise } The promise returned by the function. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.relationalStore.deleteRdbStore + */ + function deleteRdbStore(context: Context, name: string): Promise; + /** + * Indicates the database synchronization mode. + * + * @enum { number } + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.relationalStore.SyncMode + */ + enum SyncMode { + /** + * Indicates the data is pushed to remote device from local device. + * + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.relationalStore.SyncMode.SYNC_MODE_PUSH + */ + SYNC_MODE_PUSH = 0, + /** + * Indicates the data is pulled from remote device to local device. + * + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.relationalStore.SyncMode.SYNC_MODE_PULL + */ + SYNC_MODE_PULL = 1 + } + /** + * Describes the subscription type. + * + * @permission ohos.permission.DISTRIBUTED_DATASYNC + * @enum { number } + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.relationalStore.SubscribeType + */ + enum SubscribeType { + /** + * Subscription to remote data changes + * + * @permission ohos.permission.DISTRIBUTED_DATASYNC + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.relationalStore.SubscribeType.SUBSCRIBE_TYPE_REMOTE + */ + SUBSCRIBE_TYPE_REMOTE = 0 + } + /** + * Provides methods for managing the relational database (RDB). + * This class provides methods for creating, querying, updating, and deleting RDBs. + * + * @interface RdbStore + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.relationalStore.RdbStore + */ + interface RdbStore { + /** + * Inserts a row of data into the target table. + * + * @param { string } table - Indicates the row of data to be inserted into the table. + * @param { ValuesBucket } values - Indicates the row of data {@link ValuesBucket} to be inserted into the table. + * @param { AsyncCallback } callback - The row ID if the operation is successful. returns -1 otherwise. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.relationalStore.RdbStore.insert + */ + insert(table: string, values: ValuesBucket, callback: AsyncCallback): void; + /** + * Inserts a row of data into the target table. + * + * @param { string } table - Indicates the row of data to be inserted into the table. + * @param { ValuesBucket } values - Indicates the row of data {@link ValuesBucket} to be inserted into the table. + * @returns { Promise } Return the row ID if the operation is successful. return -1 otherwise. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.relationalStore.RdbStore.insert + */ + insert(table: string, values: ValuesBucket): Promise; + /** + * Inserts a batch of data into the target table. + * + * @param { string } table - Indicates the target table. + * @param { Array } values - Indicates the rows of data {@link ValuesBucket} to be inserted into the table. + * @param { AsyncCallback } callback - The number of values that were inserted if the operation is successful. returns -1 otherwise. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.relationalStore.RdbStore.batchInsert + */ + batchInsert(table: string, values: Array, callback: AsyncCallback): void; + /** + * Inserts a batch of data into the target table. + * + * @param { string } table - Indicates the target table. + * @param { Array } values - Indicates the rows of data {@link ValuesBucket} to be inserted into the table. + * @returns { Promise } Return the number of values that were inserted if the operation is successful. returns -1 otherwise. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.relationalStore.RdbStore.batchInsert + */ + batchInsert(table: string, values: Array): Promise; + /** + * Updates data in the database based on a a specified instance object of RdbPredicates. + * + * @param { ValuesBucket } values - Indicates Indicates the row of data to be updated in the database. + * The key-value pairs are associated with column names of the database table. + * @param { RdbPredicates } predicates - Indicates the specified update condition by the instance object of {@link RdbPredicates}. + * @param { AsyncCallback } callback - The number of affected rows. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.relationalStore.RdbStore.update + */ + update(values: ValuesBucket, predicates: RdbPredicates, callback: AsyncCallback): void; + /** + * Updates data in the database based on a a specified instance object of RdbPredicates. + * + * @param { ValuesBucket } values - Indicates Indicates the row of data to be updated in the database. + * The key-value pairs are associated with column names of the database table. + * @param { RdbPredicates } predicates - Indicates the specified update condition by the instance object of {@link RdbPredicates}. + * @returns { Promise } Return the number of affected rows. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.relationalStore.RdbStore.update + */ + update(values: ValuesBucket, predicates: RdbPredicates): Promise; + /** + * Deletes data from the database based on a specified instance object of RdbPredicates. + * + * @param { RdbPredicates } predicates - The specified delete condition by the instance object of {@link RdbPredicates}. + * @param { AsyncCallback } callback - The number of affected rows. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.relationalStore.RdbStore.delete + */ + delete(predicates: RdbPredicates, callback: AsyncCallback): void; + /** + * Deletes data from the database based on a specified instance object of RdbPredicates. + * + * @param { RdbPredicates } predicates - The specified delete condition by the instance object of {@link RdbPredicates}. + * @returns { Promise } Return the number of affected rows. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.relationalStore.RdbStore.delete + */ + delete(predicates: RdbPredicates): Promise; + /** + * Queries data in the database based on specified conditions. + * + * @param { RdbPredicates } predicates - The specified query condition by the instance object of {@link RdbPredicates}. + * @param { Array } columns - The columns to query. If the value is empty array, the query applies to all columns. + * @param { AsyncCallback } callback - The {@link ResultSet} object if the operation is successful. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.relationalStore.RdbStore.query + */ + query(predicates: RdbPredicates, columns: Array, callback: AsyncCallback): void; + /** + * Queries data in the database based on specified conditions. + * + * @param { RdbPredicates } predicates - The specified query condition by the instance object of {@link RdbPredicates}. + * @param { Array } columns - The columns to query. If the value is null, the query applies to all columns. + * @returns { Promise } Return the {@link ResultSet} object if the operation is successful. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.relationalStore.RdbStore.query + */ + query(predicates: RdbPredicates, columns?: Array): Promise; + /** + * Queries data in the database based on SQL statement. + * + * @param { string } sql - Indicates the SQL statement to execute. + * @param { Array } bindArgs - Indicates the {@link ValueType} values of the parameters in the SQL statement. The values are strings. + * @param { AsyncCallback } callback + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.relationalStore.RdbStore.querySql + */ + querySql(sql: string, bindArgs: Array, callback: AsyncCallback): void; + /** + * Queries data in the database based on SQL statement. + * + * @param { string } sql - Indicates the SQL statement to execute. + * @param { Array } bindArgs - Indicates the {@link ValueType} values of the parameters in the SQL statement. The values are strings. + * @returns { Promise } Return the {@link ResultSet} object if the operation is successful. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.relationalStore.RdbStore.querySql + */ + querySql(sql: string, bindArgs?: Array): Promise; + /** + * Executes an SQL statement that contains specified parameters but returns no value. + * + * @param { string } sql - Indicates the SQL statement to execute. + * @param { Array } bindArgs - Indicates the {@link ValueType} values of the parameters in the SQL statement. The values are strings. + * @param { AsyncCallback } callback - The callback of executeSql. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.relationalStore.RdbStore.executeSql + */ + executeSql(sql: string, bindArgs: Array, callback: AsyncCallback): void; + /** + * Executes an SQL statement that contains specified parameters but returns no value. + * + * @param { string } sql - Indicates the SQL statement to execute. + * @param { Array } bindArgs - Indicates the {@link ValueType} values of the parameters in the SQL statement. The values are strings. + * @returns { Promise } The promise returned by the function. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.relationalStore.RdbStore.executeSql + */ + executeSql(sql: string, bindArgs?: Array): Promise; + /** + * Begin Transaction before execute your sql. + * + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.relationalStore.RdbStore.beginTransaction + */ + beginTransaction(): void; + /** + * Commit the the sql you have executed. + * + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.relationalStore.RdbStore.commit + */ + commit(): void; + /** + * Roll back the sql you have already executed. + * + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.relationalStore.RdbStore.rollBack + */ + rollBack(): void; + /** + * Set table to be distributed table. + * + * @permission ohos.permission.DISTRIBUTED_DATASYNC + * @param { Array } tables - Indicates the tables name you want to set. + * @param { AsyncCallback } callback - The callback of setDistributedTables. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.relationalStore.RdbStore.setDistributedTables + */ + setDistributedTables(tables: Array, callback: AsyncCallback): void; + /** + * Set table to be distributed table. + * + * @permission ohos.permission.DISTRIBUTED_DATASYNC + * @param { Array } tables - Indicates the tables name you want to set. + * @returns { Promise } The promise returned by the function. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.relationalStore.RdbStore.setDistributedTables + */ + setDistributedTables(tables: Array): Promise; + /** + * Obtain distributed table name of specified remote device according to local table name. + * When query remote device database, distributed table name is needed. + * + * @permission ohos.permission.DISTRIBUTED_DATASYNC + * @param { string } device - Indicates the remote device. + * @param { string } table - {string}: The distributed table name. + * @param { AsyncCallback } callback + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.relationalStore.RdbStore.obtainDistributedTableName + */ + obtainDistributedTableName(device: string, table: string, callback: AsyncCallback): void; + /** + * Obtain distributed table name of specified remote device according to local table name. + * When query remote device database, distributed table name is needed. + * + * @permission ohos.permission.DISTRIBUTED_DATASYNC + * @param { string } device - Indicates the remote device. + * @param { string } table + * @returns { Promise } {string}: The distributed table name. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.relationalStore.RdbStore.obtainDistributedTableName + */ + obtainDistributedTableName(device: string, table: string): Promise; + /** + * Sync data between devices. + * + * @permission ohos.permission.DISTRIBUTED_DATASYNC + * @param { SyncMode } mode - Indicates the remote device. + * @param { RdbPredicates } predicates - {Array<[string, number]>}: Devices sync status array, {string}: device id, {number}: device sync status. + * @param { AsyncCallback> } callback + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.relationalStore.RdbStore.sync + */ + sync(mode: SyncMode, predicates: RdbPredicates, callback: AsyncCallback>): void; + /** + * Sync data between devices. + * + * @permission ohos.permission.DISTRIBUTED_DATASYNC + * @param { SyncMode } mode - Indicates the remote device. + * @param { RdbPredicates } predicates + * @returns { Promise> } {Array<[string, number]>}: Devices sync status array, {string}: device id, {number}: device sync status. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.relationalStore.RdbStore.sync + */ + sync(mode: SyncMode, predicates: RdbPredicates): Promise>; + /** + * Registers an observer for the database. When data in the distributed database changes, + * the callback will be invoked. + * + * @param { 'dataChange' } event - Indicates the event must be string 'dataChange'. + * @param { SubscribeType } type - Indicates the subscription type, which is defined in {@link SubscribeType}. + * If its value is SUBSCRIBE_TYPE_REMOTE, ohos.permission.DISTRIBUTED_DATASYNC is required. + * @param { Callback> } observer - {Array}: The observer of data change events in the distributed database. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.relationalStore.RdbStore.on + */ + on(event: 'dataChange', type: SubscribeType, observer: Callback>): void; + /** + * Remove specified observer of specified type from the database. + * + * @param { 'dataChange' } event - Indicates the event must be string 'dataChange'. + * @param { SubscribeType } type - Indicates the subscription type, which is defined in {@link SubscribeType}. + * If its value is SUBSCRIBE_TYPE_REMOTE, ohos.permission.DISTRIBUTED_DATASYNC is required. + * @param { Callback> } observer - {Array}: The data change observer already registered. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.relationalStore.RdbStore.off + */ + off(event: 'dataChange', type: SubscribeType, observer: Callback>): void; + } + /** + * Indicates possible value types + * + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.relationalStore.ValueType + */ + type ValueType = number | string | boolean; + /** + * Values in buckets are stored in key-value pairs + * + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.relationalStore.ValuesBucket + */ + type ValuesBucket = { + [key: string]: ValueType | Uint8Array | null; + }; + /** + * Manages relational database configurations. + * + * @interface StoreConfig + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.relationalStore.StoreConfig + */ + interface StoreConfig { + name: string; + } + /** + * Manages relational database configurations. + * + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.relationalStore.RdbPredicates + */ + class RdbPredicates { + /** + * A parameterized constructor used to create an RdbPredicates instance. + * + * @param { string } name - Indicates the table name of the database. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.relationalStore.RdbPredicates.constructor + */ + constructor(name: string); + /** + * Sync data between devices. + * When query database, this function should not be called. + * + * @param { Array } devices - Indicates specified remote devices. + * @returns { RdbPredicates } - The {@link RdbPredicates} self. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.relationalStore.RdbPredicates.inDevices + */ + inDevices(devices: Array): RdbPredicates; + /** + * Specify all remote devices which connect to local device when syncing distributed database. + * When query database, this function should not be called. + * + * @returns { RdbPredicates } - The {@link RdbPredicates} self. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.relationalStore.RdbPredicates.inAllDevices + */ + inAllDevices(): RdbPredicates; + /** + * Configure the RdbPredicates to match the field whose data type is ValueType and value is equal + * to a specified value. + * This method is similar to = of the SQL statement. + * + * @param { string } field - Indicates the column name in the database table. + * @param { ValueType } value - Indicates the value to match with the {@link RdbPredicates}. + * @returns { RdbPredicates } - The {@link RdbPredicates} self. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.relationalStore.RdbPredicates.equalTo + */ + equalTo(field: string, value: ValueType): RdbPredicates; + /** + * Configure the RdbPredicates to match the field whose data type is ValueType and value is not equal to + * a specified value. + * This method is similar to != of the SQL statement. + * + * @param { string } field - Indicates the column name in the database table. + * @param { ValueType } value - Indicates the value to match with the {@link RdbPredicates}. + * @returns { RdbPredicates } - The {@link RdbPredicates} self. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.relationalStore.RdbPredicates.notEqualTo + */ + notEqualTo(field: string, value: ValueType): RdbPredicates; + /** + * Adds a left parenthesis to the RdbPredicates. + * This method is similar to ( of the SQL statement and needs to be used together with endWrap(). + * + * @returns { RdbPredicates } - The {@link RdbPredicates} with the left parenthesis. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.relationalStore.RdbPredicates.beginWrap + */ + beginWrap(): RdbPredicates; + /** + * Adds a right parenthesis to the RdbPredicates. + * This method is similar to ) of the SQL statement and needs to be used together + * with beginWrap(). + * + * @returns { RdbPredicates } - The {@link RdbPredicates} with the right parenthesis. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.relationalStore.RdbPredicates.endWrap + */ + endWrap(): RdbPredicates; + /** + * Adds an or condition to the RdbPredicates. + * This method is similar to or of the SQL statement. + * + * @returns { RdbPredicates } Returns the {@link RdbPredicates} with the or condition. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.relationalStore.RdbPredicates.or + */ + or(): RdbPredicates; + /** + * Adds an and condition to the RdbPredicates. + * This method is similar to or of the SQL statement. + * + * @returns { RdbPredicates } Returns the {@link RdbPredicates} with the or condition. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.relationalStore.RdbPredicates.and + */ + and(): RdbPredicates; + /** + * Configure the RdbPredicates to match the field whose data type is string and value + * contains a specified value. + * This method is similar to contains of the SQL statement. + * + * @param { string } field - Indicates the column name in the database table. + * @param { string } value - Indicates the value to match with the {@link RdbPredicates}. + * @returns { RdbPredicates } - The {@link RdbPredicates} self. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.relationalStore.RdbPredicates.contains + */ + contains(field: string, value: string): RdbPredicates; + /** + * Configure the RdbPredicates to match the field whose data type is string and value starts + * with a specified string. + * This method is similar to value% of the SQL statement. + * + * @param { string } field - Indicates the column name in the database table. + * @param { string } value - Indicates the value to match with the {@link RdbPredicates}. + * @returns { RdbPredicates } - The {@link RdbPredicates} self. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.relationalStore.RdbPredicates.beginsWith + */ + beginsWith(field: string, value: string): RdbPredicates; + /** + * Configure the RdbPredicates to match the field whose data type is string and value + * ends with a specified string. + * This method is similar to %value of the SQL statement. + * + * @param { string } field - Indicates the column name in the database table. + * @param { string } value - Indicates the value to match with the {@link RdbPredicates}. + * @returns { RdbPredicates } - The {@link RdbPredicates} self. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.relationalStore.RdbPredicates.endsWith + */ + endsWith(field: string, value: string): RdbPredicates; + /** + * Configure the RdbPredicates to match the fields whose value is null. + * This method is similar to is null of the SQL statement. + * + * @param { string } field - Indicates the column name in the database table. + * @returns { RdbPredicates } - The {@link RdbPredicates} self. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.relationalStore.RdbPredicates.isNull + */ + isNull(field: string): RdbPredicates; + /** + * Configure the RdbPredicates to match the specified fields whose value is not null. + * This method is similar to is not null of the SQL statement. + * + * @param { string } field - Indicates the column name in the database table. + * @returns { RdbPredicates } - The {@link RdbPredicates} self. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.relationalStore.RdbPredicates.isNotNull + */ + isNotNull(field: string): RdbPredicates; + /** + * Configure the RdbPredicates to match the fields whose data type is string and value is + * similar to a specified string. + * This method is similar to like of the SQL statement. + * + * @param { string } field - Indicates the column name in the database table. + * @param { string } value - Indicates the value to match with the {@link RdbPredicates}. + * @returns { RdbPredicates } - The {@link RdbPredicates} that match the specified field. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.relationalStore.RdbPredicates.like + */ + like(field: string, value: string): RdbPredicates; + /** + * Configure RdbPredicates to match the specified field whose data type is string and the value contains + * a wildcard. + * Different from like, the input parameters of this method are case-sensitive. + * + * @param { string } field - Indicates the column name in the database table. + * @param { string } value - Indicates the value to match with the {@link RdbPredicates}. + * @returns { RdbPredicates } - The SQL statement with the specified {@link RdbPredicates}. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.relationalStore.RdbPredicates.glob + */ + glob(field: string, value: string): RdbPredicates; + /** + * Configure RdbPredicates to match the specified field whose data type is string and the value contains + * a wildcard. + * + * @param { string } field - Indicates the column name. + * @param { ValueType } low - Indicates the minimum value. + * @param { ValueType } high - Indicates the maximum value. + * @returns { RdbPredicates } - The SQL statement with the specified {@link RdbPredicates}. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.relationalStore.RdbPredicates.between + */ + between(field: string, low: ValueType, high: ValueType): RdbPredicates; + /** + * Configure RdbPredicates to match the specified field whose data type is int and value is + * out of a given range. + * + * @param { string } field - Indicates the column name in the database table. + * @param { ValueType } low - Indicates the minimum value. + * @param { ValueType } high - Indicates the maximum value to. + * @returns { RdbPredicates } - The SQL statement with the specified {@link RdbPredicates}. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.relationalStore.RdbPredicates.notBetween + */ + notBetween(field: string, low: ValueType, high: ValueType): RdbPredicates; + /** + * Restricts the value of the field to be greater than the specified value. + * + * @param { string } field - Indicates the column name in the database table. + * @param { ValueType } value - Indicates the value to match with the {@link RdbPredicates}. + * @returns { RdbPredicates } - The SQL query statement with the specified {@link RdbPredicates}. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.relationalStore.RdbPredicates.greaterThan + */ + greaterThan(field: string, value: ValueType): RdbPredicates; + /** + * Restricts the value of the field to be smaller than the specified value. + * + * @param { string } field - Indicates the column name in the database table. + * @param { ValueType } value - Indicates the value to match with the {@link RdbPredicates}. + * @returns { RdbPredicates } - The SQL query statement with the specified {@link RdbPredicates}. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.relationalStore.RdbPredicates.lessThan + */ + lessThan(field: string, value: ValueType): RdbPredicates; + /** + * Restricts the value of the field to be greater than or equal to the specified value. + * + * @param { string } field - Indicates the column name in the database table. + * @param { ValueType } value - Indicates the value to match with the {@link RdbPredicates}. + * @returns { RdbPredicates } - The SQL query statement with the specified {@link RdbPredicates}. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.relationalStore.RdbPredicates.greaterThanOrEqualTo + */ + greaterThanOrEqualTo(field: string, value: ValueType): RdbPredicates; + /** + * Restricts the value of the field to be smaller than or equal to the specified value. + * + * @param { string } field - Indicates the column name in the database table. + * @param { ValueType } value - Indicates the value to match with the {@link RdbPredicates}. + * @returns { RdbPredicates } - The SQL query statement with the specified {@link RdbPredicates}. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.relationalStore.RdbPredicates.lessThanOrEqualTo + */ + lessThanOrEqualTo(field: string, value: ValueType): RdbPredicates; + /** + * Restricts the ascending order of the return list. When there are several orders, + * the one close to the head has the highest priority. + * + * @param { string } field - Indicates the column name for sorting the return list. + * @returns { RdbPredicates } - The SQL query statement with the specified {@link RdbPredicates}. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.relationalStore.RdbPredicates.orderByAsc + */ + orderByAsc(field: string): RdbPredicates; + /** + * Restricts the descending order of the return list. When there are several orders, + * the one close to the head has the highest priority. + * + * @param { string } field - Indicates the column name for sorting the return list. + * @returns { RdbPredicates } - The SQL query statement with the specified {@link RdbPredicates}. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.relationalStore.RdbPredicates.orderByDesc + */ + orderByDesc(field: string): RdbPredicates; + /** + * Restricts each row of the query result to be unique. + * + * @returns { RdbPredicates } - The SQL query statement with the specified {@link RdbPredicates}. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.relationalStore.RdbPredicates.distinct + */ + distinct(): RdbPredicates; + /** + * Restricts the max number of return records. + * + * @param { number } value - Indicates the max length of the return list. + * @returns { RdbPredicates } - The SQL query statement with the specified {@link RdbPredicates}. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.relationalStore.RdbPredicates.limitAs + */ + limitAs(value: number): RdbPredicates; + /** + * Configure RdbPredicates to specify the start position of the returned result. + * Use this method together with limit(int). + * + * @param { number } rowOffset - Indicates the start position of the returned result. The value is a positive integer. + * @returns { RdbPredicates } - The SQL query statement with the specified {@link RdbPredicates}. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.relationalStore.RdbPredicates.offsetAs + */ + offsetAs(rowOffset: number): RdbPredicates; + /** + * Configure RdbPredicates to group query results by specified columns. + * + * @param { Array } fields - Indicates the specified columns by which query results are grouped. + * @returns { RdbPredicates } - The SQL query statement with the specified {@link RdbPredicates}. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.relationalStore.RdbPredicates.groupBy + */ + groupBy(fields: Array): RdbPredicates; + /** + * Configure RdbPredicates to specify the index column. + * Before using this method, you need to create an index column. + * + * @param { string } field - Indicates the name of the index column. + * @returns { RdbPredicates } - The SQL statement with the specified {@link RdbPredicates}. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.relationalStore.RdbPredicates.indexedBy + */ + indexedBy(field: string): RdbPredicates; + /** + * Configure RdbPredicates to match the specified field whose data type is ValueType array and values + * are within a given range. + * + * @param { string } field - Indicates the column name in the database table. + * @param { Array } value - Indicates the values to match with {@link RdbPredicates}. + * @returns { RdbPredicates } - The SQL statement with the specified {@link RdbPredicates}. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.relationalStore.RdbPredicates.in + */ + in(field: string, value: Array): RdbPredicates; + /** + * Configure RdbPredicates to match the specified field whose data type is ValueType array and values + * are out of a given range. + * + * @param { string } field - Indicates the column name in the database table. + * @param { Array } value - Indicates the values to match with {@link RdbPredicates}. + * @returns { RdbPredicates } - The SQL statement with the specified {@link RdbPredicates}. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.relationalStore.RdbPredicates.notIn + */ + notIn(field: string, value: Array): RdbPredicates; + } + export type ResultSet = _ResultSet; +} +export default rdb; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.data.relationalStore.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.data.relationalStore.d.ts new file mode 100755 index 00000000..c1ff4a51 --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.data.relationalStore.d.ts @@ -0,0 +1,5994 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit ArkData + */ +import { AsyncCallback, Callback } from './@ohos.base'; +import Context from './application/BaseContext'; +/** + * Provides methods for rdbStore create and delete. + * + * @namespace relationalStore + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 9 + */ +/** + * Provides methods for rdbStore create and delete. + * + * @namespace relationalStore + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @crossplatform + * @since 10 + */ +declare namespace relationalStore { + /** + * Describes the status of asset + * + * @enum { number } + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @crossplatform + * @since 10 + */ + enum AssetStatus { + /** + * ASSET_NORMAL: means the status of asset is normal. + * + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @crossplatform + * @since 10 + */ + ASSET_NORMAL, + /** + * ASSET_ABNORMAL: means the asset needs to be inserted. + * + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @crossplatform + * @since 10 + */ + ASSET_INSERT, + /** + * ASSET_ABNORMAL: means the asset needs to be updated. + * + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @crossplatform + * @since 10 + */ + ASSET_UPDATE, + /** + * ASSET_ABNORMAL: means the asset needs to be deleted. + * + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @crossplatform + * @since 10 + */ + ASSET_DELETE, + /** + * ASSET_ABNORMAL: means the status of asset is abnormal. + * + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @crossplatform + * @since 10 + */ + ASSET_ABNORMAL, + /** + * ASSET_DOWNLOADING: means the status of asset is downloading. + * + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @crossplatform + * @since 10 + */ + ASSET_DOWNLOADING + } + /** + * Records information of the asset. + * + * @interface Asset + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @crossplatform + * @since 10 + */ + interface Asset { + /** + * The name of asset. + * + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @crossplatform + * @since 10 + */ + name: string; + /** + * The uri of asset. + * + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @crossplatform + * @since 10 + */ + uri: string; + /** + * The path of asset. + * + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @crossplatform + * @since 10 + */ + path: string; + /** + * The create time of asset. + * + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @crossplatform + * @since 10 + */ + createTime: string; + /** + * The modify time of asset. + * + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @crossplatform + * @since 10 + */ + modifyTime: string; + /** + * The size of asset. + * + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @crossplatform + * @since 10 + */ + size: string; + /** + * The status of asset. + * + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @crossplatform + * @since 10 + */ + status?: AssetStatus; + } + /** + * Indicates several assets in one column + * + * @typedef { Asset[] } Assets + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @crossplatform + * @since 10 + */ + type Assets = Asset[]; + /** + * Indicates possible value types + * + * @typedef { null | number | string | boolean | Uint8Array } ValueType + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 9 + */ + /** + * Indicates possible value types + * + * @typedef { null | number | string | boolean | Uint8Array | Asset | Assets } ValueType + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @crossplatform + * @since 10 + */ + /** + * Indicates possible value types + * + * @typedef { null | number | string | boolean | Uint8Array | Asset | Assets | Float32Array | bigint } ValueType + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @crossplatform + * @since 12 + */ + type ValueType = null | number | string | boolean | Uint8Array | Asset | Assets | Float32Array | bigint; + /** + * Values in buckets are stored in key-value pairs + * + * @typedef { Record } ValuesBucket + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 9 + */ + /** + * Values in buckets are stored in key-value pairs, move Uint8Array add to ValueType + * + * @typedef { Record } ValuesBucket + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @crossplatform + * @since 10 + */ + /** + * Values in buckets are stored in key-value pairs, change {[key: string]: ValueType;} to Record + * + * @typedef { Record } ValuesBucket + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @crossplatform + * @since 11 + */ + type ValuesBucket = Record; + /** + * The type of the priority key can be number or string + * + * @typedef { number | string } PRIKeyType + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 10 + */ + type PRIKeyType = number | string; + /** + * The time is in UTC format. + * + * @typedef { Date } UTCTime + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 10 + */ + type UTCTime = Date; + /** + * Indicates the primary key and UTC time of the modified rows. + * + * @typedef { Map } ModifyTime + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 10 + */ + type ModifyTime = Map; + /** + * Manages relational database configurations. + * + * @interface StoreConfig + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 9 + */ + /** + * Manages relational database configurations. + * + * @interface StoreConfig + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @crossplatform + * @since 10 + */ + interface StoreConfig { + /** + * The database name. + * + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 9 + */ + /** + * The database name. + * + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @crossplatform + * @since 10 + */ + name: string; + /** + * Specifies the security level of the database. + * + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @crossplatform + * @since 9 + */ + securityLevel: SecurityLevel; + /** + * Specifies whether the database is encrypted. + * + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 9 + */ + encrypt?: boolean; + /** + * The data group id of application. + * + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @StageModelOnly + * @since 10 + */ + dataGroupId?: string; + /** + * Specifies the directory relative to the database directory obtained from context + * + * @type { ?string } + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @crossplatform + * @since 11 + */ + customDir?: string; + /** + * Specifies whether to clean up dirty data that is synchronized to + * the local but deleted in the cloud. + * + * @type { ?boolean } + * @syscap SystemCapability.DistributedDataManager.CloudSync.Client + * @since 11 + */ + autoCleanDirtyData?: boolean; + /** + * Specifies whether database allows rebuild. + * + * @type { ?boolean } + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 12 + */ + allowRebuild?: boolean; + } + /** + * The cloud sync progress + * + * @enum { number } + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 10 + */ + enum Progress { + /** + * SYNC_BEGIN: means the sync process begin. + * + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 10 + */ + SYNC_BEGIN, + /** + * SYNC_BEGIN: means the sync process is in progress + * + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 10 + */ + SYNC_IN_PROGRESS, + /** + * SYNC_BEGIN: means the sync process is finished + * + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 10 + */ + SYNC_FINISH + } + /** + * Describes the statistic of the cloud sync process. + * + * @interface Statistic + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 10 + */ + interface Statistic { + /** + * Describes the total number of data to sync. + * + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 10 + */ + total: number; + /** + * Describes the number of successfully synced data. + * + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 10 + */ + successful: number; + /** + * Describes the number of data failed to sync. + * + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 10 + */ + failed: number; + /** + * Describes the number of data remained to sync. + * + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 10 + */ + remained: number; + } + /** + * Describes the {@code Statistic} details of the table. + * + * @interface TableDetails + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 10 + */ + interface TableDetails { + /** + * Describes the {@code Statistic} details of the upload process. + * + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 10 + */ + upload: Statistic; + /** + * Describes the {@code Statistic} details of the download process. + * + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 10 + */ + download: Statistic; + } + /** + * Describes the status of {@code Progress}. + * + * @enum { number } + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 10 + */ + enum ProgressCode { + /** + * SUCCESS: means the status of progress is success. + * + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 10 + */ + SUCCESS, + /** + * UNKNOWN_ERROR: means the progress meets unknown error. + * + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 10 + */ + UNKNOWN_ERROR, + /** + * NETWORK_ERROR: means the progress meets network error. + * + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 10 + */ + NETWORK_ERROR, + /** + * CLOUD_DISABLED: means cloud is disabled. + * + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 10 + */ + CLOUD_DISABLED, + /** + * LOCKED_BY_OTHERS: means the progress is locked by others. + * + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 10 + */ + LOCKED_BY_OTHERS, + /** + * RECORD_LIMIT_EXCEEDED: means the record exceeds the limit. + * + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 10 + */ + RECORD_LIMIT_EXCEEDED, + /** + * NO_SPACE_FOR_ASSET: means the cloud has no space for the asset. + * + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 10 + */ + NO_SPACE_FOR_ASSET, + /** + * BLOCKED_BY_NETWORK_STRATEGY: means the sync blocked by network strategy. + * + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 12 + */ + BLOCKED_BY_NETWORK_STRATEGY + } + /** + * Describes detail of the cloud sync {@code Progress}. + * + * @interface ProgressDetails + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 10 + */ + interface ProgressDetails { + /** + * Describes the status of data sync progress. + * + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 10 + */ + schedule: Progress; + /** + * Describes the code of data sync progress. + * + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 10 + */ + code: ProgressCode; + /** + * The statistic details of the tables. + * + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 10 + */ + /** + * The statistic details of the tables. + * + * @type { Record } + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 11 + */ + details: Record; + } + /** + * Describes the {@code RdbStore} type. + * + * @enum { number } + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @crossplatform + * @since 9 + */ + enum SecurityLevel { + /** + * S1: means the db is low level security + * There are some low impact, when the data is leaked. + * + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @crossplatform + * @since 9 + */ + S1 = 1, + /** + * S2: means the db is middle level security + * There are some major impact, when the data is leaked. + * + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @crossplatform + * @since 9 + */ + S2 = 2, + /** + * S3: means the db is high level security + * There are some severity impact, when the data is leaked. + * + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @crossplatform + * @since 9 + */ + S3 = 3, + /** + * S4: means the db is critical level security + * There are some critical impact, when the data is leaked. + * + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @crossplatform + * @since 9 + */ + S4 = 4 + } + /** + * Indicates the database synchronization mode. + * + * @enum { number } + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 9 + */ + enum SyncMode { + /** + * Indicates the data is pushed to remote device from local device. + * + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 9 + */ + SYNC_MODE_PUSH = 0, + /** + * Indicates the data is pulled from remote device to local device. + * + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 9 + */ + SYNC_MODE_PULL = 1, + /** + * Indicates the data is pulled from remote device to local device. + * + * @syscap SystemCapability.DistributedDataManager.CloudSync.Client + * @since 10 + */ + SYNC_MODE_TIME_FIRST, + /** + * Indicates force push the native data to the cloud. + * + * @syscap SystemCapability.DistributedDataManager.CloudSync.Client + * @since 10 + */ + SYNC_MODE_NATIVE_FIRST, + /** + * Indicates the data is pulled from cloud to local device. + * + * @syscap SystemCapability.DistributedDataManager.CloudSync.Client + * @since 10 + */ + SYNC_MODE_CLOUD_FIRST + } + /** + * Describes the subscription type. + * + * @permission ohos.permission.DISTRIBUTED_DATASYNC + * @enum { number } + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 9 + */ + enum SubscribeType { + /** + * Subscription to remote data changes + * + * @permission ohos.permission.DISTRIBUTED_DATASYNC + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 9 + */ + SUBSCRIBE_TYPE_REMOTE = 0, + /** + * Subscription to cloud data changes + * + * @permission ohos.permission.DISTRIBUTED_DATASYNC + * @syscap SystemCapability.DistributedDataManager.CloudSync.Client + * @since 10 + */ + SUBSCRIBE_TYPE_CLOUD, + /** + * Subscription to cloud data changes details + * + * @permission ohos.permission.DISTRIBUTED_DATASYNC + * @syscap SystemCapability.DistributedDataManager.CloudSync.Client + * @since 10 + */ + SUBSCRIBE_TYPE_CLOUD_DETAILS, + /** + * Subscription to local data changes details + * + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 12 + */ + SUBSCRIBE_TYPE_LOCAL_DETAILS + } + /** + * Describes the change type. + * + * @enum { number } + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 10 + */ + enum ChangeType { + /** + * Means the change type is data change. + * + * @permission ohos.permission.DISTRIBUTED_DATASYNC + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 10 + */ + DATA_CHANGE, + /** + * Means the change type is asset change. + * + * @permission ohos.permission.DISTRIBUTED_DATASYNC + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 10 + */ + ASSET_CHANGE + } + /** + * Indicates the notify info + * + * @interface ChangeInfo + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 10 + */ + interface ChangeInfo { + /** + * Indicates the changed table + * + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 10 + */ + table: string; + /** + * Indicates the changed type + * + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 10 + */ + type: ChangeType; + /** + * Indicates if there is a string primary key, the inserted will keep data's primary keys + * otherwise it will keep the data's rowid. + * + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 10 + */ + inserted: Array | Array; + /** + * Indicates if there is a string primary key, the updated will keep data's primary keys + * otherwise it will keep the data's rowid. + * + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 10 + */ + updated: Array | Array; + /** + * Indicates if there is a string primary key, the deleted will keep data's primary keys + * otherwise it will keep the data's rowid. + * + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 10 + */ + deleted: Array | Array; + } + /** + * Describes the distribution type of the tables. + * + * @permission ohos.permission.DISTRIBUTED_DATASYNC + * @enum { number } + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 10 + */ + enum DistributedType { + /** + * Indicates the table is distributed among the devices + * + * @permission ohos.permission.DISTRIBUTED_DATASYNC + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 10 + */ + DISTRIBUTED_DEVICE, + /** + * Indicates the table is distributed between the cloud and the devices. + * + * @permission ohos.permission.DISTRIBUTED_DATASYNC + * @syscap SystemCapability.DistributedDataManager.CloudSync.Client + * @since 10 + */ + DISTRIBUTED_CLOUD + } + /** + * Manages the distributed configuration of the table. + * + * @interface DistributedConfig + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 10 + */ + interface DistributedConfig { + /** + * Specifies whether the database auto sync. + * + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 10 + */ + autoSync: boolean; + } + /** + * Describes the conflict resolutions to insert data into the table. + * + * @enum { number } + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @crossplatform + * @since 10 + */ + enum ConflictResolution { + /** + * Implements no action when conflict occurs. + * + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @crossplatform + * @since 10 + */ + ON_CONFLICT_NONE = 0, + /** + * Implements rollback operation when conflict occurs. + * + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @crossplatform + * @since 10 + */ + ON_CONFLICT_ROLLBACK = 1, + /** + * Implements abort operation when conflict occurs. + * + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @crossplatform + * @since 10 + */ + ON_CONFLICT_ABORT = 2, + /** + * Implements fail operation when conflict occurs. + * + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @crossplatform + * @since 10 + */ + ON_CONFLICT_FAIL = 3, + /** + * Implements ignore operation when conflict occurs. + * + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @crossplatform + * @since 10 + */ + ON_CONFLICT_IGNORE = 4, + /** + * Implements replace operation operator when conflict occurs. + * + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @crossplatform + * @since 10 + */ + ON_CONFLICT_REPLACE = 5 + } + /** + * Describes the data origin sources. + * + * @enum { number } + * @syscap SystemCapability.DistributedDataManager.CloudSync.Client + * @since 11 + */ + enum Origin { + /** + * Indicates the data source is local. + * + * @syscap SystemCapability.DistributedDataManager.CloudSync.Client + * @since 11 + */ + LOCAL, + /** + * Indicates the data source is cloud. + * + * @syscap SystemCapability.DistributedDataManager.CloudSync.Client + * @since 11 + */ + CLOUD, + /** + * Indicates the data source is remote. + * + * @syscap SystemCapability.DistributedDataManager.CloudSync.Client + * @since 11 + */ + REMOTE + } + /** + * Enumerates the field. + * + * @enum { string } + * @syscap SystemCapability.DistributedDataManager.CloudSync.Client + * @since 11 + */ + enum Field { + /** + * Cursor field. + * + * @syscap SystemCapability.DistributedDataManager.CloudSync.Client + * @since 11 + */ + CURSOR_FIELD = '#_cursor', + /** + * Origin field. For details, see {@link Origin}. + * + * @syscap SystemCapability.DistributedDataManager.CloudSync.Client + * @since 11 + */ + ORIGIN_FIELD = '#_origin', + /** + * Deleted flag field. + * Indicates whether data has deleted in cloud. + * + * @syscap SystemCapability.DistributedDataManager.CloudSync.Client + * @since 11 + */ + DELETED_FLAG_FIELD = '#_deleted_flag', + /** + * Owner field. + * + * @syscap SystemCapability.DistributedDataManager.CloudSync.Client + * @since 11 + */ + OWNER_FIELD = '#_cloud_owner', + /** + * Privilege field. + * + * @syscap SystemCapability.DistributedDataManager.CloudSync.Client + * @since 11 + */ + PRIVILEGE_FIELD = '#_cloud_privilege', + /** + * Sharing resource field. + * + * @syscap SystemCapability.DistributedDataManager.CloudSync.Client + * @since 11 + */ + SHARING_RESOURCE_FIELD = '#_sharing_resource_field' + } + /** + * Enumerates the type of rebuild. + * + * @enum { number } + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 12 + */ + enum RebuildType { + /** + * The database is not rebuilt. + * + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 12 + */ + NONE, + /** + * The database is rebuilt. + * + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 12 + */ + REBUILT + } + /** + * Manages relational database configurations. + * + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 9 + */ + /** + * Manages relational database configurations. + * + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @crossplatform + * @since 10 + */ + class RdbPredicates { + /** + * A parameterized constructor used to create a RdbPredicates instance. + * + * @param { string } name - Indicates the table name of the database. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 9 + */ + /** + * A parameterized constructor used to create a RdbPredicates instance. + * + * @param { string } name - Indicates the table name of the database. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @crossplatform + * @since 10 + */ + constructor(name: string); + /** + * Specifies remote devices which connect to local device when syncing distributed database. + * When query database, this function should not be called. + * + * @param { Array } devices - Indicates specified remote devices. + * @returns { RdbPredicates } - The {@link RdbPredicates} self. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 9 + */ + inDevices(devices: Array): RdbPredicates; + /** + * Specifies all remote devices which connect to local device when syncing distributed database. + * When query database, this function should not be called. + * + * @returns { RdbPredicates } - The {@link RdbPredicates} self. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 9 + */ + inAllDevices(): RdbPredicates; + /** + * Configure the RdbPredicates to match the field whose data type is ValueType and value is equal + * to a specified value. + * This method is similar to = of the SQL statement. + * + * @param { string } field - Indicates the column name in the database table. + * @param { ValueType } value - Indicates the value to match with the {@link RdbPredicates}. + * @returns { RdbPredicates } - The {@link RdbPredicates} self. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 9 + */ + /** + * Configure the RdbPredicates to match the field whose data type is ValueType and value is equal + * to a specified value. + * This method is similar to = of the SQL statement. + * + * @param { string } field - Indicates the column name in the database table. + * @param { ValueType } value - Indicates the value to match with the {@link RdbPredicates}. + * @returns { RdbPredicates } - The {@link RdbPredicates} self. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @crossplatform + * @since 10 + */ + equalTo(field: string, value: ValueType): RdbPredicates; + /** + * Configure the RdbPredicates to match the field whose data type is ValueType and value is not equal to + * a specified value. + * This method is similar to != of the SQL statement. + * + * @param { string } field - Indicates the column name in the database table. + * @param { ValueType } value - Indicates the value to match with the {@link RdbPredicates}. + * @returns { RdbPredicates } - The {@link RdbPredicates} self. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 9 + */ + /** + * Configure the RdbPredicates to match the field whose data type is ValueType and value is not equal to + * a specified value. + * This method is similar to != of the SQL statement. + * + * @param { string } field - Indicates the column name in the database table. + * @param { ValueType } value - Indicates the value to match with the {@link RdbPredicates}. + * @returns { RdbPredicates } - The {@link RdbPredicates} self. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @crossplatform + * @since 10 + */ + notEqualTo(field: string, value: ValueType): RdbPredicates; + /** + * Adds a left parenthesis to the RdbPredicates. + * This method is similar to ( of the SQL statement and needs to be used together with endWrap(). + * + * @returns { RdbPredicates } - The {@link RdbPredicates} with the left parenthesis. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 9 + */ + /** + * Adds a left parenthesis to the RdbPredicates. + * This method is similar to ( of the SQL statement and needs to be used together with endWrap(). + * + * @returns { RdbPredicates } - The {@link RdbPredicates} with the left parenthesis. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @crossplatform + * @since 10 + */ + beginWrap(): RdbPredicates; + /** + * Adds a right parenthesis to the RdbPredicates. + * This method is similar to ) of the SQL statement and needs to be used together with beginWrap(). + * + * @returns { RdbPredicates } - The {@link RdbPredicates} with the right parenthesis. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 9 + */ + /** + * Adds a right parenthesis to the RdbPredicates. + * This method is similar to ) of the SQL statement and needs to be used together with beginWrap(). + * + * @returns { RdbPredicates } - The {@link RdbPredicates} with the right parenthesis. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @crossplatform + * @since 10 + */ + endWrap(): RdbPredicates; + /** + * Adds an or condition to the RdbPredicates. + * This method is similar to or of the SQL statement. + * + * @returns { RdbPredicates } - The {@link RdbPredicates} with the or condition. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 9 + */ + /** + * Adds an or condition to the RdbPredicates. + * This method is similar to or of the SQL statement. + * + * @returns { RdbPredicates } - The {@link RdbPredicates} with the or condition. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @crossplatform + * @since 10 + */ + or(): RdbPredicates; + /** + * Adds an and condition to the RdbPredicates. + * This method is similar to and of the SQL statement. + * + * @returns { RdbPredicates } - The {@link RdbPredicates} with the and condition. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 9 + */ + /** + * Adds an and condition to the RdbPredicates. + * This method is similar to and of the SQL statement. + * + * @returns { RdbPredicates } - The {@link RdbPredicates} with the and condition. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @crossplatform + * @since 10 + */ + and(): RdbPredicates; + /** + * Configure the RdbPredicates to match the field whose data type is string and value + * contains a specified value. + * This method is similar to contains of the SQL statement. + * + * @param { string } field - Indicates the column name in the database table. + * @param { string } value - Indicates the value to match with the {@link RdbPredicates}. + * @returns { RdbPredicates } - The {@link RdbPredicates} self. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 9 + */ + /** + * Configure the RdbPredicates to match the field whose data type is string and value + * contains a specified value. + * This method is similar to contains of the SQL statement. + * + * @param { string } field - Indicates the column name in the database table. + * @param { string } value - Indicates the value to match with the {@link RdbPredicates}. + * @returns { RdbPredicates } - The {@link RdbPredicates} self. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @crossplatform + * @since 10 + */ + contains(field: string, value: string): RdbPredicates; + /** + * Configure the RdbPredicates to match the field whose data type is string and value starts + * with a specified string. + * This method is similar to value% of the SQL statement. + * + * @param { string } field - Indicates the column name in the database table. + * @param { string } value - Indicates the value to match with the {@link RdbPredicates}. + * @returns { RdbPredicates } - The {@link RdbPredicates} self. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 9 + */ + /** + * Configure the RdbPredicates to match the field whose data type is string and value starts + * with a specified string. + * This method is similar to value% of the SQL statement. + * + * @param { string } field - Indicates the column name in the database table. + * @param { string } value - Indicates the value to match with the {@link RdbPredicates}. + * @returns { RdbPredicates } - The {@link RdbPredicates} self. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @crossplatform + * @since 10 + */ + beginsWith(field: string, value: string): RdbPredicates; + /** + * Configure the RdbPredicates to match the field whose data type is string and value + * ends with a specified string. + * This method is similar to %value of the SQL statement. + * + * @param { string } field - Indicates the column name in the database table. + * @param { string } value - Indicates the value to match with the {@link RdbPredicates}. + * @returns { RdbPredicates } - The {@link RdbPredicates} self. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 9 + */ + /** + * Configure the RdbPredicates to match the field whose data type is string and value + * ends with a specified string. + * This method is similar to %value of the SQL statement. + * + * @param { string } field - Indicates the column name in the database table. + * @param { string } value - Indicates the value to match with the {@link RdbPredicates}. + * @returns { RdbPredicates } - The {@link RdbPredicates} self. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @crossplatform + * @since 10 + */ + endsWith(field: string, value: string): RdbPredicates; + /** + * Configure the RdbPredicates to match the fields whose value is null. + * This method is similar to is null of the SQL statement. + * + * @param { string } field - Indicates the column name in the database table. + * @returns { RdbPredicates } - The {@link RdbPredicates} self. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 9 + */ + /** + * Configure the RdbPredicates to match the fields whose value is null. + * This method is similar to is null of the SQL statement. + * + * @param { string } field - Indicates the column name in the database table. + * @returns { RdbPredicates } - The {@link RdbPredicates} self. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @crossplatform + * @since 10 + */ + isNull(field: string): RdbPredicates; + /** + * Configure the RdbPredicates to match the specified fields whose value is not null. + * This method is similar to is not null of the SQL statement. + * + * @param { string } field - Indicates the column name in the database table. + * @returns { RdbPredicates } - The {@link RdbPredicates} self. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 9 + */ + /** + * Configure the RdbPredicates to match the specified fields whose value is not null. + * This method is similar to is not null of the SQL statement. + * + * @param { string } field - Indicates the column name in the database table. + * @returns { RdbPredicates } - The {@link RdbPredicates} self. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @crossplatform + * @since 10 + */ + isNotNull(field: string): RdbPredicates; + /** + * Configure the RdbPredicates to match the fields whose data type is string and value is + * similar to a specified string. + * This method is similar to like of the SQL statement. + * + * @param { string } field - Indicates the column name in the database table. + * @param { string } value - Indicates the value to match with the {@link RdbPredicates}. + * @returns { RdbPredicates } - The {@link RdbPredicates} that match the specified field. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 9 + */ + /** + * Configure the RdbPredicates to match the fields whose data type is string and value is + * similar to a specified string. + * This method is similar to like of the SQL statement. + * + * @param { string } field - Indicates the column name in the database table. + * @param { string } value - Indicates the value to match with the {@link RdbPredicates}. + * @returns { RdbPredicates } - The {@link RdbPredicates} that match the specified field. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @crossplatform + * @since 10 + */ + like(field: string, value: string): RdbPredicates; + /** + * Configure RdbPredicates to match the specified field whose data type is string and the value contains + * a wildcard. + * Different from like, the input parameters of this method are case-sensitive. + * + * @param { string } field - Indicates the column name in the database table. + * @param { string } value - Indicates the value to match with the {@link RdbPredicates}. + * @returns { RdbPredicates } - The SQL statement with the specified {@link RdbPredicates}. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 9 + */ + /** + * Configure RdbPredicates to match the specified field whose data type is string and the value contains + * a wildcard. + * Different from like, the input parameters of this method are case-sensitive. + * + * @param { string } field - Indicates the column name in the database table. + * @param { string } value - Indicates the value to match with the {@link RdbPredicates}. + * @returns { RdbPredicates } - The SQL statement with the specified {@link RdbPredicates}. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @crossplatform + * @since 10 + */ + glob(field: string, value: string): RdbPredicates; + /** + * Configure RdbPredicates to match the specified field whose value is within a given range. + * + * @param { string } field - Indicates the column name. + * @param { ValueType } low - Indicates the minimum value. + * @param { ValueType } high - Indicates the maximum value. + * @returns { RdbPredicates } - The SQL statement with the specified {@link RdbPredicates}. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 9 + */ + /** + * Configure RdbPredicates to match the specified field whose value is within a given range. + * + * @param { string } field - Indicates the column name. + * @param { ValueType } low - Indicates the minimum value. + * @param { ValueType } high - Indicates the maximum value. + * @returns { RdbPredicates } - The SQL statement with the specified {@link RdbPredicates}. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @crossplatform + * @since 10 + */ + between(field: string, low: ValueType, high: ValueType): RdbPredicates; + /** + * Configure RdbPredicates to match the specified field whose value is out of a given range. + * + * @param { string } field - Indicates the column name in the database table. + * @param { ValueType } low - Indicates the minimum value. + * @param { ValueType } high - Indicates the maximum value. + * @returns { RdbPredicates } - The SQL statement with the specified {@link RdbPredicates}. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 9 + */ + /** + * Configure RdbPredicates to match the specified field whose value is out of a given range. + * + * @param { string } field - Indicates the column name in the database table. + * @param { ValueType } low - Indicates the minimum value. + * @param { ValueType } high - Indicates the maximum value. + * @returns { RdbPredicates } - The SQL statement with the specified {@link RdbPredicates}. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @crossplatform + * @since 10 + */ + notBetween(field: string, low: ValueType, high: ValueType): RdbPredicates; + /** + * Restricts the value of the field to be greater than the specified value. + * + * @param { string } field - Indicates the column name in the database table. + * @param { ValueType } value - Indicates the value to match with the {@link RdbPredicates}. + * @returns { RdbPredicates } - The SQL query statement with the specified {@link RdbPredicates}. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 9 + */ + /** + * Restricts the value of the field to be greater than the specified value. + * + * @param { string } field - Indicates the column name in the database table. + * @param { ValueType } value - Indicates the value to match with the {@link RdbPredicates}. + * @returns { RdbPredicates } - The SQL query statement with the specified {@link RdbPredicates}. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @crossplatform + * @since 10 + */ + greaterThan(field: string, value: ValueType): RdbPredicates; + /** + * Restricts the value of the field to be smaller than the specified value. + * + * @param { string } field - Indicates the column name in the database table. + * @param { ValueType } value - Indicates the value to match with the {@link RdbPredicates}. + * @returns { RdbPredicates } - The SQL query statement with the specified {@link RdbPredicates}. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 9 + */ + /** + * Restricts the value of the field to be smaller than the specified value. + * + * @param { string } field - Indicates the column name in the database table. + * @param { ValueType } value - Indicates the value to match with the {@link RdbPredicates}. + * @returns { RdbPredicates } - The SQL query statement with the specified {@link RdbPredicates}. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @crossplatform + * @since 10 + */ + lessThan(field: string, value: ValueType): RdbPredicates; + /** + * Restricts the value of the field to be greater than or equal to the specified value. + * + * @param { string } field - Indicates the column name in the database table. + * @param { ValueType } value - Indicates the value to match with the {@link RdbPredicates}. + * @returns { RdbPredicates } - The SQL query statement with the specified {@link RdbPredicates}. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 9 + */ + /** + * Restricts the value of the field to be greater than or equal to the specified value. + * + * @param { string } field - Indicates the column name in the database table. + * @param { ValueType } value - Indicates the value to match with the {@link RdbPredicates}. + * @returns { RdbPredicates } - The SQL query statement with the specified {@link RdbPredicates}. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @crossplatform + * @since 10 + */ + greaterThanOrEqualTo(field: string, value: ValueType): RdbPredicates; + /** + * Restricts the value of the field to be smaller than or equal to the specified value. + * + * @param { string } field - Indicates the column name in the database table. + * @param { ValueType } value - Indicates the value to match with the {@link RdbPredicates}. + * @returns { RdbPredicates } - The SQL query statement with the specified {@link RdbPredicates}. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 9 + */ + /** + * Restricts the value of the field to be smaller than or equal to the specified value. + * + * @param { string } field - Indicates the column name in the database table. + * @param { ValueType } value - Indicates the value to match with the {@link RdbPredicates}. + * @returns { RdbPredicates } - The SQL query statement with the specified {@link RdbPredicates}. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @crossplatform + * @since 10 + */ + lessThanOrEqualTo(field: string, value: ValueType): RdbPredicates; + /** + * Restricts the ascending order of the return list. When there are several orders, + * the one close to the head has the highest priority. + * + * @param { string } field - Indicates the column name for sorting the return list. + * @returns { RdbPredicates } - The SQL query statement with the specified {@link RdbPredicates}. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 9 + */ + /** + * Restricts the ascending order of the return list. When there are several orders, + * the one close to the head has the highest priority. + * + * @param { string } field - Indicates the column name for sorting the return list. + * @returns { RdbPredicates } - The SQL query statement with the specified {@link RdbPredicates}. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @crossplatform + * @since 10 + */ + orderByAsc(field: string): RdbPredicates; + /** + * Restricts the descending order of the return list. When there are several orders, + * the one close to the head has the highest priority. + * + * @param { string } field - Indicates the column name for sorting the return list. + * @returns { RdbPredicates } - The SQL query statement with the specified {@link RdbPredicates}. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 9 + */ + /** + * Restricts the descending order of the return list. When there are several orders, + * the one close to the head has the highest priority. + * + * @param { string } field - Indicates the column name for sorting the return list. + * @returns { RdbPredicates } - The SQL query statement with the specified {@link RdbPredicates}. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @crossplatform + * @since 10 + */ + orderByDesc(field: string): RdbPredicates; + /** + * Restricts each row of the query result to be unique. + * + * @returns { RdbPredicates } - The SQL query statement with the specified {@link RdbPredicates}. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 9 + */ + /** + * Restricts each row of the query result to be unique. + * + * @returns { RdbPredicates } - The SQL query statement with the specified {@link RdbPredicates}. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @crossplatform + * @since 10 + */ + distinct(): RdbPredicates; + /** + * Restricts the max number of return records. + * + * @param { number } value - Indicates the max length of the return list. + * @returns { RdbPredicates } - The SQL query statement with the specified {@link RdbPredicates}. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 9 + */ + /** + * Restricts the max number of return records. + * + * @param { number } value - Indicates the max length of the return list. + * @returns { RdbPredicates } - The SQL query statement with the specified {@link RdbPredicates}. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @crossplatform + * @since 10 + */ + limitAs(value: number): RdbPredicates; + /** + * Configure RdbPredicates to specify the start position of the returned result. + * Use this method together with limit(number). + * + * @param { number } rowOffset - Indicates the start position of the returned result. The value is a positive integer. + * @returns { RdbPredicates } - The SQL query statement with the specified {@link RdbPredicates}. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 9 + */ + /** + * Configure RdbPredicates to specify the start position of the returned result. + * Use this method together with limit(number). + * + * @param { number } rowOffset - Indicates the start position of the returned result. The value is a positive integer. + * @returns { RdbPredicates } - The SQL query statement with the specified {@link RdbPredicates}. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @crossplatform + * @since 10 + */ + offsetAs(rowOffset: number): RdbPredicates; + /** + * Configure RdbPredicates to group query results by specified columns. + * + * @param { Array } fields - Indicates the specified columns by which query results are grouped. + * @returns { RdbPredicates } - The SQL query statement with the specified {@link RdbPredicates}. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 9 + */ + /** + * Configure RdbPredicates to group query results by specified columns. + * + * @param { Array } fields - Indicates the specified columns by which query results are grouped. + * @returns { RdbPredicates } - The SQL query statement with the specified {@link RdbPredicates}. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @crossplatform + * @since 10 + */ + groupBy(fields: Array): RdbPredicates; + /** + * Configure RdbPredicates to specify the index column. + * Before using this method, you need to create an index column. + * + * @param { string } field - Indicates the name of the index column. + * @returns { RdbPredicates } - The SQL statement with the specified {@link RdbPredicates}. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 9 + */ + /** + * Configure RdbPredicates to specify the index column. + * Before using this method, you need to create an index column. + * + * @param { string } field - Indicates the name of the index column. + * @returns { RdbPredicates } - The SQL statement with the specified {@link RdbPredicates}. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @crossplatform + * @since 10 + */ + indexedBy(field: string): RdbPredicates; + /** + * Configure RdbPredicates to match the specified field whose data type is ValueType array and values + * are within a given range. + * + * @param { string } field - Indicates the column name in the database table. + * @param { Array } value - Indicates the values to match with {@link RdbPredicates}. + * @returns { RdbPredicates } - The SQL statement with the specified {@link RdbPredicates}. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 9 + */ + /** + * Configure RdbPredicates to match the specified field whose data type is ValueType array and values + * are within a given range. + * + * @param { string } field - Indicates the column name in the database table. + * @param { Array } value - Indicates the values to match with {@link RdbPredicates}. + * @returns { RdbPredicates } - The SQL statement with the specified {@link RdbPredicates}. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @crossplatform + * @since 10 + */ + in(field: string, value: Array): RdbPredicates; + /** + * Configure RdbPredicates to match the specified field whose data type is ValueType array and values + * are out of a given range. + * + * @param { string } field - Indicates the column name in the database table. + * @param { Array } value - Indicates the values to match with {@link RdbPredicates}. + * @returns { RdbPredicates } - The SQL statement with the specified {@link RdbPredicates}. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 9 + */ + /** + * Configure RdbPredicates to match the specified field whose data type is ValueType array and values + * are out of a given range. + * + * @param { string } field - Indicates the column name in the database table. + * @param { Array } value - Indicates the values to match with {@link RdbPredicates}. + * @returns { RdbPredicates } - The SQL statement with the specified {@link RdbPredicates}. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @crossplatform + * @since 10 + */ + notIn(field: string, value: Array): RdbPredicates; + /** + * Sets the RdbPredicates to match the field whose data type is string and value + * does not contain the specified value. + * This method is similar to "Not like %value%" of the SQL statement. + * + * @param { string } field - Indicates the column name in the database table. + * @param { string } value - Indicates the value that is not contained. + * @returns { RdbPredicates } - The {@Link RdbPredicates} set. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 12 + */ + notContains(field: string, value: string): RdbPredicates; + /** + * Sets the RdbPredicates to match the field whose data type is string and value + * is not like the specified value. + * This method is similar to "Not like" of the SQL statement. + * + * @param { string } field - Indicates the column name in the database table. + * @param { string } value - Indicates the value to compare against. + * @returns { RdbPredicates } - The {@Link RdbPredicates} set. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 12 + */ + notLike(field: string, value: string): RdbPredicates; + } + /** + * Provides methods for accessing a database result set generated by querying the database. + * + * @interface ResultSet + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 9 + */ + /** + * Provides methods for accessing a database result set generated by querying the database. + * + * @interface ResultSet + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @crossplatform + * @since 10 + */ + interface ResultSet { + /** + * Obtains the names of all columns in a result set. + * The column names are returned as a string array, in which the strings are in the same order + * as the columns in the result set. + * + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 9 + */ + /** + * Obtains the names of all columns in a result set. + * The column names are returned as a string array, in which the strings are in the same order + * as the columns in the result set. + * + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @crossplatform + * @since 10 + */ + columnNames: Array; + /** + * Obtains the number of columns in the result set. + * The returned number is equal to the length of the string array returned by the + * columnNames method. + * + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 9 + */ + /** + * Obtains the number of columns in the result set. + * The returned number is equal to the length of the string array returned by the + * columnNames method. + * + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @crossplatform + * @since 10 + */ + columnCount: number; + /** + * Obtains the number of rows in the result set. + * + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 9 + */ + /** + * Obtains the number of rows in the result set. + * + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @crossplatform + * @since 10 + */ + rowCount: number; + /** + * Obtains the current index of the result set. + * The result set index starts from 0. + * + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 9 + */ + /** + * Obtains the current index of the result set. + * The result set index starts from 0. + * + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @crossplatform + * @since 10 + */ + rowIndex: number; + /** + * Checks whether the cursor is positioned at the first row. + * + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 9 + */ + /** + * Checks whether the cursor is positioned at the first row. + * + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @crossplatform + * @since 10 + */ + isAtFirstRow: boolean; + /** + * Checks whether the cursor is positioned at the last row. + * + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 9 + */ + /** + * Checks whether the cursor is positioned at the last row. + * + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @crossplatform + * @since 10 + */ + isAtLastRow: boolean; + /** + * Checks whether the cursor is positioned after the last row. + * + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 9 + */ + /** + * Checks whether the cursor is positioned after the last row. + * + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @crossplatform + * @since 10 + */ + isEnded: boolean; + /** + * Checks whether the cursor is positioned before the first row. + * + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 9 + */ + /** + * Checks whether the cursor is positioned before the first row. + * + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @crossplatform + * @since 10 + */ + isStarted: boolean; + /** + * Checks whether the current result set is closed. + * If the result set is closed by calling the close method, true will be returned. + * + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 9 + */ + /** + * Checks whether the current result set is closed. + * If the result set is closed by calling the close method, true will be returned. + * + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @crossplatform + * @since 10 + */ + isClosed: boolean; + /** + * Obtains the column index based on the specified column name. + * The column name is passed as an input parameter. + * + * @param { string } columnName - Indicates the name of the specified column in the result set. + * @returns { number } The index of the specified column. + * @throws { BusinessError } 14800013 - The column value is null or the column type is incompatible. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 9 + */ + /** + * Obtains the column index based on the specified column name. + * The column name is passed as an input parameter. + * + * @param { string } columnName - Indicates the name of the specified column in the result set. + * @returns { number } The index of the specified column. + * @throws { BusinessError } 14800013 - The column value is null or the column type is incompatible. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @crossplatform + * @since 10 + */ + /** + * Obtains the column index based on the specified column name. + * The column name is passed as an input parameter. + * + * @param { string } columnName - Indicates the name of the specified column in the result set. + * @returns { number } The index of the specified column. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @throws { BusinessError } 14800000 - Inner error. + * @throws { BusinessError } 14800011 - Database corrupted. + * @throws { BusinessError } 14800013 - Column out of bounds. + * @throws { BusinessError } 14800014 - Already closed. + * @throws { BusinessError } 14800019 - The SQL must be a query statement. + * @throws { BusinessError } 14800021 - SQLite: Generic error. + * @throws { BusinessError } 14800022 - SQLite: Callback routine requested an abort. + * @throws { BusinessError } 14800023 - SQLite: Access permission denied. + * @throws { BusinessError } 14800024 - SQLite: The database file is locked. + * @throws { BusinessError } 14800025 - SQLite: A table in the database is locked. + * @throws { BusinessError } 14800026 - SQLite: The database is out of memory. + * @throws { BusinessError } 14800027 - SQLite: Attempt to write a readonly database. + * @throws { BusinessError } 14800028 - SQLite: Some kind of disk I/O error occurred. + * @throws { BusinessError } 14800029 - SQLite: The database is full. + * @throws { BusinessError } 14800030 - SQLite: Unable to open the database file. + * @throws { BusinessError } 14800031 - SQLite: TEXT or BLOB exceeds size limit. + * @throws { BusinessError } 14800032 - SQLite: Abort due to constraint violation. + * @throws { BusinessError } 14800033 - SQLite: Data type mismatch. + * @throws { BusinessError } 14800034 - SQLite: Library used incorrectly. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @crossplatform + * @since 12 + */ + getColumnIndex(columnName: string): number; + /** + * Obtains the column name based on the specified column index. + * The column index is passed as an input parameter. + * + * @param { number } columnIndex - Indicates the index of the specified column in the result set. + * @returns { string } The name of the specified column. + * @throws { BusinessError } 14800013 - The column value is null or the column type is incompatible. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 9 + */ + /** + * Obtains the column name based on the specified column index. + * The column index is passed as an input parameter. + * + * @param { number } columnIndex - Indicates the index of the specified column in the result set. + * @returns { string } The name of the specified column. + * @throws { BusinessError } 14800013 - The column value is null or the column type is incompatible. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @crossplatform + * @since 10 + */ + /** + * Obtains the column name based on the specified column index. + * The column index is passed as an input parameter. + * + * @param { number } columnIndex - Indicates the index of the specified column in the result set. + * @returns { string } The name of the specified column. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @throws { BusinessError } 14800000 - Inner error. + * @throws { BusinessError } 14800011 - Database corrupted. + * @throws { BusinessError } 14800013 - Column out of bounds. + * @throws { BusinessError } 14800014 - Already closed. + * @throws { BusinessError } 14800019 - The SQL must be a query statement. + * @throws { BusinessError } 14800021 - SQLite: Generic error. + * @throws { BusinessError } 14800022 - SQLite: Callback routine requested an abort. + * @throws { BusinessError } 14800023 - SQLite: Access permission denied. + * @throws { BusinessError } 14800024 - SQLite: The database file is locked. + * @throws { BusinessError } 14800025 - SQLite: A table in the database is locked. + * @throws { BusinessError } 14800026 - SQLite: The database is out of memory. + * @throws { BusinessError } 14800027 - SQLite: Attempt to write a readonly database. + * @throws { BusinessError } 14800028 - SQLite: Some kind of disk I/O error occurred. + * @throws { BusinessError } 14800029 - SQLite: The database is full. + * @throws { BusinessError } 14800030 - SQLite: Unable to open the database file. + * @throws { BusinessError } 14800031 - SQLite: TEXT or BLOB exceeds size limit. + * @throws { BusinessError } 14800032 - SQLite: Abort due to constraint violation. + * @throws { BusinessError } 14800033 - SQLite: Data type mismatch. + * @throws { BusinessError } 14800034 - SQLite: Library used incorrectly. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @crossplatform + * @since 12 + */ + getColumnName(columnIndex: number): string; + /** + * Go to the specified row of the result set forwards or backwards by an offset relative to its current position. + * A positive offset indicates moving backwards, and a negative offset indicates moving forwards. + * + * @param { number } offset - Indicates the offset relative to the current position. + * @returns { boolean } True if the result set is moved successfully and does not go beyond the range; + * Returns false otherwise. + * @throws { BusinessError } 14800012 - The result set is empty or the specified location is invalid. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 9 + */ + /** + * Go to the specified row of the result set forwards or backwards by an offset relative to its current position. + * A positive offset indicates moving backwards, and a negative offset indicates moving forwards. + * + * @param { number } offset - Indicates the offset relative to the current position. + * @returns { boolean } True if the result set is moved successfully and does not go beyond the range; + * Returns false otherwise. + * @throws { BusinessError } 14800012 - The result set is empty or the specified location is invalid. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @crossplatform + * @since 10 + */ + /** + * Go to the specified row of the result set forwards or backwards by an offset relative to its current position. + * A positive offset indicates moving backwards, and a negative offset indicates moving forwards. + * + * @param { number } offset - Indicates the offset relative to the current position. + * @returns { boolean } True if the result set is moved successfully and does not go beyond the range; + * Returns false otherwise. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @throws { BusinessError } 14800000 - Inner error. + * @throws { BusinessError } 14800011 - Database corrupted. + * @throws { BusinessError } 14800012 - Row out of bounds. + * @throws { BusinessError } 14800014 - Already closed. + * @throws { BusinessError } 14800019 - The SQL must be a query statement. + * @throws { BusinessError } 14800021 - SQLite: Generic error. + * @throws { BusinessError } 14800022 - SQLite: Callback routine requested an abort. + * @throws { BusinessError } 14800023 - SQLite: Access permission denied. + * @throws { BusinessError } 14800024 - SQLite: The database file is locked. + * @throws { BusinessError } 14800025 - SQLite: A table in the database is locked. + * @throws { BusinessError } 14800026 - SQLite: The database is out of memory. + * @throws { BusinessError } 14800027 - SQLite: Attempt to write a readonly database. + * @throws { BusinessError } 14800028 - SQLite: Some kind of disk I/O error occurred. + * @throws { BusinessError } 14800029 - SQLite: The database is full. + * @throws { BusinessError } 14800030 - SQLite: Unable to open the database file. + * @throws { BusinessError } 14800031 - SQLite: TEXT or BLOB exceeds size limit. + * @throws { BusinessError } 14800032 - SQLite: Abort due to constraint violation. + * @throws { BusinessError } 14800033 - SQLite: Data type mismatch. + * @throws { BusinessError } 14800034 - SQLite: Library used incorrectly. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @crossplatform + * @since 12 + */ + goTo(offset: number): boolean; + /** + * Go to the specified row of the result set. + * + * @param { number } position - Indicates the index of the specified row, which starts from 0. + * @returns { boolean } True if the result set is moved successfully; Returns false otherwise. + * @throws { BusinessError } 14800012 - The result set is empty or the specified location is invalid. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 9 + */ + /** + * Go to the specified row of the result set. + * + * @param { number } position - Indicates the index of the specified row, which starts from 0. + * @returns { boolean } True if the result set is moved successfully; Returns false otherwise. + * @throws { BusinessError } 14800012 - The result set is empty or the specified location is invalid. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @crossplatform + * @since 10 + */ + /** + * Go to the specified row of the result set. + * + * @param { number } position - Indicates the index of the specified row, which starts from 0. + * @returns { boolean } True if the result set is moved successfully; Returns false otherwise. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @throws { BusinessError } 14800000 - Inner error. + * @throws { BusinessError } 14800011 - Database corrupted. + * @throws { BusinessError } 14800012 - Row out of bounds. + * @throws { BusinessError } 14800014 - Already closed. + * @throws { BusinessError } 14800019 - The SQL must be a query statement. + * @throws { BusinessError } 14800021 - SQLite: Generic error. + * @throws { BusinessError } 14800022 - SQLite: Callback routine requested an abort. + * @throws { BusinessError } 14800023 - SQLite: Access permission denied. + * @throws { BusinessError } 14800024 - SQLite: The database file is locked. + * @throws { BusinessError } 14800025 - SQLite: A table in the database is locked. + * @throws { BusinessError } 14800026 - SQLite: The database is out of memory. + * @throws { BusinessError } 14800027 - SQLite: Attempt to write a readonly database. + * @throws { BusinessError } 14800028 - SQLite: Some kind of disk I/O error occurred. + * @throws { BusinessError } 14800029 - SQLite: The database is full. + * @throws { BusinessError } 14800030 - SQLite: Unable to open the database file. + * @throws { BusinessError } 14800031 - SQLite: TEXT or BLOB exceeds size limit. + * @throws { BusinessError } 14800032 - SQLite: Abort due to constraint violation. + * @throws { BusinessError } 14800033 - SQLite: Data type mismatch. + * @throws { BusinessError } 14800034 - SQLite: Library used incorrectly. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @crossplatform + * @since 12 + */ + goToRow(position: number): boolean; + /** + * Go to the first row of the result set. + * + * @returns { boolean } True if the result set is moved successfully; + * Returns false otherwise, for example, if the result set is empty. + * @throws { BusinessError } 14800012 - The result set is empty or the specified location is invalid. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 9 + */ + /** + * Go to the first row of the result set. + * + * @returns { boolean } True if the result set is moved successfully; + * Returns false otherwise, for example, if the result set is empty. + * @throws { BusinessError } 14800012 - The result set is empty or the specified location is invalid. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @crossplatform + * @since 10 + */ + /** + * Go to the first row of the result set. + * + * @returns { boolean } True if the result set is moved successfully; + * Returns false otherwise, for example, if the result set is empty. + * @throws { BusinessError } 14800000 - Inner error. + * @throws { BusinessError } 14800011 - Database corrupted. + * @throws { BusinessError } 14800012 - Row out of bounds. + * @throws { BusinessError } 14800014 - Already closed. + * @throws { BusinessError } 14800019 - The SQL must be a query statement. + * @throws { BusinessError } 14800021 - SQLite: Generic error. + * @throws { BusinessError } 14800022 - SQLite: Callback routine requested an abort. + * @throws { BusinessError } 14800023 - SQLite: Access permission denied. + * @throws { BusinessError } 14800024 - SQLite: The database file is locked. + * @throws { BusinessError } 14800025 - SQLite: A table in the database is locked. + * @throws { BusinessError } 14800026 - SQLite: The database is out of memory. + * @throws { BusinessError } 14800027 - SQLite: Attempt to write a readonly database. + * @throws { BusinessError } 14800028 - SQLite: Some kind of disk I/O error occurred. + * @throws { BusinessError } 14800029 - SQLite: The database is full. + * @throws { BusinessError } 14800030 - SQLite: Unable to open the database file. + * @throws { BusinessError } 14800031 - SQLite: TEXT or BLOB exceeds size limit. + * @throws { BusinessError } 14800032 - SQLite: Abort due to constraint violation. + * @throws { BusinessError } 14800033 - SQLite: Data type mismatch. + * @throws { BusinessError } 14800034 - SQLite: Library used incorrectly. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @crossplatform + * @since 12 + */ + goToFirstRow(): boolean; + /** + * Go to the last row of the result set. + * + * @returns { boolean } True if the result set is moved successfully; + * Returns false otherwise, for example, if the result set is empty. + * @throws { BusinessError } 14800012 - The result set is empty or the specified location is invalid. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 9 + */ + /** + * Go to the last row of the result set. + * + * @returns { boolean } True if the result set is moved successfully; + * Returns false otherwise, for example, if the result set is empty. + * @throws { BusinessError } 14800012 - The result set is empty or the specified location is invalid. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @crossplatform + * @since 10 + */ + /** + * Go to the last row of the result set. + * + * @returns { boolean } True if the result set is moved successfully; + * Returns false otherwise, for example, if the result set is empty. + * @throws { BusinessError } 14800000 - Inner error. + * @throws { BusinessError } 14800011 - Database corrupted. + * @throws { BusinessError } 14800012 - Row out of bounds. + * @throws { BusinessError } 14800014 - Already closed. + * @throws { BusinessError } 14800019 - The SQL must be a query statement. + * @throws { BusinessError } 14800021 - SQLite: Generic error. + * @throws { BusinessError } 14800022 - SQLite: Callback routine requested an abort. + * @throws { BusinessError } 14800023 - SQLite: Access permission denied. + * @throws { BusinessError } 14800024 - SQLite: The database file is locked. + * @throws { BusinessError } 14800025 - SQLite: A table in the database is locked. + * @throws { BusinessError } 14800026 - SQLite: The database is out of memory. + * @throws { BusinessError } 14800027 - SQLite: Attempt to write a readonly database. + * @throws { BusinessError } 14800028 - SQLite: Some kind of disk I/O error occurred. + * @throws { BusinessError } 14800029 - SQLite: The database is full. + * @throws { BusinessError } 14800030 - SQLite: Unable to open the database file. + * @throws { BusinessError } 14800031 - SQLite: TEXT or BLOB exceeds size limit. + * @throws { BusinessError } 14800032 - SQLite: Abort due to constraint violation. + * @throws { BusinessError } 14800033 - SQLite: Data type mismatch. + * @throws { BusinessError } 14800034 - SQLite: Library used incorrectly. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @crossplatform + * @since 12 + */ + goToLastRow(): boolean; + /** + * Go to the next row of the result set. + * + * @returns { boolean } True if the result set is moved successfully; + * Returns false otherwise, for example, if the result set is already in the last row. + * @throws { BusinessError } 14800012 - The result set is empty or the specified location is invalid. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 9 + */ + /** + * Go to the next row of the result set. + * + * @returns { boolean } True if the result set is moved successfully; + * Returns false otherwise, for example, if the result set is already in the last row. + * @throws { BusinessError } 14800012 - The result set is empty or the specified location is invalid. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @crossplatform + * @since 10 + */ + /** + * Go to the next row of the result set. + * + * @returns { boolean } True if the result set is moved successfully; + * Returns false otherwise, for example, if the result set is already in the last row. + * @throws { BusinessError } 14800000 - Inner error. + * @throws { BusinessError } 14800011 - Database corrupted. + * @throws { BusinessError } 14800012 - Row out of bounds. + * @throws { BusinessError } 14800014 - Already closed. + * @throws { BusinessError } 14800019 - The SQL must be a query statement. + * @throws { BusinessError } 14800021 - SQLite: Generic error. + * @throws { BusinessError } 14800022 - SQLite: Callback routine requested an abort. + * @throws { BusinessError } 14800023 - SQLite: Access permission denied. + * @throws { BusinessError } 14800024 - SQLite: The database file is locked. + * @throws { BusinessError } 14800025 - SQLite: A table in the database is locked. + * @throws { BusinessError } 14800026 - SQLite: The database is out of memory. + * @throws { BusinessError } 14800027 - SQLite: Attempt to write a readonly database. + * @throws { BusinessError } 14800028 - SQLite: Some kind of disk I/O error occurred. + * @throws { BusinessError } 14800029 - SQLite: The database is full. + * @throws { BusinessError } 14800030 - SQLite: Unable to open the database file. + * @throws { BusinessError } 14800031 - SQLite: TEXT or BLOB exceeds size limit. + * @throws { BusinessError } 14800032 - SQLite: Abort due to constraint violation. + * @throws { BusinessError } 14800033 - SQLite: Data type mismatch. + * @throws { BusinessError } 14800034 - SQLite: Library used incorrectly. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @crossplatform + * @since 12 + */ + goToNextRow(): boolean; + /** + * Go to the previous row of the result set. + * + * @returns { boolean } True if the result set is moved successfully; + * Returns false otherwise, for example, if the result set is already in the first row. + * @throws { BusinessError } 14800012 - The result set is empty or the specified location is invalid. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 9 + */ + /** + * Go to the previous row of the result set. + * + * @returns { boolean } True if the result set is moved successfully; + * Returns false otherwise, for example, if the result set is already in the first row. + * @throws { BusinessError } 14800012 - The result set is empty or the specified location is invalid. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @crossplatform + * @since 10 + */ + /** + * Go to the previous row of the result set. + * + * @returns { boolean } True if the result set is moved successfully; + * Returns false otherwise, for example, if the result set is already in the first row. + * @throws { BusinessError } 14800000 - Inner error. + * @throws { BusinessError } 14800011 - Database corrupted. + * @throws { BusinessError } 14800012 - Row out of bounds. + * @throws { BusinessError } 14800014 - Already closed. + * @throws { BusinessError } 14800019 - The SQL must be a query statement. + * @throws { BusinessError } 14800021 - SQLite: Generic error. + * @throws { BusinessError } 14800022 - SQLite: Callback routine requested an abort. + * @throws { BusinessError } 14800023 - SQLite: Access permission denied. + * @throws { BusinessError } 14800024 - SQLite: The database file is locked. + * @throws { BusinessError } 14800025 - SQLite: A table in the database is locked. + * @throws { BusinessError } 14800026 - SQLite: The database is out of memory. + * @throws { BusinessError } 14800027 - SQLite: Attempt to write a readonly database. + * @throws { BusinessError } 14800028 - SQLite: Some kind of disk I/O error occurred. + * @throws { BusinessError } 14800029 - SQLite: The database is full. + * @throws { BusinessError } 14800030 - SQLite: Unable to open the database file. + * @throws { BusinessError } 14800031 - SQLite: TEXT or BLOB exceeds size limit. + * @throws { BusinessError } 14800032 - SQLite: Abort due to constraint violation. + * @throws { BusinessError } 14800033 - SQLite: Data type mismatch. + * @throws { BusinessError } 14800034 - SQLite: Library used incorrectly. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @crossplatform + * @since 12 + */ + goToPreviousRow(): boolean; + /** + * Obtains the value of the specified column in the current row as a byte array. + * The implementation class determines whether to throw an exception if the value of the specified column + * in the current row is null or the specified column is not of the Blob type. + * + * @param { number } columnIndex - Indicates the specified column index, which starts from 0. + * @returns { Uint8Array } The value of the specified column as a byte array. + * @throws { BusinessError } 14800013 - The column value is null or the column type is incompatible. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 9 + */ + /** + * Obtains the value of the specified column in the current row as a byte array. + * The implementation class determines whether to throw an exception if the value of the specified column + * in the current row is null or the specified column is not of the Blob type. + * + * @param { number } columnIndex - Indicates the specified column index, which starts from 0. + * @returns { Uint8Array } The value of the specified column as a byte array. + * @throws { BusinessError } 14800013 - The column value is null or the column type is incompatible. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @crossplatform + * @since 10 + */ + /** + * Obtains the value of the specified column in the current row as a byte array. + * The implementation class determines whether to throw an exception if the value of the specified column + * in the current row is null or the specified column is not of the Blob type. + * + * @param { number } columnIndex - Indicates the specified column index, which starts from 0. + * @returns { Uint8Array } The value of the specified column as a byte array. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @throws { BusinessError } 14800000 - Inner error. + * @throws { BusinessError } 14800011 - Database corrupted. + * @throws { BusinessError } 14800012 - Row out of bounds. + * @throws { BusinessError } 14800013 - Column out of bounds. + * @throws { BusinessError } 14800014 - Already closed. + * @throws { BusinessError } 14800021 - SQLite: Generic error. + * @throws { BusinessError } 14800022 - SQLite: Callback routine requested an abort. + * @throws { BusinessError } 14800023 - SQLite: Access permission denied. + * @throws { BusinessError } 14800024 - SQLite: The database file is locked. + * @throws { BusinessError } 14800025 - SQLite: A table in the database is locked. + * @throws { BusinessError } 14800026 - SQLite: The database is out of memory. + * @throws { BusinessError } 14800027 - SQLite: Attempt to write a readonly database. + * @throws { BusinessError } 14800028 - SQLite: Some kind of disk I/O error occurred. + * @throws { BusinessError } 14800029 - SQLite: The database is full. + * @throws { BusinessError } 14800030 - SQLite: Unable to open the database file. + * @throws { BusinessError } 14800031 - SQLite: TEXT or BLOB exceeds size limit. + * @throws { BusinessError } 14800032 - SQLite: Abort due to constraint violation. + * @throws { BusinessError } 14800033 - SQLite: Data type mismatch. + * @throws { BusinessError } 14800034 - SQLite: Library used incorrectly. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @crossplatform + * @since 12 + */ + getBlob(columnIndex: number): Uint8Array; + /** + * Obtains the value of the specified column in the current row as string. + * The implementation class determines whether to throw an exception if the value of the specified column + * in the current row is null or the specified column is not of the string type. + * + * @param { number } columnIndex - Indicates the specified column index, which starts from 0. + * @returns { string } The value of the specified column as a string. + * @throws { BusinessError } 14800013 - The column value is null or the column type is incompatible. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 9 + */ + /** + * Obtains the value of the specified column in the current row as string. + * The implementation class determines whether to throw an exception if the value of the specified column + * in the current row is null or the specified column is not of the string type. + * + * @param { number } columnIndex - Indicates the specified column index, which starts from 0. + * @returns { string } The value of the specified column as a string. + * @throws { BusinessError } 14800013 - The column value is null or the column type is incompatible. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @crossplatform + * @since 10 + */ + /** + * Obtains the value of the specified column in the current row as string. + * The implementation class determines whether to throw an exception if the value of the specified column + * in the current row is null or the specified column is not of the string type. + * + * @param { number } columnIndex - Indicates the specified column index, which starts from 0. + * @returns { string } The value of the specified column as a string. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @throws { BusinessError } 14800000 - Inner error. + * @throws { BusinessError } 14800011 - Database corrupted. + * @throws { BusinessError } 14800012 - Row out of bounds. + * @throws { BusinessError } 14800013 - Column out of bounds. + * @throws { BusinessError } 14800014 - Already closed. + * @throws { BusinessError } 14800021 - SQLite: Generic error. + * @throws { BusinessError } 14800022 - SQLite: Callback routine requested an abort. + * @throws { BusinessError } 14800023 - SQLite: Access permission denied. + * @throws { BusinessError } 14800024 - SQLite: The database file is locked. + * @throws { BusinessError } 14800025 - SQLite: A table in the database is locked. + * @throws { BusinessError } 14800026 - SQLite: The database is out of memory. + * @throws { BusinessError } 14800027 - SQLite: Attempt to write a readonly database. + * @throws { BusinessError } 14800028 - SQLite: Some kind of disk I/O error occurred. + * @throws { BusinessError } 14800029 - SQLite: The database is full. + * @throws { BusinessError } 14800030 - SQLite: Unable to open the database file. + * @throws { BusinessError } 14800031 - SQLite: TEXT or BLOB exceeds size limit. + * @throws { BusinessError } 14800032 - SQLite: Abort due to constraint violation. + * @throws { BusinessError } 14800033 - SQLite: Data type mismatch. + * @throws { BusinessError } 14800034 - SQLite: Library used incorrectly. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @crossplatform + * @since 12 + */ + getString(columnIndex: number): string; + /** + * Obtains the value of the specified column in the current row as long. + * The implementation class determines whether to throw an exception if the value of the specified column + * in the current row is null, the specified column is not of the integer type. + * + * @param { number } columnIndex - Indicates the specified column index, which starts from 0. + * @returns { number } The value of the specified column as a long. + * @throws { BusinessError } 14800013 - The column value is null or the column type is incompatible. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 9 + */ + /** + * Obtains the value of the specified column in the current row as long. + * The implementation class determines whether to throw an exception if the value of the specified column + * in the current row is null, the specified column is not of the integer type. + * + * @param { number } columnIndex - Indicates the specified column index, which starts from 0. + * @returns { number } The value of the specified column as a long. + * @throws { BusinessError } 14800013 - The column value is null or the column type is incompatible. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @crossplatform + * @since 10 + */ + /** + * Obtains the value of the specified column in the current row as long. + * The implementation class determines whether to throw an exception if the value of the specified column + * in the current row is null, the specified column is not of the integer type. + * + * @param { number } columnIndex - Indicates the specified column index, which starts from 0. + * @returns { number } The value of the specified column as a long. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @throws { BusinessError } 14800000 - Inner error. + * @throws { BusinessError } 14800011 - Database corrupted. + * @throws { BusinessError } 14800012 - Row out of bounds. + * @throws { BusinessError } 14800013 - Column out of bounds. + * @throws { BusinessError } 14800014 - Already closed. + * @throws { BusinessError } 14800021 - SQLite: Generic error. + * @throws { BusinessError } 14800022 - SQLite: Callback routine requested an abort. + * @throws { BusinessError } 14800023 - SQLite: Access permission denied. + * @throws { BusinessError } 14800024 - SQLite: The database file is locked. + * @throws { BusinessError } 14800025 - SQLite: A table in the database is locked. + * @throws { BusinessError } 14800026 - SQLite: The database is out of memory. + * @throws { BusinessError } 14800027 - SQLite: Attempt to write a readonly database. + * @throws { BusinessError } 14800028 - SQLite: Some kind of disk I/O error occurred. + * @throws { BusinessError } 14800029 - SQLite: The database is full. + * @throws { BusinessError } 14800030 - SQLite: Unable to open the database file. + * @throws { BusinessError } 14800031 - SQLite: TEXT or BLOB exceeds size limit. + * @throws { BusinessError } 14800032 - SQLite: Abort due to constraint violation. + * @throws { BusinessError } 14800033 - SQLite: Data type mismatch. + * @throws { BusinessError } 14800034 - SQLite: Library used incorrectly. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @crossplatform + * @since 12 + */ + getLong(columnIndex: number): number; + /** + * Obtains the value of the specified column in the current row as double. + * The implementation class determines whether to throw an exception if the value of the specified column + * in the current row is null, the specified column is not of the double type. + * + * @param { number } columnIndex - Indicates the specified column index, which starts from 0. + * @returns { number } The value of the specified column as a double. + * @throws { BusinessError } 14800013 - The column value is null or the column type is incompatible. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 9 + */ + /** + * Obtains the value of the specified column in the current row as double. + * The implementation class determines whether to throw an exception if the value of the specified column + * in the current row is null, the specified column is not of the double type. + * + * @param { number } columnIndex - Indicates the specified column index, which starts from 0. + * @returns { number } The value of the specified column as a double. + * @throws { BusinessError } 14800013 - The column value is null or the column type is incompatible. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @crossplatform + * @since 10 + */ + /** + * Obtains the value of the specified column in the current row as double. + * The implementation class determines whether to throw an exception if the value of the specified column + * in the current row is null, the specified column is not of the double type. + * + * @param { number } columnIndex - Indicates the specified column index, which starts from 0. + * @returns { number } The value of the specified column as a double. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @throws { BusinessError } 14800000 - Inner error. + * @throws { BusinessError } 14800011 - Database corrupted. + * @throws { BusinessError } 14800012 - Row out of bounds. + * @throws { BusinessError } 14800013 - Column out of bounds. + * @throws { BusinessError } 14800014 - Already closed. + * @throws { BusinessError } 14800021 - SQLite: Generic error. + * @throws { BusinessError } 14800022 - SQLite: Callback routine requested an abort. + * @throws { BusinessError } 14800023 - SQLite: Access permission denied. + * @throws { BusinessError } 14800024 - SQLite: The database file is locked. + * @throws { BusinessError } 14800025 - SQLite: A table in the database is locked. + * @throws { BusinessError } 14800026 - SQLite: The database is out of memory. + * @throws { BusinessError } 14800027 - SQLite: Attempt to write a readonly database. + * @throws { BusinessError } 14800028 - SQLite: Some kind of disk I/O error occurred. + * @throws { BusinessError } 14800029 - SQLite: The database is full. + * @throws { BusinessError } 14800030 - SQLite: Unable to open the database file. + * @throws { BusinessError } 14800031 - SQLite: TEXT or BLOB exceeds size limit. + * @throws { BusinessError } 14800032 - SQLite: Abort due to constraint violation. + * @throws { BusinessError } 14800033 - SQLite: Data type mismatch. + * @throws { BusinessError } 14800034 - SQLite: Library used incorrectly. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @crossplatform + * @since 12 + */ + getDouble(columnIndex: number): number; + /** + * Obtains the value of the specified column in the current row as an asset. + * The implementation class determines whether to throw an exception if the value of the specified column + * in the current row is null or the specified column is not of the Asset type. + * + * @param { number } columnIndex - Indicates the specified column index, which starts from 0. + * @returns { Asset } The value of the specified column as an asset. + * @throws { BusinessError } 14800013 - The column value is null or the column type is incompatible. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @crossplatform + * @since 10 + */ + /** + * Obtains the value of the specified column in the current row as an asset. + * The implementation class determines whether to throw an exception if the value of the specified column + * in the current row is null or the specified column is not of the Asset type. + * + * @param { number } columnIndex - Indicates the specified column index, which starts from 0. + * @returns { Asset } The value of the specified column as an asset. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @throws { BusinessError } 14800000 - Inner error. + * @throws { BusinessError } 14800011 - Database corrupted. + * @throws { BusinessError } 14800012 - Row out of bounds. + * @throws { BusinessError } 14800013 - Column out of bounds. + * @throws { BusinessError } 14800014 - Already closed. + * @throws { BusinessError } 14800021 - SQLite: Generic error. + * @throws { BusinessError } 14800022 - SQLite: Callback routine requested an abort. + * @throws { BusinessError } 14800023 - SQLite: Access permission denied. + * @throws { BusinessError } 14800024 - SQLite: The database file is locked. + * @throws { BusinessError } 14800025 - SQLite: A table in the database is locked. + * @throws { BusinessError } 14800026 - SQLite: The database is out of memory. + * @throws { BusinessError } 14800027 - SQLite: Attempt to write a readonly database. + * @throws { BusinessError } 14800028 - SQLite: Some kind of disk I/O error occurred. + * @throws { BusinessError } 14800029 - SQLite: The database is full. + * @throws { BusinessError } 14800030 - SQLite: Unable to open the database file. + * @throws { BusinessError } 14800031 - SQLite: TEXT or BLOB exceeds size limit. + * @throws { BusinessError } 14800032 - SQLite: Abort due to constraint violation. + * @throws { BusinessError } 14800033 - SQLite: Data type mismatch. + * @throws { BusinessError } 14800034 - SQLite: Library used incorrectly. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @crossplatform + * @since 12 + */ + getAsset(columnIndex: number): Asset; + /** + * Obtains the value of the specified column in the current row as assets. + * The implementation class determines whether to throw an exception if the value of the specified column + * in the current row is null or the specified column is not of the Assets type. + * + * @param { number } columnIndex - Indicates the specified column index, which starts from 0. + * @returns { Assets } The value of the specified column as assets. + * @throws { BusinessError } 14800013 - The column value is null or the column type is incompatible. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @crossplatform + * @since 10 + */ + /** + * Obtains the value of the specified column in the current row as assets. + * The implementation class determines whether to throw an exception if the value of the specified column + * in the current row is null or the specified column is not of the Assets type. + * + * @param { number } columnIndex - Indicates the specified column index, which starts from 0. + * @returns { Assets } The value of the specified column as assets. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @throws { BusinessError } 14800000 - Inner error. + * @throws { BusinessError } 14800011 - Database corrupted. + * @throws { BusinessError } 14800012 - Row out of bounds. + * @throws { BusinessError } 14800013 - Column out of bounds. + * @throws { BusinessError } 14800014 - Already closed. + * @throws { BusinessError } 14800021 - SQLite: Generic error. + * @throws { BusinessError } 14800022 - SQLite: Callback routine requested an abort. + * @throws { BusinessError } 14800023 - SQLite: Access permission denied. + * @throws { BusinessError } 14800024 - SQLite: The database file is locked. + * @throws { BusinessError } 14800025 - SQLite: A table in the database is locked. + * @throws { BusinessError } 14800026 - SQLite: The database is out of memory. + * @throws { BusinessError } 14800027 - SQLite: Attempt to write a readonly database. + * @throws { BusinessError } 14800028 - SQLite: Some kind of disk I/O error occurred. + * @throws { BusinessError } 14800029 - SQLite: The database is full. + * @throws { BusinessError } 14800030 - SQLite: Unable to open the database file. + * @throws { BusinessError } 14800031 - SQLite: TEXT or BLOB exceeds size limit. + * @throws { BusinessError } 14800032 - SQLite: Abort due to constraint violation. + * @throws { BusinessError } 14800033 - SQLite: Data type mismatch. + * @throws { BusinessError } 14800034 - SQLite: Library used incorrectly. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @crossplatform + * @since 12 + */ + getAssets(columnIndex: number): Assets; + /** + * Obtains the value of the specified column in the current row. + * The implementation class determines whether to throw an exception if the value of the specified column + * in the current row is null or the specified column is not of the Assets type. + * + * @param { number } columnIndex - Indicates the specified column index, which starts from 0. + * @returns { ValueType } The value of the specified column. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @throws { BusinessError } 14800000 - Inner error. + * @throws { BusinessError } 14800011 - Database corrupted. + * @throws { BusinessError } 14800012 - Row out of bounds. + * @throws { BusinessError } 14800013 - Column out of bounds. + * @throws { BusinessError } 14800014 - Already closed. + * @throws { BusinessError } 14800021 - SQLite: Generic error. + * @throws { BusinessError } 14800022 - SQLite: Callback routine requested an abort. + * @throws { BusinessError } 14800023 - SQLite: Access permission denied. + * @throws { BusinessError } 14800024 - SQLite: The database file is locked. + * @throws { BusinessError } 14800025 - SQLite: A table in the database is locked. + * @throws { BusinessError } 14800026 - SQLite: The database is out of memory. + * @throws { BusinessError } 14800027 - SQLite: Attempt to write a readonly database. + * @throws { BusinessError } 14800028 - SQLite: Some kind of disk I/O error occurred. + * @throws { BusinessError } 14800029 - SQLite: The database is full. + * @throws { BusinessError } 14800030 - SQLite: Unable to open the database file. + * @throws { BusinessError } 14800031 - SQLite: TEXT or BLOB exceeds size limit. + * @throws { BusinessError } 14800032 - SQLite: Abort due to constraint violation. + * @throws { BusinessError } 14800033 - SQLite: Data type mismatch. + * @throws { BusinessError } 14800034 - SQLite: Library used incorrectly. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 12 + */ + getValue(columnIndex: number): ValueType; + /** + * Obtains the values of all columns in the specified row. + * + * @returns { ValuesBucket } Indicates the row of data {@link ValuesBucket} to be inserted into the table. + * @throws { BusinessError } 14800000 - Inner error. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @crossplatform + * @since 11 + */ + /** + * Obtains the values of all columns in the specified row. + * + * @returns { ValuesBucket } Indicates the row of data {@link ValuesBucket} to be inserted into the table. + * @throws { BusinessError } 14800000 - Inner error. + * @throws { BusinessError } 14800011 - Database corrupted. + * @throws { BusinessError } 14800012 - Row out of bounds. + * @throws { BusinessError } 14800013 - Column out of bounds. + * @throws { BusinessError } 14800014 - Already closed. + * @throws { BusinessError } 14800021 - SQLite: Generic error. + * @throws { BusinessError } 14800022 - SQLite: Callback routine requested an abort. + * @throws { BusinessError } 14800023 - SQLite: Access permission denied. + * @throws { BusinessError } 14800024 - SQLite: The database file is locked. + * @throws { BusinessError } 14800025 - SQLite: A table in the database is locked. + * @throws { BusinessError } 14800026 - SQLite: The database is out of memory. + * @throws { BusinessError } 14800027 - SQLite: Attempt to write a readonly database. + * @throws { BusinessError } 14800028 - SQLite: Some kind of disk I/O error occurred. + * @throws { BusinessError } 14800029 - SQLite: The database is full. + * @throws { BusinessError } 14800030 - SQLite: Unable to open the database file. + * @throws { BusinessError } 14800031 - SQLite: TEXT or BLOB exceeds size limit. + * @throws { BusinessError } 14800032 - SQLite: Abort due to constraint violation. + * @throws { BusinessError } 14800033 - SQLite: Data type mismatch. + * @throws { BusinessError } 14800034 - SQLite: Library used incorrectly. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @crossplatform + * @since 12 + */ + getRow(): ValuesBucket; + /** + * Checks whether the value of the specified column in the current row is null. + * + * @param { number } columnIndex - Indicates the specified column index, which starts from 0. + * @returns { boolean } True if the value of the specified column in the current row is null; + * Returns false otherwise. + * @throws { BusinessError } 14800013 - The column value is null or the column type is incompatible. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 9 + */ + /** + * Checks whether the value of the specified column in the current row is null. + * + * @param { number } columnIndex - Indicates the specified column index, which starts from 0. + * @returns { boolean } True if the value of the specified column in the current row is null; + * Returns false otherwise. + * @throws { BusinessError } 14800013 - The column value is null or the column type is incompatible. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @crossplatform + * @since 10 + */ + /** + * Checks whether the value of the specified column in the current row is null. + * + * @param { number } columnIndex - Indicates the specified column index, which starts from 0. + * @returns { boolean } True if the value of the specified column in the current row is null; + * Returns false otherwise. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @throws { BusinessError } 14800000 - Inner error. + * @throws { BusinessError } 14800011 - Database corrupted. + * @throws { BusinessError } 14800012 - Row out of bounds. + * @throws { BusinessError } 14800013 - Column out of bounds. + * @throws { BusinessError } 14800014 - Already closed. + * @throws { BusinessError } 14800021 - SQLite: Generic error. + * @throws { BusinessError } 14800022 - SQLite: Callback routine requested an abort. + * @throws { BusinessError } 14800023 - SQLite: Access permission denied. + * @throws { BusinessError } 14800024 - SQLite: The database file is locked. + * @throws { BusinessError } 14800025 - SQLite: A table in the database is locked. + * @throws { BusinessError } 14800026 - SQLite: The database is out of memory. + * @throws { BusinessError } 14800027 - SQLite: Attempt to write a readonly database. + * @throws { BusinessError } 14800028 - SQLite: Some kind of disk I/O error occurred. + * @throws { BusinessError } 14800029 - SQLite: The database is full. + * @throws { BusinessError } 14800030 - SQLite: Unable to open the database file. + * @throws { BusinessError } 14800031 - SQLite: TEXT or BLOB exceeds size limit. + * @throws { BusinessError } 14800032 - SQLite: Abort due to constraint violation. + * @throws { BusinessError } 14800033 - SQLite: Data type mismatch. + * @throws { BusinessError } 14800034 - SQLite: Library used incorrectly. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @crossplatform + * @since 12 + */ + isColumnNull(columnIndex: number): boolean; + /** + * Closes the result set. + * Calling this method on the result set will release all of its resources and makes it ineffective. + * + * @throws { BusinessError } 14800012 - The result set is empty or the specified location is invalid. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 9 + */ + /** + * Closes the result set. + * Calling this method on the result set will release all of its resources and makes it ineffective. + * + * @throws { BusinessError } 14800012 - The result set is empty or the specified location is invalid. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @crossplatform + * @since 10 + */ + /** + * Closes the result set. + * Calling this method on the result set will release all of its resources and makes it ineffective. + * + * @throws { BusinessError } 14800000 - Inner error. + * @throws { BusinessError } 14800012 - Row out of bounds. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @crossplatform + * @since 12 + */ + close(): void; + } + /** + * Provides methods for managing the relational database (RDB). + * This class provides methods for creating, querying, updating, and deleting RDBs. + * + * @interface RdbStore + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 9 + */ + /** + * Provides methods for managing the relational database (RDB). + * This class provides methods for creating, querying, updating, and deleting RDBs. + * + * @interface RdbStore + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @crossplatform + * @since 10 + */ + interface RdbStore { + /** + * Set RdbStore version. The version number must be an integer greater than 0. + * Obtains the RdbStore version. + * + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 10 + */ + /** + * Set RdbStore version. The version number must be an integer greater than 0. + * Obtains the RdbStore version. + * + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @crossplatform + * @since 10 + */ + /** + * Set RdbStore version. The version number must be an integer greater than 0. + * Obtains the RdbStore version. + * + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 14800000 - Inner error. + * @throws { BusinessError } 14800014 - Already closed. + * @throws { BusinessError } 14800015 - The database does not respond. + * @throws { BusinessError } 14800021 - SQLite: Generic error. + * @throws { BusinessError } 14800023 - SQLite: Access permission denied. + * @throws { BusinessError } 14800024 - SQLite: The database file is locked. + * @throws { BusinessError } 14800025 - SQLite: A table in the database is locked. + * @throws { BusinessError } 14800026 - SQLite: The database is out of memory. + * @throws { BusinessError } 14800027 - SQLite: Attempt to write a readonly database. + * @throws { BusinessError } 14800028 - SQLite: Some kind of disk I/O error occurred. + * @throws { BusinessError } 14800029 - SQLite: The database is full. + * @throws { BusinessError } 14800030 - SQLite: Unable to open the database file. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @crossplatform + * @since 12 + */ + version: number; + /** + * Set whether the database is rebuilt. + * + * @type {RebuildType} + * @readonly + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 12 + */ + rebuilt: RebuildType; + /** + * Inserts a row of data into the target table. + * + * @param { string } table - Indicates the target table. + * @param { ValuesBucket } values - Indicates the row of data {@link ValuesBucket} to be inserted into the table. + * @param { AsyncCallback } callback - The row ID if the operation is successful. returns -1 otherwise. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @throws { BusinessError } 14800000 - Inner error. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 9 + */ + /** + * Inserts a row of data into the target table. + * + * @param { string } table - Indicates the target table. + * @param { ValuesBucket } values - Indicates the row of data {@link ValuesBucket} to be inserted into the table. + * @param { AsyncCallback } callback - The row ID if the operation is successful. returns -1 otherwise. + * @throws { BusinessError } 14800047 - The WAL file size exceeds the default limit. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @throws { BusinessError } 14800000 - Inner error. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @crossplatform + * @since 10 + */ + /** + * Inserts a row of data into the target table. + * + * @param { string } table - Indicates the target table. + * @param { ValuesBucket } values - Indicates the row of data {@link ValuesBucket} to be inserted into the table. + * @param { AsyncCallback } callback - The row ID if the operation is successful. returns -1 otherwise. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @throws { BusinessError } 14800000 - Inner error. + * @throws { BusinessError } 14800011 - Database corrupted. + * @throws { BusinessError } 14800014 - Already closed. + * @throws { BusinessError } 14800015 - The database does not respond. + * @throws { BusinessError } 14800021 - SQLite: Generic error. + * @throws { BusinessError } 14800022 - SQLite: Callback routine requested an abort. + * @throws { BusinessError } 14800023 - SQLite: Access permission denied. + * @throws { BusinessError } 14800024 - SQLite: The database file is locked. + * @throws { BusinessError } 14800025 - SQLite: A table in the database is locked. + * @throws { BusinessError } 14800026 - SQLite: The database is out of memory. + * @throws { BusinessError } 14800027 - SQLite: Attempt to write a readonly database. + * @throws { BusinessError } 14800028 - SQLite: Some kind of disk I/O error occurred. + * @throws { BusinessError } 14800029 - SQLite: The database is full. + * @throws { BusinessError } 14800030 - SQLite: Unable to open the database file. + * @throws { BusinessError } 14800031 - SQLite: TEXT or BLOB exceeds size limit. + * @throws { BusinessError } 14800032 - SQLite: Abort due to constraint violation. + * @throws { BusinessError } 14800033 - SQLite: Data type mismatch. + * @throws { BusinessError } 14800034 - SQLite: Library used incorrectly. + * @throws { BusinessError } 14800047 - The WAL file size exceeds the default limit. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @crossplatform + * @since 12 + */ + insert(table: string, values: ValuesBucket, callback: AsyncCallback): void; + /** + * Inserts a row of data into the target table. + * + * @param { string } table - Indicates the target table. + * @param { ValuesBucket } values - Indicates the row of data {@link ValuesBucket} to be inserted into the table. + * @param { ConflictResolution } conflict - Indicates the {@link ConflictResolution} to insert data into the table. + * @param { AsyncCallback } callback - The row ID if the operation is successful. returns -1 otherwise. + * @throws { BusinessError } 14800047 - The WAL file size exceeds the default limit. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @throws { BusinessError } 14800000 - Inner error. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @crossplatform + * @since 10 + */ + /** + * Inserts a row of data into the target table. + * + * @param { string } table - Indicates the target table. + * @param { ValuesBucket } values - Indicates the row of data {@link ValuesBucket} to be inserted into the table. + * @param { ConflictResolution } conflict - Indicates the {@link ConflictResolution} to insert data into the table. + * @param { AsyncCallback } callback - The row ID if the operation is successful. returns -1 otherwise. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @throws { BusinessError } 14800000 - Inner error. + * @throws { BusinessError } 14800011 - Database corrupted. + * @throws { BusinessError } 14800014 - Already closed. + * @throws { BusinessError } 14800015 - The database does not respond. + * @throws { BusinessError } 14800021 - SQLite: Generic error. + * @throws { BusinessError } 14800022 - SQLite: Callback routine requested an abort. + * @throws { BusinessError } 14800023 - SQLite: Access permission denied. + * @throws { BusinessError } 14800024 - SQLite: The database file is locked. + * @throws { BusinessError } 14800025 - SQLite: A table in the database is locked. + * @throws { BusinessError } 14800026 - SQLite: The database is out of memory. + * @throws { BusinessError } 14800027 - SQLite: Attempt to write a readonly database. + * @throws { BusinessError } 14800028 - SQLite: Some kind of disk I/O error occurred. + * @throws { BusinessError } 14800029 - SQLite: The database is full. + * @throws { BusinessError } 14800030 - SQLite: Unable to open the database file. + * @throws { BusinessError } 14800031 - SQLite: TEXT or BLOB exceeds size limit. + * @throws { BusinessError } 14800032 - SQLite: Abort due to constraint violation. + * @throws { BusinessError } 14800033 - SQLite: Data type mismatch. + * @throws { BusinessError } 14800034 - SQLite: Library used incorrectly. + * @throws { BusinessError } 14800047 - The WAL file size exceeds the default limit. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @crossplatform + * @since 12 + */ + insert(table: string, values: ValuesBucket, conflict: ConflictResolution, callback: AsyncCallback): void; + /** + * Inserts a row of data into the target table. + * + * @param { string } table - Indicates the target table. + * @param { ValuesBucket } values - Indicates the row of data {@link ValuesBucket} to be inserted into the table. + * @returns { Promise } The row ID if the operation is successful. return -1 otherwise. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @throws { BusinessError } 14800000 - Inner error. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 9 + */ + /** + * Inserts a row of data into the target table. + * + * @param { string } table - Indicates the target table. + * @param { ValuesBucket } values - Indicates the row of data {@link ValuesBucket} to be inserted into the table. + * @returns { Promise } The row ID if the operation is successful. return -1 otherwise. + * @throws { BusinessError } 14800047 - The WAL file size exceeds the default limit. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @throws { BusinessError } 14800000 - Inner error. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @crossplatform + * @since 10 + */ + /** + * Inserts a row of data into the target table. + * + * @param { string } table - Indicates the target table. + * @param { ValuesBucket } values - Indicates the row of data {@link ValuesBucket} to be inserted into the table. + * @returns { Promise } The row ID if the operation is successful. return -1 otherwise. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @throws { BusinessError } 14800000 - Inner error. + * @throws { BusinessError } 14800011 - Database corrupted. + * @throws { BusinessError } 14800014 - Already closed. + * @throws { BusinessError } 14800015 - The database does not respond. + * @throws { BusinessError } 14800021 - SQLite: Generic error. + * @throws { BusinessError } 14800022 - SQLite: Callback routine requested an abort. + * @throws { BusinessError } 14800023 - SQLite: Access permission denied. + * @throws { BusinessError } 14800024 - SQLite: The database file is locked. + * @throws { BusinessError } 14800025 - SQLite: A table in the database is locked. + * @throws { BusinessError } 14800026 - SQLite: The database is out of memory. + * @throws { BusinessError } 14800027 - SQLite: Attempt to write a readonly database. + * @throws { BusinessError } 14800028 - SQLite: Some kind of disk I/O error occurred. + * @throws { BusinessError } 14800029 - SQLite: The database is full. + * @throws { BusinessError } 14800030 - SQLite: Unable to open the database file. + * @throws { BusinessError } 14800031 - SQLite: TEXT or BLOB exceeds size limit. + * @throws { BusinessError } 14800032 - SQLite: Abort due to constraint violation. + * @throws { BusinessError } 14800033 - SQLite: Data type mismatch. + * @throws { BusinessError } 14800034 - SQLite: Library used incorrectly. + * @throws { BusinessError } 14800047 - The WAL file size exceeds the default limit. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @crossplatform + * @since 12 + */ + insert(table: string, values: ValuesBucket): Promise; + /** + * Inserts a row of data into the target table. + * + * @param { string } table - Indicates the target table. + * @param { ValuesBucket } values - Indicates the row of data {@link ValuesBucket} to be inserted into the table. + * @param { ConflictResolution } conflict - Indicates the {@link ConflictResolution} to insert data into the table. + * @returns { Promise } The row ID if the operation is successful. return -1 otherwise. + * @throws { BusinessError } 14800047 - The WAL file size exceeds the default limit. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @throws { BusinessError } 14800000 - Inner error. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @crossplatform + * @since 10 + */ + /** + * Inserts a row of data into the target table. + * + * @param { string } table - Indicates the target table. + * @param { ValuesBucket } values - Indicates the row of data {@link ValuesBucket} to be inserted into the table. + * @param { ConflictResolution } conflict - Indicates the {@link ConflictResolution} to insert data into the table. + * @returns { Promise } The row ID if the operation is successful. return -1 otherwise. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @throws { BusinessError } 14800000 - Inner error. + * @throws { BusinessError } 14800011 - Database corrupted. + * @throws { BusinessError } 14800014 - Already closed. + * @throws { BusinessError } 14800015 - The database does not respond. + * @throws { BusinessError } 14800021 - SQLite: Generic error. + * @throws { BusinessError } 14800022 - SQLite: Callback routine requested an abort. + * @throws { BusinessError } 14800023 - SQLite: Access permission denied. + * @throws { BusinessError } 14800024 - SQLite: The database file is locked. + * @throws { BusinessError } 14800025 - SQLite: A table in the database is locked. + * @throws { BusinessError } 14800026 - SQLite: The database is out of memory. + * @throws { BusinessError } 14800027 - SQLite: Attempt to write a readonly database. + * @throws { BusinessError } 14800028 - SQLite: Some kind of disk I/O error occurred. + * @throws { BusinessError } 14800029 - SQLite: The database is full. + * @throws { BusinessError } 14800030 - SQLite: Unable to open the database file. + * @throws { BusinessError } 14800031 - SQLite: TEXT or BLOB exceeds size limit. + * @throws { BusinessError } 14800032 - SQLite: Abort due to constraint violation. + * @throws { BusinessError } 14800033 - SQLite: Data type mismatch. + * @throws { BusinessError } 14800034 - SQLite: Library used incorrectly. + * @throws { BusinessError } 14800047 - The WAL file size exceeds the default limit. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @crossplatform + * @since 12 + */ + insert(table: string, values: ValuesBucket, conflict: ConflictResolution): Promise; + /** + * Inserts a row of data into the target table with sync interface. + * + * @param { string } table - Indicates the target table. + * @param { ValuesBucket } values - Indicates the row of data {@link ValuesBucket} to be inserted into the table. + * @param { ConflictResolution } conflict - Indicates the {@link ConflictResolution} to insert data into the table. + * @returns { number } The row ID if the operation is successful. return -1 otherwise. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @throws { BusinessError } 14800000 - Inner error. + * @throws { BusinessError } 14800011 - Database corrupted. + * @throws { BusinessError } 14800014 - Already closed. + * @throws { BusinessError } 14800015 - The database does not respond. + * @throws { BusinessError } 14800021 - SQLite: Generic error. + * @throws { BusinessError } 14800022 - SQLite: Callback routine requested an abort. + * @throws { BusinessError } 14800023 - SQLite: Access permission denied. + * @throws { BusinessError } 14800024 - SQLite: The database file is locked. + * @throws { BusinessError } 14800025 - SQLite: A table in the database is locked. + * @throws { BusinessError } 14800026 - SQLite: The database is out of memory. + * @throws { BusinessError } 14800027 - SQLite: Attempt to write a readonly database. + * @throws { BusinessError } 14800028 - SQLite: Some kind of disk I/O error occurred. + * @throws { BusinessError } 14800029 - SQLite: The database is full. + * @throws { BusinessError } 14800030 - SQLite: Unable to open the database file. + * @throws { BusinessError } 14800031 - SQLite: TEXT or BLOB exceeds size limit. + * @throws { BusinessError } 14800032 - SQLite: Abort due to constraint violation. + * @throws { BusinessError } 14800033 - SQLite: Data type mismatch. + * @throws { BusinessError } 14800034 - SQLite: Library used incorrectly. + * @throws { BusinessError } 14800047 - The WAL file size exceeds the default limit. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @crossplatform + * @since 12 + */ + insertSync(table: string, values: ValuesBucket, conflict?: ConflictResolution): number; + /** + * Inserts a batch of data into the target table. + * + * @param { string } table - Indicates the target table. + * @param { Array } values - Indicates the rows of data {@link ValuesBucket} to be inserted into the table. + * @param { AsyncCallback } callback - The number of values that were inserted if the operation is successful. returns -1 otherwise. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @throws { BusinessError } 14800000 - Inner error. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 9 + */ + /** + * Inserts a batch of data into the target table. + * + * @param { string } table - Indicates the target table. + * @param { Array } values - Indicates the rows of data {@link ValuesBucket} to be inserted into the table. + * @param { AsyncCallback } callback - The number of values that were inserted if the operation is successful. returns -1 otherwise. + * @throws { BusinessError } 14800047 - The WAL file size exceeds the default limit. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @throws { BusinessError } 14800000 - Inner error. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @crossplatform + * @since 10 + */ + /** + * Inserts a batch of data into the target table. + * + * @param { string } table - Indicates the target table. + * @param { Array } values - Indicates the rows of data {@link ValuesBucket} to be inserted into the table. + * @param { AsyncCallback } callback - The number of values that were inserted if the operation is successful. returns -1 otherwise. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @throws { BusinessError } 14800000 - Inner error. + * @throws { BusinessError } 14800011 - Database corrupted. + * @throws { BusinessError } 14800014 - Already closed. + * @throws { BusinessError } 14800015 - The database does not respond. + * @throws { BusinessError } 14800021 - SQLite: Generic error. + * @throws { BusinessError } 14800022 - SQLite: Callback routine requested an abort. + * @throws { BusinessError } 14800023 - SQLite: Access permission denied. + * @throws { BusinessError } 14800024 - SQLite: The database file is locked. + * @throws { BusinessError } 14800025 - SQLite: A table in the database is locked. + * @throws { BusinessError } 14800026 - SQLite: The database is out of memory. + * @throws { BusinessError } 14800027 - SQLite: Attempt to write a readonly database. + * @throws { BusinessError } 14800028 - SQLite: Some kind of disk I/O error occurred. + * @throws { BusinessError } 14800029 - SQLite: The database is full. + * @throws { BusinessError } 14800030 - SQLite: Unable to open the database file. + * @throws { BusinessError } 14800031 - SQLite: TEXT or BLOB exceeds size limit. + * @throws { BusinessError } 14800032 - SQLite: Abort due to constraint violation. + * @throws { BusinessError } 14800033 - SQLite: Data type mismatch. + * @throws { BusinessError } 14800034 - SQLite: Library used incorrectly. + * @throws { BusinessError } 14800047 - The WAL file size exceeds the default limit. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @crossplatform + * @since 12 + */ + batchInsert(table: string, values: Array, callback: AsyncCallback): void; + /** + * Inserts a batch of data into the target table. + * + * @param { string } table - Indicates the target table. + * @param { Array } values - Indicates the rows of data {@link ValuesBucket} to be inserted into the table. + * @returns { Promise } The number of values that were inserted if the operation is successful. returns -1 otherwise. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @throws { BusinessError } 14800000 - Inner error. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 9 + */ + /** + * Inserts a batch of data into the target table. + * + * @param { string } table - Indicates the target table. + * @param { Array } values - Indicates the rows of data {@link ValuesBucket} to be inserted into the table. + * @returns { Promise } The number of values that were inserted if the operation is successful. returns -1 otherwise. + * @throws { BusinessError } 14800047 - The WAL file size exceeds the default limit. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @throws { BusinessError } 14800000 - Inner error. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @crossplatform + * @since 10 + */ + /** + * Inserts a batch of data into the target table. + * + * @param { string } table - Indicates the target table. + * @param { Array } values - Indicates the rows of data {@link ValuesBucket} to be inserted into the table. + * @returns { Promise } The number of values that were inserted if the operation is successful. returns -1 otherwise. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @throws { BusinessError } 14800000 - Inner error. + * @throws { BusinessError } 14800011 - Database corrupted. + * @throws { BusinessError } 14800014 - Already closed. + * @throws { BusinessError } 14800015 - The database does not respond. + * @throws { BusinessError } 14800021 - SQLite: Generic error. + * @throws { BusinessError } 14800022 - SQLite: Callback routine requested an abort. + * @throws { BusinessError } 14800023 - SQLite: Access permission denied. + * @throws { BusinessError } 14800024 - SQLite: The database file is locked. + * @throws { BusinessError } 14800025 - SQLite: A table in the database is locked. + * @throws { BusinessError } 14800026 - SQLite: The database is out of memory. + * @throws { BusinessError } 14800027 - SQLite: Attempt to write a readonly database. + * @throws { BusinessError } 14800028 - SQLite: Some kind of disk I/O error occurred. + * @throws { BusinessError } 14800029 - SQLite: The database is full. + * @throws { BusinessError } 14800030 - SQLite: Unable to open the database file. + * @throws { BusinessError } 14800031 - SQLite: TEXT or BLOB exceeds size limit. + * @throws { BusinessError } 14800032 - SQLite: Abort due to constraint violation. + * @throws { BusinessError } 14800033 - SQLite: Data type mismatch. + * @throws { BusinessError } 14800034 - SQLite: Library used incorrectly. + * @throws { BusinessError } 14800047 - The WAL file size exceeds the default limit. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @crossplatform + * @since 12 + */ + batchInsert(table: string, values: Array): Promise; + /** + * Inserts a batch of data into the target table. + * + * @param { string } table - Indicates the target table. + * @param { Array } values - Indicates the rows of data {@link ValuesBucket} to be inserted into the table. + * @returns { number } The number of values that were inserted if the operation is successful. returns -1 otherwise. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @throws { BusinessError } 14800000 - Inner error. + * @throws { BusinessError } 14800011 - Database corrupted. + * @throws { BusinessError } 14800014 - Already closed. + * @throws { BusinessError } 14800015 - The database does not respond. + * @throws { BusinessError } 14800021 - SQLite: Generic error. + * @throws { BusinessError } 14800022 - SQLite: Callback routine requested an abort. + * @throws { BusinessError } 14800023 - SQLite: Access permission denied. + * @throws { BusinessError } 14800024 - SQLite: The database file is locked. + * @throws { BusinessError } 14800025 - SQLite: A table in the database is locked. + * @throws { BusinessError } 14800026 - SQLite: The database is out of memory. + * @throws { BusinessError } 14800027 - SQLite: Attempt to write a readonly database. + * @throws { BusinessError } 14800028 - SQLite: Some kind of disk I/O error occurred. + * @throws { BusinessError } 14800029 - SQLite: The database is full. + * @throws { BusinessError } 14800030 - SQLite: Unable to open the database file. + * @throws { BusinessError } 14800031 - SQLite: TEXT or BLOB exceeds size limit. + * @throws { BusinessError } 14800032 - SQLite: Abort due to constraint violation. + * @throws { BusinessError } 14800033 - SQLite: Data type mismatch. + * @throws { BusinessError } 14800034 - SQLite: Library used incorrectly. + * @throws { BusinessError } 14800047 - The WAL file size exceeds the default limit. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @crossplatform + * @since 12 + */ + batchInsertSync(table: string, values: Array): number; + /** + * Updates data in the database based on a specified instance object of RdbPredicates. + * + * @param { ValuesBucket } values - Indicates the row of data to be updated in the database. + * The key-value pairs are associated with column names of the database table. + * @param { RdbPredicates } predicates - Indicates the specified update condition by the instance object of {@link RdbPredicates}. + * @param { AsyncCallback } callback - The number of affected rows. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @throws { BusinessError } 14800000 - Inner error. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 9 + */ + /** + * Updates data in the database based on a specified instance object of RdbPredicates. + * + * @param { ValuesBucket } values - Indicates the row of data to be updated in the database. + * The key-value pairs are associated with column names of the database table. + * @param { RdbPredicates } predicates - Indicates the specified update condition by the instance object of {@link RdbPredicates}. + * @param { AsyncCallback } callback - The number of affected rows. + * @throws { BusinessError } 14800047 - The WAL file size exceeds the default limit. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @throws { BusinessError } 14800000 - Inner error. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @crossplatform + * @since 10 + */ + /** + * Updates data in the database based on a specified instance object of RdbPredicates. + * + * @param { ValuesBucket } values - Indicates the row of data to be updated in the database. + * The key-value pairs are associated with column names of the database table. + * @param { RdbPredicates } predicates - Indicates the specified update condition by the instance object of {@link RdbPredicates}. + * @param { AsyncCallback } callback - The number of affected rows. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @throws { BusinessError } 14800000 - Inner error. + * @throws { BusinessError } 14800011 - Database corrupted. + * @throws { BusinessError } 14800014 - Already closed. + * @throws { BusinessError } 14800015 - The database does not respond. + * @throws { BusinessError } 14800021 - SQLite: Generic error. + * @throws { BusinessError } 14800022 - SQLite: Callback routine requested an abort. + * @throws { BusinessError } 14800023 - SQLite: Access permission denied. + * @throws { BusinessError } 14800024 - SQLite: The database file is locked. + * @throws { BusinessError } 14800025 - SQLite: A table in the database is locked. + * @throws { BusinessError } 14800026 - SQLite: The database is out of memory. + * @throws { BusinessError } 14800027 - SQLite: Attempt to write a readonly database. + * @throws { BusinessError } 14800028 - SQLite: Some kind of disk I/O error occurred. + * @throws { BusinessError } 14800029 - SQLite: The database is full. + * @throws { BusinessError } 14800030 - SQLite: Unable to open the database file. + * @throws { BusinessError } 14800031 - SQLite: TEXT or BLOB exceeds size limit. + * @throws { BusinessError } 14800032 - SQLite: Abort due to constraint violation. + * @throws { BusinessError } 14800033 - SQLite: Data type mismatch. + * @throws { BusinessError } 14800034 - SQLite: Library used incorrectly. + * @throws { BusinessError } 14800047 - The WAL file size exceeds the default limit. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @crossplatform + * @since 12 + */ + update(values: ValuesBucket, predicates: RdbPredicates, callback: AsyncCallback): void; + /** + * Updates data in the database based on a specified instance object of RdbPredicates. + * + * @param { ValuesBucket } values - Indicates the row of data to be updated in the database. + * The key-value pairs are associated with column names of the database table. + * @param { RdbPredicates } predicates - Indicates the specified update condition by the instance object of {@link RdbPredicates}. + * @param { ConflictResolution } conflict - Indicates the {@link ConflictResolution} to insert data into the table. + * @param { AsyncCallback } callback - The number of affected rows. + * @throws { BusinessError } 14800047 - The WAL file size exceeds the default limit. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @throws { BusinessError } 14800000 - Inner error. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @crossplatform + * @since 10 + */ + /** + * Updates data in the database based on a specified instance object of RdbPredicates. + * + * @param { ValuesBucket } values - Indicates the row of data to be updated in the database. + * The key-value pairs are associated with column names of the database table. + * @param { RdbPredicates } predicates - Indicates the specified update condition by the instance object of {@link RdbPredicates}. + * @param { ConflictResolution } conflict - Indicates the {@link ConflictResolution} to insert data into the table. + * @param { AsyncCallback } callback - The number of affected rows. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @throws { BusinessError } 14800000 - Inner error. + * @throws { BusinessError } 14800011 - Database corrupted. + * @throws { BusinessError } 14800014 - Already closed. + * @throws { BusinessError } 14800015 - The database does not respond. + * @throws { BusinessError } 14800021 - SQLite: Generic error. + * @throws { BusinessError } 14800022 - SQLite: Callback routine requested an abort. + * @throws { BusinessError } 14800023 - SQLite: Access permission denied. + * @throws { BusinessError } 14800024 - SQLite: The database file is locked. + * @throws { BusinessError } 14800025 - SQLite: A table in the database is locked. + * @throws { BusinessError } 14800026 - SQLite: The database is out of memory. + * @throws { BusinessError } 14800027 - SQLite: Attempt to write a readonly database. + * @throws { BusinessError } 14800028 - SQLite: Some kind of disk I/O error occurred. + * @throws { BusinessError } 14800029 - SQLite: The database is full. + * @throws { BusinessError } 14800030 - SQLite: Unable to open the database file. + * @throws { BusinessError } 14800031 - SQLite: TEXT or BLOB exceeds size limit. + * @throws { BusinessError } 14800032 - SQLite: Abort due to constraint violation. + * @throws { BusinessError } 14800033 - SQLite: Data type mismatch. + * @throws { BusinessError } 14800034 - SQLite: Library used incorrectly. + * @throws { BusinessError } 14800047 - The WAL file size exceeds the default limit. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @crossplatform + * @since 12 + */ + update(values: ValuesBucket, predicates: RdbPredicates, conflict: ConflictResolution, callback: AsyncCallback): void; + /** + * Updates data in the database based on a specified instance object of RdbPredicates. + * + * @param { ValuesBucket } values - Indicates the row of data to be updated in the database. + * The key-value pairs are associated with column names of the database table. + * @param { RdbPredicates } predicates - Indicates the specified update condition by the instance object of {@link RdbPredicates}. + * @returns { Promise } The number of affected rows. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @throws { BusinessError } 14800000 - Inner error. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 9 + */ + /** + * Updates data in the database based on a specified instance object of RdbPredicates. + * + * @param { ValuesBucket } values - Indicates the row of data to be updated in the database. + * The key-value pairs are associated with column names of the database table. + * @param { RdbPredicates } predicates - Indicates the specified update condition by the instance object of {@link RdbPredicates}. + * @returns { Promise } The number of affected rows. + * @throws { BusinessError } 14800047 - The WAL file size exceeds the default limit. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @throws { BusinessError } 14800000 - Inner error. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @crossplatform + * @since 10 + */ + /** + * Updates data in the database based on a specified instance object of RdbPredicates. + * + * @param { ValuesBucket } values - Indicates the row of data to be updated in the database. + * The key-value pairs are associated with column names of the database table. + * @param { RdbPredicates } predicates - Indicates the specified update condition by the instance object of {@link RdbPredicates}. + * @returns { Promise } The number of affected rows. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @throws { BusinessError } 14800000 - Inner error. + * @throws { BusinessError } 14800011 - Database corrupted. + * @throws { BusinessError } 14800014 - Already closed. + * @throws { BusinessError } 14800015 - The database does not respond. + * @throws { BusinessError } 14800021 - SQLite: Generic error. + * @throws { BusinessError } 14800022 - SQLite: Callback routine requested an abort. + * @throws { BusinessError } 14800023 - SQLite: Access permission denied. + * @throws { BusinessError } 14800024 - SQLite: The database file is locked. + * @throws { BusinessError } 14800025 - SQLite: A table in the database is locked. + * @throws { BusinessError } 14800026 - SQLite: The database is out of memory. + * @throws { BusinessError } 14800027 - SQLite: Attempt to write a readonly database. + * @throws { BusinessError } 14800028 - SQLite: Some kind of disk I/O error occurred. + * @throws { BusinessError } 14800029 - SQLite: The database is full. + * @throws { BusinessError } 14800030 - SQLite: Unable to open the database file. + * @throws { BusinessError } 14800031 - SQLite: TEXT or BLOB exceeds size limit. + * @throws { BusinessError } 14800032 - SQLite: Abort due to constraint violation. + * @throws { BusinessError } 14800033 - SQLite: Data type mismatch. + * @throws { BusinessError } 14800034 - SQLite: Library used incorrectly. + * @throws { BusinessError } 14800047 - The WAL file size exceeds the default limit. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @crossplatform + * @since 12 + */ + update(values: ValuesBucket, predicates: RdbPredicates): Promise; + /** + * Updates data in the database based on a specified instance object of RdbPredicates. + * + * @param { ValuesBucket } values - Indicates the row of data to be updated in the database. + * The key-value pairs are associated with column names of the database table. + * @param { RdbPredicates } predicates - Indicates the specified update condition by the instance object of {@link RdbPredicates}. + * @param { ConflictResolution } conflict - Indicates the {@link ConflictResolution} to insert data into the table. + * @returns { Promise } The number of affected rows. + * @throws { BusinessError } 14800047 - The WAL file size exceeds the default limit. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @throws { BusinessError } 14800000 - Inner error. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @crossplatform + * @since 10 + */ + /** + * Updates data in the database based on a specified instance object of RdbPredicates. + * + * @param { ValuesBucket } values - Indicates the row of data to be updated in the database. + * The key-value pairs are associated with column names of the database table. + * @param { RdbPredicates } predicates - Indicates the specified update condition by the instance object of {@link RdbPredicates}. + * @param { ConflictResolution } conflict - Indicates the {@link ConflictResolution} to insert data into the table. + * @returns { Promise } The number of affected rows. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @throws { BusinessError } 14800000 - Inner error. + * @throws { BusinessError } 14800011 - Database corrupted. + * @throws { BusinessError } 14800014 - Already closed. + * @throws { BusinessError } 14800015 - The database does not respond. + * @throws { BusinessError } 14800021 - SQLite: Generic error. + * @throws { BusinessError } 14800022 - SQLite: Callback routine requested an abort. + * @throws { BusinessError } 14800023 - SQLite: Access permission denied. + * @throws { BusinessError } 14800024 - SQLite: The database file is locked. + * @throws { BusinessError } 14800025 - SQLite: A table in the database is locked. + * @throws { BusinessError } 14800026 - SQLite: The database is out of memory. + * @throws { BusinessError } 14800027 - SQLite: Attempt to write a readonly database. + * @throws { BusinessError } 14800028 - SQLite: Some kind of disk I/O error occurred. + * @throws { BusinessError } 14800029 - SQLite: The database is full. + * @throws { BusinessError } 14800030 - SQLite: Unable to open the database file. + * @throws { BusinessError } 14800031 - SQLite: TEXT or BLOB exceeds size limit. + * @throws { BusinessError } 14800032 - SQLite: Abort due to constraint violation. + * @throws { BusinessError } 14800033 - SQLite: Data type mismatch. + * @throws { BusinessError } 14800034 - SQLite: Library used incorrectly. + * @throws { BusinessError } 14800047 - The WAL file size exceeds the default limit. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @crossplatform + * @since 12 + */ + update(values: ValuesBucket, predicates: RdbPredicates, conflict: ConflictResolution): Promise; + /** + * Updates data in the database based on a specified instance object of RdbPredicates with sync interface. + * + * @param { ValuesBucket } values - Indicates the row of data to be updated in the database. + * The key-value pairs are associated with column names of the database table. + * @param { RdbPredicates } predicates - Indicates the specified update condition by the instance object of {@link RdbPredicates}. + * @param { ConflictResolution } conflict - Indicates the {@link ConflictResolution} to insert data into the table. + * @returns { number } The number of affected rows. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @throws { BusinessError } 14800000 - Inner error. + * @throws { BusinessError } 14800011 - Database corrupted. + * @throws { BusinessError } 14800014 - Already closed. + * @throws { BusinessError } 14800015 - The database does not respond. + * @throws { BusinessError } 14800021 - SQLite: Generic error. + * @throws { BusinessError } 14800022 - SQLite: Callback routine requested an abort. + * @throws { BusinessError } 14800023 - SQLite: Access permission denied. + * @throws { BusinessError } 14800024 - SQLite: The database file is locked. + * @throws { BusinessError } 14800025 - SQLite: A table in the database is locked. + * @throws { BusinessError } 14800026 - SQLite: The database is out of memory. + * @throws { BusinessError } 14800027 - SQLite: Attempt to write a readonly database. + * @throws { BusinessError } 14800028 - SQLite: Some kind of disk I/O error occurred. + * @throws { BusinessError } 14800029 - SQLite: The database is full. + * @throws { BusinessError } 14800030 - SQLite: Unable to open the database file. + * @throws { BusinessError } 14800031 - SQLite: TEXT or BLOB exceeds size limit. + * @throws { BusinessError } 14800032 - SQLite: Abort due to constraint violation. + * @throws { BusinessError } 14800033 - SQLite: Data type mismatch. + * @throws { BusinessError } 14800034 - SQLite: Library used incorrectly. + * @throws { BusinessError } 14800047 - The WAL file size exceeds the default limit. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @crossplatform + * @since 12 + */ + updateSync(values: ValuesBucket, predicates: RdbPredicates, conflict?: ConflictResolution): number; + /** + * Deletes data from the database based on a specified instance object of RdbPredicates. + * + * @param { RdbPredicates } predicates - The specified delete condition by the instance object of {@link RdbPredicates}. + * @param { AsyncCallback } callback - The number of affected rows. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @throws { BusinessError } 14800000 - Inner error. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 9 + */ + /** + * Deletes data from the database based on a specified instance object of RdbPredicates. + * + * @param { RdbPredicates } predicates - The specified delete condition by the instance object of {@link RdbPredicates}. + * @param { AsyncCallback } callback - The number of affected rows. + * @throws { BusinessError } 14800047 - The WAL file size exceeds the default limit. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @throws { BusinessError } 14800000 - Inner error. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @crossplatform + * @since 10 + */ + /** + * Deletes data from the database based on a specified instance object of RdbPredicates. + * + * @param { RdbPredicates } predicates - The specified delete condition by the instance object of {@link RdbPredicates}. + * @param { AsyncCallback } callback - The number of affected rows. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @throws { BusinessError } 14800000 - Inner error. + * @throws { BusinessError } 14800011 - Database corrupted. + * @throws { BusinessError } 14800014 - Already closed. + * @throws { BusinessError } 14800015 - The database does not respond. + * @throws { BusinessError } 14800021 - SQLite: Generic error. + * @throws { BusinessError } 14800022 - SQLite: Callback routine requested an abort. + * @throws { BusinessError } 14800023 - SQLite: Access permission denied. + * @throws { BusinessError } 14800024 - SQLite: The database file is locked. + * @throws { BusinessError } 14800025 - SQLite: A table in the database is locked. + * @throws { BusinessError } 14800026 - SQLite: The database is out of memory. + * @throws { BusinessError } 14800027 - SQLite: Attempt to write a readonly database. + * @throws { BusinessError } 14800028 - SQLite: Some kind of disk I/O error occurred. + * @throws { BusinessError } 14800029 - SQLite: The database is full. + * @throws { BusinessError } 14800030 - SQLite: Unable to open the database file. + * @throws { BusinessError } 14800031 - SQLite: TEXT or BLOB exceeds size limit. + * @throws { BusinessError } 14800032 - SQLite: Abort due to constraint violation. + * @throws { BusinessError } 14800033 - SQLite: Data type mismatch. + * @throws { BusinessError } 14800034 - SQLite: Library used incorrectly. + * @throws { BusinessError } 14800047 - The WAL file size exceeds the default limit. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @crossplatform + * @since 12 + */ + delete(predicates: RdbPredicates, callback: AsyncCallback): void; + /** + * Deletes data from the database based on a specified instance object of RdbPredicates. + * + * @param { RdbPredicates } predicates - The specified delete condition by the instance object of {@link RdbPredicates}. + * @returns { Promise } The number of affected rows. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @throws { BusinessError } 14800000 - Inner error. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 9 + */ + /** + * Deletes data from the database based on a specified instance object of RdbPredicates. + * + * @param { RdbPredicates } predicates - The specified delete condition by the instance object of {@link RdbPredicates}. + * @returns { Promise } return the number of affected rows. + * @throws { BusinessError } 14800047 - The WAL file size exceeds the default limit. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @throws { BusinessError } 14800000 - Inner error. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @crossplatform + * @since 10 + */ + /** + * Deletes data from the database based on a specified instance object of RdbPredicates. + * + * @param { RdbPredicates } predicates - The specified delete condition by the instance object of {@link RdbPredicates}. + * @returns { Promise } return the number of affected rows. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @throws { BusinessError } 14800000 - Inner error. + * @throws { BusinessError } 14800011 - Database corrupted. + * @throws { BusinessError } 14800014 - Already closed. + * @throws { BusinessError } 14800015 - The database does not respond. + * @throws { BusinessError } 14800021 - SQLite: Generic error. + * @throws { BusinessError } 14800022 - SQLite: Callback routine requested an abort. + * @throws { BusinessError } 14800023 - SQLite: Access permission denied. + * @throws { BusinessError } 14800024 - SQLite: The database file is locked. + * @throws { BusinessError } 14800025 - SQLite: A table in the database is locked. + * @throws { BusinessError } 14800026 - SQLite: The database is out of memory. + * @throws { BusinessError } 14800027 - SQLite: Attempt to write a readonly database. + * @throws { BusinessError } 14800028 - SQLite: Some kind of disk I/O error occurred. + * @throws { BusinessError } 14800029 - SQLite: The database is full. + * @throws { BusinessError } 14800030 - SQLite: Unable to open the database file. + * @throws { BusinessError } 14800031 - SQLite: TEXT or BLOB exceeds size limit. + * @throws { BusinessError } 14800032 - SQLite: Abort due to constraint violation. + * @throws { BusinessError } 14800033 - SQLite: Data type mismatch. + * @throws { BusinessError } 14800034 - SQLite: Library used incorrectly. + * @throws { BusinessError } 14800047 - The WAL file size exceeds the default limit. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @crossplatform + * @since 12 + */ + delete(predicates: RdbPredicates): Promise; + /** + * Deletes data from the database based on a specified instance object of RdbPredicates with sync interface. + * + * @param { RdbPredicates } predicates - The specified delete condition by the instance object of {@link RdbPredicates}. + * @returns { number } return the number of affected rows. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @throws { BusinessError } 14800000 - Inner error. + * @throws { BusinessError } 14800011 - Database corrupted. + * @throws { BusinessError } 14800014 - Already closed. + * @throws { BusinessError } 14800015 - The database does not respond. + * @throws { BusinessError } 14800021 - SQLite: Generic error. + * @throws { BusinessError } 14800022 - SQLite: Callback routine requested an abort. + * @throws { BusinessError } 14800023 - SQLite: Access permission denied. + * @throws { BusinessError } 14800024 - SQLite: The database file is locked. + * @throws { BusinessError } 14800025 - SQLite: A table in the database is locked. + * @throws { BusinessError } 14800026 - SQLite: The database is out of memory. + * @throws { BusinessError } 14800027 - SQLite: Attempt to write a readonly database. + * @throws { BusinessError } 14800028 - SQLite: Some kind of disk I/O error occurred. + * @throws { BusinessError } 14800029 - SQLite: The database is full. + * @throws { BusinessError } 14800030 - SQLite: Unable to open the database file. + * @throws { BusinessError } 14800031 - SQLite: TEXT or BLOB exceeds size limit. + * @throws { BusinessError } 14800032 - SQLite: Abort due to constraint violation. + * @throws { BusinessError } 14800033 - SQLite: Data type mismatch. + * @throws { BusinessError } 14800034 - SQLite: Library used incorrectly. + * @throws { BusinessError } 14800047 - The WAL file size exceeds the default limit. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @crossplatform + * @since 12 + */ + deleteSync(predicates: RdbPredicates): number; + /** + * Queries data in the database based on specified conditions. + * + * @param { RdbPredicates } predicates - The specified query condition by the instance object of {@link RdbPredicates}. + * @param { AsyncCallback } callback - The {@link ResultSet} object if the operation is successful. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @throws { BusinessError } 14800000 - Inner error. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @crossplatform + * @since 10 + */ + /** + * Queries data in the database based on specified conditions. + * + * @param { RdbPredicates } predicates - The specified query condition by the instance object of {@link RdbPredicates}. + * @param { AsyncCallback } callback - The {@link ResultSet} object if the operation is successful. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @throws { BusinessError } 14800000 - Inner error. + * @throws { BusinessError } 14800014 - Already closed. + * @throws { BusinessError } 14800015 - The database does not respond. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @crossplatform + * @since 12 + */ + query(predicates: RdbPredicates, callback: AsyncCallback): void; + /** + * Queries data in the database based on specified conditions. + * + * @param { RdbPredicates } predicates - The specified query condition by the instance object of {@link RdbPredicates}. + * @param { Array } columns - The columns to query. If the value is empty array, the query applies to all columns. + * @param { AsyncCallback } callback - The {@link ResultSet} object if the operation is successful. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @throws { BusinessError } 14800000 - Inner error. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 9 + */ + /** + * Queries data in the database based on specified conditions. + * + * @param { RdbPredicates } predicates - The specified query condition by the instance object of {@link RdbPredicates}. + * @param { Array } columns - The columns to query. If the value is empty array, the query applies to all columns. + * @param { AsyncCallback } callback - The {@link ResultSet} object if the operation is successful. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @throws { BusinessError } 14800000 - Inner error. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @crossplatform + * @since 10 + */ + /** + * Queries data in the database based on specified conditions. + * + * @param { RdbPredicates } predicates - The specified query condition by the instance object of {@link RdbPredicates}. + * @param { Array } columns - The columns to query. If the value is empty array, the query applies to all columns. + * @param { AsyncCallback } callback - The {@link ResultSet} object if the operation is successful. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @throws { BusinessError } 14800000 - Inner error. + * @throws { BusinessError } 14800014 - Already closed. + * @throws { BusinessError } 14800015 - The database does not respond. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @crossplatform + * @since 12 + */ + query(predicates: RdbPredicates, columns: Array, callback: AsyncCallback): void; + /** + * Queries data in the database based on specified conditions. + * + * @param { RdbPredicates } predicates - The specified query condition by the instance object of {@link RdbPredicates}. + * @param { Array } columns - The columns to query. If the value is null, the query applies to all columns. + * @returns { Promise } The {@link ResultSet} object if the operation is successful. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @throws { BusinessError } 14800000 - Inner error. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 9 + */ + /** + * Queries data in the database based on specified conditions. + * + * @param { RdbPredicates } predicates - The specified query condition by the instance object of {@link RdbPredicates}. + * @param { Array } columns - The columns to query. If the value is null, the query applies to all columns. + * @returns { Promise } The {@link ResultSet} object if the operation is successful. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @throws { BusinessError } 14800000 - Inner error. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @crossplatform + * @since 10 + */ + /** + * Queries data in the database based on specified conditions. + * + * @param { RdbPredicates } predicates - The specified query condition by the instance object of {@link RdbPredicates}. + * @param { Array } columns - The columns to query. If the value is null, the query applies to all columns. + * @returns { Promise } The {@link ResultSet} object if the operation is successful. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @throws { BusinessError } 14800000 - Inner error. + * @throws { BusinessError } 14800014 - Already closed. + * @throws { BusinessError } 14800015 - The database does not respond. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @crossplatform + * @since 12 + */ + query(predicates: RdbPredicates, columns?: Array): Promise; + /** + * Queries data in the database based on specified conditions with sync function. + * + * @param { RdbPredicates } predicates - The specified query condition by the instance object of {@link RdbPredicates}. + * @param { Array } columns - The columns to query. If the value is empty array, the query applies to all columns. + * @returns { ResultSet } The {@link ResultSet} object if the operation is successful. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @throws { BusinessError } 14800000 - Inner error. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @crossplatform + * @since 12 + */ + /** + * Queries data in the database based on specified conditions with sync function. + * + * @param { RdbPredicates } predicates - The specified query condition by the instance object of {@link RdbPredicates}. + * @param { Array } columns - The columns to query. If the value is empty array, the query applies to all columns. + * @returns { ResultSet } The {@link ResultSet} object if the operation is successful. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @throws { BusinessError } 14800000 - Inner error. + * @throws { BusinessError } 14800014 - Already closed. + * @throws { BusinessError } 14800015 - The database does not respond. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @crossplatform + * @since 12 + */ + querySync(predicates: RdbPredicates, columns?: Array): ResultSet; + /** + * Queries data in the database based on SQL statement. + * + * @param { string } sql - Indicates the SQL statement to execute. + * @param { AsyncCallback } callback - The {@link ResultSet} object if the operation is successful. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @throws { BusinessError } 14800000 - Inner error. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @crossplatform + * @since 10 + */ + /** + * Queries data in the database based on SQL statement. + * + * @param { string } sql - Indicates the SQL statement to execute. + * @param { AsyncCallback } callback - The {@link ResultSet} object if the operation is successful. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @throws { BusinessError } 14800000 - Inner error. + * @throws { BusinessError } 14800014 - Already closed. + * @throws { BusinessError } 14800015 - The database does not respond. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @crossplatform + * @since 12 + */ + querySql(sql: string, callback: AsyncCallback): void; + /** + * Queries data in the database based on SQL statement. + * + * @param { string } sql - Indicates the SQL statement to execute. + * @param { Array } bindArgs - Indicates the {@link ValueType} values of the parameters in the SQL statement. The values are strings. + * @param { AsyncCallback } callback - The {@link ResultSet} object if the operation is successful. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @throws { BusinessError } 14800000 - Inner error. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 9 + */ + /** + * Queries data in the database based on SQL statement. + * + * @param { string } sql - Indicates the SQL statement to execute. + * @param { Array } bindArgs - Indicates the {@link ValueType} values of the parameters in the SQL statement. The values are strings. + * @param { AsyncCallback } callback - The {@link ResultSet} object if the operation is successful. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @throws { BusinessError } 14800000 - Inner error. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @crossplatform + * @since 10 + */ + /** + * Queries data in the database based on SQL statement. + * + * @param { string } sql - Indicates the SQL statement to execute. + * @param { Array } bindArgs - Indicates the {@link ValueType} values of the parameters in the SQL statement. The values are strings. + * @param { AsyncCallback } callback - The {@link ResultSet} object if the operation is successful. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @throws { BusinessError } 14800000 - Inner error. + * @throws { BusinessError } 14800014 - Already closed. + * @throws { BusinessError } 14800015 - The database does not respond. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @crossplatform + * @since 12 + */ + querySql(sql: string, bindArgs: Array, callback: AsyncCallback): void; + /** + * Queries data in the database based on SQL statement. + * + * @param { string } sql - Indicates the SQL statement to execute. + * @param { Array } bindArgs - Indicates the {@link ValueType} values of the parameters in the SQL statement. The values are strings. + * @returns { Promise } The {@link ResultSet} object if the operation is successful. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @throws { BusinessError } 14800000 - Inner error. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 9 + */ + /** + * Queries data in the database based on SQL statement. + * + * @param { string } sql - Indicates the SQL statement to execute. + * @param { Array } bindArgs - Indicates the {@link ValueType} values of the parameters in the SQL statement. The values are strings. + * @returns { Promise } The {@link ResultSet} object if the operation is successful. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @throws { BusinessError } 14800000 - Inner error. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @crossplatform + * @since 10 + */ + /** + * Queries data in the database based on SQL statement. + * + * @param { string } sql - Indicates the SQL statement to execute. + * @param { Array } bindArgs - Indicates the {@link ValueType} values of the parameters in the SQL statement. The values are strings. + * @returns { Promise } The {@link ResultSet} object if the operation is successful. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @throws { BusinessError } 14800000 - Inner error. + * @throws { BusinessError } 14800014 - Already closed. + * @throws { BusinessError } 14800015 - The database does not respond. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @crossplatform + * @since 12 + */ + querySql(sql: string, bindArgs?: Array): Promise; + /** + * Queries data in the database based on SQL statement with sync interface. + * + * @param { string } sql - Indicates the SQL statement to execute. + * @param { Array } bindArgs - Indicates the {@link ValueType} values of the parameters in the SQL statement. The values are strings. + * @returns { ResultSet } The {@link ResultSet} object if the operation is successful. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @throws { BusinessError } 14800000 - Inner error. + * @throws { BusinessError } 14800014 - Already closed. + * @throws { BusinessError } 14800015 - The database does not respond. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @crossplatform + * @since 12 + */ + querySqlSync(sql: string, bindArgs?: Array): ResultSet; + /** + * Obtains the modify time of rows corresponding to the primary keys. + * + * @param { string } table - Indicates the name of the table to check. + * @param { string } columnName - Indicates the name of the column to check. + * @param { PRIKeyType[] } primaryKeys - Indicates the primary keys of the rows to check. + * @returns { Promise } -The promise returned by the function. ModifyTime indicates the modify time of current row. + * If this table does not support cloud, the {@link ModifyTime} will be empty. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 14800000 - Inner error. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Need 3 - 4 parameter(s)! 2. The RdbStore must be not nullptr. + * 3. The tablesNames must be not empty string. 4. The columnName must be not empty string. 5. The PRIKey must be number or string. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 10 + */ + /** + * Obtains the modify time of rows corresponding to the primary keys. + * + * @param { string } table - Indicates the name of the table to check. + * @param { string } columnName - Indicates the name of the column to check. + * @param { PRIKeyType[] } primaryKeys - Indicates the primary keys of the rows to check. + * @returns { Promise } -The promise returned by the function. ModifyTime indicates the modify time of current row. + * If this table does not support cloud, the {@link ModifyTime} will be empty. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Need 3 - 4 parameter(s)! 2. The RdbStore must be not nullptr. + * 3. The tablesNames must be not empty string. 4. The columnName must be not empty string. 5. The PRIKey must be number or string. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 14800000 - Inner error. + * @throws { BusinessError } 14800011 - Database corrupted. + * @throws { BusinessError } 14800014 - Already closed. + * @throws { BusinessError } 14800015 - The database does not respond. + * @throws { BusinessError } 14800021 - SQLite: Generic error. + * @throws { BusinessError } 14800022 - SQLite: Callback routine requested an abort. + * @throws { BusinessError } 14800023 - SQLite: Access permission denied. + * @throws { BusinessError } 14800024 - SQLite: The database file is locked. + * @throws { BusinessError } 14800025 - SQLite: A table in the database is locked. + * @throws { BusinessError } 14800026 - SQLite: The database is out of memory. + * @throws { BusinessError } 14800027 - SQLite: Attempt to write a readonly database. + * @throws { BusinessError } 14800028 - SQLite: Some kind of disk I/O error occurred. + * @throws { BusinessError } 14800029 - SQLite: The database is full. + * @throws { BusinessError } 14800030 - SQLite: Unable to open the database file. + * @throws { BusinessError } 14800031 - SQLite: TEXT or BLOB exceeds size limit. + * @throws { BusinessError } 14800032 - SQLite: Abort due to constraint violation. + * @throws { BusinessError } 14800033 - SQLite: Data type mismatch. + * @throws { BusinessError } 14800034 - SQLite: Library used incorrectly. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 12 + */ + getModifyTime(table: string, columnName: string, primaryKeys: PRIKeyType[]): Promise; + /** + * Obtains the modify time of rows corresponding to the primary keys. + * + * @param { string } table - Indicates the name of the table to check. + * @param { string } columnName - Indicates the name of the column to check. + * @param { PRIKeyType[] } primaryKeys - Indicates the primary keys of the rows to check. + * @param { AsyncCallback } callback - The callback of getModifyTime. ModifyTime indicates the modify time of current row. + * If this table does not support cloud, the {@link ModifyTime} will be empty. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 14800000 - Inner error. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Need 3 - 4 parameter(s)! 2. The RdbStore must be not nullptr. + * 3. The tablesNames must be not empty string. 4. The columnName must be not empty string. 5. The PRIKey must be number or string. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 10 + */ + /** + * Obtains the modify time of rows corresponding to the primary keys. + * + * @param { string } table - Indicates the name of the table to check. + * @param { string } columnName - Indicates the name of the column to check. + * @param { PRIKeyType[] } primaryKeys - Indicates the primary keys of the rows to check. + * @param { AsyncCallback } callback - The callback of getModifyTime. ModifyTime indicates the modify time of current row. + * If this table does not support cloud, the {@link ModifyTime} will be empty. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Need 3 - 4 parameter(s)! 2. The RdbStore must be not nullptr. + * 3. The tablesNames must be not empty string. 4. The columnName must be not empty string. 5. The PRIKey must be number or string. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 14800000 - Inner error. + * @throws { BusinessError } 14800011 - Database corrupted. + * @throws { BusinessError } 14800014 - Already closed. + * @throws { BusinessError } 14800015 - The database does not respond. + * @throws { BusinessError } 14800021 - SQLite: Generic error. + * @throws { BusinessError } 14800022 - SQLite: Callback routine requested an abort. + * @throws { BusinessError } 14800023 - SQLite: Access permission denied. + * @throws { BusinessError } 14800024 - SQLite: The database file is locked. + * @throws { BusinessError } 14800025 - SQLite: A table in the database is locked. + * @throws { BusinessError } 14800026 - SQLite: The database is out of memory. + * @throws { BusinessError } 14800027 - SQLite: Attempt to write a readonly database. + * @throws { BusinessError } 14800028 - SQLite: Some kind of disk I/O error occurred. + * @throws { BusinessError } 14800029 - SQLite: The database is full. + * @throws { BusinessError } 14800030 - SQLite: Unable to open the database file. + * @throws { BusinessError } 14800031 - SQLite: TEXT or BLOB exceeds size limit. + * @throws { BusinessError } 14800032 - SQLite: Abort due to constraint violation. + * @throws { BusinessError } 14800033 - SQLite: Data type mismatch. + * @throws { BusinessError } 14800034 - SQLite: Library used incorrectly. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 12 + */ + getModifyTime(table: string, columnName: string, primaryKeys: PRIKeyType[], callback: AsyncCallback): void; + /** + * Cleans the dirty data, which is the data deleted in the cloud. + * + * Data with a cursor smaller than the specified cursor will be cleaned up. + * + * @param { string } table - Indicates the name of the table to check. + * @param { number } cursor - Indicates the position of the data to be cleaned up. + * @param { AsyncCallback } callback - Indicates the callback invoked to return the result. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 14800000 - Inner error. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Need 1 - 3 parameter(s)! 2. The RdbStore must be not nullptr. + * 3. The tablesNames must be not empty string. 4. The cursor must be valid cursor. + * @syscap SystemCapability.DistributedDataManager.CloudSync.Client + * @since 11 + */ + /** + * Cleans the dirty data, which is the data deleted in the cloud. + * + * Data with a cursor smaller than the specified cursor will be cleaned up. + * + * @param { string } table - Indicates the name of the table to check. + * @param { number } cursor - Indicates the position of the data to be cleaned up. + * @param { AsyncCallback } callback - Indicates the callback invoked to return the result. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Need 1 - 3 parameter(s)! 2. The RdbStore must be not nullptr. + * 3. The tablesNames must be not empty string. 4. The cursor must be valid cursor. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 14800000 - Inner error. + * @throws { BusinessError } 14800011 - Database corrupted. + * @throws { BusinessError } 14800014 - Already closed. + * @throws { BusinessError } 14800015 - The database does not respond. + * @throws { BusinessError } 14800021 - SQLite: Generic error. + * @throws { BusinessError } 14800022 - SQLite: Callback routine requested an abort. + * @throws { BusinessError } 14800023 - SQLite: Access permission denied. + * @throws { BusinessError } 14800024 - SQLite: The database file is locked. + * @throws { BusinessError } 14800025 - SQLite: A table in the database is locked. + * @throws { BusinessError } 14800026 - SQLite: The database is out of memory. + * @throws { BusinessError } 14800027 - SQLite: Attempt to write a readonly database. + * @throws { BusinessError } 14800028 - SQLite: Some kind of disk I/O error occurred. + * @throws { BusinessError } 14800029 - SQLite: The database is full. + * @throws { BusinessError } 14800030 - SQLite: Unable to open the database file. + * @throws { BusinessError } 14800031 - SQLite: TEXT or BLOB exceeds size limit. + * @throws { BusinessError } 14800032 - SQLite: Abort due to constraint violation. + * @throws { BusinessError } 14800033 - SQLite: Data type mismatch. + * @throws { BusinessError } 14800034 - SQLite: Library used incorrectly. + * @syscap SystemCapability.DistributedDataManager.CloudSync.Client + * @since 12 + */ + cleanDirtyData(table: string, cursor: number, callback: AsyncCallback): void; + /** + * Cleans all dirty data deleted in the cloud. + * + * @param { string } table - Indicates the name of the table to check. + * @param { AsyncCallback } callback - The callback of clean. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 14800000 - Inner error. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Need 1 - 3 parameter(s)! 2. The RdbStore must be not nullptr. + * 3. The tablesNames must be not empty string. + * @syscap SystemCapability.DistributedDataManager.CloudSync.Client + * @since 11 + */ + /** + * Cleans all dirty data deleted in the cloud. + * + * @param { string } table - Indicates the name of the table to check. + * @param { AsyncCallback } callback - The callback of clean. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Need 1 - 3 parameter(s). 2. The RdbStore must be not nullptr. + * 3. The tablesNames must be not empty string. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 14800000 - Inner error. + * @throws { BusinessError } 14800011 - Database corrupted. + * @throws { BusinessError } 14800014 - Already closed. + * @throws { BusinessError } 14800015 - The database does not respond. + * @throws { BusinessError } 14800021 - SQLite: Generic error. + * @throws { BusinessError } 14800022 - SQLite: Callback routine requested an abort. + * @throws { BusinessError } 14800023 - SQLite: Access permission denied. + * @throws { BusinessError } 14800024 - SQLite: The database file is locked. + * @throws { BusinessError } 14800025 - SQLite: A table in the database is locked. + * @throws { BusinessError } 14800026 - SQLite: The database is out of memory. + * @throws { BusinessError } 14800027 - SQLite: Attempt to write a readonly database. + * @throws { BusinessError } 14800028 - SQLite: Some kind of disk I/O error occurred. + * @throws { BusinessError } 14800029 - SQLite: The database is full. + * @throws { BusinessError } 14800030 - SQLite: Unable to open the database file. + * @throws { BusinessError } 14800031 - SQLite: TEXT or BLOB exceeds size limit. + * @throws { BusinessError } 14800032 - SQLite: Abort due to constraint violation. + * @throws { BusinessError } 14800033 - SQLite: Data type mismatch. + * @throws { BusinessError } 14800034 - SQLite: Library used incorrectly. + * @syscap SystemCapability.DistributedDataManager.CloudSync.Client + * @since 12 + */ + cleanDirtyData(table: string, callback: AsyncCallback): void; + /** + * Cleans dirty data deleted in the cloud. + * + * If a cursor is specified, data with a cursor smaller than the specified cursor will be cleaned up. + * otherwise clean all. + * + * @param { string } table - Indicates the name of the table to check. + * @param { number } [cursor] - Indicates the cursor. + * @returns { Promise } -The promise returned by the function. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 14800000 - Inner error. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Need 1 - 3 parameter(s)! 2. The RdbStore must be not nullptr. + * 3. The tablesNames must be not empty string. 4. The cursor must be valid cursor. + * @syscap SystemCapability.DistributedDataManager.CloudSync.Client + * @since 11 + */ + /** + * Cleans dirty data deleted in the cloud. + * + * If a cursor is specified, data with a cursor smaller than the specified cursor will be cleaned up. + * otherwise clean all. + * + * @param { string } table - Indicates the name of the table to check. + * @param { number } [cursor] - Indicates the cursor. + * @returns { Promise } -The promise returned by the function. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Need 1 - 3 parameter(s)! 2. The RdbStore must be not nullptr. + * 3. The tablesNames must be not empty string. 4. The cursor must be valid cursor. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 14800000 - Inner error. + * @throws { BusinessError } 14800011 - Database corrupted. + * @throws { BusinessError } 14800014 - Already closed. + * @throws { BusinessError } 14800015 - The database does not respond. + * @throws { BusinessError } 14800021 - SQLite: Generic error. + * @throws { BusinessError } 14800022 - SQLite: Callback routine requested an abort. + * @throws { BusinessError } 14800023 - SQLite: Access permission denied. + * @throws { BusinessError } 14800024 - SQLite: The database file is locked. + * @throws { BusinessError } 14800025 - SQLite: A table in the database is locked. + * @throws { BusinessError } 14800026 - SQLite: The database is out of memory. + * @throws { BusinessError } 14800027 - SQLite: Attempt to write a readonly database. + * @throws { BusinessError } 14800028 - SQLite: Some kind of disk I/O error occurred. + * @throws { BusinessError } 14800029 - SQLite: The database is full. + * @throws { BusinessError } 14800030 - SQLite: Unable to open the database file. + * @throws { BusinessError } 14800031 - SQLite: TEXT or BLOB exceeds size limit. + * @throws { BusinessError } 14800032 - SQLite: Abort due to constraint violation. + * @throws { BusinessError } 14800033 - SQLite: Data type mismatch. + * @throws { BusinessError } 14800034 - SQLite: Library used incorrectly. + * @syscap SystemCapability.DistributedDataManager.CloudSync.Client + * @since 12 + */ + cleanDirtyData(table: string, cursor?: number): Promise; + /** + * Executes a SQL statement that contains specified parameters but returns no value. + * + * @param { string } sql - Indicates the SQL statement to execute. + * @param { AsyncCallback } callback - The callback of executeSql. + * @throws { BusinessError } 14800047 - The WAL file size exceeds the default limit. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @throws { BusinessError } 14800000 - Inner error. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @crossplatform + * @since 10 + */ + /** + * Executes a SQL statement that contains specified parameters but returns no value. + * + * @param { string } sql - Indicates the SQL statement to execute. + * @param { AsyncCallback } callback - The callback of executeSql. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @throws { BusinessError } 801 - Capability not supported the sql(attach,begin,commit,rollback etc.). + * @throws { BusinessError } 14800000 - Inner error. + * @throws { BusinessError } 14800011 - Database corrupted. + * @throws { BusinessError } 14800014 - Already closed. + * @throws { BusinessError } 14800015 - The database does not respond. + * @throws { BusinessError } 14800021 - SQLite: Generic error. + * @throws { BusinessError } 14800022 - SQLite: Callback routine requested an abort. + * @throws { BusinessError } 14800023 - SQLite: Access permission denied. + * @throws { BusinessError } 14800024 - SQLite: The database file is locked. + * @throws { BusinessError } 14800025 - SQLite: A table in the database is locked. + * @throws { BusinessError } 14800026 - SQLite: The database is out of memory. + * @throws { BusinessError } 14800027 - SQLite: Attempt to write a readonly database. + * @throws { BusinessError } 14800028 - SQLite: Some kind of disk I/O error occurred. + * @throws { BusinessError } 14800029 - SQLite: The database is full. + * @throws { BusinessError } 14800030 - SQLite: Unable to open the database file. + * @throws { BusinessError } 14800031 - SQLite: TEXT or BLOB exceeds size limit. + * @throws { BusinessError } 14800032 - SQLite: Abort due to constraint violation. + * @throws { BusinessError } 14800033 - SQLite: Data type mismatch. + * @throws { BusinessError } 14800034 - SQLite: Library used incorrectly. + * @throws { BusinessError } 14800047 - The WAL file size exceeds the default limit. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @crossplatform + * @since 12 + */ + executeSql(sql: string, callback: AsyncCallback): void; + /** + * Executes a SQL statement that contains specified parameters but returns no value. + * + * @param { string } sql - Indicates the SQL statement to execute. + * @param { Array } bindArgs - Indicates the {@link ValueType} values of the parameters in the SQL statement. The values are strings. + * @param { AsyncCallback } callback - The callback of executeSql. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @throws { BusinessError } 14800000 - Inner error. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 9 + */ + /** + * Executes a SQL statement that contains specified parameters but returns no value. + * + * @param { string } sql - Indicates the SQL statement to execute. + * @param { Array } bindArgs - Indicates the {@link ValueType} values of the parameters in the SQL statement. The values are strings. + * @param { AsyncCallback } callback - The callback of executeSql. + * @throws { BusinessError } 14800047 - The WAL file size exceeds the default limit. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @throws { BusinessError } 14800000 - Inner error. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @crossplatform + * @since 10 + */ + /** + * Executes a SQL statement that contains specified parameters but returns no value. + * + * @param { string } sql - Indicates the SQL statement to execute. + * @param { Array } bindArgs - Indicates the {@link ValueType} values of the parameters in the SQL statement. The values are strings. + * @param { AsyncCallback } callback - The callback of executeSql. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @throws { BusinessError } 801 - Capability not supported the sql(attach,begin,commit,rollback etc.). + * @throws { BusinessError } 14800000 - Inner error. + * @throws { BusinessError } 14800011 - Database corrupted. + * @throws { BusinessError } 14800014 - Already closed. + * @throws { BusinessError } 14800015 - The database does not respond. + * @throws { BusinessError } 14800021 - SQLite: Generic error. + * @throws { BusinessError } 14800022 - SQLite: Callback routine requested an abort. + * @throws { BusinessError } 14800023 - SQLite: Access permission denied. + * @throws { BusinessError } 14800024 - SQLite: The database file is locked. + * @throws { BusinessError } 14800025 - SQLite: A table in the database is locked. + * @throws { BusinessError } 14800026 - SQLite: The database is out of memory. + * @throws { BusinessError } 14800027 - SQLite: Attempt to write a readonly database. + * @throws { BusinessError } 14800028 - SQLite: Some kind of disk I/O error occurred. + * @throws { BusinessError } 14800029 - SQLite: The database is full. + * @throws { BusinessError } 14800030 - SQLite: Unable to open the database file. + * @throws { BusinessError } 14800031 - SQLite: TEXT or BLOB exceeds size limit. + * @throws { BusinessError } 14800032 - SQLite: Abort due to constraint violation. + * @throws { BusinessError } 14800033 - SQLite: Data type mismatch. + * @throws { BusinessError } 14800034 - SQLite: Library used incorrectly. + * @throws { BusinessError } 14800047 - The WAL file size exceeds the default limit. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @crossplatform + * @since 12 + */ + executeSql(sql: string, bindArgs: Array, callback: AsyncCallback): void; + /** + * Executes a SQL statement that contains specified parameters but returns no value. + * + * @param { string } sql - Indicates the SQL statement to execute. + * @param { Array } bindArgs - Indicates the {@link ValueType} values of the parameters in the SQL statement. The values are strings. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @throws { BusinessError } 14800000 - Inner error. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 9 + */ + /** + * Executes a SQL statement that contains specified parameters but returns no value. + * + * @param { string } sql - Indicates the SQL statement to execute. + * @param { Array } bindArgs - Indicates the {@link ValueType} values of the parameters in the SQL statement. The values are strings. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 14800047 - The WAL file size exceeds the default limit. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @throws { BusinessError } 14800000 - Inner error. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @crossplatform + * @since 10 + */ + /** + * Executes a SQL statement that contains specified parameters but returns no value. + * + * @param { string } sql - Indicates the SQL statement to execute. + * @param { Array } bindArgs - Indicates the {@link ValueType} values of the parameters in the SQL statement. The values are strings. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @throws { BusinessError } 801 - Capability not supported the sql(attach,begin,commit,rollback etc.). + * @throws { BusinessError } 14800000 - Inner error. + * @throws { BusinessError } 14800011 - Database corrupted. + * @throws { BusinessError } 14800014 - Already closed. + * @throws { BusinessError } 14800015 - The database does not respond. + * @throws { BusinessError } 14800021 - SQLite: Generic error. + * @throws { BusinessError } 14800022 - SQLite: Callback routine requested an abort. + * @throws { BusinessError } 14800023 - SQLite: Access permission denied. + * @throws { BusinessError } 14800024 - SQLite: The database file is locked. + * @throws { BusinessError } 14800025 - SQLite: A table in the database is locked. + * @throws { BusinessError } 14800026 - SQLite: The database is out of memory. + * @throws { BusinessError } 14800027 - SQLite: Attempt to write a readonly database. + * @throws { BusinessError } 14800028 - SQLite: Some kind of disk I/O error occurred. + * @throws { BusinessError } 14800029 - SQLite: The database is full. + * @throws { BusinessError } 14800030 - SQLite: Unable to open the database file. + * @throws { BusinessError } 14800031 - SQLite: TEXT or BLOB exceeds size limit. + * @throws { BusinessError } 14800032 - SQLite: Abort due to constraint violation. + * @throws { BusinessError } 14800033 - SQLite: Data type mismatch. + * @throws { BusinessError } 14800034 - SQLite: Library used incorrectly. + * @throws { BusinessError } 14800047 - The WAL file size exceeds the default limit. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @crossplatform + * @since 12 + */ + executeSql(sql: string, bindArgs?: Array): Promise; + /** + * Executes a SQL statement that contains specified parameters and returns a value of ValueType. + * + * @param { string } sql - Indicates the SQL statement to execute. + * @param { Array } args - Indicates the {@link ValueType} values of the parameters in the SQL statement. The values are strings. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @throws { BusinessError } 801 - Capability not supported the sql(attach,begin,commit,rollback etc.). + * @throws { BusinessError } 14800000 - Inner error. + * @throws { BusinessError } 14800011 - Database corrupted. + * @throws { BusinessError } 14800014 - Already closed. + * @throws { BusinessError } 14800015 - The database does not respond. + * @throws { BusinessError } 14800021 - SQLite: Generic error. + * @throws { BusinessError } 14800022 - SQLite: Callback routine requested an abort. + * @throws { BusinessError } 14800023 - SQLite: Access permission denied. + * @throws { BusinessError } 14800024 - SQLite: The database file is locked. + * @throws { BusinessError } 14800025 - SQLite: A table in the database is locked. + * @throws { BusinessError } 14800026 - SQLite: The database is out of memory. + * @throws { BusinessError } 14800027 - SQLite: Attempt to write a readonly database. + * @throws { BusinessError } 14800028 - SQLite: Some kind of disk I/O error occurred. + * @throws { BusinessError } 14800029 - SQLite: The database is full. + * @throws { BusinessError } 14800030 - SQLite: Unable to open the database file. + * @throws { BusinessError } 14800031 - SQLite: TEXT or BLOB exceeds size limit. + * @throws { BusinessError } 14800032 - SQLite: Abort due to constraint violation. + * @throws { BusinessError } 14800033 - SQLite: Data type mismatch. + * @throws { BusinessError } 14800034 - SQLite: Library used incorrectly. + * @throws { BusinessError } 14800047 - The WAL file size exceeds the default limit. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 12 + */ + execute(sql: string, args?: Array): Promise; + /** + * Executes a SQL statement that contains specified parameters and returns a value of ValueType. + * + * @param { string } sql - Indicates the SQL statement to execute. + * @param { number } txId - Indicates the transaction ID which is obtained by beginTrans or 0. + * @param { Array } args - Indicates the {@link ValueType} values of the parameters in the SQL statement. The values are strings. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @throws { BusinessError } 801 - Capability not supported the sql(attach,begin,commit,rollback etc.). + * @throws { BusinessError } 14800000 - Inner error. + * @throws { BusinessError } 14800011 - Database corrupted. + * @throws { BusinessError } 14800014 - Already closed. + * @throws { BusinessError } 14800015 - The database does not respond. + * @throws { BusinessError } 14800021 - SQLite: Generic error. + * @throws { BusinessError } 14800022 - SQLite: Callback routine requested an abort. + * @throws { BusinessError } 14800023 - SQLite: Access permission denied. + * @throws { BusinessError } 14800024 - SQLite: The database file is locked. + * @throws { BusinessError } 14800025 - SQLite: A table in the database is locked. + * @throws { BusinessError } 14800026 - SQLite: The database is out of memory. + * @throws { BusinessError } 14800027 - SQLite: Attempt to write a readonly database. + * @throws { BusinessError } 14800028 - SQLite: Some kind of disk I/O error occurred. + * @throws { BusinessError } 14800029 - SQLite: The database is full. + * @throws { BusinessError } 14800030 - SQLite: Unable to open the database file. + * @throws { BusinessError } 14800031 - SQLite: TEXT or BLOB exceeds size limit. + * @throws { BusinessError } 14800032 - SQLite: Abort due to constraint violation. + * @throws { BusinessError } 14800033 - SQLite: Data type mismatch. + * @throws { BusinessError } 14800034 - SQLite: Library used incorrectly. + * @throws { BusinessError } 14800047 - The WAL file size exceeds the default limit. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 12 + */ + execute(sql: string, txId: number, args?: Array): Promise; + /** + * Executes a SQL statement that contains specified parameters and returns a value of ValueType with sync interface. + * + * @param { string } sql - Indicates the SQL statement to execute. + * @param { Array } args - Indicates the {@link ValueType} values of the parameters in the SQL statement. The values are strings. + * @returns { ValueType } The promise returned by the function. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @throws { BusinessError } 14800000 - Inner error. + * @throws { BusinessError } 14800011 - Database corrupted. + * @throws { BusinessError } 14800014 - Already closed. + * @throws { BusinessError } 14800015 - The database does not respond. + * @throws { BusinessError } 14800021 - SQLite: Generic error. + * @throws { BusinessError } 14800022 - SQLite: Callback routine requested an abort. + * @throws { BusinessError } 14800023 - SQLite: Access permission denied. + * @throws { BusinessError } 14800024 - SQLite: The database file is locked. + * @throws { BusinessError } 14800025 - SQLite: A table in the database is locked. + * @throws { BusinessError } 14800026 - SQLite: The database is out of memory. + * @throws { BusinessError } 14800027 - SQLite: Attempt to write a readonly database. + * @throws { BusinessError } 14800028 - SQLite: Some kind of disk I/O error occurred. + * @throws { BusinessError } 14800029 - SQLite: The database is full. + * @throws { BusinessError } 14800030 - SQLite: Unable to open the database file. + * @throws { BusinessError } 14800031 - SQLite: TEXT or BLOB exceeds size limit. + * @throws { BusinessError } 14800032 - SQLite: Abort due to constraint violation. + * @throws { BusinessError } 14800033 - SQLite: Data type mismatch. + * @throws { BusinessError } 14800034 - SQLite: Library used incorrectly. + * @throws { BusinessError } 14800047 - The WAL file size exceeds the default limit. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @crossplatform + * @since 12 + */ + executeSync(sql: string, args?: Array): ValueType; + /** + * BeginTransaction before execute your sql. + * + * @throws { BusinessError } 401 - Parameter error. The store must not be nullptr. + * @throws { BusinessError } 14800000 - Inner error. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 9 + */ + /** + * BeginTransaction before execute your sql. + * + * @throws { BusinessError } 14800047 - The WAL file size exceeds the default limit. + * @throws { BusinessError } 401 - Parameter error. The store must not be nullptr. + * @throws { BusinessError } 14800000 - Inner error. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @crossplatform + * @since 10 + */ + /** + * BeginTransaction before execute your sql. + * + * @throws { BusinessError } 401 - Parameter error. The store must not be nullptr. + * @throws { BusinessError } 14800000 - Inner error. + * @throws { BusinessError } 14800011 - Database corrupted. + * @throws { BusinessError } 14800014 - Already closed. + * @throws { BusinessError } 14800015 - The database does not respond. + * @throws { BusinessError } 14800021 - SQLite: Generic error. + * @throws { BusinessError } 14800022 - SQLite: Callback routine requested an abort. + * @throws { BusinessError } 14800023 - SQLite: Access permission denied. + * @throws { BusinessError } 14800024 - SQLite: The database file is locked. + * @throws { BusinessError } 14800025 - SQLite: A table in the database is locked. + * @throws { BusinessError } 14800026 - SQLite: The database is out of memory. + * @throws { BusinessError } 14800027 - SQLite: Attempt to write a readonly database. + * @throws { BusinessError } 14800028 - SQLite: Some kind of disk I/O error occurred. + * @throws { BusinessError } 14800029 - SQLite: The database is full. + * @throws { BusinessError } 14800030 - SQLite: Unable to open the database file. + * @throws { BusinessError } 14800031 - SQLite: TEXT or BLOB exceeds size limit. + * @throws { BusinessError } 14800032 - SQLite: Abort due to constraint violation. + * @throws { BusinessError } 14800033 - SQLite: Data type mismatch. + * @throws { BusinessError } 14800034 - SQLite: Library used incorrectly. + * @throws { BusinessError } 14800047 - The WAL file size exceeds the default limit. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @crossplatform + * @since 12 + */ + beginTransaction(): void; + /** + * Begins a transaction before executing the SQL statement. + * + * @returns { Promise } Returns the transaction ID. + * @throws { BusinessError } 401 - Parameter error. The store must not be nullptr. + * @throws { BusinessError } 801 - Capability not supported the sql(attach,begin,commit,rollback etc.). + * @throws { BusinessError } 14800000 - Inner error. + * @throws { BusinessError } 14800011 - Database corrupted. + * @throws { BusinessError } 14800014 - Already closed. + * @throws { BusinessError } 14800015 - The database does not respond. + * @throws { BusinessError } 14800021 - SQLite: Generic error. + * @throws { BusinessError } 14800022 - SQLite: Callback routine requested an abort. + * @throws { BusinessError } 14800023 - SQLite: Access permission denied. + * @throws { BusinessError } 14800024 - SQLite: The database file is locked. + * @throws { BusinessError } 14800025 - SQLite: A table in the database is locked. + * @throws { BusinessError } 14800026 - SQLite: The database is out of memory. + * @throws { BusinessError } 14800027 - SQLite: Attempt to write a readonly database. + * @throws { BusinessError } 14800028 - SQLite: Some kind of disk I/O error occurred. + * @throws { BusinessError } 14800029 - SQLite: The database is full. + * @throws { BusinessError } 14800030 - SQLite: Unable to open the database file. + * @throws { BusinessError } 14800031 - SQLite: TEXT or BLOB exceeds size limit. + * @throws { BusinessError } 14800032 - SQLite: Abort due to constraint violation. + * @throws { BusinessError } 14800033 - SQLite: Data type mismatch. + * @throws { BusinessError } 14800034 - SQLite: Library used incorrectly. + * @throws { BusinessError } 14800047 - The WAL file size exceeds the default limit. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 12 + */ + beginTrans(): Promise; + /** + * Commit the the sql you have executed. + * + * @throws { BusinessError } 401 - Parameter error. The store must not be nullptr. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 9 + */ + /** + * Commit the the sql you have executed. + * + * @throws { BusinessError } 401 - Parameter error. The store must not be nullptr. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @crossplatform + * @since 10 + */ + /** + * Commit the the sql you have executed. + * + * @throws { BusinessError } 401 - Parameter error. The store must not be nullptr. + * @throws { BusinessError } 14800000 - Inner error. + * @throws { BusinessError } 14800011 - Database corrupted. + * @throws { BusinessError } 14800014 - Already closed. + * @throws { BusinessError } 14800015 - The database does not respond. + * @throws { BusinessError } 14800021 - SQLite: Generic error. + * @throws { BusinessError } 14800022 - SQLite: Callback routine requested an abort. + * @throws { BusinessError } 14800023 - SQLite: Access permission denied. + * @throws { BusinessError } 14800024 - SQLite: The database file is locked. + * @throws { BusinessError } 14800025 - SQLite: A table in the database is locked. + * @throws { BusinessError } 14800026 - SQLite: The database is out of memory. + * @throws { BusinessError } 14800027 - SQLite: Attempt to write a readonly database. + * @throws { BusinessError } 14800028 - SQLite: Some kind of disk I/O error occurred. + * @throws { BusinessError } 14800029 - SQLite: The database is full. + * @throws { BusinessError } 14800030 - SQLite: Unable to open the database file. + * @throws { BusinessError } 14800031 - SQLite: TEXT or BLOB exceeds size limit. + * @throws { BusinessError } 14800032 - SQLite: Abort due to constraint violation. + * @throws { BusinessError } 14800033 - SQLite: Data type mismatch. + * @throws { BusinessError } 14800034 - SQLite: Library used incorrectly. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @crossplatform + * @since 12 + */ + commit(): void; + /** + * Commits the SQL statement executed. + * + * @param { number } txId - Indicates the transaction ID which is obtained by beginTrans. + * @returns { Promise } Promise used to return the result. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @throws { BusinessError } 14800011 - Database corrupted. + * @throws { BusinessError } 14800000 - Inner error. + * @throws { BusinessError } 14800014 - Already closed. + * @throws { BusinessError } 14800015 - The database does not respond. + * @throws { BusinessError } 14800021 - SQLite: Generic error. + * @throws { BusinessError } 14800022 - SQLite: Callback routine requested an abort. + * @throws { BusinessError } 14800023 - SQLite: Access permission denied. + * @throws { BusinessError } 14800024 - SQLite: The database file is locked. + * @throws { BusinessError } 14800025 - SQLite: A table in the database is locked. + * @throws { BusinessError } 14800026 - SQLite: The database is out of memory. + * @throws { BusinessError } 14800027 - SQLite: Attempt to write a readonly database. + * @throws { BusinessError } 14800028 - SQLite: Some kind of disk I/O error occurred. + * @throws { BusinessError } 14800029 - SQLite: The database is full. + * @throws { BusinessError } 14800030 - SQLite: Unable to open the database file. + * @throws { BusinessError } 14800031 - SQLite: TEXT or BLOB exceeds size limit. + * @throws { BusinessError } 14800032 - SQLite: Abort due to constraint violation. + * @throws { BusinessError } 14800033 - SQLite: Data type mismatch. + * @throws { BusinessError } 14800034 - SQLite: Library used incorrectly. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 12 + */ + commit(txId: number): Promise; + /** + * Roll back the sql you have already executed. + * + * @throws { BusinessError } 401 - Parameter error. The store must not be nullptr. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 9 + */ + /** + * Roll back the sql you have already executed. + * + * @throws { BusinessError } 401 - Parameter error. The store must not be nullptr. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @crossplatform + * @since 10 + */ + /** + * Roll back the sql you have already executed. + * + * @throws { BusinessError } 401 - Parameter error. The store must not be nullptr. + * @throws { BusinessError } 14800000 - Inner error. + * @throws { BusinessError } 14800011 - Database corrupted. + * @throws { BusinessError } 14800014 - Already closed. + * @throws { BusinessError } 14800015 - The database does not respond. + * @throws { BusinessError } 14800021 - SQLite: Generic error. + * @throws { BusinessError } 14800022 - SQLite: Callback routine requested an abort. + * @throws { BusinessError } 14800023 - SQLite: Access permission denied. + * @throws { BusinessError } 14800024 - SQLite: The database file is locked. + * @throws { BusinessError } 14800025 - SQLite: A table in the database is locked. + * @throws { BusinessError } 14800026 - SQLite: The database is out of memory. + * @throws { BusinessError } 14800027 - SQLite: Attempt to write a readonly database. + * @throws { BusinessError } 14800028 - SQLite: Some kind of disk I/O error occurred. + * @throws { BusinessError } 14800029 - SQLite: The database is full. + * @throws { BusinessError } 14800030 - SQLite: Unable to open the database file. + * @throws { BusinessError } 14800031 - SQLite: TEXT or BLOB exceeds size limit. + * @throws { BusinessError } 14800032 - SQLite: Abort due to constraint violation. + * @throws { BusinessError } 14800033 - SQLite: Data type mismatch. + * @throws { BusinessError } 14800034 - SQLite: Library used incorrectly. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @crossplatform + * @since 12 + */ + rollBack(): void; + /** + * Rolls back the SQL statement executed. + * + * @param { number } txId - Indicates the transaction ID which is obtained by beginTrans. + * @returns { Promise } Promise used to return the result. + * @throws { BusinessError } 401 - Parameter error. The store must not be nullptr. + * @throws { BusinessError } 14800011 - Database corrupted. + * @throws { BusinessError } 14800000 - Inner error. + * @throws { BusinessError } 14800014 - Already closed. + * @throws { BusinessError } 14800015 - The database does not respond. + * @throws { BusinessError } 14800021 - SQLite: Generic error. + * @throws { BusinessError } 14800022 - SQLite: Callback routine requested an abort. + * @throws { BusinessError } 14800023 - SQLite: Access permission denied. + * @throws { BusinessError } 14800024 - SQLite: The database file is locked. + * @throws { BusinessError } 14800025 - SQLite: A table in the database is locked. + * @throws { BusinessError } 14800026 - SQLite: The database is out of memory. + * @throws { BusinessError } 14800027 - SQLite: Attempt to write a readonly database. + * @throws { BusinessError } 14800028 - SQLite: Some kind of disk I/O error occurred. + * @throws { BusinessError } 14800029 - SQLite: The database is full. + * @throws { BusinessError } 14800030 - SQLite: Unable to open the database file. + * @throws { BusinessError } 14800031 - SQLite: TEXT or BLOB exceeds size limit. + * @throws { BusinessError } 14800032 - SQLite: Abort due to constraint violation. + * @throws { BusinessError } 14800033 - SQLite: Data type mismatch. + * @throws { BusinessError } 14800034 - SQLite: Library used incorrectly. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 12 + */ + rollback(txId: number): Promise; + /** + * Backs up a database in a specified name. + * + * @param { string } destName - Indicates the name that saves the database backup. + * @param { AsyncCallback } callback - The callback of backup. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @throws { BusinessError } 14800000 - Inner error. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 9 + */ + /** + * Backs up a database in a specified name. + * + * @param { string } destName - Indicates the name that saves the database backup. + * @param { AsyncCallback } callback - The callback of backup. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @throws { BusinessError } 14800000 - Inner error. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @crossplatform + * @since 10 + */ + /** + * Backs up a database in a specified name. + * + * @param { string } destName - Indicates the name that saves the database backup. + * @param { AsyncCallback } callback - The callback of backup. + * @throws { BusinessError } 401 - Parameter error. The store must not be nullptr. + * @throws { BusinessError } 14800000 - Inner error. + * @throws { BusinessError } 14800010 - Invalid database path. + * @throws { BusinessError } 14800011 - Database corrupted. + * @throws { BusinessError } 14800014 - Already closed. + * @throws { BusinessError } 14800015 - The database does not respond. + * @throws { BusinessError } 14800021 - SQLite: Generic error. + * @throws { BusinessError } 14800022 - SQLite: Callback routine requested an abort. + * @throws { BusinessError } 14800023 - SQLite: Access permission denied. + * @throws { BusinessError } 14800024 - SQLite: The database file is locked. + * @throws { BusinessError } 14800025 - SQLite: A table in the database is locked. + * @throws { BusinessError } 14800026 - SQLite: The database is out of memory. + * @throws { BusinessError } 14800027 - SQLite: Attempt to write a readonly database. + * @throws { BusinessError } 14800028 - SQLite: Some kind of disk I/O error occurred. + * @throws { BusinessError } 14800029 - SQLite: The database is full. + * @throws { BusinessError } 14800030 - SQLite: Unable to open the database file. + * @throws { BusinessError } 14800031 - SQLite: TEXT or BLOB exceeds size limit. + * @throws { BusinessError } 14800032 - SQLite: Abort due to constraint violation. + * @throws { BusinessError } 14800033 - SQLite: Data type mismatch. + * @throws { BusinessError } 14800034 - SQLite: Library used incorrectly. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @crossplatform + * @since 12 + */ + backup(destName: string, callback: AsyncCallback): void; + /** + * Backs up a database in a specified name. + * + * @param { string } destName - Indicates the name that saves the database backup. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @throws { BusinessError } 14800000 - Inner error. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 9 + */ + /** + * Backs up a database in a specified name. + * + * @param { string } destName - Indicates the name that saves the database backup. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @throws { BusinessError } 14800000 - Inner error. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @crossplatform + * @since 10 + */ + /** + * Backs up a database in a specified name. + * + * @param { string } destName - Indicates the name that saves the database backup. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @throws { BusinessError } 14800000 - Inner error. + * @throws { BusinessError } 14800011 - Database corrupted. + * @throws { BusinessError } 14800014 - Already closed. + * @throws { BusinessError } 14800015 - The database does not respond. + * @throws { BusinessError } 14800021 - SQLite: Generic error. + * @throws { BusinessError } 14800022 - SQLite: Callback routine requested an abort. + * @throws { BusinessError } 14800023 - SQLite: Access permission denied. + * @throws { BusinessError } 14800024 - SQLite: The database file is locked. + * @throws { BusinessError } 14800025 - SQLite: A table in the database is locked. + * @throws { BusinessError } 14800026 - SQLite: The database is out of memory. + * @throws { BusinessError } 14800027 - SQLite: Attempt to write a readonly database. + * @throws { BusinessError } 14800028 - SQLite: Some kind of disk I/O error occurred. + * @throws { BusinessError } 14800029 - SQLite: The database is full. + * @throws { BusinessError } 14800030 - SQLite: Unable to open the database file. + * @throws { BusinessError } 14800031 - SQLite: TEXT or BLOB exceeds size limit. + * @throws { BusinessError } 14800032 - SQLite: Abort due to constraint violation. + * @throws { BusinessError } 14800033 - SQLite: Data type mismatch. + * @throws { BusinessError } 14800034 - SQLite: Library used incorrectly. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @crossplatform + * @since 12 + */ + backup(destName: string): Promise; + /** + * Restores a database from a specified database file. + * + * @param { string } srcName - Indicates the name that saves the database file. + * @param { AsyncCallback } callback - The callback of restore. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @throws { BusinessError } 14800000 - Inner error. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 9 + */ + /** + * Restores a database from a specified database file. + * + * @param { string } srcName - Indicates the name that saves the database file. + * @param { AsyncCallback } callback - The callback of restore. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @throws { BusinessError } 14800000 - Inner error. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @crossplatform + * @since 10 + */ + /** + * Restores a database from a specified database file. + * + * @param { string } srcName - Indicates the name that saves the database file. + * @param { AsyncCallback } callback - The callback of restore. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @throws { BusinessError } 14800000 - Inner error. + * @throws { BusinessError } 14800011 - Database corrupted. + * @throws { BusinessError } 14800014 - Already closed. + * @throws { BusinessError } 14800015 - The database does not respond. + * @throws { BusinessError } 14800021 - SQLite: Generic error. + * @throws { BusinessError } 14800022 - SQLite: Callback routine requested an abort. + * @throws { BusinessError } 14800023 - SQLite: Access permission denied. + * @throws { BusinessError } 14800024 - SQLite: The database file is locked. + * @throws { BusinessError } 14800025 - SQLite: A table in the database is locked. + * @throws { BusinessError } 14800026 - SQLite: The database is out of memory. + * @throws { BusinessError } 14800027 - SQLite: Attempt to write a readonly database. + * @throws { BusinessError } 14800028 - SQLite: Some kind of disk I/O error occurred. + * @throws { BusinessError } 14800029 - SQLite: The database is full. + * @throws { BusinessError } 14800030 - SQLite: Unable to open the database file. + * @throws { BusinessError } 14800031 - SQLite: TEXT or BLOB exceeds size limit. + * @throws { BusinessError } 14800032 - SQLite: Abort due to constraint violation. + * @throws { BusinessError } 14800033 - SQLite: Data type mismatch. + * @throws { BusinessError } 14800034 - SQLite: Library used incorrectly. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @crossplatform + * @since 12 + */ + restore(srcName: string, callback: AsyncCallback): void; + /** + * Restores a database from a specified database file. + * + * @param { string } srcName - Indicates the name that saves the database file. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @throws { BusinessError } 14800000 - Inner error. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 9 + */ + /** + * Restores a database from a specified database file. + * + * @param { string } srcName - Indicates the name that saves the database file. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @throws { BusinessError } 14800000 - Inner error. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @crossplatform + * @since 10 + */ + /** + * Restores a database from a specified database file. + * + * @param { string } srcName - Indicates the name that saves the database file. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @throws { BusinessError } 14800000 - Inner error. + * @throws { BusinessError } 14800011 - Database corrupted. + * @throws { BusinessError } 14800014 - Already closed. + * @throws { BusinessError } 14800015 - The database does not respond. + * @throws { BusinessError } 14800021 - SQLite: Generic error. + * @throws { BusinessError } 14800022 - SQLite: Callback routine requested an abort. + * @throws { BusinessError } 14800023 - SQLite: Access permission denied. + * @throws { BusinessError } 14800024 - SQLite: The database file is locked. + * @throws { BusinessError } 14800025 - SQLite: A table in the database is locked. + * @throws { BusinessError } 14800026 - SQLite: The database is out of memory. + * @throws { BusinessError } 14800027 - SQLite: Attempt to write a readonly database. + * @throws { BusinessError } 14800028 - SQLite: Some kind of disk I/O error occurred. + * @throws { BusinessError } 14800029 - SQLite: The database is full. + * @throws { BusinessError } 14800030 - SQLite: Unable to open the database file. + * @throws { BusinessError } 14800031 - SQLite: TEXT or BLOB exceeds size limit. + * @throws { BusinessError } 14800032 - SQLite: Abort due to constraint violation. + * @throws { BusinessError } 14800033 - SQLite: Data type mismatch. + * @throws { BusinessError } 14800034 - SQLite: Library used incorrectly. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @crossplatform + * @since 12 + */ + restore(srcName: string): Promise; + /** + * Set table to be distributed table. + * + * @permission ohos.permission.DISTRIBUTED_DATASYNC + * @param { Array } tables - Indicates the table names you want to set. + * @param { AsyncCallback } callback - The callback of setDistributedTables. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @throws { BusinessError } 14800000 - Inner error. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 9 + */ + /** + * Set table to be distributed table. + * + * @permission ohos.permission.DISTRIBUTED_DATASYNC + * @param { Array } tables - Indicates the table names you want to set. + * @param { AsyncCallback } callback - The callback of setDistributedTables. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 14800000 - Inner error. + * @throws { BusinessError } 14800014 - Already closed. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 12 + */ + setDistributedTables(tables: Array, callback: AsyncCallback): void; + /** + * Set table to be distributed table. + * + * @permission ohos.permission.DISTRIBUTED_DATASYNC + * @param { Array } tables - Indicates the table names you want to set. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @throws { BusinessError } 14800000 - Inner error. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 9 + */ + /** + * Set table to be distributed table. + * + * @permission ohos.permission.DISTRIBUTED_DATASYNC + * @param { Array } tables - Indicates the table names you want to set. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 14800000 - Inner error. + * @throws { BusinessError } 14800014 - Already closed. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 12 + */ + setDistributedTables(tables: Array): Promise; + /** + * Set table to be distributed table. + * + * @permission ohos.permission.DISTRIBUTED_DATASYNC + * @param { Array } tables - Indicates the table names you want to set. + * @param { DistributedType } type - Indicates the distributed type {@link DistributedType}. + * This method only works when type equals to DistributedType.DISTRIBUTED_CLOUD + * @param { AsyncCallback } callback - The callback of setDistributedTables. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @throws { BusinessError } 14800000 - Inner error. + * @throws { BusinessError } 14800051 - The type of the distributed table does not match. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 10 + */ + /** + * Set table to be distributed table. + * + * @permission ohos.permission.DISTRIBUTED_DATASYNC + * @param { Array } tables - Indicates the table names you want to set. + * @param { DistributedType } type - Indicates the distributed type {@link DistributedType}. + * This method only works when type equals to DistributedType.DISTRIBUTED_CLOUD + * @param { AsyncCallback } callback - The callback of setDistributedTables. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 14800000 - Inner error. + * @throws { BusinessError } 14800014 - Already closed. + * @throws { BusinessError } 14800051 - The type of the distributed table does not match. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 12 + */ + setDistributedTables(tables: Array, type: DistributedType, callback: AsyncCallback): void; + /** + * Set table to be distributed table. + * + * @permission ohos.permission.DISTRIBUTED_DATASYNC + * @param { Array } tables - Indicates the table names you want to set. + * @param { DistributedType } type - Indicates the distributed type {@link DistributedType}. + * This method only works when type equals to DistributedType.DISTRIBUTED_CLOUD + * @param { DistributedConfig } config - Indicates the distributed config of the tables. For details, see {@link DistributedConfig}. + * @param { AsyncCallback } callback - The callback of setDistributedTables. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @throws { BusinessError } 14800000 - Inner error. + * @throws { BusinessError } 14800051 - The type of the distributed table does not match. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 10 + */ + /** + * Set table to be distributed table. + * + * @permission ohos.permission.DISTRIBUTED_DATASYNC + * @param { Array } tables - Indicates the table names you want to set. + * @param { DistributedType } type - Indicates the distributed type {@link DistributedType}. + * This method only works when type equals to DistributedType.DISTRIBUTED_CLOUD + * @param { DistributedConfig } config - Indicates the distributed config of the tables. For details, see {@link DistributedConfig}. + * @param { AsyncCallback } callback - The callback of setDistributedTables. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 14800000 - Inner error. + * @throws { BusinessError } 14800014 - Already closed. + * @throws { BusinessError } 14800051 - The type of the distributed table does not match. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 12 + */ + setDistributedTables(tables: Array, type: DistributedType, config: DistributedConfig, callback: AsyncCallback): void; + /** + * Set table to be a distributed table. + * + * @permission ohos.permission.DISTRIBUTED_DATASYNC + * @param { Array } tables - Indicates the table names you want to set. + * @param { DistributedType } type - Indicates the distributed type {@link DistributedType}. + * This method only works when type equals to DistributedType.DISTRIBUTED_CLOUD + * @param { DistributedConfig } config - Indicates the distributed config of the tables. For details, see {@link DistributedConfig}. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @throws { BusinessError } 14800000 - Inner error. + * @throws { BusinessError } 14800051 - The type of the distributed table does not match. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 10 + */ + /** + * Set table to be a distributed table. + * + * @permission ohos.permission.DISTRIBUTED_DATASYNC + * @param { Array } tables - Indicates the table names you want to set. + * @param { DistributedType } type - Indicates the distributed type {@link DistributedType}. + * This method only works when type equals to DistributedType.DISTRIBUTED_CLOUD + * @param { DistributedConfig } config - Indicates the distributed config of the tables. For details, see {@link DistributedConfig}. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 14800000 - Inner error. + * @throws { BusinessError } 14800014 - Already closed. + * @throws { BusinessError } 14800051 - The type of the distributed table does not match. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 12 + */ + setDistributedTables(tables: Array, type?: DistributedType, config?: DistributedConfig): Promise; + /** + * Obtain distributed table name of specified remote device according to local table name. + * When query remote device database, distributed table name is needed. + * + * @permission ohos.permission.DISTRIBUTED_DATASYNC + * @param { string } device - Indicates the remote device. + * @param { string } table - {string}: the distributed table name. + * @param { AsyncCallback } callback + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @throws { BusinessError } 14800000 - Inner error. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 9 + */ + /** + * Obtain distributed table name of specified remote device according to local table name. + * When query remote device database, distributed table name is needed. + * + * @permission ohos.permission.DISTRIBUTED_DATASYNC + * @param { string } device - Indicates the remote device. + * @param { string } table - {string}: the distributed table name. + * @param { AsyncCallback } callback + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 14800000 - Inner error. + * @throws { BusinessError } 14800014 - Already closed. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 12 + */ + obtainDistributedTableName(device: string, table: string, callback: AsyncCallback): void; + /** + * Obtain distributed table name of specified remote device according to local table name. + * When query remote device database, distributed table name is needed. + * + * @permission ohos.permission.DISTRIBUTED_DATASYNC + * @param { string } device - Indicates the remote device. + * @param { string } table + * @returns { Promise } {string}: the distributed table name. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @throws { BusinessError } 14800000 - Inner error. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 9 + */ + /** + * Obtain distributed table name of specified remote device according to local table name. + * When query remote device database, distributed table name is needed. + * + * @permission ohos.permission.DISTRIBUTED_DATASYNC + * @param { string } device - Indicates the remote device. + * @param { string } table + * @returns { Promise } {string}: the distributed table name. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 14800000 - Inner error. + * @throws { BusinessError } 14800014 - Already closed. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 12 + */ + obtainDistributedTableName(device: string, table: string): Promise; + /** + * Sync data between devices. + * + * @permission ohos.permission.DISTRIBUTED_DATASYNC + * @param { SyncMode } mode - Indicates the database synchronization mode. + * @param { RdbPredicates } predicates - The specified sync condition by the instance object of {@link RdbPredicates}. + * @param { AsyncCallback> } callback - {Array<[string, number]>}: devices sync status array, + * {string}: device id, + * {number}: device sync status. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @throws { BusinessError } 14800000 - Inner error. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 9 + */ + /** + * Sync data between devices. + * + * @permission ohos.permission.DISTRIBUTED_DATASYNC + * @param { SyncMode } mode - Indicates the database synchronization mode. + * @param { RdbPredicates } predicates - The specified sync condition by the instance object of {@link RdbPredicates}. + * @param { AsyncCallback> } callback - {Array<[string, number]>}: devices sync status array, + * {string}: device id, + * {number}: device sync status. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 14800000 - Inner error. + * @throws { BusinessError } 14800014 - Already closed. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 12 + */ + sync(mode: SyncMode, predicates: RdbPredicates, callback: AsyncCallback>): void; + /** + * Sync data between devices. + * + * @permission ohos.permission.DISTRIBUTED_DATASYNC + * @param { SyncMode } mode - Indicates the database synchronization mode. + * @param { RdbPredicates } predicates - The specified sync condition by the instance object of {@link RdbPredicates}. + * @returns { Promise> } {Array<[string, number]>}: devices sync status array, {string}: device id, {number}: device sync status. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @throws { BusinessError } 14800000 - Inner error. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 9 + */ + /** + * Sync data between devices. + * + * @permission ohos.permission.DISTRIBUTED_DATASYNC + * @param { SyncMode } mode - Indicates the database synchronization mode. + * @param { RdbPredicates } predicates - The specified sync condition by the instance object of {@link RdbPredicates}. + * @returns { Promise> } {Array<[string, number]>}: devices sync status array, {string}: device id, {number}: device sync status. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 14800000 - Inner error. + * @throws { BusinessError } 14800014 - Already closed. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 12 + */ + sync(mode: SyncMode, predicates: RdbPredicates): Promise>; + /** + * Sync data to cloud. + * + * @permission ohos.permission.DISTRIBUTED_DATASYNC + * @param { SyncMode } mode - indicates the database synchronization mode. + * @param { Callback } progress - the specified sync condition by the instance object of {@link ProgressDetails}. + * @param { AsyncCallback } callback - {Array<[string, number]>}: devices sync status array, {string}: device id, {number}: device sync status. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Need 2 - 4 parameter(s). 2. The RdbStore must be not nullptr. + * 3. The mode must be a SyncMode of cloud. 4. The progress must be a callback type. 5. The callback must be a function. + * @throws { BusinessError } 202 - if permission verification failed, application does not have permission ohos.permission.DISTRIBUTED_DATASYNC. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.DistributedDataManager.CloudSync.Client + * @since 10 + */ + /** + * Sync data to cloud. + * + * @permission ohos.permission.DISTRIBUTED_DATASYNC + * @param { SyncMode } mode - indicates the database synchronization mode. + * @param { Callback } progress - the specified sync condition by the instance object of {@link ProgressDetails}. + * @param { AsyncCallback } callback - {Array<[string, number]>}: devices sync status array, {string}: device id, {number}: device sync status. + * @throws { BusinessError } 202 - if permission verification failed, application does not have permission ohos.permission.DISTRIBUTED_DATASYNC. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Need 2 - 4 parameter(s). 2. The RdbStore must be not nullptr. + * 3. The mode must be a SyncMode of cloud. 4. The progress must be a callback type. 5. The callback must be a function. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 14800014 - Already closed. + * @syscap SystemCapability.DistributedDataManager.CloudSync.Client + * @since 12 + */ + cloudSync(mode: SyncMode, progress: Callback, callback: AsyncCallback): void; + /** + * Sync data to cloud. + * + * @permission ohos.permission.DISTRIBUTED_DATASYNC + * @param { SyncMode } mode - indicates the database synchronization mode. + * @param { Callback } progress - the specified sync condition by the instance object of {@link ProgressDetails}. + * @returns { Promise } : devices sync status array, {string}: device id, {number}: device sync status. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Need 2 - 4 parameter(s). 2. The RdbStore must be not nullptr. + * 3. The mode must be a SyncMode of cloud. 4. The progress must be a callback type. + * @throws { BusinessError } 202 - if permission verification failed, application does not have permission ohos.permission.DISTRIBUTED_DATASYNC. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.DistributedDataManager.CloudSync.Client + * @since 10 + */ + /** + * Sync data to cloud. + * + * @permission ohos.permission.DISTRIBUTED_DATASYNC + * @param { SyncMode } mode - indicates the database synchronization mode. + * @param { Callback } progress - the specified sync condition by the instance object of {@link ProgressDetails}. + * @returns { Promise } : devices sync status array, {string}: device id, {number}: device sync status. + * @throws { BusinessError } 202 - if permission verification failed, application does not have permission ohos.permission.DISTRIBUTED_DATASYNC. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Need 2 - 4 parameter(s). 2. The RdbStore must be not nullptr. + * 3. The mode must be a SyncMode of cloud. 4. The progress must be a callback type. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 14800014 - Already closed. + * @syscap SystemCapability.DistributedDataManager.CloudSync.Client + * @since 12 + */ + cloudSync(mode: SyncMode, progress: Callback): Promise; + /** + * Sync data to cloud. + * + * @permission ohos.permission.DISTRIBUTED_DATASYNC + * @param { SyncMode } mode - indicates the database synchronization mode. + * @param { string[] } tables - indicates the database synchronization mode. + * @param { Callback } progress - the specified sync condition by the instance object of {@link ProgressDetails}. + * @param { AsyncCallback } callback - {Array<[string, number]>}: devices sync status array, {string}: device id, {number}: device sync status. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Need 2 - 4 parameter(s). 2. The RdbStore must be not nullptr. + * 3. The mode must be a SyncMode of cloud. 4. The tablesNames must be not empty. 5. The progress must be a callback type. + * 6. The callback must be a function. + * @throws { BusinessError } 202 - if permission verification failed, application does not have permission ohos.permission.DISTRIBUTED_DATASYNC. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.DistributedDataManager.CloudSync.Client + * @since 10 + */ + /** + * Sync data to cloud. + * + * @permission ohos.permission.DISTRIBUTED_DATASYNC + * @param { SyncMode } mode - indicates the database synchronization mode. + * @param { string[] } tables - indicates the database synchronization mode. + * @param { Callback } progress - the specified sync condition by the instance object of {@link ProgressDetails}. + * @param { AsyncCallback } callback - {Array<[string, number]>}: devices sync status array, {string}: device id, {number}: device sync status. + * @throws { BusinessError } 202 - if permission verification failed, application does not have permission ohos.permission.DISTRIBUTED_DATASYNC. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Need 2 - 4 parameter(s). 2. The RdbStore must be not nullptr. + * 3. The mode must be a SyncMode of cloud. 4. The tablesNames must be not empty. 5. The progress must be a callback type. + * 6. The callback must be a function. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 14800014 - Already closed. + * @syscap SystemCapability.DistributedDataManager.CloudSync.Client + * @since 12 + */ + cloudSync(mode: SyncMode, tables: string[], progress: Callback, callback: AsyncCallback): void; + /** + * Sync data to cloud. + * + * @permission ohos.permission.DISTRIBUTED_DATASYNC + * @param { SyncMode } mode - indicates the database synchronization mode. + * @param { string[] } tables - indicates the database synchronization mode. + * @param { Callback } progress - the specified sync condition by the instance object of {@link ProgressDetails}. + * @returns { Promise } : devices sync status array, {string}: device id, {number}: device sync status. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Need 2 - 4 parameter(s). 2. The RdbStore must be not nullptr. + * 3. The mode must be a SyncMode of cloud. 4. The tablesNames must be not empty. 5. The progress must be a callback type. + * @throws { BusinessError } 202 - if permission verification failed, application does not have permission ohos.permission.DISTRIBUTED_DATASYNC. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.DistributedDataManager.CloudSync.Client + * @since 10 + */ + /** + * Sync data to cloud. + * + * @permission ohos.permission.DISTRIBUTED_DATASYNC + * @param { SyncMode } mode - indicates the database synchronization mode. + * @param { string[] } tables - indicates the database synchronization mode. + * @param { Callback } progress - the specified sync condition by the instance object of {@link ProgressDetails}. + * @returns { Promise } : devices sync status array, {string}: device id, {number}: device sync status. + * @throws { BusinessError } 202 - if permission verification failed, application does not have permission ohos.permission.DISTRIBUTED_DATASYNC. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Need 2 - 4 parameter(s). 2. The RdbStore must be not nullptr. + * 3. The mode must be a SyncMode of cloud. 4. The tablesNames must be not empty. 5. The progress must be a callback type. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 14800014 - Already closed. + * @syscap SystemCapability.DistributedDataManager.CloudSync.Client + * @since 12 + */ + cloudSync(mode: SyncMode, tables: string[], progress: Callback): Promise; + /** + * Queries remote data in the database based on specified conditions before Synchronizing Data. + * + * @param { string } device - Indicates specified remote device. + * @param { string } table - Indicates the target table. + * @param { RdbPredicates } predicates - The specified remote remote query condition by the instance object of {@link RdbPredicates}. + * @param { Array } columns - The columns to remote query. If the value is empty array, the remote query applies to all columns. + * @param { AsyncCallback } callback - The {@link ResultSet} object if the operation is successful. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @throws { BusinessError } 14800000 - Inner error. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 9 + */ + /** + * Queries remote data in the database based on specified conditions before Synchronizing Data. + * + * @param { string } device - Indicates specified remote device. + * @param { string } table - Indicates the target table. + * @param { RdbPredicates } predicates - The specified remote remote query condition by the instance object of {@link RdbPredicates}. + * @param { Array } columns - The columns to remote query. If the value is empty array, the remote query applies to all columns. + * @param { AsyncCallback } callback - The {@link ResultSet} object if the operation is successful. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 14800000 - Inner error. + * @throws { BusinessError } 14800014 - Already closed. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 12 + */ + remoteQuery(device: string, table: string, predicates: RdbPredicates, columns: Array, callback: AsyncCallback): void; + /** + * Queries remote data in the database based on specified conditions before Synchronizing Data. + * + * @param { string } device - Indicates specified remote device. + * @param { string } table - Indicates the target table. + * @param { RdbPredicates } predicates - The specified remote remote query condition by the instance object of {@link RdbPredicates}. + * @param { Array } columns - The columns to remote query. If the value is empty array, the remote query applies to all columns. + * @returns { Promise } The {@link ResultSet} object if the operation is successful. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @throws { BusinessError } 14800000 - Inner error. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 9 + */ + /** + * Queries remote data in the database based on specified conditions before Synchronizing Data. + * + * @param { string } device - Indicates specified remote device. + * @param { string } table - Indicates the target table. + * @param { RdbPredicates } predicates - The specified remote remote query condition by the instance object of {@link RdbPredicates}. + * @param { Array } columns - The columns to remote query. If the value is empty array, the remote query applies to all columns. + * @returns { Promise } The {@link ResultSet} object if the operation is successful. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 14800000 - Inner error. + * @throws { BusinessError } 14800014 - Already closed. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 12 + */ + remoteQuery(device: string, table: string, predicates: RdbPredicates, columns: Array): Promise; + /** + * Registers an observer for the database. When data in the distributed database changes, + * the callback will be invoked. + * + * @param { 'dataChange' } event - Indicates the event must be string 'dataChange'. + * @param { SubscribeType } type - Indicates the subscription type, which is defined in {@link SubscribeType}. + * If its value is SUBSCRIBE_TYPE_REMOTE, ohos.permission.DISTRIBUTED_DATASYNC is required. + * @param { Callback> } observer - {Array}: the observer of data change events in the distributed database. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 9 + */ + /** + * Registers an observer for the database. When data in the distributed database changes, + * the callback will be invoked. + * + * @param { 'dataChange' } event - Indicates the event must be string 'dataChange'. + * @param { SubscribeType } type - Indicates the subscription type, which is defined in {@link SubscribeType}. + * If its value is SUBSCRIBE_TYPE_REMOTE, ohos.permission.DISTRIBUTED_DATASYNC is required. + * @param { Callback> } observer - {Array}: the observer of data change events in the distributed database. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 14800014 - Already closed. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 12 + */ + on(event: 'dataChange', type: SubscribeType, observer: Callback>): void; + /** + * Registers an observer for the database. When data in the distributed database or the local database changes, + * the callback will be invoked. + * + * @param { 'dataChange' } event - Indicates the event must be string 'dataChange'. + * @param { SubscribeType } type - Indicates the subscription type, which is defined in {@link SubscribeType}. + * If its value is SUBSCRIBE_TYPE_REMOTE, ohos.permission.DISTRIBUTED_DATASYNC is required. + * If its value is SUBSCRIBE_TYPE_LOCAL_DETAILS, the callback will be invoked for data changes in the local database. + * @param { Callback> | Callback> } observer + * {Array}: The observer of data change events in the distributed database. + * {Array}: The change info of data change events in the distributed database or the local database. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @throws { BusinessError } 202 - Permission verification failed, application which is not a system application uses system API. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 10 + */ + /** + * Registers an observer for the database. When data in the distributed database changes, + * the callback will be invoked. + * + * @param { 'dataChange' } event - Indicates the event must be string 'dataChange'. + * @param { SubscribeType } type - Indicates the subscription type, which is defined in {@link SubscribeType}. + * If its value is SUBSCRIBE_TYPE_REMOTE, ohos.permission.DISTRIBUTED_DATASYNC is required. + * @param { Callback> | Callback> } observer + * {Array}: The observer of data change events in the distributed database. + * {Array}: The change info of data change events in the distributed database. + * @throws { BusinessError } 202 - Permission verification failed, application which is not a system application uses system API. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 14800014 - Already closed. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 12 + */ + on(event: 'dataChange', type: SubscribeType, observer: Callback> | Callback>): void; + /** + * Registers an observer for the database. + * + * @param { string } event - Indicates the subscription event. + * @param { boolean } interProcess - Indicates whether it is an interprocess subscription or an in-process subscription. + * @param { Callback } observer - The observer of data change events in the database. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 14800050 - Failed to obtain subscription service. + * @throws { BusinessError } 14800000 - Inner error. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 10 + */ + /** + * Registers an observer for the database. + * + * @param { string } event - Indicates the subscription event. + * @param { boolean } interProcess - Indicates whether it is an interprocess subscription or an in-process subscription. + * @param { Callback } observer - The observer of data change events in the database. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 14800000 - Inner error. + * @throws { BusinessError } 14800014 - Already closed. + * @throws { BusinessError } 14800050 - Failed to obtain subscription service. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 12 + */ + on(event: string, interProcess: boolean, observer: Callback): void; + /** + * Register an automatic synchronization callback to the database. + * + * @param { 'autoSyncProgress' } event - Indicates the event must be string 'autoSyncProgress'. + * @param { Callback } progress - the specified sync condition by the instance object of {@link ProgressDetails}. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Need 2 - 3 parameter(s)! 2. The RdbStore must be valid. + * 3. The event must be a not empty string. 4. The progress must be function. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 11 + */ + /** + * Register an automatic synchronization callback to the database. + * + * @param { 'autoSyncProgress' } event - Indicates the event must be string 'autoSyncProgress'. + * @param { Callback } progress - the specified sync condition by the instance object of {@link ProgressDetails}. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Need 2 - 3 parameter(s)! 2. The RdbStore must be valid. + * 3. The event must be a not empty string. 4. The progress must be function. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 14800014 - Already closed. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 12 + */ + on(event: 'autoSyncProgress', progress: Callback): void; + /** + * Remove specified observer of specified type from the database. + * + * @param { 'dataChange' } event - Indicates the event must be string 'dataChange'. + * @param { SubscribeType } type - Indicates the subscription type, which is defined in {@link SubscribeType}. + * If its value is SUBSCRIBE_TYPE_REMOTE, ohos.permission.DISTRIBUTED_DATASYNC is required. + * @param { Callback> } observer - {Array}: the data change observer already registered. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 9 + */ + /** + * Remove specified observer of specified type from the database. + * + * @param { 'dataChange' } event - Indicates the event must be string 'dataChange'. + * @param { SubscribeType } type - Indicates the subscription type, which is defined in {@link SubscribeType}. + * If its value is SUBSCRIBE_TYPE_REMOTE, ohos.permission.DISTRIBUTED_DATASYNC is required. + * @param { Callback> } observer - {Array}: the data change observer already registered. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 14800014 - Already closed. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 12 + */ + off(event: 'dataChange', type: SubscribeType, observer: Callback>): void; + /** + * Remove specified observer of specified type from the database. + * + * @param { 'dataChange' } event - indicates the event must be string 'dataChange'. + * @param { SubscribeType } type - indicates the subscription type, which is defined in {@link SubscribeType}. + * If its value is SUBSCRIBE_TYPE_REMOTE, ohos.permission.DISTRIBUTED_DATASYNC is required. + * @param { Callback> | Callback> } observer - {Array}: the data change observer already registered. + * {Array}: the change info already registered. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @throws { BusinessError } 202 - Permission verification failed, application which is not a system application uses system API. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 10 + */ + /** + * Remove specified observer of specified type from the database. + * + * @param { 'dataChange' } event - indicates the event must be string 'dataChange'. + * @param { SubscribeType } type - indicates the subscription type, which is defined in {@link SubscribeType}. + * If its value is SUBSCRIBE_TYPE_REMOTE, ohos.permission.DISTRIBUTED_DATASYNC is required. + * @param { Callback> | Callback> } observer - {Array}: the data change observer already registered. + * {Array}: the change info already registered. + * @throws { BusinessError } 202 - Permission verification failed, application which is not a system application uses system API. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 14800014 - Already closed. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 12 + */ + off(event: 'dataChange', type: SubscribeType, observer?: Callback> | Callback>): void; + /** + * Remove specified observer of specified type from the database. + * + * @param { string } event - Indicates the subscription event. + * @param { boolean } interProcess - Indicates whether it is an interprocess subscription or an in-process subscription. + * @param { Callback } observer - The data change observer already registered. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 14800050 - Failed to obtain subscription service. + * @throws { BusinessError } 14800000 - Inner error. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 10 + */ + /** + * Remove specified observer of specified type from the database. + * + * @param { string } event - Indicates the subscription event. + * @param { boolean } interProcess - Indicates whether it is an interprocess subscription or an in-process subscription. + * @param { Callback } observer - The data change observer already registered. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 14800000 - Inner error. + * @throws { BusinessError } 14800014 - Already closed. + * @throws { BusinessError } 14800050 - Failed to obtain subscription service. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 12 + */ + off(event: string, interProcess: boolean, observer?: Callback): void; + /** + * Unregister the database auto synchronization callback. + * + * @param { 'autoSyncProgress' } event - indicates the event must be string 'autoSyncProgress'. + * @param { Callback } progress - the specified sync condition by the instance object of {@link ProgressDetails}. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Need 1 - 3 parameter(s)! 2. The RdbStore must be valid. + * 3. The event must be a not empty string. 4. The progress must be function. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 11 + */ + /** + * Unregister the database auto synchronization callback. + * + * @param { 'autoSyncProgress' } event - indicates the event must be string 'autoSyncProgress'. + * @param { Callback } progress - the specified sync condition by the instance object of {@link ProgressDetails}. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Need 1 - 3 parameter(s)! 2. The RdbStore must be valid. + * 3. The event must be a not empty string. 4. The progress must be function. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 14800014 - Already closed. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 12 + */ + off(event: 'autoSyncProgress', progress?: Callback): void; + /** + * Notifies the registered observers of a change to the data resource specified by Uri. + * + * @param { string } event - Indicates the subscription event. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 14800050 - Failed to obtain subscription service. + * @throws { BusinessError } 14800000 - Inner error. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 10 + */ + /** + * Notifies the registered observers of a change to the data resource specified by Uri. + * + * @param { string } event - Indicates the subscription event. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 14800000 - Inner error. + * @throws { BusinessError } 14800014 - Already closed. + * @throws { BusinessError } 14800050 - Failed to obtain subscription service. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 12 + */ + emit(event: string): void; + /** + * Close the RdbStore and all resultSets. + * + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - Parameter error. The store must not be nullptr. + * @throws { BusinessError } 14800000 - Inner error. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 12 + */ + close(): Promise; + /** + * Attaches a database file to the currently linked database. + * + * @param { string } fullPath - Indicates the path of the database file to attach. + * @param { string } attachName - Indicates the alias of the database. + * @param { number } waitTime - Indicates the maximum time allowed for attaching the database file. + * @returns { Promise } Promise used to return the number of attached databases. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 14800000 - Inner error. + * @throws { BusinessError } 14800010 - Invalid database path. + * @throws { BusinessError } 14800011 - Database corrupted. + * @throws { BusinessError } 14800014 - Already closed. + * @throws { BusinessError } 14800015 - The database does not respond. + * @throws { BusinessError } 14800016 - The database is already attached. + * @throws { BusinessError } 14800021 - SQLite: Generic error. + * @throws { BusinessError } 14800022 - SQLite: Callback routine requested an abort. + * @throws { BusinessError } 14800023 - SQLite: Access permission denied. + * @throws { BusinessError } 14800024 - SQLite: The database file is locked. + * @throws { BusinessError } 14800025 - SQLite: A table in the database is locked. + * @throws { BusinessError } 14800026 - SQLite: The database is out of memory. + * @throws { BusinessError } 14800027 - SQLite: Attempt to write a readonly database. + * @throws { BusinessError } 14800028 - SQLite: Some kind of disk I/O error occurred. + * @throws { BusinessError } 14800029 - SQLite: The database is full. + * @throws { BusinessError } 14800030 - SQLite: Unable to open the database file. + * @throws { BusinessError } 14800031 - SQLite: TEXT or BLOB exceeds size limit. + * @throws { BusinessError } 14800032 - SQLite: Abort due to constraint violation. + * @throws { BusinessError } 14800033 - SQLite: Data type mismatch. + * @throws { BusinessError } 14800034 - SQLite: Library used incorrectly. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 12 + */ + attach(fullPath: string, attachName: string, waitTime?: number): Promise; + /** + * Attaches a database file to the currently linked database. + * + * @param { Context } context - Indicates the context of an application or ability. + * @param { StoreConfig } config - Indicates the {@link StoreConfig} configuration of the database related to this RDB store. + * @param { string } attachName - Indicates the alias of the database. + * @param { number } waitTime - Indicates the maximum time allowed for attaching the database file. + * @returns { Promise } Promise used to return the number of attached databases. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 14800000 - Inner error. + * @throws { BusinessError } 14800010 - Invalid database path. + * @throws { BusinessError } 14800011 - Database corrupted. + * @throws { BusinessError } 14800014 - Already closed. + * @throws { BusinessError } 14800015 - The database does not respond. + * @throws { BusinessError } 14800016 - The database is already attached. + * @throws { BusinessError } 14801001 - Only supported in stage mode. + * @throws { BusinessError } 14801002 - The data group id is not valid. + * @throws { BusinessError } 14800021 - SQLite: Generic error. + * @throws { BusinessError } 14800022 - SQLite: Callback routine requested an abort. + * @throws { BusinessError } 14800023 - SQLite: Access permission denied. + * @throws { BusinessError } 14800024 - SQLite: The database file is locked. + * @throws { BusinessError } 14800025 - SQLite: A table in the database is locked. + * @throws { BusinessError } 14800026 - SQLite: The database is out of memory. + * @throws { BusinessError } 14800027 - SQLite: Attempt to write a readonly database. + * @throws { BusinessError } 14800028 - SQLite: Some kind of disk I/O error occurred. + * @throws { BusinessError } 14800029 - SQLite: The database is full. + * @throws { BusinessError } 14800030 - SQLite: Unable to open the database file. + * @throws { BusinessError } 14800031 - SQLite: TEXT or BLOB exceeds size limit. + * @throws { BusinessError } 14800032 - SQLite: Abort due to constraint violation. + * @throws { BusinessError } 14800033 - SQLite: Data type mismatch. + * @throws { BusinessError } 14800034 - SQLite: Library used incorrectly. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 12 + */ + attach(context: Context, config: StoreConfig, attachName: string, waitTime?: number): Promise; + /** + * Detaches a database from this database. + * + * @param { string } attachName - Indicates the alias of the database. + * @param { number } waitTime - Indicates the maximum time allowed for detaching the database. + * @returns { Promise } Return the current number of attached databases. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @throws { BusinessError } 14800000 - Inner error. + * @throws { BusinessError } 14800011 - Database corrupted. + * @throws { BusinessError } 14800014 - Already closed. + * @throws { BusinessError } 14800015 - The database does not respond. + * @throws { BusinessError } 14800021 - SQLite: Generic error. + * @throws { BusinessError } 14800022 - SQLite: Callback routine requested an abort. + * @throws { BusinessError } 14800023 - SQLite: Access permission denied. + * @throws { BusinessError } 14800024 - SQLite: The database file is locked. + * @throws { BusinessError } 14800025 - SQLite: A table in the database is locked. + * @throws { BusinessError } 14800026 - SQLite: The database is out of memory. + * @throws { BusinessError } 14800027 - SQLite: Attempt to write a readonly database. + * @throws { BusinessError } 14800028 - SQLite: Some kind of disk I/O error occurred. + * @throws { BusinessError } 14800029 - SQLite: The database is full. + * @throws { BusinessError } 14800030 - SQLite: Unable to open the database file. + * @throws { BusinessError } 14800031 - SQLite: TEXT or BLOB exceeds size limit. + * @throws { BusinessError } 14800032 - SQLite: Abort due to constraint violation. + * @throws { BusinessError } 14800033 - SQLite: Data type mismatch. + * @throws { BusinessError } 14800034 - SQLite: Library used incorrectly. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 12 + */ + detach(attachName: string, waitTime?: number): Promise; + /** + * Locks data from the database based on a specified instance object of RdbPredicates. + * + * @param { RdbPredicates } predicates - The specified lock condition by the instance object of {@link RdbPredicates}. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @throws { BusinessError } 14800000 - Inner error. + * @throws { BusinessError } 14800011 - Database corrupted. + * @throws { BusinessError } 14800014 - Already closed. + * @throws { BusinessError } 14800015 - The database does not respond. + * @throws { BusinessError } 14800018 - No data meets the condition. + * @throws { BusinessError } 14800021 - SQLite: Generic error. + * @throws { BusinessError } 14800022 - SQLite: Callback routine requested an abort. + * @throws { BusinessError } 14800023 - SQLite: Access permission denied. + * @throws { BusinessError } 14800024 - SQLite: The database file is locked. + * @throws { BusinessError } 14800025 - SQLite: A table in the database is locked. + * @throws { BusinessError } 14800026 - SQLite: The database is out of memory. + * @throws { BusinessError } 14800027 - SQLite: Attempt to write a readonly database. + * @throws { BusinessError } 14800028 - SQLite: Some kind of disk I/O error occurred. + * @throws { BusinessError } 14800029 - SQLite: The database is full. + * @throws { BusinessError } 14800030 - SQLite: Unable to open the database file. + * @throws { BusinessError } 14800031 - SQLite: TEXT or BLOB exceeds size limit. + * @throws { BusinessError } 14800032 - SQLite: Abort due to constraint violation. + * @throws { BusinessError } 14800033 - SQLite: Data type mismatch. + * @throws { BusinessError } 14800034 - SQLite: Library used incorrectly. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @crossplatform + * @since 12 + */ + lockRow(predicates: RdbPredicates): Promise; + /** + * Unlocks data from the database based on a specified instance object of RdbPredicates. + * + * @param { RdbPredicates } predicates - The specified Unlock condition by the instance object of {@link RdbPredicates}. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @throws { BusinessError } 14800000 - Inner error. + * @throws { BusinessError } 14800011 - Database corrupted. + * @throws { BusinessError } 14800014 - Already closed. + * @throws { BusinessError } 14800015 - The database does not respond. + * @throws { BusinessError } 14800018 - No data meets the condition. + * @throws { BusinessError } 14800021 - SQLite: Generic error. + * @throws { BusinessError } 14800022 - SQLite: Callback routine requested an abort. + * @throws { BusinessError } 14800023 - SQLite: Access permission denied. + * @throws { BusinessError } 14800024 - SQLite: The database file is locked. + * @throws { BusinessError } 14800025 - SQLite: A table in the database is locked. + * @throws { BusinessError } 14800026 - SQLite: The database is out of memory. + * @throws { BusinessError } 14800027 - SQLite: Attempt to write a readonly database. + * @throws { BusinessError } 14800028 - SQLite: Some kind of disk I/O error occurred. + * @throws { BusinessError } 14800029 - SQLite: The database is full. + * @throws { BusinessError } 14800030 - SQLite: Unable to open the database file. + * @throws { BusinessError } 14800031 - SQLite: TEXT or BLOB exceeds size limit. + * @throws { BusinessError } 14800032 - SQLite: Abort due to constraint violation. + * @throws { BusinessError } 14800033 - SQLite: Data type mismatch. + * @throws { BusinessError } 14800034 - SQLite: Library used incorrectly. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @crossplatform + * @since 12 + */ + unlockRow(predicates: RdbPredicates): Promise; + /** + * Queries locked data in the database based on specified conditions. + * + * @param { RdbPredicates } predicates - The specified query condition by the instance object of {@link RdbPredicates}. + * @param { Array } columns - The columns to query. If the value is null, the query applies to all columns. + * @returns { Promise } The {@link ResultSet} object if the operation is successful. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @throws { BusinessError } 14800000 - Inner error. + * @throws { BusinessError } 14800011 - Database corrupted. + * @throws { BusinessError } 14800014 - Already closed. + * @throws { BusinessError } 14800015 - The database does not respond. + * @throws { BusinessError } 14800021 - SQLite: Generic error. + * @throws { BusinessError } 14800022 - SQLite: Callback routine requested an abort. + * @throws { BusinessError } 14800023 - SQLite: Access permission denied. + * @throws { BusinessError } 14800024 - SQLite: The database file is locked. + * @throws { BusinessError } 14800025 - SQLite: A table in the database is locked. + * @throws { BusinessError } 14800026 - SQLite: The database is out of memory. + * @throws { BusinessError } 14800027 - SQLite: Attempt to write a readonly database. + * @throws { BusinessError } 14800028 - SQLite: Some kind of disk I/O error occurred. + * @throws { BusinessError } 14800029 - SQLite: The database is full. + * @throws { BusinessError } 14800030 - SQLite: Unable to open the database file. + * @throws { BusinessError } 14800031 - SQLite: TEXT or BLOB exceeds size limit. + * @throws { BusinessError } 14800032 - SQLite: Abort due to constraint violation. + * @throws { BusinessError } 14800033 - SQLite: Data type mismatch. + * @throws { BusinessError } 14800034 - SQLite: Library used incorrectly. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @crossplatform + * @since 12 + */ + queryLockedRow(predicates: RdbPredicates, columns?: Array): Promise; + } + /** + * Obtains a RDB store. + * You can set parameters of the RDB store as required. In general, this method is recommended + * to obtain a rdb store. + * + * @param { Context } context - Indicates the context of an application or ability. + * @param { StoreConfig } config - Indicates the {@link StoreConfig} configuration of the database related to this RDB store. + * @param { AsyncCallback } callback - The RDB store {@link RdbStore}. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @throws { BusinessError } 14800000 - Inner error. + * @throws { BusinessError } 14800010 - Failed to open or delete database by invalid database path. + * @throws { BusinessError } 14800011 - Failed to open database by database corrupted. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 9 + */ + /** + * Obtains a RDB store. + * You can set parameters of the RDB store as required. In general, this method is recommended + * to obtain a rdb store. + * + * @param { Context } context - Indicates the context of an application or ability. + * @param { StoreConfig } config - Indicates the {@link StoreConfig} configuration of the database related to this RDB store. + * @param { AsyncCallback } callback - The RDB store {@link RdbStore}. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @throws { BusinessError } 14800000 - Inner error. + * @throws { BusinessError } 14800010 - Failed to open or delete database by invalid database path. + * @throws { BusinessError } 14800011 - Failed to open database by database corrupted. + * @throws { BusinessError } 14801001 - Only supported in stage mode. + * @throws { BusinessError } 14801002 - The data group id is not valid. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @crossplatform + * @since 10 + */ + /** + * Obtains a RDB store. + * You can set parameters of the RDB store as required. In general, this method is recommended + * to obtain a rdb store. + * + * @param { Context } context - Indicates the context of an application or ability. + * @param { StoreConfig } config - Indicates the {@link StoreConfig} configuration of the database related to this RDB store. + * @param { AsyncCallback } callback - The RDB store {@link RdbStore}. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @throws { BusinessError } 14800000 - Inner error. + * @throws { BusinessError } 14800010 - Invalid database path. + * @throws { BusinessError } 14800011 - Database corrupted. + * @throws { BusinessError } 14801001 - Only supported in stage mode. + * @throws { BusinessError } 14801002 - The data group id is not valid. + * @throws { BusinessError } 14800017 - Config changed. + * @throws { BusinessError } 14800021 - SQLite: Generic error. + * @throws { BusinessError } 14800022 - SQLite: Callback routine requested an abort. + * @throws { BusinessError } 14800023 - SQLite: Access permission denied. + * @throws { BusinessError } 14800027 - SQLite: Attempt to write a readonly database. + * @throws { BusinessError } 14800028 - SQLite: Some kind of disk I/O error occurred. + * @throws { BusinessError } 14800029 - SQLite: The database is full. + * @throws { BusinessError } 14800030 - SQLite: Unable to open the database file. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @crossplatform + * @since 12 + */ + function getRdbStore(context: Context, config: StoreConfig, callback: AsyncCallback): void; + /** + * Obtains a RDB store. + * You can set parameters of the RDB store as required. In general, this method is recommended + * to obtain a rdb store. + * + * @param { Context } context - Indicates the context of an application or ability. + * @param { StoreConfig } config - Indicates the {@link StoreConfig} configuration of the database related to this RDB store. + * @returns { Promise } The RDB store {@link RdbStore}. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @throws { BusinessError } 14800000 - Inner error. + * @throws { BusinessError } 14800010 - Failed to open or delete database by invalid database path. + * @throws { BusinessError } 14800011 - Failed to open database by database corrupted. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 9 + */ + /** + * Obtains a RDB store. + * You can set parameters of the RDB store as required. In general, this method is recommended + * to obtain a rdb store. + * + * @param { Context } context - Indicates the context of an application or ability. + * @param { StoreConfig } config - Indicates the {@link StoreConfig} configuration of the database related to this RDB store. + * @returns { Promise } The RDB store {@link RdbStore}. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @throws { BusinessError } 14800000 - Inner error. + * @throws { BusinessError } 14800010 - Failed to open or delete database by invalid database path. + * @throws { BusinessError } 14800011 - Failed to open database by database corrupted. + * @throws { BusinessError } 14801001 - Only supported in stage mode. + * @throws { BusinessError } 14801002 - The data group id is not valid. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @crossplatform + * @since 10 + */ + /** + * Obtains a RDB store. + * You can set parameters of the RDB store as required. In general, this method is recommended + * to obtain a rdb store. + * + * @param { Context } context - Indicates the context of an application or ability. + * @param { StoreConfig } config - Indicates the {@link StoreConfig} configuration of the database related to this RDB store. + * @returns { Promise } The RDB store {@link RdbStore}. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @throws { BusinessError } 14800000 - Inner error. + * @throws { BusinessError } 14800010 - Invalid database path. + * @throws { BusinessError } 14800011 - Database corrupted. + * @throws { BusinessError } 14801001 - Only supported in stage mode. + * @throws { BusinessError } 14801002 - The data group id is not valid. + * @throws { BusinessError } 14800017 - Config changed. + * @throws { BusinessError } 14800021 - SQLite: Generic error. + * @throws { BusinessError } 14800027 - SQLite: Attempt to write a readonly database. + * @throws { BusinessError } 14800028 - SQLite: Some kind of disk I/O error occurred. + * @throws { BusinessError } 14800029 - SQLite: The database is full. + * @throws { BusinessError } 14800030 - SQLite: Unable to open the database file. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @crossplatform + * @since 12 + */ + function getRdbStore(context: Context, config: StoreConfig): Promise; + /** + * Deletes the database with a specified name. + * When specify custom directory, this function should not be called. + * + * @param { Context } context - Indicates the context of application or capability. + * @param { string } name - Indicates the database name. + * @param { AsyncCallback } callback - The callback of deleteRdbStore. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @throws { BusinessError } 14800000 - Inner error. + * @throws { BusinessError } 14800010 - Failed to open or delete database by invalid database path. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 9 + */ + /** + * Deletes the database with a specified name. + * When specify custom directory, this function should not be called. + * + * @param { Context } context - Indicates the context of application or capability. + * @param { string } name - Indicates the database name. + * @param { AsyncCallback } callback - The callback of deleteRdbStore. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @throws { BusinessError } 14800000 - Inner error. + * @throws { BusinessError } 14800010 - Failed to open or delete database by invalid database path. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @crossplatform + * @since 10 + */ + function deleteRdbStore(context: Context, name: string, callback: AsyncCallback): void; + /** + * Deletes the database with a specified store config. + * When specify custom directory, this function should be called. + * + * @param { Context } context - Indicates the context of an application or ability. + * @param { StoreConfig } config - Indicates the {@link StoreConfig} configuration of the database related to this RDB store. + * @param { AsyncCallback } callback - The callback of deleteRdbStore. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @throws { BusinessError } 14800000 - Inner error. + * @throws { BusinessError } 14800010 - Failed to open or delete database by invalid database path. + * @throws { BusinessError } 14801001 - Only supported in stage mode. + * @throws { BusinessError } 14801002 - The data group id is not valid. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @crossplatform + * @since 10 + */ + function deleteRdbStore(context: Context, config: StoreConfig, callback: AsyncCallback): void; + /** + * Deletes the database with a specified name. + * When specify custom directory, this function should not be called. + * + * @param { Context } context - Indicates the context of application or capability. + * @param { string } name - Indicates the database name. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @throws { BusinessError } 14800000 - Inner error. + * @throws { BusinessError } 14800010 - Failed to open or delete database by invalid database path. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 9 + */ + /** + * Deletes the database with a specified name. + * When specify custom directory, this function should not be called. + * + * @param { Context } context - Indicates the context of application or capability. + * @param { string } name - Indicates the database name. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @throws { BusinessError } 14800000 - Inner error. + * @throws { BusinessError } 14800010 - Failed to open or delete database by invalid database path. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @crossplatform + * @since 10 + */ + /** + * Deletes the database with a specified name. + * When specify custom directory, this function should not be called. + * + * @param { Context } context - Indicates the context of application or capability. + * @param { string } name - Indicates the database name. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @throws { BusinessError } 14800000 - Inner error. + * @throws { BusinessError } 14800010 - Invalid database path. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @crossplatform + * @since 12 + */ + function deleteRdbStore(context: Context, name: string): Promise; + /** + * Deletes the database with a specified store config. + * When specify custom directory, this function should be called. + * + * @param { Context } context - Indicates the context of an application or ability. + * @param { StoreConfig } config - Indicates the {@link StoreConfig} configuration of the database related to this RDB store. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @throws { BusinessError } 14800000 - Inner error. + * @throws { BusinessError } 14800010 - Failed to open or delete database by invalid database path. + * @throws { BusinessError } 14801001 - Only supported in stage mode. + * @throws { BusinessError } 14801002 - The data group id is not valid. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @crossplatform + * @since 10 + */ + /** + * Deletes the database with a specified store config. + * When specify custom directory, this function should be called. + * + * @param { Context } context - Indicates the context of an application or ability. + * @param { StoreConfig } config - Indicates the {@link StoreConfig} configuration of the database related to this RDB store. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 14800000 - Inner error. + * @throws { BusinessError } 14800010 - Invalid database path. + * @throws { BusinessError } 14801001 - Only supported in stage mode. + * @throws { BusinessError } 14801002 - The data group id is not valid. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @crossplatform + * @since 12 + */ + function deleteRdbStore(context: Context, config: StoreConfig): Promise; +} +export default relationalStore; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.data.sendablePreferences.d.ets b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.data.sendablePreferences.d.ets new file mode 100755 index 00000000..c83d2973 --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.data.sendablePreferences.d.ets @@ -0,0 +1,476 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit ArkData + */ +import { Callback } from './@ohos.base'; +import Context from './application/BaseContext'; +import lang from '../arkts/@arkts.lang'; +/** + * Provides interfaces to obtain and modify preferences data. + * + * @namespace sendablePreferences + * @syscap SystemCapability.DistributedDataManager.Preferences.Core + * @atomicservice + * @since 12 + * @name sendablePreferences + */ +declare namespace sendablePreferences { + /** + * Maximum length of a key. + * + * @constant + * @syscap SystemCapability.DistributedDataManager.Preferences.Core + * @atomicservice + * @since 12 + */ + const MAX_KEY_LENGTH: number; + /** + * Maximum length of a value. + * + * @constant + * @syscap SystemCapability.DistributedDataManager.Preferences.Core + * @atomicservice + * @since 12 + */ + const MAX_VALUE_LENGTH: number; + /** + * Defines the configuration of a preferences file. + * + * @interface Options + * @syscap SystemCapability.DistributedDataManager.Preferences.Core + * @atomicservice + * @since 12 + */ + interface Options { + /** + * Name of the preferences file. + * + * @syscap SystemCapability.DistributedDataManager.Preferences.Core + * @atomicservice + * @since 12 + */ + name: string; + /** + * Application group ID. + * + * @syscap SystemCapability.DistributedDataManager.Preferences.Core + * @StageModelOnly + * @atomicservice + * @since 12 + */ + dataGroupId?: string | null; + } + /** + * Obtains a {@link Preferences} instance matching the specified preferences file name. + *

The {@link references} instance loads all data of the preferences file and + * resides in the cache. You can use removePreferencesFromCache to remove the instance from the cache. + * + * @param { Context } context - Indicates the context of application or capability. + * @param { Options } options - Indicates information about the preferences file. For details, see {@link Options}. + * @returns { Promise } Promise used to return the {@link Preferences}. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; + * 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 15500000 - Inner error. + * @throws { BusinessError } 15501001 - Only supported in stage mode. + * @throws { BusinessError } 15501002 - The data group id is not valid. + * @syscap SystemCapability.DistributedDataManager.Preferences.Core + * @atomicservice + * @since 12 + */ + function getPreferences(context: Context, options: Options): Promise; + /** + * Obtains a {@link Preferences} instance matching a specified preferences file name. + * This API returns the result synchronously. + *

The {@link references} instance loads all data of the preferences file and + * resides in the cache. You can use removePreferencesFromCache to remove the instance from the cache. + * + * @param { Context } context - Indicates the context of application or capability. + * @param { Options } options - Indicates information about the preferences file. For details, see {@link Options}. + * @returns { Preferences } return the {@link Preferences}. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; + * 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 15500000 - Inner error. + * @throws { BusinessError } 15501001 - Only supported in stage mode. + * @throws { BusinessError } 15501002 - The data group id is not valid. + * @syscap SystemCapability.DistributedDataManager.Preferences.Core + * @atomicservice + * @since 12 + */ + function getPreferencesSync(context: Context, options: Options): Preferences; + /** + * Deletes a {@link Preferences} instance matching the specified preferences file name + * from the cache (which is equivalent to calling removePreferencesFromCache) and deletes + * the preferences file. + *

When deleting a {@link Preferences} instance, you must release all references + * of the instance. In addition, do not use the instance to perform data operations. Otherwise, data inconsistency + * will occur. + * + * @param { Context } context - Indicates the context of application or capability. + * @param { Options } options - Indicates information about the preferences file. For details, see {@link Options}. + * @returns { Promise } Promise that returns no value. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; + * 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 15500000 - Inner error. + * @throws { BusinessError } 15500010 - Failed to delete preferences file. + * @throws { BusinessError } 15501001 - Only supported in stage mode. + * @throws { BusinessError } 15501002 - The data group id is not valid. + * @syscap SystemCapability.DistributedDataManager.Preferences.Core + * @atomicservice + * @since 12 + */ + function deletePreferences(context: Context, options: Options): Promise; + /** + * Removes a {@link Preferences} instance matching the specified preferences file name + * from the cache. + *

When removing a {@link Preferences} instance, you must release all references + * of the instance. In addition, do not use the instance to perform data operations. Otherwise, data inconsistency + * will occur. + * + * @param { Context } context - Indicates the context of application or capability. + * @param { Options } options - Indicates information about the preferences file. For details, see {@link Options}. + * @returns { Promise } Promise that returns no value. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; + * 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 15500000 - Inner error. + * @throws { BusinessError } 15501001 - Only supported in stage mode. + * @throws { BusinessError } 15501002 - The data group id is not valid. + * @syscap SystemCapability.DistributedDataManager.Preferences.Core + * @atomicservice + * @since 12 + */ + function removePreferencesFromCache(context: Context, options: Options): Promise; + /** + * Removes a {@link Preferences} instance matching the specified preferences file name + * from the cache. This API returns the result synchronously. + *

When removing a {@link Preferences} instance, you must release all references + * of the instance. In addition, do not use the instance to perform data operations. Otherwise, data inconsistency + * will occur. + * + * @param { Context } context - Indicates the context of application or capability. + * @param { Options } options - Indicates information about the preferences file. For details, see {@link Options}. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; + * 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 15500000 - Inner error. + * @throws { BusinessError } 15501001 - Only supported in stage mode. + * @throws { BusinessError } 15501002 - The data group id is not valid. + * @syscap SystemCapability.DistributedDataManager.Preferences.Core + * @atomicservice + * @since 12 + */ + function removePreferencesFromCacheSync(context: Context, options: Options): void; + /** + * Provides interfaces to obtain and modify preferences data. + *

The preferences data is stored in a file, which matches only one {@link Preferences} instance in the cache. + * You can use getPreferences to obtain the {@link Preferences} instance matching + * the file that stores preferences data, and use removePreferencesFromCache + * to remove the {@link Preferences} instance from the cache. + * + * @interface Preferences + * @syscap SystemCapability.DistributedDataManager.Preferences.Core + * @atomicservice + * @since 12 + */ + interface Preferences extends lang.ISendable { + /** + * Obtains the value of a preferences instance. + *

If the value is {@code null} or not in the lang.ISendable format, the default value is returned. + * + * @param { string } key - Indicates the key of the preferences. It cannot be {@code null} or empty. + * MAX_KEY_LENGTH. + * @param { lang.ISendable } defValue - Indicates the default value to return. + * @returns { Promise } Promise used to return the result. If a value matching the specified key + * is found, the value is returned. Otherwise, the default value is returned. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; + * 3. Parameter verification failed. + * @throws { BusinessError } 15500000 - Inner error. + * @syscap SystemCapability.DistributedDataManager.Preferences.Core + * @atomicservice + * @since 12 + */ + get(key: string, defValue: lang.ISendable): Promise; + /** + * Obtains the value of a preferences instance. This API returns the result synchronously. + *

If the value is {@code null} or not in the lang.ISendable format, the default value is returned. + * + * @param { string } key - Indicates the key of the preferences. It cannot be {@code null} or empty. + * MAX_KEY_LENGTH. + * @param { lang.ISendable } defValue - Indicates the default value to return. + * @returns { lang.ISendable } If a value matching the specified key is found, the value is returned. Otherwise, + * the default value is returned. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; + * 3. Parameter verification failed. + * @throws { BusinessError } 15500000 - Inner error. + * @syscap SystemCapability.DistributedDataManager.Preferences.Core + * @atomicservice + * @since 12 + */ + getSync(key: string, defValue: lang.ISendable): lang.ISendable; + /** + * Obtains all the keys and values of a preferences instance in an object. + * + * @returns { Promise } Promise used to return the values and keys obtained in an object. + * @throws { BusinessError } 15500000 - Inner error. + * @syscap SystemCapability.DistributedDataManager.Preferences.Core + * @atomicservice + * @since 12 + */ + getAll(): Promise; + /** + * Obtains all the keys and values of a preferences instance. This API returns the result synchronously. + * + * @returns { lang.ISendable } Returns the values and keys obtained in an object. + * @throws { BusinessError } 15500000 - Inner error. + * @syscap SystemCapability.DistributedDataManager.Preferences.Core + * @atomicservice + * @since 12 + */ + getAllSync(): lang.ISendable; + /** + * Checks whether the {@link Preferences} instance contains a value matching the specified key. + * + * @param { string } key - Indicates the key of the value to check. It cannot be {@code null} or empty. + * MAX_KEY_LENGTH. + * @returns { Promise } Promise used to return the result. {@code true} is returned if the + * {@link Preferences} object contains a value matching the specified key; {@code false} is returned otherwise. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; + * 3. Parameter verification failed. + * @throws { BusinessError } 15500000 - Inner error. + * @syscap SystemCapability.DistributedDataManager.Preferences.Core + * @atomicservice + * @since 12 + */ + has(key: string): Promise; + /** + * Checks whether the {@link Preferences} instance contains a value matching the specified key. + * This API returns the result synchronously. + * + * @param { string } key - Indicates the key of the value to check. It cannot be {@code null} or empty. + * MAX_KEY_LENGTH. + * @returns { boolean } {@code true} is returned if the {@link Preferences} object contains a value matching + * the specified key; {@code false} is returned otherwise. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; + * 3. Parameter verification failed. + * @throws { BusinessError } 15500000 - Inner error. + * @syscap SystemCapability.DistributedDataManager.Preferences.Core + * @atomicservice + * @since 12 + */ + hasSync(key: string): boolean; + /** + * Sets an lang.ISendable value for the key in the {@link Preferences} object. + *

You can call the {@link #flush} method to save the {@link Preferences} object to the file. + * + * @param { string } key - Indicates the key of the preferences to set. It cannot be {@code null} or empty. + * MAX_KEY_LENGTH. + * @param { lang.ISendable } value - Indicates the value of the preferences. + * MAX_VALUE_LENGTH. + * @returns { Promise } Promise that returns no value. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; + * 3. Parameter verification failed. + * @throws { BusinessError } 15500000 - Inner error. + * @syscap SystemCapability.DistributedDataManager.Preferences.Core + * @atomicservice + * @since 12 + */ + put(key: string, value: lang.ISendable): Promise; + /** + * Sets an lang.ISendable value for the key in the {@link Preferences} object. + * This API returns the result synchronously. + *

You can call the {@link #flush} method to save the {@link Preferences} object to the file. + * + * @param { string } key - Indicates the key of the preferences to set. It cannot be {@code null} or empty. + * MAX_KEY_LENGTH. + * @param { lang.ISendable } value - Indicates the value of the preferences. + * MAX_VALUE_LENGTH. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; + * 3. Parameter verification failed. + * @throws { BusinessError } 15500000 - Inner error. + * @syscap SystemCapability.DistributedDataManager.Preferences.Core + * @atomicservice + * @since 12 + */ + putSync(key: string, value: lang.ISendable): void; + /** + * Deletes the preferences with a specified key from the {@link Preferences} object. + *

You can call the {@link #flush} method to save the {@link Preferences} object to the file. + * + * @param { string } key - Indicates the key of the preferences to delete. It cannot be {@code null} or empty. + * MAX_KEY_LENGTH. + * @returns { Promise } Promise that returns no value. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; + * 3. Parameter verification failed. + * @throws { BusinessError } 15500000 - Inner error. + * @syscap SystemCapability.DistributedDataManager.Preferences.Core + * @atomicservice + * @since 12 + */ + delete(key: string): Promise; + /** + * Deletes the preferences with a specified key from the {@link Preferences} object. This API returns the result + * synchronously. + *

You can call the {@link #flush} method to save the {@link Preferences} object to the file. + * + * @param { string } key - Indicates the key of the preferences to delete. It cannot be {@code null} or empty. + * MAX_KEY_LENGTH. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; + * 3. Parameter verification failed. + * @throws { BusinessError } 15500000 - Inner error. + * @syscap SystemCapability.DistributedDataManager.Preferences.Core + * @atomicservice + * @since 12 + */ + deleteSync(key: string): void; + /** + * Clears all preferences from the {@link Preferences} object. + *

You can call the {@link #flush} method to save the {@link Preferences} object to the file. + * + * @returns { Promise } Promise that returns no value. + * @throws { BusinessError } 15500000 - Inner error. + * @syscap SystemCapability.DistributedDataManager.Preferences.Core + * @atomicservice + * @since 12 + */ + clear(): Promise; + /** + * Clears all preferences from the {@link Preferences} object. This API returns the result synchronously. + *

You can call the {@link #flush} method to save the {@link Preferences} object to the file. + * + * @throws { BusinessError } 15500000 - Inner error. + * @syscap SystemCapability.DistributedDataManager.Preferences.Core + * @atomicservice + * @since 12 + */ + clearSync(): void; + /** + * Flushes the {@link Preferences} object to the file. + * + * @returns { Promise } Promise that returns no value. + * @throws { BusinessError } 15500000 - Inner error. + * @syscap SystemCapability.DistributedDataManager.Preferences.Core + * @atomicservice + * @since 12 + */ + flush(): Promise; + /** + * Registers an observer to listen for the change of a {@link Preferences} object. + * + * @param { 'change' } type - Indicates the type of the event to observe. + * @param { Callback } callback - Indicates the callback used to return the preferences changes. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; + * 3. Parameter verification failed. + * @throws { BusinessError } 15500000 - Inner error. + * @syscap SystemCapability.DistributedDataManager.Preferences.Core + * @atomicservice + * @since 12 + */ + on(type: 'change', callback: Callback): void; + /** + * Registers an observer to listen for the change of a {@link Preferences} object in multiple processes. + * + * @param { 'multiProcessChange' } type - Indicates the type of the event to observe. + * @param { Callback } callback - Indicates the callback used to return the preferences changed + * in multiple processes. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; + * 3. Parameter verification failed. + * @throws { BusinessError } 15500000 - Inner error. + * @throws { BusinessError } 15500019 - Failed to obtain subscription service. + * @syscap SystemCapability.DistributedDataManager.Preferences.Core + * @atomicservice + * @since 12 + */ + on(type: 'multiProcessChange', callback: Callback): void; + /** + * Registers an observer to listen for changes to the {@link Preferences} object. + * + * @param { 'dataChange' } type - Indicates the type of the event to observe. + * @param { Array } keys - Indicates one or more keys to listen for. + * @param { Callback } callback - Indicates the callback used to return the data change. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; + * 3. Parameter verification failed. + * @throws { BusinessError } 15500000 - Inner error. + * @syscap SystemCapability.DistributedDataManager.Preferences.Core + * @atomicservice + * @since 12 + */ + on(type: 'dataChange', keys: Array, callback: Callback): void; + /** + * Unregisters an observer used to listen for changes to the {@link Preferences} object. + * + * @param { 'change' } type - Indicates the event type. + * @param { Callback } callback - Indicates the callback to unregister. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; + * 3. Parameter verification failed. + * @throws { BusinessError } 15500000 - Inner error. + * @syscap SystemCapability.DistributedDataManager.Preferences.Core + * @atomicservice + * @since 12 + */ + off(type: 'change', callback?: Callback): void; + /** + * Unregisters an observer used to listen for the preferences changed in multiple processes. + * + * @param { 'multiProcessChange' } type - Indicates the event type. + * @param { Callback } callback - Indicates the callback to unregister. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; + * 3. Parameter verification failed. + * @throws { BusinessError } 15500000 - Inner error. + * @syscap SystemCapability.DistributedDataManager.Preferences.Core + * @atomicservice + * @since 12 + */ + off(type: 'multiProcessChange', callback?: Callback): void; + /** + * Unregisters an observer for changes to the {@ link Preferences} object. + * + * @param { 'dataChange' } type - Indicates the event type. + * @param { Array } keys - Indicates the data whose changes are not observed. + * @param { Callback } callback - Indicates the callback to unregister. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; + * 3. Parameter verification failed. + * @throws { BusinessError } 15500000 - Inner error. + * @syscap SystemCapability.DistributedDataManager.Preferences.Core + * @atomicservice + * @since 12 + */ + off(type: 'dataChange', keys: Array, callback?: Callback): void; + } +} +export default sendablePreferences; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.data.storage.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.data.storage.d.ts new file mode 100755 index 00000000..a7ba51ec --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.data.storage.d.ts @@ -0,0 +1,233 @@ +/* +* Copyright (c) 2021 Huawei Device Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +/** + * @file + * @kit ArkData + */ +import { AsyncCallback, Callback } from './@ohos.base'; +/** + * Provides interfaces to obtain and modify storage data. + * + * @name storage + * @since 6 + * @deprecated since 9 + * @useinstead ohos.preferences.preferences + * @syscap SystemCapability.DistributedDataManager.Preferences.Core + * + */ +declare namespace storage { + /** + * Obtains a {@link Storage} instance matching a specified storage file name. + * + *

The {@link references} instance loads all data of the storage file and + * resides in the memory. You can use removeStorageFromCache to remove the instance from the memory. + * + * @param path Indicates the path of storage file stored. + * @returns Returns the {@link Storage} instance matching the specified storage file name. + * @throws BusinessError if invoked failed + * @since 6 + * @deprecated since 9 + * @useinstead ohos.preferences.preferences.getPreferences + */ + function getStorageSync(path: string): Storage; + function getStorage(path: string, callback: AsyncCallback): void; + function getStorage(path: string): Promise; + /** + * Deletes a {@link Storage} instance matching a specified storage file name + * from the cache which is performed by removeStorageFromCache and deletes the + * storage file. + * + *

When deleting the {@link Storage} instance, you must release all references + * of the instance. In addition, do not use the instance to perform data operations. Otherwise, inconsistent data + * will occur. + * + * @param path Indicates the path of storage file + * @throws BusinessError if invoked failed + * @since 6 + * @deprecated since 9 + * @useinstead ohos.preferences.preferences.deletePreferences + */ + function deleteStorageSync(path: string): void; + function deleteStorage(path: string, callback: AsyncCallback): void; + function deleteStorage(path: string): Promise; + /** + * Deletes a {@link Storage} instance matching a specified storage file name + * from the cache. + * + *

When deleting the {@link Storage} instance, you must release all references + * of the instance. In addition, do not use the instance to perform data operations. Otherwise, inconsistent data + * will occur. + * + * @param path Indicates the path of storage file. + * @throws BusinessError if invoked failed + * @since 6 + * @deprecated since 9 + * @useinstead ohos.preferences.preferences.removePreferencesFromCache + */ + function removeStorageFromCacheSync(path: string): void; + function removeStorageFromCache(path: string, callback: AsyncCallback): void; + function removeStorageFromCache(path: string): Promise; + /** + * Provides interfaces to obtain and modify storage data. + * + *

The storage data is stored in a file, which matches only one {@link Storage} instance in the memory. + * You can use getStorage to obtain the {@link Storage} instance matching + * the file that stores storage data, and use removeStorageFromCache + * to remove the {@link Storage} instance from the memory. + * + * @syscap SystemCapability.DistributedDataManager.Preferences.Core + * + * @since 6 + * @deprecated since 9 + * @useinstead ohos.preferences.preferences + */ + interface Storage { + /** + * Obtains the value of a storage in the int format. + * + *

If the value is {@code null} or not in the int format, the default value is returned. + * + * @param key Indicates the key of the storage. It cannot be {@code null} or empty. + * @param defValue Indicates the default value to return. + * @returns Returns the value matching the specified key if it is found; returns the default value otherwise. + * @throws BusinessError if invoked failed + * @since 6 + * @deprecated since 9 + * @useinstead ohos.preferences.preferences.get + */ + getSync(key: string, defValue: ValueType): ValueType; + get(key: string, defValue: ValueType, callback: AsyncCallback): void; + get(key: string, defValue: ValueType): Promise; + /** + * Checks whether the {@link Storage} object contains a storage matching a specified key. + * + * @param key Indicates the key of the storage to check for. + * @returns Returns {@code true} if the {@link Storage} object contains a storage with the specified key; + * returns {@code false} otherwise. + * @throws BusinessError if invoked failed + * @since 6 + * @deprecated since 9 + * @useinstead ohos.preferences.preferences.has + */ + hasSync(key: string): boolean; + has(key: string, callback: AsyncCallback): boolean; + has(key: string): Promise; + /** + * Sets an int value for the key in the {@link Storage} object. + * + *

You can call the {@link #flush} or {@link #flushSync} method to save the {@link Storage} object to the + * file. + * + * @param key Indicates the key of the storage to modify. It cannot be {@code null} or empty. + * @param value Indicates the value of the storage. + * MAX_KEY_LENGTH. + * @throws BusinessError if invoked failed + * @since 6 + * @deprecated since 9 + * @useinstead ohos.preferences.preferences.put + */ + putSync(key: string, value: ValueType): void; + put(key: string, value: ValueType, callback: AsyncCallback): void; + put(key: string, value: ValueType): Promise; + /** + * Deletes the storage with a specified key from the {@link Storage} object. + * + *

You can call the {@link #flush} method to save the {@link Storage} object to the + * file. + * + * @param key Indicates the key of the storage to delete. It cannot be {@code null} or empty. + * MAX_KEY_LENGTH. + * @throws BusinessError if invoked failed + * @since 6 + * @deprecated since 9 + * @useinstead ohos.preferences.preferences.delete + */ + deleteSync(key: string): void; + delete(key: string, callback: AsyncCallback): void; + delete(key: string): Promise; + /** + * Clears all storage from the {@link Storage} object. + * + *

You can call the {@link #flush} method to save the {@link Storage} object to the + * file. + * + * @throws BusinessError if invoked failed + * @since 6 + * @deprecated since 9 + * @useinstead ohos.preferences.preferences.clear + */ + clearSync(): void; + clear(callback: AsyncCallback): void; + clear(): Promise; + /** + * Asynchronously saves the {@link Storage} object to the file. + * + * @throws BusinessError if invoked failed + * @since 6 + * @deprecated since 9 + * @useinstead ohos.preferences.preferences.flush + */ + flushSync(): void; + flush(callback: AsyncCallback): void; + flush(): Promise; + /** + * Registers an observer to listen for the change of a {@link Storage} object. + * + * @param callback Indicates the callback when storage changes. + * @throws BusinessError if invoked failed + * @since 6 + * @deprecated since 9 + * @useinstead ohos.preferences.preferences.on + */ + on(type: 'change', callback: Callback): void; + /** + * Unregister an existing observer. + * + * @param callback Indicates the registered callback. + * @throws BusinessError if invoked failed + * @since 6 + * @deprecated since 9 + * @useinstead ohos.preferences.preferences.off + */ + off(type: 'change', callback: Callback): void; + } + /** + * Indicates possible value types + */ + type ValueType = number | string | boolean; + /** + * Define the change data information object. + * + * @syscap SystemCapability.DistributedDataManager.Preferences.Core + * + * @since 6 + * @deprecated since 9 + */ + interface StorageObserver { + /** + * Indicates which key changes + */ + key: string; + } + /** + * Indicates the maximum length of a key (80 characters). + */ + const MAX_KEY_LENGTH: 80; + /** + * Indicates the maximum length of a string (8192 characters). + */ + const MAX_VALUE_LENGTH: 8192; +} +export default storage; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.data.unifiedDataChannel.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.data.unifiedDataChannel.d.ts new file mode 100755 index 00000000..6635d2bf --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.data.unifiedDataChannel.d.ts @@ -0,0 +1,1259 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit ArkData + */ +import { AsyncCallback } from './@ohos.base'; +import image from "./@ohos.multimedia.image"; +import Want from "./@ohos.app.ability.Want"; +/** + * Provide methods for sharing data between different applications across unified data channels. + * + * @namespace unifiedDataChannel + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 10 + */ +/** + * Provide methods for sharing data between different applications across unified data channels. + * + * @namespace unifiedDataChannel + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @atomicservice + * @since 11 + */ +declare namespace unifiedDataChannel { + /** + * Types of scope that UnifiedData can be used. + * @enum { number } + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @atomicservice + * @since 12 + */ + enum ShareOptions { + /** + * IN_APP indicates that only use in the same app is allowed. + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @atomicservice + * @since 12 + */ + IN_APP, + /** + * CROSS_APP indicates that use in any app in this device is allowed. + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @atomicservice + * @since 12 + */ + CROSS_APP + } + /** + * Indicated delay get UnifiedData + * + * @typedef {function} GetDelayData + * @param { string } type - the type of UnifiedData required. + * @returns { UnifiedData } Return the UnifiedData required. + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @atomicservice + * @since 12 + */ + type GetDelayData = (type: string) => UnifiedData; + /** + * Indicates type of value. + * @typedef {number | string | image.PixelMap | Want | ArrayBuffer} + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @atomicservice + * @since 12 + */ + type ValueType = number | string | image.PixelMap | Want | ArrayBuffer; + /** + * Describe the unified data properties. + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @atomicservice + * @since 12 + */ + class UnifiedDataProperties { + /** + * extra property data. key-value pairs. + * @type { ?Record } + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @atomicservice + * @since 12 + */ + extras?: Record; + /** + * the user-defined tag of a UnifiedData object. + * @type { ?string } + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @atomicservice + * @since 12 + */ + tag?: string; + /** + * a timestamp, which indicates when data is written. + * @type { ?Date } + * @readonly + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @atomicservice + * @since 12 + */ + readonly timestamp?: Date; + /** + * Indicates the scope of clipboard data which can be used. + * If it is not set or is incorrectly set, The default value is CrossDevice. + * @type { ?ShareOptions } + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @atomicservice + * @since 12 + */ + shareOptions?: ShareOptions; + /** + * Indicated delay get UnifiedData. + * @type { ?GetDelayData } + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @atomicservice + * @since 12 + */ + getDelayData?: GetDelayData; + } + /** + * Describe the unified data. + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 10 + */ + /** + * Describe the unified data. + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @atomicservice + * @since 11 + */ + class UnifiedData { + /** + * Create unified data with a record + * + * @param { UnifiedRecord } record - Record will add into unified data. + * @throws { BusinessError } 401 - Parameter error. Possible causes:1.Mandatory parameters are left unspecified; + *
2.Incorrect Parameters types. + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 10 + */ + /** + * Create unified data with a record + * + * @param { UnifiedRecord } record - Record will add into unified data. + * @throws { BusinessError } 401 - Parameter error. Possible causes:1.Mandatory parameters are left unspecified; + *
2.Incorrect Parameters types. + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @atomicservice + * @since 11 + */ + constructor(record: UnifiedRecord); + /** + * Create a empty unified data. + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @atomicservice + * @since 12 + */ + constructor(); + /** + * Add a record into unified data + * + * @param { UnifiedRecord } record - Record will add into unified data. + * @throws { BusinessError } 401 - Parameter error. Possible causes:1.Mandatory parameters are left unspecified; + *
2.Incorrect Parameters types. + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 10 + */ + /** + * Add a record into unified data + * + * @param { UnifiedRecord } record - Record will add into unified data. + * @throws { BusinessError } 401 - Parameter error. Possible causes:1.Mandatory parameters are left unspecified; + *
2.Incorrect Parameters types. + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @atomicservice + * @since 11 + */ + addRecord(record: UnifiedRecord): void; + /** + * Get all records of unified data + * + * @returns { Array } Return the records of unified data + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 10 + */ + /** + * Get all records of unified data + * + * @returns { Array } Return the records of unified data + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @atomicservice + * @since 11 + */ + getRecords(): Array; + /** + * Checks whether there is a specified type of data in DataProperties. + * @param { string } type - indicates to query data type. + * @returns { boolean } if having mimeType in UnifiedData returns true, else returns false. + * @throws { BusinessError } 401 - Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameters types. + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @atomicservice + * @since 12 + */ + hasType(type: string): boolean; + /** + * UTD types of all content in the UnifiedData. + * @returns { Array } type of array + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @atomicservice + * @since 12 + */ + getTypes(): Array; + /** + * UnifiedData properties. + * @type { UnifiedDataProperties } + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @atomicservice + * @since 12 + */ + properties: UnifiedDataProperties; + } + /** + * The data abstract supported by unified data + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 10 + */ + /** + * The data abstract supported by unified data + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @atomicservice + * @since 11 + */ + class Summary { + /** + * A map for each type and data size, key is data type, value is the corresponding data size + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 10 + */ + /** + * A map for each type and data size, key is data type, value is the corresponding data size + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @atomicservice + * @since 11 + */ + summary: Record; + /** + * Total data size of data in Bytes + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 10 + */ + /** + * Total data size of data in Bytes + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @atomicservice + * @since 11 + */ + totalSize: number; + } + /** + * Describe the unified record + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 10 + */ + /** + * Describe the unified record + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @atomicservice + * @since 11 + */ + class UnifiedRecord { + /** + * Get type of unified record + * + * @returns { string } Return the type of unified data + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 10 + */ + /** + * Get type of unified record + * + * @returns { string } Return the type of unified data + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @atomicservice + * @since 11 + */ + getType(): string; + /** + * Create unified record. + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @atomicservice + * @since 12 + */ + constructor(); + /** + * Create unified record by type and value. + * + * @param { string } type - indicates to data type of unified record. It can not be empty. + * When type of value is object, parameter type must be pixel-map or want UTD type. + * @param { ValueType } value - indicates to value of unified record. + * @throws { BusinessError } 401 - Parameter error. Possible causes:1.Mandatory parameters are left unspecified; + *
2.Incorrect Parameters types; + *
3.Parameter verification failed. + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @atomicservice + * @since 12 + */ + constructor(type: string, value: ValueType); + /** + * Get the value of unified record. + * + * @returns { ValueType } Return the value of unified record. + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @atomicservice + * @since 12 + */ + getValue(): ValueType; + } + /** + * Describe the unified text data + * + * @extends UnifiedRecord + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 10 + */ + /** + * Describe the unified text data + * + * @extends UnifiedRecord + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @atomicservice + * @since 11 + */ + class Text extends UnifiedRecord { + /** + * Indicates the details of unified text + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 10 + */ + /** + * Indicates the details of unified text + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @atomicservice + * @since 11 + */ + details?: Record; + } + /** + * Describe the unified plain text data + * + * @extends Text + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 10 + */ + /** + * Describe the unified plain text data + * + * @extends Text + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @atomicservice + * @since 11 + */ + class PlainText extends Text { + /** + * Indicates the content of text + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 10 + */ + /** + * Indicates the content of text + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @atomicservice + * @since 11 + */ + textContent: string; + /** + * Indicates the abstract of text + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 10 + */ + /** + * Indicates the abstract of text + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @atomicservice + * @since 11 + */ + abstract?: string; + } + /** + * Describe the unified link data + * + * @extends Text + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 10 + */ + /** + * Describe the unified link data + * + * @extends Text + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @atomicservice + * @since 11 + */ + class Hyperlink extends Text { + /** + * Indicates the url of a link + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 10 + */ + /** + * Indicates the url of a link + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @atomicservice + * @since 11 + */ + url: string; + /** + * Indicates the description of a link + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 10 + */ + /** + * Indicates the description of a link + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @atomicservice + * @since 11 + */ + description?: string; + } + /** + * Describe the unified html data + * + * @extends Text + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 10 + */ + /** + * Describe the unified html data + * + * @extends Text + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @atomicservice + * @since 11 + */ + class HTML extends Text { + /** + * Indicates the content of html, with html tags + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 10 + */ + /** + * Indicates the content of html, with html tags + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @atomicservice + * @since 11 + */ + htmlContent: string; + /** + * Indicates the plain content of html + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 10 + */ + /** + * Indicates the plain content of html + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @atomicservice + * @since 11 + */ + plainContent?: string; + } + /** + * Describe the unified file data + * + * @extends UnifiedRecord + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 10 + */ + /** + * Describe the unified file data + * + * @extends UnifiedRecord + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @atomicservice + * @since 11 + */ + class File extends UnifiedRecord { + /** + * Indicates the details of unified File + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 10 + */ + /** + * Indicates the details of unified File + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @atomicservice + * @since 11 + */ + details?: Record; + /** + * Indicates the uri of file + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 10 + */ + /** + * Indicates the uri of file + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @atomicservice + * @since 11 + */ + uri: string; + } + /** + * Describe the unified image data + * + * @extends File + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 10 + */ + /** + * Describe the unified image data + * + * @extends File + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @atomicservice + * @since 11 + */ + class Image extends File { + /** + * Indicates the uri of image + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 10 + */ + /** + * Indicates the uri of image + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @atomicservice + * @since 11 + */ + imageUri: string; + } + /** + * Describe the unified video data + * + * @extends File + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 10 + */ + /** + * Describe the unified video data + * + * @extends File + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @atomicservice + * @since 11 + */ + class Video extends File { + /** + * Indicates the uri of video + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 10 + */ + /** + * Indicates the uri of video + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @atomicservice + * @since 11 + */ + videoUri: string; + } + /** + * Describe the unified audio data + * + * @extends File + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 10 + */ + /** + * Describe the unified audio data + * + * @extends File + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @atomicservice + * @since 11 + */ + class Audio extends File { + /** + * Indicates the uri of audio + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 10 + */ + /** + * Indicates the uri of audio + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @atomicservice + * @since 11 + */ + audioUri: string; + } + /** + * Describe the unified folder data + * + * @extends File + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 10 + */ + /** + * Describe the unified folder data + * + * @extends File + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @atomicservice + * @since 11 + */ + class Folder extends File { + /** + * Indicates the uri of folder + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 10 + */ + /** + * Indicates the uri of folder + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @atomicservice + * @since 11 + */ + folderUri: string; + } + /** + * Describe system defined type data(this kind of data is provided and bound to OpenHarmony, + * also can be parsed by system provided API) + * + * @extends UnifiedRecord + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 10 + */ + /** + * Describe system defined type data(this kind of data is provided and bound to OpenHarmony, + * also can be parsed by system provided API) + * + * @extends UnifiedRecord + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @atomicservice + * @since 11 + */ + class SystemDefinedRecord extends UnifiedRecord { + /** + * Indicates the details of system defined data + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 10 + */ + /** + * Indicates the details of system defined data + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @atomicservice + * @since 11 + */ + details?: Record; + } + /** + * Describe system defined form data(this kind of data is provided and bound to OpenHarmony, + * also can be parsed by system provided API) + * + * @extends SystemDefinedRecord + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 10 + */ + /** + * Describe system defined form data(this kind of data is provided and bound to OpenHarmony, + * also can be parsed by system provided API) + * + * @extends SystemDefinedRecord + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @atomicservice + * @since 11 + */ + class SystemDefinedForm extends SystemDefinedRecord { + /** + * Indicates the id of form + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 10 + */ + /** + * Indicates the id of form + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @atomicservice + * @since 11 + */ + formId: number; + /** + * Indicates the name of form + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 10 + */ + /** + * Indicates the name of form + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @atomicservice + * @since 11 + */ + formName: string; + /** + * Indicates the bundle name of form + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 10 + */ + /** + * Indicates the bundle name of form + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @atomicservice + * @since 11 + */ + bundleName: string; + /** + * Indicates the ability name of form + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 10 + */ + /** + * Indicates the ability name of form + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @atomicservice + * @since 11 + */ + abilityName: string; + /** + * Indicates the module of form + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 10 + */ + /** + * Indicates the module of form + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @atomicservice + * @since 11 + */ + module: string; + } + /** + * Describe system defined app item data(this kind of data is provided and bound to OpenHarmony, + * also can be parsed by system provided API) + * + * @extends SystemDefinedRecord + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 10 + */ + /** + * Describe system defined app item data(this kind of data is provided and bound to OpenHarmony, + * also can be parsed by system provided API) + * + * @extends SystemDefinedRecord + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @atomicservice + * @since 11 + */ + class SystemDefinedAppItem extends SystemDefinedRecord { + /** + * Indicates the app id + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 10 + */ + /** + * Indicates the app id + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @atomicservice + * @since 11 + */ + appId: string; + /** + * Indicates the app name + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 10 + */ + /** + * Indicates the app name + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @atomicservice + * @since 11 + */ + appName: string; + /** + * Indicates the id of app icon + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 10 + */ + /** + * Indicates the id of app icon + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @atomicservice + * @since 11 + */ + appIconId: string; + /** + * Indicates the id of app label + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 10 + */ + /** + * Indicates the id of app label + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @atomicservice + * @since 11 + */ + appLabelId: string; + /** + * Indicates the bundle name of app + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 10 + */ + /** + * Indicates the bundle name of app + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @atomicservice + * @since 11 + */ + bundleName: string; + /** + * Indicates the ability name of app + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 10 + */ + /** + * Indicates the ability name of app + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @atomicservice + * @since 11 + */ + abilityName: string; + } + /** + * Describe system defined pixel map data(this kind of data is provided and bound to OpenHarmony, + * also can be parsed by system provided API) + * + * @extends SystemDefinedRecord + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 10 + */ + /** + * Describe system defined pixel map data(this kind of data is provided and bound to OpenHarmony, + * also can be parsed by system provided API) + * + * @extends SystemDefinedRecord + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @atomicservice + * @since 11 + */ + class SystemDefinedPixelMap extends SystemDefinedRecord { + /** + * Indicates the raw data of pixel map + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 10 + */ + /** + * Indicates the raw data of pixel map + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @atomicservice + * @since 11 + */ + rawData: Uint8Array; + } + /** + * Describe application defined data(this kind of data is provided and bound to OpenHarmony, + * also can be parsed by system provided API) + * + * @extends UnifiedRecord + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 10 + */ + /** + * Describe application defined data(this kind of data is provided and bound to OpenHarmony, + * also can be parsed by system provided API) + * + * @extends UnifiedRecord + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @atomicservice + * @since 11 + */ + class ApplicationDefinedRecord extends UnifiedRecord { + /** + * Indicates the type of data, should always be started with 'ApplicationDefined.', will + * return error otherwise + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 10 + */ + /** + * Indicates the type of data, should always be started with 'ApplicationDefined.', will + * return error otherwise + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @atomicservice + * @since 11 + */ + applicationDefinedType: string; + /** + * Indicates the raw data of application defined data + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 10 + */ + /** + * Indicates the raw data of application defined data + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @atomicservice + * @since 11 + */ + rawData: Uint8Array; + } + /** + * Describe the sharing channel that UDMF support + * + * @enum { string } + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 10 + */ + /** + * Describe the sharing channel that UDMF support + * + * @enum { string } + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @atomicservice + * @since 11 + */ + enum Intention { + /** + * Indicates the intention of data hub + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 10 + */ + /** + * Indicates the intention of data hub + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @atomicservice + * @since 11 + */ + DATA_HUB = 'DataHub' + } + /** + * Describe the optional arguments of data operation + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 10 + */ + /** + * Describe the optional arguments of data operation + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @atomicservice + * @since 11 + */ + type Options = { + /** + * Indicates the target Intention + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 10 + */ + /** + * Indicates the target Intention + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @atomicservice + * @since 11 + */ + intention?: Intention; + /** + * Indicates the unique identifier of target UnifiedData + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 10 + */ + /** + * Indicates the unique identifier of target UnifiedData + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @atomicservice + * @since 11 + */ + key?: string; + }; + /** + * Insert data into unified data channel by Intention + * + * @param { Options } options - fill the intention field to indicate the target {@link Intention}. + * @param { UnifiedData } data - {@link UnifiedData} data object to insert into target intention. + * @param { AsyncCallback } callback - {string}: the unique identifier. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Parameter error. Possible causes:1.Mandatory parameters are left unspecified; + *
2.Incorrect Parameters types. + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 10 + */ + /** + * Insert data into unified data channel by Intention + * + * @param { Options } options - fill the intention field to indicate the target {@link Intention}. + * @param { UnifiedData } data - {@link UnifiedData} data object to insert into target intention. + * @param { AsyncCallback } callback - {string}: the unique identifier. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Parameter error. Possible causes:1.Mandatory parameters are left unspecified; + *
2.Incorrect Parameters types. + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @atomicservice + * @since 11 + */ + function insertData(options: Options, data: UnifiedData, callback: AsyncCallback): void; + /** + * Insert data into unified data channel by Intention + * + * @param { Options } options - fill the intention field to indicate the target {@link Intention}. + * @param { UnifiedData } data - {@link UnifiedData} data object to insert into target intention. + * @returns { Promise } {string}: the unique identifier. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Parameter error. Possible causes:1.Mandatory parameters are left unspecified; + *
2.Incorrect Parameters types. + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 10 + */ + /** + * Insert data into unified data channel by Intention + * + * @param { Options } options - fill the intention field to indicate the target {@link Intention}. + * @param { UnifiedData } data - {@link UnifiedData} data object to insert into target intention. + * @returns { Promise } {string}: the unique identifier. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Parameter error. Possible causes:1.Mandatory parameters are left unspecified; + *
2.Incorrect Parameters types. + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @atomicservice + * @since 11 + */ + function insertData(options: Options, data: UnifiedData): Promise; + /** + * Update data to unified data channel by Unique Identifier + * + * @param { Options } options - fill the unique identifier field to indicate the target {@link UnifiedData}. + * @param { UnifiedData } data - {@link UnifiedData} data object to update the target data. + * @param { AsyncCallback } callback - the callback of updateData. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Parameter error. Possible causes:1.Mandatory parameters are left unspecified; + *
2.Incorrect Parameters types. + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 10 + */ + /** + * Update data to unified data channel by Unique Identifier + * + * @param { Options } options - fill the unique identifier field to indicate the target {@link UnifiedData}. + * @param { UnifiedData } data - {@link UnifiedData} data object to update the target data. + * @param { AsyncCallback } callback - the callback of updateData. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Parameter error. Possible causes:1.Mandatory parameters are left unspecified; + *
2.Incorrect Parameters types. + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @atomicservice + * @since 11 + */ + function updateData(options: Options, data: UnifiedData, callback: AsyncCallback): void; + /** + * Update data to unified data channel by Unique Identifier + * + * @param { Options } options - fill the unique identifier field to indicate the target {@link UnifiedData}. + * @param { UnifiedData } data - {@link UnifiedData} data object to update the target data. + * @returns { Promise } the promise returned by the function. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Parameter error. Possible causes:1.Mandatory parameters are left unspecified; + *
2.Incorrect Parameters types. + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 10 + */ + /** + * Update data to unified data channel by Unique Identifier + * + * @param { Options } options - fill the unique identifier field to indicate the target {@link UnifiedData}. + * @param { UnifiedData } data - {@link UnifiedData} data object to update the target data. + * @returns { Promise } the promise returned by the function. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Parameter error. Possible causes:1.Mandatory parameters are left unspecified; + *
2.Incorrect Parameters types. + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @atomicservice + * @since 11 + */ + function updateData(options: Options, data: UnifiedData): Promise; + /** + * Query data of unified data channel by Intention or Unique Identifier + * + * @param { Options } options - fill the intention or unique identifier field to indicate the target {@link Intention} or {@link UnifiedData}. + * @param { AsyncCallback> } callback - {Array}: the target {@link UnifiedData} object array. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Parameter error. Possible causes:1.Mandatory parameters are left unspecified; + *
2.Incorrect Parameters types. + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 10 + */ + /** + * Query data of unified data channel by Intention or Unique Identifier + * + * @param { Options } options - fill the intention or unique identifier field to indicate the target {@link Intention} or {@link UnifiedData}. + * @param { AsyncCallback> } callback - {Array}: the target {@link UnifiedData} object array. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Parameter error. Possible causes:1.Mandatory parameters are left unspecified; + *
2.Incorrect Parameters types. + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @atomicservice + * @since 11 + */ + function queryData(options: Options, callback: AsyncCallback>): void; + /** + * Query data of unified data channel by Intention or Unique Identifier + * + * @param { Options } options - fill the intention or unique identifier field to indicate the target {@link Intention} or {@link UnifiedData}. + * @returns { Promise> } {Array}: the target {@link UnifiedData} object array. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Parameter error. Possible causes:1.Mandatory parameters are left unspecified; + *
2.Incorrect Parameters types. + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 10 + */ + /** + * Query data of unified data channel by Intention or Unique Identifier + * + * @param { Options } options - fill the intention or unique identifier field to indicate the target {@link Intention} or {@link UnifiedData}. + * @returns { Promise> } {Array}: the target {@link UnifiedData} object array. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Parameter error. Possible causes:1.Mandatory parameters are left unspecified; + *
2.Incorrect Parameters types. + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @atomicservice + * @since 11 + */ + function queryData(options: Options): Promise>; + /** + * Delete data of unified data channel by Intention or Unique Identifier + * + * @param { Options } options - fill the intention or unique identifier field to indicate the target {@link Intention} or {@link UnifiedData}. + * @param { AsyncCallback> } callback - {Array}: the deleted {@link UnifiedData} object array. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Parameter error. Possible causes:1.Mandatory parameters are left unspecified; + *
2.Incorrect Parameters types. + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 10 + */ + /** + * Delete data of unified data channel by Intention or Unique Identifier + * + * @param { Options } options - fill the intention or unique identifier field to indicate the target {@link Intention} or {@link UnifiedData}. + * @param { AsyncCallback> } callback - {Array}: the deleted {@link UnifiedData} object array. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Parameter error. Possible causes:1.Mandatory parameters are left unspecified; + *
2.Incorrect Parameters types. + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @atomicservice + * @since 11 + */ + function deleteData(options: Options, callback: AsyncCallback>): void; + /** + * Delete data of unified data channel by Intention or Unique Identifier + * + * @param { Options } options - fill the intention or unique identifier field to indicate the target {@link Intention} or {@link UnifiedData}. + * @returns { Promise> } {Array}: the deleted {@link UnifiedData} object array. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Parameter error. Possible causes:1.Mandatory parameters are left unspecified; + *
2.Incorrect Parameters types. + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 10 + */ + /** + * Delete data of unified data channel by Intention or Unique Identifier + * + * @param { Options } options - fill the intention or unique identifier field to indicate the target {@link Intention} or {@link UnifiedData}. + * @returns { Promise> } {Array}: the deleted {@link UnifiedData} object array. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Parameter error. Possible causes:1.Mandatory parameters are left unspecified; + *
2.Incorrect Parameters types. + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @atomicservice + * @since 11 + */ + function deleteData(options: Options): Promise>; +} +export default unifiedDataChannel; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.data.uniformDataStruct.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.data.uniformDataStruct.d.ts new file mode 100755 index 00000000..3a850030 --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.data.uniformDataStruct.d.ts @@ -0,0 +1,222 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit ArkData + */ +/** + * Provide uniform data struct definition. + * + * @namespace uniformDataStruct + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 12 + */ +declare namespace uniformDataStruct { + /** + * Describe the plain text uniform data struct. + * + * @interface PlainText + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 12 + */ + interface PlainText { + /** + * Indicates the uniform data type of this data struct. + * + * @type { 'general.plain-text' } + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 12 + */ + uniformDataType: 'general.plain-text'; + /** + * Indicates the content of the PlainText. + * + * @type { string } + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 12 + */ + textContent: string; + /** + * Indicates the abstract of the PlainText. + * @type { ?string } + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 12 + */ + abstract?: string; + /** + * Indicates the details of the PlainText. + * + * @type { ?Record } + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 12 + */ + details?: Record; + } + /** + * Describe the hyperlink uniform data struct. + * + * @interface Hyperlink + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 12 + */ + interface Hyperlink { + /** + * Indicates the uniform data type of this data struct. + * + * @type { 'general.hyperlink' } + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 12 + */ + uniformDataType: 'general.hyperlink'; + /** + * Indicates the url of of the Hyperlink. + * + * @type { string } + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 12 + */ + url: string; + /** + * Indicates the description of the Hyperlink. + * @type { ?string } + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 12 + */ + description?: string; + /** + * Indicates the details of the Hyperlink. + * + * @type { ?Record } + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 12 + */ + details?: Record; + } + /** + * Describe the html uniform data struct. + * + * @interface HTML + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 12 + */ + interface HTML { + /** + * Indicates the uniform data type of this data struct. + * + * @type { 'general.html' } + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 12 + */ + uniformDataType: 'general.html'; + /** + * Indicates the content of html, with html tags. + * + * @type { string } + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 12 + */ + htmlContent: string; + /** + * Indicates the plain content of html. + * + * @type { ?string } + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 12 + */ + plainContent?: string; + /** + * Indicates the details of html. + * + * @type { ?Record } + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 12 + */ + details?: Record; + } + /** + * Describe system defined app item uniform data struct(this kind of struct is provided and bound to OpenHarmony). + * + * @interface OpenHarmonyAppItem + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 12 + */ + interface OpenHarmonyAppItem { + /** + * Indicates the uniform data type of this data struct. + * + * @type { 'openharmony.app-item' } + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 12 + */ + uniformDataType: 'openharmony.app-item'; + /** + * Indicates the app id. + * + * @type { string } + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 12 + */ + appId: string; + /** + * Indicates the app name. + * + * @type { string } + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 12 + */ + appName: string; + /** + * Indicates the id of app icon. + * + * @type { string } + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 12 + */ + appIconId: string; + /** + * Indicates the id of app label. + * + * @type { string } + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 12 + */ + appLabelId: string; + /** + * Indicates the bundle name of app. + * + * @type { string } + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 12 + */ + bundleName: string; + /** + * Indicates the ability name of app. + * + * @type { string } + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 12 + */ + abilityName: string; + /** + * Indicates the details of app. + * + * @type { ?Record } + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 12 + */ + details?: Record; + } +} +export default uniformDataStruct; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.data.uniformTypeDescriptor.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.data.uniformTypeDescriptor.d.ts new file mode 100755 index 00000000..a81332a9 --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.data.uniformTypeDescriptor.d.ts @@ -0,0 +1,1237 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit ArkData + */ +/** + * Provides methods for uniform data type definition and query. + * + * @namespace uniformTypeDescriptor + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 10 + */ +/** + * Provides methods for uniform data type definition and query. + * + * @namespace uniformTypeDescriptor + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @atomicservice + * @since 11 + */ +declare namespace uniformTypeDescriptor { + /** + * Uniform data type IDs. + * + * @enum { string } + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 10 + */ + /** + * Uniform data type IDs. + * + * @enum { string } + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @atomicservice + * @since 11 + */ + enum UniformDataType { + /** + * Base data type for physical hierarchy, which identifies the physical representation of the data type. + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 11 + */ + ENTITY = 'general.entity', + /** + * Base data type for logical hierarchy, which identifies the logical content representation of the data type. + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 11 + */ + OBJECT = 'general.object', + /** + * Base data type for mixed object. For example, a PDF file contains both text and special formatting data. + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 11 + */ + COMPOSITE_OBJECT = 'general.composite-object', + /** + * Text data type. + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 10 + */ + /** + * Text data type. + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @atomicservice + * @since 11 + */ + TEXT = 'general.text', + /** + * Plain text data type. + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 10 + */ + /** + * Plain text data type. + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @atomicservice + * @since 11 + */ + PLAIN_TEXT = 'general.plain-text', + /** + * HTML data type. + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 10 + */ + /** + * HTML data type. + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @atomicservice + * @since 11 + */ + HTML = 'general.html', + /** + * Hyperlink data type. + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 10 + */ + /** + * Hyperlink data type. + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @atomicservice + * @since 11 + */ + HYPERLINK = 'general.hyperlink', + /** + * XML(Extensible Markup Language) data type. + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 11 + */ + XML = 'general.xml', + /** + * Real synchronized multimedia integration language. + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 12 + */ + SMIL = 'com.real.smil', + /** + * Source code data type. + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 11 + */ + SOURCE_CODE = 'general.source-code', + /** + * Script data type. + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 11 + */ + SCRIPT = 'general.script', + /** + * Shell script data type. + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 11 + */ + SHELL_SCRIPT = 'general.shell-script', + /** + * C-shell script data type. + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 11 + */ + CSH_SCRIPT = 'general.csh-script', + /** + * Perl script data type. + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 11 + */ + PERL_SCRIPT = 'general.perl-script', + /** + * PHP script data type. + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 11 + */ + PHP_SCRIPT = 'general.php-script', + /** + * Python script data type. + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 11 + */ + PYTHON_SCRIPT = 'general.python-script', + /** + * Ruby script data type. + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 11 + */ + RUBY_SCRIPT = 'general.ruby-script', + /** + * TypeScript data type. + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 11 + */ + TYPE_SCRIPT = 'general.type-script', + /** + * JavaScript data type. + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 11 + */ + JAVA_SCRIPT = 'general.java-script', + /** + * C header data type. + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 11 + */ + C_HEADER = 'general.c-header', + /** + * C source code data type. + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 11 + */ + C_SOURCE = 'general.c-source', + /** + * C++ header data type. + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 11 + */ + C_PLUS_PLUS_HEADER = 'general.c-plus-plus-header', + /** + * C++ source code data type. + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 11 + */ + C_PLUS_PLUS_SOURCE = 'general.c-plus-plus-source', + /** + * Java source code data type. + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 11 + */ + JAVA_SOURCE = 'general.java-source', + /** + * Markdown format. + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 12 + */ + MARKDOWN = 'general.markdown', + /** + * Ebook data type. + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 11 + */ + EBOOK = 'general.ebook', + /** + * EPUB ebook file format data type. + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 11 + */ + EPUB = 'general.epub', + /** + * AZW ebook file format data type. + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 11 + */ + AZW = 'com.amazon.azw', + /** + * AZW3 ebook file format data type. + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 11 + */ + AZW3 = 'com.amazon.azw3', + /** + * KFX ebook file format data type. + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 11 + */ + KFX = 'com.amazon.kfx', + /** + * MOBI ebook file format data type. + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 11 + */ + MOBI = 'com.amazon.mobi', + /** + * Media data type. + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 11 + */ + MEDIA = 'general.media', + /** + * Image data type. + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 10 + */ + /** + * Image data type. + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @atomicservice + * @since 11 + */ + IMAGE = 'general.image', + /** + * JPEG image format data type. + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 11 + */ + JPEG = 'general.jpeg', + /** + * PNG image format data type. + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 11 + */ + PNG = 'general.png', + /** + * Raw image format data type. + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 11 + */ + RAW_IMAGE = 'general.raw-image', + /** + * TIFF image format data type. + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 11 + */ + TIFF = 'general.tiff', + /** + * Windows bitmap image data type. + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 11 + */ + BMP = 'com.microsoft.bmp', + /** + * Windows icon data type. + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 11 + */ + ICO = 'com.microsoft.ico', + /** + * Adobe Photoshop document data type. + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 11 + */ + PHOTOSHOP_IMAGE = 'com.adobe.photoshop-image', + /** + * Adobe Illustrator document data type. + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 11 + */ + AI_IMAGE = 'com.adobe.illustrator.ai-image', + /** + * Base type for fax images. + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 12 + */ + FAX = 'general.fax', + /** + * J2 jConnect fax file format. + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 12 + */ + JFX_FAX = 'com.j2.jfx-fax', + /** + * The electronic fax document format. + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 12 + */ + EFX_FAX = 'com.js.efx-fax', + /** + * X bitmap image. + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 12 + */ + XBITMAP_IMAGE = 'general.xbitmap-image', + /** + * Tagged Graphics (TGA), a type of image format. + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 12 + */ + TGA_IMAGE = 'com.truevision.tga-image', + /** + * Silicon Graphics image. + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 12 + */ + SGI_IMAGE = 'com.sgi.sgi-image', + /** + * OpenEXR image. + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 12 + */ + OPENEXR_IMAGE = 'com.ilm.openexr-image', + /** + * FlashPix image. + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 12 + */ + FLASHPIX_IMAGE = 'com.kodak.flashpix.image', + /** + * Microsoft Word data type. + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 11 + */ + WORD_DOC = 'com.microsoft.word.doc', + /** + * Microsoft Excel data type. + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 11 + */ + EXCEL = 'com.microsoft.excel.xls', + /** + * Microsoft PowerPoint presentation data type. + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 11 + */ + PPT = 'com.microsoft.powerpoint.ppt', + /** + * PDF data type. + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 11 + */ + PDF = 'com.adobe.pdf', + /** + * PostScript data type. + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 11 + */ + POSTSCRIPT = 'com.adobe.postscript', + /** + * Encapsulated PostScript data type. + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 11 + */ + ENCAPSULATED_POSTSCRIPT = 'com.adobe.encapsulated-postscript', + /** + * Video data type. + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 10 + */ + /** + * Video data type. + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @atomicservice + * @since 11 + */ + VIDEO = 'general.video', + /** + * AVI video format data type. + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 11 + */ + AVI = 'general.avi', + /** + * MPEG video format data type. + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 11 + */ + MPEG = 'general.mpeg', + /** + * MPEG4 video format data type. + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 11 + */ + MPEG4 = 'general.mpeg-4', + /** + * 3GPP video format data type. + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 11 + */ + VIDEO_3GPP = 'general.3gpp', + /** + * 3GPP2 video format data type. + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 11 + */ + VIDEO_3GPP2 = 'general.3gpp2', + /** + * Windows WM video format data type. + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 11 + */ + WINDOWS_MEDIA_WM = 'com.microsoft.windows-media-wm', + /** + * Windows WMV video format data type. + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 11 + */ + WINDOWS_MEDIA_WMV = 'com.microsoft.windows-media-wmv', + /** + * Windows WMP video format data type. + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 11 + */ + WINDOWS_MEDIA_WMP = 'com.microsoft.windows-media-wmp', + /** + * Windows WVX video format data type. + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 11 + */ + WINDOWS_MEDIA_WVX = 'com.microsoft.windows-media-wvx', + /** + * Windows WMX video format data type. + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 11 + */ + WINDOWS_MEDIA_WMX = 'com.microsoft.windows-media-wmx', + /** + * RealMedia. + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 12 + */ + REALMEDIA = 'com.real.realmedia', + /** + * Audio data type. + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 10 + */ + /** + * Audio data type. + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @atomicservice + * @since 11 + */ + AUDIO = 'general.audio', + /** + * AAC audio format data type. + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 11 + */ + AAC = 'general.aac', + /** + * AIFF audio format data type. + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 11 + */ + AIFF = 'general.aiff', + /** + * ALAC audio format data type. + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 11 + */ + ALAC = 'general.alac', + /** + * FLAC audio format data type. + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 11 + */ + FLAC = 'general.flac', + /** + * MP3 audio format data type. + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 11 + */ + MP3 = 'general.mp3', + /** + * OGG audio format data type. + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 11 + */ + OGG = 'general.ogg', + /** + * PCM audio format data type. + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 11 + */ + PCM = 'general.pcm', + /** + * Windows WMA audio format data type. + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 11 + */ + WINDOWS_MEDIA_WMA = 'com.microsoft.windows-media-wma', + /** + * Waveform audio format data type created by Microsoft. + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 11 + */ + WAVEFORM_AUDIO = 'com.microsoft.waveform-audio', + /** + * Windows WAX audio format data type. + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 11 + */ + WINDOWS_MEDIA_WAX = 'com.microsoft.windows-media-wax', + /** + * Au file format. + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 12 + */ + AU_AUDIO = 'general.au-audio', + /** + * Audio Interchange File Format. + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 12 + */ + AIFC_AUDIO = 'general.aifc-audio', + /** + * Digidesign Sound Designer II audio. + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 12 + */ + SD2_AUDIO = 'com.digidesign.sd2-audio', + /** + * RealMedia audio. + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 12 + */ + REALAUDIO = 'com.real.realaudio', + /** + * File data type. + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 10 + */ + /** + * File data type. + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @atomicservice + * @since 11 + */ + FILE = 'general.file', + /** + * Directory data type. + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 11 + */ + DIRECTORY = 'general.directory', + /** + * Folder data type. + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 10 + */ + /** + * Folder data type. + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @atomicservice + * @since 11 + */ + FOLDER = 'general.folder', + /** + * Symlink data type. + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 11 + */ + SYMLINK = 'general.symlink', + /** + * Archive file data type. + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 11 + */ + ARCHIVE = 'general.archive', + /** + * Bzip2 archive file data type. + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 11 + */ + BZ2_ARCHIVE = 'general.bz2-archive', + /** + * Disk image archive file data type. + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 11 + */ + DISK_IMAGE = 'general.disk-image', + /** + * Tar archive data type. + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 11 + */ + TAR_ARCHIVE = 'general.tar-archive', + /** + * Zip archive data type. + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 11 + */ + ZIP_ARCHIVE = 'general.zip-archive', + /** + * Java archive data type. + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 11 + */ + JAVA_ARCHIVE = 'com.sun.java-archive', + /** + * GNU archive data type. + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 11 + */ + GNU_TAR_ARCHIVE = 'org.gnu.gnu-tar-archive', + /** + * Gzip archive data type. + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 11 + */ + GNU_ZIP_ARCHIVE = 'org.gnu.gnu-zip-archive', + /** + * Gzip tar archive data type. + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 11 + */ + GNU_ZIP_TAR_ARCHIVE = 'org.gnu.gnu-zip-tar-archive', + /** + * Office Open XML. + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 12 + */ + OPENXML = 'org.openxmlformats.openxml', + /** + * Office Open XML Document. + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 12 + */ + WORDPROCESSINGML_DOCUMENT = 'org.openxmlformats.wordprocessingml.document', + /** + * Office Open XML Workbook. + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 12 + */ + SPREADSHEETML_SHEET = 'org.openxmlformats.spreadsheetml.sheet', + /** + * Office Open XML Presentation. + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 12 + */ + PRESENTATIONML_PRESENTATION = 'org.openxmlformats.presentationml.presentation', + /** + * Open Document Format for Office Applications. + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 12 + */ + OPENDOCUMENT = 'org.oasis.opendocument', + /** + * OpenDocument Text. + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 12 + */ + OPENDOCUMENT_TEXT = 'org.oasis.opendocument.text', + /** + * OpenDocument Spreadsheet. + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 12 + */ + OPENDOCUMENT_SPREADSHEET = 'org.oasis.opendocument.spreadsheet', + /** + * OpenDocument Presentation. + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 12 + */ + OPENDOCUMENT_PRESENTATION = 'org.oasis.opendocument.presentation', + /** + * OpenDocument Graphics. + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 12 + */ + OPENDOCUMENT_GRAPHICS = 'org.oasis.opendocument.graphics', + /** + * OpenDocument Formulat. + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 12 + */ + OPENDOCUMENT_FORMULA = 'org.oasis.opendocument.formula', + /** + * Stuffit archive. + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 12 + */ + STUFFIT_ARCHIVE = 'com.allume.stuffit-archive', + /** + * Calendar data type. + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 11 + */ + CALENDAR = 'general.calendar', + /** + * VCalendar type, a type of calendar format. + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 12 + */ + VCS = 'general.vcs', + /** + * ICalendar type, a type of calendar format. + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 12 + */ + ICS = 'general.ics', + /** + * Contact data type. + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 11 + */ + CONTACT = 'general.contact', + /** + * Database data type. + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 11 + */ + DATABASE = 'general.database', + /** + * Message data type. + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 11 + */ + MESSAGE = 'general.message', + /** + * Base type for executable data. + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 12 + */ + EXECUTABLE = 'general.executable', + /** + * Microsoft Windows application. + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 12 + */ + PORTABLE_EXECUTABLE = 'com.microsoft.portable-executable', + /** + * Java class. + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 12 + */ + SUN_JAVA_CLASS = 'com.sun.java-class', + /** + * A file format data type stand for electronic business card. + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 11 + */ + VCARD = 'general.vcard', + /** + * Navigation data type. + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 11 + */ + NAVIGATION = 'general.navigation', + /** + * Location data type. + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 11 + */ + LOCATION = 'general.location', + /** + * Base type for fonts. + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 12 + */ + FONT = 'general.font', + /** + * TrueType font. + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 12 + */ + TRUETYPE_FONT = 'general.truetype-font', + /** + * TrueType collection font. + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 12 + */ + TRUETYPE_COLLECTION_FONT = 'general.truetype-collection-font', + /** + * OpenType font. + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 12 + */ + OPENTYPE_FONT = 'general.opentype-font', + /** + * PostScript font. + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 12 + */ + POSTSCRIPT_FONT = 'com.adobe.postscript-font', + /** + * A Printer Font Binary version of Adobe's Type 1. + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 12 + */ + POSTSCRIPT_PFB_FONT = 'com.adobe.postscript-pfb-font', + /** + * Adobe Type 1 font. + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 12 + */ + POSTSCRIPT_PFA_FONT = 'com.adobe.postscript-pfa-font', + /** + * OpenHarmony system defined form data type(the data is provided and bound to OpenHarmony system). + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 10 + */ + /** + * OpenHarmony system defined form data type(the data is provided and bound to OpenHarmony system). + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @atomicservice + * @since 11 + */ + OPENHARMONY_FORM = 'openharmony.form', + /** + * OpenHarmony system defined app item data type(the data is provided and bound to OpenHarmony system). + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 10 + */ + /** + * OpenHarmony system defined app item data type(the data is provided and bound to OpenHarmony system). + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @atomicservice + * @since 11 + */ + OPENHARMONY_APP_ITEM = 'openharmony.app-item', + /** + * OpenHarmony system defined pixel map data type(the data is provided and bound to OpenHarmony system). + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 10 + */ + /** + * OpenHarmony system defined pixel map data type(the data is provided and bound to OpenHarmony system). + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @atomicservice + * @since 11 + */ + OPENHARMONY_PIXEL_MAP = 'openharmony.pixel-map', + /** + * OpenHarmony system defined atomic service data type(the data is provided and bound to OpenHarmony system). + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 11 + */ + OPENHARMONY_ATOMIC_SERVICE = 'openharmony.atomic-service', + /** + * OpenHarmony system defined package, which is a directory presented to the user as a file(the data is provided + *
and bound to OpenHarmony system). + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 11 + */ + OPENHARMONY_PACKAGE = 'openharmony.package', + /** + * OpenHarmony system defined ability package(the data is provided and bound to OpenHarmony system). + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 11 + */ + OPENHARMONY_HAP = 'openharmony.hap', + /** + * OpenHarmony system AppNotepad data format. + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 12 + */ + OPENHARMONY_HDOC = 'openharmony.hdoc', + /** + * OpenHarmony system Notes data format. + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 12 + */ + OPENHARMONY_HINOTE = 'openharmony.hinote', + /** + * OpenHarmony system defined styled string. + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 12 + */ + OPENHARMONY_STYLED_STRING = 'openharmony.styled-string', + /** + * OpenHarmony system defined Want. + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 12 + */ + OPENHARMONY_WANT = 'openharmony.want' + } + /** + * Class describing the uniform data type defined in the {@code UniformDataType}, which consists of attributes and + *
methods describing the uniform data type and its relationships to other uniform data types. + * + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 11 + */ + class TypeDescriptor { + /** + * Type ID of the uniform data type, which corresponds to the enum string in the {@code UniformDataType}. + * + * @type { string } + * @readonly + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 11 + */ + readonly typeId: string; + /** + * Uniform data type IDs that the uniform data type belongs to. + * + * @type { Array } + * @readonly + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 11 + */ + readonly belongingToTypes: Array; + /** + * A textual description for the uniform data type. + * + * @type { string } + * @readonly + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 11 + */ + readonly description: string; + /** + * Reference URL for the uniform data type, which describes the detail information of the type. + * + * @type { string } + * @readonly + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 11 + */ + readonly referenceURL: string; + /** + * Default icon file path for the uniform data type. + * + * @type { string } + * @readonly + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 11 + */ + readonly iconFile: string; + /** + * File name extensions for the uniform data type. + * + * @type { Array } + * @readonly + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 12 + */ + readonly filenameExtensions: Array; + /** + * MIMETypes of the uniform data type. + * + * @type { Array } + * @readonly + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 12 + */ + readonly mimeTypes: Array; + /** + * Checks whether the uniform data type belongs to the given uniform data type. + * + * @param { string } type - A uniform data type to be compared. + * @returns { boolean } Returns true if the data type belongs to the given data type, else false. + * @throws { BusinessError } 401 - Parameter error. Possible causes:1.Mandatory parameters are left unspecified; + *
2.Incorrect Parameters types. + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 11 + */ + belongsTo(type: string): boolean; + /** + * Checks whether the uniform data type is the lower level type of the given uniform data type. + * + * @param { string } type - A uniform data type to be compared. + * @returns { boolean } Returns true if the data type is the lower level type of the given data type, else false. + * @throws { BusinessError } 401 - Parameter error. Possible causes:1.Mandatory parameters are left unspecified; + *
2.Incorrect Parameters types. + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 11 + */ + isLowerLevelType(type: string): boolean; + /** + * Checks whether the uniform data type is the higher level type of the given uniform data type. + * + * @param { string } type - A uniform data type to be compared. + * @returns { boolean } Returns true if the data type is the higher level type of the given data type, else false. + * @throws { BusinessError } 401 - Parameter error. Possible causes:1.Mandatory parameters are left unspecified; + *
2.Incorrect Parameters types. + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 11 + */ + isHigherLevelType(type: string): boolean; + /** + * Checks whether the uniform type descriptor is equal to the given uniform type descriptor. + * + * @param { TypeDescriptor } typeDescriptor - A uniform type descriptor to be compared. + * @returns { boolean } Returns true if the type descriptor is equal to the given type descriptor, else false. + * @throws { BusinessError } 401 - Parameter error. Possible causes:1.Mandatory parameters are left unspecified; + *
2.Incorrect Parameters types. + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 11 + */ + equals(typeDescriptor: TypeDescriptor): boolean; + } + /** + * Queries and returns the uniform type descriptor by the given uniform data type ID. + * + * @param { string } typeId - Uniform data type ID. + * @returns { TypeDescriptor } Returns the uniform type descriptor corresponding to the uniform data type ID or null + *
if the uniform data type does not exist. + * @throws { BusinessError } 401 - Parameter error. Possible causes:1.Mandatory parameters are left unspecified; + *
2.Incorrect Parameters types. + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 11 + */ + function getTypeDescriptor(typeId: string): TypeDescriptor; + /** + * Queries and returns the uniform type descriptor by the given filename extension and the uniform data type it belongs to. + * + * @param { string } filenameExtension - Filename extension. + * @param { string } [belongsTo] - A uniform data type ID it belongs to. + * @returns { string } Returns the uniform data type ID corresponding to the given filename extension and the + *
uniform data type it belongs to(If the 'belongsTo' parameter is set) or flexible type if the uniform data type does not exist. + * @throws { BusinessError } 401 - Parameter error. Possible causes:1.Mandatory parameters are left unspecified; + *
2.Incorrect Parameters types. + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 11 + */ + function getUniformDataTypeByFilenameExtension(filenameExtension: string, belongsTo?: string): string; + /** + * Queries and returns the uniform type descriptor by the given MIME type and the uniform data type it belongs to. + * + * @param { string } mimeType - MIME type. + * @param { string } [belongsTo] - A uniform data type ID it belongs to. + * @returns { string } Returns the uniform data type ID corresponding to the given MIME type and the uniform data type + *
it belongs to(If the 'belongsTo' parameter is set) or flexible type if the uniform data type does not exist. + * @throws { BusinessError } 401 - Parameter error. Possible causes:1.Mandatory parameters are left unspecified; + *
2.Incorrect Parameters types. + * @syscap SystemCapability.DistributedDataManager.UDMF.Core + * @since 11 + */ + function getUniformDataTypeByMIMEType(mimeType: string, belongsTo?: string): string; +} +export default uniformTypeDescriptor; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.deviceAttest.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.deviceAttest.d.ts new file mode 100755 index 00000000..60cfee02 --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.deviceAttest.d.ts @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit BasicServicesKit + */ + +/** + * xts_device_attest authResult information + * + * @namespace deviceAttest + * @syscap SystemCapability.XTS.DeviceAttest + * @since 9 + */ +declare namespace deviceAttest { +} +export default deviceAttest; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.deviceInfo.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.deviceInfo.d.ts new file mode 100755 index 00000000..a95125bd --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.deviceInfo.d.ts @@ -0,0 +1,616 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit BasicServicesKit + */ +/** + * A static class pertaining to the product information. + * + * @namespace deviceInfo + * @syscap SystemCapability.Startup.SystemInfo + * @since 6 + */ +/** + * A static class pertaining to the product information. + * + * @namespace deviceInfo + * @syscap SystemCapability.Startup.SystemInfo + * @crossplatform + * @atomicservice + * @since 11 + */ +declare namespace deviceInfo { + /** + * Obtains the device type represented by a string, + * which can be {@code phone} (or {@code default} for phones), {@code wearable}, {@code liteWearable}, + * {@code tablet}, {@code tv}, {@code car}, or {@code smartVision}. + * + * @constant + * @syscap SystemCapability.Startup.SystemInfo + * @since 6 + */ + /** + * Obtains the device type represented by a string, + * which can be {@code phone} (or {@code default} for phones), {@code wearable}, {@code liteWearable}, + * {@code tablet}, {@code tv}, {@code car}, or {@code smartVision}. + * + * @constant + * @syscap SystemCapability.Startup.SystemInfo + * @crossplatform + * @since 10 + */ + /** + * Obtains the device type represented by a string, + * which can be {@code phone} (or {@code default} for phones), {@code wearable}, {@code liteWearable}, + * {@code tablet}, {@code tv}, {@code car}, or {@code smartVision}. + * + * @constant + * @syscap SystemCapability.Startup.SystemInfo + * @crossplatform + * @atomicservice + * @since 11 + */ + const deviceType: string; + /** + * Obtains the device manufacturer represented by a string. + * + * @constant + * @syscap SystemCapability.Startup.SystemInfo + * @since 6 + */ + /** + * Obtains the device manufacturer represented by a string. + * + * @constant + * @syscap SystemCapability.Startup.SystemInfo + * @crossplatform + * @since 10 + */ + const manufacture: string; + /** + * Obtains the device brand represented by a string. + * + * @constant + * @syscap SystemCapability.Startup.SystemInfo + * @since 6 + */ + /** + * Obtains the device brand represented by a string. + * + * @constant + * @syscap SystemCapability.Startup.SystemInfo + * @crossplatform + * @since 10 + */ + /** + * Obtains the device brand represented by a string. + * + * @constant + * @syscap SystemCapability.Startup.SystemInfo + * @crossplatform + * @atomicservice + * @since 11 + */ + const brand: string; + /** + * Obtains the external product series represented by a string. + * + * @constant + * @syscap SystemCapability.Startup.SystemInfo + * @since 6 + */ + /** + * Obtains the external product series represented by a string. + * + * @constant + * @syscap SystemCapability.Startup.SystemInfo + * @crossplatform + * @since 10 + */ + const marketName: string; + /** + * Obtains the product series represented by a string. + * + * @constant + * @syscap SystemCapability.Startup.SystemInfo + * @since 6 + */ + /** + * Obtains the product series represented by a string. + * + * @constant + * @syscap SystemCapability.Startup.SystemInfo + * @crossplatform + * @since 10 + */ + const productSeries: string; + /** + * Obtains the product model represented by a string. + * + * @constant + * @syscap SystemCapability.Startup.SystemInfo + * @since 6 + */ + /** + * Obtains the product model represented by a string. + * + * @constant + * @syscap SystemCapability.Startup.SystemInfo + * @crossplatform + * @since 10 + */ + /** + * Obtains the product model represented by a string. + * + * @constant + * @syscap SystemCapability.Startup.SystemInfo + * @crossplatform + * @atomicservice + * @since 11 + */ + const productModel: string; + /** + * Obtains the software model represented by a string. + * + * @constant + * @syscap SystemCapability.Startup.SystemInfo + * @since 6 + */ + /** + * Obtains the software model represented by a string. + * + * @constant + * @syscap SystemCapability.Startup.SystemInfo + * @crossplatform + * @since 10 + */ + const softwareModel: string; + /** + * Obtains the hardware model represented by a string. + * + * @constant + * @syscap SystemCapability.Startup.SystemInfo + * @since 6 + */ + /** + * Obtains the hardware model represented by a string. + * + * @constant + * @syscap SystemCapability.Startup.SystemInfo + * @crossplatform + * @since 10 + */ + const hardwareModel: string; + /** + * Obtains the hardware profile represented by a string. + * + * @constant + * @syscap SystemCapability.Startup.SystemInfo + * @since 6 + * @deprecated since 9 + */ + const hardwareProfile: string; + /** + * Obtains the device serial number represented by a string. + * + * @permission ohos.permission.sec.ACCESS_UDID + * @constant + * @syscap SystemCapability.Startup.SystemInfo + * @since 6 + */ + const serial: string; + /** + * Obtains the bootloader version number represented by a string. + * + * @constant + * @syscap SystemCapability.Startup.SystemInfo + * @since 6 + */ + /** + * Obtains the bootloader version number represented by a string. + * + * @constant + * @syscap SystemCapability.Startup.SystemInfo + * @crossplatform + * @since 10 + */ + const bootloaderVersion: string; + /** + * Obtains the application binary interface (Abi) list represented by a string. + * + * @constant + * @syscap SystemCapability.Startup.SystemInfo + * @since 6 + */ + /** + * Obtains the application binary interface (Abi) list represented by a string. + * + * @constant + * @syscap SystemCapability.Startup.SystemInfo + * @crossplatform + * @since 10 + */ + const abiList: string; + /** + * Obtains the security patch level represented by a string. + * + * @constant + * @syscap SystemCapability.Startup.SystemInfo + * @since 6 + */ + /** + * Obtains the security patch level represented by a string. + * + * @constant + * @syscap SystemCapability.Startup.SystemInfo + * @crossplatform + * @since 10 + */ + const securityPatchTag: string; + /** + * Obtains the product version represented by a string. + * + * @constant + * @syscap SystemCapability.Startup.SystemInfo + * @since 6 + */ + /** + * Obtains the product version represented by a string. + * + * @constant + * @syscap SystemCapability.Startup.SystemInfo + * @crossplatform + * @since 10 + */ + const displayVersion: string; + /** + * Obtains the incremental version represented by a string. + * + * @constant + * @syscap SystemCapability.Startup.SystemInfo + * @since 6 + */ + /** + * Obtains the incremental version represented by a string. + * + * @constant + * @syscap SystemCapability.Startup.SystemInfo + * @crossplatform + * @since 10 + */ + const incrementalVersion: string; + /** + * Obtains the OS release type represented by a string. + *

The OS release category can be {@code Release}, {@code Beta}, or {@code Canary}. + * The specific release type may be {@code Release}, {@code Beta1}, or others alike. + * + * @constant + * @syscap SystemCapability.Startup.SystemInfo + * @since 6 + */ + /** + * Obtains the OS release type represented by a string. + *

The OS release category can be {@code Release}, {@code Beta}, or {@code Canary}. + * The specific release type may be {@code Release}, {@code Beta1}, or others alike. + * + * @constant + * @syscap SystemCapability.Startup.SystemInfo + * @crossplatform + * @since 10 + */ + const osReleaseType: string; + /** + * Obtains the OS version represented by a string. + * + * @constant + * @syscap SystemCapability.Startup.SystemInfo + * @since 6 + */ + /** + * Obtains the OS version represented by a string. + * + * @constant + * @syscap SystemCapability.Startup.SystemInfo + * @crossplatform + * @since 10 + */ + /** + * Obtains the OS version represented by a string. + * + * @constant + * @syscap SystemCapability.Startup.SystemInfo + * @crossplatform + * @atomicservice + * @since 11 + */ + const osFullName: string; + /** + * Obtains the major (M) version number, which increases with any updates to the overall architecture. + *

The M version number monotonically increases from 1 to 99. + * + * @constant + * @syscap SystemCapability.Startup.SystemInfo + * @since 6 + */ + /** + * Obtains the major (M) version number, which increases with any updates to the overall architecture. + *

The M version number monotonically increases from 1 to 99. + * + * @constant + * @syscap SystemCapability.Startup.SystemInfo + * @crossplatform + * @since 10 + */ + const majorVersion: number; + /** + * Obtains the senior (S) version number, which increases with any updates to the partial + * architecture or major features. + *

The S version number monotonically increases from 0 to 99. + * + * @constant + * @syscap SystemCapability.Startup.SystemInfo + * @since 6 + */ + /** + * Obtains the senior (S) version number, which increases with any updates to the partial + * architecture or major features. + *

The S version number monotonically increases from 0 to 99. + * + * @constant + * @syscap SystemCapability.Startup.SystemInfo + * @crossplatform + * @since 10 + */ + const seniorVersion: number; + /** + * Obtains the feature (F) version number, which increases with any planned new features. + *

The F version number monotonically increases from 0 or 1 to 99. + * + * @constant + * @syscap SystemCapability.Startup.SystemInfo + * @since 6 + */ + /** + * Obtains the feature (F) version number, which increases with any planned new features. + *

The F version number monotonically increases from 0 or 1 to 99. + * + * @constant + * @syscap SystemCapability.Startup.SystemInfo + * @crossplatform + * @since 10 + */ + const featureVersion: number; + /** + * Obtains the build (B) version number, which increases with each new development build. + *

The B version number monotonically increases from 0 or 1 to 999. + * + * @constant + * @syscap SystemCapability.Startup.SystemInfo + * @since 6 + */ + /** + * Obtains the build (B) version number, which increases with each new development build. + *

The B version number monotonically increases from 0 or 1 to 999. + * + * @constant + * @syscap SystemCapability.Startup.SystemInfo + * @crossplatform + * @since 10 + */ + const buildVersion: number; + /** + * Obtains the SDK API version number. + * + * @constant + * @syscap SystemCapability.Startup.SystemInfo + * @since 6 + */ + /** + * Obtains the SDK API version number. + * + * @constant + * @syscap SystemCapability.Startup.SystemInfo + * @crossplatform + * @since 10 + */ + const sdkApiVersion: number; + /** + * Obtains the first API version number. + * + * @constant + * @syscap SystemCapability.Startup.SystemInfo + * @since 6 + */ + /** + * Obtains the first API version number. + * + * @constant + * @syscap SystemCapability.Startup.SystemInfo + * @crossplatform + * @since 10 + */ + const firstApiVersion: number; + /** + * Obtains the version ID by a string. + * + * @constant + * @syscap SystemCapability.Startup.SystemInfo + * @since 6 + */ + /** + * Obtains the version ID by a string. + * + * @constant + * @syscap SystemCapability.Startup.SystemInfo + * @crossplatform + * @since 10 + */ + const versionId: string; + /** + * Obtains the build types of the same baseline code. + * + * @constant + * @syscap SystemCapability.Startup.SystemInfo + * @since 6 + */ + /** + * Obtains the build types of the same baseline code. + * + * @constant + * @syscap SystemCapability.Startup.SystemInfo + * @crossplatform + * @since 10 + */ + const buildType: string; + /** + * Obtains the different build user of the same baseline code. + * + * @constant + * @syscap SystemCapability.Startup.SystemInfo + * @since 6 + */ + /** + * Obtains the different build user of the same baseline code. + * + * @constant + * @syscap SystemCapability.Startup.SystemInfo + * @crossplatform + * @since 10 + */ + const buildUser: string; + /** + * Obtains the different build host of the same baseline code. + * + * @constant + * @syscap SystemCapability.Startup.SystemInfo + * @since 6 + */ + /** + * Obtains the different build host of the same baseline code. + * + * @constant + * @syscap SystemCapability.Startup.SystemInfo + * @crossplatform + * @since 10 + */ + const buildHost: string; + /** + * Obtains the build time. + * + * @constant + * @syscap SystemCapability.Startup.SystemInfo + * @since 6 + */ + /** + * Obtains the build time. + * + * @constant + * @syscap SystemCapability.Startup.SystemInfo + * @crossplatform + * @since 10 + */ + const buildTime: string; + /** + * Obtains the version hash. + * + * @constant + * @syscap SystemCapability.Startup.SystemInfo + * @since 6 + */ + /** + * Obtains the version hash. + * + * @constant + * @syscap SystemCapability.Startup.SystemInfo + * @crossplatform + * @since 10 + */ + const buildRootHash: string; + /** + * Obtains the device udid. + * + * @permission ohos.permission.sec.ACCESS_UDID + * @constant + * @syscap SystemCapability.Startup.SystemInfo + * @since 7 + */ + const udid: string; + /** + * Obtains the Distribution OS name. + *

Independent Software Vendor (ISV) may distribute OHOS with their own OS name. + * distributionOsName will return the ISV OS name + * If ISV not specified, it will return an empty string + * + * @constant + * @syscap SystemCapability.Startup.SystemInfo + * @since 10 + */ + const distributionOSName: string; + /** + * Obtains the Distribution OS version. + *

Independent Software Vendor (ISV) may distribute OHOS with their own OS version. + * distributionOSVersion will return the ISV OS version + * If ISV not specified, it will return the same value as osFullName + * + * @constant + * @syscap SystemCapability.Startup.SystemInfo + * @since 10 + */ + const distributionOSVersion: string; + /** + * Obtains the Distribution OS version. + *

Independent Software Vendor (ISV) may distribute OHOS with their own OS api version. + * distributionOSVersion will return the ISV OS api version + * If ISV not specified, it will return the same value as sdkApiVersion + * + * @constant + * @syscap SystemCapability.Startup.SystemInfo + * @since 10 + */ + const distributionOSApiVersion: number; + /** + * Obtains the Distribution OS release type. + *

Independent Software Vendor (ISV) may distribute OHOS with their own OS release type. + * distributionOSVersion will return the ISV OS release type + * If ISV not specified, it will return the same value as osReleaseType + * + * @constant + * @syscap SystemCapability.Startup.SystemInfo + * @since 10 + */ + const distributionOSReleaseType: string; + /** + * Open Device Identifier (ODID): a developer-level non-permanent device identifier. + * A developer can be an enterprise or individual developer. + * Example: dff3cdfd-7beb-1e7d-fdf7-1dbfddd7d30c + * + * An ODID will be regenerated in the following scenarios: + * Restore a phone to its factory settings. + * Uninstall and reinstall all apps of one developer on one device. + * + * An ODID is generated based on the following rules: + * For apps from the same developer, which are running on the same device, they have the same ODID. + * For apps from different developers, which are running on the same device, each of them has its own ODID. + * For apps from the same developer, which are running on different devices, each of them has its own ODID. + * For apps from different developers, which are running on different devices, each of them has its own ODID. + * + * @constant + * @syscap SystemCapability.Startup.SystemInfo + * @since 12 + */ + const ODID: string; +} +export default deviceInfo; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.display.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.display.d.ts new file mode 100755 index 00000000..9f2c74c3 --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.display.d.ts @@ -0,0 +1,978 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit ArkUI + */ +import type { AsyncCallback, Callback } from './@ohos.base'; +import type colorSpaceManager from './@ohos.graphics.colorSpaceManager'; +import type hdrCapability from './@ohos.graphics.hdrCapability'; +/** + * Interface of display manager. + * + * @namespace display + * @syscap SystemCapability.WindowManager.WindowManager.Core + * @since 7 + */ +/** + * Interface of display manager. + * + * @namespace display + * @syscap SystemCapability.WindowManager.WindowManager.Core + * @crossplatform + * @since 10 + */ +/** + * Interface of display manager. + * + * @namespace display + * @syscap SystemCapability.WindowManager.WindowManager.Core + * @crossplatform + * @atomicservice + * @since 11 + */ +declare namespace display { + /** + * Obtain the default display. + * + * @param { AsyncCallback } callback the result of display + * @syscap SystemCapability.WindowManager.WindowManager.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.display#getDefaultDisplaySync + */ + function getDefaultDisplay(callback: AsyncCallback): void; + /** + * Obtain the default display. + * + * @returns { Promise } the result of display + * @syscap SystemCapability.WindowManager.WindowManager.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.display#getDefaultDisplaySync + */ + function getDefaultDisplay(): Promise; + /** + * Obtain the default display. + * + * @returns { Display } the result of display + * @throws { BusinessError } 1400001 - Invalid display or screen. + * @syscap SystemCapability.WindowManager.WindowManager.Core + * @since 9 + */ + /** + * Obtain the default display. + * + * @returns { Display } the result of display + * @throws { BusinessError } 1400001 - Invalid display or screen. + * @syscap SystemCapability.WindowManager.WindowManager.Core + * @crossplatform + * @since 10 + */ + /** + * Obtain the default display. + * + * @returns { Display } the result of display + * @throws { BusinessError } 1400001 - Invalid display or screen. + * @syscap SystemCapability.WindowManager.WindowManager.Core + * @crossplatform + * @atomicservice + * @since 11 + */ + function getDefaultDisplaySync(): Display; + /** + * Obtain all displays. + * + * @param { AsyncCallback> } callback the result of all displays + * @syscap SystemCapability.WindowManager.WindowManager.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.display#getAllDisplays + */ + function getAllDisplay(callback: AsyncCallback>): void; + /** + * Obtain all displays. + * + * @returns { Promise> } the result of all displays + * @syscap SystemCapability.WindowManager.WindowManager.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.display#getAllDisplays + */ + function getAllDisplay(): Promise>; + /** + * Obtain all displays. + * + * @param { AsyncCallback> } callback the result of all displays + * @throws { BusinessError } 1400001 - Invalid display or screen. + * @syscap SystemCapability.WindowManager.WindowManager.Core + * @since 9 + */ + function getAllDisplays(callback: AsyncCallback>): void; + /** + * Obtain all displays. + * + * @returns { Promise> } the result of all displays + * @throws { BusinessError } 1400001 - Invalid display or screen. + * @syscap SystemCapability.WindowManager.WindowManager.Core + * @since 9 + */ + function getAllDisplays(): Promise>; + /** + * Register the callback for display changes. + * + * @param { 'add' | 'remove' | 'change' } type the event of display change + * @param { Callback } callback the display id of changed + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. + *
2.Incorrect parameter types. + * @syscap SystemCapability.WindowManager.WindowManager.Core + * @since 7 + */ + /** + * Register the callback for display changes. + * + * @param { 'add' | 'remove' | 'change' } type the event of display change + * @param { Callback } callback the display id of changed + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. + *
2.Incorrect parameter types. + * @syscap SystemCapability.WindowManager.WindowManager.Core + * @atomicservice + * @since 12 + */ + function on(type: 'add' | 'remove' | 'change', callback: Callback): void; + /** + * Unregister the callback for display changes. + * + * @param { 'add' | 'remove' | 'change' } type the event of display change event + * @param { Callback } callback the display id of changed + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. + *
2.Incorrect parameter types. + * @syscap SystemCapability.WindowManager.WindowManager.Core + * @since 7 + */ + /** + * Unregister the callback for display changes. + * + * @param { 'add' | 'remove' | 'change' } type the event of display change event + * @param { Callback } callback the display id of changed + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. + *
2.Incorrect parameter types. + * @syscap SystemCapability.WindowManager.WindowManager.Core + * @atomicservice + * @since 12 + */ + function off(type: 'add' | 'remove' | 'change', callback?: Callback): void; + /** + * Check whether the device is foldable. + * + * @returns { boolean } true means the device is foldable. + * @throws { BusinessError } 1400003 - This display manager service works abnormally. + * @syscap SystemCapability.Window.SessionManager + * @since 10 + */ + function isFoldable(): boolean; + /** + * Get the current fold status of the foldable device. + * + * @returns { FoldStatus } fold status of device. + * @throws { BusinessError } 1400003 - This display manager service works abnormally. + * @syscap SystemCapability.Window.SessionManager + * @since 10 + */ + function getFoldStatus(): FoldStatus; + /** + * Register the callback for fold status changes. + * + * @param { 'foldStatusChange' } type the event of fold status changes + * @param { Callback } callback Callback used to return the current fold status of device + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + * 2. Incorrect parameter types. + * @throws { BusinessError } 1400003 - This display manager service works abnormally. + * @syscap SystemCapability.Window.SessionManager + * @since 10 + */ + /** + * Register the callback for fold status changes. + * + * @param { 'foldStatusChange' } type the event of fold status changes + * @param { Callback } callback Callback used to return the current fold status of device + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. + * @throws { BusinessError } 1400003 - This display manager service works abnormally. + * @syscap SystemCapability.Window.SessionManager + * @atomicservice + * @since 12 + */ + function on(type: 'foldStatusChange', callback: Callback): void; + /** + * Unregister the callback for fold status changes. + * + * @param { 'foldStatusChange' } type the event of fold status changes + * @param { Callback } callback Callback used to return the current fold status of device + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. + * @throws { BusinessError } 1400003 - This display manager service works abnormally. + * @syscap SystemCapability.Window.SessionManager + * @since 10 + */ + /** + * Unregister the callback for fold status changes. + * + * @param { 'foldStatusChange' } type the event of fold status changes + * @param { Callback } callback Callback used to return the current fold status of device + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. + *
2.Incorrect parameter types. + * @throws { BusinessError } 1400003 - This display manager service works abnormally. + * @syscap SystemCapability.Window.SessionManager + * @atomicservice + * @since 12 + */ + function off(type: 'foldStatusChange', callback?: Callback): void; + /** + * Register the callback for fold angle changes. + * + * @param { 'foldAngleChange' } type the event of fold angle changes. + * @param { Callback> } callback Callback used to return the current fold angle of device. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. + * @throws { BusinessError } 1400003 - This display manager service works abnormally. + * @syscap SystemCapability.Window.SessionManager + * @atomicservice + * @since 12 + */ + function on(type: 'foldAngleChange', callback: Callback>): void; + /** + * Unregister the callback for fold angle changes. + * + * @param { 'foldAngleChange' } type the event of fold angle changes. + * @param { Callback> } callback Callback used to return the current fold angle of device. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. + * @throws { BusinessError } 1400003 - This display manager service works abnormally. + * @syscap SystemCapability.Window.SessionManager + * @atomicservice + * @since 12 + */ + function off(type: 'foldAngleChange', callback?: Callback>): void; + /** + * Register the callback for device capture status changes. + * + * @param { 'captureStatusChange' } type the event of capture status changes. + * @param { Callback } callback Callback used to return the device capture status. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. + * @throws { BusinessError } 1400003 - This display manager service works abnormally. + * @syscap SystemCapability.Window.SessionManager + * @atomicservice + * @since 12 + */ + function on(type: 'captureStatusChange', callback: Callback): void; + /** + * Unregister the callback for device capture status changes. + * + * @param { 'captureStatusChange' } type the event of capture status changes. + * @param { Callback } callback Callback used to return the device capture status. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. + * @throws { BusinessError } 1400003 - This display manager service works abnormally. + * @syscap SystemCapability.Window.SessionManager + * @atomicservice + * @since 12 + */ + function off(type: 'captureStatusChange', callback?: Callback): void; + /** + * Check whether the device is captured. + * + * @returns { boolean } true means the device is captured. + * @throws { BusinessError } 1400003 - This display manager service works abnormally. + * @syscap SystemCapability.Window.SessionManager + * @since 12 + */ + function isCaptured(): boolean; + /** + * Get the display mode of the foldable device. + * + * @returns { FoldDisplayMode } display mode of the foldable device. + * @throws { BusinessError } 1400003 - This display manager service works abnormally. + * @syscap SystemCapability.Window.SessionManager + * @since 10 + */ + function getFoldDisplayMode(): FoldDisplayMode; + /** + * Register the callback for fold display mode changes. + * + * @param { 'foldDisplayModeChange' } type the event of fold display mode changes + * @param { Callback } callback Callback used to return the current fold display mode + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. + * @throws { BusinessError } 1400003 - This display manager service works abnormally. + * @syscap SystemCapability.Window.SessionManager + * @since 10 + */ + /** + * Register the callback for fold display mode changes. + * + * @param { 'foldDisplayModeChange' } type the event of fold display mode changes + * @param { Callback } callback Callback used to return the current fold display mode + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. + *
2.Incorrect parameter types. + * @throws { BusinessError } 1400003 - This display manager service works abnormally. + * @syscap SystemCapability.Window.SessionManager + * @atomicservice + * @since 12 + */ + function on(type: 'foldDisplayModeChange', callback: Callback): void; + /** + * Unregister the callback for fold display mode changes. + * + * @param { 'foldDisplayModeChange' } type the event of fold display mode changes + * @param { Callback } callback Callback used to return the current fold display mode + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. + * @throws { BusinessError } 1400003 - This display manager service works abnormally. + * @syscap SystemCapability.Window.SessionManager + * @since 10 + */ + /** + * Unregister the callback for fold display mode changes. + * + * @param { 'foldDisplayModeChange' } type the event of fold display mode changes + * @param { Callback } callback Callback used to return the current fold display mode + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. + *
2.Incorrect parameter types. + * @throws { BusinessError } 1400003 - This display manager service works abnormally. + * @syscap SystemCapability.Window.SessionManager + * @atomicservice + * @since 12 + */ + function off(type: 'foldDisplayModeChange', callback?: Callback): void; + /** + * Get the fold crease region in the current display mode. + * + * @returns { FoldCreaseRegion } fold crease region in the current display mode. + * @throws { BusinessError } 1400003 - This display manager service works abnormally. + * @syscap SystemCapability.Window.SessionManager + * @since 10 + */ + function getCurrentFoldCreaseRegion(): FoldCreaseRegion; + /** + * Enumerates the fold status. + * + * @enum { number } + * @syscap SystemCapability.Window.SessionManager + * @since 10 + */ + /** + * Enumerates the fold status. + * + * @enum { number } + * @syscap SystemCapability.Window.SessionManager + * @atomicservice + * @since 12 + */ + enum FoldStatus { + /** + * Fold Status Unknown. + * + * @syscap SystemCapability.Window.SessionManager + * @since 10 + */ + /** + * Fold Status Unknown. + * + * @syscap SystemCapability.Window.SessionManager + * @atomicservice + * @since 12 + */ + FOLD_STATUS_UNKNOWN = 0, + /** + * Fold Status Expanded. + * + * @syscap SystemCapability.Window.SessionManager + * @since 10 + */ + /** + * Fold Status Expanded. + * + * @syscap SystemCapability.Window.SessionManager + * @atomicservice + * @since 12 + */ + FOLD_STATUS_EXPANDED, + /** + * Fold Status Folded. + * + * @syscap SystemCapability.Window.SessionManager + * @since 10 + */ + /** + * Fold Status Folded. + * + * @syscap SystemCapability.Window.SessionManager + * @atomicservice + * @since 12 + */ + FOLD_STATUS_FOLDED, + /** + * Fold Status Half Folded. + * + * @syscap SystemCapability.Window.SessionManager + * @since 10 + */ + /** + * Fold Status Half Folded. + * + * @syscap SystemCapability.Window.SessionManager + * @atomicservice + * @since 12 + */ + FOLD_STATUS_HALF_FOLDED + } + /** + * Enumerates the fold display mode. + * + * @enum { number } + * @syscap SystemCapability.Window.SessionManager + * @since 10 + */ + /** + * Enumerates the fold display mode. + * + * @enum { number } + * @syscap SystemCapability.Window.SessionManager + * @atomicservice + * @since 12 + */ + enum FoldDisplayMode { + /** + * Unknown Display. + * + * @syscap SystemCapability.Window.SessionManager + * @since 10 + */ + /** + * Unknown Display. + * + * @syscap SystemCapability.Window.SessionManager + * @atomicservice + * @since 12 + */ + FOLD_DISPLAY_MODE_UNKNOWN = 0, + /** + * Full Display. + * + * @syscap SystemCapability.Window.SessionManager + * @since 10 + */ + /** + * Full Display. + * + * @syscap SystemCapability.Window.SessionManager + * @atomicservice + * @since 12 + */ + FOLD_DISPLAY_MODE_FULL, + /** + * Main Display. + * + * @syscap SystemCapability.Window.SessionManager + * @since 10 + */ + /** + * Main Display. + * + * @syscap SystemCapability.Window.SessionManager + * @atomicservice + * @since 12 + */ + FOLD_DISPLAY_MODE_MAIN, + /** + * Sub Display. + * + * @syscap SystemCapability.Window.SessionManager + * @since 10 + */ + /** + * Sub Display. + * + * @syscap SystemCapability.Window.SessionManager + * @atomicservice + * @since 12 + */ + FOLD_DISPLAY_MODE_SUB, + /** + * Coordination Display. + * + * @syscap SystemCapability.Window.SessionManager + * @since 10 + */ + /** + * Coordination Display. + * + * @syscap SystemCapability.Window.SessionManager + * @atomicservice + * @since 12 + */ + FOLD_DISPLAY_MODE_COORDINATION + } + /** + * Enumerates the display states. + * + * @enum { number } + * @syscap SystemCapability.WindowManager.WindowManager.Core + * @since 7 + */ + enum DisplayState { + /** + * Unknown. + * + * @syscap SystemCapability.WindowManager.WindowManager.Core + * @since 7 + */ + STATE_UNKNOWN = 0, + /** + * Screen off. + * + * @syscap SystemCapability.WindowManager.WindowManager.Core + * @since 7 + */ + STATE_OFF, + /** + * Screen on. + * + * @syscap SystemCapability.WindowManager.WindowManager.Core + * @since 7 + */ + STATE_ON, + /** + * Doze, but it will update for some important system messages. + * + * @syscap SystemCapability.WindowManager.WindowManager.Core + * @since 7 + */ + STATE_DOZE, + /** + * Doze and not update. + * + * @syscap SystemCapability.WindowManager.WindowManager.Core + * @since 7 + */ + STATE_DOZE_SUSPEND, + /** + * VR node. + * + * @syscap SystemCapability.WindowManager.WindowManager.Core + * @since 7 + */ + STATE_VR, + /** + * Screen on and not update. + * + * @syscap SystemCapability.WindowManager.WindowManager.Core + * @since 7 + */ + STATE_ON_SUSPEND + } + /** + * Enumerates the display orientation. + * + * @enum { number } + * @syscap SystemCapability.WindowManager.WindowManager.Core + * @crossplatform + * @since 10 + */ + enum Orientation { + /** + * Indicate that the display content is in portrait mode. + * + * @syscap SystemCapability.WindowManager.WindowManager.Core + * @crossplatform + * @since 10 + */ + PORTRAIT = 0, + /** + * Indicate that the display content is in landscape mode. + * + * @syscap SystemCapability.WindowManager.WindowManager.Core + * @crossplatform + * @since 10 + */ + LANDSCAPE = 1, + /** + * Indicate that the display content is in the opposite direction of the portrait mode. + * + * @syscap SystemCapability.WindowManager.WindowManager.Core + * @crossplatform + * @since 10 + */ + PORTRAIT_INVERTED = 2, + /** + * Indicate that the display content is in the opposite direction of the landscape mode. + * + * @syscap SystemCapability.WindowManager.WindowManager.Core + * @crossplatform + * @since 10 + */ + LANDSCAPE_INVERTED = 3 + } + /** + * Fold Crease Region + * + * @interface FoldCreaseRegion + * @syscap SystemCapability.Window.SessionManager + * @since 10 + */ + interface FoldCreaseRegion { + /** + * The display ID is used to identify the screen where the crease is located. + * + * @readonly + * @syscap SystemCapability.Window.SessionManager + * @since 10 + */ + readonly displayId: number; + /** + * Crease Region. + * + * @readonly + * @syscap SystemCapability.Window.SessionManager + * @since 10 + */ + readonly creaseRects: Array; + } + /** + * Rectangle + * + * @interface Rect + * @syscap SystemCapability.WindowManager.WindowManager.Core + * @since 9 + */ + interface Rect { + /** + * The X-axis coordinate of the upper left vertex of the rectangle, in pixels. + * + * @syscap SystemCapability.WindowManager.WindowManager.Core + * @since 9 + */ + left: number; + /** + * The Y-axis coordinate of the upper left vertex of the rectangle, in pixels. + * + * @syscap SystemCapability.WindowManager.WindowManager.Core + * @since 9 + */ + top: number; + /** + * Width of the rectangle, in pixels. + * + * @syscap SystemCapability.WindowManager.WindowManager.Core + * @since 9 + */ + width: number; + /** + * Height of the rectangle, in pixels. + * + * @syscap SystemCapability.WindowManager.WindowManager.Core + * @since 9 + */ + height: number; + } + /** + * Curved area rects of the waterfall display. + * + * @interface WaterfallDisplayAreaRects + * @syscap SystemCapability.WindowManager.WindowManager.Core + * @since 9 + */ + interface WaterfallDisplayAreaRects { + /** + * Indicates the size of left side curved area of the waterfall screen. + * + * @syscap SystemCapability.WindowManager.WindowManager.Core + * @since 9 + */ + readonly left: Rect; + /** + * Indicates the size of right side curved area of the waterfall screen. + * + * @syscap SystemCapability.WindowManager.WindowManager.Core + * @since 9 + */ + readonly right: Rect; + /** + * Indicates the size of top side curved area of the waterfall screen. + * + * @syscap SystemCapability.WindowManager.WindowManager.Core + * @since 9 + */ + readonly top: Rect; + /** + * Indicates the size of bottom side curved area of the waterfall screen. + * + * @syscap SystemCapability.WindowManager.WindowManager.Core + * @since 9 + */ + readonly bottom: Rect; + } + /** + * Cutout information of the display. + * + * @interface CutoutInfo + * @syscap SystemCapability.WindowManager.WindowManager.Core + * @since 9 + */ + interface CutoutInfo { + /** + * Bounding rectangles of the cutout areas of the display. + * + * @syscap SystemCapability.WindowManager.WindowManager.Core + * @since 9 + */ + readonly boundingRects: Array; + /** + * Rectangles of curved parts on each side of a waterfall display. + * + * @syscap SystemCapability.WindowManager.WindowManager.Core + * @since 9 + */ + readonly waterfallDisplayAreaRects: WaterfallDisplayAreaRects; + } + /** + * Define properties of the display. They cannot be updated automatically. + * + * @interface Display + * @syscap SystemCapability.WindowManager.WindowManager.Core + * @since 7 + */ + /** + * Define properties of the display. They cannot be updated automatically. + * + * @interface Display + * @syscap SystemCapability.WindowManager.WindowManager.Core + * @crossplatform + * @since 10 + */ + /** + * Define properties of the display. They cannot be updated automatically. + * + * @interface Display + * @syscap SystemCapability.WindowManager.WindowManager.Core + * @crossplatform + * @atomicservice + * @since 11 + */ + interface Display { + /** + * Display ID. + * + * @syscap SystemCapability.WindowManager.WindowManager.Core + * @since 7 + */ + /** + * Display ID. + * + * @syscap SystemCapability.WindowManager.WindowManager.Core + * @crossplatform + * @since 10 + */ + id: number; + /** + * Display name. + * + * @syscap SystemCapability.WindowManager.WindowManager.Core + * @since 7 + */ + name: string; + /** + * The display is alive. + * + * @syscap SystemCapability.WindowManager.WindowManager.Core + * @since 7 + */ + alive: boolean; + /** + * The state of display. + * + * @syscap SystemCapability.WindowManager.WindowManager.Core + * @since 7 + */ + state: DisplayState; + /** + * Refresh rate, in Hz. + * + * @syscap SystemCapability.WindowManager.WindowManager.Core + * @since 7 + */ + refreshRate: number; + /** + * Rotation degrees of the display. + * + * @syscap SystemCapability.WindowManager.WindowManager.Core + * @since 7 + */ + /** + * Rotation degrees of the display. + * + * @syscap SystemCapability.WindowManager.WindowManager.Core + * @atomicservice + * @since 11 + */ + rotation: number; + /** + * Display width, in pixels. + * + * @syscap SystemCapability.WindowManager.WindowManager.Core + * @since 7 + */ + /** + * Display width, in pixels. + * + * @syscap SystemCapability.WindowManager.WindowManager.Core + * @crossplatform + * @since 10 + */ + /** + * Display width, in pixels. + * + * @syscap SystemCapability.WindowManager.WindowManager.Core + * @crossplatform + * @atomicservice + * @since 11 + */ + width: number; + /** + * Display height, in pixels. + * + * @syscap SystemCapability.WindowManager.WindowManager.Core + * @since 7 + */ + /** + * Display height, in pixels. + * + * @syscap SystemCapability.WindowManager.WindowManager.Core + * @crossplatform + * @since 10 + */ + /** + * Display height, in pixels. + * + * @syscap SystemCapability.WindowManager.WindowManager.Core + * @crossplatform + * @atomicservice + * @since 11 + */ + height: number; + /** + * Display resolution. + * + * @syscap SystemCapability.WindowManager.WindowManager.Core + * @since 7 + */ + /** + * Display resolution. + * + * @syscap SystemCapability.WindowManager.WindowManager.Core + * @crossplatform + * @since 11 + */ + densityDPI: number; + /** + * Display orientation. + * + * @syscap SystemCapability.WindowManager.WindowManager.Core + * @crossplatform + * @since 10 + */ + orientation: Orientation; + /** + * Display density, in pixels. The value for a low-resolution display is 1.0. + * + * @syscap SystemCapability.WindowManager.WindowManager.Core + * @since 7 + */ + /** + * Display density, in pixels. The value for a low-resolution display is 1.0. + * + * @syscap SystemCapability.WindowManager.WindowManager.Core + * @crossplatform + * @atomicservice + * @since 11 + */ + densityPixels: number; + /** + * Text scale density of the display. + * + * @syscap SystemCapability.WindowManager.WindowManager.Core + * @since 7 + */ + /** + * Text scale density of the display. + * + * @syscap SystemCapability.WindowManager.WindowManager.Core + * @crossplatform + * @since 11 + */ + scaledDensity: number; + /** + * DPI on the x-axis. + * + * @syscap SystemCapability.WindowManager.WindowManager.Core + * @since 7 + */ + xDPI: number; + /** + * DPI on the y-axis. + * + * @syscap SystemCapability.WindowManager.WindowManager.Core + * @since 7 + */ + yDPI: number; + /** + * All supported color spaces. + * + * @type { Array } + * @syscap SystemCapability.WindowManager.WindowManager.Core + * @since 11 + */ + colorSpaces: Array; + /** + * All supported HDR formats. + * + * @type { Array } + * @syscap SystemCapability.WindowManager.WindowManager.Core + * @since 11 + */ + hdrFormats: Array; + /** + * Obtain the cutout info of the display. + * + * @param { AsyncCallback } callback + * @throws { BusinessError } 1400001 - Invalid display or screen. + * @syscap SystemCapability.WindowManager.WindowManager.Core + * @since 9 + */ + getCutoutInfo(callback: AsyncCallback): void; + /** + * Obtain the cutout info of the display. + * + * @returns { Promise } + * @throws { BusinessError } 1400001 - Invalid display or screen. + * @syscap SystemCapability.WindowManager.WindowManager.Core + * @since 9 + */ + getCutoutInfo(): Promise; + } +} +export default display; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.distributedDeviceManager.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.distributedDeviceManager.d.ts new file mode 100755 index 00000000..6169d926 --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.distributedDeviceManager.d.ts @@ -0,0 +1,528 @@ +/* + * Copyright (c) 2023-2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit DistributedServiceKit + */ +import type { AsyncCallback, Callback } from './@ohos.base'; +/** + * Providers interfaces to create a {@link deviceManager} instances. + * + * @namespace distributedDeviceManager + * @syscap SystemCapability.DistributedHardware.DeviceManager + * @since 10 + */ +declare namespace distributedDeviceManager { + /** + * Basic description information of a distributed device. + * @interface DeviceBasicInfo + * @syscap SystemCapability.DistributedHardware.DeviceManager + * @since 10 + */ + interface DeviceBasicInfo { + /** + * Device unique identifier, The actual value is the udid-hash confused with the appid based on sha256. + * @syscap SystemCapability.DistributedHardware.DeviceManager + * @since 10 + */ + deviceId: string; + /** + * Device name. + * @syscap SystemCapability.DistributedHardware.DeviceManager + * @since 10 + */ + deviceName: string; + /** + * Obtains the device type represented by a string, + * which can be {@code phone}, {@code tablet}, {@code tv}, {@code smartVision}, {@code car}. + * @type { string } + * @syscap SystemCapability.DistributedHardware.DeviceManager + * @since 10 + */ + deviceType: string; + /** + * Device network id. + * @syscap SystemCapability.DistributedHardware.DeviceManager + * @since 10 + */ + networkId?: string; + } + /** + * The state of the nearby devices. + * @enum { number } + * @syscap SystemCapability.DistributedHardware.DeviceManager + * @since 10 + */ + enum DeviceStateChange { + /** + * This state indicates the device is online but the state is unknown,The distributed function cannot used until + * state changes to AVAILABLE. + * @syscap SystemCapability.DistributedHardware.DeviceManager + * @since 10 + */ + UNKNOWN = 0, + /** + * This state indicates the device has been synchronized to the database, Now the distributed function can be used. + * @syscap SystemCapability.DistributedHardware.DeviceManager + * @since 10 + */ + AVAILABLE = 1, + /** + * This state indicates the device is offline. + * @syscap SystemCapability.DistributedHardware.DeviceManager + * @since 10 + */ + UNAVAILABLE = 2 + } + /** + * Creates an {@code DeviceManager} instance. + * + * To manage devices, you must first call this method to obtain a {@code DeviceManager} instance and then + * use this instance to call other device management methods. + * + * @param { string } bundleName - Indicates the bundle name of the application. + * @returns { DeviceManager } - Return the DeviceManager object. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter type; + * 3. Parameter verification failed. + * @syscap SystemCapability.DistributedHardware.DeviceManager + * @since 10 + */ + function createDeviceManager(bundleName: string): DeviceManager; + /** + * Releases the {@code DeviceManager} instance that is no longer used. + * + * @permission ohos.permission.DISTRIBUTED_DATASYNC + * @param { DeviceManager } deviceManager - Indicates the {@code DeviceManager} instance. + * @throws { BusinessError } 201 - User permission verify failed. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; + * 3. Parameter verification failed. + * @throws { BusinessError } 11600101 - Failed to execute the function. + * @syscap SystemCapability.DistributedHardware.DeviceManager + * @since 10 + */ + function releaseDeviceManager(deviceManager: DeviceManager): void; + /** + * Provides methods for managing devices. + * + * @interface DeviceManager + * @syscap SystemCapability.DistributedHardware.DeviceManager + * @since 10 + */ + interface DeviceManager { + /** + * Get a list of available devices. This interface query all authorized and connectable devices. + * + * @permission ohos.permission.DISTRIBUTED_DATASYNC + * @returns { Array } - Returns a list of available devices. + * @throws { BusinessError } 201 - User permission verify failed. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; + * 3. Parameter verification failed. + * @throws { BusinessError } 11600101 - Failed to execute the function. + * @syscap SystemCapability.DistributedHardware.DeviceManager + * @since 10 + */ + getAvailableDeviceListSync(): Array; + /** + * Get a list of available devices. This interface query all authorized and connectable devices. + * + * @permission ohos.permission.DISTRIBUTED_DATASYNC + * @param { AsyncCallback> } callback - Indicates the callback to be + * invoked upon getAvailableDeviceList. + * @throws { BusinessError } 201 - User permission verify failed. + * @throws { BusinessError } 11600101 - Failed to execute the function. + * @syscap SystemCapability.DistributedHardware.DeviceManager + * @since 10 + */ + getAvailableDeviceList(callback: AsyncCallback>): void; + /** + * Get a list of available devices. This interface query all authorized and connectable devices. + * + * @permission ohos.permission.DISTRIBUTED_DATASYNC + * @returns { Promise> } - Returns a list of available devices. + * @throws { BusinessError } 201 - User permission verify failed. + * @throws { BusinessError } 11600101 - Failed to execute the function. + * @syscap SystemCapability.DistributedHardware.DeviceManager + * @since 10 + */ + getAvailableDeviceList(): Promise>; + /** + * Get the network id of the local device. + * + * @permission ohos.permission.DISTRIBUTED_DATASYNC + * @returns { string } - Returns local device network id. + * @throws { BusinessError } 201 - User permission verify failed. + * @throws { BusinessError } 11600101 - Failed to execute the function. + * @syscap SystemCapability.DistributedHardware.DeviceManager + * @since 10 + */ + getLocalDeviceNetworkId(): string; + /** + * Get the device name of the local device. + * + * @permission ohos.permission.DISTRIBUTED_DATASYNC + * @returns { string } - Returns local device name. + * @throws { BusinessError } 201 - User permission verify failed. + * @throws { BusinessError } 11600101 - Failed to execute the function. + * @syscap SystemCapability.DistributedHardware.DeviceManager + * @since 10 + */ + getLocalDeviceName(): string; + /** + * Get the device type of the local device. + * + * @permission ohos.permission.DISTRIBUTED_DATASYNC + * @returns { number } - Returns local device type. + * @throws { BusinessError } 201 - User permission verify failed. + * @throws { BusinessError } 11600101 - Failed to execute the function. + * @syscap SystemCapability.DistributedHardware.DeviceManager + * @since 10 + */ + getLocalDeviceType(): number; + /** + * Get the device id of the local device. + * + * @permission ohos.permission.DISTRIBUTED_DATASYNC + * @returns { string } - Returns local device type. + * @throws { BusinessError } 201 - User permission verify failed. + * @throws { BusinessError } 11600101 - Failed to execute the function. + * @syscap SystemCapability.DistributedHardware.DeviceManager + * @since 10 + */ + getLocalDeviceId(): string; + /** + * Get the device name by network id. + * + * @permission ohos.permission.DISTRIBUTED_DATASYNC + * @param { string } networkId - Device network id. + * @returns { string } - Returns device name. + * @throws { BusinessError } 201 - User permission verify failed. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter type; + * 3. Parameter verification failed; + * 4. The size of specified networkId is greater than 255. + * @throws { BusinessError } 11600101 - Failed to execute the function. + * @syscap SystemCapability.DistributedHardware.DeviceManager + * @since 10 + */ + getDeviceName(networkId: string): string; + /** + * Get the device type by network id. + * + * @permission ohos.permission.DISTRIBUTED_DATASYNC + * @param { string } networkId - Device network id. + * @returns { number } - Returns device type. + * @throws { BusinessError } 201 - User permission verify failed. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter type; + * 3. Parameter verification failed; + * 4. The size of specified networkId is greater than 255. + * @throws { BusinessError } 11600101 - Failed to execute the function. + * @syscap SystemCapability.DistributedHardware.DeviceManager + * @since 10 + */ + getDeviceType(networkId: string): number; + /** + * Start to discover nearby devices. + * + * @permission ohos.permission.DISTRIBUTED_DATASYNC + * @param { object } discoverParam - Identifies the type of target discovered: + * discoverTargetType : 1 - Discovery target as a device by default, the value is 1. + * @param { object } filterOptions - FilterOptions to filter discovery device. + * The type of filterOptions is map. The map are as follows: + * availableStatus: 0-1 - Discover devices only are credible, The value is 0 indicates device isn't credible; + * 0: Devices are offline, client need to bind the device by calling bindTarget() and then connect to it. + * 1: Devices already online, client can make connection. + * discoverDistance: 0-100 - Discover devices within a certain distance from the local, the unit is cm. + * authenticationStatus: 0-1 - Discover devices based on different authentication status: + * 0: Devices not authenticated. + 1: Devices already authenticated. + * The value is 1 indicates device is trust. + * authorizationType: 0-2 - Discover devices based on different authorization type: + * 0: Devices authenticated based on temporary negotiated session key. + * 1: Devices authenticated based on the same account credential key. + * 2: Devices authenticated based on different account credential keys. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter type; + * 3. Parameter verification failed. + * @throws { BusinessError } 201 - Permission verify failed. + * @throws { BusinessError } 11600104 - Discovery repeats. + * @throws { BusinessError } 11600101 - Failed to execute the function. + * @syscap SystemCapability.DistributedHardware.DeviceManager + * @since 10 + */ + startDiscovering(discoverParam: { + [key: string]: Object; + }, filterOptions?: { + [key: string]: Object; + }): void; + /** + * Stop discovering nearby devices. + * + * @permission ohos.permission.DISTRIBUTED_DATASYNC + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter type; + * 3. Parameter verification failed. + * @throws { BusinessError } 201 - Permission verify failed. + * @throws { BusinessError } 11600104 - Stop discovery repeats. + * @throws { BusinessError } 11600101 - Failed to execute the function. + * @syscap SystemCapability.DistributedHardware.DeviceManager + * @since 10 + */ + stopDiscovering(): void; + /** + * Bind the specified target. + * + * @permission ohos.permission.DISTRIBUTED_DATASYNC + * @param { string } deviceId - id of device to bind. + * @param { object } bindParam - parameters of device to bind, The parameter type is map,such as: + * "bindType" : 1-4, - This value is type of bind, the values are as follows: + * 1 - The bind type is pin code . + * 2 - The bind type is QR code. + * 3 - The bind type is nfc. + * 4 - The bind type is no_interaction. + + * "targetPkgName" : "xxxx", - The package name of binding target. + * "appName" : "xxxx", - The app name that try to bind the target. + * "appOperation" : "xxxx" - The reason why the app want to bind the target package. + * "customDescription" : "xxxx" - The detail description of the operation. + * @param { AsyncCallback<{deviceId: string}> } callback - indicates the callback to be invoked upon bindDevice. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter type; + * 3. Parameter verification failed; + * 4. The size of specified deviceId is greater than 255. + * @throws { BusinessError } 201 - Permission verify failed. + * @throws { BusinessError } 11600101 - Failed to execute the function. + * @throws { BusinessError } 11600103 - Bind invalid. + * @syscap SystemCapability.DistributedHardware.DeviceManager + * @since 10 + */ + bindTarget(deviceId: string, bindParam: { + [key: string]: Object; + }, callback: AsyncCallback<{ + deviceId: string; + }>): void; + /** + * Unbind the specified target. + * + * @permission ohos.permission.DISTRIBUTED_DATASYNC + * @param { string } deviceId - id of device to unbind + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter type; + * 3. Parameter verification failed; + * 4. The size of specified deviceId is greater than 255. + * @throws { BusinessError } 201 - Permission verify failed. + * @throws { BusinessError } 11600101 - Failed to execute the function. + * @syscap SystemCapability.DistributedHardware.DeviceManager + * @since 10 + */ + unbindTarget(deviceId: string): void; + /** + * Register a device state callback so that the application can be notified upon device state changes based on + * the application bundle name. + * + * @permission ohos.permission.DISTRIBUTED_DATASYNC + * @param { 'deviceStateChange' } type - Device state change. + * @param { Callback<{ action: DeviceStateChange, device: DeviceBasicInfo }> } callback + * Indicates the device state callback to register. + * @throws { BusinessError } 201 - Permission verify failed. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter type; + * 3. Parameter verification failed; + * 4. The size of specified type is greater than 255. + * @syscap SystemCapability.DistributedHardware.DeviceManager + * @since 10 + */ + on(type: 'deviceStateChange', callback: Callback<{ + action: DeviceStateChange; + device: DeviceBasicInfo; + }>): void; + /** + * UnRegister device state callback based on the application bundle name. + * + * @permission ohos.permission.DISTRIBUTED_DATASYNC + * @param { 'deviceStateChange' } type - Device state change. + * @param { Callback<{ action: DeviceStateChange, device: DeviceBasicInfo }> } callback + * Indicates the device state callback to unregister. + * @throws { BusinessError } 201 - Permission verify failed. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter type; + * 3. Parameter verification failed; + * 4. The size of specified type is greater than 255. + * @syscap SystemCapability.DistributedHardware.DeviceManager + * @since 10 + */ + off(type: 'deviceStateChange', callback?: Callback<{ + action: DeviceStateChange; + device: DeviceBasicInfo; + }>): void; + /** + * Register a device discovery result callback so that the application can be notified when discovery success. + * + * @permission ohos.permission.DISTRIBUTED_DATASYNC + * @param { 'discoverSuccess' } type - Successfully discovered device. + * @param { Callback<{ device: DeviceBasicInfo }> } callback - Indicates the device discovery callback to register. + * @throws { BusinessError } 201 - Permission verify failed. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter type; + * 3. Parameter verification failed; + * 4. The size of specified type is greater than 255. + * @syscap SystemCapability.DistributedHardware.DeviceManager + * @since 10 + */ + on(type: 'discoverSuccess', callback: Callback<{ + device: DeviceBasicInfo; + }>): void; + /** + * UnRegister the device discovery result callback. + * + * @permission ohos.permission.DISTRIBUTED_DATASYNC + * @param { 'discoverSuccess' } type - Successfully discovered device. + * @param { Callback<{ device: DeviceBasicInfo }> } callback - Indicates the device discovery callback to unregister. + * @throws { BusinessError } 201 - Permission verify failed. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter type; + * 3. Parameter verification failed; + * 4. The size of specified type is greater than 255. + * @syscap SystemCapability.DistributedHardware.DeviceManager + * @since 10 + */ + off(type: 'discoverSuccess', callback?: Callback<{ + device: DeviceBasicInfo; + }>): void; + /** + * Register a device name change callback so that the application can be notified when discovery success. + * + * @permission ohos.permission.DISTRIBUTED_DATASYNC + * @param { 'deviceNameChange' } type - Changed device name. + * @param { Callback<{ deviceName: string }> } callback - Indicates the device name change callback to register. + * @throws { BusinessError } 201 - Permission verify failed. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter type; + * 3. Parameter verification failed; + * 4. The size of specified type is greater than 255. + * @syscap SystemCapability.DistributedHardware.DeviceManager + * @since 10 + */ + on(type: 'deviceNameChange', callback: Callback<{ + deviceName: string; + }>): void; + /** + * UnRegister the device name change result callback. + * + * @permission ohos.permission.DISTRIBUTED_DATASYNC + * @param { 'deviceNameChange' } type - Changed device name. + * @param { Callback<{ deviceName: string }> } callback - Indicates the device name change callback to unregister. + * @throws { BusinessError } 201 - Permission verify failed. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter type; + * 3. Parameter verification failed; + * 4. The size of specified type is greater than 255. + * @syscap SystemCapability.DistributedHardware.DeviceManager + * @since 10 + */ + off(type: 'deviceNameChange', callback?: Callback<{ + deviceName: string; + }>): void; + /** + * Register a device discovery result callback so that the application can be notified when discover failed. + * + * @permission ohos.permission.DISTRIBUTED_DATASYNC + * @param { 'discoverFailure' } type - Discovery Device Failure. + * @param { Callback<{ reason: number }> } callback + * Indicates the device found result callback to register. + * @throws { BusinessError } 201 - Permission verify failed. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter type; + * 3. Parameter verification failed; + * 4. The size of specified type is greater than 255. + * @syscap SystemCapability.DistributedHardware.DeviceManager + * @since 10 + */ + on(type: 'discoverFailure', callback: Callback<{ + reason: number; + }>): void; + /** + * UnRegister the device discovery result callback. + * + * @permission ohos.permission.DISTRIBUTED_DATASYNC + * @param { 'discoverFailure' } type - Discovery Device Failure. + * @param { Callback<{ reason: number }> } callback + * Indicates the device found result callback to unregister. + * @throws { BusinessError } 201 - Permission verify failed. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter type; + * 3. Parameter verification failed; + * 4. The size of specified type is greater than 255. + * @syscap SystemCapability.DistributedHardware.DeviceManager + * @since 10 + */ + off(type: 'discoverFailure', callback?: Callback<{ + reason: number; + }>): void; + /** + * Register a serviceError callback so that the application can be notified when devicemanager service died + * + * @permission ohos.permission.DISTRIBUTED_DATASYNC + * @param { 'serviceDie' } type - Service death. + * @param { Callback<{}> } callback - Indicates the service error callback to register. + * @throws { BusinessError } 201 - Permission verify failed. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter type; + * 3. Parameter verification failed; + * 4. The size of specified type is greater than 255. + * @syscap SystemCapability.DistributedHardware.DeviceManager + * @since 10 + */ + on(type: 'serviceDie', callback?: Callback<{}>): void; + /** + * UnRegister the service error callback. + * + * @permission ohos.permission.DISTRIBUTED_DATASYNC + * @param { 'serviceDie' } type - Service death. + * @param { Callback<{}> } callback - Indicates the service error callback to unregister. + * @throws { BusinessError } 201 - Permission verify failed. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter type; + * 3. Parameter verification failed; + * 4. The size of specified type is greater than 255. + * @syscap SystemCapability.DistributedHardware.DeviceManager + * @since 10 + */ + off(type: 'serviceDie', callback?: Callback<{}>): void; + } +} +export default distributedDeviceManager; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.distributedHardware.deviceManager.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.distributedHardware.deviceManager.d.ts new file mode 100755 index 00000000..0b0878d7 --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.distributedHardware.deviceManager.d.ts @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2020-2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit DistributedServiceKit + */ + +/** + * Providers interfaces to create a {@link deviceManager} instances. + * + * @namespace deviceManager + * @syscap SystemCapability.DistributedHardware.DeviceManager + * @since 7 + * @deprecated since 11 + * @useinstead ohos.distributedDeviceManager/distributedDeviceManager + */ +declare namespace deviceManager { + /** + * Provides methods for managing devices. + * + * @interface DeviceManager + * @syscap SystemCapability.DistributedHardware.DeviceManager + * @since 7 + * @deprecated since 11 + * @useinstead ohos.distributedDeviceManager/distributedDeviceManager.DeviceManager + */ + interface DeviceManager { + } +} +export default deviceManager; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.dlpPermission.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.dlpPermission.d.ts new file mode 100755 index 00000000..4e70cc9c --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.dlpPermission.d.ts @@ -0,0 +1,585 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit DataLossPreventionKit + */ +import type { AsyncCallback, Callback } from './@ohos.base'; +import type common from './@ohos.app.ability.common'; +import type Want from './@ohos.app.ability.Want'; +/** + * Provides the capability to access the data loss prevention (DLP) files. + * + * @namespace dlpPermission + * @syscap SystemCapability.Security.DataLossPrevention + * @since 10 + */ +declare namespace dlpPermission { + /** + * Enumerates the types of actions that can be performed on a DLP file. + * + * @enum { number } + * @syscap SystemCapability.Security.DataLossPrevention + * @since 10 + */ + export enum ActionFlagType { + /** + * View a DLP file. + * + * @syscap SystemCapability.Security.DataLossPrevention + * @since 10 + */ + ACTION_VIEW = 0x00000001, + /** + * Save a DLP file. + * + * @syscap SystemCapability.Security.DataLossPrevention + * @since 10 + */ + ACTION_SAVE = 0x00000002, + /** + * Save a DLP file as another file. + * + * @syscap SystemCapability.Security.DataLossPrevention + * @since 10 + */ + ACTION_SAVE_AS = 0x00000004, + /** + * Edit a DLP file. + * + * @syscap SystemCapability.Security.DataLossPrevention + * @since 10 + */ + ACTION_EDIT = 0x00000008, + /** + * Take a screenshot of a DLP file. + * + * @syscap SystemCapability.Security.DataLossPrevention + * @since 10 + */ + ACTION_SCREEN_CAPTURE = 0x00000010, + /** + * Share the screen, on which a DLP file is opened. + * + * @syscap SystemCapability.Security.DataLossPrevention + * @since 10 + */ + ACTION_SCREEN_SHARE = 0x00000020, + /** + * Record the screen, on which a DLP file is opened. + * + * @syscap SystemCapability.Security.DataLossPrevention + * @since 10 + */ + ACTION_SCREEN_RECORD = 0x00000040, + /** + * Copy in the editor, on which a DLP file is opened. + * + * @syscap SystemCapability.Security.DataLossPrevention + * @since 10 + */ + ACTION_COPY = 0x00000080, + /** + * Print a DLP file. + * + * @syscap SystemCapability.Security.DataLossPrevention + * @since 10 + */ + ACTION_PRINT = 0x00000100, + /** + * Export a DLP file. + * + * @syscap SystemCapability.Security.DataLossPrevention + * @since 10 + */ + ACTION_EXPORT = 0x00000200, + /** + * Change the permissions for a DLP file. + * + * @syscap SystemCapability.Security.DataLossPrevention + * @since 10 + */ + ACTION_PERMISSION_CHANGE = 0x00000400 + } + /** + * Enumerates the access permissions for a DLP file. + * + * @enum { number } + * @syscap SystemCapability.Security.DataLossPrevention + * @since 10 + */ + export enum DLPFileAccess { + /** + * No permission. + * + * @syscap SystemCapability.Security.DataLossPrevention + * @since 10 + */ + NO_PERMISSION = 0, + /** + * Read-only. + * + * @syscap SystemCapability.Security.DataLossPrevention + * @since 10 + */ + READ_ONLY = 1, + /** + * Edit. + * + * @syscap SystemCapability.Security.DataLossPrevention + * @since 10 + */ + CONTENT_EDIT = 2, + /** + * Full control. + * + * @syscap SystemCapability.Security.DataLossPrevention + * @since 10 + */ + FULL_CONTROL = 3 + } + /** + * Represents the permission info of a DLP file. + * + * @interface DLPPermissionInfo + * @syscap SystemCapability.Security.DataLossPrevention + * @since 10 + */ + export interface DLPPermissionInfo { + /** + * Access permission for the DLP file. + * + * @type { DLPFileAccess } + * @syscap SystemCapability.Security.DataLossPrevention + * @since 10 + */ + dlpFileAccess: DLPFileAccess; + /** + * Actions allowed for the DLP file. The value is a combination of flags in {@link ActionFlagType}. + * + * @type { number } + * @syscap SystemCapability.Security.DataLossPrevention + * @since 10 + */ + flags: number; + } + /** + * Represents the accessed DLP file info. + * + * @interface AccessedDLPFileInfo + * @syscap SystemCapability.Security.DataLossPrevention + * @since 10 + */ + export interface AccessedDLPFileInfo { + /** + * URI of the DLP file. + * + * @type { string } + * @syscap SystemCapability.Security.DataLossPrevention + * @since 10 + */ + uri: string; + /** + * Time when the DLP file was last opened. + * + * @type { number } + * @syscap SystemCapability.Security.DataLossPrevention + * @since 10 + */ + lastOpenTime: number; + } + /** + * Represents the retention sandbox info. + * + * @interface RetentionSandboxInfo + * @syscap SystemCapability.Security.DataLossPrevention + * @since 10 + */ + export interface RetentionSandboxInfo { + /** + * Application index of the DLP sandbox. + * + * @type { number } + * @syscap SystemCapability.Security.DataLossPrevention + * @since 10 + */ + appIndex: number; + /** + * Bundle name of the application. + * + * @type { string } + * @syscap SystemCapability.Security.DataLossPrevention + * @since 10 + */ + bundleName: string; + /** + * List of file URIs. + * + * @type { Array } + * @syscap SystemCapability.Security.DataLossPrevention + * @since 10 + */ + docUris: Array; + } + /** + * Checks whether a file is a DLP file. This method uses a promise to return the result. + * + * @param { number } fd - Indicates the file descriptor of the file to check. + * @returns { Promise } Returns {@code true} if {@link fd} is a DLP file; returns {@code false} otherwise. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + * 2. Incorrect parameter types; + * @throws { BusinessError } 19100001 - Invalid parameter value. + * @throws { BusinessError } 19100011 - System service exception. + * @syscap SystemCapability.Security.DataLossPrevention + * @since 10 + */ + function isDLPFile(fd: number): Promise; + /** + * Checks whether a file is a DLP file. This method uses an asynchronous callback to return the result. + * + * @param { number } fd - Indicates the file descriptor of the file to check. + * @param { AsyncCallback } callback - Indicates the callback of isDLPFile. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + * 2. Incorrect parameter types; + * @throws { BusinessError } 19100001 - Invalid parameter value. + * @throws { BusinessError } 19100011 - System service exception. + * @syscap SystemCapability.Security.DataLossPrevention + * @since 10 + */ + function isDLPFile(fd: number, callback: AsyncCallback): void; + /** + * Obtains the permission info of this DLP file. This method uses a promise to return the result. + * + * @returns { Promise } Returns the {@link DLPPermissionInfo}. + * @throws { BusinessError } 19100001 - Invalid parameter value. + * @throws { BusinessError } 19100006 - This API can only be called by DLP sandbox applications. + * @throws { BusinessError } 19100011 - System service exception. + * @syscap SystemCapability.Security.DataLossPrevention + * @since 10 + */ + function getDLPPermissionInfo(): Promise; + /** + * Obtains the permission info of this DLP file. This method uses an asynchronous callback to return the result. + * + * @param { AsyncCallback } callback - Indicates the callback of getDLPPermissionInfo. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Incorrect parameter types; + * @throws { BusinessError } 19100001 - Invalid parameter value. + * @throws { BusinessError } 19100006 - This API can only be called by DLP sandbox applications. + * @throws { BusinessError } 19100011 - System service exception. + * @syscap SystemCapability.Security.DataLossPrevention + * @since 10 + */ + function getDLPPermissionInfo(callback: AsyncCallback): void; + /** + * Obtains the original file name from a DLP file name. This method removes the DLP file name extension from the DLP file name. + * + * @param { string } fileName - Indicates the DLP file name. + * @returns { string } Returns the original file name obtained. + * @throws { BusinessError } 19100001 - Invalid parameter value. + * @throws { BusinessError } 19100011 - System service exception. + * @syscap SystemCapability.Security.DataLossPrevention + * @since 10 + */ + function getOriginalFileName(fileName: string): string; + /** + * Obtains the DLP file name extension. + * + * @returns { string } Returns the DLP file name extension obtained. + * @throws { BusinessError } 19100011 - System service exception. + * @syscap SystemCapability.Security.DataLossPrevention + * @since 10 + */ + function getDLPSuffix(): string; + /** + * Subscribes to the event reported when a DLP file is opened by current application. + * + * @param { 'openDLPFile' } type - Indicates the type of the event to subscribe to. + * The value of type must be openDLPFile. + * @param { Callback } listener - Indicates the callback invoked when a DLP file is opened by current application. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + * 2. Incorrect parameter types. 3. Parameter verification failed; + * @throws { BusinessError } 19100001 - Invalid parameter value. + * @throws { BusinessError } 19100007 - This API cannot be called by DLP sandbox applications. + * @throws { BusinessError } 19100011 - System service exception. + * @syscap SystemCapability.Security.DataLossPrevention + * @since 10 + */ + function on(type: 'openDLPFile', listener: Callback): void; + /** + * Unsubscribes from the event reported when a DLP file is opened by current application. + * + * @param { 'openDLPFile' } type - Indicates the type of the event to unsubscribe from. + * The value of type must be openDLPFile. + * @param { Callback } listener - Indicates the callback invoked when a DLP file is opened by current application. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + * 2. Incorrect parameter types. 3. Parameter verification failed; + * @throws { BusinessError } 19100001 - Invalid parameter value. + * @throws { BusinessError } 19100007 - This API cannot be called by DLP sandbox applications. + * @throws { BusinessError } 19100011 - System service exception. + * @syscap SystemCapability.Security.DataLossPrevention + * @since 10 + */ + function off(type: 'openDLPFile', listener?: Callback): void; + /** + * Checks whether current application is in the DLP sandbox. This method uses a promise to return the result. + * + * @returns { Promise } Returns {@code true} if current application is in a DLP sandbox; returns {@code false} otherwise. + * @throws { BusinessError } 19100001 - Invalid parameter value. + * @throws { BusinessError } 19100011 - System service exception. + * @syscap SystemCapability.Security.DataLossPrevention + * @since 10 + */ + function isInSandbox(): Promise; + /** + * Checks whether current application is in the DLP sandbox. This method uses an asynchronous callback to return the result. + * + * @param { AsyncCallback } callback - Indicates the callback of isInSandbox. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Incorrect parameter types. + * @throws { BusinessError } 19100001 - Invalid parameter value. + * @throws { BusinessError } 19100011 - System service exception. + * @syscap SystemCapability.Security.DataLossPrevention + * @since 10 + */ + function isInSandbox(callback: AsyncCallback): void; + /** + * Obtains the file types supported by DLP. This method uses a promise to return the result. + * + * @returns { Promise> } Returns the list of file types supported. + * @throws { BusinessError } 19100001 - Invalid parameter value. + * @throws { BusinessError } 19100011 - System service exception. + * @syscap SystemCapability.Security.DataLossPrevention + * @since 10 + */ + function getDLPSupportedFileTypes(): Promise>; + /** + * Obtains the file types supported by DLP. This method uses an asynchronous callback to return the result. + * + * @param { AsyncCallback> } callback - Indicates the callback of getDLPSupportedFileTypes. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Incorrect parameter types. + * @throws { BusinessError } 19100001 - Invalid parameter value. + * @throws { BusinessError } 19100011 - System service exception. + * @syscap SystemCapability.Security.DataLossPrevention + * @since 10 + */ + function getDLPSupportedFileTypes(callback: AsyncCallback>): void; + /** + * Sets the retention status for the files specified by URI list. This method uses a promise to return the result. + * + * @param { Array } docUris - Indicates the URIs of the files, for which the retention status is to set. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + * 2. Incorrect parameter types; + * @throws { BusinessError } 19100001 - Invalid parameter value. + * @throws { BusinessError } 19100006 - This API can only be called by DLP sandbox applications. + * @throws { BusinessError } 19100011 - System service exception. + * @syscap SystemCapability.Security.DataLossPrevention + * @since 10 + */ + function setRetentionState(docUris: Array): Promise; + /** + * Sets the retention status for the files specified by URI list. This method uses an asynchronous callback to return the result. + * + * @param { Array } docUris - Indicates the URIs of the files, for which the retention status is to set. + * @param { AsyncCallback } callback - Indicates the callback of setRetentionState. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + * 2. Incorrect parameter types; + * @throws { BusinessError } 19100001 - Invalid parameter value. + * @throws { BusinessError } 19100006 - This API can only be called by DLP sandbox applications. + * @throws { BusinessError } 19100011 - System service exception. + * @syscap SystemCapability.Security.DataLossPrevention + * @since 10 + */ + function setRetentionState(docUris: Array, callback: AsyncCallback): void; + /** + * Cancels the retention status for the files specified by URI list. This method uses a promise to return the result. + * + * @param { Array } docUris - Indicates the list of the file URIs. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + * 2. Incorrect parameter types; + * @throws { BusinessError } 19100001 - Invalid parameter value. + * @throws { BusinessError } 19100011 - System service exception. + * @syscap SystemCapability.Security.DataLossPrevention + * @since 10 + */ + function cancelRetentionState(docUris: Array): Promise; + /** + * Cancels the retention status for the files specified by URI list. This method uses an asynchronous callback to return the result. + * + * @param { Array } docUris - Indicates the list of the file URIs. + * @param { AsyncCallback } callback - Indicates the callback of cancelRetentionState. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + * 2. Incorrect parameter types; + * @throws { BusinessError } 19100001 - Invalid parameter value. + * @throws { BusinessError } 19100011 - System service exception. + * @syscap SystemCapability.Security.DataLossPrevention + * @since 10 + */ + function cancelRetentionState(docUris: Array, callback: AsyncCallback): void; + /** + * Obtains information about the retained DLP sandboxes of an application. This method uses a promise to return the result. + * + * @param { string } bundleName - Indicates the bundle name of the application. + * @returns { Promise> } Returns a list of {@link RetentionSandboxInfo}. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Incorrect parameter types; + * @throws { BusinessError } 19100001 - Invalid parameter value. + * @throws { BusinessError } 19100007 - This API cannot be called by DLP sandbox applications. + * @throws { BusinessError } 19100011 - System service exception. + * @syscap SystemCapability.Security.DataLossPrevention + * @since 10 + */ + function getRetentionSandboxList(bundleName?: string): Promise>; + /** + * Obtains information about the retained DLP sandboxes of an application. This method uses an asynchronous callback to return the result. + * + * @param { string } bundleName - Indicates the bundle name of the application. + * @param { AsyncCallback> } callback - Indicates the callback of getRetentionSandboxList. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Incorrect parameter types; + * @throws { BusinessError } 19100001 - Invalid parameter value. + * @throws { BusinessError } 19100007 - This API cannot be called by DLP sandbox applications. + * @throws { BusinessError } 19100011 - System service exception. + * @syscap SystemCapability.Security.DataLossPrevention + * @since 10 + */ + function getRetentionSandboxList(bundleName: string, callback: AsyncCallback>): void; + /** + * Obtains information about the retained DLP sandboxes of an application. This method uses an asynchronous callback to return the result. + * + * @param { AsyncCallback> } callback - Indicates the callback of getRetentionSandboxList. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Incorrect parameter types; + * @throws { BusinessError } 19100001 - Invalid parameter value. + * @throws { BusinessError } 19100007 - This API cannot be called by DLP sandbox applications. + * @throws { BusinessError } 19100011 - System service exception. + * @syscap SystemCapability.Security.DataLossPrevention + * @since 10 + */ + function getRetentionSandboxList(callback: AsyncCallback>): void; + /** + * Obtains the DLP file access records. This method uses a promise to return the result. + * + * @returns { Promise> } Returns a list of {@link AccessedDLPFileInfo}. + * @throws { BusinessError } 19100001 - Invalid parameter value. + * @throws { BusinessError } 19100007 - This API cannot be called by DLP sandbox applications. + * @throws { BusinessError } 19100011 - System service exception. + * @syscap SystemCapability.Security.DataLossPrevention + * @since 10 + */ + function getDLPFileAccessRecords(): Promise>; + /** + * Obtains the DLP file access records. This method uses an asynchronous callback to return the result. + * + * @param { AsyncCallback> } callback - Indicates the callback of getDLPFileAccessRecords. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Incorrect parameter types; + * @throws { BusinessError } 19100001 - Invalid parameter value. + * @throws { BusinessError } 19100007 - This API cannot be called by DLP sandbox applications. + * @throws { BusinessError } 19100011 - System service exception. + * @syscap SystemCapability.Security.DataLossPrevention + * @since 10 + */ + function getDLPFileAccessRecords(callback: AsyncCallback>): void; + /** + * Represents the return value of the function startDLPManagerForResult. + * + * @interface DLPManagerResult + * @syscap SystemCapability.Security.DataLossPrevention + * @StageModelOnly + * @since 11 + */ + export interface DLPManagerResult { + /** + * Indicates the result code returned after the DLP manager is destroyed. + * + * @type { number } + * @syscap SystemCapability.Security.DataLossPrevention + * @StageModelOnly + * @since 11 + */ + resultCode: number; + /** + * Indicates the data returned after the DLP manager is destroyed. + * + * @type { Want } + * @syscap SystemCapability.Security.DataLossPrevention + * @StageModelOnly + * @since 11 + */ + want: Want; + } + /** + * Starts the DLP manager. This method uses a promise to return the result. + * + * @param { common.UIAbilityContext } context - Indicates the UIAbility context of the caller. + * @param { Want } want - Indicates the request to the DLP manager. + * @returns { Promise } Returns the {@link DLPManagerResult}. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + * 2. Incorrect parameter types; + * @throws { BusinessError } 19100001 - Invalid parameter value. + * @throws { BusinessError } 19100011 - System service exception. + * @throws { BusinessError } 19100016 - Uri does not exist in want. + * @throws { BusinessError } 19100017 - DisplayName does not exist in want (under parameters). + * @syscap SystemCapability.Security.DataLossPrevention + * @StageModelOnly + * @since 11 + */ + function startDLPManagerForResult(context: common.UIAbilityContext, want: Want): Promise; + /** + * Sets sandbox application configuration. This method uses a promise to return the result. + * + * @param { string } configInfo - Configuration of the sandbox application. + * @returns { Promise } Promise used to return the result. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + * 2. Incorrect parameter types; + * @throws { BusinessError } 19100001 - Invalid parameter value. + * @throws { BusinessError } 19100007 - This API cannot be called by DLP sandbox applications. + * @throws { BusinessError } 19100011 - System service exception. + * @throws { BusinessError } 19100018 - Not authorized application. + * @syscap SystemCapability.Security.DataLossPrevention + * @since 11 + */ + function setSandboxAppConfig(configInfo: string): Promise; + /** + * Cleans sandbox application configuration. This method uses a promise to return the result. + * + * @returns { Promise } Promise used to return the result. + * @throws { BusinessError } 19100001 - Invalid parameter value. + * @throws { BusinessError } 19100007 - This API cannot be called by DLP sandbox applications. + * @throws { BusinessError } 19100011 - System service exception. + * @throws { BusinessError } 19100018 - Not authorized application. + * @syscap SystemCapability.Security.DataLossPrevention + * @since 11 + */ + function cleanSandboxAppConfig(): Promise; + /** + * Obtains sandbox application configuration. This method uses a promise to return the result. + * + * @returns { Promise } Promise used to return the result. + * @throws { BusinessError } 19100001 - Invalid parameter value. + * @throws { BusinessError } 19100011 - System service exception. + * @throws { BusinessError } 19100018 - Not authorized application. + * @syscap SystemCapability.Security.DataLossPrevention + * @since 11 + */ + function getSandboxAppConfig(): Promise; + /** + * Checks whether the current system provides the DLP feature. This method uses a promise to return the result. + * + * @returns { Promise } Promise used to return the result. + * @throws { BusinessError } 19100011 - System service exception. + * @syscap SystemCapability.Security.DataLossPrevention + * @since 12 + */ + function isDLPFeatureProvided(): Promise; +} +export default dlpPermission; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.document.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.document.d.ts new file mode 100755 index 00000000..9ad72496 --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.document.d.ts @@ -0,0 +1,88 @@ +/* + * Copyright (c) 2021-2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit CoreFileKit + */ +import { AsyncCallback } from './@ohos.base'; +export default document; +/** + * document + * + * @namespace document + * @syscap SystemCapability.FileManagement.UserFileService + * @since 6 + * @deprecated since 9 + */ +declare namespace document { + export { choose }; + export { show }; +} +/** + * choose. + * + * @param { string[] } types - type. + * @returns { Promise } return Promise + * @throws { TypedError } Parameter check failed + * @syscap SystemCapability.FileManagement.UserFileService + * @since 6 + * @deprecated since 9 + */ +declare function choose(types?: string[]): Promise; +/** + * choose. + * + * @param { AsyncCallback } [callback] - callback. + * @throws { TypedError } Parameter check failed + * @syscap SystemCapability.FileManagement.UserFileService + * @since 6 + * @deprecated since 9 + */ +declare function choose(callback: AsyncCallback): void; +/** + * choose. + * + * @param { string[] } types - type. + * @param { AsyncCallback } [callback] - callback. + * @throws { TypedError } Parameter check failed + * @syscap SystemCapability.FileManagement.UserFileService + * @since 6 + * @deprecated since 9 + */ +declare function choose(types: string[], callback: AsyncCallback): void; +/** + * show. + * + * @param { string } uri - uri. + * @param { string } type - type. + * @returns { Promise } return Promise + * @throws { TypedError } Parameter check failed + * @syscap SystemCapability.FileManagement.UserFileService + * @since 6 + * @deprecated since 9 + */ +declare function show(uri: string, type: string): Promise; +/** + * show. + * + * @param { string } uri - uri. + * @param { string } type - type. + * @param { AsyncCallback } [callback] - callback. + * @throws { TypedError } Parameter check failed + * @syscap SystemCapability.FileManagement.UserFileService + * @since 6 + * @deprecated since 9 + */ +declare function show(uri: string, type: string, callback: AsyncCallback): void; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.driver.deviceManager.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.driver.deviceManager.d.ts new file mode 100755 index 00000000..c0fbc993 --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.driver.deviceManager.d.ts @@ -0,0 +1,223 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit DriverDevelopmentKit + */ +import type { AsyncCallback } from './@ohos.base'; +import type rpc from './@ohos.rpc'; +/** + * This module provides the capability of manage external device. + * + * @namespace deviceManager + * @syscap SystemCapability.Driver.ExternalDevice + * @since 10 + */ +declare namespace deviceManager { + /** + * Query the external device list. + * + * @permission ohos.permission.ACCESS_EXTENSIONAL_DEVICE_DRIVER + * @param { number } busType - The bus type of device to be queried. + * @returns { Array> } External device list. + * @throws { BusinessError } 401 - The parameter check failed. + * @throws { BusinessError } 22900001 - ExternalDeviceManager service exception. + * @syscap SystemCapability.Driver.ExternalDevice + * @since 10 + */ + function queryDevices(busType?: number): Array>; + /** + * Bind the device based on the device information returned by queryDevices(). + * + * @permission ohos.permission.ACCESS_EXTENSIONAL_DEVICE_DRIVER + * @param { number } deviceId - Device id on the device list returned by queryDevices(). + * @param { AsyncCallback } onDisconnect - Callback is invoked when device is disconnected after bind + * success. + * @param { AsyncCallback<{deviceId: number, remote: rpc.IRemoteObject}> } callback - Indicates the bind result + * including device ID and remote object. + * @throws { BusinessError } 401 - The parameter check failed. + * @throws { BusinessError } 22900001 - ExternalDeviceManager service exception. + * @syscap SystemCapability.Driver.ExternalDevice + * @since 10 + */ + function bindDevice(deviceId: number, onDisconnect: AsyncCallback, callback: AsyncCallback<{ + deviceId: number; + remote: rpc.IRemoteObject; + }>): void; + /** + * Bind the device based on the device information returned by queryDevices(). + * + * @permission ohos.permission.ACCESS_EXTENSIONAL_DEVICE_DRIVER + * @param { number } deviceId - Device id on the device list returned by queryDevices(). + * @param { AsyncCallback } onDisconnect - Callback is invoked when device is disconnected after bind + * success. + * @param { AsyncCallback } callback - Indicates the bind result including device ID and + * remote object. + * @throws { BusinessError } 401 - The parameter check failed. + * @throws { BusinessError } 22900001 - ExternalDeviceManager service exception. + * @syscap SystemCapability.Driver.ExternalDevice + * @since 11 + */ + function bindDeviceDriver(deviceId: number, onDisconnect: AsyncCallback, callback: AsyncCallback): void; + /** + * Bind the device based on the device information returned by queryDevices(). + * + * @permission ohos.permission.ACCESS_EXTENSIONAL_DEVICE_DRIVER + * @param { number } deviceId - Device id on the device list returned by queryDevices(). + * @param { AsyncCallback } onDisconnect - Callback is invoked when device is disconnected after bind + * success. + * @returns { Promise<{deviceId: number, remote: rpc.IRemoteObject}> } Indicates the bind result including device + * ID and remote object. + * @throws { BusinessError } 401 - The parameter check failed. + * @throws { BusinessError } 22900001 - ExternalDeviceManager service exception. + * @syscap SystemCapability.Driver.ExternalDevice + * @since 10 + */ + function bindDevice(deviceId: number, onDisconnect: AsyncCallback): Promise<{ + deviceId: number; + remote: rpc.IRemoteObject; + }>; + /** + * Bind the device based on the device information returned by queryDevices(). + * + * @permission ohos.permission.ACCESS_EXTENSIONAL_DEVICE_DRIVER + * @param { number } deviceId - Device id on the device list returned by queryDevices(). + * @param { AsyncCallback } onDisconnect - Callback is invoked when device is disconnected after bind + * success. + * @returns { Promise } Indicates the bind result including device ID and remote object. + * @throws { BusinessError } 401 - The parameter check failed. + * @throws { BusinessError } 22900001 - ExternalDeviceManager service exception. + * @syscap SystemCapability.Driver.ExternalDevice + * @since 11 + */ + function bindDeviceDriver(deviceId: number, onDisconnect: AsyncCallback): Promise; + /** + * Unbind the device based on the device information returned by queryDevices(). + * + * @permission ohos.permission.ACCESS_EXTENSIONAL_DEVICE_DRIVER + * @param { number } deviceId - Device id on the device list returned by queryDevices(). + * @param { AsyncCallback } callback - Indicates the unbind result invoked when unbind is finished. + * @throws { BusinessError } 401 - The parameter check failed. + * @throws { BusinessError } 22900001 - ExternalDeviceManager service exception. + * @syscap SystemCapability.Driver.ExternalDevice + * @since 10 + */ + function unbindDevice(deviceId: number, callback: AsyncCallback): void; + /** + * Unbind the device based on the device information returned by queryDevices(). + * + * @permission ohos.permission.ACCESS_EXTENSIONAL_DEVICE_DRIVER + * @param { number } deviceId - Device id on the device list returned by queryDevices(). + * @returns { Promise } - Indicates the unbind result invoked when unbind is finished. + * @throws { BusinessError } 401 - The parameter check failed. + * @throws { BusinessError } 22900001 - ExternalDeviceManager service exception. + * @syscap SystemCapability.Driver.ExternalDevice + * @since 10 + */ + function unbindDevice(deviceId: number): Promise; + /** + * Enumerates the bus types. + * + * @enum { number } + * @syscap SystemCapability.Driver.ExternalDevice + * @since 10 + */ + export enum BusType { + /** + * USB device type + * + * @syscap SystemCapability.Driver.ExternalDevice + * @since 10 + */ + USB = 1 + } + /** + * Represents a device. + * + * @typedef Device + * @syscap SystemCapability.Driver.ExternalDevice + * @since 10 + */ + interface Device { + /** + * Bus type of the device. + * + * @syscap SystemCapability.Driver.ExternalDevice + * @since 10 + */ + busType: BusType; + /** + * Device ID. + * + * @syscap SystemCapability.Driver.ExternalDevice + * @since 10 + */ + deviceId: number; + /** + * Description of the device. + * + * @syscap SystemCapability.Driver.ExternalDevice + * @since 10 + */ + description: string; + } + /** + * Represents a USB device. + * + * @typedef USBDevice + * @syscap SystemCapability.Driver.ExternalDevice + * @since 10 + */ + interface USBDevice extends Device { + /** + * Vendor ID. + * + * @syscap SystemCapability.Driver.ExternalDevice + * @since 10 + */ + vendorId: number; + /** + * Product ID. + * + * @syscap SystemCapability.Driver.ExternalDevice + * @since 10 + */ + productId: number; + } + /** + * Driver of the remote device bound with deviceId. + * + * @typedef RemoteDeviceDriver + * @syscap SystemCapability.Driver.ExternalDevice + * @since 11 + */ + interface RemoteDeviceDriver { + /** + * Device ID. + * + * @syscap SystemCapability.Driver.ExternalDevice + * @since 11 + */ + deviceId: number; + /** + * Remote driver object. + * + * @syscap SystemCapability.Driver.ExternalDevice + * @since 11 + */ + remote: rpc.IRemoteObject; + } +} +export default deviceManager; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.effectKit.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.effectKit.d.ts new file mode 100755 index 00000000..8af5e125 --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.effectKit.d.ts @@ -0,0 +1,435 @@ +/* +* Copyright (c) 2022 Huawei Device Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +/** + * @file + * @kit ArkGraphics2D + */ +import { AsyncCallback } from './@ohos.base'; +import image from './@ohos.multimedia.image'; +/** + * @namespace effectKit + * @since 9 + */ +/** + * @namespace effectKit + * @form + * @atomicservice + * @since 12 + */ +declare namespace effectKit { + /** + * The Filter of FilterChain. + * @typedef Filter + * @syscap SystemCapability.Multimedia.Image.Core + * @since 9 + */ + /** + * The Filter of FilterChain. + * @typedef Filter + * @syscap SystemCapability.Multimedia.Image.Core + * @form + * @atomicservice + * @since 12 + */ + interface Filter { + /** + * A blur effect is added to the image. + * @param { number } radius - The degree of blur, the value is measured in pixels. + * @returns { Filter } Filters for the current effect have been added. + * @syscap SystemCapability.Multimedia.Image.Core + * @since 9 + */ + /** + * A blur effect is added to the image. + * @param { number } radius - The degree of blur, the value is measured in pixels. + * @returns { Filter } Filters for the current effect have been added. + * @syscap SystemCapability.Multimedia.Image.Core + * @form + * @atomicservice + * @since 12 + */ + blur(radius: number): Filter; + /** + * A Brightness effect is added to the image. + * @param { number } bright - The degree of light and darkness,the value range is 0 to 1. + * @returns { Filter } Filters for the current effect have been added. + * @syscap SystemCapability.Multimedia.Image.Core + * @since 9 + */ + /** + * A Brightness effect is added to the image. + * @param { number } bright - The degree of light and darkness,the value range is 0 to 1. + * @returns { Filter } Filters for the current effect have been added. + * @syscap SystemCapability.Multimedia.Image.Core + * @form + * @atomicservice + * @since 12 + */ + brightness(bright: number): Filter; + /** + * A Grayscale effect is added to the image. + * @returns { Filter } Filters for the current effect have been added. + * @syscap SystemCapability.Multimedia.Image.Core + * @since 9 + */ + /** + * A Grayscale effect is added to the image. + * @returns { Filter } Filters for the current effect have been added. + * @syscap SystemCapability.Multimedia.Image.Core + * @form + * @atomicservice + * @since 12 + */ + grayscale(): Filter; + /** + * A invert effect is added to the image. + * @returns { Filter } Filters for the current effect have been added. + * @syscap SystemCapability.Multimedia.Image.Core + * @since 12 + */ + invert(): Filter; + /** + * A custom effect is added to the image. + * + * @param { Array } colorMatrix - A matrix of 5x4 size for create effect filter. + * @returns { Filter } Filters for the current effect have been added. + * @throws { BusinessError } 401 - Input parameter error. + * @syscap SystemCapability.Multimedia.Image.Core + * @since 12 + */ + setColorMatrix(colorMatrix: Array): Filter; + /** + * Gets the PixelMap where all filter effects have been added to the image. + * @returns { image.PixelMap } image.PixelMap. + * @syscap SystemCapability.Multimedia.Image.Core + * @since 9 + * @deprecated since 11 + * @useinstead effectKit.Filter#getEffectPixelMap + */ + getPixelMap(): image.PixelMap; + /** + * Gets the PixelMap where all filter effects have been added to the image. + * @returns { Promise } - returns the PixelMap generated. + * @syscap SystemCapability.Multimedia.Image.Core + * @since 11 + */ + /** + * Gets the PixelMap where all filter effects have been added to the image. + * @returns { Promise } - returns the PixelMap generated. + * @syscap SystemCapability.Multimedia.Image.Core + * @form + * @atomicservice + * @since 12 + */ + getEffectPixelMap(): Promise; + } + /** + * The color picker of an image. + * @typedef ColorPicker + * @syscap SystemCapability.Multimedia.Image.Core + * @since 9 + */ + /** + * The color picker of an image. + * @typedef ColorPicker + * @syscap SystemCapability.Multimedia.Image.Core + * @form + * @atomicservice + * @since 12 + */ + interface ColorPicker { + /** + * get main color of an image + * @returns { Promise } returns the MainColor generated. + * @syscap SystemCapability.Multimedia.Image.Core + * @since 9 + */ + /** + * get main color of an image + * @returns { Promise } returns the MainColor generated. + * @syscap SystemCapability.Multimedia.Image.Core + * @form + * @atomicservice + * @since 12 + */ + getMainColor(): Promise; + /** + * get main color of an image + * @returns { Color } Main color picked in the image. + * @syscap SystemCapability.Multimedia.Image.Core + * @since 9 + */ + /** + * get main color of an image + * @returns { Color } Main color picked in the image. + * @syscap SystemCapability.Multimedia.Image.Core + * @form + * @atomicservice + * @since 12 + */ + getMainColorSync(): Color; + /** + * Get largest proportion color of an image + * @returns { Color } Largest proportion color picked in the image. + * @syscap SystemCapability.Multimedia.Image.Core + * @since 10 + */ + /** + * Get largest proportion color of an image + * @returns { Color } Largest proportion color picked in the image. + * @syscap SystemCapability.Multimedia.Image.Core + * @form + * @atomicservice + * @since 12 + */ + getLargestProportionColor(): Color; + /** + * Get top proportion color of an image + * @param { number } colorCount - The number of colors to require, the value is 1 to 10. + * @returns { Array } An array of feature colors sorted by proportion, with a size equal to + * the minimum of colorCount and the actual number of extracted feature colors. + * @syscap SystemCapability.Multimedia.Image.Core + * @form + * @atomicservice + * @since 12 + */ + getTopProportionColors(colorCount: number): Array; + /** + * Get highest saturation color of an image + * @returns { Color } Highest saturation color picked in the image. + * @syscap SystemCapability.Multimedia.Image.Core + * @since 10 + */ + /** + * Get highest saturation color of an image + * @returns { Color } Highest saturation color picked in the image. + * @syscap SystemCapability.Multimedia.Image.Core + * @form + * @atomicservice + * @since 12 + */ + getHighestSaturationColor(): Color; + /** + * Get average color of an image + * @returns { Color } Average color calculated in the image. + * @syscap SystemCapability.Multimedia.Image.Core + * @since 10 + */ + /** + * Get average color of an image + * @returns { Color } Average color calculated in the image. + * @syscap SystemCapability.Multimedia.Image.Core + * @form + * @atomicservice + * @since 12 + */ + getAverageColor(): Color; + /** + * Determine whether the color is black or white or gray + * @param { number } color - The 32 bit ARGB color to discriminate. + * @returns { boolean } Result of judging black, white and gray. + * @syscap SystemCapability.Multimedia.Image.Core + * @since 10 + */ + /** + * Determine whether the color is black or white or gray + * @param { number } color - The 32 bit ARGB color to discriminate. + * @returns { boolean } Result of judging black, white and gray. + * @syscap SystemCapability.Multimedia.Image.Core + * @form + * @atomicservice + * @since 12 + */ + isBlackOrWhiteOrGrayColor(color: number): boolean; + } + /** + * The color param. + * @typedef Color + * @syscap SystemCapability.Multimedia.Image.Core + * @since 9 + */ + /** + * The color param. + * @typedef Color + * @syscap SystemCapability.Multimedia.Image.Core + * @form + * @atomicservice + * @since 12 + */ + interface Color { + /** + * Red + * @type { number } + * @syscap SystemCapability.Multimedia.Image.Core + * @since 9 + */ + /** + * Red + * @type { number } + * @syscap SystemCapability.Multimedia.Image.Core + * @form + * @atomicservice + * @since 12 + */ + red: number; + /** + * Green + * @type { number } + * @syscap SystemCapability.Multimedia.Image.Core + * @since 9 + */ + /** + * Green + * @type { number } + * @syscap SystemCapability.Multimedia.Image.Core + * @form + * @atomicservice + * @since 12 + */ + green: number; + /** + * Blue + * @type { number } + * @syscap SystemCapability.Multimedia.Image.Core + * @since 9 + */ + /** + * Blue + * @type { number } + * @syscap SystemCapability.Multimedia.Image.Core + * @form + * @atomicservice + * @since 12 + */ + blue: number; + /** + * Alpha + * @type { number } + * @syscap SystemCapability.Multimedia.Image.Core + * @since 9 + */ + /** + * Alpha + * @type { number } + * @syscap SystemCapability.Multimedia.Image.Core + * @form + * @atomicservice + * @since 12 + */ + alpha: number; + } + /** + * Create a FilterChain to add multiple effects to an image. + * @param { image.PixelMap } source - the source pixelmap. + * @returns { Filter } Returns the head node of FilterChain. + * @syscap SystemCapability.Multimedia.Image.Core + * @since 9 + */ + /** + * Create a FilterChain to add multiple effects to an image. + * @param { image.PixelMap } source - the source pixelmap. + * @returns { Filter } Returns the head node of FilterChain. + * @syscap SystemCapability.Multimedia.Image.Core + * @form + * @atomicservice + * @since 12 + */ + function createEffect(source: image.PixelMap): Filter; + /** + * Create a color picker to get color of an image. + * @param { image.PixelMap } source - the source pixelmap. + * @returns { Promise } - returns the ColorPicker generated. + * @throws { BusinessError } 401 - Input parameter error. + * @syscap SystemCapability.Multimedia.Image.Core + * @since 9 + */ + /** + * Create a color picker to get color of an image. + * @param { image.PixelMap } source - the source pixelmap. + * @returns { Promise } - returns the ColorPicker generated. + * @throws { BusinessError } 401 - Input parameter error. + * @syscap SystemCapability.Multimedia.Image.Core + * @form + * @atomicservice + * @since 12 + */ + function createColorPicker(source: image.PixelMap): Promise; + /** + * Create a color picker to get color of an image. + * @param { image.PixelMap } source - the source pixelmap. + * @param { Array } region - contains 4 elements, represents the region's left, top, right, bottom coordinates, + * default is [0, 0, 1, 1], represents the region of color picker is the whole pixelMap. + * @returns { Promise } - returns the ColorPicker generated. + * @throws { BusinessError } 401 - Input parameter error. + * @syscap SystemCapability.Multimedia.Image.Core + * @since 10 + */ + /** + * Create a color picker to get color of an image. + * @param { image.PixelMap } source - the source pixelmap. + * @param { Array } region - contains 4 elements, represents the region's left, top, right, bottom coordinates, + * default is [0, 0, 1, 1], represents the region of color picker is the whole pixelMap. + * @returns { Promise } - returns the ColorPicker generated. + * @throws { BusinessError } 401 - Input parameter error. + * @syscap SystemCapability.Multimedia.Image.Core + * @form + * @atomicservice + * @since 12 + */ + function createColorPicker(source: image.PixelMap, region: Array): Promise; + /** + * Create a color picker to get color of an image. + * @param { image.PixelMap } source - the source pixelmap. + * @param { AsyncCallback } callback - the callback of createColorPicker. + * @throws { BusinessError } 401 - Input parameter error. + * @syscap SystemCapability.Multimedia.Image.Core + * @since 9 + */ + /** + * Create a color picker to get color of an image. + * @param { image.PixelMap } source - the source pixelmap. + * @param { AsyncCallback } callback - the callback of createColorPicker. + * @throws { BusinessError } 401 - Input parameter error. + * @syscap SystemCapability.Multimedia.Image.Core + * @form + * @atomicservice + * @since 12 + */ + function createColorPicker(source: image.PixelMap, callback: AsyncCallback): void; + /** + * Create a color picker to get color of an image. + * @param { image.PixelMap } source - the source pixelmap. + * @param { Array } region - contains 4 elements, represents the region's left, top, right, bottom coordinates, + * default is [0, 0, 1, 1], represents the region of color picker is the whole pixelMap. + * @param { AsyncCallback } callback - the callback of createColorPicker. + * @throws { BusinessError } 401 - Input parameter error. + * @syscap SystemCapability.Multimedia.Image.Core + * @since 10 + */ + /** + * Create a color picker to get color of an image. + * @param { image.PixelMap } source - the source pixelmap. + * @param { Array } region - contains 4 elements, represents the region's left, top, right, bottom coordinates, + * default is [0, 0, 1, 1], represents the region of color picker is the whole pixelMap. + * @param { AsyncCallback } callback - the callback of createColorPicker. + * @throws { BusinessError } 401 - Input parameter error. + * @syscap SystemCapability.Multimedia.Image.Core + * @form + * @atomicservice + * @since 12 + */ + function createColorPicker(source: image.PixelMap, region: Array, callback: AsyncCallback): void; +} +export default effectKit; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.enterprise.EnterpriseAdminExtensionAbility.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.enterprise.EnterpriseAdminExtensionAbility.d.ts new file mode 100755 index 00000000..cb5ae123 --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.enterprise.EnterpriseAdminExtensionAbility.d.ts @@ -0,0 +1,97 @@ +/* + * Copyright (c) 2022-2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit MDMKit + */ +import type systemManager from './@ohos.enterprise.systemManager'; +/** + * Class of the enterprise admin extension ability. + * + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @stagemodelonly + * @since 12 + */ +export default class EnterpriseAdminExtensionAbility { + /** + * Called back when an application is enabled. + * + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @stagemodelonly + * @since 12 + */ + onAdminEnabled(): void; + /** + * Called back when an application is disabled. + * + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @stagemodelonly + * @since 12 + */ + onAdminDisabled(): void; + /** + * Called back when a bundle is installed. + * + * @param { string } bundleName - bundleName indicates the name of the bundle installed. + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @stagemodelonly + * @since 12 + */ + onBundleAdded(bundleName: string): void; + /** + * Called back when a bundle is uninstalled. + * + * @param { string } bundleName - bundleName indicates the name of the bundle uninstalled. + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @stagemodelonly + * @since 12 + */ + onBundleRemoved(bundleName: string): void; + /** + * Called back when an app is started. + * + * @param { string } bundleName - bundleName indicates the name of the app started. + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @stagemodelonly + * @since 12 + */ + onAppStart(bundleName: string): void; + /** + * Called back when an app is stopped. + * + * @param { string } bundleName - bundleName indicates the name of the app stopped. + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @stagemodelonly + * @since 12 + */ + onAppStop(bundleName: string): void; + /** + * Called back when a system version need to update. + * + * @param { systemManager.SystemUpdateInfo } systemUpdateInfo - the information of the system version. + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @stagemodelonly + * @since 12 + */ + onSystemUpdate(systemUpdateInfo: systemManager.SystemUpdateInfo): void; + /** + * Called back when the enterprise admin extension is started. + * + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @stagemodelonly + * @since 12 + */ + onStart(): void; +} diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.enterprise.accountManager.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.enterprise.accountManager.d.ts new file mode 100755 index 00000000..8adafc8e --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.enterprise.accountManager.d.ts @@ -0,0 +1,90 @@ +/* + * Copyright (c) 2023-2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit MDMKit + */ + +import type Want from './@ohos.app.ability.Want'; +import type osAccount from './@ohos.account.osAccount'; +/** + * This module provides the capability to manage the accounts of the enterprise devices. + * + * @namespace accountManager + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @since 10 + */ +declare namespace accountManager { + /** + * Disallows the account or all accounts to add an OS account. + * This function can be called by a super administrator. + * + * @permission ohos.permission.ENTERPRISE_SET_ACCOUNT_POLICY + * @param { Want } admin - admin indicates the enterprise admin extension ability information. + * The admin must have the corresponding permission. + * @param { boolean } disallow - true if the specific account or all accounts are not allowed to add an OS account. + * @param { number } [accountId] - indicates the account ID. It cannot be the ID of an account that does not exist. + * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. + * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. + * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; 3. Parameter verification failed. + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @stagemodelonly + * @since 12 + */ + function disallowOsAccountAddition(admin: Want, disallow: boolean, accountId?: number): void; + /** + * Queries whether the account or all accounts is disallowed to add an OS account. + * This function can be called by a super administrator. + * + * @permission ohos.permission.ENTERPRISE_SET_ACCOUNT_POLICY + * @param { Want } admin - admin indicates the enterprise admin extension ability information. + * If the admin is not empty, it must have the corresponding permission. + * @param { number } [accountId] - indicates the account ID. It cannot be the ID of an account that does not exist. + * @returns { boolean } true if the specific account or all accounts are not allowed to add an OS account. + * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. + * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. + * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; 3. Parameter verification failed. + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @stagemodelonly + * @since 12 + */ + function isOsAccountAdditionDisallowed(admin: Want, accountId?: number): boolean; + /** + * Adds an OS account using the name and account type. + * This function can be called by a super administrator. + * + * @permission ohos.permission.ENTERPRISE_SET_ACCOUNT_POLICY + * @param { Want } admin - admin indicates the enterprise admin extension ability information. + * The admin must have the corresponding permission. + * @param { string } name - the OS account name. It cannot be empty. + * @param { osAccount.OsAccountType } type - the OS account type. It can only be one of correct types. + * @returns { Promise } information about the OS account added. + * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. + * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. + * @throws { BusinessError } 9201003 - Failed to add an OS account. + * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; 3. Parameter verification failed. + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @stagemodelonly + * @since 12 + */ + function addOsAccountAsync(admin: Want, name: string, type: osAccount.OsAccountType): Promise; +} +export default accountManager; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.enterprise.adminManager.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.enterprise.adminManager.d.ts new file mode 100755 index 00000000..ff02da4c --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.enterprise.adminManager.d.ts @@ -0,0 +1,124 @@ +/* + * Copyright (c) 2022-2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit MDMKit + */ + +import type Want from './@ohos.app.ability.Want'; +/** + * This module provides the capability to manage the administrator of the enterprise devices. + * + * @namespace adminManager + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @since 9 + */ +declare namespace adminManager { + /** + * Enum for managed event + * + * @enum { number } + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @since 12 + */ + export enum ManagedEvent { + /** + * The event of bundle added. + * + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @since 12 + */ + MANAGED_EVENT_BUNDLE_ADDED = 0, + /** + * The event of bundle removed. + * + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @since 12 + */ + MANAGED_EVENT_BUNDLE_REMOVED = 1, + /** + * The event of app start. + * + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @since 12 + */ + MANAGED_EVENT_APP_START = 2, + /** + * The event of app stop. + * + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @since 12 + */ + MANAGED_EVENT_APP_STOP = 3, + /** + * The event of system update. + * + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @since 12 + */ + MANAGED_EVENT_SYSTEM_UPDATE = 4 + } + /** + * Disables a current administrator ability. + * Only apps with the ohos.permission.MANAGE_ENTERPRISE_DEVICE_ADMIN permission or the shell uid can call this method. + * + * @permission ohos.permission.MANAGE_ENTERPRISE_DEVICE_ADMIN + * @param { Want } admin - admin indicates the enterprise admin extension ability information. + * The admin must have the corresponding permission. + * @param { number } [userId] - userId indicates the user ID or do not pass user ID. + * @returns { Promise } the promise returned by the disableAdmin. + * @throws { BusinessError } 9200005 - Failed to deactivate the administrator application of the device. + * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; 3. Parameter verification failed. + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @StageModelOnly + * @since 12 + */ + function disableAdmin(admin: Want, userId?: number): Promise; + /** + * Subscribes the managed event of admin. + * + * @permission ohos.permission.ENTERPRISE_SUBSCRIBE_MANAGED_EVENT + * @param { Want } admin - admin indicates the administrator ability information. + * @param { Array } managedEvents - managedEvents indicates the managed events to subscribe. + * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. + * @throws { BusinessError } 9200008 - The specified system event is invalid. + * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; 3. Parameter verification failed. + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @StageModelOnly + * @since 12 + */ + function subscribeManagedEventSync(admin: Want, managedEvents: Array): void; + /** + * Unsubscribes the managed event of admin. + * + * @permission ohos.permission.ENTERPRISE_SUBSCRIBE_MANAGED_EVENT + * @param { Want } admin - admin indicates the administrator ability information. + * @param { Array } managedEvents - managedEvents indicates the managed events to subscribe. + * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. + * @throws { BusinessError } 9200008 - The specified system event is invalid. + * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; 3. Parameter verification failed. + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @StageModelOnly + * @since 12 + */ + function unsubscribeManagedEventSync(admin: Want, managedEvents: Array): void; +} +export default adminManager; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.enterprise.applicationManager.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.enterprise.applicationManager.d.ts new file mode 100755 index 00000000..d87c023c --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.enterprise.applicationManager.d.ts @@ -0,0 +1,147 @@ +/* + * Copyright (c) 2023-2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit MDMKit + */ + +import type Want from './@ohos.app.ability.Want'; +/** + * This module provides the capability to manage the applications of the enterprise devices. + * + * @namespace applicationManager + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @since 10 + */ +declare namespace applicationManager { + /** + * Add appid list of bundles that is disallowed to run in the device. + * This function can be called by a super administrator. + * + * @permission ohos.permission.ENTERPRISE_MANAGE_APPLICATION + * @param { Want } admin - admin indicates the enterprise admin extension ability information. + * The admin must have the corresponding permission. + * @param { Array } appIds - ids of the bundle are disallowed to run. The size of the array after setting + * cannot be greater than 200. + * @param { number } [accountId] - accountId indicates the account ID. + * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. + * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. + * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; 3. Parameter verification failed. + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @StageModelOnly + * @since 12 + */ + function addDisallowedRunningBundlesSync(admin: Want, appIds: Array, accountId?: number): void; + /** + * Remove appid list of bundles that is disallowed to run in the device. + * This function can be called by a super administrator. + * + * @permission ohos.permission.ENTERPRISE_MANAGE_APPLICATION + * @param { Want } admin - admin indicates the enterprise admin extension ability information. + * The admin must have the corresponding permission. + * @param { Array } appIds - ids of the bundle are disallowed to run. The size of the array after setting + * cannot be greater than 200. + * @param { number } [accountId] - accountId indicates the user ID. + * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. + * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. + * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; 3. Parameter verification failed. + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @StageModelOnly + * @since 12 + */ + function removeDisallowedRunningBundlesSync(admin: Want, appIds: Array, accountId?: number): void; + /** + * Get appid list of bundles that is disallowed to run in the device. + * This function can be called by a super administrator. + * + * @permission ohos.permission.ENTERPRISE_MANAGE_APPLICATION + * @param { Want } admin - admin indicates the enterprise admin extension ability information. + * The admin must have the corresponding permission. + * @param { number } [accountId] - accountId indicates the user ID. + * @returns { Array } ids of the bundle are disallowed to run. + * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. + * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. + * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; 3. Parameter verification failed. + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @StageModelOnly + * @since 12 + */ + function getDisallowedRunningBundlesSync(admin: Want, accountId?: number): Array; + /** + * Adds auto start applications. + * This function can be called by a super administrator. + * + * @permission ohos.permission.ENTERPRISE_MANAGE_APPLICATION + * @param { Want } admin - admin indicates the enterprise admin extension ability information. + * The admin must have the corresponding permission. + * @param { Array } autoStartApps - autoStartApps indicates the information of auto start app ability. + * The bundleName and abilityName of the want cannot be non-exist. + * The size of the array after setting cannot be greater than 10. + * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. + * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. + * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; 3. Parameter verification failed. + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @stagemodelonly + * @since 12 + */ + function addAutoStartApps(admin: Want, autoStartApps: Array): void; + /** + * Removes auto start applications. + * This function can be called by a super administrator. + * + * @permission ohos.permission.ENTERPRISE_MANAGE_APPLICATION + * @param { Want } admin - admin indicates the enterprise admin extension ability information. + * The admin must have the corresponding permission. + * @param { Array } autoStartApps - autoStartApps indicates the information of auto start app ability. + * The bundleName and abilityName of the want cannot be non-exist. + * The size of the array after setting cannot be greater 10. + * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. + * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. + * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; 3. Parameter verification failed. + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @stagemodelonly + * @since 12 + */ + function removeAutoStartApps(admin: Want, autoStartApps: Array): void; + /** + * Gets information of auto start applications. + * This function can be called by a super administrator. + * + * @permission ohos.permission.ENTERPRISE_MANAGE_APPLICATION + * @param { Want } admin - admin indicates the enterprise admin extension ability information. + * The admin must have the corresponding permission. + * @returns { Array } the information of auto start applications. + * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. + * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. + * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; 3. Parameter verification failed. + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @stagemodelonly + * @since 12 + */ + function getAutoStartApps(admin: Want): Array; +} +export default applicationManager; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.enterprise.bluetoothManager.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.enterprise.bluetoothManager.d.ts new file mode 100755 index 00000000..f447881c --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.enterprise.bluetoothManager.d.ts @@ -0,0 +1,144 @@ +/* + * Copyright (c) 2023-2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit MDMKit + */ +import type Want from './@ohos.app.ability.Want'; +import type constant from './@ohos.bluetooth.constant'; +import type access from './@ohos.bluetooth.access'; +/** + * This module provides the capability to manage the bluetooth of the enterprise devices. + * + * @namespace bluetoothManager + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @stagemodelonly + * @since 11 + */ +declare namespace bluetoothManager { + /** + * The information of device bluetooth. + * + * @typedef BluetoothInfo + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @stagemodelonly + * @since 12 + */ + export interface BluetoothInfo { + /** + * The name of bluetooth. + * + * @type { string } + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @stagemodelonly + * @since 12 + */ + name: string; + /** + * The state of bluetooth. + * + * @type { access.BluetoothState } + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @stagemodelonly + * @since 12 + */ + state: access.BluetoothState; + /** + * The state of bluetooth connection + * + * @type { constant.ProfileConnectionState } + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @stagemodelonly + * @since 12 + */ + connectionState: constant.ProfileConnectionState; + } + /** + * Gets bluetooth information. + * This function can be called by a super administrator. + * + * @permission ohos.permission.ENTERPRISE_MANAGE_BLUETOOTH + * @param { Want } admin - admin indicates the enterprise admin extension ability information. + * The admin must have the corresponding permission. + * @returns { BluetoothInfo } the bluetooth information. + * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. + * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. + * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; 3. Parameter verification failed. + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @stagemodelonly + * @since 12 + */ + function getBluetoothInfo(admin: Want): BluetoothInfo; + /** + * Adds devices to the list of bluetooth devices that are allowed to be connected. + * This function can be called by a super administrator. + * + * @permission ohos.permission.ENTERPRISE_MANAGE_BLUETOOTH + * @param { Want } admin - admin indicates the enterprise admin extension ability information. + * The admin must have the corresponding permission. + * @param { Array } deviceIds - IDs of the bluetooth devices to be added to the list. + * The size of the array after setting cannot be greater than 1000. + * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. + * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. + * @throws { BusinessError } 9200010 - A conflict policy has been configured. + * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; 3. Parameter verification failed. + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @stagemodelonly + * @since 12 + */ + function addAllowedBluetoothDevices(admin: Want, deviceIds: Array): void; + /** + * Removes devices from the list of bluetooth devices that are allowed to be connected. + * This function can be called by a super administrator. + * + * @permission ohos.permission.ENTERPRISE_MANAGE_BLUETOOTH + * @param { Want } admin - admin indicates the enterprise admin extension ability information. + * The admin must have the corresponding permission. + * @param { Array } deviceIds - IDs of the bluetooth devices to be removed from the list. + * The size of the array after setting cannot be greater than 1000. + * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. + * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. + * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; 3. Parameter verification failed. + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @stagemodelonly + * @since 12 + */ + function removeAllowedBluetoothDevices(admin: Want, deviceIds: Array): void; + /** + * Gets the devices in the list of bluetooth devices that are allowed to be connected. + * This function can be called by a super administrator. + * + * @permission ohos.permission.ENTERPRISE_MANAGE_BLUETOOTH + * @param { Want } admin - admin indicates the enterprise admin extension ability information. + * If the admin is not empty, it must have the corresponding permission. + * @returns { Array } IDs of the bluetooth devices in the list. + * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. + * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. + * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; 3. Parameter verification failed. + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @stagemodelonly + * @since 12 + */ + function getAllowedBluetoothDevices(admin: Want): Array; +} +export default bluetoothManager; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.enterprise.browser.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.enterprise.browser.d.ts new file mode 100755 index 00000000..9e6e850a --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.enterprise.browser.d.ts @@ -0,0 +1,67 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit MDMKit + */ + +import type Want from './@ohos.app.ability.Want'; +/** + * This module provides the capability to manage the browser policies of the enterprise devices. + * + * @namespace browser + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @since 10 + */ +declare namespace browser { + /** + * Sets the browser policy. + * This function can be called by a super administrator. + * + * @permission ohos.permission.ENTERPRISE_SET_BROWSER_POLICY + * @param { Want } admin - admin indicates the enterprise admin extension ability information. + * The admin must have the corresponding permission. + * @param { string } appId - appId indicates the id of the bundle that need to set policy. It cannot be empty. + * @param { string } policyName - policyName indicates the browser policy name that need to set. + * @param { string } policyValue - policyValue indicates the browser policy value that need to set. It must be a + * correct JSON character string that can be converted into browser policies. + * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. + * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. + * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; 3. Parameter verification failed. + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @stagemodelonly + * @since 12 + */ + function setPolicySync(admin: Want, appId: string, policyName: string, policyValue: string): void; + /** + * Gets the browser policies. + * This function can be called by a super administrator. + * + * @param { Want } admin - admin indicates the enterprise admin extension ability information. + * The admin must have the corresponding permission. + * @param { string } appId - id of the bundle that need to get policies. It cannot be empty. + * @returns { string } the browser policies returned by the getPolicies. + * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; 3. Parameter verification failed. + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @stagemodelonly + * @since 12 + */ + function getPoliciesSync(admin: Want, appId: string): string; +} +export default browser; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.enterprise.bundleManager.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.enterprise.bundleManager.d.ts new file mode 100755 index 00000000..cece3941 --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.enterprise.bundleManager.d.ts @@ -0,0 +1,275 @@ +/* + * Copyright (c) 2023-2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit MDMKit + */ + +import type Want from './@ohos.app.ability.Want'; +/** + * This module provides the capability to manage the bundles of the enterprise devices. + * + * @namespace bundleManager + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @since 10 + */ +declare namespace bundleManager { + /** + * Provides parameters required for installing an application. + * + * @typedef InstallParam + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @StageModelOnly + * @since 12 + */ + interface InstallParam { + /** + * Indicates the user id + * + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @StageModelOnly + * @since 12 + */ + userId?: number; + /** + * Indicates the install flag, which 0 for first install, 1 for cover install + * + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @StageModelOnly + * @since 12 + */ + installFlag?: number; + } + /** + * Add appid list of bundles that can be installed in the device. + * Only apps with the ohos.permission.ENTERPRISE_SET_BUNDLE_INSTALL_POLICY permission can call this method. + * + * @permission ohos.permission.ENTERPRISE_SET_BUNDLE_INSTALL_POLICY + * @param { Want } admin - admin indicates the enterprise admin extension ability information. + * The admin must have the corresponding permission. + * @param { Array } appIds - ids of the bundle that can be installed. The size of the array after + * setting cannot be greater than 200. + * @param { number } [accountId] - accountId indicates the account ID or do not pass account ID. + * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. + * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. + * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; 3. Parameter verification failed. + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @StageModelOnly + * @since 12 + */ + function addAllowedInstallBundlesSync(admin: Want, appIds: Array, accountId?: number): void; + /** + * Remove appid list of bundles that can be installed in the device. + * Only apps with the ohos.permission.ENTERPRISE_SET_BUNDLE_INSTALL_POLICY permission can call this method. + * + * @permission ohos.permission.ENTERPRISE_SET_BUNDLE_INSTALL_POLICY + * @param { Want } admin - admin indicates the enterprise admin extension ability information. + * The admin must have the corresponding permission. + * @param { Array } appIds - ids of the bundle that can be installed. The size of the array after + * setting cannot be greater than 200. + * @param { number } [accountId] - accountId indicates the account ID or do not pass account ID. + * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. + * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. + * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; 3. Parameter verification failed. + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @StageModelOnly + * @since 12 + */ + function removeAllowedInstallBundlesSync(admin: Want, appIds: Array, accountId?: number): void; + /** + * Get appid list of bundles that can be installed in the device. + * Only apps with the ohos.permission.ENTERPRISE_SET_BUNDLE_INSTALL_POLICY permission can call this method. + * + * @permission ohos.permission.ENTERPRISE_SET_BUNDLE_INSTALL_POLICY + * @param { Want } admin - admin indicates the enterprise admin extension ability information. + * The admin must have the corresponding permission. + * @param { number } [accountId] - accountId indicates the account ID or do not pass account ID. + * @returns { Array } ids of the bundle that can be installed. + * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. + * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. + * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; 3. Parameter verification failed. + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @StageModelOnly + * @since 12 + */ + function getAllowedInstallBundlesSync(admin: Want, accountId?: number): Array; + /** + * Add appid list of bundles that can not be installed in the device. + * Only apps with the ohos.permission.ENTERPRISE_SET_BUNDLE_INSTALL_POLICY permission can call this method. + * + * @permission ohos.permission.ENTERPRISE_SET_BUNDLE_INSTALL_POLICY + * @param { Want } admin - admin indicates the enterprise admin extension ability information. + * The admin must have the corresponding permission. + * @param { Array } appIds - ids of the bundle that can not be installed. The size of the array after + * setting cannot be greater than 200. + * @param { number } [accountId] - accountId indicates the account ID or do not pass account ID. + * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. + * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. + * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; 3. Parameter verification failed. + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @StageModelOnly + * @since 12 + */ + function addDisallowedInstallBundlesSync(admin: Want, appIds: Array, accountId?: number): void; + /** + * Remove appid list of bundles that can not be installed in the device. + * Only apps with the ohos.permission.ENTERPRISE_SET_BUNDLE_INSTALL_POLICY permission can call this method. + * + * @permission ohos.permission.ENTERPRISE_SET_BUNDLE_INSTALL_POLICY + * @param { Want } admin - admin indicates the enterprise admin extension ability information. + * The admin must have the corresponding permission. + * @param { Array } appIds - ids of the bundle that can not be installed. The size of the array after + * setting cannot be greater than 200. + * @param { number } [accountId] - accountId indicates the account ID or do not pass account ID. + * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. + * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. + * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; 3. Parameter verification failed. + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @StageModelOnly + * @since 12 + */ + function removeDisallowedInstallBundlesSync(admin: Want, appIds: Array, accountId?: number): void; + /** + * Get appid list of bundles that can not be installed in the device. + * Only apps with the ohos.permission.ENTERPRISE_SET_BUNDLE_INSTALL_POLICY permission can call this method. + * + * @permission ohos.permission.ENTERPRISE_SET_BUNDLE_INSTALL_POLICY + * @param { Want } admin - admin indicates the enterprise admin extension ability information. + * The admin must have the corresponding permission. + * @param { number } [accountId] - accountId indicates the account ID or do not pass account ID. + * @returns { Array } ids of the bundle that can not be installed. + * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. + * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. + * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; 3. Parameter verification failed. + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @StageModelOnly + * @since 12 + */ + function getDisallowedInstallBundlesSync(admin: Want, accountId?: number): Array; + /** + * Add appid list of bundles that can not be uninstalled in the device. + * Only apps with the ohos.permission.ENTERPRISE_SET_BUNDLE_INSTALL_POLICY permission can call this method. + * + * @permission ohos.permission.ENTERPRISE_SET_BUNDLE_INSTALL_POLICY + * @param { Want } admin - admin indicates the enterprise admin extension ability information. + * The admin must have the corresponding permission. + * @param { Array } appIds - ids of the bundle that can not be uninstalled. The size of the array after + * setting cannot be greater than 200. + * @param { number } [accountId] - accountId indicates the account ID or do not pass account ID. + * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. + * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. + * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; 3. Parameter verification failed. + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @StageModelOnly + * @since 12 + */ + function addDisallowedUninstallBundlesSync(admin: Want, appIds: Array, accountId?: number): void; + /** + * Remove appid list of bundles that can not be uninstalled in the device. + * Only apps with the ohos.permission.ENTERPRISE_SET_BUNDLE_INSTALL_POLICY permission can call this method. + * + * @permission ohos.permission.ENTERPRISE_SET_BUNDLE_INSTALL_POLICY + * @param { Want } admin - admin indicates the enterprise admin extension ability information. + * The admin must have the corresponding permission. + * @param { Array } appIds - ids of the bundle that can not be uninstalled. The size of the array after + * setting cannot be greater than 200. + * @param { number } [accountId] - accountId indicates the account ID or do not pass account ID. + * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. + * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. + * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; 3. Parameter verification failed. + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @StageModelOnly + * @since 12 + */ + function removeDisallowedUninstallBundlesSync(admin: Want, appIds: Array, accountId?: number): void; + /** + * Get appid list of bundles that can not be uninstalled in the device. + * Only apps with the ohos.permission.ENTERPRISE_SET_BUNDLE_INSTALL_POLICY permission can call this method. + * + * @permission ohos.permission.ENTERPRISE_SET_BUNDLE_INSTALL_POLICY + * @param { Want } admin - admin indicates the enterprise admin extension ability information. + * The admin must have the corresponding permission. + * @param { number } [accountId] - accountId indicates the account ID or do not pass account ID. + * @returns { Array } ids of the bundle that can not be uninstalled. + * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. + * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. + * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; 3. Parameter verification failed. + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @StageModelOnly + * @since 12 + */ + function getDisallowedUninstallBundlesSync(admin: Want, accountId?: number): Array; + /** + * Uninstall an application. + * + * @permission ohos.permission.ENTERPRISE_INSTALL_BUNDLE + * @param { Want } admin - admin indicates the enterprise admin extension ability information. + * The admin must have the corresponding permission. + * @param { string } bundleName - indicates the bundle name of the application to be uninstalled. + * @param { number } [userId] - userId indicates the user ID or do not pass user ID. + * @param { boolean } [isKeepData] - isKeepData indicates whether keep the data. + * @returns { Promise } the promise of uninstalling application result. + * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. + * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. + * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; 3. Parameter verification failed. + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @StageModelOnly + * @since 12 + */ + function uninstall(admin: Want, bundleName: string, userId?: number, isKeepData?: boolean): Promise; + /** + * Install an application. + * + * @permission ohos.permission.ENTERPRISE_INSTALL_BUNDLE + * @param { Want } admin - admin indicates the enterprise admin extension ability information. + * The admin must have the corresponding permission. + * @param { Array } hapFilePaths - indicates the path of the application to be installed. + * @param { InstallParam } [installParam] - installParam indicates the installation parameters. + * It may contain two fields: userId and installFlag. + * The flag can only be one of correct flags. + * @returns { Promise } the promise of installing application result. + * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. + * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. + * @throws { BusinessError } 9201002 - Failed to install the application. + * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; 3. Parameter verification failed. + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @StageModelOnly + * @since 12 + */ + function install(admin: Want, hapFilePaths: Array, installParam?: InstallParam): Promise; +} +export default bundleManager; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.enterprise.deviceControl.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.enterprise.deviceControl.d.ts new file mode 100755 index 00000000..b22e44d2 --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.enterprise.deviceControl.d.ts @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2022-2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit MDMKit + */ + +import type Want from './@ohos.app.ability.Want'; +/** + * This module provides the capability to control the enterprise devices. + * + * @namespace deviceControl + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @since 10 + */ +declare namespace deviceControl { + /** + * Allows the administrator to operate device. + * This function can be called by a super administrator. + * + * @permission ohos.permission.ENTERPRISE_OPERATE_DEVICE + * @param { Want } admin - admin indicates the enterprise admin extension ability information. + * The admin must have the corresponding permission. + * @param { string } operate - operate indicates the operation to be performed, + * the supported device operations include lockScreen, resetFactory, reboot and shutDown. + * @param { string } [addition] - addition indicates the specify additional parameters when performing the operation. + * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. + * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. + * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; 3. Parameter verification failed. + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @stagemodelonly + * @since 12 + */ + function operateDevice(admin: Want, operate: string, addition?: string): void; +} +export default deviceControl; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.enterprise.deviceInfo.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.enterprise.deviceInfo.d.ts new file mode 100755 index 00000000..6bfe7972 --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.enterprise.deviceInfo.d.ts @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2022-2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit MDMKit + */ + +import type Want from './@ohos.app.ability.Want'; +/** + * This module provides the capability to manage the device info of the enterprise devices. + * + * @namespace deviceInfo + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @since 10 + */ +declare namespace deviceInfo { + /** + * Gets the device information. + * This function can be called by a super administrator. + * + * @permission ohos.permission.ENTERPRISE_GET_DEVICE_INFO + * @param { Want } admin - admin indicates the enterprise admin extension ability information. + * The admin must have the corresponding permission. + * @param { string } label - label indicates the specific information that needs to be queried, + * the supported device information include deviceName, deviceSerial and simInfo. + * @returns { string } the specific information of device. + * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. + * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. + * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; 3. Parameter verification failed. + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @StageModelOnly + * @since 12 + */ + function getDeviceInfo(admin: Want, label: string): string; +} +export default deviceInfo; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.enterprise.deviceSettings.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.enterprise.deviceSettings.d.ts new file mode 100755 index 00000000..f94d7843 --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.enterprise.deviceSettings.d.ts @@ -0,0 +1,74 @@ +/* + * Copyright (c) 2023-2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit MDMKit + */ + +import type Want from './@ohos.app.ability.Want'; +/** + * This module provides the capability to manage the device settings of the enterprise devices. + * + * @namespace deviceSettings + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @since 10 + */ +declare namespace deviceSettings { + /** + * Sets the device settings value. + * This function can be called by a super administrator. + * + * @permission ohos.permission.ENTERPRISE_MANAGE_SETTINGS + * @param { Want } admin - admin indicates the enterprise admin extension ability information. + * The admin must have the corresponding permission. + * @param { string } item - item indicates the device properties that need to be set, including screenOff, powerPolicy and dateTime. + * screenOff means the device screen off time, powerPolicy means the device power policy + * and dataTime means the device system time. + * @param { string } value - device settings policy. + * When the power policy is set, only timeout scenario is available now. + * When the screen off time is set, the minimum value is 15000. It is recommended that + * the time is consistent with the optional screen-off time of the device. + * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. + * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. + * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; 3. Parameter verification failed. + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @stagemodelonly + * @since 12 + */ + function setValue(admin: Want, item: string, value: string): void; + /** + * Gets the device settings value. + * This function can be called by a super administrator. + * + * @permission ohos.permission.ENTERPRISE_MANAGE_SETTINGS + * @param { Want } admin - admin indicates the enterprise admin extension ability information. + * The admin must have the corresponding permission. + * @param { string } item - item indicates the device properties that need to be get, including screenOff and powerPolicy. + * screenOff means the device screen off time, powerPolicy means the device power policy. + * @returns { string } device settings policy. + * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. + * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. + * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; 3. Parameter verification failed. + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @stagemodelonly + * @since 12 + */ + function getValue(admin: Want, item: string): string; +} +export default deviceSettings; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.enterprise.locationManager.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.enterprise.locationManager.d.ts new file mode 100755 index 00000000..4fbca0b2 --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.enterprise.locationManager.d.ts @@ -0,0 +1,100 @@ +/* + * Copyright (c) 2023-2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit MDMKit + */ +import type Want from './@ohos.app.ability.Want'; +/** + * This module provides the capability to manage the location of the enterprise devices. + * + * @namespace locationManager + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @stagemodelonly + * @since 11 + */ +declare namespace locationManager { + /** + * The location policy. + * + * @enum { number } + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @stagemodelonly + * @since 12 + */ + export enum LocationPolicy { + /** + * Default location service. + * + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @stagemodelonly + * @since 12 + */ + DEFAULT_LOCATION_SERVICE = 0, + /** + * Disallows open location service. + * + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @stagemodelonly + * @since 12 + */ + DISALLOW_LOCATION_SERVICE = 1, + /** + * Force open the location service. + * + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @stagemodelonly + * @since 12 + */ + FORCE_OPEN_LOCATION_SERVICE = 2 + } + /** + * Sets the policy of location service. + * This function can be called by a super administrator. + * + * @permission ohos.permission.ENTERPRISE_MANAGE_LOCATION + * @param { Want } admin - admin indicates the enterprise admin extension ability information. + * The admin must have the corresponding permission. + * @param { LocationPolicy } policy - the policy of location service. + * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. + * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. + * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; 3. Parameter verification failed. + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @stagemodelonly + * @since 12 + */ + function setLocationPolicy(admin: Want, policy: LocationPolicy): void; + /** + * Gets device location service policy. + * This function can be called by a super administrator. + * + * @permission ohos.permission.ENTERPRISE_MANAGE_LOCATION + * @param { Want } admin - admin indicates the enterprise admin extension ability information. + * If the admin is not empty, it must have the corresponding permission. + * @returns { LocationPolicy } the policy of location service. + * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. + * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. + * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; 3. Parameter verification failed. + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @stagemodelonly + * @since 12 + */ + function getLocationPolicy(admin: Want): LocationPolicy; +} +export default locationManager; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.enterprise.networkManager.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.enterprise.networkManager.d.ts new file mode 100755 index 00000000..8b36a26e --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.enterprise.networkManager.d.ts @@ -0,0 +1,485 @@ +/* + * Copyright (c) 2023-2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit MDMKit + */ + +import type Want from './@ohos.app.ability.Want'; +import type connection from './@ohos.net.connection'; +/** + * This module offers set network policies on the devices. + * + * @namespace networkManager + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @stagemodelonly + * @since 10 + */ +declare namespace networkManager { + /** + * Iptables rule direction. + * + * @enum { number } + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @stagemodelonly + * @since 12 + */ + enum Direction { + /** + * Input direction + * + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @stagemodelonly + * @since 12 + */ + INPUT = 0, + /** + * Output direction + * + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @stagemodelonly + * @since 12 + */ + OUTPUT = 1 + } + /** + * Iptables rule action. + * + * @enum { number } + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @stagemodelonly + * @since 12 + */ + enum Action { + /** + * Action allow + * + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @stagemodelonly + * @since 12 + */ + ALLOW = 0, + /** + * Action deny + * + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @stagemodelonly + * @since 12 + */ + DENY = 1 + } + /** + * Iptables rule protocol + * + * @enum { number } + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @stagemodelonly + * @since 12 + */ + enum Protocol { + /** + * Protocol all + * + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @stagemodelonly + * @since 12 + */ + ALL = 0, + /** + * Protocol tcp + * + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @stagemodelonly + * @since 12 + */ + TCP = 1, + /** + * Protocol udp + * + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @stagemodelonly + * @since 12 + */ + UDP = 2, + /** + * Protocol icmp + * + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @stagemodelonly + * @since 12 + */ + ICMP = 3 + } + /** + * Firewall rule + * + * @typedef FirewallRule + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @stagemodelonly + * @since 12 + */ + interface FirewallRule { + /** + * Source IP + * + * @type { ?string } + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @stagemodelonly + * @since 12 + */ + srcAddr?: string; + /** + * Destination IP + * + * @type { ?string } + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @stagemodelonly + * @since 12 + */ + destAddr?: string; + /** + * Source Port + * + * @type { ?string } + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @stagemodelonly + * @since 12 + */ + srcPort?: string; + /** + * Destination Port + * + * @type { ?string } + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @stagemodelonly + * @since 12 + */ + destPort?: string; + /** + * Application uid + * + * @type { ?string } + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @stagemodelonly + * @since 12 + */ + appUid?: string; + /** + * Direction + * + * @type { ?Direction } + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @stagemodelonly + * @since 12 + */ + direction?: Direction; + /** + * Action + * + * @type { ?Action } + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @stagemodelonly + * @since 12 + */ + action?: Action; + /** + * Protocol + * + * @type { ?Protocol } + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @stagemodelonly + * @since 12 + */ + protocol?: Protocol; + } + /** + * Domain filter rule + * + * @typedef DomainFilterRule + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @stagemodelonly + * @since 12 + */ + interface DomainFilterRule { + /** + * Domain name + * + * @type { ?string } + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @stagemodelonly + * @since 12 + */ + domainName?: string; + /** + * Application uid + * + * @type { ?string } + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @stagemodelonly + * @since 12 + */ + appUid?: string; + /** + * action + * + * @type { ?Action } + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @stagemodelonly + * @since 12 + */ + action?: Action; + } + /** + * Gets all the network interfaces of the device. + * This function can be called by a super administrator. + * + * @permission ohos.permission.ENTERPRISE_MANAGE_NETWORK + * @param { Want } admin - admin indicates the enterprise admin extension ability information. + * The admin must have the corresponding permission. + * @returns { Array } all the network interfaces of the device. + * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. + * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. + * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; 3. Parameter verification failed. + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @stagemodelonly + * @since 12 + */ + function getAllNetworkInterfacesSync(admin: Want): Array; + /** + * Gets the ip address of the network interface. + * This function can be called by a super administrator. + * + * @permission ohos.permission.ENTERPRISE_MANAGE_NETWORK + * @param { Want } admin - admin indicates the enterprise admin extension ability information. + * The admin must have the corresponding permission. + * @param { string } networkInterface - the ip address of the network interface. + * @returns { string } the promise returned by getIpAddress. + * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. + * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. + * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; 3. Parameter verification failed. + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @stagemodelonly + * @since 12 + */ + function getIpAddressSync(admin: Want, networkInterface: string): string; + /** + * Gets the mac address of the network interface. + * This function can be called by a super administrator. + * + * @permission ohos.permission.ENTERPRISE_MANAGE_NETWORK + * @param { Want } admin - admin indicates the enterprise admin extension ability information. + * The admin must have the corresponding permission. + * @param { string } networkInterface - networkInterface indicates the network interface to get mac address. + * @returns { string } the mac address of the network interface. + * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. + * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. + * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; 3. Parameter verification failed. + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @stagemodelonly + * @since 12 + */ + function getMacSync(admin: Want, networkInterface: string): string; + /** + * Gets state of whether the network interface is disabled. + * This function can be called by a super administrator. + * + * @permission ohos.permission.ENTERPRISE_MANAGE_NETWORK + * @param { Want } admin - admin indicates the enterprise admin extension ability information. + * The admin must have the corresponding permission. + * @param { string } networkInterface - networkInterface indicates the network interface to get status. + * @returns { boolean } true if disable the network interfaces, otherwise false. + * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. + * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. + * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; 3. Parameter verification failed. + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @stagemodelonly + * @since 12 + */ + function isNetworkInterfaceDisabledSync(admin: Want, networkInterface: string): boolean; + /** + * Disables the network interfaces. + * This function can be called by a super administrator. + * + * @permission ohos.permission.ENTERPRISE_MANAGE_NETWORK + * @param { Want } admin - admin indicates the enterprise admin extension ability information. + * The admin must have the corresponding permission. + * @param { string } networkInterface - networkInterface indicates the network interface to set status. + * @param { boolean } isDisabled - True if disable the network interfaces, otherwise false. + * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. + * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. + * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; 3. Parameter verification failed. + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @stagemodelonly + * @since 12 + */ + function setNetworkInterfaceDisabledSync(admin: Want, networkInterface: string, isDisabled: boolean): void; + /** + * Set a network independent global {@link connection.HttpProxy} proxy. + * This function can be called by a super administrator. + * + * @permission ohos.permission.ENTERPRISE_MANAGE_NETWORK + * @param { Want } admin - admin indicates the enterprise admin extension ability information. + * The admin must have the corresponding permission. + * @param { connection.HttpProxy } httpProxy - network global proxy configuration information. + * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. + * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. + * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; 3. Parameter verification failed. + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @stagemodelonly + * @since 12 + */ + function setGlobalProxySync(admin: Want, httpProxy: connection.HttpProxy): void; + /** + * Obtains the network independent global {@link connection.HttpProxy} proxy. + * This function can be called by a super administrator. + * + * @permission ohos.permission.ENTERPRISE_MANAGE_NETWORK + * @param { Want } admin - admin indicates the administrator ability information.If the admin is not empty, it must + * have the corresponding permission. + * @returns { connection.HttpProxy } the network global proxy configuration information. + * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. + * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. + * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; 3. Parameter verification failed. + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @stagemodelonly + * @since 12 + */ + function getGlobalProxySync(admin: Want): connection.HttpProxy; + /** + * Adds firewall rule by {@link Firewall}. + * This function can be called by a super administrator. + * + * @permission ohos.permission.ENTERPRISE_MANAGE_NETWORK + * @param { Want } admin - admin indicates the enterprise admin extension ability information. + * The admin must have the corresponding permission. + * @param { FirewallRule } firewallRule - firewall rule that needs to be added. + * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. + * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. + * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; 3. Parameter verification failed. + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @stagemodelonly + * @since 12 + */ + function addFirewallRule(admin: Want, firewallRule: FirewallRule): void; + /** + * Removes firewall rule by {@link Firewall}. + * This function can be called by a super administrator. + * + * @permission ohos.permission.ENTERPRISE_MANAGE_NETWORK + * @param { Want } admin - admin indicates the enterprise admin extension ability information. + * The admin must have the corresponding permission. + * @param { FirewallRule } firewallRule - matching rule used to remove firewall rule. + * if firewallRule or firewallRule#direction,firewallRule#action is empty, multiple firewall rule can be removed. + * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. + * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. + * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; 3. Parameter verification failed. + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @stagemodelonly + * @since 12 + */ + function removeFirewallRule(admin: Want, firewallRule?: FirewallRule): void; + /** + * Gets all firewall rules, Contains the rules added by {@link addFirewallRule} and {@link addIptablesFilterRule}. + * This function can be called by a super administrator. + * + * @permission ohos.permission.ENTERPRISE_MANAGE_NETWORK + * @param { Want } admin - admin indicates the enterprise admin extension ability information. + * The admin must have the corresponding permission. + * @returns { Array } an array of added firewall rules. + * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. + * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. + * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; 3. Parameter verification failed. + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @stagemodelonly + * @since 12 + */ + function getFirewallRules(admin: Want): Array; + /** + * Adds domain filter rule by {@link DomainFilterRule}. + * This function can be called by a super administrator. + * + * @permission ohos.permission.ENTERPRISE_MANAGE_NETWORK + * @param { Want } admin - admin indicates the enterprise admin extension ability information. + * The admin must have the corresponding permission. + * @param { DomainFilterRule } domainFilterRule - domain filter rule that needs to be added. + * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. + * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. + * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; 3. Parameter verification failed. + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @stagemodelonly + * @since 12 + */ + function addDomainFilterRule(admin: Want, domainFilterRule: DomainFilterRule): void; + /** + * Removes domain filter rule by {@link DomainFilterRule}. + * This function can be called by a super administrator. + * + * @permission ohos.permission.ENTERPRISE_MANAGE_NETWORK + * @param { Want } admin - admin indicates the enterprise admin extension ability information. + * The admin must have the corresponding permission. + * @param { DomainFilterRule } domainFilterRule - matching rule used to remove domain filter rule. + * if domainFilterRule or domainFilterRule#action is empty, multiple domain filter rule can be removed. + * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. + * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. + * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; 3. Parameter verification failed. + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @stagemodelonly + * @since 12 + */ + function removeDomainFilterRule(admin: Want, domainFilterRule?: DomainFilterRule): void; + /** + * Gets all domain filter rules, Contains the rules added by {@link addDomainFilterRule}. + * This function can be called by a super administrator. + * + * @permission ohos.permission.ENTERPRISE_MANAGE_NETWORK + * @param { Want } admin - admin indicates the enterprise admin extension ability information. + * The admin must have the corresponding permission. + * @returns { Array } an array of added domain filter rules. + * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. + * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. + * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; 3. Parameter verification failed. + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @stagemodelonly + * @since 12 + */ + function getDomainFilterRules(admin: Want): Array; +} +export default networkManager; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.enterprise.restrictions.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.enterprise.restrictions.d.ts new file mode 100755 index 00000000..dc05c29a --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.enterprise.restrictions.d.ts @@ -0,0 +1,68 @@ +/* + * Copyright (c) 2023-2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit MDMKit + */ + +import type Want from './@ohos.app.ability.Want'; +/** + * This module provides the capability to manage restriction policy of the enterprise devices. + * + * @namespace restrictions + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @since 10 + */ +declare namespace restrictions { + /** + * Disallows the specific feature of the device. + * + * @permission ohos.permission.ENTERPRISE_MANAGE_RESTRICTIONS + * @param { Want } admin - admin indicates the enterprise admin extension ability information. + * The admin must have the corresponding permission. + * @param { string } feature - feature indicates the specific feature to be disallowed or allowed, + * the supported device features include modifyDateTime, bluetooth, printer, hdc, microphone, fingerprint, usb and wifi. + * @param { boolean } disallow - true if disallow the specific feature of device, otherwise false. + * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. + * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. + * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; 3. Parameter verification failed. + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @stagemodelonly + * @since 12 + */ + function setDisallowedPolicy(admin: Want, feature: string, disallow: boolean): void; + /** + * Queries whether the specific feature of the device is disallowed. + * + * @permission ohos.permission.ENTERPRISE_MANAGE_RESTRICTIONS + * @param { Want } admin - admin indicates the enterprise admin extension ability information. + * If the admin is not empty, it must have the corresponding permission. + * @param { string } feature - feature indicates the specific feature to be queried, + * the supported device features include modifyDateTime, bluetooth, printer, hdc, microphone, fingerprint, usb and wifi. + * @returns { boolean } true if the specific feature of device is disallowed, otherwise false. + * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. + * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. + * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; 3. Parameter verification failed. + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @stagemodelonly + * @since 12 + */ + function getDisallowedPolicy(admin: Want, feature: string): boolean; +} +export default restrictions; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.enterprise.securityManager.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.enterprise.securityManager.d.ts new file mode 100755 index 00000000..8c2a07ba --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.enterprise.securityManager.d.ts @@ -0,0 +1,189 @@ +/* + * Copyright (c) 2023-2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit MDMKit + */ +import type Want from './@ohos.app.ability.Want'; +/** + * This module provides the capability to manage the security of the enterprise devices. + * + * @namespace securityManager + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @stagemodelonly + * @since 11 + */ +declare namespace securityManager { + /** + * User certificate data. + * + * @typedef CertBlob + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @stagemodelonly + * @since 12 + */ + export interface CertBlob { + /** + * The certificate content + * + * @type { Uint8Array } + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @stagemodelonly + * @since 12 + */ + inData: Uint8Array; + /** + * The certificate alias + * + * @type { string } + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @stagemodelonly + * @since 12 + */ + alias: string; + } + /** + * Gets device security policy of the specific type. + * This function can be called by a super administrator. + * + * @permission ohos.permission.ENTERPRISE_MANAGE_SECURITY + * @param { Want } admin - admin indicates the enterprise admin extension ability information. + * The admin must have the corresponding permission. + * @param { string } item - item indicates the specified security policy that needs to be obtained, including patch and encryption. + * patch means the device security patch tag, and encryption means the device encryption status. + * @returns { string } security policy of the specific type. + * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. + * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. + * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; 3. Parameter verification failed. + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @stagemodelonly + * @since 12 + */ + function getSecurityStatus(admin: Want, item: string): string; + /** + * Install user certificate. + * This function can be called by a super administrator. + * + * @permission ohos.permission.ENTERPRISE_MANAGE_CERTIFICATE + * @param { Want } admin - admin indicates the enterprise admin extension ability information. + * The admin must have the corresponding permission. + * @param { CertBlob } certificate - certificate file content and alias. It cannot be empty or more than 40 characters. + * @returns { Promise } the promise carries the uri of the certificate used to uninstall + * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. + * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. + * @throws { BusinessError } 9201001 - Failed to manage the certificate. + * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; 3. Parameter verification failed. + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @stagemodelonly + * @since 12 + */ + function installUserCertificate(admin: Want, certificate: CertBlob): Promise; + /** + * Uninstall user certificate. + * This function can be called by a super administrator. + * + * @permission ohos.permission.ENTERPRISE_MANAGE_CERTIFICATE + * @param { Want } admin - admin indicates the enterprise admin extension ability information. + * The admin must have the corresponding permission. + * @param { string } certUri - uri of the certificate. It cannot be empty or more than 64 characters. + * @returns { Promise } the promise returned by the uninstallUserCertificate. + * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. + * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. + * @throws { BusinessError } 9201001 - Failed to manage the certificate. + * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; 3. Parameter verification failed. + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @stagemodelonly + * @since 12 + */ + function uninstallUserCertificate(admin: Want, certUri: string): Promise; + /** + * Sets the password policy of the device. + * + * @permission ohos.permission.ENTERPRISE_MANAGE_SECURITY + * @param { Want } admin - admin indicates the enterprise admin extension ability information. + * The admin must have the corresponding permission. + * @param { PasswordPolicy } policy - password policy to be set. + * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. + * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. + * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; 3. Parameter verification failed. + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @stagemodelonly + * @since 12 + */ + function setPasswordPolicy(admin: Want, policy: PasswordPolicy): void; + /** + * Gets the password policy of the device. + * + * @permission ohos.permission.ENTERPRISE_MANAGE_SECURITY + * @param { Want } admin - admin indicates the enterprise admin extension ability information. + * The admin must have the corresponding permission. + * @returns { PasswordPolicy } policy - the password policy of the device. + * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. + * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. + * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; 3. Parameter verification failed. + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @stagemodelonly + * @since 12 + */ + function getPasswordPolicy(admin: Want): PasswordPolicy; + /** + * Password policy. + * + * @typedef PasswordPolicy + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @stagemodelonly + * @since 12 + */ + export interface PasswordPolicy { + /** + * The regex of complexity + * + * @type { ?string } + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @stagemodelonly + * @since 12 + */ + complexityRegex?: string; + /** + * Period of validity + * + * @type { ?number } + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @stagemodelonly + * @since 12 + */ + validityPeriod?: number; + /** + * Other supplementary description + * + * @type { ?string } + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @stagemodelonly + * @since 12 + */ + additionalDescription?: string; + } +} +export default securityManager; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.enterprise.systemManager.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.enterprise.systemManager.d.ts new file mode 100755 index 00000000..c836b5e6 --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.enterprise.systemManager.d.ts @@ -0,0 +1,103 @@ +/* + * Copyright (c) 2023-2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit MDMKit + */ +import type Want from './@ohos.app.ability.Want'; +/** + * This module provides the capability to manage the system of the enterprise devices. + * + * @namespace systemManager + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @stagemodelonly + * @since 12 + */ +declare namespace systemManager { + /** + * The device system update info. + * + * @typedef SystemUpdateInfo + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @stagemodelonly + * @since 12 + */ + export interface SystemUpdateInfo { + /** + * The name of version need to update. + * + * @type { string } + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @stagemodelonly + * @since 12 + */ + versionName: string; + /** + * The time when the version first received. + * + * @type { number } + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @stagemodelonly + * @since 12 + */ + firstReceivedTime: number; + /** + * The type of version package. + * + * @type { string } + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @stagemodelonly + * @since 12 + */ + packageType: string; + } + /** + * Sets NTP server. + * This function can be called by a super administrator. + * + * @permission ohos.permission.ENTERPRISE_MANAGE_SYSTEM + * @param { Want } admin - admin indicates the enterprise admin extension ability information. + * The admin must have the corresponding permission. + * @param { string } server - the address of NTP server. + * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. + * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. + * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; 3. Parameter verification failed. + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @stagemodelonly + * @since 12 + */ + function setNTPServer(admin: Want, server: string): void; + /** + * Gets NTP server. + * This function can be called by a super administrator. + * + * @permission ohos.permission.ENTERPRISE_MANAGE_SYSTEM + * @param { Want } admin - admin indicates the enterprise admin extension ability information. + * The admin must have the corresponding permission. + * @returns { string } the address of NTP server. + * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. + * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. + * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; 3. Parameter verification failed. + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @stagemodelonly + * @since 12 + */ + function getNTPServer(admin: Want): string; +} +export default systemManager; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.enterprise.usbManager.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.enterprise.usbManager.d.ts new file mode 100755 index 00000000..651d0534 --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.enterprise.usbManager.d.ts @@ -0,0 +1,186 @@ +/* + * Copyright (c) 2023-2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit MDMKit + */ + +import type Want from './@ohos.app.ability.Want'; +/** + * This module provides the capability to manage the usb of the enterprise devices. + * + * @namespace usbManager + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @since 10 + */ +declare namespace usbManager { + /** + * Usb policy + * + * @enum { number } + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @stagemodelonly + * @since 12 + */ + export enum UsbPolicy { + /** + * Policy read write + * + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @stagemodelonly + * @since 12 + */ + READ_WRITE = 0, + /** + * Policy read only + * + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @stagemodelonly + * @since 12 + */ + READ_ONLY = 1, + /** + * Policy disabled + * + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @stagemodelonly + * @since 12 + */ + DISABLED = 2 + } + /** + * USB device ID. + * + * @typedef UsbDeviceId + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @stagemodelonly + * @since 12 + */ + export interface UsbDeviceId { + /** + * The vendor ID of the USB device. + * + * @type { number } + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @stagemodelonly + * @since 12 + */ + vendorId: number; + /** + * The product ID of the USB device. + * + * @type { number } + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @stagemodelonly + * @since 12 + */ + productId: number; + } + /** + * Adds the available USB device trust list by {@link UsbDeviceId} array. + * This function can be called by a super administrator. + * + * @permission ohos.permission.ENTERPRISE_MANAGE_USB + * @param { Want } admin - admin indicates the enterprise admin extension ability information. + * The admin must have the corresponding permission. + * @param { Array } usbDeviceIds - an array of added USB device ids. + * The size of the array after setting cannot be greater 1000. + * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. + * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. + * @throws { BusinessError } 9200010 - A conflict policy has been configured. + * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; 3. Parameter verification failed. + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @stagemodelonly + * @since 12 + */ + function addAllowedUsbDevices(admin: Want, usbDeviceIds: Array): void; + /** + * Removes the available USB device trust list by {@link UsbDeviceId} array. + * This function can be called by a super administrator. + * + * @permission ohos.permission.ENTERPRISE_MANAGE_USB + * @param { Want } admin - admin indicates the enterprise admin extension ability information. + * The admin must have the corresponding permission. + * @param { Array } usbDeviceIds - an array of removed USB device ids. + * The size of the array after setting cannot be greater 1000. + * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. + * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. + * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; 3. Parameter verification failed. + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @stagemodelonly + * @since 12 + */ + function removeAllowedUsbDevices(admin: Want, usbDeviceIds: Array): void; + /** + * Gets the available USB device trust list. + * This function can be called by a super administrator. + * + * @permission ohos.permission.ENTERPRISE_MANAGE_USB + * @param { Want } admin - admin indicates the enterprise admin extension ability information. + * The admin must have the corresponding permission. + * @returns { Array } an array of the available USB device trust list. + * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. + * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. + * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; 3. Parameter verification failed. + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @stagemodelonly + * @since 12 + */ + function getAllowedUsbDevices(admin: Want): Array; + /** + * Sets USB storage device access policy by {@link UsbPolicy}. + * This function can be called by a super administrator. + * + * @permission ohos.permission.ENTERPRISE_MANAGE_USB + * @param { Want } admin - admin indicates the enterprise admin extension ability information. + * The admin must have the corresponding permission. + * @param { UsbPolicy } usbPolicy - USB policy of storage device. + * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. + * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. + * @throws { BusinessError } 9200010 - A conflict policy has been configured. + * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; 3. Parameter verification failed. + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @stagemodelonly + * @since 12 + */ + function setUsbStorageDeviceAccessPolicy(admin: Want, usbPolicy: UsbPolicy): void; + /** + * Gets USB storage device access policy. + * This function can be called by a super administrator. + * + * @permission ohos.permission.ENTERPRISE_MANAGE_USB + * @param { Want } admin - admin indicates the enterprise admin extension ability information. + * The admin must have the corresponding permission. + * @returns { UsbPolicy } USB policy of storage device. + * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. + * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. + * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; 3. Parameter verification failed. + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @stagemodelonly + * @since 12 + */ + function getUsbStorageDeviceAccessPolicy(admin: Want): UsbPolicy; +} +export default usbManager; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.enterprise.wifiManager.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.enterprise.wifiManager.d.ts new file mode 100755 index 00000000..da755d4a --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.enterprise.wifiManager.d.ts @@ -0,0 +1,673 @@ +/* + * Copyright (c) 2023-2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit MDMKit + */ + +import type Want from './@ohos.app.ability.Want'; +/** + * This module offers set wifi policies on the devices. + * + * @namespace wifiManager + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @stagemodelonly + * @since 10 + */ +declare namespace wifiManager { + /** + * Describes the wifi security type. + * + * @enum { number } + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @stagemodelonly + * @since 12 + */ + enum WifiSecurityType { + /** + * Invalid security type + * + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @stagemodelonly + * @since 12 + */ + WIFI_SEC_TYPE_INVALID = 0, + /** + * Open + * + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @stagemodelonly + * @since 12 + */ + WIFI_SEC_TYPE_OPEN = 1, + /** + * Wired Equivalent Privacy (WEP) + * + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @stagemodelonly + * @since 12 + */ + WIFI_SEC_TYPE_WEP = 2, + /** + * Pre-shared key (PSK) + * + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @stagemodelonly + * @since 12 + */ + WIFI_SEC_TYPE_PSK = 3, + /** + * Simultaneous Authentication of Equals (SAE) + * + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @stagemodelonly + * @since 12 + */ + WIFI_SEC_TYPE_SAE = 4, + /** + * EAP authentication. + * + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @stagemodelonly + * @since 12 + */ + WIFI_SEC_TYPE_EAP = 5, + /** + * SUITE_B_192 192 bit level. + * + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @stagemodelonly + * @since 12 + */ + WIFI_SEC_TYPE_EAP_SUITE_B = 6, + /** + * Opportunistic Wireless Encryption. + * + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @stagemodelonly + * @since 12 + */ + WIFI_SEC_TYPE_OWE = 7, + /** + * WAPI certificate to be specified. + * + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @stagemodelonly + * @since 12 + */ + WIFI_SEC_TYPE_WAPI_CERT = 8, + /** + * WAPI pre-shared key to be specified. + * + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @stagemodelonly + * @since 12 + */ + WIFI_SEC_TYPE_WAPI_PSK = 9 + } + /** + * Wi-Fi IP type enumeration. + * + * @enum { number } + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @stagemodelonly + * @since 12 + */ + enum IpType { + /** + * Use statically configured IP settings + * + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @stagemodelonly + * @since 12 + */ + STATIC, + /** + * Use dynamically configured IP settings + * + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @stagemodelonly + * @since 12 + */ + DHCP, + /** + * No IP details are assigned + * + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @stagemodelonly + * @since 12 + */ + UNKNOWN + } + /** + * Wi-Fi IP profile. + * + * @typedef IpProfile + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @stagemodelonly + * @since 12 + */ + interface IpProfile { + /** + * The ip address + * + * @type { number } + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @stagemodelonly + * @since 12 + */ + ipAddress: number; + /** + * The gateway + * + * @type { number } + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @stagemodelonly + * @since 12 + */ + gateway: number; + /** + * The length of prefix + * + * @type { number } + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @stagemodelonly + * @since 12 + */ + prefixLength: number; + /** + * The DNS services + * + * @type { number[] } + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @stagemodelonly + * @since 12 + */ + dnsServers: number[]; + /** + * The domains + * + * @type { Array } + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @stagemodelonly + * @since 12 + */ + domains: Array; + } + /** + * Wi-Fi EAP method. + * + * @enum { number } + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @stagemodelonly + * @since 12 + */ + enum EapMethod { + /** + * Not specified + * + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @stagemodelonly + * @since 12 + */ + EAP_NONE, + /** + * Protected extensible authentication protocol + * + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @stagemodelonly + * @since 12 + */ + EAP_PEAP, + /** + * Transport layer security + * + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @stagemodelonly + * @since 12 + */ + EAP_TLS, + /** + * Tunneled transport layer security + * + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @stagemodelonly + * @since 12 + */ + EAP_TTLS, + /** + * Password + * + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @stagemodelonly + * @since 12 + */ + EAP_PWD, + /** + * Subscriber identity module + * + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @stagemodelonly + * @since 12 + */ + EAP_SIM, + /** + * Authentication and key agreement + * + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @stagemodelonly + * @since 12 + */ + EAP_AKA, + /** + * AKA prime + * + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @stagemodelonly + * @since 12 + */ + EAP_AKA_PRIME, + /** + * Unauth TLS + * + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @stagemodelonly + * @since 12 + */ + EAP_UNAUTH_TLS + } + /** + * Wi-Fi phase 2 method. + * + * @enum { number } + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @stagemodelonly + * @since 12 + */ + enum Phase2Method { + /** + * Not specified + * + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @stagemodelonly + * @since 12 + */ + PHASE2_NONE, + /** + * Password authentication protocol + * + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @stagemodelonly + * @since 12 + */ + PHASE2_PAP, + /** + * Microsoft challenge handshake authentication protocol + * + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @stagemodelonly + * @since 12 + */ + PHASE2_MSCHAP, + /** + * Microsoft challenge handshake authentication protocol version 2 + * + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @stagemodelonly + * @since 12 + */ + PHASE2_MSCHAPV2, + /** + * Generic token card + * + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @stagemodelonly + * @since 12 + */ + PHASE2_GTC, + /** + * Subscriber identity module + * + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @stagemodelonly + * @since 12 + */ + PHASE2_SIM, + /** + * Authentication and key agreement + * + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @stagemodelonly + * @since 12 + */ + PHASE2_AKA, + /** + * AKA Prime + * + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @stagemodelonly + * @since 12 + */ + PHASE2_AKA_PRIME + } + /** + * Wi-Fi EAP profile. + * + * @typedef WifiEapProfile + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @stagemodelonly + * @since 12 + */ + interface WifiEapProfile { + /** + * EAP authentication method + * + * @type { EapMethod } + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @stagemodelonly + * @since 12 + */ + eapMethod: EapMethod; + /** + * Phase 2 authentication method + * + * @type { Phase2Method } + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @stagemodelonly + * @since 12 + */ + phase2Method: Phase2Method; + /** + * The identity + * + * @type { string } + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @stagemodelonly + * @since 12 + */ + identity: string; + /** + * Anonymous identity + * + * @type { string } + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @stagemodelonly + * @since 12 + */ + anonymousIdentity: string; + /** + * Password + * + * @type { string } + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @stagemodelonly + * @since 12 + */ + password: string; + /** + * CA certificate alias + * + * @type { string } + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @stagemodelonly + * @since 12 + */ + caCertAliases: string; + /** + * CA certificate path + * + * @type { string } + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @stagemodelonly + * @since 12 + */ + caPath: string; + /** + * Client certificate alias + * + * @type { string } + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @stagemodelonly + * @since 12 + */ + clientCertAliases: string; + /** + * content of user's certificate + * + * @type { Uint8Array } + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @stagemodelonly + * @since 12 + */ + certEntry: Uint8Array; + /** + * Password of user's certificate + * + * @type { string } + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @stagemodelonly + * @since 12 + */ + certPassword: string; + /** + * Alternate subject match + * + * @type { string } + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @stagemodelonly + * @since 12 + */ + altSubjectMatch: string; + /** + * Domain suffix match + * + * @type { string } + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @stagemodelonly + * @since 12 + */ + domainSuffixMatch: string; + /** + * Realm for Passpoint credential + * + * @type { string } + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @stagemodelonly + * @since 12 + */ + realm: string; + /** + * Public Land Mobile Network of the provider of Passpoint credential + * + * @type { string } + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @stagemodelonly + * @since 12 + */ + plmn: string; + /** + * Sub ID of the SIM card + * + * @type { number } + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @stagemodelonly + * @since 12 + */ + eapSubId: number; + } + /** + * Wi-Fi profile. + * + * @typedef WifiProfile + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @stagemodelonly + * @since 12 + */ + interface WifiProfile { + /** + * Wi-Fi SSID: the maximum length is 32 + * + * @type { string } + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @stagemodelonly + * @since 12 + */ + ssid: string; + /** + * Wi-Fi bssid(MAC): the length is 6 + * + * @type { ?string } + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @stagemodelonly + * @since 12 + */ + bssid?: string; + /** + * Wi-Fi key: maximum length is 64 + * + * @type { string } + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @stagemodelonly + * @since 12 + */ + preSharedKey: string; + /** + * Hide SSID or not, false(default): not hide + * + * @type { ?boolean } + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @stagemodelonly + * @since 12 + */ + isHiddenSsid?: boolean; + /** + * Security type: reference definition of WifiSecurityType + * + * @type { WifiSecurityType } + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @stagemodelonly + * @since 12 + */ + securityType: WifiSecurityType; + /** + * The UID of the Wi-Fi profile creator + * + * @type { ?number } + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @stagemodelonly + * @since 12 + */ + creatorUid?: number; + /** + * Disable reason + * + * @type { ?number } + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @stagemodelonly + * @since 12 + */ + disableReason?: number; + /** + * Allocated networkId + * + * @type { ?number } + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @stagemodelonly + * @since 12 + */ + netId?: number; + /** + * Random mac type + * + * @type { ?number } + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @stagemodelonly + * @since 12 + */ + randomMacType?: number; + /** + * Random mac address, the length is 6 + * + * @type { ?string } + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @stagemodelonly + * @since 12 + */ + randomMacAddr?: string; + /** + * IP Type + * + * @type { ?IpType } + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @stagemodelonly + * @since 12 + */ + ipType?: IpType; + /** + * IP profile of static + * + * @type { ?IpProfile } + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @stagemodelonly + * @since 12 + */ + staticIp?: IpProfile; + /** + * EAP profile info. + * + * @type { ?WifiEapProfile } + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @stagemodelonly + * @since 12 + */ + eapProfile?: WifiEapProfile; + } + /** + * Gets state of whether the Wi-Fi is active. + * This function can be called by a super administrator. + * + * @permission ohos.permission.ENTERPRISE_MANAGE_WIFI + * @param { Want } admin - admin indicates the enterprise admin extension ability information. + * The admin must have the corresponding permission. + * @returns { boolean } true if Wi-Fi is active. + * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. + * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. + * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; 3. Parameter verification failed. + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @stagemodelonly + * @since 12 + */ + function isWifiActiveSync(admin: Want): boolean; + /** + * Sets the Wi-Fi profile. + * + * @permission ohos.permission.ENTERPRISE_MANAGE_WIFI + * @param { Want } admin - admin indicates the enterprise admin extension ability information. + * The admin must have the corresponding permission. + * @param { WifiProfile } profile - profile indicates the profile of Wi-Fi. + * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. + * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. + * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameter types; 3. Parameter verification failed. + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @stagemodelonly + * @since 12 + */ + function setWifiProfileSync(admin: Want, profile: WifiProfile): void; +} +export default wifiManager; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.events.emitter.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.events.emitter.d.ts new file mode 100755 index 00000000..50440b7e --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.events.emitter.d.ts @@ -0,0 +1,381 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit BasicServicesKit + */ +import { Callback } from './@ohos.base'; +/** + * Provides methods for sending and processing in-process events. + * + * @namespace emitter + * @syscap SystemCapability.Notification.Emitter + * @since 7 + */ +/** + * Provides methods for sending and processing in-process events. + * + * @namespace emitter + * @syscap SystemCapability.Notification.Emitter + * @atomicservice + * @since 11 + */ +declare namespace emitter { + /** + * Subscribe to a certain event in persistent manner and receives the event callback. + * + * @param { InnerEvent } event - indicate event to subscribe to. + * @param { Callback } callback - indicate callback used to receive the event. + * @syscap SystemCapability.Notification.Emitter + * @since 7 + */ + /** + * Subscribe to a certain event in persistent manner and receives the event callback. + * + * @param { InnerEvent } event - indicate event to subscribe to. + * @param { Callback } callback - indicate callback used to receive the event. + * @syscap SystemCapability.Notification.Emitter + * @atomicservice + * @since 11 + */ + function on(event: InnerEvent, callback: Callback): void; + /** + * Subscribe to a event by specific id in persistent manner and receives the event callback. + * + * @param { string } eventId - indicate ID of the event to subscribe to. + * @param { Callback } callback - indicate callback used to receive the event. + * @syscap SystemCapability.Notification.Emitter + * @atomicservice + * @since 11 + */ + function on(eventId: string, callback: Callback): void; + /** + * Subscribe to a certain event in one-shot manner and unsubscribe from it + * after the event callback is received. + * + * @param { InnerEvent } event - indicate event to subscribe to in one shot. + * @param { Callback } callback - indicate callback used to receive the event. + * @syscap SystemCapability.Notification.Emitter + * @since 7 + */ + /** + * Subscribe to a certain event in one-shot manner and unsubscribe from it + * after the event callback is received. + * + * @param { InnerEvent } event - indicate event to subscribe to in one shot. + * @param { Callback } callback - indicate callback used to receive the event. + * @syscap SystemCapability.Notification.Emitter + * @atomicservice + * @since 11 + */ + function once(event: InnerEvent, callback: Callback): void; + /** + * Subscribe to a event by specific id in one-shot manner and unsubscribe from it + * after the event callback is received. + * + * @param { string } eventId - indicate ID of the event to subscribe to in one shot. + * @param { Callback } callback - indicate callback used to receive the event. + * @syscap SystemCapability.Notification.Emitter + * @atomicservice + * @since 11 + */ + function once(eventId: string, callback: Callback): void; + /** + * Unsubscribe from an event. + * + * @param { number } eventId - indicate ID of the event to unsubscribe from. + * @syscap SystemCapability.Notification.Emitter + * @since 7 + */ + /** + * Unsubscribe from an event. + * + * @param { number } eventId - indicate ID of the event to unsubscribe from. + * @syscap SystemCapability.Notification.Emitter + * @atomicservice + * @since 11 + */ + function off(eventId: number): void; + /** + * Unsubscribe from an event. + * + * @param { string } eventId - indicate ID of the event to unsubscribe from. + * @syscap SystemCapability.Notification.Emitter + * @atomicservice + * @since 11 + */ + function off(eventId: string): void; + /** + * Unsubscribe from an event. + * + * @param { number } eventId - indicates ID of the event to unsubscribe from. + * @param { Callback } callback - indicates callback used to receive the event. + * @syscap SystemCapability.Notification.Emitter + * @since 10 + */ + /** + * Unsubscribe from an event. + * + * @param { number } eventId - indicates ID of the event to unsubscribe from. + * @param { Callback } callback - indicates callback used to receive the event. + * @syscap SystemCapability.Notification.Emitter + * @atomicservice + * @since 11 + */ + function off(eventId: number, callback: Callback): void; + /** + * Unsubscribe from an event. + * + * @param { string } eventId - indicates ID of the event to unsubscribe from. + * @param { Callback } callback - indicates callback used to receive the event. + * @syscap SystemCapability.Notification.Emitter + * @atomicservice + * @since 11 + */ + function off(eventId: string, callback: Callback): void; + /** + * Emits an event to the event queue. + * + * @param { InnerEvent } event - indicate event to emit. + * @param { EventData } [data] - indicate data carried by the event. + * @syscap SystemCapability.Notification.Emitter + * @since 7 + */ + /** + * Emits an event to the event queue. + * + * @param { InnerEvent } event - indicate event to emit. + * @param { EventData } [data] - indicate data carried by the event. + * @syscap SystemCapability.Notification.Emitter + * @atomicservice + * @since 11 + */ + function emit(event: InnerEvent, data?: EventData): void; + /** + * Emits an event by specific id to the event queue. + * + * @param { string } eventId - indicate ID of the event to emit. + * @param { EventData } [data] - indicate data carried by the event. + * @syscap SystemCapability.Notification.Emitter + * @atomicservice + * @since 11 + */ + function emit(eventId: string, data?: EventData): void; + /** + * Emits an event by specific id to the event queue. + * + * @param { string } eventId - indicate ID of the event to emit. + * @param { Options } options - Indicates the {@link Options} option of the emit priority of the event. + * @param { EventData } [data] - indicate data carried by the event. + * @syscap SystemCapability.Notification.Emitter + * @atomicservice + * @since 11 + */ + function emit(eventId: string, options: Options, data?: EventData): void; + /** + * Obtains the number of subscribe listener count. + * + * @param { number | string } eventId - indicates ID of the event to unsubscribe from. + * @returns { number } Returns the number of listener count. + * @syscap SystemCapability.Notification.Emitter + * @atomicservice + * @since 11 + */ + function getListenerCount(eventId: number | string): number; + /** + * Describes data passed in the event. + * + * @typedef EventData + * @syscap SystemCapability.Notification.Emitter + * @since 7 + */ + /** + * Describes data passed in the event. + * + * @typedef EventData + * @syscap SystemCapability.Notification.Emitter + * @atomicservice + * @since 11 + */ + export interface EventData { + /** + * Data carried by the event. + * + * @type { ?object } + * @syscap SystemCapability.Notification.Emitter + * @since 7 + */ + /** + * Data carried by the event. + * + * @type { ?object } + * @syscap SystemCapability.Notification.Emitter + * @atomicservice + * @since 11 + */ + data?: { + [key: string]: any; + }; + } + /** + * Describes an intra-process event. + * + * @typedef InnerEvent + * @syscap SystemCapability.Notification.Emitter + * @since 7 + */ + /** + * Describes an intra-process event. + * + * @typedef InnerEvent + * @syscap SystemCapability.Notification.Emitter + * @atomicservice + * @since 11 + */ + export interface InnerEvent { + /** + * Event ID, which is used to identify an event. + * + * @type { number } + * @syscap SystemCapability.Notification.Emitter + * @since 7 + */ + /** + * Event ID, which is used to identify an event. + * + * @type { number } + * @syscap SystemCapability.Notification.Emitter + * @atomicservice + * @since 11 + */ + eventId: number; + /** + * Emit priority of the event. The default priority is {@link EventPriority.LOW}. + * + * @type { ?EventPriority } + * @syscap SystemCapability.Notification.Emitter + * @since 7 + */ + /** + * Emit priority of the event. The default priority is {@link EventPriority.LOW}. + * + * @type { ?EventPriority } + * @syscap SystemCapability.Notification.Emitter + * @atomicservice + * @since 11 + */ + priority?: EventPriority; + } + /** + * Indicates the emit priority of the event. + * + * @enum { number } + * @syscap SystemCapability.Notification.Emitter + * @since 7 + */ + /** + * Indicates the emit priority of the event. + * + * @enum { number } + * @syscap SystemCapability.Notification.Emitter + * @atomicservice + * @since 11 + */ + export enum EventPriority { + /** + * Indicates that the event will be emitted immediately. + * + * @syscap SystemCapability.Notification.Emitter + * @since 7 + */ + /** + * Indicates that the event will be emitted immediately. + * + * @syscap SystemCapability.Notification.Emitter + * @atomicservice + * @since 11 + */ + IMMEDIATE = 0, + /** + * Indicates that the event will be emitted before low-priority events. + * + * @syscap SystemCapability.Notification.Emitter + * @since 7 + */ + /** + * Indicates that the event will be emitted before low-priority events. + * + * @syscap SystemCapability.Notification.Emitter + * @atomicservice + * @since 11 + */ + HIGH, + /** + * Indicates that the event will be emitted before idle-priority events. By default, an event is in LOW priority. + * + * @syscap SystemCapability.Notification.Emitter + * @since 7 + */ + /** + * Indicates that the event will be emitted before idle-priority events. By default, an event is in LOW priority. + * + * @syscap SystemCapability.Notification.Emitter + * @atomicservice + * @since 11 + */ + LOW, + /** + * Indicates that the event will be emitted after all the other events. + * + * @syscap SystemCapability.Notification.Emitter + * @since 7 + */ + /** + * Indicates that the event will be emitted after all the other events. + * + * @syscap SystemCapability.Notification.Emitter + * @atomicservice + * @since 11 + */ + IDLE + } + /** + * Describe the optional arguments of emit operation. + * + * @typedef Options + * @syscap SystemCapability.Notification.Emitter + * @since 11 + */ + /** + * Describe the optional arguments of emit operation. + * + * @typedef Options + * @syscap SystemCapability.Notification.Emitter + * @atomicservice + * @since 12 + */ + export interface Options { + /** + * Emit priority of the event. The default priority is {@link EventPriority.LOW}. + * + * @type { ?EventPriority } + * @syscap SystemCapability.Notification.Emitter + * @atomicservice + * @since 11 + */ + priority?: EventPriority; + } +} +export default emitter; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.faultLogger.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.faultLogger.d.ts new file mode 100755 index 00000000..b67760f4 --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.faultLogger.d.ts @@ -0,0 +1,166 @@ +/* +* Copyright (C) 2021-2022 Huawei Device Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +/** + * @file + * @kit PerformanceAnalysisKit + */ +import type { AsyncCallback } from './@ohos.base'; +/** + * This module provides the capability to query faultlog data. + * @namespace FaultLogger + * @syscap SystemCapability.HiviewDFX.Hiview.FaultLogger + * @since 8 + */ +declare namespace FaultLogger { + /** + * The type of fault type. + * @enum { number } + * @syscap SystemCapability.HiviewDFX.Hiview.FaultLogger + * @since 8 + */ + enum FaultType { + /** + * NO_SPECIFIC log type not distinguished. + * @syscap SystemCapability.HiviewDFX.Hiview.FaultLogger + * @since 8 + */ + NO_SPECIFIC = 0, + /** + * CPP_CRASH CPP crash log type. + * @syscap SystemCapability.HiviewDFX.Hiview.FaultLogger + * @since 8 + */ + CPP_CRASH = 2, + /** + * JS_CRASH JS crash log type. + * @syscap SystemCapability.HiviewDFX.Hiview.FaultLogger + * @since 8 + */ + JS_CRASH = 3, + /** + * APP_FREEZE app freeze log type. + * @syscap SystemCapability.HiviewDFX.Hiview.FaultLogger + * @since 8 + */ + APP_FREEZE = 4 + } + /** + * Query the result of the current application FaultLog in callback Mode. + * @param { FaultType } faultType - Fault type to query + * @param { AsyncCallback> } callback - Faultlog information data callback function + * @syscap SystemCapability.HiviewDFX.Hiview.FaultLogger + * @since 8 + * @deprecated since 9 + * @useinstead ohos.faultlogger/FaultLogger#query + */ + function querySelfFaultLog(faultType: FaultType, callback: AsyncCallback>): void; + /** + * Query the result of the current application FaultLog in return promise mode. + * @param { FaultType } faultType - Fault type to query + * @returns { Promise> } return faultlog information data by promise + * @syscap SystemCapability.HiviewDFX.Hiview.FaultLogger + * @since 8 + * @deprecated since 9 + * @useinstead ohos.faultlogger/FaultLogger#query + */ + function querySelfFaultLog(faultType: FaultType): Promise>; + /** + * Query the result of the current application FaultLog in callback Mode. + * @param { FaultType } faultType - Fault type to query + * @param { AsyncCallback> } callback - Faultlog information data callback function + * @throws { BusinessError } 401 - The parameter check failed, Parameter type error + * @throws { BusinessError } 801 - The specified SystemCapability name was not found + * @throws { BusinessError } 10600001 - The service is not started or is faulty + * @syscap SystemCapability.HiviewDFX.Hiview.FaultLogger + * @since 9 + */ + function query(faultType: FaultType, callback: AsyncCallback>): void; + /** + * Query the result of the current application FaultLog in return promise mode. + * @param { FaultType } faultType - Fault type to query + * @returns { Promise> } return faultlog information data by promise + * @throws { BusinessError } 401 - The parameter check failed, Parameter type error + * @throws { BusinessError } 801 - The specified SystemCapability name was not found + * @throws { BusinessError } 10600001 - The service is not started or is faulty + * @syscap SystemCapability.HiviewDFX.Hiview.FaultLogger + * @since 9 + */ + function query(faultType: FaultType): Promise>; + /** + * FaultLog information data structure. + * @interface FaultLogInfo + * @syscap SystemCapability.HiviewDFX.Hiview.FaultLogger + * @since 8 + */ + interface FaultLogInfo { + /** + * Process id. + * @type { number } + * @syscap SystemCapability.HiviewDFX.Hiview.FaultLogger + * @since 8 + */ + pid: number; + /** + * User id. + * @type { number } + * @syscap SystemCapability.HiviewDFX.Hiview.FaultLogger + * @since 8 + */ + uid: number; + /** + * Fault type. + * @type { FaultType } + * @syscap SystemCapability.HiviewDFX.Hiview.FaultLogger + * @since 8 + */ + type: FaultType; + /** + * Second level timestamp. + * @type { number } + * @syscap SystemCapability.HiviewDFX.Hiview.FaultLogger + * @since 8 + */ + timestamp: number; + /** + * Fault reason. + * @type { string } + * @syscap SystemCapability.HiviewDFX.Hiview.FaultLogger + * @since 8 + */ + reason: string; + /** + * Fault module. + * @type { string } + * @syscap SystemCapability.HiviewDFX.Hiview.FaultLogger + * @since 8 + */ + module: string; + /** + * Fault summary. + * @type { string } + * @syscap SystemCapability.HiviewDFX.Hiview.FaultLogger + * @since 8 + */ + summary: string; + /** + * Fault log. + * @type { string } + * @syscap SystemCapability.HiviewDFX.Hiview.FaultLogger + * @since 8 + */ + fullLog: string; + } +} +export default FaultLogger; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.file.AlbumPickerComponent.d.ets b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.file.AlbumPickerComponent.d.ets new file mode 100755 index 00000000..08da8b5c --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.file.AlbumPickerComponent.d.ets @@ -0,0 +1,83 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file A component which supports applications to select album + * @kit MediaLibraryKit + */ +import { PickerColorMode } from '@ohos.file.PhotoPickerComponent'; +/** + * AlbumPickerComponent: can select a certain album and display the images in that album through PhotoPickerComponent + * + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @atomicservice + * @since 12 + */ +@Component +export declare struct AlbumPickerComponent { + /** + * AlbumPickerOptions + * + * @type { ?AlbumPickerOptions } + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Corea + * @atomicservice + * @since 12 + */ + albumPickerOptions?: AlbumPickerOptions; + /** + * Callback when select an album, will return album uri + * + * @type { ?function } + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @atomicservice + * @since 12 + */ + onAlbumClick?: (albumInfo: AlbumInfo) => boolean; +} +/** + * AlbumPickerOptions Object + * + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @atomicservice + * @since 12 + */ +export declare class AlbumPickerOptions { + /** + * AlbumPickerComponent theme color + * + * @type { ?PickerColorMode } + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @atomicservice + * @since 12 + */ + themeColorMode?: PickerColorMode; +} +/** + * AlbumInfo: include album uri + * + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @atomicservice + * @since 12 + */ +export declare class AlbumInfo { + /** + * Album uri + * + * @type { ?string } + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @atomicservice + * @since 12 + */ + uri?: string; +} diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.file.BackupExtensionContext.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.file.BackupExtensionContext.d.ts new file mode 100755 index 00000000..0c0402d4 --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.file.BackupExtensionContext.d.ts @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit CoreFileKit + */ +import ExtensionContext from './application/ExtensionContext'; +/** + * The context of an ability or an application. It allows access to + * application-specific resources. + * Can only be obtained through the ability. + * + * @extends ExtensionContext + * @syscap SystemCapability.FileManagement.StorageService.Backup + * @StageModelOnly + * @since 12 + */ +export default class BackupExtensionContext extends ExtensionContext { + /** + * Indicates backup dir. + * + * @type { string } + * @syscap SystemCapability.FileManagement.StorageService.Backup + * @StageModelOnly + * @since 12 + */ + readonly backupDir: string; +} diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.file.PhotoPickerComponent.d.ets b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.file.PhotoPickerComponent.d.ets new file mode 100755 index 00000000..a0e6f893 --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.file.PhotoPickerComponent.d.ets @@ -0,0 +1,606 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file A component which support other applications to select photos or videos + * @kit MediaLibraryKit + */ +import photoAccessHelper from '@ohos.file.photoAccessHelper'; +/** + * Declare struct PhotoPickerComponent + * + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @atomicservice + * @since 12 + */ +@Component +export declare struct PhotoPickerComponent { + /** + * PickerOptions + * + * @type { ?PickerOptions } + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @atomicservice + * @since 12 + */ + pickerOptions?: PickerOptions; + /** + * Callback when select photos or videos + * + * @type { ?function } + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @atomicservice + * @since 12 + */ + onSelect?: (uri: string) => void; + /** + * Callback when Deselect photos or videos + * + * @type { ?function } + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @atomicservice + * @since 12 + */ + onDeselect?: (uri: string) => void; + /** + * Callback when click item. include click camera item and thumbnail item, will return itemInfo + * + * @type { ?function } + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @atomicservice + * @since 12 + */ + onItemClicked?: (itemInfo: ItemInfo, clickType: ClickType) => boolean; + /** + * Callback when enter photo browser, will return photoBrowserInfo + * + * @type { ?function } + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @atomicservice + * @since 12 + */ + onEnterPhotoBrowser?: (photoBrowserInfo: PhotoBrowserInfo) => boolean; + /** + * Callback when exit photo browser, will return photoBrowserInfo + * + * @type { ?function } + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @atomicservice + * @since 12 + */ + onExitPhotoBrowser?: (photoBrowserInfo: PhotoBrowserInfo) => boolean; + /** + * Callback when pickerController is ready. + * Set data to picker component by pickerController is supported after pickerController is ready + * + * @type { ?function } + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @atomicservice + * @since 12 + */ + onPickerControllerReady?: () => void; + /** + * PickerController + * + * @type { ?PickerController } + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @atomicservice + * @since 12 + */ + @ObjectLink + pickerController: PickerController; + /** + * Build function of PhotoPickerComponent + * + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @atomicservice + * @since 12 + */ + build(): void; +} +/** + * The class for PickerController + * + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @atomicservice + * @since 12 + */ +@Observed +export declare class PickerController { + /** + * Set data to picker component + * + * @param { DataType } dataType - data type + * @param { Object } data - data + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @atomicservice + * @since 12 + */ + setData(dataType: DataType, data: Object): void; + /** + * Set max select count to picker component, include max_total_count, max_photo_count and max_video_count. + * + * @param { MaxSelected } maxSelected - max select count data + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @atomicservice + * @since 12 + */ + setMaxSelected(maxSelected: MaxSelected): void; +} +/** + * PickerOptions Object + * + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @atomicservice + * @since 12 + */ +export declare class PickerOptions extends photoAccessHelper.BaseSelectOptions { + /** + * Support set checkBox color + * + * @type { ?string } + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @atomicservice + * @since 12 + */ + checkBoxColor?: string; + /** + * Support set backgroundColor + * + * @type { ?string } + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @atomicservice + * @since 12 + */ + backgroundColor?: string; + /** + * Support repeat select + * + * @type { ?boolean } + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @atomicservice + * @since 12 + */ + isRepeatSelectSupported?: boolean; + /** + * Support to set checkbox text color + * + * @type { ?string } + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @atomicservice + * @since 12 + */ + checkboxTextColor?: string; + /** + * Support to set photo browser background color mode + * + * @type { ?PickerColorMode } + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @atomicservice + * @since 12 + */ + photoBrowserBackgroundColorMode?: PickerColorMode; + /** + * Support to set max select number remind mode. + * + * @type { ?ReminderMode } + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @atomicservice + * @since 12 + */ + maxSelectedReminderMode?: ReminderMode; + /** + * Support to set display orientation + * + * @type { ?PickerOrientation } + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @atomicservice + * @since 12 + */ + orientation?: PickerOrientation; + /** + * Support to set select mode + * + * @type { ?SelectMode } + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @atomicservice + * @since 12 + */ + selectMode?: SelectMode; + /** + * Support to set max photo select number + * + * @type { ?number } + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @atomicservice + * @since 12 + */ + maxPhotoSelectNumber?: number; + /** + * Support to set max video select number + * + * @type { ?number } + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @atomicservice + * @since 12 + */ + maxVideoSelectNumber?: number; +} +/** + * ItemInfo + * + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @atomicservice + * @since 12 + */ +export declare class ItemInfo { + /** + * itemType. include CAMERA and THUMBNAIL. + * + * @type { ?ItemType } + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @atomicservice + * @since 12 + */ + itemType?: ItemType; + /** + * Uri. if the itemType is CAMERA, it will be null + * + * @type { ?string } + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @atomicservice + * @since 12 + */ + uri?: string; + /** + * MimeType. if the itemType is CAMERA, it will be null + * + * @type { ?string } + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @atomicservice + * @since 12 + */ + mimeType?: string; + /** + * Width. if the itemType is CAMERA, it will be null + * + * @type { ?number } + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @atomicservice + * @since 12 + */ + width?: number; + /** + * Height. if the itemType is CAMERA, it will be null + * + * @type { ?number } + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @atomicservice + * @since 12 + */ + height?: number; + /** + * Size. if the itemType is CAMERA, it will be null + * + * @type { ?number } + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @atomicservice + * @since 12 + */ + size?: number; + /** + * Duration. if the itemType is CAMERA, it will be null; if photos, return -1 + * + * @type { ?number } + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @atomicservice + * @since 12 + */ + duration?: number; +} +/** + * PhotoBrowserInfo + * + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @atomicservice + * @since 12 + */ +export declare class PhotoBrowserInfo { + /** + * AnimatorParams. include duration and curve + * + * @type { ?AnimatorParams } + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @atomicservice + * @since 12 + */ + animatorParams?: AnimatorParams; +} +/** + * AnimatorParams + * + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @atomicservice + * @since 12 + */ +export declare class AnimatorParams { + /** + * Animate duration + * + * @type { ?number } + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @atomicservice + * @since 12 + */ + duration?: number; + /** + * Animate curve + * + * @type { ?Curve | ICurve | string } + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @atomicservice + * @since 12 + */ + curve?: Curve | ICurve | string; +} +/** + * MaxSelected + * + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @atomicservice + * @since 12 + */ +export declare class MaxSelected { + /** + * data. support to set max_total_count, max_photo_count and max_video_count. + * + * @type { ?Map } + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @atomicservice + * @since 12 + */ + data?: Map; +} +/** + * DataType represents the type of the data set to picker component + * + * @enum { number } DataType + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @atomicservice + * @since 12 + */ +export declare enum DataType { + /** + * DataType: set selected uris to picker component, the data should be a array of uri + * + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @atomicservice + * @since 12 + */ + SET_SELECTED_URIS = 1, + /** + * SET_ALBUM_URI. set selected album uri to picker component + * + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @atomicservice + * @since 12 + */ + SET_ALBUM_URI = 2 +} +/** + * ItemType. include CAMERA and THUMBNAIL + * + * @enum { number } ItemType + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @atomicservice + * @since 12 + */ +export declare enum ItemType { + /** + * THUMBNAIL. photos or videos item + * + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @atomicservice + * @since 12 + */ + THUMBNAIL = 0, + /** + * CAMERA. camera item + * + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @atomicservice + * @since 12 + */ + CAMERA = 1 +} +/** + * ClickType. include SELECTED and DESELECTED + * + * @enum { number } ClickType + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @atomicservice + * @since 12 + */ +export declare enum ClickType { + /** + * SELECTED. click to select photos or videos, if click camera item, the clickType is SELECTED. + * + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @atomicservice + * @since 12 + */ + SELECTED = 0, + /** + * DESELECTED. click to deselect photos or videos + * + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @atomicservice + * @since 12 + */ + DESELECTED = 1 +} +/** + * PickerOrientation. include VERTICAL and HORIZONTAL + * + * @enum { number } PickerOrientation + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @atomicservice + * @since 12 + */ +export declare enum PickerOrientation { + /** + * VERTICAL. vertical display + * + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @atomicservice + * @since 12 + */ + VERTICAL = 0, + /** + * HORIZONTAL. horizontal display + * + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @atomicservice + * @since 12 + */ + HORIZONTAL = 1 +} +/** + * SelectMode. include SINGLE_SELECT and MULTI_SELECT + * + * @enum { number } SelectMode + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @atomicservice + * @since 12 + */ +export declare enum SelectMode { + /** + * SINGLE_SELECT. single select + * + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @atomicservice + * @since 12 + */ + SINGLE_SELECT = 0, + /** + * MULTI_SELECT. multi select + * + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @atomicservice + * @since 12 + */ + MULTI_SELECT = 1 +} +/** + * PickerColorMode. include AUTO, LIGHT and DARK + * + * @enum { number } PickerColorMode + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @atomicservice + * @since 12 + */ +export declare enum PickerColorMode { + /** + * AUTO. follow system color + * + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @atomicservice + * @since 12 + */ + AUTO = 0, + /** + * LIGHT. light color + * + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @atomicservice + * @since 12 + */ + LIGHT = 1, + /** + * DARK. dark color + * + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @atomicservice + * @since 12 + */ + DARK = 2 +} +/** + * ReminderMode, include NONE, TOAST and MASK + * + * @enum { number } ReminderMode + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @atomicservice + * @since 12 + */ +export declare enum ReminderMode { + /** + * NONE. no need to remind + * + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @atomicservice + * @since 12 + */ + NONE = 0, + /** + * TOAST. remind by toast + * + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @atomicservice + * @since 12 + */ + TOAST = 1, + /** + * MASK. remind by mask + * + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @atomicservice + * @since 12 + */ + MASK = 2 +} +/** + * MaxCountType. include TOTAL_MAX_COUNT, PHOTO_MAX_COUNT and VIDEO_MAX_COUNT + * + * @enum { number } MaxCountType + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @atomicservice + * @since 12 + */ +export declare enum MaxCountType { + /** + * TOTAL_MAX_COUNT. total max count + * + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @atomicservice + * @since 12 + */ + TOTAL_MAX_COUNT = 0, + /** + * PHOTO_MAX_COUNT. photo max count + * + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @atomicservice + * @since 12 + */ + PHOTO_MAX_COUNT = 1, + /** + * VIDEO_MAX_COUNT. video max count + * + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @atomicservice + * @since 12 + */ + VIDEO_MAX_COUNT = 2 +} diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.file.cloudSync.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.file.cloudSync.d.ts new file mode 100755 index 00000000..bb6352e8 --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.file.cloudSync.d.ts @@ -0,0 +1,278 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"), + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit CoreFileKit + */ +import type { AsyncCallback, Callback } from './@ohos.base'; +/** + * Provides the capabilities to control cloud file synchronization. + * + * @namespace cloudSync + * @syscap SystemCapability.FileManagement.DistributedFileService.CloudSync.Core + * @since 11 + */ +declare namespace cloudSync { + /** + * Describes the State type of download. + * + * @enum { number } + * @syscap SystemCapability.FileManagement.DistributedFileService.CloudSync.Core + * @since 11 + */ + enum State { + /** + * Indicates that the download task in process now. + * + * @syscap SystemCapability.FileManagement.DistributedFileService.CloudSync.Core + * @since 11 + */ + RUNNING, + /** + * Indicates that the download task finished. + * + * @syscap SystemCapability.FileManagement.DistributedFileService.CloudSync.Core + * @since 11 + */ + COMPLETED, + /** + * Indicates that the download task failed. + * + * @syscap SystemCapability.FileManagement.DistributedFileService.CloudSync.Core + * @since 11 + */ + FAILED, + /** + * Indicates that the download task stopped. + * + * @syscap SystemCapability.FileManagement.DistributedFileService.CloudSync.Core + * @since 11 + */ + STOPPED + } + /** + * Describes the download Error type. + * + * @enum { number } + * @syscap SystemCapability.FileManagement.DistributedFileService.CloudSync.Core + * @since 11 + */ + enum DownloadErrorType { + /** + * No error occurred. + * + * @syscap SystemCapability.FileManagement.DistributedFileService.CloudSync.Core + * @since 11 + */ + NO_ERROR, + /** + * download aborted due to unknown error. + * + * @syscap SystemCapability.FileManagement.DistributedFileService.CloudSync.Core + * @since 11 + */ + UNKNOWN_ERROR, + /** + * download aborted due to network unavailable. + * + * @syscap SystemCapability.FileManagement.DistributedFileService.CloudSync.Core + * @since 11 + */ + NETWORK_UNAVAILABLE, + /** + * download aborted due to local storage is full. + * + * @syscap SystemCapability.FileManagement.DistributedFileService.CloudSync.Core + * @since 11 + */ + LOCAL_STORAGE_FULL, + /** + * download aborted due to content is not found in the cloud. + * + * @syscap SystemCapability.FileManagement.DistributedFileService.CloudSync.Core + * @since 11 + */ + CONTENT_NOT_FOUND, + /** + * download aborted due to frequent user requests. + * + * @syscap SystemCapability.FileManagement.DistributedFileService.CloudSync.Core + * @since 11 + */ + FREQUENT_USER_REQUESTS + } + /** + * The DownloadProgress data structure. + * + * @interface DownloadProgress + * @syscap SystemCapability.FileManagement.DistributedFileService.CloudSync.Core + * @since 11 + */ + interface DownloadProgress { + /** + * The current download state. + * + * @type { State } + * @syscap SystemCapability.FileManagement.DistributedFileService.CloudSync.Core + * @since 11 + */ + state: State; + /** + * The processed data size for current file. + * + * @type { number } + * @syscap SystemCapability.FileManagement.DistributedFileService.CloudSync.Core + * @since 11 + */ + processed: number; + /** + * The size of current file. + * + * @type { number } + * @syscap SystemCapability.FileManagement.DistributedFileService.CloudSync.Core + * @since 11 + */ + size: number; + /** + * The uri of current file. + * + * @type { string } + * @syscap SystemCapability.FileManagement.DistributedFileService.CloudSync.Core + * @since 11 + */ + uri: string; + /** + * The error type of download. + * + * @type { DownloadErrorType } + * @syscap SystemCapability.FileManagement.DistributedFileService.CloudSync.Core + * @since 11 + */ + error: DownloadErrorType; + } + /** + * CloudFileCache object. + * + * @syscap SystemCapability.FileManagement.DistributedFileService.CloudSync.Core + * @since 11 + */ + class CloudFileCache { + /** + * A constructor used to create a CloudFileCache object. + * + * @throws { BusinessError } 401 - The input parameter is invalid.Possible causes:Incorrect parameter types. + * @syscap SystemCapability.FileManagement.DistributedFileService.CloudSync.Core + * @since 11 + */ + constructor(); + /** + * Subscribes to cloud file cache download progress change event. This method uses a callback to get download progress changes. + * + * @param { 'progress' } event - event type. + * @param { Callback } callback - callback function with a `DownloadProgress` argument. + * @throws { BusinessError } 401 - The input parameter is invalid.Possible causes:1.Mandatory parameters are left unspecified; + *
2.Incorrect parameter types. + * @throws { BusinessError } 13600001 - IPC error + * @syscap SystemCapability.FileManagement.DistributedFileService.CloudSync.Core + * @since 11 + */ + on(event: 'progress', callback: Callback): void; + /** + * Unsubscribes from cloud file cache download progress event. + * + * @param { 'progress' } event - event type. + * @param { Callback } [callback] - callback function with a `DownloadProgress` argument. + * @throws { BusinessError } 401 - The input parameter is invalid.Possible causes:1.Mandatory parameters are left unspecified; + *
2.Incorrect parameter types. + * @throws { BusinessError } 13600001 - IPC error + * @syscap SystemCapability.FileManagement.DistributedFileService.CloudSync.Core + * @since 11 + */ + off(event: 'progress', callback?: Callback): void; + /** + * Start the cloud file cache download task. + * + * @param { string } uri - uri of file. + * @returns { Promise } - Return Promise. + * @throws { BusinessError } 401 - The input parameter is invalid.Possible causes:1.Mandatory parameters are left unspecified; + *
2.Incorrect parameter types. + * @throws { BusinessError } 13600001 - IPC error. + * @throws { BusinessError } 13900002 - No such file or directory. + * @throws { BusinessError } 13900025 - No space left on device. + * @throws { BusinessError } 14000002 - Invalid uri. + * @syscap SystemCapability.FileManagement.DistributedFileService.CloudSync.Core + * @since 11 + */ + start(uri: string): Promise; + /** + * Start the cloud file cache download task with callback. + * + * @param { string } uri - uri of file. + * @param { AsyncCallback } callback - Callback function. + * @throws { BusinessError } 401 - The input parameter is invalid.Possible causes:1.Mandatory parameters are left unspecified; + *
2.Incorrect parameter types. + * @throws { BusinessError } 13600001 - IPC error. + * @throws { BusinessError } 13900002 - No such file or directory. + * @throws { BusinessError } 13900025 - No space left on device. + * @throws { BusinessError } 14000002 - Invalid uri. + * @syscap SystemCapability.FileManagement.DistributedFileService.CloudSync.Core + * @since 11 + */ + start(uri: string, callback: AsyncCallback): void; + /** + * Stop the cloud file cache download task. + * + * @param { string } uri - uri of file. + * @returns { Promise } - Return Promise. + * @throws { BusinessError } 401 - The input parameter is invalid.Possible causes:1.Mandatory parameters are left unspecified; + *
2.Incorrect parameter types. + * @throws { BusinessError } 13600001 - IPC error. + * @throws { BusinessError } 13900002 - No such file or directory. + * @throws { BusinessError } 14000002 - Invalid uri. + * @syscap SystemCapability.FileManagement.DistributedFileService.CloudSync.Core + * @since 11 + */ + /** + * Stop the cloud file cache download task. + * + * @param { string } uri - uri of file. + * @param { boolean } [needClean] - whether to delete the file that already downloaded. + * @returns { Promise } - Return Promise. + * @throws { BusinessError } 401 - The input parameter is invalid.Possible causes:1.Mandatory parameters are left unspecified; + *
2.Incorrect parameter types. + * @throws { BusinessError } 13600001 - IPC error. + * @throws { BusinessError } 13900002 - No such file or directory. + * @throws { BusinessError } 14000002 - Invalid uri. + * @syscap SystemCapability.FileManagement.DistributedFileService.CloudSync.Core + * @since 12 + */ + stop(uri: string, needClean?: boolean): Promise; + /** + * Stop the cloud file cache download task with callback. + * + * @param { string } uri - uri of file. + * @param { AsyncCallback } callback - Callback function. + * @throws { BusinessError } 401 - The input parameter is invalid.Possible causes:1.Mandatory parameters are left unspecified; + *
2.Incorrect parameter types. + * @throws { BusinessError } 13600001 - IPC error. + * @throws { BusinessError } 13900002 - No such file or directory. + * @throws { BusinessError } 14000002 - Invalid uri. + * @syscap SystemCapability.FileManagement.DistributedFileService.CloudSync.Core + * @since 11 + */ + stop(uri: string, callback: AsyncCallback): void; + } +} +export default cloudSync; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.file.cloudSyncManager.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.file.cloudSyncManager.d.ts new file mode 100755 index 00000000..d61eef02 --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.file.cloudSyncManager.d.ts @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"), + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit CoreFileKit + */ + +/** + * Provides the capabilities to manage the state and data of cloud file synchronization. + * + * @namespace cloudSyncManager + * @syscap SystemCapability.FileManagement.DistributedFileService.CloudSyncManager + * @since 10 + */ +declare namespace cloudSyncManager { +} +export default cloudSyncManager; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.file.environment.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.file.environment.d.ts new file mode 100755 index 00000000..c1ee0e64 --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.file.environment.d.ts @@ -0,0 +1,65 @@ +/* + * Copyright (C) 2021-2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit CoreFileKit + */ + +/** + * Provides Environment APIs. + * + * @namespace Environment + * @syscap SystemCapability.FileManagement.File.Environment + * @since 11 + */ +declare namespace Environment { + /** + * Get the public download directory. + * + * @permission ohos.permission.READ_WRITE_DOWNLOAD_DIRECTORY + * @returns { string } Return the public download directory. + * @throws { BusinessError } 201 - Permission verification failed, usually the result returned by VerifyAccessToken. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 13900042 - Unknown error. + * @syscap SystemCapability.FileManagement.File.Environment.FolderObtain + * @since 11 + */ + function getUserDownloadDir(): string; + /** + * Get the public desktop directory. + * + * @permission ohos.permission.READ_WRITE_DESKTOP_DIRECTORY + * @returns { string } Return the public desktop directory. + * @throws { BusinessError } 201 - Permission verification failed, usually the result returned by VerifyAccessToken. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 13900042 - Unknown error. + * @syscap SystemCapability.FileManagement.File.Environment.FolderObtain + * @since 11 + */ + function getUserDesktopDir(): string; + /** + * Get the public document directory. + * + * @permission ohos.permission.READ_WRITE_DOCUMENTS_DIRECTORY + * @returns { string } Return the public document directory. + * @throws { BusinessError } 201 - Permission verification failed, usually the result returned by VerifyAccessToken. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 13900042 - Unknown error. + * @syscap SystemCapability.FileManagement.File.Environment.FolderObtain + * @since 11 + */ + function getUserDocumentDir(): string; +} +export default Environment; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.file.fileAccess.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.file.fileAccess.d.ts new file mode 100755 index 00000000..b59358d2 --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.file.fileAccess.d.ts @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2022-2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"), + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit CoreFileKit + */ + +/** + * This module provides the capability to access user public files. + * + * @namespace fileAccess + * @syscap SystemCapability.FileManagement.UserFileService + * @since 9 + */ +declare namespace fileAccess { +} +export default fileAccess; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.file.fileuri.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.file.fileuri.d.ts new file mode 100755 index 00000000..926b479e --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.file.fileuri.d.ts @@ -0,0 +1,92 @@ +/* + * Copyright (C) 2022-2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit CoreFileKit + */ +import uri from './@ohos.uri'; +/** + * Provides fileUri APIS + * + * @namespace fileUri + * @syscap SystemCapability.FileManagement.AppFileService + * @since 9 + */ +declare namespace fileUri { + /** + * FileUri represents the uri of the file. + * + * @extends uri.URI + * @syscap SystemCapability.FileManagement.AppFileService + * @since 10 + */ + class FileUri extends uri.URI { + /** + * Constructor for obtaining the instance of the FileUri class. + * + * @param { string } uriOrPath - Uri or Path. + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900042 - Unknown error + * @throws { BusinessError } 14300002 - Invalid uri + * @syscap SystemCapability.FileManagement.AppFileService + * @since 10 + */ + constructor(uriOrPath: string); + /** + * Obtains the file name of uri. + * + * @type { string } + * @readonly + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.AppFileService + * @since 10 + */ + readonly name: string; + /** + * Get the full directory uri where the file URI is located + * + * @returns { string } Return the directory uri + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.AppFileService + * @since 11 + */ + getFullDirectoryUri(): string; + /** + * Check whether the incoming URI is a remote URI + * + * @returns { boolean } Return true or false + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.AppFileService + * @since 12 + */ + isRemoteUri(): boolean; + } + /** + * Get the uri from the path of file in app sandbox + * + * @param { string } path the path of file in app sandbox + * @returns { string } Return the file uri + * @throws { BusinessError } 401 - The input parameter is invalidPossible causes:1.Mandatory parameters are left unspecified; + *
2.Incorrect parameter types. + * @syscap SystemCapability.FileManagement.AppFileService + * @since 9 + */ + function getUriFromPath(path: string): string; +} +export default fileUri; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.file.fs.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.file.fs.d.ts new file mode 100755 index 00000000..b912cfaf --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.file.fs.d.ts @@ -0,0 +1,7472 @@ +/* + * Copyright (c) 2022-2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit CoreFileKit + */ +import { AsyncCallback } from './@ohos.base'; +export default fileIo; +/** + * FileIO + * + * @namespace fileIo + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ +/** + * FileIO + * + * @namespace fileIo + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @since 10 + */ +/** + * FileIO + * + * @namespace fileIo + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @atomicservice + * @since 11 + */ +declare namespace fileIo { + export { access }; + export { accessSync }; + export { close }; + export { closeSync }; + export { copy }; + export { copyDir }; + export { copyDirSync }; + export { copyFile }; + export { copyFileSync }; + export { createRandomAccessFile }; + export { createRandomAccessFileSync }; + export { createStream }; + export { createStreamSync }; + export { createWatcher }; + export { dup }; + export { fdatasync }; + export { fdatasyncSync }; + export { fdopenStream }; + export { fdopenStreamSync }; + export { fsync }; + export { fsyncSync }; + export { listFile }; + export { listFileSync }; + export { lseek }; + export { lstat }; + export { lstatSync }; + export { mkdir }; + export { mkdirSync }; + export { mkdtemp }; + export { mkdtempSync }; + export { moveDir }; + export { moveDirSync }; + export { moveFile }; + export { moveFileSync }; + export { open }; + export { openSync }; + export { read }; + export { readSync }; + export { readLines }; + export { readLinesSync }; + export { readText }; + export { readTextSync }; + export { rename }; + export { renameSync }; + export { rmdir }; + export { rmdirSync }; + export { stat }; + export { statSync }; + export { symlink }; + export { symlinkSync }; + export { truncate }; + export { truncateSync }; + export { unlink }; + export { unlinkSync }; + export { utimes }; + export { write }; + export { writeSync }; + export { AccessModeType }; + export { File }; + export { OpenMode }; + export { RandomAccessFile }; + export { ReaderIterator }; + export { Stat }; + export { Stream }; + export { Watcher }; + export { WhenceType }; + export { connectDfs }; + export { disconnectDfs }; + export type { Progress }; + export type { CopyOptions }; + export type { ProgressListener }; + export type { DfsListeners }; + /** + * Mode Indicates the open flags. + * + * @namespace OpenMode + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ + /** + * Mode Indicates the open flags. + * + * @namespace OpenMode + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @since 10 + */ + /** + * Mode Indicates the open flags. + * + * @namespace OpenMode + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @atomicservice + * @since 11 + */ + namespace OpenMode { + /** + * Read only Permission. + * + * @constant + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ + /** + * Read only Permission. + * + * @constant + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @since 10 + */ + /** + * Read only Permission. + * + * @constant + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @atomicservice + * @since 11 + */ + const READ_ONLY = 0o0; + /** + * Write only Permission. + * + * @constant + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ + /** + * Write only Permission. + * + * @constant + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @since 10 + */ + /** + * Write only Permission. + * + * @constant + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @atomicservice + * @since 11 + */ + const WRITE_ONLY = 0o1; + /** + * Write and Read Permission. + * + * @constant + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ + /** + * Write and Read Permission. + * + * @constant + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @since 10 + */ + /** + * Write and Read Permission. + * + * @constant + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @atomicservice + * @since 11 + */ + const READ_WRITE = 0o2; + /** + * If not exist, create file. + * + * @constant + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ + /** + * If not exist, create file. + * + * @constant + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @since 10 + */ + /** + * If not exist, create file. + * + * @constant + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @atomicservice + * @since 11 + */ + const CREATE = 0o100; + /** + * File truncate len 0. + * + * @constant + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ + /** + * File truncate len 0. + * + * @constant + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @since 10 + */ + /** + * File truncate len 0. + * + * @constant + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @atomicservice + * @since 11 + */ + const TRUNC = 0o1000; + /** + * File append write. + * + * @constant + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ + /** + * File append write. + * + * @constant + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @since 10 + */ + /** + * File append write. + * + * @constant + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @atomicservice + * @since 11 + */ + const APPEND = 0o2000; + /** + * File open in nonblocking mode. + * + * @constant + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ + /** + * File open in nonblocking mode. + * + * @constant + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @since 10 + */ + const NONBLOCK = 0o4000; + /** + * File is Dir. + * + * @constant + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ + /** + * File is Dir. + * + * @constant + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @since 10 + */ + const DIR = 0o200000; + /** + * File is not symbolic link. + * + * @constant + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ + /** + * File is not symbolic link. + * + * @constant + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @since 10 + */ + const NOFOLLOW = 0o400000; + /** + * SYNC IO. + * + * @constant + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ + /** + * SYNC IO. + * + * @constant + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @since 10 + */ + const SYNC = 0o4010000; + } +} +/** + * Access file. + * + * @param { string } path - path. + * @returns { Promise } return Promise + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900023 - Text file busy + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ +/** + * Access file. + * + * @param { string } path - path. + * @returns { Promise } Returns the file is accessible or not in promise mode. + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900023 - Text file busy + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @since 10 + */ +/** + * Access file. + * + * @param { string } path - path. + * @returns { Promise } Returns the file is accessible or not in promise mode. + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900023 - Text file busy + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @atomicservice + * @since 11 + */ +/** + * Access file. + * + * @param { string } path - path. + * @param { AccessModeType } [mode = fs.AccessModeType.EXIST] - accessibility mode. + * @returns { Promise } Returns the file is accessible or not in promise mode. + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900023 - Text file busy + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @atomicservice + * @since 12 + */ +declare function access(path: string, mode?: AccessModeType): Promise; +/** + * Access file. + * + * @param { string } path - path. + * @param { AsyncCallback } callback - The callback is used to return the file is accessible or not. + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900023 - Text file busy + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ +/** + * Access file. + * + * @param { string } path - path. + * @param { AsyncCallback } callback - The callback is used to return the file is accessible or not. + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900023 - Text file busy + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @since 10 + */ +/** + * Access file. + * + * @param { string } path - path. + * @param { AsyncCallback } callback - The callback is used to return the file is accessible or not. + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900023 - Text file busy + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @atomicservice + * @since 11 + */ +declare function access(path: string, callback: AsyncCallback): void; +/** + * Access file with sync interface. + * + * @param { string } path - path. + * @returns { boolean } Returns the file is accessible or not. + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900023 - Text file busy + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ +/** + * Access file with sync interface. + * + * @param { string } path - path. + * @returns { boolean } Returns the file is accessible or not. + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900023 - Text file busy + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @since 10 + */ +/** + * Access file with sync interface. + * + * @param { string } path - path. + * @returns { boolean } Returns the file is accessible or not. + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900023 - Text file busy + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @atomicservice + * @since 11 + */ +/** + * + * Access file with sync interface. + * + * @param { string } path - path. + * @param { AccessModeType } [mode = fs.AccessModeType.EXIST] - accessibility mode. + * @returns { boolean } Returns the file is accessible or not. + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900023 - Text file busy + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @atomicservice + * @since 12 + */ +declare function accessSync(path: string, mode?: AccessModeType): boolean; +/** + * Close file or fd. + * + * @param { number | File } file - file object or fd. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ +/** + * Close file or fd. + * + * @param { number | File } file - file object or fd. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @since 10 + */ +/** + * Close file or fd. + * + * @param { number | File } file - file object or fd. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @atomicservice + * @since 11 + */ +declare function close(file: number | File): Promise; +/** + * Close file or fd. + * + * @param { number | File } file - file object or fd. + * @param { AsyncCallback } callback - Return the callback function. + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ +/** + * Close file or fd. + * + * @param { number | File } file - file object or fd. + * @param { AsyncCallback } callback - Return the callback function. + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @since 10 + */ +/** + * Close file or fd. + * + * @param { number | File } file - file object or fd. + * @param { AsyncCallback } callback - Return the callback function. + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @atomicservice + * @since 11 + */ +declare function close(file: number | File, callback: AsyncCallback): void; +/** + * Close file or fd with sync interface. + * + * @param { number | File } file - file object or fd. + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ +/** + * Close file or fd with sync interface. + * + * @param { number | File } file - file object or fd. + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @since 10 + */ +/** + * Close file or fd with sync interface. + * + * @param { number | File } file - file object or fd. + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @atomicservice + * @since 11 + */ +declare function closeSync(file: number | File): void; +/** + * Copy file or directory. + * + * @param { string } srcUri - src uri. + * @param { string } destUri - dest uri. + * @param { CopyOptions } [options] - options. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; + *
2.Incorrect parameter types. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900010 - Try again + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied by the file system + * @throws { BusinessError } 13900015 - File exists + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900021 - File table overflow + * @throws { BusinessError } 13900022 - Too many open files + * @throws { BusinessError } 13900024 - File too large + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900027 - Read-only file system + * @throws { BusinessError } 13900028 - Too many links + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900031 - Function not implemented + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900038 - Value too large for defined data type + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 11 + */ +declare function copy(srcUri: string, destUri: string, options?: CopyOptions): Promise; +/** + * Copy file or directory. + * + * @param { string } srcUri - src uri. + * @param { string } destUri - dest uri. + * @param { AsyncCallback } callback - Return the callback function. + * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; + *
2.Incorrect parameter types. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900010 - Try again + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied by the file system + * @throws { BusinessError } 13900015 - File exists + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900021 - File table overflow + * @throws { BusinessError } 13900022 - Too many open files + * @throws { BusinessError } 13900024 - File too large + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900027 - Read-only file system + * @throws { BusinessError } 13900028 - Too many links + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900031 - Function not implemented + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900038 - Value too large for defined data type + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 11 + */ +declare function copy(srcUri: string, destUri: string, callback: AsyncCallback): void; +/** + * Copy file or directory. + * + * @param { string } srcUri - src uri. + * @param { string } destUri - dest uri. + * @param { CopyOptions } options - options. + * @param { AsyncCallback } callback - Return the callback function. + * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; + *
2.Incorrect parameter types. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900010 - Try again + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied by the file system + * @throws { BusinessError } 13900015 - File exists + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900021 - File table overflow + * @throws { BusinessError } 13900022 - Too many open files + * @throws { BusinessError } 13900024 - File too large + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900027 - Read-only file system + * @throws { BusinessError } 13900028 - Too many links + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900031 - Function not implemented + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900038 - Value too large for defined data type + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 11 + */ +declare function copy(srcUri: string, destUri: string, options: CopyOptions, callback: AsyncCallback): void; +/** + * Copy directory. + * + * @param { string } src - source path. + * @param { string } dest - destination path. + * @param { number } [mode = 0] - mode. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900010 - Try again + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900031 - Function not implemented + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900038 - Value too large for defined data type + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 10 + */ +declare function copyDir(src: string, dest: string, mode?: number): Promise; +/** + * Copy directory. + * + * @param { string } src - source path. + * @param { string } dest - destination path. + * @param { AsyncCallback } callback - Return the callback function. + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900010 - Try again + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900031 - Function not implemented + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900038 - Value too large for defined data type + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 10 + */ +declare function copyDir(src: string, dest: string, callback: AsyncCallback): void; +/** + * Copy directory. + * + * @param { string } src - source path. + * @param { string } dest - destination path. + * @param { AsyncCallback> } callback - Return the callback function. + * @throws { BusinessError } 13900015 - File exists + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 10 + */ +declare function copyDir(src: string, dest: string, callback: AsyncCallback>): void; +/** + * Copy directory. + * + * @param { string } src - source path. + * @param { string } dest - destination path. + * @param { number } mode - mode. + * @param { AsyncCallback } callback - Return the callback function. + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900010 - Try again + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900031 - Function not implemented + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900038 - Value too large for defined data type + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 10 + */ +declare function copyDir(src: string, dest: string, mode: number, callback: AsyncCallback): void; +/** + * Copy directory. + * + * @param { string } src - source path. + * @param { string } dest - destination path. + * @param { number } mode - mode. + * @param { AsyncCallback> } callback - Return the callback function. + * @throws { BusinessError } 13900015 - File exists + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 10 + */ +declare function copyDir(src: string, dest: string, mode: number, callback: AsyncCallback>): void; +/** + * Copy directory with sync interface. + * + * @param { string } src - source path. + * @param { string } dest - destination path. + * @param { number } [mode = 0] - mode. + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900010 - Try again + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900015 - File exists + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900031 - Function not implemented + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900038 - Value too large for defined data type + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 10 + */ +declare function copyDirSync(src: string, dest: string, mode?: number): void; +/** + * Copy file. + * + * @param { string | number } src - src. + * @param { string | number } dest - dest. + * @param { number } [mode = 0] - mode. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900010 - Try again + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900031 - Function not implemented + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900038 - Value too large for defined data type + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ +/** + * Copy file. + * + * @param { string | number } src - src. + * @param { string | number } dest - dest. + * @param { number } [mode = 0] - mode. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900010 - Try again + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900031 - Function not implemented + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900038 - Value too large for defined data type + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @since 10 + */ +/** + * Copy file. + * + * @param { string | number } src - src. + * @param { string | number } dest - dest. + * @param { number } [mode = 0] - mode. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900010 - Try again + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900031 - Function not implemented + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900038 - Value too large for defined data type + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @atomicservice + * @since 11 + */ +declare function copyFile(src: string | number, dest: string | number, mode?: number): Promise; +/** + * Copy file. + * + * @param { string | number } src - src. + * @param { string | number } dest - dest. + * @param { AsyncCallback } callback - Return the callback function. + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900010 - Try again + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900031 - Function not implemented + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900038 - Value too large for defined data type + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ +/** + * Copy file. + * + * @param { string | number } src - src. + * @param { string | number } dest - dest. + * @param { AsyncCallback } callback - Return the callback function. + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900010 - Try again + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900031 - Function not implemented + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900038 - Value too large for defined data type + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @since 10 + */ +/** + * Copy file. + * + * @param { string | number } src - src. + * @param { string | number } dest - dest. + * @param { AsyncCallback } callback - Return the callback function. + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900010 - Try again + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900031 - Function not implemented + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900038 - Value too large for defined data type + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @atomicservice + * @since 11 + */ +declare function copyFile(src: string | number, dest: string | number, callback: AsyncCallback): void; +/** + * Copy file. + * + * @param { string | number } src - src. + * @param { string | number } dest - dest. + * @param { number } [mode = 0] - mode. + * @param { AsyncCallback } callback - Return the callback function. + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900010 - Try again + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900031 - Function not implemented + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900038 - Value too large for defined data type + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ +/** + * Copy file. + * + * @param { string | number } src - src. + * @param { string | number } dest - dest. + * @param { number } [mode = 0] - mode. + * @param { AsyncCallback } callback - Return the callback function. + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900010 - Try again + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900031 - Function not implemented + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900038 - Value too large for defined data type + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @since 10 + */ +/** + * Copy file. + * + * @param { string | number } src - src. + * @param { string | number } dest - dest. + * @param { number } [mode = 0] - mode. + * @param { AsyncCallback } callback - Return the callback function. + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900010 - Try again + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900031 - Function not implemented + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900038 - Value too large for defined data type + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @atomicservice + * @since 11 + */ +declare function copyFile(src: string | number, dest: string | number, mode: number, callback: AsyncCallback): void; +/** + * Copy file with sync interface. + * + * @param { string | number } src - src. + * @param { string | number } dest - dest. + * @param { number } [mode = 0] - mode. + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900010 - Try again + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900031 - Function not implemented + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900038 - Value too large for defined data type + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ +/** + * Copy file with sync interface. + * + * @param { string | number } src - src. + * @param { string | number } dest - dest. + * @param { number } [mode = 0] - mode. + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900010 - Try again + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900031 - Function not implemented + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900038 - Value too large for defined data type + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @since 10 + */ +/** + * Copy file with sync interface. + * + * @param { string | number } src - src. + * @param { string | number } dest - dest. + * @param { number } [mode = 0] - mode. + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900010 - Try again + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900031 - Function not implemented + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900038 - Value too large for defined data type + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @atomicservice + * @since 11 + */ +declare function copyFileSync(src: string | number, dest: string | number, mode?: number): void; +/** + * Create class Stream. + * + * @param { string } path - path. + * @param { string } mode - mode. + * @returns { Promise } return Promise + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900006 - No such device or address + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900014 - Device or resource busy + * @throws { BusinessError } 13900015 - File exists + * @throws { BusinessError } 13900017 - No such device + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900022 - Too many open files + * @throws { BusinessError } 13900023 - Text file busy + * @throws { BusinessError } 13900024 - File too large + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900027 - Read-only file system + * @throws { BusinessError } 13900029 - Resource deadlock would occur + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900038 - Value too large for defined data type + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ +declare function createStream(path: string, mode: string): Promise; +/** + * Create class Stream. + * + * @param { string } path - path. + * @param { string } mode - mode. + * @param { AsyncCallback } callback - callback. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900006 - No such device or address + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900014 - Device or resource busy + * @throws { BusinessError } 13900015 - File exists + * @throws { BusinessError } 13900017 - No such device + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900022 - Too many open files + * @throws { BusinessError } 13900023 - Text file busy + * @throws { BusinessError } 13900024 - File too large + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900027 - Read-only file system + * @throws { BusinessError } 13900029 - Resource deadlock would occur + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900038 - Value too large for defined data type + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ +declare function createStream(path: string, mode: string, callback: AsyncCallback): void; +/** + * Create class Stream with sync interface. + * + * @param { string } path - path. + * @param { string } mode - mode. + * @returns { Stream } createStream + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900006 - No such device or address + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900014 - Device or resource busy + * @throws { BusinessError } 13900015 - File exists + * @throws { BusinessError } 13900017 - No such device + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900022 - Too many open files + * @throws { BusinessError } 13900023 - Text file busy + * @throws { BusinessError } 13900024 - File too large + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900027 - Read-only file system + * @throws { BusinessError } 13900029 - Resource deadlock would occur + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900038 - Value too large for defined data type + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ +declare function createStreamSync(path: string, mode: string): Stream; +/** + * Create class RandomAccessFile. + * + * @param { string | File } file - file path, object. + * @param { number } [mode = OpenMode.READ_ONLY] - mode. + * @returns { Promise } Returns the RandomAccessFile object which has been created in promise mode. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900006 - No such device or address + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900014 - Device or resource busy + * @throws { BusinessError } 13900015 - File exists + * @throws { BusinessError } 13900017 - No such device + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900022 - Too many open files + * @throws { BusinessError } 13900023 - Text file busy + * @throws { BusinessError } 13900024 - File too large + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900027 - Read-only file system + * @throws { BusinessError } 13900029 - Resource deadlock would occur + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900038 - Value too large for defined data type + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 10 + */ +declare function createRandomAccessFile(file: string | File, mode?: number): Promise; +/** + * Create class RandomAccessFile. + * + * @param { string | File } file - file path, object. + * @param { AsyncCallback } callback - The callback is used to return the RandomAccessFile object which has been created. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900006 - No such device or address + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900014 - Device or resource busy + * @throws { BusinessError } 13900015 - File exists + * @throws { BusinessError } 13900017 - No such device + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900022 - Too many open files + * @throws { BusinessError } 13900023 - Text file busy + * @throws { BusinessError } 13900024 - File too large + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900027 - Read-only file system + * @throws { BusinessError } 13900029 - Resource deadlock would occur + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900038 - Value too large for defined data type + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 10 + */ +declare function createRandomAccessFile(file: string | File, callback: AsyncCallback): void; +/** + * Create class RandomAccessFile. + * + * @param { string | File } file - file path, object. + * @param { number } [mode = OpenMode.READ_ONLY] - mode. + * @param { AsyncCallback } callback - The callback is used to return the RandomAccessFile object which has been created. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900006 - No such device or address + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900014 - Device or resource busy + * @throws { BusinessError } 13900015 - File exists + * @throws { BusinessError } 13900017 - No such device + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900022 - Too many open files + * @throws { BusinessError } 13900023 - Text file busy + * @throws { BusinessError } 13900024 - File too large + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900027 - Read-only file system + * @throws { BusinessError } 13900029 - Resource deadlock would occur + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900038 - Value too large for defined data type + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 10 + */ +declare function createRandomAccessFile(file: string | File, mode: number, callback: AsyncCallback): void; +/** + * Create class RandomAccessFile with sync interface. + * + * @param { string | File } file - file path, object. + * @param { number } [mode = OpenMode.READ_ONLY] - mode. + * @returns { RandomAccessFile } Returns the RandomAccessFile object which has been created. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900006 - No such device or address + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900014 - Device or resource busy + * @throws { BusinessError } 13900015 - File exists + * @throws { BusinessError } 13900017 - No such device + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900022 - Too many open files + * @throws { BusinessError } 13900023 - Text file busy + * @throws { BusinessError } 13900024 - File too large + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900027 - Read-only file system + * @throws { BusinessError } 13900029 - Resource deadlock would occur + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900038 - Value too large for defined data type + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 10 + */ +declare function createRandomAccessFileSync(file: string | File, mode?: number): RandomAccessFile; +/** + * Create watcher to listen for file changes. + * + * @param { string } path - path. + * @param { number } events - listened events. + * @param { WatchEventListener } listener - Callback to invoke when an event of the specified type occurs. + * @returns { Watcher } Returns the Watcher object which has been created. + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900015 - File exists + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900021 - File table overflow + * @throws { BusinessError } 13900022 - Too many open files + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 10 + */ +declare function createWatcher(path: string, events: number, listener: WatchEventListener): Watcher; +/** + * Duplicate fd to File Object. + * + * @param { number } fd - fd. + * @returns { File } return File + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900014 - Device or resource busy + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900022 - Too many open files + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 10 + */ +declare function dup(fd: number): File; +/** + * Synchronize file metadata. + * + * @param { number } fd - fd. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900027 - Read-only file system + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ +/** + * Synchronize file metadata. + * + * @param { number } fd - fd. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900027 - Read-only file system + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @since 10 + */ +declare function fdatasync(fd: number): Promise; +/** + * Synchronize file metadata. + * + * @param { number } fd - fd. + * @param { AsyncCallback } callback - Return the callback function. + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900027 - Read-only file system + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ +/** + * Synchronize file metadata. + * + * @param { number } fd - fd. + * @param { AsyncCallback } callback - Return the callback function. + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900027 - Read-only file system + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @since 10 + */ +declare function fdatasync(fd: number, callback: AsyncCallback): void; +/** + * Synchronize file metadata with sync interface. + * + * @param { number } fd - fd. + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900027 - Read-only file system + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ +/** + * Synchronize file metadata with sync interface. + * + * @param { number } fd - fd. + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900027 - Read-only file system + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @since 10 + */ +declare function fdatasyncSync(fd: number): void; +/** + * Create class Stream by using fd. + * + * @param { number } fd - fd. + * @param { string } mode - mode. + * @returns { Promise } Returns the Stream object in promise mode. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900006 - No such device or address + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900010 - Try again + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900014 - Device or resource busy + * @throws { BusinessError } 13900015 - File exists + * @throws { BusinessError } 13900017 - No such device + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900022 - Too many open files + * @throws { BusinessError } 13900023 - Text file busy + * @throws { BusinessError } 13900024 - File too large + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900027 - Read-only file system + * @throws { BusinessError } 13900029 - Resource deadlock would occur + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900038 - Value too large for defined data type + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ +declare function fdopenStream(fd: number, mode: string): Promise; +/** + * Create class Stream by using fd. + * + * @param { number } fd - fd. + * @param { string } mode - mode. + * @param { AsyncCallback } callback - The callback is used to return the Stream object. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900006 - No such device or address + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900010 - Try again + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900014 - Device or resource busy + * @throws { BusinessError } 13900015 - File exists + * @throws { BusinessError } 13900017 - No such device + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900022 - Too many open files + * @throws { BusinessError } 13900023 - Text file busy + * @throws { BusinessError } 13900024 - File too large + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900027 - Read-only file system + * @throws { BusinessError } 13900029 - Resource deadlock would occur + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900038 - Value too large for defined data type + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ +declare function fdopenStream(fd: number, mode: string, callback: AsyncCallback): void; +/** + * Create class Stream by using fd with sync interface. + * + * @param { number } fd - fd. + * @param { string } mode - mode. + * @returns { Stream } Returns the Stream object. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900006 - No such device or address + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900010 - Try again + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900014 - Device or resource busy + * @throws { BusinessError } 13900015 - File exists + * @throws { BusinessError } 13900017 - No such device + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900022 - Too many open files + * @throws { BusinessError } 13900023 - Text file busy + * @throws { BusinessError } 13900024 - File too large + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900027 - Read-only file system + * @throws { BusinessError } 13900029 - Resource deadlock would occur + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900038 - Value too large for defined data type + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ +declare function fdopenStreamSync(fd: number, mode: string): Stream; +/** + * Synchronize file. + * + * @param { number } fd - fd. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900027 - Read-only file system + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ +/** + * Synchronize file. + * + * @param { number } fd - fd. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900027 - Read-only file system + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @since 10 + */ +declare function fsync(fd: number): Promise; +/** + * Synchronize file. + * + * @param { number } fd - fd. + * @param { AsyncCallback } callback - Return the callback function. + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900027 - Read-only file system + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ +/** + * Synchronize file. + * + * @param { number } fd - fd. + * @param { AsyncCallback } callback - Return the callback function. + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900027 - Read-only file system + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @since 10 + */ +declare function fsync(fd: number, callback: AsyncCallback): void; +/** + * Synchronize file with sync interface. + * + * @param { number } fd - fd. + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900027 - Read-only file system + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ +/** + * Synchronize file with sync interface. + * + * @param { number } fd - fd. + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900027 - Read-only file system + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @since 10 + */ +declare function fsyncSync(fd: number): void; +/** + * List file. + * + * @param { string } path - path. + * @param { object } [options] - options. + * @returns { Promise } Returns an Array containing the name of files or directories that meet the filter criteria in promise mode. + * If present, Include the subdirectory structure. + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ +/** + * List file. + * + * @param { string } path - path. + * @param { object } [options] - options. + * @returns { Promise } Returns an Array containing the name of files or directories that meet the filter criteria. + * If present, Include the subdirectory structure. + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @since 10 + */ +/** + * List file. + * + * @param { string } path - path. + * @param { ListFileOptions } [options] - options. + * @returns { Promise } Returns an Array containing the name of files or directories that meet the filter criteria. + * If present, Include the subdirectory structure. + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @atomicservice + * @since 11 + */ +declare function listFile(path: string, options?: ListFileOptions): Promise; +/** + * List file. + * + * @param { string } path - path. + * @param { AsyncCallback } callback - The callback is used to return an Array containing the name of files or directories + * that meet the filter criteria in promise mode. If present, Include the subdirectory structure. + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ +/** + * List file. + * + * @param { string } path - path. + * @param { AsyncCallback } callback - The callback is used to return an Array containing the name of files or directories + * that meet the filter criteria in promise mode. If present, Include the subdirectory structure. + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @since 10 + */ +/** + * List file. + * + * @param { string } path - path. + * @param { AsyncCallback } callback - The callback is used to return an Array containing the name of files or directories + * that meet the filter criteria in promise mode. If present, Include the subdirectory structure. + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @atomicservice + * @since 11 + */ +declare function listFile(path: string, callback: AsyncCallback): void; +/** + * List file. + * + * @param { string } path - path. + * @param { object } [options] - options. + * @param { AsyncCallback } callback - The callback is used to return an Array containing the name of files or directories + * that meet the filter criteria in promise mode. If present, Include the subdirectory structure. + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ +/** + * List file. + * + * @param { string } path - path. + * @param { object } [options] - options. + * @param { AsyncCallback } callback - The callback is used to return an Array containing the name of files or directories + * that meet the filter criteria in promise mode. If present, Include the subdirectory structure. + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @since 10 + */ +/** + * List file. + * + * @param { string } path - path. + * @param { ListFileOptions } [options] - options. + * @param { AsyncCallback } callback - The callback is used to return an Array containing the name of files or directories + * that meet the filter criteria in promise mode. If present, Include the subdirectory structure. + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @atomicservice + * @since 11 + */ +declare function listFile(path: string, options: ListFileOptions, callback: AsyncCallback): void; +/** + * List file with sync interface. + * + * @param { string } path - path. + * @param { object } [options] - options. + * @returns { string[] } Returns an Array containing the name of files or directories that meet the filter criteria. + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ +/** + * List file with sync interface. + * + * @param { string } path - path. + * @param { object } [options] - options. + * @returns { string[] } Returns an Array containing the name of files or directories that meet the filter criteria. + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @since 10 + */ +/** + * List file with sync interface. + * + * @param { string } path - path. + * @param { ListFileOptions } [options] - options. + * @returns { string[] } Returns an Array containing the name of files or directories that meet the filter criteria. + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @atomicservice + * @since 11 + */ +declare function listFileSync(path: string, options?: ListFileOptions): string[]; +/** + * Reposition file offset. + * + * @param { number } fd - file descriptor. + * @param { number } offset - file offset. + * @param { WhenceType } [whence = WhenceType.SEEK_SET] - directive whence. + * @returns { number } Returns the file offset relative to starting position of file. + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900026 - Illegal seek + * @throws { BusinessError } 13900038 - Value too large for defined data type + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 11 + */ +/** + * Reposition file offset. + * + * @param { number } fd - file descriptor. + * @param { number } offset - file offset. + * @param { WhenceType } [whence = WhenceType.SEEK_SET] - directive whence. + * @returns { number } Returns the file offset relative to starting position of file. + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900026 - Illegal seek + * @throws { BusinessError } 13900038 - Value too large for defined data type + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @since 12 + */ +declare function lseek(fd: number, offset: number, whence?: WhenceType): number; +/** + * Stat link file. + * + * @param { string } path - path. + * @returns { Promise } Returns the Stat object in promise mode. + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900038 - Value too large for defined data type + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ +declare function lstat(path: string): Promise; +/** + * Stat link file. + * + * @param { string } path - path. + * @param { AsyncCallback } callback - The callback is used to return the Stat object. + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900038 - Value too large for defined data type + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ +declare function lstat(path: string, callback: AsyncCallback): void; +/** + * Stat link file with sync interface. + * + * @param { string } path - path. + * @returns { Stat } Returns the Stat object. + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900038 - Value too large for defined data type + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ +declare function lstatSync(path: string): Stat; +/** + * Make dir. + * + * @param { string } path - path. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900015 - File exists + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900028 - Too many links + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ +/** + * Make dir. + * + * @param { string } path - path. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900015 - File exists + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900028 - Too many links + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @since 10 + */ +/** + * Make dir. + * + * @param { string } path - path. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900015 - File exists + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900028 - Too many links + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @atomicservice + * @since 11 + */ +declare function mkdir(path: string): Promise; +/** + * Make dir. + * + * @param { string } path - path. + * @param { boolean } recursion - whether to recursively make directory. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900015 - File exists + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900028 - Too many links + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @atomicservice + * @since 11 + */ +declare function mkdir(path: string, recursion: boolean): Promise; +/** + * Make dir. + * + * @param { string } path - path. + * @param { AsyncCallback } callback - Return the callback function. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900015 - File exists + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900028 - Too many links + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ +/** + * Make dir. + * + * @param { string } path - path. + * @param { AsyncCallback } callback - Return the callback function. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900015 - File exists + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900028 - Too many links + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @since 10 + */ +/** + * Make dir. + * + * @param { string } path - path. + * @param { AsyncCallback } callback - Return the callback function. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900015 - File exists + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900028 - Too many links + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @atomicservice + * @since 11 + */ +declare function mkdir(path: string, callback: AsyncCallback): void; +/** + * Make dir. + * + * @param { string } path - path. + * @param { boolean } recursion - whether to recursively make directory. + * @param { AsyncCallback } callback - Return the callback function. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900015 - File exists + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900028 - Too many links + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @atomicservice + * @since 11 + */ +declare function mkdir(path: string, recursion: boolean, callback: AsyncCallback): void; +/** + * Make dir with sync interface. + * + * @param { string } path - path. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900015 - File exists + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900028 - Too many links + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ +/** + * Make dir with sync interface. + * + * @param { string } path - path. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900015 - File exists + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900028 - Too many links + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @since 10 + */ +/** + * Make dir with sync interface. + * + * @param { string } path - path. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900015 - File exists + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900028 - Too many links + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @atomicservice + * @since 11 + */ +declare function mkdirSync(path: string): void; +/** + * Make dir with sync interface. + * + * @param { string } path - path. + * @param { boolean } recursion - whether to recursively make directory. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900015 - File exists + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900028 - Too many links + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @atomicservice + * @since 11 + */ +declare function mkdirSync(path: string, recursion: boolean): void; +/** + * Make temp dir. + * + * @param { string } prefix - dir prefix. + * @returns { Promise } Returns the path to the new directory in promise mode. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900015 - File exists + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900028 - Too many links + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ +/** + * Make temp dir. + * + * @param { string } prefix - dir prefix. + * @returns { Promise } Returns the path to the new directory in promise mode. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900015 - File exists + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900028 - Too many links + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @since 10 + */ +declare function mkdtemp(prefix: string): Promise; +/** + * Make temp dir. + * + * @param { string } prefix - dir prefix. + * @param { AsyncCallback } callback - The callback is used to return the path to the new directory. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900015 - File exists + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900028 - Too many links + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ +/** + * Make temp dir. + * + * @param { string } prefix - dir prefix. + * @param { AsyncCallback } callback - The callback is used to return the path to the new directory. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900015 - File exists + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900028 - Too many links + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @since 10 + */ +declare function mkdtemp(prefix: string, callback: AsyncCallback): void; +/** + * Make temp dir with sync interface. + * + * @param { string } prefix - dir prefix. + * @returns { string } Returns the path to the new directory. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900015 - File exists + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900028 - Too many links + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ +/** + * Make temp dir with sync interface. + * + * @param { string } prefix - dir prefix. + * @returns { string } Returns the path to the new directory. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900015 - File exists + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900028 - Too many links + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @since 10 + */ +declare function mkdtempSync(prefix: string): string; +/** + * Move directory. + * + * @param { string } src - source file path. + * @param { string } dest - destination file path. + * @param { number } [mode = 0] - move mode when duplicate file name exists. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900014 - Device or resource busy + * @throws { BusinessError } 13900015 - File exists + * @throws { BusinessError } 13900016 - Cross-device link + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900027 - Read-only file system + * @throws { BusinessError } 13900028 - Too many links + * @throws { BusinessError } 13900032 - Directory not empty + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 10 + */ +declare function moveDir(src: string, dest: string, mode?: number): Promise; +/** + * Move directory. + * + * @param { string } src - source file path. + * @param { string } dest - destination file path. + * @param { AsyncCallback } callback - Return the callback function. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900014 - Device or resource busy + * @throws { BusinessError } 13900016 - Cross-device link + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900027 - Read-only file system + * @throws { BusinessError } 13900028 - Too many links + * @throws { BusinessError } 13900032 - Directory not empty + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 10 + */ +declare function moveDir(src: string, dest: string, callback: AsyncCallback): void; +/** + * Move directory. + * + * @param { string } src - source file path. + * @param { string } dest - destination file path. + * @param { AsyncCallback> } callback - Return the callback function. + * @throws { BusinessError } 13900015 - File exists + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 10 + */ +declare function moveDir(src: string, dest: string, callback: AsyncCallback>): void; +/** + * Move directory. + * + * @param { string } src - source file path. + * @param { string } dest - destination file path. + * @param { number } mode - move mode when duplicate file name exists. + * @param { AsyncCallback } callback - Return the callback function. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900014 - Device or resource busy + * @throws { BusinessError } 13900016 - Cross-device link + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900027 - Read-only file system + * @throws { BusinessError } 13900028 - Too many links + * @throws { BusinessError } 13900032 - Directory not empty + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 10 + */ +declare function moveDir(src: string, dest: string, mode: number, callback: AsyncCallback): void; +/** + * Move directory. + * + * @param { string } src - source file path. + * @param { string } dest - destination file path. + * @param { number } mode - move mode when duplicate file name exists. + * @param { AsyncCallback> } callback - Return the callback function. + * @throws { BusinessError } 13900015 - File exists + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 10 + */ +declare function moveDir(src: string, dest: string, mode: number, callback: AsyncCallback>): void; +/** + * Move directory with sync interface. + * + * @param { string } src - source file path. + * @param { string } dest - destination file path. + * @param { number } [mode = 0] - move mode when duplicate file name exists. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900014 - Device or resource busy + * @throws { BusinessError } 13900015 - File exists + * @throws { BusinessError } 13900016 - Cross-device link + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900027 - Read-only file system + * @throws { BusinessError } 13900028 - Too many links + * @throws { BusinessError } 13900032 - Directory not empty + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 10 + */ +declare function moveDirSync(src: string, dest: string, mode?: number): void; +/** + * Move file. + * + * @param { string } src - source file path. + * @param { string } dest - destination file path. + * @param { number } [mode = 0] - move mode when duplicate file name exists. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900014 - Device or resource busy + * @throws { BusinessError } 13900015 - File exists + * @throws { BusinessError } 13900016 - Cross-device link + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900027 - Read-only file system + * @throws { BusinessError } 13900028 - Too many links + * @throws { BusinessError } 13900032 - Directory not empty + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ +/** + * Move file. + * + * @param { string } src - source file path. + * @param { string } dest - destination file path. + * @param { number } [mode = 0] - move mode when duplicate file name exists. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900014 - Device or resource busy + * @throws { BusinessError } 13900015 - File exists + * @throws { BusinessError } 13900016 - Cross-device link + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900027 - Read-only file system + * @throws { BusinessError } 13900028 - Too many links + * @throws { BusinessError } 13900032 - Directory not empty + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @since 10 + */ +declare function moveFile(src: string, dest: string, mode?: number): Promise; +/** + * Move file. + * + * @param { string } src - source file path. + * @param { string } dest - destination file path. + * @param { AsyncCallback } callback - Return the callback function. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900014 - Device or resource busy + * @throws { BusinessError } 13900015 - File exists + * @throws { BusinessError } 13900016 - Cross-device link + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900027 - Read-only file system + * @throws { BusinessError } 13900028 - Too many links + * @throws { BusinessError } 13900032 - Directory not empty + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ +/** + * Move file. + * + * @param { string } src - source file path. + * @param { string } dest - destination file path. + * @param { AsyncCallback } callback - Return the callback function. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900014 - Device or resource busy + * @throws { BusinessError } 13900015 - File exists + * @throws { BusinessError } 13900016 - Cross-device link + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900027 - Read-only file system + * @throws { BusinessError } 13900028 - Too many links + * @throws { BusinessError } 13900032 - Directory not empty + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @since 10 + */ +declare function moveFile(src: string, dest: string, callback: AsyncCallback): void; +/** + * Move file. + * + * @param { string } src - source file path. + * @param { string } dest - destination file path. + * @param { number } [mode = 0] - move mode when duplicate file name exists. + * @param { AsyncCallback } callback - Return the callback function. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900014 - Device or resource busy + * @throws { BusinessError } 13900015 - File exists + * @throws { BusinessError } 13900016 - Cross-device link + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900027 - Read-only file system + * @throws { BusinessError } 13900028 - Too many links + * @throws { BusinessError } 13900032 - Directory not empty + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ +/** + * Move file. + * + * @param { string } src - source file path. + * @param { string } dest - destination file path. + * @param { number } [mode = 0] - move mode when duplicate file name exists. + * @param { AsyncCallback } callback - Return the callback function. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900014 - Device or resource busy + * @throws { BusinessError } 13900015 - File exists + * @throws { BusinessError } 13900016 - Cross-device link + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900027 - Read-only file system + * @throws { BusinessError } 13900028 - Too many links + * @throws { BusinessError } 13900032 - Directory not empty + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @since 10 + */ +declare function moveFile(src: string, dest: string, mode: number, callback: AsyncCallback): void; +/** + * Move file with sync interface. + * + * @param { string } src - source file path. + * @param { string } dest - destination file path. + * @param { number } [mode = 0] - move mode when duplicate file name exists. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900014 - Device or resource busy + * @throws { BusinessError } 13900015 - File exists + * @throws { BusinessError } 13900016 - Cross-device link + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900027 - Read-only file system + * @throws { BusinessError } 13900028 - Too many links + * @throws { BusinessError } 13900032 - Directory not empty + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ +/** + * Move file with sync interface. + * + * @param { string } src - source file path. + * @param { string } dest - destination file path. + * @param { number } [mode = 0] - move mode when duplicate file name exists. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900014 - Device or resource busy + * @throws { BusinessError } 13900015 - File exists + * @throws { BusinessError } 13900016 - Cross-device link + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900027 - Read-only file system + * @throws { BusinessError } 13900028 - Too many links + * @throws { BusinessError } 13900032 - Directory not empty + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @since 10 + */ +declare function moveFileSync(src: string, dest: string, mode?: number): void; +/** + * Open file. + * + * @param { string } path - path. + * @param { number } [mode = OpenMode.READ_ONLY] - mode. + * @returns { Promise } Returns the File object in Promise mode to record the file descriptor. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900006 - No such device or address + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900014 - Device or resource busy + * @throws { BusinessError } 13900015 - File exists + * @throws { BusinessError } 13900017 - No such device + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900022 - Too many open files + * @throws { BusinessError } 13900023 - Text file busy + * @throws { BusinessError } 13900024 - File too large + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900027 - Read-only file system + * @throws { BusinessError } 13900029 - Resource deadlock would occur + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900038 - Value too large for defined data type + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ +/** + * Open file. + * + * @param { string } path - path. + * @param { number } [mode = OpenMode.READ_ONLY] - mode. + * @returns { Promise } Returns the File object in Promise mode to record the file descriptor. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900006 - No such device or address + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900014 - Device or resource busy + * @throws { BusinessError } 13900015 - File exists + * @throws { BusinessError } 13900017 - No such device + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900022 - Too many open files + * @throws { BusinessError } 13900023 - Text file busy + * @throws { BusinessError } 13900024 - File too large + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900027 - Read-only file system + * @throws { BusinessError } 13900029 - Resource deadlock would occur + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900038 - Value too large for defined data type + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @since 10 + */ +/** + * Open file. + * + * @param { string } path - path. + * @param { number } [mode = OpenMode.READ_ONLY] - mode. + * @returns { Promise } Returns the File object in Promise mode to record the file descriptor. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900006 - No such device or address + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900014 - Device or resource busy + * @throws { BusinessError } 13900015 - File exists + * @throws { BusinessError } 13900017 - No such device + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900022 - Too many open files + * @throws { BusinessError } 13900023 - Text file busy + * @throws { BusinessError } 13900024 - File too large + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900027 - Read-only file system + * @throws { BusinessError } 13900029 - Resource deadlock would occur + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900038 - Value too large for defined data type + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @atomicservice + * @since 11 + */ +declare function open(path: string, mode?: number): Promise; +/** + * Open file. + * + * @param { string } path - path. + * @param { AsyncCallback } callback - The callback is used to return the File object to record the file descriptor. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900006 - No such device or address + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900014 - Device or resource busy + * @throws { BusinessError } 13900015 - File exists + * @throws { BusinessError } 13900017 - No such device + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900022 - Too many open files + * @throws { BusinessError } 13900023 - Text file busy + * @throws { BusinessError } 13900024 - File too large + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900027 - Read-only file system + * @throws { BusinessError } 13900029 - Resource deadlock would occur + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900038 - Value too large for defined data type + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ +/** + * Open file. + * + * @param { string } path - path. + * @param { AsyncCallback } callback - The callback is used to return the File object to record the file descriptor. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900006 - No such device or address + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900014 - Device or resource busy + * @throws { BusinessError } 13900015 - File exists + * @throws { BusinessError } 13900017 - No such device + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900022 - Too many open files + * @throws { BusinessError } 13900023 - Text file busy + * @throws { BusinessError } 13900024 - File too large + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900027 - Read-only file system + * @throws { BusinessError } 13900029 - Resource deadlock would occur + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900038 - Value too large for defined data type + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @since 10 + */ +/** + * Open file. + * + * @param { string } path - path. + * @param { AsyncCallback } callback - The callback is used to return the File object to record the file descriptor. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900006 - No such device or address + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900014 - Device or resource busy + * @throws { BusinessError } 13900015 - File exists + * @throws { BusinessError } 13900017 - No such device + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900022 - Too many open files + * @throws { BusinessError } 13900023 - Text file busy + * @throws { BusinessError } 13900024 - File too large + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900027 - Read-only file system + * @throws { BusinessError } 13900029 - Resource deadlock would occur + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900038 - Value too large for defined data type + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @atomicservice + * @since 11 + */ +declare function open(path: string, callback: AsyncCallback): void; +/** + * Open file. + * + * @param { string } path - path. + * @param { number } [mode = OpenMode.READ_ONLY] - mode. + * @param { AsyncCallback } callback - The callback is used to return the File object to record the file descriptor. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900006 - No such device or address + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900014 - Device or resource busy + * @throws { BusinessError } 13900015 - File exists + * @throws { BusinessError } 13900017 - No such device + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900022 - Too many open files + * @throws { BusinessError } 13900023 - Text file busy + * @throws { BusinessError } 13900024 - File too large + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900027 - Read-only file system + * @throws { BusinessError } 13900029 - Resource deadlock would occur + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900038 - Value too large for defined data type + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ +/** + * Open file. + * + * @param { string } path - path. + * @param { number } [mode = OpenMode.READ_ONLY] - mode. + * @param { AsyncCallback } callback - The callback is used to return the File object to record the file descriptor. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900006 - No such device or address + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900014 - Device or resource busy + * @throws { BusinessError } 13900015 - File exists + * @throws { BusinessError } 13900017 - No such device + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900022 - Too many open files + * @throws { BusinessError } 13900023 - Text file busy + * @throws { BusinessError } 13900024 - File too large + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900027 - Read-only file system + * @throws { BusinessError } 13900029 - Resource deadlock would occur + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900038 - Value too large for defined data type + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @since 10 + */ +/** + * Open file. + * + * @param { string } path - path. + * @param { number } [mode = OpenMode.READ_ONLY] - mode. + * @param { AsyncCallback } callback - The callback is used to return the File object to record the file descriptor. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900006 - No such device or address + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900014 - Device or resource busy + * @throws { BusinessError } 13900015 - File exists + * @throws { BusinessError } 13900017 - No such device + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900022 - Too many open files + * @throws { BusinessError } 13900023 - Text file busy + * @throws { BusinessError } 13900024 - File too large + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900027 - Read-only file system + * @throws { BusinessError } 13900029 - Resource deadlock would occur + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900038 - Value too large for defined data type + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @atomicservice + * @since 11 + */ +declare function open(path: string, mode: number, callback: AsyncCallback): void; +/** + * Open file with sync interface. + * + * @param { string } path - path. + * @param { number } [mode = OpenMode.READ_ONLY] - mode. + * @returns { File } Returns the File object to record the file descriptor. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900006 - No such device or address + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900014 - Device or resource busy + * @throws { BusinessError } 13900015 - File exists + * @throws { BusinessError } 13900017 - No such device + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900022 - Too many open files + * @throws { BusinessError } 13900023 - Text file busy + * @throws { BusinessError } 13900024 - File too large + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900027 - Read-only file system + * @throws { BusinessError } 13900029 - Resource deadlock would occur + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900038 - Value too large for defined data type + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ +/** + * Open file with sync interface. + * + * @param { string } path - path. + * @param { number } [mode = OpenMode.READ_ONLY] - mode. + * @returns { File } Returns the File object to record the file descriptor. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900006 - No such device or address + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900014 - Device or resource busy + * @throws { BusinessError } 13900015 - File exists + * @throws { BusinessError } 13900017 - No such device + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900022 - Too many open files + * @throws { BusinessError } 13900023 - Text file busy + * @throws { BusinessError } 13900024 - File too large + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900027 - Read-only file system + * @throws { BusinessError } 13900029 - Resource deadlock would occur + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900038 - Value too large for defined data type + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @since 10 + */ +/** + * Open file with sync interface. + * + * @param { string } path - path. + * @param { number } [mode = OpenMode.READ_ONLY] - mode. + * @returns { File } Returns the File object to record the file descriptor. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900006 - No such device or address + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900014 - Device or resource busy + * @throws { BusinessError } 13900015 - File exists + * @throws { BusinessError } 13900017 - No such device + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900022 - Too many open files + * @throws { BusinessError } 13900023 - Text file busy + * @throws { BusinessError } 13900024 - File too large + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900027 - Read-only file system + * @throws { BusinessError } 13900029 - Resource deadlock would occur + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900038 - Value too large for defined data type + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @atomicservice + * @since 11 + */ +declare function openSync(path: string, mode?: number): File; +/** + * Read file. + * + * @param { number } fd - file descriptor. + * @param { ArrayBuffer } buffer - buffer. + * @param { object } [options] - options. + * @returns { Promise } Returns the number of file bytes read to buffer in promise mode. + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900010 - Try again + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ +/** + * Read file. + * + * @param { number } fd - file descriptor. + * @param { ArrayBuffer } buffer - buffer. + * @param { object } [options] - options. + * @returns { Promise } Returns the number of file bytes read to buffer in promise mode. + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900010 - Try again + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @since 10 + */ +/** + * Read file. + * + * @param { number } fd - file descriptor. + * @param { ArrayBuffer } buffer - buffer. + * @param { ReadOptions } [options] - options. + * @returns { Promise } Returns the number of file bytes read to buffer in promise mode. + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900010 - Try again + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @atomicservice + * @since 11 + */ +declare function read(fd: number, buffer: ArrayBuffer, options?: ReadOptions): Promise; +/** + * Read file. + * + * @param { number } fd - file descriptor. + * @param { ArrayBuffer } buffer - buffer. + * @param { AsyncCallback } callback - The callback is used to return the number of file bytes read to buffer. + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900010 - Try again + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ +/** + * Read file. + * + * @param { number } fd - file descriptor. + * @param { ArrayBuffer } buffer - buffer. + * @param { AsyncCallback } callback - The callback is used to return the number of file bytes read to buffer. + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900010 - Try again + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @since 10 + */ +/** + * Read file. + * + * @param { number } fd - file descriptor. + * @param { ArrayBuffer } buffer - buffer. + * @param { AsyncCallback } callback - The callback is used to return the number of file bytes read to buffer. + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900010 - Try again + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @atomicservice + * @since 11 + */ +declare function read(fd: number, buffer: ArrayBuffer, callback: AsyncCallback): void; +/** + * Read file. + * + * @param { number } fd - file descriptor. + * @param { ArrayBuffer } buffer - buffer. + * @param { object } [options] - options. + * @param { AsyncCallback } callback - The callback is used to return the number of file bytes read to buffer. + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900010 - Try again + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ +/** + * Read file. + * + * @param { number } fd - file descriptor. + * @param { ArrayBuffer } buffer - buffer. + * @param { object } [options] - options. + * @param { AsyncCallback } callback - The callback is used to return the number of file bytes read to buffer. + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900010 - Try again + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @since 10 + */ +/** + * Read file. + * + * @param { number } fd - file descriptor. + * @param { ArrayBuffer } buffer - buffer. + * @param { ReadOptions } [options] - options. + * @param { AsyncCallback } callback - The callback is used to return the number of file bytes read to buffer. + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900010 - Try again + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @atomicservice + * @since 11 + */ +declare function read(fd: number, buffer: ArrayBuffer, options: ReadOptions, callback: AsyncCallback): void; +/** + * Read file with sync interface. + * + * @param { number } fd - file descriptor. + * @param { ArrayBuffer } buffer - buffer. + * @param { object } [options] - options. + * @returns { number } Returns the number of file bytes read to buffer. + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900010 - Try again + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ +/** + * Read file with sync interface. + * + * @param { number } fd - file descriptor. + * @param { ArrayBuffer } buffer - buffer. + * @param { object } [options] - options. + * @returns { number } Returns the number of file bytes read to buffer. + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900010 - Try again + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @since 10 + */ +/** + * Read file with sync interface. + * + * @param { number } fd - file descriptor. + * @param { ArrayBuffer } buffer - buffer. + * @param { ReadOptions } [options] - options. + * @returns { number } Returns the number of file bytes read to buffer. + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900010 - Try again + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @atomicservice + * @since 11 + */ +declare function readSync(fd: number, buffer: ArrayBuffer, options?: ReadOptions): number; +/** + * Read content line by line. + * + * @param { string } filePath - file path. + * @param { Options } [options] - optional parameters + * @returns { Promise } Returns the iterator object in promise mode. + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900015 - File exists + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900022 - Too many open files + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900027 - Read-only file system + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 11 + */ +declare function readLines(filePath: string, options?: Options): Promise; +/** + * Read content line by line. + * + * @param { string } filePath - file path. + * @param { AsyncCallback } callback - The callback is used to return the iterator object. + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900015 - File exists + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900022 - Too many open files + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900027 - Read-only file system + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 11 + */ +declare function readLines(filePath: string, callback: AsyncCallback): void; +/** + * Read content line by line. + * + * @param { string } filePath - file path. + * @param { Options } options - optional parameters + * @param { AsyncCallback } callback - The callback is used to return the iterator object. + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900015 - File exists + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900022 - Too many open files + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900027 - Read-only file system + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 11 + */ +declare function readLines(filePath: string, options: Options, callback: AsyncCallback): void; +/** + * Read content line by line with sync interface. + * + * @param { string } filePath - file path. + * @param { Options } [options] - optional parameters + * @returns { ReaderIterator } Returns the iterator object. + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900015 - File exists + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900022 - Too many open files + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900027 - Read-only file system + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 11 + */ +declare function readLinesSync(filePath: string, options?: Options): ReaderIterator; +/** + * Read text. + * + * @param { string } filePath - file path. + * @param { object } [options] - options. + * @returns { Promise } Returns the contents of the read file in promise mode. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900010 - Try again + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900024 - File too large + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ +/** + * Read text. + * + * @param { string } filePath - file path. + * @param { object } [options] - options. + * @returns { Promise } Returns the contents of the read file in promise mode. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900010 - Try again + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900024 - File too large + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @since 10 + */ +/** + * Read text. + * + * @param { string } filePath - file path. + * @param { ReadTextOptions } [options] - options. + * @returns { Promise } Returns the contents of the read file in promise mode. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900010 - Try again + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900024 - File too large + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @atomicservice + * @since 11 + */ +declare function readText(filePath: string, options?: ReadTextOptions): Promise; +/** + * Read text. + * + * @param { string } filePath - file path. + * @param { AsyncCallback } callback - The callback is used to return the contents of the read file. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900010 - Try again + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900024 - File too large + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ +/** + * Read text. + * + * @param { string } filePath - file path. + * @param { AsyncCallback } callback - The callback is used to return the contents of the read file. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900010 - Try again + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900024 - File too large + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @since 10 + */ +/** + * Read text. + * + * @param { string } filePath - file path. + * @param { AsyncCallback } callback - The callback is used to return the contents of the read file. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900010 - Try again + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900024 - File too large + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @atomicservice + * @since 11 + */ +declare function readText(filePath: string, callback: AsyncCallback): void; +/** + * Read text. + * + * @param { string } filePath - file path. + * @param { object } [options] - options. + * @param { AsyncCallback } callback - The callback is used to return the contents of the read file. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900010 - Try again + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900024 - File too large + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ +/** + * Read text. + * + * @param { string } filePath - file path. + * @param { object } [options] - options. + * @param { AsyncCallback } callback - The callback is used to return the contents of the read file. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900010 - Try again + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900024 - File too large + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @since 10 + */ +/** + * Read text. + * + * @param { string } filePath - file path. + * @param { ReadTextOptions } [options] - options. + * @param { AsyncCallback } callback - The callback is used to return the contents of the read file. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900010 - Try again + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900024 - File too large + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @atomicservice + * @since 11 + */ +declare function readText(filePath: string, options: ReadTextOptions, callback: AsyncCallback): void; +/** + * Read text with sync interface. + * + * @param { string } filePath - file path. + * @param { object } [options] - options. + * @returns { string } Returns the contents of the read file. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900010 - Try again + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900024 - File too large + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ +/** + * Read text with sync interface. + * + * @param { string } filePath - file path. + * @param { object } [options] - options. + * @returns { string } Returns the contents of the read file. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900010 - Try again + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900024 - File too large + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @since 10 + */ +/** + * Read text with sync interface. + * + * @param { string } filePath - file path. + * @param { ReadTextOptions } [options] - options. + * @returns { string } Returns the contents of the read file. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900010 - Try again + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900024 - File too large + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @atomicservice + * @since 11 + */ +declare function readTextSync(filePath: string, options?: ReadTextOptions): string; +/** + * Rename file. + * + * @param { string } oldPath - oldPath. + * @param { string } newPath - newPath. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900014 - Device or resource busy + * @throws { BusinessError } 13900015 - File exists + * @throws { BusinessError } 13900016 - Cross-device link + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900027 - Read-only file system + * @throws { BusinessError } 13900028 - Too many links + * @throws { BusinessError } 13900032 - Directory not empty + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ +/** + * Rename file. + * + * @param { string } oldPath - oldPath. + * @param { string } newPath - newPath. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900014 - Device or resource busy + * @throws { BusinessError } 13900015 - File exists + * @throws { BusinessError } 13900016 - Cross-device link + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900027 - Read-only file system + * @throws { BusinessError } 13900028 - Too many links + * @throws { BusinessError } 13900032 - Directory not empty + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @since 10 + */ +/** + * Rename file. + * + * @param { string } oldPath - oldPath. + * @param { string } newPath - newPath. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900014 - Device or resource busy + * @throws { BusinessError } 13900015 - File exists + * @throws { BusinessError } 13900016 - Cross-device link + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900027 - Read-only file system + * @throws { BusinessError } 13900028 - Too many links + * @throws { BusinessError } 13900032 - Directory not empty + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @atomicservice + * @since 11 + */ +declare function rename(oldPath: string, newPath: string): Promise; +/** + * Rename file. + * + * @param { string } oldPath - oldPath. + * @param { string } newPath - newPath. + * @param { AsyncCallback } callback - Returns the callback function. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900014 - Device or resource busy + * @throws { BusinessError } 13900015 - File exists + * @throws { BusinessError } 13900016 - Cross-device link + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900027 - Read-only file system + * @throws { BusinessError } 13900028 - Too many links + * @throws { BusinessError } 13900032 - Directory not empty + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ +/** + * Rename file. + * + * @param { string } oldPath - oldPath. + * @param { string } newPath - newPath. + * @param { AsyncCallback } callback - Returns the callback function. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900014 - Device or resource busy + * @throws { BusinessError } 13900015 - File exists + * @throws { BusinessError } 13900016 - Cross-device link + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900027 - Read-only file system + * @throws { BusinessError } 13900028 - Too many links + * @throws { BusinessError } 13900032 - Directory not empty + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @since 10 + */ +/** + * Rename file. + * + * @param { string } oldPath - oldPath. + * @param { string } newPath - newPath. + * @param { AsyncCallback } callback - Returns the callback function. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900014 - Device or resource busy + * @throws { BusinessError } 13900015 - File exists + * @throws { BusinessError } 13900016 - Cross-device link + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900027 - Read-only file system + * @throws { BusinessError } 13900028 - Too many links + * @throws { BusinessError } 13900032 - Directory not empty + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @atomicservice + * @since 11 + */ +declare function rename(oldPath: string, newPath: string, callback: AsyncCallback): void; +/** + * Rename file with sync interface. + * + * @param { string } oldPath - oldPath. + * @param { string } newPath - newPath. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900014 - Device or resource busy + * @throws { BusinessError } 13900015 - File exists + * @throws { BusinessError } 13900016 - Cross-device link + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900027 - Read-only file system + * @throws { BusinessError } 13900028 - Too many links + * @throws { BusinessError } 13900032 - Directory not empty + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ +/** + * Rename file with sync interface. + * + * @param { string } oldPath - oldPath. + * @param { string } newPath - newPath. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900014 - Device or resource busy + * @throws { BusinessError } 13900015 - File exists + * @throws { BusinessError } 13900016 - Cross-device link + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900027 - Read-only file system + * @throws { BusinessError } 13900028 - Too many links + * @throws { BusinessError } 13900032 - Directory not empty + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @since 10 + */ +/** + * Rename file with sync interface. + * + * @param { string } oldPath - oldPath. + * @param { string } newPath - newPath. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900014 - Device or resource busy + * @throws { BusinessError } 13900015 - File exists + * @throws { BusinessError } 13900016 - Cross-device link + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900027 - Read-only file system + * @throws { BusinessError } 13900028 - Too many links + * @throws { BusinessError } 13900032 - Directory not empty + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @atomicservice + * @since 11 + */ +declare function renameSync(oldPath: string, newPath: string): void; +/** + * Delete dir. + * + * @param { string } path - path. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900014 - Device or resource busy + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900027 - Read-only file system1 + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900032 - Directory not empty + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ +/** + * Delete dir. + * + * @param { string } path - path. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900014 - Device or resource busy + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900027 - Read-only file system1 + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900032 - Directory not empty + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @since 10 + */ +/** + * Delete dir. + * + * @param { string } path - path. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900014 - Device or resource busy + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900027 - Read-only file system1 + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900032 - Directory not empty + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @atomicservice + * @since 11 + */ +declare function rmdir(path: string): Promise; +/** + * Delete dir. + * + * @param { string } path - path. + * @param { AsyncCallback } callback - Return the callback function. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900014 - Device or resource busy + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900027 - Read-only file system1 + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900032 - Directory not empty + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ +/** + * Delete dir. + * + * @param { string } path - path. + * @param { AsyncCallback } callback - Return the callback function. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900014 - Device or resource busy + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900027 - Read-only file system1 + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900032 - Directory not empty + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @since 10 + */ +/** + * Delete dir. + * + * @param { string } path - path. + * @param { AsyncCallback } callback - Return the callback function. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900014 - Device or resource busy + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900027 - Read-only file system1 + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900032 - Directory not empty + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @atomicservice + * @since 11 + */ +declare function rmdir(path: string, callback: AsyncCallback): void; +/** + * Delete dir with sync interface. + * + * @param { string } path - path. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900014 - Device or resource busy + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900027 - Read-only file system1 + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900032 - Directory not empty + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ +/** + * Delete dir with sync interface. + * + * @param { string } path - path. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900014 - Device or resource busy + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900027 - Read-only file system1 + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900032 - Directory not empty + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @since 10 + */ +/** + * Delete dir with sync interface. + * + * @param { string } path - path. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900014 - Device or resource busy + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900027 - Read-only file system1 + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900032 - Directory not empty + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @atomicservice + * @since 11 + */ +declare function rmdirSync(path: string): void; +/** + * Get file information. + * + * @param { string | number } file - path or file descriptor. + * @returns { Promise } Returns the Stat object in promise mode. + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900031 - Function not implemented + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900038 - Value too large for defined data type + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ +/** + * Get file information. + * + * @param { string | number } file - path or file descriptor. + * @returns { Promise } Returns the Stat object in promise mode. + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900031 - Function not implemented + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900038 - Value too large for defined data type + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @since 10 + */ +/** + * Get file information. + * + * @param { string | number } file - path or file descriptor. + * @returns { Promise } Returns the Stat object in promise mode. + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900031 - Function not implemented + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900038 - Value too large for defined data type + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @atomicservice + * @since 11 + */ +declare function stat(file: string | number): Promise; +/** + * Get file information. + * + * @param { string | number } file - path or file descriptor. + * @param { AsyncCallback } callback - The callback is used to return the Stat object. + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900031 - Function not implemented + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900038 - Value too large for defined data type + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ +/** + * Get file information. + * + * @param { string | number } file - path or file descriptor. + * @param { AsyncCallback } callback - The callback is used to return the Stat object. + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900031 - Function not implemented + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900038 - Value too large for defined data type + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @since 10 + */ +/** + * Get file information. + * + * @param { string | number } file - path or file descriptor. + * @param { AsyncCallback } callback - The callback is used to return the Stat object. + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900031 - Function not implemented + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900038 - Value too large for defined data type + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @atomicservice + * @since 11 + */ +declare function stat(file: string | number, callback: AsyncCallback): void; +/** + * Get file information with sync interface. + * + * @param { string | number } file - path or file descriptor. + * @returns { Stat } Returns the Stat object. + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900031 - Function not implemented + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900038 - Value too large for defined data type + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ +/** + * Get file information with sync interface. + * + * @param { string | number } file - path or file descriptor. + * @returns { Stat } Returns the Stat object. + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900031 - Function not implemented + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900038 - Value too large for defined data type + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @since 10 + */ +/** + * Get file information with sync interface. + * + * @param { string | number } file - path or file descriptor. + * @returns { Stat } Returns the Stat object. + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900031 - Function not implemented + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900038 - Value too large for defined data type + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @atomicservice + * @since 11 + */ +declare function statSync(file: string | number): Stat; +/** + * Link file. + * + * @param { string } target - target. + * @param { string } srcPath - srcPath. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900015 - File exists + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900027 - Read-only file system + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ +declare function symlink(target: string, srcPath: string): Promise; +/** + * Link file. + * + * @param { string } target - target. + * @param { string } srcPath - srcPath. + * @param { AsyncCallback } callback - Return the callback function. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900015 - File exists + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900027 - Read-only file system + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ +declare function symlink(target: string, srcPath: string, callback: AsyncCallback): void; +/** + * Link file with sync interface. + * + * @param { string } target - target. + * @param { string } srcPath - srcPath. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900015 - File exists + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900027 - Read-only file system + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ +declare function symlinkSync(target: string, srcPath: string): void; +/** + * Truncate file. + * + * @param { string | number } file - path or file descriptor. + * @param { number } [len = 0] - len. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900023 - Text file busy + * @throws { BusinessError } 13900024 - File too large + * @throws { BusinessError } 13900027 - Read-only file system + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ +/** + * Truncate file. + * + * @param { string | number } file - path or file descriptor. + * @param { number } [len = 0] - len. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900023 - Text file busy + * @throws { BusinessError } 13900024 - File too large + * @throws { BusinessError } 13900027 - Read-only file system + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @since 10 + */ +/** + * Truncate file. + * + * @param { string | number } file - path or file descriptor. + * @param { number } [len = 0] - len. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900023 - Text file busy + * @throws { BusinessError } 13900024 - File too large + * @throws { BusinessError } 13900027 - Read-only file system + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @atomicservice + * @since 11 + */ +declare function truncate(file: string | number, len?: number): Promise; +/** + * Truncate file. + * + * @param { string | number } file - path or file descriptor. + * @param { AsyncCallback } callback - Return the callback function. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900023 - Text file busy + * @throws { BusinessError } 13900024 - File too large + * @throws { BusinessError } 13900027 - Read-only file system + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ +/** + * Truncate file. + * + * @param { string | number } file - path or file descriptor. + * @param { AsyncCallback } callback - Return the callback function. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900023 - Text file busy + * @throws { BusinessError } 13900024 - File too large + * @throws { BusinessError } 13900027 - Read-only file system + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @since 10 + */ +/** + * Truncate file. + * + * @param { string | number } file - path or file descriptor. + * @param { AsyncCallback } callback - Return the callback function. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900023 - Text file busy + * @throws { BusinessError } 13900024 - File too large + * @throws { BusinessError } 13900027 - Read-only file system + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @atomicservice + * @since 11 + */ +declare function truncate(file: string | number, callback: AsyncCallback): void; +/** + * Truncate file. + * + * @param { string | number } file - path or file descriptor. + * @param { number } [len = 0] - len. + * @param { AsyncCallback } callback - Return the callback function. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900023 - Text file busy + * @throws { BusinessError } 13900024 - File too large + * @throws { BusinessError } 13900027 - Read-only file system + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ +/** + * Truncate file. + * + * @param { string | number } file - path or file descriptor. + * @param { number } [len = 0] - len. + * @param { AsyncCallback } callback - Return the callback function. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900023 - Text file busy + * @throws { BusinessError } 13900024 - File too large + * @throws { BusinessError } 13900027 - Read-only file system + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @since 10 + */ +/** + * Truncate file. + * + * @param { string | number } file - path or file descriptor. + * @param { number } [len = 0] - len. + * @param { AsyncCallback } callback - Return the callback function. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900023 - Text file busy + * @throws { BusinessError } 13900024 - File too large + * @throws { BusinessError } 13900027 - Read-only file system + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @atomicservice + * @since 11 + */ +declare function truncate(file: string | number, len: number, callback: AsyncCallback): void; +/** + * Truncate file with sync interface. + * + * @param { string | number } file - path or file descriptor. + * @param { number } [len = 0] - len. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900023 - Text file busy + * @throws { BusinessError } 13900024 - File too large + * @throws { BusinessError } 13900027 - Read-only file system + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ +/** + * Truncate file with sync interface. + * + * @param { string | number } file - path or file descriptor. + * @param { number } [len = 0] - len. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900023 - Text file busy + * @throws { BusinessError } 13900024 - File too large + * @throws { BusinessError } 13900027 - Read-only file system + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @since 10 + */ +/** + * Truncate file with sync interface. + * + * @param { string | number } file - path or file descriptor. + * @param { number } [len = 0] - len. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900023 - Text file busy + * @throws { BusinessError } 13900024 - File too large + * @throws { BusinessError } 13900027 - Read-only file system + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @atomicservice + * @since 11 + */ +declare function truncateSync(file: string | number, len?: number): void; +/** + * Delete file. + * + * @param { string } path - path. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900014 - Device or resource busy + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900027 - Read-only file system + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ +/** + * Delete file. + * + * @param { string } path - path. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900014 - Device or resource busy + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900027 - Read-only file system + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @since 10 + */ +/** + * Delete file. + * + * @param { string } path - path. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900014 - Device or resource busy + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900027 - Read-only file system + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @atomicservice + * @since 11 + */ +declare function unlink(path: string): Promise; +/** + * Delete file. + * + * @param { string } path - path. + * @param { AsyncCallback } callback - Return the callback function. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900014 - Device or resource busy + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900027 - Read-only file system + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ +/** + * Delete file. + * + * @param { string } path - path. + * @param { AsyncCallback } callback - Return the callback function. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900014 - Device or resource busy + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900027 - Read-only file system + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @since 10 + */ +/** + * Delete file. + * + * @param { string } path - path. + * @param { AsyncCallback } callback - Return the callback function. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900014 - Device or resource busy + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900027 - Read-only file system + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @atomicservice + * @since 11 + */ +declare function unlink(path: string, callback: AsyncCallback): void; +/** + * Delete file with sync interface. + * + * @param { string } path - path. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900014 - Device or resource busy + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900027 - Read-only file system + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ +/** + * Delete file with sync interface. + * + * @param { string } path - path. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900014 - Device or resource busy + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900027 - Read-only file system + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @since 10 + */ +/** + * Delete file with sync interface. + * + * @param { string } path - path. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900014 - Device or resource busy + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900027 - Read-only file system + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @atomicservice + * @since 11 + */ +declare function unlinkSync(path: string): void; +/** + * Change file mtime. + * + * @param { string } path - path. + * @param { number } mtime - last modification time + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900027 - Read-only file system + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 11 + */ +/** + * Change file mtime. + * + * @param { string } path - path. + * @param { number } mtime - last modification time + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900027 - Read-only file system + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @since 12 + */ +declare function utimes(path: string, mtime: number): void; +/** + * Write file. + * + * @param { number } fd - file descriptor. + * @param { ArrayBuffer | string } buffer - buffer. + * @param { object } [options] - options. + * @returns { Promise } Returns the number of bytes written to the file in promise mode. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900010 - Try again + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900024 - File too large + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ +/** + * Write file. + * + * @param { number } fd - file descriptor. + * @param { ArrayBuffer | string } buffer - buffer. + * @param { object } [options] - options. + * @returns { Promise } Returns the number of bytes written to the file in promise mode. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900010 - Try again + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900024 - File too large + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @since 10 + */ +/** + * Write file. + * + * @param { number } fd - file descriptor. + * @param { ArrayBuffer | string } buffer - buffer. + * @param { WriteOptions } [options] - options. + * @returns { Promise } Returns the number of bytes written to the file in promise mode. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900010 - Try again + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900024 - File too large + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @atomicservice + * @since 11 + */ +declare function write(fd: number, buffer: ArrayBuffer | string, options?: WriteOptions): Promise; +/** + * Write file. + * + * @param { number } fd - file descriptor. + * @param { ArrayBuffer | string } buffer - buffer. + * @param { AsyncCallback } callback - The callback is used to return the number of bytes written to the file. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900010 - Try again + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900024 - File too large + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ +/** + * Write file. + * + * @param { number } fd - file descriptor. + * @param { ArrayBuffer | string } buffer - buffer. + * @param { AsyncCallback } callback - The callback is used to return the number of bytes written to the file. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900010 - Try again + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900024 - File too large + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @since 10 + */ +/** + * Write file. + * + * @param { number } fd - file descriptor. + * @param { ArrayBuffer | string } buffer - buffer. + * @param { AsyncCallback } callback - The callback is used to return the number of bytes written to the file. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900010 - Try again + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900024 - File too large + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @atomicservice + * @since 11 + */ +declare function write(fd: number, buffer: ArrayBuffer | string, callback: AsyncCallback): void; +/** + * Write file. + * + * @param { number } fd - file descriptor. + * @param { ArrayBuffer | string } buffer - buffer. + * @param { object } [options] - options. + * @param { AsyncCallback } callback - The callback is used to return the number of bytes written to the file. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900010 - Try again + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900024 - File too large + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ +/** + * Write file. + * + * @param { number } fd - file descriptor. + * @param { ArrayBuffer | string } buffer - buffer. + * @param { object } [options] - options. + * @param { AsyncCallback } callback - The callback is used to return the number of bytes written to the file. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900010 - Try again + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900024 - File too large + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @since 10 + */ +/** + * Write file. + * + * @param { number } fd - file descriptor. + * @param { ArrayBuffer | string } buffer - buffer. + * @param { WriteOptions } [options] - options. + * @param { AsyncCallback } callback - The callback is used to return the number of bytes written to the file. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900010 - Try again + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900024 - File too large + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @atomicservice + * @since 11 + */ +declare function write(fd: number, buffer: ArrayBuffer | string, options: WriteOptions, callback: AsyncCallback): void; +/** + * Write file with sync interface. + * + * @param { number } fd - file descriptor. + * @param { ArrayBuffer | string } buffer - buffer. + * @param { object } [options] - options. + * @returns { number } Returns the number of bytes written to the file. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900010 - Try again + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900024 - File too large + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ +/** + * Write file with sync interface. + * + * @param { number } fd - file descriptor. + * @param { ArrayBuffer | string } buffer - buffer. + * @param { object } [options] - options. + * @returns { number } Returns the number of bytes written to the file. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900010 - Try again + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900024 - File too large + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @since 10 + */ +/** + * Write file with sync interface. + * + * @param { number } fd - file descriptor. + * @param { ArrayBuffer | string } buffer - buffer. + * @param { WriteOptions } [options] - options. + * @returns { number } Returns the number of bytes written to the file. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900010 - Try again + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900024 - File too large + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @atomicservice + * @since 11 + */ +declare function writeSync(fd: number, buffer: ArrayBuffer | string, options?: WriteOptions): number; +/** + * Connect Distributed File System. + * + * @param { string } networkId - The networkId of device. + * @param { DfsListeners } listeners - The listeners of Distributed File System. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - The parameter check failed.Possible causes:1.Mandatory +parameters are left unspecified; + *
2.Incorrect parameter types. + * @throws { BusinessError } 13900045 - Connection failed. + * @throws { BusinessError } 13900046 - Software caused connection abort. + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 12 + */ +declare function connectDfs(networkId: string, listeners: DfsListeners): Promise; +/** + * Disconnect Distributed File System. + * + * @param { string } networkId - The networkId of device. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - The parameter check failed.Possible causes:1.Mandatory +parameters are left unspecified; + *
2.Incorrect parameter types. + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 12 + */ +declare function disconnectDfs(networkId: string): Promise; +/** + * Progress data of copyFile + * + * @typedef Progress + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 11 + */ +interface Progress { + /** + * @type { number } + * @readonly + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 11 + */ + readonly processedSize: number; + /** + * @type { number } + * @readonly + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 11 + */ + readonly totalSize: number; +} +/** + * Get options of copy + * + * @typedef CopyOptions + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 11 + */ +interface CopyOptions { + /** + * Listener of copy progress + * + * @type { ?ProgressListener } + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 11 + */ + progressListener?: ProgressListener; +} +/** + * Listener of copy progress. + * + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 11 + */ +type ProgressListener = (progress: Progress) => void; +/** + * File object. + * + * @interface File + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ +/** + * File object. + * + * @interface File + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @since 10 + */ +/** + * File object. + * + * @interface File + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @atomicservice + * @since 11 + */ +declare interface File { + /** + * @type { number } + * @readonly + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ + /** + * @type { number } + * @readonly + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @since 10 + */ + /** + * @type { number } + * @readonly + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @atomicservice + * @since 11 + */ + readonly fd: number; + /** + * File path + * + * @type { string } + * @readonly + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900042 - Unknown error + * @throws { BusinessError } 14300002 - Invalid uri + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 10 + */ + readonly path: string; + /** + * File name + * + * @type { string } + * @readonly + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 10 + */ + readonly name: string; + /** + * Get parent path of file. + * + * @returns { string } Return the parent path of file. + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900042 - Unknown error + * @throws { BusinessError } 14300002 - Invalid uri + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 11 + */ + getParent(): string; + /** + * Lock file with blocking method. + * + * @param { boolean } exclusive - whether lock is exclusive. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900042 - Unknown error + * @throws { BusinessError } 13900043 - No record locks available + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ + lock(exclusive?: boolean): Promise; + /** + * Lock file with blocking method. + * + * @param { AsyncCallback } callback - Return the callback function. + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900042 - Unknown error + * @throws { BusinessError } 13900043 - No record locks available + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ + lock(callback: AsyncCallback): void; + /** + * Lock file with blocking method. + * + * @param { boolean } exclusive - whether lock is exclusive. + * @param { AsyncCallback } callback - Return the callback function. + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900042 - Unknown error + * @throws { BusinessError } 13900043 - No record locks available + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ + lock(exclusive: boolean, callback: AsyncCallback): void; + /** + * Try to lock file with returning results immediately. + * + * @param { boolean } exclusive - whether lock is exclusive. + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900042 - Unknown error + * @throws { BusinessError } 13900043 - No record locks available + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ + tryLock(exclusive?: boolean): void; + /** + * Unlock file. + * + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900042 - Unknown error + * @throws { BusinessError } 13900043 - No record locks available + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ + unlock(): void; +} +/** + * RandomAccessFile object. + * + * @interface RandomAccessFile + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 10 + */ +declare interface RandomAccessFile { + /** + * File descriptor + * + * @type { number } + * @readonly + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 10 + */ + readonly fd: number; + /** + * File pointer + * + * @type { number } + * @readonly + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 10 + */ + readonly filePointer: number; + /** + * Set file pointer. + * + * @param { number } filePointer - filePointer. + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 10 + */ + setFilePointer(filePointer: number): void; + /** + * Close randomAccessFile with sync interface. + * + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 10 + */ + close(): void; + /** + * Write randomAccessFile. + * + * @param { ArrayBuffer | string } buffer - buffer. + * @param { object } [options] - options. + * @returns { Promise } Returns the number of bytes written to the file in promise mode. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900010 - Try again + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900024 - File too large + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 10 + */ + /** + * Write randomAccessFile. + * + * @param { ArrayBuffer | string } buffer - buffer. + * @param { WriteOptions } [options] - options. + * @returns { Promise } Returns the number of bytes written to the file in promise mode. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900010 - Try again + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900024 - File too large + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 11 + */ + write(buffer: ArrayBuffer | string, options?: WriteOptions): Promise; + /** + * Write randomAccessFile. + * + * @param { ArrayBuffer | string } buffer - buffer. + * @param { AsyncCallback } callback - The callback is used to return the number of bytes written to the file. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900010 - Try again + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900024 - File too large + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 10 + */ + write(buffer: ArrayBuffer | string, callback: AsyncCallback): void; + /** + * Write randomAccessFile. + * + * @param { ArrayBuffer | string } buffer - buffer. + * @param { object } [options] - options. + * @param { AsyncCallback } callback - The callback is used to return the number of bytes written to the file. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900010 - Try again + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900024 - File too large + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 10 + */ + /** + * Write randomAccessFile. + * + * @param { ArrayBuffer | string } buffer - buffer. + * @param { WriteOptions } [options] - options. + * @param { AsyncCallback } callback - The callback is used to return the number of bytes written to the file. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900010 - Try again + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900024 - File too large + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 11 + */ + write(buffer: ArrayBuffer | string, options: WriteOptions, callback: AsyncCallback): void; + /** + * Write randomAccessFile with sync interface. + * + * @param { ArrayBuffer | string } buffer - buffer. + * @param { object } [options] - options. + * @returns { number } Returns the number of bytes written to the file. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900010 - Try again + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900024 - File too large + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 10 + */ + /** + * Write randomAccessFile with sync interface. + * + * @param { ArrayBuffer | string } buffer - buffer. + * @param { WriteOptions } [options] - options. + * @returns { number } Returns the number of bytes written to the file. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900010 - Try again + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900024 - File too large + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 11 + */ + writeSync(buffer: ArrayBuffer | string, options?: WriteOptions): number; + /** + * Read randomAccessFile. + * + * @param { ArrayBuffer } buffer - buffer. + * @param { object } [options] - options. + * @returns { Promise } Returns the number of file bytes read to buffer in promise mode. + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900010 - Try again + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 10 + */ + /** + * Read randomAccessFile. + * + * @param { ArrayBuffer } buffer - buffer. + * @param { ReadOptions } [options] - options. + * @returns { Promise } Returns the number of file bytes read to buffer in promise mode. + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900010 - Try again + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 11 + */ + read(buffer: ArrayBuffer, options?: ReadOptions): Promise; + /** + * Read randomAccessFile. + * + * @param { ArrayBuffer } buffer - buffer. + * @param { AsyncCallback } callback - The callback is used to return the number of file bytes read to buffer. + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900010 - Try again + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 10 + */ + read(buffer: ArrayBuffer, callback: AsyncCallback): void; + /** + * Read randomAccessFile. + * + * @param { ArrayBuffer } buffer - buffer. + * @param { object } [options] - options. + * @param { AsyncCallback } callback - The callback is used to return the number of file bytes read to buffer. + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900010 - Try again + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 10 + */ + /** + * Read randomAccessFile. + * + * @param { ArrayBuffer } buffer - buffer. + * @param { ReadOptions } [options] - options. + * @param { AsyncCallback } callback - The callback is used to return the number of file bytes read to buffer. + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900010 - Try again + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 11 + */ + read(buffer: ArrayBuffer, options: ReadOptions, callback: AsyncCallback): void; + /** + * Read randomAccessFile with sync interface. + * + * @param { ArrayBuffer } buffer - buffer. + * @param { object } [options] - options. + * @returns { number } Returns the number of file bytes read to buffer. + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900010 - Try again + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 10 + */ + /** + * Read randomAccessFile with sync interface. + * + * @param { ArrayBuffer } buffer - buffer. + * @param { ReadOptions } [options] - options. + * @returns { number } Returns the number of file bytes read to buffer. + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900010 - Try again + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 11 + */ + readSync(buffer: ArrayBuffer, options?: ReadOptions): number; +} +/** + * Stat object. + * + * @interface Stat + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ +/** + * Stat object. + * + * @interface Stat + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @since 10 + */ +/** + * Stat object. + * + * @interface Stat + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @atomicservice + * @since 11 + */ +declare interface Stat { + /** + * @type { bigint } + * @readonly + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ + /** + * @type { bigint } + * @readonly + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @since 10 + */ + readonly ino: bigint; + /** + * @type { number } + * @readonly + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ + /** + * @type { number } + * @readonly + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @since 10 + */ + /** + * @type { number } + * @readonly + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @atomicservice + * @since 11 + */ + readonly mode: number; + /** + * @type { number } + * @readonly + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900042 - Unknown error + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ + /** + * @type { number } + * @readonly + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900042 - Unknown error + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @since 10 + */ + readonly uid: number; + /** + * @type { number } + * @readonly + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ + /** + * @type { number } + * @readonly + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @since 10 + */ + readonly gid: number; + /** + * @type { number } + * @readonly + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ + /** + * @type { number } + * @readonly + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @since 10 + */ + /** + * @type { number } + * @readonly + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @atomicservice + * @since 11 + */ + readonly size: number; + /** + * @type { number } + * @readonly + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ + /** + * @type { number } + * @readonly + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @since 10 + */ + /** + * @type { number } + * @readonly + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @atomicservice + * @since 11 + */ + readonly atime: number; + /** + * @type { number } + * @readonly + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ + /** + * @type { number } + * @readonly + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @since 10 + */ + /** + * @type { number } + * @readonly + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @atomicservice + * @since 11 + */ + readonly mtime: number; + /** + * @type { number } + * @readonly + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ + /** + * @type { number } + * @readonly + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @since 10 + */ + readonly ctime: number; + /** + * + * @type { LocationType } + * @readonly + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 11 + */ + readonly location: LocationType; + /** + * Whether path/fd is block device. + * + * @returns { boolean } Returns whether the path/fd point to a block device or not. + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ + /** + * Whether path/fd is block device. + * + * @returns { boolean } Returns whether the path/fd point to a block device or not. + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @since 10 + */ + isBlockDevice(): boolean; + /** + * Whether path/fd is character device. + * + * @returns { boolean } Returns whether the path/fd point to a character device or not. + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ + /** + * Whether path/fd is character device. + * + * @returns { boolean } Returns whether the path/fd point to a character device or not. + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @since 10 + */ + isCharacterDevice(): boolean; + /** + * Whether path/fd is directory. + * + * @returns { boolean } Returns whether the path/fd point to a directory or not. + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ + /** + * Whether path/fd is directory. + * + * @returns { boolean } Returns whether the path/fd point to a directory or not. + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @since 10 + */ + /** + * Whether path/fd is directory. + * + * @returns { boolean } Returns whether the path/fd point to a directory or not. + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @atomicservice + * @since 11 + */ + isDirectory(): boolean; + /** + * Whether path/fd is fifo. + * + * @returns { boolean } Returns whether the path/fd point to a fifo file or not. + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ + /** + * Whether path/fd is fifo. + * + * @returns { boolean } Returns whether the path/fd point to a fifo file or not. + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @since 10 + */ + isFIFO(): boolean; + /** + * Whether path/fd is file. + * + * @returns { boolean } Returns whether the path/fd point to a normal file or not. + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ + /** + * Whether path/fd is file. + * + * @returns { boolean } Returns whether the path/fd point to a normal file or not. + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @since 10 + */ + /** + * Whether path/fd is file. + * + * @returns { boolean } Returns whether the path/fd point to a normal file or not. + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @atomicservice + * @since 11 + */ + isFile(): boolean; + /** + * Whether path/fd is socket. + * + * @returns { boolean } Returns whether the path/fd point to a socket file or not. + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ + /** + * Whether path/fd is socket. + * + * @returns { boolean } Returns whether the path/fd point to a socket file or not. + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @since 10 + */ + isSocket(): boolean; + /** + * Whether path/fd is symbolic link. + * + * @returns { boolean } Returns whether the path/fd point to a symbolic link or not. + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ + /** + * Whether path/fd is symbolic link. + * + * @returns { boolean } Returns whether the path/fd point to a symbolic link or not. + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @since 10 + */ + isSymbolicLink(): boolean; +} +/** + * Stream object + * + * @interface Stream + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ +declare interface Stream { + /** + * Close stream. + * + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ + close(): Promise; + /** + * Close stream. + * + * @param { AsyncCallback } callback - Return the callback function. + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ + close(callback: AsyncCallback): void; + /** + * Close stream with sync interface. + * + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ + closeSync(): void; + /** + * Flush stream. + * + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900010 - Try again + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900024 - File too large + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ + flush(): Promise; + /** + * Flush stream. + * + * @param { AsyncCallback } callback - Return the callback function. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900010 - Try again + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900024 - File too large + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ + flush(callback: AsyncCallback): void; + /** + * Flush stream with sync interface. + * + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900010 - Try again + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900024 - File too large + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ + flushSync(): void; + /** + * Write stream. + * + * @param { ArrayBuffer | string } buffer - buffer. + * @param { object } [options] - options. + * @returns { Promise } Returns the number of file bytes written to file in promise mode. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900010 - Try again + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900024 - File too large + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ + /** + * Write stream. + * + * @param { ArrayBuffer | string } buffer - buffer. + * @param { WriteOptions } [options] - options. + * @returns { Promise } Returns the number of file bytes written to file in promise mode. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900010 - Try again + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900024 - File too large + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 11 + */ + write(buffer: ArrayBuffer | string, options?: WriteOptions): Promise; + /** + * Write stream. + * + * @param { ArrayBuffer | string } buffer - buffer. + * @param { AsyncCallback } callback - The callback is used to return the number of file bytes written to file. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900010 - Try again + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900024 - File too large + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ + write(buffer: ArrayBuffer | string, callback: AsyncCallback): void; + /** + * Write stream. + * + * @param { ArrayBuffer | string } buffer - buffer. + * @param { object } [options] - options. + * @param { AsyncCallback } callback - The callback is used to return the number of file bytes written to file. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900010 - Try again + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900024 - File too large + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ + /** + * Write stream. + * + * @param { ArrayBuffer | string } buffer - buffer. + * @param { WriteOptions } [options] - options. + * @param { AsyncCallback } callback - The callback is used to return the number of file bytes written to file. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900010 - Try again + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900024 - File too large + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 11 + */ + write(buffer: ArrayBuffer | string, options: WriteOptions, callback: AsyncCallback): void; + /** + * Write stream with sync interface. + * + * @param { ArrayBuffer | string } buffer - buffer. + * @param { object } [options] - options. + * @returns { number } Returns the number of file bytes written to file. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900010 - Try again + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900024 - File too large + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ + /** + * Write stream with sync interface. + * + * @param { ArrayBuffer | string } buffer - buffer. + * @param { WriteOptions } [options] - options. + * @returns { number } Returns the number of file bytes written to file. + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900010 - Try again + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900024 - File too large + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 11 + */ + writeSync(buffer: ArrayBuffer | string, options?: WriteOptions): number; + /** + * Read stream. + * + * @param { ArrayBuffer } buffer - buffer. + * @param { object } [options] - options. + * @returns { Promise } Returns the number of file bytes read to buffer in promise mode. + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900010 - Try again + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ + /** + * Read stream. + * + * @param { ArrayBuffer } buffer - buffer. + * @param { ReadOptions } [options] - options. + * @returns { Promise } Returns the number of file bytes read to buffer in promise mode. + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900010 - Try again + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 11 + */ + read(buffer: ArrayBuffer, options?: ReadOptions): Promise; + /** + * Read stream. + * + * @param { ArrayBuffer } buffer - buffer. + * @param { AsyncCallback } callback - The callback is used to return the number of file bytes read to buffer. + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900010 - Try again + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ + read(buffer: ArrayBuffer, callback: AsyncCallback): void; + /** + * Read stream. + * + * @param { ArrayBuffer } buffer - buffer. + * @param { object } [options] - options. + * @param { AsyncCallback } callback - The callback is used to return the number of file bytes read to buffer. + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900010 - Try again + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ + /** + * Read stream. + * + * @param { ArrayBuffer } buffer - buffer. + * @param { ReadOptions } [options] - options. + * @param { AsyncCallback } callback - The callback is used to return the number of file bytes read to buffer. + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900010 - Try again + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 11 + */ + read(buffer: ArrayBuffer, options: ReadOptions, callback: AsyncCallback): void; + /** + * Read stream with sync interface. + * + * @param { ArrayBuffer } buffer - buffer. + * @param { object } [options] - options. + * @returns { number } Returns the number of file bytes read to file. + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900010 - Try again + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ + /** + * Read stream with sync interface. + * + * @param { ArrayBuffer } buffer - buffer. + * @param { ReadOptions } [options] - options. + * @returns { number } Returns the number of file bytes read to file. + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900010 - Try again + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 11 + */ + readSync(buffer: ArrayBuffer, options?: ReadOptions): number; +} +/** + * Implements watcher event listening. + * + * @interface WatchEventListener + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 10 + */ +export interface WatchEventListener { + /** + * Specifies the callback function to be invoked. + * + * @param { WatchEvent } event - Event type for the callback to invoke. + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 10 + */ + (event: WatchEvent): void; +} +/** + * Event Listening. + * + * @interface WatchEvent + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 10 + */ +export interface WatchEvent { + /** + * File name. + * + * @type { string } + * @readonly + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 10 + */ + readonly fileName: string; + /** + * Event happened. + * + * @type { number } + * @readonly + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 10 + */ + readonly event: number; + /** + * Associated rename event. + * + * @type { number } + * @readonly + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 10 + */ + readonly cookie: number; +} +/** + * Watcher object + * + * @interface Watcher + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 10 + */ +export interface Watcher { + /** + * Start watcher. + * + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900015 - File exists + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900021 - File table overflow + * @throws { BusinessError } 13900022 - Too many open files + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 10 + */ + start(): void; + /** + * Stop watcher. + * + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900015 - File exists + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900021 - File table overflow + * @throws { BusinessError } 13900022 - Too many open files + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 10 + */ + stop(): void; +} +/** + * Reader Iterator Result + * + * @interface ReaderIteratorResult + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 11 + */ +export interface ReaderIteratorResult { + /** + * Whether reader iterator completes the traversal. + * + * @type { boolean } + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 11 + */ + done: boolean; + /** + * The value of reader iterator. + * + * @type { string } + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 11 + */ + value: string; +} +/** + * ReaderIterator object + * + * @interface ReaderIterator + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 11 + */ +declare interface ReaderIterator { + /** + * Get next result from the iterator. + * + * @returns { ReaderIteratorResult } Returns the result of reader iterator. + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900037 - No data available + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 11 + */ + next(): ReaderIteratorResult; +} +/** + * File filter type + * + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @since 10 + */ +/** + * File filter type + * + * @interface Filter + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @atomicservice + * @since 11 + */ +export interface Filter { + /** + * The suffix of the file. + * + * @type { ?Array } + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 10 + */ + /** + * The suffix of the file. + * + * @type { ?Array } + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @atomicservice + * @since 11 + */ + suffix?: Array; + /** + * The display name of the file. + * + * @type { ?Array } + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 10 + */ + /** + * The display name of the file. + * + * @type { ?Array } + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @atomicservice + * @since 11 + */ + displayName?: Array; + /** + * The mimetype of the file. + * + * @type { ?Array } + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 10 + */ + /** + * The mimetype of the file. + * + * @type { ?Array } + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @atomicservice + * @since 11 + */ + mimeType?: Array; + /** + * The exceeding size of the file. + * + * @type { ?number } + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 10 + */ + /** + * The exceeding size of the file. + * + * @type { ?number } + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @atomicservice + * @since 11 + */ + fileSizeOver?: number; + /** + * The last modification time of the file. + * + * @type { ?number } + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 10 + */ + /** + * The last modification time of the file. + * + * @type { ?number } + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @atomicservice + * @since 11 + */ + lastModifiedAfter?: number; + /** + * Whether to exclude media files. + * + * @type { ?boolean } + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 10 + */ + /** + * Whether to exclude media files. + * + * @type { ?boolean } + * @syscap SystemCapability.FileManagement.File.FileIO + * @crossplatform + * @atomicservice + * @since 11 + */ + excludeMedia?: boolean; +} +/** + * Conflict Files type + * + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 10 + */ +/** + * Conflict Files type + * + * @interface ConflictFiles + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 11 + */ +export interface ConflictFiles { + /** + * The path of the source file. + * + * @type { string } + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 10 + */ + /** + * The path of the source file. + * + * @type { string } + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 11 + */ + srcFile: string; + /** + * The path of the source file. + * + * @type { string } + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 10 + */ + /** + * The path of the destination file. + * + * @type { string } + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 11 + */ + destFile: string; +} +/** + * Options type + * + * @interface Options + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 11 + */ +export interface Options { + /** + * The encoding style. + * + * @type { ?string } + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 11 + */ + encoding?: string; +} +/** + * ReadOptions type + * + * @interface ReadOptions + * @syscap SystemCapability.FileManagement.File.FileIO + * @atomicservice + * @since 11 + */ +export interface ReadOptions { + /** + * The offset when reading the file. + * + * @type { ?number } + * @syscap SystemCapability.FileManagement.File.FileIO + * @atomicservice + * @since 11 + */ + offset?: number; + /** + * The length for reading. + * + * @type { ?number } + * @syscap SystemCapability.FileManagement.File.FileIO + * @atomicservice + * @since 11 + */ + length?: number; +} +/** + * ReadTextOptions type + * + * @interface ReadTextOptions + * @syscap SystemCapability.FileManagement.File.FileIO + * @atomicservice + * @since 11 + */ +export interface ReadTextOptions extends ReadOptions { + /** + * The encoding style when reading text. + * + * @type { ?string } + * @syscap SystemCapability.FileManagement.File.FileIO + * @atomicservice + * @since 11 + */ + encoding?: string; +} +/** + * WriteOptions type + * + * @interface WriteOptions + * @syscap SystemCapability.FileManagement.File.FileIO + * @atomicservice + * @since 11 + */ +export interface WriteOptions extends Options { + /** + * The offset when writing the file. + * + * @type { ?number } + * @syscap SystemCapability.FileManagement.File.FileIO + * @atomicservice + * @since 11 + */ + offset?: number; + /** + * The length for writing. + * + * @type { ?number } + * @syscap SystemCapability.FileManagement.File.FileIO + * @atomicservice + * @since 11 + */ + length?: number; +} +/** + * ListFileOptions type + * + * @interface ListFileOptions + * @syscap SystemCapability.FileManagement.File.FileIO + * @atomicservice + * @since 11 + */ +export interface ListFileOptions { + /** + * Whether to recursively list files. + * + * @type { ?boolean } + * @syscap SystemCapability.FileManagement.File.FileIO + * @atomicservice + * @since 11 + */ + recursion?: boolean; + /** + * The number of files listed. + * + * @type { ?number } + * @syscap SystemCapability.FileManagement.File.FileIO + * @atomicservice + * @since 11 + */ + listNum?: number; + /** + * The filter of listing files. + * + * @type { ?Filter } + * @syscap SystemCapability.FileManagement.File.FileIO + * @atomicservice + * @since 11 + */ + filter?: Filter; +} +/** + * The listeners of Distributed File System. + * + * @typedef DfsListeners + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 12 + */ +interface DfsListeners { + /** + * The Listener of Distributed File System status + * + * @param { string } networkId - The networkId of device. + * @param { number } status - The status code of Distributed File System. + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 12 + */ + onStatus(networkId: string, status: number): void; +} +/** + * Enumeration of different types of whence. + * + * @enum { number } whence type + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 11 + */ +declare enum WhenceType { + /** + * Starting position of the file offset. + * + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 11 + */ + SEEK_SET = 0, + /** + * Current position of the file offset. + * + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 11 + */ + SEEK_CUR = 1, + /** + * Ending position of the file offset. + * + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 11 + */ + SEEK_END = 2 +} +/** + * Enumeration of different types of file location. + * + * @enum { number } location type + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 11 + */ +declare enum LocationType { + /** + * Local file. + * + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 11 + */ + LOCAL = 1 << 0, + /** + * Cloud file. + * + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 11 + */ + CLOUD = 1 << 1 +} +/** + * Enumeration of different types of access mode. + * + * @enum { number } access mode type + * @syscap SystemCapability.FileManagement.File.FileIO + * @atomicservice + * @since 12 + */ +declare enum AccessModeType { + /** + * Check if the file exists. + * + * @syscap SystemCapability.FileManagement.File.FileIO + * @atomicservice + * @since 12 + */ + EXIST = 0, + /** + * Check if the file has write permission. + * + * @syscap SystemCapability.FileManagement.File.FileIO + * @atomicservice + * @since 12 + */ + WRITE = 2, + /** + * Check if the file has read permission. + * + * @syscap SystemCapability.FileManagement.File.FileIO + * @atomicservice + * @since 12 + */ + READ = 4, + /** + * Check if the file has read and write permission. + * + * @syscap SystemCapability.FileManagement.File.FileIO + * @atomicservice + * @since 12 + */ + READ_WRITE = 6 +} diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.file.hash.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.file.hash.d.ts new file mode 100755 index 00000000..00d6a7ce --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.file.hash.d.ts @@ -0,0 +1,85 @@ +/* + * Copyright (c) 2022-2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit CoreFileKit + */ +import type { AsyncCallback } from './@ohos.base'; +/** + * Hash + * + * @namespace hash + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ +/** + * Hash + * + * @namespace hash + * @syscap SystemCapability.FileManagement.File.FileIO + * @atomicservice + * @since 11 + */ +declare namespace hash { + /** + * Hash file. + * + * @param { string } path - path. + * @param { string } algorithm - algorithm md5 sha1 sha256. + * @returns { Promise } return Promise + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ + /** + * Hash file. + * + * @param { string } path - path. + * @param { string } algorithm - algorithm md5 sha1 sha256. + * @returns { Promise } return Promise + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @atomicservice + * @since 11 + */ + function hash(path: string, algorithm: string): Promise; + /** + * Hash file. + * + * @param { string } path - path. + * @param { string } algorithm - algorithm md5 sha1 sha256. + * @param { AsyncCallback } [callback] - callback. + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ + /** + * Hash file. + * + * @param { string } path - path. + * @param { string } algorithm - algorithm md5 sha1 sha256. + * @param { AsyncCallback } [callback] - callback. + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @atomicservice + * @since 11 + */ + function hash(path: string, algorithm: string, callback: AsyncCallback): void; +} +export default hash; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.file.photoAccessHelper.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.file.photoAccessHelper.d.ts new file mode 100755 index 00000000..1f90c78a --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.file.photoAccessHelper.d.ts @@ -0,0 +1,2377 @@ +/* + * Copyright (C) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file Helper functions to access image and video assets + * @kit MediaLibraryKit + */ +import type { AsyncCallback, Callback } from './@ohos.base'; +import type Context from './application/Context'; +import type image from './@ohos.multimedia.image'; +import type dataSharePredicates from './@ohos.data.dataSharePredicates'; +/** + * Helper functions to access image and video assets + * + * @namespace photoAccessHelper + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @since 10 + */ +/** + * Helper functions to access image and video assets + * + * @namespace photoAccessHelper + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @atomicservice + * @since 11 + */ +declare namespace photoAccessHelper { + /** + * Returns an instance of PhotoAccessHelper + * + * @param { Context } context - Hap context information + * @returns { PhotoAccessHelper } Instance of PhotoAccessHelper + * @throws { BusinessError } 401 - if parameter is invalid + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @StageModelOnly + * @since 10 + */ + /** + * Returns an instance of PhotoAccessHelper + * + * @param { Context } context - Hap context information + * @returns { PhotoAccessHelper } Instance of PhotoAccessHelper + * @throws { BusinessError } 401 - if parameter is invalid + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @StageModelOnly + * @atomicservice + * @since 11 + */ + function getPhotoAccessHelper(context: Context): PhotoAccessHelper; + /** + * Enumeration of different types of photos + * + * @enum { number } PhotoType + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @since 10 + */ + /** + * Enumeration of different types of photos + * + * @enum { number } PhotoType + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @atomicservice + * @since 11 + */ + enum PhotoType { + /** + * Image asset + * + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @since 10 + */ + /** + * Image asset + * + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @atomicservice + * @since 11 + */ + IMAGE = 1, + /** + * Video asset + * + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @since 10 + */ + /** + * Video asset + * + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @atomicservice + * @since 11 + */ + VIDEO + } + /** + * Enumeration of different categories of photos + * + * @enum { number } PhotoSubtype + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @systemapi + * @since 10 + */ + /** + * Enumeration of different categories of photos + * + * @enum { number } PhotoSubtype + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @atomicservice + * @since 12 + */ + enum PhotoSubtype { + /** + * Default Photo Type + * + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @systemapi + * @since 10 + */ + /** + * Default Photo Type + * + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @atomicservice + * @since 12 + */ + DEFAULT = 0, + /** + * Moving Photo Type + * + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @atomicservice + * @since 12 + */ + MOVING_PHOTO = 3 + } + /** + * Enumeration of different recommendation type + * + * @enum { number } RecommendationType + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @atomicservice + * @since 11 + */ + enum RecommendationType { + /** + * QR_OR_BAR_CODE indicates that QR code or barcode photos can be recommended + * + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @atomicservice + * @since 11 + */ + QR_OR_BAR_CODE = 1, + /** + * QR_CODE indicates that QR code photos can be recommended + * + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @atomicservice + * @since 11 + */ + QR_CODE = 2, + /** + * BAR_CODE indicates that barcode photos can be recommended + * + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @atomicservice + * @since 11 + */ + BAR_CODE = 3, + /** + * ID_CARD indicates that QR code or barcode photos can be recommended + * + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @atomicservice + * @since 11 + */ + ID_CARD = 4, + /** + * PROFILE_PICTURE indicates that profile picture photos can be recommended + * + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @atomicservice + * @since 11 + */ + PROFILE_PICTURE = 5, + /** + * PASSPORT indicates that passport photos can be recommended + * + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @atomicservice + * @since 12 + */ + PASSPORT = 6, + /** + * BANK_CARD indicates that bank card photos can be recommended + * + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @atomicservice + * @since 12 + */ + BANK_CARD = 7, + /** + * DRIVER_LICENSE indicates that driver license photos can be recommended + * + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @atomicservice + * @since 12 + */ + DRIVER_LICENSE = 8, + /** + * DRIVING_LICENSE indicates that driving license photos can be recommended + * + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @atomicservice + * @since 12 + */ + DRIVING_LICENSE = 9 + } + /** + * Enumeration of delivery mode. + * + * @enum { number } DeliveryMode + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @since 11 + */ + enum DeliveryMode { + /** + * Fast delivery mode + * + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @since 11 + */ + FAST_MODE = 0, + /** + * High quality delivery mode + * + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @since 11 + */ + HIGH_QUALITY_MODE = 1, + /** + * Balance delivery mode + * + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @since 11 + */ + BALANCE_MODE = 2 + } + /** + * Options to request media asset + * + * @interface RequestOptions + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @since 11 + */ + interface RequestOptions { + /** + * Indicates the delivery mode + * + * @type { DeliveryMode } + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @since 11 + */ + deliveryMode: DeliveryMode; + } + /** + * Media asset data handler + * + * @interface MediaAssetDataHandler + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @since 11 + */ + interface MediaAssetDataHandler { + /** + * Indicates required media asset data is prepared + * + * @param { T } data - the returned data of media asset + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @since 11 + */ + /** + * Indicates required media asset data is prepared + * + * @param { T } data - the returned data of media asset + * @param { Map } [map] - additional information for the data + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @since 12 + */ + onDataPrepared(data: T, map?: Map): void; + } + /** + * Media asset manager + * + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @since 11 + */ + class MediaAssetManager { + /** + * Request image + * + * @permission ohos.permission.READ_IMAGEVIDEO + * @param { Context } context - Hap context information + * @param { PhotoAsset } asset - the photo asset requested + * @param { RequestOptions } requestOptions - the request options + * @param { MediaAssetDataHandler } dataHandler - data handler used to obtain media asset data when ImageSource is prepared + * @returns { Promise } Returns request id + * @throws { BusinessError } 201 - Permission denied + * @throws { BusinessError } 401 - if parameter is invalid + * @throws { BusinessError } 14000011 - System inner fail + * @static + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @since 11 + */ + static requestImage(context: Context, asset: PhotoAsset, requestOptions: RequestOptions, dataHandler: MediaAssetDataHandler): Promise; + /** + * Request image data + * + * @permission ohos.permission.READ_IMAGEVIDEO + * @param { Context } context - Hap context information + * @param { PhotoAsset } asset - the photo asset requested + * @param { RequestOptions } requestOptions - the request options + * @param { MediaAssetDataHandler } dataHandler - data handler used obtain media asset data when data is prepared + * @returns { Promise } Returns request id + * @throws { BusinessError } 201 - Permission denied + * @throws { BusinessError } 401 - if parameter is invalid + * @throws { BusinessError } 14000011 - System inner fail + * @static + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @since 11 + */ + static requestImageData(context: Context, asset: PhotoAsset, requestOptions: RequestOptions, dataHandler: MediaAssetDataHandler): Promise; + /** + * Request moving photo + * + * @permission ohos.permission.READ_IMAGEVIDEO + * @param { Context } context - Hap context information + * @param { PhotoAsset } asset - the photo asset requested + * @param { RequestOptions } requestOptions - the request options + * @param { MediaAssetDataHandler } dataHandler - data handler used to obtain moving photo when data is prepared + * @returns { Promise } Returns request id + * @throws { BusinessError } 201 - Permission denied + * @throws { BusinessError } 401 - if parameter is invalid + * @throws { BusinessError } 14000011 - System inner fail + * @static + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @since 12 + */ + static requestMovingPhoto(context: Context, asset: PhotoAsset, requestOptions: RequestOptions, dataHandler: MediaAssetDataHandler): Promise; + /** + * Cancel request + * + * @permission ohos.permission.READ_IMAGEVIDEO + * @param { Context } context - Hap context information + * @param { string } requestId - the request id to be canceled + * @returns { Promise } Returns void + * @throws { BusinessError } 201 - Permission denied + * @throws { BusinessError } 401 - if parameter is invalid + * @throws { BusinessError } 14000011 - System inner fail + * @static + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @since 12 + */ + static cancelRequest(context: Context, requestId: string): Promise; + /** + * Request video file + * + * @permission ohos.permission.READ_IMAGEVIDEO + * @param { Context } context - Hap context information + * @param { PhotoAsset } asset - the photo asset requested + * @param { RequestOptions } requestOptions - the request options + * @param { string } fileUri - the destination file uri to save the video data + * @param { MediaAssetDataHandler } dataHandler - data handler used to notify the client that data has been written to the application sandbox + * @returns { Promise } Returns request id + * @throws { BusinessError } 201 - Permission denied + * @throws { BusinessError } 401 - if parameter is invalid + * @throws { BusinessError } 14000011 - System inner fail + * @static + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @since 12 + */ + static requestVideoFile(context: Context, asset: PhotoAsset, requestOptions: RequestOptions, fileUri: string, dataHandler: MediaAssetDataHandler): Promise; + /** + * Load moving photo + * + * @param { Context } context - Hap context information + * @param { string } imageFileUri - image file uri of the moving photo to be loaded + * @param { string } videoFileUri - video file uri of the moving photo to be loaded + * @returns { Promise } Returns moving photo + * @throws { BusinessError } 401 - Invalid parameter + * @throws { BusinessError } 14000011 - Internal system error + * @static + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @since 12 + */ + static loadMovingPhoto(context: Context, imageFileUri: string, videoFileUri: string): Promise; + } + /** + * Indicates the type of photo asset member. + * + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @since 10 + */ + type MemberType = number | string | boolean; + /** + * Defines the photo asset + * + * @interface PhotoAsset + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @since 10 + */ + /** + * Defines the photo asset + * + * @interface PhotoAsset + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @atomicservice + * @since 11 + */ + interface PhotoAsset { + /** + * uri of the asset. + * + * @type { string } + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @since 10 + */ + readonly uri: string; + /** + * Photo type, image or video + * + * @type { PhotoType } + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @since 10 + */ + readonly photoType: PhotoType; + /** + * Display name (with a file name extension) of the asset. + * + * @type { string } + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @since 10 + */ + readonly displayName: string; + /** + * Returns the value of the specified member. + * + * @param { string } member - Photo asset member. for example : get(PhotoKeys.SIZE) + * @returns { MemberType } Returns the value of the specified photo asset member + * @throws { BusinessError } 401 - if parameter is invalid + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 14000014 - Member is not a valid PhotoKey + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @since 10 + */ + get(member: string): MemberType; + /** + * Set a new value to the specified member + * + * @param { string } member - Photo asset member + * @param { string } value - The new value of the member. + * @throws { BusinessError } 401 - if parameter is invalid + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 14000014 - Member is not a valid PhotoKey + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @since 10 + * @example : set(PhotoKeys.TITLE, "newTitle"), call commitModify after set + */ + set(member: string, value: string): void; + /** + * Modify metadata of the asset + * + * @permission ohos.permission.WRITE_IMAGEVIDEO + * @param { AsyncCallback } callback - Returns void. + * @throws { BusinessError } 401 - if values to commit is invalid + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 14000001 - Invalid display name + * @throws { BusinessError } 14000011 - System inner fail + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @since 10 + */ + /** + * Modify metadata of the asset + * + * @permission ohos.permission.WRITE_IMAGEVIDEO + * @param { AsyncCallback } callback - Returns void. + * @throws { BusinessError } 401 - if values to commit is invalid + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 14000001 - Invalid display name + * @throws { BusinessError } 14000011 - System inner fail + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @atomicservice + * @since 11 + */ + commitModify(callback: AsyncCallback): void; + /** + * Modify metadata of the asset + * + * @permission ohos.permission.WRITE_IMAGEVIDEO + * @returns { Promise } Returns void + * @throws { BusinessError } 401 - if values to commit is invalid + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 14000001 - Invalid display name + * @throws { BusinessError } 14000011 - System inner fail + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @since 10 + */ + /** + * Modify metadata of the asset + * + * @permission ohos.permission.WRITE_IMAGEVIDEO + * @returns { Promise } Returns void + * @throws { BusinessError } 401 - if values to commit is invalid + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 14000001 - Invalid display name + * @throws { BusinessError } 14000011 - System inner fail + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @atomicservice + * @since 11 + */ + commitModify(): Promise; + /** + * Open the asset in read only mode + * + * @permission ohos.permission.READ_IMAGEVIDEO + * @param { AsyncCallback } callback - Returns the read only fd + * @throws { BusinessError } 401 - if parameter is invalid + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 14000011 - System inner fail + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @since 10 + * @deprecated since 11 + */ + getReadOnlyFd(callback: AsyncCallback): void; + /** + * Open the asset in read only mode + * + * @permission ohos.permission.READ_IMAGEVIDEO + * @returns { Promise } Returns the read only fd + * @throws { BusinessError } 401 - if parameter is invalid + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 14000011 - System inner fail + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @since 10 + * @deprecated since 11 + */ + getReadOnlyFd(): Promise; + /** + * Close the asset + * + * @param { number } fd - The opened fd of the asset. + * @param { AsyncCallback } callback - Returns void + * @throws { BusinessError } 401 - if parameter is invalid + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 14000011 - System inner fail + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @since 10 + * @deprecated since 11 + */ + close(fd: number, callback: AsyncCallback): void; + /** + * Close the asset + * + * @param { number } fd - The opened fd of the asset. + * @returns { Promise } Returns void + * @throws { BusinessError } 401 - if parameter is invalid + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 14000011 - System inner fail + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @since 10 + * @deprecated since 11 + */ + close(fd: number): Promise; + /** + * Get thumbnail of the asset + * + * @permission ohos.permission.READ_IMAGEVIDEO + * @param { AsyncCallback } callback - Returns the thumbnail's pixelMap. + * @throws { BusinessError } 401 - if parameter is invalid + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 14000011 - System inner fail + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @since 10 + */ + getThumbnail(callback: AsyncCallback): void; + /** + * Get thumbnail of the asset + * + * @permission ohos.permission.READ_IMAGEVIDEO + * @param { image.Size } size - Thumbnail's size + * @param { AsyncCallback } callback - Returns the thumbnail's pixelMap. + * @throws { BusinessError } 401 - if parameter is invalid + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 14000011 - System inner fail + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @since 10 + */ + getThumbnail(size: image.Size, callback: AsyncCallback): void; + /** + * Get thumbnail of the asset + * + * @permission ohos.permission.READ_IMAGEVIDEO + * @param { image.Size } [size] - Thumbnail's size + * @returns { Promise } Returns the thumbnail's pixelMap. + * @throws { BusinessError } 401 - if parameter is invalid + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 14000011 - System inner fail + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @since 10 + */ + getThumbnail(size?: image.Size): Promise; + } + /** + * Enumeration of photo asset members + * + * @enum { string } PhotoKeys + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @since 10 + */ + enum PhotoKeys { + /** + * Asset uri, read only + * + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @since 10 + */ + URI = 'uri', + /** + * Photo type of the asset, read only + * + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @since 10 + */ + PHOTO_TYPE = 'media_type', + /** + * Asset name, read only + * + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @since 10 + */ + DISPLAY_NAME = 'display_name', + /** + * Size of the asset, read only + * + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @since 10 + */ + SIZE = 'size', + /** + * Creation date of the asset, read only + * + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @since 10 + */ + DATE_ADDED = 'date_added', + /** + * Modified date of the asset, read only + * + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @since 10 + */ + DATE_MODIFIED = 'date_modified', + /** + * Duration of video files, read only + * + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @since 10 + */ + DURATION = 'duration', + /** + * Width of the image asset, read only + * + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @since 10 + */ + WIDTH = 'width', + /** + * Height of the image asset, read only + * + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @since 10 + */ + HEIGHT = 'height', + /** + * Date taken of the asset, read only + * + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @since 10 + */ + DATE_TAKEN = 'date_taken', + /** + * Orientation of the image asset, read only + * + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @since 10 + */ + ORIENTATION = 'orientation', + /** + * Favorite state of the asset, read only + * + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @since 10 + */ + FAVORITE = 'is_favorite', + /** + * Title of the asset + * + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @since 10 + */ + TITLE = 'title', + /** + * Creation time of the asset in milliseconds, read only + * + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @since 12 + */ + DATE_ADDED_MS = 'date_added_ms', + /** + * Modified time of the asset in milliseconds, read only + * + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @since 12 + */ + DATE_MODIFIED_MS = 'date_modified_ms', + /** + * Photo subtype of the asset, read only + * + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @since 12 + */ + PHOTO_SUBTYPE = 'subtype' + } + /** + * Enumeration of photo album members. + * + * @enum { string } AlbumKeys + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @since 10 + */ + enum AlbumKeys { + /** + * Album uri + * + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @since 10 + */ + URI = 'uri', + /** + * Album name + * + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @since 10 + */ + ALBUM_NAME = 'album_name' + } + /** + * Options to fetch assets or albums + * + * @interface FetchOptions + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @since 10 + */ + interface FetchOptions { + /** + * Indicates the members to query. + * + * @type { Array } + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @since 10 + */ + fetchColumns: Array; + /** + * Predicates to query + * + * @type { dataSharePredicates.DataSharePredicates } + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @since 10 + */ + predicates: dataSharePredicates.DataSharePredicates; + } + /** + * Options to create a photo asset + * + * @interface CreateOptions + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @since 10 + */ + /** + * Options to create a photo asset + * + * @interface CreateOptions + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @atomicservice + * @since 11 + */ + interface CreateOptions { + /** + * Title of the asset + * + * @type { ?string } + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @since 10 + */ + /** + * Title of the asset + * + * @type { ?string } + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @atomicservice + * @since 11 + */ + title?: string; + /** + * Specify subtype of the asset to create + * + * @type { ?PhotoSubtype } + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @atomicservice + * @since 12 + */ + subtype?: PhotoSubtype; + } + /** + * The fetch result of assets or albums + * + * @interface FetchResult + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @since 10 + */ + interface FetchResult { + /** + * Obtains the total number of objects in the fetch result. + * + * @returns { number } Total number of objects. + * @throws { BusinessError } 401 - if parameter is invalid + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 14000011 - System inner fail + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @since 10 + */ + getCount(): number; + /** + * Checks whether the result set points to the last row. + * You need to check whether the object is the last one before calling getNextObject. + * + * @returns { boolean } Whether the object is the last one in the fetch result. + * @throws { BusinessError } 401 - if parameter is invalid + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 14000011 - System inner fail + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @since 10 + */ + isAfterLast(): boolean; + /** + * Obtains the first object in the fetch result. + * + * @param { AsyncCallback } callback - Returns the first object in the fetch result. + * @throws { BusinessError } 401 - if parameter is invalid + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 14000011 - System inner fail + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @since 10 + */ + getFirstObject(callback: AsyncCallback): void; + /** + * Obtains the first object in the fetch result. + * + * @returns { Promise } Returns the first object in the fetch result. + * @throws { BusinessError } 401 - if parameter is invalid + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 14000011 - System inner fail + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @since 10 + */ + getFirstObject(): Promise; + /** + * Obtains the next object in the fetch result. + * Before calling this method, you must use isAfterLast() to check whether the current position is the last row + * in the fetch result. This method only works when the current position is not the last row. + * + * @param { AsyncCallback } callback - Returns the next object + * @throws { BusinessError } 401 - if parameter is invalid + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 14000011 - System inner fail + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @since 10 + */ + getNextObject(callback: AsyncCallback): void; + /** + * Obtains the next object in the fetch result. + * Before calling this method, you must use isAfterLast() to check whether the current position is the last row + * in the fetch result. This method only works when the current position is not the last row. + * + * @returns { Promise } Returns the next object + * @throws { BusinessError } 401 - if parameter is invalid + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 14000011 - System inner fail + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @since 10 + */ + getNextObject(): Promise; + /** + * Obtains the last object in the fetch result + * + * @param { AsyncCallback } callback - Returns the last object + * @throws { BusinessError } 401 - if parameter is invalid + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 14000011 - System inner fail + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @since 10 + */ + getLastObject(callback: AsyncCallback): void; + /** + * Obtains the last object in the fetch result + * + * @returns { Promise } Returns the last object + * @throws { BusinessError } 401 - if parameter is invalid + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 14000011 - System inner fail + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @since 10 + */ + getLastObject(): Promise; + /** + * Obtains the object with the specified index in the fetch result. + * + * @param { number } index - Index of the object to obtain. + * @param { AsyncCallback } callback - Returns the object + * @throws { BusinessError } 401 - if type index is not number + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 14000011 - System inner fail + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @since 10 + */ + getObjectByPosition(index: number, callback: AsyncCallback): void; + /** + * Obtains the object with the specified index in the fetch result. + * + * @param { number } index - Index of the asset to obtain. + * @returns { Promise } Returns the object + * @throws { BusinessError } 401 - if type index is not number + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 14000011 - System inner fail + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @since 10 + */ + getObjectByPosition(index: number): Promise; + /** + * Obtains all objects in the fetch result. + * + * @param { AsyncCallback> } callback - Returns all the objects + * @throws { BusinessError } 401 - if parameter is invalid + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 14000011 - System inner fail + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @since 10 + */ + getAllObjects(callback: AsyncCallback>): void; + /** + * Obtains all objects in the fetch result. + * + * @returns { Promise> } Returns all the objects + * @throws { BusinessError } 401 - if parameter is invalid + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 14000011 - System inner fail + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @since 10 + */ + getAllObjects(): Promise>; + /** + * Releases the fetch result. + * + * @throws { BusinessError } 401 - if parameter is invalid + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 14000011 - System inner fail + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @since 10 + */ + close(): void; + } + /** + * Album type. + * + * @enum { number } AlbumType + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @since 10 + */ + enum AlbumType { + /** + * Album created by user. + * + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @since 10 + */ + USER = 0, + /** + * Album created by system, which metadata cannot be modified. + * + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @since 10 + */ + SYSTEM = 1024 + } + /** + * Album subtype + * + * @enum { number } AlbumSubtype + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @since 10 + */ + enum AlbumSubtype { + /** + * Generic user-created albums. + * + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @since 10 + */ + USER_GENERIC = 1, + /** + * Favorite album, which assets are marked as favorite. + * + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @since 10 + */ + FAVORITE = 1025, + /** + * Video album, which contains all video assets. + * + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @since 10 + */ + VIDEO, + /** + * Any album + * + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @since 10 + */ + ANY = 2147483647 + } + /** + * Defines the abstract interface of albums. + * + * @interface AbsAlbum + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @since 10 + */ + interface AbsAlbum { + /** + * Album type + * + * @type { AlbumType } + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @since 10 + */ + readonly albumType: AlbumType; + /** + * Album subtype + * + * @type { AlbumSubtype } + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @since 10 + */ + readonly albumSubtype: AlbumSubtype; + /** + * Album name. + * + * @type { string } + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @since 10 + */ + albumName: string; + /** + * Album uri. + * + * @type { string } + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @since 10 + */ + readonly albumUri: string; + /** + * Number of assets in the album + * + * @type { number } + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @since 10 + */ + readonly count: number; + /** + * Cover uri for the album + * + * @type { string } + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @since 10 + */ + readonly coverUri: string; + /** + * Fetch assets in an album. + * + * @permission ohos.permission.READ_IMAGEVIDEO + * @param { FetchOptions } options - Fetch options. + * @param { AsyncCallback> } callback - Returns the fetch result + * @throws { BusinessError } 401 - if type options is not FetchOptions + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 14000011 - System inner fail + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @since 10 + */ + getAssets(options: FetchOptions, callback: AsyncCallback>): void; + /** + * Fetch assets in an album. + * + * @permission ohos.permission.READ_IMAGEVIDEO + * @param { FetchOptions } options - Fetch options. + * @returns { Promise> } Returns the fetch result + * @throws { BusinessError } 401 - if type options is not FetchOptions + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 14000011 - System inner fail + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @since 10 + */ + getAssets(options: FetchOptions): Promise>; + } + /** + * Defines the album. + * + * @interface Album + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @since 10 + */ + interface Album extends AbsAlbum { + /** + * Number of image assets in the album + * + * @type { ?number } + * @readonly + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @since 11 + */ + readonly imageCount?: number; + /** + * Number of video assets in the album + * + * @type { ?number } + * @readonly + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @since 11 + */ + readonly videoCount?: number; + /** + * Modify metadata for the album + * + * @permission ohos.permission.WRITE_IMAGEVIDEO + * @param { AsyncCallback } callback - Returns void + * @throws { BusinessError } 401 - if value to modify is invalid + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 14000011 - System inner fail + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @since 10 + */ + commitModify(callback: AsyncCallback): void; + /** + * Modify metadata for the album + * + * @permission ohos.permission.WRITE_IMAGEVIDEO + * @returns { Promise } Returns void + * @throws { BusinessError } 401 - if value to modify is invalid + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 14000011 - System inner fail + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @since 10 + */ + commitModify(): Promise; + /** + * Add assets to the album. + * + * @permission ohos.permission.WRITE_IMAGEVIDEO + * @param { Array } assets - Assets to add + * @param { AsyncCallback } callback - Returns void + * @throws { BusinessError } 401 - if PhotoAssets is invalid + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 14000011 - System inner fail + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @since 10 + * @deprecated since 11 + * @useinstead photoAccessHelper.MediaAlbumChangeRequest#addAssets + */ + addAssets(assets: Array, callback: AsyncCallback): void; + /** + * Add assets to the album. + * + * @permission ohos.permission.WRITE_IMAGEVIDEO + * @param { Array } assets - Assets to add + * @returns { Promise } Returns void + * @throws { BusinessError } 401 - if PhotoAssets is invalid + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 14000011 - System inner fail + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @since 10 + * @deprecated since 11 + * @useinstead photoAccessHelper.MediaAlbumChangeRequest#addAssets + */ + addAssets(assets: Array): Promise; + /** + * Remove assets from the album. + * + * @permission ohos.permission.WRITE_IMAGEVIDEO + * @param { Array } assets - Assets to remove + * @param { AsyncCallback } callback - Returns void + * @throws { BusinessError } 401 - if PhotoAssets is invalid + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 14000011 - System inner fail + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @since 10 + * @deprecated since 11 + * @useinstead photoAccessHelper.MediaAlbumChangeRequest#removeAssets + */ + removeAssets(assets: Array, callback: AsyncCallback): void; + /** + * Remove assets from the album. + * + * @permission ohos.permission.WRITE_IMAGEVIDEO + * @param { Array } assets - Assets to remove + * @returns { Promise } Returns void + * @throws { BusinessError } 401 - if PhotoAssets is invalid + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 14000011 - System inner fail + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @since 10 + * @deprecated since 11 + * @useinstead photoAccessHelper.MediaAlbumChangeRequest#removeAssets + */ + removeAssets(assets: Array): Promise; + } + /** + * Helper functions to access photos and albums. + * + * @interface PhotoAccessHelper + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @since 10 + */ + /** + * Helper functions to access photos and albums. + * + * @interface PhotoAccessHelper + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @atomicservice + * @since 11 + */ + interface PhotoAccessHelper { + /** + * Fetch photo assets + * + * @permission ohos.permission.READ_IMAGEVIDEO + * @param { FetchOptions } options - Fetch options. + * @param { AsyncCallback> } callback - Returns the fetch result. + * @throws { BusinessError } 401 - if type options is not FetchOptions + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 14000011 - System inner fail + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @since 10 + */ + getAssets(options: FetchOptions, callback: AsyncCallback>): void; + /** + * Fetch photo assets + * + * @permission ohos.permission.READ_IMAGEVIDEO + * @param { FetchOptions } options - Retrieval options. + * @returns { Promise> } Returns the fetch result. + * @throws { BusinessError } 401 - if type options is not FetchOptions + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 14000011 - System inner fail + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @since 10 + */ + getAssets(options: FetchOptions): Promise>; + /** + * Create a photo asset: + * 1. (Suggested)Integrate security component without WRITE_IMAGEVIDEO permission; + * 2. Get WRITE_IMAGEVIDEO permission by ACL; + * + * @permission ohos.permission.WRITE_IMAGEVIDEO + * @param { PhotoType } photoType - Photo asset type + * @param { string } extension - Asset extension + * @param { CreateOptions } options - Asset create option + * @param { AsyncCallback } callback - Returns the uri of the newly created asset + * @throws { BusinessError } 401 - if type createOption is wrong + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 14000011 - System inner fail + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @since 10 + */ + /** + * Create a photo asset: + * 1. (Suggested)Integrate security component without WRITE_IMAGEVIDEO permission; + * 2. Get WRITE_IMAGEVIDEO permission by ACL; + * + * @permission ohos.permission.WRITE_IMAGEVIDEO + * @param { PhotoType } photoType - Photo asset type + * @param { string } extension - Asset extension + * @param { CreateOptions } options - Asset create option + * @param { AsyncCallback } callback - Returns the uri of the newly created asset + * @throws { BusinessError } 401 - if type createOption is wrong + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 14000011 - System inner fail + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @atomicservice + * @since 11 + */ + createAsset(photoType: PhotoType, extension: string, options: CreateOptions, callback: AsyncCallback): void; + /** + * Create a photo asset: + * 1. (Suggested)Integrate security component without WRITE_IMAGEVIDEO permission; + * 2. Get WRITE_IMAGEVIDEO permission by ACL; + * + * @permission ohos.permission.WRITE_IMAGEVIDEO + * @param { PhotoType } photoType - Photo asset type + * @param { string } extension - Asset extension + * @param { AsyncCallback } callback - Returns the uri of the newly created asset + * @throws { BusinessError } 401 - if type createOption is wrong + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 14000011 - System inner fail + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @since 10 + */ + /** + * Create a photo asset: + * 1. (Suggested)Integrate security component without WRITE_IMAGEVIDEO permission; + * 2. Get WRITE_IMAGEVIDEO permission by ACL; + * + * @permission ohos.permission.WRITE_IMAGEVIDEO + * @param { PhotoType } photoType - Photo asset type + * @param { string } extension - Asset extension + * @param { AsyncCallback } callback - Returns the uri of the newly created asset + * @throws { BusinessError } 401 - if type createOption is wrong + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 14000011 - System inner fail + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @atomicservice + * @since 11 + */ + createAsset(photoType: PhotoType, extension: string, callback: AsyncCallback): void; + /** + * Create a photo asset: + * 1. (Suggested)Integrate security component without WRITE_IMAGEVIDEO permission; + * 2. Get WRITE_IMAGEVIDEO permission by ACL; + * + * @permission ohos.permission.WRITE_IMAGEVIDEO + * @param { PhotoType } photoType - Photo asset type + * @param { string } extension - Asset extension + * @param { CreateOptions } [options] - Optional asset create option + * @returns { Promise } Returns the uri of the newly created asset + * @throws { BusinessError } 401 - if type createOption is wrong + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 14000011 - System inner fail + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @since 10 + */ + /** + * Create a photo asset: + * 1. (Suggested)Integrate security component without WRITE_IMAGEVIDEO permission; + * 2. Get WRITE_IMAGEVIDEO permission by ACL; + * + * @permission ohos.permission.WRITE_IMAGEVIDEO + * @param { PhotoType } photoType - Photo asset type + * @param { string } extension - Asset extension + * @param { CreateOptions } [options] - Optional asset create option + * @returns { Promise } Returns the uri of the newly created asset + * @throws { BusinessError } 401 - if type createOption is wrong + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 14000011 - System inner fail + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @atomicservice + * @since 11 + */ + createAsset(photoType: PhotoType, extension: string, options?: CreateOptions): Promise; + /** + * Fetch albums. + * + * @permission ohos.permission.READ_IMAGEVIDEO + * @param { AlbumType } type - Album type. + * @param { AlbumSubtype } subtype - Album subtype. + * @param { FetchOptions } options - options to fetch albums + * @param { AsyncCallback> } callback - Returns the fetch result + * @throws { BusinessError } 401 - if type options is not FetchOption + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 14000011 - System inner fail + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @since 10 + */ + getAlbums(type: AlbumType, subtype: AlbumSubtype, options: FetchOptions, callback: AsyncCallback>): void; + /** + * Fetch albums. + * + * @permission ohos.permission.READ_IMAGEVIDEO + * @param { AlbumType } type - Album type. + * @param { AlbumSubtype } subtype - Album subtype. + * @param { AsyncCallback> } callback - Returns the fetch result + * @throws { BusinessError } 401 - if type options is not FetchOption + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 14000011 - System inner fail + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @since 10 + */ + getAlbums(type: AlbumType, subtype: AlbumSubtype, callback: AsyncCallback>): void; + /** + * Fetch albums. + * + * @permission ohos.permission.READ_IMAGEVIDEO + * @param { AlbumType } type - Album type. + * @param { AlbumSubtype } subtype - Album subtype. + * @param { FetchOptions } [options] - options to fetch albums + * @returns { Promise> } - Returns the fetch result + * @throws { BusinessError } 401 - if type options is not FetchOption + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 14000011 - System inner fail + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @since 10 + */ + getAlbums(type: AlbumType, subtype: AlbumSubtype, options?: FetchOptions): Promise>; + /** + * Register change notify for the specified uri. + * + * @param { string } uri - PhotoAsset's uri, album's uri or DefaultChangeUri + * @param { boolean } forChildUris - Monitor the child uris. + * @param { Callback } callback - Returns the changed data + * @throws { BusinessError } 401 - if parameter is invalid + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900020 - Invalid argument + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @since 10 + */ + registerChange(uri: string, forChildUris: boolean, callback: Callback): void; + /** + * Unregister change notify for the specified uri. + * + * @param { string } uri - PhotoAsset's uri, album's uri or DefaultChangeUri + * @param { Callback } [callback] - The callback function to unregister. + * @throws { BusinessError } 401 - if parameter is invalid + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900020 - Invalid argument + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @since 10 + */ + unRegisterChange(uri: string, callback?: Callback): void; + /** + * Create a pop-up box to delete photos + * + * @permission ohos.permission.WRITE_IMAGEVIDEO + * @param { Array } uriList - List of the asset uris to be deleted + * @param { AsyncCallback } callback - Returns void + * @throws { BusinessError } 401 - if parameter is invalid + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 14000011 - System inner fail + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @since 10 + * @deprecated since 11 + * @useinstead photoAccessHelper.MediaAssetChangeRequest#deleteAssets + */ + createDeleteRequest(uriList: Array, callback: AsyncCallback): void; + /** + * Create a pop-up box to delete photos + * + * @permission ohos.permission.WRITE_IMAGEVIDEO + * @param { Array } uriList - List of the asset uris to be deleted + * @returns { Promise } - Returns void + * @throws { BusinessError } 401 - if parameter is invalid + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 14000011 - System inner fail + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @since 10 + * @deprecated since 11 + * @useinstead photoAccessHelper.MediaAssetChangeRequest#deleteAssets + */ + createDeleteRequest(uriList: Array): Promise; + /** + * Release PhotoAccessHelper instance + * + * @param { AsyncCallback } callback - Returns void + * @throws { BusinessError } 401 - if parameter is invalid + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 14000011 - System inner fail + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @since 10 + */ + release(callback: AsyncCallback): void; + /** + * Release PhotoAccessHelper instance + * + * @returns { Promise } Returns void + * @throws { BusinessError } 401 - if parameter is invalid + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 14000011 - System inner fail + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @since 10 + */ + release(): Promise; + /** + * Apply the change request of asset or album. + * + * @permission ohos.permission.WRITE_IMAGEVIDEO + * @param { MediaChangeRequest } mediaChangeRequest - The change request to be applied + * @returns { Promise } Returns void + * @throws { BusinessError } 201 - Permission denied + * @throws { BusinessError } 401 - if parameter is invalid + * @throws { BusinessError } 14000011 - System inner fail + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @atomicservice + * @since 11 + */ + applyChanges(mediaChangeRequest: MediaChangeRequest): Promise; + } + /** + * Enumeration types of data change. + * + * @enum { number } NotifyType + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @since 10 + */ + enum NotifyType { + /** + * Data(assets or albums) have been newly created + * + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @since 10 + */ + NOTIFY_ADD, + /** + * Data(assets or albums) have been modified + * + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @since 10 + */ + NOTIFY_UPDATE, + /** + * Data(assets or albums) have been removed + * + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @since 10 + */ + NOTIFY_REMOVE, + /** + * Assets have been added to an album. + * + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @since 10 + */ + NOTIFY_ALBUM_ADD_ASSET, + /** + * Assets have been removed from an album. + * + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @since 10 + */ + NOTIFY_ALBUM_REMOVE_ASSET + } + /** + * Enumeration uris for registerChange. + * + * @enum { string } DefaultChangeUri + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @since 10 + */ + enum DefaultChangeUri { + /** + * Uri for default PhotoAsset, use with forDescendant{true}, will receive all PhotoAsset's change notifications + * + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @since 10 + */ + DEFAULT_PHOTO_URI = 'file://media/Photo', + /** + * Uri for default Album, use with forDescendant{true}, will receive all Album's change notifications + * + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @since 10 + */ + DEFAULT_ALBUM_URI = 'file://media/PhotoAlbum' + } + /** + * Defines the change data + * + * @interface ChangeData + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @since 10 + */ + interface ChangeData { + /** + * The NotifyType of ChangeData + * + * @type { NotifyType } + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @since 10 + */ + type: NotifyType; + /** + * The changed uris + * + * @type { Array } + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @since 10 + */ + uris: Array; + /** + * Change details of the asset uris to an album. + * + * @type { Array } + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @since 10 + */ + extraUris: Array; + } + /** + * PhotoViewMIMETypes represents the type of media resource that photo picker selects. + * + * @enum { string } PhotoViewMIMETypes + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @since 10 + */ + /** + * PhotoViewMIMETypes represents the type of media resource that photo picker selects. + * + * @enum { string } PhotoViewMIMETypes + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @atomicservice + * @since 11 + */ + export enum PhotoViewMIMETypes { + /** + * IMAGE_TYPE indicates that the selected media resources are images. + * + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @since 10 + */ + /** + * IMAGE_TYPE indicates that the selected media resources are images. + * + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @atomicservice + * @since 11 + */ + IMAGE_TYPE = 'image/*', + /** + * VIDEO_TYPE indicates that the selected media resources are videos. + * + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @since 10 + */ + /** + * VIDEO_TYPE indicates that the selected media resources are videos. + * + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @atomicservice + * @since 11 + */ + VIDEO_TYPE = 'video/*', + /** + * IMAGE_VIDEO_TYPE indicates that the selected media resources are images and videos. + * + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @since 10 + */ + /** + * IMAGE_VIDEO_TYPE indicates that the selected media resources are images and videos. + * + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @atomicservice + * @since 11 + */ + IMAGE_VIDEO_TYPE = '*/*', + /** + * MOVING_PHOTO_IMAGE_TYPE indicates that the selected media resources are moving photos. + * + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @atomicservice + * @since 12 + */ + MOVING_PHOTO_IMAGE_TYPE = 'image/movingPhoto' + } + /** + * Class BaseSelectOptions, which is extracted from class PhotoSelectOptions + * + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @atomicservice + * @since 12 + */ + class BaseSelectOptions { + /** + * The Type of the file in the picker window. + * + * @type { ?PhotoViewMIMETypes } + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @since 10 + */ + /** + * The Type of the file in the picker window. + * + * @type { ?PhotoViewMIMETypes } + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @atomicservice + * @since 11 + */ + /** + * The Type of the file in the picker window. + * Move from class PhotoSelectOptions to it's base class BaseSelectOptions + * + * @type { ?PhotoViewMIMETypes } + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @atomicservice + * @since 12 + */ + MIMEType?: PhotoViewMIMETypes; + /** + * Maximum number of images for a single selection. + * + * @type { ?number } + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @since 10 + */ + /** + * Maximum number of images for a single selection. + * + * @type { ?number } + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @atomicservice + * @since 11 + */ + /** + * Maximum number of images for a single selection. + * Move from class PhotoSelectOptions to it's base class BaseSelectOptions + * + * @type { ?number } + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @atomicservice + * @since 12 + */ + maxSelectNumber?: number; + /** + * Support search. + * + * @type { ?boolean } + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @atomicservice + * @since 11 + */ + /** + * Support search. + * Move from class PhotoSelectOptions to it's base class BaseSelectOptions + * + * @type { ?boolean } + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @atomicservice + * @since 12 + */ + isSearchSupported?: boolean; + /** + * Support taking photos. + * + * @type { ?boolean } + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @atomicservice + * @since 11 + */ + /** + * Support taking photos. + * Move from class PhotoSelectOptions to it's base class BaseSelectOptions + * + * @type { ?boolean } + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @atomicservice + * @since 12 + */ + isPhotoTakingSupported?: boolean; + /** + * The recommendation options when use recommendation photo function. + * + * @type { ?RecommendationOptions } + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @atomicservice + * @since 11 + */ + /** + * The recommendation options when use recommendation photo function. + * Move from class PhotoSelectOptions to it's base class BaseSelectOptions + * + * @type { ?RecommendationOptions } + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @atomicservice + * @since 12 + */ + recommendationOptions?: RecommendationOptions; + /** + * The uri for the preselected files. + * + * @type { ?Array } + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @atomicservice + * @since 11 + */ + /** + * The uri for the preselected files. + * Move from class PhotoSelectOptions to it's base class BaseSelectOptions + * + * @type { ?Array } + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @atomicservice + * @since 12 + */ + preselectedUris?: Array; + } + /** + * PhotoSelectOptions Object + * + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @since 10 + */ + /** + * PhotoSelectOptions Object + * + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @atomicservice + * @since 11 + */ + /** + * PhotoSelectOptions extends base class BaseSelectOptions + * + * @extends BaseSelectOptions + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @atomicservice + * @since 12 + */ + class PhotoSelectOptions extends BaseSelectOptions { + /** + * Support editing photos. + * + * @type { ?boolean } + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @atomicservice + * @since 11 + */ + isEditSupported?: boolean; + } + /** + * Options for recommend photos + * + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @atomicservice + * @since 11 + */ + class RecommendationOptions { + /** + * The recommendation photo type when select photo in photo picker. + * + * @type { ?RecommendationType } + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @atomicservice + * @since 11 + */ + recommendationType?: RecommendationType; + /** + * The textContextInfo to recommend images. + * + * @type { ?TextContextInfo } + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @atomicservice + * @since 12 + */ + textContextInfo?: TextContextInfo; + } + /** + * Defines the text context info. + * + * @interface TextContextInfo + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @atomicservice + * @since 12 + */ + interface TextContextInfo { + /** + * The Simplified Chinese(UTF-8) text within 250 to recommend images. + * + * @type { ?string } + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @atomicservice + * @since 12 + */ + text?: string; + } + /** + * PhotoSelectResult Object + * + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @since 10 + */ + /** + * PhotoSelectResult Object + * + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @atomicservice + * @since 11 + */ + class PhotoSelectResult { + /** + * The uris for the selected files. + * + * @type { Array } + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @since 10 + */ + /** + * The uris for the selected files. + * + * @type { Array } + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @atomicservice + * @since 11 + */ + photoUris: Array; + /** + * Original option. + * + * @type { boolean } + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @since 10 + */ + /** + * Original option. + * + * @type { boolean } + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @atomicservice + * @since 11 + */ + isOriginalPhoto: boolean; + } + /** + * PhotoViewPicker Object + * + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @since 10 + */ + /** + * PhotoViewPicker Object + * + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @atomicservice + * @since 11 + */ + class PhotoViewPicker { + /** + * Pull up the photo picker based on the selection mode. + * + * @param { PhotoSelectOptions } [option] - represents the options provided in select mode. + * @returns { Promise } Returns the uris for the selected files. + * @throws { BusinessError } 401 - if parameter is invalid + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @since 10 + */ + /** + * Pull up the photo picker based on the selection mode. + * + * @param { PhotoSelectOptions } [option] - represents the options provided in select mode. + * @returns { Promise } Returns the uris for the selected files. + * @throws { BusinessError } 401 - if parameter is invalid + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @atomicservice + * @since 11 + */ + select(option?: PhotoSelectOptions): Promise; + /** + * Pull up the photo picker based on the selection mode. + * + * @param { PhotoSelectOptions } option - represents the options provided in select mode. + * @param { AsyncCallback } callback - Returns the PhotoSelectResult by photo picker + * @throws { BusinessError } 401 - if parameter is invalid + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @since 10 + */ + /** + * Pull up the photo picker based on the selection mode. + * + * @param { PhotoSelectOptions } option - represents the options provided in select mode. + * @param { AsyncCallback } callback - Returns the PhotoSelectResult by photo picker + * @throws { BusinessError } 401 - if parameter is invalid + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @atomicservice + * @since 11 + */ + select(option: PhotoSelectOptions, callback: AsyncCallback): void; + /** + * Pull up the photo picker based on the selection mode. + * + * @param { AsyncCallback } callback - Returns the PhotoSelectResult by photo picker + * @throws { BusinessError } 401 - if parameter is invalid + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @since 10 + */ + /** + * Pull up the photo picker based on the selection mode. + * + * @param { AsyncCallback } callback - Returns the PhotoSelectResult by photo picker + * @throws { BusinessError } 401 - if parameter is invalid + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @atomicservice + * @since 11 + */ + select(callback: AsyncCallback): void; + } + /** + * Enumeration of resource type. + * + * @enum { number } ResourceType + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @atomicservice + * @since 11 + */ + enum ResourceType { + /** + * Image resource + * + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @atomicservice + * @since 11 + */ + IMAGE_RESOURCE = 1, + /** + * Video resource + * + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @atomicservice + * @since 11 + */ + VIDEO_RESOURCE = 2 + } + /** + * Defines the interface of media change request. + * + * @interface MediaChangeRequest + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @atomicservice + * @since 11 + */ + interface MediaChangeRequest { + } + /** + * Defines the class of media asset change request. + * + * @implements MediaChangeRequest + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @atomicservice + * @since 11 + */ + class MediaAssetChangeRequest implements MediaChangeRequest { + /** + * The constructor to create a MediaAssetChangeRequest instance. + * + * @param { PhotoAsset } asset - Specify which asset to change + * @throws { BusinessError } 401 - if parameter is invalid + * @throws { BusinessError } 14000011 - System inner fail + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @since 11 + */ + constructor(asset: PhotoAsset); + /** + * Create image asset change request. + * + * @param { Context } context - Hap context information + * @param { string } fileUri - File uri + * @returns { MediaAssetChangeRequest } - Returns a MediaAssetChangeRequest instance + * @throws { BusinessError } 401 - if parameter is invalid + * @throws { BusinessError } 13900002 - No such file + * @throws { BusinessError } 14000011 - System inner fail + * @static + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @since 11 + */ + static createImageAssetRequest(context: Context, fileUri: string): MediaAssetChangeRequest; + /** + * Create video asset change request. + * + * @param { Context } context - Hap context information + * @param { string } fileUri - File uri + * @returns { MediaAssetChangeRequest } - Returns a MediaAssetChangeRequest instance + * @throws { BusinessError } 401 - if parameter is invalid + * @throws { BusinessError } 13900002 - No such file + * @throws { BusinessError } 14000011 - System inner fail + * @static + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @since 11 + */ + static createVideoAssetRequest(context: Context, fileUri: string): MediaAssetChangeRequest; + /** + * Create asset change request. + * + * @param { Context } context - Hap context information + * @param { PhotoType } photoType - Photo asset type + * @param { string } extension - Asset extension + * @param { CreateOptions } [options] - Optional asset create option + * @returns { MediaAssetChangeRequest } - Returns a MediaAssetChangeRequest instance + * @throws { BusinessError } 401 - if parameter is invalid + * @throws { BusinessError } 14000011 - System inner fail + * @static + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @atomicservice + * @since 11 + */ + static createAssetRequest(context: Context, photoType: PhotoType, extension: string, options?: CreateOptions): MediaAssetChangeRequest; + /** + * Delete assets. + * + * @permission ohos.permission.WRITE_IMAGEVIDEO + * @param { Context } context - Hap context information + * @param { Array } assets - Assets to delete + * @returns { Promise } - Returns void + * @throws { BusinessError } 201 - Permission denied + * @throws { BusinessError } 401 - if parameter is invalid + * @throws { BusinessError } 14000011 - System inner fail + * @static + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @since 11 + */ + static deleteAssets(context: Context, assets: Array): Promise; + /** + * Delete assets. + * + * @permission ohos.permission.WRITE_IMAGEVIDEO + * @param { Context } context - Hap context information + * @param { Array } uriList - Uris of assets to delete + * @returns { Promise } - Returns void + * @throws { BusinessError } 201 - Permission denied + * @throws { BusinessError } 401 - if parameter is invalid + * @throws { BusinessError } 14000002 - Invalid asset uri + * @throws { BusinessError } 14000011 - System inner fail + * @static + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @since 11 + */ + static deleteAssets(context: Context, uriList: Array): Promise; + /** + * Get the asset. + * + * @returns { PhotoAsset } - Returns the asset + * @throws { BusinessError } 401 - if parameter is invalid + * @throws { BusinessError } 14000011 - System inner fail + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @since 11 + */ + getAsset(): PhotoAsset; + /** + * Set title of the asset. + * + * @param { string } title - the new title of the asset + * @throws { BusinessError } 401 - if parameter is invalid + * @throws { BusinessError } 14000011 - System inner fail + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @since 11 + */ + setTitle(title: string): void; + /** + * Get write cache handler. + * + * @permission ohos.permission.WRITE_IMAGEVIDEO + * @returns { Promise } Returns the write cache handler + * @throws { BusinessError } 201 - Permission denied + * @throws { BusinessError } 401 - if parameter is invalid + * @throws { BusinessError } 14000011 - System inner fail + * @throws { BusinessError } 14000016 - Operation Not Support + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @since 11 + */ + getWriteCacheHandler(): Promise; + /** + * Add resource of the asset using file uri. + * + * @param { ResourceType } type - Resource type + * @param { string } fileUri - File uri + * @throws { BusinessError } 401 - if parameter is invalid + * @throws { BusinessError } 13900002 - No such file + * @throws { BusinessError } 14000011 - System inner fail + * @throws { BusinessError } 14000016 - Operation Not Support + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @atomicservice + * @since 11 + */ + addResource(type: ResourceType, fileUri: string): void; + /** + * Add resource of the asset using ArrayBuffer. + * + * @param { ResourceType } type - Resource type + * @param { ArrayBuffer } data - Data buffer to add + * @throws { BusinessError } 401 - if parameter is invalid + * @throws { BusinessError } 14000011 - System inner fail + * @throws { BusinessError } 14000016 - Operation Not Support + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @atomicservice + * @since 11 + */ + addResource(type: ResourceType, data: ArrayBuffer): void; + /** + * Save the photo asset captured by camera. + * + * @throws { BusinessError } 14000011 - System inner fail + * @throws { BusinessError } 14000016 - Operation Not Support + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @since 12 + */ + saveCameraPhoto(): void; + } + /** + * Defines the class of media album change request. + * + * @implements MediaChangeRequest + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @since 11 + */ + class MediaAlbumChangeRequest implements MediaChangeRequest { + /** + * The constructor to create a MediaAlbumChangeRequest instance. + * + * @param { Album } album - Specify which album to change + * @throws { BusinessError } 401 - if parameter is invalid + * @throws { BusinessError } 14000011 - System inner fail + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @since 11 + */ + constructor(album: Album); + /** + * Get the album. + * + * @returns { Album } - Returns the album + * @throws { BusinessError } 401 - if parameter is invalid + * @throws { BusinessError } 14000011 - System inner fail + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @since 11 + */ + getAlbum(): Album; + /** + * Set name of the album. + * + * @param { string } name - the new name to set + * @throws { BusinessError } 401 - if parameter is invalid + * @throws { BusinessError } 14000011 - System inner fail + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @since 11 + */ + setAlbumName(name: string): void; + /** + * Add assets into the album. + * + * @param { Array } assets - the assets to add + * @throws { BusinessError } 401 - if parameter is invalid + * @throws { BusinessError } 14000011 - System inner fail + * @throws { BusinessError } 14000016 - Operation Not Support + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @since 11 + */ + addAssets(assets: Array): void; + /** + * Remove assets from the album. + * + * @param { Array } assets - the assets to be removed + * @throws { BusinessError } 401 - if parameter is invalid + * @throws { BusinessError } 14000011 - System inner fail + * @throws { BusinessError } 14000016 - Operation Not Support + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @since 11 + */ + removeAssets(assets: Array): void; + } + /** + * Defines the moving photo. + * + * @interface MovingPhoto + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @since 12 + */ + interface MovingPhoto { + /** + * Request the image and video content of the moving photo and write to destination uri. + * + * @permission ohos.permission.READ_IMAGEVIDEO + * @param { string } imageFileUri - Destination uri of the image content to be written + * @param { string } videoFileUri - Destination uri of the video content to be written + * @returns { Promise } Returns void + * @throws { BusinessError } 201 - Permission denied + * @throws { BusinessError } 401 - if parameter is invalid + * @throws { BusinessError } 14000011 - System inner fail + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @since 12 + */ + requestContent(imageFileUri: string, videoFileUri: string): Promise; + /** + * Request content of the moving photo for the given resource type and write to destination uri. + * + * @permission ohos.permission.READ_IMAGEVIDEO + * @param { ResourceType } resourceType - The resource type of the content to request + * @param { string } fileUri - Destination uri of the content to be written + * @returns { Promise } Returns void + * @throws { BusinessError } 201 - Permission denied + * @throws { BusinessError } 401 - if parameter is invalid + * @throws { BusinessError } 14000011 - System inner fail + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @since 12 + */ + requestContent(resourceType: ResourceType, fileUri: string): Promise; + /** + * Request content of the moving photo for the given resource type and return the array buffer. + * + * @permission ohos.permission.READ_IMAGEVIDEO + * @param { ResourceType } resourceType - The resource type of the content to request + * @returns { Promise } Returns array buffer of the content + * @throws { BusinessError } 201 - Permission denied + * @throws { BusinessError } 401 - if parameter is invalid + * @throws { BusinessError } 14000011 - System inner fail + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @since 12 + */ + requestContent(resourceType: ResourceType): Promise; + /** + * Get uri of the moving photo. + * + * @returns { string } Returns uri of the moving photo + * @throws { BusinessError } 401 - if parameter is invalid + * @throws { BusinessError } 14000011 - System inner fail + * @syscap SystemCapability.FileManagement.PhotoAccessHelper.Core + * @since 12 + */ + getUri(): string; + } +} +export default photoAccessHelper; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.file.picker.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.file.picker.d.ts new file mode 100755 index 00000000..72bfe132 --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.file.picker.d.ts @@ -0,0 +1,810 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"), + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit CoreFileKit + */ +import { AsyncCallback } from './@ohos.base'; +import Context from './application/Context'; +/** + * Provide the capabilities to use different pickers. + * + * @namespace picker + * @syscap SystemCapability.FileManagement.UserFileService + * @since 9 + */ +/** + * Provide the capabilities to use different pickers. + * + * @namespace picker + * @syscap SystemCapability.FileManagement.UserFileService + * @atomicservice + * @since 11 + */ +declare namespace picker { + /** + * PhotoViewMIMETypes represents the type of media resource that photo picker selects. + * + * @enum { string } PhotoViewMIMETypes + * @syscap SystemCapability.FileManagement.UserFileService + * @since 9 + */ + /** + * PhotoViewMIMETypes represents the type of media resource that photo picker selects. + * + * @enum { string } PhotoViewMIMETypes + * @syscap SystemCapability.FileManagement.UserFileService + * @atomicservice + * @since 11 + */ + export enum PhotoViewMIMETypes { + /** + * Image type. + * + * @syscap SystemCapability.FileManagement.UserFileService + * @since 9 + */ + /** + * Image type. + * + * @syscap SystemCapability.FileManagement.UserFileService + * @atomicservice + * @since 11 + */ + IMAGE_TYPE = 'image/*', + /** + * Video type. + * + * @syscap SystemCapability.FileManagement.UserFileService + * @since 9 + */ + /** + * Video type. + * + * @syscap SystemCapability.FileManagement.UserFileService + * @atomicservice + * @since 11 + */ + VIDEO_TYPE = 'video/*', + /** + * Image and video type. + * + * @syscap SystemCapability.FileManagement.UserFileService + * @since 9 + */ + /** + * Image and video type. + * + * @syscap SystemCapability.FileManagement.UserFileService + * @atomicservice + * @since 11 + */ + IMAGE_VIDEO_TYPE = '*/*' + } + /** + * PhotoSelectOptions Object + * + * @syscap SystemCapability.FileManagement.UserFileService + * @since 9 + */ + /** + * PhotoSelectOptions Object + * + * @syscap SystemCapability.FileManagement.UserFileService + * @atomicservice + * @since 11 + */ + class PhotoSelectOptions { + /** + * The Type of the file in the picker window. + * + * @type { ?PhotoViewMIMETypes } + * @syscap SystemCapability.FileManagement.UserFileService + * @since 9 + */ + /** + * The Type of the file in the picker window. + * + * @type { ?PhotoViewMIMETypes } + * @syscap SystemCapability.FileManagement.UserFileService + * @atomicservice + * @since 11 + */ + MIMEType?: PhotoViewMIMETypes; + /** + * Maximum number of images for a single selection. + * + * @type { ?number } + * @syscap SystemCapability.FileManagement.UserFileService + * @since 9 + */ + /** + * Maximum number of images for a single selection. + * + * @type { ?number } + * @syscap SystemCapability.FileManagement.UserFileService + * @atomicservice + * @since 11 + */ + maxSelectNumber?: number; + } + /** + * PhotoSelectResult Object + * + * @syscap SystemCapability.FileManagement.UserFileService + * @since 9 + */ + /** + * PhotoSelectResult Object + * + * @syscap SystemCapability.FileManagement.UserFileService + * @atomicservice + * @since 11 + */ + class PhotoSelectResult { + /** + * The uris for the selected files. + * + * @type { Array } + * @syscap SystemCapability.FileManagement.UserFileService + * @since 9 + */ + /** + * The uris for the selected files. + * + * @type { Array } + * @syscap SystemCapability.FileManagement.UserFileService + * @atomicservice + * @since 11 + */ + photoUris: Array; + /** + * Original option. + * + * @type { boolean } + * @syscap SystemCapability.FileManagement.UserFileService + * @since 9 + */ + /** + * Original option. + * + * @type { boolean } + * @syscap SystemCapability.FileManagement.UserFileService + * @atomicservice + * @since 11 + */ + isOriginalPhoto: boolean; + } + /** + * PhotoSaveOptions Object + * + * @syscap SystemCapability.FileManagement.UserFileService + * @since 9 + */ + class PhotoSaveOptions { + /** + * The names of the files to be saved. + * + * @type { ?Array } + * @syscap SystemCapability.FileManagement.UserFileService + * @since 9 + */ + newFileNames?: Array; + } + /** + * PhotoViewPicker Object + * + * @syscap SystemCapability.FileManagement.UserFileService + * @since 9 + */ + /** + * PhotoViewPicker Object + * + * @syscap SystemCapability.FileManagement.UserFileService + * @atomicservice + * @since 11 + */ + class PhotoViewPicker { + /** + * The constructor used to create a PhotoViewPicker object. + * + * @syscap SystemCapability.FileManagement.UserFileService + * @since 12 + */ + constructor(); + /** + * The constructor used to create a PhotoViewPicker object. + * + * @param { Context } context - represents the context. + * @syscap SystemCapability.FileManagement.UserFileService + * @since 12 + */ + constructor(context: Context); + /** + * Pull up the photo picker based on the selection mode. + * + * @param { PhotoSelectOptions } option - represents the options provided in select mode. + * @returns { Promise } Returns the uris for the selected files. + * @syscap SystemCapability.FileManagement.UserFileService + * @since 9 + */ + /** + * Pull up the photo picker based on the selection mode. + * + * @param { PhotoSelectOptions } option - represents the options provided in select mode. + * @returns { Promise } Returns the uris for the selected files. + * @syscap SystemCapability.FileManagement.UserFileService + * @atomicservice + * @since 11 + */ + select(option?: PhotoSelectOptions): Promise; + /** + * Pull up the photo picker based on the selection mode. + * + * @param { PhotoSelectOptions } option - represents the options provided in select mode. + * @param { AsyncCallback } callback - callback + * @syscap SystemCapability.FileManagement.UserFileService + * @since 9 + */ + /** + * Pull up the photo picker based on the selection mode. + * + * @param { PhotoSelectOptions } option - represents the options provided in select mode. + * @param { AsyncCallback } callback - callback + * @syscap SystemCapability.FileManagement.UserFileService + * @atomicservice + * @since 11 + */ + select(option: PhotoSelectOptions, callback: AsyncCallback): void; + /** + * Pull up the photo picker based on the selection mode. + * + * @param { AsyncCallback } callback - callback + * @syscap SystemCapability.FileManagement.UserFileService + * @since 9 + */ + /** + * Pull up the photo picker based on the selection mode. + * + * @param { AsyncCallback } callback - callback + * @syscap SystemCapability.FileManagement.UserFileService + * @atomicservice + * @since 11 + */ + select(callback: AsyncCallback): void; + /** + * Pull up the photo picker based on the save mode. + * + * @param { PhotoSaveOptions } option - represents the options provided in save mode. + * @returns { Promise> } Returns the uris for the saved files. + * @syscap SystemCapability.FileManagement.UserFileService + * @since 9 + */ + save(option?: PhotoSaveOptions): Promise>; + /** + * Pull up the photo picker based on the save mode. + * + * @param { PhotoSaveOptions } option - represents the options provided in save mode. + * @param { AsyncCallback> } callback - callback + * @syscap SystemCapability.FileManagement.UserFileService + * @since 9 + */ + save(option: PhotoSaveOptions, callback: AsyncCallback>): void; + /** + * Pull up the photo picker based on the save mode. + * + * @param { AsyncCallback> } callback - callback + * @syscap SystemCapability.FileManagement.UserFileService + * @since 9 + */ + save(callback: AsyncCallback>): void; + } + /** + * Enumerates the picker's select mode types. + * + * @enum { number } DocumentSelectMode + * @syscap SystemCapability.FileManagement.UserFileService.FolderSelection + * @since 11 + */ + /** + * Enumerates the picker's select mode types. + * + * @enum { number } DocumentSelectMode + * @syscap SystemCapability.FileManagement.UserFileService.FolderSelection + * @atomicservice + * @since 12 + */ + export enum DocumentSelectMode { + /** + * Indicates that only files are allowed to be selected. + * + * @syscap SystemCapability.FileManagement.UserFileService.FolderSelection + * @since 11 + */ + /** + * Indicates that only files are allowed to be selected. + * + * @syscap SystemCapability.FileManagement.UserFileService.FolderSelection + * @atomicservice + * @since 12 + */ + FILE = 0, + /** + * Indicates that only folders are allowed to be selected. + * + * @syscap SystemCapability.FileManagement.UserFileService.FolderSelection + * @since 11 + */ + /** + * Indicates that only folders are allowed to be selected. + * + * @syscap SystemCapability.FileManagement.UserFileService.FolderSelection + * @atomicservice + * @since 12 + */ + FOLDER = 1, + /** + * Indicates that files and folders are allowed to be selected. + * + * @syscap SystemCapability.FileManagement.UserFileService.FolderSelection + * @since 11 + */ + /** + * Indicates that files and folders are allowed to be selected. + * + * @syscap SystemCapability.FileManagement.UserFileService.FolderSelection + * @atomicservice + * @since 12 + */ + MIXED = 2 + } + /** + * Enumerates the picker's mode types. + * + * @enum { number } DocumentPickerMode + * @syscap SystemCapability.FileManagement.UserFileService.FolderSelection + * @atomicservice + * @since 12 + */ + export enum DocumentPickerMode { + /** + * Document mode. + * + * @syscap SystemCapability.FileManagement.UserFileService + * @atomicservice + * @since 12 + */ + DEFAULT = 0, + /** + * Download mode. + * + * @syscap SystemCapability.FileManagement.UserFileService + * @atomicservice + * @since 12 + */ + DOWNLOAD = 1 + } + /** + * DocumentSelectOptions Object. + * + * @syscap SystemCapability.FileManagement.UserFileService + * @since 9 + */ + /** + * DocumentSelectOptions Object. + * + * @syscap SystemCapability.FileManagement.UserFileService + * @atomicservice + * @since 12 + */ + class DocumentSelectOptions { + /** + * The default opening uri of the picker window. + * + * @type { ?string } + * @syscap SystemCapability.FileManagement.UserFileService + * @since 10 + */ + /** + * The default opening uri of the picker window. + * + * @type { ?string } + * @syscap SystemCapability.FileManagement.UserFileService + * @atomicservice + * @since 12 + */ + defaultFilePathUri?: string; + /** + * Suffixes for file selected. + * + * @type { ?Array } + * @syscap SystemCapability.FileManagement.UserFileService + * @since 10 + */ + /** + * Suffixes for file selected. + * + * @type { ?Array } + * @syscap SystemCapability.FileManagement.UserFileService + * @atomicservice + * @since 12 + */ + fileSuffixFilters?: Array; + /** + * Maximum number of files for a single selection. + * + * @type { ?number } + * @syscap SystemCapability.FileManagement.UserFileService + * @since 10 + */ + /** + * Maximum number of files for a single selection. + * + * @type { ?number } + * @syscap SystemCapability.FileManagement.UserFileService + * @atomicservice + * @since 12 + */ + maxSelectNumber?: number; + /** + * Selection mode. + * + * @type { ?DocumentSelectMode } + * @syscap SystemCapability.FileManagement.UserFileService.FolderSelection + * @since 11 + */ + /** + * Selection mode. + * + * @type { ?DocumentSelectMode } + * @syscap SystemCapability.FileManagement.UserFileService.FolderSelection + * @atomicservice + * @since 12 + */ + selectMode?: DocumentSelectMode; + /** + * Granting Permissions to Specified Directories or Files. + * The value true indicates that authorization is required. + * When authmode is set to true, the defaultFilePathUri field is mandatory. + * + * @type { ?boolean } + * @syscap SystemCapability.FileManagement.UserFileService.FolderSelection + * @atomicservice + * @since 12 + */ + authMode?: boolean; + } + /** + * DocumentSaveOptions Object + * + * @syscap SystemCapability.FileManagement.UserFileService + * @since 9 + */ + /** + * DocumentSaveOptions Object + * + * @syscap SystemCapability.FileManagement.UserFileService + * @atomicservice + * @since 12 + */ + class DocumentSaveOptions { + /** + * The names of the files to be saved. + * + * @type { ?Array } + * @syscap SystemCapability.FileManagement.UserFileService + * @since 9 + */ + /** + * The names of the files to be saved. + * + * @type { ?Array } + * @syscap SystemCapability.FileManagement.UserFileService + * @atomicservice + * @since 12 + */ + newFileNames?: Array; + /** + * The default opening uri of the picker window. + * + * @type { ?string } + * @syscap SystemCapability.FileManagement.UserFileService + * @since 10 + */ + /** + * The default opening uri of the picker window. + * + * @type { ?string } + * @syscap SystemCapability.FileManagement.UserFileService + * @atomicservice + * @since 12 + */ + defaultFilePathUri?: string; + /** + * Suffixes for file saved. + * + * @type { ?Array } + * @syscap SystemCapability.FileManagement.UserFileService + * @since 10 + */ + /** + * Suffixes for file saved. + * + * @type { ?Array } + * @syscap SystemCapability.FileManagement.UserFileService + * @atomicservice + * @since 12 + */ + fileSuffixChoices?: Array; + /** + * picker mode. + * + * @type { ?DocumentPickerMode } + * @syscap SystemCapability.FileManagement.UserFileService + * @atomicservice + * @since 12 + */ + pickerMode?: DocumentPickerMode; + } + /** + * DocumentViewPicker Object + * + * @syscap SystemCapability.FileManagement.UserFileService + * @since 9 + */ + /** + * DocumentViewPicker Object + * + * @syscap SystemCapability.FileManagement.UserFileService + * @atomicservice + * @since 12 + */ + class DocumentViewPicker { + /** + * The constructor used to create a DocumentViewPicker object. + * + * @syscap SystemCapability.FileManagement.UserFileService + * @since 12 + */ + constructor(); + /** + * The constructor used to create a DocumentViewPicker object. + * + * @param { Context } context - represents the context. + * @syscap SystemCapability.FileManagement.UserFileService + * @since 12 + */ + constructor(context: Context); + /** + * Pull up the document picker based on the selection mode. + * + * @param { DocumentSelectOptions } option - represents the options provided in select mode. + * @returns { Promise> } Returns the uris for the selected files. + * @syscap SystemCapability.FileManagement.UserFileService + * @since 9 + */ + /** + * Pull up the document picker based on the selection mode. + * + * @param { DocumentSelectOptions } option - represents the options provided in select mode. + * @returns { Promise> } Returns the uris for the selected files. + * @syscap SystemCapability.FileManagement.UserFileService + * @atomicservice + * @since 12 + */ + select(option?: DocumentSelectOptions): Promise>; + /** + * Pull up the document picker based on the selection mode. + * + * @param { DocumentSelectOptions } option - represents the options provided in select mode. + * @param { AsyncCallback> } callback - callback + * @syscap SystemCapability.FileManagement.UserFileService + * @since 9 + */ + /** + * Pull up the document picker based on the selection mode. + * + * @param { DocumentSelectOptions } option - represents the options provided in select mode. + * @param { AsyncCallback> } callback - callback + * @syscap SystemCapability.FileManagement.UserFileService + * @atomicservice + * @since 12 + */ + select(option: DocumentSelectOptions, callback: AsyncCallback>): void; + /** + * Pull up the document picker based on the selection mode. + * + * @param { AsyncCallback> } callback - callback + * @syscap SystemCapability.FileManagement.UserFileService + * @since 9 + */ + /** + * Pull up the document picker based on the selection mode. + * + * @param { AsyncCallback> } callback - callback + * @syscap SystemCapability.FileManagement.UserFileService + * @atomicservice + * @since 12 + */ + select(callback: AsyncCallback>): void; + /** + * Pull up the document picker based on the save mode. + * + * @param { DocumentSaveOptions } option - represents the options provided in save mode. + * @returns { Promise> } Returns the uris for the saved files. + * @syscap SystemCapability.FileManagement.UserFileService + * @since 9 + */ + /** + * Pull up the document picker based on the save mode. + * + * @param { DocumentSaveOptions } option - represents the options provided in save mode. + * @returns { Promise> } Returns the uris for the saved files. + * @syscap SystemCapability.FileManagement.UserFileService + * @atomicservice + * @since 12 + */ + save(option?: DocumentSaveOptions): Promise>; + /** + * Pull up the document picker based on the save mode. + * + * @param { DocumentSaveOptions } option - represents the options provided in save mode. + * @param { AsyncCallback> } callback - callback + * @syscap SystemCapability.FileManagement.UserFileService + * @since 9 + */ + /** + * Pull up the document picker based on the save mode. + * + * @param { DocumentSaveOptions } option - represents the options provided in save mode. + * @param { AsyncCallback> } callback - callback + * @syscap SystemCapability.FileManagement.UserFileService + * @atomicservice + * @since 12 + */ + save(option: DocumentSaveOptions, callback: AsyncCallback>): void; + /** + * Pull up the document picker based on the save mode. + * + * @param { AsyncCallback> } callback - callback + * @syscap SystemCapability.FileManagement.UserFileService + * @since 9 + */ + /** + * Pull up the document picker based on the save mode. + * + * @param { AsyncCallback> } callback - callback + * @syscap SystemCapability.FileManagement.UserFileService + * @atomicservice + * @since 12 + */ + save(callback: AsyncCallback>): void; + } + /** + * AudioSelectOptions Object. Currently not supported. + * + * @syscap SystemCapability.FileManagement.UserFileService + * @since 9 + */ + /** + * AudioSelectOptions Object. + * + * @syscap SystemCapability.FileManagement.UserFileService + * @since 12 + */ + class AudioSelectOptions { + /** + * Maximum number of audio for a single selection. + * + * @type { ?number } + * @syscap SystemCapability.FileManagement.UserFileService + * @atomicservice + * @since 12 + */ + maxSelectNumber?: number; + } + /** + * AudioSaveOptions Object + * + * @syscap SystemCapability.FileManagement.UserFileService + * @since 9 + */ + class AudioSaveOptions { + /** + * The names of the files to be saved. + * + * @type { ?Array } + * @syscap SystemCapability.FileManagement.UserFileService + * @since 9 + */ + newFileNames?: Array; + } + /** + * AudioViewPicker Object + * + * @syscap SystemCapability.FileManagement.UserFileService + * @since 9 + */ + class AudioViewPicker { + /** + * The constructor used to create a AudioViewPicker object. + * + * @syscap SystemCapability.FileManagement.UserFileService + * @since 12 + */ + constructor(); + /** + * The constructor used to create a AudioViewPicker object. + * + * @param { Context } context - represents the context. + * @syscap SystemCapability.FileManagement.UserFileService + * @since 12 + */ + constructor(context: Context); + /** + * Pull up the audio picker based on the selection mode. + * + * @param { AudioSelectOptions } option - represents the options provided in select mode. + * @returns { Promise> } Returns the uris for the selected files. + * @syscap SystemCapability.FileManagement.UserFileService + * @since 9 + */ + select(option?: AudioSelectOptions): Promise>; + /** + * Pull up the audio picker based on the selection mode. + * + * @param { AudioSelectOptions } option - represents the options provided in select mode. + * @param { AsyncCallback> } callback - callback + * @syscap SystemCapability.FileManagement.UserFileService + * @since 9 + */ + select(option: AudioSelectOptions, callback: AsyncCallback>): void; + /** + * Pull up the audio picker based on the selection mode. + * + * @param { AsyncCallback> } callback - callback + * @syscap SystemCapability.FileManagement.UserFileService + * @since 9 + */ + select(callback: AsyncCallback>): void; + /** + * Pull up the audio picker based on the save mode. + * + * @param { AudioSaveOptions } option - represents the options provided in save mode. + * @returns { Promise> } Returns the uris for the saved files. + * @syscap SystemCapability.FileManagement.UserFileService + * @since 9 + */ + save(option?: AudioSaveOptions): Promise>; + /** + * Pull up the audio picker based on the save mode. + * + * @param { AudioSaveOptions } option - represents the options provided in save mode. + * @param { AsyncCallback> } callback - callback + * @syscap SystemCapability.FileManagement.UserFileService + * @since 9 + */ + save(option: AudioSaveOptions, callback: AsyncCallback>): void; + /** + * Pull up the audio picker based on the save mode. + * + * @param { AsyncCallback> } callback - callback + * @syscap SystemCapability.FileManagement.UserFileService + * @since 9 + */ + save(callback: AsyncCallback>): void; + } +} +export default picker; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.file.securityLabel.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.file.securityLabel.d.ts new file mode 100755 index 00000000..705dd584 --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.file.securityLabel.d.ts @@ -0,0 +1,140 @@ +/* + * Copyright (C) 2022-2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit CoreFileKit + */ +import type { AsyncCallback } from './@ohos.base'; +/** + * Provides securityLabel APIs + * + * @namespace securityLabel + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ +declare namespace securityLabel { + /** + * The security level. + * + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ + type DataLevel = 's0' | 's1' | 's2' | 's3' | 's4'; + /** + * Set the SecurityLabel. + * + * @param { string } path - path + * @param { DataLevel } type - type + * @returns { Promise } return Promise + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900007 - Arg list too long + * @throws { BusinessError } 13900015 - File exists + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900037 - No data available + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ + function setSecurityLabel(path: string, type: DataLevel): Promise; + /** + * Set the SecurityLabel. + * + * @param { string } path - path + * @param { DataLevel } type - type + * @param { AsyncCallback } [callback] - callback + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900007 - Arg list too long + * @throws { BusinessError } 13900015 - File exists + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900037 - No data available + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ + function setSecurityLabel(path: string, type: DataLevel, callback: AsyncCallback): void; + /** + * Set the SecurityLabel with sync interface. + * + * @param { string } path - path + * @param { DataLevel } type - type + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900007 - Arg list too long + * @throws { BusinessError } 13900015 - File exists + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900037 - No data available + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ + function setSecurityLabelSync(path: string, type: DataLevel): void; + /** + * Get the SecurityLabel. + * + * @param { string } path - path + * @returns { Promise } return Promise + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900007 - Arg list too long + * @throws { BusinessError } 13900015 - File exists + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900037 - No data available + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ + function getSecurityLabel(path: string): Promise; + /** + * Get the SecurityLabel. + * + * @param { string } path - path + * @param { AsyncCallback } [callback] - callback + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900007 - Arg list too long + * @throws { BusinessError } 13900015 - File exists + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900037 - No data available + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ + function getSecurityLabel(path: string, callback: AsyncCallback): void; + /** + * Get the SecurityLabel with sync interface. + * + * @param { string } path - path + * @returns { string } security label name + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900007 - Arg list too long + * @throws { BusinessError } 13900015 - File exists + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900037 - No data available + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ + function getSecurityLabelSync(path: string): string; +} +export default securityLabel; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.file.statvfs.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.file.statvfs.d.ts new file mode 100755 index 00000000..2af30df7 --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.file.statvfs.d.ts @@ -0,0 +1,161 @@ +/* + * Copyright (C) 2022-2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit CoreFileKit + */ +import type { AsyncCallback } from './@ohos.base'; +/** + * Provides filesystem statistics APIs + * + * @namespace statfs + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ +declare namespace statfs { + /** + * Get the number of free bytes on the specified path. + * + * @param { string } path - path + * @returns { Promise } return Promise + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900031 - Function not implemented + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900038 - Value too large for defined data type + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ + function getFreeSize(path: string): Promise; + /** + * Get the number of free bytes on the specified path. + * + * @param { string } path - path + * @param { AsyncCallback } [callback] - callback + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900031 - Function not implemented + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900038 - Value too large for defined data type + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ + function getFreeSize(path: string, callback: AsyncCallback): void; + /** + * Get the number of free bytes on the specified path with sync interface. + * + * @param { string } path - path + * @returns { number } return the number of free bytes on the specified path + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900031 - Function not implemented + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900038 - Value too large for defined data type + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 10 + */ + function getFreeSizeSync(path: string): number; + /** + * Get the number of total bytes on the specified path. + * + * @param { string } path - path + * @returns { Promise } return Promise + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900031 - Function not implemented + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900038 - Value too large for defined data type + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ + function getTotalSize(path: string): Promise; + /** + * Get the number of total bytes on the specified path. + * + * @param { string } path - path + * @param { AsyncCallback } [callback] - callback + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900031 - Function not implemented + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900038 - Value too large for defined data type + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ + function getTotalSize(path: string, callback: AsyncCallback): void; + /** + * Get the number of total bytes on the specified path with sync interface. + * + * @param { string } path - path + * @returns { number } return the number of total bytes + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900031 - Function not implemented + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900038 - Value too large for defined data type + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 10 + */ + function getTotalSizeSync(path: string): number; +} +export default statfs; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.file.storageStatistics.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.file.storageStatistics.d.ts new file mode 100755 index 00000000..91153069 --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.file.storageStatistics.d.ts @@ -0,0 +1,83 @@ +/* + * Copyright (C) 2022-2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit CoreFileKit + */ +import { AsyncCallback } from './@ohos.base'; +/** + * Provides filesystem statistics APIs. + * + * @namespace storageStatistics + * @syscap SystemCapability.FileManagement.StorageService.SpatialStatistics + * @since 8 + */ +declare namespace storageStatistics { + /** + * Get the bundle statistics. + * + * @interface BundleStats + * @syscap SystemCapability.FileManagement.StorageService.SpatialStatistics + * @since 9 + */ + export interface BundleStats { + /** + * The size of application installation data. + * + * @syscap SystemCapability.FileManagement.StorageService.SpatialStatistics + * @since 9 + */ + appSize: number; + /** + * The size of application cache data. + * + * @syscap SystemCapability.FileManagement.StorageService.SpatialStatistics + * @since 9 + */ + cacheSize: number; + /** + * The size of application local data, distributed data and database data. + * + * @syscap SystemCapability.FileManagement.StorageService.SpatialStatistics + * @since 9 + */ + dataSize: number; + } + /** + * Get the current bundle statistics. + * + * @param { AsyncCallback } callback - callback + * @throws { BusinessError } 401 - The input parameter is invalid.Possible causes:Mandatory + parameters are left unspecified; + * @throws { BusinessError } 13600001 - IPC error. + * @throws { BusinessError } 13900042 - Unknown error. + * @syscap SystemCapability.FileManagement.StorageService.SpatialStatistics + * @since 9 + */ + function getCurrentBundleStats(callback: AsyncCallback): void; + /** + * Get the current bundle statistics. + * + * @returns { Promise } return Promise + * @throws { BusinessError } 401 - The input parameter is invalid.Possible causes:Mandatory + parameters are left unspecified; + * @throws { BusinessError } 13600001 - IPC error. + * @throws { BusinessError } 13900042 - Unknown error. + * @syscap SystemCapability.FileManagement.StorageService.SpatialStatistics + * @since 9 + */ + function getCurrentBundleStats(): Promise; +} +export default storageStatistics; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.fileio.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.fileio.d.ts new file mode 100755 index 00000000..74a40a2a --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.fileio.d.ts @@ -0,0 +1,1957 @@ +/* + * Copyright (c) 2021-2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit CoreFileKit + */ +import { AsyncCallback } from './@ohos.base'; +export default fileIO; +/** + * fileio + * + * @namespace fileIO + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 6 + */ +declare namespace fileIO { + export { access }; + export { accessSync }; + export { chmod }; + export { chmodSync }; + export { chown }; + export { chownSync }; + export { close }; + export { closeSync }; + export { copyFile }; + export { copyFileSync }; + export { createStream }; + export { createStreamSync }; + export { createWatcher }; + export { fchmod }; + export { fchmodSync }; + export { fchown }; + export { fchownSync }; + export { fdatasync }; + export { fdatasyncSync }; + export { fdopenStream }; + export { fdopenStreamSync }; + export { fstat }; + export { fstatSync }; + export { fsync }; + export { fsyncSync }; + export { ftruncate }; + export { ftruncateSync }; + export { hash }; + export { lchown }; + export { lchownSync }; + export { lstat }; + export { lstatSync }; + export { mkdir }; + export { mkdirSync }; + export { mkdtemp }; + export { mkdtempSync }; + export { open }; + export { openSync }; + export { opendir }; + export { opendirSync }; + export { read }; + export { readSync }; + export { readText }; + export { readTextSync }; + export { rename }; + export { renameSync }; + export { rmdir }; + export { rmdirSync }; + export { stat }; + export { statSync }; + export { symlink }; + export { symlinkSync }; + export { truncate }; + export { truncateSync }; + export { unlink }; + export { unlinkSync }; + export { write }; + export { writeSync }; + export { Dir }; + export { Dirent }; + export { ReadOut }; + export { Stat }; + export { Stream }; + export { Watcher }; +} +/** + * access. + * + * @param { string } path - path. + * @param { number } [mode = 0] - mode. + * @returns { Promise } return Promise + * @throws { TypedError } Parameter check failed + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 6 + * @deprecated since 9 + * @useinstead ohos.file.fs.access + */ +declare function access(path: string, mode?: number): Promise; +/** + * access. + * + * @param { string } path - path. + * @param { AsyncCallback } [callback] - callback. + * @throws { TypedError } Parameter check failed + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 6 + * @deprecated since 9 + * @useinstead ohos.file.fs.access + */ +declare function access(path: string, callback: AsyncCallback): void; +/** + * access. + * + * @param { string } path - path. + * @param { number } [mode = 0] - mode. + * @param { AsyncCallback } [callback] - callback. + * @throws { TypedError } Parameter check failed + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 6 + * @deprecated since 9 + * @useinstead ohos.file.fs.access + */ +declare function access(path: string, mode: number, callback: AsyncCallback): void; +/** + * accessSync. + * + * @param { string } path - path. + * @param { number } [mode = 0] - mode. + * @throws { TypedError | Error } access fail + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 6 + * @deprecated since 9 + * @useinstead ohos.file.fs.accessSync + */ +declare function accessSync(path: string, mode?: number): void; +/** + * close. + * + * @param { number } fd - fd. + * @returns { Promise } return Promise + * @throws { TypedError } Parameter check failed + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 7 + * @deprecated since 9 + * @useinstead ohos.file.fs.close + */ +declare function close(fd: number): Promise; +/** + * close. + * + * @param { number } fd - fd. + * @param { AsyncCallback } [callback] - callback. + * @throws { TypedError } Parameter check failed + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 7 + * @deprecated since 9 + * @useinstead ohos.file.fs.close + */ +declare function close(fd: number, callback: AsyncCallback): void; +/** + * closeSync. + * + * @param { number } fd - fd. + * @throws { TypedError | Error } close fail + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 6 + * @deprecated since 9 + * @useinstead ohos.file.fs.closeSync + */ +declare function closeSync(fd: number): void; +/** + * copyFile. + * + * @param { string | number } src - src. + * @param { string | number } dest - dest. + * @param { number } [mode = 0] - mode. + * @returns { Promise } return Promise + * @throws { TypedError } Parameter check failed + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 6 + * @deprecated since 9 + * @useinstead ohos.file.fs.copyFile + */ +declare function copyFile(src: string | number, dest: string | number, mode?: number): Promise; +/** + * copyFile. + * + * @param { string | number } src - src. + * @param { string | number } dest - dest. + * @param { AsyncCallback } [callback] - callback. + * @throws { TypedError } Parameter check failed + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 6 + * @deprecated since 9 + * @useinstead ohos.file.fs.copyFile + */ +declare function copyFile(src: string | number, dest: string | number, callback: AsyncCallback): void; +/** + * copyFile. + * + * @param { string | number } src - src. + * @param { string | number } dest - dest. + * @param { number } [mode = 0] - mode. + * @param { AsyncCallback } [callback] - callback. + * @throws { TypedError } Parameter check failed + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 6 + * @deprecated since 9 + * @useinstead ohos.file.fs.copyFile + */ +declare function copyFile(src: string | number, dest: string | number, mode: number, callback: AsyncCallback): void; +/** + * copyFileSync. + * + * @param { string | number } src - src. + * @param { string | number } dest - dest. + * @param { number } [mode = 0] - mode. + * @throws { TypedError | Error } copyFile fail + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 6 + * @deprecated since 9 + * @useinstead ohos.file.fs.copyFileSync + */ +declare function copyFileSync(src: string | number, dest: string | number, mode?: number): void; +/** + * createStream. + * + * @param { string } path - path. + * @param { string } mode - mode. + * @returns { Promise } return Promise + * @throws { TypedError } Parameter check failed + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 7 + * @deprecated since 9 + * @useinstead ohos.file.fs.createStream + */ +declare function createStream(path: string, mode: string): Promise; +/** + * createStream. + * + * @param { string } path - path. + * @param { string } mode - mode. + * @param { AsyncCallback } [callback] - callback. + * @throws { TypedError } Parameter check failed + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 7 + * @deprecated since 9 + * @useinstead ohos.file.fs.createStream + */ +declare function createStream(path: string, mode: string, callback: AsyncCallback): void; +/** + * createStreamSync. + * + * @param { string } path - path. + * @param { string } mode - mode. + * @returns { Stream } createStream success + * @throws { TypedError } Parameter check failed + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 7 + * @deprecated since 9 + * @useinstead ohos.file.fs.createStreamSync + */ +declare function createStreamSync(path: string, mode: string): Stream; +/** + * chown. + * + * @param { string } path - path. + * @param { number } uid - mode. + * @param { number } gid - mode. + * @returns { Promise } return Promise + * @throws { TypedError } Parameter check failed + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 7 + * @deprecated since 9 + */ +declare function chown(path: string, uid: number, gid: number): Promise; +/** + * chown. + * + * @param { string } path - path. + * @param { number } uid - mode. + * @param { number } gid - mode. + * @param { AsyncCallback } [callback] - callback. + * @throws { TypedError } Parameter check failed + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 7 + * @deprecated since 9 + */ +declare function chown(path: string, uid: number, gid: number, callback: AsyncCallback): void; +/** + * chownSync. + * + * @param { string } path - path. + * @param { number } uid - mode. + * @param { number } gid - mode. + * @throws { TypedError | Error } chown fail + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 7 + * @deprecated since 9 + */ +declare function chownSync(path: string, uid: number, gid: number): void; +/** + * chmod. + * + * @param { string } path - path. + * @param { number } mode - mode. + * @returns { Promise } return Promise + * @throws { TypedError } Parameter check failed + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 7 + * @deprecated since 9 + */ +declare function chmod(path: string, mode: number): Promise; +/** + * chmod. + * + * @param { string } path - path. + * @param { number } mode - mode. + * @param { AsyncCallback } [callback] - callback. + * @throws { TypedError } Parameter check failed + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 7 + * @deprecated since 9 + */ +declare function chmod(path: string, mode: number, callback: AsyncCallback): void; +/** + * chmodSync. + * + * @param { string } path - path. + * @param { number } mode - mode. + * @throws { TypedError | Error } chmod fail + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 7 + * @deprecated since 9 + */ +declare function chmodSync(path: string, mode: number): void; +/** + * ftruncate. + * + * @param { number } fd - fd. + * @param { number } [len = 0] - len. + * @returns { Promise } return Promise + * @throws { TypedError } Parameter check failed + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 7 + * @deprecated since 9 + * @useinstead ohos.file.fs.truncate + */ +declare function ftruncate(fd: number, len?: number): Promise; +/** + * ftruncate. + * + * @param { number } fd - fd. + * @param { AsyncCallback } [callback] - callback. + * @throws { TypedError } Parameter check failed + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 7 + * @deprecated since 9 + * @useinstead ohos.file.fs.truncate + */ +declare function ftruncate(fd: number, callback: AsyncCallback): void; +/** + * ftruncate. + * + * @param { number } fd - fd. + * @param { number } [len = 0] - len. + * @param { AsyncCallback } [callback] - callback. + * @throws { TypedError } Parameter check failed + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 7 + * @deprecated since 9 + * @useinstead ohos.file.fs.truncate + */ +declare function ftruncate(fd: number, len: number, callback: AsyncCallback): void; +/** + * ftruncateSync. + * + * @param { number } fd - fd. + * @param { number } [len = 0] - len. + * @throws { TypedError | Error } ftruncate fail + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 7 + * @deprecated since 9 + * @useinstead ohos.file.fs.truncateSync + */ +declare function ftruncateSync(fd: number, len?: number): void; +/** + * fsync. + * + * @param { number } fd - fd. + * @returns { Promise } return Promise + * @throws { TypedError } Parameter check failed + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 7 + * @deprecated since 9 + * @useinstead ohos.file.fs.fsync + */ +declare function fsync(fd: number): Promise; +/** + * fsync. + * + * @param { number } fd - fd. + * @param { AsyncCallback } [callback] - callback. + * @throws { TypedError } Parameter check failed + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 7 + * @deprecated since 9 + * @useinstead ohos.file.fs.fsync + */ +declare function fsync(fd: number, callback: AsyncCallback): void; +/** + * fsyncSync. + * + * @param { number } fd - fd. + * @throws { TypedError | Error } fsync fail + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 7 + * @deprecated since 9 + * @useinstead ohos.file.fs.fsyncSync + */ +declare function fsyncSync(fd: number): void; +/** + * fstat. + * + * @param { number } fd - fd. + * @returns { Promise } return Promise + * @throws { TypedError } fstat fail + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 7 + * @deprecated since 9 + * @useinstead ohos.file.fs.stat + */ +declare function fstat(fd: number): Promise; +/** + * fstat. + * + * @param { number } fd - fd. + * @param { AsyncCallback } callback + * @throws { TypedError } fstat fail + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 7 + * @deprecated since 9 + * @useinstead ohos.file.fs.stat + */ +declare function fstat(fd: number, callback: AsyncCallback): void; +/** + * fstatSync. + * + * @param { number } fd - fd. + * @returns { Stat } stat success + * @throws { TypedError | Error } fstat fail + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 7 + * @deprecated since 9 + * @useinstead ohos.file.fs.statSync + */ +declare function fstatSync(fd: number): Stat; +/** + * fdatasync. + * + * @param { number } fd - fd. + * @returns { Promise } return Promise + * @throws { TypedError } Parameter check failed + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 7 + * @deprecated since 9 + * @useinstead ohos.file.fs.fdatasync + */ +declare function fdatasync(fd: number): Promise; +/** + * fdatasync. + * + * @param { number } fd - fd. + * @param { AsyncCallback } [callback] - callback. + * @throws { TypedError } Parameter check failed + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 7 + * @deprecated since 9 + * @useinstead ohos.file.fs.fdatasync + */ +declare function fdatasync(fd: number, callback: AsyncCallback): void; +/** + * fdatasyncSync. + * + * @param { number } fd - fd. + * @throws { TypedError | Error } fdatasync fail + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 7 + * @deprecated since 9 + * @useinstead ohos.file.fs.fdatasyncSync + */ +declare function fdatasyncSync(fd: number): void; +/** + * fchown. + * + * @param { number } fd - fd. + * @param { number } uid - uid. + * @param { number } gid - gid. + * @returns { Promise } return Promise + * @throws { TypedError } Parameter check failed + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 7 + * @deprecated since 9 + */ +declare function fchown(fd: number, uid: number, gid: number): Promise; +/** + * fchown. + * + * @param { number } fd - fd. + * @param { number } uid - uid. + * @param { number } gid - gid. + * @param { AsyncCallback } [callback] - callback. + * @throws { TypedError } Parameter check failed + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 7 + * @deprecated since 9 + */ +declare function fchown(fd: number, uid: number, gid: number, callback: AsyncCallback): void; +/** + * fchownSync. + * + * @param { number } fd - fd. + * @param { number } uid - uid. + * @param { number } gid - gid. + * @throws { TypedError | Error } fchown fail + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 7 + * @deprecated since 9 + */ +declare function fchownSync(fd: number, uid: number, gid: number): void; +/** + * fchmod. + * + * @param { number } fd - fd. + * @param { number } mode - mode. + * @returns { Promise } return Promise + * @throws { TypedError } Parameter check failed + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 7 + * @deprecated since 9 + */ +declare function fchmod(fd: number, mode: number): Promise; +/** + * fchmod. + * + * @param { number } fd - fd. + * @param { number } mode - mode. + * @param { AsyncCallback } [callback] - callback. + * @throws { TypedError } Parameter check failed + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 7 + * @deprecated since 9 + */ +declare function fchmod(fd: number, mode: number, callback: AsyncCallback): void; +/** + * fchmodSync. + * + * @param { number } fd - fd. + * @param { number } mode - mode. + * @throws { TypedError | Error } fchmod fail + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 7 + * @deprecated since 9 + */ +declare function fchmodSync(fd: number, mode: number): void; +/** + * fdopenStream. + * + * @param { number } fd - fd. + * @param { string } mode - mode. + * @returns { Promise } return Promise + * @throws { TypedError } Parameter check failed + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 7 + * @deprecated since 9 + * @useinstead ohos.file.fs.fdopenStream + */ +declare function fdopenStream(fd: number, mode: string): Promise; +/** + * fdopenStream. + * + * @param { number } fd - fd. + * @param { string } mode - mode. + * @param { AsyncCallback } [callback] - callback. + * @throws { TypedError } Parameter check failed + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 7 + * @deprecated since 9 + * @useinstead ohos.file.fs.fdopenStream + */ +declare function fdopenStream(fd: number, mode: string, callback: AsyncCallback): void; +/** + * fdopenStreamSync. + * + * @param { number } fd - fd. + * @param { string } mode - mode. + * @returns { Stream } open stream from fd + * @throws { TypedError | Error } open fail + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 7 + * @deprecated since 9 + * @useinstead ohos.file.fs.fdopenStreamSync + */ +declare function fdopenStreamSync(fd: number, mode: string): Stream; +/** + * hash. + * + * @param { string } path - path. + * @param { string } algorithm - algorithm md5 sha1 sha256. + * @returns { Promise } return Promise + * @throws { TypedError } Parameter check failed + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 6 + * @deprecated since 9 + * @useinstead ohos.file.hash.hash + */ +declare function hash(path: string, algorithm: string): Promise; +/** + * hash. + * + * @param { string } path - path. + * @param { string } algorithm - algorithm md5 sha1 sha256. + * @param { AsyncCallback } [callback] - callback. + * @throws { TypedError } Parameter check failed + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 6 + * @deprecated since 9 + * @useinstead ohos.file.hash.hash + */ +declare function hash(path: string, algorithm: string, callback: AsyncCallback): void; +/** + * lchown. + * + * @param { string } path - path. + * @param { number } uid - uid. + * @param { number } gid - gid. + * @returns { Promise } return Promise + * @throws { TypedError } Parameter check failed + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 7 + * @deprecated since 9 + */ +declare function lchown(path: string, uid: number, gid: number): Promise; +/** + * lchown. + * + * @param { string } path - path. + * @param { number } uid - uid. + * @param { number } gid - gid. + * @param { AsyncCallback } [callback] - callback. + * @throws { TypedError } Parameter check failed + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 7 + * @deprecated since 9 + */ +declare function lchown(path: string, uid: number, gid: number, callback: AsyncCallback): void; +/** + * lchownSync. + * + * @param { string } path - path. + * @param { number } uid - uid. + * @param { number } gid - gid. + * @throws { TypedError | Error } lchown fail + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 7 + * @deprecated since 9 + */ +declare function lchownSync(path: string, uid: number, gid: number): void; +/** + * lstat. + * + * @param { string } path - path. + * @returns { Promise } return Promise + * @throws { TypedError } Parameter check failed + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 7 + * @deprecated since 9 + * @useinstead ohos.file.fs.lstat + */ +declare function lstat(path: string): Promise; +/** + * lstat. + * + * @param { string } path - path. + * @param { AsyncCallback } [callback] - callback. + * @throws { TypedError } Parameter check failed + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 7 + * @deprecated since 9 + * @useinstead ohos.file.fs.lstat + */ +declare function lstat(path: string, callback: AsyncCallback): void; +/** + * lstatSync. + * + * @param { string } path - path. + * @returns { Stat } lstat success + * @throws { TypedError | Error } lstat fail + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 7 + * @deprecated since 9 + * @useinstead ohos.file.fs.lstatSync + */ +declare function lstatSync(path: string): Stat; +/** + * mkdir. + * + * @param { string } path - path. + * @param { number } [mode = 0o770] - path. + * @returns { Promise } return Promise + * @throws { TypedError } Parameter check failed + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 6 + * @deprecated since 9 + * @useinstead ohos.file.fs.mkdir + */ +declare function mkdir(path: string, mode?: number): Promise; +/** + * mkdir. + * + * @param { string } path - path. + * @param { AsyncCallback } [callback] - callback. + * @throws { TypedError } Parameter check failed + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 6 + * @deprecated since 9 + * @useinstead ohos.file.fs.mkdir + */ +declare function mkdir(path: string, callback: AsyncCallback): void; +/** + * mkdir. + * + * @param { string } path - path. + * @param { number } [mode = 0o770] - path. + * @param { AsyncCallback } [callback] - callback. + * @throws { TypedError } Parameter check failed + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 6 + * @deprecated since 9 + * @useinstead ohos.file.fs.mkdir + */ +declare function mkdir(path: string, mode: number, callback: AsyncCallback): void; +/** + * mkdirSync. + * + * @param { string } path - path. + * @param { number } [mode = 0o770] - path. + * @throws { TypedError | Error } mkdir fail + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 6 + * @deprecated since 9 + * @useinstead ohos.file.fs.mkdirSync + */ +declare function mkdirSync(path: string, mode?: number): void; +/** + * mkdtemp. + * + * @param { string } prefix - dir prefix. + * @returns { Promise } return Promise + * @throws { TypedError } Parameter check failed + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 7 + * @deprecated since 9 + * @useinstead ohos.file.fs.mkdtemp + */ +declare function mkdtemp(prefix: string): Promise; +/** + * mkdtemp. + * + * @param { string } prefix - dir prefix. + * @param { AsyncCallback } [callback] - callback. + * @throws { TypedError } Parameter check failed + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 7 + * @deprecated since 9 + * @useinstead ohos.file.fs.mkdtemp + */ +declare function mkdtemp(prefix: string, callback: AsyncCallback): void; +/** + * mkdtempSync. + * + * @param { string } prefix - dir prefix. + * @returns { string } directory name + * @throws { TypedError | Error } mkdtemp fail + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 7 + * @deprecated since 9 + * @useinstead ohos.file.fs.mkdtempSync + */ +declare function mkdtempSync(prefix: string): string; +/** + * open. + * + * @param { string } path - path. + * @param { number } [flags = 0] - flags. + * @param { number } [mode = 0o666] - mode. + * @returns { Promise } return Promise + * @throws { TypedError } Parameter check failed + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 7 + * @deprecated since 9 + * @useinstead ohos.file.fs.open + */ +declare function open(path: string, flags?: number, mode?: number): Promise; +/** + * open. + * + * @param { string } path - path. + * @param { AsyncCallback } [callback] - callback. + * @throws { TypedError } Parameter check failed + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 7 + * @deprecated since 9 + * @useinstead ohos.file.fs.open + */ +declare function open(path: string, callback: AsyncCallback): void; +/** + * open. + * + * @param { string } path - path. + * @param { number } [flags = 0] - flags. + * @param { AsyncCallback } [callback] - callback. + * @throws { TypedError } Parameter check failed + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 7 + * @deprecated since 9 + * @useinstead ohos.file.fs.open + */ +declare function open(path: string, flags: number, callback: AsyncCallback): void; +/** + * open. + * + * @param { string } path - path. + * @param { number } [flags = 0] - flags. + * @param { number } [mode = 0o666] - mode. + * @param { AsyncCallback } [callback] - callback. + * @throws { TypedError } Parameter check failed + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 7 + * @deprecated since 9 + * @useinstead ohos.file.fs.open + */ +declare function open(path: string, flags: number, mode: number, callback: AsyncCallback): void; +/** + * openSync. + * + * @param { string } path - path. + * @param { number } [flags = 0] - flags. + * @param { number } [mode = 0o666] - mode. + * @returns { number } open fd + * @throws { TypedError | Error } open fail + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 6 + * @deprecated since 9 + * @useinstead ohos.file.fs.openSync + */ +declare function openSync(path: string, flags?: number, mode?: number): number; +/** + * opendir. + * + * @param { string } path - directory name. + * @returns { Promise

} return Promise + * @throws { TypedError } Parameter check failed + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 6 + * @deprecated since 9 + * @useinstead ohos.file.fs.listFile + */ +declare function opendir(path: string): Promise; +/** + * opendir. + * + * @param { string } path - directory name. + * @param { AsyncCallback } [callback] - callback. + * @throws { TypedError } Parameter check failed + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 6 + * @deprecated since 9 + * @useinstead ohos.file.fs.listFile + */ +declare function opendir(path: string, callback: AsyncCallback): void; +/** + * opendirSync. + * + * @param { string } path - directory name. + * @returns { Dir } opendir Dir Object + * @throws { TypedError | Error } opendir fail + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 6 + * @deprecated since 9 + * @useinstead ohos.file.fs.listFileSync + */ +declare function opendirSync(path: string): Dir; +/** + * readText. + * + * @param { string } filePath - file path. + * @param { object } [options] - options. + * @returns { Promise } return Promise + * @throws { TypedError } Parameter check failed + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 7 + * @deprecated since 9 + * @useinstead ohos.file.fs.readText + */ +declare function readText(filePath: string, options?: { + position?: number; + length?: number; + encoding?: string; +}): Promise; +/** + * readText. + * + * @param { string } filePath - file path. + * @param { object } [options] - options. + * @param { AsyncCallback } [callback] - callback. + * @throws { TypedError } Parameter check failed + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 7 + * @deprecated since 9 + * @useinstead ohos.file.fs.readText + */ +declare function readText(filePath: string, options: { + position?: number; + length?: number; + encoding?: string; +}, callback: AsyncCallback): void; +/** + * readTextSync. + * + * @param { string } filePath - file path. + * @param { object } [options] - options. + * @returns { string } readout result + * @throws { TypedError } Parameter check failed + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 7 + * @deprecated since 9 + * @useinstead ohos.file.fs.readTextSync + */ +declare function readTextSync(filePath: string, options?: { + position?: number; + length?: number; + encoding?: string; +}): string; +/** + * read. + * + * @param { number } fd - file descriptor. + * @param { ArrayBuffer } buffer - file descriptor. + * @param { object } [options] - options. + * @returns { Promise } return Promise + * @throws { TypedError } Parameter check failed + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 6 + * @deprecated since 9 + * @useinstead ohos.file.fs.read + */ +declare function read(fd: number, buffer: ArrayBuffer, options?: { + offset?: number; + length?: number; + position?: number; +}): Promise; +/** + * read. + * + * @param { number } fd - file descriptor. + * @param { ArrayBuffer } buffer - file descriptor. + * @param { AsyncCallback } [callback] - callback. + * @throws { TypedError } Parameter check failed + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 6 + * @deprecated since 9 + * @useinstead ohos.file.fs.read + */ +declare function read(fd: number, buffer: ArrayBuffer, callback: AsyncCallback): void; +/** + * read. + * + * @param { number } fd - file descriptor. + * @param { ArrayBuffer } buffer - file descriptor. + * @param { object } [options] - options. + * @param { AsyncCallback } [callback] - callback. + * @throws { TypedError } Parameter check failed + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 6 + * @deprecated since 9 + * @useinstead ohos.file.fs.read + */ +declare function read(fd: number, buffer: ArrayBuffer, options: { + offset?: number; + length?: number; + position?: number; +}, callback: AsyncCallback): void; +/** + * readSync. + * + * @param { number } fd - file descriptor. + * @param { ArrayBuffer } buffer - file descriptor. + * @param { object } [options] - options. + * @returns { number } number of bytesRead + * @throws { TypedError | Error } read fail + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 6 + * @deprecated since 9 + * @useinstead ohos.file.fs.readSync + */ +declare function readSync(fd: number, buffer: ArrayBuffer, options?: { + offset?: number; + length?: number; + position?: number; +}): number; +/** + * rename. + * + * @param { string } oldPath - oldPath. + * @param { string } newPath - newPath. + * @returns { Promise } return Promise + * @throws { TypedError } Parameter check failed + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 7 + * @deprecated since 9 + * @useinstead ohos.file.fs.rename + */ +declare function rename(oldPath: string, newPath: string): Promise; +/** + * rename. + * + * @param { string } oldPath - oldPath. + * @param { string } newPath - newPath. + * @param { AsyncCallback } [callback] - callback. + * @throws { TypedError } Parameter check failed + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 7 + * @deprecated since 9 + * @useinstead ohos.file.fs.rename + */ +declare function rename(oldPath: string, newPath: string, callback: AsyncCallback): void; +/** + * renameSync. + * + * @param { string } oldPath - oldPath. + * @param { string } newPath - newPath. + * @throws { TypedError | Error } rename fail + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 7 + * @deprecated since 9 + * @useinstead ohos.file.fs.renameSync + */ +declare function renameSync(oldPath: string, newPath: string): void; +/** + * rmdir. + * + * @param { string } path - path. + * @returns { Promise } return Promise + * @throws { TypedError } Parameter check failed + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 7 + * @deprecated since 9 + * @useinstead ohos.file.fs.rmdir + */ +declare function rmdir(path: string): Promise; +/** + * rmdir. + * + * @param { string } path - path. + * @param { AsyncCallback } [callback] - callback. + * @throws { TypedError } Parameter check failed + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 7 + * @deprecated since 9 + * @useinstead ohos.file.fs.rmdir + */ +declare function rmdir(path: string, callback: AsyncCallback): void; +/** + * rmdirSync. + * + * @param { string } path - path. + * @throws { TypedError | Error } rmdir fail + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 7 + * @deprecated since 9 + * @useinstead ohos.file.fs.rmdirSync + */ +declare function rmdirSync(path: string): void; +/** + * stat. + * + * @param { string } path - path. + * @returns { Promise } return Promise + * @throws { TypedError } Parameter check failed + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 6 + * @deprecated since 9 + * @useinstead ohos.file.fs.stat + */ +declare function stat(path: string): Promise; +/** + * stat. + * + * @param { string } path - path. + * @param { AsyncCallback } [callback] - callback. + * @throws { TypedError } Parameter check failed + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 6 + * @deprecated since 9 + * @useinstead ohos.file.fs.stat + */ +declare function stat(path: string, callback: AsyncCallback): void; +/** + * statSync. + * + * @param { string } path - path. + * @returns { Stat } stat success + * @throws { TypedError | Error } stat fail + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 6 + * @deprecated since 9 + * @useinstead ohos.file.fs.statSync + */ +declare function statSync(path: string): Stat; +/** + * symlink. + * + * @param { string } target - target. + * @param { string } srcPath - srcPath. + * @returns { Promise } return Promise + * @throws { TypedError } Parameter check failed + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 7 + * @deprecated since 9 + * @useinstead ohos.file.fs.symlink + */ +declare function symlink(target: string, srcPath: string): Promise; +/** + * symlink. + * + * @param { string } target - target. + * @param { string } srcPath - srcPath. + * @param { AsyncCallback } [callback] - callback. + * @throws { TypedError } Parameter check failed + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 7 + * @deprecated since 9 + * @useinstead ohos.file.fs.symlink + */ +declare function symlink(target: string, srcPath: string, callback: AsyncCallback): void; +/** + * symlinkSync. + * + * @param { string } target - target. + * @param { string } srcPath - srcPath. + * @throws { TypedError | Error } symlink fail + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 7 + * @deprecated since 9 + * @useinstead ohos.file.fs.symlinkSync + */ +declare function symlinkSync(target: string, srcPath: string): void; +/** + * truncate. + * + * @param { string } path - path. + * @param { number } [len = 0] - len. + * @returns { Promise } return Promise + * @throws { TypedError } Parameter check failed + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 7 + * @deprecated since 9 + * @useinstead ohos.file.fs.truncate + */ +declare function truncate(path: string, len?: number): Promise; +/** + * truncate. + * + * @param { string } path - path. + * @param { AsyncCallback } [callback] - callback. + * @throws { TypedError } Parameter check failed + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 7 + * @deprecated since 9 + * @useinstead ohos.file.fs.truncate + */ +declare function truncate(path: string, callback: AsyncCallback): void; +/** + * truncate. + * + * @param { string } path - path. + * @param { number } [len = 0] - len. + * @param { AsyncCallback } [callback] - callback. + * @throws { TypedError } Parameter check failed + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 7 + * @deprecated since 9 + * @useinstead ohos.file.fs.truncate + */ +declare function truncate(path: string, len: number, callback: AsyncCallback): void; +/** + * truncateSync. + * + * @param { string } path - path. + * @param { number } [len = 0] - len. + * @throws { TypedError | Error } truncate fail + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 7 + * @deprecated since 9 + * @useinstead ohos.file.fs.truncateSync + */ +declare function truncateSync(path: string, len?: number): void; +/** + * unlink. + * + * @param { string } path - path. + * @returns { Promise } return Promise + * @throws { TypedError } Parameter check failed + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 6 + * @deprecated since 9 + * @useinstead ohos.file.fs.unlink + */ +declare function unlink(path: string): Promise; +/** + * unlink. + * + * @param { string } path - path. + * @param { AsyncCallback } [callback] - callback. + * @throws { TypedError } Parameter check failed + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 6 + * @deprecated since 9 + * @useinstead ohos.file.fs.unlink + */ +declare function unlink(path: string, callback: AsyncCallback): void; +/** + * unlinkSync. + * + * @param { string } path - path. + * @throws { TypedError | Error } unlink fail + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 6 + * @deprecated since 9 + * @useinstead ohos.file.fs.unlinkSync + */ +declare function unlinkSync(path: string): void; +/** + * write. + * + * @param { number } fd - file descriptor. + * @param { ArrayBuffer | string } buffer - buffer or string. + * @param { object } [options] - options. + * @returns { Promise } return Promise + * @throws { TypedError } Parameter check failed + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 6 + * @deprecated since 9 + * @useinstead ohos.file.fs.write + */ +declare function write(fd: number, buffer: ArrayBuffer | string, options?: { + offset?: number; + length?: number; + position?: number; + encoding?: string; +}): Promise; +/** + * write. + * + * @param { number } fd - file descriptor. + * @param { ArrayBuffer | string } buffer - buffer or string. + * @param { AsyncCallback } [callback] - callback. + * @throws { TypedError } Parameter check failed + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 6 + * @deprecated since 9 + * @useinstead ohos.file.fs.write + */ +declare function write(fd: number, buffer: ArrayBuffer | string, callback: AsyncCallback): void; +/** + * write. + * + * @param { number } fd - file descriptor. + * @param { ArrayBuffer | string } buffer - buffer or string. + * @param { object } [options] - options. + * @param { AsyncCallback } [callback] - callback. + * @throws { TypedError } Parameter check failed + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 6 + * @deprecated since 9 + * @useinstead ohos.file.fs.write + */ +declare function write(fd: number, buffer: ArrayBuffer | string, options: { + offset?: number; + length?: number; + position?: number; + encoding?: string; +}, callback: AsyncCallback): void; +/** + * writeSync. + * + * @param { number } fd - file descriptor. + * @param { ArrayBuffer | string } buffer - buffer or string. + * @param { object } [options] - options. + * @returns { number } on success number of bytesRead + * @throws { TypedError | Error } write fail + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 6 + * @deprecated since 9 + * @useinstead ohos.file.fs.writeSync + */ +declare function writeSync(fd: number, buffer: ArrayBuffer | string, options?: { + offset?: number; + length?: number; + position?: number; + encoding?: string; +}): number; +/** + * createWatcher. + * + * @param { string } filename - filename. + * @param { number } events - events(depends on OS & filesystem) events = 1 rename events = 2 change. + * @param { AsyncCallback } [callback] - callback. + * @returns { Watcher } watch success + * @throws { TypedError | Error } watch fail + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 7 + * @deprecated since 10 + * @useinstead ohos.file.fs.createWatcher + */ +declare function createWatcher(filename: string, events: number, callback: AsyncCallback): Watcher; +/** + * Dir + * + * @interface Dir + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 6 + * @deprecated since 9 + * @useinstead ohos.file.fs.listFile + */ +declare interface Dir { + /** + * read. + * + * @returns { Promise } return Promise + * @throws { TypedError } Parameter check failed if read to end, Error.msg = "NoMore" + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 6 + * @deprecated since 9 + * @useinstead ohos.file.fs.listFile + */ + read(): Promise; + /** + * read. + * + * @param { AsyncCallback } [callback] - callback. + * @throws { TypedError } Parameter check failed if read to end, Error.msg = "NoMore" + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 6 + * @deprecated since 9 + * @useinstead ohos.file.fs.listFile + */ + read(callback: AsyncCallback): void; + /** + * readSync. + * + * @returns { Dirent } Dirent Object + * @throws { TypedError | Error } read fail if read to end, Error.msg = "NoMore" + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 6 + * @deprecated since 9 + * @useinstead ohos.file.fs.listFile + */ + readSync(): Dirent; + /** + * close. + * + * @returns { Promise } return Promise + * @throws { TypedError } close fail + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 7 + * @deprecated since 9 + * @useinstead ohos.file.fs.listFile + */ + close(): Promise; + /** + * close. + * + * @param { AsyncCallback } [callback] - callback. + * @throws { TypedError } close fail + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 7 + * @deprecated since 9 + * @useinstead ohos.file.fs.listFile + */ + close(callback: AsyncCallback): void; + /** + * closeSync. + * + * @throws { TypedError | Error } close fail + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 6 + * @deprecated since 9 + * @useinstead ohos.file.fs.listFile + */ + closeSync(): void; +} +/** + * Dirent + * + * @interface Dirent + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 6 + * @deprecated since 9 + * @useinstead ohos.file.fs.listFile + */ +declare interface Dirent { + /** + * @type { string } + * @readonly + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 6 + * @deprecated since 9 + * @useinstead ohos.file.fs.listFile + */ + readonly name: string; + /** + * isBlockDevice. + * + * @returns { boolean } is or not + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 6 + * @deprecated since 9 + * @useinstead ohos.file.fs.listFile + */ + isBlockDevice(): boolean; + /** + * isCharacterDevice. + * + * @returns { boolean } is or not + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 6 + * @deprecated since 9 + * @useinstead ohos.file.fs.listFile + */ + isCharacterDevice(): boolean; + /** + * isDirectory. + * + * @returns { boolean } is or not + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 6 + * @deprecated since 9 + * @useinstead ohos.file.fs.listFile + */ + isDirectory(): boolean; + /** + * isFIFO. + * + * @returns { boolean } is or not + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 6 + * @deprecated since 9 + * @useinstead ohos.file.fs.listFile + */ + isFIFO(): boolean; + /** + * isFile. + * + * @returns { boolean } is or not + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 6 + * @deprecated since 9 + * @useinstead ohos.file.fs.listFile + */ + isFile(): boolean; + /** + * isSocket. + * + * @returns { boolean } is or not + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 6 + * @deprecated since 9 + * @useinstead ohos.file.fs.listFile + */ + isSocket(): boolean; + /** + * isSymbolicLink. + * + * @returns { boolean } is or not + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 6 + * @deprecated since 9 + * @useinstead ohos.file.fs.listFile + */ + isSymbolicLink(): boolean; +} +/** + * Stat + * + * @interface Stat + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 6 + * @deprecated since 9 + * @useinstead ohos.file.fs.Stat + */ +declare interface Stat { + /** + * @type { number } + * @readonly + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 6 + * @deprecated since 9 + */ + readonly dev: number; + /** + * @type { number } + * @readonly + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 6 + * @deprecated since 9 + * @useinstead ohos.file.fs.Stat.ino + */ + readonly ino: number; + /** + * @type { number } + * @readonly + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 6 + * @deprecated since 9 + * @useinstead ohos.file.fs.Stat.mode + */ + readonly mode: number; + /** + * @type { number } + * @readonly + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 6 + * @deprecated since 9 + */ + readonly nlink: number; + /** + * @type { number } + * @readonly + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 6 + * @deprecated since 9 + * @useinstead ohos.file.fs.Stat.uid + */ + readonly uid: number; + /** + * @type { number } + * @readonly + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 6 + * @deprecated since 9 + * @useinstead ohos.file.fs.Stat.gid + */ + readonly gid: number; + /** + * @type { number } + * @readonly + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 6 + * @deprecated since 9 + */ + readonly rdev: number; + /** + * @type { number } + * @readonly + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 6 + * @deprecated since 9 + * @useinstead ohos.file.fs.Stat.size + */ + readonly size: number; + /** + * @type { number } + * @readonly + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 6 + * @deprecated since 9 + */ + readonly blocks: number; + /** + * @type { number } + * @readonly + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 6 + * @deprecated since 9 + * @useinstead ohos.file.fs.Stat.atime + */ + readonly atime: number; + /** + * @type { number } + * @readonly + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 6 + * @deprecated since 9 + * @useinstead ohos.file.fs.Stat.mtime + */ + readonly mtime: number; + /** + * @type { number } + * @readonly + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 6 + * @deprecated since 9 + * @useinstead ohos.file.fs.Stat.ctime + */ + readonly ctime: number; + /** + * isBlockDevice. + * + * @returns { boolean } is or not + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 6 + * @deprecated since 9 + * @useinstead ohos.file.fs.Stat.isBlockDevice + */ + isBlockDevice(): boolean; + /** + * isCharacterDevice. + * + * @returns { boolean } is or not + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 6 + * @deprecated since 9 + * @useinstead ohos.file.fs.Stat.isCharacterDevice + */ + isCharacterDevice(): boolean; + /** + * isDirectory. + * + * @returns { boolean } is or not + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 6 + * @deprecated since 9 + * @useinstead ohos.file.fs.Stat.isDirectory + */ + isDirectory(): boolean; + /** + * isFIFO. + * + * @returns { boolean } is or not + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 6 + * @deprecated since 9 + * @useinstead ohos.file.fs.Stat.isFIFO + */ + isFIFO(): boolean; + /** + * isFile. + * + * @returns { boolean } is or not + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 6 + * @deprecated since 9 + * @useinstead ohos.file.fs.Stat.isFile + */ + isFile(): boolean; + /** + * isSocket. + * + * @returns { boolean } is or not + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 6 + * @deprecated since 9 + * @useinstead ohos.file.fs.Stat.isSocket + */ + isSocket(): boolean; + /** + * isSymbolicLink. + * + * @returns { boolean } is or not + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 6 + * @deprecated since 9 + * @useinstead ohos.file.fs.Stat.isSymbolicLink + */ + isSymbolicLink(): boolean; +} +/** + * Stream + * + * @interface Stream + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 6 + * @deprecated since 9 + * @useinstead ohos.file.fs.Stream + */ +declare interface Stream { + /** + * close. + * + * @returns { Promise } return Promise + * @throws { TypedError } close fail + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 7 + * @deprecated since 9 + * @useinstead ohos.file.fs.Stream.close + */ + close(): Promise; + /** + * close. + * + * @param { AsyncCallback } [callback] - callback. + * @throws { TypedError } close fail + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 7 + * @deprecated since 9 + * @useinstead ohos.file.fs.Stream.close + */ + close(callback: AsyncCallback): void; + /** + * closeSync. + * + * @throws { TypedError | Error } close fail + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 6 + * @deprecated since 9 + * @useinstead ohos.file.fs.Stream.closeSync + */ + closeSync(): void; + /** + * flush. + * + * @returns { Promise } return Promise + * @throws { TypedError } Parameter check failed + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 7 + * @deprecated since 9 + * @useinstead ohos.file.fs.Stream.flush + */ + flush(): Promise; + /** + * flush. + * + * @param { AsyncCallback } [callback] - callback. + * @throws { TypedError } Parameter check failed + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 7 + * @deprecated since 9 + * @useinstead ohos.file.fs.Stream.flush + */ + flush(callback: AsyncCallback): void; + /** + * flushSync. + * + * @throws { TypedError | Error } flush fail + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 7 + * @deprecated since 9 + * @useinstead ohos.file.fs.Stream.flushSync + */ + flushSync(): void; + /** + * write. + * + * @param { ArrayBuffer | string } buffer - buffer or string. + * @param { object } [options] - options. + * @returns { Promise } return Promise + * @throws { TypedError } Parameter check failed + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 7 + * @deprecated since 9 + * @useinstead ohos.file.fs.Stream.write + */ + write(buffer: ArrayBuffer | string, options?: { + offset?: number; + length?: number; + position?: number; + encoding?: string; + }): Promise; + /** + * write. + * + * @param { ArrayBuffer | string } buffer - buffer or string. + * @param { AsyncCallback } [callback] - callback. + * @throws { TypedError } Parameter check failed + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 7 + * @deprecated since 9 + * @useinstead ohos.file.fs.Stream.write + */ + write(buffer: ArrayBuffer | string, callback: AsyncCallback): void; + /** + * write. + * + * @param { ArrayBuffer | string } buffer - buffer or string. + * @param { object } [options] - options. + * @param { AsyncCallback } [callback] - callback. + * @throws { TypedError } Parameter check failed + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 7 + * @deprecated since 9 + * @useinstead ohos.file.fs.Stream.write + */ + write(buffer: ArrayBuffer | string, options: { + offset?: number; + length?: number; + position?: number; + encoding?: string; + }, callback: AsyncCallback): void; + /** + * writeSync. + * + * @param { ArrayBuffer | string } buffer - buffer or string. + * @param { object } [options] - options. + * @returns { number } on success number of bytes written + * @throws { TypedError | Error } write fail + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 7 + * @deprecated since 9 + * @useinstead ohos.file.fs.Stream.writeSync + */ + writeSync(buffer: ArrayBuffer | string, options?: { + offset?: number; + length?: number; + position?: number; + encoding?: string; + }): number; + /** + * read. + * + * @param { ArrayBuffer } buffer - buffer. + * @param { object } [options] - options. + * @returns { Promise } return Promise + * @throws { TypedError } Parameter check failed + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 7 + * @deprecated since 9 + * @useinstead ohos.file.fs.Stream.read + */ + read(buffer: ArrayBuffer, options?: { + position?: number; + offset?: number; + length?: number; + }): Promise; + /** + * read. + * + * @param { ArrayBuffer } buffer - buffer. + * @param { AsyncCallback } [callback] - callback. + * @throws { TypedError } Parameter check failed + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 7 + * @deprecated since 9 + * @useinstead ohos.file.fs.Stream.read + */ + read(buffer: ArrayBuffer, callback: AsyncCallback): void; + /** + * read. + * + * @param { ArrayBuffer } buffer - buffer. + * @param { object } [options] - options. + * @param { AsyncCallback } [callback] - callback. + * @throws { TypedError } Parameter check failed + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 7 + * @deprecated since 9 + * @useinstead ohos.file.fs.Stream.read + */ + read(buffer: ArrayBuffer, options: { + position?: number; + offset?: number; + length?: number; + }, callback: AsyncCallback): void; + /** + * readSync. + * + * @param { ArrayBuffer } buffer - buffer. + * @param { object } [options] - options. + * @returns { number } number of bytesRead + * @throws { TypedError | Error } read fail + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 7 + * @deprecated since 9 + * @useinstead ohos.file.fs.Stream.readSync + */ + readSync(buffer: ArrayBuffer, options?: { + position?: number; + offset?: number; + length?: number; + }): number; +} +/** + * ReadOut + * + * @interface ReadOut + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 6 + * @deprecated since 9 + */ +declare interface ReadOut { + /** + * @type { number } + * @readonly + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 6 + * @deprecated since 9 + */ + bytesRead: number; + /** + * @type { number } + * @readonly + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 6 + * @deprecated since 9 + */ + offset: number; + /** + * @type { ArrayBuffer } + * @readonly + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 6 + * @deprecated since 9 + */ + buffer: ArrayBuffer; +} +/** + * Watcher + * + * @interface Watcher + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 7 + * @deprecated since 10 + * @useinstead ohos.file.fs.Watcher + */ +declare interface Watcher { + /** + * stop. + * + * @returns { Promise } return Promise + * @throws { TypedError | Error } stop fail + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 7 + * @deprecated since 10 + * @useinstead ohos.file.fs.Watcher.stop + */ + stop(): Promise; + /** + * stop. + * + * @param { AsyncCallback } [callback] - callback. + * @throws { TypedError | Error } stop fail + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 7 + * @deprecated since 10 + * @useinstead ohos.file.fs.Watcher.stop + */ + stop(callback: AsyncCallback): void; +} diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.fileshare.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.fileshare.d.ts new file mode 100755 index 00000000..dff897d9 --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.fileshare.d.ts @@ -0,0 +1,225 @@ +/* + * Copyright (C) 2022-2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit CoreFileKit + */ + +/** + * Provides fileshare APIS + * + * @namespace fileShare + * @syscap SystemCapability.FileManagement.AppFileService + * @since 9 + */ +declare namespace fileShare { + /** + * Enumerates the uri operate mode types. + * + * @enum { number } OperationMode + * @syscap SystemCapability.FileManagement.AppFileService.FolderAuthorization + * @since 11 + */ + export enum OperationMode { + /** + * Indicates read permissions. + * + * @syscap SystemCapability.FileManagement.AppFileService.FolderAuthorization + * @since 11 + */ + READ_MODE = 0b1, + /** + * Indicates write permissions. + * + * @syscap SystemCapability.FileManagement.AppFileService.FolderAuthorization + * @since 11 + */ + WRITE_MODE = 0b10 + } + /** + * Enumerates the error code of the permission policy for the URI operation. + * + * @enum { number } PolicyErrorCode + * @syscap SystemCapability.FileManagement.AppFileService.FolderAuthorization + * @since 11 + */ + export enum PolicyErrorCode { + /** + * Indicates that the policy is not allowed to be persisted. + * + * @syscap SystemCapability.FileManagement.AppFileService.FolderAuthorization + * @since 11 + */ + PERSISTENCE_FORBIDDEN = 1, + /** + * Indicates that the mode of this policy is invalid. + * + * @syscap SystemCapability.FileManagement.AppFileService.FolderAuthorization + * @since 11 + */ + INVALID_MODE = 2, + /** + * Indicates that the path of this policy is invalid. + * + * @syscap SystemCapability.FileManagement.AppFileService.FolderAuthorization + * @since 11 + */ + INVALID_PATH = 3, + /** + * Indicates that the permission is not persistent. + * + * @syscap SystemCapability.FileManagement.AppFileService.FolderAuthorization + * @since 12 + */ + PERMISSION_NOT_PERSISTED = 4 + } + /** + * Failed policy result on URI. + * + * @syscap SystemCapability.FileManagement.AppFileService.FolderAuthorization + * @since 11 + */ + export type PolicyErrorResult = { + /** + * Indicates the failed uri of the policy information. + * + * @type { string } + * @syscap SystemCapability.FileManagement.AppFileService.FolderAuthorization + * @since 11 + */ + uri: string; + /** + * Indicates the error code of the failure in the policy information. + * + * @type { PolicyErrorCode } + * @syscap SystemCapability.FileManagement.AppFileService.FolderAuthorization + * @since 11 + */ + code: PolicyErrorCode; + /** + * Indicates the reason of the failure in the policy information. + * + * @type { string } + * @syscap SystemCapability.FileManagement.AppFileService.FolderAuthorization + * @since 11 + */ + message: string; + }; + /** + * Policy information to manager permissions on a URI. + * + * @interface PolicyInfo + * @syscap SystemCapability.FileManagement.AppFileService.FolderAuthorization + * @since 11 + */ + export interface PolicyInfo { + /** + * Indicates the uri of the policy information. + * + * @type { string } + * @syscap SystemCapability.FileManagement.AppFileService.FolderAuthorization + * @since 11 + */ + uri: string; + /** + * Indicates the mode of operation for the URI, example { OperationMode.READ_MODE } or { OperationMode.READ_MODE | OperationMode.WRITE_MODE } + * + * @type { number } + * @syscap SystemCapability.FileManagement.AppFileService.FolderAuthorization + * @since 11 + */ + operationMode: number; + } + /** + * Set persistence permissions for the URI + * + * @permission ohos.permission.FILE_ACCESS_PERSIST + * @param { Array } policies - Policy information to grant permission on URIs. + * @returns { Promise } the promise returned by the function. + * @throws { BusinessError } 201 - Permission verification failed, usually the result returned by VerifyAccessToken. + * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; + *
2.Incorrect parameter types. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 13900001 - Operation not permitted. + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.AppFileService.FolderAuthorization + * @since 11 + */ + function persistPermission(policies: Array): Promise; + /** + * Revoke persistence permissions for the URI + * + * @permission ohos.permission.FILE_ACCESS_PERSIST + * @param { Array } policies - Policy information to grant permission on URIs. + * @returns { Promise } the promise returned by the function. + * @throws { BusinessError } 201 - Permission verification failed, usually the result returned by VerifyAccessToken. + * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; + *
2.Incorrect parameter types. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 13900001 - Operation not permitted. + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.AppFileService.FolderAuthorization + * @since 11 + */ + function revokePermission(policies: Array): Promise; + /** + * Enable the URI that have been permanently authorized + * + * @permission ohos.permission.FILE_ACCESS_PERSIST + * @param { Array } policies - Policy information to grant permission on URIs. + * @returns { Promise } the promise returned by the function. + * @throws { BusinessError } 201 - Permission verification failed, usually the result returned by VerifyAccessToken. + * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; + *
2.Incorrect parameter types. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 13900001 - Operation not permitted. + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.AppFileService.FolderAuthorization + * @since 11 + */ + function activatePermission(policies: Array): Promise; + /** + * Stop the authorized URI that has been enabled + * + * @permission ohos.permission.FILE_ACCESS_PERSIST + * @param { Array } policies - Policy information to grant permission on URIs. + * @returns { Promise } the promise returned by the function. + * @throws { BusinessError } 201 - Permission verification failed, usually the result returned by VerifyAccessToken. + * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; + *
2.Incorrect parameter types. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 13900001 - Operation not permitted. + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.AppFileService.FolderAuthorization + * @since 11 + */ + function deactivatePermission(policies: Array): Promise; + /** + * Check persistent permissions for the URI. + * + * @permission ohos.permission.FILE_ACCESS_PERSIST + * @param { Array } policies - Policy information to grant permission on URIs. + * @returns { Promise> } Returns the persistent state of uri permissions. + * @throws { BusinessError } 201 - Permission verification failed, usually the result returned by VerifyAccessToken. + * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; + *
2.Incorrect parameter types. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 13900042 - Unknown error + * @syscap SystemCapability.FileManagement.AppFileService.FolderAuthorization + * @since 12 + */ + function checkPersistentPermission(policies: Array): Promise>; +} +export default fileShare; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.font.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.font.d.ts new file mode 100755 index 00000000..e336f316 --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.font.d.ts @@ -0,0 +1,608 @@ +/* + * Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit ArkUI + */ +/** + * @namespace font + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 9 + */ +/** + * @namespace font + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ +declare namespace font { + /** + * @typedef FontOptions + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 9 + */ + /** + * @typedef FontOptions + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + interface FontOptions { + /** + * The font name to register. + * + * @type { string } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 9 + */ + /** + * The font name to register. + * + * @type { string | Resource } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * The font name to register. + * + * @type { string | Resource } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + familyName: string | Resource; + /** + * The path of the font file. + * + * @type { string } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 9 + */ + /** + * The path of the font file. + * + * @type { string | Resource } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * The path of the font file. + * + * @type { string | Resource } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + familySrc: string | Resource; + } + /** + * @typedef FontInfo + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * @typedef FontInfo + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + interface FontInfo { + /** + * The path of the font file. + * + * @type { string } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * The path of the font file. + * + * @type { string } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + path: string; + /** + * The name of postscript. + * + * @type { string } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * The name of postscript. + * + * @type { string } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + postScriptName: string; + /** + * The font name. + * + * @type { string } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * The font name. + * + * @type { string } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + fullName: string; + /** + * A set of fonts with a common design. + * + * @type { string } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * A set of fonts with a common design. + * + * @type { string } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + family: string; + /** + * A subset of the font family. + * + * @type { string } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * A subset of the font family. + * + * @type { string } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + subfamily: string; + /** + * The weight of the font. + * + * @type { number } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * The weight of the font. + * + * @type { number } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + weight: number; + /** + * The width of the font style. + * + * @type { number } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * The width of the font style. + * + * @type { number } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + width: number; + /** + * Whether it is italic. + * + * @type { boolean } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * Whether it is italic. + * + * @type { boolean } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + italic: boolean; + /** + * Whether it is compact. + * + * @type { boolean } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * Whether it is compact. + * + * @type { boolean } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + monoSpace: boolean; + /** + * Whether symbol fonts are supported. + * + * @type { boolean } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * Whether symbol fonts are supported. + * + * @type { boolean } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + symbolic: boolean; + } + /** + * @typedef UIFontConfig + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 11 + */ + /** + * @typedef UIFontConfig + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 12 + */ + interface UIFontConfig { + /** + * The paths of system font files. + * @type { Array } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 11 + */ + /** + * The paths of system font files. + * @type { Array } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 12 + */ + fontDir: Array; + /** + * The generic font info. + * @type { Array } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 11 + */ + /** + * The generic font info. + * @type { Array } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 12 + */ + generic: Array; + /** + * The fallback font info. + * @type { Array } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 11 + */ + /** + * The fallback font info. + * @type { Array } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 12 + */ + fallbackGroups: Array; + } + /** + * @typedef UIFontGenericInfo + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 11 + */ + /** + * @typedef UIFontGenericInfo + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 12 + */ + interface UIFontGenericInfo { + /** + * Name of the font set. + * @type { string } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 11 + */ + /** + * Name of the font set. + * @type { string } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 12 + */ + family: string; + /** + * Alias info of the font set. + * @type { Array } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 11 + */ + /** + * Alias info of the font set. + * @type { Array } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 12 + */ + alias: Array; + /** + * Adjust info of the font set. + * @type { Array } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 11 + */ + /** + * Adjust info of the font set. + * @type { Array } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 12 + */ + adjust: Array; + } + /** + * @typedef UIFontAliasInfo + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 11 + */ + /** + * @typedef UIFontAliasInfo + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 12 + */ + interface UIFontAliasInfo { + /** + * Font set name. + * @type { string } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 11 + */ + /** + * Font set name. + * @type { string } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 12 + */ + name: string; + /** + * Weight the font set contains only fonts with, if weight = 0, + * this font set can contain fonts with any weight. + * @type { number } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 11 + */ + /** + * Weight the font set contains only fonts with, if weight = 0, + * this font set can contain fonts with any weight. + * @type { number } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 12 + */ + weight: number; + } + /** + * @typedef UIFontAdjustInfo + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 11 + */ + /** + * @typedef UIFontAdjustInfo + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 12 + */ + interface UIFontAdjustInfo { + /** + * Original weight of the font + * @type { number } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 11 + */ + /** + * Original weight of the font + * @type { number } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 12 + */ + weight: number; + /** + * Font weight displayed in the app + * @type { number } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 11 + */ + /** + * Font weight displayed in the app + * @type { number } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 12 + */ + to: number; + } + /** + * @typedef UIFontFallbackGroupInfo + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 11 + */ + /** + * @typedef UIFontFallbackGroupInfo + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 12 + */ + interface UIFontFallbackGroupInfo { + /** + * Indicates which font set uses following list for fallback font + * if the font set name is "", it means that the following list can be fallback font for all font sets. + * @type { string } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 11 + */ + /** + * Indicates which font set uses following list for fallback font + * if the font set name is "", it means that the following list can be fallback font for all font sets. + * @type { string } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 12 + */ + fontSetName: string; + /** + * Fallback font list related. + * @type { Array } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 11 + */ + /** + * Fallback font list related. + * @type { Array } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 12 + */ + fallback: Array; + } + /** + * @typedef UIFontFallbackInfo + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 11 + */ + /** + * @typedef UIFontFallbackInfo + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 12 + */ + interface UIFontFallbackInfo { + /** + * Language that font set support. + * @type { string } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 11 + */ + /** + * Language that font set support. + * @type { string } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 12 + */ + language: string; + /** + * Font name related. + * @type { string } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 11 + */ + /** + * Font name related. + * @type { string } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 12 + */ + family: string; + } + /** + * Register a customized font in the FontManager. + * + * @param { FontOptions } options - FontOptions + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 9 + */ + /** + * Register a customized font in the FontManager. + * + * @param { FontOptions } options - FontOptions + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + function registerFont(options: FontOptions): void; + /** + * Gets a list of fonts supported by system. + * + * @returns { Array } A list of font names + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * Gets a list of fonts supported by system. + * + * @returns { Array } A list of font names + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + function getSystemFontList(): Array; + /** + * Get font details according to the font name. + * + * @param { string } fontName - font name + * @returns { FontInfo } Returns the font info + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * Get font details according to the font name. + * + * @param { string } fontName - font name + * @returns { FontInfo } Returns the font info + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 11 + */ + function getFontByName(fontName: string): FontInfo; + /** + * Get font details according to the font name. + * + * @returns { UIFontConfig } Returns the ui font config + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 11 + */ + /** + * Get font details according to the font name. + * + * @returns { UIFontConfig } Returns the ui font config + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 12 + */ + function getUIFontConfig(): UIFontConfig; +} +export default font; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.geoLocationManager.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.geoLocationManager.d.ts new file mode 100755 index 00000000..50fd94f6 --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.geoLocationManager.d.ts @@ -0,0 +1,2323 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit LocationKit + */ +import { AsyncCallback, Callback } from './@ohos.base'; +import { WantAgent } from './@ohos.wantAgent'; +import { NotificationRequest } from './notification/notificationRequest'; +/** + * Provides interfaces for acquiring location information, managing location switches, + * geocoding, reverse geocoding, country code, fencing and other functions. + * + * @namespace geoLocationManager + * @since 9 + */ +/** + * Provides interfaces for acquiring location information, managing location switches, + * geocoding, reverse geocoding, country code, fencing and other functions. + * + * @namespace geoLocationManager + * @atomicservice + * @since 11 + */ +declare namespace geoLocationManager { + /** + * Subscribe location changed. + * + * @permission ohos.permission.APPROXIMATELY_LOCATION + * @param { 'locationChange' } type - Indicates the location service event to be subscribed to. + * @param { LocationRequest } request - Indicates the location request parameters. + * @param { Callback } callback - Indicates the callback for reporting the location result. + * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. Failed to call ${geoLocationManager.on('locationChange')} due to limited device capabilities. + * @throws { BusinessError } 3301000 - The location service is unavailable. + * @throws { BusinessError } 3301100 - The location switch is off. + * @throws { BusinessError } 3301200 - Failed to obtain the geographical location. + * @syscap SystemCapability.Location.Location.Core + * @since 9 + */ + /** + * Subscribe location changed. + * + * @permission ohos.permission.APPROXIMATELY_LOCATION + * @param { 'locationChange' } type - Indicates the location service event to be subscribed to. + * @param { LocationRequest } request - Indicates the location request parameters. + * @param { Callback } callback - Indicates the callback for reporting the location result. + * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. Failed to call ${geoLocationManager.on('locationChange')} due to limited device capabilities. + * @throws { BusinessError } 3301000 - The location service is unavailable. + * @throws { BusinessError } 3301100 - The location switch is off. + * @throws { BusinessError } 3301200 - Failed to obtain the geographical location. + * @syscap SystemCapability.Location.Location.Core + * @atomicservice + * @since 11 + */ + /** + * Subscribe location changed. + * + * @permission ohos.permission.APPROXIMATELY_LOCATION + * @param { 'locationChange' } type - Indicates the location service event to be subscribed to. + * @param { LocationRequest | ContinuousLocationRequest } request - Indicates the location request parameters. + * @param { Callback } callback - Indicates the callback for reporting the location result. + * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. Failed to call ${geoLocationManager.on('locationChange')} due to limited device capabilities. + * @throws { BusinessError } 3301000 - The location service is unavailable. + * @throws { BusinessError } 3301100 - The location switch is off. + * @throws { BusinessError } 3301200 - Failed to obtain the geographical location. + * @syscap SystemCapability.Location.Location.Core + * @atomicservice + * @since 12 + */ + function on(type: 'locationChange', request: LocationRequest | ContinuousLocationRequest, callback: Callback): void; + /** + * Unsubscribe location changed. + * + * @permission ohos.permission.APPROXIMATELY_LOCATION + * @param { 'locationChange' } type - Indicates the location service event to be subscribed to. + * @param { Callback } [callback] - Indicates the callback for reporting the location result. + * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. Failed to call ${geoLocationManager.off('locationChange')} due to limited device capabilities. + * @throws { BusinessError } 3301000 - The location service is unavailable. + * @throws { BusinessError } 3301100 - The location switch is off. + * @throws { BusinessError } 3301200 - Failed to obtain the geographical location. + * @syscap SystemCapability.Location.Location.Core + * @since 9 + */ + /** + * Unsubscribe location changed. + * + * @permission ohos.permission.APPROXIMATELY_LOCATION + * @param { 'locationChange' } type - Indicates the location service event to be subscribed to. + * @param { Callback } [callback] - Indicates the callback for reporting the location result. + * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. Failed to call ${geoLocationManager.off('locationChange')} due to limited device capabilities. + * @throws { BusinessError } 3301000 - The location service is unavailable. + * @throws { BusinessError } 3301100 - The location switch is off. + * @throws { BusinessError } 3301200 - Failed to obtain the geographical location. + * @syscap SystemCapability.Location.Location.Core + * @atomicservice + * @since 11 + */ + function off(type: 'locationChange', callback?: Callback): void; + /** + * Subscribe continuous location error changed. + * + * @permission ohos.permission.APPROXIMATELY_LOCATION + * @param { 'locationError' } type - Indicates the location service event to be subscribed to. + * @param { Callback } callback - Indicates the callback for reporting the continuous location error. + * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. Failed to call ${geoLocationManager.on('locationError')} due to limited device capabilities. + * @throws { BusinessError } 3301000 - The location service is unavailable. + * @syscap SystemCapability.Location.Location.Core + * @atomicservice + * @since 12 + */ + function on(type: 'locationError', callback: Callback): void; + /** + * Unsubscribe continuous location error changed. + * + * @permission ohos.permission.APPROXIMATELY_LOCATION + * @param { 'locationError' } type - Indicates the location service event to be subscribed to. + * @param { Callback } [callback] - Indicates the callback for reporting the continuous location error. + * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. Failed to call ${geoLocationManager.off('locationError')} due to limited device capabilities. + * @throws { BusinessError } 3301000 - The location service is unavailable. + * @syscap SystemCapability.Location.Location.Core + * @atomicservice + * @since 12 + */ + function off(type: 'locationError', callback?: Callback): void; + /** + * Subscribe location switch changed. + * + * @param { 'locationEnabledChange' } type - Indicates the location service event to be subscribed to. + * @param { Callback } callback - Indicates the callback for reporting the location switch status. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. Failed to call ${geoLocationManager.on('locationEnabledChange')} due to limited device capabilities. + * @throws { BusinessError } 3301000 - The location service is unavailable. + * @syscap SystemCapability.Location.Location.Core + * @since 9 + */ + function on(type: 'locationEnabledChange', callback: Callback): void; + /** + * Unsubscribe location switch changed. + * + * @param { 'locationEnabledChange' } type - Indicates the location service event to be subscribed to. + * @param { Callback } [callback] - Indicates the callback for reporting the location switch status. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. Failed to call ${geoLocationManager.off('locationEnabledChange')} due to limited device capabilities. + * @throws { BusinessError } 3301000 - The location service is unavailable. + * @syscap SystemCapability.Location.Location.Core + * @since 9 + */ + function off(type: 'locationEnabledChange', callback?: Callback): void; + /** + * Subscribe to cache GNSS locations update messages. + * + * @permission ohos.permission.APPROXIMATELY_LOCATION + * @param { 'cachedGnssLocationsChange' } type - Indicates the location service event to be subscribed to. + * @param { CachedGnssLocationsRequest } request - Indicates the cached GNSS locations request parameters. + * @param { Callback> } callback - Indicates the callback for reporting the cached GNSS locations. + * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. Failed to call ${geoLocationManager.on('cachedGnssLocationsChange')} due to limited device capabilities. + * @throws { BusinessError } 3301000 - The location service is unavailable. + * @throws { BusinessError } 3301100 - The location switch is off. + * @throws { BusinessError } 3301200 - Failed to obtain the geographical location. + * @syscap SystemCapability.Location.Location.Gnss + * @since 9 + */ + function on(type: 'cachedGnssLocationsChange', request: CachedGnssLocationsRequest, callback: Callback>): void; + /** + * Unsubscribe to cache GNSS locations update messages. + * + * @permission ohos.permission.APPROXIMATELY_LOCATION + * @param { 'cachedGnssLocationsChange' } type - Indicates the location service event to be subscribed to. + * @param { Callback> } [callback] - Indicates the callback for reporting the cached gnss locations. + * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. Failed to call ${geoLocationManager.off('cachedGnssLocationsChange')} due to limited device capabilities. + * @throws { BusinessError } 3301000 - The location service is unavailable. + * @throws { BusinessError } 3301100 - The location switch is off. + * @throws { BusinessError } 3301200 - Failed to obtain the geographical location. + * @syscap SystemCapability.Location.Location.Gnss + * @since 9 + */ + function off(type: 'cachedGnssLocationsChange', callback?: Callback>): void; + /** + * Subscribe satellite status changed. + * + * @permission ohos.permission.APPROXIMATELY_LOCATION + * @param { 'satelliteStatusChange' } type - Indicates the location service event to be subscribed to. + * @param { Callback } callback - Indicates the callback for reporting the satellite status. + * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. Failed to call ${geoLocationManager.on('satelliteStatusChange')} due to limited device capabilities. + * @throws { BusinessError } 3301000 - The location service is unavailable. + * @throws { BusinessError } 3301100 - The location switch is off. + * @syscap SystemCapability.Location.Location.Gnss + * @since 9 + */ + function on(type: 'satelliteStatusChange', callback: Callback): void; + /** + * Unsubscribe satellite status changed. + * + * @permission ohos.permission.APPROXIMATELY_LOCATION + * @param { 'satelliteStatusChange' } type - Indicates the location service event to be subscribed to. + * @param { Callback } [callback] - Indicates the callback for reporting the satellite status. + * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. Failed to call ${geoLocationManager.off('satelliteStatusChange')} due to limited device capabilities. + * @throws { BusinessError } 3301000 - The location service is unavailable. + * @throws { BusinessError } 3301100 - The location switch is off. + * @syscap SystemCapability.Location.Location.Gnss + * @since 9 + */ + function off(type: 'satelliteStatusChange', callback?: Callback): void; + /** + * Subscribe nmea message changed. + * + * @permission ohos.permission.LOCATION and ohos.permission.APPROXIMATELY_LOCATION + * @param { 'nmeaMessage' } type - Indicates the location service event to be subscribed to. + * @param { Callback } callback - Indicates the callback for reporting the nmea message. + * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. Failed to call ${geoLocationManager.on('nmeaMessage')} due to limited device capabilities. + * @throws { BusinessError } 3301000 - The location service is unavailable. + * @throws { BusinessError } 3301100 - The location switch is off. + * @syscap SystemCapability.Location.Location.Gnss + * @since 9 + */ + function on(type: 'nmeaMessage', callback: Callback): void; + /** + * Unsubscribe nmea message changed. + * + * @permission ohos.permission.LOCATION and ohos.permission.APPROXIMATELY_LOCATION + * @param { 'nmeaMessage' } type - Indicates the location service event to be subscribed to. + * @param { Callback } [callback] - Indicates the callback for reporting the nmea message. + * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. Failed to call ${geoLocationManager.off('nmeaMessage')} due to limited device capabilities. + * @throws { BusinessError } 3301000 - The location service is unavailable. + * @throws { BusinessError } 3301100 - The location switch is off. + * @syscap SystemCapability.Location.Location.Gnss + * @since 9 + */ + function off(type: 'nmeaMessage', callback?: Callback): void; + /** + * Add a geofence and subscribe geofence status changed. + * + * @permission ohos.permission.APPROXIMATELY_LOCATION + * @param { 'gnssFenceStatusChange' } type - Indicates the location service event to be subscribed to. + * @param { GeofenceRequest } request - Indicates the Geofence configuration parameters. + * @param { WantAgent } want - Indicates which ability to start when the geofence event is triggered. + * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. Failed to call ${geoLocationManager.on('gnssFenceStatusChange')} due to limited device capabilities. + * @throws { BusinessError } 3301000 - The location service is unavailable. + * @throws { BusinessError } 3301100 - The location switch is off. + * @throws { BusinessError } 3301600 - Failed to operate the geofence. + * @syscap SystemCapability.Location.Location.Geofence + * @since 9 + */ + function on(type: 'gnssFenceStatusChange', request: GeofenceRequest, want: WantAgent): void; + /** + * Remove a geofence and unsubscribe geofence status changed. + * + * @permission ohos.permission.APPROXIMATELY_LOCATION + * @param { 'gnssFenceStatusChange' } type - Indicates the location service event to be subscribed to. + * @param { GeofenceRequest } request - Indicates the Geofence configuration parameters. + * @param { WantAgent } want - Indicates which ability to start when the geofence event is triggered. + * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. Failed to call ${geoLocationManager.off('gnssFenceStatusChange')} due to limited device capabilities. + * @throws { BusinessError } 3301000 - The location service is unavailable. + * @throws { BusinessError } 3301100 - The location switch is off. + * @throws { BusinessError } 3301600 - Failed to operate the geofence. + * @syscap SystemCapability.Location.Location.Geofence + * @since 9 + */ + function off(type: 'gnssFenceStatusChange', request: GeofenceRequest, want: WantAgent): void; + /** + * Registering the callback function for listening to country code changes. + * + * @param { 'countryCodeChange' } type - Indicates the location service event to be subscribed to. + * @param { Callback } callback - Indicates the callback for reporting country code changes. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. Failed to call ${geoLocationManager.on('countryCodeChange')} due to limited device capabilities. + * @throws { BusinessError } 3301000 - The location service is unavailable. + * @throws { BusinessError } 3301500 - Failed to query the area information. + * @syscap SystemCapability.Location.Location.Core + * @since 9 + */ + function on(type: 'countryCodeChange', callback: Callback): void; + /** + * Unregistering the callback function for listening to country code changes. + * + * @param { 'countryCodeChange' } type - Indicates the location service event to be subscribed to. + * @param { Callback } [callback] - Indicates the callback for reporting country code changes. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. Failed to call ${geoLocationManager.off('countryCodeChange')} due to limited device capabilities. + * @throws { BusinessError } 3301000 - The location service is unavailable. + * @throws { BusinessError } 3301500 - Failed to query the area information. + * @syscap SystemCapability.Location.Location.Core + * @since 9 + */ + function off(type: 'countryCodeChange', callback?: Callback): void; + /** + * Obtain current location. + * + * @permission ohos.permission.APPROXIMATELY_LOCATION + * @param { CurrentLocationRequest } request - Indicates the location request parameters. + * @param { AsyncCallback } callback - Indicates the callback for reporting the location result. + * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. Failed to call ${geoLocationManager.getCurrentLocation} due to limited device capabilities. + * @throws { BusinessError } 3301000 - The location service is unavailable. + * @throws { BusinessError } 3301100 - The location switch is off. + * @throws { BusinessError } 3301200 - Failed to obtain the geographical location. + * @syscap SystemCapability.Location.Location.Core + * @since 9 + */ + /** + * Obtain current location. + * + * @permission ohos.permission.APPROXIMATELY_LOCATION + * @param { CurrentLocationRequest } request - Indicates the location request parameters. + * @param { AsyncCallback } callback - Indicates the callback for reporting the location result. + * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. Failed to call ${geoLocationManager.getCurrentLocation} due to limited device capabilities. + * @throws { BusinessError } 3301000 - The location service is unavailable. + * @throws { BusinessError } 3301100 - The location switch is off. + * @throws { BusinessError } 3301200 - Failed to obtain the geographical location. + * @syscap SystemCapability.Location.Location.Core + * @atomicservice + * @since 11 + */ + /** + * Obtain current location. + * + * @permission ohos.permission.APPROXIMATELY_LOCATION + * @param { CurrentLocationRequest | SingleLocationRequest } request - Indicates the location request parameters. + * @param { AsyncCallback } callback - Indicates the callback for reporting the location result. + * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. Failed to call ${geoLocationManager.getCurrentLocation} due to limited device capabilities. + * @throws { BusinessError } 3301000 - The location service is unavailable. + * @throws { BusinessError } 3301100 - The location switch is off. + * @throws { BusinessError } 3301200 - Failed to obtain the geographical location. + * @syscap SystemCapability.Location.Location.Core + * @atomicservice + * @since 12 + */ + function getCurrentLocation(request: CurrentLocationRequest | SingleLocationRequest, callback: AsyncCallback): void; + /** + * Obtain current location. + * + * @permission ohos.permission.APPROXIMATELY_LOCATION + * @param { AsyncCallback } callback - Indicates the callback for reporting the location result. + * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. Failed to call ${geoLocationManager.getCurrentLocation} due to limited device capabilities. + * @throws { BusinessError } 3301000 - The location service is unavailable. + * @throws { BusinessError } 3301100 - The location switch is off. + * @throws { BusinessError } 3301200 - Failed to obtain the geographical location. + * @syscap SystemCapability.Location.Location.Core + * @since 9 + */ + /** + * Obtain current location. + * + * @permission ohos.permission.APPROXIMATELY_LOCATION + * @param { AsyncCallback } callback - Indicates the callback for reporting the location result. + * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. Failed to call ${geoLocationManager.getCurrentLocation} due to limited device capabilities. + * @throws { BusinessError } 3301000 - The location service is unavailable. + * @throws { BusinessError } 3301100 - The location switch is off. + * @throws { BusinessError } 3301200 - Failed to obtain the geographical location. + * @syscap SystemCapability.Location.Location.Core + * @atomicservice + * @since 11 + */ + function getCurrentLocation(callback: AsyncCallback): void; + /** + * Obtain current location. + * + * @permission ohos.permission.APPROXIMATELY_LOCATION + * @param { CurrentLocationRequest } [request] - Indicates the location request parameters. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. Failed to call ${geoLocationManager.getCurrentLocation} due to limited device capabilities. + * @throws { BusinessError } 3301000 - The location service is unavailable. + * @throws { BusinessError } 3301100 - The location switch is off. + * @throws { BusinessError } 3301200 - Failed to obtain the geographical location. + * @syscap SystemCapability.Location.Location.Core + * @since 9 + */ + /** + * Obtain current location. + * + * @permission ohos.permission.APPROXIMATELY_LOCATION + * @param { CurrentLocationRequest } [request] - Indicates the location request parameters. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. Failed to call ${geoLocationManager.getCurrentLocation} due to limited device capabilities. + * @throws { BusinessError } 3301000 - The location service is unavailable. + * @throws { BusinessError } 3301100 - The location switch is off. + * @throws { BusinessError } 3301200 - Failed to obtain the geographical location. + * @syscap SystemCapability.Location.Location.Core + * @atomicservice + * @since 11 + */ + /** + * Obtain current location. + * + * @permission ohos.permission.APPROXIMATELY_LOCATION + * @param { CurrentLocationRequest | SingleLocationRequest } [request] - Indicates the location request parameters. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. Failed to call ${geoLocationManager.getCurrentLocation} due to limited device capabilities. + * @throws { BusinessError } 3301000 - The location service is unavailable. + * @throws { BusinessError } 3301100 - The location switch is off. + * @throws { BusinessError } 3301200 - Failed to obtain the geographical location. + * @syscap SystemCapability.Location.Location.Core + * @atomicservice + * @since 12 + */ + function getCurrentLocation(request?: CurrentLocationRequest | SingleLocationRequest): Promise; + /** + * Obtain last known location. + * + * @permission ohos.permission.APPROXIMATELY_LOCATION + * @returns { Location } The last known location information. + * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. + * @throws { BusinessError } 801 - Capability not supported. Failed to call ${geoLocationManager.getLastLocation} due to limited device capabilities. + * @throws { BusinessError } 3301000 - The location service is unavailable. + * @throws { BusinessError } 3301100 - The location switch is off. + * @throws { BusinessError } 3301200 - Failed to obtain the geographical location. + * @syscap SystemCapability.Location.Location.Core + * @since 9 + */ + /** + * Obtain last known location. + * + * @permission ohos.permission.APPROXIMATELY_LOCATION + * @returns { Location } The last known location information. + * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. + * @throws { BusinessError } 801 - Capability not supported. Failed to call ${geoLocationManager.getLastLocation} due to limited device capabilities. + * @throws { BusinessError } 3301000 - The location service is unavailable. + * @throws { BusinessError } 3301100 - The location switch is off. + * @throws { BusinessError } 3301200 - Failed to obtain the geographical location. + * @syscap SystemCapability.Location.Location.Core + * @atomicservice + * @since 11 + */ + function getLastLocation(): Location; + /** + * Obtain current location switch status. + * + * @returns { boolean } Returns {@code true} if the location switch on, returns {@code false} otherwise. + * @throws { BusinessError } 801 - Capability not supported. Failed to call ${geoLocationManager.isLocationEnabled} due to limited device capabilities. + * @throws { BusinessError } 3301000 - The location service is unavailable. + * @syscap SystemCapability.Location.Location.Core + * @since 9 + */ + /** + * Obtain current location switch status. + * + * @returns { boolean } Returns {@code true} if the location switch on, returns {@code false} otherwise. + * @throws { BusinessError } 801 - Capability not supported. Failed to call ${geoLocationManager.isLocationEnabled} due to limited device capabilities. + * @throws { BusinessError } 3301000 - The location service is unavailable. + * @syscap SystemCapability.Location.Location.Core + * @atomicservice + * @since 11 + */ + function isLocationEnabled(): boolean; + /** + * Obtain address info from location. + * + * @param { ReverseGeoCodeRequest } request - Indicates the reverse geocode query parameters. + * @param { AsyncCallback> } callback - Indicates the callback for reporting the address info. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. Failed to call ${geoLocationManager.getAddressesFromLocation} due to limited device capabilities. + * @throws { BusinessError } 3301000 - The location service is unavailable. + * @throws { BusinessError } 3301300 - Reverse geocoding query failed. + * @syscap SystemCapability.Location.Location.Geocoder + * @since 9 + */ + function getAddressesFromLocation(request: ReverseGeoCodeRequest, callback: AsyncCallback>): void; + /** + * Obtain address info from location. + * + * @param { ReverseGeoCodeRequest } request - Indicates the reverse geocode query parameters. + * @returns { Promise> } The promise returned by the function. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. Failed to call ${geoLocationManager.getAddressesFromLocation} due to limited device capabilities. + * @throws { BusinessError } 3301000 - The location service is unavailable. + * @throws { BusinessError } 3301300 - Reverse geocoding query failed. + * @syscap SystemCapability.Location.Location.Geocoder + * @since 9 + */ + function getAddressesFromLocation(request: ReverseGeoCodeRequest): Promise>; + /** + * Obtain latitude and longitude info from location address. + * + * @param { GeoCodeRequest } request - Indicates the geocode query parameters. + * @param { AsyncCallback> } callback - Indicates the callback for reporting the latitude and longitude result. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. Failed to call ${geoLocationManager.getAddressesFromLocationName} due to limited device capabilities. + * @throws { BusinessError } 3301000 - The location service is unavailable. + * @throws { BusinessError } 3301400 - Geocoding query failed. + * @syscap SystemCapability.Location.Location.Geocoder + * @since 9 + */ + function getAddressesFromLocationName(request: GeoCodeRequest, callback: AsyncCallback>): void; + /** + * Obtain latitude and longitude info from location address. + * + * @param { GeoCodeRequest } request - Indicates the geocode query parameters. + * @returns { Promise> } The promise returned by the function. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. Failed to call ${geoLocationManager.getAddressesFromLocationName} due to limited device capabilities. + * @throws { BusinessError } 3301000 - The location service is unavailable. + * @throws { BusinessError } 3301400 - Geocoding query failed. + * @syscap SystemCapability.Location.Location.Geocoder + * @since 9 + */ + function getAddressesFromLocationName(request: GeoCodeRequest): Promise>; + /** + * Obtain geocoding service status. + * + * @returns { boolean } Returns {@code true} if geocoding service is available, returns {@code false} otherwise. + * @throws { BusinessError } 801 - Capability not supported. Failed to call ${geoLocationManager.isGeocoderAvailable} due to limited device capabilities. + * @throws { BusinessError } 3301000 - The location service is unavailable. + * @syscap SystemCapability.Location.Location.Geocoder + * @since 9 + */ + function isGeocoderAvailable(): boolean; + /** + * Obtain the number of cached GNSS locations reported at a time. + * + * @permission ohos.permission.APPROXIMATELY_LOCATION + * @param { AsyncCallback } callback - Indicates the callback for reporting the cached GNSS locations size. + * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. Failed to call ${geoLocationManager.getCachedGnssLocationsSize} due to limited device capabilities. + * @throws { BusinessError } 3301000 - The location service is unavailable. + * @throws { BusinessError } 3301100 - The location switch is off. + * @syscap SystemCapability.Location.Location.Gnss + * @since 9 + */ + function getCachedGnssLocationsSize(callback: AsyncCallback): void; + /** + * Obtain the number of cached GNSS locations. + * + * @permission ohos.permission.APPROXIMATELY_LOCATION + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. + * @throws { BusinessError } 801 - Capability not supported. Failed to call ${geoLocationManager.getCachedGnssLocationsSize} due to limited device capabilities. + * @throws { BusinessError } 3301000 - The location service is unavailable. + * @throws { BusinessError } 3301100 - The location switch is off. + * @syscap SystemCapability.Location.Location.Gnss + * @since 9 + */ + function getCachedGnssLocationsSize(): Promise; + /** + * All prepared GNSS locations are returned to the application through the callback function, + * and the bottom-layer buffer is cleared. + * + * @permission ohos.permission.APPROXIMATELY_LOCATION + * @param { AsyncCallback } callback - Indicates the callback for reporting the error message. + * If the function fails to execute, the error message will be carried in the first parameter err of AsyncCallback, + * If the function executes successfully, execute the callback function only, no data will be returned. + * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. Failed to call ${geoLocationManager.flushCachedGnssLocations} due to limited device capabilities. + * @throws { BusinessError } 3301000 - The location service is unavailable. + * @throws { BusinessError } 3301100 - The location switch is off. + * @throws { BusinessError } 3301200 - Failed to obtain the geographical location. + * @syscap SystemCapability.Location.Location.Gnss + * @since 9 + */ + function flushCachedGnssLocations(callback: AsyncCallback): void; + /** + * All prepared GNSS locations are returned to the application, + * and the bottom-layer buffer is cleared. + * + * @permission ohos.permission.APPROXIMATELY_LOCATION + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. + * @throws { BusinessError } 801 - Capability not supported. Failed to call ${geoLocationManager.flushCachedGnssLocations} due to limited device capabilities. + * @throws { BusinessError } 3301000 - The location service is unavailable. + * @throws { BusinessError } 3301100 - The location switch is off. + * @throws { BusinessError } 3301200 - Failed to obtain the geographical location. + * @syscap SystemCapability.Location.Location.Gnss + * @since 9 + */ + function flushCachedGnssLocations(): Promise; + /** + * Send extended commands to location subsystem. + * + * @param { LocationCommand } command - Indicates the extended command message body. + * @param { AsyncCallback } callback - Indicates the callback for reporting the error message. + * If the function fails to execute, the error message will be carried in the first parameter err of AsyncCallback, + * If the function executes successfully, execute the callback function only, no data will be returned. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. Failed to call ${geoLocationManager.sendCommand} due to limited device capabilities. + * @throws { BusinessError } 3301000 - The location service is unavailable. + * @syscap SystemCapability.Location.Location.Core + * @since 9 + */ + function sendCommand(command: LocationCommand, callback: AsyncCallback): void; + /** + * Send extended commands to location subsystem. + * + * @param { LocationCommand } command - Indicates the extended command message body. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. Failed to call ${geoLocationManager.sendCommand} due to limited device capabilities. + * @throws { BusinessError } 3301000 - The location service is unavailable. + * @syscap SystemCapability.Location.Location.Core + * @since 9 + */ + function sendCommand(command: LocationCommand): Promise; + /** + * Obtain the current country code. + * + * @param { AsyncCallback } callback - Indicates the callback for reporting the country code. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. Failed to call ${geoLocationManager.getCountryCode} due to limited device capabilities. + * @throws { BusinessError } 3301000 - The location service is unavailable. + * @throws { BusinessError } 3301500 - Failed to query the area information. + * @syscap SystemCapability.Location.Location.Core + * @since 9 + */ + function getCountryCode(callback: AsyncCallback): void; + /** + * Obtain the current country code. + * + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 801 - Capability not supported. Failed to call ${geoLocationManager.getCountryCode} due to limited device capabilities. + * @throws { BusinessError } 3301000 - The location service is unavailable. + * @throws { BusinessError } 3301500 - Failed to query the area information. + * @syscap SystemCapability.Location.Location.Core + * @since 9 + */ + function getCountryCode(): Promise; + /** + * Add a geofence. + * + * @permission ohos.permission.LOCATION and ohos.permission.APPROXIMATELY_LOCATION + * @param { GnssGeofenceRequest } fenceRequest - Indicates the Geofence configuration parameters. + * @returns { Promise } The promise returned by the function, for reporting the ID of geofence. + * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. Failed to call ${geoLocationManager.addGnssGeofence} due to limited device capabilities. + * @throws { BusinessError } 3301000 - The location service is unavailable. + * @throws { BusinessError } 3301100 - The location switch is off. + * @throws { BusinessError } 3301601 - The number of geofences exceeds the maximum. + * @syscap SystemCapability.Location.Location.Geofence + * @since 12 + */ + function addGnssGeofence(fenceRequest: GnssGeofenceRequest): Promise; + /** + * Remove a geofence. + * + * @permission ohos.permission.LOCATION and ohos.permission.APPROXIMATELY_LOCATION + * @param { number } geofenceId - Indicates the ID of geofence. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. Failed to call ${geoLocationManager.removeGnssGeofence} due to limited device capabilities. + * @throws { BusinessError } 3301000 - The location service is unavailable. + * @throws { BusinessError } 3301602 - Failed to delete a geofence due to an incorrect ID. + * @syscap SystemCapability.Location.Location.Geofence + * @since 12 + */ + function removeGnssGeofence(geofenceId: number): Promise; + /** + * Obtains the coordinate system types supported by geofence. + * + * @returns { Array } Return the coordinate system types supported by geofence. + * @throws { BusinessError } 801 - Capability not supported. Failed to call ${geoLocationManager.getGeofenceSupportedCoordTypes} due to limited device capabilities. + * @throws { BusinessError } 3301000 - The location service is unavailable. + * @syscap SystemCapability.Location.Location.Geofence + * @since 12 + */ + function getGeofenceSupportedCoordTypes(): Array; + /** + * Satellite status information. + * + * @typedef SatelliteStatusInfo + * @syscap SystemCapability.Location.Location.Gnss + * @since 9 + */ + export interface SatelliteStatusInfo { + /** + * Number of satellites. + * + * @type { number } + * @syscap SystemCapability.Location.Location.Gnss + * @since 9 + */ + satellitesNumber: number; + /** + * Satellite ID array. + * + * @type { Array } + * @syscap SystemCapability.Location.Location.Gnss + * @since 9 + */ + satelliteIds: Array; + /** + * Carrier to noise density array. + * + * @type { Array } + * @syscap SystemCapability.Location.Location.Gnss + * @since 9 + */ + carrierToNoiseDensitys: Array; + /** + * Satellite altitude array. + * + * @type { Array } + * @syscap SystemCapability.Location.Location.Gnss + * @since 9 + */ + altitudes: Array; + /** + * Satellite azimuth array. + * + * @type { Array } + * @syscap SystemCapability.Location.Location.Gnss + * @since 9 + */ + azimuths: Array; + /** + * Satellite carrier frequency array. + * + * @type { Array } + * @syscap SystemCapability.Location.Location.Gnss + * @since 9 + */ + carrierFrequencies: Array; + /** + * Satellite constellation type array. + * + * @type { Array } + * @syscap SystemCapability.Location.Location.Gnss + * @since 12 + */ + satelliteConstellation: Array; + /** + * Satellite additional information array. + * + * @type { Array } + * @syscap SystemCapability.Location.Location.Gnss + * @since 12 + */ + satelliteAdditionalInfo: Array; + } + /** + * Parameters for requesting to report cache location information. + * + * @typedef CachedGnssLocationsRequest + * @syscap SystemCapability.Location.Location.Gnss + * @since 9 + */ + export interface CachedGnssLocationsRequest { + /** + * GNSS cache location report period. + * + * @type { number } + * @syscap SystemCapability.Location.Location.Gnss + * @since 9 + */ + reportingPeriodSec: number; + /** + * Indicates whether to wake up the listener when the GNSS cache location queue is full. + * + * @type { boolean } + * @syscap SystemCapability.Location.Location.Gnss + * @since 9 + */ + wakeUpCacheQueueFull: boolean; + } + /** + * Configuring parameters in GNSS geofence requests. + * + * @typedef GnssGeofenceRequest + * @syscap SystemCapability.Location.Location.Geofence + * @since 12 + */ + export interface GnssGeofenceRequest { + /** + * Circular fence information. + * + * @type { Geofence } + * @syscap SystemCapability.Location.Location.Geofence + * @since 12 + */ + geofence: Geofence; + /** + * Indicates geofence transition status monitored. + * + * @type { Array } + * @syscap SystemCapability.Location.Location.Geofence + * @since 12 + */ + monitorTransitionEvents: Array; + /** + * Indicates the geofence notifications to publish. + * + * @type { ?Array } + * @syscap SystemCapability.Location.Location.Geofence + * @since 12 + */ + notifications?: Array; + /** + * Indicates the callback for reporting the geofence transition status. + * + * @type { AsyncCallback } + * @syscap SystemCapability.Location.Location.Geofence + * @since 12 + */ + geofenceTransitionCallback: AsyncCallback; + } + /** + * Configuring parameters in geofence requests. + * + * @typedef GeofenceRequest + * @syscap SystemCapability.Location.Location.Geofence + * @since 9 + */ + export interface GeofenceRequest { + /** + * Indicate the user scenario. + * + * @type { LocationRequestScenario } + * @syscap SystemCapability.Location.Location.Geofence + * @since 9 + */ + scenario: LocationRequestScenario; + /** + * Circular fence information. + * + * @type { Geofence } + * @syscap SystemCapability.Location.Location.Geofence + * @since 9 + */ + geofence: Geofence; + } + /** + * Circular fence information. + * + * @typedef Geofence + * @syscap SystemCapability.Location.Location.Geofence + * @since 9 + */ + export interface Geofence { + /** + * Latitude of the center point of the circular fence. + * + * @type { number } + * @syscap SystemCapability.Location.Location.Geofence + * @since 9 + */ + latitude: number; + /** + * Longitude of the center point of the circular fence. + * + * @type { number } + * @syscap SystemCapability.Location.Location.Geofence + * @since 9 + */ + longitude: number; + /** + * Coordinate system type. + * + * @type { ?CoordinateSystemType } + * @syscap SystemCapability.Location.Location.Geofence + * @since 12 + */ + coordinateSystemType?: CoordinateSystemType; + /** + * Radius of the circular fence. + * + * @type { number } + * @syscap SystemCapability.Location.Location.Geofence + * @since 9 + */ + radius: number; + /** + * Expiration of the circular fence. + * + * @type { number } + * @syscap SystemCapability.Location.Location.Geofence + * @since 9 + */ + expiration: number; + } + /** + * Configuring parameters in reverse geocode requests. + * + * @typedef ReverseGeoCodeRequest + * @syscap SystemCapability.Location.Location.Geocoder + * @since 9 + */ + export interface ReverseGeoCodeRequest { + /** + * Indicates the language area information. + * + * @type { ?string } + * @syscap SystemCapability.Location.Location.Geocoder + * @since 9 + */ + locale?: string; + /** + * Indicates the country information. + * + * @type { ?string } + * @syscap SystemCapability.Location.Location.Geocoder + * @since 12 + */ + country?: string; + /** + * Latitude for reverse geocoding query. + * + * @type { number } + * @syscap SystemCapability.Location.Location.Geocoder + * @since 9 + */ + latitude: number; + /** + * Longitude for reverse geocoding query. + * + * @type { number } + * @syscap SystemCapability.Location.Location.Geocoder + * @since 9 + */ + longitude: number; + /** + * Indicates the maximum number of addresses returned by reverse geocoding query. + * + * @type { ?number } + * @syscap SystemCapability.Location.Location.Geocoder + * @since 9 + */ + maxItems?: number; + } + /** + * Configuring parameters in geocode requests. + * + * @typedef GeoCodeRequest + * @syscap SystemCapability.Location.Location.Geocoder + * @since 9 + */ + export interface GeoCodeRequest { + /** + * Indicates the language area information. + * + * @type { ?string } + * @syscap SystemCapability.Location.Location.Geocoder + * @since 9 + */ + locale?: string; + /** + * Indicates the country information. + * + * @type { ?string } + * @syscap SystemCapability.Location.Location.Geocoder + * @since 12 + */ + country?: string; + /** + * Address information. + * + * @type { string } + * @syscap SystemCapability.Location.Location.Geocoder + * @since 9 + */ + description: string; + /** + * Indicates the maximum number of geocode query results. + * + * @type { ?number } + * @syscap SystemCapability.Location.Location.Geocoder + * @since 9 + */ + maxItems?: number; + /** + * Indicates the minimum latitude for geocoding query results. + * + * @type { ?number } + * @syscap SystemCapability.Location.Location.Geocoder + * @since 9 + */ + minLatitude?: number; + /** + * Indicates the minimum longitude for geocoding query results. + * + * @type { ?number } + * @syscap SystemCapability.Location.Location.Geocoder + * @since 9 + */ + minLongitude?: number; + /** + * Indicates the maximum latitude for geocoding query results. + * + * @type { ?number } + * @syscap SystemCapability.Location.Location.Geocoder + * @since 9 + */ + maxLatitude?: number; + /** + * Indicates the maximum longitude for geocoding query results. + * + * @type { ?number } + * @syscap SystemCapability.Location.Location.Geocoder + * @since 9 + */ + maxLongitude?: number; + } + /** + * Data struct describes geographic locations. + * + * @typedef GeoAddress + * @syscap SystemCapability.Location.Location.Geocoder + * @since 9 + */ + export interface GeoAddress { + /** + * Indicates latitude information. + * A positive value indicates north latitude, + * and a negative value indicates south latitude. + * + * @type { ?number } + * @syscap SystemCapability.Location.Location.Geocoder + * @since 9 + */ + latitude?: number; + /** + * Indicates longitude information. + * A positive value indicates east longitude , + * and a negative value indicates west longitude. + * + * @type { ?number } + * @syscap SystemCapability.Location.Location.Geocoder + * @since 9 + */ + longitude?: number; + /** + * Indicates language used for the location description. + * zh indicates Chinese, and en indicates English. + * + * @type { ?string } + * @syscap SystemCapability.Location.Location.Geocoder + * @since 9 + */ + locale?: string; + /** + * Indicates detailed address information. + * + * @type { ?string } + * @syscap SystemCapability.Location.Location.Geocoder + * @since 9 + */ + placeName?: string; + /** + * Indicates country code. + * + * @type { ?string } + * @syscap SystemCapability.Location.Location.Geocoder + * @since 9 + */ + countryCode?: string; + /** + * Indicates country name. + * + * @type { ?string } + * @syscap SystemCapability.Location.Location.Geocoder + * @since 9 + */ + countryName?: string; + /** + * Indicates administrative region name. + * + * @type { ?string } + * @syscap SystemCapability.Location.Location.Geocoder + * @since 9 + */ + administrativeArea?: string; + /** + * Indicates sub-administrative region name. + * + * @type { ?string } + * @syscap SystemCapability.Location.Location.Geocoder + * @since 9 + */ + subAdministrativeArea?: string; + /** + * Indicates locality information. + * + * @type { ?string } + * @syscap SystemCapability.Location.Location.Geocoder + * @since 9 + */ + locality?: string; + /** + * Indicates sub-locality information. + * + * @type { ?string } + * @syscap SystemCapability.Location.Location.Geocoder + * @since 9 + */ + subLocality?: string; + /** + * Indicates road name. + * + * @type { ?string } + * @syscap SystemCapability.Location.Location.Geocoder + * @since 9 + */ + roadName?: string; + /** + * Indicates auxiliary road information. + * + * @type { ?string } + * @syscap SystemCapability.Location.Location.Geocoder + * @since 9 + */ + subRoadName?: string; + /** + * Indicates house information. + * + * @type { ?string } + * @syscap SystemCapability.Location.Location.Geocoder + * @since 9 + */ + premises?: string; + /** + * Indicates postal code. + * + * @type { ?string } + * @syscap SystemCapability.Location.Location.Geocoder + * @since 9 + */ + postalCode?: string; + /** + * Indicates phone number. + * + * @type { ?string } + * @syscap SystemCapability.Location.Location.Geocoder + * @since 9 + */ + phoneNumber?: string; + /** + * Indicates website URL. + * + * @type { ?string } + * @syscap SystemCapability.Location.Location.Geocoder + * @since 9 + */ + addressUrl?: string; + /** + * Indicates additional information. + * + * @type { ?Array } + * @syscap SystemCapability.Location.Location.Geocoder + * @since 9 + */ + descriptions?: Array; + /** + * Indicates the amount of additional descriptive information. + * + * @type { ?number } + * @syscap SystemCapability.Location.Location.Geocoder + * @since 9 + */ + descriptionsSize?: number; + } + /** + * Configuring parameters in location requests. + * + * @typedef LocationRequest + * @syscap SystemCapability.Location.Location.Core + * @since 9 + */ + /** + * Configuring parameters in location requests. + * + * @typedef LocationRequest + * @syscap SystemCapability.Location.Location.Core + * @atomicservice + * @since 11 + */ + export interface LocationRequest { + /** + * Priority of the location request. + * + * @type { ?LocationRequestPriority } + * @syscap SystemCapability.Location.Location.Core + * @since 9 + */ + /** + * Priority of the location request. + * + * @type { ?LocationRequestPriority } + * @syscap SystemCapability.Location.Location.Core + * @atomicservice + * @since 11 + */ + priority?: LocationRequestPriority; + /** + * User scenario of the location request. + * + * @type { ?LocationRequestScenario } + * @syscap SystemCapability.Location.Location.Core + * @since 9 + */ + /** + * User scenario of the location request. + * + * @type { ?LocationRequestScenario } + * @syscap SystemCapability.Location.Location.Core + * @atomicservice + * @since 11 + */ + scenario?: LocationRequestScenario; + /** + * Location report interval. + * + * @type { ?number } + * @syscap SystemCapability.Location.Location.Core + * @since 9 + */ + /** + * Location report interval. + * + * @type { ?number } + * @syscap SystemCapability.Location.Location.Core + * @atomicservice + * @since 11 + */ + timeInterval?: number; + /** + * Location report distance interval. + * + * @type { ?number } + * @syscap SystemCapability.Location.Location.Core + * @since 9 + */ + /** + * Location report distance interval. + * + * @type { ?number } + * @syscap SystemCapability.Location.Location.Core + * @atomicservice + * @since 11 + */ + distanceInterval?: number; + /** + * Accuracy requirements for reporting locations. + * + * @type { ?number } + * @syscap SystemCapability.Location.Location.Core + * @since 9 + */ + /** + * Accuracy requirements for reporting locations. + * + * @type { ?number } + * @syscap SystemCapability.Location.Location.Core + * @atomicservice + * @since 11 + */ + maxAccuracy?: number; + } + /** + * Configuring parameters in current location requests. + * + * @typedef CurrentLocationRequest + * @syscap SystemCapability.Location.Location.Core + * @since 9 + */ + /** + * Configuring parameters in current location requests. + * + * @typedef CurrentLocationRequest + * @syscap SystemCapability.Location.Location.Core + * @atomicservice + * @since 11 + */ + export interface CurrentLocationRequest { + /** + * Priority of the location request. + * + * @type { ?LocationRequestPriority } + * @syscap SystemCapability.Location.Location.Core + * @since 9 + */ + /** + * Priority of the location request. + * + * @type { ?LocationRequestPriority } + * @syscap SystemCapability.Location.Location.Core + * @atomicservice + * @since 11 + */ + priority?: LocationRequestPriority; + /** + * User scenario of the location request. + * + * @type { ?LocationRequestScenario } + * @syscap SystemCapability.Location.Location.Core + * @since 9 + */ + /** + * User scenario of the location request. + * + * @type { ?LocationRequestScenario } + * @syscap SystemCapability.Location.Location.Core + * @atomicservice + * @since 11 + */ + scenario?: LocationRequestScenario; + /** + * Accuracy requirements for reporting locations. + * + * @type { ?number } + * @syscap SystemCapability.Location.Location.Core + * @since 9 + */ + /** + * Accuracy requirements for reporting locations. + * + * @type { ?number } + * @syscap SystemCapability.Location.Location.Core + * @atomicservice + * @since 11 + */ + maxAccuracy?: number; + /** + * Timeout interval of a single location request. + * + * @type { ?number } + * @syscap SystemCapability.Location.Location.Core + * @since 9 + */ + /** + * Timeout interval of a single location request. + * + * @type { ?number } + * @syscap SystemCapability.Location.Location.Core + * @atomicservice + * @since 11 + */ + timeoutMs?: number; + } + /** + * Geofence transition status. + * + * @typedef GeofenceTransition + * @syscap SystemCapability.Location.Location.Geofence + * @since 12 + */ + export interface GeofenceTransition { + /** + * ID of the geofence. + * + * @type { number } + * @syscap SystemCapability.Location.Location.Geofence + * @since 12 + */ + geofenceId: number; + /** + * Indicates the geofence transition status. + * + * @type { GeofenceTransitionEvent } + * @syscap SystemCapability.Location.Location.Geofence + * @since 12 + */ + transitionEvent: GeofenceTransitionEvent; + } + /** + * Configuring parameters in continuous location requests. + * + * @typedef ContinuousLocationRequest + * @syscap SystemCapability.Location.Location.Core + * @atomicservice + * @since 12 + */ + export interface ContinuousLocationRequest { + /** + * Location report interval, in seconds. + * + * @type { number } + * @syscap SystemCapability.Location.Location.Core + * @atomicservice + * @since 12 + */ + interval: number; + /** + * Location scenario. You can select a user activity scenario or power consumption scenario. + * + * @type { UserActivityScenario | PowerConsumptionScenario } + * @syscap SystemCapability.Location.Location.Core + * @atomicservice + * @since 12 + */ + locationScenario: UserActivityScenario | PowerConsumptionScenario; + } + /** + * Configuring parameters in single location requests. + * + * @typedef SingleLocationRequest + * @syscap SystemCapability.Location.Location.Core + * @atomicservice + * @since 12 + */ + export interface SingleLocationRequest { + /** + * Priority of the location request. + * + * @type { LocatingPriority } + * @syscap SystemCapability.Location.Location.Core + * @atomicservice + * @since 12 + */ + locatingPriority: LocatingPriority; + /** + * Timeout of a single location request, in milliseconds. + * + * @type { number } + * @syscap SystemCapability.Location.Location.Core + * @atomicservice + * @since 12 + */ + locatingTimeoutMs: number; + } + /** + * Provides information about geographic locations. + * + * @typedef Location + * @syscap SystemCapability.Location.Location.Core + * @since 9 + */ + /** + * Provides information about geographic locations. + * + * @typedef Location + * @syscap SystemCapability.Location.Location.Core + * @atomicservice + * @since 11 + */ + export interface Location { + /** + * Indicates latitude information. + * A positive value indicates north latitude, + * and a negative value indicates south latitude. + * + * @type { number } + * @syscap SystemCapability.Location.Location.Core + * @since 9 + */ + /** + * Indicates latitude information. + * A positive value indicates north latitude, + * and a negative value indicates south latitude. + * + * @type { number } + * @syscap SystemCapability.Location.Location.Core + * @atomicservice + * @since 11 + */ + latitude: number; + /** + * Indicates Longitude information. + * A positive value indicates east longitude , + * and a negative value indicates west longitude. + * + * @type { number } + * @syscap SystemCapability.Location.Location.Core + * @since 9 + */ + /** + * Indicates Longitude information. + * A positive value indicates east longitude , + * and a negative value indicates west longitude. + * + * @type { number } + * @syscap SystemCapability.Location.Location.Core + * @atomicservice + * @since 11 + */ + longitude: number; + /** + * Indicates location altitude, in meters. + * + * @type { number } + * @syscap SystemCapability.Location.Location.Core + * @since 9 + */ + /** + * Indicates location altitude, in meters. + * + * @type { number } + * @syscap SystemCapability.Location.Location.Core + * @atomicservice + * @since 11 + */ + altitude: number; + /** + * Indicates location accuracy, in meters. + * + * @type { number } + * @syscap SystemCapability.Location.Location.Core + * @since 9 + */ + /** + * Indicates location accuracy, in meters. + * + * @type { number } + * @syscap SystemCapability.Location.Location.Core + * @atomicservice + * @since 11 + */ + accuracy: number; + /** + * Indicates speed, in m/s. + * + * @type { number } + * @syscap SystemCapability.Location.Location.Core + * @since 9 + */ + /** + * Indicates speed, in m/s. + * + * @type { number } + * @syscap SystemCapability.Location.Location.Core + * @atomicservice + * @since 11 + */ + speed: number; + /** + * Indicates location timestamp in the UTC format. + * + * @type { number } + * @syscap SystemCapability.Location.Location.Core + * @since 9 + */ + /** + * Indicates location timestamp in the UTC format. + * + * @type { number } + * @syscap SystemCapability.Location.Location.Core + * @atomicservice + * @since 11 + */ + timeStamp: number; + /** + * Indicates direction information. + * + * @type { number } + * @syscap SystemCapability.Location.Location.Core + * @since 9 + */ + /** + * Indicates direction information. + * + * @type { number } + * @syscap SystemCapability.Location.Location.Core + * @atomicservice + * @since 11 + */ + direction: number; + /** + * Indicates location timestamp since boot. + * + * @type { number } + * @syscap SystemCapability.Location.Location.Core + * @since 9 + */ + /** + * Indicates location timestamp since boot. + * + * @type { number } + * @syscap SystemCapability.Location.Location.Core + * @atomicservice + * @since 11 + */ + timeSinceBoot: number; + /** + * Indicates additional information. + * + * @type { ?Array } + * @syscap SystemCapability.Location.Location.Core + * @since 9 + */ + /** + * Indicates additional information. + * + * @type { ?Array } + * @syscap SystemCapability.Location.Location.Core + * @atomicservice + * @since 11 + */ + additions?: Array; + /** + * Indicates additional information map. + * + * @type { ?Map } + * @syscap SystemCapability.Location.Location.Core + * @atomicservice + * @since 12 + */ + additionsMap?: Map; + /** + * Indicates the amount of additional descriptive information. + * + * @type { ?number } + * @syscap SystemCapability.Location.Location.Core + * @since 9 + */ + /** + * Indicates the amount of additional descriptive information. + * + * @type { ?number } + * @syscap SystemCapability.Location.Location.Core + * @atomicservice + * @since 11 + */ + additionSize?: number; + /** + * Indicates vertical position accuracy in meters. + * + * @type { number } + * @syscap SystemCapability.Location.Location.Core + * @atomicservice + * @since 12 + */ + altitudeAccuracy: number; + /** + * Indicates speed accuracy in meter per seconds. + * + * @type { number } + * @syscap SystemCapability.Location.Location.Core + * @atomicservice + * @since 12 + */ + speedAccuracy: number; + /** + * Indicates direction accuracy in degrees. + * + * @type { number } + * @syscap SystemCapability.Location.Location.Core + * @atomicservice + * @since 12 + */ + directionAccuracy: number; + /** + * Time uncertainty Of timeSinceBoot in nanosecond. + * + * @type { number } + * @syscap SystemCapability.Location.Location.Core + * @atomicservice + * @since 12 + */ + uncertaintyOfTimeSinceBoot: number; + /** + * Indicates the source of the location. + * + * @type { LocationSourceType } + * @syscap SystemCapability.Location.Location.Core + * @atomicservice + * @since 12 + */ + sourceType: LocationSourceType; + } + /** + * Enum for the source of the location. + * + * @enum { number } + * @syscap SystemCapability.Location.Location.Core + * @atomicservice + * @since 12 + */ + export enum LocationSourceType { + /** + * The location is obtained from the GNSS. + * + * @syscap SystemCapability.Location.Location.Core + * @atomicservice + * @since 12 + */ + GNSS = 1, + /** + * The location comes from the network positioning technology. + * + * @syscap SystemCapability.Location.Location.Core + * @atomicservice + * @since 12 + */ + NETWORK = 2, + /** + * The location comes from the indoor positioning technology. + * + * @syscap SystemCapability.Location.Location.Core + * @atomicservice + * @since 12 + */ + INDOOR = 3, + /** + * The location comes from the GNSS RTK technology. + * + * @syscap SystemCapability.Location.Location.Core + * @atomicservice + * @since 12 + */ + RTK = 4 + } + /** + * Enum for coordinate system type. + * + * @enum { number } + * @syscap SystemCapability.Location.Location.Geofence + * @since 12 + */ + export enum CoordinateSystemType { + /** + * WGS84 coordinates system. + * + * @syscap SystemCapability.Location.Location.Geofence + * @since 12 + */ + WGS84 = 1, + /** + * GCJ-02 coordinates system. + * + * @syscap SystemCapability.Location.Location.Geofence + * @since 12 + */ + GCJ02 = 2 + } + /** + * Enum for location error code. + * + * @enum { number } + * @syscap SystemCapability.Location.Location.Core + * @atomicservice + * @since 12 + */ + export enum LocationError { + /** + * Default cause for location failure. + * + * @syscap SystemCapability.Location.Location.Core + * @atomicservice + * @since 12 + */ + LOCATING_FAILED_DEFAULT = -1, + /** + * Locating failed because the location permission fails to be verified. + * + * @syscap SystemCapability.Location.Location.Core + * @atomicservice + * @since 12 + */ + LOCATING_FAILED_LOCATION_PERMISSION_DENIED = -2, + /** + * Locating failed because the app is in the background and the background location permission verification failed. + * + * @syscap SystemCapability.Location.Location.Core + * @atomicservice + * @since 12 + */ + LOCATING_FAILED_BACKGROUND_PERMISSION_DENIED = -3, + /** + * Locating failed because the location switch is turned off. + * + * @syscap SystemCapability.Location.Location.Core + * @atomicservice + * @since 12 + */ + LOCATING_FAILED_LOCATION_SWITCH_OFF = -4, + /** + * Locating failed because internet access failure. + * + * @syscap SystemCapability.Location.Location.Core + * @atomicservice + * @since 12 + */ + LOCATING_FAILED_INTERNET_ACCESS_FAILURE = -5 + } + /** + * Enum for geofence transition status. + * + * @enum { number } + * @syscap SystemCapability.Location.Location.Geofence + * @since 12 + */ + export enum GeofenceTransitionEvent { + /** + * The device is within the geofence. + * + * @syscap SystemCapability.Location.Location.Geofence + * @since 12 + */ + GEOFENCE_TRANSITION_EVENT_ENTER = 1, + /** + * The device is out of the geofence. + * + * @syscap SystemCapability.Location.Location.Geofence + * @since 12 + */ + GEOFENCE_TRANSITION_EVENT_EXIT = 2, + /** + * The device is in the geographical fence for a period of time. + * + * @syscap SystemCapability.Location.Location.Geofence + * @since 12 + */ + GEOFENCE_TRANSITION_EVENT_DWELL = 4 + } + /** + * Enum for satellite constellation category. + * + * @enum { number } + * @syscap SystemCapability.Location.Location.Gnss + * @since 12 + */ + export enum SatelliteConstellationCategory { + /** + * Invalid value. + * + * @syscap SystemCapability.Location.Location.Gnss + * @since 12 + */ + CONSTELLATION_CATEGORY_UNKNOWN = 0, + /** + * GPS. + * + * @syscap SystemCapability.Location.Location.Gnss + * @since 12 + */ + CONSTELLATION_CATEGORY_GPS = 1, + /** + * SBAS. + * + * @syscap SystemCapability.Location.Location.Gnss + * @since 12 + */ + CONSTELLATION_CATEGORY_SBAS = 2, + /** + * GLONASS. + * + * @syscap SystemCapability.Location.Location.Gnss + * @since 12 + */ + CONSTELLATION_CATEGORY_GLONASS = 3, + /** + * QZSS. + * + * @syscap SystemCapability.Location.Location.Gnss + * @since 12 + */ + CONSTELLATION_CATEGORY_QZSS = 4, + /** + * BEIDOU. + * + * @syscap SystemCapability.Location.Location.Gnss + * @since 12 + */ + CONSTELLATION_CATEGORY_BEIDOU = 5, + /** + * GALILEO. + * + * @syscap SystemCapability.Location.Location.Gnss + * @since 12 + */ + CONSTELLATION_CATEGORY_GALILEO = 6, + /** + * IRNSS. + * + * @syscap SystemCapability.Location.Location.Gnss + * @since 12 + */ + CONSTELLATION_CATEGORY_IRNSS = 7 + } + /** + * Enum for satellite additional information. + * + * @enum { number } + * @syscap SystemCapability.Location.Location.Gnss + * @since 12 + */ + export enum SatelliteAdditionalInfo { + /** + * Default value. + * + * @syscap SystemCapability.Location.Location.Gnss + * @since 12 + */ + SATELLITES_ADDITIONAL_INFO_NULL = 0, + /** + * Ephemeris data exist. + * + * @syscap SystemCapability.Location.Location.Gnss + * @since 12 + */ + SATELLITES_ADDITIONAL_INFO_EPHEMERIS_DATA_EXIST = 1, + /** + * Almanac data exist. + * + * @syscap SystemCapability.Location.Location.Gnss + * @since 12 + */ + SATELLITES_ADDITIONAL_INFO_ALMANAC_DATA_EXIST = 2, + /** + * This satellite is being used in location fix. + * + * @syscap SystemCapability.Location.Location.Gnss + * @since 12 + */ + SATELLITES_ADDITIONAL_INFO_USED_IN_FIX = 4, + /** + * Carrier frequency exist. + * + * @syscap SystemCapability.Location.Location.Gnss + * @since 12 + */ + SATELLITES_ADDITIONAL_INFO_CARRIER_FREQUENCY_EXIST = 8 + } + /** + * Enum for user activity scenario. + * + * @enum { number } + * @syscap SystemCapability.Location.Location.Core + * @atomicservice + * @since 12 + */ + export enum UserActivityScenario { + /** + * Navigation scenario. High positioning precision and real-time performance are required. + * + * @syscap SystemCapability.Location.Location.Core + * @atomicservice + * @since 12 + */ + NAVIGATION = 0x401, + /** + * Sport scenario. High positioning precision is required. + * + * @syscap SystemCapability.Location.Location.Core + * @atomicservice + * @since 12 + */ + SPORT = 0x402, + /** + * Transport scenario. High positioning precision and real-time performance are required. + * + * @syscap SystemCapability.Location.Location.Core + * @atomicservice + * @since 12 + */ + TRANSPORT = 0x403, + /** + * Daily life scenarios. Low requirements on positioning precision. + * + * @syscap SystemCapability.Location.Location.Core + * @atomicservice + * @since 12 + */ + DAILY_LIFE_SERVICE = 0x404 + } + /** + * Enum for locating priority. + * + * @enum { number } + * @syscap SystemCapability.Location.Location.Core + * @atomicservice + * @since 12 + */ + export enum LocatingPriority { + /** + * Preferentially ensure the highest locating accuracy. + * + * @syscap SystemCapability.Location.Location.Core + * @atomicservice + * @since 12 + */ + PRIORITY_ACCURACY = 0x501, + /** + * Preferentially ensure the fastest locating speed. + * + * @syscap SystemCapability.Location.Location.Core + * @atomicservice + * @since 12 + */ + PRIORITY_LOCATING_SPEED = 0x502 + } + /** + * Enum for location priority. + * + * @enum { number } + * @syscap SystemCapability.Location.Location.Core + * @since 9 + */ + /** + * Enum for location priority. + * + * @enum { number } + * @syscap SystemCapability.Location.Location.Core + * @atomicservice + * @since 11 + */ + export enum LocationRequestPriority { + /** + * Default priority. + * + * @syscap SystemCapability.Location.Location.Core + * @since 9 + */ + /** + * Default priority. + * + * @syscap SystemCapability.Location.Location.Core + * @atomicservice + * @since 11 + */ + UNSET = 0x200, + /** + * Preferentially ensure the locating accuracy. + * + * @syscap SystemCapability.Location.Location.Core + * @since 9 + */ + /** + * Preferentially ensure the locating accuracy. + * + * @syscap SystemCapability.Location.Location.Core + * @atomicservice + * @since 11 + */ + ACCURACY, + /** + * Preferentially ensure low power consumption for locating. + * + * @syscap SystemCapability.Location.Location.Core + * @since 9 + */ + /** + * Preferentially ensure low power consumption for locating. + * + * @syscap SystemCapability.Location.Location.Core + * @atomicservice + * @since 11 + */ + LOW_POWER, + /** + * Preferentially ensure that the first location is time-consuming. + * + * @syscap SystemCapability.Location.Location.Core + * @since 9 + */ + /** + * Preferentially ensure that the first location is time-consuming. + * + * @syscap SystemCapability.Location.Location.Core + * @atomicservice + * @since 11 + */ + FIRST_FIX + } + /** + * Enum for location scenario. + * + * @enum { number } + * @syscap SystemCapability.Location.Location.Core + * @since 9 + */ + /** + * Enum for location scenario. + * + * @enum { number } + * @syscap SystemCapability.Location.Location.Core + * @atomicservice + * @since 11 + */ + export enum LocationRequestScenario { + /** + * Default scenario. + * + * @syscap SystemCapability.Location.Location.Core + * @since 9 + */ + /** + * Default scenario. + * + * @syscap SystemCapability.Location.Location.Core + * @atomicservice + * @since 11 + */ + UNSET = 0x300, + /** + * Navigation scenario. High positioning precision and real-time performance are required. + * + * @syscap SystemCapability.Location.Location.Core + * @since 9 + */ + /** + * Navigation scenario. High positioning precision and real-time performance are required. + * + * @syscap SystemCapability.Location.Location.Core + * @atomicservice + * @since 11 + */ + NAVIGATION, + /** + * Trajectory tracking scenario. High positioning precision is required. + * + * @syscap SystemCapability.Location.Location.Core + * @since 9 + */ + /** + * Trajectory tracking scenario. High positioning precision is required. + * + * @syscap SystemCapability.Location.Location.Core + * @atomicservice + * @since 11 + */ + TRAJECTORY_TRACKING, + /** + * Car hailing scenario. High positioning precision and real-time performance are required. + * + * @syscap SystemCapability.Location.Location.Core + * @since 9 + */ + /** + * Car hailing scenario. High positioning precision and real-time performance are required. + * + * @syscap SystemCapability.Location.Location.Core + * @atomicservice + * @since 11 + */ + CAR_HAILING, + /** + * Daily life scenarios. Low requirements on positioning precision and real-time performance. + * + * @syscap SystemCapability.Location.Location.Core + * @since 9 + */ + /** + * Daily life scenarios. Low requirements on positioning precision and real-time performance. + * + * @syscap SystemCapability.Location.Location.Core + * @atomicservice + * @since 11 + */ + DAILY_LIFE_SERVICE, + /** + * Power saving scenarios. + * + * @syscap SystemCapability.Location.Location.Core + * @since 9 + */ + /** + * Power saving scenarios. + * + * @syscap SystemCapability.Location.Location.Core + * @atomicservice + * @since 11 + */ + NO_POWER + } + /** + * Enum for power consumption scenario. + * + * @enum { number } + * @syscap SystemCapability.Location.Location.Core + * @atomicservice + * @since 12 + */ + export enum PowerConsumptionScenario { + /** + * High power consumption mode. + * + * @syscap SystemCapability.Location.Location.Core + * @atomicservice + * @since 12 + */ + HIGH_POWER_CONSUMPTION = 0x601, + /** + * Low power consumption mode. + * + * @syscap SystemCapability.Location.Location.Core + * @atomicservice + * @since 12 + */ + LOW_POWER_CONSUMPTION = 0x602, + /** + * Power saving scenarios. + * + * @syscap SystemCapability.Location.Location.Core + * @atomicservice + * @since 12 + */ + NO_POWER_CONSUMPTION = 0x603 + } + /** + * Location subsystem command structure. + * + * @typedef LocationCommand + * @syscap SystemCapability.Location.Location.Core + * @since 9 + */ + export interface LocationCommand { + /** + * Information about the scenario where the command is sent. + * + * @type { LocationRequestScenario } + * @syscap SystemCapability.Location.Location.Core + * @since 9 + */ + scenario: LocationRequestScenario; + /** + * Sent command content. + * + * @type { string } + * @syscap SystemCapability.Location.Location.Core + * @since 9 + */ + command: string; + } + /** + * Country code structure. + * + * @typedef CountryCode + * @syscap SystemCapability.Location.Location.Core + * @since 9 + */ + export interface CountryCode { + /** + * Country code character string. + * + * @type { string } + * @syscap SystemCapability.Location.Location.Core + * @since 9 + */ + country: string; + /** + * Country code source. + * + * @type { CountryCodeType } + * @syscap SystemCapability.Location.Location.Core + * @since 9 + */ + type: CountryCodeType; + } + /** + * Enum for country code type. + * + * @enum { number } + * @syscap SystemCapability.Location.Location.Core + * @since 9 + */ + export enum CountryCodeType { + /** + * Country code obtained from the locale setting. + * + * @syscap SystemCapability.Location.Location.Core + * @since 9 + */ + COUNTRY_CODE_FROM_LOCALE = 1, + /** + * Country code obtained from the SIM information. + * + * @syscap SystemCapability.Location.Location.Core + * @since 9 + */ + COUNTRY_CODE_FROM_SIM, + /** + * Query the country code information from the reverse geocoding result. + * + * @syscap SystemCapability.Location.Location.Core + * @since 9 + */ + COUNTRY_CODE_FROM_LOCATION, + /** + * Obtain the country code from the cell registration information. + * + * @syscap SystemCapability.Location.Location.Core + * @since 9 + */ + COUNTRY_CODE_FROM_NETWORK + } +} +export default geoLocationManager; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.geolocation.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.geolocation.d.ts new file mode 100755 index 00000000..8608c003 --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.geolocation.d.ts @@ -0,0 +1,1223 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit LocationKit + */ +import { AsyncCallback, Callback } from './@ohos.base'; +import { WantAgent } from './@ohos.wantAgent'; +/** + * Provides interfaces for initiating location requests, ending the location service, + * and obtaining the location result cached by the system. + * + * @namespace geolocation + * @permission ohos.permission.LOCATION + * @syscap SystemCapability.Location.Location.Core + * @since 7 + * @deprecated since 9 + */ +declare namespace geolocation { + /** + * Subscribe location changed + * + * @permission ohos.permission.LOCATION + * @param { 'locationChange' } type - Indicates the location service event to be subscribed to. + * @param { LocationRequest } request - Indicates the location request parameters. + * @param { Callback } callback - Indicates the callback for reporting the location result. + * @syscap SystemCapability.Location.Location.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.geoLocationManager/geoLocationManager.on#event:locationChange + */ + function on(type: 'locationChange', request: LocationRequest, callback: Callback): void; + /** + * Unsubscribe location changed + * + * @permission ohos.permission.LOCATION + * @param { 'locationChange' } type - Indicates the location service event to be subscribed to. + * @param { Callback } [callback] - Indicates the callback for reporting the location result. + * @syscap SystemCapability.Location.Location.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.geoLocationManager/geoLocationManager.off#event:locationChange + */ + function off(type: 'locationChange', callback?: Callback): void; + /** + * Subscribe location switch changed + * + * @permission ohos.permission.LOCATION + * @param { 'locationServiceState' } type - Indicates the location service event to be subscribed to. + * @param { Callback } callback - Indicates the callback for reporting the location result. + * @syscap SystemCapability.Location.Location.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.geoLocationManager/geoLocationManager.on#event:locationEnabledChange + */ + function on(type: 'locationServiceState', callback: Callback): void; + /** + * Unsubscribe location switch changed + * + * @permission ohos.permission.LOCATION + * @param { 'locationServiceState' } type - Indicates the location service event to be subscribed to. + * @param { Callback } [callback] - Indicates the callback for reporting the location result. + * @syscap SystemCapability.Location.Location.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.geoLocationManager/geoLocationManager.off#event:locationEnabledChange + */ + function off(type: 'locationServiceState', callback?: Callback): void; + /** + * Subscribe to cache GNSS locations update messages + * + * @permission ohos.permission.LOCATION + * @param { 'cachedGnssLocationsReporting' } type - Indicates the location service event to be subscribed to. + * @param { CachedGnssLocationsRequest } request - Indicates the cached GNSS locations request parameters. + * @param { Callback> } callback - Indicates the callback for reporting the cached GNSS locations. + * @syscap SystemCapability.Location.Location.Gnss + * @since 8 + * @deprecated since 9 + * @useinstead ohos.geoLocationManager/geoLocationManager.on#event:cachedGnssLocationsChange + */ + function on(type: 'cachedGnssLocationsReporting', request: CachedGnssLocationsRequest, callback: Callback>): void; + /** + * Unsubscribe to cache GNSS locations update messages + * + * @permission ohos.permission.LOCATION + * @param { 'cachedGnssLocationsReporting' } type - Indicates the location service event to be subscribed to. + * @param { Callback> } [callback] - Indicates the callback for reporting the cached gnss locations. + * @syscap SystemCapability.Location.Location.Gnss + * @since 8 + * @deprecated since 9 + * @useinstead ohos.geoLocationManager/geoLocationManager.off#event:cachedGnssLocationsChange + */ + function off(type: 'cachedGnssLocationsReporting', callback?: Callback>): void; + /** + * Subscribe gnss status changed + * + * @permission ohos.permission.LOCATION + * @param { 'gnssStatusChange' } type - Indicates the location service event to be subscribed to. + * @param { Callback } callback - Indicates the callback for reporting the gnss status change. + * @syscap SystemCapability.Location.Location.Gnss + * @since 8 + * @deprecated since 9 + * @useinstead ohos.geoLocationManager/geoLocationManager.on#event:satelliteStatusChange + */ + function on(type: 'gnssStatusChange', callback: Callback): void; + /** + * Unsubscribe gnss status changed + * + * @permission ohos.permission.LOCATION + * @param { 'gnssStatusChange' } type - Indicates the location service event to be subscribed to. + * @param { Callback } [callback] - Indicates the callback for reporting the gnss status change. + * @syscap SystemCapability.Location.Location.Gnss + * @since 8 + * @deprecated since 9 + * @useinstead ohos.geoLocationManager/geoLocationManager.off#event:satelliteStatusChange + */ + function off(type: 'gnssStatusChange', callback?: Callback): void; + /** + * Subscribe nmea message changed + * + * @permission ohos.permission.LOCATION + * @param { 'nmeaMessageChange' } type - Indicates the location service event to be subscribed to. + * @param { Callback } callback - Indicates the callback for reporting the nmea message. + * @syscap SystemCapability.Location.Location.Gnss + * @since 8 + * @deprecated since 9 + * @useinstead ohos.geoLocationManager/geoLocationManager.on#event:nmeaMessage + */ + function on(type: 'nmeaMessageChange', callback: Callback): void; + /** + * Unsubscribe nmea message changed + * + * @permission ohos.permission.LOCATION + * @param { 'nmeaMessageChange' } type - Indicates the location service event to be subscribed to. + * @param { Callback } [callback] - Indicates the callback for reporting the nmea message. + * @syscap SystemCapability.Location.Location.Gnss + * @since 8 + * @deprecated since 9 + * @useinstead ohos.geoLocationManager/geoLocationManager.off#event:nmeaMessage + */ + function off(type: 'nmeaMessageChange', callback?: Callback): void; + /** + * Add a geofence and subscribe geo fence status changed + * + * @permission ohos.permission.LOCATION + * @param { 'fenceStatusChange' } type - Indicates the location service event to be subscribed to. + * @param { GeofenceRequest } request - Indicates the Geo-fence configuration parameters. + * @param { WantAgent } want - Indicates which ability to start when the geofence event is triggered. + * @syscap SystemCapability.Location.Location.Geofence + * @since 8 + * @deprecated since 9 + * @useinstead ohos.geoLocationManager/geoLocationManager.on#event:gnssFenceStatusChange + */ + function on(type: 'fenceStatusChange', request: GeofenceRequest, want: WantAgent): void; + /** + * Remove a geofence and unsubscribe geo fence status changed + * + * @permission ohos.permission.LOCATION + * @param { 'fenceStatusChange' } type - Indicates the location service event to be subscribed to. + * @param { GeofenceRequest } request - Indicates the Geo-fence configuration parameters. + * @param { WantAgent } want - Indicates which ability to start when the geofence event is triggered. + * @syscap SystemCapability.Location.Location.Geofence + * @since 8 + * @deprecated since 9 + * @useinstead ohos.geoLocationManager/geoLocationManager.off#event:gnssFenceStatusChange + */ + function off(type: 'fenceStatusChange', request: GeofenceRequest, want: WantAgent): void; + /** + * Obtain current location + * + * @permission ohos.permission.LOCATION + * @param { CurrentLocationRequest } request - Indicates the location request parameters. + * @param { AsyncCallback } callback - Indicates the callback for reporting the location result. + * @syscap SystemCapability.Location.Location.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.geoLocationManager/geoLocationManager.getCurrentLocation + */ + function getCurrentLocation(request: CurrentLocationRequest, callback: AsyncCallback): void; + /** + * Obtain current location + * + * @permission ohos.permission.LOCATION + * @param { AsyncCallback } callback - Indicates the callback for reporting the location result. + * @syscap SystemCapability.Location.Location.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.geoLocationManager/geoLocationManager.getCurrentLocation + */ + function getCurrentLocation(callback: AsyncCallback): void; + /** + * Obtain current location + * + * @permission ohos.permission.LOCATION + * @param { CurrentLocationRequest } [request] - Indicates the location request parameters. + * @returns { Promise } The promise returned by the function. + * @syscap SystemCapability.Location.Location.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.geoLocationManager/geoLocationManager.getCurrentLocation + */ + function getCurrentLocation(request?: CurrentLocationRequest): Promise; + /** + * Obtain last known location + * + * @permission ohos.permission.LOCATION + * @param { AsyncCallback } callback - Indicates the callback for reporting the location result. + * @syscap SystemCapability.Location.Location.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.geoLocationManager/geoLocationManager.getLastLocation + */ + function getLastLocation(callback: AsyncCallback): void; + /** + * Obtain last known location + * + * @permission ohos.permission.LOCATION + * @returns { Promise } The promise returned by the function. + * @syscap SystemCapability.Location.Location.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.geoLocationManager/geoLocationManager.getLastLocation + */ + function getLastLocation(): Promise; + /** + * Obtain current location switch status + * + * @permission ohos.permission.LOCATION + * @param { AsyncCallback } callback - Indicates the callback for reporting the location switch result. + * @syscap SystemCapability.Location.Location.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.geoLocationManager/geoLocationManager.isLocationEnabled + */ + function isLocationEnabled(callback: AsyncCallback): void; + /** + * Obtain current location switch status + * + * @permission ohos.permission.LOCATION + * @returns { Promise } The promise returned by the function. + * @syscap SystemCapability.Location.Location.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.geoLocationManager/geoLocationManager.isLocationEnabled + */ + function isLocationEnabled(): Promise; + /** + * Request enable location + * + * @permission ohos.permission.LOCATION + * @param { AsyncCallback } callback - Indicates the callback for reporting the location switch status. + * @syscap SystemCapability.Location.Location.Core + * @since 7 + * @deprecated since 9 + */ + function requestEnableLocation(callback: AsyncCallback): void; + /** + * Request enable location + * + * @permission ohos.permission.LOCATION + * @returns { Promise } The promise returned by the function. + * @syscap SystemCapability.Location.Location.Core + * @since 7 + * @deprecated since 9 + */ + function requestEnableLocation(): Promise; + /** + * Obtain address info from location + * + * @permission ohos.permission.LOCATION + * @param { ReverseGeoCodeRequest } request - Indicates the reverse geocode query parameters. + * @param { AsyncCallback> } callback - Indicates the callback for reporting the address info. + * @syscap SystemCapability.Location.Location.Geocoder + * @since 7 + * @deprecated since 9 + * @useinstead ohos.geoLocationManager/geoLocationManager.getAddressesFromLocation + */ + function getAddressesFromLocation(request: ReverseGeoCodeRequest, callback: AsyncCallback>): void; + /** + * Obtain address info from location + * + * @permission ohos.permission.LOCATION + * @param { ReverseGeoCodeRequest } request - Indicates the reverse geocode query parameters. + * @returns { Promise> } The promise returned by the function. + * @syscap SystemCapability.Location.Location.Geocoder + * @since 7 + * @deprecated since 9 + * @useinstead ohos.geoLocationManager/geoLocationManager.getAddressesFromLocation + */ + function getAddressesFromLocation(request: ReverseGeoCodeRequest): Promise>; + /** + * Obtain latitude and longitude info from location address + * + * @permission ohos.permission.LOCATION + * @param { GeoCodeRequest } request - Indicates the geocode query parameters. + * @param { AsyncCallback> } callback - Indicates the callback for reporting the latitude and longitude result. + * @syscap SystemCapability.Location.Location.Geocoder + * @since 7 + * @deprecated since 9 + * @useinstead ohos.geoLocationManager/geoLocationManager.getAddressesFromLocationName + */ + function getAddressesFromLocationName(request: GeoCodeRequest, callback: AsyncCallback>): void; + /** + * Obtain latitude and longitude info from location address + * + * @permission ohos.permission.LOCATION + * @param { GeoCodeRequest } request - Indicates the geocode query parameters. + * @returns { Promise> } The promise returned by the function. + * @syscap SystemCapability.Location.Location.Geocoder + * @since 7 + * @deprecated since 9 + * @useinstead ohos.geoLocationManager/geoLocationManager.getAddressesFromLocationName + */ + function getAddressesFromLocationName(request: GeoCodeRequest): Promise>; + /** + * Obtain geocode service status + * + * @permission ohos.permission.LOCATION + * @param { AsyncCallback } callback - Indicates the callback for reporting the geocode service status. + * @syscap SystemCapability.Location.Location.Geocoder + * @since 7 + * @deprecated since 9 + * @useinstead ohos.geoLocationManager/geoLocationManager.isGeocoderAvailable + */ + function isGeoServiceAvailable(callback: AsyncCallback): void; + /** + * Obtain geocode service status + * + * @permission ohos.permission.LOCATION + * @returns { Promise } The promise returned by the function. + * @syscap SystemCapability.Location.Location.Geocoder + * @since 7 + * @deprecated since 9 + * @useinstead ohos.geoLocationManager/geoLocationManager.isGeocoderAvailable + */ + function isGeoServiceAvailable(): Promise; + /** + * Obtain the number of cached GNSS locations reported at a time + * + * @permission ohos.permission.LOCATION + * @param { AsyncCallback } callback - Indicates the callback for reporting the cached GNSS locations size. + * @syscap SystemCapability.Location.Location.Gnss + * @since 8 + * @deprecated since 9 + * @useinstead ohos.geoLocationManager/geoLocationManager.getCachedGnssLocationsSize + */ + function getCachedGnssLocationsSize(callback: AsyncCallback): void; + /** + * Obtain the number of cached GNSS locations reported at a time + * + * @permission ohos.permission.LOCATION + * @returns { Promise } The promise returned by the function. + * @syscap SystemCapability.Location.Location.Gnss + * @since 8 + * @deprecated since 9 + * @useinstead ohos.geoLocationManager/geoLocationManager.getCachedGnssLocationsSize + */ + function getCachedGnssLocationsSize(): Promise; + /** + * All prepared GNSS locations are returned to the application through the callback function, + * and the bottom-layer buffer is cleared. + * + * @permission ohos.permission.LOCATION + * @param { AsyncCallback } callback - Indicates the callback for reporting the result. + * @syscap SystemCapability.Location.Location.Gnss + * @since 8 + * @deprecated since 9 + * @useinstead ohos.geoLocationManager/geoLocationManager.flushCachedGnssLocations + */ + function flushCachedGnssLocations(callback: AsyncCallback): void; + /** + * All prepared GNSS locations are returned to the application through the callback function, + * and the bottom-layer buffer is cleared. + * + * @permission ohos.permission.LOCATION + * @returns { Promise } The promise returned by the function. + * @syscap SystemCapability.Location.Location.Gnss + * @since 8 + * @deprecated since 9 + * @useinstead ohos.geoLocationManager/geoLocationManager.flushCachedGnssLocations + */ + function flushCachedGnssLocations(): Promise; + /** + * Send extended commands to location subsystem. + * + * @permission ohos.permission.LOCATION + * @param { LocationCommand } command - Indicates the extended Command Message Body. + * @param { AsyncCallback } callback - Indicates the callback for reporting the send command result. + * @syscap SystemCapability.Location.Location.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.geoLocationManager/geoLocationManager.sendCommand + */ + function sendCommand(command: LocationCommand, callback: AsyncCallback): void; + /** + * Send extended commands to location subsystem. + * + * @permission ohos.permission.LOCATION + * @param { LocationCommand } command - Indicates the extended Command Message Body. + * @returns { Promise } The promise returned by the function. + * @syscap SystemCapability.Location.Location.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.geoLocationManager/geoLocationManager.sendCommand + */ + function sendCommand(command: LocationCommand): Promise; + /** + * Satellite status information + * + * @interface SatelliteStatusInfo + * @permission ohos.permission.LOCATION + * @syscap SystemCapability.Location.Location.Gnss + * @since 8 + * @deprecated since 9 + * @useinstead ohos.geoLocationManager/geoLocationManager.SatelliteStatusInfo + */ + export interface SatelliteStatusInfo { + /** + * @syscap SystemCapability.Location.Location.Gnss + * @since 8 + * @deprecated since 9 + */ + satellitesNumber: number; + /** + * @syscap SystemCapability.Location.Location.Gnss + * @since 8 + * @deprecated since 9 + */ + satelliteIds: Array; + /** + * @syscap SystemCapability.Location.Location.Gnss + * @since 8 + * @deprecated since 9 + */ + carrierToNoiseDensitys: Array; + /** + * @syscap SystemCapability.Location.Location.Gnss + * @since 8 + * @deprecated since 9 + */ + altitudes: Array; + /** + * @syscap SystemCapability.Location.Location.Gnss + * @since 8 + * @deprecated since 9 + */ + azimuths: Array; + /** + * @syscap SystemCapability.Location.Location.Gnss + * @since 8 + * @deprecated since 9 + */ + carrierFrequencies: Array; + } + /** + * Parameters for requesting to report cache location information + * + * @interface CachedGnssLocationsRequest + * @permission ohos.permission.LOCATION + * @syscap SystemCapability.Location.Location.Gnss + * @since 8 + * @deprecated since 9 + * @useinstead ohos.geoLocationManager/geoLocationManager.CachedGnssLocationsRequest + */ + export interface CachedGnssLocationsRequest { + /** + * @syscap SystemCapability.Location.Location.Gnss + * @since 8 + * @deprecated since 9 + */ + reportingPeriodSec: number; + /** + * @syscap SystemCapability.Location.Location.Gnss + * @since 8 + * @deprecated since 9 + */ + wakeUpCacheQueueFull: boolean; + } + /** + * Configuring parameters in geo fence requests + * + * @interface GeofenceRequest + * @permission ohos.permission.LOCATION + * @syscap SystemCapability.Location.Location.Geofence + * @since 8 + * @deprecated since 9 + * @useinstead ohos.geoLocationManager/geoLocationManager.GeofenceRequest + */ + export interface GeofenceRequest { + /** + * @syscap SystemCapability.Location.Location.Geofence + * @since 8 + * @deprecated since 9 + */ + priority: LocationRequestPriority; + /** + * @syscap SystemCapability.Location.Location.Geofence + * @since 8 + * @deprecated since 9 + */ + scenario: LocationRequestScenario; + /** + * @syscap SystemCapability.Location.Location.Geofence + * @since 8 + * @deprecated since 9 + */ + geofence: Geofence; + } + /** + * Configuring parameters in geo fence requests + * + * @interface Geofence + * @permission ohos.permission.LOCATION + * @syscap SystemCapability.Location.Location.Geofence + * @since 8 + * @deprecated since 9 + * @useinstead ohos.geoLocationManager/geoLocationManager.Geofence + */ + export interface Geofence { + /** + * @syscap SystemCapability.Location.Location.Geofence + * @since 8 + * @deprecated since 9 + */ + latitude: number; + /** + * @syscap SystemCapability.Location.Location.Geofence + * @since 8 + * @deprecated since 9 + */ + longitude: number; + /** + * @syscap SystemCapability.Location.Location.Geofence + * @since 8 + * @deprecated since 9 + */ + radius: number; + /** + * @syscap SystemCapability.Location.Location.Geofence + * @since 8 + * @deprecated since 9 + */ + expiration: number; + } + /** + * Configuring parameters in reverse geocode requests + * + * @interface ReverseGeoCodeRequest + * @permission ohos.permission.LOCATION + * @syscap SystemCapability.Location.Location.Geocoder + * @since 7 + * @deprecated since 9 + * @useinstead ohos.geoLocationManager/geoLocationManager.ReverseGeoCodeRequest + */ + export interface ReverseGeoCodeRequest { + /** + * @syscap SystemCapability.Location.Location.Geocoder + * @since 7 + * @deprecated since 9 + */ + locale?: string; + /** + * @syscap SystemCapability.Location.Location.Geocoder + * @since 7 + * @deprecated since 9 + */ + latitude: number; + /** + * @syscap SystemCapability.Location.Location.Geocoder + * @since 7 + * @deprecated since 9 + */ + longitude: number; + /** + * @syscap SystemCapability.Location.Location.Geocoder + * @since 7 + * @deprecated since 9 + */ + maxItems?: number; + } + /** + * Configuring parameters in geocode requests + * + * @interface GeoCodeRequest + * @permission ohos.permission.LOCATION + * @syscap SystemCapability.Location.Location.Geocoder + * @since 7 + * @deprecated since 9 + * @useinstead ohos.geoLocationManager/geoLocationManager.GeoCodeRequest + */ + export interface GeoCodeRequest { + /** + * @syscap SystemCapability.Location.Location.Geocoder + * @since 7 + * @deprecated since 9 + */ + locale?: string; + /** + * @syscap SystemCapability.Location.Location.Geocoder + * @since 7 + * @deprecated since 9 + */ + description: string; + /** + * @syscap SystemCapability.Location.Location.Geocoder + * @since 7 + * @deprecated since 9 + */ + maxItems?: number; + /** + * @syscap SystemCapability.Location.Location.Geocoder + * @since 7 + * @deprecated since 9 + */ + minLatitude?: number; + /** + * @syscap SystemCapability.Location.Location.Geocoder + * @since 7 + * @deprecated since 9 + */ + minLongitude?: number; + /** + * @syscap SystemCapability.Location.Location.Geocoder + * @since 7 + * @deprecated since 9 + */ + maxLatitude?: number; + /** + * @syscap SystemCapability.Location.Location.Geocoder + * @since 7 + * @deprecated since 9 + */ + maxLongitude?: number; + } + /** + * Data struct describes geographic locations. + * + * @interface GeoAddress + * @permission ohos.permission.LOCATION + * @syscap SystemCapability.Location.Location.Geocoder + * @since 7 + * @deprecated since 9 + * @useinstead ohos.geoLocationManager/geoLocationManager.GeoAddress + */ + export interface GeoAddress { + /** + * Indicates latitude information. + * A positive value indicates north latitude, + * and a negative value indicates south latitude. + * + * @permission ohos.permission.LOCATION + * @syscap SystemCapability.Location.Location.Geocoder + * @since 7 + * @deprecated since 9 + */ + latitude?: number; + /** + * Indicates longitude information. + * A positive value indicates east longitude , + * and a negative value indicates west longitude . + * + * @permission ohos.permission.LOCATION + * @syscap SystemCapability.Location.Location.Geocoder + * @since 7 + * @deprecated since 9 + */ + longitude?: number; + /** + * Indicates language used for the location description. + * zh indicates Chinese, and en indicates English. + * + * @permission ohos.permission.LOCATION + * @syscap SystemCapability.Location.Location.Geocoder + * @since 7 + * @deprecated since 9 + */ + locale?: string; + /** + * Indicates landmark of the location. + * + * @permission ohos.permission.LOCATION + * @syscap SystemCapability.Location.Location.Geocoder + * @since 7 + * @deprecated since 9 + */ + placeName?: string; + /** + * Indicates country code. + * + * @permission ohos.permission.LOCATION + * @syscap SystemCapability.Location.Location.Geocoder + * @since 7 + * @deprecated since 9 + */ + countryCode?: string; + /** + * Indicates country name. + * + * @permission ohos.permission.LOCATION + * @syscap SystemCapability.Location.Location.Geocoder + * @since 7 + * @deprecated since 9 + */ + countryName?: string; + /** + * Indicates administrative region name. + * + * @permission ohos.permission.LOCATION + * @syscap SystemCapability.Location.Location.Geocoder + * @since 7 + * @deprecated since 9 + */ + administrativeArea?: string; + /** + * Indicates sub-administrative region name. + * + * @permission ohos.permission.LOCATION + * @syscap SystemCapability.Location.Location.Geocoder + * @since 7 + * @deprecated since 9 + */ + subAdministrativeArea?: string; + /** + * Indicates locality information. + * + * @permission ohos.permission.LOCATION + * @syscap SystemCapability.Location.Location.Geocoder + * @since 7 + * @deprecated since 9 + */ + locality?: string; + /** + * Indicates sub-locality information. + * + * @permission ohos.permission.LOCATION + * @syscap SystemCapability.Location.Location.Geocoder + * @since 7 + * @deprecated since 9 + */ + subLocality?: string; + /** + * Indicates road name. + * + * @permission ohos.permission.LOCATION + * @syscap SystemCapability.Location.Location.Geocoder + * @since 7 + * @deprecated since 9 + */ + roadName?: string; + /** + * Indicates auxiliary road information. + * + * @permission ohos.permission.LOCATION + * @syscap SystemCapability.Location.Location.Geocoder + * @since 7 + * @deprecated since 9 + */ + subRoadName?: string; + /** + * Indicates house information. + * + * @permission ohos.permission.LOCATION + * @syscap SystemCapability.Location.Location.Geocoder + * @since 7 + * @deprecated since 9 + */ + premises?: string; + /** + * Indicates postal code. + * + * @permission ohos.permission.LOCATION + * @syscap SystemCapability.Location.Location.Geocoder + * @since 7 + * @deprecated since 9 + */ + postalCode?: string; + /** + * Indicates phone number. + * + * @permission ohos.permission.LOCATION + * @syscap SystemCapability.Location.Location.Geocoder + * @since 7 + * @deprecated since 9 + */ + phoneNumber?: string; + /** + * Indicates website URL. + * + * @permission ohos.permission.LOCATION + * @syscap SystemCapability.Location.Location.Geocoder + * @since 7 + * @deprecated since 9 + */ + addressUrl?: string; + /** + * Indicates additional information. + * + * @permission ohos.permission.LOCATION + * @syscap SystemCapability.Location.Location.Geocoder + * @since 7 + * @deprecated since 9 + */ + descriptions?: Array; + /** + * Indicates the amount of additional descriptive information. + * + * @permission ohos.permission.LOCATION + * @syscap SystemCapability.Location.Location.Geocoder + * @since 7 + * @deprecated since 9 + */ + descriptionsSize?: number; + } + /** + * Configuring parameters in location requests + * + * @interface LocationRequest + * @permission ohos.permission.LOCATION + * @syscap SystemCapability.Location.Location.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.geoLocationManager/geoLocationManager.LocationRequest + */ + export interface LocationRequest { + /** + * @syscap SystemCapability.Location.Location.Core + * @since 7 + * @deprecated since 9 + */ + priority?: LocationRequestPriority; + /** + * @syscap SystemCapability.Location.Location.Core + * @since 7 + * @deprecated since 9 + */ + scenario?: LocationRequestScenario; + /** + * @syscap SystemCapability.Location.Location.Core + * @since 7 + * @deprecated since 9 + */ + timeInterval?: number; + /** + * @syscap SystemCapability.Location.Location.Core + * @since 7 + * @deprecated since 9 + */ + distanceInterval?: number; + /** + * @syscap SystemCapability.Location.Location.Core + * @since 7 + * @deprecated since 9 + */ + maxAccuracy?: number; + } + /** + * Configuring parameters in current location requests + * + * @interface CurrentLocationRequest + * @permission ohos.permission.LOCATION + * @syscap SystemCapability.Location.Location.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.geoLocationManager/geoLocationManager.CurrentLocationRequest + */ + export interface CurrentLocationRequest { + /** + * @syscap SystemCapability.Location.Location.Core + * @since 7 + * @deprecated since 9 + */ + priority?: LocationRequestPriority; + /** + * @syscap SystemCapability.Location.Location.Core + * @since 7 + * @deprecated since 9 + */ + scenario?: LocationRequestScenario; + /** + * @syscap SystemCapability.Location.Location.Core + * @since 7 + * @deprecated since 9 + */ + maxAccuracy?: number; + /** + * @syscap SystemCapability.Location.Location.Core + * @since 7 + * @deprecated since 9 + */ + timeoutMs?: number; + } + /** + * Provides information about geographic locations + * + * @interface Location + * @permission ohos.permission.LOCATION + * @syscap SystemCapability.Location.Location.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.geoLocationManager/geoLocationManager.Location + */ + export interface Location { + /** + * Indicates latitude information. + * A positive value indicates north latitude, + * and a negative value indicates south latitude. + * + * @permission ohos.permission.LOCATION + * @syscap SystemCapability.Location.Location.Core + * @since 7 + * @deprecated since 9 + */ + latitude: number; + /** + * Indicates Longitude information. + * A positive value indicates east longitude , + * and a negative value indicates west longitude . + * + * @permission ohos.permission.LOCATION + * @syscap SystemCapability.Location.Location.Core + * @since 7 + * @deprecated since 9 + */ + longitude: number; + /** + * Indicates location altitude, in meters. + * + * @permission ohos.permission.LOCATION + * @syscap SystemCapability.Location.Location.Core + * @since 7 + * @deprecated since 9 + */ + altitude: number; + /** + * Indicates location accuracy, in meters. + * + * @permission ohos.permission.LOCATION + * @syscap SystemCapability.Location.Location.Core + * @since 7 + * @deprecated since 9 + */ + accuracy: number; + /** + * Indicates speed, in m/s. + * + * @permission ohos.permission.LOCATION + * @syscap SystemCapability.Location.Location.Core + * @since 7 + * @deprecated since 9 + */ + speed: number; + /** + * Indicates location timestamp in the UTC format. + * + * @permission ohos.permission.LOCATION + * @syscap SystemCapability.Location.Location.Core + * @since 7 + * @deprecated since 9 + */ + timeStamp: number; + /** + * Indicates direction information. + * + * @permission ohos.permission.LOCATION + * @syscap SystemCapability.Location.Location.Core + * @since 7 + * @deprecated since 9 + */ + direction: number; + /** + * Indicates location timestamp since boot. + * + * @permission ohos.permission.LOCATION + * @syscap SystemCapability.Location.Location.Core + * @since 7 + * @deprecated since 9 + */ + timeSinceBoot: number; + /** + * Indicates additional information. + * + * @permission ohos.permission.LOCATION + * @syscap SystemCapability.Location.Location.Core + * @since 7 + * @deprecated since 9 + */ + additions?: Array; + /** + * Indicates the amount of additional descriptive information. + * + * @permission ohos.permission.LOCATION + * @syscap SystemCapability.Location.Location.Core + * @since 7 + * @deprecated since 9 + */ + additionSize?: number; + } + /** + * Enum for location priority + * + * @permission ohos.permission.LOCATION + * @enum { number } + * @syscap SystemCapability.Location.Location.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.geoLocationManager/geoLocationManager.LocationRequestPriority + */ + export enum LocationRequestPriority { + /** + * @syscap SystemCapability.Location.Location.Core + * @since 7 + * @deprecated since 9 + */ + UNSET = 0x200, + /** + * @syscap SystemCapability.Location.Location.Core + * @since 7 + * @deprecated since 9 + */ + ACCURACY, + /** + * @syscap SystemCapability.Location.Location.Core + * @since 7 + * @deprecated since 9 + */ + LOW_POWER, + /** + * @syscap SystemCapability.Location.Location.Core + * @since 7 + * @deprecated since 9 + */ + FIRST_FIX + } + /** + * Enum for location scenario + * + * @permission ohos.permission.LOCATION + * @enum { number } + * @syscap SystemCapability.Location.Location.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.geoLocationManager/geoLocationManager.LocationRequestScenario + */ + export enum LocationRequestScenario { + /** + * @syscap SystemCapability.Location.Location.Core + * @since 7 + * @deprecated since 9 + */ + UNSET = 0x300, + /** + * @syscap SystemCapability.Location.Location.Core + * @since 7 + * @deprecated since 9 + */ + NAVIGATION, + /** + * @syscap SystemCapability.Location.Location.Core + * @since 7 + * @deprecated since 9 + */ + TRAJECTORY_TRACKING, + /** + * @syscap SystemCapability.Location.Location.Core + * @since 7 + * @deprecated since 9 + */ + CAR_HAILING, + /** + * @syscap SystemCapability.Location.Location.Core + * @since 7 + * @deprecated since 9 + */ + DAILY_LIFE_SERVICE, + /** + * @syscap SystemCapability.Location.Location.Core + * @since 7 + * @deprecated since 9 + */ + NO_POWER + } + /** + * Enum for error code + * + * @permission ohos.permission.LOCATION + * @enum { number } + * @syscap SystemCapability.Location.Location.Core + * @since 7 + * @deprecated since 9 + */ + export enum GeoLocationErrorCode { + /** + * Indicates input parameter error. + * + * @permission ohos.permission.LOCATION + * @syscap SystemCapability.Location.Location.Core + * @since 7 + * @deprecated since 9 + */ + INPUT_PARAMS_ERROR, + /** + * Indicates reverse geocode query failed. + * + * @permission ohos.permission.LOCATION + * @syscap SystemCapability.Location.Location.Core + * @since 7 + * @deprecated since 9 + */ + REVERSE_GEOCODE_ERROR, + /** + * Indicates geocode query failed. + * + * @permission ohos.permission.LOCATION + * @syscap SystemCapability.Location.Location.Core + * @since 7 + * @deprecated since 9 + */ + GEOCODE_ERROR, + /** + * Indicates positioning failed. + * + * @permission ohos.permission.LOCATION + * @syscap SystemCapability.Location.Location.Core + * @since 7 + * @deprecated since 9 + */ + LOCATOR_ERROR, + /** + * Indicates operation failure caused by abnormal location switch. + * + * @permission ohos.permission.LOCATION + * @syscap SystemCapability.Location.Location.Core + * @since 7 + * @deprecated since 9 + */ + LOCATION_SWITCH_ERROR, + /** + * Indicates failed to get the last known location. + * + * @permission ohos.permission.LOCATION + * @syscap SystemCapability.Location.Location.Core + * @since 7 + * @deprecated since 9 + */ + LAST_KNOWN_LOCATION_ERROR, + /** + * Indicates location request timeout. + * + * @permission ohos.permission.LOCATION + * @syscap SystemCapability.Location.Location.Core + * @since 7 + * @deprecated since 9 + */ + LOCATION_REQUEST_TIMEOUT_ERROR + } + /** + * Enum for location privacy type + * + * @permission ohos.permission.LOCATION + * @enum { number } + * @syscap SystemCapability.Location.Location.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.geoLocationManager/geoLocationManager.LocationPrivacyType + */ + export enum LocationPrivacyType { + /** + * @syscap SystemCapability.Location.Location.Core + * @since 8 + * @deprecated since 9 + */ + OTHERS = 0, + /** + * @syscap SystemCapability.Location.Location.Core + * @since 8 + * @deprecated since 9 + */ + STARTUP, + /** + * @syscap SystemCapability.Location.Location.Core + * @since 8 + * @deprecated since 9 + */ + CORE_LOCATION + } + /** + * Location subsystem command structure + * + * @interface LocationCommand + * @permission ohos.permission.LOCATION + * @syscap SystemCapability.Location.Location.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.geoLocationManager/geoLocationManager.LocationCommand + */ + export interface LocationCommand { + /** + * @syscap SystemCapability.Location.Location.Core + * @since 8 + * @deprecated since 9 + */ + scenario: LocationRequestScenario; + /** + * @syscap SystemCapability.Location.Location.Core + * @since 8 + * @deprecated since 9 + */ + command: string; + } +} +export default geolocation; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.graphics.colorSpaceManager.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.graphics.colorSpaceManager.d.ts new file mode 100755 index 00000000..944096d3 --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.graphics.colorSpaceManager.d.ts @@ -0,0 +1,521 @@ +/* +* Copyright (C) 2022-2023 Huawei Device Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +/** + * @file + * @kit ArkGraphics2D + */ +/** + * Color space manager. + * + * @namespace colorSpaceManager + * @syscap SystemCapability.Graphic.Graphic2D.ColorManager.Core + * @since 9 + */ +/** + * Color space manager. + * + * @namespace colorSpaceManager + * @syscap SystemCapability.Graphic.Graphic2D.ColorManager.Core + * @crossplatform + * @since 11 + */ +declare namespace colorSpaceManager { + /** + * Enumerates color space types. + * @enum { number } ColorSpace + * @syscap SystemCapability.Graphic.Graphic2D.ColorManager.Core + * @since 9 + */ + /** + * Enumerates color space types. + * @enum { number } ColorSpace + * @syscap SystemCapability.Graphic.Graphic2D.ColorManager.Core + * @crossplatform + * @since 11 + */ + enum ColorSpace { + /** + * Indicates an unknown color space. + * @syscap SystemCapability.Graphic.Graphic2D.ColorManager.Core + * @since 9 + */ + /** + * Indicates an unknown color space. + * @syscap SystemCapability.Graphic.Graphic2D.ColorManager.Core + * @crossplatform + * @since 11 + */ + UNKNOWN = 0, + /** + * Indicates the color space based on Adobe RGB (1998). + * @syscap SystemCapability.Graphic.Graphic2D.ColorManager.Core + * @since 9 + */ + /** + * Indicates the color space based on Adobe RGB (1998). + * @syscap SystemCapability.Graphic.Graphic2D.ColorManager.Core + * @crossplatform + * @since 11 + */ + ADOBE_RGB_1998 = 1, + /** + * Indicates the color space based on SMPTE RP 431-2-2007 and IEC 61966-2.1:1999. + * @syscap SystemCapability.Graphic.Graphic2D.ColorManager.Core + * @since 9 + */ + /** + * Indicates the color space based on SMPTE RP 431-2-2007 and IEC 61966-2.1:1999. + * @syscap SystemCapability.Graphic.Graphic2D.ColorManager.Core + * @crossplatform + * @since 11 + */ + DCI_P3 = 2, + /** + * Indicates the color space based on SMPTE RP 431-2-2007 and IEC 61966-2.1:1999. + * @syscap SystemCapability.Graphic.Graphic2D.ColorManager.Core + * @since 9 + */ + /** + * Indicates the color space based on SMPTE RP 431-2-2007 and IEC 61966-2.1:1999. + * @syscap SystemCapability.Graphic.Graphic2D.ColorManager.Core + * @crossplatform + * @since 11 + */ + DISPLAY_P3 = 3, + /** + * Indicates the standard red green blue (SRGB) color space based on IEC 61966-2.1:1999. + * @syscap SystemCapability.Graphic.Graphic2D.ColorManager.Core + * @since 9 + */ + /** + * Indicates the standard red green blue (SRGB) color space based on IEC 61966-2.1:1999. + * @syscap SystemCapability.Graphic.Graphic2D.ColorManager.Core + * @crossplatform + * @since 11 + */ + SRGB = 4, + /** + * Indicates the color space based on ITU-R BT.709. + * PRIMARIES_BT709 | TRANSFUNC_BT709 | RANGE_FULL + * @syscap SystemCapability.Graphic.Graphic2D.ColorManager.Core + * @crossplatform + * @since 11 + */ + BT709 = 6, + /** + * Indicates the color space based on ITU-R BT.601. + * PRIMARIES_BT601_P | TRANSFUNC_BT709 | RANGE_FULL + * @syscap SystemCapability.Graphic.Graphic2D.ColorManager.Core + * @crossplatform + * @since 11 + */ + BT601_EBU = 7, + /** + * Indicates the color space based on ITU-R BT.601. + * PRIMARIES_BT601_N | TRANSFUNC_BT709 | RANGE_FULL + * @syscap SystemCapability.Graphic.Graphic2D.ColorManager.Core + * @crossplatform + * @since 11 + */ + BT601_SMPTE_C = 8, + /** + * Indicates the color space based on ITU-R BT.2020. + * PRIMARIES_BT2020 | TRANSFUNC_HLG | RANGE_FULL + * @syscap SystemCapability.Graphic.Graphic2D.ColorManager.Core + * @crossplatform + * @since 11 + */ + BT2020_HLG = 9, + /** + * Indicates the color space based on ITU-R BT.2020. + * PRIMARIES_BT2020 | TRANSFUNC_PQ | RANGE_FULL + * @syscap SystemCapability.Graphic.Graphic2D.ColorManager.Core + * @crossplatform + * @since 11 + */ + BT2020_PQ = 10, + /** + * PRIMARIES_P3_D65 | TRANSFUNC_HLG | RANGE_FULL + * @syscap SystemCapability.Graphic.Graphic2D.ColorManager.Core + * @crossplatform + * @since 11 + */ + P3_HLG = 11, + /** + * PRIMARIES_P3_D65 | TRANSFUNC_PQ | RANGE_FULL + * @syscap SystemCapability.Graphic.Graphic2D.ColorManager.Core + * @crossplatform + * @since 11 + */ + P3_PQ = 12, + /** + * PRIMARIES_ADOBE_RGB | TRANSFUNC_ADOBE_RGB | RANGE_LIMIT + * @syscap SystemCapability.Graphic.Graphic2D.ColorManager.Core + * @crossplatform + * @since 11 + */ + ADOBE_RGB_1998_LIMIT = 13, + /** + * PRIMARIES_P3_D65 | TRANSFUNC_SRGB | RANGE_LIMIT + * @syscap SystemCapability.Graphic.Graphic2D.ColorManager.Core + * @crossplatform + * @since 11 + */ + DISPLAY_P3_LIMIT = 14, + /** + * PRIMARIES_SRGB | TRANSFUNC_SRGB | RANGE_LIMIT + * @syscap SystemCapability.Graphic.Graphic2D.ColorManager.Core + * @crossplatform + * @since 11 + */ + SRGB_LIMIT = 15, + /** + * PRIMARIES_BT709 | TRANSFUNC_BT709 | RANGE_LIMIT + * @syscap SystemCapability.Graphic.Graphic2D.ColorManager.Core + * @crossplatform + * @since 11 + */ + BT709_LIMIT = 16, + /** + * PRIMARIES_BT601_P | TRANSFUNC_BT709 | RANGE_LIMIT + * @syscap SystemCapability.Graphic.Graphic2D.ColorManager.Core + * @crossplatform + * @since 11 + */ + BT601_EBU_LIMIT = 17, + /** + * PRIMARIES_BT601_N | TRANSFUNC_BT709 | RANGE_LIMIT + * @syscap SystemCapability.Graphic.Graphic2D.ColorManager.Core + * @crossplatform + * @since 11 + */ + BT601_SMPTE_C_LIMIT = 18, + /** + * PRIMARIES_BT2020 | TRANSFUNC_HLG | RANGE_LIMIT + * @syscap SystemCapability.Graphic.Graphic2D.ColorManager.Core + * @crossplatform + * @since 11 + */ + BT2020_HLG_LIMIT = 19, + /** + * PRIMARIES_BT2020 | TRANSFUNC_PQ | RANGE_LIMIT + * @syscap SystemCapability.Graphic.Graphic2D.ColorManager.Core + * @crossplatform + * @since 11 + */ + BT2020_PQ_LIMIT = 20, + /** + * PRIMARIES_P3_D65 | TRANSFUNC_HLG | RANGE_LIMIT + * @syscap SystemCapability.Graphic.Graphic2D.ColorManager.Core + * @crossplatform + * @since 11 + */ + P3_HLG_LIMIT = 21, + /** + * PRIMARIES_P3_D65 | TRANSFUNC_PQ | RANGE_LIMIT + * @syscap SystemCapability.Graphic.Graphic2D.ColorManager.Core + * @crossplatform + * @since 11 + */ + P3_PQ_LIMIT = 22, + /** + * PRIMARIES_P3_D65 | TRANSFUNC_LINEAR + * @syscap SystemCapability.Graphic.Graphic2D.ColorManager.Core + * @crossplatform + * @since 11 + */ + LINEAR_P3 = 23, + /** + * PRIMARIES_SRGB | TRANSFUNC_LINEAR + * @syscap SystemCapability.Graphic.Graphic2D.ColorManager.Core + * @crossplatform + * @since 11 + */ + LINEAR_SRGB = 24, + /** + * PRIMARIES_BT709 | TRANSFUNC_LINEAR + * @syscap SystemCapability.Graphic.Graphic2D.ColorManager.Core + * @crossplatform + * @since 11 + */ + LINEAR_BT709 = LINEAR_SRGB, + /** + * PRIMARIES_BT2020 | TRANSFUNC_LINEAR + * @syscap SystemCapability.Graphic.Graphic2D.ColorManager.Core + * @crossplatform + * @since 11 + */ + LINEAR_BT2020 = 25, + /** + * PRIMARIES_SRGB | TRANSFUNC_SRGB | RANGE_FULL + * @syscap SystemCapability.Graphic.Graphic2D.ColorManager.Core + * @crossplatform + * @since 11 + */ + DISPLAY_SRGB = SRGB, + /** + * PRIMARIES_P3_D65 | TRANSFUNC_SRGB | RANGE_FULL + * @syscap SystemCapability.Graphic.Graphic2D.ColorManager.Core + * @crossplatform + * @since 11 + */ + DISPLAY_P3_SRGB = DISPLAY_P3, + /** + * PRIMARIES_P3_D65 | TRANSFUNC_HLG | RANGE_FULL + * @syscap SystemCapability.Graphic.Graphic2D.ColorManager.Core + * @crossplatform + * @since 11 + */ + DISPLAY_P3_HLG = P3_HLG, + /** + * PRIMARIES_DISPLAY_P3 | TRANSFUNC_PQ | RANGE_FULL + * @syscap SystemCapability.Graphic.Graphic2D.ColorManager.Core + * @crossplatform + * @since 11 + */ + DISPLAY_P3_PQ = P3_PQ, + /** + * Indicates a customized color space. + * @syscap SystemCapability.Graphic.Graphic2D.ColorManager.Core + * @since 9 + */ + /** + * Indicates a customized color space. + * @syscap SystemCapability.Graphic.Graphic2D.ColorManager.Core + * @crossplatform + * @since 11 + */ + CUSTOM = 5 + } + /** + * Describes the primary colors red, green, blue and white point coordinated as (x, y) + * in color space, in terms of real world chromaticities. + * @typedef ColorSpacePrimaries + * @syscap SystemCapability.Graphic.Graphic2D.ColorManager.Core + * @since 9 + */ + /** + * Describes the primary colors red, green, blue and white point coordinated as (x, y) + * in color space, in terms of real world chromaticities. + * @typedef ColorSpacePrimaries + * @syscap SystemCapability.Graphic.Graphic2D.ColorManager.Core + * @crossplatform + * @since 11 + */ + interface ColorSpacePrimaries { + /** + * Coordinate value x of red color + * @syscap SystemCapability.Graphic.Graphic2D.ColorManager.Core + * @since 9 + */ + /** + * Coordinate value x of red color + * @syscap SystemCapability.Graphic.Graphic2D.ColorManager.Core + * @crossplatform + * @since 11 + */ + redX: number; + /** + * Coordinate value y of red color + * @syscap SystemCapability.Graphic.Graphic2D.ColorManager.Core + * @since 9 + */ + /** + * Coordinate value y of red color + * @syscap SystemCapability.Graphic.Graphic2D.ColorManager.Core + * @crossplatform + * @since 11 + */ + redY: number; + /** + * Coordinate value x of green color + * @syscap SystemCapability.Graphic.Graphic2D.ColorManager.Core + * @since 9 + */ + /** + * Coordinate value x of green color + * @syscap SystemCapability.Graphic.Graphic2D.ColorManager.Core + * @crossplatform + * @since 11 + */ + greenX: number; + /** + * Coordinate value y of green color + * @syscap SystemCapability.Graphic.Graphic2D.ColorManager.Core + * @since 9 + */ + /** + * Coordinate value y of green color + * @syscap SystemCapability.Graphic.Graphic2D.ColorManager.Core + * @crossplatform + * @since 11 + */ + greenY: number; + /** + * Coordinate value x of blue color + * @syscap SystemCapability.Graphic.Graphic2D.ColorManager.Core + * @since 9 + */ + /** + * Coordinate value x of blue color + * @syscap SystemCapability.Graphic.Graphic2D.ColorManager.Core + * @crossplatform + * @since 11 + */ + blueX: number; + /** + * Coordinate value y of blue color + * @syscap SystemCapability.Graphic.Graphic2D.ColorManager.Core + * @since 9 + */ + /** + * Coordinate value y of blue color + * @syscap SystemCapability.Graphic.Graphic2D.ColorManager.Core + * @crossplatform + * @since 11 + */ + blueY: number; + /** + * Coordinate value x of white point + * @syscap SystemCapability.Graphic.Graphic2D.ColorManager.Core + * @since 9 + */ + /** + * Coordinate value x of white point + * @syscap SystemCapability.Graphic.Graphic2D.ColorManager.Core + * @crossplatform + * @since 11 + */ + whitePointX: number; + /** + * Coordinate value y of white point + * @syscap SystemCapability.Graphic.Graphic2D.ColorManager.Core + * @since 9 + */ + /** + * Coordinate value y of white point + * @syscap SystemCapability.Graphic.Graphic2D.ColorManager.Core + * @crossplatform + * @since 11 + */ + whitePointY: number; + } + /** + * Defines a color space object and manages its key information + * @interface ColorSpaceManager + * @syscap SystemCapability.Graphic.Graphic2D.ColorManager.Core + * @since 9 + */ + /** + * Defines a color space object and manages its key information + * @interface ColorSpaceManager + * @syscap SystemCapability.Graphic.Graphic2D.ColorManager.Core + * @crossplatform + * @since 11 + */ + interface ColorSpaceManager { + /** + * Get the name of color space type. + * @returns { ColorSpace } Returns the name of color space type. + * @throws { BusinessError } 18600001 - Parameter value is abnormal. + * @syscap SystemCapability.Graphic.Graphic2D.ColorManager.Core + * @since 9 + */ + /** + * Get the name of color space type. + * @returns { ColorSpace } Returns the name of color space type. + * @throws { BusinessError } 18600001 - Parameter value is abnormal. + * @syscap SystemCapability.Graphic.Graphic2D.ColorManager.Core + * @crossplatform + * @since 11 + */ + getColorSpaceName(): ColorSpace; + /** + * Get white point(x, y) of color space. + * @returns { Array } Returns the white point value of color space. + * @throws { BusinessError } 18600001 - Parameter value is abnormal. + * @syscap SystemCapability.Graphic.Graphic2D.ColorManager.Core + * @since 9 + */ + /** + * Get white point(x, y) of color space. + * @returns { Array } Returns the white point value of color space. + * @throws { BusinessError } 18600001 - Parameter value is abnormal. + * @syscap SystemCapability.Graphic.Graphic2D.ColorManager.Core + * @crossplatform + * @since 11 + */ + getWhitePoint(): Array; + /** + * Get gamma value of color space. + * @returns { number } Returns the gamma value of color space. + * @throws { BusinessError } 18600001 - Parameter value is abnormal. + * @syscap SystemCapability.Graphic.Graphic2D.ColorManager.Core + * @since 9 + */ + /** + * Get gamma value of color space. + * @returns { number } Returns the gamma value of color space. + * @throws { BusinessError } 18600001 - Parameter value is abnormal. + * @syscap SystemCapability.Graphic.Graphic2D.ColorManager.Core + * @crossplatform + * @since 11 + */ + getGamma(): number; + } + /** + * Create a color space manager by provided color space type. + * @param { ColorSpace } colorSpaceName - Indicates the type of color space + * @returns { ColorSpaceManager } Returns a color space manager object created by provided type. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 18600001 - Parameter value is abnormal. + * @syscap SystemCapability.Graphic.Graphic2D.ColorManager.Core + * @since 9 + */ + /** + * Create a color space manager by provided color space type. + * @param { ColorSpace } colorSpaceName - Indicates the type of color space + * @returns { ColorSpaceManager } Returns a color space manager object created by provided type. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 18600001 - Parameter value is abnormal. + * @syscap SystemCapability.Graphic.Graphic2D.ColorManager.Core + * @crossplatform + * @since 11 + */ + function create(colorSpaceName: ColorSpace): ColorSpaceManager; + /** + * Create a customized color space manager by its color primaries and gamma value + * @param { ColorSpacePrimaries } primaries - Indicates the customized color primaries + * @param { number } gamma - Indicates display gamma value + * @returns { ColorSpaceManager } Returns a color space manager object created by customized parameters. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 18600001 - Parameter value is abnormal. + * @syscap SystemCapability.Graphic.Graphic2D.ColorManager.Core + * @since 9 + */ + /** + * Create a customized color space manager by its color primaries and gamma value + * @param { ColorSpacePrimaries } primaries - Indicates the customized color primaries + * @param { number } gamma - Indicates display gamma value + * @returns { ColorSpaceManager } Returns a color space manager object created by customized parameters. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 18600001 - Parameter value is abnormal. + * @syscap SystemCapability.Graphic.Graphic2D.ColorManager.Core + * @crossplatform + * @since 11 + */ + function create(primaries: ColorSpacePrimaries, gamma: number): ColorSpaceManager; +} +export default colorSpaceManager; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.graphics.common2D.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.graphics.common2D.d.ts new file mode 100755 index 00000000..ac57127b --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.graphics.common2D.d.ts @@ -0,0 +1,122 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit ArkGraphics2D + */ +/** + * The date structure that provides the basis for graphics. + * + * @namespace common2D + * @syscap SystemCapability.Graphics.Drawing + * @since 11 + */ +declare namespace common2D { + /** + * Provide a description in the form of color ARGB. + * @typedef Color + * @syscap SystemCapability.Graphics.Drawing + * @since 11 + */ + interface Color { + /** + * Alpha component of color, from 0 to 255. + * @type { number } + * @syscap SystemCapability.Graphics.Drawing + * @since 11 + */ + alpha: number; + /** + * Red component of color, from 0 to 255. + * @type { number } + * @syscap SystemCapability.Graphics.Drawing + * @since 11 + */ + red: number; + /** + * Green component of color, from 0 to 255. + * @type { number } + * @syscap SystemCapability.Graphics.Drawing + * @since 11 + */ + green: number; + /** + * Blue component of color, from 0 to 255. + * @type { number } + * @syscap SystemCapability.Graphics.Drawing + * @since 11 + */ + blue: number; + } + /** + * Provides the definition of the rectangle. + * @typedef Rect + * @syscap SystemCapability.Graphics.Drawing + * @since 11 + */ + interface Rect { + /** + * Left Position of Rectangle. + * @type { number } + * @syscap SystemCapability.Graphics.Drawing + * @since 11 + */ + left: number; + /** + * Top side position of the rectangle + * @type { number } + * @syscap SystemCapability.Graphics.Drawing + * @since 11 + */ + top: number; + /** + * Right Position of Rectangle. + * @type { number } + * @syscap SystemCapability.Graphics.Drawing + * @since 11 + */ + right: number; + /** + * Position of the bottom side of the rectangle. + * @type { number } + * @syscap SystemCapability.Graphics.Drawing + * @since 11 + */ + bottom: number; + } + /** + * Coordinates in the font layout. + * @typedef Point + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + interface Point { + /** + * X-axis coordinate. + * @type { number } + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + x: number; + /** + * Y-axis coordinate. + * @type { number } + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + y: number; + } +} +export default common2D; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.graphics.displaySync.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.graphics.displaySync.d.ts new file mode 100755 index 00000000..84e48413 --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.graphics.displaySync.d.ts @@ -0,0 +1,117 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit ArkGraphics2D + */ + +/// +import type { ExpectedFrameRateRange } from 'ExpectedFrameRateRange'; +import type { Callback } from './@ohos.base'; +/** + * Provides functions of applying an independent draw frame rate used for drawing the UI. + * + * @namespace displaySync + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 11 + */ +declare namespace displaySync { + /** + * Provides the IntervalInfo interface, which includes timestamp and targetTimestamp. + * @interface IntervalInfo + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 11 + */ + interface IntervalInfo { + /** + * The timestamp means the current drawing frame time. + * @type { number } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 11 + */ + timestamp: number; + /** + * The timestamp means the next drawing frame time. + * @type { number } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 11 + */ + targetTimestamp: number; + } + /** + * Provides the DisplaySync interface, which can be used to control + * the frequency of triggering callback function. + * @interface DisplaySync + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 11 + */ + interface DisplaySync { + /** + * The expected frame rate of dynamical rate range. + * If the function isn't be called. The DisplaySync's + * minimum/maximum/expected rate default value is 60. + * @param { ExpectedFrameRateRange } rateRange - Indicates ExpectedFrameRateRange. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + *
1. Mandatory parameters are left unspecified. + *
2. Incorrect parameters types. + *
3. Parameter verification failed. + * or check ExpectedFrameRateRange if valid. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 11 + */ + setExpectedFrameRateRange(rateRange: ExpectedFrameRateRange): void; + /** + * Registers a callback with the corresponding query condition by using the handle. + * This callback is triggered when DisplaySync dispatching. + * @param { 'frame' } type - The type of event to remove the listener for. Must be 'frame'. + * @param { Callback } callback - The callback function to be called when DisplaySync dispatching. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 11 + */ + on(type: 'frame', callback: Callback): void; + /** + * Deregisters a callback with the corresponding query condition by using the handle. + * This callback is triggered when DisplaySync dispatching. + * @param { 'frame' } type - The type of event to remove the listener for. Must be 'frame'. + * @param { Callback } [callback] - The callback function to remove. If not provided, all callbacks for the given event type + * will be removed. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 11 + */ + off(type: 'frame', callback?: Callback): void; + /** + * Add DisplaySync to Pipeline. It means that + * the callback function be enabled. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 11 + */ + start(): void; + /** + * Delete DisplaySync from Pipeline. It means that + * the callback function be disabled. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 11 + */ + stop(): void; + } + /** + * Create a new DisplaySync object. + * @returns { DisplaySync } DisplaySync + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 11 + */ + function create(): DisplaySync; +} +export default displaySync; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.graphics.drawing.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.graphics.drawing.d.ts new file mode 100755 index 00000000..37d82e5a --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.graphics.drawing.d.ts @@ -0,0 +1,1278 @@ +/* + * Copyright (c) 2023-2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit ArkGraphics 2D + */ +import type image from './@ohos.multimedia.image'; +import type common2D from './@ohos.graphics.common2D'; +/** + * Provides functions such as 2D graphics rendering, text drawing, and image display. + * + * @namespace drawing + * @syscap SystemCapability.Graphics.Drawing + * @since 11 + */ +declare namespace drawing { + /** + * Enumerate blending modes for colors. + * Blend is a operation that use 4 components(red, green, blue, alpha) to generate + * a new color from two colors(source, destination). + * @enum { number } + * @syscap SystemCapability.Graphics.Drawing + * @since 11 + */ + enum BlendMode { + /** + * Disable 4 regions(red, green, blue, alpha) + * @syscap SystemCapability.Graphics.Drawing + * @since 11 + */ + CLEAR = 0, + /** + * Use components of the source + * @syscap SystemCapability.Graphics.Drawing + * @since 11 + */ + SRC = 1, + /** + * Use components of the destination + * @syscap SystemCapability.Graphics.Drawing + * @since 11 + */ + DST = 2, + /** + * The source is placed above the destination. + * @syscap SystemCapability.Graphics.Drawing + * @since 11 + */ + SRC_OVER = 3, + /** + * The Destination is placed above the source. + * @syscap SystemCapability.Graphics.Drawing + * @since 11 + */ + DST_OVER = 4, + /** + * Use source replaces the destination, and will not exceed the boundaries of the destination + * @syscap SystemCapability.Graphics.Drawing + * @since 11 + */ + SRC_IN = 5, + /** + * Use destination, and will not exceed the boundaries of the source + * @syscap SystemCapability.Graphics.Drawing + * @since 11 + */ + DST_IN = 6, + /** + * Source is use in outside of the boundaries of the destination. + * @syscap SystemCapability.Graphics.Drawing + * @since 11 + */ + SRC_OUT = 7, + /** + * Destination is use in outside of the boundaries of the source. + * @syscap SystemCapability.Graphics.Drawing + * @since 11 + */ + DST_OUT = 8, + /** + * Source which overlaps the destination will replaces the destination. + * @syscap SystemCapability.Graphics.Drawing + * @since 11 + */ + SRC_ATOP = 9, + /** + * Destination which overlaps the source will replaces the source. + * @syscap SystemCapability.Graphics.Drawing + * @since 11 + */ + DST_ATOP = 10, + /** + * Combine regions where source and destination do not overlap. + * @syscap SystemCapability.Graphics.Drawing + * @since 11 + */ + XOR = 11, + /** + * The sum of the source and destination. + * @syscap SystemCapability.Graphics.Drawing + * @since 11 + */ + PLUS = 12, + /** + * All components are multiplied. + * @syscap SystemCapability.Graphics.Drawing + * @since 11 + */ + MODULATE = 13, + /** + * Multiply the complement values of the background and source color values, + * and then complement the result. + * @syscap SystemCapability.Graphics.Drawing + * @since 11 + */ + SCREEN = 14, + /** + * Multiplies or screens the colors, depending on destination + * @syscap SystemCapability.Graphics.Drawing + * @since 11 + */ + OVERLAY = 15, + /** + * Choose a darker background and source color. + * @syscap SystemCapability.Graphics.Drawing + * @since 11 + */ + DARKEN = 16, + /** + * Choose a lighter background and source color. + * @syscap SystemCapability.Graphics.Drawing + * @since 11 + */ + LIGHTEN = 17, + /** + * Brightens destination color to reflect the source color. + * @syscap SystemCapability.Graphics.Drawing + * @since 11 + */ + COLOR_DODGE = 18, + /** + * Darkens destination color to reflect the source color. + * @syscap SystemCapability.Graphics.Drawing + * @since 11 + */ + COLOR_BURN = 19, + /** + * Multiplies or screens the colors, depending on source + * @syscap SystemCapability.Graphics.Drawing + * @since 11 + */ + HARD_LIGHT = 20, + /** + * Lightens or Darkens the colors, depending on the source. + * @syscap SystemCapability.Graphics.Drawing + * @since 11 + */ + SOFT_LIGHT = 21, + /** + * Subtract the darker of the two colors from the brighter color. + * @syscap SystemCapability.Graphics.Drawing + * @since 11 + */ + DIFFERENCE = 22, + /** + * Produces an effect similar to difference mode, but with lower contrast. + * @syscap SystemCapability.Graphics.Drawing + * @since 11 + */ + EXCLUSION = 23, + /** + * Multiply the source color by the destination color and replace the destination. + * @syscap SystemCapability.Graphics.Drawing + * @since 11 + */ + MULTIPLY = 24, + /** + * Use the hue of the source and the saturation and brightness of the destination. + * @syscap SystemCapability.Graphics.Drawing + * @since 11 + */ + HUE = 25, + /** + * Use the saturation of the source and the hue and brightness of the destination. + * @syscap SystemCapability.Graphics.Drawing + * @since 11 + */ + SATURATION = 26, + /** + * Use the hue and saturation of the source and the brightness of the destination. + * @syscap SystemCapability.Graphics.Drawing + * @since 11 + */ + COLOR = 27, + /** + * Use the brightness of the source and the hue and saturation of the destination. + * @syscap SystemCapability.Graphics.Drawing + * @since 11 + */ + LUMINOSITY = 28 + } + /** + * Describes a path object. + * + * @syscap SystemCapability.Graphics.Drawing + * @since 11 + */ + class Path { + /** + * Sets the start point of a path + * @param { number } x - Indicates the x coordinate of the start point. + * @param { number } y - Indicates the y coordinate of the start point. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @syscap SystemCapability.Graphics.Drawing + * @since 11 + */ + moveTo(x: number, y: number): void; + /** + * Draws a line segment from the last point of a path to the target point. + * @param { number } x - Indicates the x coordinate of the target point. + * @param { number } y - Indicates the y coordinate of the target point. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @syscap SystemCapability.Graphics.Drawing + * @since 11 + */ + lineTo(x: number, y: number): void; + /** + * This is done by using angle arc mode. In this mode, a rectangle that encloses an ellipse is specified first, + * and then a start angle and a sweep angle are specified. + * The arc is a portion of the ellipse defined by the start angle and the sweep angle. + * By default, a line segment from the last point of the path to the start point of the arc is also added. + * @param { number } x1 - Indicates the x coordinate of the upper left corner of the rectangle. + * @param { number } y1 - Indicates the y coordinate of the upper left corner of the rectangle. + * @param { number } x2 - Indicates the x coordinate of the lower right corner of the rectangle. + * @param { number } y2 - Indicates the y coordinate of the lower right corner of the rectangle. + * @param { number } startDeg - Indicates the start angle, in degrees. + * @param { number } sweepDeg - Indicates the angle to sweep, in degrees. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @syscap SystemCapability.Graphics.Drawing + * @since 11 + */ + arcTo(x1: number, y1: number, x2: number, y2: number, startDeg: number, sweepDeg: number): void; + /** + * Draws a quadratic Bezier curve from the last point of a path to the target point. + * @param { number } ctrlX - Indicates the x coordinate of the control point. + * @param { number } ctrlY - Indicates the y coordinate of the control point. + * @param { number } endX - Indicates the x coordinate of the target point. + * @param { number } endY - Indicates the y coordinate of the target point. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @syscap SystemCapability.Graphics.Drawing + * @since 11 + */ + quadTo(ctrlX: number, ctrlY: number, endX: number, endY: number): void; + /** + * Draws a cubic Bezier curve from the last point of a path to the target point. + * @param { number } ctrlX1 - Indicates the x coordinate of the first control point. + * @param { number } ctrlY1 - Indicates the y coordinate of the first control point. + * @param { number } ctrlX2 - Indicates the x coordinate of the second control point. + * @param { number } ctrlY2 - Indicates the y coordinate of the second control point. + * @param { number } endX - Indicates the x coordinate of the target point. + * @param { number } endY - Indicates the y coordinate of the target point. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @syscap SystemCapability.Graphics.Drawing + * @since 11 + */ + cubicTo(ctrlX1: number, ctrlY1: number, ctrlX2: number, ctrlY2: number, endX: number, endY: number): void; + /** + * Closes a path. A line segment from the start point to the last point of the path is added. + * @syscap SystemCapability.Graphics.Drawing + * @since 11 + */ + close(): void; + /** + * Resets path data. + * @syscap SystemCapability.Graphics.Drawing + * @since 11 + */ + reset(): void; + } + /** + * Enumerates storage filter mode. + * @enum { number } + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + enum FilterMode { + /** + * Single sample point (nearest neighbor). + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + FILTER_MODE_NEAREST = 0, + /** + * Interpolate between 2x2 sample points (bilinear interpolation). + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + FILTER_MODE_LINEAR = 1 + } + /** + * Provides an interface to the drawing, and samplingOptions used when sampling from the image. + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + class SamplingOptions { + /** + * Constructor for the samplingOptions. + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + constructor(); + /** + * Constructor for the samplingOptions with filter mode. + * @param { FilterMode } filterMode - Storage filter mode. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + constructor(filterMode: FilterMode); + } + /** + * Provides an interface to the drawing, and how to clip and transform the drawing. + * @syscap SystemCapability.Graphics.Drawing + * @since 11 + */ + class Canvas { + /** + * Constructor for the Canvas. + * @param { image.PixelMap } pixelmap - PixelMap. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @syscap SystemCapability.Graphics.Drawing + * @since 11 + */ + constructor(pixelmap: image.PixelMap); + /** + * If rectangle is stroked, use pen to stroke width describes the line thickness, + * else use brush to fill the rectangle. + * @param { common2D.Rect } rect - Rectangle to draw. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @syscap SystemCapability.Graphics.Drawing + * @since 11 + */ + drawRect(rect: common2D.Rect): void; + /** + * If radius is zero or less, nothing is drawn. If circle is stroked, use pen to + * stroke width describes the line thickness, else use brush to fill the circle. + * @param { number } x - X coordinate of the circle center. + * @param { number } y - Y coordinate of the circle center. + * @param { number } radius - The radius of the circle must be greater than 0. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types; 3. Parameter verification failed. + * @syscap SystemCapability.Graphics.Drawing + * @since 11 + */ + drawCircle(x: number, y: number, radius: number): void; + /** + * Draw a pixelmap, with the upper left corner at (left, top). + * @param { image.PixelMap } pixelmap - PixelMap. + * @param { number } left - Left side of image. + * @param { number } top - Top side of image. + * @throws { BusinessError } 401 - Parameter error. + * @syscap SystemCapability.Graphics.Drawing + * @since 11 + */ + /** + * Draw a pixelmap, with the upper left corner at (left, top). + * @param { image.PixelMap } pixelmap - PixelMap. + * @param { number } left - Left side of image. + * @param { number } top - Top side of image. + * @param { SamplingOptions } samplingOptions - SamplingOptions used to describe the sampling mode. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + drawImage(pixelmap: image.PixelMap, left: number, top: number, samplingOptions?: SamplingOptions): void; + /** + * Fills clip with color color. Mode determines how ARGB is combined with destination. + * @param { common2D.Color } color - The range of color channels must be [0, 255]. + * @param { BlendMode } blendMode - Used to combine source color and destination. The default value is SRC_OVER. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types; 3. Parameter verification failed. + * @syscap SystemCapability.Graphics.Drawing + * @since 11 + */ + drawColor(color: common2D.Color, blendMode?: BlendMode): void; + /** + * Draw a point. + * @param { number } x - X coordinate position of the point. + * @param { number } y - Y coordinate position of the point. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @syscap SystemCapability.Graphics.Drawing + * @since 11 + */ + drawPoint(x: number, y: number): void; + /** + * Draws a path. + * @param { Path } path - Path to draw. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @syscap SystemCapability.Graphics.Drawing + * @since 11 + */ + drawPath(path: Path): void; + /** + * Draws line segment from startPt to endPt. + * @param { number } x0 - X coordinate of the start point of the line segment. + * @param { number } y0 - Y coordinate of the start point of the line segment. + * @param { number } x1 - X coordinate of the end point of the line segment. + * @param { number } y1 - Y coordinate of the end point of the line segment. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @syscap SystemCapability.Graphics.Drawing + * @since 11 + */ + drawLine(x0: number, y0: number, x1: number, y1: number): void; + /** + * Draws a textBlob + * @param { TextBlob } blob - TextBlob to draw. + * @param { number } x - X coordinate of the text start point. + * @param { number } y - Y coordinate of the text start point. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @syscap SystemCapability.Graphics.Drawing + * @since 11 + */ + drawTextBlob(blob: TextBlob, x: number, y: number): void; + /** + * Draws the pixelmap base on the mesh which is evenly distributed across the pixelmap. + * @param { image.PixelMap } pixelmap - The pixelmap to draw using the mesh. + * @param { number } meshWidth - The number of columns in the mesh. + * @param { number } meshHeight - The number of rows in the mesh. + * @param { Array } vertices - Array of vertices, specifying where the mesh should be drawn. + * @param { number } vertOffset - Number of vert elements to skip before drawing. + * @param { Array } colors - Array of colors, specifying a color at each vertex. + * @param { number } colorOffset - Number of color elements to skip before drawing. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + drawPixelMapMesh(pixelmap: image.PixelMap, meshWidth: number, meshHeight: number, vertices: Array, vertOffset: number, colors: Array, colorOffset: number): void; + /** + * Set pen to a canvas. + * @param { Pen } pen - object. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @syscap SystemCapability.Graphics.Drawing + * @since 11 + */ + attachPen(pen: Pen): void; + /** + * Set brush to a canvas. + * @param { Brush } brush - Object. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @syscap SystemCapability.Graphics.Drawing + * @since 11 + */ + attachBrush(brush: Brush): void; + /** + * Unset pen to a canvas. + * @syscap SystemCapability.Graphics.Drawing + * @since 11 + */ + detachPen(): void; + /** + * Unset brush to a canvas. + * @syscap SystemCapability.Graphics.Drawing + * @since 11 + */ + detachBrush(): void; + /** + * Saves the current canvas status (canvas matrix) to the top of the stack. + * @returns { number } Return the number of saved states. + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + save(): number; + /** + * Restores the canvas status (canvas matrix) saved on the top of the stack. + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + restore(): void; + /** + * Restores the specific number of the canvas status (canvas matrix) saved in the stack. + * @param { number } count - Depth of state stack to restore. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + restoreToCount(count: number): void; + /** + * Gets the number of the canvas status (canvas matrix) saved in the stack. + * @returns { number } Return represent depth of save state stack. + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + getSaveCount(): number; + /** + * Scales by sx on the x-axis and sy on the y-axis. + * @param { number } sx - Indicates the amount to scale on x-axis. + * @param { number } sy - Indicates the amount to scale on y-axis. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + scale(sx: number, sy: number): void; + /** + * Skews by sx on the x-axis and sy on the y-axis. + * @param { number } sx - Indicates the value skew transformation on x-axis. + * @param { number } sy - Indicates the value skew transformation on y-axis. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + skew(sx: number, sy: number): void; + /** + * Rotates by degrees, positive degrees rotates clockwise. + * @param { number } degrees - Indicates the amount to rotate, in degrees. + * @param { number } sx - Indicates the x-axis value of the point to rotate about. + * @param { number } sy - Indicates the y-axis value of the point to rotate about. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + rotate(degrees: number, sx: number, sy: number): void; + /** + * Translates by dx along the x-axis and dy along the y-axis. + * @param { number } dx - Indicates the distance to translate on x-axis. + * @param { number } dy - Indicates the distance to translate on y-axis. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + translate(dx: number, dy: number): void; + /** + * Replaces the clipping area with the intersection or difference of the current clipping area and path, + * and use a clipping edge that is aliased or anti-aliased. + * @param { Path } path - To combine with clip. + * @param { ClipOp } clipOp - Indicates the operation to apply to clip. The default value is intersect. + * @param { boolean } doAntiAlias - True if clip is to be anti-aliased. The default value is false. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + clipPath(path: Path, clipOp?: ClipOp, doAntiAlias?: boolean): void; + /** + * Replaces the clipping area with the intersection or difference between the + * current clipping area and Rect, and use a clipping edge that is aliased or anti-aliased. + * @param { common2D.Rect } rect - To combine with clipping area. + * @param { ClipOp } clipOp - Indicates the operation to apply to clip. The default value is intersect. + * @param { boolean } doAntiAlias - True if clip is to be anti-aliased. The default value is false. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + clipRect(rect: common2D.Rect, clipOp?: ClipOp, doAntiAlias?: boolean): void; + } + /** + * Enumerates clip operations. + * + * @enum { number } + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + enum ClipOp { + /** + * Clips with difference. + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + DIFFERENCE = 0, + /** + * Clips with intersection. + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + INTERSECT = 1 + } + /** + * Provide a description of the type and position of the text. + * @typedef TextBlobRunBuffer + * @syscap SystemCapability.Graphics.Drawing + * @since 11 + */ + interface TextBlobRunBuffer { + /** + * Text model. + * @type { number } + * @syscap SystemCapability.Graphics.Drawing + * @since 11 + */ + glyph: number; + /** + * X-coordinate of the text start point. + * @type { number } + * @syscap SystemCapability.Graphics.Drawing + * @since 11 + */ + positionX: number; + /** + * Y-coordinate of the text start point. + * @type { number } + * @syscap SystemCapability.Graphics.Drawing + * @since 11 + */ + positionY: number; + } + /** + * Encoding type of the description text. + * + * @enum { number } + * @syscap SystemCapability.Graphics.Drawing + * @since 11 + */ + enum TextEncoding { + /** + * Use 1 byte to represent UTF-8 or ASCII + * @syscap SystemCapability.Graphics.Drawing + * @since 11 + */ + TEXT_ENCODING_UTF8 = 0, + /** + * Use 2 bytes to represent most of unicode + * @syscap SystemCapability.Graphics.Drawing + * @since 11 + */ + TEXT_ENCODING_UTF16 = 1, + /** + * Use 4 bytes to represent all unicode. + * @syscap SystemCapability.Graphics.Drawing + * @since 11 + */ + TEXT_ENCODING_UTF32 = 2, + /** + * Use 2 bytes to represent the glyph index. + * @syscap SystemCapability.Graphics.Drawing + * @since 11 + */ + TEXT_ENCODING_GLYPH_ID = 3 + } + /** + * Provide a description of the text + * + * class TextBlob + * @syscap SystemCapability.Graphics.Drawing + * @since 11 + */ + class TextBlob { + /** + * Create a textblob from a string + * @param { string } text - Drawn glyph content. + * @param { Font } font - Specify text size, font, text scale, etc. + * @param { TextEncoding } encoding - The default value is TEXT_ENCODING_UTF8. + * @returns { TextBlob } TextBlob object. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @static + * @syscap SystemCapability.Graphics.Drawing + * @since 11 + */ + static makeFromString(text: string, font: Font, encoding?: TextEncoding): TextBlob; + /** + * Creating a textblob object based on RunBuffer information + * @param { Array } pos - The array of TextBlobRunBuffer. + * @param { Font } font - Font used for this run. + * @param { common2D.Rect } bounds - Optional run bounding box. The default value is null; + * @returns { TextBlob } TextBlob object. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @static + * @syscap SystemCapability.Graphics.Drawing + * @since 11 + */ + static makeFromRunBuffer(pos: Array, font: Font, bounds?: common2D.Rect): TextBlob; + /** + * Returns the bounding rectangle shape + * @returns { common2D.Rect } Rect object. + * @syscap SystemCapability.Graphics.Drawing + * @since 11 + */ + bounds(): common2D.Rect; + } + /** + * The Typeface class specifies the typeface and intrinsic style of a font. + * + * @syscap SystemCapability.Graphics.Drawing + * @since 11 + */ + class Typeface { + /** + * Get the family name for this typeface. + * @returns { string } Family name. + * @syscap SystemCapability.Graphics.Drawing + * @since 11 + */ + getFamilyName(): string; + } + /** + * Font controls options applied when drawing and measuring text. + * + * @syscap SystemCapability.Graphics.Drawing + * @since 11 + */ + class Font { + /** + * Requests, but does not require, that glyphs respect sub-pixel positioning. + * @param { boolean } isSubpixel - Setting for sub-pixel positioning. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @syscap SystemCapability.Graphics.Drawing + * @since 11 + */ + enableSubpixel(isSubpixel: boolean): void; + /** + * Increases stroke width when creating glyph bitmaps to approximate a bold typeface. + * @param { boolean } isEmbolden - Setting for bold approximation. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @syscap SystemCapability.Graphics.Drawing + * @since 11 + */ + enableEmbolden(isEmbolden: boolean): void; + /** + * Requests linearly scalable font and glyph metrics. + * @param { boolean } isLinearMetrics - Setting for linearly scalable font and glyph metrics. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @syscap SystemCapability.Graphics.Drawing + * @since 11 + */ + enableLinearMetrics(isLinearMetrics: boolean): void; + /** + * Sets text size in points. Has no effect if textSize is not greater than or equal to zero. + * @param { number } textSize - Typographic height of text. The height of the text must be greater than 0. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types; 3. Parameter verification failed. + * @syscap SystemCapability.Graphics.Drawing + * @since 11 + */ + setSize(textSize: number): void; + /** + * Obtains the text size. + * @returns { number } Text size. + * @syscap SystemCapability.Graphics.Drawing + * @since 11 + */ + getSize(): number; + /** + * Sets Typeface to font. + * @param { Typeface } typeface - Font and style used to draw text. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @syscap SystemCapability.Graphics.Drawing + * @since 11 + */ + setTypeface(typeface: Typeface): void; + /** + * Get Typeface to font. + * @returns { Typeface } Typeface. + * @syscap SystemCapability.Graphics.Drawing + * @since 11 + */ + getTypeface(): Typeface; + /** + * Get fontMetrics associated with typeface. + * @returns { FontMetrics } The fontMetrics value returned to the caller. + * @syscap SystemCapability.Graphics.Drawing + * @since 11 + */ + getMetrics(): FontMetrics; + /** + * Measure the width of text. + * @param { string } text - Text Symbol Content. + * @param { TextEncoding } encoding - Encoding format. + * @returns { number } The width of text. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @syscap SystemCapability.Graphics.Drawing + * @since 11 + */ + measureText(text: string, encoding: TextEncoding): number; + } + /** + * The metrics of an Font. + * @typedef FontMetrics + * @syscap SystemCapability.Graphics.Drawing + * @since 11 + */ + interface FontMetrics { + /** + * Maximum range above the glyph bounding box. + * @type { number } + * @syscap SystemCapability.Graphics.Drawing + * @since 11 + */ + top: number; + /** + * Distance Retained Above Baseline. + * @type { number } + * @syscap SystemCapability.Graphics.Drawing + * @since 11 + */ + ascent: number; + /** + * The distance that remains below the baseline. + * @type { number } + * @syscap SystemCapability.Graphics.Drawing + * @since 11 + */ + descent: number; + /** + * Maximum range below the glyph bounding box. + * @type { number } + * @syscap SystemCapability.Graphics.Drawing + * @since 11 + */ + bottom: number; + /** + * Line Spacing. + * @type { number } + * @syscap SystemCapability.Graphics.Drawing + * @since 11 + */ + leading: number; + } + /** + * MaskFilter is the class for object that perform transformations on an alpha-channel mask before drawing it. + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + class MaskFilter { + /** + * Makes a MaskFilter with a blur effect. + * @param { BlurType } blurType - Indicates the blur type. + * @param { number } sigma - Indicates the standard deviation of the Gaussian blur to apply. Must be > 0. + * @returns { MaskFilter } MaskFilter object. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types; 3. Parameter verification failed. + * @static + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + static createBlurMaskFilter(blurType: BlurType, sigma: number): MaskFilter; + } + /** + * Defines a PathEffect, which is used to affects stroked paths. + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + class PathEffect { + /** + * Makes a dash PathEffect. + * @param { Array } intervals - Array of ON and OFF distances. Must contain an even number of entries (>=2), + * with the even indices specifying the "on" intervals, and the odd indices specifying the "off" intervals. + * @param { number } phase - Offset into the intervals array. + * @returns { PathEffect } PathEffect object. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types; 3. Parameter verification failed. + * @static + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + static createDashPathEffect(intervals: Array, phase: number): PathEffect; + } + /** + * Defines a ShadowLayer, which is used to specify the color, blur radius, and offset of the shadow. + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + class ShadowLayer { + /** + * Makes a new ShadowLayer. + * + * @param { number } blurRadius - The blur radius of the shadow. The blur radius must be greater than 0. + * @param { number } x - The offset point on x-axis. + * @param { number } y - The offset point on y-axis. + * @param { common2D.Color } color - The shadow color. The range of color channels must be [0, 255]. + * @returns { ShadowLayer } ShadowLayer object. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types; 3. Parameter verification failed. + * @static + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + static create(blurRadius: number, x: number, y: number, color: common2D.Color): ShadowLayer; + } + /** + * ColorFilters are optional objects in the drawing pipeline. + * + * @syscap SystemCapability.Graphics.Drawing + * @since 11 + */ + class ColorFilter { + /** + * Makes a color filter with the given color and blend mode. + * @param { common2D.Color } color - The range of color channels must be [0, 255]. + * @param { BlendMode } mode - BlendMode. + * @returns { ColorFilter } Colorfilter object. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types; 3. Parameter verification failed. + * @static + * @syscap SystemCapability.Graphics.Drawing + * @since 11 + */ + static createBlendModeColorFilter(color: common2D.Color, mode: BlendMode): ColorFilter; + /** + * Create a color filter consisting of two filters. + * @param { ColorFilter } outer - The filter is used next. + * @param { ColorFilter } inner - The filter is used first. + * @returns { ColorFilter } Colorfilter object. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @static + * @syscap SystemCapability.Graphics.Drawing + * @since 11 + */ + static createComposeColorFilter(outer: ColorFilter, inner: ColorFilter): ColorFilter; + /** + * Makes a color filter that converts between linear colors and sRGB colors. + * @returns { ColorFilter } Colorfilter object. + * @static + * @syscap SystemCapability.Graphics.Drawing + * @since 11 + */ + static createLinearToSRGBGamma(): ColorFilter; + /** + * Makes a color filter that converts between sRGB colors and linear colors. + * @returns { ColorFilter } Colorfilter object. + * @static + * @syscap SystemCapability.Graphics.Drawing + * @since 11 + */ + static createSRGBGammaToLinear(): ColorFilter; + /** + * Makes a color filter that multiplies the luma of its input into the alpha channel, + * and sets the red, green, and blue channels to zero. + * @returns { ColorFilter } Colorfilter. + * @static + * @syscap SystemCapability.Graphics.Drawing + * @since 11 + */ + static createLumaColorFilter(): ColorFilter; + } + /** + * Enumerate join styles. The join style defines the shape of the joins of a + * polyline segment drawn by the pen. + * @enum { number } + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + enum JoinStyle { + /** + * Miter corner. If the angle of a polyline is small, its miter length may be inappropriate. + * In this case, you need to use the miter limit to limit the miter length. + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + MITER_JOIN = 0, + /** + * Round corner. + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + ROUND_JOIN = 1, + /** + * Bevel corner. + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + BEVEL_JOIN = 2 + } + /** + * Enumerates cap styles of a pen. The cap style defines + * the style of both ends of a segment drawn by the pen. + * @enum { number } + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + enum CapStyle { + /** + * No cap style. Both ends of the segment are cut off square. + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + FLAT_CAP = 0, + /** + * Square cap style. Both ends have a square, the height of which + * is half of the width of the segment, with the same width. + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + SQUARE_CAP = 1, + /** + * Round cap style. Both ends have a semicircle centered, the diameter of which + * is the same as the width of the segment. + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + ROUND_CAP = 2 + } + /** + * Enumerates blur type. + * @enum { number } + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + enum BlurType { + /** + * Fuzzy inside and outside. + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + NORMAL = 0, + /** + * Solid inside, fuzzy outside. + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + SOLID = 1, + /** + * Nothing inside, fuzzy outside. + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + OUTER = 2, + /** + * Fuzzy inside, nothing outside. + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + INNER = 3 + } + /** + * Provides settings for strokes during drawing. + * @syscap SystemCapability.Graphics.Drawing + * @since 11 + */ + class Pen { + /** + * Set the color of the pen. + * @param { common2D.Color } color - The range of color channels must be [0, 255]. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @syscap SystemCapability.Graphics.Drawing + * @since 11 + */ + setColor(color: common2D.Color): void; + /** + * Sets the thickness of the pen used by the paint to outline the shape. + * + * @param { number } width - Zero thickness for hairline; greater than zero for pen thickness. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @syscap SystemCapability.Graphics.Drawing + * @since 11 + */ + setStrokeWidth(width: number): void; + /** + * Requests, but does not require, that edge pixels draw opaque or with partial transparency. + * + * @param { boolean } aa - Setting for antialiasing. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @syscap SystemCapability.Graphics.Drawing + * @since 11 + */ + setAntiAlias(aa: boolean): void; + /** + * Replaces alpha, leaving RGB + * + * @param { number } alpha - Alpha channel of color. The range of alpha must be [0, 255]. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types; 3. Parameter verification failed. + * @syscap SystemCapability.Graphics.Drawing + * @since 11 + */ + setAlpha(alpha: number): void; + /** + * Sets ColorFilter to pen + * + * @param { ColorFilter } filter - ColorFilter to apply to subsequent draw. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @syscap SystemCapability.Graphics.Drawing + * @since 11 + */ + setColorFilter(filter: ColorFilter): void; + /** + * Sets MaskFilter to pen. + * + * @param { MaskFilter } filter - MaskFilter to apply to subsequent draw. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + setMaskFilter(filter: MaskFilter): void; + /** + * Sets PathEffect to pen. + * + * @param { PathEffect } effect - PathEffect to apply to subsequent draw. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + setPathEffect(effect: PathEffect): void; + /** + * Sets ShadowLayer to pen. + * + * @param { ShadowLayer } shadowLayer - ShadowLayer to apply to subsequent draw. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + setShadowLayer(shadowLayer: ShadowLayer): void; + /** + * Sets a blender that implements the specified blendmode enum. + * + * @param { BlendMode } mode - Blendmode. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @syscap SystemCapability.Graphics.Drawing + * @since 11 + */ + setBlendMode(mode: BlendMode): void; + /** + * Request color distribution error. + * + * @param { boolean } dither - Whether the color is distributed incorrectly. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @syscap SystemCapability.Graphics.Drawing + * @since 11 + */ + setDither(dither: boolean): void; + /** + * Sets the JoinStyle for a pen. + * + * @param { JoinStyle } style - The JoinStyle. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + setJoinStyle(style: JoinStyle): void; + /** + * Obtains the JoinStyle of a pen. + * + * @returns { JoinStyle } The JoinStyle. + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + getJoinStyle(): JoinStyle; + /** + * Sets the CapStyle for a pen. + * + * @param { CapStyle } style - The CapStyle. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + setCapStyle(style: CapStyle): void; + /** + * Obtains the CapStyle of a pen. + * + * @returns { CapStyle } The CapStyle. + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + getCapStyle(): CapStyle; + } + /** + * Provides settings for brush fill when drawing. + * @syscap SystemCapability.Graphics.Drawing + * @since 11 + */ + class Brush { + /** + * Set the color of the brush. + * @param { common2D.Color } color - The range of color channels must be [0, 255]. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types; 3. Parameter verification failed. + * @syscap SystemCapability.Graphics.Drawing + * @since 11 + */ + setColor(color: common2D.Color): void; + /** + * Requests, but does not require, that edge pixels draw opaque or with partial transparency. + * @param { boolean } aa - Setting for antialiasing. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @syscap SystemCapability.Graphics.Drawing + * @since 11 + */ + setAntiAlias(aa: boolean): void; + /** + * Replaces alpha, leaving RGB + * @param { number } alpha - Alpha channel of color. The range of alpha must be [0, 255]. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types; 3. Parameter verification failed. + * @syscap SystemCapability.Graphics.Drawing + * @since 11 + */ + setAlpha(alpha: number): void; + /** + * Sets ColorFilter to brush + * @param { ColorFilter } filter - ColorFilter to apply to subsequent draw. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @syscap SystemCapability.Graphics.Drawing + * @since 11 + */ + setColorFilter(filter: ColorFilter): void; + /** + * Sets MaskFilter to brush. + * @param { MaskFilter } filter - MaskFilter to apply to subsequent draw. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + setMaskFilter(filter: MaskFilter): void; + /** + * Sets ShadowLayer to brush. + * + * @param { ShadowLayer } shadowLayer - ShadowLayer painting. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + setShadowLayer(shadowLayer: ShadowLayer): void; + /** + * Sets a blender that implements the specified blendmode enum. + * @param { BlendMode } mode - Blendmode. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types. + * @syscap SystemCapability.Graphics.Drawing + * @since 11 + */ + setBlendMode(mode: BlendMode): void; + } +} +export default drawing; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.graphics.hdrCapability.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.graphics.hdrCapability.d.ts new file mode 100755 index 00000000..861f6742 --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.graphics.hdrCapability.d.ts @@ -0,0 +1,94 @@ +/* +* Copyright (C) 2022-2023 Huawei Device Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +/** + * @file + * @kit ArkGraphics2D + */ + +/** + * HDR Capability. + * + * @namespace hdrCapability + * @syscap SystemCapability.Graphic.Graphic2D.ColorManager.Core + * @since 11 + */ +declare namespace hdrCapability { + /** + * Enumerates the HDR Format + * + * @enum { number } + * @syscap SystemCapability.Graphic.Graphic2D.ColorManager.Core + * @since 11 + */ + enum HDRFormat { + /** + * Not support HDR. + * + * @syscap SystemCapability.Graphic.Graphic2D.ColorManager.Core + * @since 11 + */ + NONE = 0, + /** + * HLG format supported by video. + * + * @syscap SystemCapability.Graphic.Graphic2D.ColorManager.Core + * @since 11 + */ + VIDEO_HLG = 1, + /** + * HDR10 format supported by video. + * + * @syscap SystemCapability.Graphic.Graphic2D.ColorManager.Core + * @since 11 + */ + VIDEO_HDR10 = 2, + /** + * HDR Vivid format supported by video. + * + * @syscap SystemCapability.Graphic.Graphic2D.ColorManager.Core + * @since 11 + */ + VIDEO_HDR_VIVID = 3, + /** + * HDR Vivid format supported by image, stored in dual JPEG format. + * + * @syscap SystemCapability.Graphic.Graphic2D.ColorManager.Core + * @since 11 + */ + IMAGE_HDR_VIVID_DUAL = 4, + /** + * HDR Vivid format supported by image, stored in single HEIF format. + * + * @syscap SystemCapability.Graphic.Graphic2D.ColorManager.Core + * @since 11 + */ + IMAGE_HDR_VIVID_SINGLE = 5, + /** + * ISO HDR format supported by image, stored in dual JPEG format. + * + * @syscap SystemCapability.Graphic.Graphic2D.ColorManager.Core + * @since 11 + */ + IMAGE_HDR_ISO_DUAL = 6, + /** + * ISO HDR format supported by image, stored in single HEIF format. + * + * @syscap SystemCapability.Graphic.Graphic2D.ColorManager.Core + * @since 11 + */ + IMAGE_HDR_ISO_SINGLE = 7 + } +} +export default hdrCapability; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.graphics.scene.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.graphics.scene.d.ts new file mode 100755 index 00000000..026bd733 --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.graphics.scene.d.ts @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2024-2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file Export 3D interfaces + * @kit ArkGraphics3D + */ +/** + * Export post processing settings + * @syscap SystemCapability.ArkUi.Graphics3D + * @since 12 + */ +export { ToneMappingType, ToneMappingSettings, PostProcessSettings } from './graphics3d/ScenePostProcessSettings'; +/** + * Export scene types + * @syscap SystemCapability.ArkUi.Graphics3D + * @since 12 + */ +export { Vec2, Vec3, Vec4, Color, Rect, Quaternion, Aabb, Position3, Rotation3, Scale3 } from './graphics3d/SceneTypes'; +/** + * Export scene resources + * @syscap SystemCapability.ArkUi.Graphics3D + * @since 12 + */ +export { SceneResourceType, SceneResource, Shader, MaterialType, Material, ShaderMaterial, SubMesh, Mesh, Animation, EnvironmentBackgroundType, Environment, Image } from './graphics3d/SceneResources'; +/** + * Export scene nodes + * @syscap SystemCapability.ArkUi.Graphics3D + * @since 12 + */ +export { LayerMask, NodeType, Container, Node, Geometry, LightType, Light, SpotLight, DirectionalLight, Camera } from './graphics3d/SceneNodes'; +/** + * Export scene + * @syscap SystemCapability.ArkUi.Graphics3D + * @since 12 + */ +export { SceneResourceParameters, SceneNodeParameters, SceneResourceFactory, Scene } from './graphics3d/Scene'; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.graphics.sendableColorSpaceManager.d.ets b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.graphics.sendableColorSpaceManager.d.ets new file mode 100755 index 00000000..5b0da86c --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.graphics.sendableColorSpaceManager.d.ets @@ -0,0 +1,100 @@ +/* +* Copyright (C) 2024 Huawei Device Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +/** + * @file + * @kit ArkGraphics2D + */ +import lang from '../arkts/@arkts.lang'; +import collections from '../arkts/@arkts.collections'; +import colorSpaceManager from '@ohos.graphics.colorSpaceManager'; +/** + * Color space manager. + * + * @namespace sendableColorSpaceManager + * @syscap SystemCapability.Graphic.Graphic2D.ColorManager.Core + * @crossplatform + * @since 12 + */ +declare namespace sendableColorSpaceManager { + /** + * Redefines ISendable for convenience. + * + * @typedef { lang.ISendable } ISendable + * @syscap SystemCapability.Graphic.Graphic2D.ColorManager.Core + * @crossplatform + * @since 12 + */ + type ISendable = lang.ISendable; + /** + * Defines a color space object and manages its key information + * @interface ColorSpaceManager + * @syscap SystemCapability.Graphic.Graphic2D.ColorManager.Core + * @crossplatform + * @since 12 + */ + interface ColorSpaceManager extends ISendable { + /** + * Get the name of color space type. + * @returns { colorSpaceManager.ColorSpace } Returns the name of color space type. + * @throws { BusinessError } 18600001 - Parameter value is abnormal. + * @syscap SystemCapability.Graphic.Graphic2D.ColorManager.Core + * @crossplatform + * @since 12 + */ + getColorSpaceName(): colorSpaceManager.ColorSpace; + /** + * Get white point(x, y) of color space. + * @returns { collections.Array } Returns the white point value of color space. + * @throws { BusinessError } 18600001 - Parameter value is abnormal. + * @syscap SystemCapability.Graphic.Graphic2D.ColorManager.Core + * @crossplatform + * @since 12 + */ + getWhitePoint(): collections.Array; + /** + * Get gamma value of color space. + * @returns { number } Returns the gamma value of color space. + * @throws { BusinessError } 18600001 - Parameter value is abnormal. + * @syscap SystemCapability.Graphic.Graphic2D.ColorManager.Core + * @crossplatform + * @since 12 + */ + getGamma(): number; + } + /** + * Create a color space manager by provided color space type. + * @param { colorSpaceManager.ColorSpace } colorSpaceName - Indicates the type of color space + * @returns { ColorSpaceManager } Returns a color space manager object created by provided type. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 18600001 - Parameter value is abnormal. + * @syscap SystemCapability.Graphic.Graphic2D.ColorManager.Core + * @crossplatform + * @since 12 + */ + function create(colorSpaceName: colorSpaceManager.ColorSpace): ColorSpaceManager; + /** + * Create a customized color space manager by its color primaries and gamma value + * @param { colorSpaceManager.ColorSpacePrimaries } primaries - Indicates the customized color primaries + * @param { number } gamma - Indicates display gamma value + * @returns { ColorSpaceManager } Returns a color space manager object created by customized parameters. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 18600001 - Parameter value is abnormal. + * @syscap SystemCapability.Graphic.Graphic2D.ColorManager.Core + * @crossplatform + * @since 12 + */ + function create(primaries: colorSpaceManager.ColorSpacePrimaries, gamma: number): ColorSpaceManager; +} +export default sendableColorSpaceManager; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.graphics.text.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.graphics.text.d.ts new file mode 100755 index 00000000..a6216671 --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.graphics.text.d.ts @@ -0,0 +1,1099 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit ArkGraphics2D + */ +import type drawing from './@ohos.graphics.drawing'; +import type common2D from './@ohos.graphics.common2D'; +/** + * Provides functions such as 2D graphics text paragraphs, text styles. + * + * @namespace text + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ +declare namespace text { + /** + * Refers to how to align the horizontal position of text when displaying text. + * @enum { number } + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + enum TextAlign { + /** + * Use the left side of the text as a reference line for alignment. + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + LEFT = 0, + /** + * Use the right side of the text as a reference line for alignment. + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + RIGHT = 1, + /** + * Use the midpoint line the text as a reference line for alignment. + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + CENTER = 2, + /** + * Align the text at the start and end of the line. + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + JUSTIFY = 3, + /** + * Align text from start, based on the direction of text, such as left-to-right or right-to-left. + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + START = 4, + /** + * Align text from end, based on the direction of text, such as left-to-right or right-to-left, opposite to START. + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + END = 5 + } + /** + * Enumerate text runs direction. + * @enum { number } + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + enum TextDirection { + /** + * The text is oriented from right to left. + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + RTL, + /** + * The text is oriented from left to right. + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + LTR + } + /** + * Enumerate text segmentation strategy. + * @enum { number } + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + enum BreakStrategy { + /** + * The segmentation strategy is greedy. + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + GREEDY, + /** + * The segmentation strategy is high quality. + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + HIGH_QUALITY, + /** + * The segmentation strategy is balanced. + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + BALANCED + } + /** + * Enumerate word break strategy. + * @enum { number } + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + enum WordBreak { + /** + * Normal word break strategy. + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + NORMAL, + /** + * Breaks word by character. + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + BREAK_ALL, + /** + * Breaks word by phrase. + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + BREAK_WORD + } + /** + * Decoration for text. + * @typedef Decoration + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + interface Decoration { + /** + * Decorates text by line. + * @type { ?TextDecorationType } + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + textDecoration?: TextDecorationType; + /** + * Text color. + * @type { ?common2D.Color } + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + color?: common2D.Color; + /** + * Text decoration style. + * @type { ?TextDecorationStyle } + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + decorationStyle?: TextDecorationStyle; + /** + * The thickness scale of decoration line. + * @type { ?number } + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + decorationThicknessScale?: number; + } + /** + * Enumerates decoration line for text. + * @enum { number } + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + enum TextDecorationType { + /** + * There are no text decoration. + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + NONE, + /** + * There is a decoration line below the text. + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + UNDERLINE, + /** + * There is a decoration line above the text. + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + OVERLINE, + /** + * There is a decoration line through the middle of the text. + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + LINE_THROUGH + } + /** + * Enumerates decoration line style. + * @enum { number } + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + enum TextDecorationStyle { + /** + * Decoration line is solid line. + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + SOLID, + /** + * Decoration line is double line. + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + DOUBLE, + /** + * Decoration line is dotted line. + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + DOTTED, + /** + * Decoration line is dashed line. + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + DASHED, + /** + * Decoration line is wavy line. + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + WAVY + } + /** + * Enumeration of font weight of text. + * @enum { number } + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + enum FontWeight { + /** + * Thin + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + W100, + /** + * Extra-light + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + W200, + /** + * Light + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + W300, + /** + * Normal/Regular + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + W400, + /** + * Medium + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + W500, + /** + * Semi-bold + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + W600, + /** + * Bold + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + W700, + /** + * Extra-bold + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + W800, + /** + * Black + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + W900 + } + /** + * Enumeration of font style of text. + * @enum { number } + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + enum FontStyle { + /** + * Upright font type. + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + NORMAL, + /** + * Slant font. + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + ITALIC, + /** + * Oblique font. + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + OBLIQUE + } + /** + * Enumeration the type of text baseline. + * @enum { number } + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + enum TextBaseline { + /** + * The alphabetic baseline, typically used for Latin-based scripts where the baseline aligns + * with the base of lowercase letters. + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + ALPHABETIC, + /** + * The ideographic baseline, commonly used for ideographic scripts such as Chinese, Japanese, and Korean, + * where the baseline aligns with the center of characters. + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + IDEOGRAPHIC + } + /** + * Enumerates of ellipsis mode. + * @enum { number } + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + enum EllipsisMode { + /** + * The ellipsis is shown in the start of text. + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + START, + /** + * The ellipsis is shown in the middle of text. + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + MIDDLE, + /** + * The ellipsis is shown in the end of text. + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + END + } + /** + * Describes text style. + * @typedef TextStyle + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + interface TextStyle { + /** + * Decoration of text. + * @type { ?Decoration } decoration for text + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + decoration?: Decoration; + /** + * Color of text. + * @type { ?common2D.Color } it is uint32_t type data + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + color?: common2D.Color; + /** + * Font weight of text. + * @type { ?FontWeight } it is uint32_t type data + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + fontWeight?: FontWeight; + /** + * Font style of text. + * @type { ?FontStyle } it is uint32_t type data + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + fontStyle?: FontStyle; + /** + * Base line of text. + * @type { ?TextBaseline } it is uint32_t type data + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + baseline?: TextBaseline; + /** + * Font Families of text. + * @type { ?Array } fontfamily gather + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + fontFamilies?: Array; + /** + * Font size of text. + * @type { ?number } it is double type data + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + fontSize?: number; + /** + * Letter spacing of text. + * @type { ?number } it is double type data + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + letterSpacing?: number; + /** + * Word spacing of text. + * @type { ?number } it is double type data + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + wordSpacing?: number; + /** + * Height scale of text. + * @type { ?number } it is double type data + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + heightScale?: number; + /** + * Half leading of text. + * @type { ?boolean } it is boolean type data + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + halfLeading?: boolean; + /** + * Control the height calculation method of font blob, true means calculate the height of the blob by + * the font size, false means by the line height and leading. + * @type { ?boolean } it is boolean type data + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + heightOnly?: boolean; + /** + * Text ellipsis. + * @type { ?string } it is u16string type data. + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + ellipsis?: string; + /** + * Text ellipsis mode. + * @type { ?EllipsisMode } Ellipsis mode. + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + ellipsisMode?: EllipsisMode; + /** + * Text locale. + * @type { ?string } it is string type data. + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + locale?: string; + } + /** + * Provides the basis for graphics. + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + class FontCollection { + /** + * Get global FontCollection instance of the application. + * @returns { FontCollection } The FontCollection object. + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + static getGlobalInstance(): FontCollection; + /** + * Load font. + * @param { string } name - the font name. + * @param { string | Resource } path - the path of the font file. + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + loadFontSync(name: string, path: string | Resource): void; + } + /** + * Determines the configuration used by ParagraphBuilder to position lines within a Paragraph of text. + * @typedef ParagraphStyle + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + interface ParagraphStyle { + /** + * Text style of paragraph. + * @type { ?TextStyle } + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + textStyle?: TextStyle; + /** + * Text runs direction. + * @type { ?TextDirection } + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + textDirection?: TextDirection; + /** + * Refers to how to align the horizontal position of text when displaying text. + * @type { ?TextAlign } + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + align?: TextAlign; + /** + * Word break strategy. + * @type { ?WordBreak } + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + wordBreak?: WordBreak; + /** + * Maximum number of lines. + * @type { ?number } + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + maxLines?: number; + /** + * text segmentation strategy. + * @type { ?BreakStrategy } + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + breakStrategy?: BreakStrategy; + } + /** + * Where to vertically align the placeholder relative to the surrounding text. + * @enum { number } + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + enum PlaceholderAlignment { + /** + * Match the baseline of the placeholder with the baseline. + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + OFFSET_AT_BASELINE, + /** + * Align the bottom edge of the placeholder with the baseline such that the placeholder + * sits on top of the baseline. + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + ABOVE_BASELINE, + /** + * Align the top edge of the placeholder with the baseline specified in such that the placeholder + * hangs below the baseline. + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + BELOW_BASELINE, + /** + * Align the top edge of the placeholder with the top edge of the font. When the placeholder is very tall, + * the extra space will hang from the top and extend through the bottom of the line. + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + TOP_OF_ROW_BOX, + /** + * Align the bottom edge of the placeholder with the bottom edge of the text. When the placeholder is very tall, + * the extra space will rise from the bottom and extend through the top of the line. + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + BOTTOM_OF_ROW_BOX, + /** + * Align the middle of the placeholder with the middle of the text.When the placeholder is very tall, + * the extra space will grow equally from the top and bottom of the line. + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + CENTER_OF_ROW_BOX + } + /** + * Provide a description of placeholder scope in creating typography. + * @typedef PlaceholderSpan + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + interface PlaceholderSpan { + /** + * The width of the placeholder. + * @type { number } + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + width: number; + /** + * The height of the placeholder. + * @type { number } + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + height: number; + /** + * Alignment mode of placeholder. + * @type { PlaceholderAlignment } + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + align: PlaceholderAlignment; + /** + * Baseline of placeholder. + * @type { TextBaseline } + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + baseline: TextBaseline; + /** + * Baseline offset of placeholder. + * @type { number } + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + baselineOffset: number; + } + /** + * Provides the definition of the range. + * @typedef Range + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + interface Range { + /** + * Left index. + * @type { number } + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + start: number; + /** + * Right index. + * @type { number } + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + end: number; + } + /** + * A paragraph retains the size and position of each glyph in the text and can be efficiently resized and painted. + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + class Paragraph { + /** + * Calculates the positioning of all the glyphs. + * @param { number } width - Control how wide the text is allowed to be. + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + layoutSync(width: number): void; + /** + * Paint the laid out text onto the supplied canvas at (x, y). + * @param { drawing.Canvas } canvas - Object + * @param { number } x - Represents the X-axis position on the canvas. + * @param { number } y - Represents the Y-axis position on the canvas. + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + paint(canvas: drawing.Canvas, x: number, y: number): void; + /** + * Get max width of horizontal space this paragraph occupied. + * @returns { number } Max width of horizontal space. + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + getMaxWidth(): number; + /** + * Get height of horizontal space this paragraph occupies. + * @returns { number } Height of horizontal space this paragraph occupies. + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + getHeight(): number; + /** + * Get the longest line of horizontal space this paragraph occupies. + * @returns { number } The longest line of horizontal space this paragraph occupies. + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + getLongestLine(): number; + /** + * Get the min intrinsic width of horizontal space this paragraph occupies. + * @returns { number } The min intrinsic width of horizontal space this paragraph occupies. + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + getMinIntrinsicWidth(): number; + /** + * Get the max intrinsic width. + * @returns { number } Intrinsic Width. + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + getMaxIntrinsicWidth(): number; + /** + * Get the alphabetic baseline. + * @returns { number } Alphabetic Baseline. + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + getAlphabeticBaseline(): number; + /** + * Get the ideographic baseline. + * @returns { number } Ideographic Baseline. + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + getIdeographicBaseline(): number; + /** + * Get the rects for range. + * @param { Range } range - The range to set. + * @param { RectWidthStyle } widthStyle - Width style to set. + * @param { RectHeightStyle } heightStyle - Height style to set. + * @returns { Array } The rects for range. + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + getRectsForRange(range: Range, widthStyle: RectWidthStyle, heightStyle: RectHeightStyle): Array; + /** + * Get the rects for placeholders. + * @returns { Array } The rects for placeholders. + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + getRectsForPlaceholders(): Array; + /** + * Get the glyph position at coordinate. + * @param { number } x - the positionX of typography to set. + * @param { number } y - the positionY of typography to set. + * @returns { PositionWithAffinity } TextBlob object. + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + getGlyphPositionAtCoordinate(x: number, y: number): PositionWithAffinity; + /** + * Find the start and end position of the word containing the glyphs of the given offset. + * @param { number } offset - offset value + * @returns { Range } The range value returned to the caller. + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + getWordBoundary(offset: number): Range; + /** + * Get line count. + * @returns { number } The line count value returned to the caller. + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + getLineCount(): number; + /** + * Get the line height of the specified line. + * @param { number } line - line number + * @returns { number } The line height value returned to the caller. + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + getLineHeight(line: number): number; + /** + * Get the line width of the specified line. + * @param { number } line - line number + * @returns { number } The line width value returned to the caller. + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + getLineWidth(line: number): number; + /** + * Return whether it exceed the maximum lines of typography. + * @returns { boolean } The true indicates exceeding, the false indicates not exceeding. + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + didExceedMaxLines(): boolean; + /** + * Get the text lines of paragraph. + * @returns { Array } the tuple of TextLine. + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + getTextLines(): Array; + } + /** + * Box that contain text. + * @typedef TextBox + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + interface TextBox { + /** + * Rect of text box. + * @type { common2D.Rect } + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + rect: common2D.Rect; + /** + * Text direction. + * @type { TextDirection } + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + direction: TextDirection; + } + /** + * Position and affinity. + * @typedef PositionWithAffinity + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + interface PositionWithAffinity { + /** + * Position of text. + * @type { number } + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + position: number; + /** + * Affinity of text. + * @type { Affinity } + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + affinity: Affinity; + } + /** + * Enumerates rect width style. + * @enum { number } + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + enum RectWidthStyle { + /** + * Tight width. + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + TIGHT, + /** + * Max width. + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + MAX + } + /** + * Enumerates rect height style. + * @enum { number } + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + enum RectHeightStyle { + /** + * Provide tight bounding boxes that fit heights per run. + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + TIGHT, + /** + * The height of the boxes will be the maximum height of all runs in the line. All rects in the same + * line will be the same height. + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + MAX, + /** + * The top and bottom of each rect will cover half of the space above and half of the space below the line. + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + INCLUDE_LINE_SPACE_MIDDLE, + /** + * The line spacing will be added to the top of the rect. + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + INCLUDE_LINE_SPACE_TOP, + /** + * The line spacing will be added to the bottom of the rect. + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + INCLUDE_LINE_SPACE_BOTTOM, + /** + * The height of the boxes will be calculated by text strut. + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + STRUT + } + /** + * Enumerates text affinity.When a selection range involves line breaks or other special characters, the + * affinity determines which side of the characters the start and end of the selection range should be + * closer to. + * @enum { number } + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + enum Affinity { + /** + * The position has affinity for the upstream side of the text position. + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + UPSTREAM, + /** + * The position has affinity for the downstream side of the text position. + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + DOWNSTREAM + } + /** + * Builds a Paragraph containing text with the given styling information. + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + class ParagraphBuilder { + /** + * Constructor ParagraphBuilder. + * @param { ParagraphStyle } paragraphStyle - Paragraph style {@link ParagraphStyle} + * @param { FontCollection } fontCollection - Font collection {@link FontCollection} + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + constructor(paragraphStyle: ParagraphStyle, fontCollection: FontCollection); + /** + * Push a style to the stack. + * @param { TextStyle } textStyle - Text style {@link TextStyle} + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + pushStyle(textStyle: TextStyle): void; + /** + * Remove a style from the stack. + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + popStyle(): void; + /** + * Adds text to the builder. + * @param { string } text - Text string + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + addText(text: string): void; + /** + * Add placeholder. + * @param { PlaceholderSpan } placeholderSpan - Placeholder Span {@link PlaceholderSpan} + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + addPlaceholder(placeholderSpan: PlaceholderSpan): void; + /** + * Create paragraph object. + * @returns { Paragraph } The paragraph value returned to the caller. + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + build(): Paragraph; + } + /** + * The structure of text line that provides the basis of paragraph for graphics. + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + class TextLine { + /** + * Get the count of glyphs. + * @returns { number } The counts of glyphs. + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + getGlyphCount(): number; + /** + * Get the range of text line. + * @returns { Range } The range of text. + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + getTextRange(): Range; + /** + * Get the glyph runs of text line. + * @returns { Array } The tuple of glyph runs of text. + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + getGlyphRuns(): Array; + /** + * Paint the range of text line. + * @param { drawing.Canvas } canvas - Canvas. + * @param { number } x - Represents the X-axis position on the canvas. + * @param { number } y - Represents the Y-axis position on the canvas. + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + paint(canvas: drawing.Canvas, x: number, y: number): void; + } + /** + * Independent rendering of text layout. + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + class Run { + /** + * Gets the number of glyph. + * @returns { number } The number of glyph. + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + getGlyphCount(): number; + /** + * Gets the glyph identifier for each character. + * @returns { Array } Glyph identifier. + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + getGlyphs(): Array; + /** + * Gets the font position offset. + * @returns { Array } The position of the font in the layout. + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + getPositions(): Array; + /** + * Gets the font position offset array. + * @returns { Array } The position offset of the font in the layout. + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + getOffsets(): Array; + /** + * Gets the font object instance. + * @returns { drawing.Font } The font object instance. + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + getFont(): drawing.Font; + /** + * Paint the laid out text onto the supplied canvas at (x, y). + * @param { drawing.Canvas } canvas - Object. + * @param { number } x - Represents the X-axis position on the canvas. + * @param { number } y - Represents the Y-axis position on the canvas. + * @syscap SystemCapability.Graphics.Drawing + * @since 12 + */ + paint(canvas: drawing.Canvas, x: number, y: number): void; + } +} +export default text; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.hiAppEvent.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.hiAppEvent.d.ts new file mode 100755 index 00000000..304c5674 --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.hiAppEvent.d.ts @@ -0,0 +1,212 @@ +/* + * Copyright (c) 2021-2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit PerformanceAnalysisKit + */ +import type { AsyncCallback } from './@ohos.base'; +/** + * Provides the event logging function for applications to log the fault, statistical, security, + * and user behavior events reported during running. Based on event information, + * you will be able to analyze the running status of applications. + * + * @namespace hiAppEvent + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * @since 7 + * @deprecated since 9 + * @useinstead ohos.hiviewdfx.hiAppEvent + */ +declare namespace hiAppEvent { + /** + * Enumerate application event types. + * + * @enum { number } + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * @since 7 + * @deprecated since 9 + */ + enum EventType { + /** + * Fault event. + * + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * @since 7 + * @deprecated since 9 + */ + FAULT = 1, + /** + * Statistic event. + * + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * @since 7 + * @deprecated since 9 + */ + STATISTIC = 2, + /** + * Security event. + * + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * @since 7 + * @deprecated since 9 + */ + SECURITY = 3, + /** + * User behavior event. + * + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * @since 7 + * @deprecated since 9 + */ + BEHAVIOR = 4 + } + /** + * Preset event. + * + * @namespace Event + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * @since 7 + * @deprecated since 9 + */ + namespace Event { + /** + * User login event. + * + * @constant + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * @since 7 + * @deprecated since 9 + */ + const USER_LOGIN: string; + /** + * User logout event. + * + * @constant + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * @since 7 + * @deprecated since 9 + */ + const USER_LOGOUT: string; + /** + * Distributed service event. + * + * @constant + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * @since 7 + * @deprecated since 9 + */ + const DISTRIBUTED_SERVICE_START: string; + } + /** + * Preset param. + * + * @namespace Param + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * @since 7 + * @deprecated since 9 + */ + namespace Param { + /** + * User id. + * + * @constant + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * @since 7 + * @deprecated since 9 + */ + const USER_ID: string; + /** + * Distributed service name. + * + * @constant + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * @since 7 + * @deprecated since 9 + */ + const DISTRIBUTED_SERVICE_NAME: string; + /** + * Distributed service instance id. + * + * @constant + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * @since 7 + * @deprecated since 9 + */ + const DISTRIBUTED_SERVICE_INSTANCE_ID: string; + } + /** + * Write application event. + * + * @param { string } eventName Application event name. + * @param { EventType } eventType Application event type. + * @param { object } keyValues Application event key-value pair params. + * @returns { Promise } Return Promise. + * @static + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * @since 7 + * @deprecated since 9 + */ + function write(eventName: string, eventType: EventType, keyValues: object): Promise; + /** + * Write application event. + * + * @param { string } eventName Application event name. + * @param { EventType } eventType Application event type. + * @param { object } keyValues Application event key-value pair params. + * @param { AsyncCallback } [callback] Callback function. + * @static + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * @since 7 + * @deprecated since 9 + */ + function write(eventName: string, eventType: EventType, keyValues: object, callback: AsyncCallback): void; + /** + * Application event logging configuration interface. + * + * @param { ConfigOption } config Application event logging configuration item object. + * @returns { boolean } Configuration result. + * @static + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * @since 7 + * @deprecated since 9 + */ + function configure(config: ConfigOption): boolean; + /** + * Describe the options for the configuration. + * + * @interface ConfigOption + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * @since 7 + * @deprecated since 9 + */ + interface ConfigOption { + /** + * Configuration item: application event logging switch. + * + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * @since 7 + * @deprecated since 9 + */ + disable?: boolean; + /** + * Configuration item: event file directory storage quota size. + * + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * @since 7 + * @deprecated since 9 + */ + maxStorage?: string; + } +} +export default hiAppEvent; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.hiTraceChain.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.hiTraceChain.d.ts new file mode 100755 index 00000000..9732ae4e --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.hiTraceChain.d.ts @@ -0,0 +1,308 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit PerformanceAnalysisKit + */ +/** + * Provides APIs to implement call chain tracing throughout a service process. + * With HiTrace, you can quickly obtain the run log for the call chain of a + * specified service process and locate faults in cross-device, cross-process, + * or cross-thread communications. + * + * @namespace hiTraceChain + * @syscap SystemCapability.HiviewDFX.HiTrace + * @since 8 + */ +declare namespace hiTraceChain { + /** + * Enumerate trace flag + * + * @enum { number } + * @syscap SystemCapability.HiviewDFX.HiTrace + * @since 8 + */ + enum HiTraceFlag { + /** + * Default value + * + * @syscap SystemCapability.HiviewDFX.HiTrace + * @since 8 + */ + DEFAULT = 0, + /** + * Trace sync and async call. default: trace sync call only. + * + * @syscap SystemCapability.HiviewDFX.HiTrace + * @since 8 + */ + INCLUDE_ASYNC = 1, + /** + * Do not create child span. default: create child span. + * + * @syscap SystemCapability.HiviewDFX.HiTrace + * @since 8 + */ + DONOT_CREATE_SPAN = 1 << 1, + /** + * Output tracepoint info in span. default: do not output tracepoint info. + * + * @syscap SystemCapability.HiviewDFX.HiTrace + * @since 8 + */ + TP_INFO = 1 << 2, + /** + * Do not output begin and end info. default: output begin and end info. + * + * @syscap SystemCapability.HiviewDFX.HiTrace + * @since 8 + */ + NO_BE_INFO = 1 << 3, + /** + * Do not add id to log. default: add id to log. + * + * @syscap SystemCapability.HiviewDFX.HiTrace + * @since 8 + */ + DISABLE_LOG = 1 << 4, + /** + * The trace is triggered by fault. + * + * @syscap SystemCapability.HiviewDFX.HiTrace + * @since 8 + */ + FAILURE_TRIGGER = 1 << 5, + /** + * Output device-to-device tracepoint info in span only. default: do not output device-to-device tracepoint info. + * + * @syscap SystemCapability.HiviewDFX.HiTrace + * @since 8 + */ + D2D_TP_INFO = 1 << 6 + } + /** + * Enumerate trace point type + * + * @enum { number } + * @syscap SystemCapability.HiviewDFX.HiTrace + * @since 8 + */ + enum HiTraceTracepointType { + /** + * Client send + * + * @syscap SystemCapability.HiviewDFX.HiTrace + * @since 8 + */ + CS = 0, + /** + * Client receive + * + * @syscap SystemCapability.HiviewDFX.HiTrace + * @since 8 + */ + CR = 1, + /** + * Server send + * + * @syscap SystemCapability.HiviewDFX.HiTrace + * @since 8 + */ + SS = 2, + /** + * Server receive + * + * @syscap SystemCapability.HiviewDFX.HiTrace + * @since 8 + */ + SR = 3, + /** + * General info + * + * @syscap SystemCapability.HiviewDFX.HiTrace + * @since 8 + */ + GENERAL = 4 + } + /** + * Enumerate trace communication mode + * + * @enum { number } + * @syscap SystemCapability.HiviewDFX.HiTrace + * @since 8 + */ + enum HiTraceCommunicationMode { + /** + * Unspecified + * + * @syscap SystemCapability.HiviewDFX.HiTrace + * @since 8 + */ + DEFAULT = 0, + /** + * Thread-to-thread + * + * @syscap SystemCapability.HiviewDFX.HiTrace + * @since 8 + */ + THREAD = 1, + /** + * Process-to-process + * + * @syscap SystemCapability.HiviewDFX.HiTrace + * @since 8 + */ + PROCESS = 2, + /** + * Device-to-device + * + * @syscap SystemCapability.HiviewDFX.HiTrace + * @since 8 + */ + DEVICE = 3 + } + /** + * Trace id, for tracing process. + * + * @interface HiTraceId + * @syscap SystemCapability.HiviewDFX.HiTrace + * @since 8 + */ + interface HiTraceId { + /** + * Chain id. + * + * @type { bigint } + * @syscap SystemCapability.HiviewDFX.HiTrace + * @since 8 + */ + chainId: bigint; + /** + * Span id. + * + * @type { ?number } + * @syscap SystemCapability.HiviewDFX.HiTrace + * @since 8 + */ + spanId?: number; + /** + * Parent span id. + * + * @type { ?number } + * @syscap SystemCapability.HiviewDFX.HiTrace + * @since 8 + */ + parentSpanId?: number; + /** + * Trace flag. + * + * @type { ?number } + * @syscap SystemCapability.HiviewDFX.HiTrace + * @since 8 + */ + flags?: number; + } + /** + * Start tracing a process impl. + * + * @param { string } name Process name. + * @param { number } flags Trace function flag. + * @returns { HiTraceId } Valid if first call, otherwise invalid. + * @syscap SystemCapability.HiviewDFX.HiTrace + * @since 8 + */ + function begin(name: string, flags?: number): HiTraceId; + /** + * Stop process tracing and clear trace id of current thread if the given trace + * id is valid, otherwise do nothing. + * + * @param { HiTraceId } id The trace id that need to stop. + * @syscap SystemCapability.HiviewDFX.HiTrace + * @since 8 + */ + function end(id: HiTraceId): void; + /** + * Get trace id of current thread, and return a invalid trace id if no + * trace id belong to current thread + * + * @returns { HiTraceId } Valid if current thread have a trace id, otherwise invalid. + * @syscap SystemCapability.HiviewDFX.HiTrace + * @since 8 + */ + function getId(): HiTraceId; + /** + * Set id as trace id of current thread. Do nothing if id is invalid. + * + * @param { HiTraceId } id Set id as trace id of current thread. + * @syscap SystemCapability.HiviewDFX.HiTrace + * @since 8 + */ + function setId(id: HiTraceId): void; + /** + * Clear trace id of current thread and set it invalid. + * + * @syscap SystemCapability.HiviewDFX.HiTrace + * @since 8 + */ + function clearId(): void; + /** + * Create a new span id according to the trace id of current thread. + * + * @returns { HiTraceId } A valid span trace id. Otherwise trace id of current thread if do not allow create span. + * @syscap SystemCapability.HiviewDFX.HiTrace + * @since 8 + */ + function createSpan(): HiTraceId; + /** + * Print hitrace info, include trace id info. + * + * @param { HiTraceCommunicationMode } mode Trace communication mode. + * @param { HiTraceTracepointType } type Trace info type. + * @param { HiTraceId } id Trace id that need to print. + * @param { string } msg Customized info that need to print. + * @syscap SystemCapability.HiviewDFX.HiTrace + * @since 8 + */ + function tracepoint(mode: HiTraceCommunicationMode, type: HiTraceTracepointType, id: HiTraceId, msg?: string): void; + /** + * Judge whether the trace id is valid or not. + * + * @param { HiTraceId } id Trace id that need to judge. + * @returns { boolean } True for a valid trace id, otherwise false. + * @syscap SystemCapability.HiviewDFX.HiTrace + * @since 8 + */ + function isValid(id: HiTraceId): boolean; + /** + * Judge whether the trace id has enabled a trace flag or not. + * + * @param { HiTraceId } id Trace id that need to judge. + * @param { HiTraceFlag } flag Trace flag that need to judge. + * @returns { boolean } true if the trace id has enabled the flag. + * @syscap SystemCapability.HiviewDFX.HiTrace + * @since 8 + */ + function isFlagEnabled(id: HiTraceId, flag: HiTraceFlag): boolean; + /** + * Enable the designative trace flag for the trace id. + * + * @param { HiTraceId } id Trace id that need to enable a flag. + * @param { HiTraceFlag } flag the designative trace flag that need to be enabled in the trace id. + * @syscap SystemCapability.HiviewDFX.HiTrace + * @since 8 + */ + function enableFlag(id: HiTraceId, flag: HiTraceFlag): void; +} +export default hiTraceChain; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.hiTraceMeter.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.hiTraceMeter.d.ts new file mode 100755 index 00000000..20245c72 --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.hiTraceMeter.d.ts @@ -0,0 +1,84 @@ +/* + * Copyright (C) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit PerformanceAnalysisKit + */ +/** + * Provides interfaces to trace a task for performance measure, the logs can be capture by the + * bytrace cmdline available on the device. + * + *

This interfaces trace the start, end, and value changes of key processes that last for at least 3 ms. + * + *

Example: + * Track the beginning of a context: + *

{@code
+ * hiTraceMeter.startTrace("checkName", 111);
+ * }
+ * Track the end of a context: + *
{@code
+ * hiTraceMeter.finishTrace("checkName", 111);
+ * }
+ * To trace the number of layers, which is 3: + *
{@code
+ * hiTraceMeter.traceByValue("curLayer", 3);
+ * }
+ * + *

Each {@code startTrace} matches one {@code finishTrace}, and they must have the same name + * and taskId. + * + * @namespace hiTraceMeter + * @syscap SystemCapability.HiviewDFX.HiTrace + * @since 8 + */ +declare namespace hiTraceMeter { + /** + * Records a trace marking it as the start of a task, can with the expected completion time between + * startTrace and finishTrace. + * + * This method is invoked at the start of a transaction to indicate that a task has started, whose name + * is specified by {@code name}, and the taskId is used to distinguish the tasks. It must be followed by + * {@link #finishTrace}, the name and taskId need to be the same. + * + * @param { string } name Indicates the task name. + * @param { number } taskId The unique id used to distinguish the tasks and match with the id in follow finishTrace. + * @syscap SystemCapability.HiviewDFX.HiTrace + * @since 8 + */ + function startTrace(name: string, taskId: number): void; + /** + * Records a trace and marks it as the end of a task. + * + * This method is invoked at the end of a transaction to indicate that a task has ended, whose name + * is specified by {@code name}. This method must be invoked after the the startTrace. + * + * @param { string } name Indicates the task name. It must be the same with the {@code name} of startTrace. + * @param { number } taskId The unique id used to distinguish the tasks and must be the same with the . + * {@code taskId} of startTrace. + * @syscap SystemCapability.HiviewDFX.HiTrace + * @since 8 + */ + function finishTrace(name: string, taskId: number): void; + /** + * Records a trace for generating a count, such as clock pulse and the number of layers. + * + * @param { string } name Indicates the name used to identify the count. + * @param { number } count Indicates the number of the count. + * @syscap SystemCapability.HiviewDFX.HiTrace + * @since 8 + */ + function traceByValue(name: string, count: number): void; +} +export default hiTraceMeter; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.hichecker.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.hichecker.d.ts new file mode 100755 index 00000000..ae01df07 --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.hichecker.d.ts @@ -0,0 +1,135 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit PerformanceAnalysisKit + */ +/** + * This module provides the capability to check bad code usage. + * + * @namespace hichecker + * @syscap SystemCapability.HiviewDFX.HiChecker + * @since 8 + */ +declare namespace hichecker { + /** + * The caution rule print log. + * + * @constant + * @syscap SystemCapability.HiviewDFX.HiChecker + * @since 8 + */ + const RULE_CAUTION_PRINT_LOG: 9223372036854775808n; // 1 << 63 + /** + * The caution rule trigger crash. + * + * @constant + * @syscap SystemCapability.HiviewDFX.HiChecker + * @since 8 + */ + const RULE_CAUTION_TRIGGER_CRASH: 4611686018427387904n; // 1 << 62 + /** + * The thread rule check slow process. + * + * @constant + * @syscap SystemCapability.HiviewDFX.HiChecker + * @since 8 + */ + const RULE_THREAD_CHECK_SLOW_PROCESS: 1n; + /** + * The process rule check ability connection leak. + * + * @constant + * @syscap SystemCapability.HiviewDFX.HiChecker + * @since 8 + */ + const RULE_CHECK_ABILITY_CONNECTION_LEAK: 8589934592n; // 1 << 33 + /** + * The process rule check ability Arkui performance + * + * @constant + * @syscap SystemCapability.HiviewDFX.HiChecker + * @since 11 + */ + const RULE_CHECK_ARKUI_PERFORMANCE: 17179869184n; // 1 << 34 + /** + * add one or more rule. + * + * @param { bigint } rule + * @syscap SystemCapability.HiviewDFX.HiChecker + * @since 8 + * @deprecated since 9 + * @useinstead ohos.hichecker/hichecker#addCheckRule + */ + function addRule(rule: bigint): void; + /** + * remove one or more rule. + * + * @param { bigint } rule + * @syscap SystemCapability.HiviewDFX.HiChecker + * @since 8 + * @deprecated since 9 + * @useinstead ohos.hichecker/hichecker#removeCheckRule + */ + function removeRule(rule: bigint): void; + /** + * get added rule + * + * @returns { bigint } all added thread rule and process rule. + * @syscap SystemCapability.HiviewDFX.HiChecker + * @since 8 + */ + function getRule(): bigint; + /** + * whether the query rule is added + * + * @param { bigint } rule + * @returns { boolean } the result of whether the query rule is added. + * @syscap SystemCapability.HiviewDFX.HiChecker + * @since 8 + * @deprecated since 9 + * @useinstead ohos.hichecker/hichecker#containsCheckRule + */ + function contains(rule: bigint): boolean; + /** + * Add one or more rule. + * + * @param { bigint } rule + * @throws { BusinessError } 401 - the parameter check failed, only one bigint type parameter is needed + * @syscap SystemCapability.HiviewDFX.HiChecker + * @since 9 + */ + function addCheckRule(rule: bigint): void; + /** + * Remove one or more rule. + * + * @param { bigint } rule + * @throws { BusinessError } 401 - the parameter check failed, only one bigint type parameter is needed + * @syscap SystemCapability.HiviewDFX.HiChecker + * @since 9 + */ + function removeCheckRule(rule: bigint): void; + /** + * Whether the query rule is added + * + * @param { bigint } rule + * @returns { boolean } the result of whether the query rule is added. + * @throws { BusinessError } 401 - the parameter check failed, only one bigint type parameter is needed + * @syscap SystemCapability.HiviewDFX.HiChecker + * @since 9 + */ + function containsCheckRule(rule: bigint): boolean; +} +export default hichecker; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.hidebug.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.hidebug.d.ts new file mode 100755 index 00000000..322aa1fe --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.hidebug.d.ts @@ -0,0 +1,750 @@ +/* +* Copyright (C) 2022 Huawei Device Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +/** + * @file + * @kit PerformanceAnalysisKit + */ +/** + * Provide interfaces related to debugger access and obtaining CPU, + * memory and other virtual machine information during runtime for JS programs + * + * @namespace hidebug + * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug + * @since 8 + */ +declare namespace hidebug { + /** + * Get total native heap memory size + * + * @returns { bigint } Returns total native heap memory size. + * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug + * @since 8 + */ + function getNativeHeapSize(): bigint; + /** + * Get Native heap memory allocation size. + * @returns { bigint } Returns native heap memory allocation size. + * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug + * @since 8 + */ + function getNativeHeapAllocatedSize(): bigint; + /** + * Get Native heap memory free size + * + * @returns { bigint } Returns native heap memory free size. + * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug + * @since 8 + */ + function getNativeHeapFreeSize(): bigint; + /** + * Get the virtual set size memory of the application process + * + * @returns { bigint } Returns application process virtual set size memory information. + * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug + * @since 11 + */ + function getVss(): bigint; + /** + * Get application process proportional set size memory information + * + * @returns { bigint } Returns application process proportional set size memory information. + * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug + * @since 8 + */ + function getPss(): bigint; + /** + * Obtains the size of the shared dirty memory of a process. + * + * @returns { bigint } Returns the size of the shared dirty memory. + * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug + * @since 8 + */ + function getSharedDirty(): bigint; + /** + * Obtains the size of the private dirty memory of a process. + * @returns { bigint } Returns the size of the private dirty memory. + * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug + * @since 9 + */ + function getPrivateDirty(): bigint; + /** + * Obtains the cpu usage percent of a process. + * + * @returns { number } Returns the cpu usage of a process. + * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug + * @since 9 + */ + function getCpuUsage(): number; + /** + * Start CPU Profiling. + * The input parameter is a user-defined file name, excluding the file suffix. + * The generated file is in the files folder under the application directory. + * Such as "/data/accounts/account_0/appdata/[package name]/files/cpuprofiler-xxx.json" + * + * @param { string } filename - Indicates the user-defined file name, excluding the file suffix. + * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug + * @since 8 + * @deprecated since 9 + * @useinstead ohos.hidebug/hidebug.startJsCpuProfiling + */ + function startProfiling(filename: string): void; + /** + * Stop CPU Profiling. + * It takes effect only when the CPU profiler is turned on + * + * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug + * @since 8 + * @deprecated since 9 + * @useinstead ohos.hidebug/hidebug.stopJsCpuProfiling + */ + function stopProfiling(): void; + /** + * Dump JS Virtual Machine Heap Snapshot. + * The input parameter is a user-defined file name, excluding the file suffix. + * The generated file is in the files folder under the application directory. + * Such as "/data/accounts/account_0/appdata/[package name]/files/xxx.heapsnapshot" + * + * @param { string } filename - Indicates the user-defined file name, excluding the file suffix. + * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug + * @since 8 + * @deprecated since 9 + * @useinstead ohos.hidebug/hidebug.dumpJsHeapData + */ + function dumpHeapData(filename: string): void; + /** + * Start CPU Profiling. + * The input parameter is a user-defined file name, excluding the file suffix. + * The generated file is in the files folder under the application directory. + * + * @param { string } filename - Indicates the user-defined file name, excluding the file suffix. + * @throws {BusinessError} 401 - the parameter check failed, Parameter type error + * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug + * @since 9 + */ + function startJsCpuProfiling(filename: string): void; + /** + * Stop CPU Profiling. + * It takes effect only when the CPU profiler is turned on + * + * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug + * @since 9 + */ + function stopJsCpuProfiling(): void; + /** + * Dump JS Virtual Machine Heap Snapshot. + * The input parameter is a user-defined file name, excluding the file suffix. + * The generated file is in the files folder under the application directory. + * + * @param { string } filename - Indicates the user-defined file name, excluding the file suffix. + * @throws {BusinessError} 401 - the parameter check failed, Parameter type error + * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug + * @since 9 + */ + function dumpJsHeapData(filename: string): void; + /** + * Get a debugging dump of a system service by service id. + * It need dump permission. + * + * @permission ohos.permission.DUMP + * @param { number } serviceid - Indicates the id of the service ability. + * @param { number } fd - The file descriptor. + * @param { Array } args - The args list of the system ability dump interface. + * @throws {BusinessError} 401 - the parameter check failed, Possible causes: + * 1.the parameter type error + * 2.the args parameter is not string array + * @throws {BusinessError} 11400101 - the service id is invalid + * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug + * @since 9 + */ + function getServiceDump(serviceid: number, fd: number, args: Array): void; + /** + * Obtains the cpu usage of system. + * + * @returns { number } Returns the cpu usage of system. + * @throws { BusinessError } 11400104 - The status of the system cpu usage is abnormal + * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug + * @since 12 + */ + function getSystemCpuUsage(): number; + /** + * Application CPU usage of thread. + * + * @interface ThreadCpuUsage + * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug + * @since 12 + */ + interface ThreadCpuUsage { + /** + * Thread id + * + * @type { number } + * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug + * @since 12 + */ + threadId: number; + /** + * Cpu usage of thread + * + * @type { number } + * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug + * @since 12 + */ + cpuUsage: number; + } + /** + * Get the CPU usage of all threads in the application. + * + * @returns { ThreadCpuUsage[] } Returns the CPU usage of all threads in the application. + * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug + * @since 12 + */ + function getAppThreadCpuUsage(): ThreadCpuUsage[]; + /** + * System memory information + * + * @interface SystemMemInfo + * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug + * @since 12 + */ + interface SystemMemInfo { + /** + * Total system memory size, in kilobyte + * + * @type { bigint } + * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug + * @since 12 + */ + totalMem: bigint; + /** + * System free memory size, in kilobyte + * + * @type { bigint } + * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug + * @since 12 + */ + freeMem: bigint; + /** + * System available memory size, in kilobyte + * + * @type { bigint } + * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug + * @since 12 + */ + availableMem: bigint; + } + /** + * Obtains the system memory size. + * + * @returns { SystemMemInfo } Returns system memory size. + * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug + * @since 12 + */ + function getSystemMemInfo(): SystemMemInfo; + /** + * Application process native memory information. + * + * @interface NativeMemInfo + * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug + * @since 12 + */ + interface NativeMemInfo { + /** + * Process proportional set size memory, in kilobyte + * + * @type { bigint } + * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug + * @since 12 + */ + pss: bigint; + /** + * Virtual set size memory, in kilobyte + * + * @type { bigint } + * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug + * @since 12 + */ + vss: bigint; + /** + * Resident set size, in kilobyte + * + * @type { bigint } + * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug + * @since 12 + */ + rss: bigint; + /** + * The size of the shared dirty memory, in kilobyte + * + * @type { bigint } + * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug + * @since 12 + */ + sharedDirty: bigint; + /** + * The size of the private dirty memory, in kilobyte + * + * @type { bigint } + * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug + * @since 12 + */ + privateDirty: bigint; + /** + * The size of the shared clean memory, in kilobyte + * + * @type { bigint } + * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug + * @since 12 + */ + sharedClean: bigint; + /** + * The size of the private clean memory, in kilobyte + * + * @type { bigint } + * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug + * @since 12 + */ + privateClean: bigint; + } + /** + * Obtains the memory information of application process. + * + * @returns { NativeMemInfo } Returns the native memory of a process. + * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug + * @since 12 + */ + function getAppNativeMemInfo(): NativeMemInfo; + /** + * Application process memory limit + * + * @interface MemoryLimit + * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug + * @since 12 + */ + interface MemoryLimit { + /** + * The limit of the application process's resident set, in kilobyte + * + * @type { bigint } + * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug + * @since 12 + */ + rssLimit: bigint; + /** + * The limit of the application process's virtual memory, in kilobyte + * + * @type { bigint } + * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug + * @since 12 + */ + vssLimit: bigint; + /** + * The limit of the js vm heap size of current virtual machine, in kilobyte + * + * @type { bigint } + * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug + * @since 12 + */ + vmHeapLimit: bigint; + } + /** + * Obtains the memory limit of application process. + * + * @returns { MemoryLimit } Returns memory limit of application. + * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug + * @since 12 + */ + function getAppMemoryLimit(): MemoryLimit; + /** + * The memory information of application virtual machine. + * + * @interface VMMemoryInfo + * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug + * @since 12 + */ + interface VMMemoryInfo { + /** + * Total size of current virtual machine Heap, in kilobyte + * + * @type { bigint } + * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug + * @since 12 + */ + totalHeap: bigint; + /** + * Used size of current virtual machine Heap, in kilobyte + * + * @type { bigint } + * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug + * @since 12 + */ + heapUsed: bigint; + /** + * All array object size of current virtual machine, in kilobyte + * + * @type { bigint } + * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug + * @since 12 + */ + allArraySize: bigint; + } + /** + * Obtains the memory information of application virtual machine. + * + * @returns { VMMemoryInfo } Returns memory information of application virtual machine. + * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug + * @since 12 + */ + function getAppVMMemoryInfo(): VMMemoryInfo; + /** + * Enum for trace flag + * + * @enum { number } + * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug + * @since 12 + */ + enum TraceFlag { + /** + * Only capture main thread trace + * + * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug + * @since 12 + */ + MAIN_THREAD = 1, + /** + * Capture all thread trace + * + * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug + * @since 12 + */ + ALL_THREADS = 2 + } + /** + * Provide trace tags + * + * @namespace tags + * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug + * @since 12 + */ + namespace tags { + /** + * Ability Manager tag. + * + * @constant + * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug + * @since 12 + */ + const ABILITY_MANAGER: number; + /** + * ARKUI development framework tag. + * + * @constant + * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug + * @since 12 + */ + const ARKUI: number; + /** + * ARK tag. + * + * @constant + * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug + * @since 12 + */ + const ARK: number; + /** + * Bluetooth tag. + * + * @constant + * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug + * @since 12 + */ + const BLUETOOTH: number; + /** + * Common library subsystem tag. + * + * @constant + * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug + * @since 12 + */ + const COMMON_LIBRARY: number; + /** + * Distributed hardware device manager tag. + * + * @constant + * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug + * @since 12 + */ + const DISTRIBUTED_HARDWARE_DEVICE_MANAGER: number; + /** + * Distributed audio tag. + * + * @constant + * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug + * @since 12 + */ + const DISTRIBUTED_AUDIO: number; + /** + * Distributed camera tag. + * + * @constant + * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug + * @since 12 + */ + const DISTRIBUTED_CAMERA: number; + /** + * Distributed data manager module tag. + * + * @constant + * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug + * @since 12 + */ + const DISTRIBUTED_DATA: number; + /** + * Distributed hardware framework tag. + * + * @constant + * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug + * @since 12 + */ + const DISTRIBUTED_HARDWARE_FRAMEWORK: number; + /** + * Distributed input tag. + * + * @constant + * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug + * @since 12 + */ + const DISTRIBUTED_INPUT: number; + /** + * Distributed screen tag. + * + * @constant + * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug + * @since 12 + */ + const DISTRIBUTED_SCREEN: number; + /** + * Distributed scheduler tag. + * + * @constant + * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug + * @since 12 + */ + const DISTRIBUTED_SCHEDULER: number; + /** + * FFRT tasks. + * + * @constant + * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug + * @since 12 + */ + const FFRT: number; + /** + * File management tag. + * + * @constant + * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug + * @since 12 + */ + const FILE_MANAGEMENT: number; + /** + * Global resource manager tag. + * + * @constant + * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug + * @since 12 + */ + const GLOBAL_RESOURCE_MANAGER: number; + /** + * Graphics module tag. + * + * @constant + * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug + * @since 12 + */ + const GRAPHICS: number; + /** + * HDF subsystem tag. + * + * @constant + * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug + * @since 12 + */ + const HDF: number; + /** + * MISC module tag. + * + * @constant + * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug + * @since 12 + */ + const MISC: number; + /** + * Multimodal input module tag. + * + * @constant + * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug + * @since 12 + */ + const MULTIMODAL_INPUT: number; + /** + * Net tag. + * + * @constant + * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug + * @since 12 + */ + const NET: number; + /** + * Notification module tag. + * + * @constant + * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug + * @since 12 + */ + const NOTIFICATION: number; + /** + * NWeb tag. + * + * @constant + * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug + * @since 12 + */ + const NWEB: number; + /** + * OHOS generic tag. + * + * @constant + * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug + * @since 12 + */ + const OHOS: number; + /** + * Power manager tag. + * + * @constant + * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug + * @since 12 + */ + const POWER_MANAGER: number; + /** + * RPC tag. + * + * @constant + * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug + * @since 12 + */ + const RPC: number; + /** + * SA tag. + * + * @constant + * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug + * @since 12 + */ + const SAMGR: number; + /** + * Window manager tag. + * + * @constant + * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug + * @since 12 + */ + const WINDOW_MANAGER: number; + /** + * Audio module tag. + * + * @constant + * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug + * @since 12 + */ + const AUDIO: number; + /** + * Camera module tag. + * + * @constant + * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug + * @since 12 + */ + const CAMERA: number; + /** + * Image module tag. + * + * @constant + * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug + * @since 12 + */ + const IMAGE: number; + /** + * Media module tag. + * + * @constant + * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug + * @since 12 + */ + const MEDIA: number; + } + /** + * Start capture application trace. + * + * @param { number[] } tags - Tag of trace. + * @param { TraceFlag } flag - Trace flag. + * @param { number } limitSize - Max size of trace file, in bytes, the max is 500MB. + * @returns { string } Returns absolute path of the trace file. + * @throws { BusinessError } 401 - Invalid argument, Possible causes: + * 1.The limit parameter is too small + * 2.The parameter is not within the enumeration type + * 3.The parameter type error or parameter order error + * @throws { BusinessError } 11400102 - Have already capture trace + * @throws { BusinessError } 11400103 - Without write permission on the file + * @throws { BusinessError } 11400104 - The status of the trace is abnormal + * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug + * @since 12 + */ + function startAppTraceCapture(tags: number[], flag: TraceFlag, limitSize: number): string; + /** + * Stop capture application trace. + * + * @throws { BusinessError } 11400104 - The status of the trace is abnormal + * @throws { BusinessError } 11400105 - No capture trace running + * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug + * @since 12 + */ + function stopAppTraceCapture(): void; + /** + * Set the resource limitation of application.Please note that this function is only valid + * when the developer options switch of setting is turned on. + * + * @param { string } type - resource type. It could be pss_memory、js_heap、fd、or thread. + * @param { number } value - For different resource type, values could have different meaning: + * 1.For pss_memory, it means the baseline PSS memory size for the application, + * system memory control will be triggered if exceed the value too much. + * 2.For js_heap, it means the percentage of the used JS heap memory to the maximum limit exceed + * which heap dump will be triggered if enableDebugLog set as true, it can be set between 85 and 95. + * 3.For fd, it means the maximum fd number can be opened. + * 4.For thread, it means the maximum thread number can be created. + * @param { boolean } enableDebugLog - Whether to enable external debug log. Default is false, pls make sure set + * it as true only in gray release because collecting debug log will cost too much cpu or memory. + * @throws { BusinessError } 401 - Invalid argument, Possible causes: + * 1.The limit parameter is too small + * 2.The parameter is not in the specified type + * 3.The parameter type error or parameter order error + * @throws { BusinessError } 11400104 - Set limit failed due to remote exception + * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug + * @atomicservice + * @since 12 + */ + function setAppResourceLimit(type: string, value: number, enableDebugLog: boolean): void; +} +export default hidebug; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.hilog.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.hilog.d.ts new file mode 100755 index 00000000..e280f269 --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.hilog.d.ts @@ -0,0 +1,372 @@ +/* + * Copyright (c) 2021-2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit PerformanceAnalysisKit + */ +/** +* Provides interfaces to generate system logs. +* +* @namespace hilog +* @syscap SystemCapability.HiviewDFX.HiLog +* @since 7 +*/ +/** +* Provides interfaces to generate system logs. +* +* @namespace hilog +* @syscap SystemCapability.HiviewDFX.HiLog +* @crossplatform +* @since 10 +*/ +/** +* Provides interfaces to generate system logs. +* +* @namespace hilog +* @syscap SystemCapability.HiviewDFX.HiLog +* @crossplatform +* @atomicservice +* @since 11 +*/ +declare namespace hilog { + /** + * Outputs debug-level logs. + * + * @param { number } domain Indicates the service domain, which is a hexadecimal integer ranging from 0x0 to 0xFFFF + * @param { string } tag Identifies the log tag, length cannot exceed 32 bytes. + * @param { string } format Indicates the log format string. + * @param { any[] }args Indicates the log parameters. + * @syscap SystemCapability.HiviewDFX.HiLog + * @since 7 + */ + /** + * Outputs debug-level logs. + * + * @param { number } domain Indicates the service domain, which is a hexadecimal integer ranging from 0x0 to 0xFFFF + * @param { string } tag Identifies the log tag, length cannot exceed 32 bytes. + * @param { string } format Indicates the log format string. + * @param { any[] }args Indicates the log parameters. + * @syscap SystemCapability.HiviewDFX.HiLog + * @crossplatform + * @since 10 + */ + /** + * Outputs debug-level logs. + * + * @param { number } domain Indicates the service domain, which is a hexadecimal integer ranging from 0x0 to 0xFFFF + * @param { string } tag Identifies the log tag, length cannot exceed 32 bytes. + * @param { string } format Indicates the log format string. + * @param { any[] }args Indicates the log parameters. + * @syscap SystemCapability.HiviewDFX.HiLog + * @crossplatform + * @atomicservice + * @since 11 + */ + function debug(domain: number, tag: string, format: string, ...args: any[]): void; + /** + * Outputs info-level logs. + * + * @param { number } domain Indicates the service domain, which is a hexadecimal integer ranging from 0x0 to 0xFFFF + * @param { string } tag Identifies the log tag, length cannot exceed 32 bytes. + * @param { string } format Indicates the log format string. + * @param { any[] }args Indicates the log parameters. + * @syscap SystemCapability.HiviewDFX.HiLog + * @since 7 + */ + /** + * Outputs info-level logs. + * + * @param { number } domain Indicates the service domain, which is a hexadecimal integer ranging from 0x0 to 0xFFFF + * @param { string } tag Identifies the log tag, length cannot exceed 32 bytes. + * @param { string } format Indicates the log format string. + * @param { any[] }args Indicates the log parameters. + * @syscap SystemCapability.HiviewDFX.HiLog + * @crossplatform + * @since 10 + */ + /** + * Outputs info-level logs. + * + * @param { number } domain Indicates the service domain, which is a hexadecimal integer ranging from 0x0 to 0xFFFF + * @param { string } tag Identifies the log tag, length cannot exceed 32 bytes. + * @param { string } format Indicates the log format string. + * @param { any[] }args Indicates the log parameters. + * @syscap SystemCapability.HiviewDFX.HiLog + * @crossplatform + * @atomicservice + * @since 11 + */ + function info(domain: number, tag: string, format: string, ...args: any[]): void; + /** + * Outputs warning-level logs. + * + * @param { number } domain Indicates the service domain, which is a hexadecimal integer ranging from 0x0 to 0xFFFF + * @param { string } tag Identifies the log tag, length cannot exceed 32 bytes. + * @param { string } format Indicates the log format string. + * @param { any[] }args Indicates the log parameters. + * @syscap SystemCapability.HiviewDFX.HiLog + * @since 7 + */ + /** + * Outputs warning-level logs. + * + * @param { number } domain Indicates the service domain, which is a hexadecimal integer ranging from 0x0 to 0xFFFF + * @param { string } tag Identifies the log tag, length cannot exceed 32 bytes. + * @param { string } format Indicates the log format string. + * @param { any[] }args Indicates the log parameters. + * @syscap SystemCapability.HiviewDFX.HiLog + * @crossplatform + * @since 10 + */ + /** + * Outputs warning-level logs. + * + * @param { number } domain Indicates the service domain, which is a hexadecimal integer ranging from 0x0 to 0xFFFF + * @param { string } tag Identifies the log tag, length cannot exceed 32 bytes. + * @param { string } format Indicates the log format string. + * @param { any[] }args Indicates the log parameters. + * @syscap SystemCapability.HiviewDFX.HiLog + * @crossplatform + * @atomicservice + * @since 11 + */ + function warn(domain: number, tag: string, format: string, ...args: any[]): void; + /** + * Outputs error-level logs. + * + * @param { number } domain Indicates the service domain, which is a hexadecimal integer ranging from 0x0 to 0xFFFF + * @param { string } tag Identifies the log tag, length cannot exceed 32 bytes. + * @param { string } format Indicates the log format string. + * @param { any[] }args Indicates the log parameters. + * @syscap SystemCapability.HiviewDFX.HiLog + * @since 7 + */ + /** + * Outputs error-level logs. + * + * @param { number } domain Indicates the service domain, which is a hexadecimal integer ranging from 0x0 to 0xFFFF + * @param { string } tag Identifies the log tag, length cannot exceed 32 bytes. + * @param { string } format Indicates the log format string. + * @param { any[] }args Indicates the log parameters. + * @syscap SystemCapability.HiviewDFX.HiLog + * @crossplatform + * @since 10 + */ + /** + * Outputs error-level logs. + * + * @param { number } domain Indicates the service domain, which is a hexadecimal integer ranging from 0x0 to 0xFFFF + * @param { string } tag Identifies the log tag, length cannot exceed 32 bytes. + * @param { string } format Indicates the log format string. + * @param { any[] }args Indicates the log parameters. + * @syscap SystemCapability.HiviewDFX.HiLog + * @crossplatform + * @atomicservice + * @since 11 + */ + function error(domain: number, tag: string, format: string, ...args: any[]): void; + /** + * Outputs fatal-level logs. + * + * @param { number } domain Indicates the service domain, which is a hexadecimal integer ranging from 0x0 to 0xFFFF + * @param { string } tag Identifies the log tag, length cannot exceed 32 bytes. + * @param { string } format Indicates the log format string. + * @param { any[] }args Indicates the log parameters. + * @syscap SystemCapability.HiviewDFX.HiLog + * @since 7 + */ + /** + * Outputs fatal-level logs. + * + * @param { number } domain Indicates the service domain, which is a hexadecimal integer ranging from 0x0 to 0xFFFF + * @param { string } tag Identifies the log tag, length cannot exceed 32 bytes. + * @param { string } format Indicates the log format string. + * @param { any[] }args Indicates the log parameters. + * @syscap SystemCapability.HiviewDFX.HiLog + * @crossplatform + * @since 10 + */ + /** + * Outputs fatal-level logs. + * + * @param { number } domain Indicates the service domain, which is a hexadecimal integer ranging from 0x0 to 0xFFFF + * @param { string } tag Identifies the log tag, length cannot exceed 32 bytes. + * @param { string } format Indicates the log format string. + * @param { any[] }args Indicates the log parameters. + * @syscap SystemCapability.HiviewDFX.HiLog + * @crossplatform + * @atomicservice + * @since 11 + */ + function fatal(domain: number, tag: string, format: string, ...args: any[]): void; + /** + * Checks whether logs of the specified tag, and level can be printed. + * + * @param { number } domain Indicates the service domain, which is a hexadecimal integer ranging from 0x0 to 0xFFFF + * @param { string } tag Identifies the log tag, length cannot exceed 32 bytes. + * @param { LogLevel } level log level + * @returns { boolean } + * @syscap SystemCapability.HiviewDFX.HiLog + * @since 7 + */ + /** + * Checks whether logs of the specified tag, and level can be printed. + * + * @param { number } domain Indicates the service domain, which is a hexadecimal integer ranging from 0x0 to 0xFFFF + * @param { string } tag Identifies the log tag, length cannot exceed 32 bytes. + * @param { LogLevel } level log level + * @returns { boolean } + * @syscap SystemCapability.HiviewDFX.HiLog + * @atomicservice + * @since 11 + */ + function isLoggable(domain: number, tag: string, level: LogLevel): boolean; + /** + * Log level define + * + * @syscap SystemCapability.HiviewDFX.HiLog + * @since 7 + */ + /** + * Log level define + * + * @enum { number } + * @syscap SystemCapability.HiviewDFX.HiLog + * @crossplatform + * @since 10 + */ + /** + * Log level define + * + * @enum { number } + * @syscap SystemCapability.HiviewDFX.HiLog + * @crossplatform + * @atomicservice + * @since 11 + */ + enum LogLevel { + /** + * DEBUG Log level define + * + * @syscap SystemCapability.HiviewDFX.HiLog + * @since 7 + */ + /** + * DEBUG Log level define + * + * @syscap SystemCapability.HiviewDFX.HiLog + * @crossplatform + * @since 10 + */ + /** + * DEBUG Log level define + * + * @syscap SystemCapability.HiviewDFX.HiLog + * @crossplatform + * @atomicservice + * @since 11 + */ + DEBUG = 3, + /** + * INFO Log level define + * + * @syscap SystemCapability.HiviewDFX.HiLog + * @since 7 + */ + /** + * INFO Log level define + * + * @syscap SystemCapability.HiviewDFX.HiLog + * @crossplatform + * @since 10 + */ + /** + * INFO Log level define + * + * @syscap SystemCapability.HiviewDFX.HiLog + * @crossplatform + * @atomicservice + * @since 11 + */ + INFO = 4, + /** + * WARN Log level define + * + * @syscap SystemCapability.HiviewDFX.HiLog + * @since 7 + */ + /** + * WARN Log level define + * + * @syscap SystemCapability.HiviewDFX.HiLog + * @crossplatform + * @since 10 + */ + /** + * WARN Log level define + * + * @syscap SystemCapability.HiviewDFX.HiLog + * @crossplatform + * @atomicservice + * @since 11 + */ + WARN = 5, + /** + * ERROR Log level define + * + * @syscap SystemCapability.HiviewDFX.HiLog + * @since 7 + */ + /** + * ERROR Log level define + * + * @syscap SystemCapability.HiviewDFX.HiLog + * @crossplatform + * @since 10 + */ + /** + * ERROR Log level define + * + * @syscap SystemCapability.HiviewDFX.HiLog + * @crossplatform + * @atomicservice + * @since 11 + */ + ERROR = 6, + /** + * FATAL Log level define + * + * @syscap SystemCapability.HiviewDFX.HiLog + * @since 7 + */ + /** + * FATAL Log level define + * + * @syscap SystemCapability.HiviewDFX.HiLog + * @crossplatform + * @since 10 + */ + /** + * FATAL Log level define + * + * @syscap SystemCapability.HiviewDFX.HiLog + * @crossplatform + * @atomicservice + * @since 11 + */ + FATAL = 7 + } +} +export default hilog; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.hiviewdfx.hiAppEvent.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.hiviewdfx.hiAppEvent.d.ts new file mode 100755 index 00000000..3a29a9ff --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.hiviewdfx.hiAppEvent.d.ts @@ -0,0 +1,1297 @@ +/* + * Copyright (c) 2022-2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit PerformanceAnalysisKit + */ +import type { AsyncCallback } from './@ohos.base'; +/** + * Provides the event logging function for applications to log the fault, statistical, security, + * and user behavior events reported during running. Based on event information, + * you will be able to analyze the running status of applications. + * + * @namespace hiAppEvent + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * @since 9 + */ +/** + * Provides the event logging function for applications to log the fault, statistical, security, + * and user behavior events reported during running. Based on event information, + * you will be able to analyze the running status of applications. + * + * @namespace hiAppEvent + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * @atomicservice + * @since 11 + */ +declare namespace hiAppEvent { + /** + * Enumerate application event types. + * + * @enum { number } + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * @since 9 + */ + /** + * Enumerate application event types. + * + * @enum { number } + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * @atomicservice + * @since 11 + */ + enum EventType { + /** + * Fault event. + * + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * @since 9 + */ + /** + * Fault event. + * + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * @atomicservice + * @since 11 + */ + FAULT = 1, + /** + * Statistic event. + * + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * @since 9 + */ + /** + * Statistic event. + * + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * @atomicservice + * @since 11 + */ + STATISTIC = 2, + /** + * Security event. + * + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * @since 9 + */ + /** + * Security event. + * + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * @atomicservice + * @since 11 + */ + SECURITY = 3, + /** + * User behavior event. + * + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * @since 9 + */ + /** + * User behavior event. + * + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * @atomicservice + * @since 11 + */ + BEHAVIOR = 4 + } + /** + * Preset domain. + * + * @namespace domain + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * @atomicservice + * @since 11 + */ + namespace domain { + /** + * the domain of operating system. + * + * @constant + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * @atomicservice + * @since 11 + */ + const OS: string; + } + /** + * Preset event. + * + * @namespace event + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * @since 9 + */ + /** + * Preset event. + * + * @namespace event + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * @atomicservice + * @since 11 + */ + namespace event { + /** + * User login event. + * + * @constant + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * @since 9 + */ + /** + * User login event. + * + * @constant + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * @atomicservice + * @since 11 + */ + const USER_LOGIN: string; + /** + * User logout event. + * + * @constant + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * @since 9 + */ + /** + * User logout event. + * + * @constant + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * @atomicservice + * @since 11 + */ + const USER_LOGOUT: string; + /** + * Distributed service event. + * + * @constant + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * @since 9 + */ + /** + * Distributed service event. + * + * @constant + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * @atomicservice + * @since 11 + */ + const DISTRIBUTED_SERVICE_START: string; + /** + * crash event. + * + * @constant + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * @atomicservice + * @since 11 + */ + const APP_CRASH: string; + /** + * freeze event. + * + * @constant + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * @atomicservice + * @since 11 + */ + const APP_FREEZE: string; + /** + * launch event. + * + * @constant + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * @atomicservice + * @since 12 + */ + const APP_LAUNCH: string; + /** + * scroll jank event. + * + * @constant + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * @atomicservice + * @since 12 + */ + const SCROLL_JANK: string; + /** + * cpu usage high event. + * + * @constant + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * @atomicservice + * @since 12 + */ + const CPU_USAGE_HIGH: string; + /** + * battery usage event. + * + * @constant + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * @atomicservice + * @since 12 + */ + const BATTERY_USAGE: string; + /** + * resource overlimit event. + * + * @constant + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * @atomicservice + * @since 12 + */ + const RESOURCE_OVERLIMIT: string; + /** + * address sanitizer event. + * + * @constant + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * @atomicservice + * @since 12 + */ + const ADDRESS_SANITIZER: string; + /** + * main thread jank event. + * + * @constant + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * @atomicservice + * @since 12 + */ + const MAIN_THREAD_JANK: string; + } + /** + * Preset param. + * + * @namespace param + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * @since 9 + */ + /** + * Preset param. + * + * @namespace param + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * @atomicservice + * @since 11 + */ + namespace param { + /** + * User id. + * + * @constant + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * @since 9 + */ + /** + * User id. + * + * @constant + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * @atomicservice + * @since 11 + */ + const USER_ID: string; + /** + * Distributed service name. + * + * @constant + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * @since 9 + */ + /** + * Distributed service name. + * + * @constant + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * @atomicservice + * @since 11 + */ + const DISTRIBUTED_SERVICE_NAME: string; + /** + * Distributed service instance id. + * + * @constant + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * @since 9 + */ + /** + * Distributed service instance id. + * + * @constant + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * @atomicservice + * @since 11 + */ + const DISTRIBUTED_SERVICE_INSTANCE_ID: string; + } + /** + * Application event logging configuration interface. + * + * @param { ConfigOption } config Application event logging configuration item object. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 11103001 - Invalid max storage quota value. + * @static + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * @since 9 + */ + /** + * Application event logging configuration interface. + * + * @param { ConfigOption } config Application event logging configuration item object. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.The limit parameter is too small; + * 2.The parameter type error. + * @throws { BusinessError } 11103001 - Invalid max storage quota value. + * @static + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * @atomicservice + * @since 11 + */ + function configure(config: ConfigOption): void; + /** + * Describe the options for the configuration. + * + * @interface ConfigOption + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * @since 9 + */ + /** + * Describe the options for the configuration. + * + * @interface ConfigOption + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * @atomicservice + * @since 11 + */ + interface ConfigOption { + /** + * Configuration item: application event logging switch. + * + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * @since 9 + */ + /** + * Configuration item: application event logging switch. + * + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * @atomicservice + * @since 11 + */ + disable?: boolean; + /** + * Configuration item: event file directory storage quota size. + * + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * @since 9 + */ + /** + * Configuration item: event file directory storage quota size. + * + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * @atomicservice + * @since 11 + */ + maxStorage?: string; + } + /** + * Definition of written application event information. + * + * @interface AppEventInfo + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * @since 9 + */ + /** + * Definition of written application event information. + * + * @interface AppEventInfo + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * @atomicservice + * @since 11 + */ + interface AppEventInfo { + /** + * The domain of the event. + * + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * @since 9 + */ + /** + * The domain of the event. + * + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * @atomicservice + * @since 11 + */ + domain: string; + /** + * The name of the event. + * + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * @since 9 + */ + /** + * The name of the event. + * + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * @atomicservice + * @since 11 + */ + name: string; + /** + * The type of the event. + * + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * @since 9 + */ + /** + * The type of the event. + * + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * @atomicservice + * @since 11 + */ + eventType: EventType; + /** + * The params of the event. + * + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * @since 9 + */ + /** + * The params of the event. + * + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * @atomicservice + * @since 11 + */ + params: object; + } + /** + * Write application event. + * + * @param { AppEventInfo } info Application event information to be written. + * @returns { Promise } Return Promise. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 11100001 - Function is disabled. + * @throws { BusinessError } 11101001 - Invalid event domain. + * @throws { BusinessError } 11101002 - Invalid event name. + * @throws { BusinessError } 11101003 - Invalid number of event parameters. + * @throws { BusinessError } 11101004 - Invalid string length of the event parameter. + * @throws { BusinessError } 11101005 - Invalid event parameter name. + * @throws { BusinessError } 11101006 - Invalid array length of the event parameter. + * @static + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * @since 9 + */ + /** + * Write application event. + * + * @param { AppEventInfo } info Application event information to be written. + * @returns { Promise } Return Promise. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.The limit parameter is too small; + * 2.The parameter type error. + * @throws { BusinessError } 11100001 - Function is disabled. + * @throws { BusinessError } 11101001 - Invalid event domain. + * @throws { BusinessError } 11101002 - Invalid event name. + * @throws { BusinessError } 11101003 - Invalid number of event parameters. + * @throws { BusinessError } 11101004 - Invalid string length of the event parameter. + * @throws { BusinessError } 11101005 - Invalid event parameter name. + * @throws { BusinessError } 11101006 - Invalid array length of the event parameter. + * @static + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * @atomicservice + * @since 11 + */ + function write(info: AppEventInfo): Promise; + /** + * Write application event. + * + * @param { AppEventInfo } info Application event information to be written. + * @param { AsyncCallback } callback Callback function. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 11100001 - Function is disabled. + * @throws { BusinessError } 11101001 - Invalid event domain. + * @throws { BusinessError } 11101002 - Invalid event name. + * @throws { BusinessError } 11101003 - Invalid number of event parameters. + * @throws { BusinessError } 11101004 - Invalid string length of the event parameter. + * @throws { BusinessError } 11101005 - Invalid event parameter name. + * @throws { BusinessError } 11101006 - Invalid array length of the event parameter. + * @static + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * @since 9 + */ + /** + * Write application event. + * + * @param { AppEventInfo } info Application event information to be written. + * @param { AsyncCallback } callback Callback function. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.The limit parameter is too small; + * 2.The parameter type error. + * @throws { BusinessError } 11100001 - Function is disabled. + * @throws { BusinessError } 11101001 - Invalid event domain. + * @throws { BusinessError } 11101002 - Invalid event name. + * @throws { BusinessError } 11101003 - Invalid number of event parameters. + * @throws { BusinessError } 11101004 - Invalid string length of the event parameter. + * @throws { BusinessError } 11101005 - Invalid event parameter name. + * @throws { BusinessError } 11101006 - Invalid array length of the event parameter. + * @static + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * @atomicservice + * @since 11 + */ + function write(info: AppEventInfo, callback: AsyncCallback): void; + /** + * Indicates possible parameter types. + * + * @typedef {number | string | boolean | Array} + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * @atomicservice + * @since 12 + */ + type ParamType = number | string | boolean | Array; + /** + * It is used to set custom parameters for events, including both system-subscribed events and custom events. + * Existing parameter will be overwritten, and non-existing parameter will be created. + * + * @param { Record } params The parameters of the event. + * @param { string } domain The domain of the event. + * @param { string } name The name of the event. + * @returns { Promise } Return Promise. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.The limit parameter is too small; + * 2.The parameter type error. + * @throws { BusinessError } 11101007 - The number of parameter keys exceeds the limit. + * @static + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * @atomicservice + * @since 12 + */ + function setEventParam(params: Record, domain: string, name?: string): Promise; + /** + * Definition of the read event package. + * + * @interface AppEventPackage + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * @since 9 + */ + /** + * Definition of the read event package. + * + * @interface AppEventPackage + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * @atomicservice + * @since 11 + */ + interface AppEventPackage { + /** + * The id of the package. + * + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * @since 9 + */ + /** + * The id of the package. + * + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * @atomicservice + * @since 11 + */ + packageId: number; + /** + * The number of events contained in the package. + * + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * @since 9 + */ + /** + * The number of events contained in the package. + * + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * @atomicservice + * @since 11 + */ + row: number; + /** + * The total size of events contained in the package. + * + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * @since 9 + */ + /** + * The total size of events contained in the package. + * + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * @atomicservice + * @since 11 + */ + size: number; + /** + * The events data contained in the package. + * + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * @since 9 + */ + /** + * The events data contained in the package. + * + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * @atomicservice + * @since 11 + */ + data: string[]; + /** + * The event json format data contained in the package. + * + * @type { Array } + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * @atomicservice + * @since 12 + */ + appEventInfos: Array; + } + /** + * Definition of event holder object, which is used to read the event data monitored by the watcher. + * + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * @since 9 + */ + /** + * Definition of event holder object, which is used to read the event data monitored by the watcher. + * + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * @atomicservice + * @since 11 + */ + class AppEventPackageHolder { + /** + * Constructor for AppEventPackageHolder. + * + * @param { string } watcherName Name of the watcher to read. + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * @since 9 + */ + /** + * Constructor for AppEventPackageHolder. + * + * @param { string } watcherName Name of the watcher to read. + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * @atomicservice + * @since 11 + */ + constructor(watcherName: string); + /** + * Set the threshold size per read. + * + * @param { number } size Threshold size. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 11104001 - Invalid size value. + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * @since 9 + */ + /** + * Set the threshold size per read. + * + * @param { number } size Threshold size. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.The limit parameter is too small; + * 2.The parameter type error. + * @throws { BusinessError } 11104001 - Invalid size value. + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * @atomicservice + * @since 11 + */ + setSize(size: number): void; + /** + * Set the number of rows per read. + * + * @param { number } size Row size. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.The limit parameter is too small; + * 2.The parameter type error. + * @throws { BusinessError } 11104001 - Invalid size value. + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * @atomicservice + * @since 12 + */ + setRow(size: number): void; + /** + * Read the event data monitored by the watcher. + * + * @returns { AppEventPackage } The read event package. + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * @since 9 + */ + /** + * Read the event data monitored by the watcher. + * + * @returns { AppEventPackage } The read event package. + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * @atomicservice + * @since 11 + */ + takeNext(): AppEventPackage; + } + /** + * Definition of the condition for triggering callback when the watcher monitors event data. + * + * @interface TriggerCondition + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * @since 9 + */ + /** + * Definition of the condition for triggering callback when the watcher monitors event data. + * + * @interface TriggerCondition + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * @atomicservice + * @since 11 + */ + interface TriggerCondition { + /** + * The number of write events that trigger callback. + * + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * @since 9 + */ + /** + * The number of write events that trigger callback. + * + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * @atomicservice + * @since 11 + */ + row?: number; + /** + * The size of write events that trigger callback. + * + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * @since 9 + */ + /** + * The size of write events that trigger callback. + * + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * @atomicservice + * @since 11 + */ + size?: number; + /** + * The interval for triggering callback. + * + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * @since 9 + */ + /** + * The interval for triggering callback. + * + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * @atomicservice + * @since 11 + */ + timeOut?: number; + } + /** + * Definition of event filter object, which is used to filter events monitored by the watcher. + * + * @interface AppEventFilter + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * @since 9 + */ + /** + * Definition of event filter object, which is used to filter events monitored by the watcher. + * + * @interface AppEventFilter + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * @atomicservice + * @since 11 + */ + interface AppEventFilter { + /** + * The name of the event domain to be monitored by the watcher. + * + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * @since 9 + */ + /** + * The name of the event domain to be monitored by the watcher. + * + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * @atomicservice + * @since 11 + */ + domain: string; + /** + * The types of the events to be monitored by the watcher. + * + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * @since 9 + */ + /** + * The types of the events to be monitored by the watcher. + * + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * @atomicservice + * @since 11 + */ + eventTypes?: EventType[]; + /** + * The names of the events to be monitored by the watcher. + * + * @type { ?string[] } + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * @atomicservice + * @since 11 + */ + names?: string[]; + } + /** + * Definition of event group. + * + * @interface AppEventGroup + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * @atomicservice + * @since 11 + */ + interface AppEventGroup { + /** + * The name of the event. + * + * @type { string } + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * @atomicservice + * @since 11 + */ + name: string; + /** + * The event array which is group by the name. + * + * @type { Array } + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * @atomicservice + * @since 11 + */ + appEventInfos: Array; + } + /** + * Definition of event watcher object, which is used to monitor written event data. + * + * @interface Watcher + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * @since 9 + */ + /** + * Definition of event watcher object, which is used to monitor written event data. + * + * @interface Watcher + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * @atomicservice + * @since 11 + */ + interface Watcher { + /** + * The name of watcher. + * + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * @since 9 + */ + /** + * The name of watcher. + * + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * @atomicservice + * @since 11 + */ + name: string; + /** + * The condition for triggering callback. + * + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * @since 9 + */ + /** + * The condition for triggering callback. + * + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * @atomicservice + * @since 11 + */ + triggerCondition?: TriggerCondition; + /** + * The event filters for monitoring events. + * + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * @since 9 + */ + /** + * The event filters for monitoring events. + * + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * @atomicservice + * @since 11 + */ + appEventFilters?: AppEventFilter[]; + /** + * The callback function of watcher. + * + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * @since 9 + */ + /** + * The callback function of watcher. + * + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * @atomicservice + * @since 11 + */ + onTrigger?: (curRow: number, curSize: number, holder: AppEventPackageHolder) => void; + /** + * The callback function, when watcher receive the event. + * + * @type { ?function } + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * @atomicservice + * @since 11 + */ + onReceive?: (domain: string, appEventGroups: Array) => void; + } + /** + * Add event watcher. + * + * @param { Watcher } watcher Watcher object for monitoring events. + * @returns { AppEventPackageHolder } Holder object, which is used to read the monitoring data of the watcher. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 11102001 - Invalid watcher name. + * @throws { BusinessError } 11102002 - Invalid filtering event domain. + * @throws { BusinessError } 11102003 - Invalid row value. + * @throws { BusinessError } 11102004 - Invalid size value. + * @throws { BusinessError } 11102005 - Invalid timeout value. + * @static + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * @since 9 + */ + /** + * Add event watcher. + * + * @param { Watcher } watcher Watcher object for monitoring events. + * @returns { AppEventPackageHolder } Holder object, which is used to read the monitoring data of the watcher. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.The limit parameter is too small; + * 2.The parameter type error. + * @throws { BusinessError } 11102001 - Invalid watcher name. + * @throws { BusinessError } 11102002 - Invalid filtering event domain. + * @throws { BusinessError } 11102003 - Invalid row value. + * @throws { BusinessError } 11102004 - Invalid size value. + * @throws { BusinessError } 11102005 - Invalid timeout value. + * @static + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * @atomicservice + * @since 11 + */ + function addWatcher(watcher: Watcher): AppEventPackageHolder; + /** + * Remove event watcher. + * + * @param { Watcher } watcher Watcher object for monitoring events. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 11102001 - Invalid watcher name. + * @static + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * @since 9 + */ + /** + * Remove event watcher. + * + * @param { Watcher } watcher Watcher object for monitoring events. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.The limit parameter is too small; + * 2.The parameter type error. + * @throws { BusinessError } 11102001 - Invalid watcher name. + * @static + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * @atomicservice + * @since 11 + */ + function removeWatcher(watcher: Watcher): void; + /** + * Clear all local logging data of the application. + * + * @static + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * @since 9 + */ + /** + * Clear all local logging data of the application. + * + * @static + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * @atomicservice + * @since 11 + */ + function clearData(): void; + /** + * Set user ID. + * + * @param { string } name The key of the user ID. + * @param { string } value The value of the user ID. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.The limit parameter is too small; + * 2.The parameter type error. + * @static + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * @atomicservice + * @since 11 + */ + function setUserId(name: string, value: string): void; + /** + * Get user ID. + * + * @param { string } name The key of the user ID. + * @returns { string } the user ID value. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.The limit parameter is too small; + * 2.The parameter type error. + * @static + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * @atomicservice + * @since 11 + */ + function getUserId(name: string): string; + /** + * Set user property. + * + * @param { string } name The key of the user property. + * @param { string } value The value of the user property. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.The limit parameter is too small; + * 2.The parameter type error. + * @static + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * @atomicservice + * @since 11 + */ + function setUserProperty(name: string, value: string): void; + /** + * Get user property. + * + * @param { string } name The key of the user property. + * @returns { string } the user property value. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.The limit parameter is too small; + * 2.The parameter type error. + * @static + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * @atomicservice + * @since 11 + */ + function getUserProperty(name: string): string; + /** + * Describe the event config to be reported by processor. + * + * @interface AppEventReportConfig + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * @atomicservice + * @since 11 + */ + interface AppEventReportConfig { + /** + * The domain of the event. + * + * @type { ?string } + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * @atomicservice + * @since 11 + */ + domain?: string; + /** + * The name of the event. + * + * @type { ?string } + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * @atomicservice + * @since 11 + */ + name?: string; + /** + * The realtime report event. + * + * @type { ?boolean } + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * @atomicservice + * @since 11 + */ + isRealTime?: boolean; + } + /** + * Definition of the processor. + * + * @interface Processor + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * @atomicservice + * @since 11 + */ + interface Processor { + /** + * The name of the processor. + * + * @type { string } + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * @atomicservice + * @since 11 + */ + name: string; + /** + * The processor enable the developer to debug. + * + * @type { ?boolean } + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * @atomicservice + * @since 11 + */ + debugMode?: boolean; + /** + * The server location which used for the processor to receive the data, defined by the processor. + * + * @type { ?string } + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * @atomicservice + * @since 11 + */ + routeInfo?: string; + /** + * The app ID is provided by the processor. + * + * @type { ?string } + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * @atomicservice + * @since 11 + */ + appId?: string; + /** + * The processor report the event when start. + * + * @type { ?boolean } + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * @atomicservice + * @since 11 + */ + onStartReport?: boolean; + /** + * The processor report the event when the application onBackground. + * + * @type { ?boolean } + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * @atomicservice + * @since 11 + */ + onBackgroundReport?: boolean; + /** + * The processor report the event according to the period. + * + * @type { ?number } + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * @atomicservice + * @since 11 + */ + periodReport?: number; + /** + * The processor report the event according to the batch size. + * + * @type { ?number } + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * @atomicservice + * @since 11 + */ + batchReport?: number; + /** + * The user ID names which the processor can report. + * + * @type { ?string[] } + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * @atomicservice + * @since 11 + */ + userIds?: string[]; + /** + * The user property names which the processor can report. + * + * @type { ?string[] } + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * @atomicservice + * @since 11 + */ + userProperties?: string[]; + /** + * The events which the processor can report. + * + * @type { ?AppEventReportConfig[] } + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * @atomicservice + * @since 11 + */ + eventConfigs?: AppEventReportConfig[]; + /** + * The processor config id. + * + * @type { ?number } + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * @atomicservice + * @since 12 + */ + configId?: number; + /** + * The processor set custom config data. + * + * @type { ?Record } + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * @atomicservice + * @since 12 + */ + customConfigs?: Record; + } + /** + * Add the processor, who can report the event. + * + * @param { Processor } processor The instance which report the event + * @returns { number } The processor unique ID. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.The limit parameter is too small; + * 2.The parameter type error. + * @static + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * @atomicservice + * @since 11 + */ + function addProcessor(processor: Processor): number; + /** + * Remove the processor. + * + * @param { number } id The processor unique ID. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.The limit parameter is too small; + * 2.The parameter type error. + * @static + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * @atomicservice + * @since 11 + */ + function removeProcessor(id: number): void; +} +export default hiAppEvent; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.i18n.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.i18n.d.ts new file mode 100755 index 00000000..b2080f23 --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.i18n.d.ts @@ -0,0 +1,2863 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit LocalizationKit + */ + +/** + * Provides international settings related APIs. + * + * @namespace i18n + * @syscap SystemCapability.Global.I18n + * @since 7 + */ +/** + * Provides international settings related APIs. + * + * @namespace i18n + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @atomicservice + * @since 11 + */ +declare namespace i18n { + /** + * Obtains the country or region name localized for display on a given locale. + * + * @param { string } country - The locale whose country or region name will be displayed. + * @param { string } locale - The locale used to display the country or region. + * @param { boolean } [sentenceCase] - Specifies whether the country or region name is displayed in sentence case. + * @returns { string } the country or region name localized for display on a given locale. + * @syscap SystemCapability.Global.I18n + * @since 7 + * @deprecated since 9 + * @useinstead ohos.System.getDisplayCountry + */ + export function getDisplayCountry(country: string, locale: string, sentenceCase?: boolean): string; + /** + * Obtains the language name localized for display on a given locale. + * + * @param { string } language - The locale whose language name will be displayed. + * @param { string } locale - The locale used to display the language. + * @param { boolean } [sentenceCase] - Specifies whether the language name is displayed in sentence case. + * @returns { string } the language name localized for display on a given locale. + * @syscap SystemCapability.Global.I18n + * @since 7 + * @deprecated since 9 + * @useinstead ohos.System.getDisplayLanguage + */ + export function getDisplayLanguage(language: string, locale: string, sentenceCase?: boolean): string; + /** + * Obtains the language currently used by the system. + * + * @returns { string } the language currently used by the system. + * @syscap SystemCapability.Global.I18n + * @since 7 + * @deprecated since 9 + * @useinstead ohos.System.getSystemLanguage + */ + export function getSystemLanguage(): string; + /** + * Obtains the region currently used by the system. + * + * @returns { string } the region currently used by the system. + * @syscap SystemCapability.Global.I18n + * @since 7 + * @deprecated since 9 + * @useinstead ohos.System.getSystemRegion + */ + export function getSystemRegion(): string; + /** + * Obtains the locale currently used by the system. + * + * @returns { string } the locale currently used by the system. + * @syscap SystemCapability.Global.I18n + * @since 7 + * @deprecated since 9 + * @useinstead ohos.System.getSystemLocale + */ + export function getSystemLocale(): string; + /** + * Provides system functions. + * + * @syscap SystemCapability.Global.I18n + * @since 9 + */ + /** + * Provides system functions. + * + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Provides system functions. + * + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @atomicservice + * @since 11 + */ + export class System { + /** + * Obtains the country or region name localized for display on a given locale. + * + * @param { string } country - The locale whose country or region name will be displayed. + * @param { string } locale - The locale used to display the country or region. + * @param { boolean } [sentenceCase] - Specifies whether the country or region name is displayed in sentence case. + * @returns { string } the country or region name localized for display on a given locale. + * @throws { BusinessError } 401 - check param failed + * @throws { BusinessError } 890001 - param value not valid + * @syscap SystemCapability.Global.I18n + * @since 9 + */ + /** + * Obtains the country or region name localized for display on a given locale. + * + * @param { string } country - The locale whose country or region name will be displayed. It must be a valid country. + * @param { string } locale - The locale used to display the country or region. It must be a valid locale. + * @param { boolean } [sentenceCase] - Specifies whether the country or region name is displayed in sentence case. + * @returns { string } the country or region name localized for display on a given locale. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. + * @throws { BusinessError } 890001 - Invalid parameter. Possible causes: Parameter verification failed. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Obtains the country or region name localized for display on a given locale. + * + * @param { string } country - The locale whose country or region name will be displayed. It must be a valid country. + * @param { string } locale - The locale used to display the country or region. It must be a valid locale. + * @param { boolean } [sentenceCase] - Specifies whether the country or region name is displayed in sentence case. + * @returns { string } the country or region name localized for display on a given locale. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. + * @throws { BusinessError } 890001 - param value not valid. Possible causes: Parameter verification failed. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since 12 + */ + static getDisplayCountry(country: string, locale: string, sentenceCase?: boolean): string; + /** + * Obtains the language name localized for display on a given locale. + * + * @param { string } language - The locale whose language name will be displayed. + * @param { string } locale - The locale used to display the language. + * @param { boolean } [sentenceCase] - Specifies whether the language name is displayed in sentence case. + * @returns { string } the language name localized for display on a given locale. + * @throws { BusinessError } 401 - check param failed + * @throws { BusinessError } 890001 - param value not valid + * @syscap SystemCapability.Global.I18n + * @since 9 + */ + /** + * Obtains the language name localized for display on a given locale. + * + * @param { string } language - The locale whose language name will be displayed. + * @param { string } locale - The locale used to display the language. + * @param { boolean } [sentenceCase] - Specifies whether the language name is displayed in sentence case. + * @returns { string } the language name localized for display on a given locale. + * @throws { BusinessError } 401 - check param failed + * @throws { BusinessError } 890001 - param value not valid + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Obtains the language name localized for display on a given locale. + * + * @param { string } language - The locale whose language name will be displayed. It must be a valid language. + * @param { string } locale - The locale used to display the language. It must be a valid locale. + * @param { boolean } [sentenceCase] - Specifies whether the language name is displayed in sentence case. + * @returns { string } the language name localized for display on a given locale. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. + * @throws { BusinessError } 890001 - Invalid parameter. Possible causes: Parameter verification failed. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since 11 + */ + static getDisplayLanguage(language: string, locale: string, sentenceCase?: boolean): string; + /** + * Obtains all languages supported by the system. + * + * @returns { Array } all languages supported by the system. + * @syscap SystemCapability.Global.I18n + * @since 9 + */ + /** + * Obtains all languages supported by the system. + * + * @returns { Array } all languages supported by the system. + * @syscap SystemCapability.Global.I18n + * @atomicservice + * @since 12 + */ + static getSystemLanguages(): Array; + /** + * Obtains all regions supported by the system in the language. + * + * @param { string } language - The language used to get the list of regions. It must be a valid language. + * @returns { Array } all countries or regions supported by the system in the language. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. + * @throws { BusinessError } 890001 - Invalid parameter. Possible causes: Parameter verification failed. + * @syscap SystemCapability.Global.I18n + * @since 9 + */ + /** + * Obtains all regions supported by the system in the language. + * + * @param { string } language - The language used to get the list of regions. It must be a valid language. + * @returns { Array } all countries or regions supported by the system in the language. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. + * @throws { BusinessError } 890001 - param value not valid. Possible causes: Parameter verification failed. + * @syscap SystemCapability.Global.I18n + * @atomicservice + * @since 12 + */ + static getSystemCountries(language: string): Array; + /** + * Determine whether the current language or region is recommended. + * + * @param { string } language - The language code. It must be a valid language. + * @param { string } [region] - The region code. It must be a valid region. + * @returns { boolean } whether the current language or region is recommended. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. + * @throws { BusinessError } 890001 - Invalid parameter. Possible causes: Parameter verification failed. + * @syscap SystemCapability.Global.I18n + * @since 9 + */ + /** + * Determine whether the current language or region is recommended. + * + * @param { string } language - The language code. It must be a valid language. + * @param { string } [region] - The region code. It must be a valid region. + * @returns { boolean } whether the current language or region is recommended. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. + * @throws { BusinessError } 890001 - param value not valid. Possible causes: Parameter verification failed. + * @syscap SystemCapability.Global.I18n + * @atomicservice + * @since 12 + */ + static isSuggested(language: string, region?: string): boolean; + /** + * Obtains the language currently used by the system. + * + * @returns { string } the language currently used by the system. + * @syscap SystemCapability.Global.I18n + * @since 9 + */ + /** + * Obtains the language currently used by the system. + * + * @returns { string } the language currently used by the system. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Obtains the language currently used by the system. + * + * @returns { string } the language currently used by the system. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @atomicservice + * @since 11 + */ + static getSystemLanguage(): string; + /** + * Obtains the region currently used by the system. + * + * @returns { string } the region currently used by the system. + * @syscap SystemCapability.Global.I18n + * @since 9 + */ + /** + * Obtains the region currently used by the system. + * + * @returns { string } the region currently used by the system. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Obtains the region currently used by the system. + * + * @returns { string } the region currently used by the system. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since 12 + */ + static getSystemRegion(): string; + /** + * Obtains the locale currently used by the system. + * + * @returns { string } the locale currently used by the system. + * @syscap SystemCapability.Global.I18n + * @since 9 + */ + /** + * Obtains the locale currently used by the system. + * + * @returns { string } the locale currently used by the system. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Obtains the locale currently used by the system. + * + * @returns { string } the locale currently used by the system. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since 11 + */ + static getSystemLocale(): string; + /** + * Check out whether system is 24-hour system. + * + * @returns { boolean } a boolean represent whether system is 24-hour system. + * @syscap SystemCapability.Global.I18n + * @since 9 + */ + /** + * Check out whether system is 24-hour system. + * + * @returns { boolean } a boolean represent whether system is 24-hour system. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Check out whether system is 24-hour system. + * + * @returns { boolean } a boolean represent whether system is 24-hour system. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @since 11 + */ + /** + * Check out whether system is 24-hour system. + * + * @returns { boolean } a boolean represent whether system is 24-hour system. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @atomicservice + * @since 12 + */ + static is24HourClock(): boolean; + /** + * Access the system preferred language list. + * + * @returns { Array } a string Array represent the preferred language list. + * @syscap SystemCapability.Global.I18n + * @since 9 + */ + /** + * Access the system preferred language list. + * + * @returns { Array } a string Array represent the preferred language list. + * @syscap SystemCapability.Global.I18n + * @atomicservice + * @since 12 + */ + static getPreferredLanguageList(): Array; + /** + * Get the first preferred language of system. + * + * @returns { string } a string represent the first preferred language of system. + * @syscap SystemCapability.Global.I18n + * @since 9 + */ + /** + * Get the first preferred language of system. + * + * @returns { string } a string represent the first preferred language of system. + * @syscap SystemCapability.Global.I18n + * @atomicservice + * @since 12 + */ + static getFirstPreferredLanguage(): string; + /** + * Set the preferred language of App. + * + * @param { string } language - the language to be set. It must be a valid language. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. + * @throws { BusinessError } 890001 - Invalid parameter. Possible causes: Parameter verification failed. + * @syscap SystemCapability.Global.I18n + * @since 11 + */ + /** + * Set the preferred language of App. + * + * @param { string } language - the language to be set. It must be a valid language. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. + * @throws { BusinessError } 890001 - Invalid parameter. Possible causes: Parameter verification failed. + * @syscap SystemCapability.Global.I18n + * @atomicservice + * @since 12 + */ + static setAppPreferredLanguage(language: string): void; + /** + * Get the preferred language of App. + * + * @returns { string } a string represent the preferred language of App. + * @syscap SystemCapability.Global.I18n + * @since 9 + */ + /** + * Get the preferred language of App. + * + * @returns { string } a string represent the preferred language of App. + * @syscap SystemCapability.Global.I18n + * @atomicservice + * @since 12 + */ + static getAppPreferredLanguage(): string; + /** + * Get whether to use local digit. + * + * @returns { boolean } a boolean represents whether to use local digit. + * @syscap SystemCapability.Global.I18n + * @since 9 + */ + /** + * Get whether to use local digit. + * + * @returns { boolean } a boolean represents whether to use local digit. + * @syscap SystemCapability.Global.I18n + * @atomicservice + * @since 12 + */ + static getUsingLocalDigit(): boolean; + } + /** + * Provides util functions. + * + * @interface Util + * @syscap SystemCapability.Global.I18n + * @since 8 + * @deprecated since 9 + * @useinstead ohos.i18n/i18n.I18NUtil + */ + export interface Util { + /** + * Convert from unit to unit and format according to the locale. + * + * @param { UnitInfo } fromUnit - Information of the unit to be converted. + * @param { UnitInfo } toUnit - Information about the unit to be converted to. + * @param { number } value - Indicates the number to be formatted. + * @param { string } locale - The locale to be used. + * @param { string } [style] - The style of format. + * @returns { string } converted number and unit. + * @syscap SystemCapability.Global.I18n + * @since 8 + * @deprecated since 9 + * @useinstead ohos.i18n/i18n.I18NUtil#unitConvert + */ + unitConvert(fromUnit: UnitInfo, toUnit: UnitInfo, value: number, locale: string, style?: string): string; + } + /** + * Provides util functions. + * + * @syscap SystemCapability.Global.I18n + * @since 9 + */ + /** + * Provides util functions. + * + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Provides util functions. + * + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since 12 + */ + export class I18NUtil { + /** + * Convert from unit to unit and format according to the locale. + * + * @param { UnitInfo } fromUnit - Information of the unit to be converted. + * @param { UnitInfo } toUnit - Information about the unit to be converted to. + * @param { number } value - Indicates the number to be formatted. + * @param { string } locale - The locale to be used. + * @param { string } [style] - The style of format. + * @returns { string } converted number and unit. + * @syscap SystemCapability.Global.I18n + * @since 9 + */ + /** + * Convert from unit to unit and format according to the locale. + * + * @param { UnitInfo } fromUnit - Information of the unit to be converted. + * @param { UnitInfo } toUnit - Information about the unit to be converted to. + * @param { number } value - Indicates the number to be formatted. + * @param { string } locale - The locale to be used. + * @param { string } [style] - The style of format. + * @returns { string } converted number and unit. + * @syscap SystemCapability.Global.I18n + * @atomicservice + * @since 12 + */ + static unitConvert(fromUnit: UnitInfo, toUnit: UnitInfo, value: number, locale: string, style?: string): string; + /** + * Get the order of year, month, day in the specified locale. Year, month, day are separated by '-'. + * 'y' stands for year, 'L' stands for month, d stands for day. + * + * @param { string } locale - Information of the locale + * @returns { string } the string of 'y', 'L', 'd' joined by '-'. + * @syscap SystemCapability.Global.I18n + * @since 9 + */ + /** + * Get the order of year, month, day in the specified locale. Year, month, day are separated by '-'. + * 'y' stands for year, 'L' stands for month, d stands for day. + * + * @param { string } locale - Information of the locale. + * @returns { string } the string of 'y', 'L', 'd' joined by '-'. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Get the order of year, month, day in the specified locale. Year, month, day are separated by '-'. + * 'y' stands for year, 'L' stands for month, d stands for day. + * + * @param { string } locale - Information of the locale. + * @returns { string } the string of 'y', 'L', 'd' joined by '-'. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since 12 + */ + static getDateOrder(locale: string): string; + /** + * Get the time period name for the specified hour. + * + * @param { number } hour - the hour value. + * @param { string } [locale] - specified the locale. Use current app locale by default. It must be a valid locale. + * @returns { string } the string of time period name. The return value may be empty string + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. + * @throws { BusinessError } 890001 - Invalid parameter. Possible causes: Parameter verification failed. + * @syscap SystemCapability.Global.I18n + * @since 11 + */ + /** + * Get the time period name for the specified hour. + * + * @param { number } hour - the hour value. + * @param { string } [locale] - specified the locale. Use current app locale by default. It must be a valid locale. + * @returns { string } the string of time period name. The return value may be empty string + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. + * @throws { BusinessError } 890001 - Invalid parameter. Possible causes: Parameter verification failed. + * @syscap SystemCapability.Global.I18n + * @atomicservice + * @since 12 + */ + static getTimePeriodName(hour: number, locale?: string): string; + /** + * Get the best matched locale in the specified list. + * + * @param { string } locale - the origin locale. It must be a valid locale. + * @param { string[] } localeList - a list of locales to be matched. It must be a valid locale. + * @returns { string } the string of the best matched locale name. + * The return value may be empty string due to none is matched. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. + * @throws { BusinessError } 890001 - Invalid parameter. Possible causes: Parameter verification failed. + * @static + * @syscap SystemCapability.Global.I18n + * @atomicservice + * @since 12 + */ + static getBestMatchLocale(locale: string, localeList: string[]): string; + /** + * Get a three-letter abbreviation of the specified language. + * + * @param { string } locale - the origin locale or language code. It must be a valid locale. + * @returns { string } 3 letter language code. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. + * @throws { BusinessError } 890001 - Invalid parameter. Possible causes: Parameter verification failed. + * @static + * @syscap SystemCapability.Global.I18n + * @atomicservice + * @since 12 + */ + static getThreeLetterLanguage(locale: string): string; + /** + * Get a three-letter abbreviation of the specified region. + * + * @param { string } locale - the origin locale or region code. It must be a valid locale. + * @returns { string } 3 letter region code. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. + * @throws { BusinessError } 890001 - Invalid parameter. Possible causes: Parameter verification failed. + * @static + * @syscap SystemCapability.Global.I18n + * @atomicservice + * @since 12 + */ + static getThreeLetterRegion(locale: string): string; + } + /** + * Provides the options of unit. + * + * @interface UnitInfo + * @syscap SystemCapability.Global.I18n + * @since 8 + */ + /** + * Provides the options of unit. + * + * @interface UnitInfo + * @syscap SystemCapability.Global.I18n + * @atomicservice + * @since 12 + */ + export interface UnitInfo { + /** + * Unit name. + * + * @syscap SystemCapability.Global.I18n + * @since 8 + */ + /** + * Unit name. + * + * @syscap SystemCapability.Global.I18n + * @atomicservice + * @since 12 + */ + unit: string; + /** + * The measurement system of the unit. + * + * @syscap SystemCapability.Global.I18n + * @since 8 + */ + /** + * The measurement system of the unit. + * + * @syscap SystemCapability.Global.I18n + * @atomicservice + * @since 12 + */ + measureSystem: string; + } + /** + * Provides the options of PhoneNumberFormat. + * + * @interface PhoneNumberFormatOptions + * @syscap SystemCapability.Global.I18n + * @since 8 + */ + /** + * Provides the options of PhoneNumberFormat. + * + * @interface PhoneNumberFormatOptions + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 11 + */ + /** + * Provides the options of PhoneNumberFormat. + * + * @interface PhoneNumberFormatOptions + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since 12 + */ + export interface PhoneNumberFormatOptions { + /** + * Indicates the type to format phone number. + * + * @type { string } + * @syscap SystemCapability.Global.I18n + * @since 8 + */ + /** + * Indicates the type to format phone number. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @since 9 + */ + /** + * Indicates the type to format phone number. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 11 + */ + /** + * Indicates the type to format phone number. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since 12 + */ + type?: string; + } + /** + * Provides the API for formatting phone number strings + * + * @syscap SystemCapability.Global.I18n + * @since 8 + */ + /** + * Provides the API for formatting phone number strings + * + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 11 + */ + /** + * Provides the API for formatting phone number strings + * + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since 12 + */ + export class PhoneNumberFormat { + /** + * A constructor used to create a PhoneNumberFormat object. + * + * @param { string } country - Indicates a character string containing the country information for the PhoneNumberFormat object. + * @param { PhoneNumberFormatOptions } [options] - format types: "E164", "RFC3966", "INTERNATIONAL", "NATIONAL". + * @syscap SystemCapability.Global.I18n + * @since 8 + */ + /** + * A constructor used to create a PhoneNumberFormat object. + * + * @param { string } country - Indicates a character string containing the country information for the PhoneNumberFormat object. + * @param { PhoneNumberFormatOptions } [options] - format types: "E164", "RFC3966", "INTERNATIONAL", "NATIONAL". + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 11 + */ + /** + * A constructor used to create a PhoneNumberFormat object. + * + * @param { string } country - Indicates a character string containing the country information for the PhoneNumberFormat object. + * @param { PhoneNumberFormatOptions } [options] - format types: "E164", "RFC3966", "INTERNATIONAL", "NATIONAL". + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since 12 + */ + constructor(country: string, options?: PhoneNumberFormatOptions); + /** + * Judge whether phone number is valid. + * + * @param { string } number - Indicates the input phone number. + * @returns { boolean } a boolean indicates whether the input phone number is valid. + * @syscap SystemCapability.Global.I18n + * @since 8 + */ + /** + * Judge whether phone number is valid. + * + * @param { string } number - Indicates the input phone number. + * @returns { boolean } a boolean indicates whether the input phone number is valid. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 11 + */ + /** + * Judge whether phone number is valid. + * + * @param { string } number - Indicates the input phone number. + * @returns { boolean } a boolean indicates whether the input phone number is valid. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since 12 + */ + isValidNumber(number: string): boolean; + /** + * Obtains the formatted phone number strings of number. + * + * @param { string } number - Indicates the input phone number to be formatted. + * @returns { string } the formatted phone number. + * @syscap SystemCapability.Global.I18n + * @since 8 + */ + /** + * Obtains the formatted phone number strings of number. + * + * @param { string } number - Indicates the input phone number to be formatted. + * @returns { string } the formatted phone number. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 11 + */ + /** + * Obtains the formatted phone number strings of number. + * + * @param { string } number - Indicates the input phone number to be formatted. + * @returns { string } the formatted phone number. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since 12 + */ + format(number: string): string; + /** + * Determine the location by phone number, and return it according to the specified regional language. + * + * @param { string } number - input phone number. + * @param { string } locale - locale ID. + * @returns { string } a string represents phone number's location. + * @syscap SystemCapability.Global.I18n + * @since 9 + */ + /** + * Determine the location by phone number, and return it according to the specified regional language. + * + * @param { string } number - input phone number. + * @param { string } locale - locale ID. + * @returns { string } a string represents phone number's location. + * @syscap SystemCapability.Global.I18n + * @atomicservice + * @since 12 + */ + getLocationName(number: string, locale: string): string; + } + /** + * Get a Calendar instance specified by locale and type. + * + * @param { string } locale - The locale used to get calendar. + * @param { string } [type] - If type is not specified, get locale's default Calendar, else get the specified type of Calendar. + * such as buddhist, chinese, coptic, ethiopic, hebrew, gregory, indian, islamic_civil, islamic_tbla, islamic_umalqura, + * japanese, persian. + * @returns { Calendar } Calendar object + * @syscap SystemCapability.Global.I18n + * @since 8 + */ + /** + * Get a Calendar instance specified by locale and type. + * + * @param { string } locale - The locale used to get calendar. + * @param { string } [type] - If type is not specified, get locale's default Calendar, else get the specified type of Calendar. + * such as buddhist, chinese, coptic, ethiopic, hebrew, gregory, indian, islamic_civil, islamic_tbla, islamic_umalqura, + * japanese, persian. + * @returns { Calendar } Calendar object + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Get a Calendar instance specified by locale and type. + * + * @param { string } locale - The locale used to get calendar. + * @param { string } [type] - If type is not specified, get locale's default Calendar, else get the specified type of Calendar. + * such as buddhist, chinese, coptic, ethiopic, hebrew, gregory, indian, islamic_civil, islamic_tbla, islamic_umalqura, + * japanese, persian. + * @returns { Calendar } Calendar object + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since 12 + */ + export function getCalendar(locale: string, type?: string): Calendar; + /** + * Provides the API for accessing Calendar name, time and date related information. + * + * @syscap SystemCapability.Global.I18n + * @since 7 + */ + /** + * Provides the API for accessing Calendar name, time and date related information. + * + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Provides the API for accessing Calendar name, time and date related information. + * + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since 12 + */ + export class Calendar { + /** + * set the date. + * + * @param { Date } date - Date object used to set the time and date. + * @syscap SystemCapability.Global.I18n + * @since 8 + */ + /** + * set the date. + * + * @param { Date } date - Date object used to set the time and date. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * set the date. + * + * @param { Date } date - Date object used to set the time and date. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since 12 + */ + setTime(date: Date): void; + /** + * set the time. + * + * @param { number } time - Indicates the elapsed milliseconds from 1970.1.1 00:00:00 GMT. + * @syscap SystemCapability.Global.I18n + * @since 8 + */ + /** + * set the time. + * + * @param { number } time - Indicates the elapsed milliseconds from 1970.1.1 00:00:00 GMT. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * set the time. + * + * @param { number } time - Indicates the elapsed milliseconds from 1970.1.1 00:00:00 GMT. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since 12 + */ + setTime(time: number): void; + /** + * Set the time + * + * @param { number } year - The year field of the calendar, ranges from 0 to 9999. + * @param { number } month - The month field of the calendar, ranges from 0 to 11. + * @param { number } date - The day field of the calendar, ranges from 1 to 31. + * @param { number } hour - The hour field of the calendar, ranges from 0 to 23. + * @param { number } minute - The minute field of the calendar, ranges from 0 to 59. + * @param { number } second - the second field of the calendar, ranges from 0 to 59. + * @syscap SystemCapability.Global.I18n + * @since 8 + */ + /** + * Set the time + * + * @param { number } year - The year field of the calendar, ranges from 0 to 9999. + * @param { number } month - The month field of the calendar, ranges from 0 to 11. + * @param { number } date - The day field of the calendar, ranges from 1 to 31. + * @param { number } hour - The hour field of the calendar, ranges from 0 to 23. + * @param { number } minute - The minute field of the calendar, ranges from 0 to 59. + * @param { number } second - the second field of the calendar, ranges from 0 to 59. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Set the time + * + * @param { number } year - The year field of the calendar, ranges from 0 to 9999. + * @param { number } month - The month field of the calendar, ranges from 0 to 11. + * @param { number } date - The day field of the calendar, ranges from 1 to 31. + * @param { number } hour - The hour field of the calendar, ranges from 0 to 23. + * @param { number } minute - The minute field of the calendar, ranges from 0 to 59. + * @param { number } second - the second field of the calendar, ranges from 0 to 59. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since 12 + */ + set(year: number, month: number, date: number, hour?: number, minute?: number, second?: number): void; + /** + * Set the timezone of this calendar. + * + * @param { string } timezone - The id of a timezone. + * @syscap SystemCapability.Global.I18n + * @since 8 + */ + /** + * Set the timezone of this calendar. + * + * @param { string } timezone - The id of a timezone. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Set the timezone of this calendar. + * + * @param { string } timezone - The id of a timezone. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since 12 + */ + setTimeZone(timezone: string): void; + /** + * Get the timezone id of this calendar instance. + * + * @returns { string } the timezone id of this calendar. + * @syscap SystemCapability.Global.I18n + * @since 8 + */ + /** + * Get the timezone id of this calendar instance. + * + * @returns { string } the timezone id of this calendar. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Get the timezone id of this calendar instance. + * + * @returns { string } the timezone id of this calendar. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since 12 + */ + getTimeZone(): string; + /** + * Get the start day of a week. 1 indicates Sunday, 7 indicates Saturday. + * + * @returns { number } start day of a week. + * @syscap SystemCapability.Global.I18n + * @since 8 + */ + /** + * Get the start day of a week. 1 indicates Sunday, 7 indicates Saturday. + * + * @returns { number } start day of a week. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Get the start day of a week. 1 indicates Sunday, 7 indicates Saturday. + * + * @returns { number } start day of a week. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since 12 + */ + getFirstDayOfWeek(): number; + /** + * Set the start day of a week. 1 indicates Sunday, 7 indicates Saturday. + * + * @param { number } value - Indicates the start day of a week. 1 indicates Sunday, 7 indicates Saturday. + * @syscap SystemCapability.Global.I18n + * @since 8 + */ + /** + * Set the start day of a week. 1 indicates Sunday, 7 indicates Saturday. + * + * @param { number } value - Indicates the start day of a week. 1 indicates Sunday, 7 indicates Saturday. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Set the start day of a week. 1 indicates Sunday, 7 indicates Saturday. + * + * @param { number } value - Indicates the start day of a week. 1 indicates Sunday, 7 indicates Saturday. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since 12 + */ + setFirstDayOfWeek(value: number): void; + /** + * Get the minimal days of a week, which is needed for the first day of a year. + * + * @returns { number } the minimal days of a week. + * @syscap SystemCapability.Global.I18n + * @since 8 + */ + /** + * Get the minimal days of a week, which is needed for the first day of a year. + * + * @returns { number } the minimal days of a week. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Get the minimal days of a week, which is needed for the first day of a year. + * + * @returns { number } the minimal days of a week. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since 12 + */ + getMinimalDaysInFirstWeek(): number; + /** + * Set the minimal days of a week, which is needed for the first week of a year. + * + * @param { number } value - The value to be set. + * @syscap SystemCapability.Global.I18n + * @since 8 + */ + /** + * Set the minimal days of a week, which is needed for the first week of a year. + * + * @param { number } value - The value to be set. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Set the minimal days of a week, which is needed for the first week of a year. + * + * @param { number } value - The value to be set. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since 12 + */ + setMinimalDaysInFirstWeek(value: number): void; + /** + * Get the associated value with the field. + * + * @param { string } field - Field values such as era, year, month, week_of_year, week_of_month, date, day_of_year, day_of_week + * day_of_week_in_month, hour, hour_of_day, minute, second, millisecond, zone_offset, dst_offset, year_woy, + * dow_local, extended_year, julian_day, milliseconds_in_day, is_leap_month. + * @returns { number } the associated value. + * @syscap SystemCapability.Global.I18n + * @since 8 + */ + /** + * Get the associated value with the field. + * + * @param { string } field - Field values such as era, year, month, week_of_year, week_of_month, date, day_of_year, day_of_week + * day_of_week_in_month, hour, hour_of_day, minute, second, millisecond, zone_offset, dst_offset, year_woy, + * dow_local, extended_year, julian_day, milliseconds_in_day, is_leap_month. + * @returns { number } the associated value. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Get the associated value with the field. + * + * @param { string } field - Field values such as era, year, month, week_of_year, week_of_month, date, day_of_year, day_of_week + * day_of_week_in_month, hour, hour_of_day, minute, second, millisecond, zone_offset, dst_offset, year_woy, + * dow_local, extended_year, julian_day, milliseconds_in_day, is_leap_month. + * @returns { number } the associated value. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since 12 + */ + get(field: string): number; + /** + * Get calendar's name localized for display in the given locale. + * + * @param { string } locale - Locale used to get the localized name for this calendar. It must be a valid locale. + * @returns { string } the localized name of this calendar. + * @syscap SystemCapability.Global.I18n + * @since 8 + */ + /** + * Get calendar's name localized for display in the given locale. + * + * @param { string } locale - Locale used to get the localized name for this calendar. It must be a valid locale. + * @returns { string } the localized name of this calendar. + * @syscap SystemCapability.Global.I18n + * @atomicservice + * @since 12 + */ + getDisplayName(locale: string): string; + /** + * Returns true if the given date is a weekend day. If the date is not given, + * the date object of this calendar is used. + * + * @param { Date } [date] - Date object whose attribute is desired. + * @returns { boolean } whether the date is a weekend day. + * @syscap SystemCapability.Global.I18n + * @since 8 + */ + /** + * Returns true if the given date is a weekend day. If the date is not given, + * the date object of this calendar is used. + * + * @param { Date } [date] - Date object whose attribute is desired. + * @returns { boolean } whether the date is a weekend day. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Returns true if the given date is a weekend day. If the date is not given, + * the date object of this calendar is used. + * + * @param { Date } [date] - Date object whose attribute is desired. + * @returns { boolean } whether the date is a weekend day. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since 12 + */ + isWeekend(date?: Date): boolean; + /** + * Adds or subtract the specified amount of time to the given calendar field. + * + * @param { string } field - field values such as year, month, week_of_year, week_of_month, date, day_of_year, day_of_week + * day_of_week_in_month, hour, hour_of_day, minute, second, millisecond + * @param { number } amount - the amount of date or time to be added to the field. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. + * @throws { BusinessError } 890001 - Invalid parameter. Possible causes: Parameter verification failed. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 11 + */ + /** + * Adds or subtract the specified amount of time to the given calendar field. + * + * @param { string } field - field values such as year, month, week_of_year, week_of_month, date, day_of_year, day_of_week + * day_of_week_in_month, hour, hour_of_day, minute, second, millisecond + * @param { number } amount - the amount of date or time to be added to the field. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. + * @throws { BusinessError } 890001 - Invalid parameter. Possible causes: Parameter verification failed. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since 12 + */ + add(field: string, amount: number): void; + /** + * Get the UTC milliseconds. + * + * @returns { number } the calendar time as UTC milliseconds. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 11 + */ + /** + * Get the UTC milliseconds. + * + * @returns { number } the calendar time as UTC milliseconds. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since 12 + */ + getTimeInMillis(): number; + /** + * Returns days comparison result. + * + * @param { Date } date - Date object to be compared. + * @returns { number } value of of the comparison result. A positive value indicates that the date is later, + * and a negative value indicates that the date is earlier. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 11 + */ + /** + * Returns days comparison result. + * + * @param { Date } date - Date object to be compared. + * @returns { number } value of of the comparison result. A positive value indicates that the date is later, + * and a negative value indicates that the date is earlier. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since 12 + */ + compareDays(date: Date): number; + } + /** + * Judge whether the locale is RTL locale. + * + * @param { string } locale - The locale to be used. + * @returns { boolean } true representing the locale is an RTL locale + * @syscap SystemCapability.Global.I18n + * @since 7 + */ + /** + * Judge whether the locale is RTL locale. + * + * @param { string } locale - The locale to be used. + * @returns { boolean } true representing the locale is an RTL locale + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Judge whether the locale is RTL locale. + * + * @param { string } locale - The locale to be used. + * @returns { boolean } true representing the locale is an RTL locale + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since 12 + */ + export function isRTL(locale: string): boolean; + /** + * Obtains a BreakIterator object for finding the location of break point in text. + * + * @param { string } locale - the returned BreakIterator will adapt the rule, specified by the locale, to break text. + * @returns { BreakIterator } a newly constructed BreakIterator object. + * @syscap SystemCapability.Global.I18n + * @since 8 + */ + /** + * Obtains a BreakIterator object for finding the location of break point in text. + * + * @param { string } locale - the returned BreakIterator will adapt the rule, specified by the locale, to break text. + * @returns { BreakIterator } a newly constructed BreakIterator object. + * @syscap SystemCapability.Global.I18n + * @atomicservice + * @since 12 + */ + export function getLineInstance(locale: string): BreakIterator; + /** + * The BreakIterator class is used for finding the location of break point in text. + * + * @syscap SystemCapability.Global.I18n + * @since 8 + */ + /** + * The BreakIterator class is used for finding the location of break point in text. + * + * @syscap SystemCapability.Global.I18n + * @atomicservice + * @since 12 + */ + export class BreakIterator { + /** + * Obtains the current position of the BreakIterator instance. + * + * @returns { number } the current position of the BreakIterator instance. + * @syscap SystemCapability.Global.I18n + * @since 8 + */ + /** + * Obtains the current position of the BreakIterator instance. + * + * @returns { number } the current position of the BreakIterator instance. + * @syscap SystemCapability.Global.I18n + * @atomicservice + * @since 12 + */ + current(): number; + /** + * Set the BreakIterator's position to the first break point, the first break point is always the beginning of the + * processed text. + * + * @returns { number } the index of the first break point. + * @syscap SystemCapability.Global.I18n + * @since 8 + */ + /** + * Set the BreakIterator's position to the first break point, the first break point is always the beginning of the + * processed text. + * + * @returns { number } the index of the first break point. + * @syscap SystemCapability.Global.I18n + * @atomicservice + * @since 12 + */ + first(): number; + /** + * Set the BreakIterator's position to the last break point. the last break point is always the index beyond the + * last character of the processed text. + * + * @returns { number } the index of the last break point. + * @syscap SystemCapability.Global.I18n + * @since 8 + */ + /** + * Set the BreakIterator's position to the last break point. the last break point is always the index beyond the + * last character of the processed text. + * + * @returns { number } the index of the last break point. + * @syscap SystemCapability.Global.I18n + * @atomicservice + * @since 12 + */ + last(): number; + /** + * Set the BreakIterator's position to the nth break point from the current break point. + * + * @param { number } [index] - indicates the number of break points to advance. If index is not given, n is treated as 1. + * @returns { number } the index of the BreakIterator after moving. If there is not enough break points, returns -1. + * @syscap SystemCapability.Global.I18n + * @since 8 + */ + /** + * Set the BreakIterator's position to the nth break point from the current break point. + * + * @param { number } [index] - indicates the number of break points to advance. If index is not given, n is treated as 1. + * @returns { number } the index of the BreakIterator after moving. If there is not enough break points, returns -1. + * @syscap SystemCapability.Global.I18n + * @atomicservice + * @since 12 + */ + next(index?: number): number; + /** + * Set the BreakIterator's position to the break point preceding the current break point. + * + * @returns { number } the index of the BreakIterator after moving. If there is not enough break points, returns -1. + * @syscap SystemCapability.Global.I18n + * @since 8 + */ + /** + * Set the BreakIterator's position to the break point preceding the current break point. + * + * @returns { number } the index of the BreakIterator after moving. If there is not enough break points, returns -1. + * @syscap SystemCapability.Global.I18n + * @atomicservice + * @since 12 + */ + previous(): number; + /** + * Set the text to be processed. + * + * @param { string } text - Indicates the text to be processed by the BreakIterator. + * @syscap SystemCapability.Global.I18n + * @since 8 + */ + /** + * Set the text to be processed. + * + * @param { string } text - Indicates the text to be processed by the BreakIterator. + * @syscap SystemCapability.Global.I18n + * @atomicservice + * @since 12 + */ + setLineBreakText(text: string): void; + /** + * Set the BreakIterator's position to the first break point following the specified offset. + * + * @param { number } offset + * @returns { number } the index of the BreakIterator after moving. If there is not enough break points, returns -1. + * @syscap SystemCapability.Global.I18n + * @since 8 + */ + /** + * Set the BreakIterator's position to the first break point following the specified offset. + * + * @param { number } offset + * @returns { number } the index of the BreakIterator after moving. If there is not enough break points, returns -1. + * @syscap SystemCapability.Global.I18n + * @atomicservice + * @since 12 + */ + following(offset: number): number; + /** + * Obtains the text being processed. + * + * @returns { string } the text that is processed by the BreakIterator. + * @syscap SystemCapability.Global.I18n + * @since 8 + */ + /** + * Obtains the text being processed. + * + * @returns { string } the text that is processed by the BreakIterator. + * @syscap SystemCapability.Global.I18n + * @atomicservice + * @since 12 + */ + getLineBreakText(): string; + /** + * Returns true if the position indicated by the offset is a break point, otherwise false. The BreakIterator's + * position will be set to the position indicated by the offset if it returns true, otherwise the BreakIterator + * will be moved to the break point following the offset. + * + * @param { number } offset The offset to be checked. + * @returns { boolean } true if the offset is a break point. + * @syscap SystemCapability.Global.I18n + * @since 8 + */ + /** + * Returns true if the position indicated by the offset is a break point, otherwise false. The BreakIterator's + * position will be set to the position indicated by the offset if it returns true, otherwise the BreakIterator + * will be moved to the break point following the offset. + * + * @param { number } offset The offset to be checked. + * @returns { boolean } true if the offset is a break point. + * @syscap SystemCapability.Global.I18n + * @atomicservice + * @since 12 + */ + isBoundary(offset: number): boolean; + } + /** + * Get IndexUtil object. + * + * @param { string } [locale] - Indicates a character string containing the locale information, including + * the language and optionally the script and region, for the NumberFormat object. + * @returns { IndexUtil } IndexUtil object. + * @syscap SystemCapability.Global.I18n + * @since 8 + */ + /** + * Get IndexUtil object. + * + * @param { string } [locale] - Indicates a character string containing the locale information, including + * the language and optionally the script and region, for the NumberFormat object. + * @returns { IndexUtil } IndexUtil object. + * @syscap SystemCapability.Global.I18n + * @atomicservice + * @since 12 + */ + export function getInstance(locale?: string): IndexUtil; + /** + * Sequence text can be grouped under the specified area, + * and grouping index with different lengths can be specified. + * + * @syscap SystemCapability.Global.I18n + * @since 8 + */ + /** + * Sequence text can be grouped under the specified area, + * and grouping index with different lengths can be specified. + * + * @syscap SystemCapability.Global.I18n + * @atomicservice + * @since 12 + */ + export class IndexUtil { + /** + * Get a list of labels for use as a UI index + * + * @returns { Array } a list of labels + * @syscap SystemCapability.Global.I18n + * @since 8 + */ + /** + * Get a list of labels for use as a UI index + * + * @returns { Array } a list of labels + * @syscap SystemCapability.Global.I18n + * @atomicservice + * @since 12 + */ + getIndexList(): Array; + /** + * Add the index characters from a Locale to the index. + * + * @param { string } locale - The locale whose index characters are to be added. + * @syscap SystemCapability.Global.I18n + * @since 8 + */ + /** + * Add the index characters from a Locale to the index. + * + * @param { string } locale - The locale whose index characters are to be added. + * @syscap SystemCapability.Global.I18n + * @atomicservice + * @since 12 + */ + addLocale(locale: string): void; + /** + * Get corresponding index of the input text. + * + * @param { string } text - input text + * @returns { string } index of the input text + * @syscap SystemCapability.Global.I18n + * @since 8 + */ + /** + * Get corresponding index of the input text. + * + * @param { string } text - input text + * @returns { string } index of the input text + * @syscap SystemCapability.Global.I18n + * @atomicservice + * @since 12 + */ + getIndex(text: string): string; + } + /** + * Provides the API for accessing unicode character properties. For example, determine whether a character is a number. + * + * @syscap SystemCapability.Global.I18n + * @since 8 + * @deprecated since 9 + * @useinstead Unicode + */ + export class Character { + /** + * Determines whether the specified code point is a digit character + * + * @param { string } char - the character to be tested + * @returns { boolean } true if the character is a digit character + * @syscap SystemCapability.Global.I18n + * @since 8 + * @deprecated since 9 + * @useinstead Unicode.isDigit + */ + isDigit(char: string): boolean; + /** + * Determines if the specified character is a space character or not. + * + * @param { string } char - the character to be tested + * @returns { boolean } true if the character is a space character + * @syscap SystemCapability.Global.I18n + * @since 8 + * @deprecated since 9 + * @useinstead Unicode.isSpaceChar + */ + isSpaceChar(char: string): boolean; + /** + * Determines if the specified character is a whitespace character + * + * @param { string } char - the character to be tested + * @returns { boolean } true if the character is a whitespace character + * @syscap SystemCapability.Global.I18n + * @since 8 + * @deprecated since 9 + * @useinstead Unicode.isWhitespace + */ + isWhitespace(char: string): boolean; + /** + * Determines if the specified character is a RTL character or not. + * + * @param { string } char - the character to be tested + * @returns { boolean } true if the character is a RTL character + * @syscap SystemCapability.Global.I18n + * @since 8 + * @deprecated since 9 + * @useinstead Unicode.isRTL + */ + isRTL(char: string): boolean; + /** + * Determines if the specified character is a Ideographic character or not. + * + * @param { string } char - the character to be tested + * @returns { boolean } true if the character is a Ideographic character + * @syscap SystemCapability.Global.I18n + * @since 8 + * @deprecated since 9 + * @useinstead Unicode.isIdeograph + */ + isIdeograph(char: string): boolean; + /** + * Determines if the specified character is a Letter or not. + * + * @param { string } char - the character to be tested + * @returns { boolean } true if the character is a Letter + * @syscap SystemCapability.Global.I18n + * @since 8 + * @deprecated since 9 + * @useinstead Unicode.isLetter + */ + isLetter(char: string): boolean; + /** + * Determines if the specified character is a LowerCase character or not. + * + * @param { string } char - the character to be tested + * @returns { boolean } true if the character is a LowerCase character + * @syscap SystemCapability.Global.I18n + * @since 8 + * @deprecated since 9 + * @useinstead Unicode.isLowerCase + */ + isLowerCase(char: string): boolean; + /** + * Determines if the specified character is a UpperCase character or not. + * + * @param { string } char - the character to be tested + * @returns { boolean } true if the character is a UpperCase character + * @syscap SystemCapability.Global.I18n + * @since 8 + * @deprecated since 9 + * @useinstead Unicode.isUpperCase + */ + isUpperCase(char: string): boolean; + /** + * Get the general category value of the specified character. + * + * @param { string } char - the character to be tested + * @returns { string } the general category of the specified character. + * @syscap SystemCapability.Global.I18n + * @since 8 + * @deprecated since 9 + * @useinstead Unicode.getType + */ + getType(char: string): string; + } + /** + * Provides the API for accessing unicode character properties. For example, determine whether a character is a number. + * + * @syscap SystemCapability.Global.I18n + * @since 9 + */ + /** + * Provides the API for accessing unicode character properties. For example, determine whether a character is a number. + * + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Provides the API for accessing unicode character properties. For example, determine whether a character is a number. + * + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since 12 + */ + export class Unicode { + /** + * Determines whether the specified code point is a digit character + * + * @param { string } char - the character to be tested + * @returns { boolean } true if the character is a digit character + * @syscap SystemCapability.Global.I18n + * @since 9 + */ + /** + * Determines whether the specified code point is a digit character + * + * @param { string } char - the character to be tested + * @returns { boolean } true if the character is a digit character + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Determines whether the specified code point is a digit character + * + * @param { string } char - the character to be tested + * @returns { boolean } true if the character is a digit character + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since 12 + */ + static isDigit(char: string): boolean; + /** + * Determines if the specified character is a space character or not. + * + * @param { string } char - the character to be tested + * @returns { boolean } true if the character is a space character + * @syscap SystemCapability.Global.I18n + * @since 9 + */ + /** + * Determines if the specified character is a space character or not. + * + * @param { string } char - the character to be tested + * @returns { boolean } true if the character is a space character + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Determines if the specified character is a space character or not. + * + * @param { string } char - the character to be tested + * @returns { boolean } true if the character is a space character + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since 12 + */ + static isSpaceChar(char: string): boolean; + /** + * Determines if the specified character is a whitespace character + * + * @param { string } char - the character to be tested + * @returns { boolean } true if the character is a whitespace character + * @syscap SystemCapability.Global.I18n + * @since 9 + */ + /** + * Determines if the specified character is a whitespace character + * + * @param { string } char - the character to be tested + * @returns { boolean } true if the character is a whitespace character + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Determines if the specified character is a whitespace character + * + * @param { string } char - the character to be tested + * @returns { boolean } true if the character is a whitespace character + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since 12 + */ + static isWhitespace(char: string): boolean; + /** + * Determines if the specified character is a RTL character or not. + * + * @param { string } char - the character to be tested + * @returns { boolean } true if the character is a RTL character + * @syscap SystemCapability.Global.I18n + * @since 9 + */ + /** + * Determines if the specified character is a RTL character or not. + * + * @param { string } char - the character to be tested + * @returns { boolean } true if the character is a RTL character + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Determines if the specified character is a RTL character or not. + * + * @param { string } char - the character to be tested + * @returns { boolean } true if the character is a RTL character + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since 12 + */ + static isRTL(char: string): boolean; + /** + * Determines if the specified character is a Ideographic character or not. + * + * @param { string } char - the character to be tested + * @returns { boolean } true if the character is a Ideographic character + * @syscap SystemCapability.Global.I18n + * @since 9 + */ + /** + * Determines if the specified character is a Ideographic character or not. + * + * @param { string } char - the character to be tested + * @returns { boolean } true if the character is a Ideographic character + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Determines if the specified character is a Ideographic character or not. + * + * @param { string } char - the character to be tested + * @returns { boolean } true if the character is a Ideographic character + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since 12 + */ + static isIdeograph(char: string): boolean; + /** + * Determines if the specified character is a Letter or not. + * + * @param { string } char - the character to be tested + * @returns { boolean } true if the character is a Letter + * @syscap SystemCapability.Global.I18n + * @since 9 + */ + /** + * Determines if the specified character is a Letter or not. + * + * @param { string } char - the character to be tested + * @returns { boolean } true if the character is a Letter + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Determines if the specified character is a Letter or not. + * + * @param { string } char - the character to be tested + * @returns { boolean } true if the character is a Letter + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since 12 + */ + static isLetter(char: string): boolean; + /** + * Determines if the specified character is a LowerCase character or not. + * + * @param { string } char - the character to be tested + * @returns { boolean } true if the character is a LowerCase character + * @syscap SystemCapability.Global.I18n + * @since 9 + */ + /** + * Determines if the specified character is a LowerCase character or not. + * + * @param { string } char - the character to be tested + * @returns { boolean } true if the character is a LowerCase character + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Determines if the specified character is a LowerCase character or not. + * + * @param { string } char - the character to be tested + * @returns { boolean } true if the character is a LowerCase character + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since 12 + */ + static isLowerCase(char: string): boolean; + /** + * Determines if the specified character is a UpperCase character or not. + * + * @param { string } char - the character to be tested + * @returns { boolean } true if the character is a UpperCase character + * @syscap SystemCapability.Global.I18n + * @since 9 + */ + /** + * Determines if the specified character is a UpperCase character or not. + * + * @param { string } char - the character to be tested + * @returns { boolean } true if the character is a UpperCase character + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Determines if the specified character is a UpperCase character or not. + * + * @param { string } char - the character to be tested + * @returns { boolean } true if the character is a UpperCase character + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since 12 + */ + static isUpperCase(char: string): boolean; + /** + * Get the general category value of the specified character. + * + * @param { string } char - the character to be tested + * @returns { string } the general category of the specified character. + * @syscap SystemCapability.Global.I18n + * @since 9 + */ + /** + * Get the general category value of the specified character. + * + * @param { string } char - the character to be tested + * @returns { string } the general category of the specified character. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Get the general category value of the specified character. + * + * @param { string } char - the character to be tested + * @returns { string } the general category of the specified character. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since 12 + */ + static getType(char: string): string; + } + /** + * check out whether system is 24-hour system. + * + * @returns { boolean } a boolean represent whether system is 24-hour system. + * @syscap SystemCapability.Global.I18n + * @since 7 + * @deprecated since 9 + * @useinstead ohos.i18n/i18n.System#is24HourClock + */ + export function is24HourClock(): boolean; + /** + * set 24-hour system. + * + * @permission ohos.permission.UPDATE_CONFIGURATION + * @param { boolean } option - represent the boolean to be set. + * @returns { boolean } a boolean represent whether setting 24-hour system success. + * @syscap SystemCapability.Global.I18n + * @since 7 + * @deprecated since 9 + * @useinstead ohos.i18n/i18n.System#set24HourClock + */ + export function set24HourClock(option: boolean): boolean; + /** + * Add one language to preferred language List. + * + * @permission ohos.permission.UPDATE_CONFIGURATION + * @param { string } language - the language to be added. + * @param { number } [index] - the position of preferred language list to be inserted. + * @returns { boolean } a boolean represent whether language added success. + * @syscap SystemCapability.Global.I18n + * @since 8 + * @deprecated since 9 + * @useinstead ohos.i18n/i18n.System#addPreferredLanguage + */ + export function addPreferredLanguage(language: string, index?: number): boolean; + /** + * Remove one language from preferred language list. + * + * @permission ohos.permission.UPDATE_CONFIGURATION + * @param { number } index - the position of removed language in preferred language list. + * @returns { boolean } a boolean represent whether removed success. + * @syscap SystemCapability.Global.I18n + * @since 8 + * @deprecated since 9 + * @useinstead ohos.i18n/i18n.System#removePreferredLanguage + */ + export function removePreferredLanguage(index: number): boolean; + /** + * Access the system preferred language list. + * + * @returns { Array } a string Array represent the preferred language list. + * @syscap SystemCapability.Global.I18n + * @since 8 + * @deprecated since 9 + * @useinstead ohos.i18n/i18n.System#getPreferredLanguageList + */ + export function getPreferredLanguageList(): Array; + /** + * Get the first preferred language of system. + * + * @returns { string } a string represent the first preferred language of system. + * @syscap SystemCapability.Global.I18n + * @since 8 + * @deprecated since 9 + * @useinstead ohos.i18n/i18n.System#getFirstPreferredLanguage + */ + export function getFirstPreferredLanguage(): string; + /** + * Get the default TimeZone object or the TimeZone object corresponds to zoneID. + * + * @param { string } [zoneID] - TimeZone ID used to create TimeZone Object. + * @returns { TimeZone } a TimeZone object corresponds to zoneID. + * @syscap SystemCapability.Global.I18n + * @since 7 + */ + /** + * Get the default TimeZone object or the TimeZone object corresponds to zoneID. + * + * @param { string } [zoneID] - TimeZone ID used to create TimeZone Object. + * @returns { TimeZone } a TimeZone object corresponds to zoneID. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Get the default TimeZone object or the TimeZone object corresponds to zoneID. + * + * @param { string } [zoneID] - TimeZone ID used to create TimeZone Object. + * @returns { TimeZone } a TimeZone object corresponds to zoneID. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since 12 + */ + export function getTimeZone(zoneID?: string): TimeZone; + /** + * Provides the API for accessing TimeZone name, rawOffset and offset information. + * + * @syscap SystemCapability.Global.I18n + * @since 7 + */ + /** + * Provides the API for accessing TimeZone name, rawOffset and offset information. + * + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Provides the API for accessing TimeZone name, rawOffset and offset information. + * + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since 12 + */ + export class TimeZone { + /** + * Get the id of the TimeZone object. + * + * @returns { string } a string represents the timezone id. + * @syscap SystemCapability.Global.I18n + * @since 7 + */ + /** + * Get the id of the TimeZone object. + * + * @returns { string } a string represents the timezone id. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Get the id of the TimeZone object. + * + * @returns { string } a string represents the timezone id. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since 12 + */ + getID(): string; + /** + * Get the displayName of the TimeZone Object under the locale. + * + * @param { string } [locale] - the locale tag use to display timezone object's name. + * @param { boolean } [isDST] - wether consider daylight saving time when display timezone object's name. + * @returns { string } a string represents the display name. + * @syscap SystemCapability.Global.I18n + * @since 7 + */ + /** + * Get the displayName of the TimeZone Object under the locale. + * + * @param { string } [locale] - the locale tag use to display timezone object's name. + * @param { boolean } [isDST] - wether consider daylight saving time when display timezone object's name. + * @returns { string } a string represents the display name. + * @syscap SystemCapability.Global.I18n + * @atomicservice + * @since 12 + */ + getDisplayName(locale?: string, isDST?: boolean): string; + /** + * Get the raw offset of the TimeZone object. + * + * @returns { number } a number represents the raw offset. + * @syscap SystemCapability.Global.I18n + * @since 7 + */ + /** + * Get the raw offset of the TimeZone object. + * + * @returns { number } a number represents the raw offset. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Get the raw offset of the TimeZone object. + * + * @returns { number } a number represents the raw offset. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since 12 + */ + getRawOffset(): number; + /** + * Get the offset of the TimeZone object. + * + * @param { number } [date] - Indicates a date use to compute offset. + * @returns { number } a number represents the offset with date. + * @syscap SystemCapability.Global.I18n + * @since 7 + */ + /** + * Get the offset of the TimeZone object. + * + * @param { number } [date] - Indicates a date use to compute offset. + * @returns { number } a number represents the offset with date. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Get the offset of the TimeZone object. + * + * @param { number } [date] - Indicates a date use to compute offset. + * @returns { number } a number represents the offset with date. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since 12 + */ + getOffset(date?: number): number; + /** + * Get available TimeZone ID list. + * + * @returns { Array } a string array represents the available TimeZone ID list. + * @syscap SystemCapability.Global.I18n + * @since 9 + */ + /** + * Get available TimeZone ID list. + * + * @returns { Array } a string array represents the available TimeZone ID list. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Get available TimeZone ID list. + * + * @returns { Array } a string array represents the available TimeZone ID list. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since 12 + */ + static getAvailableIDs(): Array; + /** + * Get available Zone City ID list. + * + * @returns { Array } a string array represents the available Zone City ID list. + * @syscap SystemCapability.Global.I18n + * @since 9 + */ + /** + * Get available Zone City ID list. + * + * @returns { Array } a string array represents the available Zone City ID list. + * @syscap SystemCapability.Global.I18n + * @atomicservice + * @since 12 + */ + static getAvailableZoneCityIDs(): Array; + /** + * Get City display name in a certain locale. + * + * @param { string } cityID - Zone City ID. + * @param { string } locale - locale used to display city name. + * @returns { string } a string represents the display name of City in locale. + * @syscap SystemCapability.Global.I18n + * @since 9 + */ + /** + * Get City display name in a certain locale. + * + * @param { string } cityID - Zone City ID. + * @param { string } locale - locale used to display city name. + * @returns { string } a string represents the display name of City in locale. + * @syscap SystemCapability.Global.I18n + * @atomicservice + * @since 12 + */ + static getCityDisplayName(cityID: string, locale: string): string; + /** + * Get TimeZone Object from city ID. + * + * @param { string } cityID - Zone City ID. + * @returns { TimeZone } a TimeZone Object from city ID. + * @syscap SystemCapability.Global.I18n + * @since 9 + */ + /** + * Get TimeZone Object from city ID. + * + * @param { string } cityID - Zone City ID. + * @returns { TimeZone } a TimeZone Object from city ID. + * @syscap SystemCapability.Global.I18n + * @atomicservice + * @since 12 + */ + static getTimezoneFromCity(cityID: string): TimeZone; + /** + * Get the possible time zones from the specified longitude and latitude. + * + * @param { number } longitude value + * @param { number } latitude value + * @returns { Array } Returns a TimeZone array from the specified longitude and latitude. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. + * @throws { BusinessError } 890001 - Invalid parameter. Possible causes: Parameter verification failed. + * @syscap SystemCapability.Global.I18n + * @since 10 + */ + /** + * Get the possible time zones from the specified longitude and latitude. + * + * @param { number } longitude value + * @param { number } latitude value + * @returns { Array } Returns a TimeZone array from the specified longitude and latitude. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. + * @throws { BusinessError } 890001 - param value not valid. Possible causes: Parameter verification failed. + * @syscap SystemCapability.Global.I18n + * @atomicservice + * @since 12 + */ + static getTimezonesByLocation(longitude: number, latitude: number): Array; + } + /** + * Provides the API for transliterate text from one format to another. + * + * @syscap SystemCapability.Global.I18n + * @since 9 + */ + /** + * Provides the API for transliterate text from one format to another. + * + * @syscap SystemCapability.Global.I18n + * @atomicservice + * @since 12 + */ + export class Transliterator { + /** + * Get a string array of all available transliterator ids. + * + * @returns { string[] } a string array of all available transliterator ids. + * @syscap SystemCapability.Global.I18n + * @since 9 + */ + /** + * Get a string array of all available transliterator ids. + * + * @returns { string[] } a string array of all available transliterator ids. + * @syscap SystemCapability.Global.I18n + * @atomicservice + * @since 12 + */ + static getAvailableIDs(): string[]; + /** + * Get a Transliterator that is specified by id name. + * + * @param { string } id - specified the type of Transliterator. id is formed by source and dest. Transliterator will transliterate + * the input string from source format to the dest format. For example, a Simplified Chinese to Latn + * Transliterator will transform the text written in Chinese to Latn characters. + * @returns { Transliterator } Transliterator that is specified by id name. + * @syscap SystemCapability.Global.I18n + * @since 9 + */ + /** + * Get a Transliterator that is specified by id name. + * + * @param { string } id - specified the type of Transliterator. id is formed by source and dest. Transliterator will transliterate + * the input string from source format to the dest format. For example, a Simplified Chinese to Latn + * Transliterator will transform the text written in Chinese to Latn characters. + * @returns { Transliterator } Transliterator that is specified by id name. + * @syscap SystemCapability.Global.I18n + * @atomicservice + * @since 12 + */ + static getInstance(id: string): Transliterator; + /** + * Transform the input text. + * + * @param { string } text - text to be transliterated. + * @returns { string } the output text that is transliterated from source format to the dest format. + * @syscap SystemCapability.Global.I18n + * @since 9 + */ + /** + * Transform the input text. + * + * @param { string } text - text to be transliterated. + * @returns { string } the output text that is transliterated from source format to the dest format. + * @syscap SystemCapability.Global.I18n + * @atomicservice + * @since 12 + */ + transform(text: string): string; + } + /** + * Enumerates the Normalizer modes. + * + * @enum { number } + * @syscap SystemCapability.Global.I18n + * @since 10 + */ + /** + * Enumerates the Normalizer modes. + * + * @enum { number } + * @syscap SystemCapability.Global.I18n + * @atomicservice + * @since 12 + */ + export enum NormalizerMode { + /** + * Normalization form C, characters are decomposed and then re-composed by canonical equivalence + * + * @syscap SystemCapability.Global.I18n + * @since 10 + */ + /** + * Normalization form C, characters are decomposed and then re-composed by canonical equivalence + * + * @syscap SystemCapability.Global.I18n + * @atomicservice + * @since 12 + */ + NFC = 1, + /** + * Normalization form D, characters are decomposed by canonical equivalence + * + * @syscap SystemCapability.Global.I18n + * @since 10 + */ + /** + * Normalization form D, characters are decomposed by canonical equivalence + * + * @syscap SystemCapability.Global.I18n + * @atomicservice + * @since 12 + */ + NFD = 2, + /** + * Normalization form KC, characters are decomposed by compatibility, then re-composed by canonical equivalence + * + * @syscap SystemCapability.Global.I18n + * @since 10 + */ + /** + * Normalization form KC, characters are decomposed by compatibility, then re-composed by canonical equivalence + * + * @syscap SystemCapability.Global.I18n + * @atomicservice + * @since 12 + */ + NFKC = 3, + /** + * Normalization form KD, characters are decomposed by compatibility + * + * @syscap SystemCapability.Global.I18n + * @since 10 + */ + /** + * Normalization form KD, characters are decomposed by compatibility + * + * @syscap SystemCapability.Global.I18n + * @atomicservice + * @since 12 + */ + NFKD = 4 + } + /** + * Provides the API for text encoding normalization. + * + * @syscap SystemCapability.Global.I18n + * @since 10 + */ + /** + * Provides the API for text encoding normalization. + * + * @syscap SystemCapability.Global.I18n + * @atomicservice + * @since 12 + */ + export class Normalizer { + /** + * Get a Normalizer that is specified by normalize mode. + * + * @param { NormalizerMode } mode - specified the mode of Normalizer. It must be a valid mode. + * @returns { Normalizer } Transliterator that is specified by id name. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. + * @syscap SystemCapability.Global.I18n + * @since 10 + */ + /** + * Get a Normalizer that is specified by normalize mode. + * + * @param { NormalizerMode } mode - specified the mode of Normalizer. It must be a valid mode. + * @returns { Normalizer } Transliterator that is specified by id name. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. + * @syscap SystemCapability.Global.I18n + * @atomicservice + * @since 12 + */ + static getInstance(mode: NormalizerMode): Normalizer; + /** + * Get a normalized string of specified mode. + * + * @param { string } text - text to normalized. + * @returns { string } a normalized string from source. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. + * @syscap SystemCapability.Global.I18n + * @since 10 + */ + /** + * Get a normalized string of specified mode. + * + * @param { string } text - text to normalized. + * @returns { string } a normalized string from source. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. + * @syscap SystemCapability.Global.I18n + * @atomicservice + * @since 12 + */ + normalize(text: string): string; + } + /** + * Provides the informations of one holiday. + * + * @interface HolidayInfoItem + * @syscap SystemCapability.Global.I18n + * @since 11 + */ + /** + * Provides the informations of one holiday. + * + * @interface HolidayInfoItem + * @syscap SystemCapability.Global.I18n + * @atomicservice + * @since 12 + */ + export interface HolidayInfoItem { + /** + * Holiday base name. + * + * @type { string } + * @syscap SystemCapability.Global.I18n + * @since 11 + */ + /** + * Holiday base name. + * + * @type { string } + * @syscap SystemCapability.Global.I18n + * @atomicservice + * @since 12 + */ + baseName: string; + /** + * Holiday start year. + * + * @type { number } + * @syscap SystemCapability.Global.I18n + * @since 11 + */ + /** + * Holiday start year. + * + * @type { number } + * @syscap SystemCapability.Global.I18n + * @atomicservice + * @since 12 + */ + year: number; + /** + * Holiday start month. + * + * @type { number } + * @syscap SystemCapability.Global.I18n + * @since 11 + */ + /** + * Holiday start month. + * + * @type { number } + * @syscap SystemCapability.Global.I18n + * @atomicservice + * @since 12 + */ + month: number; + /** + * Holiday start day. + * + * @type { number } + * @syscap SystemCapability.Global.I18n + * @since 11 + */ + /** + * Holiday start day. + * + * @type { number } + * @syscap SystemCapability.Global.I18n + * @atomicservice + * @since 12 + */ + day: number; + /** + * Holiday local name array. + * + * @type { ?Array } + * @syscap SystemCapability.Global.I18n + * @since 11 + */ + /** + * Holiday local name array. + * + * @type { ?Array } + * @syscap SystemCapability.Global.I18n + * @atomicservice + * @since 12 + */ + localNames?: Array; + } + /** + * Provides the informations holiday locale name. + * + * @interface HolidayLocalName + * @syscap SystemCapability.Global.I18n + * @since 11 + */ + /** + * Provides the informations holiday locale name. + * + * @interface HolidayLocalName + * @syscap SystemCapability.Global.I18n + * @atomicservice + * @since 12 + */ + export interface HolidayLocalName { + /** + * Holiday locale name language id. + * + * @type { string } + * @syscap SystemCapability.Global.I18n + * @since 11 + */ + /** + * Holiday locale name language id. + * + * @type { string } + * @syscap SystemCapability.Global.I18n + * @atomicservice + * @since 12 + */ + language: string; + /** + * Holiday local name. + * + * @type { string } + * @syscap SystemCapability.Global.I18n + * @since 11 + */ + /** + * Holiday local name. + * + * @type { string } + * @syscap SystemCapability.Global.I18n + * @atomicservice + * @since 12 + */ + name: string; + } + /** + * Provide some functions to manage holidays in a country or region. Partly follows the RFC2445 standard. + * + * @syscap SystemCapability.Global.I18n + * @since 11 + */ + /** + * Provide some functions to manage holidays in a country or region. Partly follows the RFC2445 standard. + * + * @syscap SystemCapability.Global.I18n + * @atomicservice + * @since 12 + */ + export class HolidayManager { + /** + * A constructor used to create a HolidayManager object. + * + * @param { String } icsPath - the path of the iCalendar format file to create HolidayManager object. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. + * @throws { BusinessError } 890001 - Invalid parameter. Possible causes: Parameter verification failed. + * @syscap SystemCapability.Global.I18n + * @since 11 + */ + /** + * A constructor used to create a HolidayManager object. + * + * @param { String } icsPath - the path of the iCalendar format file to create HolidayManager object. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. + * @throws { BusinessError } 890001 - Invalid parameter. Possible causes: Parameter verification failed. + * @syscap SystemCapability.Global.I18n + * @atomicservice + * @since 12 + */ + constructor(icsPath: String); + /** + * Returns true if the given date is a holiday. If the date is not given, + * the date object of current time is used. + * + * @param { Date } [date] - Date object whose attribute is desired. + * @returns { boolean } whether the date is a holiday day. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. + * @syscap SystemCapability.Global.I18n + * @since 11 + */ + /** + * Returns true if the given date is a holiday. If the date is not given, + * the date object of current time is used. + * + * @param { Date } [date] - Date object whose attribute is desired. + * @returns { boolean } whether the date is a holiday day. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. + * @syscap SystemCapability.Global.I18n + * @atomicservice + * @since 12 + */ + isHoliday(date?: Date): boolean; + /** + * Obtains holiday info array for a specified year + * + * @param { number } [year] - specified holiday year. If the year is not given, + * the current year is used. + * @returns { Array } holiday information array for one year. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. + * @throws { BusinessError } 890001 - Invalid parameter. Possible causes: Parameter verification failed. + * @syscap SystemCapability.Global.I18n + * @since 11 + */ + /** + * Obtains holiday info array for a specified year + * + * @param { number } [year] - specified holiday year. If the year is not given, + * the current year is used. + * @returns { Array } holiday information array for one year. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. + * @throws { BusinessError } 890001 - Invalid parameter. Possible causes: Parameter verification failed. + * @syscap SystemCapability.Global.I18n + * @atomicservice + * @since 12 + */ + getHolidayInfoItemArray(year?: number): Array; + } + /** + * Provides the informations of one entity. + * + * @interface EntityInfoItem + * @syscap SystemCapability.Global.I18n + * @since 11 + */ + /** + * Provides the informations of one entity. + * + * @interface EntityInfoItem + * @syscap SystemCapability.Global.I18n + * @atomicservice + * @since 12 + */ + export interface EntityInfoItem { + /** + * Entity begin position. + * + * @type { number } + * @syscap SystemCapability.Global.I18n + * @since 11 + */ + /** + * Entity begin position. + * + * @type { number } + * @syscap SystemCapability.Global.I18n + * @atomicservice + * @since 12 + */ + begin: number; + /** + * Entity end position. + * + * @type { number } + * @syscap SystemCapability.Global.I18n + * @since 11 + */ + /** + * Entity end position. + * + * @type { number } + * @syscap SystemCapability.Global.I18n + * @atomicservice + * @since 12 + */ + end: number; + /** + * Entity type. Field values such as phone_number, date + * + * @type { string } + * @syscap SystemCapability.Global.I18n + * @since 11 + */ + /** + * Entity type. Field values such as phone_number, date + * + * @type { string } + * @syscap SystemCapability.Global.I18n + * @atomicservice + * @since 12 + */ + type: string; + } + /** + * Provide some functions to find named entity in text. + * + * @syscap SystemCapability.Global.I18n + * @since 11 + */ + /** + * Provide some functions to find named entity in text. + * + * @syscap SystemCapability.Global.I18n + * @atomicservice + * @since 12 + */ + export class EntityRecognizer { + /** + * A constructor used to create a EntityRecognizer object. + * + * @param { string } [locale] - specified the locale. Use current app locale by default. It must be a valid locale. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. + * @throws { BusinessError } 890001 - Invalid parameter. Possible causes: Parameter verification failed. + * @syscap SystemCapability.Global.I18n + * @since 11 + */ + /** + * A constructor used to create a EntityRecognizer object. + * + * @param { string } [locale] - specified the locale. Use current app locale by default. It must be a valid locale. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. + * @throws { BusinessError } 890001 - Invalid parameter. Possible causes: Parameter verification failed. + * @syscap SystemCapability.Global.I18n + * @atomicservice + * @since 12 + */ + constructor(locale?: string); + /** + * Obtains holiday info array for a specified text + * + * @param { string } text - the text to find entities. + * @returns { Array } entity information array found. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. + * @syscap SystemCapability.Global.I18n + * @since 11 + */ + /** + * Obtains holiday info array for a specified text + * + * @param { string } text - the text to find entities. + * @returns { Array } entity information array found. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. + * @syscap SystemCapability.Global.I18n + * @atomicservice + * @since 12 + */ + findEntityInfo(text: string): Array; + } +} +export default i18n; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.identifier.oaid.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.identifier.oaid.d.ts new file mode 100755 index 00000000..14341b07 --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.identifier.oaid.d.ts @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file Provides the capability to manage OAID + * @kit AdsKit + */ +import type { AsyncCallback } from './@ohos.base'; +/** + * Provides the capability to manage OAID. + * @namespace identifier + * @syscap SystemCapability.Advertising.OAID + * @since 10 + */ +declare namespace identifier { + /** + * Obtain the OAID with callback. + * Obtaining OAID requires the permission:ohos.permission.APP_TRACKING_CONSENT, otherwise the obtained OAID is 00000000-0000-0000-0000-000000000000. + * @permission ohos.permission.APP_TRACKING_CONSENT + * @param { AsyncCallback } callback - The callback to get the OAID. + * @throws { BusinessError } 17300001 - System internal error. + * @syscap SystemCapability.Advertising.OAID + * @since 10 + */ + function getOAID(callback: AsyncCallback): void; + /** + * Obtain the OAID with promise. + * Obtaining OAID requires the permission:ohos.permission.APP_TRACKING_CONSENT, otherwise the obtained OAID is 00000000-0000-0000-0000-000000000000. + * @permission ohos.permission.APP_TRACKING_CONSENT + * @returns { Promise } promise - Returns the OAID. + * @throws { BusinessError } 17300001 - System internal error. + * @syscap SystemCapability.Advertising.OAID + * @since 10 + */ + function getOAID(): Promise; +} +export default identifier; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.inputMethod.Panel.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.inputMethod.Panel.d.ts new file mode 100755 index 00000000..6078f289 --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.inputMethod.Panel.d.ts @@ -0,0 +1,106 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit IMEKit + */ +/** + * Panel information. + * + * @typedef PanelInfo + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 11 + */ +export interface PanelInfo { + /** + * Panel type. + * + * @type { PanelType } + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 11 + */ + type: PanelType; + /** + *

Flag of Panel.

+ *

Currently only using for SOFT_KEYBOARD panel.

+ * + * @type { ?PanelFlag } + * @default FLG_FIXED + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 11 + */ + flag?: PanelFlag; +} +/** + * Enumerates the flags of panel. + * + * @enum { number } + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 11 + */ +export enum PanelFlag { + /** + * Fixed style. + *

It's provided for the panel with type of SOFT_KEYBOARD. + * When the flag is set, the soft keyboard is fixed at the bottom of the screen.

+ * + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 11 + */ + FLAG_FIXED = 0, + /** + * Floating style. + *

It's provided for the panel with type of SOFT_KEYBOARD. + * When the flag is set, the soft keyboard is floating.

+ * + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 11 + */ + FLAG_FLOATING, + /** + * Candidate style. + *

It's provided for the panel with type of SOFT_KEYBOARD. + * When the flag is set, the soft keyboard is a candidate window which will show the possible characters when user types a input code. + * Panel with candidate style will not be automatically shown or hidden by input method service. + * Input method application developers are supposed to control the panel status on their own.

+ * + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 11 + */ + FLAG_CANDIDATE +} +/** + * Enumerates the types of panel. + * + * @enum { number } + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 11 + */ +export enum PanelType { + /** + * Panel for displaying a virtual soft keyboard. + * + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 11 + */ + SOFT_KEYBOARD = 0, + /** + * Panel for displaying status bar. + * + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 11 + */ + STATUS_BAR +} diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.inputMethod.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.inputMethod.d.ts new file mode 100755 index 00000000..53cf0f05 --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.inputMethod.d.ts @@ -0,0 +1,1640 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit IMEKit + */ +import type { Callback, AsyncCallback } from './@ohos.base'; +import type { ElementName } from './bundleManager/ElementName'; +import InputMethodSubtype from './@ohos.InputMethodSubtype'; +/** + * Input method + * + * @namespace inputMethod + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 6 + */ +declare namespace inputMethod { + /** + * Keyboard max number + * + * @constant + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 8 + */ + const MAX_TYPE_NUM: number; + /** + * Input method setting + * + * @returns { InputMethodSetting } the object of InputMethodSetting + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 8 + * @deprecated since 9 + * @useinstead inputMethod#getSetting + */ + function getInputMethodSetting(): InputMethodSetting; + /** + * Input method controller + * + * @returns { InputMethodController } the object of InputMethodController. + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 6 + * @deprecated since 9 + * @useinstead inputMethod#getController + */ + function getInputMethodController(): InputMethodController; + /** + * Input method setting + * + * @returns { InputMethodSetting } the object of InputMethodSetting. + * @throws { BusinessError } 12800007 - settings extension error. + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 9 + */ + function getSetting(): InputMethodSetting; + /** + * Input method controller + * + * @returns { InputMethodController } the object of InputMethodController. + * @throws { BusinessError } 12800006 - input method controller error. + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 9 + */ + function getController(): InputMethodController; + /** + * Get default input method + * + * @returns { InputMethodProperty } property of the default input method. + * @throws { BusinessError } 12800008 - input method manager service error. + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 11 + */ + function getDefaultInputMethod(): InputMethodProperty; + /** + * Get system input method config ability + * + * @returns { ElementName } the information of system input method config ability. + * @throws { BusinessError } 12800008 - input method manager service error. + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 11 + */ + function getSystemInputMethodConfigAbility(): ElementName; + /** + * Switch input method + * + * @permission ohos.permission.CONNECT_IME_ABILITY + * @param { InputMethodProperty } target - indicates the input method which will replace the current one. + * @param { AsyncCallback } callback - the callback of switchInputMethod. + * @throws { BusinessError } 201 - permissions check fails. + * @throws { BusinessError } 401 - parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. + * @throws { BusinessError } 12800005 - configuration persisting error. + * @throws { BusinessError } 12800008 - input method manager service error. + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 9 + */ + /** + * Switch input method. The caller must be the current inputmethod. + * + * @param { InputMethodProperty } target - indicates the target input method. + * @param { AsyncCallback } callback - the callback of switchInputMethod. + * @throws { BusinessError } 401 - parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. + * @throws { BusinessError } 12800005 - configuration persisting error. + * @throws { BusinessError } 12800008 - input method manager service error. + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 11 + */ + function switchInputMethod(target: InputMethodProperty, callback: AsyncCallback): void; + /** + * Switch input method + * + * @permission ohos.permission.CONNECT_IME_ABILITY + * @param { InputMethodProperty } target - Indicates the input method which will replace the current one. + * @returns { Promise } the promise returned by the function. + * @throws { BusinessError } 201 - permissions check fails. + * @throws { BusinessError } 401 - parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. + * @throws { BusinessError } 12800005 - configuration persisting error. + * @throws { BusinessError } 12800008 - input method manager service error. + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 9 + */ + /** + * Switch input method. The caller must be the current inputmethod. + * + * @param { InputMethodProperty } target - indicates the target input method. + * @returns { Promise } the promise returned by the function. + * @throws { BusinessError } 401 - parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. + * @throws { BusinessError } 12800005 - configuration persisting error. + * @throws { BusinessError } 12800008 - input method manager service error. + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 11 + */ + function switchInputMethod(target: InputMethodProperty): Promise; + /** + * Get current input method + * + * @returns { InputMethodProperty } the property of current inputmethod. + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 9 + */ + function getCurrentInputMethod(): InputMethodProperty; + /** + * Switch current input method subtype + * + * @permission ohos.permission.CONNECT_IME_ABILITY + * @param { InputMethodSubtype } target - Indicates the input method subtype which will replace the current one. + * @param { AsyncCallback } callback - the callback of switchCurrentInputMethodSubtype. + * @throws { BusinessError } 201 - permissions check fails. + * @throws { BusinessError } 401 - parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. + * @throws { BusinessError } 12800005 - configuration persisting error. + * @throws { BusinessError } 12800008 - input method manager service error. + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 9 + */ + /** + * Switch current input method subtype, if this interface is invoked by the current IME, this permission is ignored. + * + * @permission ohos.permission.CONNECT_IME_ABILITY + * @param { InputMethodSubtype } target - Indicates the input method subtype which will replace the current one. + * @param { AsyncCallback } callback - the callback of switchCurrentInputMethodSubtype. + * @throws { BusinessError } 201 - permissions check fails. + * @throws { BusinessError } 401 - parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. + * @throws { BusinessError } 12800005 - configuration persisting error. + * @throws { BusinessError } 12800008 - input method manager service error. + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 10 + */ + /** + * Switch current input method subtype. The caller must be the current inputmethod. + * + * @param { InputMethodSubtype } target - indicates the target input method subtype. + * @param { AsyncCallback } callback - the callback of switchCurrentInputMethodSubtype. + * @throws { BusinessError } 401 - parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. + * @throws { BusinessError } 12800005 - configuration persisting error. + * @throws { BusinessError } 12800008 - input method manager service error. + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 11 + */ + function switchCurrentInputMethodSubtype(target: InputMethodSubtype, callback: AsyncCallback): void; + /** + * Switch current input method subtype + * + * @permission ohos.permission.CONNECT_IME_ABILITY + * @param { InputMethodSubtype } target - Indicates the input method subtype which will replace the current one. + * @returns { Promise } the promise returned by the function. + * @throws { BusinessError } 201 - permissions check fails. + * @throws { BusinessError } 401 - parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. + * @throws { BusinessError } 12800005 - configuration persisting error. + * @throws { BusinessError } 12800008 - input method manager service error. + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 9 + */ + /** + * Switch current input method subtype, if this interface is invoked by the current IME, this permission is ignored. + * + * @permission ohos.permission.CONNECT_IME_ABILITY + * @param { InputMethodSubtype } target - Indicates the input method subtype which will replace the current one. + * @returns { Promise } the promise returned by the function. + * @throws { BusinessError } 201 - permissions check fails. + * @throws { BusinessError } 401 - parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. + * @throws { BusinessError } 12800005 - configuration persisting error. + * @throws { BusinessError } 12800008 - input method manager service error. + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 10 + */ + /** + * Switch current input method subtype. The caller must be the current inputmethod. + * + * @param { InputMethodSubtype } target - indicates the target input method subtype. + * @returns { Promise } the promise returned by the function. + * @throws { BusinessError } 401 - parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. + * @throws { BusinessError } 12800005 - configuration persisting error. + * @throws { BusinessError } 12800008 - input method manager service error. + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 11 + */ + function switchCurrentInputMethodSubtype(target: InputMethodSubtype): Promise; + /** + * Get the current input method subtype + * + * @returns { InputMethodSubtype } the subtype of the current input method. + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 9 + */ + function getCurrentInputMethodSubtype(): InputMethodSubtype; + /** + * Switch input method and subtype. If the caller is an input method, it must be the current inputmethod. + * + * @permission ohos.permission.CONNECT_IME_ABILITY + * @param { InputMethodProperty } inputMethodProperty - Indicates the target input method. + * @param { InputMethodSubtype } inputMethodSubtype - Indicates the target input method subtype. + * @param { AsyncCallback } callback - the callback of switchCurrentInputMethodAndSubtype. + * @throws { BusinessError } 201 - permissions check fails. + * @throws { BusinessError } 401 - parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. + * @throws { BusinessError } 12800005 - configuration persisting error. + * @throws { BusinessError } 12800008 - input method manager service error. + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 9 + */ + /** + * Switch input method and subtype. The caller must be the current inputmethod. + * + * @param { InputMethodProperty } inputMethodProperty - indicates the target input method. + * @param { InputMethodSubtype } inputMethodSubtype - indicates the target input method subtype. + * @param { AsyncCallback } callback - the callback of switchCurrentInputMethodAndSubtype. + * @throws { BusinessError } 401 - parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. + * @throws { BusinessError } 12800005 - configuration persisting error. + * @throws { BusinessError } 12800008 - input method manager service error. + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 11 + */ + function switchCurrentInputMethodAndSubtype(inputMethodProperty: InputMethodProperty, inputMethodSubtype: InputMethodSubtype, callback: AsyncCallback): void; + /** + * Switch input method and subtype. If the caller is an input method, it must be the current inputmethod. + * + * @permission ohos.permission.CONNECT_IME_ABILITY + * @param { InputMethodProperty } inputMethodProperty - Indicates the target input method. + * @param { InputMethodSubtype } inputMethodSubtype - Indicates the target input method subtype. + * @returns { Promise } the promise returned by the function. + * @throws { BusinessError } 201 - permissions check fails. + * @throws { BusinessError } 401 - parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. + * @throws { BusinessError } 12800005 - configuration persisting error. + * @throws { BusinessError } 12800008 - input method manager service error. + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 9 + */ + /** + * Switch input method and subtype. The caller must be the current inputmethod. + * + * @param { InputMethodProperty } inputMethodProperty - indicates the target input method. + * @param { InputMethodSubtype } inputMethodSubtype - indicates the target input method subtype. + * @returns { Promise } the promise returned by the function. + * @throws { BusinessError } 401 - parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. + * @throws { BusinessError } 12800005 - configuration persisting error. + * @throws { BusinessError } 12800008 - input method manager service error. + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 11 + */ + function switchCurrentInputMethodAndSubtype(inputMethodProperty: InputMethodProperty, inputMethodSubtype: InputMethodSubtype): Promise; + /** + * @interface InputMethodSetting + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 8 + */ + interface InputMethodSetting { + /** + * Subscribe input method or subtype change. + * + * @param { 'imeChange' } type - Indicates the event type. + * @param { function } callback - the callback of 'imeChange' + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 9 + */ + on(type: 'imeChange', callback: (inputMethodProperty: InputMethodProperty, inputMethodSubtype: InputMethodSubtype) => void): void; + /** + * Unsubscribe input method or subtype change. + * + * @param { 'imeChange' } type - Indicates the event type. + * @param { function } [callback] - the callback of 'imeChange', + * when subscriber unsubscribes all callback functions of event 'imeChange', this parameter can be left blank. + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 9 + */ + off(type: 'imeChange', callback?: (inputMethodProperty: InputMethodProperty, inputMethodSubtype: InputMethodSubtype) => void): void; + /** + * List subtype of the specified input method. + * + * @param { InputMethodProperty } inputMethodProperty - the property of the specified inputmethod. + * @param { AsyncCallback> } callback - the callback of listInputMethodSubtype. + * @throws { BusinessError } 401 - parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. + * @throws { BusinessError } 12800001 - package manager error. + * @throws { BusinessError } 12800008 - input method manager service error. + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 9 + */ + listInputMethodSubtype(inputMethodProperty: InputMethodProperty, callback: AsyncCallback>): void; + /** + * List subtype of the specified input method. + * + * @param { InputMethodProperty } inputMethodProperty - Indicates the specified input method. + * @returns { Promise> } the promise returned by the function. + * @throws { BusinessError } 401 - parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. + * @throws { BusinessError } 12800001 - package manager error. + * @throws { BusinessError } 12800008 - input method manager service error. + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 9 + */ + listInputMethodSubtype(inputMethodProperty: InputMethodProperty): Promise>; + /** + * List subtype of current input method + * + * @param { AsyncCallback> } callback - the callback of listCurrentInputMethodSubtype. + * @throws { BusinessError } 12800001 - package manager error. + * @throws { BusinessError } 12800008 - input method manager service error. + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 9 + */ + listCurrentInputMethodSubtype(callback: AsyncCallback>): void; + /** + * List subtype of current input method + * + * @returns { Promise> } the promise returned by the function. + * @throws { BusinessError } 12800001 - package manager error. + * @throws { BusinessError } 12800008 - input method manager service error. + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 9 + */ + listCurrentInputMethodSubtype(): Promise>; + /** + * List input methods + * + * @param { boolean } enable - + * If true, collect enabled input methods. + * If false, collect disabled input methods. + * @param { AsyncCallback> } callback - the callback of getInputMethods. + * @throws { BusinessError } 401 - parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. + * @throws { BusinessError } 12800001 - package manager error. + * @throws { BusinessError } 12800008 - input method manager service error. + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 9 + */ + getInputMethods(enable: boolean, callback: AsyncCallback>): void; + /** + * List input methods + * + * @param { boolean } enable - + * If true, collect enabled input methods. + * If false, collect disabled input methods. + * @returns { Promise> } the promise returned by the function. + * @throws { BusinessError } 401 - parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. + * @throws { BusinessError } 12800001 - package manager error. + * @throws { BusinessError } 12800008 - input method manager service error. + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 9 + */ + getInputMethods(enable: boolean): Promise>; + /** + * List enabled or disabled input methods sync + * + * @param { boolean } enable - + * If true, collect enabled input methods. + * If false, collect disabled input methods. + * @returns { Array } the list of inputmethod. + * @throws { BusinessError } 401 - parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. + * @throws { BusinessError } 12800001 - bundle manager error. + * @throws { BusinessError } 12800008 - input method manager service error. + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 11 + */ + getInputMethodsSync(enable: boolean): Array; + /** + * List all input methods + * + * @param { AsyncCallback> } callback - the callback of getInputMethods. + * @throws { BusinessError } 12800001 - bundle manager error. + * @throws { BusinessError } 12800008 - input method manager service error. + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 11 + */ + getAllInputMethods(callback: AsyncCallback>): void; + /** + * List all input methods + * + * @returns { Promise> } the promise returned by the function. + * @throws { BusinessError } 12800001 - bundle manager error. + * @throws { BusinessError } 12800008 - input method manager service error. + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 11 + */ + getAllInputMethods(): Promise>; + /** + * List all input methods sync + * + * @returns { Array } the list of all inputmethod. + * @throws { BusinessError } 12800001 - bundle manager error. + * @throws { BusinessError } 12800008 - input method manager service error. + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 11 + */ + getAllInputMethodsSync(): Array; + /** + * @param { AsyncCallback> } callback - the callback of listInputMethod. + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 8 + * @deprecated since 9 + * @useinstead inputMethod.InputMethodSetting#getInputMethods + */ + listInputMethod(callback: AsyncCallback>): void; + /** + * @returns { Promise> } the promise returned by the function. + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 8 + * @deprecated since 9 + * @useinstead inputMethod.InputMethodSetting#getInputMethods + */ + listInputMethod(): Promise>; + /** + * Show input method setting extension dialog + * + * @param { AsyncCallback } callback - the callback of showOptionalInputMethods. + * @throws { BusinessError } 12800008 - input method manager service error. + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 9 + */ + showOptionalInputMethods(callback: AsyncCallback): void; + /** + * Show input method setting extension dialog + * + * @returns { Promise } the promise returned by the function. + * @throws { BusinessError } 12800008 - input method manager service error. + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 9 + */ + showOptionalInputMethods(): Promise; + /** + * @param { AsyncCallback } callback - the callback of displayOptionalInputMethod. + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 8 + * @deprecated since 9 + * @useinstead inputMethod.InputMethodSetting#showOptionalInputMethods + */ + displayOptionalInputMethod(callback: AsyncCallback): void; + /** + * @returns { Promise } the promise returned by the function. + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 8 + * @deprecated since 9 + * @useinstead inputMethod.InputMethodSetting#showOptionalInputMethods + */ + displayOptionalInputMethod(): Promise; + } + /** + * @interface InputMethodController + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 6 + */ + interface InputMethodController { + /** + * Attach application to the input method service. + * + * @param { boolean } showKeyboard - show the keyboard or not when attach the input method. + * @param { TextConfig } textConfig - indicates the config of the textInput. + * @param { AsyncCallback } callback - the callback of attach. + * @throws { BusinessError } 401 - parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. + * @throws { BusinessError } 12800003 - input method client error. + * @throws { BusinessError } 12800008 - input method manager service error. + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 10 + */ + attach(showKeyboard: boolean, textConfig: TextConfig, callback: AsyncCallback): void; + /** + * Attach application to the input method service. + * + * @param { boolean } showKeyboard - show the keyboard or not when attach the input method. + * @param { TextConfig } textConfig - indicates the config of the textInput. + * @returns { Promise } the promise returned by the function. + * @throws { BusinessError } 401 - parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. + * @throws { BusinessError } 12800003 - input method client error. + * @throws { BusinessError } 12800008 - input method manager service error. + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 10 + */ + attach(showKeyboard: boolean, textConfig: TextConfig): Promise; + /** + * Show the text input and start typing. + * + * @param { AsyncCallback } callback - the callback of showTextInput. + * @throws { BusinessError } 12800003 - input method client error. + * @throws { BusinessError } 12800008 - input method manager service error. + * @throws { BusinessError } 12800009 - input method client is detached. + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 10 + */ + showTextInput(callback: AsyncCallback): void; + /** + * Show the text input and start typing. + * + * @returns { Promise } the promise returned by the function. + * @throws { BusinessError } 12800003 - input method client error. + * @throws { BusinessError } 12800008 - input method manager service error. + * @throws { BusinessError } 12800009 - input method client is detached. + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 10 + */ + showTextInput(): Promise; + /** + * Hide the text input and stop typing. + * + * @param { AsyncCallback } callback - the callback of hideTextInput. + * @throws { BusinessError } 12800003 - input method client error. + * @throws { BusinessError } 12800008 - input method manager service error. + * @throws { BusinessError } 12800009 - input method client is detached. + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 10 + */ + hideTextInput(callback: AsyncCallback): void; + /** + * Hide the text input and stop typing. + * + * @returns { Promise } the promise returned by the function. + * @throws { BusinessError } 12800003 - input method client error. + * @throws { BusinessError } 12800008 - input method manager service error. + * @throws { BusinessError } 12800009 - input method client is detached. + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 10 + */ + hideTextInput(): Promise; + /** + * Detach the applications from the input method manager service. + * + * @param { AsyncCallback } callback - the callback of detach. + * @throws { BusinessError } 12800003 - input method client error. + * @throws { BusinessError } 12800008 - input method manager service error. + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 10 + */ + detach(callback: AsyncCallback): void; + /** + * Detach the applications from the input method manager service. + * + * @returns { Promise } the promise returned by the function. + * @throws { BusinessError } 12800003 - input method client error. + * @throws { BusinessError } 12800008 - input method manager service error. + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 10 + */ + detach(): Promise; + /** + * Inform the system of the window ID of the application currently bound to the input method. + * After the correct setting, the window where the client is located can avoid the input method window. + * + * @param { number } windowId - the window ID of the application currently bound to the input method. + * @param { AsyncCallback } callback - the callback of setCallingWindow. + * @throws { BusinessError } 401 - parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. + * @throws { BusinessError } 12800003 - input method client error. + * @throws { BusinessError } 12800008 - input method manager service error. + * @throws { BusinessError } 12800009 - input method client is detached. + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 10 + */ + setCallingWindow(windowId: number, callback: AsyncCallback): void; + /** + * Inform the system of the window ID of the application currently bound to the input method. + * After the correct setting, the window where the client is located can avoid the input method window. + * + * @param { number } windowId - the window ID of the application currently bound to the input method. + * @returns { Promise } the promise returned by the function. + * @throws { BusinessError } 401 - parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. + * @throws { BusinessError } 12800003 - input method client error. + * @throws { BusinessError } 12800008 - input method manager service error. + * @throws { BusinessError } 12800009 - input method client is detached. + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 10 + */ + setCallingWindow(windowId: number): Promise; + /** + * Update Cursor and notify the input method that the current application cursor has changed. + * + * @param { CursorInfo } cursorInfo - the CursorInfo object. + * @param { AsyncCallback } callback - the callback of updateCursor. + * @throws { BusinessError } 401 - parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. + * @throws { BusinessError } 12800003 - input method client error. + * @throws { BusinessError } 12800008 - input method manager service error. + * @throws { BusinessError } 12800009 - input method client is detached. + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 10 + */ + updateCursor(cursorInfo: CursorInfo, callback: AsyncCallback): void; + /** + * Update Cursor and notify the input method that the current application cursor has changed. + * + * @param { CursorInfo } cursorInfo - the CursorInfo object. + * @returns { Promise } the promise returned by the function. + * @throws { BusinessError } 401 - parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. + * @throws { BusinessError } 12800003 - input method client error. + * @throws { BusinessError } 12800008 - input method manager service error. + * @throws { BusinessError } 12800009 - input method client is detached. + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 10 + */ + updateCursor(cursorInfo: CursorInfo): Promise; + /** + * Notify the input method the selected text and the selection range of the current application text has changed. + * + * @param { string } text - the whole input text. + * @param { number } start - start position of selected text. + * @param { number } end - end position of selected text. + * @param { AsyncCallback } callback - the callback of changeSelection. + * @throws { BusinessError } 401 - parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. + * @throws { BusinessError } 12800003 - input method client error. + * @throws { BusinessError } 12800008 - input method manager service error. + * @throws { BusinessError } 12800009 - input method client is detached. + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 10 + */ + changeSelection(text: string, start: number, end: number, callback: AsyncCallback): void; + /** + * Notify the input method the selected text and the selection range of the current application text has changed. + * + * @param { string } text - the selected text. + * @param { number } start - start position of selected text. + * @param { number } end - end position of selected text. + * @returns { Promise } the promise returned by the function. + * @throws { BusinessError } 401 - parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. + * @throws { BusinessError } 12800003 - input method client error. + * @throws { BusinessError } 12800008 - input method manager service error. + * @throws { BusinessError } 12800009 - input method client is detached. + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 10 + */ + changeSelection(text: string, start: number, end: number): Promise; + /** + * Update InputAttribute information of input text. + * + * @param { InputAttribute } attribute - the InputAttribute object. + * @param { AsyncCallback } callback - the callback of updateAttribute. + * @throws { BusinessError } 401 - parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. + * @throws { BusinessError } 12800003 - input method client error. + * @throws { BusinessError } 12800008 - input method manager service error. + * @throws { BusinessError } 12800009 - input method client is detached. + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 10 + */ + updateAttribute(attribute: InputAttribute, callback: AsyncCallback): void; + /** + * Update InputAttribute information of input text. + * + * @param { InputAttribute } attribute - the InputAttribute object. + * @returns { Promise } the promise returned by the function. + * @throws { BusinessError } 401 - parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. + * @throws { BusinessError } 12800003 - input method client error. + * @throws { BusinessError } 12800008 - input method manager service error. + * @throws { BusinessError } 12800009 - input method client is detached. + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 10 + */ + updateAttribute(attribute: InputAttribute): Promise; + /** + * Stop input session + * + * @param { AsyncCallback } callback - the callback of stopInputSession. + * @throws { BusinessError } 12800003 - input method client error. + * @throws { BusinessError } 12800008 - input method manager service error. + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 9 + */ + stopInputSession(callback: AsyncCallback): void; + /** + * Stop input session + * + * @returns { Promise } the promise returned by the function. + * @throws { BusinessError } 12800003 - input method client error. + * @throws { BusinessError } 12800008 - input method manager service error. + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 9 + */ + stopInputSession(): Promise; + /** + * Stop input + * + * @param { AsyncCallback } callback - the callback of stopInput. + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 6 + * @deprecated since 9 + * @useinstead inputMethod.InputMethodController#stopInputSession + */ + stopInput(callback: AsyncCallback): void; + /** + * Stop input + * + * @returns { Promise } the promise returned by the function. + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 6 + * @deprecated since 9 + * @useinstead inputMethod.InputMethodController#stopInputSession + */ + stopInput(): Promise; + /** + * Show soft keyboard + * + * @permission ohos.permission.CONNECT_IME_ABILITY + * @param { AsyncCallback } callback - the callback of showSoftKeyboard. + * @throws { BusinessError } 201 - permissions check fails. + * @throws { BusinessError } 12800003 - input method client error. + * @throws { BusinessError } 12800008 - input method manager service error. + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 9 + */ + showSoftKeyboard(callback: AsyncCallback): void; + /** + * Show soft keyboard + * + * @permission ohos.permission.CONNECT_IME_ABILITY + * @returns { Promise } the promise returned by the function. + * @throws { BusinessError } 201 - permissions check fails. + * @throws { BusinessError } 12800003 - input method client error. + * @throws { BusinessError } 12800008 - input method manager service error. + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 9 + */ + showSoftKeyboard(): Promise; + /** + * Hide soft keyboard + * + * @permission ohos.permission.CONNECT_IME_ABILITY + * @param { AsyncCallback } callback - the callback of hideSoftKeyboard. + * @throws { BusinessError } 201 - permissions check fails. + * @throws { BusinessError } 12800003 - input method client error. + * @throws { BusinessError } 12800008 - input method manager service error. + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 9 + */ + hideSoftKeyboard(callback: AsyncCallback): void; + /** + * Hide soft keyboard + * + * @permission ohos.permission.CONNECT_IME_ABILITY + * @returns { Promise } the promise returned by the function. + * @throws { BusinessError } 201 - permissions check fails. + * @throws { BusinessError } 12800003 - input method client error. + * @throws { BusinessError } 12800008 - input method manager service error. + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 9 + */ + hideSoftKeyboard(): Promise; + /** + * Register a callback and when IME sends select event with range of selection, + * the callback will be invoked. + * + * @param { 'selectByRange' } type - event type, fixed as 'selectByRange'. + * @param { Callback } callback - processes selectByRange command. The range of selection is provided for + * this callback, and subscribers are expected to select corresponding text in callback according to + * the range. + * @throws { BusinessError } 401 - parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 10 + */ + on(type: 'selectByRange', callback: Callback): void; + /** + * Unregister the callback of selectedByRange. + * + * @param { 'selectByRange' } type - event type, fixed as 'selectByRange'. + * @param { Callback } [callback] - the callback of 'selectByRange', + * when subscriber unsubscribes all callback functions of event 'selectByRange', this parameter can be left blank. + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 10 + */ + off(type: 'selectByRange', callback?: Callback): void; + /** + * Register a callback and when IME sends select event witch movement of cursor, + * the callback will be invoked. + * + * @param { 'selectByMovement' } type - event type, fixed as 'selectByMovement'. + * @param { Callback } callback - processes selectByMovement command. The movement of cursor is provided + * for this callback, and subscribers are expected to select corresponding text in callback according to + * the movement. + * @throws { BusinessError } 401 - parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 10 + */ + on(type: 'selectByMovement', callback: Callback): void; + /** + * Unregister the callback of selectedByMovement. + * + * @param { 'selectByMovement' } type - event type, fixed as 'selectByMovement'. + * @param { Callback } [callback] - the callback of 'selectByMovement', + * when subscriber unsubscribes all callback functions of event 'selectByMovement', this parameter can be left blank. + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 10 + */ + off(type: 'selectByMovement', callback?: Callback): void; + /** + * Register a callback and when IME sends insert text event, the callback will be invoked. + * + * @param { 'insertText' } type - event type, fixed as 'insertText'. + * @param { function } callback - processes insertText command. The text of insert is provided for this callback. + * Subscribers are expected to process the inserted text and update changes in editor by changeSelection and updateCursor as needed. + * @throws { BusinessError } 401 - parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. + * @throws { BusinessError } 12800009 - input method client is detached. + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 10 + */ + on(type: 'insertText', callback: (text: string) => void): void; + /** + * Unregister the callback of insertText. + * + * @param { 'insertText' } type - event type, fixed as 'insertText'. + * @param { function } [callback] - the callback of 'insertText', + * when subscriber unsubscribes all callback functions of event 'insertText', this parameter can be left blank. + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 10 + */ + off(type: 'insertText', callback?: (text: string) => void): void; + /** + * Register a callback and when IME sends delete left event with length, + * the callback will be invoked. + * + * @param { 'deleteLeft' } type - event type, fixed as 'deleteLeft'. + * @param { function } callback - processes deleteLeft command. The length of + * delete is provided for this callback. Subscribers are expected to delete specified length of text + * to the left of the cursor and update changes in editor by changeSelection and updateCursor as needed. + * @throws { BusinessError } 401 - parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. + * @throws { BusinessError } 12800009 - input method client is detached. + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 10 + */ + on(type: 'deleteLeft', callback: (length: number) => void): void; + /** + * Unregister the callback of deleteLeft. + * + * @param { 'deleteLeft' } type - event type, fixed as 'deleteLeft'. + * @param { function } [callback] - the callback of 'deleteLeft', + * when subscriber unsubscribes all callback functions of event 'deleteLeft', this parameter can be left blank. + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 10 + */ + off(type: 'deleteLeft', callback?: (length: number) => void): void; + /** + * Register a callback and when IME sends delete right event with length, + * the callback will be invoked. + * + * @param { 'deleteRight' } type - event type, fixed as 'deleteRight'. + * @param { function } callback - processes deleteRight command. The length of + * delete is provided for this callback. Subscribers are expected to delete specified length of text + * to the right of the cursor and update changes in editor by changeSelection and updateCursor as needed. + * @throws { BusinessError } 401 - parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. + * @throws { BusinessError } 12800009 - input method client is detached. + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 10 + */ + on(type: 'deleteRight', callback: (length: number) => void): void; + /** + * Unregister the callback of deleteRight. + * + * @param { 'deleteRight' } type - event type, fixed as 'deleteRight'. + * @param { function } [callback] - the callback of 'deleteRight', + * when subscriber unsubscribes all callback functions of event 'deleteRight', this parameter can be left blank. + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 10 + */ + off(type: 'deleteRight', callback?: (length: number) => void): void; + /** + * Register a callback and when IME sends keyboard status, the callback will be invoked. + * + * @param { 'sendKeyboardStatus' } type - event type, fixed as 'sendKeyboardStatus'. + * @param { function } callback - processes sendKeyboardStatus command. + * The keyboardStatus is provided for this callback. + * @throws { BusinessError } 401 - parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. + * @throws { BusinessError } 12800009 - input method client is detached. + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 10 + */ + on(type: 'sendKeyboardStatus', callback: (keyboardStatus: KeyboardStatus) => void): void; + /** + * Unregister the callback of sendKeyboardStatus. + * + * @param { 'sendKeyboardStatus' } type - event type, fixed as 'sendKeyboardStatus'. + * @param { function } [callback] - the callback of 'sendKeyboardStatus', + * when subscriber unsubscribes all callback functions of event 'sendKeyboardStatus', this parameter can be left blank. + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 10 + */ + off(type: 'sendKeyboardStatus', callback?: (keyboardStatus: KeyboardStatus) => void): void; + /** + * Register a callback and when IME sends functionKey, the callback will be invoked. + * + * @param { 'sendFunctionKey' } type - event type, fixed as 'sendFunctionKey'. + * @param { function } callback - processes sendFunctionKey command. + * The functionKey is provided for this callback.Subscribers are expected to complete the + * corresponding task based on the value of functionKey. + * @throws { BusinessError } 401 - parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. + * @throws { BusinessError } 12800009 - input method client is detached. + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 10 + */ + on(type: 'sendFunctionKey', callback: (functionKey: FunctionKey) => void): void; + /** + * Unregister the callback of sendFunctionKey. + * + * @param { 'sendFunctionKey' } type - event type, fixed as 'sendFunctionKey'. + * @param { function } [callback] - the callback of 'sendFunctionKey', + * when subscriber unsubscribes all callback functions of event 'sendFunctionKey', this parameter can be left blank. + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 10 + */ + off(type: 'sendFunctionKey', callback?: (functionKey: FunctionKey) => void): void; + /** + * Register a callback and when IME sends move cursor, the callback will be invoked. + * + * @param { 'moveCursor' } type - event type, fixed as 'moveCursor'. + * @param { function } callback - processes moveCursor command. The direction of + * cursor is provided for this callback. Subscribers are expected to move the cursor and update changes + * in editor by changeSelection and updateCursor. + * @throws { BusinessError } 401 - parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. + * @throws { BusinessError } 12800009 - input method client is detached. + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 10 + */ + on(type: 'moveCursor', callback: (direction: Direction) => void): void; + /** + * Unregister the callback of moveCursor. + * + * @param { 'moveCursor' } type - event type, fixed as 'moveCursor'. + * @param { function } [callback] - the callback of 'moveCursor', + * when subscriber unsubscribes all callback functions of event 'moveCursor', this parameter can be left blank. + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 10 + */ + off(type: 'moveCursor', callback?: (direction: Direction) => void): void; + /** + * Register a callback and when IME sends extend action code, the callback will be invoked. + * + * @param { 'handleExtendAction' } type - event type, fixed as 'handleExtendAction'. + * @param { function } callback - processes handleExtendAction command. The action code + * is provided for this callback. + * @throws { BusinessError } 401 - parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. + * @throws { BusinessError } 12800009 - input method client is detached. + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 10 + */ + on(type: 'handleExtendAction', callback: (action: ExtendAction) => void): void; + /** + * Unregister the callback of handleExtendAction. + * + * @param { 'handleExtendAction' } type - event type, fixed as 'handleExtendAction'. + * @param { function } [callback] - the callback of 'handleExtendAction', + * when subscriber unsubscribes all callback functions of event 'handleExtendAction', this parameter can be left blank. + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 10 + */ + off(type: 'handleExtendAction', callback?: (action: ExtendAction) => void): void; + /** + * Register a callback and when input method ability gets left text of cursor, the callback will be invoked. + * + * @param { 'getLeftTextOfCursor' } type - event type, fixed as 'getLeftTextOfCursor'. + * @param { function } callback - processes getLeftTextOfCursor command. The callback + * must be a synchronization method and will block the input method application. + * @throws { BusinessError } 401 - parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. + * @throws { BusinessError } 12800009 - input method client is detached. + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 10 + */ + on(type: 'getLeftTextOfCursor', callback: (length: number) => string): void; + /** + * Unregister the callback of getLeftTextOfCursor event. + * + * @param { 'getLeftTextOfCursor' } type - event type, fixed as 'getLeftTextOfCursor'. + * @param { function } [callback] - the callback of 'getLeftTextOfCursor', + * when subscriber unsubscribes all callback functions of event 'getLeftTextOfCursor', this parameter can be left blank. + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 10 + */ + off(type: 'getLeftTextOfCursor', callback?: (length: number) => string): void; + /** + * Register a callback and when input method ability gets right text of cursor, the callback will be invoked. + * + * @param { 'getRightTextOfCursor' } type - event type, fixed as 'getRightTextOfCursor'. + * @param { function } callback - processes getRightTextOfCursor command. The callback + * must be a synchronization method and will block the input method application. + * @throws { BusinessError } 401 - parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. + * @throws { BusinessError } 12800009 - input method client is detached. + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 10 + */ + on(type: 'getRightTextOfCursor', callback: (length: number) => string): void; + /** + * Unregister the callback of getRightTextOfCursor event. + * + * @param { 'getRightTextOfCursor' } type - event type, fixed as 'getRightTextOfCursor'. + * @param { function } [callback] - the callback of 'getRightTextOfCursor', + * when subscriber unsubscribes all callback functions of event 'getRightTextOfCursor', this parameter can be left blank. + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 10 + */ + off(type: 'getRightTextOfCursor', callback?: (length: number) => string): void; + /** + * Register a callback and when input method ability gets the text index at cursor, the callback will be invoked. + * + * @param { 'getTextIndexAtCursor' } type - event type, fixed as 'getTextIndexAtCursor'. + * @param { function } callback - processes getTextIndexAtCursor command. The callback + * must be a synchronization method, and should return the text index at the cursor. + * @throws { BusinessError } 401 - parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. + * @throws { BusinessError } 12800009 - input method client is detached. + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 10 + */ + on(type: 'getTextIndexAtCursor', callback: () => number): void; + /** + * Unregister the callback of getTextIndexAtCursor. + * + * @param { 'getTextIndexAtCursor' } type - event type, fixed as 'getTextIndexAtCursor'. + * @param { function } [callback] - the callback of 'getTextIndexAtCursor', + * when subscriber unsubscribes all callback functions of event 'getTextIndexAtCursor', this parameter can be left blank. + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 10 + */ + off(type: 'getTextIndexAtCursor', callback?: () => number): void; + } + /** + * input method property + * + * @interface InputMethodProperty + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 8 + */ + interface InputMethodProperty { + /** + * The name of input method + * + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 8 + * @deprecated since 9 + * @useinstead inputMethod.InputMethodProperty#name + */ + readonly packageName: string; + /** + * The id of input method + * + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 8 + * @deprecated since 9 + * @useinstead inputMethod.InputMethodProperty#id + */ + readonly methodId: string; + /** + * The name of input method + * + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 9 + */ + readonly name: string; + /** + * The id of input method + * + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 9 + */ + readonly id: string; + /** + * The label of input method + * + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 9 + */ + readonly label?: string; + /** + * The label id of input method + * + * @type { ?number } + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 10 + */ + readonly labelId?: number; + /** + * The icon of input method + * + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 9 + */ + readonly icon?: string; + /** + * The icon id of input method + * + * @type { ?number } + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 9 + */ + readonly iconId?: number; + /** + * The extra info of input method + * + * @type { object } + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 9 + */ + /** + * The extra info of input method + * + * @type { ?object } + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 10 + */ + extra?: object; + } + /** + * Enumerates the moving direction of cursor + * + * @enum { number } + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 10 + */ + export enum Direction { + /** + * Cursor moves up + * + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 10 + */ + CURSOR_UP = 1, + /** + * Cursor moves down + * + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 10 + */ + CURSOR_DOWN, + /** + * Cursor moves left + * + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 10 + */ + CURSOR_LEFT, + /** + * Cursor moves right + * + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 10 + */ + CURSOR_RIGHT + } + /** + * Range of selected text. + * + * @typedef Range + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 10 + */ + export interface Range { + /** + * Indicates the index of the first character of the selected text. + * + * @type { number } + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 10 + */ + start: number; + /** + * Indicates the index of the last character of the selected text. + * + * @type { number } + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 10 + */ + end: number; + } + /** + * Movement of cursor. + * + * @typedef Movement + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 10 + */ + export interface Movement { + /** + * Indicates the direction of cursor movement + * + * @type { Direction } + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 10 + */ + direction: Direction; + } + /** + * Enumerates the text input type. + * + * @enum { number } + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 10 + */ + export enum TextInputType { + /** + * The text input type is NONE. + * + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 10 + */ + NONE = -1, + /** + * The text input type is TEXT. + * + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 10 + */ + TEXT = 0, + /** + * The text input type is MULTILINE. + * + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 10 + */ + MULTILINE, + /** + * The text input type is NUMBER. + * + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 10 + */ + NUMBER, + /** + * The text input type is PHONE. + * + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 10 + */ + PHONE, + /** + * The text input type is DATETIME. + * + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 10 + */ + DATETIME, + /** + * The text input type is EMAIL_ADDRESS. + * + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 10 + */ + EMAIL_ADDRESS, + /** + * The text input type is URL. + * + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 10 + */ + URL, + /** + * The text input type is VISIBLE_PASSWORD. + * + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 10 + */ + VISIBLE_PASSWORD, + /** + * The text input type is NUMBER_PASSWORD. + * + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 11 + */ + NUMBER_PASSWORD + } + /** + * Enumerates the enter key type. + * + * @enum { number } + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 10 + */ + export enum EnterKeyType { + /** + * The enter key type is UNSPECIFIED. + * + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 10 + */ + UNSPECIFIED = 0, + /** + * The enter key type is NONE. + * + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 10 + */ + NONE, + /** + * The enter key type is GO. + * + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 10 + */ + GO, + /** + * The enter key type is SEARCH. + * + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 10 + */ + SEARCH, + /** + * The enter key type is SEND. + * + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 10 + */ + SEND, + /** + * The enter key type is NEXT. + * + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 10 + */ + NEXT, + /** + * The enter key type is DONE. + * + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 10 + */ + DONE, + /** + * The enter key type is PREVIOUS. + * + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 10 + */ + PREVIOUS + } + /** + * Enumerates the keyboard status. + * + * @enum { number } + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 10 + */ + export enum KeyboardStatus { + /** + * The keyboard status is none. + * + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 10 + */ + NONE = 0, + /** + * The keyboard status is hide. + * + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 10 + */ + HIDE = 1, + /** + * The keyboard status is show. + * + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 10 + */ + SHOW = 2 + } + /** + * Attribute of Input. + * + * @typedef InputAttribute + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 10 + */ + export interface InputAttribute { + /** + * Indicates the text input type of the input method. + * + * @type { TextInputType } + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 10 + */ + textInputType: TextInputType; + /** + * Indicates the enter key type of the input method. + * + * @type { EnterKeyType } + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 10 + */ + enterKeyType: EnterKeyType; + } + /** + * FunctionKey of Input. + * + * @typedef FunctionKey + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 10 + */ + export interface FunctionKey { + /** + * Indicates the enter key type of the input method. + * + * @type { EnterKeyType } + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 10 + */ + enterKeyType: EnterKeyType; + } + /** + * Information of Cursor. + * + * @typedef CursorInfo + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 10 + */ + export interface CursorInfo { + /** + * Indicates the left point of the cursor info and must be absolute coordinate of the physical screen. + * + * @type { number } + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 10 + */ + left: number; + /** + * Indicates the top point of the cursor info and must be absolute coordinate of the physical screen. + * + * @type { number } + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 10 + */ + top: number; + /** + * Indicates the width point of the cursor info. + * + * @type { number } + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 10 + */ + width: number; + /** + * Indicates the height point of the cursor info. + * + * @type { number } + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 10 + */ + height: number; + } + /** + * Config of editor. + * + * @typedef TextConfig + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 10 + */ + export interface TextConfig { + /** + * Attribute of Input. + * + * @type { InputAttribute } + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 10 + */ + inputAttribute: InputAttribute; + /** + * Cursor information. + * + * @type { ?CursorInfo } + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 10 + */ + cursorInfo?: CursorInfo; + /** + * Selection information. + * + * @type { ?Range } + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 10 + */ + selection?: Range; + /** + * The window ID of the application currently bound to the input method. + * + * @type { ?number } + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 10 + */ + windowId?: number; + } + /** + * Enumerates the extend action. + * + * @enum { number } + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 10 + */ + export enum ExtendAction { + /** + * Select all text. + * + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 10 + */ + SELECT_ALL = 0, + /** + * Cut selecting text. + * + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 10 + */ + CUT = 3, + /** + * Copy selecting text. + * + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 10 + */ + COPY = 4, + /** + * Paste from paste board. + * + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 10 + */ + PASTE = 5 + } + /** + * Information of input window. + * + * @typedef InputWindowInfo + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 10 + */ + export interface InputWindowInfo { + /** + * Indicates name of the input window. + * + * @type { string } + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 10 + */ + name: string; + /** + * Indicates the abscissa of the upper-left vertex of input window. + * + * @type { number } + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 10 + */ + left: number; + /** + * Indicates the ordinate of the upper-left vertex of input window. + * + * @type { number } + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 10 + */ + top: number; + /** + * Indicates the width of the input window. + * + * @type { number } + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 10 + */ + width: number; + /** + * Indicates the height of the input window. + * + * @type { number } + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 10 + */ + height: number; + } +} +export default inputMethod; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.inputMethodEngine.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.inputMethodEngine.d.ts new file mode 100755 index 00000000..75062976 --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.inputMethodEngine.d.ts @@ -0,0 +1,1936 @@ +/* + * Copyright (c) 2021-2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit IMEKit + */ + +/// +import type { AsyncCallback, Callback } from './@ohos.base'; +import type { KeyEvent as InputKeyEvent } from './@ohos.multimodalInput.keyEvent'; +import InputMethodSubtype from './@ohos.InputMethodSubtype'; +import type { LocalStorage } from 'StateManagement'; +import BaseContext from './application/BaseContext'; +import window from './@ohos.window'; +/** + * Input method engine + * + * @namespace inputMethodEngine + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 8 + */ +declare namespace inputMethodEngine { + /** + * When "enter" key is pressed, there is no action + * + * @constant + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 8 + */ + const ENTER_KEY_TYPE_UNSPECIFIED: number; + /** + * When "enter" key is pressed, it means GO + * + * @constant + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 8 + */ + const ENTER_KEY_TYPE_GO: number; + /** + * When "enter" key is pressed, it means SEARCH + * + * @constant + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 8 + */ + const ENTER_KEY_TYPE_SEARCH: number; + /** + * When "enter" key is pressed, it means SEND + * + * @constant + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 8 + */ + const ENTER_KEY_TYPE_SEND: number; + /** + * When "enter" key is pressed, it means NEXT + * + * @constant + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 8 + */ + const ENTER_KEY_TYPE_NEXT: number; + /** + * When "enter" key is pressed, it means DONE + * + * @constant + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 8 + */ + const ENTER_KEY_TYPE_DONE: number; + /** + * When "enter" key is pressed, it means PREVIOUS + * + * @constant + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 8 + */ + const ENTER_KEY_TYPE_PREVIOUS: number; + /** + * Editor with no special function + * + * @constant + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 8 + */ + const PATTERN_NULL: number; + /** + * Editor of type TEXT + * + * @constant + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 8 + */ + const PATTERN_TEXT: number; + /** + * Editor of type NUMBER + * + * @constant + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 8 + */ + const PATTERN_NUMBER: number; + /** + * Editor of type PHONE NUMBER + * + * @constant + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 8 + */ + const PATTERN_PHONE: number; + /** + * Editor of type DATETIME + * + * @constant + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 8 + */ + const PATTERN_DATETIME: number; + /** + * Editor of type EMAIL + * + * @constant + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 8 + */ + const PATTERN_EMAIL: number; + /** + * Editor of type URI + * + * @constant + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 8 + */ + const PATTERN_URI: number; + /** + * Editor of type PASSWORD + * + * @constant + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 8 + */ + const PATTERN_PASSWORD: number; + /** + * Editor of type SCREEN LOCK PASSWORD + * + * @constant + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 11 + */ + const PATTERN_PASSWORD_SCREEN_LOCK: number; + /** + * Editor of type NUMBER PASSWORD + * + * @constant + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 11 + */ + const PATTERN_PASSWORD_NUMBER: number; + /** + * Editor in SELECTING state + * + * @constant + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 8 + */ + const FLAG_SELECTING: number; + /** + * Editor in SINGLE_LINE state + * + * @constant + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 8 + */ + const FLAG_SINGLE_LINE: number; + /** + * The Editor displays in PART mode + * + * @constant + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 8 + */ + const DISPLAY_MODE_PART: number; + /** + * The Editor displays in FULL mode + * + * @constant + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 8 + */ + const DISPLAY_MODE_FULL: number; + /** + * Allows ASCII to be inputted + * + * @constant + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 8 + */ + const OPTION_ASCII: number; + /** + * Do not specify Editor's input type + * + * @constant + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 8 + */ + const OPTION_NONE: number; + /** + * Allows CHARACTERS to be inputted + * + * @constant + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 8 + */ + const OPTION_AUTO_CAP_CHARACTERS: number; + /** + * Allows SENTENCES to be inputted + * + * @constant + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 8 + */ + const OPTION_AUTO_CAP_SENTENCES: number; + /** + * Allows WORDS to be inputted + * + * @constant + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 8 + */ + const OPTION_AUTO_WORDS: number; + /** + * Allows MULTI_LINE to be inputted + * + * @constant + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 8 + */ + const OPTION_MULTI_LINE: number; + /** + * Half-screen mode + * + * @constant + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 8 + */ + const OPTION_NO_FULLSCREEN: number; + /** + * The move direction of cursor: UP + * + * @constant + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 9 + */ + const CURSOR_UP: number; + /** + * The move direction of cursor: DOWN + * + * @constant + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 9 + */ + const CURSOR_DOWN: number; + /** + * The move direction of cursor: LEFT + * + * @constant + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 9 + */ + const CURSOR_LEFT: number; + /** + * The move direction of cursor: RIGHT + * + * @constant + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 9 + */ + const CURSOR_RIGHT: number; + /** + * The window styles for input method ability. + * + * @constant + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 9 + */ + const WINDOW_TYPE_INPUT_METHOD_FLOAT: number; + /** + * Get InputMethodAbility object to subscribe events about IME. + * + * @returns { InputMethodAbility } the object of the InputMethodAbility. + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 9 + */ + function getInputMethodAbility(): InputMethodAbility; + /** + * @returns { InputMethodEngine } + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 8 + * @deprecated since 9 + * @useinstead inputMethodEngine#getInputMethodAbility + */ + function getInputMethodEngine(): InputMethodEngine; + /** + * Get KeyboardDelegate object to subscribe key event or events about editor. + * + * @returns { KeyboardDelegate } the object of KeyboardDelegate. + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 9 + */ + function getKeyboardDelegate(): KeyboardDelegate; + /** + * @returns { KeyboardDelegate } + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 8 + * @deprecated since 9 + * @useinstead inputMethodEngine#getKeyboardDelegate + */ + function createKeyboardDelegate(): KeyboardDelegate; + /** + * Indicates the possible data types of the command. + * @typedef { number | string | boolean } + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 12 + */ + type CommandDataType = number | string | boolean; + /** + * @interface KeyboardController + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 8 + */ + interface KeyboardController { + /** + * Hide soft keyboard + * + * @param { AsyncCallback } callback - indicates the callback function of hide. + * @throws { BusinessError } 12800003 - input method client error. + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 9 + */ + hide(callback: AsyncCallback): void; + /** + * Hide soft keyboard + * + * @returns { Promise } the promise returned by the function + * @throws { BusinessError } 12800003 - input method client error. + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 9 + */ + hide(): Promise; + /** + * @param { AsyncCallback } callback - indicates the callback function of hideKeyboard. + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 8 + * @deprecated since 9 + * @useinstead inputMethodEngine.KeyboardController#hide + */ + hideKeyboard(callback: AsyncCallback): void; + /** + * @returns { Promise } the promise returned by the function + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 8 + * @deprecated since 9 + * @useinstead inputMethodEngine.KeyboardController#hide + */ + hideKeyboard(): Promise; + /** + * Exit the current input type. This function can only be called by default input method configured by system. + * + * @param { AsyncCallback } callback - the callback of exitCurrentInputType. + * @throws { BusinessError } 12800008 - input method manager service error. + * @throws { BusinessError } 12800010 - not default input method configured by system. + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 11 + */ + exitCurrentInputType(callback: AsyncCallback): void; + /** + * Exit the current input type. This function can only be called by default input method configured by system. + * + * @returns { Promise } the promise returned by the function. + * @throws { BusinessError } 12800008 - input method manager service error. + * @throws { BusinessError } 12800010 - not default input method configured by system. + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 11 + */ + exitCurrentInputType(): Promise; + } + /** + * @interface InputMethodEngine + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 8 + */ + interface InputMethodEngine { + /** + * Subscribe 'inputStart' + * + * @param { 'inputStart' } type - indicates the type of subscribe event. + * @param { function } callback - indicates the callback of on('inputStart'). + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 8 + */ + on(type: 'inputStart', callback: (kbController: KeyboardController, textInputClient: TextInputClient) => void): void; + /** + * Unsubscribe 'inputStart' + * + * @param { 'inputStart' } type - indicates the type of subscribe event. + * @param { function } callback - optional, indicates the callback of off('inputStart'). + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 8 + */ + off(type: 'inputStart', callback?: (kbController: KeyboardController, textInputClient: TextInputClient) => void): void; + /** + * Subscribe 'keyboardShow'|'keyboardHide' + * + * @param { 'keyboardShow' | 'keyboardHide' } type - indicates the type of subscribe event. + * @param { function } callback - indicates the callback of on('keyboardShow'|'keyboardHide'). + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 8 + */ + on(type: 'keyboardShow' | 'keyboardHide', callback: () => void): void; + /** + * Unsubscribe 'keyboardShow'|'keyboardHide' + * + * @param { 'keyboardShow' | 'keyboardHide' } type - indicates the type of subscribe event. + * @param { function } [callback] - optional, indicates the callback of off('keyboardShow'|'keyboardHide'). + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 8 + */ + off(type: 'keyboardShow' | 'keyboardHide', callback?: () => void): void; + } + /** + *

Control events about IME.

+ *

Events provided for IME to subscribe with callback function. When those events occur, the corresponding callback + * will be invoked.

+ * + * @interface InputMethodAbility + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 9 + */ + interface InputMethodAbility { + /** + * Subscribe 'inputStart' event. + * + * @param { 'inputStart' } type - the type of subscribe event. + * @param { function } callback - the callback of on('inputStart'). + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 9 + */ + on(type: 'inputStart', callback: (kbController: KeyboardController, inputClient: InputClient) => void): void; + /** + * Unsubscribe 'inputStart' event. + * + * @param { 'inputStart' } type - the type of unsubscribe event. + * @param { function } [callback] - optional, the callback of off('inputStart'). + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 9 + */ + off(type: 'inputStart', callback?: (kbController: KeyboardController, inputClient: InputClient) => void): void; + /** + * Subscribe 'inputStop'. + * + * @param { 'inputStop' } type - the type of subscribe event. + * @param { function } callback - the callback of on('inputStop'). + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 9 + */ + on(type: 'inputStop', callback: () => void): void; + /** + * Unsubscribe 'inputStop'. + * + * @param { 'inputStop' } type - the type of unsubscribe event. + * @param { function } callback - the callback of off('inputStop'). + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 9 + */ + off(type: 'inputStop', callback: () => void): void; + /** + * Subscribe 'setCallingWindow'. + * + * @param { 'setCallingWindow' } type - the type of subscribe event. + * @param { function } callback - the callback of on('setCallingWindow'). + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 9 + */ + on(type: 'setCallingWindow', callback: (wid: number) => void): void; + /** + * Unsubscribe 'setCallingWindow'. + * + * @param { 'setCallingWindow' } type - the type of unsubscribe event. + * @param { function } callback - the callback of off('setCallingWindow'). + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 9 + */ + off(type: 'setCallingWindow', callback: (wid: number) => void): void; + /** + * Subscribe 'keyboardShow'|'keyboardHide'. + * + * @param { 'keyboardShow' | 'keyboardHide' } type - the type of subscribe event. + * @param { function } callback - the callback of on('keyboardShow'|'keyboardHide'). + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 9 + */ + on(type: 'keyboardShow' | 'keyboardHide', callback: () => void): void; + /** + * Unsubscribe 'keyboardShow'|'keyboardHide'. + * + * @param { 'keyboardShow' | 'keyboardHide' } type - the type of unsubscribe event. + * @param { function } [callback] - the callback of off('keyboardShow'|'keyboardHide'). + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 9 + */ + off(type: 'keyboardShow' | 'keyboardHide', callback?: () => void): void; + /** + * Subscribe 'setSubtype'. + * + * @param { 'setSubtype' } type - the type of subscribe event. + * @param { function } callback - the callback of on('setSubtype'). + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 9 + */ + on(type: 'setSubtype', callback: (inputMethodSubtype: InputMethodSubtype) => void): void; + /** + * Unsubscribe 'setSubtype'. + * + * @param { 'setSubtype' } type - the type of subscribe event. + * @param { function } [callback] - the callback of off('setSubtype'). + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 9 + */ + off(type: 'setSubtype', callback?: (inputMethodSubtype: InputMethodSubtype) => void): void; + /** + * Subscribe 'securityModeChange' event. + * + * @param { 'securityModeChange' } type - the type of subscribe event. + * @param { Callback } callback - the callback of on('securityModeChange'). + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 11 + */ + on(type: 'securityModeChange', callback: Callback): void; + /** + * Unsubscribe 'securityModeChange' event. + * + * @param { 'securityModeChange' } type - the type of unsubscribe event. + * @param { Callback } [callback] - optional, the callback of off('securityModeChange'). + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 11 + */ + off(type: 'securityModeChange', callback?: Callback): void; + /** + * Subscribe 'privateCommand'.This function can only be called by default input method configured by system. + * + * @param { 'privateCommand' } type - indicates the type of subscribe event. + * @param { Callback> } callback - indicates the callback of on('privateCommand'). + * @throws { BusinessError } 12800010 - not default input method configured by system. + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 12 + */ + on(type: 'privateCommand', callback: Callback>): void; + /** + * Unsubscribe 'privateCommand'.This function can only be called by default input method configured by system. + * + * @param { 'privateCommand' } type - indicates the type of subscribe event. + * @param { Callback> } [callback] - optional, + * indicates the callback of off('privateCommand'). + * @throws { BusinessError } 12800010 - not default input method configured by system. + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 12 + */ + off(type: 'privateCommand', callback?: Callback>): void; + /** + * Get input method's security mode. + * + * @returns { SecurityMode } return security mode. + * @throws { BusinessError } 12800004 - not an input method extension. + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 11 + */ + getSecurityMode(): SecurityMode; + /** + * Creates a panel. + *

The system only allows one soft keyboard and one status bar to be created.

+ * + * @param { BaseContext } ctx - indicates the context on which the window depends. + * @param { PanelInfo } info - the info of panel to be created. + * @param { AsyncCallback } callback - the callback of createPanel. + * @throws { BusinessError } 401 - parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; + * @throws { BusinessError } 12800004 - not an input method extension. + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 10 + */ + createPanel(ctx: BaseContext, info: PanelInfo, callback: AsyncCallback): void; + /** + * Creates a panel. + *

The system only allows one soft keyboard and one status bar to be created.

+ * + * @param { BaseContext } ctx - indicates the context on which the window depends. + * @param { PanelInfo } info - the info of panel to be created. + * @returns { Promise } the promise returned by the function. + * @throws { BusinessError } 401 - parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; + * @throws { BusinessError } 12800004 - not an input method extension. + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 10 + */ + createPanel(ctx: BaseContext, info: PanelInfo): Promise; + /** + * Destroys a panel. + * + * @param { Panel } panel - to be destroyed. + * @param { AsyncCallback } callback - the callback of destroyPanel. + * @throws { BusinessError } 401 - parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 10 + */ + destroyPanel(panel: Panel, callback: AsyncCallback): void; + /** + * Destroys a panel. + * + * @param { Panel } panel - to be destroyed. + * @returns { Promise } the promise returned by the function. + * @throws { BusinessError } 401 - parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 10 + */ + destroyPanel(panel: Panel): Promise; + } + /** + * @interface TextInputClient + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 8 + * @deprecated since 9 + * @useinstead inputMethodEngine#InputClient + */ + interface TextInputClient { + /** + * @param { number } action - action indicates the function of "enter" key. + * @param { AsyncCallback } callback - the callback of sendKeyFunction. + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 8 + * @deprecated since 9 + * @useinstead inputMethodEngine.InputClient#sendKeyFunction + */ + sendKeyFunction(action: number, callback: AsyncCallback): void; + /** + * @param { number } action - action indicates the function of "enter" key. + * @returns { Promise } the promise returned by the function. + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 8 + * @deprecated since 9 + * @useinstead inputMethodEngine.InputClient#sendKeyFunction + */ + sendKeyFunction(action: number): Promise; + /** + * @param { number } length - length of text which will be deleted forward. + * @param { AsyncCallback } callback - the callback of deleteForward. + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 8 + * @deprecated since 9 + * @useinstead inputMethodEngine.InputClient#deleteForward + */ + deleteForward(length: number, callback: AsyncCallback): void; + /** + * @param { number } length - length of text which will be deleted forward. + * @returns { Promise } the promise returned by the function. + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 8 + * @deprecated since 9 + * @useinstead inputMethodEngine.InputClient#deleteForward + */ + deleteForward(length: number): Promise; + /** + * @param { number } length - length of text which will be deleted backward. + * @param { AsyncCallback } callback - the callback of deleteBackward. + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 8 + * @deprecated since 9 + * @useinstead inputMethodEngine.InputClient#deleteBackward + */ + deleteBackward(length: number, callback: AsyncCallback): void; + /** + * @param { number } length - length of text which will be deleted backward. + * @returns { Promise } the promise returned by the function. + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 8 + * @deprecated since 9 + * @useinstead inputMethodEngine.InputClient#deleteBackward + */ + deleteBackward(length: number): Promise; + /** + * @param { string } text - text which will be inserted. + * @param { AsyncCallback } callback - the callback of insertText. + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 8 + * @deprecated since 9 + * @useinstead inputMethodEngine.InputClient#insertText + */ + insertText(text: string, callback: AsyncCallback): void; + /** + * @param { string } text - text which will be inserted. + * @returns { Promise } the promise returned by the function + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 8 + * @deprecated since 9 + * @useinstead inputMethodEngine.InputClient#insertText + */ + insertText(text: string): Promise; + /** + * @param { number } length - the length of text which will be got. + * @param { AsyncCallback } callback - the callback of getForward. + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 8 + * @deprecated since 9 + * @useinstead inputMethodEngine.InputClient#getForward + */ + getForward(length: number, callback: AsyncCallback): void; + /** + * @param { number } length - the length of text which will be got. + * @returns { Promise } the promise returned by the function + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 8 + * @deprecated since 9 + * @useinstead inputMethodEngine.InputClient#getForward + */ + getForward(length: number): Promise; + /** + * @param { number } length - the length of text which will be got. + * @param { AsyncCallback } callback - the callback of getBackward. + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 8 + * @deprecated since 9 + * @useinstead inputMethodEngine.InputClient#getBackward + */ + getBackward(length: number, callback: AsyncCallback): void; + /** + * @param { number } length - the length of text which will be got. + * @returns { Promise } the promise returned by the function. + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 8 + * @deprecated since 9 + * @useinstead inputMethodEngine.InputClient#getBackward + */ + getBackward(length: number): Promise; + /** + * @param { AsyncCallback } callback - the callback of getEditorAttribute. + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 8 + * @deprecated since 9 + * @useinstead inputMethodEngine.InputClient#getEditorAttribute + */ + getEditorAttribute(callback: AsyncCallback): void; + /** + * @returns { Promise } the promise returned by the function. + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 8 + * @deprecated since 9 + * @useinstead inputMethodEngine.InputClient#getEditorAttribute + */ + getEditorAttribute(): Promise; + } + /** + * Control events about Editor. + * + * @interface InputClient + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 9 + */ + interface InputClient { + /** + * Send the function of the key. + * + * @param { number } action - action indicates the function of "enter" key. + * @param { AsyncCallback } callback - the callback of sendKeyFunction. + * @throws { BusinessError } 401 - parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. + * @throws { BusinessError } 12800003 - input method client error. + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 9 + */ + sendKeyFunction(action: number, callback: AsyncCallback): void; + /** + * Send the function of the key. + * + * @param { number } action - action indicates the function of "enter" key. + * @returns { Promise } the promise returned by the function. + * @throws { BusinessError } 401 - parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. + * @throws { BusinessError } 12800003 - input method client error. + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 9 + */ + sendKeyFunction(action: number): Promise; + /** + * Delete text forward. + * + * @param { number } length - length of text which will be deleted forward. It can't be less than 0. + * @param { AsyncCallback } callback - the callback of deleteForward. + * @throws { BusinessError } 401 - parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. + * @throws { BusinessError } 12800002 - Input method engine error. + * @throws { BusinessError } 12800003 - input method client error. + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 9 + */ + deleteForward(length: number, callback: AsyncCallback): void; + /** + * Delete text forward. + * + * @param { number } length - length of text which will be deleted forward. It can't be less than 0. + * @returns { Promise } the promise returned by the function. + * @throws { BusinessError } 401 - parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. + * @throws { BusinessError } 12800002 - Input method engine error. + * @throws { BusinessError } 12800003 - input method client error. + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 9 + */ + deleteForward(length: number): Promise; + /** + * Delete text forward. + * + * @param { number } length - length of text which will be deleted forward. It can't be less than 0. + * @throws { BusinessError } 401 - parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. + * @throws { BusinessError } 12800002 - input method engine error. + * @throws { BusinessError } 12800003 - input method client error. + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 10 + */ + deleteForwardSync(length: number): void; + /** + * Delete text backward. + * + * @param { number } length - length of text which will be deleted backward. It can't be less than 0. + * @param { AsyncCallback } callback - the callback of deleteBackward. + * @throws { BusinessError } 401 - parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. + * @throws { BusinessError } 12800002 - Input method engine error. + * @throws { BusinessError } 12800003 - input method client error. + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 9 + */ + deleteBackward(length: number, callback: AsyncCallback): void; + /** + * Delete text backward. + * + * @param { number } length - length of text which will be deleted backward. It can't be less than 0. + * @returns { Promise } the promise returned by the function. + * @throws { BusinessError } 401 - parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. + * @throws { BusinessError } 12800002 - Input method engine error. + * @throws { BusinessError } 12800003 - input method client error. + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 9 + */ + deleteBackward(length: number): Promise; + /** + * Delete text backward. + * + * @param { number } length - length of text which will be deleted backward. It can't be less than 0. + * @throws { BusinessError } 401 - parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. + * @throws { BusinessError } 12800002 - input method engine error. + * @throws { BusinessError } 12800003 - input method client error. + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 10 + */ + deleteBackwardSync(length: number): void; + /** + * Insert text into Editor. + * + * @param { string } text - text which will be inserted. + * @param { AsyncCallback } callback - the callback of insertText. + * @throws { BusinessError } 401 - parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. + * @throws { BusinessError } 12800002 - Input method engine error. + * @throws { BusinessError } 12800003 - input method client error. + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 9 + */ + insertText(text: string, callback: AsyncCallback): void; + /** + * Insert text into Editor. + * + * @param { string } text - text which will be inserted. + * @returns { Promise } the promise returned by the function. + * @throws { BusinessError } 401 - parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. + * @throws { BusinessError } 12800002 - Input method engine error. + * @throws { BusinessError } 12800003 - input method client error. + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 9 + */ + insertText(text: string): Promise; + /** + * Insert text into Editor. + * + * @param { string } text - text which will be inserted. + * @throws { BusinessError } 401 - parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. + * @throws { BusinessError } 12800002 - input method engine error. + * @throws { BusinessError } 12800003 - input method client error. + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 10 + */ + insertTextSync(text: string): void; + /** + * Get the text before cursor. + * + * @param { number } length - the length of text which will be got. It can't be less than 0. + * @param { AsyncCallback } callback - the callback of getForward. + * @throws { BusinessError } 401 - parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. + * @throws { BusinessError } 12800003 - input method client error. + * @throws { BusinessError } 12800006 - Input method controller error. + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 9 + */ + getForward(length: number, callback: AsyncCallback): void; + /** + * Get the text before cursor. + * + * @param { number } length - the length of text which will be got. It can't be less than 0. + * @returns { Promise } the promise returned by the function. + * @throws { BusinessError } 401 - parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. + * @throws { BusinessError } 12800003 - input method client error. + * @throws { BusinessError } 12800006 - Input method controller error. + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 9 + */ + getForward(length: number): Promise; + /** + * Get the text before cursor. + * + * @param { number } length - the length of text which will be got. It can't be less than 0. + * @returns { string } the text string before cursor. + * @throws { BusinessError } 401 - parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. + * @throws { BusinessError } 12800003 - input method client error. + * @throws { BusinessError } 12800006 - input method controller error. + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 10 + */ + getForwardSync(length: number): string; + /** + * Get the text after cursor. + * + * @param { number } length - the length of text which will be got.It can't be less than 0. + * @param { AsyncCallback } callback - the callback of getBackward. + * @throws { BusinessError } 401 - parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. + * @throws { BusinessError } 12800003 - input method client error. + * @throws { BusinessError } 12800006 - Input method controller error. + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 9 + */ + getBackward(length: number, callback: AsyncCallback): void; + /** + * Get the text after cursor. + * + * @param { number } length - the length of text which will be got.It can't be less than 0. + * @returns { Promise } the promise returned by the function. + * @throws { BusinessError } 401 - parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. + * @throws { BusinessError } 12800003 - input method client error. + * @throws { BusinessError } 12800006 - Input method controller error. + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 9 + */ + getBackward(length: number): Promise; + /** + * Get the text after cursor. + * + * @param { number } length - the length of text which will be got. It can't be less than 0. + * @returns { string } the text string after cursor. + * @throws { BusinessError } 401 - parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. + * @throws { BusinessError } 12800003 - input method client error. + * @throws { BusinessError } 12800006 - input method controller error. + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 10 + */ + getBackwardSync(length: number): string; + /** + * Get attribute about editor. + * + * @param { AsyncCallback } callback - the callback of getEditorAttribute. + * @throws { BusinessError } 12800003 - input method client error. + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 9 + */ + getEditorAttribute(callback: AsyncCallback): void; + /** + * Get attribute about editor. + * + * @returns { Promise } the promise returned by the function. + * @throws { BusinessError } 12800003 - input method client error. + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 9 + */ + getEditorAttribute(): Promise; + /** + * Get attribute about editor. + * + * @returns { EditorAttribute } the attribute of editor. + * @throws { BusinessError } 12800003 - input method client error. + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 10 + */ + getEditorAttributeSync(): EditorAttribute; + /** + * Move cursor from input method. + * + * @param { number } direction - Indicates the distance of cursor to be moved. It can't be less than 0. + * @param { AsyncCallback } callback - the callback of moveCursor. + * @throws { BusinessError } 401 - parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. + * @throws { BusinessError } 12800003 - input method client error. + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 9 + */ + moveCursor(direction: number, callback: AsyncCallback): void; + /** + * Move cursor from input method. + * + * @param { number } direction - Indicates the distance of cursor to be moved. It can't be less than 0. + * @returns { Promise } the promise returned by the function. + * @throws { BusinessError } 401 - parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. + * @throws { BusinessError } 12800003 - input method client error. + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 9 + */ + moveCursor(direction: number): Promise; + /** + * Move cursor from input method. + * + * @param { number } direction - Indicates the distance of cursor to be moved. It can't be less than 0. + * @throws { BusinessError } 401 - parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. + * @throws { BusinessError } 12800003 - input method client error. + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 10 + */ + moveCursorSync(direction: number): void; + /** + * Select text in editor by range. + * + * @param { Range } range - indicates the range of selected text in editor. + * @param { AsyncCallback } callback - the callback of selectByRange. + * @throws { BusinessError } 401 - parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. + * @throws { BusinessError } 12800003 - input method client error. + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 10 + */ + selectByRange(range: Range, callback: AsyncCallback): void; + /** + * Select text in editor by range. + * + * @param { Range } range - indicates the range of selected text in editor. + * @returns { Promise } the promise returned by the function. + * @throws { BusinessError } 401 - parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. + * @throws { BusinessError } 12800003 - input method client error. + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 10 + */ + selectByRange(range: Range): Promise; + /** + * Select text in editor by range. + * + * @param { Range } range - indicates the range of selected text in editor. + * @throws { BusinessError } 401 - parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. + * @throws { BusinessError } 12800003 - input method client error. + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 10 + */ + selectByRangeSync(range: Range): void; + /** + * Select text in editor by cursor movement. + * + * @param { Movement } movement - indicates the movement of cursor when selecting. + * @param { AsyncCallback } callback - the callback of selectByMovement. + * @throws { BusinessError } 401 - parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. + * @throws { BusinessError } 12800003 - input method client error. + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 10 + */ + selectByMovement(movement: Movement, callback: AsyncCallback): void; + /** + * Select text in editor by cursor movement. + * + * @param { Movement } movement - indicates the movement of cursor when selecting. + * @returns { Promise } the promise returned by the function. + * @throws { BusinessError } 401 - parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. + * @throws { BusinessError } 12800003 - input method client error. + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 10 + */ + selectByMovement(movement: Movement): Promise; + /** + * Select text in editor by cursor movement. + * + * @param { Movement } movement - indicates the movement of cursor when selecting. + * @throws { BusinessError } 401 - parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. + * @throws { BusinessError } 12800003 - input method client error. + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 10 + */ + selectByMovementSync(movement: Movement): void; + /** + * Get the index number of text at cursor. + * + * @param { AsyncCallback } callback - the callback of getTextIndexAtCursor, number represents the index + * number of text at cursor. + * @throws { BusinessError } 12800003 - input method client error. + * @throws { BusinessError } 12800006 - Input method controller error. + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 10 + */ + getTextIndexAtCursor(callback: AsyncCallback): void; + /** + * Get the index number of text at cursor. + * + * @returns { Promise } the promise returned by the function, number represents the index number of text + * at cursor. + * @throws { BusinessError } 12800003 - input method client error. + * @throws { BusinessError } 12800006 - Input method controller error. + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 10 + */ + getTextIndexAtCursor(): Promise; + /** + * Get the index number of text at cursor. + * + * @returns { number } the index number of text at cursor. + * @throws { BusinessError } 12800003 - input method client error. + * @throws { BusinessError } 12800006 - Input method controller error. + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 10 + */ + getTextIndexAtCursorSync(): number; + /** + * Send extend action code. + * + * @param { ExtendAction } action - action code which will be send. + * @param { AsyncCallback } callback - the callback of sendExtendAction. + * @throws { BusinessError } 401 - parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types + * @throws { BusinessError } 12800003 - input method client error. + * @throws { BusinessError } 12800006 - Input method controller error. + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 10 + */ + sendExtendAction(action: ExtendAction, callback: AsyncCallback): void; + /** + * Send extend action code. + * + * @param { ExtendAction } action - action code which will be send. + * @returns { Promise } the promise returned by the function. + * @throws { BusinessError } 401 - parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types + * @throws { BusinessError } 12800003 - input method client error. + * @throws { BusinessError } 12800006 - Input method controller error. + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 10 + */ + sendExtendAction(action: ExtendAction): Promise; + /** + * Send private command.This function can only be called by default input method configured by system. + * + * @param { Record } commandData - command data which will be send.Max size 32KB. + * @returns { Promise } the promise returned by the function. + * @throws { BusinessError } 401 - parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. + * @throws { BusinessError } 12800003 - input method client error. + * @throws { BusinessError } 12800010 - not default input method configured by system. + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 12 + */ + sendPrivateCommand(commandData: Record): Promise; + /** + * Get info of the calling window. + * + * @returns { Promise } the promise returned by the function. + * @throws { BusinessError } 12800003 - input method client error. + * @throws { BusinessError } 12800012 - input method panel doesn't exist. + * @throws { BusinessError } 12800013 - window manager service error. + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 12 + */ + getCallingWindowInfo(): Promise; + /** + * Insert the provided text as preview text. + * + * @param { string } text - the text to be previewed. + * @param { Range } range - the range of the text to be replaced by the preview text. + * @returns { Promise } the promise returned by the function. + * @throws { BusinessError } 401 - parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. + * @throws { BusinessError } 12800003 - input method client error. + * @throws { BusinessError } 12800011 - text preview is not supported. + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 12 + */ + setPreviewText(text: string, range: Range): Promise; + /** + * Insert the provided text as preview text. + * + * @param { string } text - the text to be previewed. + * @param { Range } range - the range of the text to be replaced by the preview text. + * @throws { BusinessError } 401 - parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. + * @throws { BusinessError } 12800003 - input method client error. + * @throws { BusinessError } 12800011 - text preview is not supported. + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 12 + */ + setPreviewTextSync(text: string, range: Range): void; + /** + * Finish the text preview. + * + * @returns { Promise } the promise returned by the function. + * @throws { BusinessError } 12800003 - input method client error. + * @throws { BusinessError } 12800011 - text preview is not supported. + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 12 + */ + finishTextPreview(): Promise; + /** + * Finish the text preview. + * + * @throws { BusinessError } 12800003 - input method client error. + * @throws { BusinessError } 12800011 - text preview is not supported. + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 12 + */ + finishTextPreviewSync(): void; + } + /** + * @interface KeyboardDelegate + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 8 + */ + interface KeyboardDelegate { + /** + * Subscribe key up or down event + * + * @param { 'keyDown' | 'keyUp' } type - indicates the type of subscribe event. + * @param { function } callback - indicates the callback function of on('keyDown'|'keyUp'). + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 8 + */ + on(type: 'keyDown' | 'keyUp', callback: (event: KeyEvent) => boolean): void; + /** + * Unsubscribe key up or down event + * + * @param { 'keyDown' | 'keyUp' } type - indicates the type of unsubscribe event. + * @param { function } [callback] - optional, indicates the callback function of off('keyDown'|'keyUp'). + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 8 + */ + off(type: 'keyDown' | 'keyUp', callback?: (event: KeyEvent) => boolean): void; + /** + * Subscribe key event. + * + * @param { 'keyEvent' } type - indicates the type of subscribe event. + * @param { function } callback - indicates the callback function of on('keyEvent'). + * If the key is processed by event subscriber, callback should be return true, else return false. + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 10 + */ + on(type: 'keyEvent', callback: (event: InputKeyEvent) => boolean): void; + /** + * Unsubscribe key event. + * + * @param { 'keyEvent' } type - indicates the type of unsubscribe event. + * @param { function } [callback] - optional, indicates the callback function of off('keyEvent'). + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 10 + */ + off(type: 'keyEvent', callback?: (event: InputKeyEvent) => boolean): void; + /** + * Subscribe cursor context change + * + * @param { 'cursorContextChange' } type - indicates the type of subscribe event. + * @param { function } callback - indicates the callback function of on('cursorContextChange'). + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 8 + */ + on(type: 'cursorContextChange', callback: (x: number, y: number, height: number) => void): void; + /** + * Unsubscribe cursor context change + * + * @param { 'cursorContextChange' } type - indicates the type of unsubscribe event. + * @param { function } [callback] - optional, indicates the callback function of off('cursorContextChange'). + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 8 + */ + off(type: 'cursorContextChange', callback?: (x: number, y: number, height: number) => void): void; + /** + * Subscribe selection change + * + * @param { 'selectionChange' } type - indicates the type of subscribe event. + * @param { function } callback - indicates the callback function + * of on('selectionChange'). + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 8 + */ + on(type: 'selectionChange', callback: (oldBegin: number, oldEnd: number, newBegin: number, newEnd: number) => void): void; + /** + * Unsubscribe selection change + * + * @param { 'selectionChange' } type - indicates the type of unsubscribe event. + * @param { function } [callback] - optional, + * indicates the callback function of off('selectionChange'). + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 8 + */ + off(type: 'selectionChange', callback?: (oldBegin: number, oldEnd: number, newBegin: number, newEnd: number) => void): void; + /** + * Subscribe text change + * + * @param { 'textChange' } type - indicates the type of subscribe event. + * @param { function } callback - indicates the callback function of on('textChange'). + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 8 + */ + on(type: 'textChange', callback: (text: string) => void): void; + /** + * Unsubscribe text change + * + * @param { 'textChange' } type - indicates the type of unsubscribe event. + * @param { function } [callback] - optional, indicates the callback function of off('textChange'). + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 8 + */ + off(type: 'textChange', callback?: (text: string) => void): void; + /** + * Subscribe input text attribute change + * + * @param { 'editorAttributeChanged' } type - indicates the type of subscribe event. + * @param { function } callback - indicates the callback function of on('editorAttributeChanged'). + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 10 + */ + on(type: 'editorAttributeChanged', callback: (attr: EditorAttribute) => void): void; + /** + * Unsubscribe input text attribute change + * + * @param { 'editorAttributeChanged' } type - indicates the type of subscribe event. + * @param { function } [callback] - indicates the callback function of off('editorAttributeChanged'). + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 10 + */ + off(type: 'editorAttributeChanged', callback?: (attr: EditorAttribute) => void): void; + } + /** + * A panel is a container used to hold soft keyboard, candidate list, or status bar. + * + * @interface Panel + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 10 + */ + interface Panel { + /** + * Sets ui content. + *

When this method is executed successfully, the content of panel will be replaced.

+ * + * @param { string } path - the path of ui content. + * @param { AsyncCallback } callback - the callback of setUiContent. + * @throws { BusinessError } 401 - parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 10 + */ + setUiContent(path: string, callback: AsyncCallback): void; + /** + * Sets ui content. + *

When this method is executed successfully, the content of panel will be replaced.

+ * + * @param { string } path - the path of ui content. + * @returns { Promise } the promise returned by the function. + * @throws { BusinessError } 401 - parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 10 + */ + setUiContent(path: string): Promise; + /** + * Sets ui content. + *

When this method is executed successfully, the content of panel will be replaced.

+ * + * @param { string } path - the path of ui content. + * @param { LocalStorage } storage - the data object shared within the content instance loaded by the panel. + * @param { AsyncCallback } callback - the callback of setUiContent. + * @throws { BusinessError } 401 - parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 10 + */ + setUiContent(path: string, storage: LocalStorage, callback: AsyncCallback): void; + /** + * Sets ui content. + *

When this method is executed successfully, the content of panel will be replaced.

+ * + * @param { string } path - the path of ui content. + * @param { LocalStorage } storage - the data object shared within the content instance loaded by the panel. + * @returns { Promise } the promise returned by the function. + * @throws { BusinessError } 401 - parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 10 + */ + setUiContent(path: string, storage: LocalStorage): Promise; + /** + * Resizes a panel. + * + * @param { number } width - the new width of the panel. + * @param { number } height - the new height of the panel. + * @param { AsyncCallback } callback - the callback of resize. + * @throws { BusinessError } 401 - parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 10 + */ + resize(width: number, height: number, callback: AsyncCallback): void; + /** + * Resizes a panel. + * + * @param { number } width - the new width of the panel. + * @param { number } height - the new height of the panel. + * @returns { Promise } the promise returned by the function. + * @throws { BusinessError } 401 - parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 10 + */ + resize(width: number, height: number): Promise; + /** + * Moves a panel. + *

It's unusable for SOFT_KEYBOARD panel with FLG_FIXED.

+ * + * @param { number } x - the x-coordinate of the new position. + * @param { number } y - the y-coordinate of the new position. + * @param { AsyncCallback } callback - the callback of moveTo. + * @throws { BusinessError } 401 - parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 10 + */ + moveTo(x: number, y: number, callback: AsyncCallback): void; + /** + * Moves a panel. + *

It's unusable for SOFT_KEYBOARD panel with FLG_FIXED.

+ * + * @param { number } x - the x-coordinate of the new position. + * @param { number } y - the y-coordinate of the new position. + * @returns { Promise } the promise returned by the function. + * @throws { BusinessError } 401 - parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 10 + */ + moveTo(x: number, y: number): Promise; + /** + * Shows panel. + * + * @param { AsyncCallback } callback - the callback of show. + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 10 + */ + show(callback: AsyncCallback): void; + /** + * Shows panel. + * + * @returns { Promise } the promise returned by the function. + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 10 + */ + show(): Promise; + /** + * Hides panel. + * + * @param { AsyncCallback } callback - the callback of hide. + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 10 + */ + hide(callback: AsyncCallback): void; + /** + * Hides panel. + * + * @returns { Promise } the promise returned by the function. + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 10 + */ + hide(): Promise; + /** + * Registers panel show event. + *

The "show" events are triggered when the panel is shown.

+ * + * @param { 'show' } type - events type. + * @param { function } callback - the callback will be called when events are triggered. + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 10 + */ + on(type: 'show', callback: () => void): void; + /** + * Unregisters panel show event. + * + * @param { 'show' } type - events type. + * @param { function } [callback] - the callback to Unregister. + * @throws { BusinessError } 401 - parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 10 + */ + off(type: 'show', callback?: () => void): void; + /** + * Registers panel hide event. + *

The "hide" events are triggered when the panel is hidden.

+ * + * @param { 'hide' } type - events type. + * @param { function } callback - the callback will be called when events are triggered. + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 10 + */ + on(type: 'hide', callback: () => void): void; + /** + * Unregisters panel hide event. + * + * @param { 'hide' } type - events type. + * @param { function } [callback] - the callback to Unregister. + * @throws { BusinessError } 401 - parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 10 + */ + off(type: 'hide', callback?: () => void): void; + /** + * Changes panel flag. + *

Before flag is changed, Developers should hide the panel.After that, developers can change the content, size, point of the panel + * and show it again at appropriate opportunity.

+ * + * @param { PanelFlag } flag - the callback of changeFlag. + * @throws { BusinessError } 401 - parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 10 + */ + changeFlag(flag: PanelFlag): void; + /** + * Sets ime panel private mode or not. + * + * @permission ohos.permission.PRIVACY_WINDOW + * @param { boolean } isPrivacyMode - if the value is true, the privacy mode will be set, + * otherwise the non-privacy mode will be set. + * @throws { BusinessError } 201 - permissions check fails. + * @throws { BusinessError } 401 - parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 11 + */ + setPrivacyMode(isPrivacyMode: boolean): void; + /** + * Adjust the rect of soft keyboard panel for landscape and portrait orientations. + *

It's only used for SOFT_KEYBOARD panel with FLG_FIXED and FLG_FLOATING.

+ * + * @param { PanelFlag } flag - panel flag. + * @param { PanelRect } rect - panel rect. + * @throws { BusinessError } 401 - parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. + * @throws { BusinessError } 12800013 - window manager service error. + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 12 + */ + adjustPanelRect(flag: PanelFlag, rect: PanelRect): void; + /** + * Subscribe 'sizeChange' event. + *

It's only used for SOFT_KEYBOARD panel with FLG_FIXED and FLG_FLOATING.

+ * + * @param { 'sizeChange' } type - the type of subscribe event. + * @param { Callback } callback - the callback of on('sizeChange'). + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 12 + */ + on(type: 'sizeChange', callback: Callback): void; + /** + * Unsubscribe 'sizeChange' event. + *

It's only used for SOFT_KEYBOARD panel with FLG_FIXED and FLG_FLOATING.

+ * + * @param { 'sizeChange' } type - the type of unsubscribe event. + * @param { Callback } [callback] - optional, the callback of off('sizeChange'). + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 12 + */ + off(type: 'sizeChange', callback?: Callback): void; + } + /** + * @interface EditorAttribute + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 8 + */ + interface EditorAttribute { + /** + * Editor's pattern + * + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 8 + */ + readonly inputPattern: number; + /** + * Editor's key type + * + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 8 + */ + readonly enterKeyType: number; + /** + * Indicates whether the editor supports the text preview. + * + * @type { boolean } + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 12 + */ + isTextPreviewSupported: boolean; + } + /** + * @interface KeyEvent + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 8 + */ + interface KeyEvent { + /** + * Key code + * + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 8 + */ + readonly keyCode: number; + /** + * Key action + * + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 8 + */ + readonly keyAction: number; + } + /** + * Enumerates the flags of panel + * + * @enum { number } + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 10 + */ + export enum PanelFlag { + /** + * Fixed style. + *

It's provided for the panel with type of SOFT_KEYBOARD. + * When the flag is set, the soft keyboard is fixed at the bottom of the screen.

+ * + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 10 + */ + FLG_FIXED = 0, + /** + * Floating style. + *

It's provided for the panel with type of SOFT_KEYBOARD. + * When the flag is set, the soft keyboard is floating.

+ * + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 10 + */ + FLG_FLOATING + } + /** + *

Panel types provided for input method applications.

+ *

Input method application developers should select the appropriate panel type according to the user scenario.

+ * + * @enum { number } + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 10 + */ + export enum PanelType { + /** + * Panel for displaying a virtual software keyboard. + * + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 10 + */ + SOFT_KEYBOARD = 0, + /** + * Panel for displaying status bar. + * + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 10 + */ + STATUS_BAR + } + /** + * Panel information. + * + * @typedef PanelInfo + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 10 + */ + export interface PanelInfo { + /** + * Panel type. + * + * @type { PanelType } + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 10 + */ + type: PanelType; + /** + *

Flag of Panel.

+ *

Currently only using for SOFT_KEYBOARD panel.

+ * + * @type { ?PanelFlag } + * @default FLG_FIXED + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 10 + */ + flag?: PanelFlag; + } + /** + * Enumerates the moving direction of cursor + * + * @enum { number } + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 10 + */ + export enum Direction { + /** + * Cursor moves up + * + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 10 + */ + CURSOR_UP = 1, + /** + * Cursor moves down + * + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 10 + */ + CURSOR_DOWN, + /** + * Cursor moves left + * + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 10 + */ + CURSOR_LEFT, + /** + * Cursor moves right + * + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 10 + */ + CURSOR_RIGHT + } + /** + * Enumerates the security mode. + * + * @enum { number } + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 11 + */ + export enum SecurityMode { + /** + * Basic security mode + * + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 11 + */ + BASIC = 0, + /** + * Full security mode + * + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 11 + */ + FULL + } + /** + * Range of selected text. + * + * @interface Range + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 10 + */ + export interface Range { + /** + * Indicates the index of the first character of the selected text. + * + * @type { number } + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 10 + */ + start: number; + /** + * Indicates the index of the last character of the selected text. + * + * @type { number } + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 10 + */ + end: number; + } + /** + * Movement of cursor. + * + * @interface Movement + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 10 + */ + export interface Movement { + /** + * Indicates the direction of cursor movement + * + * @type { Direction } + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 10 + */ + direction: Direction; + } + /** + * Enumerates the extend action. + * + * @enum { number } + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 10 + */ + export enum ExtendAction { + /** + * Select all text. + * + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 10 + */ + SELECT_ALL = 0, + /** + * Cut selecting text. + * + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 10 + */ + CUT = 3, + /** + * Copy selecting text. + * + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 10 + */ + COPY = 4, + /** + * Paste from paste board. + * + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 10 + */ + PASTE = 5 + } + /** + * Window info. + * + * @interface WindowInfo + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 12 + */ + export interface WindowInfo { + /** + * Rectangle. + * + * @type { window.Rect } + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 12 + */ + rect: window.Rect; + /** + * Window status. + * + * @type { window.WindowStatusType } + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 12 + */ + status: window.WindowStatusType; + } + /** + * Panel Rect. + * + * @interface PanelRect + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 12 + */ + export interface PanelRect { + /** + * Panel rect in landscape orientation. + * + * @type { window.Rect } + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 12 + */ + landscapeRect: window.Rect; + /** + * Panel rect in portrait orientation. + * + * @type { window.Rect } + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 12 + */ + portraitRect: window.Rect; + } +} +export default inputMethodEngine; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.inputMethodList.d.ets b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.inputMethodList.d.ets new file mode 100755 index 00000000..898ce040 --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.inputMethodList.d.ets @@ -0,0 +1,101 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit IMEKit + */ +/** + * Define pattern options of keyboard. + * + * @interface PatternOptions + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 11 + */ +export interface PatternOptions { + /** + * The default selected pattern, The defaultSelected will default to 0 if left blank + * + * @type { number } + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 11 + */ + defaultSelected?: number; + /** + * the patterns of input method. + * + * @type { Array } + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 11 + */ + patterns: Array; + /** + * An action callback. When the pattern icon clicked, the callback will be invoked. + * + * @type { function } + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 11 + */ + action: (index: number) => void; +} +/** + * Define pattern of keyboard. The caller must be the current inputmethod. + * + * @interface Pattern + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 11 + */ +export interface Pattern { + /** + * The icon resource of pattern. + * + * @type { Resource } + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 11 + */ + icon: Resource; + /** + * The selected icon resource of pattern. + * + * @type { Resource } + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 11 + */ + selectedIcon: Resource; +} +/** + * Declare input method list dialog. The caller must be the current inputmethod. + * + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 11 + */ +@CustomDialog +export declare struct InputMethodListDialog { + /** + * Sets the controller. + * + * @type { CustomDialogController } + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 11 + */ + controller: CustomDialogController; + /** + * Sets the pattern options. This parameter can be left blank when it is not default input method. + * + * @type { PatternOptions } + * @syscap SystemCapability.MiscServices.InputMethodFramework + * @since 11 + */ + patternOptions?: PatternOptions; +} diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.intl.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.intl.d.ts new file mode 100755 index 00000000..11306e7a --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.intl.d.ts @@ -0,0 +1,3939 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit LocalizationKit + */ +/** + * Provides internationalization related APIs. + * + * @namespace intl + * @syscap SystemCapability.Global.I18n + * @since 6 + */ +/** + * Provides internationalization related APIs. + * + * @namespace intl + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ +/** + * Provides internationalization related APIs. + * + * @namespace intl + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @since 11 + */ +/** + * Provides internationalization related APIs. + * + * @namespace intl + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @atomicservice + * @since 12 + */ +declare namespace intl { + /** + * Provides the options of Locale. + * + * @interface LocaleOptions + * @syscap SystemCapability.Global.I18n + * @since 6 + */ + /** + * Provides the options of Locale. + * + * @interface LocaleOptions + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Provides the options of Locale. + * + * @interface LocaleOptions + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @since 11 + */ + /** + * Provides the options of Locale. + * + * @interface LocaleOptions + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @atomicservice + * @since 12 + */ + export interface LocaleOptions { + /** + * Indicates the calendar. + * + * @type { string } + * @syscap SystemCapability.Global.I18n + * @since 6 + */ + /** + * Indicates the calendar. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @since 9 + */ + /** + * Indicates the calendar. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Indicates the calendar. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @since 11 + */ + /** + * Indicates the calendar. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @atomicservice + * @since 12 + */ + calendar?: string; + /** + * Indicates the collation. + * + * @type { string } + * @syscap SystemCapability.Global.I18n + * @since 6 + */ + /** + * Indicates the collation. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @since 9 + */ + /** + * Indicates the collation. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Indicates the collation. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @since 11 + */ + /** + * Indicates the collation. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @atomicservice + * @since 12 + */ + collation?: string; + /** + * Indicates the hourCycle. + * + * @type { string } + * @syscap SystemCapability.Global.I18n + * @since 6 + */ + /** + * Indicates the hourCycle. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @since 9 + */ + /** + * Indicates the hourCycle. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Indicates the hourCycle. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @since 11 + */ + /** + * Indicates the hourCycle. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @atomicservice + * @since 12 + */ + hourCycle?: string; + /** + * Indicates the numberingSystem. + * + * @type { string } + * @syscap SystemCapability.Global.I18n + * @since 6 + */ + /** + * Indicates the numberingSystem. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @since 9 + */ + /** + * Indicates the numberingSystem. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Indicates the numberingSystem. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @since 11 + */ + /** + * Indicates the numberingSystem. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @atomicservice + * @since 12 + */ + numberingSystem?: string; + /** + * Indicates the numeric. + * + * @type { boolean } + * @syscap SystemCapability.Global.I18n + * @since 6 + */ + /** + * Indicates the numeric. + * + * @type { ?boolean } + * @syscap SystemCapability.Global.I18n + * @since 9 + */ + /** + * Indicates the numeric. + * + * @type { ?boolean } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Indicates the numeric. + * + * @type { ?boolean } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @since 11 + */ + /** + * Indicates the numeric. + * + * @type { ?boolean } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @atomicservice + * @since 12 + */ + numeric?: boolean; + /** + * Indicates the caseFirst. + * + * @type { string } + * @syscap SystemCapability.Global.I18n + * @since 6 + */ + /** + * Indicates the caseFirst. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @since 9 + */ + /** + * Indicates the caseFirst. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Indicates the caseFirst. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @since 11 + */ + /** + * Indicates the caseFirst. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @atomicservice + * @since 12 + */ + caseFirst?: string; + } + /** + * Provides APIs for obtaining locale information. + * + * @syscap SystemCapability.Global.I18n + * @since 6 + */ + /** + * Provides APIs for obtaining locale information. + * + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Provides APIs for obtaining locale information. + * + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @since 11 + */ + /** + * Provides APIs for obtaining locale information. + * + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @atomicservice + * @since 12 + */ + export class Locale { + /** + * A constructor used to create a Locale object. + * + * @syscap SystemCapability.Global.I18n + * @since 8 + */ + /** + * A constructor used to create a Locale object. + * + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * A constructor used to create a Locale object. + * + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @since 11 + */ + /** + * A constructor used to create a Locale object. + * + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @atomicservice + * @since 12 + */ + constructor(); + /** + * A constructor used to create a Locale object. + * + * @param { string } locale - Indicates a character string containing the locale information, including + * the language and optionally the script and region. + * @param { LocaleOptions } options - Indicates Locale option object use to initialize the Locale object. + * @syscap SystemCapability.Global.I18n + * @since 6 + */ + /** + * A constructor used to create a Locale object. + * + * @param { string } locale - Indicates a character string containing the locale information, including + * the language and optionally the script and region. + * @param { LocaleOptions } options - Indicates Locale option object use to initialize the Locale object. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * A constructor used to create a Locale object. + * + * @param { string } locale - Indicates a character string containing the locale information, including + * the language and optionally the script and region. + * @param { LocaleOptions } options - Indicates Locale option object use to initialize the Locale object. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @since 11 + */ + /** + * A constructor used to create a Locale object. + * + * @param { string } locale - Indicates a character string containing the locale information, including + * the language and optionally the script and region. + * @param { LocaleOptions } options - Indicates Locale option object use to initialize the Locale object. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @atomicservice + * @since 12 + */ + constructor(locale: string, options?: LocaleOptions); + /** + * Indicates the language of the locale. + * + * @syscap SystemCapability.Global.I18n + * @since 6 + */ + /** + * Indicates the language of the locale. + * + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Indicates the language of the locale. + * + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @since 11 + */ + /** + * Indicates the language of the locale. + * + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @atomicservice + * @since 12 + */ + language: string; + /** + * Indicates the script of the locale. + * + * @syscap SystemCapability.Global.I18n + * @since 6 + */ + /** + * Indicates the script of the locale. + * + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Indicates the script of the locale. + * + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @since 11 + */ + /** + * Indicates the script of the locale. + * + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @atomicservice + * @since 12 + */ + script: string; + /** + * Indicates the region of the locale. + * + * @syscap SystemCapability.Global.I18n + * @since 6 + */ + /** + * Indicates the region of the locale. + * + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Indicates the region of the locale. + * + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @since 11 + */ + /** + * Indicates the region of the locale. + * + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @atomicservice + * @since 12 + */ + region: string; + /** + * Indicates the basic locale information, which is returned as a substring of + * a complete locale string. + * + * @syscap SystemCapability.Global.I18n + * @since 6 + */ + /** + * Indicates the basic locale information, which is returned as a substring of + * a complete locale string. + * + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Indicates the basic locale information, which is returned as a substring of + * a complete locale string. + * + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @since 11 + */ + /** + * Indicates the basic locale information, which is returned as a substring of + * a complete locale string. + * + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @atomicservice + * @since 12 + */ + baseName: string; + /** + * Indicates the case first style of the locale. + * + * @syscap SystemCapability.Global.I18n + * @since 6 + */ + /** + * Indicates the case first style of the locale. + * + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Indicates the case first style of the locale. + * + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @since 11 + */ + /** + * Indicates the case first style of the locale. + * + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @atomicservice + * @since 12 + */ + caseFirst: string; + /** + * Indicates the calendar. + * + * @syscap SystemCapability.Global.I18n + * @since 6 + */ + /** + * Indicates the calendar. + * + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Indicates the calendar. + * + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @since 11 + */ + /** + * Indicates the calendar. + * + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @atomicservice + * @since 12 + */ + calendar: string; + /** + * Indicates the collation. + * + * @syscap SystemCapability.Global.I18n + * @since 6 + */ + /** + * Indicates the collation. + * + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Indicates the collation. + * + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @since 11 + */ + /** + * Indicates the collation. + * + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @atomicservice + * @since 12 + */ + collation: string; + /** + * Indicates the hour cycle. + * + * @syscap SystemCapability.Global.I18n + * @since 6 + */ + /** + * Indicates the hour cycle. + * + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Indicates the hour cycle. + * + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @since 11 + */ + /** + * Indicates the hour cycle. + * + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @atomicservice + * @since 12 + */ + hourCycle: string; + /** + * Indicates the numbering system. + * + * @syscap SystemCapability.Global.I18n + * @since 6 + */ + /** + * Indicates the numbering system. + * + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Indicates the numbering system. + * + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @since 11 + */ + /** + * Indicates the numbering system. + * + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @atomicservice + * @since 12 + */ + numberingSystem: string; + /** + * Indicates whether it is numeric. + * + * @syscap SystemCapability.Global.I18n + * @since 6 + */ + /** + * Indicates whether it is numeric. + * + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Indicates whether it is numeric. + * + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @since 11 + */ + /** + * Indicates whether it is numeric. + * + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @atomicservice + * @since 12 + */ + numeric: boolean; + /** + * Convert the locale information to string. + * + * @returns { string } locale information in string form. + * @syscap SystemCapability.Global.I18n + * @since 6 + */ + /** + * Convert the locale information to string. + * + * @returns { string } locale information in string form. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Convert the locale information to string. + * + * @returns { string } locale information in string form. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @since 11 + */ + /** + * Convert the locale information to string. + * + * @returns { string } locale information in string form. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @atomicservice + * @since 12 + */ + toString(): string; + /** + * Maximize the locale's base information. + * + * @returns { Locale } maximized locale. + * @syscap SystemCapability.Global.I18n + * @since 6 + */ + /** + * Maximize the locale's base information. + * + * @returns { Locale } maximized locale. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Maximize the locale's base information. + * + * @returns { Locale } maximized locale. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @since 11 + */ + /** + * Maximize the locale's base information. + * + * @returns { Locale } maximized locale. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @atomicservice + * @since 12 + */ + maximize(): Locale; + /** + * Minimize the locale's base information. + * + * @returns { Locale } minimized locale. + * @syscap SystemCapability.Global.I18n + * @since 6 + */ + /** + * Minimize the locale's base information. + * + * @returns { Locale } minimized locale. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Minimize the locale's base information. + * + * @returns { Locale } minimized locale. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @since 11 + */ + /** + * Minimize the locale's base information. + * + * @returns { Locale } minimized locale. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @atomicservice + * @since 12 + */ + minimize(): Locale; + } + /** + * Provides the options of date time format. + * + * @interface DateTimeOptions + * @syscap SystemCapability.Global.I18n + * @since 6 + */ + /** + * Provides the options of date time format. + * + * @interface DateTimeOptions + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Provides the options of date time format. + * + * @interface DateTimeOptions + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @since 11 + */ + /** + * Provides the options of date time format. + * + * @interface DateTimeOptions + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @atomicservice + * @since 12 + */ + export interface DateTimeOptions { + /** + * Indicates the locale. + * + * @type { string } + * @syscap SystemCapability.Global.I18n + * @since 6 + */ + /** + * Indicates the locale. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @since 9 + */ + /** + * Indicates the locale. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Indicates the locale. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @since 11 + */ + /** + * Indicates the locale. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @atomicservice + * @since 12 + */ + locale?: string; + /** + * Indicates the dateStyle. + * + * @type { string } + * @syscap SystemCapability.Global.I18n + * @since 6 + */ + /** + * Indicates the dateStyle. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @since 9 + */ + /** + * Indicates the dateStyle. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Indicates the dateStyle. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @since 11 + */ + /** + * Indicates the dateStyle. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @atomicservice + * @since 12 + */ + dateStyle?: string; + /** + * Indicates the timeStyle. + * + * @type { string } + * @syscap SystemCapability.Global.I18n + * @since 6 + */ + /** + * Indicates the timeStyle. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @since 9 + */ + /** + * Indicates the timeStyle. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Indicates the timeStyle. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @since 11 + */ + /** + * Indicates the timeStyle. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @atomicservice + * @since 12 + */ + timeStyle?: string; + /** + * Indicates the hourCycle. + * + * @type { string } + * @syscap SystemCapability.Global.I18n + * @since 6 + */ + /** + * Indicates the hourCycle. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @since 9 + */ + /** + * Indicates the hourCycle. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Indicates the hourCycle. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @since 11 + */ + /** + * Indicates the hourCycle. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @atomicservice + * @since 12 + */ + hourCycle?: string; + /** + * Indicates the timeZone. + * + * @type { string } + * @syscap SystemCapability.Global.I18n + * @since 6 + */ + /** + * Indicates the timeZone. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @since 9 + */ + /** + * Indicates the timeZone. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Indicates the timeZone. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @since 11 + */ + /** + * Indicates the timeZone. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @atomicservice + * @since 12 + */ + timeZone?: string; + /** + * Indicates the numberingSystem. + * + * @type { string } + * @syscap SystemCapability.Global.I18n + * @since 6 + */ + /** + * Indicates the numberingSystem. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @since 9 + */ + /** + * Indicates the numberingSystem. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Indicates the numberingSystem. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @since 11 + */ + /** + * Indicates the numberingSystem. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @atomicservice + * @since 12 + */ + numberingSystem?: string; + /** + * Indicates the hour12. + * + * @type { boolean } + * @syscap SystemCapability.Global.I18n + * @since 6 + */ + /** + * Indicates the hour12. + * + * @type { ?boolean } + * @syscap SystemCapability.Global.I18n + * @since 9 + */ + /** + * Indicates the hour12. + * + * @type { ?boolean } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Indicates the hour12. + * + * @type { ?boolean } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @since 11 + */ + /** + * Indicates the hour12. + * + * @type { ?boolean } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @atomicservice + * @since 12 + */ + hour12?: boolean; + /** + * Indicates the weekday. + * + * @type { string } + * @syscap SystemCapability.Global.I18n + * @since 6 + */ + /** + * Indicates the weekday. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @since 9 + */ + /** + * Indicates the weekday. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Indicates the weekday. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @since 11 + */ + /** + * Indicates the weekday. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @atomicservice + * @since 12 + */ + weekday?: string; + /** + * Indicates the era. + * + * @type { string } + * @syscap SystemCapability.Global.I18n + * @since 6 + */ + /** + * Indicates the era. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @since 9 + */ + /** + * Indicates the era. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Indicates the era. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @since 11 + */ + /** + * Indicates the era. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @atomicservice + * @since 12 + */ + era?: string; + /** + * Indicates the year. + * + * @type { string } + * @syscap SystemCapability.Global.I18n + * @since 6 + */ + /** + * Indicates the year. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @since 9 + */ + /** + * Indicates the year. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Indicates the year. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @since 11 + */ + /** + * Indicates the year. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @atomicservice + * @since 12 + */ + year?: string; + /** + * Indicates the month. + * + * @type { string } + * @syscap SystemCapability.Global.I18n + * @since 6 + */ + /** + * Indicates the month. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @since 9 + */ + /** + * Indicates the month. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Indicates the month. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @since 11 + */ + /** + * Indicates the month. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @atomicservice + * @since 12 + */ + month?: string; + /** + * Indicates the day. + * + * @type { string } + * @syscap SystemCapability.Global.I18n + * @since 6 + */ + /** + * Indicates the day. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @since 9 + */ + /** + * Indicates the day. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Indicates the day. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @since 11 + */ + /** + * Indicates the day. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @atomicservice + * @since 12 + */ + day?: string; + /** + * Indicates the hour. + * + * @type { string } + * @syscap SystemCapability.Global.I18n + * @since 6 + */ + /** + * Indicates the hour. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @since 9 + */ + /** + * Indicates the hour. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Indicates the hour. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @since 11 + */ + /** + * Indicates the hour. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @atomicservice + * @since 12 + */ + hour?: string; + /** + * Indicates the minute. + * + * @type { string } + * @syscap SystemCapability.Global.I18n + * @since 6 + */ + /** + * Indicates the minute. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @since 9 + */ + /** + * Indicates the minute. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Indicates the minute. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @since 11 + */ + /** + * Indicates the minute. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @atomicservice + * @since 12 + */ + minute?: string; + /** + * Indicates the second. + * + * @type { string } + * @syscap SystemCapability.Global.I18n + * @since 6 + */ + /** + * Indicates the second. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @since 9 + */ + /** + * Indicates the second. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Indicates the second. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @since 11 + */ + /** + * Indicates the second. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @atomicservice + * @since 12 + */ + second?: string; + /** + * Indicates the timeZoneName. + * + * @type { string } + * @syscap SystemCapability.Global.I18n + * @since 6 + */ + /** + * Indicates the timeZoneName. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @since 9 + */ + /** + * Indicates the timeZoneName. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Indicates the timeZoneName. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @since 11 + */ + /** + * Indicates the timeZoneName. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @atomicservice + * @since 12 + */ + timeZoneName?: string; + /** + * Indicates the dayPeriod. + * + * @type { string } + * @syscap SystemCapability.Global.I18n + * @since 6 + */ + /** + * Indicates the dayPeriod. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @since 9 + */ + /** + * Indicates the dayPeriod. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Indicates the dayPeriod. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @since 11 + */ + /** + * Indicates the dayPeriod. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @atomicservice + * @since 12 + */ + dayPeriod?: string; + /** + * Indicates the localeMatcher. + * + * @type { string } + * @syscap SystemCapability.Global.I18n + * @since 6 + */ + /** + * Indicates the localeMatcher. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @since 9 + */ + /** + * Indicates the localeMatcher. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Indicates the localeMatcher. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @since 11 + */ + /** + * Indicates the localeMatcher. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @atomicservice + * @since 12 + */ + localeMatcher?: string; + /** + * Indicates the formatMatcher. + * + * @type { string } + * @syscap SystemCapability.Global.I18n + * @since 6 + */ + /** + * Indicates the formatMatcher. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @since 9 + */ + /** + * Indicates the formatMatcher. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Indicates the formatMatcher. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @since 11 + */ + /** + * Indicates the formatMatcher. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @atomicservice + * @since 12 + */ + formatMatcher?: string; + } + /** + * Provides the API for formatting date strings. + * + * @syscap SystemCapability.Global.I18n + * @since 6 + */ + /** + * Provides the API for formatting date strings. + * + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Provides the API for formatting date strings. + * + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @since 11 + */ + /** + * Provides the API for formatting date strings. + * + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @atomicservice + * @since 12 + */ + export class DateTimeFormat { + /** + * A constructor used to create a DateTimeFormat object. + * + * @syscap SystemCapability.Global.I18n + * @since 8 + */ + /** + * A constructor used to create a DateTimeFormat object. + * + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * A constructor used to create a DateTimeFormat object. + * + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @since 11 + */ + /** + * A constructor used to create a DateTimeFormat object. + * + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @atomicservice + * @since 12 + */ + constructor(); + /** + * A constructor used to create a DateTimeFormat object. + * + * @param { string | Array } locale - Indicates character string containing the locale information, including + * the language and optionally the script and region, for the DateTimeFormat object. + * @param { DateTimeOptions } [options] - Indicates the options used to format the date. + * @syscap SystemCapability.Global.I18n + * @since 6 + */ + /** + * A constructor used to create a DateTimeFormat object. + * + * @param { string | Array } locale - Indicates character string containing the locale information, including + * the language and optionally the script and region, for the DateTimeFormat object. + * @param { DateTimeOptions } [options] - Indicates the options used to format the date. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * A constructor used to create a DateTimeFormat object. + * + * @param { string | Array } locale - Indicates character string containing the locale information, including + * the language and optionally the script and region, for the DateTimeFormat object. + * @param { DateTimeOptions } [options] - Indicates the options used to format the date. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @since 11 + */ + /** + * A constructor used to create a DateTimeFormat object. + * + * @param { string | Array } locale - Indicates character string containing the locale information, including + * the language and optionally the script and region, for the DateTimeFormat object. + * @param { DateTimeOptions } [options] - Indicates the options used to format the date. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @atomicservice + * @since 12 + */ + constructor(locale: string | Array, options?: DateTimeOptions); + /** + * Obtains the formatted date strings. + * + * @param { Date } date - Indicates the Date object to be formatted. + * @returns { string } a date string formatted based on the specified locale. + * @syscap SystemCapability.Global.I18n + * @since 6 + */ + /** + * Obtains the formatted date strings. + * + * @param { Date } date - Indicates the Date object to be formatted. + * @returns { string } a date string formatted based on the specified locale. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Obtains the formatted date strings. + * + * @param { Date } date - Indicates the Date object to be formatted. + * @returns { string } a date string formatted based on the specified locale. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @since 11 + */ + /** + * Obtains the formatted date strings. + * + * @param { Date } date - Indicates the Date object to be formatted. + * @returns { string } a date string formatted based on the specified locale. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @atomicservice + * @since 12 + */ + format(date: Date): string; + /** + * Obtains the formatted date strings of a date range. + * + * @param { Date } startDate - Indicates the start date of the date range. + * @param { Date } endDate - Indicates the end date of the date range. + * @returns { string } a date string formatted based on the specified locale. + * @syscap SystemCapability.Global.I18n + * @since 6 + */ + /** + * Obtains the formatted date strings of a date range. + * + * @param { Date } startDate - Indicates the start date of the date range. + * @param { Date } endDate - Indicates the end date of the date range. + * @returns { string } a date string formatted based on the specified locale. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Obtains the formatted date strings of a date range. + * + * @param { Date } startDate - Indicates the start date of the date range. + * @param { Date } endDate - Indicates the end date of the date range. + * @returns { string } a date string formatted based on the specified locale. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @since 11 + */ + /** + * Obtains the formatted date strings of a date range. + * + * @param { Date } startDate - Indicates the start date of the date range. + * @param { Date } endDate - Indicates the end date of the date range. + * @returns { string } a date string formatted based on the specified locale. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @atomicservice + * @since 12 + */ + formatRange(startDate: Date, endDate: Date): string; + /** + * Obtains the options of the DateTimeFormat object. + * + * @returns { DateTimeOptions } the options of the DateTimeFormat object. + * @syscap SystemCapability.Global.I18n + * @since 6 + */ + /** + * Obtains the options of the DateTimeFormat object. + * + * @returns { DateTimeOptions } the options of the DateTimeFormat object. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Obtains the options of the DateTimeFormat object. + * + * @returns { DateTimeOptions } the options of the DateTimeFormat object. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @since 11 + */ + /** + * Obtains the options of the DateTimeFormat object. + * + * @returns { DateTimeOptions } the options of the DateTimeFormat object. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @form + * @atomicservice + * @since 12 + */ + resolvedOptions(): DateTimeOptions; + } + /** + * Provides the options of number format. + * + * @interface NumberOptions + * @syscap SystemCapability.Global.I18n + * @since 6 + */ + /** + * Provides the options of number format. + * + * @interface NumberOptions + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Provides the options of number format. + * + * @interface NumberOptions + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since 12 + */ + export interface NumberOptions { + /** + * Indicates the locale. + * + * @type { string } + * @syscap SystemCapability.Global.I18n + * @since 6 + */ + /** + * Indicates the locale. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @since 9 + */ + /** + * Indicates the locale. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Indicates the locale. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since 12 + */ + locale?: string; + /** + * Indicates the currency. + * + * @type { string } + * @syscap SystemCapability.Global.I18n + * @since 6 + */ + /** + * Indicates the currency. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @since 9 + */ + /** + * Indicates the currency. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Indicates the currency. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since 12 + */ + currency?: string; + /** + * Indicates the currencySign. + * + * @type { string } + * @syscap SystemCapability.Global.I18n + * @since 6 + */ + /** + * Indicates the currencySign. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @since 9 + */ + /** + * Indicates the currencySign. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Indicates the currencySign. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since 12 + */ + currencySign?: string; + /** + * Indicates the currencyDisplay. + * + * @type { string } + * @syscap SystemCapability.Global.I18n + * @since 6 + */ + /** + * Indicates the currencyDisplay. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @since 9 + */ + /** + * Indicates the currencyDisplay. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Indicates the currencyDisplay. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since 12 + */ + currencyDisplay?: string; + /** + * Indicates the unit. + * + * @type { string } + * @syscap SystemCapability.Global.I18n + * @since 6 + */ + /** + * Indicates the unit. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @since 9 + */ + /** + * Indicates the unit. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Indicates the unit. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since 12 + */ + unit?: string; + /** + * Indicates the unitDisplay. + * + * @type { string } + * @syscap SystemCapability.Global.I18n + * @since 6 + */ + /** + * Indicates the unitDisplay. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @since 9 + */ + /** + * Indicates the unitDisplay. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Indicates the unitDisplay. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since 12 + */ + unitDisplay?: string; + /** + * Indicates the unitUsage. + * + * @type { string } + * @syscap SystemCapability.Global.I18n + * @since 8 + */ + /** + * Indicates the unitUsage. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @since 9 + */ + /** + * Indicates the unitUsage. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Indicates the unitUsage. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since 12 + */ + unitUsage?: string; + /** + * Indicates the signDisplay. + * + * @type { string } + * @syscap SystemCapability.Global.I18n + * @since 6 + */ + /** + * Indicates the signDisplay. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @since 9 + */ + /** + * Indicates the signDisplay. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Indicates the signDisplay. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since 12 + */ + signDisplay?: string; + /** + * Indicates the compactDisplay. + * + * @type { string } + * @syscap SystemCapability.Global.I18n + * @since 6 + */ + /** + * Indicates the compactDisplay. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @since 9 + */ + /** + * Indicates the compactDisplay. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Indicates the compactDisplay. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since 12 + */ + compactDisplay?: string; + /** + * Indicates the notation. + * + * @type { string } + * @syscap SystemCapability.Global.I18n + * @since 6 + */ + /** + * Indicates the notation. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @since 9 + */ + /** + * Indicates the notation. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Indicates the notation. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since 12 + */ + notation?: string; + /** + * Indicates the localeMatcher. + * + * @type { string } + * @syscap SystemCapability.Global.I18n + * @since 6 + */ + /** + * Indicates the localeMatcher. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @since 9 + */ + /** + * Indicates the localeMatcher. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Indicates the localeMatcher. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since 12 + */ + localeMatcher?: string; + /** + * Indicates the style. + * + * @type { string } + * @syscap SystemCapability.Global.I18n + * @since 6 + */ + /** + * Indicates the style. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @since 9 + */ + /** + * Indicates the style. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Indicates the style. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since 12 + */ + style?: string; + /** + * Indicates the numberingSystem. + * + * @type { string } + * @syscap SystemCapability.Global.I18n + * @since 6 + */ + /** + * Indicates the numberingSystem. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @since 9 + */ + /** + * Indicates the numberingSystem. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Indicates the numberingSystem. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since 12 + */ + numberingSystem?: string; + /** + * Indicates the useGrouping. + * + * @type { boolean } + * @syscap SystemCapability.Global.I18n + * @since 6 + */ + /** + * Indicates the useGrouping. + * + * @type { ?boolean } + * @syscap SystemCapability.Global.I18n + * @since 9 + */ + /** + * Indicates the useGrouping. + * + * @type { ?boolean } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Indicates the useGrouping. + * + * @type { ?boolean } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since 12 + */ + useGrouping?: boolean; + /** + * Indicates the minimumIntegerDigits. + * + * @type { number } + * @syscap SystemCapability.Global.I18n + * @since 6 + */ + /** + * Indicates the minimumIntegerDigits. + * + * @type { ?number } + * @syscap SystemCapability.Global.I18n + * @since 9 + */ + /** + * Indicates the minimumIntegerDigits. + * + * @type { ?number } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Indicates the minimumIntegerDigits. + * + * @type { ?number } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since 12 + */ + minimumIntegerDigits?: number; + /** + * Indicates the minimumFractionDigits. + * + * @type { number } + * @syscap SystemCapability.Global.I18n + * @since 6 + */ + /** + * Indicates the minimumFractionDigits. + * + * @type { ?number } + * @syscap SystemCapability.Global.I18n + * @since 9 + */ + /** + * Indicates the minimumFractionDigits. + * + * @type { ?number } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Indicates the minimumFractionDigits. + * + * @type { ?number } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since 12 + */ + minimumFractionDigits?: number; + /** + * Indicates the maximumFractionDigits. + * + * @type { number } + * @syscap SystemCapability.Global.I18n + * @since 6 + */ + /** + * Indicates the maximumFractionDigits. + * + * @type { ?number } + * @syscap SystemCapability.Global.I18n + * @since 9 + */ + /** + * Indicates the maximumFractionDigits. + * + * @type { ?number } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Indicates the maximumFractionDigits. + * + * @type { ?number } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since 12 + */ + maximumFractionDigits?: number; + /** + * Indicates the minimumSignificantDigits. + * + * @type { number } + * @syscap SystemCapability.Global.I18n + * @since 6 + */ + /** + * Indicates the minimumSignificantDigits. + * + * @type { ?number } + * @syscap SystemCapability.Global.I18n + * @since 9 + */ + /** + * Indicates the minimumSignificantDigits. + * + * @type { ?number } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Indicates the minimumSignificantDigits. + * + * @type { ?number } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since 12 + */ + minimumSignificantDigits?: number; + /** + * Indicates the maximumSignificantDigits. + * + * @type { number } + * @syscap SystemCapability.Global.I18n + * @since 6 + */ + /** + * Indicates the maximumSignificantDigits. + * + * @type { ?number } + * @syscap SystemCapability.Global.I18n + * @since 9 + */ + /** + * Indicates the maximumSignificantDigits. + * + * @type { ?number } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Indicates the maximumSignificantDigits. + * + * @type { ?number } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since 12 + */ + maximumSignificantDigits?: number; + } + /** + * Provides the API for formatting number strings. + * + * @syscap SystemCapability.Global.I18n + * @since 6 + */ + /** + * Provides the API for formatting number strings. + * + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Provides the API for formatting number strings. + * + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since 12 + */ + export class NumberFormat { + /** + * A constructor used to create a NumberFormat object. + * + * @syscap SystemCapability.Global.I18n + * @since 8 + */ + /** + * A constructor used to create a NumberFormat object. + * + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * A constructor used to create a NumberFormat object. + * + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since 12 + */ + constructor(); + /** + * A constructor used to create a NumberFormat object. + * + * @param { string | Array } locale - Indicates a character string containing the locale information, including + * the language and optionally the script and region, for the NumberFormat object. + * @param { NumberOptions } [options] - Indicates the options used to format the number. + * @syscap SystemCapability.Global.I18n + * @since 6 + */ + /** + * A constructor used to create a NumberFormat object. + * + * @param { string | Array } locale - Indicates a character string containing the locale information, including + * the language and optionally the script and region, for the NumberFormat object. + * @param { NumberOptions } [options] - Indicates the options used to format the number. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * A constructor used to create a NumberFormat object. + * + * @param { string | Array } locale - Indicates a character string containing the locale information, including + * the language and optionally the script and region, for the NumberFormat object. + * @param { NumberOptions } [options] - Indicates the options used to format the number. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since 12 + */ + constructor(locale: string | Array, options?: NumberOptions); + /** + * Obtains the formatted number string. + * + * @param { number } number Indicates the number to be formatted. + * @returns { string } a number string formatted based on the specified locale. + * @syscap SystemCapability.Global.I18n + * @since 6 + */ + /** + * Obtains the formatted number string. + * + * @param { number } number Indicates the number to be formatted. + * @returns { string } a number string formatted based on the specified locale. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Obtains the formatted number string. + * + * @param { number } number Indicates the number to be formatted. + * @returns { string } a number string formatted based on the specified locale. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since 12 + */ + format(number: number): string; + /** + * Obtains the options of the NumberFormat object. + * + * @returns { NumberOptions } the options of the NumberFormat object. + * @syscap SystemCapability.Global.I18n + * @since 6 + */ + /** + * Obtains the options of the NumberFormat object. + * + * @returns { NumberOptions } the options of the NumberFormat object. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Obtains the options of the NumberFormat object. + * + * @returns { NumberOptions } the options of the NumberFormat object. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since 12 + */ + resolvedOptions(): NumberOptions; + } + /** + * Provides the options of Collator + * + * @interface CollatorOptions + * @syscap SystemCapability.Global.I18n + * @since 8 + */ + /** + * Provides the options of Collator + * + * @interface CollatorOptions + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Provides the options of Collator + * + * @interface CollatorOptions + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since 12 + */ + export interface CollatorOptions { + /** + * The locale matching algorithm to use. + * Possible values are "lookup" and "best fit"; the default is "best fit". + * + * @type { string } + * @syscap SystemCapability.Global.I18n + * @since 8 + */ + /** + * The locale matching algorithm to use. + * Possible values are "lookup" and "best fit"; the default is "best fit". + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @since 9 + */ + /** + * The locale matching algorithm to use. + * Possible values are "lookup" and "best fit"; the default is "best fit". + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * The locale matching algorithm to use. + * Possible values are "lookup" and "best fit"; the default is "best fit". + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since 12 + */ + localeMatcher?: string; + /** + * Whether the comparison is for sorting or for searching for matching strings. + * Possible values are "sort" and "search"; the default is "sort". + * + * @type { string } + * @syscap SystemCapability.Global.I18n + * @since 8 + */ + /** + * Whether the comparison is for sorting or for searching for matching strings. + * Possible values are "sort" and "search"; the default is "sort". + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @since 9 + */ + /** + * Whether the comparison is for sorting or for searching for matching strings. + * Possible values are "sort" and "search"; the default is "sort". + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Whether the comparison is for sorting or for searching for matching strings. + * Possible values are "sort" and "search"; the default is "sort". + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since 12 + */ + usage?: string; + /** + * Which differences in the strings should lead to non-zero result values. + * Possible values are "base", "accent", "case", "variant". + * "base" are used when only strings that differ in base letters compare as unequal. + * "accent" are used when only strings that differ in base letters or accents and + * other diacritic marks compare as unequal. + * "case" are used when only strings that differ in base letters or case compare as unequal. + * "variant" are used when Strings that differ in base letters, accents and other diacritic marks, + * or case compare as unequal. + * + * @type { string } + * @syscap SystemCapability.Global.I18n + * @since 8 + */ + /** + * Which differences in the strings should lead to non-zero result values. + * Possible values are "base", "accent", "case", "variant". + * "base" are used when only strings that differ in base letters compare as unequal. + * "accent" are used when only strings that differ in base letters or accents and + * other diacritic marks compare as unequal. + * "case" are used when only strings that differ in base letters or case compare as unequal. + * "variant" are used when Strings that differ in base letters, accents and other diacritic marks, + * or case compare as unequal. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @since 9 + */ + /** + * Which differences in the strings should lead to non-zero result values. + * Possible values are "base", "accent", "case", "variant". + * "base" are used when only strings that differ in base letters compare as unequal. + * "accent" are used when only strings that differ in base letters or accents and + * other diacritic marks compare as unequal. + * "case" are used when only strings that differ in base letters or case compare as unequal. + * "variant" are used when Strings that differ in base letters, accents and other diacritic marks, + * or case compare as unequal. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Which differences in the strings should lead to non-zero result values. + * Possible values are "base", "accent", "case", "variant". + * "base" are used when only strings that differ in base letters compare as unequal. + * "accent" are used when only strings that differ in base letters or accents and + * other diacritic marks compare as unequal. + * "case" are used when only strings that differ in base letters or case compare as unequal. + * "variant" are used when Strings that differ in base letters, accents and other diacritic marks, + * or case compare as unequal. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since 12 + */ + sensitivity?: string; + /** + * Whether punctuation should be ignored. default value is false. + * + * @type { boolean } + * @syscap SystemCapability.Global.I18n + * @since 8 + */ + /** + * Whether punctuation should be ignored. Default value is false. + * + * @type { ?boolean } + * @syscap SystemCapability.Global.I18n + * @since 9 + */ + /** + * Whether punctuation should be ignored. Default value is false. + * + * @type { ?boolean } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Whether punctuation should be ignored. Default value is false. + * + * @type { ?boolean } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since 12 + */ + ignorePunctuation?: boolean; + /** + * Variant collations for certain locales. + * + * @type { string } + * @syscap SystemCapability.Global.I18n + * @since 8 + */ + /** + * Variant collations for certain locales. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @since 9 + */ + /** + * Variant collations for certain locales. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Variant collations for certain locales. + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since 12 + */ + collation?: string; + /** + * Whether numeric collation should be used. Default value is false. + * + * @type { boolean } + * @syscap SystemCapability.Global.I18n + * @since 8 + */ + /** + * Whether numeric collation should be used. Default value is false. + * + * @type { ?boolean } + * @syscap SystemCapability.Global.I18n + * @since 9 + */ + /** + * Whether numeric collation should be used. Default value is false. + * + * @type { ?boolean } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Whether numeric collation should be used. Default value is false. + * + * @type { ?boolean } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since 12 + */ + numeric?: boolean; + /** + * Whether upper case or lower case should sort first. + * Possible values are "upper", "lower", or "false" (use the locale's default). + * + * @type { string } + * @syscap SystemCapability.Global.I18n + * @since 8 + */ + /** + * Whether upper case or lower case should sort first. + * Possible values are "upper", "lower", or "false" (use the locale's default). + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @since 9 + */ + /** + * Whether upper case or lower case should sort first. + * Possible values are "upper", "lower", or "false" (use the locale's default). + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Whether upper case or lower case should sort first. + * Possible values are "upper", "lower", or "false" (use the locale's default). + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since 12 + */ + caseFirst?: string; + } + /** + * Enable language-sensitive string comparison. + * + * @syscap SystemCapability.Global.I18n + * @since 8 + */ + /** + * Enable language-sensitive string comparison. + * + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Enable language-sensitive string comparison. + * + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since 12 + */ + export class Collator { + /** + * A constructor used to create Collator object. + * + * @syscap SystemCapability.Global.I18n + * @since 8 + */ + /** + * A constructor used to create Collator object. + * + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * A constructor used to create Collator object. + * + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since 12 + */ + constructor(); + /** + * A constructor used to create Collator Object; + * + * @param { string | Array } locale - Indicates a character string containing the locale information, including + * the language and optionally the script and region, for the Collator object. + * @param { CollatorOptions } [options] - Indicates the options used to initialize Collator object. + * @syscap SystemCapability.Global.I18n + * @since 8 + */ + /** + * A constructor used to create Collator Object; + * + * @param { string | Array } locale - Indicates a character string containing the locale information, including + * the language and optionally the script and region, for the Collator object. + * @param { CollatorOptions } [options] - Indicates the options used to initialize Collator object. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * A constructor used to create Collator Object; + * + * @param { string | Array } locale - Indicates a character string containing the locale information, including + * the language and optionally the script and region, for the Collator object. + * @param { CollatorOptions } [options] - Indicates the options used to initialize Collator object. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since 12 + */ + constructor(locale: string | Array, options?: CollatorOptions); + /** + * compares two strings according to the sort order of this Collator object + * + * @param { string } first - The first string to compare. + * @param { string } second - The second string to compare. + * @returns { number } a number indicating how first compare to second: + * a negative value if string1 comes before string2; + * a positive value if string1 comes after string2; + * 0 if they are considered equal. + * @syscap SystemCapability.Global.I18n + * @since 8 + */ + /** + * compares two strings according to the sort order of this Collator object + * + * @param { string } first - The first string to compare. + * @param { string } second - The second string to compare. + * @returns { number } a number indicating how first compare to second: + * a negative value if string1 comes before string2; + * a positive value if string1 comes after string2; + * 0 if they are considered equal. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * compares two strings according to the sort order of this Collator object + * + * @param { string } first - The first string to compare. + * @param { string } second - The second string to compare. + * @returns { number } a number indicating how first compare to second: + * a negative value if string1 comes before string2; + * a positive value if string1 comes after string2; + * 0 if they are considered equal. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since 12 + */ + compare(first: string, second: string): number; + /** + * Returns a new object with properties that reflect the locale and collation options computed + * during initialization of the object. + * + * @returns { CollatorOptions } a CollatorOptions object with properties that reflect the properties of this object. + * @syscap SystemCapability.Global.I18n + * @since 8 + */ + /** + * Returns a new object with properties that reflect the locale and collation options computed + * during initialization of the object. + * + * @returns { CollatorOptions } a CollatorOptions object with properties that reflect the properties of this object. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Returns a new object with properties that reflect the locale and collation options computed + * during initialization of the object. + * + * @returns { CollatorOptions } a CollatorOptions object with properties that reflect the properties of this object. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since 12 + */ + resolvedOptions(): CollatorOptions; + } + /** + * Provides the options of PluralRules + * + * @interface PluralRulesOptions + * @syscap SystemCapability.Global.I18n + * @since 8 + */ + /** + * Provides the options of PluralRules + * + * @interface PluralRulesOptions + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Provides the options of PluralRules + * + * @interface PluralRulesOptions + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since 12 + */ + export interface PluralRulesOptions { + /** + * The locale matching algorithm to use. + * Possible values are "lookup" and "best fit"; the default is "best fit". + * + * @type { string } + * @syscap SystemCapability.Global.I18n + * @since 8 + */ + /** + * The locale matching algorithm to use. + * Possible values are "lookup" and "best fit"; the default is "best fit". + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @since 9 + */ + /** + * The locale matching algorithm to use. + * Possible values are "lookup" and "best fit"; the default is "best fit". + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * The locale matching algorithm to use. + * Possible values are "lookup" and "best fit"; the default is "best fit". + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since 12 + */ + localeMatcher?: string; + /** + * The type to use. Possible values are: "cardinal", "ordinal" + * + * @type { string } + * @syscap SystemCapability.Global.I18n + * @since 8 + */ + /** + * The type to use. Possible values are: "cardinal", "ordinal" + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @since 9 + */ + /** + * The type to use. Possible values are: "cardinal", "ordinal" + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * The type to use. Possible values are: "cardinal", "ordinal" + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since 12 + */ + type?: string; + /** + * The minimum number of integer digits to use. + * Possible values are from 1 to 21; the default is 1. + * + * @type { number } + * @syscap SystemCapability.Global.I18n + * @since 8 + */ + /** + * The minimum number of integer digits to use. + * Possible values are from 1 to 21; the default is 1. + * + * @type { ?number } + * @syscap SystemCapability.Global.I18n + * @since 9 + */ + /** + * The minimum number of integer digits to use. + * Possible values are from 1 to 21; the default is 1. + * + * @type { ?number } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * The minimum number of integer digits to use. + * Possible values are from 1 to 21; the default is 1. + * + * @type { ?number } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since 12 + */ + minimumIntegerDigits?: number; + /** + * The minimum number of fraction digits to use. + * Possible values are from 0 to 20; the default for plain number and percent formatting is 0; + * + * @type { number } + * @syscap SystemCapability.Global.I18n + * @since 8 + */ + /** + * The minimum number of fraction digits to use. + * Possible values are from 0 to 20; the default for plain number and percent formatting is 0; + * + * @type { ?number } + * @syscap SystemCapability.Global.I18n + * @since 9 + */ + /** + * The minimum number of fraction digits to use. + * Possible values are from 0 to 20; the default for plain number and percent formatting is 0; + * + * @type { ?number } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * The minimum number of fraction digits to use. + * Possible values are from 0 to 20; the default for plain number and percent formatting is 0; + * + * @type { ?number } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since 12 + */ + minimumFractionDigits?: number; + /** + * The maximum number of fraction digits to use. + * Possible values are from 0 to 20; + * the default for plain number formatting is the larger of minimumFractionDigits and 3; + * + * @type { number } + * @syscap SystemCapability.Global.I18n + * @since 8 + */ + /** + * The maximum number of fraction digits to use. + * Possible values are from 0 to 20; + * the default for plain number formatting is the larger of minimumFractionDigits and 3; + * + * @type { ?number } + * @syscap SystemCapability.Global.I18n + * @since 9 + */ + /** + * The maximum number of fraction digits to use. + * Possible values are from 0 to 20; + * the default for plain number formatting is the larger of minimumFractionDigits and 3; + * + * @type { ?number } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * The maximum number of fraction digits to use. + * Possible values are from 0 to 20; + * the default for plain number formatting is the larger of minimumFractionDigits and 3; + * + * @type { ?number } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since 12 + */ + maximumFractionDigits?: number; + /** + * The minimum number of significant digits to use. + * Possible values are from 1 to 21; the default is 1. + * + * @type { number } + * @syscap SystemCapability.Global.I18n + * @since 8 + */ + /** + * The minimum number of significant digits to use. + * Possible values are from 1 to 21; the default is 1. + * + * @type { ?number } + * @syscap SystemCapability.Global.I18n + * @since 9 + */ + /** + * The minimum number of significant digits to use. + * Possible values are from 1 to 21; the default is 1. + * + * @type { ?number } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * The minimum number of significant digits to use. + * Possible values are from 1 to 21; the default is 1. + * + * @type { ?number } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since 12 + */ + minimumSignificantDigits?: number; + /** + * The maximum number of significant digits to use. + * Possible values are from 1 to 21; the default is 21. + * + * @type { number } + * @syscap SystemCapability.Global.I18n + * @since 8 + */ + /** + * The maximum number of significant digits to use. + * Possible values are from 1 to 21; the default is 21. + * + * @type { ?number } + * @syscap SystemCapability.Global.I18n + * @since 9 + */ + /** + * The maximum number of significant digits to use. + * Possible values are from 1 to 21; the default is 21. + * + * @type { ?number } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * The maximum number of significant digits to use. + * Possible values are from 1 to 21; the default is 21. + * + * @type { ?number } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since 12 + */ + maximumSignificantDigits?: number; + } + /** + * Enables plural-sensitive formatting and plural-related language rules. + * + * @syscap SystemCapability.Global.I18n + * @since 8 + */ + /** + * Enables plural-sensitive formatting and plural-related language rules. + * + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Enables plural-sensitive formatting and plural-related language rules. + * + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since 12 + */ + export class PluralRules { + /** + * A constructor used to create PluralRules object. + * + * @syscap SystemCapability.Global.I18n + * @since 8 + */ + /** + * A constructor used to create PluralRules object. + * + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * A constructor used to create PluralRules object. + * + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since 12 + */ + constructor(); + /** + * A constructor used to create PluralRules object. + * + * @param { string | Array } locale - Indicates a character string containing the locale information, including + * the language and optionally the script and region, for the PluralRules object. + * @param { PluralRulesOptions } [options] - Indicates the options used to initialize PluralRules object. + * @syscap SystemCapability.Global.I18n + * @since 8 + */ + /** + * A constructor used to create PluralRules object. + * + * @param { string | Array } locale - Indicates a character string containing the locale information, including + * the language and optionally the script and region, for the PluralRules object. + * @param { PluralRulesOptions } [options] - Indicates the options used to initialize PluralRules object. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * A constructor used to create PluralRules object. + * + * @param { string | Array } locale - Indicates a character string containing the locale information, including + * the language and optionally the script and region, for the PluralRules object. + * @param { PluralRulesOptions } [options] - Indicates the options used to initialize PluralRules object. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since 12 + */ + constructor(locale: string | Array, options?: PluralRulesOptions); + /** + * Returns a string indicating which plural rule to use for locale-aware formatting. + * + * @param { number } n - The number to get a plural rule for. + * @returns { string } A string representing the pluralization category of the number, + * can be one of zero, one, two, few, many or other. + * @syscap SystemCapability.Global.I18n + * @since 8 + */ + /** + * Returns a string indicating which plural rule to use for locale-aware formatting. + * + * @param { number } n - The number to get a plural rule for. + * @returns { string } A string representing the pluralization category of the number, + * can be one of zero, one, two, few, many or other. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Returns a string indicating which plural rule to use for locale-aware formatting. + * + * @param { number } n - The number to get a plural rule for. + * @returns { string } A string representing the pluralization category of the number, + * can be one of zero, one, two, few, many or other. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since 12 + */ + select(n: number): string; + } + /** + * Provides the input options of RelativeTimeFormat. + * + * @interface RelativeTimeFormatInputOptions + * @syscap SystemCapability.Global.I18n + * @since 8 + */ + /** + * Provides the input options of RelativeTimeFormat. + * + * @interface RelativeTimeFormatInputOptions + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Provides the input options of RelativeTimeFormat. + * + * @interface RelativeTimeFormatInputOptions + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since 12 + */ + export interface RelativeTimeFormatInputOptions { + /** + * The locale matching algorithm to use. + * Possible values are: lookup, best fit + * + * @type { string } + * @syscap SystemCapability.Global.I18n + * @since 8 + */ + /** + * The locale matching algorithm to use. + * Possible values are: lookup, best fit + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @since 9 + */ + /** + * The locale matching algorithm to use. + * Possible values are: lookup, best fit + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * The locale matching algorithm to use. + * Possible values are: lookup, best fit + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since 12 + */ + localeMatcher?: string; + /** + * The format of output message. + * Possible values are: always, auto + * + * @type { string } + * @syscap SystemCapability.Global.I18n + * @since 8 + */ + /** + * The format of output message. + * Possible values are: always, auto + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @since 9 + */ + /** + * The format of output message. + * Possible values are: always, auto + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * The format of output message. + * Possible values are: always, auto + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since 12 + */ + numeric?: string; + /** + * The length of the internationalized message. + * Possible values are: long, short, narrow + * + * @type { string } + * @syscap SystemCapability.Global.I18n + * @since 8 + */ + /** + * The length of the internationalized message. + * Possible values are: long, short, narrow + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @since 9 + */ + /** + * The length of the internationalized message. + * Possible values are: long, short, narrow + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * The length of the internationalized message. + * Possible values are: long, short, narrow + * + * @type { ?string } + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since 12 + */ + style?: string; + } + /** + * Provides the resolved options of RelativeTimeFormat. + * + * @interface RelativeTimeFormatResolvedOptions + * @syscap SystemCapability.Global.I18n + * @since 8 + */ + /** + * Provides the resolved options of RelativeTimeFormat. + * + * @interface RelativeTimeFormatResolvedOptions + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Provides the resolved options of RelativeTimeFormat. + * + * @interface RelativeTimeFormatResolvedOptions + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since 12 + */ + export interface RelativeTimeFormatResolvedOptions { + /** + * The BCP 47 language tag for the locale actually used. + * + * @syscap SystemCapability.Global.I18n + * @since 8 + */ + /** + * The BCP 47 language tag for the locale actually used. + * + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * The BCP 47 language tag for the locale actually used. + * + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since 12 + */ + locale: string; + /** + * The length of the internationalized message. + * Possible values are: long, short, narrow + * + * @syscap SystemCapability.Global.I18n + * @since 8 + */ + /** + * The length of the internationalized message. + * Possible values are: long, short, narrow + * + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * The length of the internationalized message. + * Possible values are: long, short, narrow + * + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since 12 + */ + style: string; + /** + * The format of output message. + * Possible values are: always, auto + * + * @syscap SystemCapability.Global.I18n + * @since 8 + */ + /** + * The format of output message. + * Possible values are: always, auto + * + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * The format of output message. + * Possible values are: always, auto + * + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since 12 + */ + numeric: string; + /** + * The value requested using the Unicode extension key "nu" or filled in as a default. + * + * @syscap SystemCapability.Global.I18n + * @since 8 + */ + /** + * The value requested using the Unicode extension key "nu" or filled in as a default. + * + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * The value requested using the Unicode extension key "nu" or filled in as a default. + * + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since 12 + */ + numberingSystem: string; + } + /** + * Given a Time period length value and a unit, RelativeTimeFormat object enables + * language-sensitive relative time formatting. + * + * @syscap SystemCapability.Global.I18n + * @since 8 + */ + /** + * Given a Time period length value and a unit, RelativeTimeFormat object enables + * language-sensitive relative time formatting. + * + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Given a Time period length value and a unit, RelativeTimeFormat object enables + * language-sensitive relative time formatting. + * + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since 12 + */ + export class RelativeTimeFormat { + /** + * A constructor used to create RelativeTimeFormat object. + * + * @syscap SystemCapability.Global.I18n + * @since 8 + */ + /** + * A constructor used to create RelativeTimeFormat object. + * + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * A constructor used to create RelativeTimeFormat object. + * + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since 12 + */ + constructor(); + /** + * A constructor used to create RelativeTimeFormat object. + * + * @param { string | Array } locale - Indicates a character string containing the locale information, including + * the language and optionally the script and region, for the RelativeTimeFormat object. + * @param { RelativeTimeFormatInputOptions } [options] - Indicates the options used to initialize RelativeTimeFormat object. + * @syscap SystemCapability.Global.I18n + * @since 8 + */ + /** + * A constructor used to create RelativeTimeFormat object. + * + * @param { string | Array } locale - Indicates a character string containing the locale information, including + * the language and optionally the script and region, for the RelativeTimeFormat object. + * @param { RelativeTimeFormatInputOptions } [options] - Indicates the options used to initialize RelativeTimeFormat object. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * A constructor used to create RelativeTimeFormat object. + * + * @param { string | Array } locale - Indicates a character string containing the locale information, including + * the language and optionally the script and region, for the RelativeTimeFormat object. + * @param { RelativeTimeFormatInputOptions } [options] - Indicates the options used to initialize RelativeTimeFormat object. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since 12 + */ + constructor(locale: string | Array, options?: RelativeTimeFormatInputOptions); + /** + * formats a value and unit according to the locale and formatting options of this object. + * + * @param { number } value - Numeric value to use in the internationalized relative time message. + * @param { string } unit - Unit to use in the relative time internationalized message. + * Possible values are: year, quarter, month, week, day, hour, minute, second. + * @returns { string } formatted language-sensitive relative time. + * @syscap SystemCapability.Global.I18n + * @since 8 + */ + /** + * formats a value and unit according to the locale and formatting options of this object. + * + * @param { number } value - Numeric value to use in the internationalized relative time message. + * @param { string } unit - Unit to use in the relative time internationalized message. + * Possible values are: year, quarter, month, week, day, hour, minute, second. + * @returns { string } formatted language-sensitive relative time. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * formats a value and unit according to the locale and formatting options of this object. + * + * @param { number } value - Numeric value to use in the internationalized relative time message. + * @param { string } unit - Unit to use in the relative time internationalized message. + * Possible values are: year, quarter, month, week, day, hour, minute, second. + * @returns { string } formatted language-sensitive relative time. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since 12 + */ + format(value: number, unit: string): string; + /** + * returns an Array of objects representing the relative time format in parts that can be used for + * custom locale-aware formatting + * + * @param { number } value - Numeric value to use in the internationalized relative time message. + * @param { string } unit - to use in the relative time internationalized message. + * Possible values are: year, quarter, month, week, day, hour, minute, second. + * @returns { Array } an Array of objects representing the relative time format in parts + * @syscap SystemCapability.Global.I18n + * @since 8 + */ + /** + * returns an Array of objects representing the relative time format in parts that can be used for + * custom locale-aware formatting + * + * @param { number } value - Numeric value to use in the internationalized relative time message. + * @param { string } unit - to use in the relative time internationalized message. + * Possible values are: year, quarter, month, week, day, hour, minute, second. + * @returns { Array } an Array of objects representing the relative time format in parts + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * returns an Array of objects representing the relative time format in parts that can be used for + * custom locale-aware formatting + * + * @param { number } value - Numeric value to use in the internationalized relative time message. + * @param { string } unit - to use in the relative time internationalized message. + * Possible values are: year, quarter, month, week, day, hour, minute, second. + * @returns { Array } an Array of objects representing the relative time format in parts + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since 12 + */ + formatToParts(value: number, unit: string): Array; + /** + * Returns a new object with properties that reflect the locale and formatting options computed during + * initialization of the object. + * + * @returns { RelativeTimeFormatResolvedOptions } RelativeTimeFormatOptions which reflect the locale and formatting options of the object. + * @syscap SystemCapability.Global.I18n + * @since 8 + */ + /** + * Returns a new object with properties that reflect the locale and formatting options computed during + * initialization of the object. + * + * @returns { RelativeTimeFormatResolvedOptions } RelativeTimeFormatOptions which reflect the locale and formatting options of the object. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @since 10 + */ + /** + * Returns a new object with properties that reflect the locale and formatting options computed during + * initialization of the object. + * + * @returns { RelativeTimeFormatResolvedOptions } RelativeTimeFormatOptions which reflect the locale and formatting options of the object. + * @syscap SystemCapability.Global.I18n + * @crossplatform + * @atomicservice + * @since 12 + */ + resolvedOptions(): RelativeTimeFormatResolvedOptions; + } +} +export default intl; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.matrix4.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.matrix4.d.ts new file mode 100755 index 00000000..0cd24f5e --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.matrix4.d.ts @@ -0,0 +1,993 @@ +/* + * Copyright (c) 2020-2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit ArkUI + */ +/** + * Used to do matrix operations + * + * @namespace matrix4 + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 7 + */ +/** + * Used to do matrix operations + * + * @namespace matrix4 + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 10 + */ +/** + * Used to do matrix operations + * + * @namespace matrix4 + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 11 + */ +declare namespace matrix4 { + /** + * Set translation parameters + * + * @interface TranslateOption + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 7 + */ + /** + * Set translation parameters + * + * @interface TranslateOption + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 10 + */ + /** + * Set translation parameters + * + * @interface TranslateOption + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 11 + */ + interface TranslateOption { + /** + * Indicates the translation distance of the x-axis, in px. + * + * @type { ?number } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 7 + */ + /** + * Indicates the translation distance of the x-axis, in px. + * + * @type { ?number } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 10 + */ + /** + * Indicates the translation distance of the x-axis, in px. + * + * @type { ?number } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 11 + */ + x?: number; + /** + * Indicates the translation distance of the y-axis, in px. + * + * @type { ?number } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 7 + */ + /** + * Indicates the translation distance of the y-axis, in px. + * + * @type { ?number } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 10 + */ + /** + * Indicates the translation distance of the y-axis, in px. + * + * @type { ?number } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 11 + */ + y?: number; + /** + * Indicates the translation distance of the z-axis, in px. + * + * @type { ?number } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 7 + */ + /** + * Indicates the translation distance of the z-axis, in px. + * + * @type { ?number } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 10 + */ + /** + * Indicates the translation distance of the z-axis, in px. + * + * @type { ?number } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 11 + */ + z?: number; + } + /** + * Set scaling parameters + * + * @interface ScaleOption + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 7 + */ + /** + * Set scaling parameters + * + * @interface ScaleOption + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 10 + */ + /** + * Set scaling parameters + * + * @interface ScaleOption + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 11 + */ + interface ScaleOption { + /** + * Zoom factor of the x-axis. + * + * @type { ?number } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 7 + */ + /** + * Zoom factor of the x-axis. + * + * @type { ?number } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 10 + */ + /** + * Zoom factor of the x-axis. + * + * @type { ?number } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 11 + */ + x?: number; + /** + * Zoom factor of the y-axis. + * + * @type { ?number } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 7 + */ + /** + * Zoom factor of the y-axis. + * + * @type { ?number } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 10 + */ + /** + * Zoom factor of the y-axis. + * + * @type { ?number } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 11 + */ + y?: number; + /** + * Zoom factor of the z-axis. + * + * @type { ?number } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 7 + */ + /** + * Zoom factor of the z-axis. + * + * @type { ?number } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 10 + */ + /** + * Zoom factor of the z-axis. + * + * @type { ?number } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 11 + */ + z?: number; + /** + * Transform the x-axis coordinate of the center point. + * + * @type { ?number } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 7 + */ + /** + * Transform the x-axis coordinate of the center point. + * + * @type { ?number } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 10 + */ + /** + * Transform the x-axis coordinate of the center point. + * + * @type { ?number } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 11 + */ + centerX?: number; + /** + * Transform the y-axis coordinate of the center point. + * + * @type { ?number } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 7 + */ + /** + * Transform the y-axis coordinate of the center point. + * + * @type { ?number } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 10 + */ + /** + * Transform the y-axis coordinate of the center point. + * + * @type { ?number } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 11 + */ + centerY?: number; + } + /** + * Set Rotation Parameters. + * + * @interface RotateOption + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 7 + */ + /** + * Set Rotation Parameters. + * + * @interface RotateOption + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 10 + */ + /** + * Set Rotation Parameters. + * + * @interface RotateOption + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 11 + */ + interface RotateOption { + /** + * Axis of rotation vector x coordinate. + * + * @type { ?number } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 7 + */ + /** + * Axis of rotation vector x coordinate. + * + * @type { ?number } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 10 + */ + /** + * Axis of rotation vector x coordinate. + * + * @type { ?number } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 11 + */ + x?: number; + /** + * Axis of rotation vector y coordinate. + * + * @type { ?number } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 7 + */ + /** + * Axis of rotation vector y coordinate. + * + * @type { ?number } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 10 + */ + /** + * Axis of rotation vector y coordinate. + * + * @type { ?number } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 11 + */ + y?: number; + /** + * Axis of rotation vector z coordinate. + * + * @type { ?number } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 7 + */ + /** + * Axis of rotation vector z coordinate. + * + * @type { ?number } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 10 + */ + /** + * Axis of rotation vector z coordinate. + * + * @type { ?number } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 11 + */ + z?: number; + /** + * Transform the x-axis coordinate of the center point. + * + * @type { ?number } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 7 + */ + /** + * Transform the x-axis coordinate of the center point. + * + * @type { ?number } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 10 + */ + /** + * Transform the x-axis coordinate of the center point. + * + * @type { ?number } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 11 + */ + centerX?: number; + /** + * Transform the y-axis coordinate of the center point. + * + * @type { ?number } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 7 + */ + /** + * Transform the y-axis coordinate of the center point. + * + * @type { ?number } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 10 + */ + /** + * Transform the y-axis coordinate of the center point. + * + * @type { ?number } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 11 + */ + centerY?: number; + /** + * Rotation angle. + * + * @type { ?number } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 7 + */ + /** + * Rotation angle. + * + * @type { ?number } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 10 + */ + /** + * Rotation angle. + * + * @type { ?number } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 11 + */ + angle?: number; + } + /** + * Set poly to poly point. + * + * @interface Point + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + export interface Point { + /** + * Point x. + * + * @type { number } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + x: number; + /** + * Point y. + * + * @type { number } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + y: number; + } + /** + * Set poly to poly point options. + * + * @interface PolyToPolyOptions + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + export interface PolyToPolyOptions { + /** + * Array of point coordinates for the source polygon. + * + * @type { Array } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + src: Array; + /** + * Start point index of the source polygon, which defaults to 0. + * @type { ?number } + * @default 0 + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + srcIndex?: number; + /** + * Array of point coordinates for the target polygon. + * + * @type { Array } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + dst: Array; + /** + * Start index of the target polygon, which defaults to 0. + * + * @type { ?number } + * @default src.Length/2 + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + dstIndex?: number; + /** + * The number of points to be used. + * If it is 0, it returns the identity matrix. + * If it is 1, it returns a translation matrix that changed before two points. + * If it is 2-4, it returns a transformation matrix. + * @type { ?number } + * @default 0 + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + pointCount?: number; + } + /** + * Matrix4Transit. + * + * @interface Matrix4Transit + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 7 + */ + /** + * Matrix4Transit. + * + * @interface Matrix4Transit + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 10 + */ + /** + * Matrix4Transit. + * + * @interface Matrix4Transit + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 11 + */ + interface Matrix4Transit { + /** + * Copy function of Matrix, which can copy a copy of the current matrix object. + * + * @returns { Matrix4Transit } Return to Matrix4Transit + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 7 + */ + /** + * Copy function of Matrix, which can copy a copy of the current matrix object. + * + * @returns { Matrix4Transit } Return to Matrix4Transit + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 10 + */ + /** + * Copy function of Matrix, which can copy a copy of the current matrix object. + * + * @returns { Matrix4Transit } Return to Matrix4Transit + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 11 + */ + copy(): Matrix4Transit; + /** + * The inverse function of Matrix returns an inverse matrix of the current matrix object, that is, the effect is exactly the opposite. + * + * @returns { Matrix4Transit } Return to Matrix4Transit + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 7 + */ + /** + * The inverse function of Matrix returns an inverse matrix of the current matrix object, that is, the effect is exactly the opposite. + * + * @returns { Matrix4Transit } Return to Matrix4Transit + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 10 + */ + /** + * The inverse function of Matrix returns an inverse matrix of the current matrix object, that is, the effect is exactly the opposite. + * + * @returns { Matrix4Transit } Return to Matrix4Transit + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 11 + */ + invert(): Matrix4Transit; + /** + * Matrix superposition function, which can superpose the effects of two matrices to generate a new matrix object. + * + * @param { Matrix4Transit } options + * @returns { Matrix4Transit } Return to Matrix4Transit + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 7 + */ + /** + * Matrix superposition function, which can superpose the effects of two matrices to generate a new matrix object. + * + * @param { Matrix4Transit } options + * @returns { Matrix4Transit } Return to Matrix4Transit + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 10 + */ + /** + * Matrix superposition function, which can superpose the effects of two matrices to generate a new matrix object. + * + * @param { Matrix4Transit } options + * @returns { Matrix4Transit } Return to Matrix4Transit + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 11 + */ + combine(options: Matrix4Transit): Matrix4Transit; + /** + * Matrix translation function, which can add the x-axis, Y-axis, or Z-axis translation effect to the current matrix. + * + * @param { TranslateOption } options + * @returns { Matrix4Transit } Return to Matrix4Transit + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 7 + */ + /** + * Matrix translation function, which can add the x-axis, Y-axis, or Z-axis translation effect to the current matrix. + * + * @param { TranslateOption } options + * @returns { Matrix4Transit } Return to Matrix4Transit + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 10 + */ + /** + * Matrix translation function, which can add the x-axis, Y-axis, or Z-axis translation effect to the current matrix. + * + * @param { TranslateOption } options + * @returns { Matrix4Transit } Return to Matrix4Transit + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 11 + */ + translate(options: TranslateOption): Matrix4Transit; + /** + * Scaling function of the Matrix, which can add the x-axis, Y-axis, or Z-axis scaling effect to the current matrix. + * + * @param { ScaleOption } options + * @returns { Matrix4Transit } Return to Matrix4Transit + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 7 + */ + /** + * Scaling function of the Matrix, which can add the x-axis, Y-axis, or Z-axis scaling effect to the current matrix. + * + * @param { ScaleOption } options + * @returns { Matrix4Transit } Return to Matrix4Transit + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 10 + */ + /** + * Scaling function of the Matrix, which can add the x-axis, Y-axis, or Z-axis scaling effect to the current matrix. + * + * @param { ScaleOption } options + * @returns { Matrix4Transit } Return to Matrix4Transit + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 11 + */ + scale(options: ScaleOption): Matrix4Transit; + /** + * Skew function of the Matrix, which can add the x-axis, y-axis skew effect to the current matrix. + * Skew function takes a generic point with coordinates (x0, y0, z0) to the point (x0 + x*y0, y0 + y*x0, z0), + * where x, y are fixed parameters, called the shear factors. + * + * @param { number } x - the shear factor of x-axis. + * @param { number } y - the shear factor of y-axis. + * @returns { Matrix4Transit } Return to Matrix4Transit + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + */ + skew(x: number, y: number): Matrix4Transit; + /** + * Rotation function of the Matrix. You can add the x-axis, Y-axis, or Z-axis rotation effect to the current matrix. + * + * @param { RotateOption } options + * @returns { Matrix4Transit } Return to Matrix4Transit + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 7 + */ + /** + * Rotation function of the Matrix. You can add the x-axis, Y-axis, or Z-axis rotation effect to the current matrix. + * + * @param { RotateOption } options + * @returns { Matrix4Transit } Return to Matrix4Transit + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 10 + */ + /** + * Rotation function of the Matrix. You can add the x-axis, Y-axis, or Z-axis rotation effect to the current matrix. + * + * @param { RotateOption } options + * @returns { Matrix4Transit } Return to Matrix4Transit + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 11 + */ + rotate(options: RotateOption): Matrix4Transit; + /** + * Matrix coordinate point conversion function, which can apply the current transformation effect to a coordinate point. + * + * @param { [number, number] } options + * @returns { [number, number] } Return to Matrix4Transit + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 7 + */ + /** + * Matrix coordinate point conversion function, which can apply the current transformation effect to a coordinate point. + * + * @param { [number, number] } options + * @returns { [number, number] } Return to Matrix4Transit + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 10 + */ + /** + * Matrix coordinate point conversion function, which can apply the current transformation effect to a coordinate point. + * + * @param { [number, number] } options + * @returns { [number, number] } Return to Matrix4Transit + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 11 + */ + transformPoint(options: [ + number, + number + ]): [ + number, + number + ]; + /** + * Sets matrix to map src to dst. + * + * @param { PolyToPolyOptions } options - polyToPoly options + * @returns { Matrix4Transit } Return to Matrix4Transit + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + */ + setPolyToPoly(options: PolyToPolyOptions): Matrix4Transit; + } + /** + * Constructor of Matrix, which can create a fourth-order matrix based on the input parameters. The matrix is column-first. + * + * @param { [number,number,number,number,number,number,number,number,number,number,number,number,number,number,number,number] } options + * options indicates a fourth-order matrix + * The default value: + * [1, 0, 0, 0, + * 0, 1, 0, 0, + * 0, 0, 1, 0, + * 0, 0, 0, 1] + * @returns { Matrix4Transit } Return to Matrix4Transit + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 7 + */ + /** + * Constructor of Matrix, which can create a fourth-order matrix based on the input parameters. The matrix is column-first. + * + * @param { [number,number,number,number,number,number,number,number,number,number,number,number,number,number,number,number] } options + * options indicates a fourth-order matrix + * The default value: + * [1, 0, 0, 0, + * 0, 1, 0, 0, + * 0, 0, 1, 0, + * 0, 0, 0, 1] + * @returns { Matrix4Transit } Return to Matrix4Transit + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 10 + */ + /** + * Constructor of Matrix, which can create a fourth-order matrix based on the input parameters. The matrix is column-first. + * + * @param { [number,number,number,number,number,number,number,number,number,number,number,number,number,number,number,number] } options + * options indicates a fourth-order matrix + * The default value: + * [1, 0, 0, 0, + * 0, 1, 0, 0, + * 0, 0, 1, 0, + * 0, 0, 0, 1] + * Fourth-order matrix notes: + * m00 { number } -The x-axis scale value, the identity matrix defaults to 1. + * m01 { number } -The second value, the rotation of the xyz axis affects this value. + * m02 { number } -The third value, the rotation of the xyz axis affects this value. + * m03 { number } -Meaningless. + * m10 { number } -The fifth value, the rotation of the xyz axis affects this value. + * m11 { number } -The y-axis scales the value, and the identity matrix defaults to 1. + * m12 { number } -The 7th value, the rotation of the xyz axis affects this value. + * m13 { number } -Meaningless. + * m20 { number } -The 9th value, the rotation of the xyz axis affects this value. + * m21 { number } -The 10th value, xyz axis rotation affects this value. + * m22 { number } -The z-axis scale value, the identity matrix defaults to 1. + * m23 { number } -Meaningless. + * m30 { number } -The x-axis translation value in px, the identity matrix defaults to 0. + * m31 { number } -Y-axis translation value, in px, the identity matrix defaults to 0. + * m32 { number } -The z-axis translation value in px, the identity matrix defaults to 0. + * m33 { number } -It takes effect in homogeneous coordinates to produce a perspective projection effect. + * @returns { Matrix4Transit } Return to Matrix4Transit + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 11 + */ + function init(options: [ + number, + number, + number, + number, + number, + number, + number, + number, + number, + number, + number, + number, + number, + number, + number, + number + ]): Matrix4Transit; + /** + * Matrix initialization function, which can return an identity matrix object. + * + * @returns { Matrix4Transit } Return to Matrix4Transit + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 7 + */ + /** + * Matrix initialization function, which can return an identity matrix object. + * + * @returns { Matrix4Transit } Return to Matrix4Transit + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 10 + */ + /** + * Matrix initialization function, which can return an identity matrix object. + * + * @returns { Matrix4Transit } Return to Matrix4Transit + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 11 + */ + function identity(): Matrix4Transit; + /** + * Copy function of Matrix, which can copy a copy of the current matrix object. + * + * @returns { Matrix4Transit } Return to Matrix4Transit + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 7 + * @deprecated since 10 + */ + function copy(): Matrix4Transit; + /** + * The inverse function of Matrix returns an inverse matrix of the current matrix object, that is, the effect is exactly the opposite. + * + * @returns { Matrix4Transit } Return to Matrix4Transit + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 7 + * @deprecated since 10 + */ + function invert(): Matrix4Transit; + /** + * Matrix superposition function, which can superpose the effects of two matrices to generate a new matrix object. + * + * @param { Matrix4Transit } options + * @returns { Matrix4Transit } Return to Matrix4Transit + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 7 + * @deprecated since 10 + */ + function combine(options: Matrix4Transit): Matrix4Transit; + /** + * Matrix translation function, which can add the x-axis, Y-axis, or Z-axis translation effect to the current matrix. + * + * @param { TranslateOption } options + * @returns { Matrix4Transit } Return to Matrix4Transit + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 7 + * @deprecated since 10 + */ + function translate(options: TranslateOption): Matrix4Transit; + /** + * Scaling function of the Matrix, which can add the x-axis, Y-axis, or Z-axis scaling effect to the current matrix. + * + * @param { ScaleOption } options + * @returns { Matrix4Transit } Return to Matrix4Transit + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 7 + * @deprecated since 10 + */ + function scale(options: ScaleOption): Matrix4Transit; + /** + * Rotation function of the Matrix. You can add the x-axis, Y-axis, or Z-axis rotation effect to the current matrix. + * + * @param { RotateOption } options + * @returns { Matrix4Transit } Return to Matrix4Transit + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 7 + * @deprecated since 10 + */ + function rotate(options: RotateOption): Matrix4Transit; + /** + * Matrix coordinate point conversion function, which can apply the current transformation effect to a coordinate point. + * + * @param { [number, number] } options + * @returns { [number, number] } Return to Matrix4Transit + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 7 + * @deprecated since 10 + */ + function transformPoint(options: [ + number, + number + ]): [ + number, + number + ]; +} +export default matrix4; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.measure.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.measure.d.ts new file mode 100755 index 00000000..8a878bf1 --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.measure.d.ts @@ -0,0 +1,383 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit ArkUI + */ + +/// +import { Resource } from 'GlobalResource'; +/** + * Defines the options of MeasureText. + * + * @interface MeasureOptions + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 9 + */ +/** + * Defines the options of MeasureText. + * + * @interface MeasureOptions + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ +/** + * Defines the options of MeasureText. + * + * @interface MeasureOptions + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ +export interface MeasureOptions { + /** + * Text to display. + * + * @type { string | Resource } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 9 + */ + /** + * Text to display. + * + * @type { string | Resource } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * Text to display. + * + * @type { string | Resource } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + textContent: string | Resource; + /** + * Text display area of width. + * + * @type { ?(number | string | Resource) } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * Text display area of width. + * + * @type { ?(number | string | Resource) } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + constraintWidth?: number | string | Resource; + /** + * Font Size. + * + * @type { ?(number | string | Resource) } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 9 + */ + /** + * Font Size. + * + * @type { ?(number | string | Resource) } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + fontSize?: number | string | Resource; + /** + * Font style. + * + * @type { ?(number | FontStyle) } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 9 + */ + /** + * Font style. + * + * @type { ?(number | FontStyle) } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + fontStyle?: number | FontStyle; + /** + * Font weight. + * + * @type { ?(number | string | FontWeight) } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 9 + */ + /** + * Font weight. + * + * @type { ?(number | string | FontWeight) } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + fontWeight?: number | string | FontWeight; + /** + * Font list of text. + * + * @type { ?(string | Resource) } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 9 + */ + /** + * Font list of text. + * + * @type { ?(string | Resource) } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + fontFamily?: string | Resource; + /** + * Distance between text fonts. + * + * @type { ?(number | string) } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 9 + */ + /** + * Distance between text fonts. + * + * @type { ?(number | string) } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + letterSpacing?: number | string; + /** + * Alignment of text. + * + * @type { ?(number | TextAlign) } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * Alignment of text. + * + * @type { ?(number | TextAlign) } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + textAlign?: number | TextAlign; + /** + * Overflow mode of the font. + * + * @type { ?(number | TextOverflow) } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * Overflow mode of the font. + * + * @type { ?(number | TextOverflow) } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + overflow?: number | TextOverflow; + /** + * Maximum number of lines of text. + * + * @type { ?number } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * Maximum number of lines of text. + * + * @type { ?number } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + maxLines?: number; + /** + * Vertical center mode of the font. + * + * @type { ?(number | string | Resource) } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * Vertical center mode of the font. + * + * @type { ?(number | string | Resource) } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + lineHeight?: number | string | Resource; + /** + * Baseline offset. + * + * @type { ?(number | string) } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * Baseline offset. + * + * @type { ?(number | string) } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + baselineOffset?: number | string; + /** + * Type of letter in the text font + * + * @type { ?(number | TextCase) } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * Type of letter in the text font + * + * @type { ?(number | TextCase) } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + textCase?: number | TextCase; + /** + * Specify the indentation of the first line in a text-block. + * + * @type { ?(number | string) } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * Specify the indentation of the first line in a text-block. + * + * @type { ?(number | string) } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + textIndent?: number | string; + /** + * Set the word break type. + * + * @type { ?WordBreak } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * Set the word break type. + * + * @type { ?WordBreak } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + wordBreak?: WordBreak; +} +/** + * Defines the Measure interface. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 9 + */ +/** + * Defines the Measure interface. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ +export default class MeasureText { + /** + * Displays the textWidth. + * + * @param { MeasureOptions } options - Options. + * @returns { number } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 9 + */ + /** + * Displays the textWidth. + * + * @param { MeasureOptions } options - Options. + * @returns { number } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * Displays the textWidth. + * + * @param { MeasureOptions } options - Options. + * @returns { number } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + static measureText(options: MeasureOptions): number; + /** + * Displays the text width and height. + * + * @param { MeasureOptions } options - Options of measure area occupied by text. + * @returns { SizeOptions } width and height for text to display \ + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 10 + */ + /** + * Displays the text width and height. + * + * @param { MeasureOptions } options - Options of measure area occupied by text. + * @returns { SizeOptions } width and height for text to display \ + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 11 + */ + /** + * Displays the text width and height. + * + * @param { MeasureOptions } options - Options of measure area occupied by text. + * @returns { SizeOptions } width and height for text to display \ + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + static measureTextSize(options: MeasureOptions): SizeOptions; +} diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.mediaquery.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.mediaquery.d.ts new file mode 100755 index 00000000..e58ad4ec --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.mediaquery.d.ts @@ -0,0 +1,336 @@ +/* + * Copyright (c) 2021-2023 +Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit ArkUI + */ +import { Callback } from './@ohos.base'; +/** + * Used to do mediaquery operations. + * + * @namespace mediaquery + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 7 + */ +/** + * Used to do mediaquery operations. + * + * @namespace mediaquery + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 10 + */ +/** + * Used to do mediaquery operations. + * + * @namespace mediaquery + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 11 + */ +/** + * Used to do mediaquery operations. + * + * @namespace mediaquery + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @form + * @atomicservice + * @since 12 + */ +declare namespace mediaquery { + /** + * Defines the Result of mediaquery. + * + * @interface MediaQueryResult + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 7 + */ + /** + * Defines the Result of mediaquery. + * + * @interface MediaQueryResult + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 10 + */ + /** + * Defines the Result of mediaquery. + * + * @interface MediaQueryResult + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 11 + */ + /** + * Defines the Result of mediaquery. + * + * @interface MediaQueryResult + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @form + * @atomicservice + * @since 12 + */ + interface MediaQueryResult { + /** + * Whether the match condition is met. + * This parameter is read-only. + * + * @type { boolean } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 7 + */ + /** + * Whether the match condition is met. + * This parameter is read-only. + * + * @type { boolean } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 10 + */ + /** + * Whether the match condition is met. + * This parameter is read-only. + * + * @type { boolean } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 11 + */ + /** + * Whether the match condition is met. + * This parameter is read-only. + * + * @type { boolean } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @form + * @atomicservice + * @since 12 + */ + readonly matches: boolean; + /** + * Matching condition of a media event. + * This parameter is read-only. + * + * @type { string } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 7 + */ + /** + * Matching condition of a media event. + * This parameter is read-only. + * + * @type { string } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 10 + */ + /** + * Matching condition of a media event. + * This parameter is read-only. + * + * @type { string } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 11 + */ + /** + * Matching condition of a media event. + * This parameter is read-only. + * + * @type { string } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @form + * @atomicservice + * @since 12 + */ + readonly media: string; + } + /** + * Defines the Listener of mediaquery. + * + * @interface MediaQueryListener + * @extends MediaQueryResult + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 7 + */ + /** + * Defines the Listener of mediaquery. + * + * @interface MediaQueryListener + * @extends MediaQueryResult + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 10 + */ + /** + * Defines the Listener of mediaquery. + * + * @interface MediaQueryListener + * @extends MediaQueryResult + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 11 + */ + /** + * Defines the Listener of mediaquery. + * + * @interface MediaQueryListener + * @extends MediaQueryResult + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @form + * @atomicservice + * @since 12 + */ + interface MediaQueryListener extends MediaQueryResult { + /** + * Registers a callback with the corresponding query condition by using the handle. + * This callback is triggered when the media attributes change. + * + * @param { 'change' } type + * @param { Callback } callback + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 7 + */ + /** + * Registers a callback with the corresponding query condition by using the handle. + * This callback is triggered when the media attributes change. + * + * @param { 'change' } type + * @param { Callback } callback + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 10 + */ + /** + * Registers a callback with the corresponding query condition by using the handle. + * This callback is triggered when the media attributes change. + * + * @param { 'change' } type + * @param { Callback } callback + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 11 + */ + /** + * Registers a callback with the corresponding query condition by using the handle. + * This callback is triggered when the media attributes change. + * + * @param { 'change' } type + * @param { Callback } callback + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @form + * @atomicservice + * @since 12 + */ + on(type: 'change', callback: Callback): void; + /** + * Deregisters a callback with the corresponding query condition by using the handle. + * This callback is not triggered when the media attributes chang. + * + * @param { 'change' } type + * @param { Callback } callback + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 7 + */ + /** + * Deregisters a callback with the corresponding query condition by using the handle. + * This callback is not triggered when the media attributes chang. + * + * @param { 'change' } type + * @param { Callback } callback + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 10 + */ + /** + * Deregisters a callback with the corresponding query condition by using the handle. + * This callback is not triggered when the media attributes chang. + * + * @param { 'change' } type + * @param { Callback } callback + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 11 + */ + /** + * Deregisters a callback with the corresponding query condition by using the handle. + * This callback is not triggered when the media attributes chang. + * + * @param { 'change' } type + * @param { Callback } callback + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @form + * @atomicservice + * @since 12 + */ + off(type: 'change', callback?: Callback): void; + } + /** + * Sets the media query criteria and returns the corresponding listening handle + * + * @param { string } condition + * @returns { MediaQueryListener } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 7 + */ + /** + * Sets the media query criteria and returns the corresponding listening handle + * + * @param { string } condition + * @returns { MediaQueryListener } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 10 + */ + /** + * Sets the media query criteria and returns the corresponding listening handle + * + * @param { string } condition + * @returns { MediaQueryListener } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 11 + */ + /** + * Sets the media query criteria and returns the corresponding listening handle + * + * @param { string } condition + * @returns { MediaQueryListener } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @form + * @atomicservice + * @since 12 + */ + function matchMediaSync(condition: string): MediaQueryListener; +} +export default mediaquery; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.multimedia.audio.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.multimedia.audio.d.ts new file mode 100755 index 00000000..5ad2e69c --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.multimedia.audio.d.ts @@ -0,0 +1,4694 @@ +/* + * Copyright (c) 2021-2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit AudioKit + */ +import { AsyncCallback, Callback } from './@ohos.base'; +/** + * @namespace audio + * @since 7 + */ +/** + * @namespace audio + * @atomicservice + * @since 12 + */ +declare namespace audio { + /** + * Enumerates audio errors. + * @enum {number} + * @syscap SystemCapability.Multimedia.Audio.Core + * @since 9 + */ + enum AudioErrors { + /** + * Invalid parameter. + * @syscap SystemCapability.Multimedia.Audio.Core + * @since 9 + */ + ERROR_INVALID_PARAM = 6800101, + /** + * Allocate memory failed. + * @syscap SystemCapability.Multimedia.Audio.Core + * @since 9 + */ + ERROR_NO_MEMORY = 6800102, + /** + * Operation not permit at current state. + * @syscap SystemCapability.Multimedia.Audio.Core + * @since 9 + */ + ERROR_ILLEGAL_STATE = 6800103, + /** + * Unsupported option. + * @syscap SystemCapability.Multimedia.Audio.Core + * @since 9 + */ + ERROR_UNSUPPORTED = 6800104, + /** + * Time out. + * @syscap SystemCapability.Multimedia.Audio.Core + * @since 9 + */ + ERROR_TIMEOUT = 6800105, + /** + * Audio specific errors. + * @syscap SystemCapability.Multimedia.Audio.Core + * @since 9 + */ + ERROR_STREAM_LIMIT = 6800201, + /** + * Default error. + * @syscap SystemCapability.Multimedia.Audio.Core + * @since 9 + */ + ERROR_SYSTEM = 6800301 + } + /** + * Define default volume group id for audio + * @constant + * @syscap SystemCapability.Multimedia.Audio.Volume + * @since 9 + */ + const DEFAULT_VOLUME_GROUP_ID: number; + /** + * Define default interrupt group id for audio + * @constant + * @syscap SystemCapability.Multimedia.Audio.Interrupt + * @since 9 + */ + const DEFAULT_INTERRUPT_GROUP_ID: number; + /** + * Obtains an {@link AudioManager} instance. + * @returns { AudioManager } this {@link AudioManager} object. + * @syscap SystemCapability.Multimedia.Audio.Core + * @since 7 + */ + function getAudioManager(): AudioManager; + /** + * Obtains an {@link AudioCapturer} instance. This method uses an asynchronous callback to return the capturer instance. + * @param { AudioCapturerOptions } options - Capturer configurations. + * @param { AsyncCallback } callback - Callback used to return the audio capturer instance. + * @syscap SystemCapability.Multimedia.Audio.Capturer + * @since 8 + */ + function createAudioCapturer(options: AudioCapturerOptions, callback: AsyncCallback): void; + /** + * Obtains an {@link AudioCapturer} instance. This method uses a promise to return the capturer instance. + * @param { AudioCapturerOptions } options - Capturer configurations. + * @returns { Promise } Promise used to return the audio capturer instance. + * @syscap SystemCapability.Multimedia.Audio.Capturer + * @since 8 + */ + function createAudioCapturer(options: AudioCapturerOptions): Promise; + /** + * Obtains an {@link AudioRenderer} instance. This method uses an asynchronous callback to return the renderer instance. + * @param { AudioRendererOptions } options - Renderer configurations. + * @param { AsyncCallback } callback - Callback used to return the audio renderer instance. + * @syscap SystemCapability.Multimedia.Audio.Renderer + * @since 8 + */ + function createAudioRenderer(options: AudioRendererOptions, callback: AsyncCallback): void; + /** + * Obtains an {@link AudioRenderer} instance. This method uses a promise to return the renderer instance. + * @param { AudioRendererOptions } options - Renderer configurations. + * @returns { Promise } Promise used to return the audio renderer instance. + * @syscap SystemCapability.Multimedia.Audio.Renderer + * @since 8 + */ + function createAudioRenderer(options: AudioRendererOptions): Promise; + /** + * Enumerates the audio states. + * @enum { number } + * @syscap SystemCapability.Multimedia.Audio.Core + * @since 8 + */ + enum AudioState { + /** + * Invalid state. + * @syscap SystemCapability.Multimedia.Audio.Core + * @since 8 + */ + STATE_INVALID = -1, + /** + * Create new instance state. + * @syscap SystemCapability.Multimedia.Audio.Core + * @since 8 + */ + STATE_NEW = 0, + /** + * Prepared state. + * @syscap SystemCapability.Multimedia.Audio.Core + * @since 8 + */ + STATE_PREPARED = 1, + /** + * Running state. + * @syscap SystemCapability.Multimedia.Audio.Core + * @since 8 + */ + STATE_RUNNING = 2, + /** + * Stopped state. + * @syscap SystemCapability.Multimedia.Audio.Core + * @since 8 + */ + STATE_STOPPED = 3, + /** + * Released state. + * @syscap SystemCapability.Multimedia.Audio.Core + * @since 8 + */ + STATE_RELEASED = 4, + /** + * Paused state. + * @syscap SystemCapability.Multimedia.Audio.Core + * @since 8 + */ + STATE_PAUSED = 5 + } + /** + * Enumerates audio stream types. + * @enum { number } + * @syscap SystemCapability.Multimedia.Audio.Volume + * @since 7 + */ + enum AudioVolumeType { + /** + * Audio streams for voice calls. + * @syscap SystemCapability.Multimedia.Audio.Volume + * @since 8 + */ + VOICE_CALL = 0, + /** + * Audio streams for ringtones. + * @syscap SystemCapability.Multimedia.Audio.Volume + * @since 7 + */ + RINGTONE = 2, + /** + * Audio streams for media purpose. + * @syscap SystemCapability.Multimedia.Audio.Volume + * @since 7 + */ + MEDIA = 3, + /** + * Audio volume for alarm purpose. + * @syscap SystemCapability.Multimedia.Audio.Volume + * @since 10 + */ + ALARM = 4, + /** + * Audio volume for accessibility purpose. + * @syscap SystemCapability.Multimedia.Audio.Volume + * @since 10 + */ + ACCESSIBILITY = 5, + /** + * Audio stream for voice assistant. + * @syscap SystemCapability.Multimedia.Audio.Volume + * @since 8 + */ + VOICE_ASSISTANT = 9 + } + /** + * Enumerates audio device flags. + * @enum { number } + * @syscap SystemCapability.Multimedia.Audio.Device + * @since 7 + */ + enum DeviceFlag { + /** + * Output devices. + * @syscap SystemCapability.Multimedia.Audio.Device + * @since 7 + */ + OUTPUT_DEVICES_FLAG = 1, + /** + * Input devices. + * @syscap SystemCapability.Multimedia.Audio.Device + * @since 7 + */ + INPUT_DEVICES_FLAG = 2, + /** + * All devices. + * @syscap SystemCapability.Multimedia.Audio.Device + * @since 7 + */ + ALL_DEVICES_FLAG = 3 + } + /** + * Enumerates device roles. + * @enum { number } + * @syscap SystemCapability.Multimedia.Audio.Device + * @since 7 + */ + /** + * Enumerates device roles. + * @enum { number } + * @syscap SystemCapability.Multimedia.Audio.Device + * @atomicservice + * @since 12 + */ + enum DeviceRole { + /** + * Input role. + * @syscap SystemCapability.Multimedia.Audio.Device + * @since 7 + */ + /** + * Input role. + * @syscap SystemCapability.Multimedia.Audio.Device + * @atomicservice + * @since 12 + */ + INPUT_DEVICE = 1, + /** + * Output role. + * @syscap SystemCapability.Multimedia.Audio.Device + * @since 7 + */ + /** + * Output role. + * @syscap SystemCapability.Multimedia.Audio.Device + * @atomicservice + * @since 12 + */ + OUTPUT_DEVICE = 2 + } + /** + * Enumerates device types. + * @enum { number } + * @syscap SystemCapability.Multimedia.Audio.Device + * @since 7 + */ + /** + * Enumerates device types. + * @enum { number } + * @syscap SystemCapability.Multimedia.Audio.Device + * @atomicservice + * @since 12 + */ + enum DeviceType { + /** + * Invalid device. + * @syscap SystemCapability.Multimedia.Audio.Device + * @since 7 + */ + /** + * Invalid device. + * @syscap SystemCapability.Multimedia.Audio.Device + * @atomicservice + * @since 12 + */ + INVALID = 0, + /** + * Built-in earpiece. + * @syscap SystemCapability.Multimedia.Audio.Device + * @since 7 + */ + /** + * Built-in earpiece. + * @syscap SystemCapability.Multimedia.Audio.Device + * @atomicservice + * @since 12 + */ + EARPIECE = 1, + /** + * Built-in speaker. + * @syscap SystemCapability.Multimedia.Audio.Device + * @since 7 + */ + /** + * Built-in speaker. + * @syscap SystemCapability.Multimedia.Audio.Device + * @atomicservice + * @since 12 + */ + SPEAKER = 2, + /** + * Wired headset, which is a combination of a pair of earpieces and a microphone. + * @syscap SystemCapability.Multimedia.Audio.Device + * @since 7 + */ + /** + * Wired headset, which is a combination of a pair of earpieces and a microphone. + * @syscap SystemCapability.Multimedia.Audio.Device + * @atomicservice + * @since 12 + */ + WIRED_HEADSET = 3, + /** + * A pair of wired headphones. + * @syscap SystemCapability.Multimedia.Audio.Device + * @since 7 + */ + /** + * A pair of wired headphones. + * @syscap SystemCapability.Multimedia.Audio.Device + * @atomicservice + * @since 12 + */ + WIRED_HEADPHONES = 4, + /** + * Bluetooth device using the synchronous connection oriented link (SCO). + * @syscap SystemCapability.Multimedia.Audio.Device + * @since 7 + */ + /** + * Bluetooth device using the synchronous connection oriented link (SCO). + * @syscap SystemCapability.Multimedia.Audio.Device + * @atomicservice + * @since 12 + */ + BLUETOOTH_SCO = 7, + /** + * Bluetooth device using advanced audio distribution profile (A2DP). + * @syscap SystemCapability.Multimedia.Audio.Device + * @since 7 + */ + /** + * Bluetooth device using advanced audio distribution profile (A2DP). + * @syscap SystemCapability.Multimedia.Audio.Device + * @atomicservice + * @since 12 + */ + BLUETOOTH_A2DP = 8, + /** + * Built-in microphone. + * @syscap SystemCapability.Multimedia.Audio.Device + * @since 7 + */ + /** + * Built-in microphone. + * @syscap SystemCapability.Multimedia.Audio.Device + * @atomicservice + * @since 12 + */ + MIC = 15, + /** + * USB audio headset. + * @syscap SystemCapability.Multimedia.Audio.Device + * @since 7 + */ + /** + * USB audio headset. + * @syscap SystemCapability.Multimedia.Audio.Device + * @atomicservice + * @since 12 + */ + USB_HEADSET = 22, + /** + * Display port device. + * @syscap SystemCapability.Multimedia.Audio.Device + * @atomicservice + * @since 12 + */ + DISPLAY_PORT = 23, + /** + * Device type for rerouting audio to other remote devices by system application + * @syscap SystemCapability.Multimedia.Audio.Device + * @atomicservice + * @since 12 + */ + REMOTE_CAST = 24, + /** + * Default device type. + * @syscap SystemCapability.Multimedia.Audio.Device + * @since 9 + */ + /** + * Default device type. + * @syscap SystemCapability.Multimedia.Audio.Device + * @atomicservice + * @since 12 + */ + DEFAULT = 1000 + } + /** + * Enumerates the active device types. + * @enum { number } + * @syscap SystemCapability.Multimedia.Audio.Device + * @since 7 + * @deprecated since 9 + * @useinstead ohos.multimedia.audio.CommunicationDeviceType + */ + enum ActiveDeviceType { + /** + * Speaker. + * @syscap SystemCapability.Multimedia.Audio.Device + * @since 7 + * @deprecated since 9 + * @useinstead ohos.multimedia.audio.CommunicationDeviceType.SPEAKER + */ + SPEAKER = 2, + /** + * Bluetooth device using the SCO link. + * @syscap SystemCapability.Multimedia.Audio.Device + * @since 7 + * @deprecated since 9 + */ + BLUETOOTH_SCO = 7 + } + /** + * Enumerates the available device types for communication. + * @enum { number } + * @syscap SystemCapability.Multimedia.Audio.Communication + * @since 9 + */ + enum CommunicationDeviceType { + /** + * Speaker. + * @syscap SystemCapability.Multimedia.Audio.Communication + * @since 9 + */ + SPEAKER = 2 + } + /** + * Enumerates ringer modes. + * @enum { number } + * @syscap SystemCapability.Multimedia.Audio.Communication + * @since 7 + */ + enum AudioRingMode { + /** + * Silent mode. + * @syscap SystemCapability.Multimedia.Audio.Communication + * @since 7 + */ + RINGER_MODE_SILENT = 0, + /** + * Vibration mode. + * @syscap SystemCapability.Multimedia.Audio.Communication + * @since 7 + */ + RINGER_MODE_VIBRATE = 1, + /** + * Normal mode. + * @syscap SystemCapability.Multimedia.Audio.Communication + * @since 7 + */ + RINGER_MODE_NORMAL = 2 + } + /** + * Enumerates the audio sample formats. + * @enum { number } + * @syscap SystemCapability.Multimedia.Audio.Core + * @since 8 + */ + enum AudioSampleFormat { + /** + * Invalid format. + * @syscap SystemCapability.Multimedia.Audio.Core + * @since 8 + */ + SAMPLE_FORMAT_INVALID = -1, + /** + * Unsigned 8 format. + * @syscap SystemCapability.Multimedia.Audio.Core + * @since 8 + */ + SAMPLE_FORMAT_U8 = 0, + /** + * Signed 16 bit integer, little endian. + * @syscap SystemCapability.Multimedia.Audio.Core + * @since 8 + */ + SAMPLE_FORMAT_S16LE = 1, + /** + * Signed 24 bit integer, little endian. + * @syscap SystemCapability.Multimedia.Audio.Core + * @since 8 + */ + SAMPLE_FORMAT_S24LE = 2, + /** + * Signed 32 bit integer, little endian. + * @syscap SystemCapability.Multimedia.Audio.Core + * @since 8 + */ + SAMPLE_FORMAT_S32LE = 3, + /** + * Signed 32 bit float, little endian. + * @syscap SystemCapability.Multimedia.Audio.Core + * @since 9 + */ + SAMPLE_FORMAT_F32LE = 4 + } + /** + * Enumerates the audio channel. + * @enum { number } + * @syscap SystemCapability.Multimedia.Audio.Core + * @since 8 + */ + enum AudioChannel { + /** + * Channel 1. + * @syscap SystemCapability.Multimedia.Audio.Core + * @since 8 + */ + CHANNEL_1 = 0x1 << 0, + /** + * Channel 2. + * @syscap SystemCapability.Multimedia.Audio.Core + * @since 8 + */ + CHANNEL_2 = 0x1 << 1, + /** + * Channel 3. + * @syscap SystemCapability.Multimedia.Audio.Core + * @since 11 + */ + CHANNEL_3 = 3, + /** + * Channel 4. + * @syscap SystemCapability.Multimedia.Audio.Core + * @since 11 + */ + CHANNEL_4 = 4, + /** + * Channel 5. + * @syscap SystemCapability.Multimedia.Audio.Core + * @since 11 + */ + CHANNEL_5 = 5, + /** + * Channel 6. + * @syscap SystemCapability.Multimedia.Audio.Core + * @since 11 + */ + CHANNEL_6 = 6, + /** + * Channel 7. + * @syscap SystemCapability.Multimedia.Audio.Core + * @since 11 + */ + CHANNEL_7 = 7, + /** + * Channel 8. + * @syscap SystemCapability.Multimedia.Audio.Core + * @since 11 + */ + CHANNEL_8 = 8, + /** + * Channel 9. + * @syscap SystemCapability.Multimedia.Audio.Core + * @since 11 + */ + CHANNEL_9 = 9, + /** + * Channel 10. + * @syscap SystemCapability.Multimedia.Audio.Core + * @since 11 + */ + CHANNEL_10 = 10, + /** + * Channel 12. + * @syscap SystemCapability.Multimedia.Audio.Core + * @since 11 + */ + CHANNEL_12 = 12, + /** + * Channel 14. + * @syscap SystemCapability.Multimedia.Audio.Core + * @since 11 + */ + CHANNEL_14 = 14, + /** + * Channel 16. + * @syscap SystemCapability.Multimedia.Audio.Core + * @since 11 + */ + CHANNEL_16 = 16 + } + /** + * Enumerates the audio sampling rate. + * @enum { number } + * @syscap SystemCapability.Multimedia.Audio.Core + * @since 8 + */ + enum AudioSamplingRate { + /** + * 8kHz sample rate. + * @syscap SystemCapability.Multimedia.Audio.Core + * @since 8 + */ + SAMPLE_RATE_8000 = 8000, + /** + * 11.025kHz sample rate. + * @syscap SystemCapability.Multimedia.Audio.Core + * @since 8 + */ + SAMPLE_RATE_11025 = 11025, + /** + * 12kHz sample rate. + * @syscap SystemCapability.Multimedia.Audio.Core + * @since 8 + */ + SAMPLE_RATE_12000 = 12000, + /** + * 16kHz sample rate. + * @syscap SystemCapability.Multimedia.Audio.Core + * @since 8 + */ + SAMPLE_RATE_16000 = 16000, + /** + * 22.05kHz sample rate. + * @syscap SystemCapability.Multimedia.Audio.Core + * @since 8 + */ + SAMPLE_RATE_22050 = 22050, + /** + * 24kHz sample rate. + * @syscap SystemCapability.Multimedia.Audio.Core + * @since 8 + */ + SAMPLE_RATE_24000 = 24000, + /** + * 32kHz sample rate. + * @syscap SystemCapability.Multimedia.Audio.Core + * @since 8 + */ + SAMPLE_RATE_32000 = 32000, + /** + * 44.1kHz sample rate. + * @syscap SystemCapability.Multimedia.Audio.Core + * @since 8 + */ + SAMPLE_RATE_44100 = 44100, + /** + * 48kHz sample rate. + * @syscap SystemCapability.Multimedia.Audio.Core + * @since 8 + */ + SAMPLE_RATE_48000 = 48000, + /** + * 64kHz sample rate. + * @syscap SystemCapability.Multimedia.Audio.Core + * @since 8 + */ + SAMPLE_RATE_64000 = 64000, + /** + * 88.2kHz sample rate. + * @syscap SystemCapability.Multimedia.Audio.Core + * @since 12 + */ + SAMPLE_RATE_88200 = 88200, + /** + * 96kHz sample rate. + * @syscap SystemCapability.Multimedia.Audio.Core + * @since 8 + */ + SAMPLE_RATE_96000 = 96000, + /** + * 176.4kHz sample rate. + * @syscap SystemCapability.Multimedia.Audio.Core + * @since 12 + */ + SAMPLE_RATE_176400 = 176400, + /** + * 192kHz sample rate. + * @syscap SystemCapability.Multimedia.Audio.Core + * @since 12 + */ + SAMPLE_RATE_192000 = 192000 + } + /** + * Enumerates the audio encoding type. + * @enum { number } + * @syscap SystemCapability.Multimedia.Audio.Core + * @since 8 + */ + /** + * Enumerates the audio encoding type. + * @enum { number } + * @syscap SystemCapability.Multimedia.Audio.Core + * @atomicservice + * @since 12 + */ + enum AudioEncodingType { + /** + * Invalid type. + * @syscap SystemCapability.Multimedia.Audio.Core + * @since 8 + */ + /** + * Invalid type. + * @syscap SystemCapability.Multimedia.Audio.Core + * @atomicservice + * @since 12 + */ + ENCODING_TYPE_INVALID = -1, + /** + * PCM encoding. + * @syscap SystemCapability.Multimedia.Audio.Core + * @since 8 + */ + /** + * PCM encoding. + * @syscap SystemCapability.Multimedia.Audio.Core + * @atomicservice + * @since 12 + */ + ENCODING_TYPE_RAW = 0 + } + /** + * Enumerates the audio content type. + * @enum { number } + * @syscap SystemCapability.Multimedia.Audio.Core + * @since 7 + * @deprecated since 10 + * @useinstead ohos.multimedia.audio.StreamUsage + */ + enum ContentType { + /** + * Unknown content. + * @syscap SystemCapability.Multimedia.Audio.Core + * @since 7 + * @deprecated since 10 + * @useinstead ohos.multimedia.audio.StreamUsage.STREAM_USAGE_UNKNOWN + */ + CONTENT_TYPE_UNKNOWN = 0, + /** + * Speech content. + * @syscap SystemCapability.Multimedia.Audio.Core + * @since 7 + * @deprecated since 10 + * @useinstead ohos.multimedia.audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION + */ + CONTENT_TYPE_SPEECH = 1, + /** + * Music content. + * @syscap SystemCapability.Multimedia.Audio.Core + * @since 7 + * @deprecated since 10 + * @useinstead ohos.multimedia.audio.StreamUsage.STREAM_USAGE_MUSIC + */ + CONTENT_TYPE_MUSIC = 2, + /** + * Movie content. + * @syscap SystemCapability.Multimedia.Audio.Core + * @since 7 + * @deprecated since 10 + * @useinstead ohos.multimedia.audio.StreamUsage.STREAM_USAGE_MOVIE + */ + CONTENT_TYPE_MOVIE = 3, + /** + * Notification content. + * @syscap SystemCapability.Multimedia.Audio.Core + * @since 7 + * @deprecated since 10 + * @useinstead ohos.multimedia.audio.StreamUsage.STREAM_USAGE_NOTIFICATION + */ + CONTENT_TYPE_SONIFICATION = 4, + /** + * Ringtone content. + * @syscap SystemCapability.Multimedia.Audio.Core + * @since 8 + * @deprecated since 10 + * @useinstead ohos.multimedia.audio.StreamUsage.STREAM_USAGE_RINGTONE + */ + CONTENT_TYPE_RINGTONE = 5 + } + /** + * Enumerates the stream usage. + * @enum { number } + * @syscap SystemCapability.Multimedia.Audio.Core + * @since 7 + */ + /** + * Enumerates the stream usage. + * @enum { number } + * @syscap SystemCapability.Multimedia.Audio.Core + * @atomicservice + * @since 12 + */ + enum StreamUsage { + /** + * Unknown usage. + * @syscap SystemCapability.Multimedia.Audio.Core + * @since 7 + */ + /** + * Unknown usage. + * @syscap SystemCapability.Multimedia.Audio.Core + * @atomicservice + * @since 12 + */ + STREAM_USAGE_UNKNOWN = 0, + /** + * Media usage. + * @syscap SystemCapability.Multimedia.Audio.Core + * @since 7 + * @deprecated since 10 + * @useinstead ohos.multimedia.audio.StreamUsage.STREAM_USAGE_MUSIC or + * ohos.multimedia.audio.StreamUsage.STREAM_USAGE_MOVIE or + * ohos.multimedia.audio.StreamUsage.STREAM_USAGE_GAME or + * ohos.multimedia.audio.StreamUsage.STREAM_USAGE_AUDIOBOOK + */ + STREAM_USAGE_MEDIA = 1, + /** + * Music usage. + * @syscap SystemCapability.Multimedia.Audio.Core + * @since 10 + */ + /** + * Music usage. + * @syscap SystemCapability.Multimedia.Audio.Core + * @atomicservice + * @since 12 + */ + STREAM_USAGE_MUSIC = 1, + /** + * Voice communication usage. + * @syscap SystemCapability.Multimedia.Audio.Core + * @since 7 + */ + /** + * Voice communication usage. + * @syscap SystemCapability.Multimedia.Audio.Core + * @atomicservice + * @since 12 + */ + STREAM_USAGE_VOICE_COMMUNICATION = 2, + /** + * Voice assistant broadcast usage. + * @syscap SystemCapability.Multimedia.Audio.Core + * @since 9 + */ + /** + * Voice assistant broadcast usage. + * @syscap SystemCapability.Multimedia.Audio.Core + * @atomicservice + * @since 12 + */ + STREAM_USAGE_VOICE_ASSISTANT = 3, + /** + * Alarm usage. + * @syscap SystemCapability.Multimedia.Audio.Core + * @since 10 + */ + /** + * Alarm usage. + * @syscap SystemCapability.Multimedia.Audio.Core + * @atomicservice + * @since 12 + */ + STREAM_USAGE_ALARM = 4, + /** + * Voice message usage. + * @syscap SystemCapability.Multimedia.Audio.Core + * @since 10 + */ + /** + * Voice message usage. + * @syscap SystemCapability.Multimedia.Audio.Core + * @atomicservice + * @since 12 + */ + STREAM_USAGE_VOICE_MESSAGE = 5, + /** + * Notification or ringtone usage. + * @syscap SystemCapability.Multimedia.Audio.Core + * @since 7 + * @deprecated since 10 + * @useinstead ohos.multimedia.audio.StreamUsage.STREAM_USAGE_RINGTONE + */ + STREAM_USAGE_NOTIFICATION_RINGTONE = 6, + /** + * Ringtone usage. + * @syscap SystemCapability.Multimedia.Audio.Core + * @since 10 + */ + /** + * Ringtone usage. + * @syscap SystemCapability.Multimedia.Audio.Core + * @atomicservice + * @since 12 + */ + STREAM_USAGE_RINGTONE = 6, + /** + * Notification usage. + * @syscap SystemCapability.Multimedia.Audio.Core + * @since 10 + */ + /** + * Notification usage. + * @syscap SystemCapability.Multimedia.Audio.Core + * @atomicservice + * @since 12 + */ + STREAM_USAGE_NOTIFICATION = 7, + /** + * Accessibility usage, such as screen reader. + * @syscap SystemCapability.Multimedia.Audio.Core + * @since 10 + */ + /** + * Accessibility usage, such as screen reader. + * @syscap SystemCapability.Multimedia.Audio.Core + * @atomicservice + * @since 12 + */ + STREAM_USAGE_ACCESSIBILITY = 8, + /** + * Movie or video usage. + * @syscap SystemCapability.Multimedia.Audio.Core + * @since 10 + */ + /** + * Movie or video usage. + * @syscap SystemCapability.Multimedia.Audio.Core + * @atomicservice + * @since 12 + */ + STREAM_USAGE_MOVIE = 10, + /** + * Game sound effect usage. + * @syscap SystemCapability.Multimedia.Audio.Core + * @since 10 + */ + /** + * Game sound effect usage. + * @syscap SystemCapability.Multimedia.Audio.Core + * @atomicservice + * @since 12 + */ + STREAM_USAGE_GAME = 11, + /** + * Audiobook usage. + * @syscap SystemCapability.Multimedia.Audio.Core + * @since 10 + */ + /** + * Audiobook usage. + * @syscap SystemCapability.Multimedia.Audio.Core + * @atomicservice + * @since 12 + */ + STREAM_USAGE_AUDIOBOOK = 12, + /** + * Navigation usage. + * @syscap SystemCapability.Multimedia.Audio.Core + * @since 10 + */ + /** + * Navigation usage. + * @syscap SystemCapability.Multimedia.Audio.Core + * @atomicservice + * @since 12 + */ + STREAM_USAGE_NAVIGATION = 13, + /** + * Video call usage. + * @syscap SystemCapability.Multimedia.Audio.Core + * @atomicservice + * @since 12 + */ + STREAM_USAGE_VIDEO_COMMUNICATION = 17 + } + /** + * Describes audio stream information. + * @typedef AudioStreamInfo + * @syscap SystemCapability.Multimedia.Audio.Core + * @since 8 + */ + interface AudioStreamInfo { + /** + * Sampling rate. + * @syscap SystemCapability.Multimedia.Audio.Core + * @since 8 + */ + samplingRate: AudioSamplingRate; + /** + * Audio channels. + * @syscap SystemCapability.Multimedia.Audio.Core + * @since 8 + */ + channels: AudioChannel; + /** + * Audio sample format. + * @syscap SystemCapability.Multimedia.Audio.Core + * @since 8 + */ + sampleFormat: AudioSampleFormat; + /** + * Audio encoding type. + * @syscap SystemCapability.Multimedia.Audio.Core + * @since 8 + */ + encodingType: AudioEncodingType; + /** + * Audio channel layout. + * @type { ?AudioChannelLayout } + * @syscap SystemCapability.Multimedia.Audio.Core + * @since 11 + */ + channelLayout?: AudioChannelLayout; + } + /** + * Describes audio renderer information. + * @typedef AudioRendererInfo + * @syscap SystemCapability.Multimedia.Audio.Core + * @since 8 + */ + /** + * Describes audio renderer information. + * @typedef AudioRendererInfo + * @syscap SystemCapability.Multimedia.Audio.Core + * @atomicservice + * @since 12 + */ + interface AudioRendererInfo { + /** + * Content type. + * @type { ContentType } + * @syscap SystemCapability.Multimedia.Audio.Core + * @since 8 + * @deprecated since 10 + * @useinstead ohos.multimedia.audio.AudioRendererInfo#usage + */ + /** + * Content type. + * @type { ?ContentType } + * @syscap SystemCapability.Multimedia.Audio.Core + * @since 10 + */ + content?: ContentType; + /** + * Stream usage. + * @syscap SystemCapability.Multimedia.Audio.Core + * @since 8 + */ + /** + * Stream usage. + * @syscap SystemCapability.Multimedia.Audio.Core + * @atomicservice + * @since 12 + */ + usage: StreamUsage; + /** + * Audio renderer flags. + * @syscap SystemCapability.Multimedia.Audio.Core + * @since 8 + */ + /** + * Audio renderer flags. + * @syscap SystemCapability.Multimedia.Audio.Core + * @atomicservice + * @since 12 + */ + rendererFlags: number; + } + /** + * Describes audio renderer configuration options. + * @typedef AudioRendererOptions + * @syscap SystemCapability.Multimedia.Audio.Renderer + * @since 8 + */ + interface AudioRendererOptions { + /** + * Stream information. + * @syscap SystemCapability.Multimedia.Audio.Renderer + * @since 8 + */ + streamInfo: AudioStreamInfo; + /** + * Renderer information. + * @syscap SystemCapability.Multimedia.Audio.Renderer + * @since 8 + */ + rendererInfo: AudioRendererInfo; + /** + * Privacy configuration. + * @syscap SystemCapability.Multimedia.Audio.PlaybackCapture + * @since 10 + */ + privacyType?: AudioPrivacyType; + } + /** + * Enumerates audio stream privacy type for playback capture. + * @enum { number } + * @syscap SystemCapability.Multimedia.Audio.PlaybackCapture + * @since 10 + */ + enum AudioPrivacyType { + /** + * Privacy type that stream can be captured by third party applications. + * @syscap SystemCapability.Multimedia.Audio.PlaybackCapture + * @since 10 + */ + PRIVACY_TYPE_PUBLIC = 0, + /** + * Privacy type that stream can not be captured. + * @syscap SystemCapability.Multimedia.Audio.PlaybackCapture + * @since 10 + */ + PRIVACY_TYPE_PRIVATE = 1 + } + /** + * Enumerates the interrupt modes. + * @enum { number } + * @syscap SystemCapability.Multimedia.Audio.Interrupt + * @since 9 + */ + /** + * Enumerates the interrupt modes. + * @enum { number } + * @syscap SystemCapability.Multimedia.Audio.Interrupt + * @atomicservice + * @since 12 + */ + enum InterruptMode { + /** + * Mode that different stream share one interrupt unit. + * @syscap SystemCapability.Multimedia.Audio.Interrupt + * @since 9 + */ + /** + * Mode that different stream share one interrupt unit. + * @syscap SystemCapability.Multimedia.Audio.Interrupt + * @atomicservice + * @since 12 + */ + SHARE_MODE = 0, + /** + * Mode that each stream has independent interrupt unit. + * @syscap SystemCapability.Multimedia.Audio.Interrupt + * @since 9 + */ + /** + * Mode that each stream has independent interrupt unit. + * @syscap SystemCapability.Multimedia.Audio.Interrupt + * @atomicservice + * @since 12 + */ + INDEPENDENT_MODE = 1 + } + /** + * Enumerates the audio renderer rates. + * @enum { number } + * @syscap SystemCapability.Multimedia.Audio.Renderer + * @since 8 + */ + enum AudioRendererRate { + /** + * Normal rate. + * @syscap SystemCapability.Multimedia.Audio.Renderer + * @since 8 + */ + RENDER_RATE_NORMAL = 0, + /** + * Double rate. + * @syscap SystemCapability.Multimedia.Audio.Renderer + * @since 8 + */ + RENDER_RATE_DOUBLE = 1, + /** + * Half rate. + * @syscap SystemCapability.Multimedia.Audio.Renderer + * @since 8 + */ + RENDER_RATE_HALF = 2 + } + /** + * Enumerates the interrupt types. + * @enum { number } + * @syscap SystemCapability.Multimedia.Audio.Renderer + * @since 7 + */ + /** + * Enumerates the interrupt types. + * @enum { number } + * @syscap SystemCapability.Multimedia.Audio.Renderer + * @atomicservice + * @since 12 + */ + enum InterruptType { + /** + * Audio playback interruption started. + * @syscap SystemCapability.Multimedia.Audio.Renderer + * @since 7 + */ + /** + * Audio playback interruption started. + * @syscap SystemCapability.Multimedia.Audio.Renderer + * @atomicservice + * @since 12 + */ + INTERRUPT_TYPE_BEGIN = 1, + /** + * Audio playback interruption ended. + * @syscap SystemCapability.Multimedia.Audio.Renderer + * @since 7 + */ + /** + * Audio playback interruption ended. + * @syscap SystemCapability.Multimedia.Audio.Renderer + * @atomicservice + * @since 12 + */ + INTERRUPT_TYPE_END = 2 + } + /** + * Enumerates the interrupt hints. + * @enum { number } + * @syscap SystemCapability.Multimedia.Audio.Renderer + * @since 7 + */ + /** + * Enumerates the interrupt hints. + * @enum { number } + * @syscap SystemCapability.Multimedia.Audio.Renderer + * @atomicservice + * @since 12 + */ + enum InterruptHint { + /** + * None. + * @syscap SystemCapability.Multimedia.Audio.Renderer + * @since 8 + */ + /** + * None. + * @syscap SystemCapability.Multimedia.Audio.Renderer + * @atomicservice + * @since 12 + */ + INTERRUPT_HINT_NONE = 0, + /** + * Resume the playback. + * @syscap SystemCapability.Multimedia.Audio.Renderer + * @since 7 + */ + /** + * Resume the playback. + * @syscap SystemCapability.Multimedia.Audio.Renderer + * @atomicservice + * @since 12 + */ + INTERRUPT_HINT_RESUME = 1, + /** + * Paused/Pause the playback. + * @syscap SystemCapability.Multimedia.Audio.Renderer + * @since 7 + */ + /** + * Paused/Pause the playback. + * @syscap SystemCapability.Multimedia.Audio.Renderer + * @atomicservice + * @since 12 + */ + INTERRUPT_HINT_PAUSE = 2, + /** + * Stopped/Stop the playback. + * @syscap SystemCapability.Multimedia.Audio.Renderer + * @since 7 + */ + /** + * Stopped/Stop the playback. + * @syscap SystemCapability.Multimedia.Audio.Renderer + * @atomicservice + * @since 12 + */ + INTERRUPT_HINT_STOP = 3, + /** + * Ducked the playback. (In ducking, the audio volume is reduced, but not silenced.) + * @syscap SystemCapability.Multimedia.Audio.Renderer + * @since 7 + */ + /** + * Ducked the playback. (In ducking, the audio volume is reduced, but not silenced.) + * @syscap SystemCapability.Multimedia.Audio.Renderer + * @atomicservice + * @since 12 + */ + INTERRUPT_HINT_DUCK = 4, + /** + * Unducked the playback. + * @syscap SystemCapability.Multimedia.Audio.Renderer + * @since 8 + */ + /** + * Unducked the playback. + * @syscap SystemCapability.Multimedia.Audio.Renderer + * @atomicservice + * @since 12 + */ + INTERRUPT_HINT_UNDUCK = 5 + } + /** + * Enumerates the interrupt force types. + * @enum { number } + * @syscap SystemCapability.Multimedia.Audio.Renderer + * @since 9 + */ + /** + * Enumerates the interrupt force types. + * @enum { number } + * @syscap SystemCapability.Multimedia.Audio.Renderer + * @atomicservice + * @since 12 + */ + enum InterruptForceType { + /** + * Forced action taken by system. + * @syscap SystemCapability.Multimedia.Audio.Renderer + * @since 9 + */ + /** + * Forced action taken by system. + * @syscap SystemCapability.Multimedia.Audio.Renderer + * @atomicservice + * @since 12 + */ + INTERRUPT_FORCE = 0, + /** + * Share type, application can choose to take action or ignore. + * @syscap SystemCapability.Multimedia.Audio.Renderer + * @since 9 + */ + /** + * Share type, application can choose to take action or ignore. + * @syscap SystemCapability.Multimedia.Audio.Renderer + * @atomicservice + * @since 12 + */ + INTERRUPT_SHARE = 1 + } + /** + * Describes the interrupt event received by the app when playback is interrupted. + * @typedef InterruptEvent + * @syscap SystemCapability.Multimedia.Audio.Renderer + * @since 9 + */ + /** + * Describes the interrupt event received by the app when playback is interrupted. + * @typedef InterruptEvent + * @syscap SystemCapability.Multimedia.Audio.Renderer + * @atomicservice + * @since 12 + */ + interface InterruptEvent { + /** + * Indicates whether the interruption has started or finished. + * @syscap SystemCapability.Multimedia.Audio.Renderer + * @since 9 + */ + /** + * Indicates whether the interruption has started or finished. + * @syscap SystemCapability.Multimedia.Audio.Renderer + * @atomicservice + * @since 12 + */ + eventType: InterruptType; + /** + * Indicates whether the action is taken by system or to be taken by the app. + * @syscap SystemCapability.Multimedia.Audio.Renderer + * @since 9 + */ + /** + * Indicates whether the action is taken by system or to be taken by the app. + * @syscap SystemCapability.Multimedia.Audio.Renderer + * @atomicservice + * @since 12 + */ + forceType: InterruptForceType; + /** + * Indicates the kind of action. + * @syscap SystemCapability.Multimedia.Audio.Renderer + * @since 9 + */ + /** + * Indicates the kind of action. + * @syscap SystemCapability.Multimedia.Audio.Renderer + * @atomicservice + * @since 12 + */ + hintType: InterruptHint; + } + /** + * Enumerates interrupt action types. + * @enum { number } + * @syscap SystemCapability.Multimedia.Audio.Renderer + * @since 7 + * @deprecated since 9 + */ + enum InterruptActionType { + /** + * Focus gain event. + * @syscap SystemCapability.Multimedia.Audio.Renderer + * @since 7 + * @deprecated since 9 + */ + TYPE_ACTIVATED = 0, + /** + * Audio interruption event. + * @syscap SystemCapability.Multimedia.Audio.Renderer + * @since 7 + * @deprecated since 9 + */ + TYPE_INTERRUPT = 1 + } + /** + * Enumerates device change types. + * @enum { number } + * @syscap SystemCapability.Multimedia.Audio.Device + * @since 7 + */ + enum DeviceChangeType { + /** + * Device connection. + * @syscap SystemCapability.Multimedia.Audio.Device + * @since 7 + */ + CONNECT = 0, + /** + * Device disconnection. + * @syscap SystemCapability.Multimedia.Audio.Device + * @since 7 + */ + DISCONNECT = 1 + } + /** + * Enumerates audio scenes. + * @enum { number } + * @syscap SystemCapability.Multimedia.Audio.Communication + * @since 8 + */ + enum AudioScene { + /** + * Default audio scene + * @syscap SystemCapability.Multimedia.Audio.Communication + * @since 8 + */ + AUDIO_SCENE_DEFAULT = 0, + /** + * Voice chat audio scene + * @syscap SystemCapability.Multimedia.Audio.Communication + * @since 8 + */ + AUDIO_SCENE_VOICE_CHAT = 3 + } + /** + * Implements audio volume and audio device management. + * @typedef AudioManager + * @syscap SystemCapability.Multimedia.Audio.Core + * @since 7 + */ + interface AudioManager { + /** + * Sets the volume for a stream. This method uses an asynchronous callback to return the result. + * @permission ohos.permission.ACCESS_NOTIFICATION_POLICY + * @param { AudioVolumeType } volumeType - Audio stream type. + * @param { number } volume - Volume to set. The value range can be obtained by calling getMinVolume and getMaxVolume. + * @param { AsyncCallback } callback - Callback used to return the result. + * @syscap SystemCapability.Multimedia.Audio.Volume + * @since 7 + * @deprecated since 9 + * @useinstead ohos.multimedia.audio.AudioVolumeGroupManager#setVolume + */ + setVolume(volumeType: AudioVolumeType, volume: number, callback: AsyncCallback): void; + /** + * Sets the volume for a stream. This method uses a promise to return the result. + * @permission ohos.permission.ACCESS_NOTIFICATION_POLICY + * @param { AudioVolumeType } volumeType - Audio stream type. + * @param { number } volume - Volume to set. The value range can be obtained by calling getMinVolume and getMaxVolume. + * @returns { Promise } Promise used to return the result. + * @syscap SystemCapability.Multimedia.Audio.Volume + * @since 7 + * @deprecated since 9 + * @useinstead ohos.multimedia.audio.AudioVolumeGroupManager#setVolume + */ + setVolume(volumeType: AudioVolumeType, volume: number): Promise; + /** + * Obtains the volume of a stream. This method uses an asynchronous callback to return the query result. + * @param { AudioVolumeType } volumeType - Audio stream type. + * @param { AsyncCallback } callback - Callback used to return the volume. + * @syscap SystemCapability.Multimedia.Audio.Volume + * @since 7 + * @deprecated since 9 + * @useinstead ohos.multimedia.audio.AudioVolumeGroupManager#getVolume + */ + getVolume(volumeType: AudioVolumeType, callback: AsyncCallback): void; + /** + * Obtains the volume of a stream. This method uses a promise to return the query result. + * @param { AudioVolumeType } volumeType - Audio stream type. + * @returns { Promise } Promise used to return the volume. + * @syscap SystemCapability.Multimedia.Audio.Volume + * @since 7 + * @deprecated since 9 + * @useinstead ohos.multimedia.audio.AudioVolumeGroupManager#getVolume + */ + getVolume(volumeType: AudioVolumeType): Promise; + /** + * Obtains the minimum volume allowed for a stream. This method uses an asynchronous callback to return the query result. + * @param { AudioVolumeType } volumeType - Audio stream type. + * @param { AsyncCallback } callback - Callback used to return the minimum volume. + * @syscap SystemCapability.Multimedia.Audio.Volume + * @since 7 + * @deprecated since 9 + * @useinstead ohos.multimedia.audio.AudioVolumeGroupManager#getMinVolume + */ + getMinVolume(volumeType: AudioVolumeType, callback: AsyncCallback): void; + /** + * Obtains the minimum volume allowed for a stream. This method uses a promise to return the query result. + * @param { AudioVolumeType } volumeType - Audio stream type. + * @returns { Promise } Promise used to return the minimum volume. + * @syscap SystemCapability.Multimedia.Audio.Volume + * @since 7 + * @deprecated since 9 + * @useinstead ohos.multimedia.audio.AudioVolumeGroupManager#getMinVolume + */ + getMinVolume(volumeType: AudioVolumeType): Promise; + /** + * Obtains the maximum volume allowed for a stream. This method uses an asynchronous callback to return the query result. + * @param { AudioVolumeType } volumeType - Audio stream type. + * @param { AsyncCallback } callback - Callback used to return the maximum volume. + * @syscap SystemCapability.Multimedia.Audio.Volume + * @since 7 + * @deprecated since 9 + * @useinstead ohos.multimedia.audio.AudioVolumeGroupManager#getMaxVolume + */ + getMaxVolume(volumeType: AudioVolumeType, callback: AsyncCallback): void; + /** + * Obtains the maximum volume allowed for a stream. This method uses a promise to return the query result. + * @param { AudioVolumeType } volumeType - Audio stream type. + * @returns { Promise } Promise used to return the maximum volume. + * @syscap SystemCapability.Multimedia.Audio.Volume + * @since 7 + * @deprecated since 9 + * @useinstead ohos.multimedia.audio.AudioVolumeGroupManager#getMaxVolume + */ + getMaxVolume(volumeType: AudioVolumeType): Promise; + /** + * Obtains the audio devices with a specific flag. This method uses an asynchronous callback to return the query result. + * @param { DeviceFlag } deviceFlag - Audio device flag. + * @param { AsyncCallback } callback - Callback used to return the device list. + * @syscap SystemCapability.Multimedia.Audio.Device + * @since 7 + * @deprecated since 9 + * @useinstead ohos.multimedia.audio.AudioRoutingManager#getDevices + */ + getDevices(deviceFlag: DeviceFlag, callback: AsyncCallback): void; + /** + * Obtains the audio devices with a specific flag. This method uses a promise to return the query result. + * @param { DeviceFlag } deviceFlag - Audio device flag. + * @returns { Promise } Promise used to return the device list. + * @syscap SystemCapability.Multimedia.Audio.Device + * @since 7 + * @deprecated since 9 + * @useinstead ohos.multimedia.audio.AudioRoutingManager#getDevices + */ + getDevices(deviceFlag: DeviceFlag): Promise; + /** + * Mutes a stream. This method uses an asynchronous callback to return the result. + * @param { AudioVolumeType } volumeType - Audio stream type. + * @param { boolean } mute - Mute status to set. The value true means to mute the stream, and false means the opposite. + * @param { AsyncCallback } callback - Callback used to return the result. + * @syscap SystemCapability.Multimedia.Audio.Volume + * @since 7 + * @deprecated since 9 + * @useinstead ohos.multimedia.audio.AudioVolumeGroupManager#mute + */ + mute(volumeType: AudioVolumeType, mute: boolean, callback: AsyncCallback): void; + /** + * Mutes a stream. This method uses a promise to return the result. + * @param { AudioVolumeType } volumeType - Audio stream type. + * @param { boolean } mute - Mute status to set. The value true means to mute the stream, and false means the opposite. + * @returns { Promise } Promise used to return the result. + * @syscap SystemCapability.Multimedia.Audio.Volume + * @since 7 + * @deprecated since 9 + * @useinstead ohos.multimedia.audio.AudioVolumeGroupManager#mute + */ + mute(volumeType: AudioVolumeType, mute: boolean): Promise; + /** + * Checks whether a stream is muted. This method uses an asynchronous callback to return the query result. + * @param { AudioVolumeType } volumeType - Audio stream type. + * @param { AsyncCallback } callback - Callback used to return the mute status of the stream. + * The value true means that the stream is muted, and false means the opposite. + * @syscap SystemCapability.Multimedia.Audio.Volume + * @since 7 + * @deprecated since 9 + * @useinstead ohos.multimedia.audio.AudioVolumeGroupManager#isMute + */ + isMute(volumeType: AudioVolumeType, callback: AsyncCallback): void; + /** + * Checks whether a stream is muted. This method uses a promise to return the result. + * @param { AudioVolumeType } volumeType - Audio stream type. + * @returns { Promise } Promise used to return the mute status of the stream. The value true means + * that the stream is muted, and false means the opposite. + * @syscap SystemCapability.Multimedia.Audio.Volume + * @since 7 + * @deprecated since 9 + * @useinstead ohos.multimedia.audio.AudioVolumeGroupManager#isMute + */ + isMute(volumeType: AudioVolumeType): Promise; + /** + * Checks whether a stream is active. This method uses an asynchronous callback to return the query result. + * @param { AudioVolumeType } volumeType - Audio stream type. + * @param { AsyncCallback } callback - Callback used to return the active status of the stream. + * The value true means that the stream is active, and false means the opposite. + * @syscap SystemCapability.Multimedia.Audio.Volume + * @since 7 + * @deprecated since 9 + * @useinstead ohos.multimedia.audio.AudioStreamManager#isActive + */ + isActive(volumeType: AudioVolumeType, callback: AsyncCallback): void; + /** + * Checks whether a stream is active. This method uses a promise to return the query result. + * @param { AudioVolumeType } volumeType - Audio stream type. + * @returns { Promise } Promise used to return the active status of the stream. The value true means + * that the stream is active, and false means the opposite. + * @syscap SystemCapability.Multimedia.Audio.Volume + * @since 7 + * @deprecated since 9 + * @useinstead ohos.multimedia.audio.AudioStreamManager#isActive + */ + isActive(volumeType: AudioVolumeType): Promise; + /** + * Mutes or unmutes the microphone. This method uses an asynchronous callback to return the result. + * @permission ohos.permission.MICROPHONE + * @param { boolean } mute - Mute status to set. The value true means to mute the microphone, and false means the opposite. + * @param { AsyncCallback } callback - Callback used to return the result. + * @syscap SystemCapability.Multimedia.Audio.Device + * @since 7 + * @deprecated since 9 + * @useinstead ohos.multimedia.audio.AudioVolumeGroupManager#setMicrophoneMute + */ + setMicrophoneMute(mute: boolean, callback: AsyncCallback): void; + /** + * Mutes or unmutes the microphone. This method uses a promise to return the result. + * @permission ohos.permission.MICROPHONE + * @param { boolean } mute - Mute status to set. The value true means to mute the microphone, and false means the opposite. + * @returns { Promise } Promise used to return the result. + * @syscap SystemCapability.Multimedia.Audio.Device + * @since 7 + * @deprecated since 9 + * @useinstead ohos.multimedia.audio.AudioVolumeGroupManager#setMicrophoneMute + */ + setMicrophoneMute(mute: boolean): Promise; + /** + * Checks whether the microphone is muted. This method uses an asynchronous callback to return the query result. + * @permission ohos.permission.MICROPHONE + * @param { AsyncCallback } callback - used to return the mute status of the microphone. The value + * true means that the microphone is muted, and false means the opposite. + * @syscap SystemCapability.Multimedia.Audio.Device + * @since 7 + * @deprecated since 9 + * @useinstead ohos.multimedia.audio.AudioVolumeGroupManager#isMicrophoneMute + */ + isMicrophoneMute(callback: AsyncCallback): void; + /** + * Checks whether the microphone is muted. This method uses a promise to return the query result. + * @permission ohos.permission.MICROPHONE + * @returns { Promise } Promise used to return the mute status of the microphone. The value + * true means that the microphone is muted, and false means the opposite. + * @syscap SystemCapability.Multimedia.Audio.Device + * @since 7 + * @deprecated since 9 + * @useinstead ohos.multimedia.audio.AudioVolumeGroupManager#isMicrophoneMute + */ + isMicrophoneMute(): Promise; + /** + * Sets the ringer mode. This method uses an asynchronous callback to return the result. + * @permission ohos.permission.ACCESS_NOTIFICATION_POLICY + * @param { AudioRingMode } mode - Ringer mode. + * @param { AsyncCallback } callback - Callback used to return the result. + * @syscap SystemCapability.Multimedia.Audio.Communication + * @since 7 + * @deprecated since 9 + * @useinstead ohos.multimedia.audio.AudioVolumeGroupManager#setRingerMode + */ + setRingerMode(mode: AudioRingMode, callback: AsyncCallback): void; + /** + * Sets the ringer mode. This method uses a promise to return the result. + * @permission ohos.permission.ACCESS_NOTIFICATION_POLICY + * @param { AudioRingMode } mode - Ringer mode. + * @returns { Promise } Promise used to return the result. + * @syscap SystemCapability.Multimedia.Audio.Communication + * @since 7 + * @deprecated since 9 + * @useinstead ohos.multimedia.audio.AudioVolumeGroupManager#setRingerMode + */ + setRingerMode(mode: AudioRingMode): Promise; + /** + * Obtains the ringer mode. This method uses an asynchronous callback to return the query result. + * @param { AsyncCallback } callback - Callback used to return the ringer mode. + * @syscap SystemCapability.Multimedia.Audio.Communication + * @since 7 + * @deprecated since 9 + * @useinstead ohos.multimedia.audio.AudioVolumeGroupManager#getRingerMode + */ + getRingerMode(callback: AsyncCallback): void; + /** + * Obtains the ringer mode. This method uses a promise to return the query result. + * @returns { Promise } Promise used to return the ringer mode. + * @syscap SystemCapability.Multimedia.Audio.Communication + * @since 7 + * @deprecated since 9 + * @useinstead ohos.multimedia.audio.AudioVolumeGroupManager#getRingerMode + */ + getRingerMode(): Promise; + /** + * Sets an audio parameter. This method uses an asynchronous callback to return the result. + * @permission ohos.permission.MODIFY_AUDIO_SETTINGS + * @param { string } key - Key of the audio parameter to set. + * @param { string } value - Value of the audio parameter to set. + * @param { AsyncCallback } callback - Callback used to return the result. + * @syscap SystemCapability.Multimedia.Audio.Core + * @since 7 + * @deprecated since 11 + * @useinstead ohos.multimedia.audio.AudioManager#setExtraParameters + */ + setAudioParameter(key: string, value: string, callback: AsyncCallback): void; + /** + * Sets an audio parameter. This method uses a promise to return the result. + * @permission ohos.permission.MODIFY_AUDIO_SETTINGS + * @param { string } key - Key of the audio parameter to set. + * @param { string } value - Value of the audio parameter to set. + * @returns { Promise } Promise used to return the result. + * @syscap SystemCapability.Multimedia.Audio.Core + * @since 7 + * @deprecated since 11 + * @useinstead ohos.multimedia.audio.AudioManager#setExtraParameters + */ + setAudioParameter(key: string, value: string): Promise; + /** + * Obtains the value of an audio parameter. This method uses an asynchronous callback to return the query result. + * @param { string } key - Key of the audio parameter whose value is to be obtained. + * @param { AsyncCallback } callback - Callback used to return the value of the audio parameter. + * @syscap SystemCapability.Multimedia.Audio.Core + * @since 7 + * @deprecated since 11 + * @useinstead ohos.multimedia.audio.AudioManager#getExtraParameters + */ + getAudioParameter(key: string, callback: AsyncCallback): void; + /** + * Obtains the value of an audio parameter. This method uses a promise to return the query result. + * @param { string } key - Key of the audio parameter whose value is to be obtained. + * @returns { Promise } Promise used to return the value of the audio parameter. + * @syscap SystemCapability.Multimedia.Audio.Core + * @since 7 + * @deprecated since 11 + * @useinstead ohos.multimedia.audio.AudioManager#getExtraParameters + */ + getAudioParameter(key: string): Promise; + /** + * Sets a device to the active state. This method uses an asynchronous callback to return the result. + * @param { ActiveDeviceType } deviceType - Audio device type. + * @param { boolean } active - Active status to set. The value true means to set the device to the active + * status, and false means the opposite. + * @param { AsyncCallback } callback - Callback used to return the result. + * @syscap SystemCapability.Multimedia.Audio.Device + * @since 7 + * @deprecated since 9 + * @useinstead ohos.multimedia.audio.AudioRoutingManager#setCommunicationDevice + */ + setDeviceActive(deviceType: ActiveDeviceType, active: boolean, callback: AsyncCallback): void; + /** + * Sets a device to the active state. This method uses a promise to return the result. + * @param { ActiveDeviceType } deviceType - Audio device type. + * @param { boolean } active - Active status to set. The value true means to set the device to the active + * status, and false means the opposite. + * @returns { Promise } Promise used to return the result. + * @syscap SystemCapability.Multimedia.Audio.Device + * @since 7 + * @deprecated since 9 + * @useinstead ohos.multimedia.audio.AudioRoutingManager#setCommunicationDevice + */ + setDeviceActive(deviceType: ActiveDeviceType, active: boolean): Promise; + /** + * Checks whether a device is active. This method uses an asynchronous callback to return the query result. + * @param { ActiveDeviceType } deviceType - Audio device type. + * @param { AsyncCallback } callback - Callback used to return the active status of the device. + * @syscap SystemCapability.Multimedia.Audio.Device + * @since 7 + * @deprecated since 9 + * @useinstead ohos.multimedia.audio.AudioRoutingManager#isCommunicationDeviceActive + */ + isDeviceActive(deviceType: ActiveDeviceType, callback: AsyncCallback): void; + /** + * Checks whether a device is active. This method uses a promise to return the query result. + * @param { ActiveDeviceType } deviceType - Audio device type. + * @returns { Promise } Promise used to return the active status of the device. + * @syscap SystemCapability.Multimedia.Audio.Device + * @since 7 + * @deprecated since 9 + * @useinstead ohos.multimedia.audio.AudioRoutingManager#isCommunicationDeviceActive + */ + isDeviceActive(deviceType: ActiveDeviceType): Promise; + /** + * Obtains the audio scene mode. This method uses an asynchronous callback to return the query result. + * @param { AsyncCallback } callback - Callback used to return the audio scene mode. + * @syscap SystemCapability.Multimedia.Audio.Communication + * @since 8 + */ + getAudioScene(callback: AsyncCallback): void; + /** + * Obtains the audio scene mode. This method uses a promise to return the query result. + * @returns { Promise } Promise used to return the audio scene mode. + * @syscap SystemCapability.Multimedia.Audio.Communication + * @since 8 + */ + getAudioScene(): Promise; + /** + * Obtains the audio scene mode. + * @returns { AudioScene } Current audio scene mode. + * @syscap SystemCapability.Multimedia.Audio.Communication + * @since 10 + */ + getAudioSceneSync(): AudioScene; + /** + * Subscribes to device change events. When a device is connected/disconnected, registered clients will receive + * the callback. + * @param { 'deviceChange' } type - Type of the event to listen for. Only the deviceChange event is supported. + * @param { Callback } callback - Callback used to obtain the device update details. + * @syscap SystemCapability.Multimedia.Audio.Device + * @since 7 + * @deprecated since 9 + * @useinstead ohos.multimedia.audio.AudioRoutingManager#event:deviceChange + */ + on(type: 'deviceChange', callback: Callback): void; + /** + * UnSubscribes to device change events. + * @param { 'deviceChange' } type - Type of the event to listen for. Only the deviceChange event is supported. + * @param { Callback } callback - Callback used to obtain the device update details. + * @syscap SystemCapability.Multimedia.Audio.Device + * @since 7 + * @deprecated since 9 + * @useinstead ohos.multimedia.audio.AudioRoutingManager#event:deviceChange + */ + off(type: 'deviceChange', callback?: Callback): void; + /** + * Listens for audio interruption events. When the audio of an application is interrupted by another application, + * the callback is invoked to notify the former application. + * @param { 'interrupt' } type - Type of the event to listen for. Only the interrupt event is supported. + * @param { AudioInterrupt } interrupt - Parameters of the audio interruption event type. + * @param { Callback } callback - Callback invoked for the audio interruption event. + * @syscap SystemCapability.Multimedia.Audio.Renderer + * @since 7 + * @deprecated since 11 + * @useinstead ohos.multimedia.audio.AudioRenderer#event:audioInterrupt + */ + on(type: 'interrupt', interrupt: AudioInterrupt, callback: Callback): void; + /** + * Cancels the listening of audio interruption events. + * @param { 'interrupt' } type - Type of the event to listen for. Only the interrupt event is supported. + * @param { AudioInterrupt } interrupt - Input parameters of the audio interruption event. + * @param { Callback } callback - Callback invoked for the audio interruption event. + * @syscap SystemCapability.Multimedia.Audio.Renderer + * @since 7 + * @deprecated since 11 + * @useinstead ohos.multimedia.audio.AudioRenderer#event:audioInterrupt + */ + off(type: 'interrupt', interrupt: AudioInterrupt, callback?: Callback): void; + /** + * Obtains an {@link AudioVolumeManager} instance. + * @returns { AudioVolumeManager } AudioVolumeManager instance. + * @syscap SystemCapability.Multimedia.Audio.Volume + * @since 9 + */ + getVolumeManager(): AudioVolumeManager; + /** + * Obtains an {@link AudioStreamManager} instance. + * @returns { AudioStreamManager } AudioStreamManager instance. + * @syscap SystemCapability.Multimedia.Audio.Core + * @since 9 + */ + getStreamManager(): AudioStreamManager; + /** + * Obtains an {@link AudioRoutingManager} instance. + * @returns { AudioRoutingManager } AudioRoutingManager instance. + * @syscap SystemCapability.Multimedia.Audio.Device + * @since 9 + */ + getRoutingManager(): AudioRoutingManager; + } + /** + * Implements audio router management. + * @typedef AudioRoutingManager + * @syscap SystemCapability.Multimedia.Audio.Device + * @since 9 + */ + interface AudioRoutingManager { + /** + * Obtains the audio devices with a specific flag. This method uses an asynchronous callback to return the query result. + * @param { DeviceFlag } deviceFlag - Audio device flag. + * @param { AsyncCallback } callback - Callback used to return the device list. + * @syscap SystemCapability.Multimedia.Audio.Device + * @since 9 + */ + getDevices(deviceFlag: DeviceFlag, callback: AsyncCallback): void; + /** + * Obtains the audio devices with a specific flag. This method uses a promise to return the query result. + * @param { DeviceFlag } deviceFlag - Audio device flag. + * @returns { Promise } Promise used to return the device list. + * @syscap SystemCapability.Multimedia.Audio.Device + * @since 9 + */ + getDevices(deviceFlag: DeviceFlag): Promise; + /** + * Obtains the audio devices with a specific flag. + * @param { DeviceFlag } deviceFlag - Audio device flag. + * @returns { AudioDeviceDescriptors } The device list. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @throws { BusinessError } 6800101 - Parameter verification failed. + * @syscap SystemCapability.Multimedia.Audio.Device + * @since 10 + */ + getDevicesSync(deviceFlag: DeviceFlag): AudioDeviceDescriptors; + /** + * Subscribes to device change events. When a device is connected/disconnected, registered clients will receive + * the callback. + * @param { 'deviceChange' } type - Type of the event to listen for. Only the deviceChange event is supported. + * @param { DeviceFlag } deviceFlag - Audio device flag. + * @param { Callback } callback - Callback used to obtain the device update details. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @throws { BusinessError } 6800101 - Parameter verification failed. + * @syscap SystemCapability.Multimedia.Audio.Device + * @since 9 + */ + on(type: 'deviceChange', deviceFlag: DeviceFlag, callback: Callback): void; + /** + * UnSubscribes to device change events. + * @param { 'deviceChange' } type - Type of the event to listen for. Only the deviceChange event is supported. + * @param { Callback } callback - Callback used to obtain the device update details. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @throws { BusinessError } 6800101 - Parameter verification failed. + * @syscap SystemCapability.Multimedia.Audio.Device + * @since 9 + */ + off(type: 'deviceChange', callback?: Callback): void; + /** + * Sets a device to the active state. This method uses an asynchronous callback to return the result. + * @param { CommunicationDeviceType } deviceType - Audio device type. + * @param { boolean } active - Active status to set. The value true means to set the device to + * the active status, and false means the opposite. + * @param { AsyncCallback } callback - Callback used to return the result. + * @syscap SystemCapability.Multimedia.Audio.Communication + * @since 9 + */ + setCommunicationDevice(deviceType: CommunicationDeviceType, active: boolean, callback: AsyncCallback): void; + /** + * Sets a device to the active state. This method uses a promise to return the result. + * @param { CommunicationDeviceType } deviceType - Audio device type. + * @param { boolean } active - Active status to set. The value true means to set the device to the active status, + * and false means the opposite. + * @returns { Promise } Promise used to return the result. + * @syscap SystemCapability.Multimedia.Audio.Communication + * @since 9 + */ + setCommunicationDevice(deviceType: CommunicationDeviceType, active: boolean): Promise; + /** + * Checks whether a device is active. This method uses an asynchronous callback to return the query result. + * @param { CommunicationDeviceType } deviceType - Audio device type. + * @param { AsyncCallback } callback - Callback used to return the active status of the device. + * @syscap SystemCapability.Multimedia.Audio.Communication + * @since 9 + */ + isCommunicationDeviceActive(deviceType: CommunicationDeviceType, callback: AsyncCallback): void; + /** + * Checks whether a device is active. This method uses a promise to return the query result. + * @param { CommunicationDeviceType } deviceType - Audio device type. + * @returns { Promise } Promise used to return the active status of the device. + * @syscap SystemCapability.Multimedia.Audio.Communication + * @since 9 + */ + isCommunicationDeviceActive(deviceType: CommunicationDeviceType): Promise; + /** + * Checks whether a device is active. + * @param { CommunicationDeviceType } deviceType - Audio device type. + * @returns { boolean } The active status of the device. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @throws { BusinessError } 6800101 - Parameter verification failed. + * @syscap SystemCapability.Multimedia.Audio.Communication + * @since 10 + */ + isCommunicationDeviceActiveSync(deviceType: CommunicationDeviceType): boolean; + /** + * Get output device for target audio renderer info. + * @param { AudioRendererInfo } rendererInfo - Audio renderer information + * @param { AsyncCallback } callback - Callback used to return the result. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @throws { BusinessError } 6800101 - Parameter verification failed. Return by callback. + * @throws { BusinessError } 6800301 - System error. Return by callback. + * @syscap SystemCapability.Multimedia.Audio.Device + * @since 10 + */ + getPreferOutputDeviceForRendererInfo(rendererInfo: AudioRendererInfo, callback: AsyncCallback): void; + /** + * Get output device for target audio renderer info. + * @param { AudioRendererInfo } rendererInfo - Audio renderer information. + * @returns { Promise } Promise used to return the result. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @throws { BusinessError } 6800101 - Parameter verification failed. Return by promise. + * @throws { BusinessError } 6800301 - System error. Return by promise. + * @syscap SystemCapability.Multimedia.Audio.Device + * @since 10 + */ + getPreferOutputDeviceForRendererInfo(rendererInfo: AudioRendererInfo): Promise; + /** + * Gets preferred output device for target audio renderer info. + * @param { AudioRendererInfo } rendererInfo - Audio renderer information. + * @returns { AudioDeviceDescriptors } The preferred devices. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @throws { BusinessError } 6800101 - Parameter verification failed. + * @syscap SystemCapability.Multimedia.Audio.Device + * @since 10 + */ + getPreferredOutputDeviceForRendererInfoSync(rendererInfo: AudioRendererInfo): AudioDeviceDescriptors; + /** + * Subscribes to prefer output device change events. When prefer device for target audio renderer info changes, + * registered clients will receive the callback. + * @param { 'preferOutputDeviceChangeForRendererInfo' } type - Type of the event to listen for. Only the + * preferOutputDeviceChangeForRendererInfo event is supported. + * @param { AudioRendererInfo } rendererInfo - Audio renderer information. + * @param { Callback } callback - Callback used to obtain the changed prefer devices information. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @throws { BusinessError } 6800101 - Parameter verification failed. + * @syscap SystemCapability.Multimedia.Audio.Device + * @since 10 + */ + on(type: 'preferOutputDeviceChangeForRendererInfo', rendererInfo: AudioRendererInfo, callback: Callback): void; + /** + * UnSubscribes to prefer output device change events. + * @param { 'preferOutputDeviceChangeForRendererInfo' } type - Type of the event to listen for. Only the + * preferOutputDeviceChangeForRendererInfo event is supported. + * @param { Callback } callback - Callback used to obtain the changed prefer devices in subscribe. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @throws { BusinessError } 6800101 - Parameter verification failed. + * @syscap SystemCapability.Multimedia.Audio.Device + * @since 10 + */ + off(type: 'preferOutputDeviceChangeForRendererInfo', callback?: Callback): void; + /** + * Get input device for target audio capturer info. + * @param { AudioCapturerInfo } capturerInfo - Audio capturer information. + * @param { AsyncCallback } callback - Callback used to return the result. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @throws { BusinessError } 6800101 - Parameter verification failed. Return by callback. + * @throws { BusinessError } 6800301 - System error. Return by callback. + * @syscap SystemCapability.Multimedia.Audio.Device + * @since 10 + */ + getPreferredInputDeviceForCapturerInfo(capturerInfo: AudioCapturerInfo, callback: AsyncCallback): void; + /** + * Get input device for target audio capturer info. + * @param { AudioCapturerInfo } capturerInfo - Audio capturer information. + * @returns { Promise } Promise used to return the result. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @throws { BusinessError } 6800101 - Parameter verification failed. Return by promise. + * @throws { BusinessError } 6800301 - System error. Return by promise. + * @syscap SystemCapability.Multimedia.Audio.Device + * @since 10 + */ + getPreferredInputDeviceForCapturerInfo(capturerInfo: AudioCapturerInfo): Promise; + /** + * Subscribes to preferred input device change events. When preferred device for target audio capturer info changes, + * registered clients will receive the callback. + * @param { 'preferredInputDeviceChangeForCapturerInfo' } type - Type of the event to listen for. + * @param { AudioCapturerInfo } capturerInfo - Audio capturer information. + * @param { Callback } callback - Callback used to obtain the changed preferred devices information. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @throws { BusinessError } 6800101 - Parameter verification failed. + * @syscap SystemCapability.Multimedia.Audio.Device + * @since 10 + */ + on(type: 'preferredInputDeviceChangeForCapturerInfo', capturerInfo: AudioCapturerInfo, callback: Callback): void; + /** + * Unsubscribes to preferred input device change events. + * @param { 'preferredInputDeviceChangeForCapturerInfo' } type - Type of the event to listen for. + * @param { Callback } callback - Callback used to obtain the changed preferred devices in subscribe. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @throws { BusinessError } 6800101 - Parameter verification failed. + * @syscap SystemCapability.Multimedia.Audio.Device + * @since 10 + */ + off(type: 'preferredInputDeviceChangeForCapturerInfo', callback?: Callback): void; + /** + * Gets preferred input device for target audio capturer info. + * @param { AudioCapturerInfo } capturerInfo - Audio capturer information. + * @returns { AudioDeviceDescriptors } The preferred devices. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @throws { BusinessError } 6800101 - Parameter verification failed. + * @syscap SystemCapability.Multimedia.Audio.Device + * @since 10 + */ + getPreferredInputDeviceForCapturerInfoSync(capturerInfo: AudioCapturerInfo): AudioDeviceDescriptors; + } + /** + * Implements audio stream management. + * @typedef AudioStreamManager + * @syscap SystemCapability.Multimedia.Audio.Core + * @since 9 + */ + interface AudioStreamManager { + /** + * Get information of current existing audio renderers. + * @param { AsyncCallback } callback - Callback used to return the information + * of current existing audio renderers. + * @syscap SystemCapability.Multimedia.Audio.Renderer + * @since 9 + */ + getCurrentAudioRendererInfoArray(callback: AsyncCallback): void; + /** + * Get information of current existing audio renderers. + * @returns { Promise } Promise used to return the information of current + * existing audio renderers. + * @syscap SystemCapability.Multimedia.Audio.Renderer + * @since 9 + */ + getCurrentAudioRendererInfoArray(): Promise; + /** + * Get information of current existing audio renderers. + * @returns { AudioRendererChangeInfoArray } The information of current existing audio renderers. + * @syscap SystemCapability.Multimedia.Audio.Renderer + * @since 10 + */ + getCurrentAudioRendererInfoArraySync(): AudioRendererChangeInfoArray; + /** + * Get information of current existing audio capturers. + * @param { AsyncCallback } callback - Callback used to return the information + * of current existing audio capturers. + * @syscap SystemCapability.Multimedia.Audio.Renderer + * @since 9 + */ + getCurrentAudioCapturerInfoArray(callback: AsyncCallback): void; + /** + * Get information of current existing audio capturers. + * @returns { Promise } Promise used to return the information of current existing + * audio capturers. + * @syscap SystemCapability.Multimedia.Audio.Renderer + * @since 9 + */ + getCurrentAudioCapturerInfoArray(): Promise; + /** + * Get information of current existing audio capturers. + * @returns { AudioCapturerChangeInfoArray } The information of current existing audio capturers. + * @syscap SystemCapability.Multimedia.Audio.Capturer + * @since 10 + */ + getCurrentAudioCapturerInfoArraySync(): AudioCapturerChangeInfoArray; + /** + * Gets information of audio effects. + * @param { StreamUsage } usage - Stream usage. + * @param { AsyncCallback } callback - Callback used to return the information of audio effects. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @throws { BusinessError } 6800101 - Parameter verification failed. Return by callback. + * @syscap SystemCapability.Multimedia.Audio.Renderer + * @since 10 + */ + getAudioEffectInfoArray(usage: StreamUsage, callback: AsyncCallback): void; + /** + * Gets information of audio effects. + * @param { StreamUsage } usage - Stream usage. + * @returns { Promise } Promise used to return the information of audio effects. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @throws { BusinessError } 6800101 - Parameter verification failed. Return by promise. + * @syscap SystemCapability.Multimedia.Audio.Renderer + * @since 10 + */ + getAudioEffectInfoArray(usage: StreamUsage): Promise; + /** + * Gets information of audio effects. + * @param { StreamUsage } usage - Stream usage. + * @returns { AudioEffectInfoArray } The information of audio effects. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @throws { BusinessError } 6800101 - Parameter verification failed. + * @syscap SystemCapability.Multimedia.Audio.Renderer + * @since 10 + */ + getAudioEffectInfoArraySync(usage: StreamUsage): AudioEffectInfoArray; + /** + * Listens for audio renderer change events. When there is any audio renderer change, + * registered clients will receive the callback. + * @param { 'audioRendererChange' } type - Type of the event to listen for. Only the audioRendererChange event is supported. + * @param { Callback } callback - Callback invoked for the audio renderer change event. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @throws { BusinessError } 6800101 - Parameter verification failed. + * @syscap SystemCapability.Multimedia.Audio.Renderer + * @since 9 + */ + on(type: 'audioRendererChange', callback: Callback): void; + /** + * UnSubscribes to audio renderer change events. + * @param { 'audioRendererChange' } type - Type of the event to listen for. Only the audioRendererChange event is supported. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @throws { BusinessError } 6800101 - Parameter verification failed. + * @syscap SystemCapability.Multimedia.Audio.Renderer + * @since 9 + */ + off(type: 'audioRendererChange'): void; + /** + * Listens for audio capturer change events. When there is any audio capturer change, + * registered clients will receive the callback. + * @param { 'audioCapturerChange' } type - Type of the event to listen for. Only the audioCapturerChange event is supported. + * @param { Callback } callback - Callback invoked for the audio capturer change event. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @throws { BusinessError } 6800101 - Parameter verification failed. + * @syscap SystemCapability.Multimedia.Audio.Capturer + * @since 9 + */ + on(type: 'audioCapturerChange', callback: Callback): void; + /** + * UnSubscribes to audio capturer change events. + * @param { 'audioCapturerChange' } type - Type of the event to listen for. Only the audioCapturerChange event is supported. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @throws { BusinessError } 6800101 - Parameter verification failed. + * @syscap SystemCapability.Multimedia.Audio.Capturer + * @since 9 + */ + off(type: 'audioCapturerChange'): void; + /** + * Checks whether a stream is active. This method uses an asynchronous callback to return the query result. + * @param { AudioVolumeType } volumeType - Audio stream type. + * @param { AsyncCallback } callback - Callback used to return the active status of the stream. + * The value true means that the stream is active, and false means the opposite. + * @syscap SystemCapability.Multimedia.Audio.Renderer + * @since 9 + */ + isActive(volumeType: AudioVolumeType, callback: AsyncCallback): void; + /** + * Checks whether a stream is active. This method uses a promise to return the query result. + * @param { AudioVolumeType } volumeType - Audio stream type. + * @returns { Promise } Promise used to return the active status of the stream. The value + * true means that the stream is active, and false means the opposite. + * @syscap SystemCapability.Multimedia.Audio.Renderer + * @since 9 + */ + isActive(volumeType: AudioVolumeType): Promise; + /** + * Checks whether a stream is active. + * @param { AudioVolumeType } volumeType - Audio stream type. + * @returns { boolean } The active status of the stream. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @throws { BusinessError } 6800101 - Parameter verification failed. + * @syscap SystemCapability.Multimedia.Audio.Renderer + * @since 10 + */ + isActiveSync(volumeType: AudioVolumeType): boolean; + } + /** + * Implements audio volume management. + * @typedef AudioVolumeManager + * @syscap SystemCapability.Multimedia.Audio.Volume + * @since 9 + */ + interface AudioVolumeManager { + /** + * Obtains an AudioVolumeGroupManager instance. This method uses an asynchronous callback to return the result. + * @param { number } groupId - volume group id, use LOCAL_VOLUME_GROUP_ID in default + * @param { AsyncCallback } callback - Callback used to return the result. + * @syscap SystemCapability.Multimedia.Audio.Volume + * @since 9 + */ + getVolumeGroupManager(groupId: number, callback: AsyncCallback): void; + /** + * Obtains an AudioVolumeGroupManager instance. This method uses a promise to return the result. + * @param { number } groupId - volume group id, use LOCAL_VOLUME_GROUP_ID in default + * @returns { Promise } Promise used to return the result. + * @syscap SystemCapability.Multimedia.Audio.Volume + * @since 9 + */ + getVolumeGroupManager(groupId: number): Promise; + /** + * Obtains an AudioVolumeGroupManager instance. + * @param { number } groupId - volume group id, use LOCAL_VOLUME_GROUP_ID in default + * @returns { AudioVolumeGroupManager } The audio volume group manager instance. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @throws { BusinessError } 6800101 - Parameter verification failed. + * @syscap SystemCapability.Multimedia.Audio.Volume + * @since 10 + */ + getVolumeGroupManagerSync(groupId: number): AudioVolumeGroupManager; + /** + * Listens for system volume change events. This method uses a callback to get volume change events. + * @param { 'volumeChange' } type - Type of the event to listen for. Only the volumeChange event is supported. + * @param { Callback } callback - Callback used to get the system volume change event. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @throws { BusinessError } 6800101 - Parameter verification failed. + * @syscap SystemCapability.Multimedia.Audio.Volume + * @since 9 + */ + on(type: 'volumeChange', callback: Callback): void; + } + /** + * Implements audio volume group management. + * @typedef AudioVolumeGroupManager + * @syscap SystemCapability.Multimedia.Audio.Volume + * @since 9 + */ + interface AudioVolumeGroupManager { + /** + * Obtains the volume of a stream. This method uses an asynchronous callback to return the query result. + * @param { AudioVolumeType } volumeType - Audio stream type. + * @param { AsyncCallback } callback - Callback used to return the volume. + * @syscap SystemCapability.Multimedia.Audio.Volume + * @since 9 + */ + getVolume(volumeType: AudioVolumeType, callback: AsyncCallback): void; + /** + * Obtains the volume of a stream. This method uses a promise to return the query result. + * @param { AudioVolumeType } volumeType - Audio stream type. + * @returns { Promise } Promise used to return the volume. + * @syscap SystemCapability.Multimedia.Audio.Volume + * @since 9 + */ + getVolume(volumeType: AudioVolumeType): Promise; + /** + * Obtains the volume of a stream. + * @param { AudioVolumeType } volumeType - Audio stream type. + * @returns { number } Current system volume level. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @throws { BusinessError } 6800101 - Parameter verification failed. + * @syscap SystemCapability.Multimedia.Audio.Volume + * @since 10 + */ + getVolumeSync(volumeType: AudioVolumeType): number; + /** + * Obtains the minimum volume allowed for a stream. This method uses an asynchronous callback to return the query result. + * @param { AudioVolumeType } volumeType - Audio stream type. + * @param { AsyncCallback } callback - Callback used to return the minimum volume. + * @syscap SystemCapability.Multimedia.Audio.Volume + * @since 9 + */ + getMinVolume(volumeType: AudioVolumeType, callback: AsyncCallback): void; + /** + * Obtains the minimum volume allowed for a stream. This method uses a promise to return the query result. + * @param { AudioVolumeType } volumeType - Audio stream type. + * @returns { Promise } Promise used to return the minimum volume. + * @syscap SystemCapability.Multimedia.Audio.Volume + * @since 9 + */ + getMinVolume(volumeType: AudioVolumeType): Promise; + /** + * Obtains the minimum volume allowed for a stream. + * @param { AudioVolumeType } volumeType - Audio stream type. + * @returns { number } Min volume level. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @throws { BusinessError } 6800101 - Parameter verification failed. + * @syscap SystemCapability.Multimedia.Audio.Volume + * @since 10 + */ + getMinVolumeSync(volumeType: AudioVolumeType): number; + /** + * Obtains the maximum volume allowed for a stream. This method uses an asynchronous callback to return the query result. + * @param { AudioVolumeType } volumeType - Audio stream type. + * @param { AsyncCallback } callback - Callback used to return the maximum volume. + * @syscap SystemCapability.Multimedia.Audio.Volume + * @since 9 + */ + getMaxVolume(volumeType: AudioVolumeType, callback: AsyncCallback): void; + /** + * Obtains the maximum volume allowed for a stream. This method uses a promise to return the query result. + * @param { AudioVolumeType } volumeType - Audio stream type. + * @returns { Promise } Promise used to return the maximum volume. + * @syscap SystemCapability.Multimedia.Audio.Volume + * @since 9 + */ + getMaxVolume(volumeType: AudioVolumeType): Promise; + /** + * Obtains the maximum volume allowed for a stream. + * @param { AudioVolumeType } volumeType - Audio stream type. + * @returns { number } Max volume level. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @throws { BusinessError } 6800101 - Parameter verification failed. + * @syscap SystemCapability.Multimedia.Audio.Volume + * @since 10 + */ + getMaxVolumeSync(volumeType: AudioVolumeType): number; + /** + * Checks whether a stream is muted. This method uses an asynchronous callback to return the query result. + * @param { AudioVolumeType } volumeType - Audio stream type. + * @param { AsyncCallback } callback - Callback used to return the mute status of the stream. The + * value true means that the stream is muted, and false means the opposite. + * @syscap SystemCapability.Multimedia.Audio.Volume + * @since 9 + */ + isMute(volumeType: AudioVolumeType, callback: AsyncCallback): void; + /** + * Checks whether a stream is muted. This method uses a promise to return the result. + * @param { AudioVolumeType } volumeType - Audio stream type. + * @returns { Promise } Promise used to return the mute status of the stream. The value true + * means that the stream is muted, and false means the opposite. + * @syscap SystemCapability.Multimedia.Audio.Volume + * @since 9 + */ + isMute(volumeType: AudioVolumeType): Promise; + /** + * Checks whether a stream is muted. + * @param { AudioVolumeType } volumeType - Audio stream type. + * @returns { boolean } The mute status of the stream. The value true + * means that the stream is muted, and false means the opposite. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @throws { BusinessError } 6800101 - Parameter verification failed. + * @syscap SystemCapability.Multimedia.Audio.Volume + * @since 10 + */ + isMuteSync(volumeType: AudioVolumeType): boolean; + /** + * Obtains the ringer mode. This method uses an asynchronous callback to return the query result. + * @param { AsyncCallback } callback - Callback used to return the ringer mode. + * @syscap SystemCapability.Multimedia.Audio.Volume + * @since 9 + */ + getRingerMode(callback: AsyncCallback): void; + /** + * Obtains the ringer mode. This method uses a promise to return the query result. + * @returns { Promise } Promise used to return the ringer mode. + * @syscap SystemCapability.Multimedia.Audio.Volume + * @since 9 + */ + getRingerMode(): Promise; + /** + * Obtains the ringer mode. + * @returns { AudioRingMode } Current ringer mode. + * @syscap SystemCapability.Multimedia.Audio.Volume + * @since 10 + */ + getRingerModeSync(): AudioRingMode; + /** + * Listens for ringer mode change events. This method uses a callback to get ringer mode changes. + * @param { 'ringerModeChange' } type - Type of the event to listen for. Only the ringerModeChange event is supported. + * @param { Callback } callback - Callback used to get the updated ringer mode. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @throws { BusinessError } 6800101 - Parameter verification failed. + * @syscap SystemCapability.Multimedia.Audio.Volume + * @since 9 + */ + on(type: 'ringerModeChange', callback: Callback): void; + /** + * Mutes or unmutes the microphone. This method uses an asynchronous callback to return the result. + * @permission ohos.permission.MANAGE_AUDIO_CONFIG + * @param { boolean } mute - Mute status to set. The value true means to mute the microphone, and false means the opposite. + * @param { AsyncCallback } callback - Callback used to return the result. + * @syscap SystemCapability.Multimedia.Audio.Volume + * @since 9 + * @deprecated since 11 + * @useinstead ohos.multimedia.audio.AudioVolumeGroupManager#setMicMute + */ + setMicrophoneMute(mute: boolean, callback: AsyncCallback): void; + /** + * Mutes or unmutes the microphone. This method uses a promise to return the result. + * @permission ohos.permission.MANAGE_AUDIO_CONFIG + * @param { boolean } mute - Mute status to set. The value true means to mute the microphone, and false means the opposite. + * @returns { Promise } Promise used to return the result. + * @syscap SystemCapability.Multimedia.Audio.Volume + * @since 9 + * @deprecated since 11 + * @useinstead ohos.multimedia.audio.AudioVolumeGroupManager#setMicMute + */ + setMicrophoneMute(mute: boolean): Promise; + /** + * Checks whether the microphone is muted. This method uses an asynchronous callback to return the query result. + * @param { AsyncCallback } callback - used to return the mute status of the microphone. The value + * true means that the microphone is muted, and false means the opposite. + * @syscap SystemCapability.Multimedia.Audio.Volume + * @since 9 + */ + isMicrophoneMute(callback: AsyncCallback): void; + /** + * Checks whether the microphone is muted. This method uses a promise to return the query result. + * @returns { Promise } Promise used to return the mute status of the microphone. The value true + * means that the microphone is muted, and false means the opposite. + * @syscap SystemCapability.Multimedia.Audio.Volume + * @since 9 + */ + isMicrophoneMute(): Promise; + /** + * Checks whether the microphone is muted. + * @returns { boolean } The mute status of the microphone. The value true + * means that the microphone is muted, and false means the opposite. + * @syscap SystemCapability.Multimedia.Audio.Volume + * @since 10 + */ + isMicrophoneMuteSync(): boolean; + /** + * Listens for system microphone state change events. This method uses a callback to get microphone change events. + * @param { 'micStateChange' } type - Type of the event to listen for. Only the micStateChange event is supported. + * @param { Callback } callback - Callback used to get the system microphone state change event. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @throws { BusinessError } 6800101 - Parameter verification failed. + * @syscap SystemCapability.Multimedia.Audio.Volume + * @since 9 + */ + on(type: 'micStateChange', callback: Callback): void; + /** + * Gets if this volume group is volume unadjustable. + * @returns { boolean } Whether it is volume unadjustable. + * @syscap SystemCapability.Multimedia.Audio.Volume + * @since 10 + */ + isVolumeUnadjustable(): boolean; + /** + * Gets the volume db value that system calculate by volume type, volume level and device type. + * This method uses an asynchronous callback to return the result. + * @param { AudioVolumeType } volumeType - Audio volume type. + * @param { number } volumeLevel - Volume level to set. + * @param { DeviceType } device - Output device type. + * @param { AsyncCallback } callback - Callback used to return the result. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @throws { BusinessError } 6800101 - Parameter verification failed. Return by callback. + * @throws { BusinessError } 6800301 - System error. Return by callback. + * @syscap SystemCapability.Multimedia.Audio.Volume + * @since 10 + */ + getSystemVolumeInDb(volumeType: AudioVolumeType, volumeLevel: number, device: DeviceType, callback: AsyncCallback): void; + /** + * Gets the volume db value that system calculate by volume type, volume level and device type. + * This method uses a promise to return the result. + * @param { AudioVolumeType } volumeType - Audio volume type. + * @param { number } volumeLevel - Volume level to set. + * @param { DeviceType } device - Output device type. + * @returns { Promise } Promise used to return the result. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @throws { BusinessError } 6800101 - Parameter verification failed. Return by promise. + * @throws { BusinessError } 6800301 - System error. Return by promise. + * @syscap SystemCapability.Multimedia.Audio.Volume + * @since 10 + */ + getSystemVolumeInDb(volumeType: AudioVolumeType, volumeLevel: number, device: DeviceType): Promise; + /** + * Gets the volume db value that system calculate by volume type, volume level and device type. + * @param { AudioVolumeType } volumeType - Audio volume type. + * @param { number } volumeLevel - Volume level to set. + * @param { DeviceType } device - Output device type. + * @returns { number } The system volume in dB. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @throws { BusinessError } 6800101 - Parameter verification failed. + * @syscap SystemCapability.Multimedia.Audio.Volume + * @since 10 + */ + getSystemVolumeInDbSync(volumeType: AudioVolumeType, volumeLevel: number, device: DeviceType): number; + /** + * Gets the max amplitude value for a specific input device. + * This method uses a promise to return the result. + * @param { AudioDeviceDescriptor } inputDevice - the target device. + * @returns { Promise } Promise used to return the max amplitude value. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @throws { BusinessError } 6800101 - Parameter verification failed. Return by promise. + * @throws { BusinessError } 6800301 - System error. Return by promise. + * @syscap SystemCapability.Multimedia.Audio.Volume + * @since 12 + */ + getMaxAmplitudeForInputDevice(inputDevice: AudioDeviceDescriptor): Promise; + /** + * Gets the max amplitude value for a specific output device. + * This method uses a promise to return the result. + * @param { AudioDeviceDescriptor } outputDevice - the target device. + * @returns { Promise } Promise used to return the max amplitude value. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @throws { BusinessError } 6800101 - Parameter verification failed. Return by promise. + * @throws { BusinessError } 6800301 - System error. Return by promise. + * @syscap SystemCapability.Multimedia.Audio.Volume + * @since 12 + */ + getMaxAmplitudeForOutputDevice(outputDevice: AudioDeviceDescriptor): Promise; + } + /** + * Array of AudioRendererChangeInfo, which is read-only. + * @typedef { Array> } AudioRendererChangeInfoArray + * @syscap SystemCapability.Multimedia.Audio.Renderer + * @since 9 + */ + type AudioRendererChangeInfoArray = Array>; + /** + * Describes audio renderer change information. + * @typedef AudioRendererChangeInfo + * @syscap SystemCapability.Multimedia.Audio.Renderer + * @since 9 + */ + interface AudioRendererChangeInfo { + /** + * Audio stream unique id. + * @syscap SystemCapability.Multimedia.Audio.Renderer + * @since 9 + */ + readonly streamId: number; + /** + * Audio renderer information. + * @syscap SystemCapability.Multimedia.Audio.Renderer + * @since 9 + */ + readonly rendererInfo: AudioRendererInfo; + /** + * Audio output devices. + * @syscap SystemCapability.Multimedia.Audio.Renderer + * @since 9 + */ + readonly deviceDescriptors: AudioDeviceDescriptors; + } + /** + * Array of AudioCapturerChangeInfo, which is read-only. + * @typedef { Array> } AudioCapturerChangeInfoArray + * @syscap SystemCapability.Multimedia.Audio.Capturer + * @since 9 + */ + type AudioCapturerChangeInfoArray = Array>; + /** + * Describes audio capturer change information. + * @typedef AudioCapturerChangeInfo + * @syscap SystemCapability.Multimedia.Audio.Capturer + * @since 9 + */ + interface AudioCapturerChangeInfo { + /** + * Audio stream unique id. + * @syscap SystemCapability.Multimedia.Audio.Capturer + * @since 9 + */ + readonly streamId: number; + /** + * Audio capturer information. + * @syscap SystemCapability.Multimedia.Audio.Capturer + * @since 9 + */ + readonly capturerInfo: AudioCapturerInfo; + /** + * Audio input devices. + * @syscap SystemCapability.Multimedia.Audio.Capturer + * @since 9 + */ + readonly deviceDescriptors: AudioDeviceDescriptors; + /** + * Audio capturer muted status. + * @syscap SystemCapability.Multimedia.Audio.Capturer + * @since 11 + */ + readonly muted?: boolean; + } + /** + * Describes an audio device. + * @typedef AudioDeviceDescriptor + * @syscap SystemCapability.Multimedia.Audio.Device + * @since 7 + */ + /** + * Describes an audio device. + * @typedef AudioDeviceDescriptor + * @syscap SystemCapability.Multimedia.Audio.Device + * @atomicservice + * @since 12 + */ + interface AudioDeviceDescriptor { + /** + * Audio device role. + * @syscap SystemCapability.Multimedia.Audio.Device + * @since 7 + */ + /** + * Audio device role. + * @syscap SystemCapability.Multimedia.Audio.Device + * @atomicservice + * @since 12 + */ + readonly deviceRole: DeviceRole; + /** + * Audio device type. + * @syscap SystemCapability.Multimedia.Audio.Device + * @since 7 + */ + /** + * Audio device type. + * @syscap SystemCapability.Multimedia.Audio.Device + * @atomicservice + * @since 12 + */ + readonly deviceType: DeviceType; + /** + * Audio device id. + * @syscap SystemCapability.Multimedia.Audio.Device + * @since 9 + */ + /** + * Audio device id. + * @syscap SystemCapability.Multimedia.Audio.Device + * @atomicservice + * @since 12 + */ + readonly id: number; + /** + * Audio device name. + * @syscap SystemCapability.Multimedia.Audio.Device + * @since 9 + */ + /** + * Audio device name. + * @syscap SystemCapability.Multimedia.Audio.Device + * @atomicservice + * @since 12 + */ + readonly name: string; + /** + * Audio device address. + * @syscap SystemCapability.Multimedia.Audio.Device + * @since 9 + */ + /** + * Audio device address. + * @syscap SystemCapability.Multimedia.Audio.Device + * @atomicservice + * @since 12 + */ + readonly address: string; + /** + * Supported sampling rates. + * @syscap SystemCapability.Multimedia.Audio.Device + * @since 9 + */ + /** + * Supported sampling rates. + * @syscap SystemCapability.Multimedia.Audio.Device + * @atomicservice + * @since 12 + */ + readonly sampleRates: Array; + /** + * Supported channel counts. + * @syscap SystemCapability.Multimedia.Audio.Device + * @since 9 + */ + /** + * Supported channel counts. + * @syscap SystemCapability.Multimedia.Audio.Device + * @atomicservice + * @since 12 + */ + readonly channelCounts: Array; + /** + * Supported channel masks. + * @syscap SystemCapability.Multimedia.Audio.Device + * @since 9 + */ + /** + * Supported channel masks. + * @syscap SystemCapability.Multimedia.Audio.Device + * @atomicservice + * @since 12 + */ + readonly channelMasks: Array; + /** + * Name used to display, considering distributed device situation. + * @syscap SystemCapability.Multimedia.Audio.Device + * @since 10 + */ + /** + * Name used to display, considering distributed device situation. + * @syscap SystemCapability.Multimedia.Audio.Device + * @atomicservice + * @since 12 + */ + readonly displayName: string; + /** + * Supported encoding types. + * @syscap SystemCapability.Multimedia.Audio.Core + * @since 11 + */ + /** + * Supported encoding types. + * @syscap SystemCapability.Multimedia.Audio.Core + * @atomicservice + * @since 12 + */ + readonly encodingTypes?: Array; + } + /** + * Array of AudioDeviceDescriptors, which is read-only. + * @typedef { Array> } AudioDeviceDescriptors + * @syscap SystemCapability.Multimedia.Audio.Device + * @since 7 + */ + /** + * Array of AudioDeviceDescriptors, which is read-only. + * @typedef { Array> } AudioDeviceDescriptors + * @syscap SystemCapability.Multimedia.Audio.Device + * @atomicservice + * @since 12 + */ + type AudioDeviceDescriptors = Array>; + /** + * Describes the volume event received by the app when the volume is changed. + * @typedef VolumeEvent + * @syscap SystemCapability.Multimedia.Audio.Volume + * @since 9 + */ + interface VolumeEvent { + /** + * Volume type of the current stream. + * @syscap SystemCapability.Multimedia.Audio.Volume + * @since 9 + */ + volumeType: AudioVolumeType; + /** + * Volume level. + * @syscap SystemCapability.Multimedia.Audio.Volume + * @since 9 + */ + volume: number; + /** + * Whether to show the volume change in UI. + * @syscap SystemCapability.Multimedia.Audio.Volume + * @since 9 + */ + updateUi: boolean; + } + /** + * Describes the callback invoked for audio interruption or focus gain events.When the audio of an application + * is interrupted by another application, the callback is invoked to notify the former application. + * @typedef InterruptAction + * @syscap SystemCapability.Multimedia.Audio.Renderer + * @since 7 + * @deprecated since 9 + * @useinstead ohos.multimedia.audio.InterruptEvent + */ + interface InterruptAction { + /** + * Event type. + * The value TYPE_ACTIVATED means the focus gain event, and TYPE_INTERRUPT means the audio interruption event. + * @syscap SystemCapability.Multimedia.Audio.Renderer + * @since 7 + * @deprecated since 9 + */ + actionType: InterruptActionType; + /** + * Type of the audio interruption event. + * @syscap SystemCapability.Multimedia.Audio.Renderer + * @since 7 + * @deprecated since 9 + */ + type?: InterruptType; + /** + * Hint for the audio interruption event. + * @syscap SystemCapability.Multimedia.Audio.Renderer + * @since 7 + * @deprecated since 9 + */ + hint?: InterruptHint; + /** + * Whether the focus is gained or released. The value true means that the focus is gained or released, + * and false means that the focus fails to be gained or released. + * @syscap SystemCapability.Multimedia.Audio.Renderer + * @since 7 + * @deprecated since 9 + */ + activated?: boolean; + } + /** + * Describes input parameters of audio listening events. + * @typedef AudioInterrupt + * @syscap SystemCapability.Multimedia.Audio.Renderer + * @since 7 + * @deprecated since 9 + */ + interface AudioInterrupt { + /** + * Audio stream usage type. + * @syscap SystemCapability.Multimedia.Audio.Renderer + * @since 7 + * @deprecated since 9 + */ + streamUsage: StreamUsage; + /** + * Type of the media interrupted. + * @syscap SystemCapability.Multimedia.Audio.Renderer + * @since 7 + * @deprecated since 9 + */ + contentType: ContentType; + /** + * Whether audio playback can be paused when it is interrupted. + * The value true means that audio playback can be paused when it is interrupted, and false means the opposite. + * @syscap SystemCapability.Multimedia.Audio.Renderer + * @since 7 + * @deprecated since 9 + */ + pauseWhenDucked: boolean; + } + /** + * Describes the microphone state change event received by the app when the microphone state is changed. + * @typedef MicStateChangeEvent + * @syscap SystemCapability.Multimedia.Audio.Device + * @since 9 + */ + interface MicStateChangeEvent { + /** + * Mic mute state. + * @syscap SystemCapability.Multimedia.Audio.Device + * @since 9 + */ + mute: boolean; + } + /** + * Describes the device change type and device information. + * @typedef DeviceChangeAction + * @syscap SystemCapability.Multimedia.Audio.Device + * @since 7 + */ + interface DeviceChangeAction { + /** + * Device change type. + * @syscap SystemCapability.Multimedia.Audio.Device + * @since 7 + */ + type: DeviceChangeType; + /** + * Device information. + * @syscap SystemCapability.Multimedia.Audio.Device + * @since 7 + */ + deviceDescriptors: AudioDeviceDescriptors; + } + /** + * Enumerates channel blend mode. + * @enum { number } + * @syscap SystemCapability.Multimedia.Audio.Core + * @since 11 + */ + enum ChannelBlendMode { + /** + * No channel process. + * @syscap SystemCapability.Multimedia.Audio.Core + * @since 11 + */ + MODE_DEFAULT = 0, + /** + * Blend left and right channel. + * @syscap SystemCapability.Multimedia.Audio.Core + * @since 11 + */ + MODE_BLEND_LR = 1, + /** + * Replicate left to right channel. + * @syscap SystemCapability.Multimedia.Audio.Core + * @since 11 + */ + MODE_ALL_LEFT = 2, + /** + * Replicate right to left channel. + * @syscap SystemCapability.Multimedia.Audio.Core + * @since 11 + */ + MODE_ALL_RIGHT = 3 + } + /** + * Enumerates audio stream device change reason. + * @enum {number} + * @syscap SystemCapability.Multimedia.Audio.Device + * @since 11 + */ + /** + * Enumerates audio stream device change reason. + * @enum {number} + * @syscap SystemCapability.Multimedia.Audio.Device + * @atomicservice + * @since 12 + */ + enum AudioStreamDeviceChangeReason { + /** + * Unknown. + * @syscap SystemCapability.Multimedia.Audio.Device + * @since 11 + */ + /** + * Unknown. + * @syscap SystemCapability.Multimedia.Audio.Device + * @atomicservice + * @since 12 + */ + REASON_UNKNOWN = 0, + /** + * New device available. + * @syscap SystemCapability.Multimedia.Audio.Device + * @since 11 + */ + /** + * New device available. + * @syscap SystemCapability.Multimedia.Audio.Device + * @atomicservice + * @since 12 + */ + REASON_NEW_DEVICE_AVAILABLE = 1, + /** + * Old device unavailable. Applications should consider to pause the audio playback when this reason is + * reported. + * @syscap SystemCapability.Multimedia.Audio.Device + * @since 11 + */ + /** + * Old device unavailable. Applications should consider to pause the audio playback when this reason is + * reported. + * @syscap SystemCapability.Multimedia.Audio.Device + * @atomicservice + * @since 12 + */ + REASON_OLD_DEVICE_UNAVAILABLE = 2, + /** + * Overrode by user or system. + * @syscap SystemCapability.Multimedia.Audio.Device + * @since 11 + */ + /** + * Overrode by user or system. + * @syscap SystemCapability.Multimedia.Audio.Device + * @atomicservice + * @since 12 + */ + REASON_OVERRODE = 3 + } + /** + * Audio stream device change info. + * @typedef AudioStreamDeviceChangeInfo + * @syscap SystemCapability.Multimedia.Audio.Device + * @since 11 + */ + /** + * Audio stream device change info. + * @typedef AudioStreamDeviceChangeInfo + * @syscap SystemCapability.Multimedia.Audio.Device + * @atomicservice + * @since 12 + */ + interface AudioStreamDeviceChangeInfo { + /** + * Audio device descriptors after change. + * @type {AudioDeviceDescriptors} + * @syscap SystemCapability.Multimedia.Audio.Device + * @since 11 + */ + /** + * Audio device descriptors after change. + * @type {AudioDeviceDescriptors} + * @syscap SystemCapability.Multimedia.Audio.Device + * @atomicservice + * @since 12 + */ + devices: AudioDeviceDescriptors; + /** + * Audio stream device change reason. + * @type {AudioStreamDeviceChangeReason} + * @syscap SystemCapability.Multimedia.Audio.Device + * @since 11 + */ + /** + * Audio stream device change reason. + * @type {AudioStreamDeviceChangeReason} + * @syscap SystemCapability.Multimedia.Audio.Device + * @atomicservice + * @since 12 + */ + changeReason: AudioStreamDeviceChangeReason; + } + /** + * Provides audio playback APIs. + * @typedef AudioRenderer + * @syscap SystemCapability.Multimedia.Audio.Renderer + * @since 8 + */ + interface AudioRenderer { + /** + * Defines the current render state. + * @syscap SystemCapability.Multimedia.Audio.Renderer + * @since 8 + */ + readonly state: AudioState; + /** + * Obtains the renderer information provided while creating a renderer instance. This method uses an asynchronous + * callback to return the result. + * @param { AsyncCallback } callback - Callback used to return the renderer information. + * @syscap SystemCapability.Multimedia.Audio.Renderer + * @since 8 + */ + getRendererInfo(callback: AsyncCallback): void; + /** + * Obtains the renderer information provided while creating a renderer instance. This method uses a promise to + * return the result. + * @returns { Promise } Promise used to return the renderer information. + * @syscap SystemCapability.Multimedia.Audio.Renderer + * @since 8 + */ + getRendererInfo(): Promise; + /** + * Obtains the renderer information provided while creating a renderer instance. + * @returns { AudioRendererInfo } The renderer information. + * @syscap SystemCapability.Multimedia.Audio.Renderer + * @since 10 + */ + getRendererInfoSync(): AudioRendererInfo; + /** + * Obtains the renderer stream information. This method uses an asynchronous callback to return the result. + * @param { AsyncCallback } callback - Callback used to return the stream information. + * @syscap SystemCapability.Multimedia.Audio.Renderer + * @since 8 + */ + getStreamInfo(callback: AsyncCallback): void; + /** + * Obtains the renderer stream information. This method uses a promise to return the result. + * @returns { Promise } Promise used to return the stream information. + * @syscap SystemCapability.Multimedia.Audio.Renderer + * @since 8 + */ + getStreamInfo(): Promise; + /** + * Obtains the renderer stream information. + * @returns { AudioStreamInfo } The stream information. + * @syscap SystemCapability.Multimedia.Audio.Renderer + * @since 10 + */ + getStreamInfoSync(): AudioStreamInfo; + /** + * Obtains the renderer stream id. This method uses an asynchronous callback to return the result. + * @param { AsyncCallback } callback - Callback used to return the stream id. + * @syscap SystemCapability.Multimedia.Audio.Renderer + * @since 9 + */ + getAudioStreamId(callback: AsyncCallback): void; + /** + * Obtains the renderer stream id. This method uses a promise to return the result. + * @returns { Promise } Promise used to return the stream id. + * @syscap SystemCapability.Multimedia.Audio.Renderer + * @since 9 + */ + getAudioStreamId(): Promise; + /** + * Obtains the renderer stream id. + * @returns { number } The stream id. + * @syscap SystemCapability.Multimedia.Audio.Renderer + * @since 10 + */ + getAudioStreamIdSync(): number; + /** + * Obtains the current audio effect mode. This method uses an asynchronous callback to return the query result. + * @param { AsyncCallback } callback - Callback used to return the current audio effect mode. + * @syscap SystemCapability.Multimedia.Audio.Renderer + * @since 10 + */ + getAudioEffectMode(callback: AsyncCallback): void; + /** + * Obtains the current audio effect mode. This method uses a promise to return the query result. + * @returns { Promise } Promise used to return the current audio effect mode. + * @syscap SystemCapability.Multimedia.Audio.Renderer + * @since 10 + */ + getAudioEffectMode(): Promise; + /** + * Sets the current audio effect mode. This method uses an asynchronous callback to return the result. + * @param { AudioEffectMode } mode - Audio effect mode. + * @param { AsyncCallback } callback - Callback used to return the result. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @throws { BusinessError } 6800101 - Parameter verification failed. Return by callback. + * @syscap SystemCapability.Multimedia.Audio.Renderer + * @since 10 + */ + setAudioEffectMode(mode: AudioEffectMode, callback: AsyncCallback): void; + /** + * Sets the current audio effect mode. This method uses a promise to return the result. + * @param { AudioEffectMode } mode - Audio effect mode. + * @returns { Promise } Promise used to return the result. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @throws { BusinessError } 6800101 - Parameter verification failed. Return by promise. + * @syscap SystemCapability.Multimedia.Audio.Renderer + * @since 10 + */ + setAudioEffectMode(mode: AudioEffectMode): Promise; + /** + * Starts the renderer. This method uses an asynchronous callback to return the result. + * @param { AsyncCallback } callback - Callback used to return the result. + * @syscap SystemCapability.Multimedia.Audio.Renderer + * @since 8 + */ + start(callback: AsyncCallback): void; + /** + * Starts the renderer. This method uses a promise to return the result. + * @returns { Promise } Promise used to return the result. + * @syscap SystemCapability.Multimedia.Audio.Renderer + * @since 8 + */ + start(): Promise; + /** + * Writes the buffer. This method uses an asynchronous callback to return the result. + * @param { ArrayBuffer } buffer - Buffer to be written. + * @param { AsyncCallback } callback - Returns the number of bytes written if the operation is successful. + * Returns an error code otherwise. + * @syscap SystemCapability.Multimedia.Audio.Renderer + * @since 8 + * @deprecated since 11 + * @useinstead ohos.multimedia.audio.AudioRenderer#event:writeData + */ + write(buffer: ArrayBuffer, callback: AsyncCallback): void; + /** + * Writes the buffer. This method uses a promise to return the result. + * @param { ArrayBuffer } buffer - Buffer to be written. + * @returns { Promise } Returns the number of bytes written if the operation is successful. + * Returns an error code otherwise. + * @syscap SystemCapability.Multimedia.Audio.Renderer + * @since 8 + * @deprecated since 11 + * @useinstead ohos.multimedia.audio.AudioRenderer#event:writeData + */ + write(buffer: ArrayBuffer): Promise; + /** + * Obtains the timestamp in Unix epoch time (starts from January 1, 1970), in nanoseconds. This method uses an + * asynchronous callback to return the result. + * @param { AsyncCallback } callback - Callback used to return the timestamp. + * @syscap SystemCapability.Multimedia.Audio.Renderer + * @since 8 + */ + getAudioTime(callback: AsyncCallback): void; + /** + * Obtains the timestamp in Unix epoch time (starts from January 1, 1970), in nanoseconds. This method uses a + * promise to return the result. + * @returns { Promise } Promise used to return the timestamp. + * @syscap SystemCapability.Multimedia.Audio.Renderer + * @since 8 + */ + getAudioTime(): Promise; + /** + * Obtains the timestamp in Unix epoch time (starts from January 1, 1970), in nanoseconds. + * @returns { number } The audio timestamp. + * @syscap SystemCapability.Multimedia.Audio.Renderer + * @since 10 + */ + getAudioTimeSync(): number; + /** + * Drains the playback buffer. This method uses an asynchronous callback to return the result. + * @param { AsyncCallback } callback - Callback used to return the result. + * @syscap SystemCapability.Multimedia.Audio.Renderer + * @since 8 + */ + drain(callback: AsyncCallback): void; + /** + * Drains the playback buffer. This method uses a promise to return the result. + * @returns { Promise } Promise used to return the result. + * @syscap SystemCapability.Multimedia.Audio.Renderer + * @since 8 + */ + drain(): Promise; + /** + * Flushes the playback buffer. This method uses a promise to return the result. + * @returns { Promise } Promise used to return the result. + * @throws { BusinessError } 6800103 - Operation not permit at current state. Return by promise. + * @syscap SystemCapability.Multimedia.Audio.Renderer + * @since 11 + */ + flush(): Promise; + /** + * Pauses rendering. This method uses an asynchronous callback to return the result. + * @param { AsyncCallback } callback - Callback used to return the result. + * @syscap SystemCapability.Multimedia.Audio.Renderer + * @since 8 + */ + pause(callback: AsyncCallback): void; + /** + * Pauses rendering. This method uses a promise to return the result. + * @returns { Promise } Promise used to return the result. + * @syscap SystemCapability.Multimedia.Audio.Renderer + * @since 8 + */ + pause(): Promise; + /** + * Stops rendering. This method uses an asynchronous callback to return the result. + * @param { AsyncCallback } callback - Callback used to return the result. + * @syscap SystemCapability.Multimedia.Audio.Renderer + * @since 8 + */ + stop(callback: AsyncCallback): void; + /** + * Stops rendering. This method uses a promise to return the result. + * @returns { Promise } Promise used to return the result. + * @syscap SystemCapability.Multimedia.Audio.Renderer + * @since 8 + */ + stop(): Promise; + /** + * Releases the renderer. This method uses an asynchronous callback to return the result. + * @param { AsyncCallback } callback - Callback used to return the result. + * @syscap SystemCapability.Multimedia.Audio.Renderer + * @since 8 + */ + release(callback: AsyncCallback): void; + /** + * Releases the renderer. This method uses a promise to return the result. + * @returns { Promise } Promise used to return the result. + * @syscap SystemCapability.Multimedia.Audio.Renderer + * @since 8 + */ + release(): Promise; + /** + * Obtains a reasonable minimum buffer size in bytes for rendering. This method uses an asynchronous callback to + * return the result. + * @param { AsyncCallback } callback - Callback used to return the buffer size. + * @syscap SystemCapability.Multimedia.Audio.Renderer + * @since 8 + */ + getBufferSize(callback: AsyncCallback): void; + /** + * Obtains a reasonable minimum buffer size in bytes for rendering. This method uses a promise to return the result. + * @returns { Promise } Promise used to return the buffer size. + * @syscap SystemCapability.Multimedia.Audio.Renderer + * @since 8 + */ + getBufferSize(): Promise; + /** + * Obtains a reasonable minimum buffer size in bytes for rendering. + * @returns { number } The audio buffer size. + * @syscap SystemCapability.Multimedia.Audio.Renderer + * @since 10 + */ + getBufferSizeSync(): number; + /** + * Sets the render rate. This method uses an asynchronous callback to return the result. + * @param { AudioRendererRate } rate - Audio render rate. + * @param { AsyncCallback } callback - Callback used to return the result. + * @syscap SystemCapability.Multimedia.Audio.Renderer + * @since 8 + * @deprecated since 11 + * @useinstead ohos.multimedia.audio.AudioRenderer#setSpeed + */ + setRenderRate(rate: AudioRendererRate, callback: AsyncCallback): void; + /** + * Sets the render rate. This method uses a promise to return the result. + * @param { AudioRendererRate } rate - Audio render rate. + * @returns { Promise } Promise used to return the result. + * @syscap SystemCapability.Multimedia.Audio.Renderer + * @since 8 + * @deprecated since 11 + * @useinstead ohos.multimedia.audio.AudioRenderer#setSpeed + */ + setRenderRate(rate: AudioRendererRate): Promise; + /** + * Sets the playback speed. + * @param { number } speed - Audio playback speed. The value type is float, form 0.25 to 4.0. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @throws { BusinessError } 6800101 - Parameter verification failed. + * @syscap SystemCapability.Multimedia.Audio.Renderer + * @since 11 + */ + setSpeed(speed: number): void; + /** + * Obtains the current render rate. This method uses an asynchronous callback to return the result. + * @param { AsyncCallback } callback - Callback used to return the audio render rate. + * @syscap SystemCapability.Multimedia.Audio.Renderer + * @since 8 + * @deprecated since 11 + * @useinstead ohos.multimedia.audio.AudioRenderer#getSpeed + */ + getRenderRate(callback: AsyncCallback): void; + /** + * Obtains the current render rate. This method uses a promise to return the result. + * @returns { Promise } Promise used to return the audio render rate. + * @syscap SystemCapability.Multimedia.Audio.Renderer + * @since 8 + * @deprecated since 11 + * @useinstead ohos.multimedia.audio.AudioRenderer#getSpeed + */ + getRenderRate(): Promise; + /** + * Obtains the current render rate. + * @returns { AudioRendererRate } The audio render rate. + * @syscap SystemCapability.Multimedia.Audio.Renderer + * @since 10 + * @deprecated since 11 + * @useinstead ohos.multimedia.audio.AudioRenderer#getSpeed + */ + getRenderRateSync(): AudioRendererRate; + /** + * Obtains the current playback speed. + * @returns { number } The playback speed. + * @syscap SystemCapability.Multimedia.Audio.Renderer + * @since 11 + */ + getSpeed(): number; + /** + * Set interrupt mode. + * @param { InterruptMode } mode - The interrupt mode. + * @param { AsyncCallback } callback - Callback used to return the result. + * @syscap SystemCapability.Multimedia.Audio.Interrupt + * @since 9 + */ + setInterruptMode(mode: InterruptMode, callback: AsyncCallback): void; + /** + * Set interrupt mode. + * @param { InterruptMode } mode - The interrupt mode. + * @returns { Promise } Promise used to return the result. + * @syscap SystemCapability.Multimedia.Audio.Interrupt + * @since 9 + */ + setInterruptMode(mode: InterruptMode): Promise; + /** + * Set interrupt mode. + * @param { InterruptMode } mode - The interrupt mode. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @throws { BusinessError } 6800101 - Parameter verification failed. + * @syscap SystemCapability.Multimedia.Audio.Interrupt + * @since 10 + */ + setInterruptModeSync(mode: InterruptMode): void; + /** + * Sets the volume for this stream. This method uses an asynchronous callback to return the result. + * @param { number } volume - Volume to set. The value type is float, form 0.0 to 1.0. + * @param { AsyncCallback } callback - Callback used to return the result. + * @syscap SystemCapability.Multimedia.Audio.Renderer + * @since 9 + */ + setVolume(volume: number, callback: AsyncCallback): void; + /** + * Sets the volume for a stream. This method uses a promise to return the result. + * @param { number } volume - Volume to set. The value type is float, form 0.0 to 1.0. + * @returns { Promise } Promise used to return the result. + * @syscap SystemCapability.Multimedia.Audio.Renderer + * @since 9 + */ + setVolume(volume: number): Promise; + /** + * Gets volume of this stream. + * @returns { number } Returns one float value. + * @syscap SystemCapability.Multimedia.Audio.Renderer + * @since 12 + */ + getVolume(): number; + /** + * Changes the volume with ramp for a duration. + * @param { number } volume - Volume to set. The value type is float, form 0.0 to 1.0. + * @param { number } duration - Duration for volume ramp, in millisecond. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @throws { BusinessError } 6800101 - Parameter verification failed. + * @syscap SystemCapability.Multimedia.Audio.Renderer + * @since 11 + */ + setVolumeWithRamp(volume: number, duration: number): void; + /** + * Gets the min volume this stream can set. This method uses an asynchronous callback to return the result. + * @param { AsyncCallback } callback - Callback used to return the result. + * @syscap SystemCapability.Multimedia.Audio.Renderer + * @since 10 + */ + getMinStreamVolume(callback: AsyncCallback): void; + /** + * Gets the min volume this stream can set. This method uses a promise to return the result. + * @returns { Promise } Promise used to return the result. + * @syscap SystemCapability.Multimedia.Audio.Renderer + * @since 10 + */ + getMinStreamVolume(): Promise; + /** + * Gets the min volume this stream can set. + * @returns { number } Min stream volume. + * @syscap SystemCapability.Multimedia.Audio.Renderer + * @since 10 + */ + getMinStreamVolumeSync(): number; + /** + * Gets the max volume this stream can set. This method uses an asynchronous callback to return the result. + * @param { AsyncCallback } callback - Callback used to return the result. + * @syscap SystemCapability.Multimedia.Audio.Renderer + * @since 10 + */ + getMaxStreamVolume(callback: AsyncCallback): void; + /** + * Gets the max volume this stream can set. This method uses a promise to return the result. + * @returns { Promise } Promise used to return the result. + * @syscap SystemCapability.Multimedia.Audio.Renderer + * @since 10 + */ + getMaxStreamVolume(): Promise; + /** + * Gets the max volume this stream can set. + * @returns { number } Max stream volume. + * @syscap SystemCapability.Multimedia.Audio.Renderer + * @since 10 + */ + getMaxStreamVolumeSync(): number; + /** + * Gets buffer underflow count. This method uses an asynchronous callback to return the result. + * @param { AsyncCallback } callback - Callback used to return the result. + * @syscap SystemCapability.Multimedia.Audio.Renderer + * @since 10 + */ + getUnderflowCount(callback: AsyncCallback): void; + /** + * Gets buffer underflow count. This method uses a promise to return the result. + * @returns { Promise } Promise used to return the result. + * @syscap SystemCapability.Multimedia.Audio.Renderer + * @since 10 + */ + getUnderflowCount(): Promise; + /** + * Gets buffer underflow count. + * @returns { number } Underflow count number. + * @syscap SystemCapability.Multimedia.Audio.Renderer + * @since 10 + */ + getUnderflowCountSync(): number; + /** + * Gets the output device or devices for this stream. + * This method uses an asynchronous callback to return the result. + * @param { AsyncCallback } callback - Callback used to return the result. + * @syscap SystemCapability.Multimedia.Audio.Device + * @since 10 + */ + getCurrentOutputDevices(callback: AsyncCallback): void; + /** + * Gets the output device or devices for this stream. + * This method uses a promise to return the result. + * @returns { Promise } Promise used to return the result. + * @syscap SystemCapability.Multimedia.Audio.Device + * @since 10 + */ + getCurrentOutputDevices(): Promise; + /** + * Gets the output device or devices for this stream. + * @returns { AudioDeviceDescriptors } Output device or devices. + * @syscap SystemCapability.Multimedia.Audio.Device + * @since 10 + */ + getCurrentOutputDevicesSync(): AudioDeviceDescriptors; + /** + * Sets channel blend mode for this stream. + * @param { ChannelBlendMode } mode - Target channel blend mode. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @throws { BusinessError } 6800101 - Parameter verification failed. + * @throws { BusinessError } 6800103 - Operation not permit at current state. + * @syscap SystemCapability.Multimedia.Audio.Renderer + * @since 11 + */ + setChannelBlendMode(mode: ChannelBlendMode): void; + /** + * Listens for audio interrupt events. This method uses a callback to get interrupt events. The interrupt event is + * triggered when audio playback is interrupted. + * @param { 'audioInterrupt' } type - Type of the event to listen for. Only the audioInterrupt event is supported. + * @param { Callback } callback - Callback used to listen for interrupt callback. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @throws { BusinessError } 6800101 - Parameter verification failed. + * @syscap SystemCapability.Multimedia.Audio.Interrupt + * @since 9 + */ + on(type: 'audioInterrupt', callback: Callback): void; + /** + * Subscribes to mark reached events. When the number of frames rendered reaches the value of the frame parameter, + * the callback is invoked. + * @param { 'markReach' } type - Type of the event to listen for. Only the markReach event is supported. + * @param { number } frame - Number of frames to trigger the event. The value must be greater than 0. + * @param { Callback } callback - Callback invoked when the event is triggered. + * @syscap SystemCapability.Multimedia.Audio.Renderer + * @since 8 + */ + on(type: 'markReach', frame: number, callback: Callback): void; + /** + * Unsubscribes from mark reached events. + * @param { 'markReach' } type - Type of the event to listen for. Only the markReach event is supported. + * @syscap SystemCapability.Multimedia.Audio.Renderer + * @since 8 + */ + off(type: 'markReach'): void; + /** + * Subscribes to period reached events. When the period of frame rendering reaches the value of frame parameter, + * the callback is invoked. + * @param { 'periodReach' } type - Type of the event to listen for. Only the periodReach event is supported. + * @param { number } frame - Period during which frame rendering is listened. The value must be greater than 0. + * @param { Callback } callback - Callback invoked when the event is triggered. + * @syscap SystemCapability.Multimedia.Audio.Renderer + * @since 8 + */ + on(type: 'periodReach', frame: number, callback: Callback): void; + /** + * Unsubscribes from period reached events. + * @param { 'periodReach' } type - Type of the event to listen for. Only the periodReach event is supported. + * @syscap SystemCapability.Multimedia.Audio.Renderer + * @since 8 + */ + off(type: 'periodReach'): void; + /** + * Subscribes audio state change event callback. + * @param { 'stateChange' } type - Type of the event to listen for. Only the stateChange event is supported. + * @param { Callback } callback - Callback invoked when state change. + * @syscap SystemCapability.Multimedia.Audio.Renderer + * @since 8 + */ + on(type: 'stateChange', callback: Callback): void; + /** + * Subscribes output device change event callback. + * The event is triggered when output device change for this stream. + * @param { 'outputDeviceChange' } type - Type of the event to listen for. + * @param { Callback } callback - Callback used to listen device change event. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @throws { BusinessError } 6800101 - Parameter verification failed. + * @syscap SystemCapability.Multimedia.Audio.Device + * @since 10 + */ + on(type: 'outputDeviceChange', callback: Callback): void; + /** + * Subscribes output device change event callback. + * The event is triggered when output device change for this stream. + * @param { 'outputDeviceChangeWithInfo' } type - Type of the event to listen for. + * @param { Callback } callback - Callback used to listen device change event. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @throws { BusinessError } 6800101 - Parameter verification failed. + * @syscap SystemCapability.Multimedia.Audio.Device + * @since 11 + */ + on(type: 'outputDeviceChangeWithInfo', callback: Callback): void; + /** + * Unsubscribes output device change event callback. + * @param { 'outputDeviceChange' } type - Type of the event to listen for. + * @param { Callback } callback - Callback used in subscribe. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @throws { BusinessError } 6800101 - Parameter verification failed. + * @syscap SystemCapability.Multimedia.Audio.Device + * @since 10 + */ + off(type: 'outputDeviceChange', callback?: Callback): void; + /** + * Unsubscribes output device change event callback. + * @param { 'outputDeviceChangeWithInfo' } type - Type of the event to listen for. + * @param { Callback } callback - Callback used in subscribe. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @throws { BusinessError } 6800101 - Parameter verification failed. + * @syscap SystemCapability.Multimedia.Audio.Device + * @since 11 + */ + off(type: 'outputDeviceChangeWithInfo', callback?: Callback): void; + /** + * Subscribes audio data callback. + * The event is triggered when audio buffer is available for writing more data. + * @param { 'writeData' } type - Type of the event to listen for. + * @param { Callback } callback - Callback with buffer to write. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @throws { BusinessError } 6800101 - Parameter verification failed. + * @syscap SystemCapability.Multimedia.Audio.Renderer + * @since 11 + */ + on(type: 'writeData', callback: Callback): void; + /** + * Unsubscribes audio data callback. + * @param { 'writeData' } type - Type of the event to listen for. + * @param { Callback } callback - Callback used in subscribe. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @throws { BusinessError } 6800101 - Parameter verification failed. + * @syscap SystemCapability.Multimedia.Audio.Renderer + * @since 11 + */ + off(type: 'writeData', callback?: Callback): void; + } + /** + * Enumerates source types. + * @enum { number } + * @syscap SystemCapability.Multimedia.Audio.Core + * @since 8 + */ + enum SourceType { + /** + * Invalid source type. + * @syscap SystemCapability.Multimedia.Audio.Core + * @since 8 + */ + SOURCE_TYPE_INVALID = -1, + /** + * Mic source type. + * @syscap SystemCapability.Multimedia.Audio.Core + * @since 8 + */ + SOURCE_TYPE_MIC = 0, + /** + * Voice recognition source type. + * @syscap SystemCapability.Multimedia.Audio.Core + * @since 9 + */ + SOURCE_TYPE_VOICE_RECOGNITION = 1, + /** + * Playback capture source type. + * @syscap SystemCapability.Multimedia.Audio.PlaybackCapture + * @since 10 + * @deprecated since 12 + * @useinstead OH_AVScreenCapture in native interface. + */ + SOURCE_TYPE_PLAYBACK_CAPTURE = 2, + /** + * Voice communication source type. + * @syscap SystemCapability.Multimedia.Audio.Core + * @since 8 + */ + SOURCE_TYPE_VOICE_COMMUNICATION = 7, + /** + * Voice message source type. + * @syscap SystemCapability.Multimedia.Audio.Core + * @since 12 + */ + SOURCE_TYPE_VOICE_MESSAGE = 10 + } + /** + * Describes audio capturer information. + * @typedef AudioCapturerInfo + * @syscap SystemCapability.Multimedia.Audio.Core + * @since 8 + */ + interface AudioCapturerInfo { + /** + * Audio source type. + * @syscap SystemCapability.Multimedia.Audio.Core + * @since 8 + */ + source: SourceType; + /** + * Audio capturer flags. + * @syscap SystemCapability.Multimedia.Audio.Core + * @since 8 + */ + capturerFlags: number; + } + /** + * Describes audio capturer configuration options. + * @typedef AudioCapturerOptions + * @syscap SystemCapability.Multimedia.Audio.Capturer + * @since 8 + */ + interface AudioCapturerOptions { + /** + * Stream information. + * @syscap SystemCapability.Multimedia.Audio.Capturer + * @since 8 + */ + streamInfo: AudioStreamInfo; + /** + * Capturer information. + * @syscap SystemCapability.Multimedia.Audio.Capturer + * @since 8 + */ + capturerInfo: AudioCapturerInfo; + /** + * Playback capture config. + * @syscap SystemCapability.Multimedia.Audio.PlaybackCapture + * @since 10 + * @deprecated since 12 + * @useinstead OH_AVScreenCapture in native interface. + */ + playbackCaptureConfig?: AudioPlaybackCaptureConfig; + } + /** + * Describe playback capture filtering options + * @typedef CaptureFilterOptions + * @syscap SystemCapability.Multimedia.Audio.PlaybackCapture + * @since 10 + * @deprecated since 12 + * @useinstead OH_AVScreenCapture in native interface. + */ + interface CaptureFilterOptions { + /** + * Filter by stream usages. If you want to capture voice streams, additional permission is needed. + * @permission ohos.permission.CAPTURE_VOICE_DOWNLINK_AUDIO + * @syscap SystemCapability.Multimedia.Audio.PlaybackCapture + * @since 10 + */ + /** + * Filter by stream usages. But not allow to capture voice streams. + * @syscap SystemCapability.Multimedia.Audio.PlaybackCapture + * @since 11 + * @deprecated since 12 + * @useinstead OH_AVScreenCapture in native interface. + */ + usages: Array; + } + /** + * Describe playback capture config object. + * @typedef AudioPlaybackCaptureConfig + * @syscap SystemCapability.Multimedia.Audio.PlaybackCapture + * @since 10 + * @deprecated since 12 + * @useinstead OH_AVScreenCapture in native interface. + */ + interface AudioPlaybackCaptureConfig { + /** + * Add filter options to decide which streams to be captured. + * @syscap SystemCapability.Multimedia.Audio.PlaybackCapture + * @since 10 + * @deprecated since 12 + * @useinstead OH_AVScreenCapture in native interface. + */ + filterOptions: CaptureFilterOptions; + } + /** + * Provides APIs for audio recording. + * @typedef AudioCapturer + * @syscap SystemCapability.Multimedia.Audio.Capturer + * @since 8 + */ + interface AudioCapturer { + /** + * Defines the current capture state. + * @syscap SystemCapability.Multimedia.Audio.Capturer + * @since 8 + */ + readonly state: AudioState; + /** + * Obtains the capturer information provided while creating a capturer instance. This method uses an asynchronous + * callback to return the result. + * @param { AsyncCallback } callback - Callback used to return the capturer information. + * @syscap SystemCapability.Multimedia.Audio.Capturer + * @since 8 + */ + getCapturerInfo(callback: AsyncCallback): void; + /** + * Obtains the capturer information provided while creating a capturer instance. This method uses a promise to + * return the result. + * @returns { Promise } Promise used to return the capturer information. + * @syscap SystemCapability.Multimedia.Audio.Capturer + * @since 8 + */ + getCapturerInfo(): Promise; + /** + * Obtains the capturer information provided while creating a capturer instance. + * @returns { AudioCapturerInfo } The capturer information. + * @syscap SystemCapability.Multimedia.Audio.Capturer + * @since 10 + */ + getCapturerInfoSync(): AudioCapturerInfo; + /** + * Obtains the capturer stream information. This method uses an asynchronous callback to return the result. + * @param { AsyncCallback } callback - Callback used to return the stream information. + * @syscap SystemCapability.Multimedia.Audio.Capturer + * @since 8 + */ + getStreamInfo(callback: AsyncCallback): void; + /** + * Obtains the capturer stream information. This method uses a promise to return the result. + * @returns { Promise } Promise used to return the stream information. + * @syscap SystemCapability.Multimedia.Audio.Capturer + * @since 8 + */ + getStreamInfo(): Promise; + /** + * Obtains the capturer stream information. + * @returns { AudioStreamInfo } The stream information. + * @syscap SystemCapability.Multimedia.Audio.Capturer + * @since 10 + */ + getStreamInfoSync(): AudioStreamInfo; + /** + * Obtains the capturer stream id. This method uses an asynchronous callback to return the result. + * @param { AsyncCallback } callback - Callback used to return the stream id. + * @syscap SystemCapability.Multimedia.Audio.Capturer + * @since 9 + */ + getAudioStreamId(callback: AsyncCallback): void; + /** + * Obtains the capturer stream id. This method uses a promise to return the result. + * @returns { Promise } Promise used to return the stream id. + * @syscap SystemCapability.Multimedia.Audio.Capturer + * @since 9 + */ + getAudioStreamId(): Promise; + /** + * Obtains the capturer stream id. + * @returns { number } The stream id. + * @syscap SystemCapability.Multimedia.Audio.Capturer + * @since 10 + */ + getAudioStreamIdSync(): number; + /** + * Starts capturing. This method uses an asynchronous callback to return the result. + * @param { AsyncCallback } callback - Callback used to return the result. + * @syscap SystemCapability.Multimedia.Audio.Capturer + * @since 8 + */ + start(callback: AsyncCallback): void; + /** + * Starts capturing. This method uses a promise to return the result. + * @returns { Promise } Promise used to return the result. + * @syscap SystemCapability.Multimedia.Audio.Capturer + * @since 8 + */ + start(): Promise; + /** + * Reads the buffer from the audio capturer. This method uses an asynchronous callback to return the result. + * @param { number } size - Number of bytes to read. + * @param { boolean } isBlockingRead - Whether the read operation should be blocked. + * @param { AsyncCallback } callback - Callback used to return the buffer. + * @syscap SystemCapability.Multimedia.Audio.Capturer + * @since 8 + * @deprecated since 11 + * @useinstead ohos.multimedia.audio.AudioCapturer#event:readData + */ + read(size: number, isBlockingRead: boolean, callback: AsyncCallback): void; + /** + * Reads the buffer from the audio capturer. This method uses a promise to return the result. + * @param { number } size - Number of bytes to read. + * @param { boolean } isBlockingRead - Whether the read operation should be blocked. + * @returns { Promise } Returns the buffer data read if the operation is successful. + * Returns an error code otherwise. + * @syscap SystemCapability.Multimedia.Audio.Capturer + * @since 8 + * @deprecated since 11 + * @useinstead ohos.multimedia.audio.AudioCapturer#event:readData + */ + read(size: number, isBlockingRead: boolean): Promise; + /** + * Obtains the timestamp in Unix epoch time (starts from January 1, 1970), in nanoseconds. This method uses an + * asynchronous callback to return the result. + * @param { AsyncCallback } callback - Callback used to return the timestamp. + * @syscap SystemCapability.Multimedia.Audio.Capturer + * @since 8 + */ + getAudioTime(callback: AsyncCallback): void; + /** + * Obtains the timestamp in Unix epoch time (starts from January 1, 1970), in nanoseconds. This method uses a + * promise to return the result. + * @returns { Promise } Promise used to return the timestamp. + * @syscap SystemCapability.Multimedia.Audio.Capturer + * @since 8 + */ + getAudioTime(): Promise; + /** + * Obtains the timestamp in Unix epoch time (starts from January 1, 1970), in nanoseconds. + * @returns { number } The audio timestamp. + * @syscap SystemCapability.Multimedia.Audio.Capturer + * @since 10 + */ + getAudioTimeSync(): number; + /** + * Stops capturing. This method uses an asynchronous callback to return the result. + * @param { AsyncCallback } callback - Callback used to return the result. + * @syscap SystemCapability.Multimedia.Audio.Capturer + * @since 8 + */ + stop(callback: AsyncCallback): void; + /** + * Stops capturing. This method uses a promise to return the result. + * @returns { Promise } Promise used to return the result. + * @syscap SystemCapability.Multimedia.Audio.Capturer + * @since 8 + */ + stop(): Promise; + /** + * Releases the capturer. This method uses an asynchronous callback to return the result. + * @param { AsyncCallback } callback - Callback used to return the result. + * @syscap SystemCapability.Multimedia.Audio.Capturer + * @since 8 + */ + release(callback: AsyncCallback): void; + /** + * Releases the capturer. This method uses a promise to return the result. + * @returns { Promise } - Promise used to return the result. + * @syscap SystemCapability.Multimedia.Audio.Capturer + * @since 8 + */ + release(): Promise; + /** + * Obtains a reasonable minimum buffer size in bytes for capturing. This method uses an asynchronous callback to + * return the result. + * @param { AsyncCallback } callback - Callback used to return the buffer size. + * @syscap SystemCapability.Multimedia.Audio.Capturer + * @since 8 + */ + getBufferSize(callback: AsyncCallback): void; + /** + * Obtains a reasonable minimum buffer size in bytes for capturing. This method uses a promise to return the result. + * @returns { Promise } Promise used to return the buffer size. + * @syscap SystemCapability.Multimedia.Audio.Capturer + * @since 8 + */ + getBufferSize(): Promise; + /** + * Obtains a reasonable minimum buffer size in bytes for capturing. + * @returns { number } Promise used to return the buffer size. + * @syscap SystemCapability.Multimedia.Audio.Capturer + * @since 10 + */ + getBufferSizeSync(): number; + /** + * Gets the input device or devices for this stream. + * @returns { AudioDeviceDescriptors } Descriptors of input devices. + * @syscap SystemCapability.Multimedia.Audio.Device + * @since 11 + */ + getCurrentInputDevices(): AudioDeviceDescriptors; + /** + * Gets full capturer info for this stream. + * @returns { AudioCapturerChangeInfo } Full capture info. + * @syscap SystemCapability.Multimedia.Audio.Device + * @since 11 + */ + getCurrentAudioCapturerChangeInfo(): AudioCapturerChangeInfo; + /** + * Gets overflow count. + * @returns { Promise } - Promise used to return the result. + * @syscap SystemCapability.Multimedia.Audio.Capturer + * @since 12 + */ + getOverflowCount(): Promise; + /** + * Gets overflow count. + * @returns { number } Overflow count number. + * @syscap SystemCapability.Multimedia.Audio.Capturer + * @since 12 + */ + getOverflowCountSync(): number; + /** + * Subscribes to mark reached events. When the number of frames captured reaches the value of the frame parameter, + * the callback is invoked. + * @param { 'markReach' } type - Type of the event to listen for. Only the markReach event is supported. + * @param { number } frame - Number of frames to trigger the event. The value must be greater than 0. + * @param { Callback } callback - Callback invoked when the event is triggered. + * @syscap SystemCapability.Multimedia.Audio.Capturer + * @since 8 + */ + on(type: 'markReach', frame: number, callback: Callback): void; + /** + * Unsubscribes from the mark reached events. + * @param { 'markReach' } type - Type of the event to listen for. Only the markReach event is supported. + * @syscap SystemCapability.Multimedia.Audio.Capturer + * @since 8 + */ + off(type: 'markReach'): void; + /** + * Subscribes to period reached events. When the period of frame capturing reaches the value of frame parameter, + * the callback is invoked. + * @param { 'periodReach' } type - Type of the event to listen for. Only the periodReach event is supported. + * @param { number } frame - Period during which frame capturing is listened. The value must be greater than 0. + * @param { Callback } callback - Callback invoked when the event is triggered. + * @syscap SystemCapability.Multimedia.Audio.Capturer + * @since 8 + */ + on(type: 'periodReach', frame: number, callback: Callback): void; + /** + * Unsubscribes from period reached events. + * @param { 'periodReach' } type - Type of the event to listen for. Only the periodReach event is supported. + * @syscap SystemCapability.Multimedia.Audio.Capturer + * @since 8 + */ + off(type: 'periodReach'): void; + /** + * Subscribes audio state change event callback. + * @param { 'stateChange' } type - Type of the event to listen for. Only the stateChange event is supported. + * @param { Callback } callback - Callback used to listen for the audio state change event. + * @syscap SystemCapability.Multimedia.Audio.Capturer + * @since 8 + */ + on(type: 'stateChange', callback: Callback): void; + /** + * Listens for audio interrupt events. This method uses a callback to get interrupt events. The interrupt event is + * triggered when audio recording is interrupted. + * @param { 'audioInterrupt' } type - Type of the event to listen for. Only the audioInterrupt event is supported. + * @param { Callback } callback - Callback used to listen for interrupt callback. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @throws { BusinessError } 6800101 - Parameter verification failed. + * @syscap SystemCapability.Multimedia.Audio.Interrupt + * @since 10 + */ + on(type: 'audioInterrupt', callback: Callback): void; + /** + * UnSubscribes to audio interrupt events. + * @param { 'audioInterrupt' } type - Type of the event to listen for. Only the audioInterrupt event is supported. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @throws { BusinessError } 6800101 - Parameter verification failed. + * @syscap SystemCapability.Multimedia.Audio.Interrupt + * @since 10 + */ + off(type: 'audioInterrupt'): void; + /** + * Subscribes input device change event callback. + * The event is triggered when input device change for this stream. + * @param { 'inputDeviceChange' } type - Type of the event to listen for. + * @param { Callback } callback - Callback used to listen device change event. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @throws { BusinessError } 6800101 - Parameter verification failed. + * @syscap SystemCapability.Multimedia.Audio.Device + * @since 11 + */ + on(type: 'inputDeviceChange', callback: Callback): void; + /** + * Unsubscribes input device change event callback. + * @param { 'inputDeviceChange' } type - Type of the event to listen for. + * @param { Callback } callback - Callback used in subscribe. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @throws { BusinessError } 6800101 - Parameter verification failed. + * @syscap SystemCapability.Multimedia.Audio.Device + * @since 11 + */ + off(type: 'inputDeviceChange', callback?: Callback): void; + /** + * Subscribes audio capturer info change event callback. + * The event is triggered when input device change for this stream. + * @param { 'audioCapturerChange' } type - Type of the event to listen for. + * @param { Callback } callback - Callback used to listen device change event. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @throws { BusinessError } 6800101 - Parameter verification failed. + * @syscap SystemCapability.Multimedia.Audio.Capturer + * @since 11 + */ + on(type: 'audioCapturerChange', callback: Callback): void; + /** + * Unsubscribes audio capturer info change event callback. + * @param { 'audioCapturerChange' } type - Type of the event to listen for. + * @param { Callback } callback - Callback used in subscribe. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @throws { BusinessError } 6800101 - Parameter verification failed. + * @syscap SystemCapability.Multimedia.Audio.Capturer + * @since 11 + */ + off(type: 'audioCapturerChange', callback?: Callback): void; + /** + * Subscribes audio data callback. + * The event is triggered when audio buffer is available for reading more data. + * @param { 'readData' } type - Type of the event to listen for. + * @param { Callback } callback - Callback with the buffer to read. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @throws { BusinessError } 6800101 - Parameter verification failed. + * @syscap SystemCapability.Multimedia.Audio.Capturer + * @since 11 + */ + on(type: 'readData', callback: Callback): void; + /** + * Unsubscribes audio data callback. + * @param { 'readData' } type - Type of the event to listen for. + * @param { Callback } callback - Callback used in subscribe. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @throws { BusinessError } 6800101 - Parameter verification failed. + * @syscap SystemCapability.Multimedia.Audio.Capturer + * @since 11 + */ + off(type: 'readData', callback?: Callback): void; + } + /** + * Array of AudioEffectMode, which is read-only. + * @typedef { Array> } AudioEffectInfoArray + * @syscap SystemCapability.Multimedia.Audio.Renderer + * @since 10 + */ + type AudioEffectInfoArray = Array>; + /** + * Describes an audio effect mode group. + * @enum { number } + * @syscap SystemCapability.Multimedia.Audio.Renderer + * @since 10 + */ + /** + * Describes an audio effect mode group. + * @enum { number } + * @syscap SystemCapability.Multimedia.Audio.Renderer + * @atomicservice + * @since 12 + */ + enum AudioEffectMode { + /** + * Audio Effect Mode effect none. + * @syscap SystemCapability.Multimedia.Audio.Renderer + * @since 10 + */ + /** + * Audio Effect Mode effect none. + * @syscap SystemCapability.Multimedia.Audio.Renderer + * @atomicservice + * @since 12 + */ + EFFECT_NONE = 0, + /** + * Audio Effect Mode effect default. + * @syscap SystemCapability.Multimedia.Audio.Renderer + * @since 10 + */ + /** + * Audio Effect Mode effect default. + * @syscap SystemCapability.Multimedia.Audio.Renderer + * @atomicservice + * @since 12 + */ + EFFECT_DEFAULT = 1 + } + /** + * Audio AudioChannel Layout + * A 64-bit integer indicates that the appearance and order of the speakers for recording or playback. + * @enum { number } + * @syscap SystemCapability.Multimedia.Audio.Core + * @since 11 + */ + enum AudioChannelLayout { + /** + * Unknown Channel Layout + * @syscap SystemCapability.Multimedia.Audio.Core + * @since 11 + */ + CH_LAYOUT_UNKNOWN = 0x0, + /** + * Channel Layout For Mono, 1 channel in total + * Speaker layout: front center(FC) + * @syscap SystemCapability.Multimedia.Audio.Core + * @since 11 + */ + CH_LAYOUT_MONO = 0x4, + /** + * Channel Layout For Stereo, 2 channels in total + * Speaker layout: front left(FL), front right(FR) + * @syscap SystemCapability.Multimedia.Audio.Core + * @since 11 + */ + CH_LAYOUT_STEREO = 0x3, + /** + * Channel Layout For Stereo-Downmix, 2 channels in total + * Speaker layout: Stereo left, stereo right + * @syscap SystemCapability.Multimedia.Audio.Core + * @since 11 + */ + CH_LAYOUT_STEREO_DOWNMIX = 0x60000000, + /** + * Channel Layout For 2.1, 3 channels in total + * Speaker layout: Stereo plus low-frequency effects(LFE) + * @syscap SystemCapability.Multimedia.Audio.Core + * @since 11 + */ + CH_LAYOUT_2POINT1 = 0xB, + /** + * Channel Layout For 3.0, 3 channels in total + * Speaker layout: Stereo plus back center(BC) + * @syscap SystemCapability.Multimedia.Audio.Core + * @since 11 + */ + CH_LAYOUT_3POINT0 = 0x103, + /** + * Channel Layout For Surround, 3 channels in total + * Speaker layout: Stereo plus FC + * @syscap SystemCapability.Multimedia.Audio.Core + * @since 11 + */ + CH_LAYOUT_SURROUND = 0x7, + /** + * Channel Layout For 3.1, 4 channels in total + * Speaker layout: Surround plus LFE + * @syscap SystemCapability.Multimedia.Audio.Core + * @since 11 + */ + CH_LAYOUT_3POINT1 = 0xF, + /** + * Channel Layout For 4.0, 4 channels in total + * Speaker layout: Surround plus BC + * @syscap SystemCapability.Multimedia.Audio.Core + * @since 11 + */ + CH_LAYOUT_4POINT0 = 0x107, + /** + * Channel Layout For Quad, 4 channels in total + * Speaker layout: Stereo plus left and right back speakers + * @syscap SystemCapability.Multimedia.Audio.Core + * @since 11 + */ + CH_LAYOUT_QUAD = 0x33, + /** + * Channel Layout For Quad-Side, 4 channels in total + * Speaker layout: Stereo plus left and right side speakers(SL, SR) + * @syscap SystemCapability.Multimedia.Audio.Core + * @since 11 + */ + CH_LAYOUT_QUAD_SIDE = 0x603, + /** + * Channel Layout For 2.0.2, 4 channels in total + * Speaker layout: Stereo plus left and right top side speakers + * @syscap SystemCapability.Multimedia.Audio.Core + * @since 11 + */ + CH_LAYOUT_2POINT0POINT2 = 0x3000000003, + /** + * Channel Layout For ORDER1-ACN-N3D First Order Ambisonic(FOA), 4 channels in total + * First order, Ambisonic Channel Number(ACN) format, Normalization of three-D(N3D) + * @syscap SystemCapability.Multimedia.Audio.Core + * @since 11 + */ + CH_LAYOUT_AMB_ORDER1_ACN_N3D = 0x100000000001, + /** + * Channel Layout For ORDER1-ACN-SN3D FOA, 4 channels in total + * First order, ACN format, Semi-Normalization of three-D(SN3D) + * @syscap SystemCapability.Multimedia.Audio.Core + * @since 11 + */ + CH_LAYOUT_AMB_ORDER1_ACN_SN3D = 0x100000001001, + /** + * Channel Layout For ORDER1-FUMA FOA, 4 channels in total + * First order, Furse-Malham(FuMa) format + * @syscap SystemCapability.Multimedia.Audio.Core + * @since 11 + */ + CH_LAYOUT_AMB_ORDER1_FUMA = 0x100000000101, + /** + * Channel Layout For 4.1, 5 channels in total + * Speaker layout: 4.0 plus LFE + * @syscap SystemCapability.Multimedia.Audio.Core + * @since 11 + */ + CH_LAYOUT_4POINT1 = 0x10F, + /** + * Channel Layout For 5.0, 5 channels in total + * Speaker layout: Surround plus two side speakers + * @syscap SystemCapability.Multimedia.Audio.Core + * @since 11 + */ + CH_LAYOUT_5POINT0 = 0x607, + /** + * Channel Layout For 5.0-Back, 5 channels in total + * Speaker layout: Surround plus two back speakers + * @syscap SystemCapability.Multimedia.Audio.Core + * @since 11 + */ + CH_LAYOUT_5POINT0_BACK = 0x37, + /** + * Channel Layout For 2.1.2, 5 channels in total + * Speaker layout: 2.0.2 plus LFE + * @syscap SystemCapability.Multimedia.Audio.Core + * @since 11 + */ + CH_LAYOUT_2POINT1POINT2 = 0x300000000B, + /** + * Channel Layout For 3.0.2, 5 channels in total + * Speaker layout: 2.0.2 plus FC + * @syscap SystemCapability.Multimedia.Audio.Core + * @since 11 + */ + CH_LAYOUT_3POINT0POINT2 = 0x3000000007, + /** + * Channel Layout For 5.1, 6 channels in total + * Speaker layout: 5.0 plus LFE + * @syscap SystemCapability.Multimedia.Audio.Core + * @since 11 + */ + CH_LAYOUT_5POINT1 = 0x60F, + /** + * Channel Layout For 5.1-Back, 6 channels in total + * Speaker layout: 5.0-Back plus LFE + * @syscap SystemCapability.Multimedia.Audio.Core + * @since 11 + */ + CH_LAYOUT_5POINT1_BACK = 0x3F, + /** + * Channel Layout For 6.0, 6 channels in total + * Speaker layout: 5.0 plus BC + * @syscap SystemCapability.Multimedia.Audio.Core + * @since 11 + */ + CH_LAYOUT_6POINT0 = 0x707, + /** + * Channel Layout For Hexagonal, 6 channels in total + * Speaker layout: 5.0-Back plus BC + * @syscap SystemCapability.Multimedia.Audio.Core + * @since 11 + */ + CH_LAYOUT_HEXAGONAL = 0x137, + /** + * Channel Layout For 3.1.2, 6 channels in total + * Speaker layout: 3.1 plus two top front speakers(TFL, TFR) + * @syscap SystemCapability.Multimedia.Audio.Core + * @since 11 + */ + CH_LAYOUT_3POINT1POINT2 = 0x500F, + /** + * Channel Layout For 6.0-Front, 6 channels in total + * Speaker layout: Quad-Side plus left and right front center speakers(FLC, FRC) + * @syscap SystemCapability.Multimedia.Audio.Core + * @since 11 + */ + CH_LAYOUT_6POINT0_FRONT = 0x6C3, + /** + * Channel Layout For 6.1, 7 channels in total + * Speaker layout: 5.1 plus BC + * @syscap SystemCapability.Multimedia.Audio.Core + * @since 11 + */ + CH_LAYOUT_6POINT1 = 0x70F, + /** + * Channel Layout For 6.1-Back, 7 channels in total + * Speaker layout: 5.1-Back plus BC + * @syscap SystemCapability.Multimedia.Audio.Core + * @since 11 + */ + CH_LAYOUT_6POINT1_BACK = 0x13F, + /** + * Channel Layout For 6.1-Front, 7 channels in total + * Speaker layout: 6.0-Front plus LFE + * @syscap SystemCapability.Multimedia.Audio.Core + * @since 11 + */ + CH_LAYOUT_6POINT1_FRONT = 0x6CB, + /** + * Channel Layout For 7.0, 7 channels in total + * Speaker layout: 5.0 plus two back speakers + * @syscap SystemCapability.Multimedia.Audio.Core + * @since 11 + */ + CH_LAYOUT_7POINT0 = 0x637, + /** + * Channel Layout For 7.0-Front, 7 channels in total + * Speaker layout: 5.0 plus left and right front center speakers + * @syscap SystemCapability.Multimedia.Audio.Core + * @since 11 + */ + CH_LAYOUT_7POINT0_FRONT = 0x6C7, + /** + * Channel Layout For 7.1, 8 channels in total + * Speaker layout: 5.1 plus two back speakers + * @syscap SystemCapability.Multimedia.Audio.Core + * @since 11 + */ + CH_LAYOUT_7POINT1 = 0x63F, + /** + * Channel Layout For Octagonal, 8 channels in total + * Speaker layout: 5.0 plus BL, BR and BC. + * @syscap SystemCapability.Multimedia.Audio.Core + * @since 11 + */ + CH_LAYOUT_OCTAGONAL = 0x737, + /** + * Channel Layout For 5.1.2, 8 channels in total + * Speaker layout: 5.1 plus two top side speakers. + * @syscap SystemCapability.Multimedia.Audio.Core + * @since 11 + */ + CH_LAYOUT_5POINT1POINT2 = 0x300000060F, + /** + * Channel Layout For 7.1-Wide, 8 channels in total + * Speaker layout: 5.1 plus left and right front center speakers. + * @syscap SystemCapability.Multimedia.Audio.Core + * @since 11 + */ + CH_LAYOUT_7POINT1_WIDE = 0x6CF, + /** + * Channel Layout For 7.1-Wide, 8 channels in total + * Speaker layout: 5.1-Back plus left and right front center speakers. + * @syscap SystemCapability.Multimedia.Audio.Core + * @since 11 + */ + CH_LAYOUT_7POINT1_WIDE_BACK = 0xFF, + /** + * Channel Layout For ORDER2-ACN-N3D Higher Order Ambisonics(HOA), 9 channels in total + * Second order, ACN format, N3D + * @syscap SystemCapability.Multimedia.Audio.Core + * @since 11 + */ + CH_LAYOUT_AMB_ORDER2_ACN_N3D = 0x100000000002, + /** + * Channel Layout For ORDER2-ACN-SN3D HOA, 9 channels in total + * Second order, ACN format, SN3D + * @syscap SystemCapability.Multimedia.Audio.Core + * @since 11 + */ + CH_LAYOUT_AMB_ORDER2_ACN_SN3D = 0x100000001002, + /** + * Channel Layout For ORDER2-FUMA HOA, 9 channels in total + * Second order, FuMa format + * @syscap SystemCapability.Multimedia.Audio.Core + * @since 11 + */ + CH_LAYOUT_AMB_ORDER2_FUMA = 0x100000000102, + /** + * Channel Layout For 5.1.4, 10 channels in total + * Speaker layout: 5.1 plus four top speakers(TFL, TFR, TBL, TBR) + * @syscap SystemCapability.Multimedia.Audio.Core + * @since 11 + */ + CH_LAYOUT_5POINT1POINT4 = 0x2D60F, + /** + * Channel Layout For 7.1.2, 10 channels in total + * Speaker layout: 7.1 plus two top side speakers + * @syscap SystemCapability.Multimedia.Audio.Core + * @since 11 + */ + CH_LAYOUT_7POINT1POINT2 = 0x300000063F, + /** + * Channel Layout For 7.1.4, 12 channels in total + * Speaker layout: 7.1 plus four top speakers + * @syscap SystemCapability.Multimedia.Audio.Core + * @since 11 + */ + CH_LAYOUT_7POINT1POINT4 = 0x2D63F, + /** + * Channel Layout For 10.2, 12 channels in total + * Speaker layout: FL, FR, FC, TFL, TFR, BL, BR, BC, SL, SR, wide left(WL), and wide right(WR) + * @syscap SystemCapability.Multimedia.Audio.Core + * @since 11 + */ + CH_LAYOUT_10POINT2 = 0x180005737, + /** + * Channel Layout For 9.1.4, 14 channels in total + * Speaker layout: 7.1.4 plus two wide speakers(WL, WR) + * @syscap SystemCapability.Multimedia.Audio.Core + * @since 11 + */ + CH_LAYOUT_9POINT1POINT4 = 0x18002D63F, + /** + * Channel Layout For 9.1.6, 16 channels in total + * Speaker layout: 9.1.4 plus two top side speakers + * @syscap SystemCapability.Multimedia.Audio.Core + * @since 11 + */ + CH_LAYOUT_9POINT1POINT6 = 0x318002D63F, + /** + * Channel Layout For Hexadecagonal, 16 channels in total + * Speaker layout: Octagonal plus two wide speakers, six top speakers(TFL, TFR, TFC, TBL, TBR, TBC) + * @syscap SystemCapability.Multimedia.Audio.Core + * @since 11 + */ + CH_LAYOUT_HEXADECAGONAL = 0x18003F737, + /** + * Channel Layout For ORDER3-ACN-N3D HOA, 16 channels in total + * Third order, ACN format, N3D + * @syscap SystemCapability.Multimedia.Audio.Core + * @since 11 + */ + CH_LAYOUT_AMB_ORDER3_ACN_N3D = 0x100000000003, + /** + * Channel Layout For ORDER3-ACN-SN3D HOA, 16 channels in total + * Third order, ACN format, N3D + * @syscap SystemCapability.Multimedia.Audio.Core + * @since 11 + */ + CH_LAYOUT_AMB_ORDER3_ACN_SN3D = 0x100000001003, + /** + * Channel Layout For ORDER3-FUMA HOA, 16 channels in total + * Third order, FuMa format + * @syscap SystemCapability.Multimedia.Audio.Core + * @since 11 + */ + CH_LAYOUT_AMB_ORDER3_FUMA = 0x100000000103 + } +} +export default audio; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.multimedia.audioHaptic.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.multimedia.audioHaptic.d.ts new file mode 100755 index 00000000..1e12367e --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.multimedia.audioHaptic.d.ts @@ -0,0 +1,253 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit AudioKit + */ +import type { Callback } from './@ohos.base'; +import type audio from './@ohos.multimedia.audio'; +/** + * Provides audio haptic collaborative play interfaces. + * + * @namespace audioHaptic + * @syscap SystemCapability.Multimedia.AudioHaptic.Core + * @since 11 + */ +declare namespace audioHaptic { + /** + * Obtains an {@link AudioHapticManager} instance. This object is singleton in one process. + * @returns { AudioHapticManager } AudioHapticManager instance. + * @syscap SystemCapability.Multimedia.AudioHaptic.Core + * @since 11 + */ + function getAudioHapticManager(): AudioHapticManager; + /** + * Audio Latency mode. + * @enum {number} + * @syscap SystemCapability.Multimedia.AudioHaptic.Core + * @since 11 + */ + enum AudioLatencyMode { + /** + * Normal audio mode. + * @syscap SystemCapability.Multimedia.AudioHaptic.Core + * @since 11 + */ + AUDIO_LATENCY_MODE_NORMAL = 0, + /** + * Low latency mode. This mode should be used when duration of the audio source is short. If duration of the audio + * source is long, it may be truncated. This behavior is the same with sound pool. + * @syscap SystemCapability.Multimedia.AudioHaptic.Core + * @since 11 + */ + AUDIO_LATENCY_MODE_FAST = 1 + } + /** + * Audio haptic player options object. + * @typedef AudioHapticPlayerOptions + * @syscap SystemCapability.Multimedia.AudioHaptic.Core + * @since 11 + */ + interface AudioHapticPlayerOptions { + /** + * Mute audio. + * @type {?boolean} + * @syscap SystemCapability.Multimedia.AudioHaptic.Core + * @since 11 + */ + muteAudio?: boolean; + /** + * Mute haptics. + * @type {?boolean} + * @syscap SystemCapability.Multimedia.AudioHaptic.Core + * @since 11 + */ + muteHaptics?: boolean; + } + /** + * Audio haptic manager object. + * @typedef AudioHapticManager + * @syscap SystemCapability.Multimedia.AudioHaptic.Core + * @since 11 + */ + interface AudioHapticManager { + /** + * Register audio and haptic file into manager. Audio and haptic works are paired while playing. After registering + * source, it will returns the source id. This method uses a promise to return the source id. + * @param { string } audioUri - Audio file uri. + * @param { string } hapticUri - Haptic file uri. + * @returns { Promise } Promise used to return the source id. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @syscap SystemCapability.Multimedia.AudioHaptic.Core + * @since 11 + */ + registerSource(audioUri: string, hapticUri: string): Promise; + /** + * Unregister source. This method uses a promise to return the result. + * @param { number } id source id. + * @returns { Promise } Promise used to return the result. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @syscap SystemCapability.Multimedia.AudioHaptic.Core + * @since 11 + */ + unregisterSource(id: number): Promise; + /** + * Set the audio latency mode of one source. + * @param { number } id - Source id. + * @param { AudioLatencyMode } latencyMode - Audio latency mode. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @throws { BusinessError } 5400102 - Operation not allowed. + * @syscap SystemCapability.Multimedia.AudioHaptic.Core + * @since 11 + */ + setAudioLatencyMode(id: number, latencyMode: AudioLatencyMode): void; + /** + * Set the stream usage of one source. + * @param { number } id - Source id. + * @param { audio.StreamUsage } usage - Stream usage. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types; + * 3.Parameter verification failed. + * @throws { BusinessError } 5400102 - Operation not allowed. + * @syscap SystemCapability.Multimedia.AudioHaptic.Core + * @since 11 + */ + setStreamUsage(id: number, usage: audio.StreamUsage): void; + /** + * Create an audio haptic player. This method uses a promise to return the result. If haptics is needed, caller + * should have the permission of ohos.permission.VIBRATE. + * @permission ohos.permission.VIBRATE + * @param { number } id - Source id. + * @param { AudioHapticPlayerOptions } options - Options when creating audio haptic player. + * @returns { Promise } Promise used to return the result. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @throws { BusinessError } 5400102 - Operation not allowed. + * @throws { BusinessError } 5400103 - I/O error. + * @throws { BusinessError } 5400106 - Unsupport format. + * @syscap SystemCapability.Multimedia.AudioHaptic.Core + * @since 11 + */ + createPlayer(id: number, options?: AudioHapticPlayerOptions): Promise; + } + /** + * Type of audio haptic. + * @enum {number} + * @syscap SystemCapability.Multimedia.AudioHaptic.Core + * @since 11 + */ + enum AudioHapticType { + /** + * Audio. + * @syscap SystemCapability.Multimedia.AudioHaptic.Core + * @since 11 + */ + AUDIO_HAPTIC_TYPE_AUDIO = 0, + /** + * Haptic. + * @syscap SystemCapability.Multimedia.AudioHaptic.Core + * @since 11 + */ + AUDIO_HAPTIC_TYPE_HAPTIC = 1 + } + /** + * Audio haptic player object. + * @typedef AudioHapticPlayer + * @syscap SystemCapability.Multimedia.AudioHaptic.Core + * @since 11 + */ + interface AudioHapticPlayer { + /** + * Is muted for one AudioHapticType + * @param { AudioHapticType } type - Indicates the type to query. + * @returns { boolean } - Is muted. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Parameter verification failed. + * @syscap SystemCapability.Multimedia.AudioHaptic.Core + * @since 11 + */ + isMuted(type: AudioHapticType): boolean; + /** + * Start this player. This method uses a promise to return the result. + * @returns { Promise } Promise used to return the result. + * @throws { BusinessError } 5400102 - Operate not permit. + * @throws { BusinessError } 5400103 - IO error. + * @throws { BusinessError } 5400105 - Service died. + * @syscap SystemCapability.Multimedia.AudioHaptic.Core + * @since 11 + */ + start(): Promise; + /** + * Stop this player. This method uses a promise to return the result. + * @returns { Promise } Promise used to return the result. + * @throws { BusinessError } 5400102 - Operate not permit. + * @throws { BusinessError } 5400105 - Service died. + * @syscap SystemCapability.Multimedia.AudioHaptic.Core + * @since 11 + */ + stop(): Promise; + /** + * Release this player. This method uses a promise to return the result. + * @returns { Promise } Promise used to return the result. + * @throws { BusinessError } 5400105 - Service died. + * @syscap SystemCapability.Multimedia.AudioHaptic.Core + * @since 11 + */ + release(): Promise; + /** + * Subscribes end of stream event. + * @param { 'endOfStream' } type - Type of the playback event to listen for. + * @param { Callback } callback - Callback used to listen for the playback end of stream. + * @syscap SystemCapability.Multimedia.AudioHaptic.Core + * @since 11 + */ + on(type: 'endOfStream', callback: Callback): void; + /** + * Unsubscribes end of stream event. + * @param { 'endOfStream' } type - Type of the playback event to listen for. + * @param { Callback } callback - Callback used to listen for the playback end of stream. + * @syscap SystemCapability.Multimedia.AudioHaptic.Core + * @since 11 + */ + off(type: 'endOfStream', callback?: Callback): void; + /** + * Subscribes audio interrupt event. + * @param { 'audioInterrupt' } type - Type of the playback event to listen for. + * @param { Callback } callback - Callback used to listen for audio interrupt info. + * @syscap SystemCapability.Multimedia.AudioHaptic.Core + * @since 11 + */ + on(type: 'audioInterrupt', callback: Callback): void; + /** + * Unsubscribes audio interrupt event. + * @param { 'audioInterrupt' } type - Type of the playback event to listen for. + * @param { Callback } callback - Callback used to listen for audio interrupt info. + * @syscap SystemCapability.Multimedia.AudioHaptic.Core + * @since 11 + */ + off(type: 'audioInterrupt', callback?: Callback): void; + } +} +export default audioHaptic; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.multimedia.avCastPicker.d.ets b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.multimedia.avCastPicker.d.ets new file mode 100755 index 00000000..a68f6b37 --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.multimedia.avCastPicker.d.ets @@ -0,0 +1,114 @@ +/* +* Copyright (C) 2023 Huawei Device Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +/** + * @file + * @kit AVSessionKit + */ +import { AVCastPickerState } from './@ohos.multimedia.avCastPickerParam'; +import { AVCastPickerStyle } from './@ohos.multimedia.avCastPickerParam'; +import { AVCastPickerColorMode } from './@ohos.multimedia.avCastPickerParam'; +/** + * A picker view to show availale streaming device list. + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @since 10 + */ +/** +* A picker view to show availale streaming device list. +* @syscap SystemCapability.Multimedia.AVSession.AVCast +* @atomicservice +* @since 12 +*/ +@Component +declare struct AVCastPicker { + /** + * Assigns the color of picker component at normal state . + * @type { ? Color | number | string } + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @crossplatform + * @since 11 + */ + /** + * Assigns the color of picker component at normal state . + * @type { ? Color | number | string } + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @crossplatform + * @atomicservice + * @since 12 + */ + @Prop + normalColor?: Color | number | string; + /** + * Assigns the color of picker component at active state. + * @type { ? Color | number | string } + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @crossplatform + * @since 11 + */ + /** + * Assigns the color of picker component at active state. + * @type { ? Color | number | string } + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @crossplatform + * @atomicservice + * @since 12 + */ + @Prop + activeColor?: Color | number | string; + /** + * Set the picker style. + * @type { ? AVCastPickerStyle } + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @atomicservice + * @since 12 + */ + @Prop + pickerStyle?: AVCastPickerStyle; + /** + * Set the picker color mode. + * @type { ? AVCastPickerColorMode } + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @atomicservice + * @since 12 + */ + @Prop + colorMode?: AVCastPickerColorMode; + /** + * Set the session type used by current picker component which can refer to AVSessionType in avSession. + * If not set, default value is 'audio'. + * @type { ? string } + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @atomicservice + * @since 12 + */ + @Prop + sessionType?: string; + /** + * Picker state change callback. + * @type { ?function } + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @crossplatform + * @since 11 + */ + /** + * Picker state change callback. + * @type { ?function } + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @crossplatform + * @atomicservice + * @since 12 + */ + onStateChange?: (state: AVCastPickerState) => void; +} +export default AVCastPicker; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.multimedia.avCastPickerParam.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.multimedia.avCastPickerParam.d.ts new file mode 100755 index 00000000..57686d33 --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.multimedia.avCastPickerParam.d.ts @@ -0,0 +1,110 @@ +/* +* Copyright (C) 2023 Huawei Device Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +/** + * @file + * @kit AVSessionKit + */ +/** + * Definition of av cast picker state + * @enum { number } + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @since 11 + */ +/** + * Definition of av cast picker state + * @enum { number } + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @atomicservice + * @since 12 + */ +export declare enum AVCastPickerState { + /** + * The picker starts showing. + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @since 11 + */ + /** + * The picker starts showing. + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @atomicservice + * @since 12 + */ + STATE_APPEARING, + /** + * The picker finishes presenting. + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @since 11 + */ + /** + * The picker finishes presenting. + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @atomicservice + * @since 12 + */ + STATE_DISAPPEARING +} +/** + * Definition of av cast picker style + * @enum { number } + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @atomicservice + * @since 12 + */ +export declare enum AVCastPickerStyle { + /** + * The picker shows in a panel style. + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @atomicservice + * @since 12 + */ + STYLE_PANEL, + /** + * The picker shows in a menu style. + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @atomicservice + * @since 12 + */ + STYLE_MENU +} +/** + * Definition of color mode of picker + * @enum { number } + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @atomicservice + * @since 12 + */ +export declare enum AVCastPickerColorMode { + /** + * Auto mode which follows the definition of system. + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @atomicservice + * @since 12 + */ + AUTO, + /** + * Dark mode. + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @atomicservice + * @since 12 + */ + DARK, + /** + * Light mode. + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @atomicservice + * @since 12 + */ + LIGHT +} diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.multimedia.avVolumePanel.d.ets b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.multimedia.avVolumePanel.d.ets new file mode 100755 index 00000000..26a54a43 --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.multimedia.avVolumePanel.d.ets @@ -0,0 +1,66 @@ +/* +* Copyright (C) 2024 Huawei Device Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +/** + * @file Defines a panel to set the system audio output volume. + * @kit AudioKit + */ +/** + * Declare custom parameters used for volume panel. + * + * @syscap SystemCapability.Multimedia.Audio.Volume + * @atomicservice + * @since 12 + */ +export declare class AVVolumePanelParameter { + /** + * Sets the position of volume panel. + * + * @syscap SystemCapability.Multimedia.Audio.Volume + * @atomicservice + * @since 12 + */ + position?: Position; +} +/** + * A panel to set the system audio output volume. + * + * @syscap SystemCapability.Multimedia.Audio.Volume + * @atomicservice + * @since 12 + */ +@Component +export declare struct AVVolumePanel { + /** + * Sets the device volume through the volume panel. + * The value should be between mininum and maxinum current device volume, otherwise it will be discarded. + * + * @type { ?number } + * @syscap SystemCapability.Multimedia.Audio.Volume + * @atomicservice + * @since 12 + */ + @Prop + volumeLevel?: number; + /** + * Sets the custom parameters of volume panel. + * + * @type { ?AVVolumePanelParameter } + * @syscap SystemCapability.Multimedia.Audio.Volume + * @atomicservice + * @since 12 + */ + @Prop + volumeParameter?: AVVolumePanelParameter; +} diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.multimedia.avsession.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.multimedia.avsession.d.ts new file mode 100755 index 00000000..dc2ec115 --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.multimedia.avsession.d.ts @@ -0,0 +1,4404 @@ +/* +* Copyright (c) 2022-2023 Huawei Device Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +/** + * @file + * @kit AVSessionKit + */ +import type { ErrorCallback, AsyncCallback, Callback } from './@ohos.base'; +import { WantAgent } from './@ohos.wantAgent'; +import { KeyEvent } from './@ohos.multimodalInput.keyEvent'; +import image from './@ohos.multimedia.image'; +import type media from './@ohos.multimedia.media'; +import type Context from './application/BaseContext'; +/** + * @namespace avSession + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 9 + */ +/** + * @namespace avSession + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ +declare namespace avSession { + /** + * Create an AVSession instance. An ability can only create one AVSession + * @param { Context } context - The context of application + * @param { string } tag - A user-defined name for this session + * @param { AVSessionType } type - The type of session {@link AVSessionType} + * @param { AsyncCallback } callback - async callback for AVSession. + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Parameter verification failed. + * @throws { BusinessError } 6600101 - Session service exception. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + function createAVSession(context: Context, tag: string, type: AVSessionType, callback: AsyncCallback): void; + /** + * Create an AVSession instance. An ability can only create one AVSession + * @param { Context } context - The context of application + * @param { string } tag - A user-defined name for this session + * @param { AVSessionType } type - The type of session {@link AVSessionType} + * @returns { Promise } Promise for AVSession + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Parameter verification failed. + * @throws { BusinessError } 6600101 - Session service exception. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * Create an AVSession instance. An ability can only create one AVSession + * @param { Context } context - The context of application + * @param { string } tag - A user-defined name for this session + * @param { AVSessionType } type - The type of session {@link AVSessionType} + * @returns { Promise } Promise for AVSession + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Parameter verification failed. + * @throws { BusinessError } 6600101 - Session service exception. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + function createAVSession(context: Context, tag: string, type: AVSessionType): Promise; + /** + * Define different protocol capability + * @enum { number } + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @since 11 + */ + /** + * Define different protocol capability + * @enum { number } + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @atomicservice + * @since 12 + */ + enum ProtocolType { + /** + * The default cast type "local", media can be routed on the same device, + * including internal speakers or audio jack on the device itself, A2DP devices. + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @since 11 + */ + /** + * The default cast type "local", media can be routed on the same device, + * including internal speakers or audio jack on the device itself, A2DP devices. + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @atomicservice + * @since 12 + */ + TYPE_LOCAL = 0, + /** + * The Cast+ Stream indicating the media is presenting on a different device + * the application need get an AVCastController to control remote playback. + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @since 11 + */ + TYPE_CAST_PLUS_STREAM = 2, + /** + * The DLNA type indicates the device supports DLNA protocol, + * the application needs to get an AVCastController to control remote playback. + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @since 12 + */ + TYPE_DLNA = 4 + } + /** + * Session type, support audio & video + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * Session type, support audio & video, voice_call + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 11 + */ + /** + * Session type supports audio & video, voice_call, video_call + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + type AVSessionType = 'audio' | 'video' | 'voice_call' | 'video_call'; + /** + * AVSession object. + * @interface AVSession + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * AVSession object. + * @interface AVSession + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + interface AVSession { + /** + * unique session Id + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * unique session Id + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + readonly sessionId: string; + /** + * Get current session type + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * Get current session type + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + readonly sessionType: AVSessionType; + /** + * Set the metadata of this session. + * In addition to the required properties, users can fill in partially supported properties + * @param { AVMetadata } data {@link AVMetadata} + * @param { AsyncCallback } callback - The asyncCallback triggered when the command is executed successfully + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Parameter verification failed. + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600102 - The session does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + setAVMetadata(data: AVMetadata, callback: AsyncCallback): void; + /** + * Set the metadata of this session. + * In addition to the required properties, users can fill in partially supported properties + * @param { AVMetadata } data {@link AVMetadata} + * @returns { Promise } void promise when executed successfully + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Parameter verification failed. + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600102 - The session does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * Set the metadata of this session. + * In addition to the required properties, users can fill in partially supported properties + * @param { AVMetadata } data {@link AVMetadata} + * @returns { Promise } void promise when executed successfully + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Parameter verification failed. + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600102 - The session does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + setAVMetadata(data: AVMetadata): Promise; + /** + * Set the metadata related with current call. + * @param { CallMetadata } data - {@link CallMetadata} + * @param { AsyncCallback } callback - The asyncCallback triggered when the command is executed successfully + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. 3.Parameter verification failed. + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600102 - The session does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 11 + */ + setCallMetadata(data: CallMetadata, callback: AsyncCallback): void; + /** + * Set the metadata related with current call. + * @param { CallMetadata } data - {@link CallMetadata} + * @returns { Promise } void promise when executed successfully + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. 3.Parameter verification failed. + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600102 - The session does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 11 + */ + setCallMetadata(data: CallMetadata): Promise; + /** + * Set the playback state of this session. + * @param { AVPlaybackState } state {@link AVPlaybackState} + * @param { AsyncCallback } callback - The asyncCallback triggered when the command is executed successfully + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Parameter verification failed. + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600102 - The session does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + setAVPlaybackState(state: AVPlaybackState, callback: AsyncCallback): void; + /** + * Set the playback state of this session. + * @param { AVPlaybackState } state {@link AVPlaybackState} + * @returns { Promise } void promise when executed successfully + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Parameter verification failed. + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600102 - The session does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * Set the playback state of this session. + * @param { AVPlaybackState } state {@link AVPlaybackState} + * @returns { Promise } void promise when executed successfully + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Parameter verification failed. + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600102 - The session does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + setAVPlaybackState(state: AVPlaybackState): Promise; + /** + * Set the call state of this session. + * @param { AVCallState } state - {@link AVCallState} + * @param { AsyncCallback } callback - The asyncCallback triggered when the command is executed successfully + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Parameter verification failed. + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600102 - The session does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 11 + */ + setAVCallState(state: AVCallState, callback: AsyncCallback): void; + /** + * Set the call state of this session. + * @param { AVCallState } state - {@link AVCallState} + * @returns { Promise } void promise when executed successfully + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Parameter verification failed. + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600102 - The session does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 11 + */ + setAVCallState(state: AVCallState): Promise; + /** + * Set the ability to start the session corresponding to + * @param { WantAgent } ability - The WantAgent for launch the ability + * @param { AsyncCallback } callback - The asyncCallback triggered when the command is executed successfully + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Parameter verification failed. + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600102 - The session does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + setLaunchAbility(ability: WantAgent, callback: AsyncCallback): void; + /** + * Set the ability to start the session corresponding to + * @param { WantAgent } ability - The WantAgent for launch the ability + * @returns { Promise } void promise when executed successfully + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Parameter verification failed. + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600102 - The session does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + setLaunchAbility(ability: WantAgent): Promise; + /** + * Dispatch the session event of this session. + * @param { string } event - Session event name to dispatch + * @param { object } args - The parameters of session event + * @param { AsyncCallback} callback - The asyncCallback triggered when the command is executed successfully + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. 3.Parameter verification failed. + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600102 - The session does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + dispatchSessionEvent(event: string, args: { + [key: string]: Object; + }, callback: AsyncCallback): void; + /** + * Dispatch the session event of this session. + * @param { string } event - Session event name to dispatch + * @param { object } args - The parameters of session event + * @returns { Promise } void promise when executed successfully + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. 3.Parameter verification failed. + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600102 - The session does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + dispatchSessionEvent(event: string, args: { + [key: string]: Object; + }): Promise; + /** + * Set the playlist of queueItem. Identifies the content of the playlist presented by this session. + * @param { Array } items - An array of the AVQueueItem + * @param { AsyncCallback } callback - The asyncCallback triggered when the command is executed successfully. + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Parameter verification failed. + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600102 - The session does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + setAVQueueItems(items: Array, callback: AsyncCallback): void; + /** + * Set the playlist of queueItem. Identifies the content of the playlist presented by this session. + * @param { Array } items - An array of the AVQueueItem + * @returns { Promise } void promise when executed successfully + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Parameter verification failed. + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600102 - The session does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + setAVQueueItems(items: Array): Promise; + /** + * Set the name of the playlist presented by this session. + * @param { string } title - The name of the playlist + * @param { AsyncCallback } callback - The asyncCallback triggered when the command is executed successfully. + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Parameter verification failed. + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600102 - The session does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + setAVQueueTitle(title: string, callback: AsyncCallback): void; + /** + * Set the name of the playlist presented by this session. + * @param { string } title - The name of the playlist + * @returns { Promise } void promise when executed successfully + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Parameter verification failed. + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600102 - The session does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + setAVQueueTitle(title: string): Promise; + /** + * Set the custom media packets for this session. + * @param { object } extras - The custom media packets + * @param { AsyncCallback } callback - The asyncCallback triggered when the command is executed successfully. + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Parameter verification failed. + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600102 - The session does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + setExtras(extras: { + [key: string]: Object; + }, callback: AsyncCallback): void; + /** + * Set the custom media packets for this session. + * @param { object } extras - The custom media packets + * @returns { Promise } void promise when executed successfully + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Parameter verification failed. + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600102 - The session does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + setExtras(extras: { + [key: string]: Object; + }): Promise; + /** + * Get the current session's own controller + * @param { AsyncCallback } callback - async callback for the AVSessionController. + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600102 - The session does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + getController(callback: AsyncCallback): void; + /** + * Get the current session's own controller + * @returns { Promise } Promise for the AVSessionController + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600102 - The session does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + getController(): Promise; + /** + * Get the cast controller when the session is casted to remote device. + * If the avsession is not under casting state, the controller will return null. + * @param { AsyncCallback } callback - async callback for the AVCastController. + * @throws {BusinessError} 6600102 - {@link #ERR_CODE_SESSION_NOT_EXIST} - session does not exist + * @throws {BusinessError} 6600110 - 6600109 - remote connection does not exist + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @since 10 + */ + getAVCastController(callback: AsyncCallback): void; + /** + * Get the cast controller when the session is casted to remote device. + * If the avsession is not under casting state, the controller will return null. + * @returns { Promise } Promise for the AVCastController + * @throws {BusinessError} 6600102 - {@link #ERR_CODE_SESSION_NOT_EXIST} session does not exist + * @throws {BusinessError} 6600110 - 6600109 - remote connection does not exist + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @since 10 + */ + /** + * Get the cast controller when the session is casted to remote device. + * If the avsession is not under casting state, the controller will return null. + * @returns { Promise } Promise for the AVCastController + * @throws {BusinessError} 6600102 - {@link #ERR_CODE_SESSION_NOT_EXIST} session does not exist + * @throws {BusinessError} 6600110 - 6600109 - remote connection does not exist + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @atomicservice + * @since 12 + */ + getAVCastController(): Promise; + /** + * Get output device information + * @param { AsyncCallback } callback - async callback for the OutputDeviceInfo. + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600102 - The session does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + getOutputDevice(callback: AsyncCallback): void; + /** + * Get output device information + * @returns { Promise } Promise for the OutputDeviceInfo + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600102 - The session does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * Get output device information + * @returns { Promise } Promise for the OutputDeviceInfo + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600102 - The session does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + getOutputDevice(): Promise; + /** + * Get output device information + * @returns { OutputDeviceInfo } the OutputDeviceInfo + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600102 - The session does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + getOutputDeviceSync(): OutputDeviceInfo; + /** + * Get all the current virtual display information for extended display. + * @returns { Promise> } Promise for the CastDisplayInfo + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600102 - The session does not exist. + * @syscap SystemCapability.Multimedia.AVSession.ExtendedDisplayCast + * @since 12 + */ + getAllCastDisplays(): Promise>; + /** + * Register play command callback. + * As long as it is registered, it means that the ability supports this command. + * If you cancel the callback, you need to call off {@link off} + * When canceling the callback, need to update the supported commands list. + * Each playback command only supports registering one callback, + * and the new callback will replace the previous one. + * @param { 'play' } type - Command to register 'play'. + * @param { function } callback - Used to handle ('play') command + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600102 - The session does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + on(type: 'play', callback: () => void): void; + /** + * Register pause command callback. + * As long as it is registered, it means that the ability supports this command. + * If you cancel the callback, you need to call off {@link off} + * When canceling the callback, need to update the supported commands list. + * Each playback command only supports registering one callback, + * and the new callback will replace the previous one. + * @param { 'pause' } type - Command to register 'pause'. + * @param { function } callback - Used to handle ('pause') command + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600102 - The session does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + on(type: 'pause', callback: () => void): void; + /** + * Register stop command callback. + * As long as it is registered, it means that the ability supports this command. + * If you cancel the callback, you need to call off {@link off} + * When canceling the callback, need to update the supported commands list. + * Each playback command only supports registering one callback, + * and the new callback will replace the previous one. + * @param { 'stop' } type - Command to register 'stop'. + * @param { function } callback - Used to handle ('stop') command + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600102 - The session does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + on(type: 'stop', callback: () => void): void; + /** + * Register playNext command callback. + * As long as it is registered, it means that the ability supports this command. + * If you cancel the callback, you need to call off {@link off} + * When canceling the callback, need to update the supported commands list. + * Each playback command only supports registering one callback, + * and the new callback will replace the previous one. + * @param { 'playNext' } type - Command to register 'playNext'. + * @param { function } callback - Used to handle ('playNext') command + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600102 - The session does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + on(type: 'playNext', callback: () => void): void; + /** + * Register playPrevious command callback. + * As long as it is registered, it means that the ability supports this command. + * If you cancel the callback, you need to call off {@link off} + * When canceling the callback, need to update the supported commands list. + * Each playback command only supports registering one callback, + * and the new callback will replace the previous one. + * @param { 'playPrevious' } type - Command to register 'playPrevious'. + * @param { function } callback - Used to handle ('playPrevious') command + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600102 - The session does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + on(type: 'playPrevious', callback: () => void): void; + /** + * Register fastForward command callback. + * As long as it is registered, it means that the ability supports this command. + * If you cancel the callback, you need to call off {@link off} + * When canceling the callback, need to update the supported commands list. + * Each playback command only supports registering one callback, + * and the new callback will replace the previous one. + * @param { 'fastForward' } type - Command to register 'fastForward'. + * @param { function } callback - Used to handle ('fastForward') command + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600102 - The session does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + on(type: 'fastForward', callback: (time?: number) => void): void; + /** + * Register rewind command callback. + * As long as it is registered, it means that the ability supports this command. + * If you cancel the callback, you need to call off {@link off} + * When canceling the callback, need to update the supported commands list. + * Each playback command only supports registering one callback, + * and the new callback will replace the previous one. + * @param { 'rewind' } type - Command to register 'rewind'. + * @param { function } callback - Used to handle ('rewind') command + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600102 - The session does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + on(type: 'rewind', callback: (time?: number) => void): void; + /** + * Unregister play command callback. + * When canceling the callback, need to update the supported commands list. + * @param { 'play' } type - Command to register 'play'. + * @param { function } callback - Used to handle ('play') command + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600102 - The session does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + off(type: 'play', callback?: () => void): void; + /** + * Unregister pause command callback. + * When canceling the callback, need to update the supported commands list. + * @param { 'pause' } type - Command to register 'pause'. + * @param { function } callback - Used to handle ('pause') command + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600102 - The session does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + off(type: 'pause', callback?: () => void): void; + /** + * Unregister stop command callback. + * When canceling the callback, need to update the supported commands list. + * @param { 'stop' } type - Command to register 'stop'. + * @param { function } callback - Used to handle ('stop') command + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600102 - The session does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + off(type: 'stop', callback?: () => void): void; + /** + * Unregister playNext command callback. + * When canceling the callback, need to update the supported commands list. + * @param { 'playNext' } type - Command to register 'playNext'. + * @param { function } callback - Used to handle ('playNext') command + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600102 - The session does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + off(type: 'playNext', callback?: () => void): void; + /** + * Unregister playPrevious command callback. + * When canceling the callback, need to update the supported commands list. + * @param { 'playPrevious' } type - Command to register 'playPrevious'. + * @param { function } callback - Used to handle ('playPrevious') command + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600102 - The session does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + off(type: 'playPrevious', callback?: () => void): void; + /** + * Unregister fastForward command callback. + * When canceling the callback, need to update the supported commands list. + * @param { 'fastForward' } type - Command to register 'fastForward'. + * @param { function } callback - Used to handle ('fastForward') command + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600102 - The session does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + off(type: 'fastForward', callback?: () => void): void; + /** + * Unregister rewind command callback. + * When canceling the callback, need to update the supported commands list. + * @param { 'rewind' } type - Command to register 'rewind'. + * @param { function } callback - Used to handle ('rewind') command + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600102 - The session does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + off(type: 'rewind', callback?: () => void): void; + /** + * Register playFromAssetId command callback. + * As long as it is registered, it means that the ability supports this command. + * If you cancel the callback, you need to call off {@link off} + * When canceling the callback, need to update the supported commands list. + * Each playback command only supports registering one callback, + * and the new callback will replace the previous one. + * @param { 'playFromAssetId' } type - Command to register 'playFromAssetId'. + * @param { function } callback - Used to handle ('playFromAssetId') command + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600102 - The session does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 11 + */ + on(type: 'playFromAssetId', callback: (assetId: number) => void): void; + /** + * Unregister playFromAssetId command callback. + * @param { 'playFromAssetId' } type - Command to register 'playFromAssetId'. + * @param { function } callback - Used to handle ('playFromAssetId') command + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600102 - The session does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 11 + */ + off(type: 'playFromAssetId', callback?: (assetId: number) => void): void; + /** + * Register seek command callback + * @param { 'seek' } type - Registration Type 'seek' + * @param { function } callback - Used to handle seek command.The callback provides the seek time(ms) + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600102 - The session does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + on(type: 'seek', callback: (time: number) => void): void; + /** + * Unregister seek command callback + * @param { 'seek' } type - Registration Type 'seek' + * @param { function } callback - Used to handle seek command.The callback provides the seek time(ms) + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600102 - The session does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + off(type: 'seek', callback?: (time: number) => void): void; + /** + * Register setSpeed command callback + * @param { 'setSpeed' } type - Registration Type 'setSpeed' + * @param { function } callback - Used to handle setSpeed command.The callback provides the speed value + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600102 - The session does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + on(type: 'setSpeed', callback: (speed: number) => void): void; + /** + * Unregister setSpeed command callback + * @param { 'setSpeed' } type - Registration Type 'setSpeed' + * @param { function } callback - Used to handle setSpeed command.The callback provides the speed value + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600102 - The session does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + off(type: 'setSpeed', callback?: (speed: number) => void): void; + /** + * Register setLoopMode command callback + * @param { 'setLoopMode' } type - Registration Type 'setLoopMode' + * @param { function } callback - Used to handle setLoopMode command.The callback provides the {@link LoopMode} + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600102 - The session does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + on(type: 'setLoopMode', callback: (mode: LoopMode) => void): void; + /** + * Unregister setLoopMode command callback + * @param { 'setLoopMode' } type - Registration Type 'setLoopMode' + * @param { function } callback - Used to handle setLoopMode command.The callback provides the {@link LoopMode} + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600102 - The session does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + off(type: 'setLoopMode', callback?: (mode: LoopMode) => void): void; + /** + * Register toggle favorite command callback + * @param { 'toggleFavorite' } type - Registration Type 'toggleFavorite' + * @param { function } callback - Used to handle toggleFavorite command.The callback provides + * the assetId for which the favorite status needs to be switched. + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600102 - The session does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + on(type: 'toggleFavorite', callback: (assetId: string) => void): void; + /** + * Unregister toggle favorite command callback + * @param { 'toggleFavorite' } type - Registration Type 'toggleFavorite' + * @param { function } callback - Used to handle toggleFavorite command.The callback provides + * the assetId for which the favorite status needs to be switched. + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600102 - The session does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + off(type: 'toggleFavorite', callback?: (assetId: string) => void): void; + /** + * Register media key handling callback + * @param { 'handleKeyEvent' } type - Registration Type 'handleKeyEvent' + * @param { function } callback - Used to handle key events.The callback provides the KeyEvent + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600102 - The session does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + on(type: 'handleKeyEvent', callback: (event: KeyEvent) => void): void; + /** + * Unregister media key handling callback + * @param { 'handleKeyEvent' } type - Registration Type 'handleKeyEvent' + * @param { function } callback - Used to handle key events.The callback provides the KeyEvent + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600102 - The session does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + off(type: 'handleKeyEvent', callback?: (event: KeyEvent) => void): void; + /** + * Register session output device change callback + * @param { 'outputDeviceChange' } type - Registration Type 'outputDeviceChange' + * @param { function } callback - Used to handle output device changed. + * The callback provide the new device info {@link OutputDeviceInfo} and related connection state {@link ConnectionState}. + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. + * @throws { BusinessError } 6600101 - Session service exception + * @throws { BusinessError } 6600102 - The session does not exist + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * Register session output device change callback + * @param { 'outputDeviceChange' } type - Registration Type 'outputDeviceChange' + * @param { function } callback - Used to handle output device changed. + * The callback provide the new device info {@link OutputDeviceInfo} and related connection state {@link ConnectionState}. + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. + * @throws { BusinessError } 6600101 - Session service exception + * @throws { BusinessError } 6600102 - The session does not exist + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + on(type: 'outputDeviceChange', callback: (state: ConnectionState, device: OutputDeviceInfo) => void): void; + /** + * Unregister session output device change callback + * @param { 'outputDeviceChange' } type - Registration Type 'outputDeviceChange' + * @param { function } callback - Used to handle output device changed. + * The callback provide the new device info {@link OutputDeviceInfo} and related connection state {@link ConnectionState}. + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. + * @throws { BusinessError } 6600101 - Session service exception + * @throws { BusinessError } 6600102 - The session does not exist + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * Unregister session output device change callback + * @param { 'outputDeviceChange' } type - Registration Type 'outputDeviceChange' + * @param { function } callback - Used to handle output device changed. + * The callback provide the new device info {@link OutputDeviceInfo} and related connection state {@link ConnectionState}. + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. + * @throws { BusinessError } 6600101 - Session service exception + * @throws { BusinessError } 6600102 - The session does not exist + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + off(type: 'outputDeviceChange', callback?: (state: ConnectionState, device: OutputDeviceInfo) => void): void; + /** + * Register session custom command change callback + * @param { 'commonCommand' } type - Registration Type 'commonCommand' + * @param { function } callback - Used to handle event when the common command is received + * The callback provide the command name and command args + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600102 - The session does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + on(type: 'commonCommand', callback: (command: string, args: { + [key: string]: Object; + }) => void): void; + /** + * Unregister session custom command change callback + * @param { 'commonCommand' } type - Registration Type 'commonCommand' + * @param { function } callback - Used to cancel a specific listener + * The callback provide the command name and command args + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600102 - The session does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + off(type: 'commonCommand', callback?: (command: string, args: { + [key: string]: Object; + }) => void): void; + /** + * Register the item to play from the playlist change callback + * @param { 'skipToQueueItem' } type - Registration Type 'skipToQueueItem' + * @param { function } callback - Used to handle the item to be played. + * The callback provide the new device info {@link OutputDeviceInfo} + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600102 - The session does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + on(type: 'skipToQueueItem', callback: (itemId: number) => void): void; + /** + * Unregister the item to play from the playlist change callback + * @param { 'skipToQueueItem' } type - Registration Type 'skipToQueueItem' + * @param { function } callback - Used to handle the item to be played. + * The callback provide the new device info {@link OutputDeviceInfo} + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600102 - The session does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + off(type: 'skipToQueueItem', callback?: (itemId: number) => void): void; + /** + * Register answer command callback. + * As long as it is registered, it means that the ability supports this command. + * If you cancel the callback, you need to call off {@link off} + * @param { 'answer' } type - Command to register 'answer'. + * @param { Callback } callback - Used to handle ('answer') command + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600102 - The session does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 11 + */ + on(type: 'answer', callback: Callback): void; + /** + * Unregister answer command callback. + * @param { 'answer' } type - Command to register 'answer'. + * @param { Callback } callback - Used to handle ('answer') command + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600102 - The session does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 11 + */ + off(type: 'answer', callback?: Callback): void; + /** + * Register hangUp command callback. + * As long as it is registered, it means that the ability supports this command. + * If you cancel the callback, you need to call off {@link off} + * @param { 'hangUp' } type - Command to register 'hangUp'. + * @param { Callback } callback - Used to handle ('hangUp') command + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600102 - The session does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 11 + */ + on(type: 'hangUp', callback: Callback): void; + /** + * Unregister hangUp command callback. + * @param { 'hangUp' } type - Command to register 'hangUp'. + * @param { Callback } callback - Used to handle ('hangUp') command + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600102 - The session does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 11 + */ + off(type: 'hangUp', callback?: Callback): void; + /** + * Register toggleCallMute command callback. + * As long as it is registered, it means that the ability supports this command. + * If you cancel the callback, you need to call off {@link off} + * @param { 'toggleCallMute' } type - Command to register 'toggleCallMute'. + * @param { Callback } callback - Used to handle ('toggleCallMute') command + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600102 - The session does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 11 + */ + on(type: 'toggleCallMute', callback: Callback): void; + /** + * Unregister toggleCallMute command callback. + * @param { 'toggleCallMute' } type - Command to register 'toggleCallMute'. + * @param { Callback } callback - Used to handle ('toggleCallMute') command + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified.2.Incorrect parameter types. + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600102 - The session does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 11 + */ + off(type: 'toggleCallMute', callback?: Callback): void; + /** + * Register listener for cast display information changed. + * @param { 'castDisplayChange' } type - Type of the 'castDisplayChange' to listen for. + * @param { Callback } callback - Callback used to return cast display information. + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. + * @throws { BusinessError } 6600101 - Session service exception + * @throws { BusinessError } 6600102 - The session does not exist + * @syscap SystemCapability.Multimedia.AVSession.ExtendedDisplayCast + * @since 12 + */ + on(type: 'castDisplayChange', callback: Callback): void; + /** + * Unregister listener for cast display information changed. + * @param { 'castDisplayChange' } type - Type of the 'castDisplayChange' to listen for. + * @param { Callback } callback - Callback used to return cast display information. + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. + * @throws { BusinessError } 6600101 - Session service exception + * @throws { BusinessError } 6600102 - The session does not exist + * @syscap SystemCapability.Multimedia.AVSession.ExtendedDisplayCast + * @since 12 + */ + off(type: 'castDisplayChange', callback?: Callback): void; + /** + * Stop current cast and disconnect device connection. + * @param { AsyncCallback } callback A callback instance used to return when cast stopped completed. + * @throws { BusinessError } 6600109 - The remote connection is not established + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @since 10 + */ + stopCasting(callback: AsyncCallback): void; + /** + * Stop current cast and disconnect device connection. + * @returns { Promise } void result promise when executed successfully + * @throws { BusinessError } 6600109 - The remote connection is not established + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @since 10 + */ + /** + * Stop current cast and disconnect device connection. + * @returns { Promise } void result promise when executed successfully + * @throws { BusinessError } 6600109 - The remote connection is not established + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @atomicservice + * @since 12 + */ + stopCasting(): Promise; + /** + * Activate the session, indicating that the session can accept control commands + * @param { AsyncCallback } callback - The asyncCallback triggered when the session is activated. + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600102 - The session does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + activate(callback: AsyncCallback): void; + /** + * Activate the session, indicating that the session can accept control commands + * @returns { Promise } void result promise when executed successfully + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600102 - The session does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * Activate the session, indicating that the session can accept control commands + * @returns { Promise } void result promise when executed successfully + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600102 - The session does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + activate(): Promise; + /** + * Deactivate the session, indicating that the session not ready to accept control commands + * @param { AsyncCallback } callback - The asyncCallback triggered when the session is deactivated. + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600102 - The session does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + deactivate(callback: AsyncCallback): void; + /** + * Deactivate the session, indicating that the session not ready to accept control commands + * @returns { Promise } void promise when executed successfully + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600102 - The session does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * Deactivate the session, indicating that the session not ready to accept control commands + * @returns { Promise } void promise when executed successfully + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600102 - The session does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + deactivate(): Promise; + /** + * Destroy this session, the server will clean up the session resources + * @param { AsyncCallback } callback - The asyncCallback triggered when the command is executed successfully + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600102 - The session does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + destroy(callback: AsyncCallback): void; + /** + * Destroy this session, the server will clean up the session resources + * @returns { Promise } void promise when executed successfully + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600102 - The session does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * Destroy this session, the server will clean up the session resources + * @returns { Promise } void promise when executed successfully + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600102 - The session does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + destroy(): Promise; + } + /** + * The type of control command + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @since 10 + */ + /** + * The type of control command + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @atomicservice + * @since 12 + */ + type AVCastControlCommandType = 'play' | 'pause' | 'stop' | 'playNext' | 'playPrevious' | 'fastForward' | 'rewind' | 'seek' | 'setVolume' | 'setSpeed' | 'setLoopMode' | 'toggleFavorite' | 'toggleMute'; + /** + * The definition of command to be sent to the session + * @interface AVCastControlCommand + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @since 10 + */ + /** + * The definition of command to be sent to the session + * @interface AVCastControlCommand + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @atomicservice + * @since 12 + */ + interface AVCastControlCommand { + /** + * The command value {@link AVCastControlCommandType} + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @since 10 + */ + /** + * The command value {@link AVCastControlCommandType} + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @atomicservice + * @since 12 + */ + command: AVCastControlCommandType; + /** + * Parameter carried in the command. + * The seek command must carry the number parameter. + * The setVolume command must carry the number parameter. + * The toggleFavorite command must carry the {@link AVMediaDescription.assetId} parameter. + * The setSpeed command must carry the {@link #media.PlaybackSpeed} parameter. + * The setLoopMode command must carry the {@link LoopMode} parameter. + * Other commands do not need to carry parameters. + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @since 10 + */ + /** + * Parameter carried in the command. + * The seek command must carry the number parameter. + * The setVolume command must carry the number parameter. + * The toggleFavorite command must carry the {@link AVMediaDescription.assetId} parameter. + * The setSpeed command must carry the {@link #media.PlaybackSpeed} parameter. + * The setLoopMode command must carry the {@link LoopMode} parameter. + * Other commands do not need to carry parameters. + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @atomicservice + * @since 12 + */ + parameter?: media.PlaybackSpeed | number | string | LoopMode; + } + /** + * AVCastController definition used to implement a remote control when a cast is connected + * @interface AVCastController + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @since 10 + */ + /** + * AVCastController definition used to implement a remote control when a cast is connected + * @interface AVCastController + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @atomicservice + * @since 12 + */ + interface AVCastController { + /** + * Get the playback status of the current player + * @param { AsyncCallback } callback - The triggered asyncCallback when (getAVPlaybackState). + * @throws { BusinessError } 6600101 - Session service exception + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @since 10 + */ + getAVPlaybackState(callback: AsyncCallback): void; + /** + * Get the playback status of the current player + * @returns { Promise } (AVPlaybackState) returned through promise + * @throws { BusinessError } 6600101 - Session service exception + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @since 10 + */ + /** + * Get the playback status of the current player + * @returns { Promise } (AVPlaybackState) returned through promise + * @throws { BusinessError } 6600101 - Session service exception + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @atomicservice + * @since 12 + */ + getAVPlaybackState(): Promise; + /** + * Send control commands to remote player + * @param { AVCastControlCommand } command The command to be send. + * @param { AsyncCallback } callback - The asyncCallback triggered when the command is executed successfully + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Parameter verification failed. + * @throws { BusinessError } 6600101 - Session service exception + * @throws { BusinessError } 6600105 - Invalid session command + * @throws { BusinessError } 6600109 - The remote connection is not established + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @since 10 + */ + sendControlCommand(command: AVCastControlCommand, callback: AsyncCallback): void; + /** + * Send control commands to remote player + * @param { AVCastControlCommand } command The command to be send. + * @returns { Promise } Promise used to return the result. + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Parameter verification failed. + * @throws { BusinessError } 6600101 - Session service exception + * @throws { BusinessError } 6600105 - Invalid session command + * @throws { BusinessError } 6600109 - The remote connection is not established + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @since 10 + */ + /** + * Send control commands to remote player + * @param { AVCastControlCommand } command The command to be send. + * @returns { Promise } Promise used to return the result. + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Parameter verification failed. + * @throws { BusinessError } 6600101 - Session service exception + * @throws { BusinessError } 6600105 - Invalid session command + * @throws { BusinessError } 6600109 - The remote connection is not established + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @atomicservice + * @since 12 + */ + sendControlCommand(command: AVCastControlCommand): Promise; + /** + * Play the current item, should contain mediaUri otherwise the playback will fail. + * @param { AVQueueItem } item media item info. + * @param { AsyncCallback } callback - The asyncCallback triggered when the command is executed successfully + * @throws {BusinessError} 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Parameter verification failed. + * @throws {BusinessError} 6600101 - Session service exception + * @throws {BusinessError} 6600109 - The remote connection is not established + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @since 10 + */ + start(item: AVQueueItem, callback: AsyncCallback): void; + /** + * Play the current item, should contain mediaUri otherwise the playback will fail. + * @param { AVQueueItem } item media item info. + * @returns { Promise } Promise used to return the result. + * @throws {BusinessError} 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Parameter verification failed. + * @throws {BusinessError} 6600101 - Session service exception + * @throws {BusinessError} 6600109 - The remote connection is not established + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @since 10 + */ + /** + * Play the current item, should contain mediaUri otherwise the playback will fail. + * @param { AVQueueItem } item media item info. + * @returns { Promise } Promise used to return the result. + * @throws {BusinessError} 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Parameter verification failed. + * @throws {BusinessError} 6600101 - Session service exception + * @throws {BusinessError} 6600109 - The remote connection is not established + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @atomicservice + * @since 12 + */ + start(item: AVQueueItem): Promise; + /** + * Load the current item and mediaUri can be null, this is needed for sink media information displaying + * @param { AVQueueItem } item media item info. + * @param { AsyncCallback } callback - The asyncCallback triggered when the command is executed successfully + * @throws {BusinessError} 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Parameter verification failed. + * @throws {BusinessError} 6600101 - Session service exception + * @throws {BusinessError} 6600109 - The remote connection is not established + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @since 10 + */ + prepare(item: AVQueueItem, callback: AsyncCallback): void; + /** + * Load the current item and mediaUri can be null, this is needed for sink media information displaying + * @param { AVQueueItem } item media item info. + * @returns { Promise } Promise used to return the result. + * @throws {BusinessError} 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Parameter verification failed. + * @throws {BusinessError} 6600101 - Session service exception + * @throws {BusinessError} 6600109 - The remote connection is not established + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @since 10 + */ + /** + * Load the current item and mediaUri can be null, this is needed for sink media information displaying + * @param { AVQueueItem } item media item info. + * @returns { Promise } Promise used to return the result. + * @throws {BusinessError} 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Parameter verification failed. + * @throws {BusinessError} 6600101 - Session service exception + * @throws {BusinessError} 6600109 - The remote connection is not established + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @atomicservice + * @since 12 + */ + prepare(item: AVQueueItem): Promise; + /** + * Get the current playing item + * @param { AsyncCallback } callback - The triggered asyncCallback. + * @throws { BusinessError } 6600101 - Session service exception + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @since 10 + */ + getCurrentItem(callback: AsyncCallback): void; + /** + * Get the current playing item + * @returns { Promise } (AVQueueItem) returned through promise + * @throws { BusinessError } 6600101 - Session service exception + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @since 10 + */ + /** + * Get the current playing item + * @returns { Promise } (AVQueueItem) returned through promise + * @throws { BusinessError } 6600101 - Session service exception + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @atomicservice + * @since 12 + */ + getCurrentItem(): Promise; + /** + * Get commands supported by the current cast controller + * @param { AsyncCallback> } callback - The triggered asyncCallback when (getValidCommands). + * @throws { BusinessError } 6600101 - Session service exception. + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @since 11 + */ + getValidCommands(callback: AsyncCallback>): void; + /** + * Get commands supported by the current cast controller + * @returns { Promise> } array of AVCastControlCommandType promise + * @throws { BusinessError } 6600101 - Session service exception. + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @since 11 + */ + getValidCommands(): Promise>; + /** + * Process the response corresponding to the media key request obtained by the application. + * @param { string } assetId - The assetId of resource which provides the response. + * @param { Uint8Array } response - Response corresponding to the request. + * @returns { Promise } void promise when executed successfully + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Parameter verification failed. + * @throws { BusinessError } 6600101 - Session service exception + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @since 12 + */ + processMediaKeyResponse(assetId: string, response: Uint8Array): Promise; + /** + * Destroy the controller + * @param { AsyncCallback } callback - The asyncCallback triggered when the command is executed successfully. + * @throws { BusinessError } 6600101 - Session service exception. + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @since 11 + */ + release(callback: AsyncCallback): void; + /** + * Destroy the controller + * @returns { Promise } void promise when executed successfully + * @throws { BusinessError } 6600101 - Session service exception. + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @since 11 + */ + /** + * Destroy the controller + * @returns { Promise } void promise when executed successfully + * @throws { BusinessError } 6600101 - Session service exception. + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @atomicservice + * @since 12 + */ + release(): Promise; + /** + * Register playback state changed callback + * @param { 'playbackStateChange' } type + * @param { Array | 'all' } filter - The properties of {@link AVPlaybackState} that you cared about + * @param { function } callback - The callback used to handle playback state changed event. + * The callback function provides the {@link AVPlaybackState} parameter. + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. + * @throws { BusinessError } 6600101 - Session service exception + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @since 10 + */ + /** + * Register playback state changed callback + * @param { 'playbackStateChange' } type + * @param { Array | 'all' } filter - The properties of {@link AVPlaybackState} that you cared about + * @param { function } callback - The callback used to handle playback state changed event. + * The callback function provides the {@link AVPlaybackState} parameter. + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. + * @throws { BusinessError } 6600101 - Session service exception + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @atomicservice + * @since 12 + */ + on(type: 'playbackStateChange', filter: Array | 'all', callback: (state: AVPlaybackState) => void): void; + /** + * Unregister playback state changed callback + * @param { 'playbackStateChange' } type + * @param { function } callback - The callback used to handle playback state changed event. + * The callback function provides the {@link AVPlaybackState} parameter. + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. + * @throws { BusinessError } 6600101 - Session service exception + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @since 10 + */ + /** + * Unregister playback state changed callback + * @param { 'playbackStateChange' } type + * @param { function } callback - The callback used to handle playback state changed event. + * The callback function provides the {@link AVPlaybackState} parameter. + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. + * @throws { BusinessError } 6600101 - Session service exception + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @atomicservice + * @since 12 + */ + off(type: 'playbackStateChange', callback?: (state: AVPlaybackState) => void): void; + /** + * Register listener for current media item playback events. + * @param { 'mediaItemChange' } type Type of the playback event to listen for. + * @param { Callback } callback Callback used to listen for current item changed. + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. + * @throws { BusinessError } 6600101 - Session service exception + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @since 10 + */ + /** + * Register listener for current media item playback events. + * @param { 'mediaItemChange' } type Type of the playback event to listen for. + * @param { Callback } callback Callback used to listen for current item changed. + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. + * @throws { BusinessError } 6600101 - Session service exception + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @atomicservice + * @since 12 + */ + on(type: 'mediaItemChange', callback: Callback): void; + /** + * Unregister listener for current media item playback events. + * @param { 'mediaItemChange' } type Type of the playback event to listen for. + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. + * @throws { BusinessError } 6600101 - Session service exception + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @since 10 + */ + /** + * Unregister listener for current media item playback events. + * @param { 'mediaItemChange' } type Type of the playback event to listen for. + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. + * @throws { BusinessError } 6600101 - Session service exception + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @atomicservice + * @since 12 + */ + off(type: 'mediaItemChange'): void; + /** + * Register playback command callback sent by remote side or media center. + * Application needs update the new media resource when receive these commands by using playItem. + * @param { 'playNext' } type - Type of the 'playNext' event to listen for. + * @param { Callback } callback - Used to handle 'playNext' command + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. + * @throws { BusinessError } 6600101 - Session service exception + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @since 10 + */ + /** + * Register playback command callback sent by remote side or media center. + * Application needs update the new media resource when receive these commands by using playItem. + * @param { 'playNext' } type - Type of the 'playNext' event to listen for. + * @param { Callback } callback - Used to handle 'playNext' command + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. + * @throws { BusinessError } 6600101 - Session service exception + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @atomicservice + * @since 12 + */ + on(type: 'playNext', callback: Callback): void; + /** + * Unregister playback command callback sent by remote side or media center. + * When canceling the callback, need to update the supported commands list. + * @param { 'playNext' } type - Type of the 'playNext' event to listen for. + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. + * @throws { BusinessError } 6600101 - Session service exception + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @since 10 + */ + /** + * Unregister playback command callback sent by remote side or media center. + * When canceling the callback, need to update the supported commands list. + * @param { 'playNext' } type - Type of the 'playNext' event to listen for. + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. + * @throws { BusinessError } 6600101 - Session service exception + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @atomicservice + * @since 12 + */ + off(type: 'playNext'): void; + /** + * Register playback command callback sent by remote side or media center. + * Application needs update the new media resource when receive these commands by using playItem. + * @param { 'playPrevious' } type - Type of the 'playPrevious' to listen for. + * @param { Callback } callback - Used to handle 'playPrevious' command + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. + * @throws { BusinessError } 6600101 - Session service exception + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @since 10 + */ + /** + * Register playback command callback sent by remote side or media center. + * Application needs update the new media resource when receive these commands by using playItem. + * @param { 'playPrevious' } type - Type of the 'playPrevious' to listen for. + * @param { Callback } callback - Used to handle 'playPrevious' command + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. + * @throws { BusinessError } 6600101 - Session service exception + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @atomicservice + * @since 12 + */ + on(type: 'playPrevious', callback: Callback): void; + /** + * Unregister playback command callback sent by remote side or media center. + * When canceling the callback, need to update the supported commands list. + * @param { 'playPrevious' } type - Type of the 'playPrevious' to listen for. + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. + * @throws { BusinessError } 6600101 - Session service exception + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @since 10 + */ + /** + * Unregister playback command callback sent by remote side or media center. + * When canceling the callback, need to update the supported commands list. + * @param { 'playPrevious' } type - Type of the 'playPrevious' to listen for. + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. + * @throws { BusinessError } 6600101 - Session service exception + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @atomicservice + * @since 12 + */ + off(type: 'playPrevious'): void; + /** + * Register requested playback command callback sent by remote side or media center. + * The AVQueueItem may include the requested assetId, starting position and other configurations. + * @param { 'requestPlay' } type - Type of the 'requestPlay' to listen for. + * @param { Callback } callback - Used to handle 'requestPlay' command + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. + * @throws { BusinessError } 6600101 - Session service exception + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @since 11 + */ + on(type: 'requestPlay', callback: Callback): void; + /** + * Unregister requested playback command callback sent by remote side or media center. + * @param { 'requestPlay' } type - Type of the 'requestPlay' to listen for. + * @param { Callback } callback - Used to handle 'requestPlay' command + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. + * @throws { BusinessError } 6600101 - Session service exception + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @since 11 + */ + off(type: 'requestPlay', callback?: Callback): void; + /** + * Register endOfStream state callback. + * Application needs update the new media resource when receive these commands by using playItem. + * @param { 'endOfStream' } type - Type of the 'endOfStream' to listen for. + * @param { Callback } callback - Used to handle 'endOfStream' command + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. + * @throws { BusinessError } 6600101 - Session service exception + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @since 11 + */ + on(type: 'endOfStream', callback: Callback): void; + /** + * Unregister endOfStream state callback. + * @param { 'endOfStream' } type - Type of the 'endOfStream' to listen for. + * @param { Callback } callback - Used to handle 'endOfStream' command + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. + * @throws { BusinessError } 6600101 - Session service exception + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @since 11 + */ + off(type: 'endOfStream', callback?: Callback): void; + /** + * Register listens for playback events. + * @param { 'seekDone' } type - Type of the 'seekDone' to listen for. + * @param { Callback } callback - Callback used to listen for the playback seekDone event. + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. + * @throws { BusinessError } 6600101 - Session service exception + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @since 10 + */ + /** + * Register listens for playback events. + * @param { 'seekDone' } type - Type of the 'seekDone' to listen for. + * @param { Callback } callback - Callback used to listen for the playback seekDone event. + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. + * @throws { BusinessError } 6600101 - Session service exception + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @atomicservice + * @since 12 + */ + on(type: 'seekDone', callback: Callback): void; + /** + * Unregister listens for playback events. + * @param { 'seekDone' } type - Type of the 'seekDone' to listen for. + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. + * @throws { BusinessError } 6600101 - Session service exception + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @since 10 + */ + /** + * Unregister listens for playback events. + * @param { 'seekDone' } type - Type of the 'seekDone' to listen for. + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. + * @throws { BusinessError } 6600101 - Session service exception + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @atomicservice + * @since 12 + */ + off(type: 'seekDone'): void; + /** + * Register the valid commands of the casted session changed callback + * @param { 'validCommandChange' } type - 'validCommandChange' + * @param { Callback> } callback - The callback used to handle the changes. + * The callback function provides an array of AVCastControlCommandType. + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600103 - The session controller does not exist. + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @since 11 + */ + on(type: 'validCommandChange', callback: Callback>); + /** + * Unregister the valid commands of the casted session changed callback + * @param { 'validCommandChange' } type - 'validCommandChange' + * @param { Callback> } callback - The callback used to handle the changes. + * The callback function provides an array of AVCastControlCommandType. + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600103 - The session controller does not exist. + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @since 11 + */ + off(type: 'validCommandChange', callback?: Callback>); + /** + * Register listeners for playback error events. + * @param { 'error' } type Type of the 'error' to listen for. + * @param { ErrorCallback } callback Callback used to listen for the playback error event. + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. + * @throws { BusinessError } 5400101 - No memory. + * @throws { BusinessError } 5400102 - Operation not allowed. + * @throws { BusinessError } 5400103 - I/O error. + * @throws { BusinessError } 5400104 - Time out. + * @throws { BusinessError } 5400105 - Service died. + * @throws { BusinessError } 5400106 - Unsupport format. + * @throws { BusinessError } 6600101 - Session service exception + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @since 10 + */ + /** + * Register listeners for playback error events. + * @param { 'error' } type Type of the 'error' to listen for. + * @param { ErrorCallback } callback Callback used to listen for the playback error event. + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. + * @throws { BusinessError } 5400101 - No memory. + * @throws { BusinessError } 5400102 - Operation not allowed. + * @throws { BusinessError } 5400103 - I/O error. + * @throws { BusinessError } 5400104 - Time out. + * @throws { BusinessError } 5400105 - Service died. + * @throws { BusinessError } 5400106 - Unsupport format. + * @throws { BusinessError } 6600101 - Session service exception + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @atomicservice + * @since 12 + */ + on(type: 'error', callback: ErrorCallback): void; + /** + * Unregister listens for playback error events. + * @param { 'error' } type Type of the 'error' to listen for. + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. + * @throws { BusinessError } 5400101 - No memory. + * @throws { BusinessError } 5400102 - Operation not allowed. + * @throws { BusinessError } 5400103 - I/O error. + * @throws { BusinessError } 5400104 - Time out. + * @throws { BusinessError } 5400105 - Service died. + * @throws { BusinessError } 5400106 - Unsupport format. + * @throws { BusinessError } 6600101 - Session service exception + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @since 10 + */ + /** + * Unregister listens for playback error events. + * @param { 'error' } type Type of the 'error' to listen for. + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. + * @throws { BusinessError } 5400101 - No memory. + * @throws { BusinessError } 5400102 - Operation not allowed. + * @throws { BusinessError } 5400103 - I/O error. + * @throws { BusinessError } 5400104 - Time out. + * @throws { BusinessError } 5400105 - Service died. + * @throws { BusinessError } 5400106 - Unsupport format. + * @throws { BusinessError } 6600101 - Session service exception + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @atomicservice + * @since 12 + */ + off(type: 'error'): void; + /** + * Register listener for drm key request. + * @param { 'keyRequest' } type - Type of the 'keyRequest' to listen for. + * @param { KeyRequestCallback } callback - Callback used to request drm key. + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. + * @throws { BusinessError } 6600101 - Session service exception + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @atomicservice + * @since 12 + */ + on(type: 'keyRequest', callback: KeyRequestCallback): void; + /** + * Unregister listener for drm key request. + * @param { 'keyRequest' } type - Type of the 'keyRequest' to listen for. + * @param { KeyRequestCallback } callback - Callback used to request drm key. + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. + * @throws { BusinessError } 6600101 - Session service exception + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @atomicservice + * @since 12 + */ + off(type: 'keyRequest', callback?: KeyRequestCallback): void; + } + /** + * The callback of key request. + * + * @typedef { Function } KeyRequestCallback + * @param { string } assetId - request key for current assetId + * @param { Uint8Array } requestData - media key request data sent to media key server + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @atomicservice + * @since 12 + */ + type KeyRequestCallback = (assetId: string, requestData: Uint8Array) => void; + /** + * Enumerates the cast display states. + * + * @enum { number } + * @syscap SystemCapability.Multimedia.AVSession.ExtendedDisplayCast + * @since 12 + */ + enum CastDisplayState { + /** + * Screen off. + * + * @syscap SystemCapability.Multimedia.AVSession.ExtendedDisplayCast + * @since 12 + */ + STATE_OFF = 1, + /** + * Screen on. + * + * @syscap SystemCapability.Multimedia.AVSession.ExtendedDisplayCast + * @since 12 + */ + STATE_ON + } + /** + * Define the information for extended display screen. + * @typedef CastDisplayInfo + * @syscap SystemCapability.Multimedia.AVSession.ExtendedDisplayCast + * @since 12 + */ + interface CastDisplayInfo { + /** + * Display ID. + * The application can get more display information based on the same id from display interface. + * + * @syscap SystemCapability.Multimedia.AVSession.ExtendedDisplayCast + * @since 12 + */ + id: number; + /** + * Display name. + * + * @syscap SystemCapability.Multimedia.AVSession.ExtendedDisplayCast + * @since 12 + */ + name: string; + /** + * The state of display. + * + * @syscap SystemCapability.Multimedia.AVSession.ExtendedDisplayCast + * @since 12 + */ + state: CastDisplayState; + /** + * Display width, in pixels. + * + * @syscap SystemCapability.Multimedia.AVSession.ExtendedDisplayCast + * @since 12 + */ + width: number; + /** + * Display height, in pixels. + * + * @syscap SystemCapability.Multimedia.AVSession.ExtendedDisplayCast + * @since 12 + */ + height: number; + } + /** + * Define the device connection state. + * @enum { number } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * Define the device connection state. + * @enum { number } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + enum ConnectionState { + /** + * A connection state indicating the device is in the process of connecting. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * A connection state indicating the device is in the process of connecting. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + STATE_CONNECTING = 0, + /** + * A connection state indicating the device is connected. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * A connection state indicating the device is connected. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + STATE_CONNECTED = 1, + /** + * The default connection state indicating the device is disconnected. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * The default connection state indicating the device is disconnected. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + STATE_DISCONNECTED = 6 + } + /** + * The pre-defined display tag by system. + * @enum { number } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 11 + */ + enum DisplayTag { + /** + * Indicate the AUDIO VIVID property of current media resource. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 11 + */ + TAG_AUDIO_VIVID = 1 + } + /** + * The metadata of the current media.Used to set the properties of the current media file + * @interface AVMetadata + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * The metadata of the current media.Used to set the properties of the current media file + * @interface AVMetadata + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + interface AVMetadata { + /** + * Unique ID used to represent this media. + * @type { string } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * Unique ID used to represent this media. + * @type { string } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + assetId: string; + /** + * The title of this media, for display in media center. + * @type { ?string } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * The title of this media, for display in media center. + * @type { ?string } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + title?: string; + /** + * The artist of this media + * @type { ?string } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * The artist of this media + * @type { ?string } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + artist?: string; + /** + * The author of this media + * @type { ?string } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * The author of this media + * @type { ?string } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + author?: string; + /** + * The name of play list which current media belongs to + * @type { ?string } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 12 + */ + avQueueName?: string; + /** + * The id of play list which current media belongs to, it should be an unique identifier in the application. + * @type { ?string } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 11 + */ + avQueueId?: string; + /** + * The artwork of play list as a {@link PixelMap} or an uri formatted String, + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 11 + */ + avQueueImage?: image.PixelMap | string; + /** + * The album of this media + * @type { ?string } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * The album of this media + * @type { ?string } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + album?: string; + /** + * The writer of this media + * @type { ?string } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * The writer of this media + * @type { ?string } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + writer?: string; + /** + * The composer of this media + * @type { ?string } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + composer?: string; + /** + * The duration of this media, used to automatically calculate playback position + * @type { ?number } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * The duration of this media, used to automatically calculate playback position + * @type { ?number } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + duration?: number; + /** + * The image of the media as a {@link PixelMap} or an uri formatted String, + * used to display in media center. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * The image of the media as a {@link PixelMap} or an uri formatted String, + * used to display in media center. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + mediaImage?: image.PixelMap | string; + /** + * The publishDate of the media + * @type { ?Date } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + publishDate?: Date; + /** + * The subtitle of the media, used for display + * @type { ?string } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * The subtitle of the media, used for display + * @type { ?string } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + subtitle?: string; + /** + * The discription of the media, used for display + * @type { ?string } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * The discription of the media, used for display + * @type { ?string } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + description?: string; + /** + * The lyric of the media, it should be in standard lyric format + * @type { ?string } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + lyric?: string; + /** + * The previous playable media id. + * Used to tell the controller if there is a previous playable media + * @type { ?string } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * The previous playable media id. + * Used to tell the controller if there is a previous playable media + * @type { ?string } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + previousAssetId?: string; + /** + * The next playable media id. + * Used to tell the controller if there is a next playable media + * @type { ?string } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * The next playable media id. + * Used to tell the controller if there is a next playable media + * @type { ?string } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + nextAssetId?: string; + /** + * The protocols supported by this session, if not set, the default is {@link TYPE_CAST_PLUS_STREAM}. + * See {@link ProtocolType} + * @type { ?number } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 11 + */ + /** + * The protocols supported by this session, if not set, the default is {@link TYPE_CAST_PLUS_STREAM}. + * See {@link ProtocolType} + * @type { ?number } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + filter?: number; + /** + * The drm schemes supported by this session which are represented by uuid. + * @type { ?Array } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 12 + */ + drmSchemes?: Array; + /** + * The supported skipIntervals when doing fast forward and rewind operation, the default is {@link SECONDS_15}. + * See {@link SkipIntervals} + * @type { ?SkipIntervals } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 11 + */ + skipIntervals?: SkipIntervals; + /** + * The display tags supported by application to be displayed on media center + * @type { ?number } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 11 + */ + displayTags?: number; + } + /** + * The description of the media for an item in the playlist of the session + * @interface AVMediaDescription + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * The description of the media for an item in the playlist of the session + * @interface AVMediaDescription + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + interface AVMediaDescription { + /** + * Unique ID used to represent this media. + * @type { string } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * Unique ID used to represent this media. + * @type { string } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + assetId: string; + /** + * The title of this media, for display in media center. + * @type { ?string } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * The title of this media, for display in media center. + * @type { ?string } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + title?: string; + /** + * The subtitle of the media, used for display + * @type { ?string } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * The subtitle of the media, used for display + * @type { ?string } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + subtitle?: string; + /** + * The description of this media + * @type { ?string } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * The description of this media + * @type { ?string } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + description?: string; + /** + * The image of this media asset displayed in the media center. + * It can be a {@link PixelMap} or a URI formatted string, + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * The image of this media asset displayed in the media center. + * It can be a {@link PixelMap} or a URI formatted string, + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + mediaImage?: image.PixelMap | string; + /** + * Any additional attributes that can be represented as key-value pairs + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + extras?: { + [key: string]: Object; + }; + /** + * The type of this media, such as video, audio and so on. + * @type { ?string } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * The type of this media, such as video, audio and so on. + * @type { ?string } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + mediaType?: string; + /** + * The size of this media. + * @type { ?number } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * The size of this media. + * @type { ?number } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + mediaSize?: number; + /** + * The album title of this media + * @type { ?string } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * The album title of this media + * @type { ?string } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + albumTitle?: string; + /** + * The album cover uri of this media + * @type { ?string } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * The album cover uri of this media + * @type { ?string } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + albumCoverUri?: string; + /** + * The lyric content of the media, it should be in standard lyric format + * @type { ?string } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * The lyric content of the media, it should be in standard lyric format + * @type { ?string } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + lyricContent?: string; + /** + * The lyric uri of the media. + * @type { ?string } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * The lyric uri of the media. + * @type { ?string } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + lyricUri?: string; + /** + * The artist of this media. + * @type { ?string } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * The artist of this media. + * @type { ?string } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + artist?: string; + /** + * The uri of the media, used to locate the media in some special cases + * @type { ?string } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * The uri of the media, used to locate the media in some special cases + * @type { ?string } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + mediaUri?: string; + /** + * Media file descriptor. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * Media file descriptor. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + fdSrc?: media.AVFileDescriptor; + /** + * DataSource descriptor. The caller ensures the fileSize and callback are valid. + * @type { ?media.AVDataSrcDescriptor } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 12 + */ + dataSrc?: media.AVDataSrcDescriptor; + /** + * The drm scheme supported by this resource which is represented by uuid. + * @type { ?string } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 12 + */ + drmScheme?: string; + /** + * The duration of this media + * @type { ?number } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * The duration of this media + * @type { ?number } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + duration?: number; + /** + * Media start position, described by milliseconds. + * @type { ?number } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * Media start position, described by milliseconds. + * @type { ?number } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + startPosition?: number; + /** + * Media credits position, described by milliseconds. + * @type { ?number } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * Media credits position, described by milliseconds. + * @type { ?number } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + creditsPosition?: number; + /** + * Application name. + * @type { ?string } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * Application name. + * @type { ?string } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + appName?: string; + /** + * The display tags supported by application to be displayed on media center + * @type { ?number } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 11 + */ + /** + * The display tags supported by application to be displayed on media center + * @type { ?number } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + displayTags?: number; + } + /** + * The item in the playlist of the session + * @interface AVQueueItem + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * The item in the playlist of the session + * @interface AVQueueItem + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + interface AVQueueItem { + /** + * Sequence number of the item in the playlist. + * @type { number } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * Sequence number of the item in the playlist. + * @type { number } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + itemId: number; + /** + * The media description of the item in the playlist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * The media description of the item in the playlist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + description?: AVMediaDescription; + } + /** + * Used to indicate the playback state of the current media. + * If the playback state of the media changes, it needs to be updated synchronously + * @interface AVPlaybackState + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * Used to indicate the playback state of the current media. + * If the playback state of the media changes, it needs to be updated synchronously + * @interface AVPlaybackState + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + interface AVPlaybackState { + /** + * Current playback state. See {@link PlaybackState} + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * Current playback state. See {@link PlaybackState} + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + state?: PlaybackState; + /** + * Current playback speed + * @type { ?number } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * Current playback speed + * @type { ?number } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + speed?: number; + /** + * Current playback position of this media. See {@link PlaybackPosition} + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * Current playback position of this media. See {@link PlaybackPosition} + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + position?: PlaybackPosition; + /** + * The current buffered time, the maximum playable position + * @type { ?number } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * The current buffered time, the maximum playable position + * @type { ?number } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + bufferedTime?: number; + /** + * Current playback loop mode. See {@link LoopMode} + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * Current playback loop mode. See {@link LoopMode} + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + loopMode?: LoopMode; + /** + * Current Favorite Status + * @type { ?boolean } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * Current Favorite Status + * @type { ?boolean } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + isFavorite?: boolean; + /** + * Current active item id + * @type { ?number } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * Current active item id + * @type { ?number } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + activeItemId?: number; + /** + * Current player volume + * @type { ?number } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * Current player volume + * @type { ?number } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + volume?: number; + /** + * maximum volume + * @type { ?number } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 11 + */ + /** + * maximum volume + * @type { ?number } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + maxVolume?: number; + /** + * Current muted status + * @type { ?boolean } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 11 + */ + /** + * Current muted status + * @type { ?boolean } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + muted?: boolean; + /** + * The duration of this media asset. + * @type { ?number } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 11 + */ + duration?: number; + /** + * The video width of this media asset. + * @type { ?number } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 11 + */ + /** + * The video width of this media asset. + * @type { ?number } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + videoWidth?: number; + /** + * The video height of this media asset. + * @type { ?number } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 11 + */ + /** + * The video height of this media asset. + * @type { ?number } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + videoHeight?: number; + /** + * Current custom media packets + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * Current custom media packets + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + extras?: { + [key: string]: Object; + }; + } + /** + * Playback position definition + * @interface PlaybackPosition + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * Playback position definition + * @interface PlaybackPosition + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + interface PlaybackPosition { + /** + * Elapsed time(position) of this media set by the app. + * @type { number } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * Elapsed time(position) of this media set by the app. + * @type { number } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + elapsedTime: number; + /** + * Record the system time when elapsedTime is set. + * @type { number } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * Record the system time when elapsedTime is set. + * @type { number } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + updateTime: number; + } + /** + * The metadata of the current call. + * @interface CallMetadata + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 11 + */ + interface CallMetadata { + /** + * The displayed user name of current call. + * @type { ?string } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 11 + */ + name?: string; + /** + * The phone number of current call. + * @type { ?string } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 11 + */ + phoneNumber?: string; + /** + * The displayed picture that represents a particular user. + * @type { ?image.PixelMap } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 11 + */ + avatar?: image.PixelMap; + } + /** + * Used to indicate the call state of the current call. + * @interface AVCallState + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 11 + */ + interface AVCallState { + /** + * Current call state. See {@link CallState} + * @type {CallState} + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 11 + */ + state: CallState; + /** + * Current muted status. + * @type { boolean } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 11 + */ + muted: boolean; + } + /** + * Enumeration of current call state + * @enum { number } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 11 + */ + enum CallState { + /** + * Idle state. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 11 + */ + CALL_STATE_IDLE = 0, + /** + * Incoming state. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 11 + */ + CALL_STATE_INCOMING = 1, + /** + * Active state in calling. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 11 + */ + CALL_STATE_ACTIVE = 2, + /** + * Dialing state. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 11 + */ + CALL_STATE_DIALING = 3, + /** + * Waiting state. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 11 + */ + CALL_STATE_WAITING = 4, + /** + * Holding state. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 11 + */ + CALL_STATE_HOLDING = 5, + /** + * Disconnecting state. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 11 + */ + CALL_STATE_DISCONNECTING = 6 + } + /** + * cast category indicating different playback scenes + * @enum { number } + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @since 10 + */ + /** + * cast category indicating different playback scenes + * @enum { number } + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @atomicservice + * @since 12 + */ + enum AVCastCategory { + /** + * The default cast type "local", media can be routed on the same device, + * including internal speakers or audio jack on the device itself, A2DP devices. + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @since 10 + */ + /** + * The default cast type "local", media can be routed on the same device, + * including internal speakers or audio jack on the device itself, A2DP devices. + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @atomicservice + * @since 12 + */ + CATEGORY_LOCAL = 0, + /** + * The remote category indicating the media is presenting on a remote device, + * the application needs to get an AVCastController to control remote playback. + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @since 10 + */ + /** + * The remote category indicating the media is presenting on a remote device, + * the application needs to get an AVCastController to control remote playback. + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @atomicservice + * @since 12 + */ + CATEGORY_REMOTE = 1 + } + /** + * Device type definition + * @enum { number } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * Device type definition + * @enum { number } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + enum DeviceType { + /** + * A device type indicating the route is on internal speakers or audio jack on the device itself. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * A device type indicating the route is on internal speakers or audio jack on the device itself. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + DEVICE_TYPE_LOCAL = 0, + /** + * A device type indicating the route is on a TV. + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @since 10 + */ + /** + * A device type indicating the route is on a TV. + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @atomicservice + * @since 12 + */ + DEVICE_TYPE_TV = 2, + /** + * A device type indicating the route is on a smart speaker. + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @since 10 + */ + /** + * A device type indicating the route is on a smart speaker. + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @atomicservice + * @since 12 + */ + DEVICE_TYPE_SMART_SPEAKER = 3, + /** + * A device type indicating the route is on a bluetooth device. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * A device type indicating the route is on a bluetooth device. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + DEVICE_TYPE_BLUETOOTH = 10 + } + /** + * Device Information Definition + * @interface DeviceInfo + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * Device Information Definition + * @interface DeviceInfo + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + interface DeviceInfo { + /** + * The playback type supported by the device. See {@link AVCastCategory} + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * The playback type supported by the device. See {@link AVCastCategory} + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + castCategory: AVCastCategory; + /** + * Audio device id.The length of the audioDeviceId array is greater than 1 + * if output to multiple devices at the same time. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * Audio device id.The length of the audioDeviceId array is greater than 1 + * if output to multiple devices at the same time. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + deviceId: string; + /** + * Device name. The length of the deviceName array is greater than 1 + * if output to multiple devices at the same time. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * Device name. The length of the deviceName array is greater than 1 + * if output to multiple devices at the same time. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + deviceName: string; + /** + * device type. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * device type. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + deviceType: DeviceType; + /** + * The protocols supported by current device, can be union of {@link ProtocolType}. + * @type { ?number } + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @since 11 + */ + /** + * The protocols supported by current device, can be union of {@link ProtocolType}. + * @type { ?number } + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @atomicservice + * @since 12 + */ + supportedProtocols?: number; + /** + * The drm capability supported by current device, each drm is represented by uuid. + * @type { ?Array } + * @syscap SystemCapability.Multimedia.AVSession.AVCast + * @since 12 + */ + supportedDrmCapabilities?: Array; + } + /** + * Target Device Information Definition + * @interface OutputDeviceInfo + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * Target Device Information Definition + * @interface OutputDeviceInfo + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + interface OutputDeviceInfo { + /** + * Arrays of device information + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * Arrays of device information + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + devices: Array; + } + /** + * Loop Play Mode Definition + * @enum { number } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * Loop Play Mode Definition + * @enum { number } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + enum LoopMode { + /** + * The default mode is sequential playback + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * The default mode is sequential playback + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + LOOP_MODE_SEQUENCE = 0, + /** + * Single loop mode + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * Single loop mode + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + LOOP_MODE_SINGLE = 1, + /** + * List loop mode + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * List loop mode + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + LOOP_MODE_LIST = 2, + /** + * Shuffle playback mode + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * Shuffle playback mode + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + LOOP_MODE_SHUFFLE = 3, + /** + * Custom playback mode supported by application + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 11 + */ + /** + * Custom playback mode supported by application + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + LOOP_MODE_CUSTOM = 4 + } + /** + * Supported skip intervals definition + * @enum { number } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 11 + */ + enum SkipIntervals { + /** + * 10 seconds + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 11 + */ + SECONDS_10 = 10, + /** + * 15 seconds + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 11 + */ + SECONDS_15 = 15, + /** + * 30 seconds + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 11 + */ + SECONDS_30 = 30 + } + /** + * Definition of current playback state + * @enum { number } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * Definition of current playback state + * @enum { number } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + enum PlaybackState { + /** + * Initial state. The initial state of media file + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * Initial state. The initial state of media file + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + PLAYBACK_STATE_INITIAL = 0, + /** + * Preparing state. Indicates that the media file is not ready to play, + * the media is loading or buffering + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * Preparing state. Indicates that the media file is not ready to play, + * the media is loading or buffering + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + PLAYBACK_STATE_PREPARE = 1, + /** + * Playing state. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * Playing state. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + PLAYBACK_STATE_PLAY = 2, + /** + * Paused state. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * Paused state. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + PLAYBACK_STATE_PAUSE = 3, + /** + * Fast forwarding state. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * Fast forwarding state. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + PLAYBACK_STATE_FAST_FORWARD = 4, + /** + * Rewinding state. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * Rewinding state. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + PLAYBACK_STATE_REWIND = 5, + /** + * Stopped state.The server will clear the media playback position and other information. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * Stopped state.The server will clear the media playback position and other information. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + PLAYBACK_STATE_STOP = 6, + /** + * Completed state. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * Completed state. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + PLAYBACK_STATE_COMPLETED = 7, + /** + * Released state. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * Released state. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + PLAYBACK_STATE_RELEASED = 8, + /** + * error state. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * error state. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + PLAYBACK_STATE_ERROR = 9, + /** + * Idle state. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 11 + */ + /** + * Idle state. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + PLAYBACK_STATE_IDLE = 10, + /** + * Buffering state. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 11 + */ + /** + * Buffering state. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + PLAYBACK_STATE_BUFFERING = 11 + } + /** + * Session controller,used to control media playback and get media information + * @interface AVSessionController + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + interface AVSessionController { + /** + * Unique session Id + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + readonly sessionId: string; + /** + * Get the playback status of the current session + * @param { AsyncCallback } callback - The triggered asyncCallback when (getAVPlaybackState). + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600102 - The session does not exist. + * @throws { BusinessError } 6600103 - The session controller does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + getAVPlaybackState(callback: AsyncCallback): void; + /** + * Get the playback status of the current session + * @returns { Promise } (AVPlaybackState) returned through promise + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600102 - The session does not exist. + * @throws { BusinessError } 6600103 - The session controller does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + getAVPlaybackState(): Promise; + /** + * Get the playback status of the current session + * @returns { AVPlaybackState } (AVPlaybackState) returned + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600102 - The session does not exist. + * @throws { BusinessError } 6600103 - The session controller does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + getAVPlaybackStateSync(): AVPlaybackState; + /** + * Get the metadata of the current session + * @param { AsyncCallback } callback - The triggered asyncCallback when (getAVMetadata). + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600102 - The session does not exist. + * @throws { BusinessError } 6600103 - The session controller does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + getAVMetadata(callback: AsyncCallback): void; + /** + * Get the metadata of the current session + * @returns { Promise } (AVMetadata) returned through promise + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600102 - The session does not exist. + * @throws { BusinessError } 6600103 - The session controller does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + getAVMetadata(): Promise; + /** + * Get the metadata of the current session + * @returns { AVMetadata } (AVMetadata) returned + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600102 - The session does not exist. + * @throws { BusinessError } 6600103 - The session controller does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + getAVMetadataSync(): AVMetadata; + /** + * Get the call status of the current session + * @param { AsyncCallback } callback - The triggered asyncCallback when (getAVCallState). + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600102 - The session does not exist. + * @throws { BusinessError } 6600103 - The session controller does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 11 + */ + getAVCallState(callback: AsyncCallback): void; + /** + * Get the call status of the current session + * @returns { Promise } (AVCallState) returned through promise + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600102 - The session does not exist. + * @throws { BusinessError } 6600103 - The session controller does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 11 + */ + getAVCallState(): Promise; + /** + * Get the call metadata of the current session + * @param { AsyncCallback } callback - The triggered asyncCallback when (getCallMetadata). + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600102 - The session does not exist. + * @throws { BusinessError } 6600103 - The session controller does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 11 + */ + getCallMetadata(callback: AsyncCallback): void; + /** + * Get the call metadata of the current session + * @returns { Promise } (CallMetadata) returned through promise + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600102 - The session does not exist. + * @throws { BusinessError } 6600103 - The session controller does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 11 + */ + getCallMetadata(): Promise; + /** + * Get the name of the playlist of the current session + * @param { AsyncCallback } callback - The triggered asyncCallback when (getAVQueueTitle). + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600102 - The session does not exist. + * @throws { BusinessError } 6600103 - The session controller does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + getAVQueueTitle(callback: AsyncCallback): void; + /** + * Get the name of the playlist of the current session + * @returns { Promise } (string) returned through promise + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600102 - The session does not exist. + * @throws { BusinessError } 6600103 - The session controller does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + getAVQueueTitle(): Promise; + /** + * Get the name of the playlist of the current session + * @returns { string } (string) returned + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600102 - The session does not exist. + * @throws { BusinessError } 6600103 - The session controller does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + getAVQueueTitleSync(): string; + /** + * Get the playlist of the current session + * @param { AsyncCallback> } callback - The triggered asyncCallback when (getAVQueueItems). + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600102 - The session does not exist. + * @throws { BusinessError } 6600103 - The session controller does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + getAVQueueItems(callback: AsyncCallback>): void; + /** + * Get the playlist of the current session + * @returns { Promise> } (Array) returned through promise + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600102 - The session does not exist. + * @throws { BusinessError } 6600103 - The session controller does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + getAVQueueItems(): Promise>; + /** + * Get the playlist of the current session + * @returns { Array } (Array) returned + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600102 - The session does not exist. + * @throws { BusinessError } 6600103 - The session controller does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + getAVQueueItemsSync(): Array; + /** + * Set the item in the playlist to be played + * @param { number } itemId - The serial number of the item to be played + * @param { AsyncCallback } callback - The asyncCallback triggered when the command is executed successfully + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Parameter verification failed. + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600102 - The session does not exist. + * @throws { BusinessError } 6600103 - The session controller does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + skipToQueueItem(itemId: number, callback: AsyncCallback): void; + /** + * Set the item in the playlist to be played + * @param { number } itemId - The serial number of the item to be played + * @returns { Promise } void promise when executed successfully + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Parameter verification failed. + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600102 - The session does not exist. + * @throws { BusinessError } 6600103 - The session controller does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + skipToQueueItem(itemId: number): Promise; + /** + * Get output device information + * @param { AsyncCallback } callback - The triggered asyncCallback when (getOutputDevice). + * @throws { BusinessError } 600101 - Session service exception. + * @throws { BusinessError } 600103 - The session controller does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + getOutputDevice(callback: AsyncCallback): void; + /** + * Get output device information + * @returns { Promise } (OutputDeviceInfo) returned through promise + * @throws { BusinessError } 600101 - Session service exception. + * @throws { BusinessError } 600103 - The session controller does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + getOutputDevice(): Promise; + /** + * Get output device information + * @returns { OutputDeviceInfo } (OutputDeviceInfo) returned + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600103 - The session controller does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + getOutputDeviceSync(): OutputDeviceInfo; + /** + * Send media key event to this session + * @param { KeyEvent } event - The KeyEvent + * @param { AsyncCallback } callback - The asyncCallback triggered when the command is executed successfully. + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Parameter verification failed. + * @throws { BusinessError } 600101 - Session service exception. + * @throws { BusinessError } 600102 - The session does not exist. + * @throws { BusinessError } 600103 - The session controller does not exist. + * @throws { BusinessError } 600105 - Invalid session command. + * @throws { BusinessError } 600106 - The session is not activated. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + sendAVKeyEvent(event: KeyEvent, callback: AsyncCallback): void; + /** + * Send media key event to this session + * @param { KeyEvent } event - The KeyEvent + * @returns { Promise } void promise when executed successfully + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Parameter verification failed. + * @throws { BusinessError } 600101 - Session service exception. + * @throws { BusinessError } 600102 - The session does not exist. + * @throws { BusinessError } 600103 - The session controller does not exist. + * @throws { BusinessError } 600105 - Invalid session command. + * @throws { BusinessError } 600106 - The session is not activated. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + sendAVKeyEvent(event: KeyEvent): Promise; + /** + * Get the {@link WantAgent} of this session that can launch the session ability + * @param { AsyncCallback } callback - The asyncCallback triggered when getting the WantAgent. + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600102 - The session does not exist. + * @throws { BusinessError } 6600103 - The session controller does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + getLaunchAbility(callback: AsyncCallback): void; + /** + * Get the {@link WantAgent} of this session that can launch the session ability + * @returns { Promise } WantAgent promise + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600102 - The session does not exist. + * @throws { BusinessError } 6600103 - The session controller does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + getLaunchAbility(): Promise; + /** + * Get the adjusted playback position. The time automatically calculated by the system + * taking into account factors such as playback status, playback speed, and application update time. + * @returns { number } current playback position in ms.Note that the returns value of each call will be different. + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600103 - The session controller does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + getRealPlaybackPositionSync(): number; + /** + * Check if the current session is active + * @param { AsyncCallback } callback - The triggered asyncCallback when (isActive). + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600102 - The session does not exist. + * @throws { BusinessError } 6600103 - The session controller does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + isActive(callback: AsyncCallback): void; + /** + * Check if the current session is active + * @returns { Promise } boolean promise + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600102 - The session does not exist. + * @throws { BusinessError } 6600103 - The session controller does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + isActive(): Promise; + /** + * Check if the current session is active + * @returns { boolean } boolean + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600102 - The session does not exist. + * @throws { BusinessError } 6600103 - The session controller does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + isActiveSync(): boolean; + /** + * Destroy the server controller + * @param { AsyncCallback } callback - The asyncCallback triggered when the command is executed successfully. + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600103 - The session controller does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + destroy(callback: AsyncCallback): void; + /** + * Destroy the server controller + * @returns { Promise } void promise when executed successfully + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600103 - The session controller does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + destroy(): Promise; + /** + * Get commands supported by the current session + * @param { AsyncCallback> } callback - The triggered asyncCallback when (getValidCommands). + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600102 - The session does not exist. + * @throws { BusinessError } 6600103 - The session controller does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + getValidCommands(callback: AsyncCallback>): void; + /** + * Get commands supported by the current session + * @returns { Promise> } array of AVControlCommandType promise + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600102 - The session does not exist. + * @throws { BusinessError } 6600103 - The session controller does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + getValidCommands(): Promise>; + /** + * Get commands supported by the current session + * @returns {Array } array of AVControlCommandType + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600102 - The session does not exist. + * @throws { BusinessError } 6600103 - The session controller does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + getValidCommandsSync(): Array; + /** + * Send control commands to this session + * @param { AVControlCommand } command - The command to be sent. See {@link AVControlCommand} + * @param { AsyncCallback } callback - The asyncCallback triggered when the command is executed successfully. + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Parameter verification failed. + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600102 - The session does not exist. + * @throws { BusinessError } 6600103 - The session controller does not exist. + * @throws { BusinessError } 6600105 - Invalid session command. + * @throws { BusinessError } 6600106 - The session is not activated. + * @throws { BusinessError } 6600107 - Too many commands or events. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + sendControlCommand(command: AVControlCommand, callback: AsyncCallback): void; + /** + * Send control commands to this session + * @param { AVControlCommand } command - The command to be sent. See {@link AVControlCommand} + * @returns { Promise } void promise when executed successfully + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Parameter verification failed. + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600102 - The session does not exist. + * @throws { BusinessError } 6600103 - The session controller does not exist. + * @throws { BusinessError } 6600105 - Invalid session command. + * @throws { BusinessError } 6600106 - The session is not activated. + * @throws { BusinessError } 6600107 - Too many commands or events. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + sendControlCommand(command: AVControlCommand): Promise; + /** + * Send common commands to this session + * @param { string } command - The command name to be sent. + * @param { object } args - The parameters of session event + * @param { AsyncCallback } callback - The asyncCallback triggered when the command is executed successfully. + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Parameter verification failed. + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600102 - The session does not exist. + * @throws { BusinessError } 6600103 - The session controller does not exist. + * @throws { BusinessError } 6600105 - Invalid session command. + * @throws { BusinessError } 6600106 - The session is not activated. + * @throws { BusinessError } 6600107 - Too many commands or events. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + sendCommonCommand(command: string, args: { + [key: string]: Object; + }, callback: AsyncCallback): void; + /** + * Send common commands to this session + * @param { string } command - The command name to be sent. + * @param { object } args - The parameters of session event + * @returns { Promise } void promise when executed successfully + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Parameter verification failed. + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600102 - The session does not exist. + * @throws { BusinessError } 6600103 - The session controller does not exist. + * @throws { BusinessError } 6600105 - Invalid session command. + * @throws { BusinessError } 6600106 - The session is not activated. + * @throws { BusinessError } 6600107 - Too many commands or events. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + sendCommonCommand(command: string, args: { + [key: string]: Object; + }): Promise; + /** + * Get custom media packets provided by the corresponding session + * @param { AsyncCallback<{[key: string]: Object}> } callback - The triggered asyncCallback when (getExtras). + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. 3.Parameter verification failed. + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600102 - The session does not exist. + * @throws { BusinessError } 6600103 - The session controller does not exist. + * @throws { BusinessError } 6600105 - Invalid session command. + * @throws { BusinessError } 6600107 - Too many commands or events. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + getExtras(callback: AsyncCallback<{ + [key: string]: Object; + }>): void; + /** + * Get custom media packets provided by the corresponding session + * @returns { Promise<{[key: string]: Object}> } the parameters of extras + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. 3.Parameter verification failed. + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600102 - The session does not exist. + * @throws { BusinessError } 6600103 - The session controller does not exist. + * @throws { BusinessError } 6600105 - Invalid session command. + * @throws { BusinessError } 6600107 - Too many commands or events. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + getExtras(): Promise<{ + [key: string]: Object; + }>; + /** + * Register metadata changed callback + * @param { 'metadataChange' } type + * @param { Array | 'all' } filter - The properties of {@link AVMetadata} that you cared about + * @param { function } callback - The callback used to handle metadata changed event. + * The callback function provides the {@link AVMetadata} parameter. + * It only contains the properties set in the filter. + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600103 - The session controller does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + on(type: 'metadataChange', filter: Array | 'all', callback: (data: AVMetadata) => void); + /** + * Unregister metadata changed callback + * @param { 'metadataChange' } type + * @param { function } callback - The callback used to handle metadata changed event. + * The callback function provides the {@link AVMetadata} parameter. + * It only contains the properties set in the filter. + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600103 - The session controller does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + off(type: 'metadataChange', callback?: (data: AVMetadata) => void); + /** + * Register playback state changed callback + * @param { 'playbackStateChange' } type + * @param { Array | 'all' } filter - The properties of {@link AVPlaybackState} that you cared about + * @param { function } callback - The callback used to handle playback state changed event. + * The callback function provides the {@link AVPlaybackState} parameter. + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600103 - The session controller does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + on(type: 'playbackStateChange', filter: Array | 'all', callback: (state: AVPlaybackState) => void); + /** + * Unregister playback state changed callback + * @param { 'playbackStateChange' } type + * @param { function } callback - The callback used to handle playback state changed event. + * The callback function provides the {@link AVPlaybackState} parameter. + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600103 - The session controller does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + off(type: 'playbackStateChange', callback?: (state: AVPlaybackState) => void); + /** + * Register call metadata changed callback + * @param { 'callMetadataChange' } type - 'callMetadataChange' + * @param { Array | 'all' } filter - The properties of {@link CallMetadata} that you cared about + * @param { Callback } callback - The callback used to handle call metadata changed event. + * The callback function provides the {@link CallMetadata} parameter. + * It only contains the properties set in the filter. + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600103 - The session controller does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 11 + */ + on(type: 'callMetadataChange', filter: Array | 'all', callback: Callback): void; + /** + * Unregister call metadata changed callback + * @param { 'callMetadataChange' } type - 'callMetadataChange' + * @param { Callback } callback - The callback used to handle call metadata changed event. + * The callback function provides the {@link CallMetadata} parameter. + * It only contains the properties set in the filter. + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600103 - The session controller does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 11 + */ + off(type: 'callMetadataChange', callback?: Callback): void; + /** + * Register call state changed callback + * @param { 'callStateChange' } type - 'callStateChange' + * @param { Array | 'all' } filter - The properties of {@link AVCallState} that you cared about + * @param { Callback } callback - The callback used to handle call state changed event. + * The callback function provides the {@link AVCallState} parameter. + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600103 - The session controller does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 11 + */ + on(type: 'callStateChange', filter: Array | 'all', callback: Callback): void; + /** + * Unregister playback state changed callback + * @param { 'callStateChange' } type - 'callStateChange' + * @param { Callback } callback - The callback used to handle call state changed event. + * The callback function provides the {@link AVCallState} parameter. + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600103 - The session controller does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 11 + */ + off(type: 'callStateChange', callback?: Callback): void; + /** + * Register current session destroyed callback + * @param { 'sessionDestroy' } type + * @param { function } callback - The callback used to handle current session destroyed event. + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600103 - The session controller does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + on(type: 'sessionDestroy', callback: () => void); + /** + * Unregister current session destroyed callback + * @param { 'sessionDestroy' } type - 'sessionDestroy' + * @param { function } callback - The callback used to handle current session destroyed event. + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600103 - The session controller does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + off(type: 'sessionDestroy', callback?: () => void); + /** + * Register the active state of this session changed callback + * @param { 'activeStateChange' } type - 'activeStateChange' + * @param { function } callback - The callback used to handle the active state of this session changed event. + * The callback function provides the changed session state. + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600103 - The session controller does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + on(type: 'activeStateChange', callback: (isActive: boolean) => void); + /** + * Unregister the active state of this session changed callback + * @param { 'activeStateChange' } type - 'activeStateChange' + * @param { function } callback - The callback used to handle the active state of this session changed event. + * The callback function provides the changed session state. + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600103 - The session controller does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + off(type: 'activeStateChange', callback?: (isActive: boolean) => void); + /** + * Register the valid commands of the session changed callback + * @param { 'validCommandChange' } type - 'validCommandChange' + * @param { function } callback - The callback used to handle the changes. + * The callback function provides an array of AVControlCommandType. + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600103 - The session controller does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + on(type: 'validCommandChange', callback: (commands: Array) => void); + /** + * Unregister the valid commands of the session changed callback + * @param { 'validCommandChange' } type - 'validCommandChange' + * @param { function } callback - The callback used to handle the changes. + * The callback function provides an array of AVControlCommandType. + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600103 - The session controller does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + off(type: 'validCommandChange', callback?: (commands: Array) => void); + /** + * Register session output device change callback + * @param { 'outputDeviceChange' } type - Registration Type 'outputDeviceChange' + * @param { function } callback - Used to handle output device changed. + * The callback provide the new device info {@link OutputDeviceInfo} and related connection state {@link ConnectionState}. + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. + * @throws { BusinessError } 6600101 - Session service exception + * @throws { BusinessError } 6600103 - The session controller does not exist + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + on(type: 'outputDeviceChange', callback: (state: ConnectionState, device: OutputDeviceInfo) => void): void; + /** + * Unregister session output device change callback + * @param { 'outputDeviceChange' } type - Registration Type 'outputDeviceChange' + * @param { function } callback - Used to handle output device changed. + * The callback provide the new device info {@link OutputDeviceInfo} and related connection state {@link ConnectionState}. + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. + * @throws { BusinessError } 6600101 - Session service exception + * @throws { BusinessError } 6600103 - The session controller does not exist + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + off(type: 'outputDeviceChange', callback?: (state: ConnectionState, device: OutputDeviceInfo) => void): void; + /** + * Register session event callback + * @param { 'sessionEvent' } type - 'sessionEvent' + * @param { function } callback - The callback used to handle session event changed event. + * The callback function provides the event string and key-value pair parameters. + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600103 - The session controller does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + on(type: 'sessionEvent', callback: (sessionEvent: string, args: { + [key: string]: Object; + }) => void): void; + /** + * Unregister session event callback + * @param { 'sessionEvent' } type - 'sessionEvent' + * @param { function } callback - Used to cancel a specific listener + * The callback function provides the event string and key-value pair parameters. + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600103 - The session controller does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + off(type: 'sessionEvent', callback?: (sessionEvent: string, args: { + [key: string]: Object; + }) => void): void; + /** + * Register session playlist change callback + * @param { 'queueItemsChange' } type - Registration Type 'queueItemsChange' + * @param { function } callback - Used to handle playlist changed. + * The callback provides the new array of AVQueueItem {@link AVQueueItem} + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600103 - The session controller does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + on(type: 'queueItemsChange', callback: (items: Array) => void): void; + /** + * Unregister session playlist change callback + * @param { 'queueItemsChange' } type - Registration Type 'queueItemsChange' + * @param { function } callback - Used to handle playlist changed. + * The callback provides the new array of AVQueueItem {@link AVQueueItem} + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600103 - The session controller does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + off(type: 'queueItemsChange', callback?: (items: Array) => void): void; + /** + * Register the name of session playlist change callback + * @param { 'queueTitleChange' } type - Registration Type 'queueTitleChange' + * @param { function } callback - Used to handle name of playlist changed. + * The callback provides the new name. + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600103 - The session controller does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + on(type: 'queueTitleChange', callback: (title: string) => void): void; + /** + * Unregister the name of session playlist change callback + * @param { 'queueTitleChange' } type - Registration Type 'queueTitleChange' + * @param { function } callback - Used to handle name of playlist changed. + * The callback provides the new name. + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600103 - The session controller does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + off(type: 'queueTitleChange', callback?: (title: string) => void): void; + /** + * Register the custom media packets change callback + * @param { 'extrasChange' } type - Registration Type 'extrasChange' + * @param { function } callback - Used to handle custom media packets changed. + * The callback provides the new media packets. + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600103 - The session controller does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + on(type: 'extrasChange', callback: (extras: { + [key: string]: Object; + }) => void): void; + /** + * Unregister the custom media packets change callback + * @param { 'extrasChange' } type - Registration Type 'extrasChange' + * @param { function } callback - Used to handle custom media packets changed. + * The callback provides the new media packets. + * @throws { BusinessError } 401 - parameter check failed. 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. + * @throws { BusinessError } 6600101 - Session service exception. + * @throws { BusinessError } 6600103 - The session controller does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + off(type: 'extrasChange', callback?: (extras: { + [key: string]: Object; + }) => void): void; + } + /** + * The type of control command + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * The type of control command, add new support 'playFromAssetId' | 'answer' | 'hangUp' | 'toggleCallMute' + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 11 + */ + type AVControlCommandType = 'play' | 'pause' | 'stop' | 'playNext' | 'playPrevious' | 'fastForward' | 'rewind' | 'seek' | 'setSpeed' | 'setLoopMode' | 'toggleFavorite' | 'playFromAssetId' | 'answer' | 'hangUp' | 'toggleCallMute'; + /** + * The definition of command to be sent to the session + * @interface AVControlCommand + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + interface AVControlCommand { + /** + * The command value {@link AVControlCommandType} + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + command: AVControlCommandType; + /** + * parameter of the command. Whether this command requires parameters, see {@link AVSessionCommand} + * seek command requires a number parameter + * setSpeed command requires a number parameter + * setLoopMode command requires a {@link LoopMode} parameter. + * toggleFavorite command requires assetId {@link AVMetadata.assetId} parameter + * other commands need no parameter + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + parameter?: LoopMode | string | number; + } + /** + * Enumerates ErrorCode types, returns in BusinessError.code. + * @enum { number } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * Enumerates ErrorCode types, returns in BusinessError.code. + * @enum { number } + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + enum AVSessionErrorCode { + /** + * Session service exception. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * Session service exception. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + ERR_CODE_SERVICE_EXCEPTION = 6600101, + /** + * The session does not exist + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * The session does not exist + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + ERR_CODE_SESSION_NOT_EXIST = 6600102, + /** + * The session controller does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * The session controller does not exist. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + ERR_CODE_CONTROLLER_NOT_EXIST = 6600103, + /** + * The remote session connection failed. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * The remote session connection failed. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + ERR_CODE_REMOTE_CONNECTION_ERR = 6600104, + /** + * Invalid session command. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * Invalid session command. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + ERR_CODE_COMMAND_INVALID = 6600105, + /** + * The session is not activated. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * The session is not activated. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + ERR_CODE_SESSION_INACTIVE = 6600106, + /** + * Too many commands or events. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * Too many commands or events. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + ERR_CODE_MESSAGE_OVERLOAD = 6600107, + /** + * Device connecting failed. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * Device connecting failed. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + ERR_CODE_DEVICE_CONNECTION_FAILED = 6600108, + /** + * The remote connection is not established. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 10 + */ + /** + * The remote connection is not established. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @atomicservice + * @since 12 + */ + ERR_CODE_REMOTE_CONNECTION_NOT_EXIST = 6600109 + } +} +export default avSession; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.multimedia.camera.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.multimedia.camera.d.ts new file mode 100755 index 00000000..87a04922 --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.multimedia.camera.d.ts @@ -0,0 +1,3649 @@ +/* + * Copyright (C) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit CameraKit + */ +import { ErrorCallback, AsyncCallback } from './@ohos.base'; +import type Context from './application/BaseContext'; +import image from './@ohos.multimedia.image'; +import type colorSpaceManager from './@ohos.graphics.colorSpaceManager'; +import photoAccessHelper from './@ohos.file.photoAccessHelper'; +/** + * @namespace camera + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ +/** + * @namespace camera + * @syscap SystemCapability.Multimedia.Camera.Core + * @atomicservice + * @since 12 + */ +declare namespace camera { + /** + * Creates a CameraManager instance. + * + * @param { Context } context - Current application context. + * @returns { CameraManager } CameraManager instance. + * @throws { BusinessError } 7400101 - Parameter missing or parameter type incorrect. + * @throws { BusinessError } 7400201 - Camera service fatal error. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + function getCameraManager(context: Context): CameraManager; + /** + * Enum for camera status. + * + * @enum { number } + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + enum CameraStatus { + /** + * Appear status. + * + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + CAMERA_STATUS_APPEAR = 0, + /** + * Disappear status. + * + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + CAMERA_STATUS_DISAPPEAR = 1, + /** + * Available status. + * + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + CAMERA_STATUS_AVAILABLE = 2, + /** + * Unavailable status. + * + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + CAMERA_STATUS_UNAVAILABLE = 3 + } + /** + * Profile for camera streams. + * + * @typedef Profile + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + interface Profile { + /** + * Camera format. + * + * @type { CameraFormat } + * @readonly + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + readonly format: CameraFormat; + /** + * Picture size. + * + * @type { Size } + * @readonly + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + readonly size: Size; + } + /** + * Frame rate range. + * + * @typedef FrameRateRange + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + interface FrameRateRange { + /** + * Min frame rate. + * + * @type { number } + * @readonly + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + readonly min: number; + /** + * Max frame rate. + * + * @type { number } + * @readonly + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + readonly max: number; + } + /** + * Video profile. + * + * @typedef VideoProfile + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + interface VideoProfile extends Profile { + /** + * Frame rate in unit fps (frames per second). + * + * @type { FrameRateRange } + * @readonly + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + readonly frameRateRange: FrameRateRange; + } + /** + * Camera output capability. + * + * @typedef CameraOutputCapability + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + interface CameraOutputCapability { + /** + * Preview profiles. + * + * @type { Array } + * @readonly + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + readonly previewProfiles: Array; + /** + * Photo profiles. + * + * @type { Array } + * @readonly + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + readonly photoProfiles: Array; + /** + * Video profiles. + * + * @type { Array } + * @readonly + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + readonly videoProfiles: Array; + /** + * All the supported metadata Object Types. + * + * @type { Array } + * @readonly + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + readonly supportedMetadataObjectTypes: Array; + } + /** + * Enum for camera error code. + * + * @enum { number } + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + enum CameraErrorCode { + /** + * Parameter missing or parameter type incorrect. + * + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + INVALID_ARGUMENT = 7400101, + /** + * Operation not allowed. + * + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + OPERATION_NOT_ALLOWED = 7400102, + /** + * Session not config. + * + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + SESSION_NOT_CONFIG = 7400103, + /** + * Session not running. + * + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + SESSION_NOT_RUNNING = 7400104, + /** + * Session config locked. + * + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + SESSION_CONFIG_LOCKED = 7400105, + /** + * Device setting locked. + * + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + DEVICE_SETTING_LOCKED = 7400106, + /** + * Can not use camera cause of conflict. + * + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + CONFLICT_CAMERA = 7400107, + /** + * Camera disabled cause of security reason. + * + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + DEVICE_DISABLED = 7400108, + /** + * Can not use camera cause of preempted. + * + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + DEVICE_PREEMPTED = 7400109, + /** + * Unresolved conflicts with current configurations. + * + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 12 + */ + UNRESOLVED_CONFLICTS_WITH_CURRENT_CONFIGURATIONS = 7400110, + /** + * Camera service fatal error. + * + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + SERVICE_FATAL_ERROR = 7400201 + } + /** + * Camera manager object. + * + * @interface CameraManager + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + interface CameraManager { + /** + * Gets supported camera descriptions. + * + * @returns { Array } An array of supported cameras. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + getSupportedCameras(): Array; + /** + * Gets supported output capability for specific camera. + * + * @param { CameraDevice } camera - Camera device. + * @returns { CameraOutputCapability } The camera output capability. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + * @deprecated since 11 + * @useinstead ohos.multimedia.camera.CameraManager#getSupportedOutputCapability + */ + getSupportedOutputCapability(camera: CameraDevice): CameraOutputCapability; + /** + * Gets supported scene mode for specific camera. + * + * @param { CameraDevice } camera - Camera device. + * @returns { Array } An array of supported scene mode of camera. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 11 + */ + getSupportedSceneModes(camera: CameraDevice): Array; + /** + * Gets supported output capability for specific camera. + * + * @param { CameraDevice } camera - Camera device. + * @param { SceneMode } mode - Scene mode. + * @returns { CameraOutputCapability } The camera output capability. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 11 + */ + getSupportedOutputCapability(camera: CameraDevice, mode: SceneMode): CameraOutputCapability; + /** + * Determine whether camera is muted. + * + * @returns { boolean } Is camera muted. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + isCameraMuted(): boolean; + /** + * Creates a CameraInput instance by camera. + * + * @permission ohos.permission.CAMERA + * @param { CameraDevice } camera - Camera device used to create the instance. + * @returns { CameraInput } The CameraInput instance. + * @throws { BusinessError } 7400101 - Parameter missing or parameter type incorrect. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + /** + * Creates a CameraInput instance by camera. + * + * @permission ohos.permission.CAMERA + * @param { CameraDevice } camera - Camera device used to create the instance. + * @returns { CameraInput } The CameraInput instance. + * @throws { BusinessError } 7400101 - Parameter missing or parameter type incorrect. + * @throws { BusinessError } 7400102 - Operation not allowed. + * @throws { BusinessError } 7400201 - Camera service fatal error. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 12 + */ + createCameraInput(camera: CameraDevice): CameraInput; + /** + * Creates a CameraInput instance by camera position and type. + * + * @permission ohos.permission.CAMERA + * @param { CameraPosition } position - Target camera position. + * @param { CameraType } type - Target camera type. + * @returns { CameraInput } The CameraInput instance. + * @throws { BusinessError } 7400101 - Parameter missing or parameter type incorrect. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + /** + * Creates a CameraInput instance by camera position and type. + * + * @permission ohos.permission.CAMERA + * @param { CameraPosition } position - Target camera position. + * @param { CameraType } type - Target camera type. + * @returns { CameraInput } The CameraInput instance. + * @throws { BusinessError } 7400101 - Parameter missing or parameter type incorrect. + * @throws { BusinessError } 7400102 - Operation not allowed. + * @throws { BusinessError } 7400201 - Camera service fatal error. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 12 + */ + createCameraInput(position: CameraPosition, type: CameraType): CameraInput; + /** + * Creates a PreviewOutput instance. + * + * @param { Profile } profile - Preview output profile. + * @param { string } surfaceId - Surface object id used in camera photo output. + * @returns { PreviewOutput } The PreviewOutput instance. + * @throws { BusinessError } 7400101 - Parameter missing or parameter type incorrect. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + /** + * Creates a PreviewOutput instance. + * + * @param { Profile } profile - Preview output profile. + * @param { string } surfaceId - Surface object id used in camera photo output. + * @returns { PreviewOutput } The PreviewOutput instance. + * @throws { BusinessError } 7400101 - Parameter missing or parameter type incorrect. + * @throws { BusinessError } 7400201 - Camera service fatal error. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 12 + */ + createPreviewOutput(profile: Profile, surfaceId: string): PreviewOutput; + /** + * Creates a PhotoOutput instance. + * + * @param { Profile } profile - Photo output profile. + * @param { string } surfaceId - Surface object id used in camera photo output. + * @returns { PhotoOutput } The PhotoOutput instance. + * @throws { BusinessError } 7400101 - Parameter missing or parameter type incorrect. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + * @deprecated since 11 + * @useinstead ohos.multimedia.camera.CameraManager#createPhotoOutput + */ + createPhotoOutput(profile: Profile, surfaceId: string): PhotoOutput; + /** + * Creates a PhotoOutput instance without surfaceId. + * Call PhotoOutput capture interface will give a callback, + * {@link on(type: 'photoAvailable', callback: AsyncCallback)} + * + * @param { Profile } profile - Photo output profile. + * @returns { PhotoOutput } The PhotoOutput instance. + * @throws { BusinessError } 7400101 - Parameter missing or parameter type incorrect. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 11 + */ + /** + * Creates a PhotoOutput instance without surfaceId. + * Call PhotoOutput capture interface will give a callback, + * {@link on(type: 'photoAvailable', callback: AsyncCallback)} + * + * @param { Profile } profile - Photo output profile. + * @returns { PhotoOutput } The PhotoOutput instance. + * @throws { BusinessError } 7400101 - Parameter missing or parameter type incorrect. + * @throws { BusinessError } 7400201 - Camera service fatal error. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 12 + */ + createPhotoOutput(profile: Profile): PhotoOutput; + /** + * Creates a VideoOutput instance. + * + * @param { VideoProfile } profile - Video profile. + * @param { string } surfaceId - Surface object id used in camera video output. + * @returns { VideoOutput } The VideoOutput instance. + * @throws { BusinessError } 7400101 - Parameter missing or parameter type incorrect. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + /** + * Creates a VideoOutput instance. + * + * @param { VideoProfile } profile - Video profile. + * @param { string } surfaceId - Surface object id used in camera video output. + * @returns { VideoOutput } The VideoOutput instance. + * @throws { BusinessError } 7400101 - Parameter missing or parameter type incorrect. + * @throws { BusinessError } 7400201 - Camera service fatal error. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 12 + */ + createVideoOutput(profile: VideoProfile, surfaceId: string): VideoOutput; + /** + * Creates a MetadataOutput instance. + * + * @param { Array } metadataObjectTypes - Array of MetadataObjectType. + * @returns { MetadataOutput } The MetadataOutput instance. + * @throws { BusinessError } 7400101 - Parameter missing or parameter type incorrect. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + /** + * Creates a MetadataOutput instance. + * + * @param { Array } metadataObjectTypes - Array of MetadataObjectType. + * @returns { MetadataOutput } The MetadataOutput instance. + * @throws { BusinessError } 7400101 - Parameter missing or parameter type incorrect. + * @throws { BusinessError } 7400201 - Camera service fatal error. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 12 + */ + createMetadataOutput(metadataObjectTypes: Array): MetadataOutput; + /** + * Gets a CaptureSession instance. + * + * @returns { CaptureSession } The CaptureSession instance. + * @throws { BusinessError } 7400201 - Camera service fatal error. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + * @deprecated since 11 + * @useinstead ohos.multimedia.camera.CameraManager#createSession + */ + createCaptureSession(): CaptureSession; + /** + * Gets a Session instance by specific scene mode. + * + * @param { SceneMode } mode - Scene mode. + * @returns { T } The specific Session instance by specific scene mode. + * @throws { BusinessError } 7400201 - Camera service fatal error. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 11 + */ + createSession(mode: SceneMode): T; + /** + * Subscribes camera status change event callback. + * + * @param { 'cameraStatus' } type - Event type. + * @param { AsyncCallback } callback - Callback used to get the camera status change. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + on(type: 'cameraStatus', callback: AsyncCallback): void; + /** + * Unsubscribes from camera status change event callback. + * + * @param { 'cameraStatus' } type - Event type. + * @param { AsyncCallback } callback - Callback used to get the camera status change. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + off(type: 'cameraStatus', callback?: AsyncCallback): void; + /** + * Check if the device has a torch. + * + * @returns { boolean } this value that specifies whether the device has a torch. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 11 + */ + isTorchSupported(): boolean; + /** + * Check if a specifies torch mode is supported. + * @param { TorchMode } mode - torch mode. + * @returns { boolean } is torch mode supported. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 11 + */ + isTorchModeSupported(mode: TorchMode): boolean; + /** + * Get current torch mode. + * + * @returns { TorchMode } torch mode. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 11 + */ + getTorchMode(): TorchMode; + /** + * Set torch mode to the device. + * + * @param { TorchMode } mode - torch mode. + * @throws { BusinessError } 7400101 - Parameter missing or parameter type incorrect. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 11 + */ + /** + * Set torch mode to the device. + * + * @param { TorchMode } mode - torch mode. + * @throws { BusinessError } 7400101 - Parameter missing or parameter type incorrect. + * @throws { BusinessError } 7400102 - Operation not allowed. + * @throws { BusinessError } 7400201 - Camera service fatal error. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 12 + */ + setTorchMode(mode: TorchMode): void; + /** + * Subscribes torch status change event callback. + * + * @param { 'torchStatusChange' } type - Event type + * @param { AsyncCallback } callback - Callback used to return the torch status change + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 11 + */ + on(type: 'torchStatusChange', callback: AsyncCallback): void; + /** + * Unsubscribes torch status change event callback. + * + * @param { 'torchStatusChange' } type - Event type + * @param { AsyncCallback } callback - Callback used to return the torch status change + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 11 + */ + off(type: 'torchStatusChange', callback?: AsyncCallback): void; + } + /** + * Torch status info. + * + * @typedef TorchStatusInfo + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 11 + */ + interface TorchStatusInfo { + /** + * is torch available + * + * @type { boolean } + * @readonly + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 11 + */ + readonly isTorchAvailable: boolean; + /** + * is torch active + * + * @type { boolean } + * @readonly + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 11 + */ + readonly isTorchActive: boolean; + /** + * the current torch brightness level. + * + * @type { number } + * @readonly + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 11 + */ + readonly torchLevel: number; + } + /** + * Enum for torch mode. + * + * @enum { number } + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 11 + */ + enum TorchMode { + /** + * The device torch is always off. + * + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 11 + */ + OFF = 0, + /** + * The device torch is always on. + * + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 11 + */ + ON = 1, + /** + * The device continuously monitors light levels and uses the torch when necessary. + * + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 11 + */ + AUTO = 2 + } + /** + * Camera status info. + * + * @typedef CameraStatusInfo + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + interface CameraStatusInfo { + /** + * Camera instance. + * + * @type { CameraDevice } + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + camera: CameraDevice; + /** + * Current camera status. + * + * @type { CameraStatus } + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + status: CameraStatus; + } + /** + * Enum for camera position. + * + * @enum { number } + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + /** + * Enum for camera position. + * + * @enum { number } + * @syscap SystemCapability.Multimedia.Camera.Core + * @atomicservice + * @since 12 + */ + enum CameraPosition { + /** + * Unspecified position. + * + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + /** + * Unspecified position. + * + * @syscap SystemCapability.Multimedia.Camera.Core + * @atomicservice + * @since 12 + */ + CAMERA_POSITION_UNSPECIFIED = 0, + /** + * Back position. + * + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + /** + * Back position. + * + * @syscap SystemCapability.Multimedia.Camera.Core + * @atomicservice + * @since 12 + */ + CAMERA_POSITION_BACK = 1, + /** + * Front position. + * + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + /** + * Front position. + * + * @syscap SystemCapability.Multimedia.Camera.Core + * @atomicservice + * @since 12 + */ + CAMERA_POSITION_FRONT = 2, + /** + * Camera that is inner position when the device is folded. + * + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 11 + */ + /** + * Camera that is inner position when the device is folded. + * + * @syscap SystemCapability.Multimedia.Camera.Core + * @atomicservice + * @since 12 + */ + CAMERA_POSITION_FOLD_INNER = 3 + } + /** + * Enum for camera type. + * + * @enum { number } + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + enum CameraType { + /** + * Default camera type + * + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + CAMERA_TYPE_DEFAULT = 0, + /** + * Wide camera + * + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + CAMERA_TYPE_WIDE_ANGLE = 1, + /** + * Ultra wide camera + * + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + CAMERA_TYPE_ULTRA_WIDE = 2, + /** + * Telephoto camera + * + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + CAMERA_TYPE_TELEPHOTO = 3, + /** + * True depth camera + * + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + CAMERA_TYPE_TRUE_DEPTH = 4 + } + /** + * Enum for camera connection type. + * + * @enum { number } + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + enum ConnectionType { + /** + * Built-in camera. + * + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + CAMERA_CONNECTION_BUILT_IN = 0, + /** + * Camera connected using USB + * + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + CAMERA_CONNECTION_USB_PLUGIN = 1, + /** + * Remote camera + * + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + CAMERA_CONNECTION_REMOTE = 2 + } + /** + * Camera device object. + * + * @typedef CameraDevice + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + interface CameraDevice { + /** + * Camera id attribute. + * + * @type { string } + * @readonly + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + readonly cameraId: string; + /** + * Camera position attribute. + * + * @type { CameraPosition } + * @readonly + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + readonly cameraPosition: CameraPosition; + /** + * Camera type attribute. + * + * @type { CameraType } + * @readonly + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + readonly cameraType: CameraType; + /** + * Camera connection type attribute. + * + * @type { ConnectionType } + * @readonly + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + readonly connectionType: ConnectionType; + /** + * Camera sensor orientation attribute. + * + * @type { number } + * @readonly + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 12 + */ + readonly cameraOrientation: number; + } + /** + * Size parameter. + * + * @typedef Size + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + interface Size { + /** + * Height. + * + * @type { number } + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + height: number; + /** + * Width. + * + * @type { number } + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + width: number; + } + /** + * Point parameter. + * + * @typedef Point + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + interface Point { + /** + * x co-ordinate + * + * @type { number } + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + x: number; + /** + * y co-ordinate + * + * @type { number } + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + y: number; + } + /** + * Camera input object. + * + * @interface CameraInput + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + interface CameraInput { + /** + * Open camera. + * + * @param { AsyncCallback } callback - Callback used to return the result. + * @throws { BusinessError } 7400107 - Can not use camera cause of conflict. + * @throws { BusinessError } 7400108 - Camera disabled cause of security reason. + * @throws { BusinessError } 7400201 - Camera service fatal error. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + open(callback: AsyncCallback): void; + /** + * Open camera. + * + * @returns { Promise } Promise used to return the result. + * @throws { BusinessError } 7400107 - Can not use camera cause of conflict. + * @throws { BusinessError } 7400108 - Camera disabled cause of security reason. + * @throws { BusinessError } 7400201 - Camera service fatal error. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + open(): Promise; + /** + * Open camera. + * + * @param { boolean } isSecureEnabled - Enable secure camera. + * @returns { Promise } Promise used to return the result. + * @throws { BusinessError } 7400107 - Can not use camera cause of conflict. + * @throws { BusinessError } 7400108 - Camera disabled cause of security reason. + * @throws { BusinessError } 7400201 - Camera service fatal error. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 12 + */ + open(isSecureEnabled: boolean): Promise; + /** + * Close camera. + * + * @param { AsyncCallback } callback - Callback used to return the result. + * @throws { BusinessError } 7400201 - Camera service fatal error. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + close(callback: AsyncCallback): void; + /** + * Close camera. + * + * @returns { Promise } Promise used to return the result. + * @throws { BusinessError } 7400201 - Camera service fatal error. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + close(): Promise; + /** + * Subscribes to error events. + * + * @param { 'error' } type - Event type. + * @param { CameraDevice } camera - Camera device. + * @param { ErrorCallback } callback - Callback used to get the camera input errors. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + on(type: 'error', camera: CameraDevice, callback: ErrorCallback): void; + /** + * Unsubscribes from error events. + * + * @param { 'error' } type - Event type. + * @param { CameraDevice } camera - Camera device. + * @param { ErrorCallback } callback - Callback used to get the camera input errors. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + off(type: 'error', camera: CameraDevice, callback?: ErrorCallback): void; + } + /** + * Enumerates the camera scene modes. + * + * @enum { number } + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 11 + */ + enum SceneMode { + /** + * Normal photo mode. + * + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 11 + */ + NORMAL_PHOTO = 1, + /** + * Normal video mode. + * + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 11 + */ + NORMAL_VIDEO = 2, + /** + * Secure camera mode. + * + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 12 + */ + SECURE_PHOTO = 12 + } + /** + * Enum for camera format type. + * + * @enum { number } + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + enum CameraFormat { + /** + * RGBA 8888 Format. + * + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + CAMERA_FORMAT_RGBA_8888 = 3, + /** + * YUV 420 Format. + * + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + CAMERA_FORMAT_YUV_420_SP = 1003, + /** + * JPEG Format. + * + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + CAMERA_FORMAT_JPEG = 2000, + /** + * YCBCR P010 Format. + * + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 11 + */ + CAMERA_FORMAT_YCBCR_P010, + /** + * YCRCB P010 Format. + * + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 11 + */ + CAMERA_FORMAT_YCRCB_P010 + } + /** + * Enum for flash mode. + * + * @enum { number } + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + enum FlashMode { + /** + * Close mode. + * + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + FLASH_MODE_CLOSE = 0, + /** + * Open mode. + * + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + FLASH_MODE_OPEN = 1, + /** + * Auto mode. + * + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + FLASH_MODE_AUTO = 2, + /** + * Always open mode. + * + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + FLASH_MODE_ALWAYS_OPEN = 3 + } + /** + * Flash Query object. + * + * @interface FlashQuery + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 12 + */ + interface FlashQuery { + /** + * Check if device has flash light. + * + * @returns { boolean } The flash light support status. + * @throws { BusinessError } 7400103 - Session not config. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 11 + */ + /** + * Check if device has flash light. + * Move to FlashQuery interface from Flash since 12. + * + * @returns { boolean } The flash light support status. + * @throws { BusinessError } 7400103 - Session not config, only throw in session usage. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 12 + */ + hasFlash(): boolean; + /** + * Checks whether a specified flash mode is supported. + * + * @param { FlashMode } flashMode - Flash mode + * @returns { boolean } Is the flash mode supported. + * @throws { BusinessError } 7400103 - Session not config. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 11 + */ + /** + * Checks whether a specified flash mode is supported. + * Move to FlashQuery interface from Flash since 12. + * + * @param { FlashMode } flashMode - Flash mode + * @returns { boolean } Is the flash mode supported. + * @throws { BusinessError } 7400103 - Session not config, only throw in session usage. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 12 + */ + isFlashModeSupported(flashMode: FlashMode): boolean; + } + /** + * Flash object. + * + * @interface Flash + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 11 + */ + interface Flash extends FlashQuery { + /** + * Gets current flash mode. + * + * @returns { FlashMode } The current flash mode. + * @throws { BusinessError } 7400103 - Session not config. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 11 + */ + getFlashMode(): FlashMode; + /** + * Sets flash mode. + * + * @param { FlashMode } flashMode - Target flash mode. + * @throws { BusinessError } 7400103 - Session not config. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 11 + */ + setFlashMode(flashMode: FlashMode): void; + } + /** + * Enum for exposure mode. + * + * @enum { number } + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + enum ExposureMode { + /** + * Lock exposure mode. + * + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + EXPOSURE_MODE_LOCKED = 0, + /** + * Auto exposure mode. + * + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + EXPOSURE_MODE_AUTO = 1, + /** + * Continuous automatic exposure. + * + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + EXPOSURE_MODE_CONTINUOUS_AUTO = 2 + } + /** + * AutoExposureQuery object. + * + * @interface AutoExposureQuery + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 12 + */ + interface AutoExposureQuery { + /** + * Checks whether a specified exposure mode is supported. + * + * @param { ExposureMode } aeMode - Exposure mode + * @returns { boolean } Is the exposure mode supported. + * @throws { BusinessError } 7400103 - Session not config. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 11 + */ + /** + * Checks whether a specified exposure mode is supported. + * Move to AutoExposureQuery interface from AutoExposure interface since 12. + * + * @param { ExposureMode } aeMode - Exposure mode + * @returns { boolean } Is the exposure mode supported. + * @throws { BusinessError } 7400103 - Session not config, only throw in session usage. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 12 + */ + isExposureModeSupported(aeMode: ExposureMode): boolean; + /** + * Query the exposure compensation range. + * + * @returns { Array } The array of compensation range. + * @throws { BusinessError } 7400103 - Session not config. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 11 + */ + /** + * Query the exposure compensation range. + * Move to AutoExposureQuery interface from AutoExposure interface since 12. + * + * @returns { Array } The array of compensation range. + * @throws { BusinessError } 7400103 - Session not config, only throw in session usage. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 12 + */ + getExposureBiasRange(): Array; + } + /** + * AutoExposure object. + * + * @interface AutoExposure + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 11 + */ + interface AutoExposure extends AutoExposureQuery { + /** + * Gets current exposure mode. + * + * @returns { ExposureMode } The current exposure mode. + * @throws { BusinessError } 7400103 - Session not config. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 11 + */ + getExposureMode(): ExposureMode; + /** + * Sets Exposure mode. + * + * @param { ExposureMode } aeMode - Exposure mode + * @throws { BusinessError } 7400103 - Session not config. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 11 + */ + setExposureMode(aeMode: ExposureMode): void; + /** + * Gets current metering point. + * + * @returns { Point } The current metering point. + * @throws { BusinessError } 7400103 - Session not config. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 11 + */ + getMeteringPoint(): Point; + /** + * Set the center point of the metering area. + * + * @param { Point } point - metering point + * @throws { BusinessError } 7400103 - Session not config. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 11 + */ + setMeteringPoint(point: Point): void; + /** + * Query the exposure compensation range. + * + * @returns { Array } The array of compensation range. + * @throws { BusinessError } 7400103 - Session not config. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 11 + */ + getExposureBiasRange(): Array; + /** + * Set exposure compensation. + * + * @param { number } exposureBias - Exposure compensation + * @throws { BusinessError } 7400103 - Session not config. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 11 + */ + /** + * Set exposure compensation. + * + * @param { number } exposureBias - Exposure compensation + * @throws { BusinessError } 7400102 - Operation not allowed. + * @throws { BusinessError } 7400103 - Session not config. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 12 + */ + setExposureBias(exposureBias: number): void; + /** + * Query the exposure value. + * + * @returns { number } The exposure value. + * @throws { BusinessError } 7400103 - Session not config. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 11 + */ + getExposureValue(): number; + } + /** + * Enum for focus mode. + * + * @enum { number } + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + enum FocusMode { + /** + * Manual mode. + * + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + FOCUS_MODE_MANUAL = 0, + /** + * Continuous auto mode. + * + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + FOCUS_MODE_CONTINUOUS_AUTO = 1, + /** + * Auto mode. + * + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + FOCUS_MODE_AUTO = 2, + /** + * Locked mode. + * + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + FOCUS_MODE_LOCKED = 3 + } + /** + * Enum for focus state. + * + * @enum { number } + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + enum FocusState { + /** + * Scan state. + * + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + FOCUS_STATE_SCAN = 0, + /** + * Focused state. + * + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + FOCUS_STATE_FOCUSED = 1, + /** + * Unfocused state. + * + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + FOCUS_STATE_UNFOCUSED = 2 + } + /** + * Focus Query object. + * + * @interface FocusQuery + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 12 + */ + interface FocusQuery { + /** + * Checks whether a specified focus mode is supported. + * + * @param { FocusMode } afMode - Focus mode. + * @returns { boolean } Is the focus mode supported. + * @throws { BusinessError } 7400103 - Session not config. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 11 + */ + /** + * Checks whether a specified focus mode is supported. + * Move to FocusQuery interface from Focus interface since 12. + * + * @param { FocusMode } afMode - Focus mode. + * @returns { boolean } Is the focus mode supported. + * @throws { BusinessError } 7400103 - Session not config, only throw in session usage. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 12 + */ + isFocusModeSupported(afMode: FocusMode): boolean; + } + /** + * Focus object. + * + * @interface Focus + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 11 + */ + interface Focus extends FocusQuery { + /** + * Gets current focus mode. + * + * @returns { FocusMode } The current focus mode. + * @throws { BusinessError } 7400103 - Session not config. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 11 + */ + getFocusMode(): FocusMode; + /** + * Sets focus mode. + * + * @param { FocusMode } afMode - Target focus mode. + * @throws { BusinessError } 7400103 - Session not config. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 11 + */ + setFocusMode(afMode: FocusMode): void; + /** + * Sets focus point. + * + * @param { Point } point - Target focus point. + * @throws { BusinessError } 7400103 - Session not config. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 11 + */ + setFocusPoint(point: Point): void; + /** + * Gets current focus point. + * + * @returns { Point } The current focus point. + * @throws { BusinessError } 7400103 - Session not config. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 11 + */ + getFocusPoint(): Point; + /** + * Gets current focal length. + * + * @returns { number } The current focal point. + * @throws { BusinessError } 7400103 - Session not config. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 11 + */ + getFocalLength(): number; + } + /** + * Enum for smooth zoom mode. + * + * @enum { number } + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 11 + */ + enum SmoothZoomMode { + /** + * Normal zoom mode. + * + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 11 + */ + NORMAL = 0 + } + /** + * SmoothZoomInfo object + * + * @typedef SmoothZoomInfo + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 11 + */ + interface SmoothZoomInfo { + /** + * The duration of smooth zoom. + * + * @type { number } + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 11 + */ + duration: number; + } + /** + * Zoom query object. + * + * @interface ZoomQuery + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 12 + */ + interface ZoomQuery { + /** + * Gets all supported zoom ratio range. + * + * @returns { Array } The zoom ratio range. + * @throws { BusinessError } 7400103 - Session not config. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 11 + */ + /** + * Gets all supported zoom ratio range. + * Move to ZoomQuery interface from Zoom since 12. + * + * @returns { Array } The zoom ratio range. + * @throws { BusinessError } 7400103 - Session not config, only throw in session usage. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 12 + */ + getZoomRatioRange(): Array; + } + /** + * Zoom object. + * + * @interface Zoom + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 11 + */ + interface Zoom extends ZoomQuery { + /** + * Gets zoom ratio. + * + * @returns { number } The zoom ratio value. + * @throws { BusinessError } 7400103 - Session not config. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 11 + */ + /** + * Gets zoom ratio. + * + * @returns { number } The zoom ratio value. + * @throws { BusinessError } 7400103 - Session not config. + * @throws { BusinessError } 7400201 - Camera service fatal error. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 12 + */ + getZoomRatio(): number; + /** + * Sets zoom ratio. + * + * @param { number } zoomRatio - Target zoom ratio. + * @throws { BusinessError } 7400103 - Session not config. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 11 + */ + setZoomRatio(zoomRatio: number): void; + /** + * Sets target zoom ratio by smooth method. + * + * @param { number } targetRatio - Target zoom ratio. + * @param { SmoothZoomMode } mode - Smooth zoom mode. + * @throws { BusinessError } 7400103 - Session not config. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 11 + */ + setSmoothZoom(targetRatio: number, mode?: SmoothZoomMode): void; + } + /** + * Enum for video stabilization mode. + * + * @enum { number } + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + enum VideoStabilizationMode { + /** + * Turn off video stablization. + * + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + OFF = 0, + /** + * LOW mode provides basic stabilization effect. + * + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + LOW = 1, + /** + * MIDDLE mode means algorithms can achieve better effects than LOW mode. + * + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + MIDDLE = 2, + /** + * HIGH mode means algorithms can achieve better effects than MIDDLE mode. + * + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + HIGH = 3, + /** + * Camera HDF can select mode automatically. + * + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + AUTO = 4 + } + /** + * Stabilization Query object. + * + * @interface StabilizationQuery + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 12 + */ + interface StabilizationQuery { + /** + * Check whether the specified video stabilization mode is supported. + * + * @param { VideoStabilizationMode } vsMode - Video Stabilization mode. + * @returns { boolean } Is flash mode supported. + * @throws { BusinessError } 7400103 - Session not config. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 11 + */ + /** + * Check whether the specified video stabilization mode is supported. + * Move to StabilizationQuery interface from Stabilization since 12. + * + * @param { VideoStabilizationMode } vsMode - Video Stabilization mode. + * @returns { boolean } Is flash mode supported. + * @throws { BusinessError } 7400103 - Session not config, only throw in session usage. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 12 + */ + isVideoStabilizationModeSupported(vsMode: VideoStabilizationMode): boolean; + } + /** + * Stabilization object. + * + * @interface Stabilization + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 11 + */ + interface Stabilization extends StabilizationQuery { + /** + * Query the video stabilization mode currently in use. + * + * @returns { VideoStabilizationMode } The current video stabilization mode. + * @throws { BusinessError } 7400103 - Session not config. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 11 + */ + getActiveVideoStabilizationMode(): VideoStabilizationMode; + /** + * Set video stabilization mode. + * + * @param { VideoStabilizationMode } mode - video stabilization mode to set. + * @throws { BusinessError } 7400103 - Session not config. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 11 + */ + setVideoStabilizationMode(mode: VideoStabilizationMode): void; + } + /** + * Color Management Query object. + * + * @interface ColorManagementQuery + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 12 + */ + interface ColorManagementQuery { + /** + * Gets the supported color space types. + * + * @returns { Array } The array of the supported color space for the session. + * @throws { BusinessError } 7400103 - Session not config, only throw in session usage. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 12 + */ + getSupportedColorSpaces(): Array; + } + /** + * Color Management object. + * + * @interface ColorManagement + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 12 + */ + interface ColorManagement extends ColorManagementQuery { + /** + * Gets the specific color space type. + * + * @returns { colorSpaceManager.ColorSpace } Current color space. + * @throws { BusinessError } 7400103 - Session not config. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 12 + */ + getActiveColorSpace(): colorSpaceManager.ColorSpace; + /** + * Sets a color space for the session. + * + * @param { colorSpaceManager.ColorSpace } colorSpace - The type of color space. + * @throws { BusinessError } 7400101 - Parameter missing or parameter type incorrect. + * @throws { BusinessError } 7400102 - The colorSpace does not match the format. + * @throws { BusinessError } 7400103 - Session not config. + * @throws { BusinessError } 7400201 - Camera service fatal error. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 12 + */ + setColorSpace(colorSpace: colorSpaceManager.ColorSpace): void; + } + /** + * Session object. + * + * @interface Session + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 11 + */ + interface Session { + /** + * Begin capture session config. + * + * @throws { BusinessError } 7400105 - Session config locked. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 11 + */ + /** + * Begin capture session config. + * + * @throws { BusinessError } 7400105 - Session config locked. + * @throws { BusinessError } 7400201 - Camera service fatal error. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 12 + */ + beginConfig(): void; + /** + * Commit capture session config. + * + * @param { AsyncCallback } callback - Callback used to return the result. + * @throws { BusinessError } 7400102 - Operation not allowed. + * @throws { BusinessError } 7400201 - Camera service fatal error. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 11 + */ + commitConfig(callback: AsyncCallback): void; + /** + * Commit capture session config. + * + * @returns { Promise } Promise used to return the result. + * @throws { BusinessError } 7400102 - Operation not allowed. + * @throws { BusinessError } 7400201 - Camera service fatal error. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 11 + */ + commitConfig(): Promise; + /** + * Determines whether the camera input can be added into the session. + * This method is valid between Session.beginConfig() and Session.commitConfig(). + * + * @param { CameraInput } cameraInput - Target camera input to add. + * @returns { boolean } You can add the input into the session. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 11 + */ + canAddInput(cameraInput: CameraInput): boolean; + /** + * Adds a camera input. + * This method is valid between Session.beginConfig() and Session.commitConfig(). + * + * @param { CameraInput } cameraInput - Target camera input to add. + * @throws { BusinessError } 7400101 - Parameter missing or parameter type incorrect. + * @throws { BusinessError } 7400102 - Operation not allowed. + * @throws { BusinessError } 7400103 - Session not config. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 11 + */ + /** + * Adds a camera input. + * This method is valid between Session.beginConfig() and Session.commitConfig(). + * + * @param { CameraInput } cameraInput - Target camera input to add. + * @throws { BusinessError } 7400101 - Parameter missing or parameter type incorrect. + * @throws { BusinessError } 7400102 - Operation not allowed. + * @throws { BusinessError } 7400103 - Session not config. + * @throws { BusinessError } 7400201 - Camera service fatal error. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 12 + */ + addInput(cameraInput: CameraInput): void; + /** + * Removes a camera input. + * This method is valid between Session.beginConfig() and Session.commitConfig(). + * + * @param { CameraInput } cameraInput - Target camera input to remove. + * @throws { BusinessError } 7400101 - Parameter missing or parameter type incorrect. + * @throws { BusinessError } 7400102 - Operation not allowed. + * @throws { BusinessError } 7400103 - Session not config. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 11 + */ + /** + * Removes a camera input. + * This method is valid between Session.beginConfig() and Session.commitConfig(). + * + * @param { CameraInput } cameraInput - Target camera input to remove. + * @throws { BusinessError } 7400101 - Parameter missing or parameter type incorrect. + * @throws { BusinessError } 7400102 - Operation not allowed. + * @throws { BusinessError } 7400103 - Session not config. + * @throws { BusinessError } 7400201 - Camera service fatal error. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 12 + */ + removeInput(cameraInput: CameraInput): void; + /** + * Determines whether the camera output can be added into the session. + * This method is valid after Session.addInput(cameraInput) and before Session.commitConfig(). + * + * @param { CameraOutput } cameraOutput - Target camera output to add. + * @returns { boolean } You can add the output into the session. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 11 + */ + canAddOutput(cameraOutput: CameraOutput): boolean; + /** + * Adds a camera output. + * This method is valid after Session.addInput(cameraInput) and before Session.commitConfig(). + * + * @param { CameraOutput } cameraOutput - Target camera output to add. + * @throws { BusinessError } 7400101 - Parameter missing or parameter type incorrect. + * @throws { BusinessError } 7400102 - Operation not allowed. + * @throws { BusinessError } 7400103 - Session not config. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 11 + */ + /** + * Adds a camera output. + * This method is valid after Session.addInput(cameraInput) and before Session.commitConfig(). + * + * @param { CameraOutput } cameraOutput - Target camera output to add. + * @throws { BusinessError } 7400101 - Parameter missing or parameter type incorrect. + * @throws { BusinessError } 7400102 - Operation not allowed. + * @throws { BusinessError } 7400103 - Session not config. + * @throws { BusinessError } 7400201 - Camera service fatal error. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 12 + */ + addOutput(cameraOutput: CameraOutput): void; + /** + * Removes a camera output. + * This method is valid between Session.beginConfig() and Session.commitConfig(). + * + * @param { CameraOutput } cameraOutput - Target camera output to remove. + * @throws { BusinessError } 7400101 - Parameter missing or parameter type incorrect. + * @throws { BusinessError } 7400102 - Operation not allowed. + * @throws { BusinessError } 7400103 - Session not config. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 11 + */ + /** + * Removes a camera output. + * This method is valid between Session.beginConfig() and Session.commitConfig(). + * + * @param { CameraOutput } cameraOutput - Target camera output to remove. + * @throws { BusinessError } 7400101 - Parameter missing or parameter type incorrect. + * @throws { BusinessError } 7400102 - Operation not allowed. + * @throws { BusinessError } 7400103 - Session not config. + * @throws { BusinessError } 7400201 - Camera service fatal error. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 12 + */ + removeOutput(cameraOutput: CameraOutput): void; + /** + * Starts capture session. + * + * @param { AsyncCallback } callback - Callback used to return the result. + * @throws { BusinessError } 7400103 - Session not config. + * @throws { BusinessError } 7400201 - Camera service fatal error. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 11 + */ + /** + * Starts capture session. + * + * @param { AsyncCallback } callback - Callback used to return the result. + * @throws { BusinessError } 7400102 - Operation not allowed. + * @throws { BusinessError } 7400103 - Session not config. + * @throws { BusinessError } 7400201 - Camera service fatal error. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 12 + */ + start(callback: AsyncCallback): void; + /** + * Starts capture session. + * + * @returns { Promise } Promise used to return the result. + * @throws { BusinessError } 7400103 - Session not config. + * @throws { BusinessError } 7400201 - Camera service fatal error. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 11 + */ + /** + * Starts capture session. + * + * @returns { Promise } Promise used to return the result. + * @throws { BusinessError } 7400102 - Operation not allowed. + * @throws { BusinessError } 7400103 - Session not config. + * @throws { BusinessError } 7400201 - Camera service fatal error. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 12 + */ + start(): Promise; + /** + * Stops capture session. + * + * @param { AsyncCallback } callback - Callback used to return the result. + * @throws { BusinessError } 7400201 - Camera service fatal error. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 11 + */ + stop(callback: AsyncCallback): void; + /** + * Stops capture session. + * + * @returns { Promise } Promise used to return the result. + * @throws { BusinessError } 7400201 - Camera service fatal error. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 11 + */ + stop(): Promise; + /** + * Release capture session instance. + * + * @param { AsyncCallback } callback - Callback used to return the result. + * @throws { BusinessError } 7400201 - Camera service fatal error. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 11 + */ + release(callback: AsyncCallback): void; + /** + * Release capture session instance. + * + * @returns { Promise } Promise used to return the result. + * @throws { BusinessError } 7400201 - Camera service fatal error. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 11 + */ + release(): Promise; + } + /** + * Capture session object. + * + * @interface CaptureSession + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + * @deprecated since 11 + * @useinstead ohos.multimedia.camera.VideoSession + */ + interface CaptureSession { + /** + * Begin capture session config. + * + * @throws { BusinessError } 7400105 - Session config locked. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + * @deprecated since 11 + * @useinstead ohos.multimedia.camera.Session#beginConfig + */ + beginConfig(): void; + /** + * Commit capture session config. + * + * @param { AsyncCallback } callback - Callback used to return the result. + * @throws { BusinessError } 7400102 - Operation not allowed. + * @throws { BusinessError } 7400201 - Camera service fatal error. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + * @deprecated since 11 + * @useinstead ohos.multimedia.camera.Session#commitConfig + */ + commitConfig(callback: AsyncCallback): void; + /** + * Commit capture session config. + * + * @returns { Promise } Promise used to return the result. + * @throws { BusinessError } 7400102 - Operation not allowed. + * @throws { BusinessError } 7400201 - Camera service fatal error. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + * @deprecated since 11 + * @useinstead ohos.multimedia.camera.Session#commitConfig + */ + commitConfig(): Promise; + /** + * Adds a camera input. + * + * @param { CameraInput } cameraInput - Target camera input to add. + * @throws { BusinessError } 7400101 - Parameter missing or parameter type incorrect. + * @throws { BusinessError } 7400102 - Operation not allowed. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + * @deprecated since 11 + * @useinstead ohos.multimedia.camera.Session#addInput + */ + addInput(cameraInput: CameraInput): void; + /** + * Removes a camera input. + * + * @param { CameraInput } cameraInput - Target camera input to remove. + * @throws { BusinessError } 7400101 - Parameter missing or parameter type incorrect. + * @throws { BusinessError } 7400102 - Operation not allowed. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + * @deprecated since 11 + * @useinstead ohos.multimedia.camera.Session#removeInput + */ + removeInput(cameraInput: CameraInput): void; + /** + * Adds a camera output. + * + * @param { CameraOutput } cameraOutput - Target camera output to add. + * @throws { BusinessError } 7400101 - Parameter missing or parameter type incorrect. + * @throws { BusinessError } 7400102 - Operation not allowed. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + * @deprecated since 11 + * @useinstead ohos.multimedia.camera.Session#addOutput + */ + addOutput(cameraOutput: CameraOutput): void; + /** + * Removes a camera output. + * + * @param { CameraOutput } cameraOutput - Target camera output to remove. + * @throws { BusinessError } 7400101 - Parameter missing or parameter type incorrect. + * @throws { BusinessError } 7400102 - Operation not allowed. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + * @deprecated since 11 + * @useinstead ohos.multimedia.camera.Session#removeOutput + */ + removeOutput(cameraOutput: CameraOutput): void; + /** + * Starts capture session. + * + * @param { AsyncCallback } callback - Callback used to return the result. + * @throws { BusinessError } 7400103 - Session not config. + * @throws { BusinessError } 7400201 - Camera service fatal error. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + * @deprecated since 11 + * @useinstead ohos.multimedia.camera.Session#start + */ + start(callback: AsyncCallback): void; + /** + * Starts capture session. + * + * @returns { Promise } Promise used to return the result. + * @throws { BusinessError } 7400103 - Session not config. + * @throws { BusinessError } 7400201 - Camera service fatal error. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + * @deprecated since 11 + * @useinstead ohos.multimedia.camera.Session#start + */ + start(): Promise; + /** + * Stops capture session. + * + * @param { AsyncCallback } callback - Callback used to return the result. + * @throws { BusinessError } 7400201 - Camera service fatal error. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + * @deprecated since 11 + * @useinstead ohos.multimedia.camera.Session#stop + */ + stop(callback: AsyncCallback): void; + /** + * Stops capture session. + * + * @returns { Promise } Promise used to return the result. + * @throws { BusinessError } 7400201 - Camera service fatal error. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + * @deprecated since 11 + * @useinstead ohos.multimedia.camera.Session#stop + */ + stop(): Promise; + /** + * Release capture session instance. + * + * @param { AsyncCallback } callback - Callback used to return the result. + * @throws { BusinessError } 7400201 - Camera service fatal error. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + * @deprecated since 11 + * @useinstead ohos.multimedia.camera.Session#release + */ + release(callback: AsyncCallback): void; + /** + * Release capture session instance. + * + * @returns { Promise } Promise used to return the result. + * @throws { BusinessError } 7400201 - Camera service fatal error. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + * @deprecated since 11 + * @useinstead ohos.multimedia.camera.Session#release + */ + release(): Promise; + /** + * Check if device has flash light. + * + * @returns { boolean } The flash light support status. + * @throws { BusinessError } 7400103 - Session not config. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + * @deprecated since 11 + * @useinstead ohos.multimedia.camera.Flash#hasFlash + */ + hasFlash(): boolean; + /** + * Checks whether a specified flash mode is supported. + * + * @param { FlashMode } flashMode - Flash mode + * @returns { boolean } Is the flash mode supported. + * @throws { BusinessError } 7400103 - Session not config. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + * @deprecated since 11 + * @useinstead ohos.multimedia.camera.Flash#isFlashModeSupported + */ + isFlashModeSupported(flashMode: FlashMode): boolean; + /** + * Gets current flash mode. + * + * @returns { FlashMode } The current flash mode. + * @throws { BusinessError } 7400103 - Session not config. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + * @deprecated since 11 + * @useinstead ohos.multimedia.camera.Flash#getFlashMode + */ + getFlashMode(): FlashMode; + /** + * Sets flash mode. + * + * @param { FlashMode } flashMode - Target flash mode. + * @throws { BusinessError } 7400103 - Session not config. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + * @deprecated since 11 + * @useinstead ohos.multimedia.camera.Flash#setFlashMode + */ + setFlashMode(flashMode: FlashMode): void; + /** + * Checks whether a specified exposure mode is supported. + * + * @param { ExposureMode } aeMode - Exposure mode + * @returns { boolean } Is the exposure mode supported. + * @throws { BusinessError } 7400103 - Session not config. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + * @deprecated since 11 + * @useinstead ohos.multimedia.camera.AutoExposure#isExposureModeSupported + */ + isExposureModeSupported(aeMode: ExposureMode): boolean; + /** + * Gets current exposure mode. + * + * @returns { ExposureMode } The current exposure mode. + * @throws { BusinessError } 7400103 - Session not config. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + * @deprecated since 11 + * @useinstead ohos.multimedia.camera.AutoExposure#getExposureMode + */ + getExposureMode(): ExposureMode; + /** + * Sets Exposure mode. + * + * @param { ExposureMode } aeMode - Exposure mode + * @throws { BusinessError } 7400103 - Session not config. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + * @deprecated since 11 + * @useinstead ohos.multimedia.camera.AutoExposure#setExposureMode + */ + setExposureMode(aeMode: ExposureMode): void; + /** + * Gets current metering point. + * + * @returns { Point } The current metering point. + * @throws { BusinessError } 7400103 - Session not config. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + * @deprecated since 11 + * @useinstead ohos.multimedia.camera.AutoExposure#getMeteringPoint + */ + getMeteringPoint(): Point; + /** + * Set the center point of the metering area. + * + * @param { Point } point - metering point + * @throws { BusinessError } 7400103 - Session not config. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + * @deprecated since 11 + * @useinstead ohos.multimedia.camera.AutoExposure#setMeteringPoint + */ + setMeteringPoint(point: Point): void; + /** + * Query the exposure compensation range. + * + * @returns { Array } The array of compensation range. + * @throws { BusinessError } 7400103 - Session not config. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + * @deprecated since 11 + * @useinstead ohos.multimedia.camera.AutoExposure#getExposureBiasRange + */ + getExposureBiasRange(): Array; + /** + * Set exposure compensation. + * + * @param { number } exposureBias - Exposure compensation + * @throws { BusinessError } 7400103 - Session not config. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + * @deprecated since 11 + * @useinstead ohos.multimedia.camera.AutoExposure#setExposureBias + */ + setExposureBias(exposureBias: number): void; + /** + * Query the exposure value. + * + * @returns { number } The exposure value. + * @throws { BusinessError } 7400103 - Session not config. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + * @deprecated since 11 + * @useinstead ohos.multimedia.camera.AutoExposure#getExposureValue + */ + getExposureValue(): number; + /** + * Checks whether a specified focus mode is supported. + * + * @param { FocusMode } afMode - Focus mode. + * @returns { boolean } Is the focus mode supported. + * @throws { BusinessError } 7400103 - Session not config. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + * @deprecated since 11 + * @useinstead ohos.multimedia.camera.Focus#isFocusModeSupported + */ + isFocusModeSupported(afMode: FocusMode): boolean; + /** + * Gets current focus mode. + * + * @returns { FocusMode } The current focus mode. + * @throws { BusinessError } 7400103 - Session not config. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + * @deprecated since 11 + * @useinstead ohos.multimedia.camera.Focus#getFocusMode + */ + getFocusMode(): FocusMode; + /** + * Sets focus mode. + * + * @param { FocusMode } afMode - Target focus mode. + * @throws { BusinessError } 7400103 - Session not config. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + * @deprecated since 11 + * @useinstead ohos.multimedia.camera.Focus#setFocusMode + */ + setFocusMode(afMode: FocusMode): void; + /** + * Sets focus point. + * + * @param { Point } point - Target focus point. + * @throws { BusinessError } 7400103 - Session not config. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + * @deprecated since 11 + * @useinstead ohos.multimedia.camera.Focus#setFocusPoint + */ + setFocusPoint(point: Point): void; + /** + * Gets current focus point. + * + * @returns { Point } The current focus point. + * @throws { BusinessError } 7400103 - Session not config. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + * @deprecated since 11 + * @useinstead ohos.multimedia.camera.Focus#getFocusPoint + */ + getFocusPoint(): Point; + /** + * Gets current focal length. + * + * @returns { number } The current focal point. + * @throws { BusinessError } 7400103 - Session not config. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + * @deprecated since 11 + * @useinstead ohos.multimedia.camera.Focus#getFocalLength + */ + getFocalLength(): number; + /** + * Gets all supported zoom ratio range. + * + * @returns { Array } The zoom ratio range. + * @throws { BusinessError } 7400103 - Session not config. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + * @deprecated since 11 + * @useinstead ohos.multimedia.camera.Zoom#getZoomRatioRange + */ + getZoomRatioRange(): Array; + /** + * Gets zoom ratio. + * + * @returns { number } The zoom ratio value. + * @throws { BusinessError } 7400103 - Session not config. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + * @deprecated since 11 + * @useinstead ohos.multimedia.camera.Zoom#getZoomRatio + */ + getZoomRatio(): number; + /** + * Sets zoom ratio. + * + * @param { number } zoomRatio - Target zoom ratio. + * @throws { BusinessError } 7400103 - Session not config. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + * @deprecated since 11 + * @useinstead ohos.multimedia.camera.Zoom#setZoomRatio + */ + setZoomRatio(zoomRatio: number): void; + /** + * Check whether the specified video stabilization mode is supported. + * + * @param { VideoStabilizationMode } vsMode - Video Stabilization mode. + * @returns { boolean } Is flash mode supported. + * @throws { BusinessError } 7400103 - Session not config. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + * @deprecated since 11 + * @useinstead ohos.multimedia.camera.Stabilization#isVideoStabilizationModeSupported + */ + isVideoStabilizationModeSupported(vsMode: VideoStabilizationMode): boolean; + /** + * Query the video stabilization mode currently in use. + * + * @returns { VideoStabilizationMode } The current video stabilization mode. + * @throws { BusinessError } 7400103 - Session not config. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + * @deprecated since 11 + * @useinstead ohos.multimedia.camera.Stabilization#getActiveVideoStabilizationMode + */ + getActiveVideoStabilizationMode(): VideoStabilizationMode; + /** + * Set video stabilization mode. + * + * @param { VideoStabilizationMode } mode - video stabilization mode to set. + * @throws { BusinessError } 7400103 - Session not config. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + * @deprecated since 11 + * @useinstead ohos.multimedia.camera.Stabilization#setVideoStabilizationMode + */ + setVideoStabilizationMode(mode: VideoStabilizationMode): void; + /** + * Subscribes focus status change event callback. + * + * @param { 'focusStateChange' } type - Event type. + * @param { AsyncCallback } callback - Callback used to get the focus state change. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + * @deprecated since 11 + * @useinstead ohos.multimedia.camera.VideoSession#on + */ + on(type: 'focusStateChange', callback: AsyncCallback): void; + /** + * Unsubscribes from focus status change event callback. + * + * @param { 'focusStateChange' } type - Event type. + * @param { AsyncCallback } callback - Callback used to get the focus state change. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + * @deprecated since 11 + * @useinstead ohos.multimedia.camera.VideoSession#off + */ + off(type: 'focusStateChange', callback?: AsyncCallback): void; + /** + * Subscribes to error events. + * + * @param { 'error' } type - Event type. + * @param { ErrorCallback } callback - Callback used to get the capture session errors. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + * @deprecated since 11 + * @useinstead ohos.multimedia.camera.VideoSession#on + */ + on(type: 'error', callback: ErrorCallback): void; + /** + * Unsubscribes from error events. + * + * @param { 'error' } type - Event type. + * @param { ErrorCallback } callback - Callback used to get the capture session errors. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + * @deprecated since 11 + * @useinstead ohos.multimedia.camera.VideoSession#off + */ + off(type: 'error', callback?: ErrorCallback): void; + } + /** + * Photo session object. + * + * @interface PhotoSession + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 11 + */ + interface PhotoSession extends Session, Flash, AutoExposure, Focus, Zoom, ColorManagement { + /** + * Subscribes to error events. + * + * @param { 'error' } type - Event type. + * @param { ErrorCallback } callback - Callback used to get the capture session errors. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 11 + */ + on(type: 'error', callback: ErrorCallback): void; + /** + * Unsubscribes from error events. + * + * @param { 'error' } type - Event type. + * @param { ErrorCallback } callback - Callback used to get the capture session errors. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 11 + */ + off(type: 'error', callback?: ErrorCallback): void; + /** + * Subscribes focus state change event callback. + * + * @param { 'focusStateChange' } type - Event type. + * @param { AsyncCallback } callback - Callback used to get the focus state change. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 11 + */ + on(type: 'focusStateChange', callback: AsyncCallback): void; + /** + * Unsubscribes from focus state change event callback. + * + * @param { 'focusStateChange' } type - Event type. + * @param { AsyncCallback } callback - Callback used to get the focus state change. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 11 + */ + off(type: 'focusStateChange', callback?: AsyncCallback): void; + /** + * Subscribes zoom info event callback. + * + * @param { 'smoothZoomInfoAvailable' } type - Event type. + * @param { AsyncCallback } callback - Callback used to get the zoom info. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 11 + */ + on(type: 'smoothZoomInfoAvailable', callback: AsyncCallback): void; + /** + * Unsubscribes from zoom info event callback. + * + * @param { 'smoothZoomInfoAvailable' } type - Event type. + * @param { AsyncCallback } callback - Callback used to get the zoom info. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 11 + */ + off(type: 'smoothZoomInfoAvailable', callback?: AsyncCallback): void; + } + /** + * Video session object. + * + * @interface VideoSession + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 11 + */ + interface VideoSession extends Session, Flash, AutoExposure, Focus, Zoom, Stabilization, ColorManagement { + /** + * Subscribes to error events. + * + * @param { 'error' } type - Event type. + * @param { ErrorCallback } callback - Callback used to get the capture session errors. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 11 + */ + on(type: 'error', callback: ErrorCallback): void; + /** + * Unsubscribes from error events. + * + * @param { 'error' } type - Event type. + * @param { ErrorCallback } callback - Callback used to get the capture session errors. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 11 + */ + off(type: 'error', callback?: ErrorCallback): void; + /** + * Subscribes focus state change event callback. + * + * @param { 'focusStateChange' } type - Event type. + * @param { AsyncCallback } callback - Callback used to get the focus state change. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 11 + */ + on(type: 'focusStateChange', callback: AsyncCallback): void; + /** + * Unsubscribes from focus state change event callback. + * + * @param { 'focusStateChange' } type - Event type. + * @param { AsyncCallback } callback - Callback used to get the focus state change. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 11 + */ + off(type: 'focusStateChange', callback?: AsyncCallback): void; + /** + * Subscribes zoom info event callback. + * + * @param { 'smoothZoomInfoAvailable' } type - Event type. + * @param { AsyncCallback } callback - Callback used to get the zoom info. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 11 + */ + on(type: 'smoothZoomInfoAvailable', callback: AsyncCallback): void; + /** + * Unsubscribes from zoom info event callback. + * + * @param { 'smoothZoomInfoAvailable' } type - Event type. + * @param { AsyncCallback } callback - Callback used to get the zoom info. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 11 + */ + off(type: 'smoothZoomInfoAvailable', callback?: AsyncCallback): void; + } + /** + * Secure camera session object. + * + * @interface SecureSession + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 12 + */ + interface SecureSession extends Session, Flash, AutoExposure, Focus, Zoom { + /** + * Add Secure output for camera. + * + * @param { PreviewOutput } previewOutput - Specify the output as a secure flow. + * @throws { BusinessError } 7400101 - Parameter missing or parameter type incorrect. + * @throws { BusinessError } 7400102 - Operation not allowed. + * @throws { BusinessError } 7400103 - Session not config. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 12 + */ + addSecureOutput(previewOutput: PreviewOutput): void; + /** + * Subscribes to error events. + * + * @param { 'error' } type - Event type. + * @param { ErrorCallback } callback - Callback used to get the capture session errors. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 12 + */ + on(type: 'error', callback: ErrorCallback): void; + /** + * Unsubscribes from error events. + * + * @param { 'error' } type - Event type. + * @param { ErrorCallback } callback - Callback used to get the capture session errors. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 12 + */ + off(type: 'error', callback?: ErrorCallback): void; + /** + * Subscribes focus status change event callback. + * + * @param { 'focusStateChange' } type - Event type. + * @param { AsyncCallback } callback - Callback used to get the focus state change. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 12 + */ + on(type: 'focusStateChange', callback: AsyncCallback): void; + /** + * Unsubscribes from focus status change event callback. + * + * @param { 'focusStateChange' } type - Event type. + * @param { AsyncCallback } callback - Callback used to get the focus state change. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 12 + */ + off(type: 'focusStateChange', callback?: AsyncCallback): void; + } + /** + * Camera output object. + * + * @interface CameraOutput + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + interface CameraOutput { + /** + * Release output instance. + * + * @param { AsyncCallback } callback - Callback used to return the result. + * @throws { BusinessError } 7400201 - Camera service fatal error. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + release(callback: AsyncCallback): void; + /** + * Release output instance. + * + * @returns { Promise } Promise used to return the result. + * @throws { BusinessError } 7400201 - Camera service fatal error. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + release(): Promise; + } + /** + * Preview output object. + * + * @interface PreviewOutput + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + interface PreviewOutput extends CameraOutput { + /** + * Start output instance. + * + * @param { AsyncCallback } callback - Callback used to return the result. + * @throws { BusinessError } 7400103 - Session not config. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + * @deprecated since 11 + * @useinstead ohos.multimedia.camera.Session#start + */ + start(callback: AsyncCallback): void; + /** + * Start output instance. + * + * @returns { Promise } Promise used to return the result. + * @throws { BusinessError } 7400103 - Session not config. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + * @deprecated since 11 + * @useinstead ohos.multimedia.camera.Session#start + */ + start(): Promise; + /** + * Stop output instance. + * + * @param { AsyncCallback } callback - Callback used to return the result. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + * @deprecated since 11 + * @useinstead ohos.multimedia.camera.Session#stop + */ + stop(callback: AsyncCallback): void; + /** + * Stop output instance. + * + * @returns { Promise } Promise used to return the result. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + * @deprecated since 11 + * @useinstead ohos.multimedia.camera.Session#stop + */ + stop(): Promise; + /** + * Subscribes frame start event callback. + * + * @param { 'frameStart' } type - Event type. + * @param { AsyncCallback } callback - Callback used to return the result. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + on(type: 'frameStart', callback: AsyncCallback): void; + /** + * Unsubscribes from frame start event callback. + * + * @param { 'frameStart' } type - Event type. + * @param { AsyncCallback } callback - Callback used to return the result. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + off(type: 'frameStart', callback?: AsyncCallback): void; + /** + * Subscribes frame end event callback. + * + * @param { 'frameEnd' } type - Event type. + * @param { AsyncCallback } callback - Callback used to return the result. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + on(type: 'frameEnd', callback: AsyncCallback): void; + /** + * Unsubscribes from frame end event callback. + * + * @param { 'frameEnd' } type - Event type. + * @param { AsyncCallback } callback - Callback used to return the result. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + off(type: 'frameEnd', callback?: AsyncCallback): void; + /** + * Subscribes to error events. + * + * @param { 'error' } type - Event type. + * @param { ErrorCallback } callback - Callback used to get the preview output errors. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + on(type: 'error', callback: ErrorCallback): void; + /** + * Unsubscribes from error events. + * + * @param { 'error' } type - Event type. + * @param { ErrorCallback } callback - Callback used to get the preview output errors. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + off(type: 'error', callback?: ErrorCallback): void; + /** + * Get supported frame rates which can be set during session running. + * + * @returns { Array } The array of supported frame rate range. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 12 + */ + getSupportedFrameRates(): Array; + /** + * Set a frame rate range. + * + * @param { number } minFps - Minimum frame rate per second. + * @param { number } maxFps - Maximum frame rate per second. + * @throws { BusinessError } 7400101 - Parameter missing or parameter type incorrect. + * @throws { BusinessError } 7400110 - Unresolved conflicts with current configurations. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 12 + */ + setFrameRate(minFps: number, maxFps: number): void; + /** + * Get active frame rate range which has been set before. + * + * @returns { FrameRateRange } The active frame rate range. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 12 + */ + getActiveFrameRate(): FrameRateRange; + } + /** + * Enumerates the image rotation angles. + * + * @enum { number } + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + enum ImageRotation { + /** + * The capture image rotates 0 degrees. + * + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + ROTATION_0 = 0, + /** + * The capture image rotates 90 degrees. + * + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + ROTATION_90 = 90, + /** + * The capture image rotates 180 degrees. + * + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + ROTATION_180 = 180, + /** + * The capture image rotates 270 degrees. + * + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + ROTATION_270 = 270 + } + /** + * Photo capture location + * + * @typedef Location + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + interface Location { + /** + * Latitude. + * + * @type { number } + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + latitude: number; + /** + * Longitude. + * + * @type { number } + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + longitude: number; + /** + * Altitude. + * + * @type { number } + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + altitude: number; + } + /** + * Enumerates the image quality levels. + * + * @enum { number } + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + enum QualityLevel { + /** + * High image quality. + * + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + QUALITY_LEVEL_HIGH = 0, + /** + * Medium image quality. + * + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + QUALITY_LEVEL_MEDIUM = 1, + /** + * Low image quality. + * + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + QUALITY_LEVEL_LOW = 2 + } + /** + * Photo capture options to set. + * + * @typedef PhotoCaptureSetting + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + interface PhotoCaptureSetting { + /** + * Photo image quality. + * + * @type { ?QualityLevel } + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + quality?: QualityLevel; + /** + * Photo rotation. + * + * @type { ?ImageRotation } + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + rotation?: ImageRotation; + /** + * Photo location. + * + * @type { ?Location } + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + location?: Location; + /** + * Set the mirror photo function switch, default to false. + * + * @type { ?boolean } + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + mirror?: boolean; + } + /** + * Photo object + * + * @typedef Photo + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 11 + */ + interface Photo { + /** + * Main image. + * + * @type { image.Image } + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 11 + */ + main: image.Image; + /** + * Release Photo object. + * + * @returns { Promise } Promise used to return the result. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 11 + */ + release(): Promise; + } + /** + * Photo output object. + * + * @interface PhotoOutput + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + interface PhotoOutput extends CameraOutput { + /** + * Start capture output. + * + * @param { AsyncCallback } callback - Callback used to return the result. + * @throws { BusinessError } 7400104 - Session not running. + * @throws { BusinessError } 7400201 - Camera service fatal error. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + capture(callback: AsyncCallback): void; + /** + * Start capture output. + * + * @returns { Promise } Promise used to return the result. + * @throws { BusinessError } 7400104 - Session not running. + * @throws { BusinessError } 7400201 - Camera service fatal error. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + capture(): Promise; + /** + * Start capture output. + * + * @param { PhotoCaptureSetting } setting - Photo capture settings. + * @param { AsyncCallback } callback - Callback used to return the result. + * @throws { BusinessError } 7400101 - Parameter missing or parameter type incorrect. + * @throws { BusinessError } 7400104 - Session not running. + * @throws { BusinessError } 7400201 - Camera service fatal error. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + capture(setting: PhotoCaptureSetting, callback: AsyncCallback): void; + /** + * Start capture output. + * + * @param { PhotoCaptureSetting } setting - Photo capture settings. + * @returns { Promise } Promise used to return the result. + * @throws { BusinessError } 7400101 - Parameter missing or parameter type incorrect. + * @throws { BusinessError } 7400104 - Session not running. + * @throws { BusinessError } 7400201 - Camera service fatal error. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + /** + * Start capture output. + * Remove optional param. + * + * @param { PhotoCaptureSetting } setting - Photo capture settings. + * @returns { Promise } Promise used to return the result. + * @throws { BusinessError } 7400101 - Parameter missing or parameter type incorrect. + * @throws { BusinessError } 7400104 - Session not running. + * @throws { BusinessError } 7400201 - Camera service fatal error. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 11 + */ + capture(setting: PhotoCaptureSetting): Promise; + /** + * Subscribes photo available event callback. + * + * @param { 'photoAvailable' } type - Event type. + * @param { AsyncCallback } callback - Callback used to get the Photo. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 11 + */ + on(type: 'photoAvailable', callback: AsyncCallback): void; + /** + * Unsubscribes photo available event callback. + * + * @param { 'photoAvailable' } type - Event type. + * @param { AsyncCallback } callback - Callback used to get the Photo. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 11 + */ + off(type: 'photoAvailable', callback?: AsyncCallback): void; + /** + * Subscribes photo asset event callback. + * + * @param { 'photoAssetAvailable' } type - Event type. + * @param { AsyncCallback } callback - Callback used to get the asset. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 12 + */ + on(type: 'photoAssetAvailable', callback: AsyncCallback): void; + /** + * Unsubscribes photo asset event callback. + * + * @param { 'photoAssetAvailable' } type - Event type. + * @param { AsyncCallback } callback - Callback used to get the asset. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 12 + */ + off(type: 'photoAssetAvailable', callback?: AsyncCallback): void; + /** + * Check whether to support mirror photo. + * + * @returns { boolean } Is the mirror supported. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + isMirrorSupported(): boolean; + /** + * Subscribes capture start event callback. + * + * @param { 'captureStart' } type - Event type. + * @param { AsyncCallback } callback - Callback used to get the capture ID. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + * @deprecated since 11 + * @useinstead ohos.multimedia.camera.PhotoOutput#captureStartWithInfo + */ + on(type: 'captureStart', callback: AsyncCallback): void; + /** + * Unsubscribes from capture start event callback. + * + * @param { 'captureStart' } type - Event type. + * @param { AsyncCallback } callback - Callback used to get the capture ID. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + * @deprecated since 11 + * @useinstead ohos.multimedia.camera.PhotoOutput#captureStartWithInfo + */ + off(type: 'captureStart', callback?: AsyncCallback): void; + /** + * Subscribes capture start event callback. + * + * @param { 'captureStartWithInfo' } type - Event type. + * @param { AsyncCallback } callback - Callback used to get the capture start info. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 11 + */ + on(type: 'captureStartWithInfo', callback: AsyncCallback): void; + /** + * Unsubscribes from capture start event callback. + * + * @param { 'captureStartWithInfo' } type - Event type. + * @param { AsyncCallback } callback - Callback used to get the capture start info. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 11 + */ + off(type: 'captureStartWithInfo', callback?: AsyncCallback): void; + /** + * Subscribes frame shutter event callback. + * + * @param { 'frameShutter' } type - Event type. + * @param { AsyncCallback } callback - Callback used to get the frame shutter information. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + on(type: 'frameShutter', callback: AsyncCallback): void; + /** + * Unsubscribes from frame shutter event callback. + * + * @param { 'frameShutter' } type - Event type. + * @param { AsyncCallback } callback - Callback used to get the frame shutter information. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + off(type: 'frameShutter', callback?: AsyncCallback): void; + /** + * Subscribes frame shutter end event callback. + * + * @param { 'frameShutterEnd' } type - Event type. + * @param { AsyncCallback } callback - Callback used to get the frame shutter end information. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 12 + */ + on(type: 'frameShutterEnd', callback: AsyncCallback): void; + /** + * Unsubscribes from frame shutter end event callback. + * + * @param { 'frameShutterEnd' } type - Event type. + * @param { AsyncCallback } callback - Callback used to get the frame shutter end information. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 12 + */ + off(type: 'frameShutterEnd', callback?: AsyncCallback): void; + /** + * Subscribes capture end event callback. + * + * @param { 'captureEnd' } type - Event type. + * @param { AsyncCallback } callback - Callback used to get the capture end information. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + on(type: 'captureEnd', callback: AsyncCallback): void; + /** + * Unsubscribes from capture end event callback. + * + * @param { 'captureEnd' } type - Event type. + * @param { AsyncCallback } callback - Callback used to get the capture end information. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + off(type: 'captureEnd', callback?: AsyncCallback): void; + /** + * Subscribes capture ready event callback. After receiving the callback, can proceed to the next capture + * + * @param { 'captureReady' } type - Event type. + * @param { AsyncCallback } callback - Callback used to notice capture ready. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 12 + */ + on(type: 'captureReady', callback: AsyncCallback): void; + /** + * Unsubscribes from capture ready event callback. + * + * @param { 'captureReady' } type - Event type. + * @param { AsyncCallback } callback - Callback used to notice capture ready. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 12 + */ + off(type: 'captureReady', callback?: AsyncCallback): void; + /** + * Subscribes estimated capture duration event callback. + * + * @param { 'estimatedCaptureDuration' } type - Event type. + * @param { AsyncCallback } callback - Callback used to notify the estimated capture duration (in milliseconds). + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 12 + */ + on(type: 'estimatedCaptureDuration', callback: AsyncCallback): void; + /** + * Unsubscribes from estimated capture duration event callback. + * + * @param { 'estimatedCaptureDuration' } type - Event type. + * @param { AsyncCallback } callback - Callback used to notify the estimated capture duration (in milliseconds). + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 12 + */ + off(type: 'estimatedCaptureDuration', callback?: AsyncCallback): void; + /** + * Subscribes to error events. + * + * @param { 'error' } type - Event type. + * @param { ErrorCallback } callback - Callback used to get the photo output errors. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + on(type: 'error', callback: ErrorCallback): void; + /** + * Unsubscribes from error events. + * + * @param { 'error' } type - Event type. + * @param { ErrorCallback } callback - Callback used to get the photo output errors. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + off(type: 'error', callback?: ErrorCallback): void; + /** + * Confirm if moving photo supported. + * + * @returns { boolean } TRUE if the moving photo is supported. + * @throws { BusinessError } 7400201 - Camera service fatal error. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 12 + */ + isMovingPhotoSupported(): boolean; + /** + * Enable moving photo. + * + * @permission ohos.permission.MICROPHONE + * @param { boolean } enabled - Target state for moving photo. + * @throws { BusinessError } 201 - permission denied. + * @throws { BusinessError } 7400101 - Parameter missing or parameter type incorrect. + * @throws { BusinessError } 7400201 - Camera service fatal error. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 12 + */ + enableMovingPhoto(enabled: boolean): void; + } + /** + * Frame shutter callback info. + * + * @typedef FrameShutterInfo + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + interface FrameShutterInfo { + /** + * Capture id. + * + * @type { number } + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + captureId: number; + /** + * Timestamp for frame. + * + * @type { number } + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + timestamp: number; + } + /** + * Frame shutter end callback info. + * + * @typedef FrameShutterEndInfo + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 12 + */ + interface FrameShutterEndInfo { + /** + * Capture id. + * + * @type { number } + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 12 + */ + captureId: number; + } + /** + * Capture start info. + * + * @typedef CaptureStartInfo + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 11 + */ + interface CaptureStartInfo { + /** + * Capture id. + * + * @type { number } + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 11 + */ + captureId: number; + /** + * Time(in milliseconds) is the shutter time for the photo. + * + * @type { number } + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 11 + */ + time: number; + } + /** + * Capture end info. + * + * @typedef CaptureEndInfo + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + interface CaptureEndInfo { + /** + * Capture id. + * + * @type { number } + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + captureId: number; + /** + * Frame count. + * + * @type { number } + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + frameCount: number; + } + /** + * Video output object. + * + * @interface VideoOutput + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + interface VideoOutput extends CameraOutput { + /** + * Start video output. + * + * @param { AsyncCallback } callback - Callback used to return the result. + * @throws { BusinessError } 7400103 - Session not config. + * @throws { BusinessError } 7400201 - Camera service fatal error. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + start(callback: AsyncCallback): void; + /** + * Start video output. + * + * @returns { Promise } Promise used to return the result. + * @throws { BusinessError } 7400103 - Session not config. + * @throws { BusinessError } 7400201 - Camera service fatal error. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + start(): Promise; + /** + * Stop video output. + * + * @param { AsyncCallback } callback - Callback used to return the result. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + stop(callback: AsyncCallback): void; + /** + * Stop video output. + * + * @returns { Promise } Promise used to return the result. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + stop(): Promise; + /** + * Get supported frame rates which can be set during session running. + * + * @returns { Array } The array of supported frame rate range. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 12 + */ + getSupportedFrameRates(): Array; + /** + * Set a frame rate range. + * + * @param { number } minFps - Minimum frame rate per second. + * @param { number } maxFps - Maximum frame rate per second. + * @throws { BusinessError } 7400101 - Parameter missing or parameter type incorrect. + * @throws { BusinessError } 7400110 - Unresolved conflicts with current configurations. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 12 + */ + setFrameRate(minFps: number, maxFps: number): void; + /** + * Get active frame rate range which has been set before. + * + * @returns { FrameRateRange } The active frame rate range. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 12 + */ + getActiveFrameRate(): FrameRateRange; + /** + * Subscribes frame start event callback. + * + * @param { 'frameStart' } type - Event type. + * @param { AsyncCallback } callback - Callback used to return the result. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + on(type: 'frameStart', callback: AsyncCallback): void; + /** + * Unsubscribes from frame start event callback. + * + * @param { 'frameStart' } type - Event type. + * @param { AsyncCallback } callback - Callback used to return the result. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + off(type: 'frameStart', callback?: AsyncCallback): void; + /** + * Subscribes frame end event callback. + * + * @param { 'frameEnd' } type - Event type. + * @param { AsyncCallback } callback - Callback used to return the result. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + on(type: 'frameEnd', callback: AsyncCallback): void; + /** + * Unsubscribes from frame end event callback. + * + * @param { 'frameEnd' } type - Event type. + * @param { AsyncCallback } callback - Callback used to return the result. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + off(type: 'frameEnd', callback?: AsyncCallback): void; + /** + * Subscribes to error events. + * + * @param { 'error' } type - Event type. + * @param { ErrorCallback } callback - Callback used to get the video output errors. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + on(type: 'error', callback: ErrorCallback): void; + /** + * Unsubscribes from error events. + * + * @param { 'error' } type - Event type. + * @param { ErrorCallback } callback - Callback used to get the video output errors. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + off(type: 'error', callback?: ErrorCallback): void; + } + /** + * Metadata object type. + * + * @enum { number } + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + enum MetadataObjectType { + /** + * Face detection type. + * + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + FACE_DETECTION = 0 + } + /** + * Rectangle definition. + * + * @typedef Rect + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + interface Rect { + /** + * X coordinator of top left point. + * + * @type { number } + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + topLeftX: number; + /** + * Y coordinator of top left point. + * + * @type { number } + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + topLeftY: number; + /** + * Width of this rectangle. + * + * @type { number } + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + width: number; + /** + * Height of this rectangle. + * + * @type { number } + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + height: number; + } + /** + * Metadata object basis. + * + * @typedef MetadataObject + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + interface MetadataObject { + /** + * Metadata object type. + * + * @type { MetadataObjectType } + * @readonly + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + readonly type: MetadataObjectType; + /** + * Metadata object timestamp in milliseconds. + * + * @type { number } + * @readonly + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + readonly timestamp: number; + /** + * The axis-aligned bounding box of detected metadata object. + * + * @type { Rect } + * @readonly + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + readonly boundingBox: Rect; + } + /** + * Metadata Output object + * + * @interface MetadataOutput + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + interface MetadataOutput extends CameraOutput { + /** + * Start output metadata + * + * @param { AsyncCallback } callback - Callback used to return the result. + * @throws { BusinessError } 7400103 - Session not config. + * @throws { BusinessError } 7400201 - Camera service fatal error. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + start(callback: AsyncCallback): void; + /** + * Start output metadata + * + * @returns { Promise } Promise used to return the result. + * @throws { BusinessError } 7400103 - Session not config. + * @throws { BusinessError } 7400201 - Camera service fatal error. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + start(): Promise; + /** + * Stop output metadata + * + * @param { AsyncCallback } callback - Callback used to return the result. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + stop(callback: AsyncCallback): void; + /** + * Stop output metadata + * + * @returns { Promise } Promise used to return the result. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + stop(): Promise; + /** + * Subscribes to metadata objects available event callback. + * + * @param { 'metadataObjectsAvailable' } type - Event type. + * @param { AsyncCallback> } callback - Callback used to get the available metadata objects. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + on(type: 'metadataObjectsAvailable', callback: AsyncCallback>): void; + /** + * Unsubscribes from metadata objects available event callback. + * + * @param { 'metadataObjectsAvailable' } type - Event type. + * @param { AsyncCallback> } callback - Callback used to get the available metadata objects. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + off(type: 'metadataObjectsAvailable', callback?: AsyncCallback>): void; + /** + * Subscribes to error events. + * + * @param { 'error' } type - Event type. + * @param { ErrorCallback } callback - Callback used to get the video output errors. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + on(type: 'error', callback: ErrorCallback): void; + /** + * Unsubscribes from error events. + * + * @param { 'error' } type - Event type. + * @param { ErrorCallback } callback - Callback used to get the video output errors. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 10 + */ + off(type: 'error', callback?: ErrorCallback): void; + } +} +export default camera; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.multimedia.cameraPicker.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.multimedia.cameraPicker.d.ts new file mode 100755 index 00000000..c43cc1e3 --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.multimedia.cameraPicker.d.ts @@ -0,0 +1,227 @@ +/* + * Copyright (C) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit CameraKit + */ +import type Context from './application/Context'; +import type camera from './@ohos.multimedia.camera'; +/** + * @namespace cameraPicker + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 11 + */ +/** + * @namespace cameraPicker + * @syscap SystemCapability.Multimedia.Camera.Core + * @atomicservice + * @since 12 + */ +declare namespace cameraPicker { + /** + * Picker profile settings for take photo and record video. + * + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 11 + */ + /** + * Picker profile settings for take photo and record video. + * + * @syscap SystemCapability.Multimedia.Camera.Core + * @atomicservice + * @since 12 + */ + class PickerProfile { + /** + * The camera position to be used. + * + * @type { camera.CameraPosition } + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 11 + */ + /** + * The camera position to be used. + * + * @type { camera.CameraPosition } + * @syscap SystemCapability.Multimedia.Camera.Core + * @atomicservice + * @since 12 + */ + cameraPosition: camera.CameraPosition; + /** + * The uri of the result to be saved. + * + * @type { ?string } + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 11 + */ + /** + * The uri of the result to be saved. + * + * @type { ?string } + * @syscap SystemCapability.Multimedia.Camera.Core + * @atomicservice + * @since 12 + */ + saveUri?: string; + /** + * The max duration of the video. + * + * @type { ?number } + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 11 + */ + /** + * The max duration of the video. + * + * @type { ?number } + * @syscap SystemCapability.Multimedia.Camera.Core + * @atomicservice + * @since 12 + */ + videoDuration?: number; + } + /** + * Enum for camera picker media type. + * + * @enum { string } + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 11 + */ + /** + * Enum for camera picker media type. + * + * @enum { string } + * @syscap SystemCapability.Multimedia.Camera.Core + * @atomicservice + * @since 12 + */ + enum PickerMediaType { + /** + * Type image, picker provide an ability to take photo. + * + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 11 + */ + /** + * Type image, picker provide an ability to take photo. + * + * @syscap SystemCapability.Multimedia.Camera.Core + * @atomicservice + * @since 12 + */ + PHOTO = 'photo', + /** + * Type video, picker provide an ability to record video. + * + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 11 + */ + /** + * Type video, picker provide an ability to record video. + * + * @syscap SystemCapability.Multimedia.Camera.Core + * @atomicservice + * @since 12 + */ + VIDEO = 'video' + } + /** + * The picker result info for pick function. + * + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 11 + */ + /** + * The picker result info for pick function. + * + * @syscap SystemCapability.Multimedia.Camera.Core + * @atomicservice + * @since 12 + */ + class PickerResult { + /** + * The result code. + * + * @type { number } + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 11 + */ + /** + * The result code. + * + * @type { number } + * @syscap SystemCapability.Multimedia.Camera.Core + * @atomicservice + * @since 12 + */ + resultCode: number; + /** + * The result saved uri. + * + * @type { string } + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 11 + */ + /** + * The result saved uri. + * + * @type { string } + * @syscap SystemCapability.Multimedia.Camera.Core + * @atomicservice + * @since 12 + */ + resultUri: string; + /** + * The result resource type. + * + * @type { PickerMediaType } + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 11 + */ + /** + * The result resource type. + * + * @type { PickerMediaType } + * @syscap SystemCapability.Multimedia.Camera.Core + * @atomicservice + * @since 12 + */ + mediaType: PickerMediaType; + } + /** + * Pick function to get a photo or video result. + * + * @param { Context } context - From UIExtensionAbility. + * @param { Array } mediaTypes - Pick media type. + * @param { PickerProfile } pickerProfile - Picker input Profile. + * @returns { Promise } pick result. + * @syscap SystemCapability.Multimedia.Camera.Core + * @since 11 + */ + /** + * Pick function to get a photo or video result. + * + * @param { Context } context - From UIExtensionAbility. + * @param { Array } mediaTypes - Pick media type. + * @param { PickerProfile } pickerProfile - Picker input Profile. + * @returns { Promise } pick result. + * @syscap SystemCapability.Multimedia.Camera.Core + * @atomicservice + * @since 12 + */ + function pick(context: Context, mediaTypes: Array, pickerProfile: PickerProfile): Promise; +} +export default cameraPicker; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.multimedia.drm.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.multimedia.drm.d.ts new file mode 100755 index 00000000..b1f408a9 --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.multimedia.drm.d.ts @@ -0,0 +1,1465 @@ +/* +* Copyright (C) 2023 Huawei Device Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +/** + * @file Defines the DRM capability. + * @kit DrmKit + */ +/** + * This module provides the DRM capability to multimedia player. + * @namespace drm + * @syscap SystemCapability.Multimedia.Drm.Core + * @since 11 + */ +/** + * This module provides the DRM capability to multimedia player. + * @namespace drm + * @syscap SystemCapability.Multimedia.Drm.Core + * @atomicservice + * @since 12 + */ +declare namespace drm { + /** + * Enumerates drm error code. + * @enum { number } + * @syscap SystemCapability.Multimedia.Drm.Core + * @since 11 + */ + enum DrmErrorCode { + /** + * All unknown errors. + * @syscap SystemCapability.Multimedia.Drm.Core + * @since 11 + */ + ERROR_UNKNOWN = 24700101, + /** + * Meet max MediaKeySystem num limit. + * @syscap SystemCapability.Multimedia.Drm.Core + * @since 11 + */ + MAX_SYSTEM_NUM_REACHED = 24700103, + /** + * Meet max MediaKeySession num limit. + * @syscap SystemCapability.Multimedia.Drm.Core + * @since 11 + */ + MAX_SESSION_NUM_REACHED = 24700104, + /** + * Service fatal error e.g. service died. + * @syscap SystemCapability.Multimedia.Drm.Core + * @since 11 + */ + SERVICE_FATAL_ERROR = 24700201 + } + /** + * Enumerates which config name we can get. + * @enum { string } + * @syscap SystemCapability.Multimedia.Drm.Core + * @since 11 + */ + enum PreDefinedConfigName { + /** + * Config name vendor + * @syscap SystemCapability.Multimedia.Drm.Core + * @since 11 + */ + CONFIG_DEVICE_VENDOR = 'vendor', + /** + * Config name version + * @syscap SystemCapability.Multimedia.Drm.Core + * @since 11 + */ + CONFIG_DEVICE_VERSION = 'version', + /** + * Config name description + * @syscap SystemCapability.Multimedia.Drm.Core + * @since 11 + */ + CONFIG_DEVICE_DESCRIPTION = 'description', + /** + * Config name algorithms + * @syscap SystemCapability.Multimedia.Drm.Core + * @since 11 + */ + CONFIG_DEVICE_ALGORITHMS = 'algorithms', + /** + * Config name deviceUniqueId + * @syscap SystemCapability.Multimedia.Drm.Core + * @since 11 + */ + CONFIG_DEVICE_UNIQUE_ID = 'deviceUniqueId', + /** + * Config name maxSessionNum + * @syscap SystemCapability.Multimedia.Drm.Core + * @since 11 + */ + CONFIG_SESSION_MAX = 'maxSessionNum', + /** + * Config name currentSessionNum + * @syscap SystemCapability.Multimedia.Drm.Core + * @since 11 + */ + CONFIG_SESSION_CURRENT = 'currentSessionNum' + } + /** + * Enumerates media key type. + * @enum { number } + * @syscap SystemCapability.Multimedia.Drm.Core + * @since 11 + */ + enum MediaKeyType { + /** + * Offline media key type. + * @syscap SystemCapability.Multimedia.Drm.Core + * @since 11 + */ + MEDIA_KEY_TYPE_OFFLINE = 0, + /** + * Online media key type. + * @syscap SystemCapability.Multimedia.Drm.Core + * @since 11 + */ + MEDIA_KEY_TYPE_ONLINE + } + /** + * Enumerates offline media key status. + * @enum { number } + * @syscap SystemCapability.Multimedia.Drm.Core + * @since 11 + */ + enum OfflineMediaKeyStatus { + /** + * Offline media key status unknown. + * @syscap SystemCapability.Multimedia.Drm.Core + * @since 11 + */ + OFFLINE_MEDIA_KEY_STATUS_UNKNOWN = 0, + /** + * Offline media key status usable. + * @syscap SystemCapability.Multimedia.Drm.Core + * @since 11 + */ + OFFLINE_MEDIA_KEY_STATUS_USABLE = 1, + /** + * Offline media key status inactive. + * @syscap SystemCapability.Multimedia.Drm.Core + * @since 11 + */ + OFFLINE_MEDIA_KEY_STATUS_INACTIVE = 2 + } + /** + * Enumerates certificate status. + * @enum { number } + * @syscap SystemCapability.Multimedia.Drm.Core + * @since 11 + */ + enum CertificateStatus { + /** + * Device already provisioned. + * @syscap SystemCapability.Multimedia.Drm.Core + * @since 11 + */ + CERT_STATUS_PROVISIONED = 0, + /** + * Device not provisioned. + * @syscap SystemCapability.Multimedia.Drm.Core + * @since 11 + */ + CERT_STATUS_NOT_PROVISIONED, + /** + * Cert already expired. + * @syscap SystemCapability.Multimedia.Drm.Core + * @since 11 + */ + CERT_STATUS_EXPIRED, + /** + * Certs are invalid. + * @syscap SystemCapability.Multimedia.Drm.Core + * @since 11 + */ + CERT_STATUS_INVALID, + /** + * Get certs status failed. + * @syscap SystemCapability.Multimedia.Drm.Core + * @since 11 + */ + CERT_STATUS_UNAVAILABLE + } + /** + * Enumerates media key request types. + * @enum { number } + * @syscap SystemCapability.Multimedia.Drm.Core + * @since 11 + */ + /** + * Enumerates media key request types. + * @enum { number } + * @syscap SystemCapability.Multimedia.Drm.Core + * @atomicservice + * @since 12 + */ + enum MediaKeyRequestType { + /** + * Media key request type unknown. + * @syscap SystemCapability.Multimedia.Drm.Core + * @since 11 + */ + /** + * Media key request type unknown. + * @syscap SystemCapability.Multimedia.Drm.Core + * @atomicservice + * @since 12 + */ + MEDIA_KEY_REQUEST_TYPE_UNKNOWN = 0, + /** + * Media key request type initial. + * @syscap SystemCapability.Multimedia.Drm.Core + * @since 11 + */ + /** + * Media key request type initial. + * @syscap SystemCapability.Multimedia.Drm.Core + * @atomicservice + * @since 12 + */ + MEDIA_KEY_REQUEST_TYPE_INITIAL = 1, + /** + * Media key request type renewal. + * @syscap SystemCapability.Multimedia.Drm.Core + * @since 11 + */ + /** + * Media key request type renewal. + * @syscap SystemCapability.Multimedia.Drm.Core + * @atomicservice + * @since 12 + */ + MEDIA_KEY_REQUEST_TYPE_RENEWAL = 2, + /** + * Media key request type release. + * @syscap SystemCapability.Multimedia.Drm.Core + * @since 11 + */ + /** + * Media key request type release. + * @syscap SystemCapability.Multimedia.Drm.Core + * @atomicservice + * @since 12 + */ + MEDIA_KEY_REQUEST_TYPE_RELEASE = 3, + /** + * Media key request type none. + * @syscap SystemCapability.Multimedia.Drm.Core + * @since 11 + */ + /** + * Media key request type none. + * @syscap SystemCapability.Multimedia.Drm.Core + * @atomicservice + * @since 12 + */ + MEDIA_KEY_REQUEST_TYPE_NONE = 4, + /** + * Media key request type update. + * @syscap SystemCapability.Multimedia.Drm.Core + * @since 11 + */ + /** + * Media key request type update. + * @syscap SystemCapability.Multimedia.Drm.Core + * @atomicservice + * @since 12 + */ + MEDIA_KEY_REQUEST_TYPE_UPDATE = 5 + } + /** + * Enumerates content protection level. + * @enum { number } + * @syscap SystemCapability.Multimedia.Drm.Core + * @since 11 + */ + /** + * Enumerates content protection level. + * @enum { number } + * @syscap SystemCapability.Multimedia.Drm.Core + * @atomicservice + * @since 12 + */ + enum ContentProtectionLevel { + /** + * Device decrypt and decode type unknown. + * @syscap SystemCapability.Multimedia.Drm.Core + * @since 11 + */ + /** + * Device decrypt and decode type unknown. + * @syscap SystemCapability.Multimedia.Drm.Core + * @atomicservice + * @since 12 + */ + CONTENT_PROTECTION_LEVEL_UNKNOWN = 0, + /** + * Device using software level. + * @syscap SystemCapability.Multimedia.Drm.Core + * @since 11 + */ + /** + * Device using software level. + * @syscap SystemCapability.Multimedia.Drm.Core + * @atomicservice + * @since 12 + */ + CONTENT_PROTECTION_LEVEL_SW_CRYPTO, + /** + * Device using hardware level. + * @syscap SystemCapability.Multimedia.Drm.Core + * @since 11 + */ + /** + * Device using hardware level. + * @syscap SystemCapability.Multimedia.Drm.Core + * @atomicservice + * @since 12 + */ + CONTENT_PROTECTION_LEVEL_HW_CRYPTO, + /** + * Device using enhanced hardware level. + * @syscap SystemCapability.Multimedia.Drm.Core + * @since 11 + */ + /** + * Device using enhanced hardware level. + * @syscap SystemCapability.Multimedia.Drm.Core + * @atomicservice + * @since 12 + */ + CONTENT_PROTECTION_LEVEL_ENHANCED_HW, + /** + * Max mode. + * @syscap SystemCapability.Multimedia.Drm.Core + * @since 11 + */ + /** + * Max mode. + * @syscap SystemCapability.Multimedia.Drm.Core + * @atomicservice + * @since 12 + */ + CONTENT_PROTECTION_LEVEL_MAX + } + /** + * Provides the drm provision request definitions. + * @interface ProvisionRequest + * @syscap SystemCapability.Multimedia.Drm.Core + * @since 11 + */ + interface ProvisionRequest { + /** + * Provision request data sent to provision server. + * @type { Uint8Array } + * @syscap SystemCapability.Multimedia.Drm.Core + * @since 11 + */ + data: Uint8Array; + /** + * Provision server URL. + * @type { string } + * @syscap SystemCapability.Multimedia.Drm.Core + * @since 11 + */ + defaultURL: string; + } + /** + * Provides the drm media key request info optional data. + * @interface OptionsData + * @syscap SystemCapability.Multimedia.Drm.Core + * @since 11 + */ + /** + * Provides the drm media key request info optional data. + * @interface OptionsData + * @syscap SystemCapability.Multimedia.Drm.Core + * @atomicservice + * @since 12 + */ + interface OptionsData { + /** + * App defined optional data name. + * @type { string } + * @syscap SystemCapability.Multimedia.Drm.Core + * @since 11 + */ + /** + * App defined optional data name. + * @type { string } + * @syscap SystemCapability.Multimedia.Drm.Core + * @atomicservice + * @since 12 + */ + name: string; + /** + * App defined optional data value. + * @type { string } + * @syscap SystemCapability.Multimedia.Drm.Core + * @since 11 + */ + /** + * App defined optional data value. + * @type { string } + * @syscap SystemCapability.Multimedia.Drm.Core + * @atomicservice + * @since 12 + */ + value: string; + } + /** + * Provides the drm media key request definitions. + * @interface MediaKeyRequest + * @syscap SystemCapability.Multimedia.Drm.Core + * @since 11 + */ + /** + * Provides the drm media key request definitions. + * @interface MediaKeyRequest + * @syscap SystemCapability.Multimedia.Drm.Core + * @atomicservice + * @since 12 + */ + interface MediaKeyRequest { + /** + * Media key request type. + * @type { MediaKeyRequestType } + * @syscap SystemCapability.Multimedia.Drm.Core + * @since 11 + */ + /** + * Media key request type. + * @type { MediaKeyRequestType } + * @syscap SystemCapability.Multimedia.Drm.Core + * @atomicservice + * @since 12 + */ + mediaKeyRequestType: MediaKeyRequestType; + /** + * Media key request data sent to media key server. + * @type { Uint8Array } + * @syscap SystemCapability.Multimedia.Drm.Core + * @since 11 + */ + /** + * Media key request data sent to media key server. + * @type { Uint8Array } + * @syscap SystemCapability.Multimedia.Drm.Core + * @atomicservice + * @since 12 + */ + data: Uint8Array; + /** + * Media key server URL. + * @type { string } + * @syscap SystemCapability.Multimedia.Drm.Core + * @since 11 + */ + /** + * Media key server URL. + * @type { string } + * @syscap SystemCapability.Multimedia.Drm.Core + * @atomicservice + * @since 12 + */ + defaultURL: string; + } + /** + * Used to indicates the event info attached to specific event type. + * @interface EventInfo + * @syscap SystemCapability.Multimedia.Drm.Core + * @since 11 + */ + /** + * Used to indicates the event info attached to specific event type. + * @interface EventInfo + * @syscap SystemCapability.Multimedia.Drm.Core + * @atomicservice + * @since 12 + */ + interface EventInfo { + /** + * Event info. + * @type { Uint8Array } + * @syscap SystemCapability.Multimedia.Drm.Core + * @since 11 + */ + /** + * Event info. + * @type { Uint8Array } + * @syscap SystemCapability.Multimedia.Drm.Core + * @atomicservice + * @since 12 + */ + info: Uint8Array; + /** + * Event extra info. + * @type { string } + * @syscap SystemCapability.Multimedia.Drm.Core + * @since 11 + */ + /** + * Event extra info. + * @type { string } + * @syscap SystemCapability.Multimedia.Drm.Core + * @atomicservice + * @since 12 + */ + extraInfo: string; + } + /** + * Used to indicates the statistic info. + * @interface StatisticKeyValue + * @syscap SystemCapability.Multimedia.Drm.Core + * @since 11 + */ + interface StatisticKeyValue { + /** + * Statistic info name. + * @type { string } + * @syscap SystemCapability.Multimedia.Drm.Core + * @since 11 + */ + name: string; + /** + * Statistic info value. + * @type { string } + * @syscap SystemCapability.Multimedia.Drm.Core + * @since 11 + */ + value: string; + } + /** + * Used to indicates the media key status. + * @interface MediaKeyStatus + * @syscap SystemCapability.Multimedia.Drm.Core + * @since 11 + */ + /** + * Used to indicates the media key status. + * @interface MediaKeyStatus + * @syscap SystemCapability.Multimedia.Drm.Core + * @atomicservice + * @since 12 + */ + interface MediaKeyStatus { + /** + * Media key Id in string. + * @type { string } + * @syscap SystemCapability.Multimedia.Drm.Core + * @since 11 + */ + /** + * Media key Id in string. + * @type { string } + * @syscap SystemCapability.Multimedia.Drm.Core + * @atomicservice + * @since 12 + */ + name: string; + /** + * Media key status description. + * @type { string } + * @syscap SystemCapability.Multimedia.Drm.Core + * @since 11 + */ + /** + * Media key status description. + * @type { string } + * @syscap SystemCapability.Multimedia.Drm.Core + * @atomicservice + * @since 12 + */ + value: string; + } + /** + * Used to indicates the media key status with a key and its value. + * @interface KeysInfo + * @syscap SystemCapability.Multimedia.Drm.Core + * @since 11 + */ + /** + * Used to indicates the media key status with a key and its value. + * @interface KeysInfo + * @syscap SystemCapability.Multimedia.Drm.Core + * @atomicservice + * @since 12 + */ + interface KeysInfo { + /** + * Keys Id in media key. + * @type { Uint8Array } + * @syscap SystemCapability.Multimedia.Drm.Core + * @since 11 + */ + /** + * Keys Id in media key. + * @type { Uint8Array } + * @syscap SystemCapability.Multimedia.Drm.Core + * @atomicservice + * @since 12 + */ + keyId: Uint8Array; + /** + * Keys status description. + * @type { string } + * @syscap SystemCapability.Multimedia.Drm.Core + * @since 11 + */ + /** + * Keys status description. + * @type { string } + * @syscap SystemCapability.Multimedia.Drm.Core + * @atomicservice + * @since 12 + */ + value: string; + } + /** + * Used to indicates the media key system info of media source. + * @interface MediaKeySystemInfo + * @syscap SystemCapability.Multimedia.Drm.Core + * @since 11 + */ + /** + * Used to indicates the media key system info of media source. + * @interface MediaKeySystemInfo + * @syscap SystemCapability.Multimedia.Drm.Core + * @atomicservice + * @since 12 + */ + interface MediaKeySystemInfo { + /** + * Drm system ID. + * @type { string } + * @syscap SystemCapability.Multimedia.Drm.Core + * @since 11 + */ + /** + * Drm system ID. + * @type { string } + * @syscap SystemCapability.Multimedia.Drm.Core + * @atomicservice + * @since 12 + */ + uuid: string; + /** + * PSSH(protection scheme specific header) contain drm info. + * @type { Uint8Array } + * @syscap SystemCapability.Multimedia.Drm.Core + * @since 11 + */ + /** + * PSSH(protection scheme specific header) contain drm info. + * @type { Uint8Array } + * @syscap SystemCapability.Multimedia.Drm.Core + * @atomicservice + * @since 12 + */ + pssh: Uint8Array; + } + /** + * Name and UUID of DRM plugin. + * @interface MediaKeySystemDescription + * @syscap SystemCapability.Multimedia.Drm.Core + * @since 12 + */ + interface MediaKeySystemDescription { + /** + * Name of DRM plugin. + * @type { string } + * @syscap SystemCapability.Multimedia.Drm.Core + * @since 12 + */ + name: string; + /** + * UUID supported by DRM plugin. + * @type { string } + * @syscap SystemCapability.Multimedia.Drm.Core + * @since 12 + */ + uuid: string; + } + /** + * Get a MediaKeySystem's UUID. + * @param { string } name - The Digital Right Management solution name. + * @returns { string } The MediaKeySystem uuid. + * @throws { BusinessError } 401 - The parameter check failed.Possibly because: + *
1.Mandatory parameters are left unspecified. 2.Parameter verification failed. + * @throws { BusinessError } 24700101 - All unknown errors. + * @throws { BusinessError } 24700201 - Service fatal error e.g. service died. + * @syscap SystemCapability.Multimedia.Drm.Core + * @since 12 + */ + function getMediaKeySystemUuid(name: string): string; + /** + * Get all media key systems supported. + * @returns { MediaKeySystemDescription[] } The MediaKeySystem name and uuid info list. + * @throws { BusinessError } 24700101 - All unknown errors. + * @throws { BusinessError } 24700201 - Service fatal error e.g. service died. + * @syscap SystemCapability.Multimedia.Drm.Core + * @since 12 + */ + function getMediaKeySystems(): MediaKeySystemDescription[]; + /** + * Creates a MediaKeySystem instance. + * @param { string } name - Used to point a Digital Right Management solution. + * @returns { MediaKeySystem } The MediaKeySystem instance. + * @throws { BusinessError } 401 - The parameter check failed. Possibly because: + * 1.Mandatory parameters are left unspecified. 2.Parameter verification failed. + * @throws { BusinessError } 24700101 - All unknown errors. + * @throws { BusinessError } 24700103 - Meet max MediaKeySystem num limit. + * @throws { BusinessError } 24700201 - Service fatal error e.g. service died. + * @syscap SystemCapability.Multimedia.Drm.Core + * @since 11 + */ + function createMediaKeySystem(name: string): MediaKeySystem; + /** + * Judge whether a system that specifies name, mimetype and content protection level is supported. + * @param { string } name - Used to point a Digital Right Management solution. + * @param { string } mimeType - Used to specifies the media type. + * @param { ContentProtectionLevel } level - Used to specifies the ContentProtectionLevel. + * @returns { boolean } Whether these conditions will be met. + * @throws { BusinessError } 401 - The parameter check failed. Possibly because: + * 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types. + * 3.Parameter verification failed. + * @throws { BusinessError } 24700101 - All unknown errors. + * @throws { BusinessError } 24700201 - Service fatal error e.g. service died. + * @syscap SystemCapability.Multimedia.Drm.Core + * @since 11 + */ + function isMediaKeySystemSupported(name: string, mimeType: string, level: ContentProtectionLevel): boolean; + /** + * Judge whether a system that specifies name, mimetype is supported. + * @param { string } name - Used to point a Digital Right Management solution. + * @param { string } mimeType - Used to specifies the media type. + * @returns { boolean } Whether these conditions will be met. + * @throws { BusinessError } 401 - The parameter check failed. Possibly because: + * 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types. + * 3.Parameter verification failed. + * @throws { BusinessError } 24700101 - All unknown errors. + * @throws { BusinessError } 24700201 - Service fatal error e.g. service died. + * @syscap SystemCapability.Multimedia.Drm.Core + * @since 11 + */ + function isMediaKeySystemSupported(name: string, mimeType: string): boolean; + /** + * Judge whether a system that specifies name is supported. + * @param { string } name - Used to point a Digital Right Management solution. + * @returns { boolean } Whether these conditions will be met. + * @throws { BusinessError } 401 - The parameter check failed. Possibly because: + * 1.Mandatory parameters are left unspecified. 2.Parameter verification failed, + * the param name's length is zero or too big(exceeds 4096 Bytes). + * @throws { BusinessError } 24700101 - All unknown errors. + * @throws { BusinessError } 24700201 - Service fatal error e.g. service died. + * @syscap SystemCapability.Multimedia.Drm.Core + * @since 11 + */ + function isMediaKeySystemSupported(name: string): boolean; + /** + * Manages and record MediaKeySessions. Before calling an MediaKeySystem method, we must use getMediaKeySystem + * to get a MediaKeySystem instance, then we can call functions. + * @interface MediaKeySystem + * @syscap SystemCapability.Multimedia.Drm.Core + * @since 11 + * + */ + interface MediaKeySystem { + /** + * Get the specified configuration. + * @param { string } configName - Used to specify the config name. + * @returns { string } The config value string. + * @throws { BusinessError } 401 - The parameter check failed. Possibly because: + * 1.Mandatory parameters are left unspecified. 2.Parameter verification failed, + * the param's length is zero or too big(exceeds 4096 Bytes). + * @throws { BusinessError } 24700101 - All unknown errors. + * @throws { BusinessError } 24700201 - Service fatal error e.g. service died. + * @syscap SystemCapability.Multimedia.Drm.Core + * @since 11 + */ + getConfigurationString(configName: string): string; + /** + * Set the specified configuration. + * @param { string } configName - Used to specify the config name. + * @param { string } value - The value to be set. + * @throws { BusinessError } 401 - The parameter check failed. Possibly because: + * 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types. + * 3.Parameter verification failed. + * @throws { BusinessError } 24700101 - All unknown errors. + * @throws { BusinessError } 24700201 - Service fatal error e.g. service died. + * @syscap SystemCapability.Multimedia.Drm.Core + * @since 11 + */ + setConfigurationString(configName: string, value: string): void; + /** + * Get the specified configuration. + * @param { string } configName - Used to specify the config name. + * @returns { Uint8Array } The config value. + * @throws { BusinessError } 401 - The parameter check failed. Possibly because: + * 1.Mandatory parameters are left unspecified. 2.Parameter verification failed. + * @throws { BusinessError } 24700101 - All unknown errors. + * @throws { BusinessError } 24700201 - Service fatal error e.g. service died. + * @syscap SystemCapability.Multimedia.Drm.Core + * @since 11 + */ + getConfigurationByteArray(configName: string): Uint8Array; + /** + * Set the specified configuration. + * @param { string } configName - Used to specify the config name. + * @param { Uint8Array } value - The value to be set. + * @throws { BusinessError } 401 - The parameter check failed. Possibly because: + * 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types. + * 3.Parameter verification failed. + * @throws { BusinessError } 24700101 - All unknown errors. + * @throws { BusinessError } 24700201 - Service fatal error e.g. service died. + * @syscap SystemCapability.Multimedia.Drm.Core + * @since 11 + */ + setConfigurationByteArray(configName: string, value: Uint8Array): void; + /** + * Get performance statistics information.That includes currentSessionNum, version, decryptNumber, + * and errorDecryptNumber. + * @returns { StatisticKeyValue[] } A list that includes performance index and corresponding statistics. + * @throws { BusinessError } 24700101 - All unknown errors. + * @throws { BusinessError } 24700201 - Service fatal error e.g. service died. + * @syscap SystemCapability.Multimedia.Drm.Core + * @since 11 + */ + getStatistics(): StatisticKeyValue[]; + /** + * Get max content protection level the device supports. + * @returns { ContentProtectionLevel } The max content protection level of the MediaKeySystem instance. + * @throws { BusinessError } 24700101 - All unknown errors. + * @throws { BusinessError } 24700201 - Service fatal error e.g. service died. + * @syscap SystemCapability.Multimedia.Drm.Core + * @since 11 + */ + getMaxContentProtectionLevel(): ContentProtectionLevel; + /** + * Generate a media key system provision request. + * @returns { Promise } Promise with ProvisionRequest used to return the result. + * @throws { BusinessError } 24700101 - All unknown errors. + * @throws { BusinessError } 24700201 - Service fatal error e.g. service died. + * @syscap SystemCapability.Multimedia.Drm.Core + * @since 11 + */ + generateKeySystemRequest(): Promise; + /** + * Process the response corresponding the key system request obtained by the application. + * @param { Uint8Array } response - Response corresponding to the request. + * @returns { Promise } Promise used to return the result. + * @throws { BusinessError } 401 - The parameter check failed. Possibly because: + * 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types. + * 3.Parameter verification failed. + * @throws { BusinessError } 24700101 - All unknown errors. + * @throws { BusinessError } 24700201 - Service fatal error e.g. service died. + * @syscap SystemCapability.Multimedia.Drm.Core + * @since 11 + */ + processKeySystemResponse(response: Uint8Array): Promise; + /** + * Get certificate status of the MediaKeySystem. + * @returns { CertificateStatus } Certificate Status of the MediaKeySystem instance. + * @throws { BusinessError } 24700101 - All unknown errors. + * @throws { BusinessError } 24700201 - Service fatal error e.g. service died. + * @syscap SystemCapability.Multimedia.Drm.Core + * @since 11 + */ + getCertificateStatus(): CertificateStatus; + /** + * Register keySystemRequired events. + * @param { 'keySystemRequired' } type - Type of the drm event to listen for. + * @param { function } callback - Used to listen for the key system required event. + * @throws { BusinessError } 401 - The parameter check failed. Possibly because: + * 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types. + * @throws { BusinessError } 24700101 - All unknown errors. + * @syscap SystemCapability.Multimedia.Drm.Core + * @since 11 + */ + on(type: 'keySystemRequired', callback: (eventInfo: EventInfo) => void): void; + /** + * Unregister keySystemRequired events. + * @param { 'keySystemRequired' } type - Type of the drm event to listen for. + * @param { function } callback - Used to listen for the key system required event. + * @throws { BusinessError } 401 - The parameter check failed. Possibly because: + * 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types. + * @throws { BusinessError } 24700101 - All unknown errors. + * @syscap SystemCapability.Multimedia.Drm.Core + * @since 11 + */ + off(type: 'keySystemRequired', callback?: (eventInfo: EventInfo) => void): void; + /** + * Create a MediaKeySession instance with level. + * @param { ContentProtectionLevel } level - Used to specify the content protection level. + * @returns { MediaKeySession } A MediaKeySession instance. + * @throws { BusinessError } 401 - The parameter check failed. Possibly because: + * 1.Mandatory parameters are left unspecified. 2.The param level exceeds reasonable range, + * please use value in ContentProtectionLevel. + * @throws { BusinessError } 24700101 - All unknown errors. + * @throws { BusinessError } 24700104 - Meet max MediaKeySession num limit. + * @throws { BusinessError } 24700201 - Service fatal error e.g. service died. + * @syscap SystemCapability.Multimedia.Drm.Core + * @since 11 + */ + createMediaKeySession(level: ContentProtectionLevel): MediaKeySession; + /** + * Create a MediaKeySession instance. + * @returns { MediaKeySession } A MediaKeySession instance. + * @throws { BusinessError } 24700101 - All unknown errors. + * @throws { BusinessError } 24700104 - Meet max MediaKeySession num limit. + * @throws { BusinessError } 24700201 - Service fatal error e.g. service died. + * @syscap SystemCapability.Multimedia.Drm.Core + * @since 11 + */ + createMediaKeySession(): MediaKeySession; + /** + * Get the list of offline MediaKeyIds. + * @returns { Uint8Array[] } The list of offline MediaKeyIds. + * @throws { BusinessError } 24700101 - All unknown errors. + * @throws { BusinessError } 24700201 - Service fatal error e.g. service died. + * @syscap SystemCapability.Multimedia.Drm.Core + * @since 11 + */ + getOfflineMediaKeyIds(): Uint8Array[]; + /** + * Get offline media key status corresponding to the mediaKeyId. + * @param { Uint8Array } mediaKeyId - The media key identifier. + * @returns { OfflineMediaKeyStatus } Offline media key Status. + * @throws { BusinessError } 401 - The parameter check failed. Possibly because: + * 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types. + * 3.Parameter verification failed. + * @throws { BusinessError } 24700101 - All unknown errors. + * @throws { BusinessError } 24700201 - Service fatal error e.g. service died. + * @syscap SystemCapability.Multimedia.Drm.Core + * @since 11 + */ + getOfflineMediaKeyStatus(mediaKeyId: Uint8Array): OfflineMediaKeyStatus; + /** + * Remove media key corresponding to the mediaKeyId. + * @param { Uint8Array } mediaKeyId - The mediaKeyId specifies which media key should be clear. + * @throws { BusinessError } 401 - The parameter check failed.Possibly because: + * 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types. + * @throws { BusinessError } 24700101 - All unknown errors. + * @throws { BusinessError } 24700201 - Service fatal error e.g. service died. + * @syscap SystemCapability.Multimedia.Drm.Core + * @since 11 + */ + clearOfflineMediaKeys(mediaKeyId: Uint8Array): void; + /** + * Release the resource before the MediaKeySystem gonna be unused. + * @throws { BusinessError } 24700101 - All unknown errors. + * @throws { BusinessError } 24700201 - Service fatal error e.g. service died. + * @syscap SystemCapability.Multimedia.Drm.Core + * @since 11 + */ + destroy(): void; + } + /** + * Provide functions and keep a decrypt module. Before calling an MediaKeySession method, we must + * use MediaKeySystem's createMediaKeySession to get a MediaKeySession instance. + * @interface MediaKeySession + * @syscap SystemCapability.Multimedia.Drm.Core + * @since 11 + */ + /** + * Provide functions and keep a decrypt module. Before calling an MediaKeySession method, we must + * use MediaKeySystem's createMediaKeySession to get a MediaKeySession instance. + * @interface MediaKeySession + * @syscap SystemCapability.Multimedia.Drm.Core + * @atomicservice + * @since 12 + */ + interface MediaKeySession { + /** + * Generate the media key request. + * @param { string } mimeType - Media type. + * @param { Uint8Array } initData - PSSH info. + * @param { number } mediaKeyType - Offline or online. + * @param { OptionsData[] } options - Optional data the application set to drm framework. + * @returns { Promise } Promise with MediaKeyRequest used to return the result. + * @throws { BusinessError } 401 -The parameter check failed. Possibly because: + * 1.Mandatory parameters are left unspecified or too many parameters. 2.Incorrect parameter types. + * 3.Parameter verification failed. + * @throws { BusinessError } 24700101 - All unknown errors. + * @throws { BusinessError } 24700201 - Service fatal error e.g. service died. + * @syscap SystemCapability.Multimedia.Drm.Core + * @since 11 + */ + /** + * Generate the media key request. + * @param { string } mimeType - Media type. + * @param { Uint8Array } initData - PSSH info. + * @param { number } mediaKeyType - Offline or online. + * @param { OptionsData[] } options - Optional data the application set to drm framework. + * @returns { Promise } Promise with MediaKeyRequest used to return the result. + * @throws { BusinessError } 401 -The parameter check failed. Possibly because: + * 1.Mandatory parameters are left unspecified or too many parameters. 2.Incorrect parameter types. + * 3.Parameter verification failed. + * @throws { BusinessError } 24700101 - All unknown errors. + * @throws { BusinessError } 24700201 - Service fatal error e.g. service died. + * @syscap SystemCapability.Multimedia.Drm.Core + * @atomicservice + * @since 12 + */ + generateMediaKeyRequest(mimeType: string, initData: Uint8Array, mediaKeyType: number, options?: OptionsData[]): Promise; + /** + * Process the response corresponding to the media key request obtained by the application. + * @param { Uint8Array } response - The response. + * @returns { Promise } Promise with media key identifier in Uint8ARRY used to return the result. + * @throws { BusinessError } 401 - The parameter check failed. Possibly because: + * 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types. + * 3.Parameter verification failed. + * @throws { BusinessError } 24700101 - All unknown errors. + * @throws { BusinessError } 24700201 - Service fatal error e.g. service died. + * @syscap SystemCapability.Multimedia.Drm.Core + * @since 11 + */ + /** + * Process the response corresponding to the media key request obtained by the application. + * @param { Uint8Array } response - The response. + * @returns { Promise } Promise with media key identifier in Uint8ARRY used to return the result. + * @throws { BusinessError } 401 - The parameter check failed. Possibly because: + * 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types. + * 3.Parameter verification failed. + * @throws { BusinessError } 24700101 - All unknown errors. + * @throws { BusinessError } 24700201 - Service fatal error e.g. service died. + * @syscap SystemCapability.Multimedia.Drm.Core + * @atomicservice + * @since 12 + */ + processMediaKeyResponse(response: Uint8Array): Promise; + /** + * Check the media key status + * @returns { MediaKeyStatus[] } A list of media key status description pairs. + * @throws { BusinessError } 24700101 - All unknown errors. + * @throws { BusinessError } 24700201 - Service fatal error e.g. service died. + * @syscap SystemCapability.Multimedia.Drm.Core + * @since 11 + */ + /** + * Check the media key status + * @returns { MediaKeyStatus[] } A list of media key status description pairs. + * @throws { BusinessError } 24700101 - All unknown errors. + * @throws { BusinessError } 24700201 - Service fatal error e.g. service died. + * @syscap SystemCapability.Multimedia.Drm.Core + * @atomicservice + * @since 12 + */ + checkMediaKeyStatus(): MediaKeyStatus[]; + /** + * Remove media key. + * @throws { BusinessError } 24700101 - All unknown errors. + * @throws { BusinessError } 24700201 - Service fatal error e.g. service died. + * @syscap SystemCapability.Multimedia.Drm.Core + * @since 11 + */ + /** + * Remove media key. + * @throws { BusinessError } 24700101 - All unknown errors. + * @throws { BusinessError } 24700201 - Service fatal error e.g. service died. + * @syscap SystemCapability.Multimedia.Drm.Core + * @atomicservice + * @since 12 + */ + clearMediaKeys(): void; + /** + * Generate offline media key request. + * @param { Uint8Array } mediaKeyId - The mediaKeyId specifies which media content's media key request + * should be generated. + * @returns { Promise } Promise with media key request in Uint8Array used to return the result. + * @throws { BusinessError } 401 - The parameter check failed. Possibly because: + * 1.Mandatory parameters are left unspecified or too many parameters. 2.Incorrect parameter types. + * 3.Parameter verification failed. + * @throws { BusinessError } 24700101 - All unknown errors. + * @throws { BusinessError } 24700201 - Service fatal error e.g. service died. + * @syscap SystemCapability.Multimedia.Drm.Core + * @since 11 + */ + /** + * Generate offline media key request. + * @param { Uint8Array } mediaKeyId - The mediaKeyId specifies which media content's media key request + * should be generated. + * @returns { Promise } Promise with media key request in Uint8Array used to return the result. + * @throws { BusinessError } 401 - The parameter check failed. Possibly because: + * 1.Mandatory parameters are left unspecified or too many parameters. 2.Incorrect parameter types. + * 3.Parameter verification failed. + * @throws { BusinessError } 24700101 - All unknown errors. + * @throws { BusinessError } 24700201 - Service fatal error e.g. service died. + * @syscap SystemCapability.Multimedia.Drm.Core + * @atomicservice + * @since 12 + */ + generateOfflineReleaseRequest(mediaKeyId: Uint8Array): Promise; + /** + * Process offline media key response. + * @param { Uint8Array } mediaKeyId - The mediaKeyId specifies which media content's media key it is. + * @param { Uint8Array } response - The offline media key. + * @returns { Promise } Promise used to return the result. + * @throws { BusinessError } 401 - The parameter check failed. Possibly because: + * 1.Mandatory parameters are left unspecified or too many parameters. 2.Incorrect parameter types. + * 3.Parameter verification failed. + * @throws { BusinessError } 24700101 - All unknown errors. + * @throws { BusinessError } 24700201 - Service fatal error e.g. service died. + * @syscap SystemCapability.Multimedia.Drm.Core + * @since 11 + */ + /** + * Process offline media key response. + * @param { Uint8Array } mediaKeyId - The mediaKeyId specifies which media content's media key it is. + * @param { Uint8Array } response - The offline media key. + * @returns { Promise } Promise used to return the result. + * @throws { BusinessError } 401 - The parameter check failed. Possibly because: + * 1.Mandatory parameters are left unspecified or too many parameters. 2.Incorrect parameter types. + * 3.Parameter verification failed. + * @throws { BusinessError } 24700101 - All unknown errors. + * @throws { BusinessError } 24700201 - Service fatal error e.g. service died. + * @syscap SystemCapability.Multimedia.Drm.Core + * @atomicservice + * @since 12 + */ + processOfflineReleaseResponse(mediaKeyId: Uint8Array, response: Uint8Array): Promise; + /** + * Restore offline media key. + * @param { Uint8Array } mediaKeyId - The mediaKeyId specifies which media key should be restore. + * @returns { Promise } Promise used to return the result. + * @throws { BusinessError } 401 - The parameter check failed. Possibly because: + * 1.Mandatory parameters are left unspecified or too many parameters. 2.Incorrect parameter types. + * 3.Parameter verification failed. + * @throws { BusinessError } 24700101 - All unknown errors. + * @throws { BusinessError } 24700201 - Service fatal error e.g. service died. + * @syscap SystemCapability.Multimedia.Drm.Core + * @since 11 + */ + /** + * Restore offline media key. + * @param { Uint8Array } mediaKeyId - The mediaKeyId specifies which media key should be restore. + * @returns { Promise } Promise used to return the result. + * @throws { BusinessError } 401 - The parameter check failed. Possibly because: + * 1.Mandatory parameters are left unspecified or too many parameters. 2.Incorrect parameter types. + * 3.Parameter verification failed. + * @throws { BusinessError } 24700101 - All unknown errors. + * @throws { BusinessError } 24700201 - Service fatal error e.g. service died. + * @syscap SystemCapability.Multimedia.Drm.Core + * @atomicservice + * @since 12 + */ + restoreOfflineMediaKeys(mediaKeyId: Uint8Array): Promise; + /** + * Get content protection level. + * @returns { ContentProtectionLevel } MediaKeySession content protection level. + * @throws { BusinessError } 24700101 - All unknown errors. + * @throws { BusinessError } 24700201 - Service fatal error e.g. service died. + * @syscap SystemCapability.Multimedia.Drm.Core + * @since 11 + */ + /** + * Get content protection level. + * @returns { ContentProtectionLevel } MediaKeySession content protection level. + * @throws { BusinessError } 24700101 - All unknown errors. + * @throws { BusinessError } 24700201 - Service fatal error e.g. service died. + * @syscap SystemCapability.Multimedia.Drm.Core + * @atomicservice + * @since 12 + */ + getContentProtectionLevel(): ContentProtectionLevel; + /** + * Whether the encrypted content require a secure decoder or not. + * @param { string } mimeType - The media type. + * @returns { boolean } Whether secure decoder is required. + * @throws { BusinessError } 401 - The parameter check failed. Possibly because: + * 1.Mandatory parameters are left unspecified or too many parameters. 2.Incorrect parameter types. + * 3.Parameter verification failed. + * @throws { BusinessError } 24700101 - All unknown errors. + * @throws { BusinessError } 24700201 - Service fatal error e.g. service died. + * @syscap SystemCapability.Multimedia.Drm.Core + * @since 11 + */ + /** + * Whether the encrypted content require a secure decoder or not. + * @param { string } mimeType - The media type. + * @returns { boolean } Whether secure decoder is required. + * @throws { BusinessError } 401 - The parameter check failed. Possibly because: + * 1.Mandatory parameters are left unspecified or too many parameters. 2.Incorrect parameter types. + * 3.Parameter verification failed. + * @throws { BusinessError } 24700101 - All unknown errors. + * @throws { BusinessError } 24700201 - Service fatal error e.g. service died. + * @syscap SystemCapability.Multimedia.Drm.Core + * @atomicservice + * @since 12 + */ + requireSecureDecoderModule(mimeType: string): boolean; + /** + * Register keyRequired event. + * @param { 'keyRequired' } type - Type of the drm event to listen for. + * @param { function } callback used to listen for the key required event. + * @throws { BusinessError } 401 - The parameter check failed. Possibly because: + * 1.Mandatory parameters are left unspecified or too many parameters. 2.Incorrect parameter types. + * 3.Parameter verification failed. + * @throws { BusinessError } 24700101 - All unknown errors. + * @syscap SystemCapability.Multimedia.Drm.Core + * @since 11 + */ + /** + * Register keyRequired event. + * @param { 'keyRequired' } type - Type of the drm event to listen for. + * @param { function } callback used to listen for the key required event. + * @throws { BusinessError } 401 - The parameter check failed. Possibly because: + * 1.Mandatory parameters are left unspecified or too many parameters. 2.Incorrect parameter types. + * 3.Parameter verification failed. + * @throws { BusinessError } 24700101 - All unknown errors. + * @syscap SystemCapability.Multimedia.Drm.Core + * @atomicservice + * @since 12 + */ + on(type: 'keyRequired', callback: (eventInfo: EventInfo) => void): void; + /** + * Unregister keyRequired event. + * @param { 'keyRequired' } type - Type of the drm event to listen for. + * @param { function } callback used to listen for the key required event. + * @throws { BusinessError } 401 - The parameter check failed. Possibly because: + * 1.Mandatory parameters are left unspecified or too many parameters. 2.Incorrect parameter types. + * 3.Parameter verification failed. + * @throws { BusinessError } 24700101 - All unknown errors. + * @syscap SystemCapability.Multimedia.Drm.Core + * @since 11 + */ + /** + * Unregister keyRequired event. + * @param { 'keyRequired' } type - Type of the drm event to listen for. + * @param { function } callback used to listen for the key required event. + * @throws { BusinessError } 401 - The parameter check failed. Possibly because: + * 1.Mandatory parameters are left unspecified or too many parameters. 2.Incorrect parameter types. + * 3.Parameter verification failed. + * @throws { BusinessError } 24700101 - All unknown errors. + * @syscap SystemCapability.Multimedia.Drm.Core + * @atomicservice + * @since 12 + */ + off(type: 'keyRequired', callback?: (eventInfo: EventInfo) => void): void; + /** + * Register keyExpired event. + * @param { 'keyExpired' } type - Type of the drm event to listen for. + * @param { function } callback - Used to listen for the key required event. + * @throws { BusinessError } 401 - The parameter check failed. Possibly because: + * 1.Mandatory parameters are left unspecified or too many parameters. 2.Incorrect parameter types. + * 3.Parameter verification failed. + * @throws { BusinessError } 24700101 - All unknown errors. + * @syscap SystemCapability.Multimedia.Drm.Core + * @since 11 + */ + /** + * Register keyExpired event. + * @param { 'keyExpired' } type - Type of the drm event to listen for. + * @param { function } callback - Used to listen for the key required event. + * @throws { BusinessError } 401 - The parameter check failed. Possibly because: + * 1.Mandatory parameters are left unspecified or too many parameters. 2.Incorrect parameter types. + * 3.Parameter verification failed. + * @throws { BusinessError } 24700101 - All unknown errors. + * @syscap SystemCapability.Multimedia.Drm.Core + * @atomicservice + * @since 12 + */ + on(type: 'keyExpired', callback: (eventInfo: EventInfo) => void): void; + /** + * Unregister keyExpired event. + * @param { 'keyExpired' } type - Type of the drm event to listen for. + * @param { function } callback - Used to listen for the key required event. + * @throws { BusinessError } 401 - The parameter check failed. Possibly because: + * 1.Mandatory parameters are left unspecified or too many parameters. 2.Incorrect parameter types. + * 3.Parameter verification failed. + * @throws { BusinessError } 24700101 - All unknown errors. + * @syscap SystemCapability.Multimedia.Drm.Core + * @since 11 + */ + /** + * Unregister keyExpired event. + * @param { 'keyExpired' } type - Type of the drm event to listen for. + * @param { function } callback - Used to listen for the key required event. + * @throws { BusinessError } 401 - The parameter check failed. Possibly because: + * 1.Mandatory parameters are left unspecified or too many parameters. 2.Incorrect parameter types. + * 3.Parameter verification failed. + * @throws { BusinessError } 24700101 - All unknown errors. + * @syscap SystemCapability.Multimedia.Drm.Core + * @atomicservice + * @since 12 + */ + off(type: 'keyExpired', callback?: (eventInfo: EventInfo) => void): void; + /** + * Register vendorDefined event. + * @param { 'vendorDefined' } type - Type of the drm event to listen for. + * @param { function } callback - Used to listen for the vendor defined event. + * @throws { BusinessError } 401 - The parameter check failed. Possibly because: + * 1.Mandatory parameters are left unspecified or too many parameters. 2.Incorrect parameter types. + * 3.Parameter verification failed. + * @throws { BusinessError } 24700101 - All unknown errors. + * @syscap SystemCapability.Multimedia.Drm.Core + * @since 11 + */ + /** + * Register vendorDefined event. + * @param { 'vendorDefined' } type - Type of the drm event to listen for. + * @param { function } callback - Used to listen for the vendor defined event. + * @throws { BusinessError } 401 - The parameter check failed. Possibly because: + * 1.Mandatory parameters are left unspecified or too many parameters. 2.Incorrect parameter types. + * 3.Parameter verification failed. + * @throws { BusinessError } 24700101 - All unknown errors. + * @syscap SystemCapability.Multimedia.Drm.Core + * @atomicservice + * @since 12 + */ + on(type: 'vendorDefined', callback: (eventInfo: EventInfo) => void): void; + /** + * Unregister vendorDefined event. + * @param { 'vendorDefined' } type - Type of the drm event to listen for. + * @param { function } callback - Used to listen for the vendor defined event. + * @throws { BusinessError } 401 - The parameter check failed. Possibly because: + * 1.Mandatory parameters are left unspecified or too many parameters. 2.Incorrect parameter types. + * 3.Parameter verification failed. + * @throws { BusinessError } 24700101 - All unknown errors. + * @syscap SystemCapability.Multimedia.Drm.Core + * @since 11 + */ + /** + * Unregister vendorDefined event. + * @param { 'vendorDefined' } type - Type of the drm event to listen for. + * @param { function } callback - Used to listen for the vendor defined event. + * @throws { BusinessError } 401 - The parameter check failed. Possibly because: + * 1.Mandatory parameters are left unspecified or too many parameters. 2.Incorrect parameter types. + * 3.Parameter verification failed. + * @throws { BusinessError } 24700101 - All unknown errors. + * @syscap SystemCapability.Multimedia.Drm.Core + * @atomicservice + * @since 12 + */ + off(type: 'vendorDefined', callback?: (eventInfo: EventInfo) => void): void; + /** + * Register expirationUpdate event. + * @param { 'expirationUpdate' } type - Type of the drm event to listen for. + * @param { function } callback - Used to listen for expiration update event. + * @throws { BusinessError } 401 - The parameter check failed. Possibly because: + * 1.Mandatory parameters are left unspecified or too many parameters. 2.Incorrect parameter types. + * 3.Parameter verification failed. + * @throws { BusinessError } 24700101 - All unknown errors. + * @syscap SystemCapability.Multimedia.Drm.Core + * @since 11 + */ + /** + * Register expirationUpdate event. + * @param { 'expirationUpdate' } type - Type of the drm event to listen for. + * @param { function } callback - Used to listen for expiration update event. + * @throws { BusinessError } 401 - The parameter check failed. Possibly because: + * 1.Mandatory parameters are left unspecified or too many parameters. 2.Incorrect parameter types. + * 3.Parameter verification failed. + * @throws { BusinessError } 24700101 - All unknown errors. + * @syscap SystemCapability.Multimedia.Drm.Core + * @atomicservice + * @since 12 + */ + on(type: 'expirationUpdate', callback: (eventInfo: EventInfo) => void): void; + /** + * Unregister expirationUpdate event. + * @param { 'expirationUpdate' } type - Type of the drm event to listen for. + * @param { function } callback - Used to listen for expiration update event. + * @throws { BusinessError } 401 - The parameter check failed. Possibly because: + * 1.Mandatory parameters are left unspecified or too many parameters. 2.Incorrect parameter types. + * 3.Parameter verification failed. + * @throws { BusinessError } 24700101 - All unknown errors. + * @syscap SystemCapability.Multimedia.Drm.Core + * @since 11 + */ + /** + * Unregister expirationUpdate event. + * @param { 'expirationUpdate' } type - Type of the drm event to listen for. + * @param { function } callback - Used to listen for expiration update event. + * @throws { BusinessError } 401 - The parameter check failed. Possibly because: + * 1.Mandatory parameters are left unspecified or too many parameters. 2.Incorrect parameter types. + * 3.Parameter verification failed. + * @throws { BusinessError } 24700101 - All unknown errors. + * @syscap SystemCapability.Multimedia.Drm.Core + * @atomicservice + * @since 12 + */ + off(type: 'expirationUpdate', callback?: (eventInfo: EventInfo) => void): void; + /** + * Register keysChange event. + * @param { 'keysChange' } type - Type of the drm event to listen for. + * @param { function } callback - Used to listen for keys change event. + * @throws { BusinessError } 401 - The parameter check failed. Possibly because: + * 1.Mandatory parameters are left unspecified or too many parameters. 2.Incorrect parameter types. + * 3.Parameter verification failed. + * @throws { BusinessError } 24700101 - All unknown errors. + * @syscap SystemCapability.Multimedia.Drm.Core + * @since 11 + */ + /** + * Register keysChange event. + * @param { 'keysChange' } type - Type of the drm event to listen for. + * @param { function } callback - Used to listen for keys change event. + * @throws { BusinessError } 401 - The parameter check failed. Possibly because: + * 1.Mandatory parameters are left unspecified or too many parameters. 2.Incorrect parameter types. + * 3.Parameter verification failed. + * @throws { BusinessError } 24700101 - All unknown errors. + * @syscap SystemCapability.Multimedia.Drm.Core + * @atomicservice + * @since 12 + */ + on(type: 'keysChange', callback: (keyInfo: KeysInfo[], newKeyAvailable: boolean) => void): void; + /** + * Unregister keysChange event. + * @param { 'keysChange' } type - Type of the drm event to listen for. + * @param { function } callback - Used to listen for keys change event. + * @throws { BusinessError } 401 - The parameter check failed. Possibly because: + * 1.Mandatory parameters are left unspecified or too many parameters. 2.Incorrect parameter types. + * 3.Parameter verification failed. + * @throws { BusinessError } 24700101 - All unknown errors. + * @syscap SystemCapability.Multimedia.Drm.Core + * @since 11 + */ + /** + * Unregister keysChange event. + * @param { 'keysChange' } type - Type of the drm event to listen for. + * @param { function } callback - Used to listen for keys change event. + * @throws { BusinessError } 401 - The parameter check failed. Possibly because: + * 1.Mandatory parameters are left unspecified or too many parameters. 2.Incorrect parameter types. + * 3.Parameter verification failed. + * @throws { BusinessError } 24700101 - All unknown errors. + * @syscap SystemCapability.Multimedia.Drm.Core + * @atomicservice + * @since 12 + */ + off(type: 'keysChange', callback?: (keyInfo: KeysInfo[], newKeyAvailable: boolean) => void): void; + /** + * Release the resource before the session gonna be unused. + * @throws { BusinessError } 24700101 - All unknown errors. + * @throws { BusinessError } 24700201 - Service fatal error e.g. service died. + * @syscap SystemCapability.Multimedia.Drm.Core + * @since 11 + */ + /** + * Release the resource before the session gonna be unused. + * @throws { BusinessError } 24700101 - All unknown errors. + * @throws { BusinessError } 24700201 - Service fatal error e.g. service died. + * @syscap SystemCapability.Multimedia.Drm.Core + * @atomicservice + * @since 12 + */ + destroy(): void; + } +} +export default drm; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.multimedia.image.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.multimedia.image.d.ts new file mode 100755 index 00000000..63f53e6c --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.multimedia.image.d.ts @@ -0,0 +1,7072 @@ +/* + * Copyright (C) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit ImageKit + */ +import { AsyncCallback } from './@ohos.base'; +import type colorSpaceManager from './@ohos.graphics.colorSpaceManager'; +import type resourceManager from './@ohos.resourceManager'; +import type rpc from './@ohos.rpc'; +/** + * @namespace image + * @since 6 + */ +/** + * This module provides the capability of image codec and access + * @namespace image + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @atomicservice + * @since 11 + */ +/** + * This module provides the capability of image codec and access + * @namespace image + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @form + * @atomicservice + * @since 12 + */ +declare namespace image { + /** + * Enumerates pixel map formats. + * + * @enum { number } + * @syscap SystemCapability.Multimedia.Image.Core + * @since 7 + */ + /** + * Enumerates pixel map formats. + * + * @enum { number } + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 10 + */ + /** + * Enumerates pixel map formats. + * + * @enum { number } + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @atomicservice + * @since 11 + */ + /** + * Enumerates pixel map formats. + * + * @enum { number } + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @form + * @atomicservice + * @since 12 + */ + enum PixelMapFormat { + /** + * Indicates an unknown format. + * + * @syscap SystemCapability.Multimedia.Image.Core + * @since 7 + */ + /** + * Indicates an unknown format. + * + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 10 + */ + /** + * Indicates an unknown format. + * + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @atomicservice + * @since 11 + */ + /** + * Indicates an unknown format. + * + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @form + * @atomicservice + * @since 12 + */ + UNKNOWN = 0, + /** + * Indicates that each pixel is stored on 16 bits. Only the R, G, and B components are encoded + * from the higher-order to the lower-order bits: red is stored with 5 bits of precision, + * green is stored with 6 bits of precision, and blue is stored with 5 bits of precision. + * + * @syscap SystemCapability.Multimedia.Image.Core + * @since 7 + */ + /** + * Indicates that each pixel is stored on 16 bits. Only the R, G, and B components are encoded + * from the higher-order to the lower-order bits: red is stored with 5 bits of precision, + * green is stored with 6 bits of precision, and blue is stored with 5 bits of precision. + * + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 10 + */ + /** + * Indicates that each pixel is stored on 16 bits. Only the R, G, and B components are encoded + * from the higher-order to the lower-order bits: red is stored with 5 bits of precision, + * green is stored with 6 bits of precision, and blue is stored with 5 bits of precision. + * + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @atomicservice + * @since 11 + */ + /** + * Indicates that each pixel is stored on 16 bits. Only the R, G, and B components are encoded + * from the higher-order to the lower-order bits: red is stored with 5 bits of precision, + * green is stored with 6 bits of precision, and blue is stored with 5 bits of precision. + * + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @form + * @atomicservice + * @since 12 + */ + RGB_565 = 2, + /** + * Indicates that each pixel is stored on 32 bits. Each pixel contains 4 components:B(8bits), G(8bits), R(8bits), A(8bits) + * and are stored from the higher-order to the lower-order bits. + * + * @syscap SystemCapability.Multimedia.Image.Core + * @since 7 + */ + /** + * Indicates that each pixel is stored on 32 bits. Each pixel contains 4 components:B(8bits), G(8bits), R(8bits), A(8bits) + * and are stored from the higher-order to the lower-order bits. + * + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 10 + */ + /** + * Indicates that each pixel is stored on 32 bits. Each pixel contains 4 components:B(8bits), G(8bits), R(8bits), A(8bits) + * and are stored from the higher-order to the lower-order bits. + * + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @atomicservice + * @since 11 + */ + /** + * Indicates that each pixel is stored on 32 bits. Each pixel contains 4 components:B(8bits), G(8bits), R(8bits), A(8bits) + * and are stored from the higher-order to the lower-order bits. + * + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @form + * @atomicservice + * @since 12 + */ + RGBA_8888 = 3, + /** + * Indicates that each pixel is stored on 32 bits. Each pixel contains 4 components:B(8bits), G(8bits), R(8bits), A(8bits) + * and are stored from the higher-order to the lower-order bits. + * + * @syscap SystemCapability.Multimedia.Image.Core + * @since 9 + */ + /** + * Indicates that each pixel is stored on 32 bits. Each pixel contains 4 components:B(8bits), G(8bits), R(8bits), A(8bits) + * and are stored from the higher-order to the lower-order bits. + * + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 10 + */ + /** + * Indicates that each pixel is stored on 32 bits. Each pixel contains 4 components:B(8bits), G(8bits), R(8bits), A(8bits) + * and are stored from the higher-order to the lower-order bits. + * + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @atomicservice + * @since 11 + */ + /** + * Indicates that each pixel is stored on 32 bits. Each pixel contains 4 components:B(8bits), G(8bits), R(8bits), A(8bits) + * and are stored from the higher-order to the lower-order bits. + * + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @form + * @atomicservice + * @since 12 + */ + BGRA_8888 = 4, + /** + * Indicates that each pixel is stored on 24 bits. Each pixel contains 3 components:R(8bits), G(8bits), B(8bits) + * and are stored from the higher-order to the lower-order bits. + * + * @syscap SystemCapability.Multimedia.Image.Core + * @since 9 + */ + /** + * Indicates that each pixel is stored on 24 bits. Each pixel contains 3 components:R(8bits), G(8bits), B(8bits) + * and are stored from the higher-order to the lower-order bits. + * + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 10 + */ + /** + * Indicates that each pixel is stored on 24 bits. Each pixel contains 3 components:R(8bits), G(8bits), B(8bits) + * and are stored from the higher-order to the lower-order bits. + * + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @atomicservice + * @since 11 + */ + /** + * Indicates that each pixel is stored on 24 bits. Each pixel contains 3 components:R(8bits), G(8bits), B(8bits) + * and are stored from the higher-order to the lower-order bits. + * + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @form + * @atomicservice + * @since 12 + */ + RGB_888 = 5, + /** + * Indicates that each pixel is stored on 8 bits. Each pixel contains 1 component:ALPHA(8bits) + * and is stored from the higher-order to the lower-order bits. + * + * @syscap SystemCapability.Multimedia.Image.Core + * @since 9 + */ + /** + * Indicates that each pixel is stored on 8 bits. Each pixel contains 1 component:ALPHA(8bits) + * and is stored from the higher-order to the lower-order bits. + * + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 10 + */ + /** + * Indicates that each pixel is stored on 8 bits. Each pixel contains 1 component:ALPHA(8bits) + * and is stored from the higher-order to the lower-order bits. + * + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @atomicservice + * @since 11 + */ + /** + * Indicates that each pixel is stored on 8 bits. Each pixel contains 1 component:ALPHA(8bits) + * and is stored from the higher-order to the lower-order bits. + * + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @form + * @atomicservice + * @since 12 + */ + ALPHA_8 = 6, + /** + * Indicates that each pixel is stored on 32 bits. Each pixel contains 4 components:B(8bits), G(8bits), R(8bits), A(8bits) + * and are stored from the higher-order to the lower-order bits in F16. + * + * @syscap SystemCapability.Multimedia.Image.Core + * @since 9 + */ + /** + * Indicates that each pixel is stored on 32 bits. Each pixel contains 4 components:B(8bits), G(8bits), R(8bits), A(8bits) + * and are stored from the higher-order to the lower-order bits in F16. + * + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 10 + */ + /** + * Indicates that each pixel is stored on 32 bits. Each pixel contains 4 components:B(8bits), G(8bits), R(8bits), A(8bits) + * and are stored from the higher-order to the lower-order bits in F16. + * + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @atomicservice + * @since 11 + */ + /** + * Indicates that each pixel is stored on 32 bits. Each pixel contains 4 components:B(8bits), G(8bits), R(8bits), A(8bits) + * and are stored from the higher-order to the lower-order bits in F16. + * + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @form + * @atomicservice + * @since 12 + */ + RGBA_F16 = 7, + /** + * Indicates that the storage order is to store Y first and then V U alternately each occupies 8 bits + * and are stored from the higher-order to the lower-order bits. + * + * @syscap SystemCapability.Multimedia.Image.Core + * @since 9 + */ + /** + * Indicates that the storage order is to store Y first and then V U alternately each occupies 8 bits + * and are stored from the higher-order to the lower-order bits. + * + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 10 + */ + /** + * Indicates that the storage order is to store Y first and then V U alternately each occupies 8 bits + * and are stored from the higher-order to the lower-order bits. + * + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @atomicservice + * @since 11 + */ + /** + * Indicates that the storage order is to store Y first and then V U alternately each occupies 8 bits + * and are stored from the higher-order to the lower-order bits. + * + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @form + * @atomicservice + * @since 12 + */ + NV21 = 8, + /** + * Indicates that the storage order is to store Y first and then U V alternately each occupies 8 bits + * and are stored from the higher-order to the lower-order bits. + * + * @syscap SystemCapability.Multimedia.Image.Core + * @since 9 + */ + /** + * Indicates that the storage order is to store Y first and then U V alternately each occupies 8 bits + * and are stored from the higher-order to the lower-order bits. + * + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 10 + */ + /** + * Indicates that the storage order is to store Y first and then U V alternately each occupies 8 bits + * and are stored from the higher-order to the lower-order bits. + * + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @atomicservice + * @since 11 + */ + /** + * Indicates that the storage order is to store Y first and then U V alternately each occupies 8 bits + * and are stored from the higher-order to the lower-order bits. + * + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @form + * @atomicservice + * @since 12 + */ + NV12 = 9 + } + /** + * Describes the size of an image. + * + * @typedef Size + * @syscap SystemCapability.Multimedia.Image.Core + * @since 6 + */ + /** + * Describes the size of an image. + * + * @typedef Size + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 10 + */ + /** + * Describes the size of an image. + * + * @typedef Size + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @atomicservice + * @since 11 + */ + /** + * Describes the size of an image. + * + * @typedef Size + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @form + * @atomicservice + * @since 12 + */ + interface Size { + /** + * Height + * + * @type { number } + * @syscap SystemCapability.Multimedia.Image.Core + * @since 6 + */ + /** + * Height + * + * @type { number } + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 10 + */ + /** + * Height + * + * @type { number } + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @atomicservice + * @since 11 + */ + /** + * Height + * + * @type { number } + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @form + * @atomicservice + * @since 12 + */ + height: number; + /** + * Width + * + * @type { number } + * @syscap SystemCapability.Multimedia.Image.Core + * @since 6 + */ + /** + * Width + * + * @type { number } + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 10 + */ + /** + * Width + * + * @type { number } + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @atomicservice + * @since 11 + */ + /** + * Width + * + * @type { number } + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @form + * @atomicservice + * @since 12 + */ + width: number; + } + /** + * Enumerates exchangeable image file format (Exif) information types of an image. + * + * @enum { string } + * @syscap SystemCapability.Multimedia.Image.Core + * @since 7 + */ + /** + * Enumerates exchangeable image file format (Exif) information types of an image. + * + * @enum { string } + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 10 + */ + enum PropertyKey { + /** + * Number of bits in each pixel of an image. + * + * @syscap SystemCapability.Multimedia.Image.Core + * @since 7 + */ + /** + * Number of bits in each pixel of an image. + * + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 10 + */ + BITS_PER_SAMPLE = 'BitsPerSample', + /** + * Image rotation mode. + * + * @syscap SystemCapability.Multimedia.Image.Core + * @since 7 + */ + /** + * Image rotation mode. + * + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 10 + */ + ORIENTATION = 'Orientation', + /** + * Image length. + * + * @syscap SystemCapability.Multimedia.Image.Core + * @since 7 + */ + /** + * Image length. + * + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 10 + */ + IMAGE_LENGTH = 'ImageLength', + /** + * Image width. + * + * @syscap SystemCapability.Multimedia.Image.Core + * @since 7 + */ + /** + * Image width. + * + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 10 + */ + IMAGE_WIDTH = 'ImageWidth', + /** + * GPS latitude. + * + * @syscap SystemCapability.Multimedia.Image.Core + * @since 7 + */ + /** + * GPS latitude. + * + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 10 + */ + GPS_LATITUDE = 'GPSLatitude', + /** + * GPS longitude. + * + * @syscap SystemCapability.Multimedia.Image.Core + * @since 7 + */ + /** + * GPS longitude. + * + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 10 + */ + GPS_LONGITUDE = 'GPSLongitude', + /** + * GPS latitude reference. For example, N indicates north latitude and S indicates south latitude. + * + * @syscap SystemCapability.Multimedia.Image.Core + * @since 7 + */ + /** + * GPS latitude reference. For example, N indicates north latitude and S indicates south latitude. + * + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 10 + */ + GPS_LATITUDE_REF = 'GPSLatitudeRef', + /** + * GPS longitude reference. For example, E indicates east longitude and W indicates west longitude. + * + * @syscap SystemCapability.Multimedia.Image.Core + * @since 7 + */ + /** + * GPS longitude reference. For example, E indicates east longitude and W indicates west longitude. + * + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 10 + */ + GPS_LONGITUDE_REF = 'GPSLongitudeRef', + /** + * Shooting time + * + * @syscap SystemCapability.Multimedia.Image.Core + * @since 9 + */ + /** + * Shooting time + * + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 10 + */ + DATE_TIME_ORIGINAL = 'DateTimeOriginal', + /** + * Exposure time + * + * @syscap SystemCapability.Multimedia.Image.Core + * @since 9 + */ + /** + * Exposure time + * + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 10 + */ + EXPOSURE_TIME = 'ExposureTime', + /** + * Scene type + * + * @syscap SystemCapability.Multimedia.Image.Core + * @since 9 + */ + /** + * Scene type + * + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 10 + */ + SCENE_TYPE = 'SceneType', + /** + * ISO speedratings + * + * @syscap SystemCapability.Multimedia.Image.Core + * @since 9 + */ + /** + * ISO speedratings + * + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 10 + */ + ISO_SPEED_RATINGS = 'ISOSpeedRatings', + /** + * Aperture value + * + * @syscap SystemCapability.Multimedia.Image.Core + * @since 9 + */ + /** + * Aperture value + * + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 10 + */ + F_NUMBER = 'FNumber', + /** + * Date time + * + * @syscap SystemCapability.Multimedia.Image.Core + * @since 10 + */ + DATE_TIME = 'DateTime', + /** + * GPS time stamp + * + * @syscap SystemCapability.Multimedia.Image.Core + * @since 10 + */ + GPS_TIME_STAMP = 'GPSTimeStamp', + /** + * GPS date stamp + * + * @syscap SystemCapability.Multimedia.Image.Core + * @since 10 + */ + GPS_DATE_STAMP = 'GPSDateStamp', + /** + * Image description + * + * @syscap SystemCapability.Multimedia.Image.Core + * @since 10 + */ + IMAGE_DESCRIPTION = 'ImageDescription', + /** + * Make + * + * @syscap SystemCapability.Multimedia.Image.Core + * @since 10 + */ + MAKE = 'Make', + /** + * Model + * + * @syscap SystemCapability.Multimedia.Image.Core + * @since 10 + */ + MODEL = 'Model', + /** + * Photo mode + * + * @syscap SystemCapability.Multimedia.Image.Core + * @since 10 + */ + PHOTO_MODE = 'PhotoMode', + /** + * Sensitivity type + * + * @syscap SystemCapability.Multimedia.Image.Core + * @since 10 + */ + SENSITIVITY_TYPE = 'SensitivityType', + /** + * Standard output sensitivity + * + * @syscap SystemCapability.Multimedia.Image.Core + * @since 10 + */ + STANDARD_OUTPUT_SENSITIVITY = 'StandardOutputSensitivity', + /** + * Recommended exposure index + * + * @syscap SystemCapability.Multimedia.Image.Core + * @since 10 + */ + RECOMMENDED_EXPOSURE_INDEX = 'RecommendedExposureIndex', + /** + * ISO speed + * + * @syscap SystemCapability.Multimedia.Image.Core + * @since 10 + */ + ISO_SPEED = 'ISOSpeedRatings', + /** + * Aperture value + * + * @syscap SystemCapability.Multimedia.Image.Core + * @since 10 + */ + APERTURE_VALUE = 'ApertureValue', + /** + * Exposure bias value + * + * @syscap SystemCapability.Multimedia.Image.Core + * @since 10 + */ + EXPOSURE_BIAS_VALUE = 'ExposureBiasValue', + /** + * Metering mode + * + * @syscap SystemCapability.Multimedia.Image.Core + * @since 10 + */ + METERING_MODE = 'MeteringMode', + /** + * Light source + * + * @syscap SystemCapability.Multimedia.Image.Core + * @since 10 + */ + LIGHT_SOURCE = 'LightSource', + /** + * Flash + * + * @syscap SystemCapability.Multimedia.Image.Core + * @since 10 + */ + FLASH = 'Flash', + /** + * Focal length + * + * @syscap SystemCapability.Multimedia.Image.Core + * @since 10 + */ + FOCAL_LENGTH = 'FocalLength', + /** + * User comment + * + * @syscap SystemCapability.Multimedia.Image.Core + * @since 10 + */ + USER_COMMENT = 'UserComment', + /** + * Pixel x dimension + * + * @syscap SystemCapability.Multimedia.Image.Core + * @since 10 + */ + PIXEL_X_DIMENSION = 'PixelXDimension', + /** + * Pixel y dimension + * + * @syscap SystemCapability.Multimedia.Image.Core + * @since 10 + */ + PIXEL_Y_DIMENSION = 'PixelYDimension', + /** + * White balance + * + * @syscap SystemCapability.Multimedia.Image.Core + * @since 10 + */ + WHITE_BALANCE = 'WhiteBalance', + /** + * Focal length in 35mm film + * + * @syscap SystemCapability.Multimedia.Image.Core + * @since 10 + */ + FOCAL_LENGTH_IN_35_MM_FILM = 'FocalLengthIn35mmFilm', + /** + * Capture mode + * + * @syscap SystemCapability.Multimedia.Image.Core + * @since 10 + */ + CAPTURE_MODE = 'HwMnoteCaptureMode', + /** + * Physical aperture + * + * @syscap SystemCapability.Multimedia.Image.Core + * @since 10 + */ + PHYSICAL_APERTURE = 'HwMnotePhysicalAperture', + /** + * Roll Angle + * + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 11 + */ + ROLL_ANGLE = 'HwMnoteRollAngle', + /** + * Pitch Angle + * + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 11 + */ + PITCH_ANGLE = 'HwMnotePitchAngle', + /** + * Capture Scene: Food + * + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 11 + */ + SCENE_FOOD_CONF = 'HwMnoteSceneFoodConf', + /** + * Capture Scene: Stage + * + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 11 + */ + SCENE_STAGE_CONF = 'HwMnoteSceneStageConf', + /** + * Capture Scene: Blue Sky + * + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 11 + */ + SCENE_BLUE_SKY_CONF = 'HwMnoteSceneBlueSkyConf', + /** + * Capture Scene: Green Plant + * + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 11 + */ + SCENE_GREEN_PLANT_CONF = 'HwMnoteSceneGreenPlantConf', + /** + * Capture Scene: Beach + * + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 11 + */ + SCENE_BEACH_CONF = 'HwMnoteSceneBeachConf', + /** + * Capture Scene: Snow + * + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 11 + */ + SCENE_SNOW_CONF = 'HwMnoteSceneSnowConf', + /** + * Capture Scene: Sunset + * + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 11 + */ + SCENE_SUNSET_CONF = 'HwMnoteSceneSunsetConf', + /** + * Capture Scene: Flowers + * + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 11 + */ + SCENE_FLOWERS_CONF = 'HwMnoteSceneFlowersConf', + /** + * Capture Scene: Night + * + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 11 + */ + SCENE_NIGHT_CONF = 'HwMnoteSceneNightConf', + /** + * Capture Scene: Text + * + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 11 + */ + SCENE_TEXT_CONF = 'HwMnoteSceneTextConf', + /** + * Face Count + * + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 11 + */ + FACE_COUNT = 'HwMnoteFaceCount', + /** + * Focus Mode + * + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 11 + */ + FOCUS_MODE = 'HwMnoteFocusMode', + /** + * The scheme used for image compression. + * + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 12 + */ + COMPRESSION = 'Compression', + /** + * Pixel composition, such as RGB or YCbCr. + * + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 12 + */ + PHOTOMETRIC_INTERPRETATION = 'PhotometricInterpretation', + /** + * For each strip, the byte offset of that strip. + * + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 12 + */ + STRIP_OFFSETS = 'StripOffsets', + /** + * The number of components per pixel. + * + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 12 + */ + SAMPLES_PER_PIXEL = 'SamplesPerPixel', + /** + * The number of rows per strip of image data. + * + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 12 + */ + ROWS_PER_STRIP = 'RowsPerStrip', + /** + * The total number of bytes in each strip of image data. + * + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 12 + */ + STRIP_BYTE_COUNTS = 'StripByteCounts', + /** + * The image resolution in the width direction. + * + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 12 + */ + X_RESOLUTION = 'XResolution', + /** + * The image resolution in the height direction. + * + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 12 + */ + Y_RESOLUTION = 'YResolution', + /** + * Indicates whether pixel components are recorded in a chunky or planar format. + * + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 12 + */ + PLANAR_CONFIGURATION = 'PlanarConfiguration', + /** + * The unit used to measure XResolution and YResolution. + * + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 12 + */ + RESOLUTION_UNIT = 'ResolutionUnit', + /** + * The transfer function for the image, typically used for color correction. + * + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 12 + */ + TRANSFER_FUNCTION = 'TransferFunction', + /** + * The name and version of the software used to generate the image. + * + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 12 + */ + SOFTWARE = 'Software', + /** + * The name of the person who created the image. + * + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 12 + */ + ARTIST = 'Artist', + /** + * The chromaticity of the white point of the image. + * + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 12 + */ + WHITE_POINT = 'WhitePoint', + /** + * The chromaticity of the primary colors of the image. + * + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 12 + */ + PRIMARY_CHROMATICITIES = 'PrimaryChromaticities', + /** + * The matrix coefficients for transformation from RGB to YCbCr image data. + * + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 12 + */ + YCBCR_COEFFICIENTS = 'YCbCrCoefficients', + /** + * The sampling ratio of chrominance components to the luminance component. + * + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 12 + */ + YCBCR_SUB_SAMPLING = 'YCbCrSubSampling', + /** + * The position of chrominance components in relation to the luminance component. + * + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 12 + */ + YCBCR_POSITIONING = 'YCbCrPositioning', + /** + * The reference black point value and reference white point value. + * + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 12 + */ + REFERENCE_BLACK_WHITE = 'ReferenceBlackWhite', + /** + * Copyright information for the image. + * + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 12 + */ + COPYRIGHT = 'Copyright', + /** + * The offset to the start byte (SOI) of JPEG compressed thumbnail data. + * + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 12 + */ + JPEG_INTERCHANGE_FORMAT = 'JPEGInterchangeFormat', + /** + * The number of bytes of JPEG compressed thumbnail data. + * + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 12 + */ + JPEG_INTERCHANGE_FORMAT_LENGTH = 'JPEGInterchangeFormatLength', + /** + * The class of the program used by the camera to set exposure when the picture is taken. + * + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 12 + */ + EXPOSURE_PROGRAM = 'ExposureProgram', + /** + * Indicates the spectral sensitivity of each channel of the camera used. + * + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 12 + */ + SPECTRAL_SENSITIVITY = 'SpectralSensitivity', + /** + * Indicates the Opto-Electric Conversion Function (OECF) specified in ISO 14524. + * + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 12 + */ + OECF = 'OECF', + /** + * The version of the Exif standard supported. + * + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 12 + */ + EXIF_VERSION = 'ExifVersion', + /** + * The date and time when the image was stored as digital data. + * + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 12 + */ + DATE_TIME_DIGITIZED = 'DateTimeDigitized', + /** + * Information specific to compressed data. + * + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 12 + */ + COMPONENTS_CONFIGURATION = 'ComponentsConfiguration', + /** + * The shutter speed, expressed as an APEX (Additive System of Photographic Exposure) value. + * + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 12 + */ + SHUTTER_SPEED = 'ShutterSpeedValue', + /** + * The brightness value of the image, in APEX units. + * + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 12 + */ + BRIGHTNESS_VALUE = 'BrightnessValue', + /** + * The smallest F number of lens. + * + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 12 + */ + MAX_APERTURE_VALUE = 'MaxApertureValue', + /** + * The distance to the subject, measured in meters. + * + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 12 + */ + SUBJECT_DISTANCE = 'SubjectDistance', + /** + * This tag indicate the location and area of the main subject in the overall scene. + * + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 12 + */ + SUBJECT_AREA = 'SubjectArea', + /** + * A tag for manufacturers of Exif/DCF writers to record any desired information. + * + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 12 + */ + MAKER_NOTE = 'MakerNote', + /** + * A tag for record fractions of seconds for the DateTime tag. + * + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 12 + */ + SUBSEC_TIME = 'SubsecTime', + /** + * A tag used to record fractions of seconds for the DateTimeOriginal tag. + * + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 12 + */ + SUBSEC_TIME_ORIGINAL = 'SubsecTimeOriginal', + /** + * A tag used to record fractions of seconds for the DateTimeDigitized tag. + * + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 12 + */ + SUBSEC_TIME_DIGITIZED = 'SubsecTimeDigitized', + /** + * This tag denotes the Flashpix format version supported by an FPXR file, enhancing device compatibility. + * + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 12 + */ + FLASHPIX_VERSION = 'FlashpixVersion', + /** + * The color space information tag, often recorded as the color space specifier. + * + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 12 + */ + COLOR_SPACE = 'ColorSpace', + /** + * The name of an audio file related to the image data. + * + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 12 + */ + RELATED_SOUND_FILE = 'RelatedSoundFile', + /** + * Strobe energy at image capture, in BCPS. + * + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 12 + */ + FLASH_ENERGY = 'FlashEnergy', + /** + * Camera or input device spatial frequency table. + * + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 12 + */ + SPATIAL_FREQUENCY_RESPONSE = 'SpatialFrequencyResponse', + /** + * Pixels per FocalPlaneResolutionUnit in the image width. + * + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 12 + */ + FOCAL_PLANE_X_RESOLUTION = 'FocalPlaneXResolution', + /** + * Pixels per FocalPlaneResolutionUnit in the image height. + * + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 12 + */ + FOCAL_PLANE_Y_RESOLUTION = 'FocalPlaneYResolution', + /** + * Unit for measuring FocalPlaneXResolution and FocalPlaneYResolution. + * + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 12 + */ + FOCAL_PLANE_RESOLUTION_UNIT = 'FocalPlaneResolutionUnit', + /** + * Location of the main subject, relative to the left edge. + * + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 12 + */ + SUBJECT_LOCATION = 'SubjectLocation', + /** + * Selected exposure index at capture. + * + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 12 + */ + EXPOSURE_INDEX = 'ExposureIndex', + /** + * Image sensor type on the camera. + * + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 12 + */ + SENSING_METHOD = 'SensingMethod', + /** + * Indicates the image source. + * + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 12 + */ + FILE_SOURCE = 'FileSource', + /** + * Color filter array (CFA) geometric pattern of the image sensor. + * + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 12 + */ + CFA_PATTERN = 'CFAPattern', + /** + * Indicates special processing on image data. + * + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 12 + */ + CUSTOM_RENDERED = 'CustomRendered', + /** + * Exposure mode set when the image was shot. + * + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 12 + */ + EXPOSURE_MODE = 'ExposureMode', + /** + * Digital zoom ratio at the time of capture. + * + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 12 + */ + DIGITAL_ZOOM_RATIO = 'DigitalZoomRatio', + /** + * Type of scene captured. + * + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 12 + */ + SCENE_CAPTURE_TYPE = 'SceneCaptureType', + /** + * Degree of overall image gain adjustment. + * + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 12 + */ + GAIN_CONTROL = 'GainControl', + /** + * Direction of contrast processing applied by the camera. + * + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 12 + */ + CONTRAST = 'Contrast', + /** + * Direction of saturation processing applied by the camera. + * + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 12 + */ + SATURATION = 'Saturation', + /** + * The direction of sharpness processing applied by the camera. + * + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 12 + */ + SHARPNESS = 'Sharpness', + /** + * Information on picture-taking conditions for a specific camera model. + * + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 12 + */ + DEVICE_SETTING_DESCRIPTION = 'DeviceSettingDescription', + /** + * Indicates the distance range to the subject. + * + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 12 + */ + SUBJECT_DISTANCE_RANGE = 'SubjectDistanceRange', + /** + * An identifier uniquely assigned to each image. + * + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 12 + */ + IMAGE_UNIQUE_ID = 'ImageUniqueID', + /** + * The version of the GPSInfoIFD. + * + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 12 + */ + GPS_VERSION_ID = 'GPSVersionID', + /** + * Reference altitude used for GPS altitude. + * + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 12 + */ + GPS_ALTITUDE_REF = 'GPSAltitudeRef', + /** + * The altitude based on the reference in GPSAltitudeRef. + * + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 12 + */ + GPS_ALTITUDE = 'GPSAltitude', + /** + * The GPS satellites used for measurements. + * + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 12 + */ + GPS_SATELLITES = 'GPSSatellites', + /** + * The status of the GPS receiver when the image is recorded. + * + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 12 + */ + GPS_STATUS = 'GPSStatus', + /** + * The GPS measurement mode. + * + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 12 + */ + GPS_MEASURE_MODE = 'GPSMeasureMode', + /** + * The GPS DOP (data degree of precision). + * + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 12 + */ + GPS_DOP = 'GPSDOP', + /** + * The unit used to express the GPS receiver speed of movement. + * + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 12 + */ + GPS_SPEED_REF = 'GPSSpeedRef', + /** + * The speed of GPS receiver movement. + * + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 12 + */ + GPS_SPEED = 'GPSSpeed', + /** + * The reference for giving the direction of GPS receiver movement. + * + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 12 + */ + GPS_TRACK_REF = 'GPSTrackRef', + /** + * The direction of GPS receiver movement. + * + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 12 + */ + GPS_TRACK = 'GPSTrack', + /** + * The reference for the image's direction. + * + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 12 + */ + GPS_IMG_DIRECTION_REF = 'GPSImgDirectionRef', + /** + * The direction of the image when captured. + * + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 12 + */ + GPS_IMG_DIRECTION = 'GPSImgDirection', + /** + * Geodetic survey data used by the GPS receiver. + * + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 12 + */ + GPS_MAP_DATUM = 'GPSMapDatum', + /** + * Indicates the latitude reference of the destination point. + * + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 12 + */ + GPS_DEST_LATITUDE_REF = 'GPSDestLatitudeRef', + /** + * The latitude of the destination point. + * + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 12 + */ + GPS_DEST_LATITUDE = 'GPSDestLatitude', + /** + * Indicates the longitude reference of the destination point. + * + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 12 + */ + GPS_DEST_LONGITUDE_REF = 'GPSDestLongitudeRef', + /** + * The longitude of the destination point. + * + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 12 + */ + GPS_DEST_LONGITUDE = 'GPSDestLongitude', + /** + * The reference for the bearing to the destination point. + * + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 12 + */ + GPS_DEST_BEARING_REF = 'GPSDestBearingRef', + /** + * The bearing to the destination point. + * + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 12 + */ + GPS_DEST_BEARING = 'GPSDestBearing', + /** + * The measurement unit for the distance to the target point. + * + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 12 + */ + GPS_DEST_DISTANCE_REF = 'GPSDestDistanceRef', + /** + * The distance to the destination point. + * + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 12 + */ + GPS_DEST_DISTANCE = 'GPSDestDistance', + /** + * A character string recording the name of the method used for location finding. + * + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 12 + */ + GPS_PROCESSING_METHOD = 'GPSProcessingMethod', + /** + * A character string recording the name of the GPS area. + * + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 12 + */ + GPS_AREA_INFORMATION = 'GPSAreaInformation', + /** + * This field denotes if differential correction was applied to GPS data, crucial for precise location accuracy. + * + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 12 + */ + GPS_DIFFERENTIAL = 'GPSDifferential', + /** + * The serial number of the camera body. + * + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 12 + */ + BODY_SERIAL_NUMBER = 'BodySerialNumber', + /** + * The name of the camera owner. + * + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 12 + */ + CAMERA_OWNER_NAME = 'CameraOwnerName', + /** + * Indicates whether the image is a composite image. + * + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 12 + */ + COMPOSITE_IMAGE = 'CompositeImage', + /** + * The compression mode used for a compressed image, in unit bits per pixel. + * + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 12 + */ + COMPRESSED_BITS_PER_PIXEL = 'CompressedBitsPerPixel', + /** + * The DNGVersion tag encodes the four-tier version number for DNG specification compliance. + * + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 12 + */ + DNG_VERSION = 'DNGVersion', + /** + * DefaultCropSize specifies the final image size in raw coordinates, accounting for extra edge pixels. + * + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 12 + */ + DEFAULT_CROP_SIZE = 'DefaultCropSize', + /** + * Indicates the value of coefficient gamma. + * + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 12 + */ + GAMMA = 'Gamma', + /** + * The tag indicate the ISO speed latitude yyy value of the camera or input device that is defined in ISO 12232. + * + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 12 + */ + ISO_SPEED_LATITUDE_YYY = 'ISOSpeedLatitudeyyy', + /** + * The tag indicate the ISO speed latitude zzz value of the camera or input device that is defined in ISO 12232. + * + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 12 + */ + ISO_SPEED_LATITUDE_ZZZ = 'ISOSpeedLatitudezzz', + /** + * The manufacturer of the lens. + * + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 12 + */ + LENS_MAKE = 'LensMake', + /** + * The model name of the lens. + * + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 12 + */ + LENS_MODEL = 'LensModel', + /** + * The serial number of the lens. + * + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 12 + */ + LENS_SERIAL_NUMBER = 'LensSerialNumber', + /** + * Specifications of the lens used. + * + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 12 + */ + LENS_SPECIFICATION = 'LensSpecification', + /** + * This tag provides a broad description of the data type in this subfile. + * + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 12 + */ + NEW_SUBFILE_TYPE = 'NewSubfileType', + /** + * This tag records the UTC offset for the DateTime tag, ensuring accurate timestamps regardless of location. + * + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 12 + */ + OFFSET_TIME = 'OffsetTime', + /** + * This tag records the UTC offset when the image was digitized, aiding in accurate timestamp adjustment. + * + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 12 + */ + OFFSET_TIME_DIGITIZED = 'OffsetTimeDigitized', + /** + * This tag records the UTC offset when the original image was created, crucial for time-sensitive applications. + * + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 12 + */ + OFFSET_TIME_ORIGINAL = 'OffsetTimeOriginal', + /** + * Exposure times of source images for a composite image. + * + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 12 + */ + SOURCE_EXPOSURE_TIMES_OF_COMPOSITE_IMAGE = 'SourceExposureTimesOfCompositeImage', + /** + * The number of source images used for a composite image. + * + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 12 + */ + SOURCE_IMAGE_NUMBER_OF_COMPOSITE_IMAGE = 'SourceImageNumberOfCompositeImage', + /** + * This deprecated tag indicates the data type in this subfile. Use NewSubfileType instead. + * + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 12 + */ + SUBFILE_TYPE = 'SubfileType', + /** + * This tag indicates horizontal positioning errors in meters. + * + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 12 + */ + GPS_H_POSITIONING_ERROR = 'GPSHPositioningError', + /** + * This tag indicates the sensitivity of the camera or input device when the image was shot. + * + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 12 + */ + PHOTOGRAPHIC_SENSITIVITY = 'PhotographicSensitivity', + /** + * Burst Number + * + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 12 + */ + BURST_NUMBER = 'HwMnoteBurstNumber', + /** + * Face Conf + * + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 12 + */ + FACE_CONF = 'HwMnoteFaceConf', + /** + * Face Leye Center + * + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 12 + */ + FACE_LEYE_CENTER = 'HwMnoteFaceLeyeCenter', + /** + * Face Mouth Center + * + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 12 + */ + FACE_MOUTH_CENTER = 'HwMnoteFaceMouthCenter', + /** + * Face Pointer + * + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 12 + */ + FACE_POINTER = 'HwMnoteFacePointer', + /** + * Face Rect + * + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 12 + */ + FACE_RECT = 'HwMnoteFaceRect', + /** + * Face Reye Center + * + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 12 + */ + FACE_REYE_CENTER = 'HwMnoteFaceReyeCenter', + /** + * Face Smile Score + * + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 12 + */ + FACE_SMILE_SCORE = 'HwMnoteFaceSmileScore', + /** + * Face Version + * + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 12 + */ + FACE_VERSION = 'HwMnoteFaceVersion', + /** + * Front Camera + * + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 12 + */ + FRONT_CAMERA = 'HwMnoteFrontCamera', + /** + * Scene Pointer + * + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 12 + */ + SCENE_POINTER = 'HwMnoteScenePointer', + /** + * Scene Version + * + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 12 + */ + SCENE_VERSION = 'HwMnoteSceneVersion', + /** + * GIF LOOP COUNT + * If infinite loop returns 0, other values represent the number of loops + * + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 12 + */ + GIF_LOOP_COUNT = 'GIFLoopCount' + } + /** + * Enum for image formats. + * + * @enum { number } + * @syscap SystemCapability.Multimedia.Image.Core + * @since 9 + */ + enum ImageFormat { + /** + * YCBCR422 semi-planar format. + * + * @syscap SystemCapability.Multimedia.Image.Core + * @since 9 + */ + YCBCR_422_SP = 1000, + /** + * JPEG encoding format. + * + * @syscap SystemCapability.Multimedia.Image.Core + * @since 9 + */ + JPEG = 2000 + } + /** + * Enumerates alpha types. + * + * @enum { number } + * @syscap SystemCapability.Multimedia.Image.Core + * @since 9 + */ + /** + * Enumerates alpha types. + * + * @enum { number } + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 10 + */ + /** + * Enumerates alpha types. + * + * @enum { number } + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @atomicservice + * @since 11 + */ + /** + * Enumerates alpha types. + * + * @enum { number } + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @form + * @atomicservice + * @since 12 + */ + enum AlphaType { + /** + * Indicates an unknown alpha type. + * + * @syscap SystemCapability.Multimedia.Image.Core + * @since 9 + */ + /** + * Indicates an unknown alpha type. + * + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 10 + */ + /** + * Indicates an unknown alpha type. + * + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @atomicservice + * @since 11 + */ + /** + * Indicates an unknown alpha type. + * + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @form + * @atomicservice + * @since 12 + */ + UNKNOWN = 0, + /** + * Indicates that the image has no alpha channel, or all pixels in the image are fully opaque. + * + * @syscap SystemCapability.Multimedia.Image.Core + * @since 9 + */ + /** + * Indicates that the image has no alpha channel, or all pixels in the image are fully opaque. + * + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 10 + */ + /** + * Indicates that the image has no alpha channel, or all pixels in the image are fully opaque. + * + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @atomicservice + * @since 11 + */ + /** + * Indicates that the image has no alpha channel, or all pixels in the image are fully opaque. + * + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @form + * @atomicservice + * @since 12 + */ + OPAQUE = 1, + /** + * Indicates that RGB components of each pixel in the image are premultiplied by alpha. + * + * @syscap SystemCapability.Multimedia.Image.Core + * @since 9 + */ + /** + * Indicates that RGB components of each pixel in the image are premultiplied by alpha. + * + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 10 + */ + /** + * Indicates that RGB components of each pixel in the image are premultiplied by alpha. + * + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @atomicservice + * @since 11 + */ + /** + * Indicates that RGB components of each pixel in the image are premultiplied by alpha. + * + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @form + * @atomicservice + * @since 12 + */ + PREMUL = 2, + /** + * Indicates that RGB components of each pixel in the image are independent of alpha and are not premultiplied by alpha. + * + * @syscap SystemCapability.Multimedia.Image.Core + * @since 9 + */ + /** + * Indicates that RGB components of each pixel in the image are independent of alpha and are not premultiplied by alpha. + * + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 10 + */ + /** + * Indicates that RGB components of each pixel in the image are independent of alpha and are not premultiplied by alpha. + * + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @atomicservice + * @since 11 + */ + /** + * Indicates that RGB components of each pixel in the image are independent of alpha and are not premultiplied by alpha. + * + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @form + * @atomicservice + * @since 12 + */ + UNPREMUL = 3 + } + /** + * Enumerates decoding dynamic range. + * + * @enum { number } + * @syscap SystemCapability.Multimedia.Image.Core + * @since 12 + */ + enum DecodingDynamicRange { + /** + * Decoding according to the content of the image. + * + * @syscap SystemCapability.Multimedia.Image.Core + * @since 12 + */ + AUTO = 0, + /** + * Decoding to standard dynamic range. + * + * @syscap SystemCapability.Multimedia.Image.Core + * @since 12 + */ + SDR = 1, + /** + * Decoding to high dynamic range. + * + * @syscap SystemCapability.Multimedia.Image.Core + * @since 12 + */ + HDR = 2 + } + /** + * Enumerates packing dynamic range. + * + * @enum { number } + * @syscap SystemCapability.Multimedia.Image.Core + * @since 12 + */ + enum PackingDynamicRange { + /** + * Packing according to the content of the image. + * + * @syscap SystemCapability.Multimedia.Image.Core + * @since 12 + */ + AUTO = 0, + /** + * Packing to standard dynamic range. + * + * @syscap SystemCapability.Multimedia.Image.Core + * @since 12 + */ + SDR = 1 + } + /** + * Enum for image scale mode. + * + * @enum { number } + * @syscap SystemCapability.Multimedia.Image.Core + * @since 9 + */ + /** + * Enum for image scale mode. + * + * @enum { number } + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 10 + */ + /** + * Enum for image scale mode. + * + * @enum { number } + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @atomicservice + * @since 11 + */ + /** + * Enum for image scale mode. + * + * @enum { number } + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @form + * @atomicservice + * @since 12 + */ + enum ScaleMode { + /** + * Indicates the effect that fits the image into the target size. + * + * @syscap SystemCapability.Multimedia.Image.Core + * @since 9 + */ + /** + * Indicates the effect that fits the image into the target size. + * + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 10 + */ + /** + * Indicates the effect that fits the image into the target size. + * + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @atomicservice + * @since 11 + */ + /** + * Indicates the effect that fits the image into the target size. + * + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @form + * @atomicservice + * @since 12 + */ + FIT_TARGET_SIZE = 0, + /** + * Indicates the effect that scales an image to fill the target image area and center-crops the part outside the area. + * + * @syscap SystemCapability.Multimedia.Image.Core + * @since 9 + */ + /** + * Indicates the effect that scales an image to fill the target image area and center-crops the part outside the area. + * + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 10 + */ + /** + * Indicates the effect that scales an image to fill the target image area and center-crops the part outside the area. + * + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @atomicservice + * @since 11 + */ + /** + * Indicates the effect that scales an image to fill the target image area and center-crops the part outside the area. + * + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @form + * @atomicservice + * @since 12 + */ + CENTER_CROP = 1 + } + /** + * The component type of image. + * + * @enum { number } + * @syscap SystemCapability.Multimedia.Image.ImageReceiver + * @since 9 + */ + enum ComponentType { + /** + * Luma info. + * + * @syscap SystemCapability.Multimedia.Image.ImageReceiver + * @since 9 + */ + YUV_Y = 1, + /** + * Chrominance info. + * + * @syscap SystemCapability.Multimedia.Image.ImageReceiver + * @since 9 + */ + YUV_U = 2, + /** + * Chroma info. + * + * @syscap SystemCapability.Multimedia.Image.ImageReceiver + * @since 9 + */ + YUV_V = 3, + /** + * Jpeg type. + * + * @syscap SystemCapability.Multimedia.Image.ImageReceiver + * @since 9 + */ + JPEG = 4 + } + /** + * Describes region information. + * + * @typedef Region + * @syscap SystemCapability.Multimedia.Image.Core + * @since 8 + */ + /** + * Describes region information. + * + * @typedef Region + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 10 + */ + /** + * Describes region information. + * + * @typedef Region + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @atomicservice + * @since 11 + */ + /** + * Describes region information. + * + * @typedef Region + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @form + * @atomicservice + * @since 12 + */ + interface Region { + /** + * Image size. + * + * @type { Size } + * @syscap SystemCapability.Multimedia.Image.Core + * @since 7 + */ + /** + * Image size. + * + * @type { Size } + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 10 + */ + /** + * Image size. + * + * @type { Size } + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @atomicservice + * @since 11 + */ + /** + * Image size. + * + * @type { Size } + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @form + * @atomicservice + * @since 12 + */ + size: Size; + /** + * x-coordinate at the upper left corner of the image. + * + * @type { number } + * @syscap SystemCapability.Multimedia.Image.Core + * @since 7 + */ + /** + * x-coordinate at the upper left corner of the image. + * + * @type { number } + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 10 + */ + /** + * x-coordinate at the upper left corner of the image. + * + * @type { number } + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @atomicservice + * @since 11 + */ + /** + * x-coordinate at the upper left corner of the image. + * + * @type { number } + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @form + * @atomicservice + * @since 12 + */ + x: number; + /** + * y-coordinate at the upper left corner of the image. + * + * @type { number } + * @syscap SystemCapability.Multimedia.Image.Core + * @since 7 + */ + /** + * y-coordinate at the upper left corner of the image. + * + * @type { number } + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 10 + */ + /** + * y-coordinate at the upper left corner of the image. + * + * @type { number } + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @atomicservice + * @since 11 + */ + /** + * y-coordinate at the upper left corner of the image. + * + * @type { number } + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @form + * @atomicservice + * @since 12 + */ + y: number; + } + /** + * Describes area information in an image. + * + * @typedef PositionArea + * @syscap SystemCapability.Multimedia.Image.Core + * @since 7 + */ + /** + * Describes area information in an image. + * + * @typedef PositionArea + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 10 + */ + /** + * Describes area information in an image. + * + * @typedef PositionArea + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @atomicservice + * @since 11 + */ + /** + * Describes area information in an image. + * + * @typedef PositionArea + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @form + * @atomicservice + * @since 12 + */ + interface PositionArea { + /** + * Image data that will be read or written. + * + * @type { ArrayBuffer } + * @syscap SystemCapability.Multimedia.Image.Core + * @since 7 + */ + /** + * Image data that will be read or written. + * + * @type { ArrayBuffer } + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 10 + */ + /** + * Image data that will be read or written. + * + * @type { ArrayBuffer } + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @atomicservice + * @since 11 + */ + /** + * Image data that will be read or written. + * + * @type { ArrayBuffer } + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @form + * @atomicservice + * @since 12 + */ + pixels: ArrayBuffer; + /** + * Offset for data reading. + * + * @type { number } + * @syscap SystemCapability.Multimedia.Image.Core + * @since 7 + */ + /** + * Offset for data reading. + * + * @type { number } + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 10 + */ + /** + * Offset for data reading. + * + * @type { number } + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @atomicservice + * @since 11 + */ + /** + * Offset for data reading. + * + * @type { number } + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @form + * @atomicservice + * @since 12 + */ + offset: number; + /** + * Number of bytes to read. + * + * @type { number } + * @syscap SystemCapability.Multimedia.Image.Core + * @since 7 + */ + /** + * Number of bytes to read. + * + * @type { number } + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 10 + */ + /** + * Number of bytes to read. + * + * @type { number } + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @atomicservice + * @since 11 + */ + /** + * Number of bytes to read. + * + * @type { number } + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @form + * @atomicservice + * @since 12 + */ + stride: number; + /** + * Region to read. + * + * @type { Region } + * @syscap SystemCapability.Multimedia.Image.Core + * @since 7 + */ + /** + * Region to read. + * + * @type { Region } + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 10 + */ + /** + * Region to read. + * + * @type { Region } + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @atomicservice + * @since 11 + */ + /** + * Region to read. + * + * @type { Region } + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @form + * @atomicservice + * @since 12 + */ + region: Region; + } + /** + * Describes image information. + * + * @typedef ImageInfo + * @syscap SystemCapability.Multimedia.Image.Core + * @since 6 + */ + /** + * Describes image information. + * + * @typedef ImageInfo + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 10 + */ + /** + * Describes image information. + * + * @typedef ImageInfo + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @atomicservice + * @since 11 + */ + /** + * Describes image information. + * + * @typedef ImageInfo + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @form + * @atomicservice + * @since 12 + */ + interface ImageInfo { + /** + * Indicates image dimensions specified by a {@link Size} interface. + * + * @type { Size } + * @syscap SystemCapability.Multimedia.Image.Core + * @since 6 + */ + /** + * Indicates image dimensions specified by a {@link Size} interface. + * + * @type { Size } + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 10 + */ + /** + * Indicates image dimensions specified by a {@link Size} interface. + * + * @type { Size } + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @atomicservice + * @since 11 + */ + /** + * Indicates image dimensions specified by a {@link Size} interface. + * + * @type { Size } + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @form + * @atomicservice + * @since 12 + */ + size: Size; + /** + * Indicates image default density. + * + * @type { number } + * @syscap SystemCapability.Multimedia.Image.Core + * @since 9 + */ + /** + * Indicates image default density. + * + * @type { number } + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 10 + */ + /** + * Indicates image default density. + * + * @type { number } + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @atomicservice + * @since 11 + */ + /** + * Indicates image default density. + * + * @type { number } + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @form + * @atomicservice + * @since 12 + */ + density: number; + /** + * The number of byte per row. + * + * @type { number } + * @syscap SystemCapability.Multimedia.Image.Core + * @atomicservice + * @since 11 + */ + /** + * The number of byte per row. + * + * @type { number } + * @syscap SystemCapability.Multimedia.Image.Core + * @form + * @atomicservice + * @since 12 + */ + stride: number; + /** + * Indicates image format. + * + * @type { PixelMapFormat } + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @form + * @atomicservice + * @since 12 + */ + pixelFormat: PixelMapFormat; + /** + * Indicates image alpha type. + * + * @type { AlphaType } + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @form + * @atomicservice + * @since 12 + */ + alphaType: AlphaType; + /** + * Indicates image mime type. + * + * @type { string } + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 12 + */ + mimeType: string; + /** + * Indicates whether the image high dynamic range + * + * @type { boolean } + * @syscap SystemCapability.Multimedia.Image.Core + * @since 12 + */ + isHdr: boolean; + } + /** + * Describes the option for image packing. + * + * @typedef PackingOption + * @syscap SystemCapability.Multimedia.Image.ImagePacker + * @since 6 + */ + /** + * Describes the option for image packing. + * + * @typedef PackingOption + * @syscap SystemCapability.Multimedia.Image.ImagePacker + * @crossplatform + * @since 10 + */ + /** + * Describes the option for image packing. + * + * @typedef PackingOption + * @syscap SystemCapability.Multimedia.Image.ImagePacker + * @crossplatform + * @atomicservice + * @since 11 + */ + interface PackingOption { + /** + * Multipurpose Internet Mail Extensions (MIME) format of the target image, for example, image/jpeg. + * + * @type { string } + * @syscap SystemCapability.Multimedia.Image.ImagePacker + * @since 6 + */ + /** + * Multipurpose Internet Mail Extensions (MIME) format of the target image, for example, image/jpeg. + * + * @type { string } + * @syscap SystemCapability.Multimedia.Image.ImagePacker + * @crossplatform + * @since 10 + */ + /** + * Multipurpose Internet Mail Extensions (MIME) format of the target image, for example, image/jpeg. + * + * @type { string } + * @syscap SystemCapability.Multimedia.Image.ImagePacker + * @crossplatform + * @atomicservice + * @since 11 + */ + format: string; + /** + * Quality of the target image. The value is an integer ranging from 0 to 100. A larger value indicates better. + * + * @type { number } + * @syscap SystemCapability.Multimedia.Image.ImagePacker + * @since 6 + */ + /** + * Quality of the target image. The value is an integer ranging from 0 to 100. A larger value indicates better. + * + * @type { number } + * @syscap SystemCapability.Multimedia.Image.ImagePacker + * @crossplatform + * @since 10 + */ + /** + * Quality of the target image. The value is an integer ranging from 0 to 100. A larger value indicates better. + * + * @type { number } + * @syscap SystemCapability.Multimedia.Image.ImagePacker + * @crossplatform + * @atomicservice + * @since 11 + */ + quality: number; + /** + * BufferSize of the target image. + * If this bufferSize is less than or equal to 0, it will be converted to 10MB. + * + * @type { ?number } + * @syscap SystemCapability.Multimedia.Image.ImagePacker + * @since 9 + */ + /** + * BufferSize of the target image. + * If this bufferSize is less than or equal to 0, it will be converted to 10MB. + * + * @type { ?number } + * @syscap SystemCapability.Multimedia.Image.ImagePacker + * @crossplatform + * @since 10 + */ + /** + * BufferSize of the target image. + * If this bufferSize is less than or equal to 0, it will be converted to 10MB. + * + * @type { ?number } + * @syscap SystemCapability.Multimedia.Image.ImagePacker + * @crossplatform + * @atomicservice + * @since 11 + */ + bufferSize?: number; + /** + * The desired dynamic range of the target image. + * + * @type { ?PackingDynamicRange } + * @syscap SystemCapability.Multimedia.Image.ImagePacker + * @since 12 + */ + desiredDynamicRange?: PackingDynamicRange; + } + /** + * Describes image properties. + * + * @typedef GetImagePropertyOptions + * @syscap SystemCapability.Multimedia.Image.ImageSource + * @since 7 + * @deprecated since 11 + * @useinstead image.ImagePropertyOptions + */ + /** + * Describes image properties. + * + * @typedef GetImagePropertyOptions + * @syscap SystemCapability.Multimedia.Image.ImageSource + * @crossplatform + * @since 10 + * @deprecated since 11 + * @useinstead image.ImagePropertyOptions + */ + interface GetImagePropertyOptions { + /** + * Index of an image. + * + * @type { ?number } + * @syscap SystemCapability.Multimedia.Image.ImageSource + * @since 7 + * @deprecated since 11 + * @useinstead image.ImagePropertyOptions#index + */ + /** + * Index of an image. + * + * @type { ?number } + * @syscap SystemCapability.Multimedia.Image.ImageSource + * @crossplatform + * @since 10 + * @deprecated since 11 + * @useinstead image.ImagePropertyOptions#index + */ + index?: number; + /** + * Default property value. + * + * @type { ?string } + * @syscap SystemCapability.Multimedia.Image.ImageSource + * @since 7 + * @deprecated since 11 + * @useinstead image.ImagePropertyOptions#defaultValue + */ + /** + * Default property value. + * + * @type { ?string } + * @syscap SystemCapability.Multimedia.Image.ImageSource + * @crossplatform + * @since 10 + * @deprecated since 11 + * @useinstead image.ImagePropertyOptions#defaultValue + */ + defaultValue?: string; + } + /** + * Describes image properties. + * + * @typedef ImagePropertyOptions + * @syscap SystemCapability.Multimedia.Image.ImageSource + * @crossplatform + * @since 11 + */ + interface ImagePropertyOptions { + /** + * Index of an image. + * + * @type { ?number } + * @syscap SystemCapability.Multimedia.Image.ImageSource + * @crossplatform + * @since 11 + */ + index?: number; + /** + * Default property value. + * + * @type { ?string } + * @syscap SystemCapability.Multimedia.Image.ImageSource + * @crossplatform + * @since 11 + */ + defaultValue?: string; + } + /** + * Describes image decoding parameters. + * + * @typedef DecodingOptions + * @syscap SystemCapability.Multimedia.Image.ImageSource + * @since 7 + */ + /** + * Describes image decoding parameters. + * + * @typedef DecodingOptions + * @syscap SystemCapability.Multimedia.Image.ImageSource + * @crossplatform + * @since 10 + */ + /** + * Describes image decoding parameters. + * + * @typedef DecodingOptions + * @syscap SystemCapability.Multimedia.Image.ImageSource + * @crossplatform + * @atomicservice + * @since 11 + */ + /** + * Describes image decoding parameters. + * + * @typedef DecodingOptions + * @syscap SystemCapability.Multimedia.Image.ImageSource + * @crossplatform + * @form + * @atomicservice + * @since 12 + */ + interface DecodingOptions { + /** + * Number of image frames. + * + * @type { ?number } + * @syscap SystemCapability.Multimedia.Image.ImageSource + * @since 7 + */ + /** + * Number of image frames. + * + * @type { ?number } + * @syscap SystemCapability.Multimedia.Image.ImageSource + * @crossplatform + * @since 10 + */ + /** + * Number of image frames. + * + * @type { ?number } + * @syscap SystemCapability.Multimedia.Image.ImageSource + * @crossplatform + * @atomicservice + * @since 11 + */ + /** + * Number of image frames. + * + * @type { ?number } + * @syscap SystemCapability.Multimedia.Image.ImageSource + * @crossplatform + * @form + * @atomicservice + * @since 12 + */ + index?: number; + /** + * Sampling ratio of the image pixel map. + * + * @type { ?number } + * @syscap SystemCapability.Multimedia.Image.ImageSource + * @since 7 + */ + /** + * Sampling ratio of the image pixel map. + * + * @type { ?number } + * @syscap SystemCapability.Multimedia.Image.ImageSource + * @crossplatform + * @since 10 + */ + /** + * Sampling ratio of the image pixel map. + * + * @type { ?number } + * @syscap SystemCapability.Multimedia.Image.ImageSource + * @crossplatform + * @atomicservice + * @since 11 + */ + /** + * Sampling ratio of the image pixel map. + * + * @type { ?number } + * @syscap SystemCapability.Multimedia.Image.ImageSource + * @crossplatform + * @form + * @atomicservice + * @since 12 + */ + sampleSize?: number; + /** + * Rotation angle of the image pixel map. The value ranges from 0 to 360. + * + * @type { ?number } + * @syscap SystemCapability.Multimedia.Image.ImageSource + * @since 7 + */ + /** + * Rotation angle of the image pixel map. The value ranges from 0 to 360. + * + * @type { ?number } + * @syscap SystemCapability.Multimedia.Image.ImageSource + * @crossplatform + * @since 10 + */ + /** + * Rotation angle of the image pixel map. The value ranges from 0 to 360. + * + * @type { ?number } + * @syscap SystemCapability.Multimedia.Image.ImageSource + * @crossplatform + * @atomicservice + * @since 11 + */ + /** + * Rotation angle of the image pixel map. The value ranges from 0 to 360. + * + * @type { ?number } + * @syscap SystemCapability.Multimedia.Image.ImageSource + * @crossplatform + * @form + * @atomicservice + * @since 12 + */ + rotate?: number; + /** + * Whether the image pixel map is editable. + * + * @type { ?boolean } + * @syscap SystemCapability.Multimedia.Image.ImageSource + * @since 7 + */ + /** + * Whether the image pixel map is editable. + * + * @type { ?boolean } + * @syscap SystemCapability.Multimedia.Image.ImageSource + * @crossplatform + * @since 10 + */ + /** + * Whether the image pixel map is editable. + * + * @type { ?boolean } + * @syscap SystemCapability.Multimedia.Image.ImageSource + * @crossplatform + * @atomicservice + * @since 11 + */ + /** + * Whether the image pixel map is editable. + * + * @type { ?boolean } + * @syscap SystemCapability.Multimedia.Image.ImageSource + * @crossplatform + * @form + * @atomicservice + * @since 12 + */ + editable?: boolean; + /** + * Width and height of the image pixel map. The value (0, 0) indicates that the pixels are decoded + * based on the original image size. + * + * @type { ?Size } + * @syscap SystemCapability.Multimedia.Image.ImageSource + * @since 7 + */ + /** + * Width and height of the image pixel map. The value (0, 0) indicates that the pixels are decoded + * based on the original image size. + * + * @type { ?Size } + * @syscap SystemCapability.Multimedia.Image.ImageSource + * @crossplatform + * @since 10 + */ + /** + * Width and height of the image pixel map. The value (0, 0) indicates that the pixels are decoded + * based on the original image size. + * + * @type { ?Size } + * @syscap SystemCapability.Multimedia.Image.ImageSource + * @crossplatform + * @atomicservice + * @since 11 + */ + /** + * Width and height of the image pixel map. The value (0, 0) indicates that the pixels are decoded + * based on the original image size. + * + * @type { ?Size } + * @syscap SystemCapability.Multimedia.Image.ImageSource + * @crossplatform + * @form + * @atomicservice + * @since 12 + */ + desiredSize?: Size; + /** + * Cropping region of the image pixel map. + * + * @type { ?Region } + * @syscap SystemCapability.Multimedia.Image.ImageSource + * @since 7 + */ + /** + * Cropping region of the image pixel map. + * + * @type { ?Region } + * @syscap SystemCapability.Multimedia.Image.ImageSource + * @crossplatform + * @since 10 + */ + /** + * Cropping region of the image pixel map. + * + * @type { ?Region } + * @syscap SystemCapability.Multimedia.Image.ImageSource + * @crossplatform + * @atomicservice + * @since 11 + */ + /** + * Cropping region of the image pixel map. + * + * @type { ?Region } + * @syscap SystemCapability.Multimedia.Image.ImageSource + * @crossplatform + * @form + * @atomicservice + * @since 12 + */ + desiredRegion?: Region; + /** + * Data format of the image pixel map. + * + * @type { ?PixelMapFormat } + * @syscap SystemCapability.Multimedia.Image.ImageSource + * @since 7 + */ + /** + * Data format of the image pixel map. + * + * @type { ?PixelMapFormat } + * @syscap SystemCapability.Multimedia.Image.ImageSource + * @crossplatform + * @since 10 + */ + /** + * Data format of the image pixel map. + * + * @type { ?PixelMapFormat } + * @syscap SystemCapability.Multimedia.Image.ImageSource + * @crossplatform + * @atomicservice + * @since 11 + */ + /** + * Data format of the image pixel map. + * + * @type { ?PixelMapFormat } + * @syscap SystemCapability.Multimedia.Image.ImageSource + * @crossplatform + * @form + * @atomicservice + * @since 12 + */ + desiredPixelFormat?: PixelMapFormat; + /** + * The density for image pixel map. + * + * @type { ?number } + * @syscap SystemCapability.Multimedia.Image.ImageSource + * @since 9 + */ + /** + * The density for image pixel map. + * + * @type { ?number } + * @syscap SystemCapability.Multimedia.Image.ImageSource + * @crossplatform + * @since 10 + */ + /** + * The density for image pixel map. + * + * @type { ?number } + * @syscap SystemCapability.Multimedia.Image.ImageSource + * @crossplatform + * @atomicservice + * @since 11 + */ + /** + * The density for image pixel map. + * + * @type { ?number } + * @syscap SystemCapability.Multimedia.Image.ImageSource + * @crossplatform + * @form + * @atomicservice + * @since 12 + */ + fitDensity?: number; + /** + * Color space of the image pixel map. + * + * @type { ?colorSpaceManager.ColorSpaceManager } + * @syscap SystemCapability.Multimedia.Image.ImageSource + * @crossplatform + * @since 11 + */ + desiredColorSpace?: colorSpaceManager.ColorSpaceManager; + /** + * The desired dynamic range of the image pixelmap. + * + * @type { ?DecodingDynamicRange } + * @syscap SystemCapability.Multimedia.Image.ImageSource + * @since 12 + */ + desiredDynamicRange?: DecodingDynamicRange; + } + /** + * Describes image color components. + * + * @typedef Component + * @syscap SystemCapability.Multimedia.Image.Core + * @since 9 + */ + interface Component { + /** + * Component type. + * + * @type { ComponentType } + * @syscap SystemCapability.Multimedia.Image.Core + * @since 9 + */ + readonly componentType: ComponentType; + /** + * Row stride. + * + * @type { number } + * @syscap SystemCapability.Multimedia.Image.Core + * @since 9 + */ + readonly rowStride: number; + /** + * Pixel stride. + * + * @type { number } + * @syscap SystemCapability.Multimedia.Image.Core + * @since 9 + */ + readonly pixelStride: number; + /** + * Component buffer. + * + * @type { ArrayBuffer } + * @syscap SystemCapability.Multimedia.Image.Core + * @since 9 + */ + readonly byteBuffer: ArrayBuffer; + } + /** + * Initialization options for pixelmap. + * + * @typedef InitializationOptions + * @syscap SystemCapability.Multimedia.Image.Core + * @since 8 + */ + /** + * Initialization options for pixelmap. + * + * @typedef InitializationOptions + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 10 + */ + /** + * Initialization options for pixelmap. + * + * @typedef InitializationOptions + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @atomicservice + * @since 11 + */ + /** + * Initialization options for pixelmap. + * + * @typedef InitializationOptions + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @form + * @atomicservice + * @since 12 + */ + interface InitializationOptions { + /** + * PixelMap size. + * + * @type { Size } + * @syscap SystemCapability.Multimedia.Image.Core + * @since 8 + */ + /** + * PixelMap size. + * + * @type { Size } + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 10 + */ + /** + * PixelMap size. + * + * @type { Size } + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @atomicservice + * @since 11 + */ + /** + * PixelMap size. + * + * @type { Size } + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @form + * @atomicservice + * @since 12 + */ + size: Size; + /** + * PixelMap source format. + * + * @type { ?PixelMapFormat } + * @syscap SystemCapability.Multimedia.Image.Core + * @since 12 + */ + srcPixelFormat?: PixelMapFormat; + /** + * PixelMap expected format. + * + * @type { ?PixelMapFormat } + * @syscap SystemCapability.Multimedia.Image.Core + * @since 8 + */ + /** + * PixelMap expected format. + * + * @type { ?PixelMapFormat } + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 10 + */ + /** + * PixelMap expected format. + * + * @type { ?PixelMapFormat } + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @atomicservice + * @since 11 + */ + /** + * PixelMap expected format. + * + * @type { ?PixelMapFormat } + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @form + * @atomicservice + * @since 12 + */ + pixelFormat?: PixelMapFormat; + /** + * Editable or not. + * + * @type { ?boolean } + * @syscap SystemCapability.Multimedia.Image.Core + * @since 8 + */ + /** + * Editable or not. + * + * @type { ?boolean } + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 10 + */ + /** + * Editable or not. + * + * @type { ?boolean } + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @atomicservice + * @since 11 + */ + /** + * Editable or not. + * + * @type { ?boolean } + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @form + * @atomicservice + * @since 12 + */ + editable?: boolean; + /** + * PixelMap expected alpha type. + * + * @type { ?AlphaType } + * @syscap SystemCapability.Multimedia.Image.Core + * @since 9 + */ + /** + * PixelMap expected alpha type. + * + * @type { ?AlphaType } + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 10 + */ + /** + * PixelMap expected alpha type. + * + * @type { ?AlphaType } + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @atomicservice + * @since 11 + */ + /** + * PixelMap expected alpha type. + * + * @type { ?AlphaType } + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @form + * @atomicservice + * @since 12 + */ + alphaType?: AlphaType; + /** + * PixelMap expected scaling effect. + * + * @type { ?ScaleMode } + * @syscap SystemCapability.Multimedia.Image.Core + * @since 9 + */ + /** + * PixelMap expected scaling effect. + * + * @type { ?ScaleMode } + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 10 + */ + /** + * PixelMap expected scaling effect. + * + * @type { ?ScaleMode } + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @atomicservice + * @since 11 + */ + /** + * PixelMap expected scaling effect. + * + * @type { ?ScaleMode } + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @form + * @atomicservice + * @since 12 + */ + scaleMode?: ScaleMode; + } + /** + * Initialization options for ImageSource. + * + * @typedef SourceOptions + * @syscap SystemCapability.Multimedia.Image.Core + * @since 9 + */ + /** + * Initialization options for ImageSource. + * + * @typedef SourceOptions + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 10 + */ + /** + * Initialization options for ImageSource. + * + * @typedef SourceOptions + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @atomicservice + * @since 11 + */ + /** + * Initialization options for ImageSource. + * + * @typedef SourceOptions + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @form + * @atomicservice + * @since 12 + */ + interface SourceOptions { + /** + * The density for ImageSource. + * + * @type { number } + * @syscap SystemCapability.Multimedia.Image.Core + * @since 9 + */ + /** + * The density for ImageSource. + * + * @type { number } + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 10 + */ + /** + * The density for ImageSource. + * + * @type { number } + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @atomicservice + * @since 11 + */ + /** + * The density for ImageSource. + * + * @type { number } + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @form + * @atomicservice + * @since 12 + */ + sourceDensity: number; + /** + * PixelMap expected format. + * + * @type { ?PixelMapFormat } + * @syscap SystemCapability.Multimedia.Image.Core + * @since 9 + */ + /** + * PixelMap expected format. + * + * @type { ?PixelMapFormat } + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 10 + */ + /** + * PixelMap expected format. + * + * @type { ?PixelMapFormat } + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @atomicservice + * @since 11 + */ + /** + * PixelMap expected format. + * + * @type { ?PixelMapFormat } + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @form + * @atomicservice + * @since 12 + */ + sourcePixelFormat?: PixelMapFormat; + /** + * PixelMap size. + * + * @type { ?Size } + * @syscap SystemCapability.Multimedia.Image.Core + * @since 9 + */ + /** + * PixelMap size. + * + * @type { ?Size } + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 10 + */ + /** + * PixelMap size. + * + * @type { ?Size } + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @atomicservice + * @since 11 + */ + /** + * PixelMap size. + * + * @type { ?Size } + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @form + * @atomicservice + * @since 12 + */ + sourceSize?: Size; + } + /** + * Create pixelmap by data buffer. + * + * @param { ArrayBuffer } colors The image color buffer. + * @param { InitializationOptions } options Initialization options for pixelmap. + * @param { AsyncCallback } callback Callback used to return the PixelMap object. + * @syscap SystemCapability.Multimedia.Image.Core + * @since 8 + */ + /** + * Create pixelmap by data buffer. + * + * @param { ArrayBuffer } colors The image color buffer. + * @param { InitializationOptions } options Initialization options for pixelmap. + * @param { AsyncCallback } callback Callback used to return the PixelMap object. + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 10 + */ + function createPixelMap(colors: ArrayBuffer, options: InitializationOptions, callback: AsyncCallback): void; + /** + * Create pixelmap by data buffer. + * + * @param { ArrayBuffer } colors The image color buffer. + * @param { InitializationOptions } options Initialization options for pixelmap. + * @returns { Promise } A Promise instance used to return the PixelMap object. + * @syscap SystemCapability.Multimedia.Image.Core + * @since 8 + */ + /** + * Create pixelmap by data buffer. + * + * @param { ArrayBuffer } colors The image color buffer. + * @param { InitializationOptions } options Initialization options for pixelmap. + * @returns { Promise } A Promise instance used to return the PixelMap object. + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 10 + */ + function createPixelMap(colors: ArrayBuffer, options: InitializationOptions): Promise; + /** + * Create pixelmap by data buffer. + * + * @param { ArrayBuffer } colors The image color buffer. + * @param { InitializationOptions } options Initialization options for pixelmap. + * @returns { PixelMap } Returns the instance if the operation is successful;Otherwise, return undefined. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. 3.Parameter verification failed. + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 12 + */ + function createPixelMapSync(colors: ArrayBuffer, options: InitializationOptions): PixelMap; + /** + * Create an empty pixelmap. + * + * @param { InitializationOptions } options Initialization options for pixelmap. + * @returns { PixelMap } Returns the instance if the operation is successful;Otherwise, return undefined. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. 3.Parameter verification failed. + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 12 + */ + function createPixelMapSync(options: InitializationOptions): PixelMap; + /** + * Transforms pixelmap from unpremultiplied alpha format to premultiplied alpha format. + * + * @param { PixelMap } src The source pixelmap. + * @param { PixelMap } dst The destination pixelmap. + * @param { AsyncCallback } callback Callback used to return the operation result. + * If the operation fails, an error message is returned. + * @throws { BusinessError } 62980103 - The image data is not supported. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. 3.Parameter verification failed. + * @throws { BusinessError } 62980246 - Failed to read the pixelMap. + * @throws { BusinessError } 62980248 - Pixelmap not allow modify. + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 12 + */ + function createPremultipliedPixelMap(src: PixelMap, dst: PixelMap, callback: AsyncCallback): void; + /** + * Transforms pixelmap from premultiplied alpha format to unpremultiplied alpha format. + * + * @param { PixelMap } src The source pixelMap. + * @param { PixelMap } dst The destination pixelmap. + * @returns { Promise } A Promise instance used to return the operation result. + * If the operation fails, an error message is returned. + * @throws { BusinessError } 62980103 - The image data is not supported. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. 3.Parameter verification failed. + * @throws { BusinessError } 62980246 - Failed to read the pixelMap. + * @throws { BusinessError } 62980248 - Pixelmap not allow modify. + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 12 + */ + function createPremultipliedPixelMap(src: PixelMap, dst: PixelMap): Promise; + /** + * Transforms pixelmap from premultiplied alpha format to unpremultiplied alpha format. + * + * @param { PixelMap } src The source pixelmap. + * @param { PixelMap } dst The destination pixelmap. + * @param { AsyncCallback } callback Callback used to return the operation result. + * If the operation fails, an error message is returned. + * @throws { BusinessError } 62980103 - The image data is not supported. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. 3.Parameter verification failed. + * @throws { BusinessError } 62980246 - Failed to read the pixelMap. + * @throws { BusinessError } 62980248 - Pixelmap not allow modify. + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 12 + */ + function createUnpremultipliedPixelMap(src: PixelMap, dst: PixelMap, callback: AsyncCallback): void; + /** + * Transforms pixelmap from premultiplied alpha format to unpremultiplied alpha format. + * + * @param { PixelMap } src The source pixelmap. + * @param { PixelMap } dst The destination pixelmap. + * @returns { Promise } A Promise instance used to return the operation result. + * If the operation fails, an error message is returned. + * @throws { BusinessError } 62980103 - The image data is not supported. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. 3.Parameter verification failed. + * @throws { BusinessError } 62980246 - Failed to read the pixelMap. + * @throws { BusinessError } 62980248 - Pixelmap not allow modify. + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 12 + */ + function createUnpremultipliedPixelMap(src: PixelMap, dst: PixelMap): Promise; + /** + * Creates a PixelMap object based on MessageSequence parameter. + * + * @param { rpc.MessageSequence } sequence - rpc.MessageSequence parameter. + * @returns { PixelMap } Returns the instance if the operation is successful;Otherwise, an exception will be thrown. + * @throws { BusinessError } 62980096 - Operation failed. + * @throws { BusinessError } 62980097 - IPC error. + * @throws { BusinessError } 62980115 - Invalid input parameter. + * @throws { BusinessError } 62980105 - Failed to get the data. + * @throws { BusinessError } 62980177 - Abnormal API environment. + * @throws { BusinessError } 62980178 - Failed to create the PixelMap. + * @throws { BusinessError } 62980179 - Abnormal buffer size. + * @throws { BusinessError } 62980180 - FD mapping failed. + * @throws { BusinessError } 62980246 - Failed to read the PixelMap. + * @syscap SystemCapability.Multimedia.Image.Core + * @since 11 + */ + function createPixelMapFromParcel(sequence: rpc.MessageSequence): PixelMap; + /** + * Creates a PixelMap object from surface id. + * + * @param { string } surfaceId - surface id. + * @param { Region } region - The region to surface. + * @returns { Promise } Returns the instance if the operation is successful;Otherwise, an exception will be thrown. + * @throws { BusinessError } 62980115 - If the image parameter invalid. + * @throws { BusinessError } 62980105 - Failed to get the data. + * @throws { BusinessError } 62980178 - Failed to create the PixelMap. + * @syscap SystemCapability.Multimedia.Image.Core + * @since 11 + */ + function createPixelMapFromSurface(surfaceId: string, region: Region): Promise; + /** + * Creates a PixelMap object from surface id. + * + * @param { string } surfaceId - surface id. + * @param { Region } region - The region to surface. + * @returns { PixelMap } Returns the instance if the operation is successful;Otherwise, an exception will be thrown. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. 3.Parameter verification failed. + * @throws { BusinessError } 62980105 - Failed to get the data. + * @throws { BusinessError } 62980178 - Failed to create the PixelMap. + * @syscap SystemCapability.Multimedia.Image.Core + * @since 12 + */ + function createPixelMapFromSurfaceSync(surfaceId: string, region: Region): PixelMap; + /** + * Creates an ImageSource instance based on the URI. + * + * @param { string } uri Image source URI. + * @returns { ImageSource } returns the ImageSource instance if the operation is successful; returns null otherwise. + * @syscap SystemCapability.Multimedia.Image.ImageSource + * @since 6 + */ + /** + * Creates an ImageSource instance based on the URI. + * + * @param { string } uri Image source URI. + * @returns { ImageSource } returns the ImageSource instance if the operation is successful; returns null otherwise. + * @syscap SystemCapability.Multimedia.Image.ImageSource + * @crossplatform + * @since 10 + */ + /** + * Creates an ImageSource instance based on the URI. + * + * @param { string } uri Image source URI. + * @returns { ImageSource } returns the ImageSource instance if the operation is successful; returns null otherwise. + * @syscap SystemCapability.Multimedia.Image.ImageSource + * @crossplatform + * @atomicservice + * @since 11 + */ + function createImageSource(uri: string): ImageSource; + /** + * Creates an ImageSource instance based on the URI. + * + * @param { string } uri Image source URI. + * @param { SourceOptions } options The config of Image source. + * @returns { ImageSource } Returns the ImageSource instance if the operation is successful; returns null otherwise. + * @syscap SystemCapability.Multimedia.Image.ImageSource + * @since 9 + */ + /** + * Creates an ImageSource instance based on the URI. + * + * @param { string } uri Image source URI. + * @param { SourceOptions } options The config of Image source. + * @returns { ImageSource } Returns the ImageSource instance if the operation is successful; returns null otherwise. + * @syscap SystemCapability.Multimedia.Image.ImageSource + * @crossplatform + * @since 10 + */ + /** + * Creates an ImageSource instance based on the URI. + * + * @param { string } uri Image source URI. + * @param { SourceOptions } options The config of Image source. + * @returns { ImageSource } Returns the ImageSource instance if the operation is successful; returns null otherwise. + * @syscap SystemCapability.Multimedia.Image.ImageSource + * @crossplatform + * @atomicservice + * @since 11 + */ + /** + * Creates an ImageSource instance based on the URI. + * + * @param { string } uri Image source URI. + * @param { SourceOptions } options The config of Image source. + * @returns { ImageSource } Returns the ImageSource instance if the operation is successful; returns null otherwise. + * @syscap SystemCapability.Multimedia.Image.ImageSource + * @crossplatform + * @form + * @atomicservice + * @since 12 + */ + function createImageSource(uri: string, options: SourceOptions): ImageSource; + /** + * Creates an ImageSource instance based on the file descriptor. + * + * @param { number } fd ID of a file descriptor. + * @returns { ImageSource } Returns the ImageSource instance if the operation is successful; returns null otherwise. + * @syscap SystemCapability.Multimedia.Image.ImageSource + * @since 7 + */ + /** + * Creates an ImageSource instance based on the file descriptor. + * + * @param { number } fd ID of a file descriptor. + * @returns { ImageSource } Returns the ImageSource instance if the operation is successful; returns null otherwise. + * @syscap SystemCapability.Multimedia.Image.ImageSource + * @crossplatform + * @since 10 + */ + /** + * Creates an ImageSource instance based on the file descriptor. + * + * @param { number } fd ID of a file descriptor. + * @returns { ImageSource } Returns the ImageSource instance if the operation is successful; returns null otherwise. + * @syscap SystemCapability.Multimedia.Image.ImageSource + * @crossplatform + * @atomicservice + * @since 11 + */ + function createImageSource(fd: number): ImageSource; + /** + * Creates an ImageSource instance based on the file descriptor. + * + * @param { number } fd ID of a file descriptor. + * @param { SourceOptions } options The config of Image source. + * @returns { ImageSource } Returns the ImageSource instance if the operation is successful; returns null otherwise. + * @syscap SystemCapability.Multimedia.Image.ImageSource + * @since 9 + */ + /** + * Creates an ImageSource instance based on the file descriptor. + * + * @param { number } fd ID of a file descriptor. + * @param { SourceOptions } options The config of Image source. + * @returns { ImageSource } Returns the ImageSource instance if the operation is successful; returns null otherwise. + * @syscap SystemCapability.Multimedia.Image.ImageSource + * @crossplatform + * @since 10 + */ + /** + * Creates an ImageSource instance based on the file descriptor. + * + * @param { number } fd ID of a file descriptor. + * @param { SourceOptions } options The config of Image source. + * @returns { ImageSource } Returns the ImageSource instance if the operation is successful; returns null otherwise. + * @syscap SystemCapability.Multimedia.Image.ImageSource + * @crossplatform + * @atomicservice + * @since 11 + */ + /** + * Creates an ImageSource instance based on the file descriptor. + * + * @param { number } fd ID of a file descriptor. + * @param { SourceOptions } options The config of Image source. + * @returns { ImageSource } Returns the ImageSource instance if the operation is successful; returns null otherwise. + * @syscap SystemCapability.Multimedia.Image.ImageSource + * @crossplatform + * @form + * @atomicservice + * @since 12 + */ + function createImageSource(fd: number, options: SourceOptions): ImageSource; + /** + * Creates an ImageSource instance based on the buffer. + * + * @param { ArrayBuffer } buf The buffer of the image. + * @returns { ImageSource } Returns the ImageSource instance if the operation is successful; returns null otherwise. + * @syscap SystemCapability.Multimedia.Image.ImageSource + * @since 9 + */ + /** + * Creates an ImageSource instance based on the buffer. + * + * @param { ArrayBuffer } buf The buffer of the image. + * @returns { ImageSource } Returns the ImageSource instance if the operation is successful; returns null otherwise. + * @syscap SystemCapability.Multimedia.Image.ImageSource + * @crossplatform + * @since 10 + */ + /** + * Creates an ImageSource instance based on the buffer. + * + * @param { ArrayBuffer } buf The buffer of the image. + * @returns { ImageSource } Returns the ImageSource instance if the operation is successful; returns null otherwise. + * @syscap SystemCapability.Multimedia.Image.ImageSource + * @crossplatform + * @atomicservice + * @since 11 + */ + /** + * Creates an ImageSource instance based on the buffer. + * + * @param { ArrayBuffer } buf The buffer of the image. + * @returns { ImageSource } Returns the ImageSource instance if the operation is successful; returns null otherwise. + * @syscap SystemCapability.Multimedia.Image.ImageSource + * @crossplatform + * @form + * @atomicservice + * @since 12 + */ + function createImageSource(buf: ArrayBuffer): ImageSource; + /** + * Creates an ImageSource instance based on the buffer. + * + * @param { ArrayBuffer } buf The buffer of the image. + * @param { SourceOptions } options The config of Image source. + * @returns { ImageSource } Returns the ImageSource instance if the operation is successful; returns null otherwise. + * @syscap SystemCapability.Multimedia.Image.ImageSource + * @since 9 + */ + /** + * Creates an ImageSource instance based on the buffer. + * + * @param { ArrayBuffer } buf The buffer of the image. + * @param { SourceOptions } options The config of Image source. + * @returns { ImageSource } Returns the ImageSource instance if the operation is successful; returns null otherwise. + * @syscap SystemCapability.Multimedia.Image.ImageSource + * @crossplatform + * @since 10 + */ + /** + * Creates an ImageSource instance based on the buffer. + * + * @param { ArrayBuffer } buf The buffer of the image. + * @param { SourceOptions } options The config of Image source. + * @returns { ImageSource } Returns the ImageSource instance if the operation is successful; returns null otherwise. + * @syscap SystemCapability.Multimedia.Image.ImageSource + * @crossplatform + * @atomicservice + * @since 11 + */ + /** + * Creates an ImageSource instance based on the buffer. + * + * @param { ArrayBuffer } buf The buffer of the image. + * @param { SourceOptions } options The config of Image source. + * @returns { ImageSource } Returns the ImageSource instance if the operation is successful; returns null otherwise. + * @syscap SystemCapability.Multimedia.Image.ImageSource + * @crossplatform + * @form + * @atomicservice + * @since 12 + */ + function createImageSource(buf: ArrayBuffer, options: SourceOptions): ImageSource; + /** + * Creates an ImageSource instance based on the raw file descriptor. + * + * @param { resourceManager.RawFileDescriptor } rawfile The raw file descriptor of the image. + * @param { SourceOptions } options The config of Image source. + * @returns { ImageSource } Returns the ImageSource instance if the operation is successful; returns null otherwise. + * @syscap SystemCapability.Multimedia.Image.ImageSource + * @crossplatform + * @atomicservice + * @since 11 + */ + function createImageSource(rawfile: resourceManager.RawFileDescriptor, options?: SourceOptions): ImageSource; + /** + * Creates an ImageSource instance based on the buffer in incremental. + * + * @param { ArrayBuffer } buf The buffer of the image. + * @returns { ImageSource } Returns the ImageSource instance if the operation is successful; returns null otherwise. + * @syscap SystemCapability.Multimedia.Image.ImageSource + * @since 9 + */ + /** + * Creates an ImageSource instance based on the buffer in incremental. + * + * @param { ArrayBuffer } buf The buffer of the image. + * @returns { ImageSource } Returns the ImageSource instance if the operation is successful; returns null otherwise. + * @syscap SystemCapability.Multimedia.Image.ImageSource + * @crossplatform + * @since 10 + */ + function CreateIncrementalSource(buf: ArrayBuffer): ImageSource; + /** + * Creates an ImageSource instance based on the buffer in incremental. + * + * @param { ArrayBuffer } buf The buffer of the image. + * @param { SourceOptions } options The config of source. + * @returns { ImageSource } Returns the ImageSource instance if the operation is successful; returns null otherwise. + * @syscap SystemCapability.Multimedia.Image.ImageSource + * @since 9 + */ + /** + * Creates an ImageSource instance based on the buffer in incremental. + * + * @param { ArrayBuffer } buf The buffer of the image. + * @param { SourceOptions } options The config of source. + * @returns { ImageSource } Returns the ImageSource instance if the operation is successful; returns null otherwise. + * @syscap SystemCapability.Multimedia.Image.ImageSource + * @crossplatform + * @since 10 + */ + function CreateIncrementalSource(buf: ArrayBuffer, options?: SourceOptions): ImageSource; + /** + * Creates an ImagePacker instance. + * + * @returns { ImagePacker } Returns the ImagePacker instance if the operation is successful; returns null otherwise. + * @syscap SystemCapability.Multimedia.Image.ImagePacker + * @since 6 + */ + /** + * Creates an ImagePacker instance. + * + * @returns { ImagePacker } Returns the ImagePacker instance if the operation is successful; returns null otherwise. + * @syscap SystemCapability.Multimedia.Image.ImagePacker + * @crossplatform + * @since 10 + */ + /** + * Creates an ImagePacker instance. + * + * @returns { ImagePacker } Returns the ImagePacker instance if the operation is successful; returns null otherwise. + * @syscap SystemCapability.Multimedia.Image.ImagePacker + * @crossplatform + * @atomicservice + * @since 11 + */ + function createImagePacker(): ImagePacker; + /** + * Creates an ImageReceiver instance. + * + * @param { number } width The default width in pixels of the Images that this receiver will produce. + * @param { number } height The default height in pixels of the Images that this receiver will produce. + * @param { number } format The format of the Image that this receiver will produce. This must be one of the + * {@link ImageFormat} constants. + * @param { number } capacity The maximum number of images the user will want to access simultaneously. + * @returns { ImageReceiver } Returns the ImageReceiver instance if the operation is successful; returns null otherwise. + * @syscap SystemCapability.Multimedia.Image.ImageReceiver + * @since 9 + * @deprecated since 11 + * @useinstead image#createImageReceiver + */ + function createImageReceiver(width: number, height: number, format: number, capacity: number): ImageReceiver; + /** + * Creates an ImageReceiver instance. + * + * @param { Size } size - The default {@link Size} in pixels of the Images that this receiver will produce. + * @param { ImageFormat } format - The format of the Image that this receiver will produce. This must be one of the + * {@link ImageFormat} constants. + * @param { number } capacity - The maximum number of images the user will want to access simultaneously. + * @returns { ImageReceiver } Returns the ImageReceiver instance if the operation is successful; returns null otherwise. + * @throws { BusinessError } 401 - Parameter error.Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; + * @syscap SystemCapability.Multimedia.Image.ImageReceiver + * @since 11 + */ + function createImageReceiver(size: Size, format: ImageFormat, capacity: number): ImageReceiver; + /** + * Creates an ImageCreator instance. + * + * @param { number } width The default width in pixels of the Images that this creator will produce. + * @param { number } height The default height in pixels of the Images that this creator will produce. + * @param { number } format The format of the Image that this creator will produce. This must be one of the + * {@link ImageFormat} constants. + * @param { number } capacity The maximum number of images the user will want to access simultaneously. + * @returns { ImageCreator } Returns the ImageCreator instance if the operation is successful; returns null otherwise. + * @syscap SystemCapability.Multimedia.Image.ImageCreator + * @since 9 + * @deprecated since 11 + * @useinstead image#createImageCreator + */ + function createImageCreator(width: number, height: number, format: number, capacity: number): ImageCreator; + /** + * Creates an ImageCreator instance. + * + * @param { Size } size - The default {@link Size} in pixels of the Images that this creator will produce. + * @param { ImageFormat } format - The format of the Image that this creator will produce. This must be one of the + * {@link ImageFormat} constants. + * @param { number } capacity - The maximum number of images the user will want to access simultaneously. + * @returns { ImageCreator } Returns the ImageCreator instance if the operation is successful; returns null otherwise. + * @throws { BusinessError } 401 - Parameter error.Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; + * @syscap SystemCapability.Multimedia.Image.ImageCreator + * @since 11 + */ + function createImageCreator(size: Size, format: ImageFormat, capacity: number): ImageCreator; + /** + * PixelMap instance. + * + * @typedef PixelMap + * @syscap SystemCapability.Multimedia.Image.Core + * @since 7 + */ + /** + * PixelMap instance. + * + * @typedef PixelMap + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 10 + */ + /** + * PixelMap instance. + * + * @typedef PixelMap + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @atomicservice + * @since 11 + */ + /** + * PixelMap instance. + * + * @typedef PixelMap + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @form + * @atomicservice + * @since 12 + */ + interface PixelMap { + /** + * Whether the image pixel map can be edited. + * + * @type { boolean } + * @syscap SystemCapability.Multimedia.Image.Core + * @since 7 + */ + /** + * Whether the image pixel map can be edited. + * + * @type { boolean } + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 10 + */ + /** + * Whether the image pixel map can be edited. + * + * @type { boolean } + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @atomicservice + * @since 11 + */ + /** + * Whether the image pixel map can be edited. + * + * @type { boolean } + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @form + * @atomicservice + * @since 12 + */ + readonly isEditable: boolean; + /** + * Reads image pixel map data and writes the data to an ArrayBuffer. This method uses + * a promise to return the result. + * + * @param { ArrayBuffer } dst A buffer to which the image pixel map data will be written. + * @returns { Promise } A Promise instance used to return the operation result. If the operation fails, an error message is returned. + * @syscap SystemCapability.Multimedia.Image.Core + * @since 7 + */ + /** + * Reads image pixel map data and writes the data to an ArrayBuffer. This method uses + * a promise to return the result. + * + * @param { ArrayBuffer } dst A buffer to which the image pixel map data will be written. + * @returns { Promise } A Promise instance used to return the operation result. If the operation fails, an error message is returned. + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 10 + */ + /** + * Reads image pixel map data and writes the data to an ArrayBuffer. This method uses + * a promise to return the result. + * + * @param { ArrayBuffer } dst A buffer to which the image pixel map data will be written. + * @returns { Promise } A Promise instance used to return the operation result. If the operation fails, an error message is returned. + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @atomicservice + * @since 11 + */ + /** + * Reads image pixel map data and writes the data to an ArrayBuffer. This method uses + * a promise to return the result. + * + * @param { ArrayBuffer } dst A buffer to which the image pixel map data will be written. + * @returns { Promise } A Promise instance used to return the operation result. If the operation fails, an error message is returned. + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @form + * @atomicservice + * @since 12 + */ + readPixelsToBuffer(dst: ArrayBuffer): Promise; + /** + * Reads image pixel map data and writes the data to an ArrayBuffer. This method uses + * a callback to return the result. + * + * @param { ArrayBuffer } dst A buffer to which the image pixel map data will be written. + * @param { AsyncCallback } callback Callback used to return the operation result. If the operation fails, an error message is returned. + * @syscap SystemCapability.Multimedia.Image.Core + * @since 7 + */ + /** + * Reads image pixel map data and writes the data to an ArrayBuffer. This method uses + * a callback to return the result. + * + * @param { ArrayBuffer } dst A buffer to which the image pixel map data will be written. + * @param { AsyncCallback } callback Callback used to return the operation result. If the operation fails, an error message is returned. + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 10 + */ + /** + * Reads image pixel map data and writes the data to an ArrayBuffer. This method uses + * a callback to return the result. + * + * @param { ArrayBuffer } dst A buffer to which the image pixel map data will be written. + * @param { AsyncCallback } callback Callback used to return the operation result. If the operation fails, an error message is returned. + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @atomicservice + * @since 11 + */ + /** + * Reads image pixel map data and writes the data to an ArrayBuffer. This method uses + * a callback to return the result. + * + * @param { ArrayBuffer } dst A buffer to which the image pixel map data will be written. + * @param { AsyncCallback } callback Callback used to return the operation result. If the operation fails, an error message is returned. + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @form + * @atomicservice + * @since 12 + */ + readPixelsToBuffer(dst: ArrayBuffer, callback: AsyncCallback): void; + /** + * Reads image pixel map data and writes the data to an ArrayBuffer. + * + * @param { ArrayBuffer } dst A buffer to which the image pixel map data will be written. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. 3.Parameter verification failed. + * @throws { BusinessError } 501 - Resource Unavailable. + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @form + * @atomicservice + * @since 12 + */ + readPixelsToBufferSync(dst: ArrayBuffer): void; + /** + * Reads image pixel map data in an area. This method uses a promise to return the data read. + * + * @param { PositionArea } area Area from which the image pixel map data will be read. + * @returns { Promise } A Promise instance used to return the operation result. If the operation fails, an error message is returned. + * @syscap SystemCapability.Multimedia.Image.Core + * @since 7 + */ + /** + * Reads image pixel map data in an area. This method uses a promise to return the data read. + * + * @param { PositionArea } area Area from which the image pixel map data will be read. + * @returns { Promise } A Promise instance used to return the operation result. If the operation fails, an error message is returned. + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 10 + */ + /** + * Reads image pixel map data in an area. This method uses a promise to return the data read. + * + * @param { PositionArea } area Area from which the image pixel map data will be read. + * @returns { Promise } A Promise instance used to return the operation result. If the operation fails, an error message is returned. + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @atomicservice + * @since 11 + */ + /** + * Reads image pixel map data in an area. This method uses a promise to return the data read. + * + * @param { PositionArea } area Area from which the image pixel map data will be read. + * @returns { Promise } A Promise instance used to return the operation result. If the operation fails, an error message is returned. + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @form + * @atomicservice + * @since 12 + */ + readPixels(area: PositionArea): Promise; + /** + * Reads image pixel map data in an area. This method uses a callback to return the data read. + * + * @param { PositionArea } area Area from which the image pixel map data will be read. + * @param { AsyncCallback } callback Callback used to return the operation result. If the operation fails, an error message is returned. + * @syscap SystemCapability.Multimedia.Image.Core + * @since 7 + */ + /** + * Reads image pixel map data in an area. This method uses a callback to return the data read. + * + * @param { PositionArea } area Area from which the image pixel map data will be read. + * @param { AsyncCallback } callback Callback used to return the operation result. If the operation fails, an error message is returned. + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 10 + */ + /** + * Reads image pixel map data in an area. This method uses a callback to return the data read. + * + * @param { PositionArea } area Area from which the image pixel map data will be read. + * @param { AsyncCallback } callback Callback used to return the operation result. If the operation fails, an error message is returned. + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @atomicservice + * @since 11 + */ + /** + * Reads image pixel map data in an area. This method uses a callback to return the data read. + * + * @param { PositionArea } area Area from which the image pixel map data will be read. + * @param { AsyncCallback } callback Callback used to return the operation result. If the operation fails, an error message is returned. + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @form + * @atomicservice + * @since 12 + */ + readPixels(area: PositionArea, callback: AsyncCallback): void; + /** + * Reads image pixel map data in an area. + * + * @param { PositionArea } area Area from which the image pixel map data will be read. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. 3.Parameter verification failed. + * @throws { BusinessError } 501 - Resource Unavailable. + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @atomicservice + * @since 12 + */ + readPixelsSync(area: PositionArea): void; + /** + * Writes image pixel map data to the specified area. This method uses a promise to return + * the operation result. + * + * @param { PositionArea } area Area to which the image pixel map data will be written. + * @returns { Promise } A Promise instance used to return the operation result. If the operation fails, an error message is returned. + * @syscap SystemCapability.Multimedia.Image.Core + * @since 7 + */ + /** + * Writes image pixel map data to the specified area. This method uses a promise to return + * the operation result. + * + * @param { PositionArea } area Area to which the image pixel map data will be written. + * @returns { Promise } A Promise instance used to return the operation result. If the operation fails, an error message is returned. + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 10 + */ + /** + * Writes image pixel map data to the specified area. This method uses a promise to return + * the operation result. + * + * @param { PositionArea } area Area to which the image pixel map data will be written. + * @returns { Promise } A Promise instance used to return the operation result. If the operation fails, an error message is returned. + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @atomicservice + * @since 11 + */ + /** + * Writes image pixel map data to the specified area. This method uses a promise to return + * the operation result. + * + * @param { PositionArea } area Area to which the image pixel map data will be written. + * @returns { Promise } A Promise instance used to return the operation result. If the operation fails, an error message is returned. + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @form + * @atomicservice + * @since 12 + */ + writePixels(area: PositionArea): Promise; + /** + * Writes image pixel map data to the specified area. This method uses a callback to return + * the operation result. + * + * @param { PositionArea } area Area to which the image pixel map data will be written. + * @param { AsyncCallback } callback Callback used to return the operation result. If the operation fails, an error message is returned. + * @syscap SystemCapability.Multimedia.Image.Core + * @since 7 + */ + /** + * Writes image pixel map data to the specified area. This method uses a callback to return + * the operation result. + * + * @param { PositionArea } area Area to which the image pixel map data will be written. + * @param { AsyncCallback } callback Callback used to return the operation result. If the operation fails, an error message is returned. + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 10 + */ + /** + * Writes image pixel map data to the specified area. This method uses a callback to return + * the operation result. + * + * @param { PositionArea } area Area to which the image pixel map data will be written. + * @param { AsyncCallback } callback Callback used to return the operation result. If the operation fails, an error message is returned. + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @atomicservice + * @since 11 + */ + /** + * Writes image pixel map data to the specified area. This method uses a callback to return + * the operation result. + * + * @param { PositionArea } area Area to which the image pixel map data will be written. + * @param { AsyncCallback } callback Callback used to return the operation result. If the operation fails, an error message is returned. + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @form + * @atomicservice + * @since 12 + */ + writePixels(area: PositionArea, callback: AsyncCallback): void; + /** + * Writes image pixel map data to the specified area. + * + * @param { PositionArea } area Area to which the image pixel map data will be written. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. 3.Parameter verification failed. + * @throws { BusinessError } 501 - Resource Unavailable. + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @form + * @atomicservice + * @since 12 + */ + writePixelsSync(area: PositionArea): void; + /** + * Reads image data in an ArrayBuffer and writes the data to a PixelMap object. This method + * uses a promise to return the result. + * + * @param { ArrayBuffer } src A buffer from which the image data will be read. + * @returns { Promise } A Promise instance used to return the operation result. If the operation fails, an error message is returned. + * @syscap SystemCapability.Multimedia.Image.Core + * @since 7 + */ + /** + * Reads image data in an ArrayBuffer and writes the data to a PixelMap object. This method + * uses a promise to return the result. + * + * @param { ArrayBuffer } src A buffer from which the image data will be read. + * @returns { Promise } A Promise instance used to return the operation result. If the operation fails, an error message is returned. + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 10 + */ + /** + * Reads image data in an ArrayBuffer and writes the data to a PixelMap object. This method + * uses a promise to return the result. + * + * @param { ArrayBuffer } src A buffer from which the image data will be read. + * @returns { Promise } A Promise instance used to return the operation result. If the operation fails, an error message is returned. + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @atomicservice + * @since 11 + */ + /** + * Reads image data in an ArrayBuffer and writes the data to a PixelMap object. This method + * uses a promise to return the result. + * + * @param { ArrayBuffer } src A buffer from which the image data will be read. + * @returns { Promise } A Promise instance used to return the operation result. If the operation fails, an error message is returned. + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @form + * @atomicservice + * @since 12 + */ + writeBufferToPixels(src: ArrayBuffer): Promise; + /** + * Reads image data in an ArrayBuffer and writes the data to a PixelMap object. This method + * uses a callback to return the result. + * + * @param { ArrayBuffer } src A buffer from which the image data will be read. + * @param { AsyncCallback } callback Callback used to return the operation result. If the operation fails, an error message is returned. + * @syscap SystemCapability.Multimedia.Image.Core + * @since 7 + */ + /** + * Reads image data in an ArrayBuffer and writes the data to a PixelMap object. This method + * uses a callback to return the result. + * + * @param { ArrayBuffer } src A buffer from which the image data will be read. + * @param { AsyncCallback } callback Callback used to return the operation result. If the operation fails, an error message is returned. + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 10 + */ + /** + * Reads image data in an ArrayBuffer and writes the data to a PixelMap object. This method + * uses a callback to return the result. + * + * @param { ArrayBuffer } src A buffer from which the image data will be read. + * @param { AsyncCallback } callback Callback used to return the operation result. If the operation fails, an error message is returned. + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @atomicservice + * @since 11 + */ + /** + * Reads image data in an ArrayBuffer and writes the data to a PixelMap object. This method + * uses a callback to return the result. + * + * @param { ArrayBuffer } src A buffer from which the image data will be read. + * @param { AsyncCallback } callback Callback used to return the operation result. If the operation fails, an error message is returned. + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @form + * @atomicservice + * @since 12 + */ + writeBufferToPixels(src: ArrayBuffer, callback: AsyncCallback): void; + /** + * Reads image data in an ArrayBuffer and writes the data to a PixelMap object. + * + * @param { ArrayBuffer } src A buffer from which the image data will be read. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. 3.Parameter verification failed. + * @throws { BusinessError } 501 - Resource Unavailable. + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @atomicservice + * @since 12 + */ + writeBufferToPixelsSync(src: ArrayBuffer): void; + /** + * Obtains pixel map information about this image. This method uses a promise to return the information. + * + * @returns { Promise } A Promise instance used to return the image pixel map information. If the operation fails, an error message is returned. + * @syscap SystemCapability.Multimedia.Image.Core + * @since 7 + */ + /** + * Obtains pixel map information about this image. This method uses a promise to return the information. + * + * @returns { Promise } A Promise instance used to return the image pixel map information. If the operation fails, an error message is returned. + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 10 + */ + /** + * Obtains pixel map information about this image. This method uses a promise to return the information. + * + * @returns { Promise } A Promise instance used to return the image pixel map information. If the operation fails, an error message is returned. + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @atomicservice + * @since 11 + */ + /** + * Obtains pixel map information about this image. This method uses a promise to return the information. + * + * @returns { Promise } A Promise instance used to return the image pixel map information. If the operation fails, an error message is returned. + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @form + * @atomicservice + * @since 12 + */ + getImageInfo(): Promise; + /** + * Obtains pixel map information about this image. This method uses a callback to return the information. + * + * @param { AsyncCallback } callback Callback used to return the image pixel map information. + * If the operation fails, an error message is returned. + * @syscap SystemCapability.Multimedia.Image.Core + * @since 7 + */ + /** + * Obtains pixel map information about this image. This method uses a callback to return the information. + * + * @param { AsyncCallback } callback Callback used to return the image pixel map information. + * If the operation fails, an error message is returned. + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 10 + */ + /** + * Obtains pixel map information about this image. This method uses a callback to return the information. + * + * @param { AsyncCallback } callback Callback used to return the image pixel map information. + * If the operation fails, an error message is returned. + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @atomicservice + * @since 11 + */ + /** + * Obtains pixel map information about this image. This method uses a callback to return the information. + * + * @param { AsyncCallback } callback Callback used to return the image pixel map information. + * If the operation fails, an error message is returned. + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @form + * @atomicservice + * @since 12 + */ + getImageInfo(callback: AsyncCallback): void; + /** + * Get image information from image source. + * + * @returns { ImageInfo } the image information. + * @throws { BusinessError } 501 - Resource Unavailable. + * @syscap SystemCapability.Multimedia.Image.ImageSource + * @crossplatform + * @form + * @atomicservice + * @since 12 + */ + getImageInfoSync(): ImageInfo; + /** + * Obtains the number of bytes in each line of the image pixel map. + * + * @returns { number } Number of bytes in each line. + * @syscap SystemCapability.Multimedia.Image.Core + * @since 7 + */ + /** + * Obtains the number of bytes in each line of the image pixel map. + * + * @returns { number } Number of bytes in each line. + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 10 + */ + /** + * Obtains the number of bytes in each line of the image pixel map. + * + * @returns { number } Number of bytes in each line. + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @atomicservice + * @since 11 + */ + /** + * Obtains the number of bytes in each line of the image pixel map. + * + * @returns { number } Number of bytes in each line. + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @form + * @atomicservice + * @since 12 + */ + getBytesNumberPerRow(): number; + /** + * Obtains the total number of bytes of the image pixel map. + * + * @returns { number } Total number of bytes. + * @syscap SystemCapability.Multimedia.Image.Core + * @since 7 + */ + /** + * Obtains the total number of bytes of the image pixel map. + * + * @returns { number } Total number of bytes. + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 10 + */ + /** + * Obtains the total number of bytes of the image pixel map. + * + * @returns { number } Total number of bytes. + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @atomicservice + * @since 11 + */ + /** + * Obtains the total number of bytes of the image pixel map. + * + * @returns { number } Total number of bytes. + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @form + * @atomicservice + * @since 12 + */ + getPixelBytesNumber(): number; + /** + * Obtains the density of the image pixel map. + * + * @returns { number } The number of density. + * @syscap SystemCapability.Multimedia.Image.Core + * @since 9 + */ + /** + * Obtains the density of the image pixel map. + * + * @returns { number } The number of density. + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 10 + */ + /** + * Obtains the density of the image pixel map. + * + * @returns { number } The number of density. + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @atomicservice + * @since 11 + */ + /** + * Obtains the density of the image pixel map. + * + * @returns { number } The number of density. + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @form + * @atomicservice + * @since 12 + */ + getDensity(): number; + /** + * Set the transparent rate of pixel map. This method uses a callback to return the operation result. + * + * @param { number } rate The value of transparent rate. + * @param { AsyncCallback } callback Callback used to return the operation result. If the operation fails, an error message is returned. + * @syscap SystemCapability.Multimedia.Image.Core + * @since 9 + */ + /** + * Set the transparent rate of pixel map. This method uses a callback to return the operation result. + * + * @param { number } rate The value of transparent rate. + * @param { AsyncCallback } callback Callback used to return the operation result. If the operation fails, an error message is returned. + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 10 + */ + /** + * Set the transparent rate of pixel map. This method uses a callback to return the operation result. + * + * @param { number } rate The value of transparent rate. + * @param { AsyncCallback } callback Callback used to return the operation result. If the operation fails, an error message is returned. + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @atomicservice + * @since 11 + */ + /** + * Set the transparent rate of pixel map. This method uses a callback to return the operation result. + * + * @param { number } rate The value of transparent rate. + * @param { AsyncCallback } callback Callback used to return the operation result. If the operation fails, an error message is returned. + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @form + * @atomicservice + * @since 12 + */ + opacity(rate: number, callback: AsyncCallback): void; + /** + * Set the transparent rate of pixel map. This method uses a promise to return the result. + * + * @param { number } rate The value of transparent rate. + * @returns { Promise } A Promise instance used to return the operation result. If the operation fails, an error message is returned. + * @syscap SystemCapability.Multimedia.Image.Core + * @since 9 + */ + /** + * Set the transparent rate of pixel map. This method uses a promise to return the result. + * + * @param { number } rate The value of transparent rate. + * @returns { Promise } A Promise instance used to return the operation result. If the operation fails, an error message is returned. + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 10 + */ + /** + * Set the transparent rate of pixel map. This method uses a promise to return the result. + * + * @param { number } rate The value of transparent rate. + * @returns { Promise } A Promise instance used to return the operation result. If the operation fails, an error message is returned. + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @atomicservice + * @since 11 + */ + /** + * Set the transparent rate of pixel map. This method uses a promise to return the result. + * + * @param { number } rate The value of transparent rate. + * @returns { Promise } A Promise instance used to return the operation result. If the operation fails, an error message is returned. + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @form + * @atomicservice + * @since 12 + */ + opacity(rate: number): Promise; + /** + * Set the transparent rate of pixel map. + * + * @param { number } rate The value of transparent rate. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. 3.Parameter verification failed. + * @throws { BusinessError } 501 - Resource Unavailable. + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @atomicservice + * @since 12 + */ + opacitySync(rate: number): void; + /** + * Obtains new pixel map with alpha information. This method uses a promise to return the information. + * + * @returns { Promise } A Promise instance used to return the new image pixel map. If the operation fails, an error message is returned. + * @syscap SystemCapability.Multimedia.Image.Core + * @since 9 + */ + /** + * Obtains new pixel map with alpha information. This method uses a promise to return the information. + * + * @returns { Promise } A Promise instance used to return the new image pixel map. If the operation fails, an error message is returned. + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 10 + */ + /** + * Obtains new pixel map with alpha information. This method uses a promise to return the information. + * + * @returns { Promise } A Promise instance used to return the new image pixel map. If the operation fails, an error message is returned. + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @atomicservice + * @since 11 + */ + /** + * Obtains new pixel map with alpha information. This method uses a promise to return the information. + * + * @returns { Promise } A Promise instance used to return the new image pixel map. If the operation fails, an error message is returned. + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @form + * @atomicservice + * @since 12 + */ + createAlphaPixelmap(): Promise; + /** + * Obtains new pixel map with alpha information. This method uses a callback to return the information. + * + * @param { AsyncCallback } callback Callback used to return the new image pixel map. If the operation fails, an error message is returned. + * @syscap SystemCapability.Multimedia.Image.Core + * @since 9 + */ + /** + * Obtains new pixel map with alpha information. This method uses a callback to return the information. + * + * @param { AsyncCallback } callback Callback used to return the new image pixel map. If the operation fails, an error message is returned. + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 10 + */ + /** + * Obtains new pixel map with alpha information. This method uses a callback to return the information. + * + * @param { AsyncCallback } callback Callback used to return the new image pixel map. If the operation fails, an error message is returned. + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @atomicservice + * @since 11 + */ + /** + * Obtains new pixel map with alpha information. This method uses a callback to return the information. + * + * @param { AsyncCallback } callback Callback used to return the new image pixel map. If the operation fails, an error message is returned. + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @form + * @atomicservice + * @since 12 + */ + createAlphaPixelmap(callback: AsyncCallback): void; + /** + * Obtains new pixel map with alpha information. + * + * @returns { PixelMap } return the new image pixel map. If the operation fails, an error message is returned. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Parameter verification failed. + * @throws { BusinessError } 501 - Resource Unavailable. + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @atomicservice + * @since 12 + */ + createAlphaPixelmapSync(): PixelMap; + /** + * Image zoom in width and height. This method uses a callback to return the operation result. + * + * @param { number } x The zoom value of width. + * @param { number } y The zoom value of height. + * @param { AsyncCallback } callback Callback used to return the operation result. If the operation fails, an error message is returned. + * @syscap SystemCapability.Multimedia.Image.Core + * @since 9 + */ + /** + * Image zoom in width and height. This method uses a callback to return the operation result. + * + * @param { number } x The zoom value of width. + * @param { number } y The zoom value of height. + * @param { AsyncCallback } callback Callback used to return the operation result. If the operation fails, an error message is returned. + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 10 + */ + /** + * Image zoom in width and height. This method uses a callback to return the operation result. + * + * @param { number } x The zoom value of width. + * @param { number } y The zoom value of height. + * @param { AsyncCallback } callback Callback used to return the operation result. If the operation fails, an error message is returned. + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @atomicservice + * @since 11 + */ + /** + * Image zoom in width and height. This method uses a callback to return the operation result. + * + * @param { number } x The zoom value of width. + * @param { number } y The zoom value of height. + * @param { AsyncCallback } callback Callback used to return the operation result. If the operation fails, an error message is returned. + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @form + * @atomicservice + * @since 12 + */ + scale(x: number, y: number, callback: AsyncCallback): void; + /** + * Image zoom in width and height. This method uses a promise to return the result. + * + * @param { number } x The zoom value of width. + * @param { number } y The zoom value of height. + * @returns { Promise } A Promise instance used to return the operation result. If the operation fails, an error message is returned. + * @syscap SystemCapability.Multimedia.Image.Core + * @since 9 + */ + /** + * Image zoom in width and height. This method uses a promise to return the result. + * + * @param { number } x The zoom value of width. + * @param { number } y The zoom value of height. + * @returns { Promise } A Promise instance used to return the operation result. If the operation fails, an error message is returned. + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 10 + */ + /** + * Image zoom in width and height. This method uses a promise to return the result. + * + * @param { number } x The zoom value of width. + * @param { number } y The zoom value of height. + * @returns { Promise } A Promise instance used to return the operation result. If the operation fails, an error message is returned. + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @atomicservice + * @since 11 + */ + /** + * Image zoom in width and height. This method uses a promise to return the result. + * + * @param { number } x The zoom value of width. + * @param { number } y The zoom value of height. + * @returns { Promise } A Promise instance used to return the operation result. If the operation fails, an error message is returned. + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @form + * @atomicservice + * @since 12 + */ + scale(x: number, y: number): Promise; + /** + * Image zoom in width and height. + * + * @param { number } x The zoom value of width. + * @param { number } y The zoom value of height. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. 3.Parameter verification failed. + * @throws { BusinessError } 501 - Resource Unavailable. + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @atomicservice + * @since 12 + */ + scaleSync(x: number, y: number): void; + /** + * Image position transformation. This method uses a callback to return the operation result. + * + * @param { number } x The position value of width. + * @param { number } y The position value of height. + * @param { AsyncCallback } callback Callback used to return the operation result. If the operation fails, an error message is returned. + * @syscap SystemCapability.Multimedia.Image.Core + * @since 9 + */ + /** + * Image position transformation. This method uses a callback to return the operation result. + * + * @param { number } x The position value of width. + * @param { number } y The position value of height. + * @param { AsyncCallback } callback Callback used to return the operation result. If the operation fails, an error message is returned. + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 10 + */ + /** + * Image position transformation. This method uses a callback to return the operation result. + * + * @param { number } x The position value of width. + * @param { number } y The position value of height. + * @param { AsyncCallback } callback Callback used to return the operation result. If the operation fails, an error message is returned. + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @atomicservice + * @since 11 + */ + /** + * Image position transformation. This method uses a callback to return the operation result. + * + * @param { number } x The position value of width. + * @param { number } y The position value of height. + * @param { AsyncCallback } callback Callback used to return the operation result. If the operation fails, an error message is returned. + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @form + * @atomicservice + * @since 12 + */ + translate(x: number, y: number, callback: AsyncCallback): void; + /** + * Image position transformation. This method uses a promise to return the result. + * + * @param { number } x The position value of width. + * @param { number } y The position value of height. + * @returns { Promise } A Promise instance used to return the operation result. If the operation fails, an error message is returned. + * @syscap SystemCapability.Multimedia.Image.Core + * @since 9 + */ + /** + * Image position transformation. This method uses a promise to return the result. + * + * @param { number } x The position value of width. + * @param { number } y The position value of height. + * @returns { Promise } A Promise instance used to return the operation result. If the operation fails, an error message is returned. + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 10 + */ + /** + * Image position transformation. This method uses a promise to return the result. + * + * @param { number } x The position value of width. + * @param { number } y The position value of height. + * @returns { Promise } A Promise instance used to return the operation result. If the operation fails, an error message is returned. + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @atomicservice + * @since 11 + */ + /** + * Image position transformation. This method uses a promise to return the result. + * + * @param { number } x The position value of width. + * @param { number } y The position value of height. + * @returns { Promise } A Promise instance used to return the operation result. If the operation fails, an error message is returned. + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @form + * @atomicservice + * @since 12 + */ + translate(x: number, y: number): Promise; + /** + * Image position transformation. + * + * @param { number } x The position value of width. + * @param { number } y The position value of height. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. 3.Parameter verification failed. + * @throws { BusinessError } 501 - Resource Unavailable. + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @atomicservice + * @since 12 + */ + translateSync(x: number, y: number): void; + /** + * Image rotation. This method uses a callback to return the operation result. + * + * @param { number } angle The rotation angle. + * @param { AsyncCallback } callback Callback used to return the operation result. If the operation fails, an error message is returned. + * @syscap SystemCapability.Multimedia.Image.Core + * @since 9 + */ + /** + * Image rotation. This method uses a callback to return the operation result. + * + * @param { number } angle The rotation angle. + * @param { AsyncCallback } callback Callback used to return the operation result. If the operation fails, an error message is returned. + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 10 + */ + /** + * Image rotation. This method uses a callback to return the operation result. + * + * @param { number } angle The rotation angle. + * @param { AsyncCallback } callback Callback used to return the operation result. If the operation fails, an error message is returned. + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @atomicservice + * @since 11 + */ + /** + * Image rotation. This method uses a callback to return the operation result. + * + * @param { number } angle The rotation angle. + * @param { AsyncCallback } callback Callback used to return the operation result. If the operation fails, an error message is returned. + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @form + * @atomicservice + * @since 12 + */ + rotate(angle: number, callback: AsyncCallback): void; + /** + * Image rotation. This method uses a promise to return the result. + * + * @param { number } angle The rotation angle. + * @returns { Promise } A Promise instance used to return the operation result. If the operation fails, an error message is returned. + * @syscap SystemCapability.Multimedia.Image.Core + * @since 9 + */ + /** + * Image rotation. This method uses a promise to return the result. + * + * @param { number } angle The rotation angle. + * @returns { Promise } A Promise instance used to return the operation result. If the operation fails, an error message is returned. + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 10 + */ + /** + * Image rotation. This method uses a promise to return the result. + * + * @param { number } angle The rotation angle. + * @returns { Promise } A Promise instance used to return the operation result. If the operation fails, an error message is returned. + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @atomicservice + * @since 11 + */ + /** + * Image rotation. This method uses a promise to return the result. + * + * @param { number } angle The rotation angle. + * @returns { Promise } A Promise instance used to return the operation result. If the operation fails, an error message is returned. + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @form + * @atomicservice + * @since 12 + */ + rotate(angle: number): Promise; + /** + * Image rotation. + * + * @param { number } angle The rotation angle. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. 3.Parameter verification failed. + * @throws { BusinessError } 501 - Resource Unavailable. + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @atomicservice + * @since 12 + */ + rotateSync(angle: number): void; + /** + * Image flipping. This method uses a callback to return the operation result. + * + * @param { boolean } horizontal Is flip in horizontal. + * @param { boolean } vertical Is flip in vertical. + * @param { AsyncCallback } callback Callback used to return the operation result. If the operation fails, an error message is returned. + * @syscap SystemCapability.Multimedia.Image.Core + * @since 9 + */ + /** + * Image flipping. This method uses a callback to return the operation result. + * + * @param { boolean } horizontal Is flip in horizontal. + * @param { boolean } vertical Is flip in vertical. + * @param { AsyncCallback } callback Callback used to return the operation result. If the operation fails, an error message is returned. + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 10 + */ + /** + * Image flipping. This method uses a callback to return the operation result. + * + * @param { boolean } horizontal Is flip in horizontal. + * @param { boolean } vertical Is flip in vertical. + * @param { AsyncCallback } callback Callback used to return the operation result. If the operation fails, an error message is returned. + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @atomicservice + * @since 11 + */ + /** + * Image flipping. This method uses a callback to return the operation result. + * + * @param { boolean } horizontal Is flip in horizontal. + * @param { boolean } vertical Is flip in vertical. + * @param { AsyncCallback } callback Callback used to return the operation result. If the operation fails, an error message is returned. + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @form + * @atomicservice + * @since 12 + */ + flip(horizontal: boolean, vertical: boolean, callback: AsyncCallback): void; + /** + * Image flipping. This method uses a promise to return the result. + * + * @param { boolean } horizontal Is flip in horizontal. + * @param { boolean } vertical Is flip in vertical. + * @returns { Promise } A Promise instance used to return the operation result. If the operation fails, an error message is returned. + * @syscap SystemCapability.Multimedia.Image.Core + * @since 9 + */ + /** + * Image flipping. This method uses a promise to return the result. + * + * @param { boolean } horizontal Is flip in horizontal. + * @param { boolean } vertical Is flip in vertical. + * @returns { Promise } A Promise instance used to return the operation result. If the operation fails, an error message is returned. + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 10 + */ + /** + * Image flipping. This method uses a promise to return the result. + * + * @param { boolean } horizontal Is flip in horizontal. + * @param { boolean } vertical Is flip in vertical. + * @returns { Promise } A Promise instance used to return the operation result. If the operation fails, an error message is returned. + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @atomicservice + * @since 11 + */ + /** + * Image flipping. This method uses a promise to return the result. + * + * @param { boolean } horizontal Is flip in horizontal. + * @param { boolean } vertical Is flip in vertical. + * @returns { Promise } A Promise instance used to return the operation result. If the operation fails, an error message is returned. + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @form + * @atomicservice + * @since 12 + */ + flip(horizontal: boolean, vertical: boolean): Promise; + /** + * Image flipping. + * + * @param { boolean } horizontal Is flip in horizontal. + * @param { boolean } vertical Is flip in vertical. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. 3.Parameter verification failed. + * @throws { BusinessError } 501 - Resource Unavailable. + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @atomicservice + * @since 12 + */ + flipSync(horizontal: boolean, vertical: boolean): void; + /** + * Crop the image. This method uses a callback to return the operation result. + * + * @param { Region } region The region to crop. + * @param { AsyncCallback } callback Callback used to return the operation result. If the operation fails, an error message is returned. + * @syscap SystemCapability.Multimedia.Image.Core + * @since 9 + */ + /** + * Crop the image. This method uses a callback to return the operation result. + * + * @param { Region } region The region to crop. + * @param { AsyncCallback } callback Callback used to return the operation result. If the operation fails, an error message is returned. + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 10 + */ + /** + * Crop the image. This method uses a callback to return the operation result. + * + * @param { Region } region The region to crop. + * @param { AsyncCallback } callback Callback used to return the operation result. If the operation fails, an error message is returned. + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @atomicservice + * @since 11 + */ + /** + * Crop the image. This method uses a callback to return the operation result. + * + * @param { Region } region The region to crop. + * @param { AsyncCallback } callback Callback used to return the operation result. If the operation fails, an error message is returned. + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @form + * @atomicservice + * @since 12 + */ + crop(region: Region, callback: AsyncCallback): void; + /** + * Crop the image. This method uses a promise to return the result. + * + * @param { Region } region The region to crop. + * @returns { Promise } A Promise instance used to return the operation result. If the operation fails, an error message is returned. + * @syscap SystemCapability.Multimedia.Image.Core + * @since 9 + */ + /** + * Crop the image. This method uses a promise to return the result. + * + * @param { Region } region The region to crop. + * @returns { Promise } A Promise instance used to return the operation result. If the operation fails, an error message is returned. + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 10 + */ + /** + * Crop the image. This method uses a promise to return the result. + * + * @param { Region } region The region to crop. + * @returns { Promise } A Promise instance used to return the operation result. If the operation fails, an error message is returned. + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @atomicservice + * @since 11 + */ + /** + * Crop the image. This method uses a promise to return the result. + * + * @param { Region } region The region to crop. + * @returns { Promise } A Promise instance used to return the operation result. If the operation fails, an error message is returned. + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @form + * @atomicservice + * @since 12 + */ + crop(region: Region): Promise; + /** + * Crop the image. + * + * @param { Region } region The region to crop. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. 3.Parameter verification failed. + * @throws { BusinessError } 501 - Resource Unavailable. + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @atomicservice + * @since 12 + */ + cropSync(region: Region): void; + /** + * Get color space of pixel map. + * + * @returns { colorSpaceManager.ColorSpaceManager } If the operation fails, an error message is returned. + * @throws { BusinessError } 62980101 - The image data is abnormal. + * @throws { BusinessError } 62980103 - The image data is not supported. + * @throws { BusinessError } 62980115 - Invalid image parameter. + * @syscap SystemCapability.Multimedia.Image.Core + * @since 10 + */ + /** + * Get color space of pixel map. + * + * @returns { colorSpaceManager.ColorSpaceManager } If the operation fails, an error message is returned. + * @throws { BusinessError } 62980101 - If the image data abnormal. + * @throws { BusinessError } 62980103 - If the image data unsupport. + * @throws { BusinessError } 62980115 - If the image parameter invalid. + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 11 + */ + getColorSpace(): colorSpaceManager.ColorSpaceManager; + /** + * Marshalling pixelmap and write into MessageSequence. + * + * @param { rpc.MessageSequence } sequence rpc.MessageSequence parameter. + * @throws { BusinessError } 62980115 - Invalid image parameter. + * @throws { BusinessError } 62980097 - IPC error. + * @syscap SystemCapability.Multimedia.Image.Core + * @since 10 + */ + marshalling(sequence: rpc.MessageSequence): void; + /** + * Creates a PixelMap object based on MessageSequence parameter. + * + * @param { rpc.MessageSequence } sequence rpc.MessageSequence parameter. + * @returns { Promise } A Promise instance used to return the PixelMap object. + * @throws { BusinessError } 62980115 - Invalid image parameter. + * @throws { BusinessError } 62980097 - IPC error. + * @throws { BusinessError } 62980096 - The operation failed. + * @syscap SystemCapability.Multimedia.Image.Core + * @since 10 + */ + unmarshalling(sequence: rpc.MessageSequence): Promise; + /** + * Set color space of pixel map. + * + * This method is only used to set the colorspace property of pixelmap, while all pixel data remains the same after calling this method. + * If you want to change colorspace for all pixels, use method {@Link #applyColorSpace(colorSpaceManager.ColorSpaceManager)} or + * {@Link #applyColorSpace(colorSpaceManager.ColorSpaceManager, AsyncCallback)}. + * + * @param { colorSpaceManager.ColorSpaceManager } colorSpace The color space for pixel map. + * @throws { BusinessError } 62980111 - The image source data is incomplete. + * @throws { BusinessError } 62980115 - Invalid image parameter. + * @syscap SystemCapability.Multimedia.Image.Core + * @since 10 + */ + /** + * Set color space of pixel map. + * + * This method is only used to set the colorspace property of pixelmap, while all pixel data remains the same after calling this method. + * If you want to change colorspace for all pixels, use method {@Link #applyColorSpace(colorSpaceManager.ColorSpaceManager)} or + * {@Link #applyColorSpace(colorSpaceManager.ColorSpaceManager, AsyncCallback)}. + * + * @param { colorSpaceManager.ColorSpaceManager } colorSpace The color space for pixel map. + * @throws { BusinessError } 62980111 - If the operation invalid. + * @throws { BusinessError } 62980115 - If the image parameter invalid. + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 11 + */ + setColorSpace(colorSpace: colorSpaceManager.ColorSpaceManager): void; + /** + * Is it stride Alignment + * + * @type { boolean } + * @readonly + * @syscap SystemCapability.Multimedia.Image.Core + * @since 11 + */ + readonly isStrideAlignment: boolean; + /** + * Apply color space of pixel map, the pixels will be changed by input color space. This method uses a callback to return the operation result. + * + * This method is used to change color space of pixelmap. Pixel data will be changed by calling this method. + * If you want to set the colorspace property of pixelmap only, use method {@Link #setColorSpace(colorSpaceManager.ColorSpaceManager)}. + * + * @param { colorSpaceManager.ColorSpaceManager } targetColorSpace - The color space for pixel map. + * @param { AsyncCallback } callback - Callback used to return the operation result. If the operation fails, an error message is returned. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. 3.Parameter verification failed. + * @throws { BusinessError } 62980104 - Failed to initialize the internal object. + * @throws { BusinessError } 62980108 - Failed to convert the color space. + * @throws { BusinessError } 62980115 - Invalid image parameter. + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 11 + */ + applyColorSpace(targetColorSpace: colorSpaceManager.ColorSpaceManager, callback: AsyncCallback): void; + /** + * Apply color space of pixel map, the pixels will be changed by input color space. This method uses a promise to return the result. + * + * This method is used to change color space of pixelmap. Pixel data will be changed by calling this method. + * If you want to set the colorspace property of pixelmap only, use method {@Link #setColorSpace(colorSpaceManager.ColorSpaceManager)}. + * + * @param { colorSpaceManager.ColorSpaceManager } targetColorSpace - The color space for pixel map. + * @returns { Promise } A Promise instance used to return the operation result. If the operation fails, an error message is returned. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. 3.Parameter verification failed. + * @throws { BusinessError } 62980104 - Failed to initialize the internal object. + * @throws { BusinessError } 62980108 - Failed to convert the color space. + * @throws { BusinessError } 62980115 - Invalid image parameter. + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 11 + */ + applyColorSpace(targetColorSpace: colorSpaceManager.ColorSpaceManager): Promise; + /** + * Releases this PixelMap object. This method uses a callback to return the result. + * + * @param { AsyncCallback } callback Callback invoked for instance release. If the operation fails, an error message is returned. + * @syscap SystemCapability.Multimedia.Image.Core + * @since 7 + */ + /** + * Releases this PixelMap object. This method uses a callback to return the result. + * + * @param { AsyncCallback } callback Callback invoked for instance release. If the operation fails, an error message is returned. + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 10 + */ + /** + * Releases this PixelMap object. This method uses a callback to return the result. + * + * @param { AsyncCallback } callback Callback invoked for instance release. If the operation fails, an error message is returned. + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @atomicservice + * @since 11 + */ + /** + * Releases this PixelMap object. This method uses a callback to return the result. + * + * @param { AsyncCallback } callback Callback invoked for instance release. If the operation fails, an error message is returned. + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @form + * @atomicservice + * @since 12 + */ + release(callback: AsyncCallback): void; + /** + * Releases this PixelMap object. This method uses a promise to return the result. + * + * @returns { Promise } A Promise instance used to return the instance release result. If the operation fails, an error message is returned. + * @syscap SystemCapability.Multimedia.Image.Core + * @since 7 + */ + /** + * Releases this PixelMap object. This method uses a promise to return the result. + * + * @returns { Promise } A Promise instance used to return the instance release result. If the operation fails, an error message is returned. + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 10 + */ + /** + * Releases this PixelMap object. This method uses a promise to return the result. + * + * @returns { Promise } A Promise instance used to return the instance release result. If the operation fails, an error message is returned. + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @atomicservice + * @since 11 + */ + /** + * Releases this PixelMap object. This method uses a promise to return the result. + * + * @returns { Promise } A Promise instance used to return the instance release result. If the operation fails, an error message is returned. + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @form + * @atomicservice + * @since 12 + */ + release(): Promise; + } + /** + * ImageSource instance. + * + * @typedef ImageSource + * @syscap SystemCapability.Multimedia.Image.ImageSource + * @since 6 + */ + /** + * ImageSource instance. + * + * @typedef ImageSource + * @syscap SystemCapability.Multimedia.Image.ImageSource + * @crossplatform + * @since 10 + */ + /** + * ImageSource instance. + * + * @typedef ImageSource + * @syscap SystemCapability.Multimedia.Image.ImageSource + * @crossplatform + * @atomicservice + * @since 11 + */ + /** + * ImageSource instance. + * + * @typedef ImageSource + * @syscap SystemCapability.Multimedia.Image.ImageSource + * @crossplatform + * @form + * @atomicservice + * @since 12 + */ + interface ImageSource { + /** + * Obtains information about an image with the specified sequence number and uses a callback + * to return the result. + * + * @param { number } index Sequence number of an image. + * @param { AsyncCallback } callback Callback used to return the image information. + * @syscap SystemCapability.Multimedia.Image.ImageSource + * @since 6 + */ + /** + * Obtains information about an image with the specified sequence number and uses a callback + * to return the result. + * + * @param { number } index Sequence number of an image. + * @param { AsyncCallback } callback Callback used to return the image information. + * @syscap SystemCapability.Multimedia.Image.ImageSource + * @crossplatform + * @since 10 + */ + /** + * Obtains information about an image with the specified sequence number and uses a callback + * to return the result. + * + * @param { number } index Sequence number of an image. + * @param { AsyncCallback } callback Callback used to return the image information. + * @syscap SystemCapability.Multimedia.Image.ImageSource + * @crossplatform + * @atomicservice + * @since 11 + */ + /** + * Obtains information about an image with the specified sequence number and uses a callback + * to return the result. + * + * @param { number } index Sequence number of an image. + * @param { AsyncCallback } callback Callback used to return the image information. + * @syscap SystemCapability.Multimedia.Image.ImageSource + * @crossplatform + * @form + * @atomicservice + * @since 12 + */ + getImageInfo(index: number, callback: AsyncCallback): void; + /** + * Obtains information about this image and uses a callback to return the result. + * + * @param { AsyncCallback } callback Callback used to return the image information. + * @syscap SystemCapability.Multimedia.Image.ImageSource + * @since 6 + */ + /** + * Obtains information about this image and uses a callback to return the result. + * + * @param { AsyncCallback } callback Callback used to return the image information. + * @syscap SystemCapability.Multimedia.Image.ImageSource + * @crossplatform + * @since 10 + */ + /** + * Obtains information about this image and uses a callback to return the result. + * + * @param { AsyncCallback } callback Callback used to return the image information. + * @syscap SystemCapability.Multimedia.Image.ImageSource + * @crossplatform + * @atomicservice + * @since 11 + */ + /** + * Obtains information about this image and uses a callback to return the result. + * + * @param { AsyncCallback } callback Callback used to return the image information. + * @syscap SystemCapability.Multimedia.Image.ImageSource + * @crossplatform + * @form + * @atomicservice + * @since 12 + */ + getImageInfo(callback: AsyncCallback): void; + /** + * Get image information from image source. + * + * @param { number } index Sequence number of an image. If this parameter is not specified, the default value 0 is used. + * @returns { Promise } A Promise instance used to return the image information. + * @syscap SystemCapability.Multimedia.Image.ImageSource + * @since 6 + */ + /** + * Get image information from image source. + * + * @param { number } index Sequence number of an image. If this parameter is not specified, the default value 0 is used. + * @returns { Promise } A Promise instance used to return the image information. + * @syscap SystemCapability.Multimedia.Image.ImageSource + * @crossplatform + * @since 10 + */ + /** + * Get image information from image source. + * + * @param { number } index Sequence number of an image. If this parameter is not specified, the default value 0 is used. + * @returns { Promise } A Promise instance used to return the image information. + * @syscap SystemCapability.Multimedia.Image.ImageSource + * @crossplatform + * @atomicservice + * @since 11 + */ + /** + * Get image information from image source. + * + * @param { number } index Sequence number of an image. If this parameter is not specified, the default value 0 is used. + * @returns { Promise } A Promise instance used to return the image information. + * @syscap SystemCapability.Multimedia.Image.ImageSource + * @crossplatform + * @form + * @atomicservice + * @since 12 + */ + getImageInfo(index?: number): Promise; + /** + * Get image information from image source synchronously. + * + * @param { number } index - Index of sequence images. If this parameter is not specified, default value is 0. + * @returns { ImageInfo } The image information. + * @syscap SystemCapability.Multimedia.Image.ImageSource + * @crossplatform + * @since 12 + */ + getImageInfoSync(index?: number): ImageInfo; + /** + * Creates a PixelMap object based on image decoding parameters. This method uses a promise to + * return the object. + * + * @param { DecodingOptions } options Image decoding parameters. + * @returns { Promise } A Promise instance used to return the PixelMap object. + * @syscap SystemCapability.Multimedia.Image.ImageSource + * @since 7 + */ + /** + * Creates a PixelMap object based on image decoding parameters. This method uses a promise to + * return the object. + * + * @param { DecodingOptions } options Image decoding parameters. + * @returns { Promise } A Promise instance used to return the PixelMap object. + * @syscap SystemCapability.Multimedia.Image.ImageSource + * @crossplatform + * @since 10 + */ + /** + * Creates a PixelMap object based on image decoding parameters. This method uses a promise to + * return the object. + * + * @param { DecodingOptions } options Image decoding parameters. + * @returns { Promise } A Promise instance used to return the PixelMap object. + * @syscap SystemCapability.Multimedia.Image.ImageSource + * @crossplatform + * @atomicservice + * @since 11 + */ + /** + * Creates a PixelMap object based on image decoding parameters. This method uses a promise to + * return the object. + * + * @param { DecodingOptions } options Image decoding parameters. + * @returns { Promise } A Promise instance used to return the PixelMap object. + * @syscap SystemCapability.Multimedia.Image.ImageSource + * @crossplatform + * @form + * @atomicservice + * @since 12 + */ + createPixelMap(options?: DecodingOptions): Promise; + /** + * Creates a PixelMap object. This method uses a callback to return the object. + * + * @param { AsyncCallback } callback Callback used to return the PixelMap object. + * @syscap SystemCapability.Multimedia.Image.ImageSource + * @since 7 + */ + /** + * Creates a PixelMap object. This method uses a callback to return the object. + * + * @param { AsyncCallback } callback Callback used to return the PixelMap object. + * @syscap SystemCapability.Multimedia.Image.ImageSource + * @crossplatform + * @since 10 + */ + /** + * Creates a PixelMap object. This method uses a callback to return the object. + * + * @param { AsyncCallback } callback Callback used to return the PixelMap object. + * @syscap SystemCapability.Multimedia.Image.ImageSource + * @crossplatform + * @atomicservice + * @since 11 + */ + /** + * Creates a PixelMap object. This method uses a callback to return the object. + * + * @param { AsyncCallback } callback Callback used to return the PixelMap object. + * @syscap SystemCapability.Multimedia.Image.ImageSource + * @crossplatform + * @form + * @atomicservice + * @since 12 + */ + createPixelMap(callback: AsyncCallback): void; + /** + * Creates a PixelMap object based on image decoding parameters. This method uses a callback to + * return the object. + * + * @param { DecodingOptions } options Image decoding parameters. + * @param { AsyncCallback } callback Callback used to return the PixelMap object. + * @syscap SystemCapability.Multimedia.Image.ImageSource + * @since 7 + */ + /** + * Creates a PixelMap object based on image decoding parameters. This method uses a callback to + * return the object. + * + * @param { DecodingOptions } options Image decoding parameters. + * @param { AsyncCallback } callback Callback used to return the PixelMap object. + * @syscap SystemCapability.Multimedia.Image.ImageSource + * @crossplatform + * @since 10 + */ + /** + * Creates a PixelMap object based on image decoding parameters. This method uses a callback to + * return the object. + * + * @param { DecodingOptions } options Image decoding parameters. + * @param { AsyncCallback } callback Callback used to return the PixelMap object. + * @syscap SystemCapability.Multimedia.Image.ImageSource + * @crossplatform + * @atomicservice + * @since 11 + */ + /** + * Creates a PixelMap object based on image decoding parameters. This method uses a callback to + * return the object. + * + * @param { DecodingOptions } options Image decoding parameters. + * @param { AsyncCallback } callback Callback used to return the PixelMap object. + * @syscap SystemCapability.Multimedia.Image.ImageSource + * @crossplatform + * @form + * @atomicservice + * @since 12 + */ + createPixelMap(options: DecodingOptions, callback: AsyncCallback): void; + /** + * Create a PixelMap object based on image decoding parameters synchronously. + * + * @param { DecodingOptions } options - Image decoding parameters. + * @returns { PixelMap } Return the PixelMap. If decoding fails, return undefined. + * @syscap SystemCapability.Multimedia.Image.ImageSource + * @crossplatform + * @since 12 + */ + createPixelMapSync(options?: DecodingOptions): PixelMap; + /** + * Creates a PixelMap array based on image decoding parameters. This method uses a promise to + * return the array. + * + * @param { DecodingOptions } options Image decoding parameters. + * @returns { Promise> } A Promise instance used to return the PixelMap array. + * @throws { BusinessError } 62980096 - The operation failed. + * @throws { BusinessError } 62980099 - The shared memory data is abnormal. + * @throws { BusinessError } 62980101 - The image data is abnormal. + * @throws { BusinessError } 62980103 - The image data is not supported. + * @throws { BusinessError } 62980106 - The image is too large. + * @throws { BusinessError } 62980109 - Failed to crop the image. + * @throws { BusinessError } 62980110 - The image source data is incorrect. + * @throws { BusinessError } 62980111 - The image source data is incomplete. + * @throws { BusinessError } 62980112 - The image format does not match. + * @throws { BusinessError } 62980113 - Unknown image format. + * @throws { BusinessError } 62980115 - Invalid image parameter. + * @throws { BusinessError } 62980116 - Failed to decode the image. + * @throws { BusinessError } 62980118 - Failed to create the image plugin. + * @throws { BusinessError } 62980122 - The image decoding header is abnormal. + * @throws { BusinessError } 62980137 - Invalid media operation. + * @throws { BusinessError } 62980173 - The DMA memory does not exist. + * @throws { BusinessError } 62980174 - The DMA memory data is abnormal. + * @syscap SystemCapability.Multimedia.Image.ImageSource + * @crossplatform + * @since 10 + */ + createPixelMapList(options?: DecodingOptions): Promise>; + /** + * Creates a PixelMap array. This method uses a callback to return the array. + * + * @param { AsyncCallback> } callback Callback used to return the PixelMap array. + * @throws { BusinessError } 62980096 - The operation failed. + * @throws { BusinessError } 62980099 - The shared memory data is abnormal. + * @throws { BusinessError } 62980101 - The image data is abnormal. + * @throws { BusinessError } 62980103 - The image data is not supported. + * @throws { BusinessError } 62980106 - The image is too large. + * @throws { BusinessError } 62980109 - Failed to crop the image. + * @throws { BusinessError } 62980110 - The image source data is incorrect. + * @throws { BusinessError } 62980111 - The image source data is incomplete. + * @throws { BusinessError } 62980112 - The image format does not match. + * @throws { BusinessError } 62980113 - Unknown image format. + * @throws { BusinessError } 62980115 - Invalid image parameter. + * @throws { BusinessError } 62980116 - Failed to decode the image. + * @throws { BusinessError } 62980118 - Failed to create the image plugin. + * @throws { BusinessError } 62980122 - The image decoding header is abnormal. + * @throws { BusinessError } 62980137 - Invalid media operation. + * @throws { BusinessError } 62980173 - The DMA memory does not exist. + * @throws { BusinessError } 62980174 - The DMA memory data is abnormal. + * @syscap SystemCapability.Multimedia.Image.ImageSource + * @crossplatform + * @since 10 + */ + createPixelMapList(callback: AsyncCallback>): void; + /** + * Creates a PixelMap array based on image decoding parameters. This method uses a callback to + * return the array. + * + * @param { DecodingOptions } options Image decoding parameters. + * @param { AsyncCallback> } callback Callback used to return the PixelMap array. + * @throws { BusinessError } 62980096 - The operation failed. + * @throws { BusinessError } 62980099 - The shared memory data is abnormal. + * @throws { BusinessError } 62980101 - The image data is abnormal. + * @throws { BusinessError } 62980103 - The image data is not supported. + * @throws { BusinessError } 62980106 - The image is too large. + * @throws { BusinessError } 62980109 - Failed to crop the image. + * @throws { BusinessError } 62980110 - The image source data is incorrect. + * @throws { BusinessError } 62980111 - The image source data is incomplete. + * @throws { BusinessError } 62980112 - The image format does not match. + * @throws { BusinessError } 62980113 - Unknown image format. + * @throws { BusinessError } 62980115 - Invalid image parameter. + * @throws { BusinessError } 62980116 - Failed to decode the image. + * @throws { BusinessError } 62980118 - Failed to create the image plugin. + * @throws { BusinessError } 62980122 - The image decoding header is abnormal. + * @throws { BusinessError } 62980137 - Invalid media operation. + * @throws { BusinessError } 62980173 - The DMA memory does not exist. + * @throws { BusinessError } 62980174 - The DMA memory data is abnormal. + * @syscap SystemCapability.Multimedia.Image.ImageSource + * @crossplatform + * @since 10 + */ + createPixelMapList(options: DecodingOptions, callback: AsyncCallback>): void; + /** + * Obtains the array of delay time in an image. This method uses a promise to return the array. + * + * @returns { Promise> } A Promise instance used to return the array. + * @throws { BusinessError } 62980096 - The operation failed. + * @throws { BusinessError } 62980110 - The image source data is incorrect. + * @throws { BusinessError } 62980111 - The image source data is incomplete. + * @throws { BusinessError } 62980112 - The image format does not match. + * @throws { BusinessError } 62980113 - Unknown image format. + * @throws { BusinessError } 62980115 - Invalid image parameter. + * @throws { BusinessError } 62980116 - Failed to decode the image. + * @throws { BusinessError } 62980118 - Failed to create the image plugin. + * @throws { BusinessError } 62980122 - The image decoding header is abnormal. + * @throws { BusinessError } 62980137 - Invalid media operation. + * @throws { BusinessError } 62980149 - Invalid media parameter. + * @syscap SystemCapability.Multimedia.Image.ImageSource + * @crossplatform + * @since 10 + */ + getDelayTimeList(): Promise>; + /** + * Obtains the array of delay time in an image. This method uses a callback to return the array. + * + * @param { AsyncCallback> } callback Callback used to return the array. + * @throws { BusinessError } 62980096 - The operation failed. + * @throws { BusinessError } 62980110 - The image source data is incorrect. + * @throws { BusinessError } 62980111 - The image source data is incomplete. + * @throws { BusinessError } 62980112 - The image format does not match. + * @throws { BusinessError } 62980113 - Unknown image format. + * @throws { BusinessError } 62980115 - Invalid image parameter. + * @throws { BusinessError } 62980116 - Failed to decode the image. + * @throws { BusinessError } 62980118 - Failed to create the image plugin. + * @throws { BusinessError } 62980122 - The image decoding header is abnormal. + * @throws { BusinessError } 62980137 - Invalid media operation. + * @throws { BusinessError } 62980149 - Invalid media parameter. + * @syscap SystemCapability.Multimedia.Image.ImageSource + * @crossplatform + * @since 10 + */ + getDelayTimeList(callback: AsyncCallback>): void; + /** + * Obtains the array of disposal type in a gif image. This method uses a promise to return the array. + * + * @returns { Promise> } A Promise instance used to return the array. + * @throws { BusinessError } 62980096 - The operation failed. + * @throws { BusinessError } 62980101 - The image data is abnormal. + * @throws { BusinessError } 62980137 - Invalid media operation. + * @throws { BusinessError } 62980149 - Invalid image source mime type. + * @syscap SystemCapability.Multimedia.Image.ImageSource + * @crossplatform + * @since 12 + */ + getDisposalTypeList(): Promise>; + /** + * Obtains the count of frame in an image. This method uses a promise to return the number. + * + * @returns { Promise } A Promise instance used to return the number. + * @throws { BusinessError } 62980096 - The operation failed. + * @throws { BusinessError } 62980110 - The image source data is incorrect. + * @throws { BusinessError } 62980111 - The image source data is incomplete. + * @throws { BusinessError } 62980112 - The image format does not match. + * @throws { BusinessError } 62980113 - Unknown image format. + * @throws { BusinessError } 62980115 - Invalid image parameter. + * @throws { BusinessError } 62980116 - Failed to decode the image. + * @throws { BusinessError } 62980118 - Failed to create the image plugin. + * @throws { BusinessError } 62980122 - The image decoding header is abnormal. + * @throws { BusinessError } 62980137 - Invalid media operation. + * @syscap SystemCapability.Multimedia.Image.ImageSource + * @crossplatform + * @since 10 + */ + getFrameCount(): Promise; + /** + * Obtains the count of frame in an image. This method uses a callback to return the number. + * + * @param { AsyncCallback } callback Callback used to return the number. + * @throws { BusinessError } 62980096 - The operation failed. + * @throws { BusinessError } 62980110 - The image source data is incorrect. + * @throws { BusinessError } 62980111 - The image source data is incomplete. + * @throws { BusinessError } 62980112 - The image format does not match. + * @throws { BusinessError } 62980113 - Unknown image format. + * @throws { BusinessError } 62980115 - Invalid image parameter. + * @throws { BusinessError } 62980116 - Failed to decode the image. + * @throws { BusinessError } 62980118 - Failed to create the image plugin. + * @throws { BusinessError } 62980122 - The image decoding header is abnormal. + * @throws { BusinessError } 62980137 - Invalid media operation. + * @syscap SystemCapability.Multimedia.Image.ImageSource + * @crossplatform + * @since 10 + */ + getFrameCount(callback: AsyncCallback): void; + /** + * Obtains the value of a property in an image with the specified index. This method uses a + * promise to return the property value in a string. + * + * @param { PropertyKey } key - Name of the property whose value is to be obtained. + * @param { ImagePropertyOptions } options - Index of the image. + * @returns { Promise } A Promise instance used to return the property value. If the operation fails, the default value is returned. + * @throws { BusinessError } 401 - Parameter error.Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types;3.Parameter verification failed; + * @throws { BusinessError } 62980096 - The operation failed. + * @throws { BusinessError } 62980103 - The image data is not supported. + * @throws { BusinessError } 62980110 - The image source data is incorrect. + * @throws { BusinessError } 62980111 - The image source data is incomplete. + * @throws { BusinessError } 62980112 - The image format does not match. + * @throws { BusinessError } 62980113 - Unknown image format. + * @throws { BusinessError } 62980115 - Invalid image parameter. + * @throws { BusinessError } 62980116 - Failed to decode the image. + * @throws { BusinessError } 62980118 - Failed to create the image plugin. + * @throws { BusinessError } 62980122 - The image decoding header is abnormal. + * @throws { BusinessError } 62980123 - Images in EXIF format are not supported. + * @throws { BusinessError } 62980135 - The EXIF value is invalid. + * @syscap SystemCapability.Multimedia.Image.ImageSource + * @crossplatform + * @since 11 + */ + getImageProperty(key: PropertyKey, options?: ImagePropertyOptions): Promise; + /** + * Obtains the value of a property in an image with the specified index. This method uses a + * promise to return the property value in a string. + * + * @param { string } key Name of the property whose value is to be obtained. + * @param { GetImagePropertyOptions } options Index of the image. + * @returns { Promise } A Promise instance used to return the property value. If the operation fails, the default value is returned. + * @syscap SystemCapability.Multimedia.Image.ImageSource + * @since 7 + * @deprecated since 11 + * @useinstead image.ImageSource#getImageProperty + */ + /** + * Obtains the value of a property in an image with the specified index. This method uses a + * promise to return the property value in a string. + * + * @param { string } key Name of the property whose value is to be obtained. + * @param { GetImagePropertyOptions } options Index of the image. + * @returns { Promise } A Promise instance used to return the property value. If the operation fails, the default value is returned. + * @syscap SystemCapability.Multimedia.Image.ImageSource + * @crossplatform + * @since 10 + * @deprecated since 11 + * @useinstead image.ImageSource#getImageProperty + */ + getImageProperty(key: string, options?: GetImagePropertyOptions): Promise; + /** + * Obtains the value of a property in this image. This method uses a callback to return the + * property value in a string. + * + * @param { string } key Name of the property whose value is to be obtained. + * @param { AsyncCallback } callback Callback used to return the property value. If the operation fails, an error message is returned. + * @syscap SystemCapability.Multimedia.Image.ImageSource + * @since 7 + * @deprecated since 11 + * @useinstead image.ImageSource#getImageProperty + */ + /** + * Obtains the value of a property in this image. This method uses a callback to return the + * property value in a string. + * + * @param { string } key Name of the property whose value is to be obtained. + * @param { AsyncCallback } callback Callback used to return the property value. If the operation fails, an error message is returned. + * @syscap SystemCapability.Multimedia.Image.ImageSource + * @crossplatform + * @since 10 + * @deprecated since 11 + * @useinstead image.ImageSource#getImageProperty + */ + getImageProperty(key: string, callback: AsyncCallback): void; + /** + * Obtains the value of a property in an image with the specified index. This method uses + * a callback to return the property value in a string. + * + * @param { string } key Name of the property whose value is to be obtained. + * @param { GetImagePropertyOptions } options Index of the image. + * @param { AsyncCallback } callback Callback used to return the property value. If the operation fails, the default value is returned. + * @syscap SystemCapability.Multimedia.Image.ImageSource + * @since 7 + * @deprecated since 11 + * @useinstead image.ImageSource#getImageProperty + */ + /** + * Obtains the value of a property in an image with the specified index. This method uses + * a callback to return the property value in a string. + * + * @param { string } key Name of the property whose value is to be obtained. + * @param { GetImagePropertyOptions } options Index of the image. + * @param { AsyncCallback } callback Callback used to return the property value. If the operation fails, the default value is returned. + * @syscap SystemCapability.Multimedia.Image.ImageSource + * @crossplatform + * @since 10 + * @deprecated since 11 + * @useinstead image.ImageSource#getImageProperty + */ + getImageProperty(key: string, options: GetImagePropertyOptions, callback: AsyncCallback): void; + /** + * Obtains the value of properties in an image. This method uses a promise to return the property values in array + * of records. + * + * @param { Array } key - Name of the properties whose value is to be obtained. + * @returns { Promise> } Array of Records instance used to return the + * property values. If the operation fails, the null is returned. + * @throws { BusinessError } 401 - Parameter error.Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed; + * @throws { BusinessError } 62980096 - The operation failed. + * @throws { BusinessError } 62980110 - The image source data is incorrect. + * @throws { BusinessError } 62980113 - Unknown image format. + * @throws { BusinessError } 62980116 - Failed to decode the image. + * @syscap SystemCapability.Multimedia.Image.ImageSource + * @crossplatform + * @since 12 + */ + getImageProperties(key: Array): Promise>; + /** + * Modify the value of a property in an image with the specified key. This method uses a + * promise to return the property value in a string. + * + * @param { PropertyKey } key - Name of the property whose value is to be modified. + * @param { string } value - The value to be set to property. + * @returns { Promise } A Promise instance used to return the property value. + * @throws { BusinessError } 401 - Parameter error.Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; + * @throws { BusinessError } 62980123 - Images in EXIF format are not supported. + * @throws { BusinessError } 62980133 - The EXIF data is out of range. + * @throws { BusinessError } 62980135 - The EXIF value is invalid. + * @throws { BusinessError } 62980146 - The EXIF data failed to be written to the file. + * @syscap SystemCapability.Multimedia.Image.ImageSource + * @crossplatform + * @since 11 + */ + modifyImageProperty(key: PropertyKey, value: string): Promise; + /** + * Modify the value of a property in an image with the specified key. This method uses a + * promise to return the property value in a string. + * + * @param { string } key Name of the property whose value is to be modified. + * @param { string } value The value to be set to property. + * @returns { Promise } A Promise instance used to return the property value. + * @syscap SystemCapability.Multimedia.Image.ImageSource + * @since 9 + * @deprecated since 11 + * @useinstead image.ImageSource#modifyImageProperty + */ + /** + * Modify the value of a property in an image with the specified key. This method uses a + * promise to return the property value in a string. + * + * @param { string } key Name of the property whose value is to be modified. + * @param { string } value The value to be set to property. + * @returns { Promise } A Promise instance used to return the property value. + * @syscap SystemCapability.Multimedia.Image.ImageSource + * @crossplatform + * @since 10 + * @deprecated since 11 + * @useinstead image.ImageSource#modifyImageProperty + */ + modifyImageProperty(key: string, value: string): Promise; + /** + * Modify the value of a property in an image with the specified key. This method uses a callback to return the + * property value in a string. + * + * @param { string } key Name of the property whose value is to be obtained. + * @param { string } value The value to be set to property. + * @param { AsyncCallback } callback Callback to return the operation result. + * @syscap SystemCapability.Multimedia.Image.ImageSource + * @since 9 + * @deprecated since 11 + * @useinstead image.ImageSource#modifyImageProperty + */ + /** + * Modify the value of a property in an image with the specified key. This method uses a callback to return the + * property value in a string. + * + * @param { string } key Name of the property whose value is to be obtained. + * @param { string } value The value to be set to property. + * @param { AsyncCallback } callback Callback to return the operation result. + * @syscap SystemCapability.Multimedia.Image.ImageSource + * @crossplatform + * @since 10 + * @deprecated since 11 + * @useinstead image.ImageSource#modifyImageProperty + */ + modifyImageProperty(key: string, value: string, callback: AsyncCallback): void; + /** + * Modify the value of properties in an image with the specified keys. + * + * @param { Record } records - Array of the property Records whose values are to + * be modified. + * @returns { Promise } A Promise instance used to return the operation result. If the operation fails, an + * error message is returned. + * @throws { BusinessError } 401 - Parameter error.Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed; + * @throws { BusinessError } 62980123 - Images in EXIF format are not supported. + * @throws { BusinessError } 62980133 - The EXIF data is out of range. + * @throws { BusinessError } 62980135 - The EXIF value is invalid. + * @throws { BusinessError } 62980146 - The EXIF data failed to be written to the file. + * @syscap SystemCapability.Multimedia.Image.ImageSource + * @crossplatform + * @since 12 + */ + modifyImageProperties(records: Record): Promise; + /** + * Update the data in the incremental ImageSource. + * + * @param { ArrayBuffer } buf The data to be updated. + * @param { boolean } isFinished If is it finished. + * @param { number } value The offset of data. + * @param { number } length The length fo buf. + * @returns { Promise } A Promise instance used to return the property value. + * @syscap SystemCapability.Multimedia.Image.ImageSource + * @since 9 + */ + /** + * Update the data in the incremental ImageSource. + * + * @param { ArrayBuffer } buf The data to be updated. + * @param { boolean } isFinished If is it finished. + * @param { number } value The offset of data. + * @param { number } length The length fo buf. + * @returns { Promise } A Promise instance used to return the property value. + * @syscap SystemCapability.Multimedia.Image.ImageSource + * @crossplatform + * @since 10 + */ + /** + * Update the data in the incremental ImageSource. + * + * @param { ArrayBuffer } buf The data to be updated. + * @param { boolean } isFinished If is it finished. + * @param { number } offset The offset of data. + * @param { number } length The length fo buf. + * @returns { Promise } A Promise instance used to return the property value. + * @syscap SystemCapability.Multimedia.Image.ImageSource + * @crossplatform + * @since 11 + */ + updateData(buf: ArrayBuffer, isFinished: boolean, offset: number, length: number): Promise; + /** + * Update the data in the incremental ImageSource. + * + * @param { ArrayBuffer } buf The data to be updated. + * @param { boolean } isFinished If is it finished. + * @param { number } value The offset of data. + * @param { number } length The length fo buf. + * @param { AsyncCallback } callback Callback to return the operation result. + * @syscap SystemCapability.Multimedia.Image.ImageSource + * @since 9 + */ + /** + * Update the data in the incremental ImageSource. + * + * @param { ArrayBuffer } buf The data to be updated. + * @param { boolean } isFinished If is it finished. + * @param { number } value The offset of data. + * @param { number } length The length fo buf. + * @param { AsyncCallback } callback Callback to return the operation result. + * @syscap SystemCapability.Multimedia.Image.ImageSource + * @crossplatform + * @since 10 + */ + /** + * Update the data in the incremental ImageSource. + * + * @param { ArrayBuffer } buf The data to be updated. + * @param { boolean } isFinished If is it finished. + * @param { number } offset The offset of data. + * @param { number } length The length fo buf. + * @param { AsyncCallback } callback Callback to return the operation result. + * @syscap SystemCapability.Multimedia.Image.ImageSource + * @crossplatform + * @since 11 + */ + updateData(buf: ArrayBuffer, isFinished: boolean, offset: number, length: number, callback: AsyncCallback): void; + /** + * Releases an ImageSource instance and uses a callback to return the result. + * + * @param { AsyncCallback } callback Callback to return the operation result. + * @syscap SystemCapability.Multimedia.Image.ImageSource + * @since 6 + */ + /** + * Releases an ImageSource instance and uses a callback to return the result. + * + * @param { AsyncCallback } callback Callback to return the operation result. + * @syscap SystemCapability.Multimedia.Image.ImageSource + * @crossplatform + * @since 10 + */ + release(callback: AsyncCallback): void; + /** + * Releases an ImageSource instance and uses a promise to return the result. + * + * @returns { Promise } A Promise instance used to return the operation result. + * @syscap SystemCapability.Multimedia.Image.ImageSource + * @since 6 + */ + /** + * Releases an ImageSource instance and uses a promise to return the result. + * + * @returns { Promise } A Promise instance used to return the operation result. + * @syscap SystemCapability.Multimedia.Image.ImageSource + * @crossplatform + * @since 10 + */ + release(): Promise; + /** + * Supported image formats. + * + * @type { Array } + * @syscap SystemCapability.Multimedia.Image.ImageSource + * @since 6 + */ + /** + * Supported image formats. + * + * @type { Array } + * @syscap SystemCapability.Multimedia.Image.ImageSource + * @crossplatform + * @since 10 + */ + readonly supportedFormats: Array; + } + /** + * ImagePacker instance. + * + * @typedef ImagePacker + * @syscap SystemCapability.Multimedia.Image.ImagePacker + * @since 6 + */ + /** + * ImagePacker instance. + * + * @typedef ImagePacker + * @syscap SystemCapability.Multimedia.Image.ImagePacker + * @crossplatform + * @since 10 + */ + /** + * ImagePacker instance. + * + * @typedef ImagePacker + * @syscap SystemCapability.Multimedia.Image.ImagePacker + * @crossplatform + * @atomicservice + * @since 11 + */ + interface ImagePacker { + /** + * Compresses or packs an image and uses a callback to return the result. + * + * @param { ImageSource } source Image to be processed. + * @param { PackingOption } option Option for image packing. + * @param { AsyncCallback } callback Callback used to return the packed data. + * @syscap SystemCapability.Multimedia.Image.ImagePacker + * @since 6 + */ + /** + * Compresses or packs an image and uses a callback to return the result. + * + * @param { ImageSource } source Image to be processed. + * @param { PackingOption } option Option for image packing. + * @param { AsyncCallback } callback Callback used to return the packed data. + * @syscap SystemCapability.Multimedia.Image.ImagePacker + * @crossplatform + * @since 10 + */ + /** + * Compresses or packs an image and uses a callback to return the result. + * + * @param { ImageSource } source Image to be processed. + * @param { PackingOption } option Option for image packing. + * @param { AsyncCallback } callback Callback used to return the packed data. + * @syscap SystemCapability.Multimedia.Image.ImagePacker + * @crossplatform + * @atomicservice + * @since 11 + */ + packing(source: ImageSource, option: PackingOption, callback: AsyncCallback): void; + /** + * Compresses or packs an image and uses a promise to return the result. + * + * @param { ImageSource } source Image to be processed. + * @param { PackingOption } option Option for image packing. + * @returns { Promise } A Promise instance used to return the compressed or packed data. + * @syscap SystemCapability.Multimedia.Image.ImagePacker + * @since 6 + */ + /** + * Compresses or packs an image and uses a promise to return the result. + * + * @param { ImageSource } source Image to be processed. + * @param { PackingOption } option Option for image packing. + * @returns { Promise } A Promise instance used to return the compressed or packed data. + * @syscap SystemCapability.Multimedia.Image.ImagePacker + * @crossplatform + * @since 10 + */ + /** + * Compresses or packs an image and uses a promise to return the result. + * + * @param { ImageSource } source Image to be processed. + * @param { PackingOption } option Option for image packing. + * @returns { Promise } A Promise instance used to return the compressed or packed data. + * @syscap SystemCapability.Multimedia.Image.ImagePacker + * @crossplatform + * @atomicservice + * @since 11 + */ + packing(source: ImageSource, option: PackingOption): Promise; + /** + * Compresses or packs an image and uses a callback to return the result. + * + * @param { PixelMap } source PixelMap to be processed. + * @param { PackingOption } option Option for image packing. + * @param { AsyncCallback } callback Callback used to return the packed data. + * @syscap SystemCapability.Multimedia.Image.ImagePacker + * @since 8 + */ + /** + * Compresses or packs an image and uses a callback to return the result. + * + * @param { PixelMap } source PixelMap to be processed. + * @param { PackingOption } option Option for image packing. + * @param { AsyncCallback } callback Callback used to return the packed data. + * @syscap SystemCapability.Multimedia.Image.ImagePacker + * @crossplatform + * @since 10 + */ + /** + * Compresses or packs an image and uses a callback to return the result. + * + * @param { PixelMap } source PixelMap to be processed. + * @param { PackingOption } option Option for image packing. + * @param { AsyncCallback } callback Callback used to return the packed data. + * @syscap SystemCapability.Multimedia.Image.ImagePacker + * @crossplatform + * @atomicservice + * @since 11 + */ + packing(source: PixelMap, option: PackingOption, callback: AsyncCallback): void; + /** + * Compresses or packs an image and uses a promise to return the result. + * + * @param { PixelMap } source PixelMap to be processed. + * @param { PackingOption } option Option for image packing. + * @returns { Promise } A Promise instance used to return the compressed or packed data. + * @syscap SystemCapability.Multimedia.Image.ImagePacker + * @since 8 + */ + /** + * Compresses or packs an image and uses a promise to return the result. + * + * @param { PixelMap } source PixelMap to be processed. + * @param { PackingOption } option Option for image packing. + * @returns { Promise } A Promise instance used to return the compressed or packed data. + * @syscap SystemCapability.Multimedia.Image.ImagePacker + * @crossplatform + * @since 10 + */ + /** + * Compresses or packs an image and uses a promise to return the result. + * + * @param { PixelMap } source PixelMap to be processed. + * @param { PackingOption } option Option for image packing. + * @returns { Promise } A Promise instance used to return the compressed or packed data. + * @syscap SystemCapability.Multimedia.Image.ImagePacker + * @crossplatform + * @atomicservice + * @since 11 + */ + packing(source: PixelMap, option: PackingOption): Promise; + /** + * Compresses or packs an image into a file and uses a callback to return the result. + * + * @param { ImageSource } source Image to be processed. + * @param { number } fd ID of a file descriptor. + * @param { PackingOption } options Options for image packing. + * @param { AsyncCallback } callback Callback used to return the operation result. + * @syscap SystemCapability.Multimedia.Image.ImagePacker + * @crossplatform + * @since 11 + */ + packToFile(source: ImageSource, fd: number, options: PackingOption, callback: AsyncCallback): void; + /** + * Compresses or packs an image into a file and uses a promise to return the result. + * + * @param { ImageSource } source Image to be processed. + * @param { number } fd ID of a file descriptor. + * @param { PackingOption } options Options for image packing. + * @returns { Promise } A Promise instance used to return the operation result. + * @syscap SystemCapability.Multimedia.Image.ImagePacker + * @crossplatform + * @since 11 + */ + packToFile(source: ImageSource, fd: number, options: PackingOption): Promise; + /** + * Compresses or packs an image into a file and uses a callback to return the result. + * + * @param { PixelMap } source PixelMap to be processed. + * @param { number } fd ID of a file descriptor. + * @param { PackingOption } options Options for image packing. + * @param { AsyncCallback } callback Callback used to return the operation result. + * @syscap SystemCapability.Multimedia.Image.ImagePacker + * @crossplatform + * @since 11 + */ + packToFile(source: PixelMap, fd: number, options: PackingOption, callback: AsyncCallback): void; + /** + * Compresses or packs an image into a file and uses a promise to return the result. + * + * @param { PixelMap } source PixelMap to be processed. + * @param { number } fd ID of a file descriptor. + * @param { PackingOption } options Options for image packing. + * @returns { Promise } A Promise instance used to return the operation result. + * @syscap SystemCapability.Multimedia.Image.ImagePacker + * @crossplatform + * @since 11 + */ + packToFile(source: PixelMap, fd: number, options: PackingOption): Promise; + /** + * Releases an ImagePacker instance and uses a callback to return the result. + * + * @param { AsyncCallback } callback Callback to return the operation result. + * @syscap SystemCapability.Multimedia.Image.ImagePacker + * @since 6 + */ + /** + * Releases an ImagePacker instance and uses a callback to return the result. + * + * @param { AsyncCallback } callback Callback to return the operation result. + * @syscap SystemCapability.Multimedia.Image.ImagePacker + * @crossplatform + * @since 10 + */ + release(callback: AsyncCallback): void; + /** + * Releases an ImagePacker instance and uses a promise to return the result. + * + * @returns { Promise } A Promise instance used to return the operation result. + * @syscap SystemCapability.Multimedia.Image.ImagePacker + * @since 6 + */ + /** + * Releases an ImagePacker instance and uses a promise to return the result. + * + * @returns { Promise } A Promise instance used to return the operation result. + * @syscap SystemCapability.Multimedia.Image.ImagePacker + * @crossplatform + * @since 10 + */ + release(): Promise; + /** + * Supported image formats. + * + * @type { Array } + * @syscap SystemCapability.Multimedia.Image.ImagePacker + * @since 6 + */ + /** + * Supported image formats. + * + * @type { Array } + * @syscap SystemCapability.Multimedia.Image.ImagePacker + * @crossplatform + * @since 10 + */ + readonly supportedFormats: Array; + } + /** + * Provides basic image operations, including obtaining image information, and reading and writing image data. + * + * @typedef Image + * @syscap SystemCapability.Multimedia.Image.Core + * @since 9 + */ + interface Image { + /** + * Sets or gets the image area to crop, default is size. + * + * @type { Region } + * @syscap SystemCapability.Multimedia.Image.Core + * @since 9 + */ + clipRect: Region; + /** + * Image size. + * + * @type { Size } + * @syscap SystemCapability.Multimedia.Image.Core + * @since 9 + */ + readonly size: Size; + /** + * Image format. + * + * @type { number } + * @syscap SystemCapability.Multimedia.Image.Core + * @since 9 + */ + readonly format: number; + /** + * Image timestamp. + * + * @type { number } + * @syscap SystemCapability.Multimedia.Image.Core + * @since 12 + */ + readonly timestamp: number; + /** + * Get component buffer from image and uses a callback to return the result. + * + * @param { ComponentType } componentType The component type of image. + * @param { AsyncCallback } callback Callback used to return the component buffer. + * @syscap SystemCapability.Multimedia.Image.Core + * @since 9 + */ + getComponent(componentType: ComponentType, callback: AsyncCallback): void; + /** + * Get component buffer from image and uses a promise to return the result. + * + * @param { ComponentType } componentType The component type of image. + * @returns { Promise } A Promise instance used to return the component buffer. + * @syscap SystemCapability.Multimedia.Image.Core + * @since 9 + */ + getComponent(componentType: ComponentType): Promise; + /** + * Release current image to receive another and uses a callback to return the result. + * + * @param { AsyncCallback } callback Callback to return the operation result. + * @syscap SystemCapability.Multimedia.Image.Core + * @since 9 + */ + release(callback: AsyncCallback): void; + /** + * Release current image to receive another and uses a promise to return the result. + * + * @returns { Promise } A Promise instance used to return the operation result. + * @syscap SystemCapability.Multimedia.Image.Core + * @since 9 + */ + release(): Promise; + } + /** + * Image receiver object. + * + * @typedef ImageReceiver + * @syscap SystemCapability.Multimedia.Image.ImageReceiver + * @since 9 + */ + interface ImageReceiver { + /** + * Image size. + * + * @type { Size } + * @syscap SystemCapability.Multimedia.Image.ImageReceiver + * @since 9 + */ + readonly size: Size; + /** + * Image capacity. + * + * @type { number } + * @syscap SystemCapability.Multimedia.Image.ImageReceiver + * @since 9 + */ + readonly capacity: number; + /** + * Image format. + * + * @type { ImageFormat } + * @syscap SystemCapability.Multimedia.Image.ImageReceiver + * @since 9 + */ + readonly format: ImageFormat; + /** + * Get an id which indicates a surface and can be used to set to Camera or other component can receive a surface + * and uses a callback to return the result. + * + * @param { AsyncCallback } callback Callback used to return the surface id. + * @syscap SystemCapability.Multimedia.Image.ImageReceiver + * @since 9 + */ + getReceivingSurfaceId(callback: AsyncCallback): void; + /** + * Get an id which indicates a surface and can be used to set to Camera or other component can receive a surface + * and uses a promise to return the result. + * + * @returns { Promise } A Promise instance used to return the surface id. + * @syscap SystemCapability.Multimedia.Image.ImageReceiver + * @since 9 + */ + getReceivingSurfaceId(): Promise; + /** + * Get lasted image from receiver and uses a callback to return the result. + * + * @param { AsyncCallback } callback Callback used to return the latest image. + * @syscap SystemCapability.Multimedia.Image.ImageReceiver + * @since 9 + */ + readLatestImage(callback: AsyncCallback): void; + /** + * Get lasted image from receiver and uses a promise to return the result. + * + * @returns { Promise } A Promise instance used to return the latest image. + * @syscap SystemCapability.Multimedia.Image.ImageReceiver + * @since 9 + */ + readLatestImage(): Promise; + /** + * Get next image from receiver and uses a callback to return the result. + * + * @param { AsyncCallback } callback Callback used to return the next image. + * @syscap SystemCapability.Multimedia.Image.ImageReceiver + * @since 9 + */ + readNextImage(callback: AsyncCallback): void; + /** + * Get next image from receiver and uses a promise to return the result. + * + * @returns { Promise } A Promise instance used to return the next image. + * @syscap SystemCapability.Multimedia.Image.ImageReceiver + * @since 9 + */ + readNextImage(): Promise; + /** + * Subscribe callback when receiving an image + * + * @param { 'imageArrival' } type Callback used to return the next image. + * @param { AsyncCallback } callback Callback used to return image. + * @syscap SystemCapability.Multimedia.Image.ImageReceiver + * @since 9 + */ + on(type: 'imageArrival', callback: AsyncCallback): void; + /** + * Release image receiver instance and uses a callback to return the result. + * + * @param { AsyncCallback } callback Callback to return the operation result. + * @syscap SystemCapability.Multimedia.Image.ImageReceiver + * @since 9 + */ + release(callback: AsyncCallback): void; + /** + * Release image receiver instance and uses a promise to return the result. + * + * @returns { Promise } A Promise instance used to return the operation result. + * @syscap SystemCapability.Multimedia.Image.ImageReceiver + * @since 9 + */ + release(): Promise; + } + /** + * Image creator object. + * + * @typedef ImageCreator + * @syscap SystemCapability.Multimedia.Image.ImageCreator + * @since 9 + */ + interface ImageCreator { + /** + * Image capacity. + * + * @type { number } + * @syscap SystemCapability.Multimedia.Image.ImageCreator + * @since 9 + */ + readonly capacity: number; + /** + * Image format. + * + * @type { ImageFormat } + * @syscap SystemCapability.Multimedia.Image.ImageCreator + * @since 9 + */ + readonly format: ImageFormat; + /** + * Apply for new graphic buffer from free queue and use a callback to return the result. + * + * @param { AsyncCallback } callback Callback to return the operation result. + * @syscap SystemCapability.Multimedia.Image.ImageCreator + * @since 9 + */ + dequeueImage(callback: AsyncCallback): void; + /** + * Apply for new graphic buffer from free queue and uses a promise to return the result. + * + * @returns { Promise } A Promise instance used to return the operation result. + * @syscap SystemCapability.Multimedia.Image.ImageCreator + * @since 9 + */ + dequeueImage(): Promise; + /** + * Queue buffer to dirty queue and uses a callback to return the result. + * + * @param { Image } interface + * @param { AsyncCallback } callback Callback to return the operation result. + * @syscap SystemCapability.Multimedia.Image.ImageCreator + * @since 9 + */ + queueImage(interface: Image, callback: AsyncCallback): void; + /** + * Queue buffer to dirty queue and uses a promise to return the result. + * + * @param { Image } interface + * @returns { Promise } A Promise instance used to return the operation result. + * @syscap SystemCapability.Multimedia.Image.ImageCreator + * @since 9 + */ + queueImage(interface: Image): Promise; + /** + * Subscribe callback when releasing buffer + * + * @param { 'imageRelease' } type Callback used to return the operation result. + * @param { AsyncCallback } callback Callback used to return the operation result. + * @syscap SystemCapability.Multimedia.Image.ImageCreator + * @since 9 + */ + on(type: 'imageRelease', callback: AsyncCallback): void; + /** + * Releases buffer in bufferqueue instance and uses a callback to return the result. + * + * @param { AsyncCallback } callback Callback to return the operation result. + * @syscap SystemCapability.Multimedia.Image.ImageCreator + * @since 9 + */ + release(callback: AsyncCallback): void; + /** + * Releases buffer in bufferqueue instance and uses a promise to return the result. + * + * @returns { Promise } A Promise instance used to return the operation result. + * @syscap SystemCapability.Multimedia.Image.ImageCreator + * @since 9 + */ + release(): Promise; + } +} +export default image; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.multimedia.media.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.multimedia.media.d.ts new file mode 100755 index 00000000..aac7fc9e --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.multimedia.media.d.ts @@ -0,0 +1,4729 @@ +/* +* Copyright (C) 2021 Huawei Device Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +/** + * @file + * @kit MediaKit + */ +import { ErrorCallback, AsyncCallback, Callback } from './@ohos.base'; +import audio from "./@ohos.multimedia.audio"; +import type image from './@ohos.multimedia.image'; +import type { SoundPool as _SoundPool } from './multimedia/soundPool'; +import type { PlayParameters as _PlayParameters } from './multimedia/soundPool'; +import type drm from './@ohos.multimedia.drm'; +/** + * @namespace media + * @since 6 + */ +/** + * @namespace media + * @atomicservice + * @since 11 + */ +declare namespace media { + /** + * Creates an AVPlayer instance. + * @param { AsyncCallback } callback - used to return AVPlayer instance if the operation is successful; returns null otherwise. + * @throws { BusinessError } 5400101 - No memory. Return by callback. + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @since 9 + */ + /** + * Creates an AVPlayer instance. + * @param { AsyncCallback } callback - used to return AVPlayer instance if the operation is successful; returns null otherwise. + * @throws { BusinessError } 5400101 - No memory. Return by callback. + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @atomicservice + * @since 11 + */ + function createAVPlayer(callback: AsyncCallback): void; + /** + * Creates an AVPlayer instance. + * @returns { Promise } A Promise instance used to return AVPlayer instance if the operation is successful; returns null otherwise. + * @throws { BusinessError } 5400101 - No memory. Return by promise. + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @since 9 + */ + /** + * Creates an AVPlayer instance. + * @returns { Promise } A Promise instance used to return AVPlayer instance if the operation is successful; returns null otherwise. + * @throws { BusinessError } 5400101 - No memory. Return by promise. + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @atomicservice + * @since 11 + */ + function createAVPlayer(): Promise; + /** + * Creates an AVRecorder instance. + * @param { AsyncCallback } callback - used to return AVRecorder instance if the operation is successful; returns null otherwise. + * @throws { BusinessError } 5400101 - No memory. Return by callback. + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @since 9 + */ + function createAVRecorder(callback: AsyncCallback): void; + /** + * Creates an AVRecorder instance. + * @returns { Promise } A Promise instance used to return AVRecorder instance if the operation is successful; returns null otherwise. + * @throws { BusinessError } 5400101 - No memory. Return by promise. + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @since 9 + */ + /** + * Creates an AVRecorder instance. + * @returns { Promise } A Promise instance used to return AVRecorder instance if the operation is successful; returns null otherwise. + * @throws { BusinessError } 5400101 - No memory. Return by promise. + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @atomicservice + * @since 12 + */ + function createAVRecorder(): Promise; + /** + * Creates an AudioPlayer instance. + * @returns { AudioPlayer } Returns an AudioPlayer instance if the operation is successful; returns null otherwise. + * @syscap SystemCapability.Multimedia.Media.AudioPlayer + * @since 6 + * @deprecated since 9 + * @useinstead ohos.multimedia.media/media#createAVPlayer + */ + function createAudioPlayer(): AudioPlayer; + /** + * Creates an AudioRecorder instance. + * @returns { AudioRecorder } Returns an AudioRecorder instance if the operation is successful; returns null otherwise. + * @syscap SystemCapability.Multimedia.Media.AudioRecorder + * @since 6 + * @deprecated since 9 + * @useinstead ohos.multimedia.media/media#createAVRecorder + */ + function createAudioRecorder(): AudioRecorder; + /** + * Create MediaSource from url. + * @param { string } url : The location for the media source. + * @param { Record } headers : Headers attached to network request while player request data. + * @returns { MediaSource } MediaSource instance if the operation is successful; returns null otherwise. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3.Parameter verification failed. + * @throws { BusinessError } 5400101 - No memory. + * @syscap SystemCapability.Multimedia.Media.Core + * @since 12 + */ + function createMediaSourceWithUrl(url: string, headers?: Record): MediaSource; + /** + * Creates an VideoPlayer instance. + * @param { AsyncCallback } callback - used to return AudioPlayer instance if the operation is successful; returns null otherwise. + * @syscap SystemCapability.Multimedia.Media.VideoPlayer + * @since 8 + * @deprecated since 9 + * @useinstead ohos.multimedia.media/media#createAVPlayer + */ + function createVideoPlayer(callback: AsyncCallback): void; + /** + * Creates an VideoPlayer instance. + * @returns { Promise } A Promise instance used to return VideoPlayer instance if the operation is successful; returns null otherwise. + * @syscap SystemCapability.Multimedia.Media.VideoPlayer + * @since 8 + * @deprecated since 9 + * @useinstead ohos.multimedia.media/media#createAVPlayer + */ + function createVideoPlayer(): Promise; + /** + * Creates a soundPool instance. + * + * @param {number} maxStreams The maximum number of simultaneous streams for this soundPool instance + * @param {audio.AudioRendererInfo} audioRenderInfo Audio renderer information + * @param {AsyncCallback} callback Callback used to return soundPool instance if the operation is successful; returns null otherwise. + * @throws { BusinessError } 5400101 - No memory. Return by callback. + * @syscap SystemCapability.Multimedia.Media.SoundPool + * @since 10 + */ + function createSoundPool(maxStreams: number, audioRenderInfo: audio.AudioRendererInfo, callback: AsyncCallback): void; + /** + * Creates a soundPool instance. + * + * @param {number} maxStreams The maximum number of simultaneous streams for this soundPool instance + * @param {audio.AudioRendererInfo} audioRenderInfo Audio renderer information + * @returns {Promise} A Promise instance used to return SoundPool instance if the operation is successful; returns null otherwise. + * @throws { BusinessError } 5400101 - No memory. Return by promise. + * @syscap SystemCapability.Multimedia.Media.SoundPool + * @since 10 + */ + function createSoundPool(maxStreams: number, audioRenderInfo: audio.AudioRendererInfo): Promise; + /** + * Creates an AVScreenCaptureRecorder instance. + * @returns { Promise } A Promise instance used to return AVScreenCaptureRecorder instance if the operation is successful; + * returns null otherwise. + * @throws { BusinessError } 5400101 - No memory. Return by promise. + * @syscap SystemCapability.Multimedia.Media.AVScreenCapture + * @since 12 + */ + function createAVScreenCaptureRecorder(): Promise; + /** + * Manages and plays sound. Before calling an SoundPool method, you must use createSoundPool() + * to create an SoundPool instance. + * + * @syscap SystemCapability.Multimedia.Media.SoundPool + * @since 10 + */ + type SoundPool = _SoundPool; + /** + * Describes play parameters. + * + * @syscap SystemCapability.Multimedia.Media.SoundPool + * @since 10 + */ + type PlayParameters = _PlayParameters; + /** + * Enumerates state change reason. + * + * @enum { number } + * @syscap SystemCapability.Multimedia.Media.Core + * @since 9 + */ + /** + * Enumerates state change reason. + * + * @enum { number } + * @syscap SystemCapability.Multimedia.Media.Core + * @atomicservice + * @since 11 + */ + enum StateChangeReason { + /** + * State changed by user operation. + * @syscap SystemCapability.Multimedia.Media.Core + * @since 9 + */ + /** + * State changed by user operation. + * @syscap SystemCapability.Multimedia.Media.Core + * @atomicservice + * @since 11 + */ + USER = 1, + /** + * State changed by background action. + * @syscap SystemCapability.Multimedia.Media.Core + * @since 9 + */ + /** + * State changed by background action. + * @syscap SystemCapability.Multimedia.Media.Core + * @atomicservice + * @since 11 + */ + BACKGROUND = 2 + } + /** + * Creates an AVMetadataExtractor instance. + * @returns { Promise } A Promise instance used to return AVMetadataExtractor instance + * if the operation is successful; returns null otherwise. + * @throws { BusinessError } 5400101 - No memory. Returned by promise. + * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor + * @since 11 + */ + function createAVMetadataExtractor(): Promise; + /** + * Creates an AVMetadataExtractor instance. + * @param { AsyncCallback } callback - Callback used to return AVMetadataExtractor instance + * if the operation is successful; returns null otherwise. + * @throws { BusinessError } 5400101 - No memory. Returned by callback. + * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor + * @since 11 + */ + function createAVMetadataExtractor(callback: AsyncCallback): void; + /** + * Creates an AVImageGenerator instance. + * @returns { Promise } A Promise instance used to return AVImageGenerator instance + * if the operation is successful; returns null otherwise. + * @throws { BusinessError } 5400101 - No memory. Returned by promise. + * @syscap SystemCapability.Multimedia.Media.AVImageGenerator + * @since 12 + */ + function createAVImageGenerator(): Promise; + /** + * Creates an AVImageGenerator instance. + * @param { AsyncCallback } callback - Callback used to return AVImageGenerator instance + * if the operation is successful; returns null otherwise. + * @throws { BusinessError } 5400101 - No memory. Returned by callback. + * @syscap SystemCapability.Multimedia.Media.AVImageGenerator + * @since 12 + */ + function createAVImageGenerator(callback: AsyncCallback): void; + /** + * Fetch media meta data or audio art picture from source. Before calling an AVMetadataExtractor method, + * you must use createAVMetadataExtractor() to create an AVMetadataExtractor instance. + * @typedef AVMetadataExtractor + * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor + * @since 11 + */ + interface AVMetadataExtractor { + /** + * Media file descriptor. + * @type { ?AVFileDescriptor } + * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor + * @since 11 + */ + fdSrc?: AVFileDescriptor; + /** + * DataSource descriptor. + * @type { ?AVDataSrcDescriptor } + * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor + * @since 11 + */ + dataSrc?: AVDataSrcDescriptor; + /** + * It will extract the resource to fetch media meta data info. + * @param { AsyncCallback } callback - A callback instance used to return when fetchMetadata completed. + * @throws { BusinessError } 5400102 - Operation not allowed. Returned by callback. + * @throws { BusinessError } 5400106 - Unsupported format. Returned by callback. + * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor + * @since 11 + */ + fetchMetadata(callback: AsyncCallback): void; + /** + * It will extract the resource to fetch media meta data info. + * @returns { Promise } A Promise instance used to return when fetchMetadata completed. + * @throws { BusinessError } 5400102 - Operation not allowed. Returned by promise. + * @throws { BusinessError } 5400106 - Unsupported format. Returned by promise. + * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor + * @since 11 + */ + fetchMetadata(): Promise; + /** + * It will extract the audio resource to fetch an album cover. + * @param { AsyncCallback } callback - A callback instance used + * to return when fetchAlbumCover completed. + * @throws { BusinessError } 5400102 - Operation not allowed. Return by callback. + * @throws { BusinessError } 5400106 - Unsupported format. Returned by callback. + * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor + * @since 11 + */ + fetchAlbumCover(callback: AsyncCallback): void; + /** + * It will extract the audio resource to fetch an album cover. + * @returns { Promise } A Promise instance used to return when fetchAlbumCover completed. + * @throws { BusinessError } 5400102 - Operation not allowed. Returned by promise. + * @throws { BusinessError } 5400106 - Unsupported format. Returned by promise. + * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor + * @since 11 + */ + fetchAlbumCover(): Promise; + /** + * Release resources used for AVMetadataExtractor. + * @param { AsyncCallback } callback - A callback instance used to return when release completed. + * @throws { BusinessError } 5400102 - Operation not allowed. Returned by callback. + * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor + * @since 11 + */ + release(callback: AsyncCallback): void; + /** + * Release resources used for AVMetadataExtractor. + * @returns { Promise } A Promise instance used to return when release completed. + * @throws { BusinessError } 5400102 - Operation not allowed. Returned by promise. + * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor + * @since 11 + */ + release(): Promise; + } + /** + * Provides the container definition for media meta data. + * @typedef AVMetadata + * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor + * @since 11 + */ + interface AVMetadata { + /** + * The metadata to retrieve the information about the album title + * of the media source. + * @type { ?string } + * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor + * @since 11 + */ + /** + * The metadata to retrieve the information about the album title + * of the media source. This field is readonly in current version. + * @type { ?string } + * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor + * @since 12 + */ + album?: string; + /** + * The metadata to retrieve the information about the performer or + * artist associated with the media source. + * @type { ?string } + * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor + * @since 11 + */ + /** + * The metadata to retrieve the information about the performer or + * artist associated with the media source. This field is readonly in current version. + * @type { ?string } + * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor + * @since 12 + */ + albumArtist?: string; + /** + * The metadata to retrieve the information about the artist of + * the media source. + * @type { ?string } + * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor + * @since 11 + */ + /** + * The metadata to retrieve the information about the artist of + * the media source. This field is readonly in current version. + * @type { ?string } + * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor + * @since 12 + */ + artist?: string; + /** + * The metadata to retrieve the information about the author of + * the media source. + * @type { ?string } + * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor + * @since 11 + */ + /** + * The metadata to retrieve the information about the author of + * the media source. This field is readonly in current version. + * @type { ?string } + * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor + * @since 12 + */ + author?: string; + /** + * The metadata to retrieve the information about the created time of + * the media source. + * @type { ?string } + * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor + * @since 11 + */ + /** + * The metadata to retrieve the information about the created time of + * the media source. This field is readonly in current version. + * @type { ?string } + * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor + * @since 12 + */ + dateTime?: string; + /** + * The metadata to retrieve the information about the created or modified time + * with the specific date format of the media source. + * @type { ?string } + * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor + * @since 11 + */ + /** + * The metadata to retrieve the information about the created or modified time + * with the specific date format of the media source. This field is readonly in current version. + * @type { ?string } + * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor + * @since 12 + */ + dateTimeFormat?: string; + /** + * The metadata to retrieve the information about the composer of + * the media source. + * @type { ?string } + * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor + * @since 11 + */ + /** + * The metadata to retrieve the information about the composer of + * the media source. This field is readonly in current version. + * @type { ?string } + * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor + * @since 12 + */ + composer?: string; + /** + * The metadata to retrieve the playback duration of the media source. + * @type { ?string } + * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor + * @since 11 + */ + /** + * The metadata to retrieve the playback duration of the media source. This field is readonly in current version. + * @type { ?string } + * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor + * @since 12 + */ + duration?: string; + /** + * The metadata to retrieve the content type or genre of the data + * source. + * @type { ?string } + * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor + * @since 11 + */ + genre?: string; + /** + * If this value exists the media contains audio content. + * @type { ?string } + * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor + * @since 11 + */ + /** + * If this value exists the media contains audio content. This field is readonly in current version. + * @type { ?string } + * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor + * @since 12 + */ + hasAudio?: string; + /** + * If this value exists the media contains video content. + * @type { ?string } + * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor + * @since 11 + */ + /** + * If this value exists the media contains video content. This field is readonly in current version. + * @type { ?string } + * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor + * @since 12 + */ + hasVideo?: string; + /** + * The metadata to retrieve the mime type of the media source. Some + * example mime types include: "video/mp4", "audio/mp4", "audio/amr-wb", + * @type { ?string } + * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor + * @since 11 + */ + /** + * The metadata to retrieve the mime type of the media source. Some + * example mime types include: "video/mp4", "audio/mp4", "audio/amr-wb". This field is readonly in current version. + * @type { ?string } + * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor + * @since 12 + */ + mimeType?: string; + /** + * The metadata to retrieve the number of tracks, such as audio, video, + * text, in the media source, such as a mp4 or 3gpp file. + * @type { ?string } + * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor + * @since 11 + */ + /** + * The metadata to retrieve the number of tracks, such as audio, video, + * text, in the media source, such as a mp4 or 3gpp file. This field is readonly in current version. + * @type { ?string } + * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor + * @since 12 + */ + trackCount?: string; + /** + * It is the audio sample rate, if available. + * @type { ?string } + * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor + * @since 11 + */ + /** + * It is the audio sample rate, if available. This field is readonly in current version. + * @type { ?string } + * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor + * @since 12 + */ + sampleRate?: string; + /** + * The metadata to retrieve the media source title. + * @type { ?string } + * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor + * @since 11 + */ + /** + * The metadata to retrieve the media source title. This field is readonly in current version. + * @type { ?string } + * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor + * @since 12 + */ + title?: string; + /** + * If the media contains video, this key retrieves its height. + * @type { ?string } + * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor + * @since 11 + */ + /** + * If the media contains video, this key retrieves its height. This field is readonly in current version. + * @type { ?string } + * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor + * @since 12 + */ + videoHeight?: string; + /** + * If the media contains video, this key retrieves its width. + * @type { ?string } + * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor + * @since 11 + */ + /** + * If the media contains video, this key retrieves its width. This field is readonly in current version. + * @type { ?string } + * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor + * @since 12 + */ + videoWidth?: string; + /** + * The metadata to retrieve the information about the video + * orientation. + * @type { ?string } + * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor + * @since 11 + */ + videoOrientation?: string; + /** + * This value exists if the video is HDR video. + * @type { ?HdrType } + * @readonly + * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor + * @since 12 + */ + hdrType?: HdrType; + /** + * The geographical location info of the video. + * @type { ?Location } + * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor + * @since 12 + */ + location?: Location; + /** + * Custom parameter key-value map read from moov.meta.list. + * @type { ?Record } + * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor + * @since 12 + */ + customInfo?: Record; + } + /** + * Enumerates options about the HDR Type of the video. + * @enum { number } + * @syscap SystemCapability.Multimedia.Media.Core + * @since 12 + */ + enum HdrType { + /** + * This option is used to mark none HDR type. + * @syscap SystemCapability.Multimedia.Media.Core + * @since 12 + */ + AV_HDR_TYPE_NONE = 0, + /** + * This option is used to mark HDR Vivid type. + * @syscap SystemCapability.Multimedia.Media.Core + * @since 12 + */ + AV_HDR_TYPE_VIVID = 1 + } + /** + * Generate an image from a video resource with the specific time. Before calling an AVImageGenerator method, + * you must use createAVImageGenerator() to create an AVImageGenerator instance. + * @typedef AVImageGenerator + * @syscap SystemCapability.Multimedia.Media.AVImageGenerator + * @since 12 + */ + interface AVImageGenerator { + /** + * Media file descriptor. + * @type { ?AVFileDescriptor } + * @syscap SystemCapability.Multimedia.Media.AVImageGenerator + * @since 12 + */ + fdSrc?: AVFileDescriptor; + /** + * It will fetch a picture at @timeUs from the given video resource. + * @param { number } timeUs - The time expected to fetch picture from the video resource. + * The unit is microsecond(us). + * @param { AVImageQueryOptions } options - The time options about the relationship + * between the given timeUs and a key frame, see @AVImageQueryOptions . + * @param { PixelMapParams } param - The output pixel map format params, see @PixelMapParams . + * @param { AsyncCallback } callback - A callback instance used + * to return when fetchFrameByTime completed. + * @throws { BusinessError } 5400102 - Operation not allowed. Returned by callback. + * @throws { BusinessError } 5400106 - Unsupported format. Returned by callback. + * @syscap SystemCapability.Multimedia.Media.AVImageGenerator + * @since 12 + */ + fetchFrameByTime(timeUs: number, options: AVImageQueryOptions, param: PixelMapParams, callback: AsyncCallback): void; + /** + * It will decode the given video resource. Then fetch a picture + * at @timeUs according the given @options and @param . + * @param { number } timeUs - The time expected to fetch picture from the video resource. + * The unit is microsecond(us). + * @param { AVImageQueryOptions } options - The time options about the relationship + * between the given timeUs and a key frame, see @AVImageQueryOptions . + * @param { PixelMapParams } param - The output pixel map format params, see @PixelMapParams . + * @returns { Promise } A Promise instance used to return the pixel map + * when fetchFrameByTime completed. + * @throws { BusinessError } 5400102 - Operation not allowed. Returned by promise. + * @throws { BusinessError } 5400106 - Unsupported format. Returned by promise. + * @syscap SystemCapability.Multimedia.Media.AVImageGenerator + * @since 12 + */ + fetchFrameByTime(timeUs: number, options: AVImageQueryOptions, param: PixelMapParams): Promise; + /** + * Release resources used for AVImageGenerator. + * @param { AsyncCallback } callback - A callback instance used to return when release completed. + * @throws { BusinessError } 5400102 - Operation not allowed. Returned by callback. + * @syscap SystemCapability.Multimedia.Media.AVImageGenerator + * @since 12 + */ + release(callback: AsyncCallback): void; + /** + * Release resources used for AVImageGenerator. + * @returns { Promise } A Promise instance used to return when release completed. + * @throws { BusinessError } 5400102 - Operation not allowed. Returned by promise. + * @syscap SystemCapability.Multimedia.Media.AVImageGenerator + * @since 12 + */ + release(): Promise; + } + /** + * Enumerates options about the relationship between the given timeUs and a key frame. + * @enum { number } + * @syscap SystemCapability.Multimedia.Media.AVImageGenerator + * @since 12 + */ + enum AVImageQueryOptions { + /** + * This option is used to fetch a key frame from the given media + * resource that is located right after or at the given time. + * @syscap SystemCapability.Multimedia.Media.AVImageGenerator + * @since 12 + */ + AV_IMAGE_QUERY_NEXT_SYNC, + /** + * This option is used to fetch a key frame from the given media + * resource that is located right before or at the given time. + * @syscap SystemCapability.Multimedia.Media.AVImageGenerator + * @since 12 + */ + AV_IMAGE_QUERY_PREVIOUS_SYNC, + /** + * This option is used to fetch a key frame from the given media + * resource that is located closest to or at the given time. + * @syscap SystemCapability.Multimedia.Media.AVImageGenerator + * @since 12 + */ + AV_IMAGE_QUERY_CLOSEST_SYNC + } + /** + * Expected pixel map format for the fetched image from video resource. + * @typedef PixelMapParams + * @syscap SystemCapability.Multimedia.Media.AVImageGenerator + * @since 12 + */ + interface PixelMapParams { + /** + * Expected pixelmap's width, -1 means to keep consistent with the + * original dimensions of the given video resource. + * @type { ?number } + * @syscap SystemCapability.Multimedia.Media.AVImageGenerator + * @since 12 + */ + width?: number; + /** + * Expected pixelmap's width, -1 means to keep consistent with the + * original dimensions of the given video resource. + * @type { ?number } + * @syscap SystemCapability.Multimedia.Media.AVImageGenerator + * @since 12 + */ + height?: number; + } + /** + * Enumerates ErrorCode types, return in BusinessError::code. + * + * @enum { number } + * @syscap SystemCapability.Multimedia.Media.Core + * @since 9 + */ + /** + * Enumerates ErrorCode types, return in BusinessError::code. + * + * @enum { number } + * @syscap SystemCapability.Multimedia.Media.Core + * @atomicservice + * @since 11 + */ + enum AVErrorCode { + /** + * Operation success. + * @syscap SystemCapability.Multimedia.Media.Core + * @since 9 + */ + /** + * Operation success. + * @syscap SystemCapability.Multimedia.Media.Core + * @atomicservice + * @since 11 + */ + AVERR_OK = 0, + /** + * Permission denied. + * @syscap SystemCapability.Multimedia.Media.Core + * @since 9 + */ + /** + * Permission denied. + * @syscap SystemCapability.Multimedia.Media.Core + * @atomicservice + * @since 11 + */ + AVERR_NO_PERMISSION = 201, + /** + * Invalid parameter. + * @syscap SystemCapability.Multimedia.Media.Core + * @since 9 + */ + /** + * Invalid parameter. + * @syscap SystemCapability.Multimedia.Media.Core + * @atomicservice + * @since 11 + */ + AVERR_INVALID_PARAMETER = 401, + /** + * The api is not supported in the current version. + * @syscap SystemCapability.Multimedia.Media.Core + * @since 9 + */ + /** + * The api is not supported in the current version. + * @syscap SystemCapability.Multimedia.Media.Core + * @atomicservice + * @since 11 + */ + AVERR_UNSUPPORT_CAPABILITY = 801, + /** + * The system memory is insufficient or the number of services reaches the upper limit. + * @syscap SystemCapability.Multimedia.Media.Core + * @since 9 + */ + /** + * The system memory is insufficient or the number of services reaches the upper limit. + * @syscap SystemCapability.Multimedia.Media.Core + * @atomicservice + * @since 11 + */ + AVERR_NO_MEMORY = 5400101, + /** + * Current status does not allow or do not have permission to perform this operation. + * @syscap SystemCapability.Multimedia.Media.Core + * @since 9 + */ + /** + * Current status does not allow or do not have permission to perform this operation. + * @syscap SystemCapability.Multimedia.Media.Core + * @atomicservice + * @since 11 + */ + AVERR_OPERATE_NOT_PERMIT = 5400102, + /** + * Data flow exception information. + * @syscap SystemCapability.Multimedia.Media.Core + * @since 9 + */ + /** + * Data flow exception information. + * @syscap SystemCapability.Multimedia.Media.Core + * @atomicservice + * @since 11 + */ + AVERR_IO = 5400103, + /** + * System or network response timeout. + * @syscap SystemCapability.Multimedia.Media.Core + * @since 9 + */ + /** + * System or network response timeout. + * @syscap SystemCapability.Multimedia.Media.Core + * @atomicservice + * @since 11 + */ + AVERR_TIMEOUT = 5400104, + /** + * Service process died. + * @syscap SystemCapability.Multimedia.Media.Core + * @since 9 + */ + /** + * Service process died. + * @syscap SystemCapability.Multimedia.Media.Core + * @atomicservice + * @since 11 + */ + AVERR_SERVICE_DIED = 5400105, + /** + * Unsupported media format. + * @syscap SystemCapability.Multimedia.Media.Core + * @since 9 + */ + /** + * Unsupported media format. + * @syscap SystemCapability.Multimedia.Media.Core + * @atomicservice + * @since 11 + */ + AVERR_UNSUPPORT_FORMAT = 5400106, + /** + * Audio interrupted. + * @syscap SystemCapability.Multimedia.Media.Core + * @atomicservice + * @since 11 + */ + AVERR_AUDIO_INTERRUPTED = 5400107 + } + /** + * Describes AVPlayer states. + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @since 9 + + */ + /** + * Describes AVPlayer states. + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @atomicservice + * @since 11 + + */ + type AVPlayerState = 'idle' | 'initialized' | 'prepared' | 'playing' | 'paused' | 'completed' | 'stopped' | 'released' | 'error'; + /** + * Manages and plays media. Before calling an AVPlayer method, you must use createAVPlayer() + * to create an AVPlayer instance. + * + * @typedef AVPlayer + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @since 9 + */ + /** + * Manages and plays media. Before calling an AVPlayer method, you must use createAVPlayer() + * to create an AVPlayer instance. + * + * @typedef AVPlayer + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @atomicservice + * @since 11 + */ + interface AVPlayer { + /** + * Prepare audio/video playback, it will request resource for playing. + * @param { AsyncCallback } callback - instance used to return when prepare completed. + * @throws { BusinessError } 5400102 - Operation not allowed. Return by callback. + * @throws { BusinessError } 5400106 - Unsupport format. Return by callback. + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @since 9 + */ + /** + * Prepare audio/video playback, it will request resource for playing. + * @param { AsyncCallback } callback - instance used to return when prepare completed. + * @throws { BusinessError } 5400102 - Operation not allowed. Return by callback. + * @throws { BusinessError } 5400106 - Unsupport format. Return by callback. + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @atomicservice + * @since 11 + */ + prepare(callback: AsyncCallback): void; + /** + * Prepare audio/video playback, it will request resource for playing. + * @returns { Promise } A Promise instance used to return when prepare completed. + * @throws { BusinessError } 5400102 - Operation not allowed. Return by promise. + * @throws { BusinessError } 5400106 - Unsupport format. Return by promise. + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @since 9 + */ + /** + * Prepare audio/video playback, it will request resource for playing. + * @returns { Promise } A Promise instance used to return when prepare completed. + * @throws { BusinessError } 5400102 - Operation not allowed. Return by promise. + * @throws { BusinessError } 5400106 - Unsupport format. Return by promise. + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @atomicservice + * @since 11 + */ + prepare(): Promise; + /** + * Play audio/video playback. + * @param { AsyncCallback } callback - instance used to return when play completed. + * @throws { BusinessError } 5400102 - Operation not allowed. Return by callback. + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @since 9 + */ + /** + * Play audio/video playback. + * @param { AsyncCallback } callback - instance used to return when play completed. + * @throws { BusinessError } 5400102 - Operation not allowed. Return by callback. + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @atomicservice + * @since 11 + */ + play(callback: AsyncCallback): void; + /** + * Play audio/video playback. + * @returns { Promise } A Promise instance used to return when play completed. + * @throws { BusinessError } 5400102 - Operation not allowed. Return by promise. + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @since 9 + */ + /** + * Play audio/video playback. + * @returns { Promise } A Promise instance used to return when play completed. + * @throws { BusinessError } 5400102 - Operation not allowed. Return by promise. + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @atomicservice + * @since 11 + */ + play(): Promise; + /** + * Pause audio/video playback. + * @param { AsyncCallback } callback - instance used to return when pause completed. + * @throws { BusinessError } 5400102 - Operation not allowed. Return by callback. + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @since 9 + */ + /** + * Pause audio/video playback. + * @param { AsyncCallback } callback - instance used to return when pause completed. + * @throws { BusinessError } 5400102 - Operation not allowed. Return by callback. + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @atomicservice + * @since 11 + */ + pause(callback: AsyncCallback): void; + /** + * Pause audio/video playback. + * @returns { Promise } A Promise instance used to return when pause completed. + * @throws { BusinessError } 5400102 - Operation not allowed. Return by promise. + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @since 9 + */ + /** + * Pause audio/video playback. + * @returns { Promise } A Promise instance used to return when pause completed. + * @throws { BusinessError } 5400102 - Operation not allowed. Return by promise. + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @atomicservice + * @since 11 + */ + pause(): Promise; + /** + * Stop audio/video playback. + * @param { AsyncCallback } callback - instance used to return when stop completed. + * @throws { BusinessError } 5400102 - Operation not allowed. Return by callback. + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @since 9 + */ + /** + * Stop audio/video playback. + * @param { AsyncCallback } callback - instance used to return when stop completed. + * @throws { BusinessError } 5400102 - Operation not allowed. Return by callback. + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @atomicservice + * @since 11 + */ + stop(callback: AsyncCallback): void; + /** + * Stop audio/video playback. + * @returns { Promise } A Promise instance used to return when stop completed. + * @throws { BusinessError } 5400102 - Operation not allowed. Return by promise. + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @since 9 + */ + /** + * Stop audio/video playback. + * @returns { Promise } A Promise instance used to return when stop completed. + * @throws { BusinessError } 5400102 - Operation not allowed. Return by promise. + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @atomicservice + * @since 11 + */ + stop(): Promise; + /** + * Reset AVPlayer, it will to idle state and can set src again. + * @param { AsyncCallback } callback - instance used to return when reset completed. + * @throws { BusinessError } 5400102 - Operation not allowed. Return by callback. + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @since 9 + */ + /** + * Reset AVPlayer, it will to idle state and can set src again. + * @param { AsyncCallback } callback - instance used to return when reset completed. + * @throws { BusinessError } 5400102 - Operation not allowed. Return by callback. + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @atomicservice + * @since 11 + */ + reset(callback: AsyncCallback): void; + /** + * Reset AVPlayer, it will to idle state and can set src again. + * @returns { Promise } A Promise instance used to return when reset completed. + * @throws { BusinessError } 5400102 - Operation not allowed. Return by promise. + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @since 9 + */ + /** + * Reset AVPlayer, it will to idle state and can set src again. + * @returns { Promise } A Promise instance used to return when reset completed. + * @throws { BusinessError } 5400102 - Operation not allowed. Return by promise. + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @atomicservice + * @since 11 + */ + reset(): Promise; + /** + * Releases resources used for AVPlayer. + * @param { AsyncCallback } callback - instance used to return when release completed. + * @throws { BusinessError } 5400102 - Operation not allowed. Return by callback. + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @since 9 + */ + /** + * Releases resources used for AVPlayer. + * @param { AsyncCallback } callback - instance used to return when release completed. + * @throws { BusinessError } 5400102 - Operation not allowed. Return by callback. + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @atomicservice + * @since 11 + */ + release(callback: AsyncCallback): void; + /** + * Releases resources used for AVPlayer. + * @returns { Promise } A Promise instance used to return when release completed. + * @throws { BusinessError } 5400102 - Operation not allowed. Return by promise. + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @since 9 + */ + /** + * Releases resources used for AVPlayer. + * @returns { Promise } A Promise instance used to return when release completed. + * @throws { BusinessError } 5400102 - Operation not allowed. Return by promise. + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @atomicservice + * @since 11 + */ + release(): Promise; + /** + * Jumps to the specified playback position. + * @param { number } timeMs - Playback position to jump, should be in [0, duration]. + * @param { SeekMode } mode - See @SeekMode . + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @since 9 + */ + /** + * Jumps to the specified playback position. + * @param { number } timeMs - Playback position to jump, should be in [0, duration]. + * @param { SeekMode } mode - See @SeekMode . + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @atomicservice + * @since 11 + */ + seek(timeMs: number, mode?: SeekMode): void; + /** + * Sets the volume. + * @param { number } volume - Relative volume. The value ranges from 0.00 to 1.00. The value 1 indicates the maximum volume (100%). + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @since 9 + */ + /** + * Sets the volume. + * @param { number } volume - Relative volume. The value ranges from 0.00 to 1.00. The value 1 indicates the maximum volume (100%). + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @atomicservice + * @since 12 + */ + setVolume(volume: number): void; + /** + * Get all track infos in MediaDescription, should be called after data loaded callback. + * @param { AsyncCallback> } callback - Async callback return track info in MediaDescription. + * @throws { BusinessError } 5400102 - Operation not allowed. Return by callback. + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @since 9 + */ + /** + * Get all track infos in MediaDescription, should be called after data loaded callback. + * @param { AsyncCallback> } callback - Async callback return track info in MediaDescription. + * @throws { BusinessError } 5400102 - Operation not allowed. Return by callback. + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @atomicservice + * @since 11 + */ + getTrackDescription(callback: AsyncCallback>): void; + /** + * Get all track infos in MediaDescription, should be called after data loaded callback. + * @returns { Promise> } A Promise instance used to return the track info in MediaDescription. + * @throws { BusinessError } 5400102 - Operation not allowed. Return by promise. + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @since 9 + */ + /** + * Get all track infos in MediaDescription, should be called after data loaded callback. + * @returns { Promise> } A Promise instance used to return the track info in MediaDescription. + * @throws { BusinessError } 5400102 - Operation not allowed. Return by promise. + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @atomicservice + * @since 11 + */ + getTrackDescription(): Promise>; + /** + * Set MediaSource to AVPlayer, this interface is exclusive with fd/url/dataSrc assign. + * @param { MediaSource } src : MediaSource instance to be set to the avplayer instance. + * @param { PlaybackStrategy } strategy : Play strategy of the media source. + * @returns { Promise } A Promise instance used to return when setMediaSource completed. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3.Parameter verification failed. + * @throws { BusinessError } 5400102 - Operation not allowed. Return by promise. + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @atomicservice + * @since 12 + */ + setMediaSource(src: MediaSource, strategy?: PlaybackStrategy): Promise; + /** + * Media URI. Mainstream media formats are supported. + * Network:http://xxx + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @since 9 + */ + /** + * Media URI. Mainstream media formats are supported. + * Network:http://xxx + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @atomicservice + * @since 11 + */ + url?: string; + /** + * Media file descriptor. Mainstream media formats are supported. + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @since 9 + */ + /** + * Media file descriptor. Mainstream media formats are supported. + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @atomicservice + * @since 11 + */ + fdSrc?: AVFileDescriptor; + /** + * DataSource descriptor. Supports mainstream media formats. + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @since 10 + */ + /** + * DataSource descriptor. Supports mainstream media formats. + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @atomicservice + * @since 11 + */ + dataSrc?: AVDataSrcDescriptor; + /** + * Whether to loop media playback. + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @since 9 + */ + /** + * Whether to loop media playback. + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @atomicservice + * @since 12 + */ + loop: boolean; + /** + * Describes audio interrupt mode, refer to {@link #audio.InterruptMode}. If it is not + * set, the default mode will be used. Set it before calling the {@link #play()} in the + * first time in order for the interrupt mode to become effective thereafter. + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @since 9 + */ + /** + * Describes audio interrupt mode, refer to {@link #audio.InterruptMode}. If it is not + * set, the default mode will be used. Set it before calling the {@link #play()} in the + * first time in order for the interrupt mode to become effective thereafter. + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @atomicservice + * @since 12 + */ + audioInterruptMode?: audio.InterruptMode; + /** + * Describes audio renderer info, refer to {@link #audio.AudioRendererInfo}. Set it before + * calling the {@link #prepare()} in the first time in order for the audio renderer info to + * become effective thereafter. + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @since 10 + */ + /** + * Describes audio renderer info, refer to {@link #audio.AudioRendererInfo}. Set it before + * calling the {@link #prepare()} in the first time in order for the audio renderer info to + * become effective thereafter. + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @atomicservice + * @since 12 + */ + audioRendererInfo?: audio.AudioRendererInfo; + /** + * Obtains the current audio effect mode, refer to {@link #audio.AudioEffectMode}. + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @since 10 + */ + /** + * Obtains the current audio effect mode, refer to {@link #audio.AudioEffectMode}. + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @atomicservice + * @since 12 + */ + audioEffectMode?: audio.AudioEffectMode; + /** + * Current playback position. + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @since 9 + */ + /** + * Current playback position. + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @atomicservice + * @since 12 + */ + readonly currentTime: number; + /** + * Playback duration, When the data source does not support seek, it returns - 1, such as a live broadcast scenario. + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @since 9 + */ + /** + * Playback duration, When the data source does not support seek, it returns - 1, such as a live broadcast scenario. + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @atomicservice + * @since 11 + */ + readonly duration: number; + /** + * Playback state. + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @since 9 + */ + /** + * Playback state. + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @atomicservice + * @since 12 + */ + readonly state: AVPlayerState; + /** + * Video player will use this id get a surface instance. + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @since 9 + */ + /** + * Video player will use this id get a surface instance. + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @atomicservice + * @since 11 + */ + surfaceId?: string; + /** + * Video width, valid after prepared. + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @since 9 + */ + /** + * Video width, valid after prepared. + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @atomicservice + * @since 12 + */ + readonly width: number; + /** + * Video height, valid after prepared. + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @since 9 + */ + /** + * Video height, valid after prepared. + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @atomicservice + * @since 12 + */ + readonly height: number; + /** + * Video scale type. By default, the {@link #VIDEO_SCALE_TYPE_FIT} will be used, for more + * information, refer to {@link #VideoScaleType} . + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @since 9 + */ + /** + * Video scale type. By default, the {@link #VIDEO_SCALE_TYPE_FIT} will be used, for more + * information, refer to {@link #VideoScaleType} . + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @atomicservice + * @since 12 + */ + videoScaleType?: VideoScaleType; + /** + * Set payback speed. + * @param { PlaybackSpeed } speed - playback speed, see @PlaybackSpeed . + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @since 9 + */ + /** + * Set payback speed. + * @param { PlaybackSpeed } speed - playback speed, see @PlaybackSpeed . + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @atomicservice + * @since 12 + */ + setSpeed(speed: PlaybackSpeed): void; + /** + * select a specified bitrate to playback, only valid for HLS protocol network stream. By default, the + * player will select the appropriate bitrate according to the network connection speed. The + * available bitrate list reported by {@link #on('availableBitrates')}. Set it to select + * a specified bitrate. If the specified bitrate is not in the list of available bitrate, the player + * will select the minimal and closest one from the available bitrate list. + * @param { number } bitrate - the playback bitrate must be expressed in bits per second. + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @since 9 + */ + /** + * select a specified bitrate to playback, only valid for HLS protocol network stream. By default, the + * player will select the appropriate bitrate according to the network connection speed. The + * available bitrate list reported by {@link #on('availableBitrates')}. Set it to select + * a specified bitrate. If the specified bitrate is not in the list of available bitrate, the player + * will select the minimal and closest one from the available bitrate list. + * @param { number } bitrate - the playback bitrate must be expressed in bits per second. + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @atomicservice + * @since 12 + */ + setBitrate(bitrate: number): void; + /** + * Set decryption session to codec module. + * @param { drm.MediaKeySession } mediaKeySession - Handle of MediaKeySession to decrypt encrypted media. + * @param { boolean } secureVideoPath - Secure video path required or not. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3.Parameter verification failed. + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @since 11 + */ + /** + * Set decryption session to codec module. + * @param { drm.MediaKeySession } mediaKeySession - Handle of MediaKeySession to decrypt encrypted media. + * @param { boolean } secureVideoPath - Secure video path required or not. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3.Parameter verification failed. + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @atomicservice + * @since 12 + */ + setDecryptionConfig(mediaKeySession: drm.MediaKeySession, secureVideoPath: boolean): void; + /** + * Get media key system info from media source. + * @returns { Array } MediaKeySystemInfo with PSSH. + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @since 11 + */ + /** + * Get media key system info from media source. + * @returns { Array } MediaKeySystemInfo with PSSH. + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @atomicservice + * @since 12 + */ + getMediaKeySystemInfos(): Array; + /** + * Register listens for mediaKeySystemInfoUpdate events. + * @param { 'mediaKeySystemInfoUpdate' } type - Type of the event to listen for. + * @param { function } callback - Callback used to listen for the mediaKeySystemInfoUpdate event. + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @since 11 + */ + /** + * Register listens for mediaKeySystemInfoUpdate events. + * @param { 'mediaKeySystemInfoUpdate' } type - Type of the event to listen for. + * @param { function } callback - Callback used to listen for the mediaKeySystemInfoUpdate event. + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @atomicservice + * @since 12 + */ + on(type: 'mediaKeySystemInfoUpdate', callback: (mediaKeySystemInfo: Array) => void): void; + /** + * Unregister listens for mediaKeySystemInfoUpdate events. + * @param { 'mediaKeySystemInfoUpdate' } type - Type of the event to listen for. + * @param { function } callback - Callback for event. + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @since 11 + */ + /** + * Unregister listens for mediaKeySystemInfoUpdate events. + * @param { 'mediaKeySystemInfoUpdate' } type - Type of the event to listen for. + * @param { function } callback - Callback for event. + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @atomicservice + * @since 12 + */ + off(type: 'mediaKeySystemInfoUpdate', callback?: (mediaKeySystemInfo: Array) => void): void; + /** + * Register listens for media playback stateChange event. + * @param { 'stateChange' } type - Type of the playback event to listen for. + * @param { function } callback - Callback used to listen for the playback stateChange event. + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @since 9 + */ + /** + * Register listens for media playback stateChange event. + * @param { 'stateChange' } type - Type of the playback event to listen for. + * @param { function } callback - Callback used to listen for the playback stateChange event. + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @atomicservice + * @since 11 + */ + on(type: 'stateChange', callback: (state: AVPlayerState, reason: StateChangeReason) => void): void; + /** + * Unregister listens for media playback stateChange event. + * @param { 'stateChange' } type - Type of the playback event to listen for. + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @since 9 + */ + /** + * Unregister listens for media playback stateChange event. + * @param { 'stateChange' } type - Type of the playback event to listen for. + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @atomicservice + * @since 11 + */ + off(type: 'stateChange'): void; + /** + * Register listens for media playback volumeChange event. + * @param { 'volumeChange' } type - Type of the playback event to listen for. + * @param { Callback } callback - Callback used to listen for the playback volume event. + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @since 9 + */ + /** + * Register listens for media playback volumeChange event. + * @param { 'volumeChange' } type - Type of the playback event to listen for. + * @param { Callback } callback - Callback used to listen for the playback volume event. + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @atomicservice + * @since 12 + */ + on(type: 'volumeChange', callback: Callback): void; + /** + * Unregister listens for media playback volumeChange event. + * @param { 'volumeChange' } type - Type of the playback event to listen for. + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @since 9 + */ + off(type: 'volumeChange'): void; + /** + * Register listens for media playback endOfStream event. + * @param { 'endOfStream' } type - Type of the playback event to listen for. + * @param { Callback } callback - Callback used to listen for the playback end of stream. + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @since 9 + */ + /** + * Register listens for media playback endOfStream event. + * @param { 'endOfStream' } type - Type of the playback event to listen for. + * @param { Callback } callback - Callback used to listen for the playback end of stream. + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @atomicservice + * @since 12 + */ + on(type: 'endOfStream', callback: Callback): void; + /** + * Unregister listens for media playback endOfStream event. + * @param { 'endOfStream' } type - Type of the playback event to listen for. + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @since 9 + */ + off(type: 'endOfStream'): void; + /** + * Register listens for media playback seekDone event. + * @param { 'seekDone' } type - Type of the playback event to listen for. + * @param { Callback } callback - Callback used to listen for the playback seekDone event. + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @since 9 + */ + /** + * Register listens for media playback seekDone event. + * @param { 'seekDone' } type - Type of the playback event to listen for. + * @param { Callback } callback - Callback used to listen for the playback seekDone event. + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @atomicservice + * @since 11 + */ + on(type: 'seekDone', callback: Callback): void; + /** + * Unregister listens for media playback seekDone event. + * @param { 'seekDone' } type - Type of the playback event to listen for. + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @since 9 + */ + /** + * Unregister listens for media playback seekDone event. + * @param { 'seekDone' } type - Type of the playback event to listen for. + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @atomicservice + * @since 11 + */ + off(type: 'seekDone'): void; + /** + * Register listens for media playback speedDone event. + * @param { 'speedDone' } type - Type of the playback event to listen for. + * @param { Callback } callback - Callback used to listen for the playback speedDone event. + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @since 9 + */ + /** + * Register listens for media playback speedDone event. + * @param { 'speedDone' } type - Type of the playback event to listen for. + * @param { Callback } callback - Callback used to listen for the playback speedDone event. + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @atomicservice + * @since 12 + */ + on(type: 'speedDone', callback: Callback): void; + /** + * Unregister listens for media playback speedDone event. + * @param { 'speedDone' } type - Type of the playback event to listen for. + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @since 9 + */ + off(type: 'speedDone'): void; + /** + * Register listens for media playback setBitrateDone event. + * @param { 'bitrateDone' } type - Type of the playback event to listen for. + * @param { Callback } callback - Callback used to listen for the playback setBitrateDone event. + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @since 9 + */ + /** + * Register listens for media playback setBitrateDone event. + * @param { 'bitrateDone' } type - Type of the playback event to listen for. + * @param { Callback } callback - Callback used to listen for the playback setBitrateDone event. + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @atomicservice + * @since 12 + */ + on(type: 'bitrateDone', callback: Callback): void; + /** + * Unregister listens for media playback setBitrateDone event. + * @param { 'bitrateDone' } type - Type of the playback event to listen for. + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @since 9 + */ + off(type: 'bitrateDone'): void; + /** + * Register listens for media playback timeUpdate event. + * @param { 'timeUpdate' } type - Type of the playback event to listen for. + * @param { Callback } callback - Callback used to listen for the playback timeUpdate event. + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @since 9 + */ + /** + * Register listens for media playback timeUpdate event. + * @param { 'timeUpdate' } type - Type of the playback event to listen for. + * @param { Callback } callback - Callback used to listen for the playback timeUpdate event. + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @atomicservice + * @since 11 + */ + on(type: 'timeUpdate', callback: Callback): void; + /** + * Unregister listens for media playback timeUpdate event. + * @param { 'timeUpdate' } type - Type of the playback event to listen for. + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @since 9 + */ + /** + * Unregister listens for media playback timeUpdate event. + * @param { 'timeUpdate' } type - Type of the playback event to listen for. + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @atomicservice + * @since 11 + */ + off(type: 'timeUpdate'): void; + /** + * Register listens for media playback durationUpdate event. + * @param { 'durationUpdate' } type - Type of the playback event to listen for. + * @param { Callback } callback - Callback used to listen for the playback durationUpdate event. + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @since 9 + */ + /** + * Register listens for media playback durationUpdate event. + * @param { 'durationUpdate' } type - Type of the playback event to listen for. + * @param { Callback } callback - Callback used to listen for the playback durationUpdate event. + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @atomicservice + * @since 12 + */ + on(type: 'durationUpdate', callback: Callback): void; + /** + * Unregister listens for media playback durationUpdate event. + * @param { 'durationUpdate' } type - Type of the playback event to listen for. + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @since 9 + */ + off(type: 'durationUpdate'): void; + /** + * Register listens for video playback buffering events. + * @param { 'bufferingUpdate' } type - Type of the playback buffering update event to listen for. + * @param { function } callback - Callback used to listen for the buffering update event, + * return BufferingInfoType and the value. + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @since 9 + */ + /** + * Register listens for video playback buffering events. + * @param { 'bufferingUpdate' } type - Type of the playback buffering update event to listen for. + * @param { function } callback - Callback used to listen for the buffering update event, + * return BufferingInfoType and the value. + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @atomicservice + * @since 12 + */ + on(type: 'bufferingUpdate', callback: (infoType: BufferingInfoType, value: number) => void): void; + /** + * Unregister listens for video playback buffering events. + * @param { 'bufferingUpdate' } type - Type of the playback buffering update event to listen for. + * return BufferingInfoType and the value. + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @since 9 + */ + off(type: 'bufferingUpdate'): void; + /** + * Register listens for start render video frame events. + * @param { 'startRenderFrame' } type - Type of the playback event to listen for. + * @param { Callback } callback - Callback used to listen for the playback event return . + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @since 9 + */ + /** + * Register listens for start render video frame events. + * @param { 'startRenderFrame' } type - Type of the playback event to listen for. + * @param { Callback } callback - Callback used to listen for the playback event return . + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @atomicservice + * @since 12 + */ + on(type: 'startRenderFrame', callback: Callback): void; + /** + * Unregister listens for start render video frame events. + * @param { 'startRenderFrame' } type - Type of the playback event to listen for. + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @since 9 + */ + off(type: 'startRenderFrame'): void; + /** + * Register listens for video size change event. + * @param { 'videoSizeChange' } type - Type of the playback event to listen for. + * @param { function } callback - Callback used to listen for the playback event return video size. + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @since 9 + */ + /** + * Register listens for video size change event. + * @param { 'videoSizeChange' } type - Type of the playback event to listen for. + * @param { function } callback - Callback used to listen for the playback event return video size. + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @atomicservice + * @since 12 + */ + on(type: 'videoSizeChange', callback: (width: number, height: number) => void): void; + /** + * Unregister listens for video size change event. + * @param { 'videoSizeChange' } type - Type of the playback event to listen for. + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @since 9 + */ + off(type: 'videoSizeChange'): void; + /** + * Register listens for audio interrupt event, refer to {@link #audio.InterruptEvent} + * @param { 'audioInterrupt' } type - Type of the playback event to listen for. + * @param { function } callback - Callback used to listen for the playback event return audio interrupt info. + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @since 9 + */ + /** + * Register listens for audio interrupt event, refer to {@link #audio.InterruptEvent} + * @param { 'audioInterrupt' } type - Type of the playback event to listen for. + * @param { function } callback - Callback used to listen for the playback event return audio interrupt info. + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @atomicservice + * @since 12 + */ + on(type: 'audioInterrupt', callback: (info: audio.InterruptEvent) => void): void; + /** + * Unregister listens for audio interrupt event, refer to {@link #audio.InterruptEvent} + * @param { 'audioInterrupt' } type - Type of the playback event to listen for. + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @since 9 + */ + off(type: 'audioInterrupt'): void; + /** + * Register listens for available bitrate list collect completed events for HLS protocol stream playback. + * This event will be reported after the {@link #prepare} called. + * @param { 'availableBitrates' } type - Type of the playback event to listen for. + * @param { function } callback - Callback used to listen for the playback event return available bitrate list. + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @since 9 + */ + /** + * Register listens for available bitrate list collect completed events for HLS protocol stream playback. + * This event will be reported after the {@link #prepare} called. + * @param { 'availableBitrates' } type - Type of the playback event to listen for. + * @param { function } callback - Callback used to listen for the playback event return available bitrate list. + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @atomicservice + * @since 12 + */ + on(type: 'availableBitrates', callback: (bitrates: Array) => void): void; + /** + * Unregister listens for available bitrate list collect completed events for HLS protocol stream playback. + * This event will be reported after the {@link #prepare} called. + * @param { 'availableBitrates' } type - Type of the playback event to listen for. + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @since 9 + */ + off(type: 'availableBitrates'): void; + /** + * Register listens for playback error events. + * @param { 'error' } type - Type of the playback error event to listen for. + * @param { ErrorCallback } callback - Callback used to listen for the playback error event. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - The parameter check failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 5400101 - No memory. + * @throws { BusinessError } 5400102 - Operation not allowed. + * @throws { BusinessError } 5400103 - I/O error. + * @throws { BusinessError } 5400104 - Time out. + * @throws { BusinessError } 5400105 - Service died. + * @throws { BusinessError } 5400106 - Unsupport format. + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @since 9 + */ + /** + * Register listens for playback error events. + * @param { 'error' } type - Type of the playback error event to listen for. + * @param { ErrorCallback } callback - Callback used to listen for the playback error event. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3.Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 5400101 - No memory. + * @throws { BusinessError } 5400102 - Operation not allowed. + * @throws { BusinessError } 5400103 - I/O error. + * @throws { BusinessError } 5400104 - Time out. + * @throws { BusinessError } 5400105 - Service died. + * @throws { BusinessError } 5400106 - Unsupport format. + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @atomicservice + * @since 11 + */ + on(type: 'error', callback: ErrorCallback): void; + /** + * Unregister listens for playback error events. + * @param { 'error' } type - Type of the playback error event to listen for. + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @since 9 + */ + /** + * Unregister listens for playback error events. + * @param { 'error' } type - Type of the playback error event to listen for. + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @atomicservice + * @since 11 + */ + off(type: 'error'): void; + /** + * Subscribes output device change event callback. + * The event is triggered when output device change for this stream. + * @param { 'audioOutputDeviceChangeWithInfo' } type - Type of the event to listen for. + * @param { Callback } callback - Callback used to listen device change event. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3.Parameter verification failed. + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @since 11 + */ + /** + * Subscribes output device change event callback. + * The event is triggered when output device change for this stream. + * @param { 'audioOutputDeviceChangeWithInfo' } type - Type of the event to listen for. + * @param { Callback } callback - Callback used to listen device change event. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3.Parameter verification failed. + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @atomicservice + * @since 12 + */ + on(type: 'audioOutputDeviceChangeWithInfo', callback: Callback): void; + /** + * Unsubscribes output device change event callback. + * @param { 'audioOutputDeviceChangeWithInfo' } type - Type of the event to listen for. + * @param { Callback } callback - Callback used to listen device change event. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3.Parameter verification failed. + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @since 11 + */ + /** + * Unsubscribes output device change event callback. + * @param { 'audioOutputDeviceChangeWithInfo' } type - Type of the event to listen for. + * @param { Callback } callback - Callback used to listen device change event. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3.Parameter verification failed. + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @atomicservice + * @since 12 + */ + off(type: 'audioOutputDeviceChangeWithInfo', callback?: Callback): void; + } + /** + * Enumerates ErrorCode types, return in BusinessError::code + * + * @enum { number } + * @syscap SystemCapability.Multimedia.Media.Core + * @since 8 + * @deprecated since 11 + * @useinstead ohos.multimedia.media/media.AVErrorCode + */ + enum MediaErrorCode { + /** + * operation success. + * @syscap SystemCapability.Multimedia.Media.Core + * @since 8 + * @deprecated since 11 + * @useinstead ohos.multimedia.media/media.AVErrorCode#AVERR_OK + */ + MSERR_OK = 0, + /** + * malloc or new memory failed. maybe system have no memory. + * @syscap SystemCapability.Multimedia.Media.Core + * @since 8 + * @deprecated since 11 + * @useinstead ohos.multimedia.media/media.AVErrorCode#AVERR_NO_MEMORY + */ + MSERR_NO_MEMORY = 1, + /** + * no permission for the operation. + * @syscap SystemCapability.Multimedia.Media.Core + * @since 8 + * @deprecated since 11 + * @useinstead ohos.multimedia.media/media.AVErrorCode#AVERR_OPERATE_NOT_PERMIT + */ + MSERR_OPERATION_NOT_PERMIT = 2, + /** + * invalid argument. + * @syscap SystemCapability.Multimedia.Media.Core + * @since 8 + * @deprecated since 11 + * @useinstead ohos.multimedia.media/media.AVErrorCode#AVERR_INVALID_PARAMETER + */ + MSERR_INVALID_VAL = 3, + /** + * an I/O error occurred. + * @syscap SystemCapability.Multimedia.Media.Core + * @since 8 + * @deprecated since 11 + * @useinstead ohos.multimedia.media/media.AVErrorCode#AVERR_IO + */ + MSERR_IO = 4, + /** + * operation time out. + * @syscap SystemCapability.Multimedia.Media.Core + * @since 8 + * @deprecated since 11 + * @useinstead ohos.multimedia.media/media.AVErrorCode#AVERR_TIMEOUT + */ + MSERR_TIMEOUT = 5, + /** + * unknown error. + * @syscap SystemCapability.Multimedia.Media.Core + * @since 8 + * @deprecated since 11 + * @useinstead ohos.multimedia.media/media.AVErrorCode#AVERR_INVALID_PARAMETER + */ + MSERR_UNKNOWN = 6, + /** + * media service died. + * @syscap SystemCapability.Multimedia.Media.Core + * @since 8 + * @deprecated since 11 + * @useinstead ohos.multimedia.media/media.AVErrorCode#AVERR_SERVICE_DIED + */ + MSERR_SERVICE_DIED = 7, + /** + * operation is not permit in current state. + * @syscap SystemCapability.Multimedia.Media.Core + * @since 8 + * @deprecated since 11 + * @useinstead ohos.multimedia.media/media.AVErrorCode#AVERR_INVALID_PARAMETER + */ + MSERR_INVALID_STATE = 8, + /** + * operation is not supported in current version. + * @syscap SystemCapability.Multimedia.Media.Core + * @since 8 + * @deprecated since 11 + * @useinstead ohos.multimedia.media/media.AVErrorCode#AVERR_UNSUPPORT_CAPABILITY + */ + MSERR_UNSUPPORTED = 9 + } + /** + * Enumerates buffering info type, for network playback. + * + * @enum { number } + * @syscap SystemCapability.Multimedia.Media.Core + * @since 8 + */ + /** + * Enumerates buffering info type, for network playback. + * + * @enum { number } + * @syscap SystemCapability.Multimedia.Media.Core + * @atomicservice + * @since 12 + */ + enum BufferingInfoType { + /** + * begin to buffering + * @syscap SystemCapability.Multimedia.Media.Core + * @since 8 + */ + /** + * begin to buffering + * @syscap SystemCapability.Multimedia.Media.Core + * @atomicservice + * @since 12 + */ + BUFFERING_START = 1, + /** + * end to buffering + * @syscap SystemCapability.Multimedia.Media.Core + * @since 8 + */ + /** + * end to buffering + * @syscap SystemCapability.Multimedia.Media.Core + * @atomicservice + * @since 12 + */ + BUFFERING_END = 2, + /** + * buffering percent + * @syscap SystemCapability.Multimedia.Media.Core + * @since 8 + */ + /** + * buffering percent + * @syscap SystemCapability.Multimedia.Media.Core + * @atomicservice + * @since 12 + */ + BUFFERING_PERCENT = 3, + /** + * cached duration in milliseconds + * @syscap SystemCapability.Multimedia.Media.Core + * @since 8 + */ + /** + * cached duration in milliseconds + * @syscap SystemCapability.Multimedia.Media.Core + * @atomicservice + * @since 12 + */ + CACHED_DURATION = 4 + } + /** + * Media source descriptor. User can set media data information + + * @typedef MediaSource + * @syscap SystemCapability.Multimedia.Media.Core + * @atomicservice + * @since 12 + */ + interface MediaSource { + /** + * Set Media Mime Type to help player handle extended Media source. + * @param { AVMimeTypes } mimeType - for MediaSource define. see @ AVMimeTypes. + * @syscap SystemCapability.Multimedia.Media.Core + * @atomicservice + * @since 12 + */ + setMimeType(mimeType: AVMimeTypes): void; + } + /** + * Enumerates Media Mime types, used for MediaSource define; + * @enum { string } + * @syscap SystemCapability.Multimedia.Media.Core + * @atomicservice + * @since 12 + */ + enum AVMimeTypes { + /** + * Indicate current file is index file for hls Media. + * @syscap SystemCapability.Multimedia.Media.Core + * @atomicservice + * @since 12 + */ + APPLICATION_M3U8 = 'application/m3u8' + } + /** + * Provides preferred playback settings for player. + * + * @typedef PlaybackStrategy + * @syscap SystemCapability.Multimedia.Media.Core + * @atomicservice + * @since 12 + */ + interface PlaybackStrategy { + /** + * Choose a stream with width close to it. + * @syscap SystemCapability.Multimedia.Media.Core + * @atomicservice + * @since 12 + */ + preferredWidth?: number; + /** + * Choose a stream with height close to it. + * @syscap SystemCapability.Multimedia.Media.Core + * @atomicservice + * @since 12 + */ + preferredHeight?: number; + /** + * Choose a preferred buffer duration. + * @syscap SystemCapability.Multimedia.Media.Core + * @atomicservice + * @since 12 + */ + preferredBufferDuration?: number; + /** + * If true, the player should choose HDR stream if exist. + * @syscap SystemCapability.Multimedia.Media.Core + * @atomicservice + * @since 12 + */ + preferredHdr?: boolean; + } + /** + * Media file descriptor. The caller needs to ensure that the fd is valid and + * the offset and length are correct. + * + * @typedef AVFileDescriptor + * @syscap SystemCapability.Multimedia.Media.Core + * @since 9 + */ + /** + * Media file descriptor. The caller needs to ensure that the fd is valid and + * the offset and length are correct. + * + * @typedef AVFileDescriptor + * @syscap SystemCapability.Multimedia.Media.Core + * @atomicservice + * @since 11 + */ + interface AVFileDescriptor { + /** + * The file descriptor of audio or video source from file system. The caller + * is responsible to close the file descriptor. + * @syscap SystemCapability.Multimedia.Media.Core + * @since 9 + */ + /** + * The file descriptor of audio or video source from file system. The caller + * is responsible to close the file descriptor. + * @syscap SystemCapability.Multimedia.Media.Core + * @atomicservice + * @since 11 + */ + fd: number; + /** + * The offset into the file where the data to be read, in bytes. By default, + * the offset is zero. + * @syscap SystemCapability.Multimedia.Media.Core + * @since 9 + */ + /** + * The offset into the file where the data to be read, in bytes. By default, + * the offset is zero. + * @syscap SystemCapability.Multimedia.Media.Core + * @atomicservice + * @since 11 + */ + offset?: number; + /** + * The length in bytes of the data to be read. By default, the length is the + * rest of bytes in the file from the offset. + * @syscap SystemCapability.Multimedia.Media.Core + * @since 9 + */ + /** + * The length in bytes of the data to be read. By default, the length is the + * rest of bytes in the file from the offset. + * @syscap SystemCapability.Multimedia.Media.Core + * @atomicservice + * @since 11 + */ + length?: number; + } + /** + * DataSource descriptor. The caller needs to ensure that the fileSize and + * callback is valid. + * + * @typedef AVDataSrcDescriptor + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @since 10 + */ + /** + * DataSource descriptor. The caller needs to ensure that the fileSize and + * callback is valid. + * + * @typedef AVDataSrcDescriptor + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @atomicservice + * @since 11 + */ + interface AVDataSrcDescriptor { + /** + * Size of the file, -1 means the file size is unknown, in this case, + * seek and setSpeed can't be executed, loop can't be set, and can't replay. + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @since 10 + */ + /** + * Size of the file, -1 means the file size is unknown, in this case, + * seek and setSpeed can't be executed, loop can't be set, and can't replay. + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @atomicservice + * @since 11 + */ + fileSize: number; + /** + * Callback function implemented by users, which is used to fill data. + * buffer - The buffer need to fill. + * length - The stream length player want to get. + * pos - The stream position player want get start, and is an optional parameter. + * When fileSize set to -1, this parameter is not used. + * Returns length of the data to be filled. + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @since 10 + */ + /** + * Callback function implemented by users, which is used to fill data. + * buffer - The buffer need to fill. + * length - The stream length player want to get. + * pos - The stream position player want get start, and is an optional parameter. + * When fileSize set to -1, this parameter is not used. + * Returns length of the data to be filled. + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @atomicservice + * @since 11 + */ + callback: (buffer: ArrayBuffer, length: number, pos?: number) => number; + } + /** + * Describes audio playback states. + * @syscap SystemCapability.Multimedia.Media.AudioPlayer + * @since 6 + * @deprecated since 9 + * @useinstead ohos.multimedia.media/media.AVPlayerState + */ + type AudioState = 'idle' | 'playing' | 'paused' | 'stopped' | 'error'; + /** + * Manages and plays audio. Before calling an AudioPlayer method, you must use createAudioPlayer() + * to create an AudioPlayer instance. + * + * @typedef AudioPlayer + * @syscap SystemCapability.Multimedia.Media.AudioPlayer + * @since 6 + * @deprecated since 9 + * @useinstead ohos.multimedia.media/media.AVPlayer + */ + interface AudioPlayer { + /** + * Starts audio playback. + * @syscap SystemCapability.Multimedia.Media.AudioPlayer + * @since 6 + * @deprecated since 9 + * @useinstead ohos.multimedia.media/media.AVPlayer#play + */ + play(): void; + /** + * Pauses audio playback. + * @syscap SystemCapability.Multimedia.Media.AudioPlayer + * @since 6 + * @deprecated since 9 + * @useinstead ohos.multimedia.media/media.AVPlayer#pause + */ + pause(): void; + /** + * Stops audio playback. + * @syscap SystemCapability.Multimedia.Media.AudioPlayer + * @since 6 + * @deprecated since 9 + * @useinstead ohos.multimedia.media/media.AVPlayer#stop + */ + stop(): void; + /** + * Resets audio playback. + * @syscap SystemCapability.Multimedia.Media.AudioPlayer + * @since 7 + * @deprecated since 9 + * @useinstead ohos.multimedia.media/media.AVPlayer#reset + */ + reset(): void; + /** + * Jumps to the specified playback position. + * @param { number } timeMs - Playback position to jump + * @syscap SystemCapability.Multimedia.Media.AudioPlayer + * @since 6 + * @deprecated since 9 + * @useinstead ohos.multimedia.media/media.AVPlayer#seek + */ + seek(timeMs: number): void; + /** + * Sets the volume. + * @param { number } vol - Relative volume. The value ranges from 0.00 to 1.00. The value 1 indicates the maximum volume (100%). + * @syscap SystemCapability.Multimedia.Media.AudioPlayer + * @since 6 + * @deprecated since 9 + * @useinstead ohos.multimedia.media/media.AVPlayer#setVolume + */ + setVolume(vol: number): void; + /** + * Releases resources used for audio playback. + * @syscap SystemCapability.Multimedia.Media.AudioPlayer + * @since 6 + * @deprecated since 9 + * @useinstead ohos.multimedia.media/media.AVPlayer#release + */ + release(): void; + /** + * Get all track infos in MediaDescription, should be called after data loaded callback. + * @param { AsyncCallback> } callback - async callback return track info in MediaDescription. + * @syscap SystemCapability.Multimedia.Media.AudioPlayer + * @since 8 + * @deprecated since 9 + * @useinstead ohos.multimedia.media/media.AVPlayer#getTrackDescription + */ + getTrackDescription(callback: AsyncCallback>): void; + /** + * Get all track infos in MediaDescription, should be called after data loaded callback. + * @returns { Promise> } A Promise instance used to return the track info in MediaDescription. + * @syscap SystemCapability.Multimedia.Media.AudioPlayer + * @since 8 + * @deprecated since 9 + * @useinstead ohos.multimedia.media/media.AVPlayer#getTrackDescription + */ + getTrackDescription(): Promise>; + /** + * Listens for audio playback buffering events. + * @param { 'bufferingUpdate' } type - Type of the playback buffering update event to listen for. + * @param { function } callback - Callback used to listen for the buffering update event, + * return BufferingInfoType and the value. + * @syscap SystemCapability.Multimedia.Media.AudioPlayer + * @since 8 + * @deprecated since 9 + * @useinstead ohos.multimedia.media/media.AVPlayer#event:bufferingUpdate + */ + on(type: 'bufferingUpdate', callback: (infoType: BufferingInfoType, value: number) => void): void; + /** + * Audio media URI. Mainstream audio formats are supported. + * local:fd://XXX, file://XXX. network:http://xxx + * @permission ohos.permission.READ_MEDIA or ohos.permission.INTERNET + * @syscap SystemCapability.Multimedia.Media.AudioPlayer + * @since 6 + * @deprecated since 9 + * @useinstead ohos.multimedia.media/media.AVPlayer#url + */ + src: string; + /** + * Audio file descriptor. Mainstream audio formats are supported. + * @syscap SystemCapability.Multimedia.Media.AudioPlayer + * @since 9 + * @deprecated since 9 + * @useinstead ohos.multimedia.media/media.AVPlayer#fdSrc + */ + fdSrc: AVFileDescriptor; + /** + * Whether to loop audio playback. The value true means to loop playback. + * @syscap SystemCapability.Multimedia.Media.AudioPlayer + * @since 6 + * @deprecated since 9 + * @useinstead ohos.multimedia.media/media.AVPlayer#loop + */ + loop: boolean; + /** + * Describes audio interrupt mode, refer to {@link #audio.InterruptMode}. If it is not + * set, the default mode will be used. Set it before calling the {@link #play()} in the + * first time in order for the interrupt mode to become effective thereafter. + * @syscap SystemCapability.Multimedia.Media.AudioPlayer + * @since 9 + * @deprecated since 9 + * @useinstead ohos.multimedia.media/media.AVPlayer#audioInterruptMode + */ + audioInterruptMode?: audio.InterruptMode; + /** + * Current playback position. + * @syscap SystemCapability.Multimedia.Media.AudioPlayer + * @since 6 + * @deprecated since 9 + * @useinstead ohos.multimedia.media/media.AVPlayer#currentTime + */ + readonly currentTime: number; + /** + * Playback duration, When the data source does not support seek, it returns - 1, such as a live broadcast scenario. + * @syscap SystemCapability.Multimedia.Media.AudioPlayer + * @since 6 + * @deprecated since 9 + * @useinstead ohos.multimedia.media/media.AVPlayer#duration + */ + readonly duration: number; + /** + * Playback state. + * @syscap SystemCapability.Multimedia.Media.AudioPlayer + * @since 6 + * @deprecated since 9 + * @useinstead ohos.multimedia.media/media.AVPlayer#state + */ + readonly state: AudioState; + /** + * Listens for audio playback events. + * @param { 'play' | 'pause' | 'stop' | 'reset' | 'dataLoad' | 'finish' | 'volumeChange' } type - Type of the playback event to listen for. + * @param { function } callback - Callback used to listen for the playback event. + * @syscap SystemCapability.Multimedia.Media.AudioPlayer + * @since 6 + * @deprecated since 9 + * @useinstead ohos.multimedia.media/media.AVPlayer#event:stateChange + */ + on(type: 'play' | 'pause' | 'stop' | 'reset' | 'dataLoad' | 'finish' | 'volumeChange', callback: () => void): void; + /** + * Listens for audio playback events. + * @param { 'timeUpdate' } type - Type of the playback event to listen for. + * @param { Callback } callback - Callback used to listen for the playback event. + * @syscap SystemCapability.Multimedia.Media.AudioPlayer + * @since 6 + * @deprecated since 9 + * @useinstead ohos.multimedia.media/media.AVPlayer#event:timeUpdate + */ + on(type: 'timeUpdate', callback: Callback): void; + /** + * Listens for audio interrupt event, refer to {@link #audio.InterruptEvent} + * @param { 'audioInterrupt' } type - Type of the playback event to listen for. + * @param { function } callback - Callback used to listen for the playback event return audio interrupt info. + * @syscap SystemCapability.Multimedia.Media.AudioPlayer + * @since 9 + * @deprecated since 9 + * @useinstead ohos.multimedia.media/media.AVPlayer#event:audioInterrupt + */ + on(type: 'audioInterrupt', callback: (info: audio.InterruptEvent) => void): void; + /** + * Listens for playback error events. + * @param { 'error' } type - Type of the playback error event to listen for. + * @param { ErrorCallback } callback - Callback used to listen for the playback error event. + * @syscap SystemCapability.Multimedia.Media.AudioPlayer + * @since 6 + * @deprecated since 9 + * @useinstead ohos.multimedia.media/media.AVPlayer#event:error + */ + on(type: 'error', callback: ErrorCallback): void; + } + /** + * Describes media recorder states. + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @since 9 + */ + /** + * Describes media recorder states. + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @atomicservice + * @since 12 + */ + type AVRecorderState = 'idle' | 'prepared' | 'started' | 'paused' | 'stopped' | 'released' | 'error'; + /** + * Manages and record audio/video. Before calling an AVRecorder method, you must use createAVRecorder() + * to create an AVRecorder instance. + * + * @typedef AVRecorder + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @since 9 + */ + /** + * Manages and record audio/video. Before calling an AVRecorder method, you must use createAVRecorder() + * to create an AVRecorder instance. + * + * @typedef AVRecorder + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @atomicservice + * @since 12 + */ + interface AVRecorder { + /** + * Prepares for recording. + * @permission ohos.permission.MICROPHONE + * @param { AVRecorderConfig } config - Recording parameters. + * @param { AsyncCallback } callback - A callback instance used to return when prepare completed. + * @throws { BusinessError } 201 - Permission denied. Return by callback. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3.Parameter verification failed. + * @throws { BusinessError } 5400102 - Operate not permit. Return by callback. + * @throws { BusinessError } 5400105 - Service died. Return by callback. + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @since 9 + */ + prepare(config: AVRecorderConfig, callback: AsyncCallback): void; + /** + * Prepares for recording. + * @permission ohos.permission.MICROPHONE + * @param { AVRecorderConfig } config - Recording parameters. + * @returns { Promise } A Promise instance used to return when prepare completed. + * @throws { BusinessError } 201 - Permission denied. Return by promise. + * @throws { BusinessError } 401 - The parameter check failed. Return by promise. + * @throws { BusinessError } 5400102 - Operate not permit. Return by promise. + * @throws { BusinessError } 5400105 - Service died. Return by promise. + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @since 9 + */ + /** + * Prepares for recording. + * @permission ohos.permission.MICROPHONE + * @param { AVRecorderConfig } config - Recording parameters. + * @returns { Promise } A Promise instance used to return when prepare completed. + * @throws { BusinessError } 201 - Permission denied. Return by promise. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3.Parameter verification failed. + * @throws { BusinessError } 5400102 - Operate not permit. Return by promise. + * @throws { BusinessError } 5400105 - Service died. Return by promise. + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @atomicservice + * @since 12 + */ + prepare(config: AVRecorderConfig): Promise; + /** + * Get AVRecorderConfig.it must be called after prepare. + * @param { AsyncCallback } callback - Callback used to return the input config in AVRecorderConfig. + * @throws { BusinessError } 5400102 - Operate not permit. Return by callback. + * @throws { BusinessError } 5400103 - IO error. Return by callback. + * @throws { BusinessError } 5400105 - Service died. Return by callback. + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @since 11 + */ + getAVRecorderConfig(callback: AsyncCallback): void; + /** + * Get AVRecorderConfig.it must be called after prepare. + * @returns { Promise } A Promise instance used to return the input config in AVRecorderConfig. + * @throws { BusinessError } 5400102 - Operate not permit. Return by promise. + * @throws { BusinessError } 5400103 - IO error. Return by promise. + * @throws { BusinessError } 5400105 - Service died. Return by promise. + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @since 11 + */ + getAVRecorderConfig(): Promise; + /** + * Get input surface.it must be called between prepare completed and start. + * @param { AsyncCallback } callback - Callback used to return the input surface id in string. + * @throws { BusinessError } 5400102 - Operate not permit. Return by callback. + * @throws { BusinessError } 5400103 - IO error. Return by callback. + * @throws { BusinessError } 5400105 - Service died. Return by callback. + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @since 9 + */ + getInputSurface(callback: AsyncCallback): void; + /** + * Get input surface. it must be called between prepare completed and start. + * @returns { Promise } A Promise instance used to return the input surface id in string. + * @throws { BusinessError } 5400102 - Operate not permit. Return by promise. + * @throws { BusinessError } 5400103 - IO error. Return by promise. + * @throws { BusinessError } 5400105 - Service died. Return by promise. + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @since 9 + */ + getInputSurface(): Promise; + /** + * Update the video orientation before recorder start. + * @param { number } rotation: Rotation angle, should be [0, 90, 180, 270]. + * @returns { Promise } A Promise instance used to return when the function is finished. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3.Parameter verification failed. + * @throws { BusinessError } 5400102 - Operation not allowed. Return by promise. + * @throws { BusinessError } 5400103 - IO error. Return by promise. + * @throws { BusinessError } 5400105 - Service died. Return by promise. + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @since 12 + */ + updateRotation(rotation: number): Promise; + /** + * Start AVRecorder, it will to started state. + * @param { AsyncCallback } callback - A callback instance used to return when start completed. + * @throws { BusinessError } 5400102 - Operate not permit. Return by callback. + * @throws { BusinessError } 5400103 - IO error. Return by callback. + * @throws { BusinessError } 5400105 - Service died. Return by callback. + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @since 9 + */ + start(callback: AsyncCallback): void; + /** + * Start AVRecorder, it will to started state. + * @returns { Promise } A Promise instance used to return when start completed. + * @throws { BusinessError } 5400102 - Operate not permit. Return by promise. + * @throws { BusinessError } 5400103 - IO error. Return by promise. + * @throws { BusinessError } 5400105 - Service died. Return by promise. + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @since 9 + */ + /** + * Start AVRecorder, it will to started state. + * @returns { Promise } A Promise instance used to return when start completed. + * @throws { BusinessError } 5400102 - Operate not permit. Return by promise. + * @throws { BusinessError } 5400103 - IO error. Return by promise. + * @throws { BusinessError } 5400105 - Service died. Return by promise. + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @atomicservice + * @since 12 + */ + start(): Promise; + /** + * Start AVRecorder, it will to paused state. + * @param { AsyncCallback } callback - A callback instance used to return when pause completed. + * @throws { BusinessError } 5400102 - Operate not permit. Return by callback. + * @throws { BusinessError } 5400103 - IO error. Return by callback. + * @throws { BusinessError } 5400105 - Service died. Return by callback. + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @since 9 + */ + pause(callback: AsyncCallback): void; + /** + * Start AVRecorder, it will to paused state. + * @returns { Promise } A Promise instance used to return when pause completed. + * @throws { BusinessError } 5400102 - Operate not permit. Return by promise. + * @throws { BusinessError } 5400103 - IO error. Return by promise. + * @throws { BusinessError } 5400105 - Service died. Return by promise. + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @since 9 + */ + /** + * Start AVRecorder, it will to paused state. + * @returns { Promise } A Promise instance used to return when pause completed. + * @throws { BusinessError } 5400102 - Operate not permit. Return by promise. + * @throws { BusinessError } 5400103 - IO error. Return by promise. + * @throws { BusinessError } 5400105 - Service died. Return by promise. + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @atomicservice + * @since 12 + */ + pause(): Promise; + /** + * Resume AVRecorder, it will to started state. + * @param { AsyncCallback } callback - A callback instance used to return when resume completed. + * @throws { BusinessError } 5400102 - Operate not permit. Return by callback. + * @throws { BusinessError } 5400103 - IO error. Return by callback. + * @throws { BusinessError } 5400105 - Service died. Return by callback. + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @since 9 + */ + resume(callback: AsyncCallback): void; + /** + * Resume AVRecorder, it will to started state. + * @returns { Promise } A Promise instance used to return when resume completed. + * @throws { BusinessError } 5400102 - Operate not permit. Return by promise. + * @throws { BusinessError } 5400103 - IO error. Return by promise. + * @throws { BusinessError } 5400105 - Service died. Return by promise. + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @since 9 + */ + /** + * Resume AVRecorder, it will to started state. + * @returns { Promise } A Promise instance used to return when resume completed. + * @throws { BusinessError } 5400102 - Operate not permit. Return by promise. + * @throws { BusinessError } 5400103 - IO error. Return by promise. + * @throws { BusinessError } 5400105 - Service died. Return by promise. + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @atomicservice + * @since 12 + */ + resume(): Promise; + /** + * Stop AVRecorder, it will to stopped state. + * @param { AsyncCallback } callback - A callback instance used to return when stop completed. + * @throws { BusinessError } 5400102 - Operate not permit. Return by callback. + * @throws { BusinessError } 5400103 - IO error. Return by callback. + * @throws { BusinessError } 5400105 - Service died. Return by callback. + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @since 9 + */ + stop(callback: AsyncCallback): void; + /** + * Stop AVRecorder, it will to stopped state. + * @returns { Promise } A Promise instance used to return when stop completed. + * @throws { BusinessError } 5400102 - Operate not permit. Return by promise. + * @throws { BusinessError } 5400103 - IO error. Return by promise. + * @throws { BusinessError } 5400105 - Service died. Return by promise. + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @since 9 + */ + /** + * Stop AVRecorder, it will to stopped state. + * @returns { Promise } A Promise instance used to return when stop completed. + * @throws { BusinessError } 5400102 - Operate not permit. Return by promise. + * @throws { BusinessError } 5400103 - IO error. Return by promise. + * @throws { BusinessError } 5400105 - Service died. Return by promise. + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @atomicservice + * @since 12 + */ + stop(): Promise; + /** + * Reset AVRecorder, it will to idle state. + * @param { AsyncCallback } callback - A callback instance used to return when reset completed. + * @throws { BusinessError } 5400103 - IO error. Return by callback. + * @throws { BusinessError } 5400105 - Service died. Return by callback. + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @since 9 + */ + reset(callback: AsyncCallback): void; + /** + * Reset AVRecorder, it will to idle state. + * @returns { Promise } A Promise instance used to return when reset completed. + * @throws { BusinessError } 5400103 - IO error. Return by promise. + * @throws { BusinessError } 5400105 - Service died. Return by promise. + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @since 9 + */ + reset(): Promise; + /** + * Releases resources used for AVRecorder, it will to released state. + * @param { AsyncCallback } callback - A callback instance used to return when release completed. + * @throws { BusinessError } 5400105 - Service died. Return by callback. + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @since 9 + */ + release(callback: AsyncCallback): void; + /** + * Releases resources used for AVRecorder, it will to released state. + * @returns { Promise } A Promise instance used to return when release completed. + * @throws { BusinessError } 5400105 - Service died. Return by callback. + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @since 9 + */ + /** + * Releases resources used for AVRecorder, it will to released state. + * @returns { Promise } A Promise instance used to return when release completed. + * @throws { BusinessError } 5400105 - Service died. Return by callback. + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @atomicservice + * @since 12 + */ + release(): Promise; + /** + * Get AudioCapturer info from current AVRecorder. + * @param { AsyncCallback } callback - A callback used to return AudioCapturerChangeInfo. + * @throws { BusinessError } 5400102 - Operation not allowed. + * @throws { BusinessError } 5400103 - I/O error. + * @throws { BusinessError } 5400105 - Service died. Return by callback. + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @since 11 + */ + getCurrentAudioCapturerInfo(callback: AsyncCallback): void; + /** + * Get AudioCapturer info from current AVRecorder. + * @returns { Promise } A Promise instance used to return AudioCapturerChangeInfo. + * @throws { BusinessError } 5400102 - Operation not allowed. + * @throws { BusinessError } 5400103 - I/O error. + * @throws { BusinessError } 5400105 - Service died. Return by promise. + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @since 11 + */ + getCurrentAudioCapturerInfo(): Promise; + /** + * Get max audio capturer amplitude from current AVRecorder. + * @param { AsyncCallback } callback - A callback used to return max Amplitude. + * @throws { BusinessError } 5400102 - Operation not allowed. + * @throws { BusinessError } 5400105 - Service died. Return by callback. + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @since 11 + */ + getAudioCapturerMaxAmplitude(callback: AsyncCallback): void; + /** + * Get max audio capturer amplitude from current AVRecorder. + * @returns { Promise } A Promise instance used to return max Amplitude. + * @throws { BusinessError } 5400102 - Operation not allowed. + * @throws { BusinessError } 5400105 - Service died. Return by promise. + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @since 11 + */ + getAudioCapturerMaxAmplitude(): Promise; + /** + * Get available encoder and encoder info for AVRecorder. + * @param { AsyncCallback> } callback - A callback used to return available encoder info. + * @throws { BusinessError } 5400102 - Operation not allowed. + * @throws { BusinessError } 5400105 - Service died. Return by callback. + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @since 11 + */ + getAvailableEncoder(callback: AsyncCallback>): void; + /** + * Get available encoder and encoder info for AVRecorder. + * @returns { Promise> } A Promise instance used to return available encoder info. + * @throws { BusinessError } 5400102 - Operation not allowed. + * @throws { BusinessError } 5400105 - Service died. Return by promise. + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @since 11 + */ + getAvailableEncoder(): Promise>; + /** + * Recorder state. + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @since 9 + */ + /** + * Recorder state. + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @atomicservice + * @since 12 + */ + readonly state: AVRecorderState; + /** + * Listens for recording audioCapturerChange events. + * @param { 'audioCapturerChange' } type - Type of the audioCapturerChange event to listen for. + * @param { Callback } callback - Callback used to listen device change event. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3.Parameter verification failed. + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @since 11 + */ + on(type: 'audioCapturerChange', callback: Callback): void; + /** + * Listens for recording stateChange events. + * @param { 'stateChange' } type - Type of the recording event to listen for. + * @param { function } callback - Callback used to listen for the recorder stateChange event. + * @throws { BusinessError } 5400103 - IO error. Return by callback. + * @throws { BusinessError } 5400105 - Service died. Return by callback. + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @since 9 + */ + /** + * Listens for recording stateChange events. + * @param { 'stateChange' } type - Type of the recording event to listen for. + * @param { function } callback - Callback used to listen for the recorder stateChange event. + * @throws { BusinessError } 5400103 - IO error. Return by callback. + * @throws { BusinessError } 5400105 - Service died. Return by callback. + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @atomicservice + * @since 12 + */ + on(type: 'stateChange', callback: (state: AVRecorderState, reason: StateChangeReason) => void): void; + /** + * Listens for recording error events. + * @param { 'error' } type - Type of the recording error event to listen for. + * @param { ErrorCallback } callback - Callback used to listen for the recorder error event. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - The parameter check failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 5400101 - No memory. + * @throws { BusinessError } 5400102 - Operation not allowed. + * @throws { BusinessError } 5400103 - I/O error. + * @throws { BusinessError } 5400104 - Time out. + * @throws { BusinessError } 5400105 - Service died. + * @throws { BusinessError } 5400106 - Unsupport format. + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @since 9 + */ + /** + * Listens for recording error events. + * @param { 'error' } type - Type of the recording error event to listen for. + * @param { ErrorCallback } callback - Callback used to listen for the recorder error event. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - The parameter check failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 5400101 - No memory. + * @throws { BusinessError } 5400102 - Operation not allowed. + * @throws { BusinessError } 5400103 - I/O error. + * @throws { BusinessError } 5400104 - Time out. + * @throws { BusinessError } 5400105 - Service died. + * @throws { BusinessError } 5400106 - Unsupport format. + * @throws { BusinessError } 5400107 - Audio interrupted. + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @since 11 + */ + /** + * Listens for recording error events. + * @param { 'error' } type - Type of the recording error event to listen for. + * @param { ErrorCallback } callback - Callback used to listen for the recorder error event. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3.Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 5400101 - No memory. + * @throws { BusinessError } 5400102 - Operation not allowed. + * @throws { BusinessError } 5400103 - I/O error. + * @throws { BusinessError } 5400104 - Time out. + * @throws { BusinessError } 5400105 - Service died. + * @throws { BusinessError } 5400106 - Unsupport format. + * @throws { BusinessError } 5400107 - Audio interrupted. + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @atomicservice + * @since 12 + */ + on(type: 'error', callback: ErrorCallback): void; + /** + * Cancel Listens for recording stateChange events. + * @param { 'stateChange' } type - Type of the recording stateChange event to listen for. + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @since 9 + */ + /** + * Cancel Listens for recording stateChange events. + * @param { 'stateChange' } type - Type of the recording stateChange event to listen for. + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @atomicservice + * @since 12 + */ + off(type: 'stateChange'): void; + /** + * Cancel Listens for recording error events. + * @param { 'error' } type - Type of the recording error event to listen for. + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @since 9 + */ + /** + * Cancel Listens for recording error events. + * @param { 'error' } type - Type of the recording error event to listen for. + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @atomicservice + * @since 12 + */ + off(type: 'error'): void; + /** + * Cancel Listens for recording audioCapturerChange events. + * @param { 'audioCapturerChange' } type - Type of the audioCapturerChange event to listen for. + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @since 11 + */ + off(type: 'audioCapturerChange'): void; + } + /** + * Enumerates audio encoding formats, it will be deprecated after API8, use @CodecMimeType to replace. + * + * @enum { number } + * @syscap SystemCapability.Multimedia.Media.AudioRecorder + * @since 6 + * @deprecated since 8 + * @useinstead ohos.multimedia.media/media.CodecMimeType + */ + enum AudioEncoder { + /** + * Default audio encoding format, which is AMR-NB. + * @syscap SystemCapability.Multimedia.Media.AudioRecorder + * @since 6 + * @deprecated since 8 + */ + DEFAULT = 0, + /** + * Indicates the AMR-NB audio encoding format. + * @syscap SystemCapability.Multimedia.Media.AudioRecorder + * @since 6 + * @deprecated since 8 + */ + AMR_NB = 1, + /** + * Indicates the AMR-WB audio encoding format. + * @syscap SystemCapability.Multimedia.Media.AudioRecorder + * @since 6 + * @deprecated since 8 + */ + AMR_WB = 2, + /** + * Advanced Audio Coding Low Complexity (AAC-LC). + * @syscap SystemCapability.Multimedia.Media.AudioRecorder + * @since 6 + * @deprecated since 8 + */ + AAC_LC = 3, + /** + * High-Efficiency Advanced Audio Coding (HE-AAC). + * @syscap SystemCapability.Multimedia.Media.AudioRecorder + * @since 6 + * @deprecated since 8 + */ + HE_AAC = 4 + } + /** + * Enumerates audio output formats, it will be deprecated after API8, use @ContainerFormatType to replace. + * + * @enum { number } + * @syscap SystemCapability.Multimedia.Media.AudioRecorder + * @since 6 + * @deprecated since 8 + * @useinstead ohos.multimedia.media/media.ContainerFormatType + */ + enum AudioOutputFormat { + /** + * Default audio output format, which is Moving Pictures Expert Group 4 (MPEG-4). + * @syscap SystemCapability.Multimedia.Media.AudioRecorder + * @since 6 + * @deprecated since 8 + */ + DEFAULT = 0, + /** + * Indicates the Moving Picture Experts Group-4 (MPEG4) media format. + * @syscap SystemCapability.Multimedia.Media.AudioRecorder + * @since 6 + * @deprecated since 8 + */ + MPEG_4 = 2, + /** + * Indicates the Adaptive Multi-Rate Narrowband (AMR-NB) media format. + * @syscap SystemCapability.Multimedia.Media.AudioRecorder + * @since 6 + * @deprecated since 8 + */ + AMR_NB = 3, + /** + * Indicates the Adaptive Multi-Rate Wideband (AMR-WB) media format. + * @syscap SystemCapability.Multimedia.Media.AudioRecorder + * @since 6 + * @deprecated since 8 + */ + AMR_WB = 4, + /** + * Audio Data Transport Stream (ADTS), a transmission stream format of Advanced Audio Coding (AAC) audio. + * @syscap SystemCapability.Multimedia.Media.AudioRecorder + * @since 6 + * @deprecated since 8 + */ + AAC_ADTS = 6 + } + /** + * Provides the geographical location definitions for media resources. + * + * @typedef Location + * @syscap SystemCapability.Multimedia.Media.Core + * @since 6 + */ + interface Location { + /** + * Latitude. + * @syscap SystemCapability.Multimedia.Media.Core + * @since 6 + */ + latitude: number; + /** + * Longitude. + * @syscap SystemCapability.Multimedia.Media.Core + * @since 6 + */ + longitude: number; + } + /** + * Provides the audio recorder configuration definitions. + * + * @typedef AudioRecorderConfig + * @syscap SystemCapability.Multimedia.Media.AudioRecorder + * @since 6 + * @deprecated since 9 + * @useinstead ohos.multimedia.media/media.AVRecorderConfig + */ + interface AudioRecorderConfig { + /** + * Audio encoding format. The default value is DEFAULT, it will be deprecated after API8. + * use "audioEncoderMime" instead. + * @syscap SystemCapability.Multimedia.Media.AudioRecorder + * @since 6 + * @deprecated since 8 + * @useinstead ohos.multimedia.media/media.AudioRecorderConfig.audioEncoderMime + */ + audioEncoder?: AudioEncoder; + /** + * Audio encoding bit rate. + * @syscap SystemCapability.Multimedia.Media.AudioRecorder + * @since 6 + * @deprecated since 9 + */ + audioEncodeBitRate?: number; + /** + * Audio sampling rate. + * @syscap SystemCapability.Multimedia.Media.AudioRecorder + * @since 6 + * @deprecated since 9 + */ + audioSampleRate?: number; + /** + * Number of audio channels. + * @syscap SystemCapability.Multimedia.Media.AudioRecorder + * @since 6 + * @deprecated since 9 + */ + numberOfChannels?: number; + /** + * Audio output format. The default value is DEFAULT, it will be deprecated after API8. + * it will be replaced with "fileFormat". + * @syscap SystemCapability.Multimedia.Media.AudioRecorder + * @since 6 + * @deprecated since 8 + * @useinstead ohos.multimedia.media/media.AudioRecorderConfig.fileFormat + */ + format?: AudioOutputFormat; + /** + * Audio output uri.support two kind of uri now. + * format like: scheme + "://" + "context". + * file: file://path + * fd: fd://fd + * @syscap SystemCapability.Multimedia.Media.AudioRecorder + * @since 6 + * @deprecated since 9 + */ + uri: string; + /** + * Geographical location information. + * @syscap SystemCapability.Multimedia.Media.AudioRecorder + * @since 6 + * @deprecated since 9 + */ + location?: Location; + /** + * audio encoding format MIME. it used to replace audioEncoder. + * @syscap SystemCapability.Multimedia.Media.AudioRecorder + * @since 8 + * @deprecated since 9 + */ + audioEncoderMime?: CodecMimeType; + /** + * output file format. see @ContainerFormatType , it used to replace "format". + * @syscap SystemCapability.Multimedia.Media.AudioRecorder + * @since 8 + * @deprecated since 9 + */ + fileFormat?: ContainerFormatType; + } + /** + * Manages and record audio. Before calling an AudioRecorder method, you must use createAudioRecorder() + * to create an AudioRecorder instance. + * + * @typedef AudioRecorder + * @syscap SystemCapability.Multimedia.Media.AudioRecorder + * @since 6 + * @deprecated since 9 + * @useinstead ohos.multimedia.media/media.AVRecorder + */ + interface AudioRecorder { + /** + * Prepares for recording. + * @permission ohos.permission.MICROPHONE + * @param { AudioRecorderConfig } config - Recording parameters. + * @syscap SystemCapability.Multimedia.Media.AudioRecorder + * @since 6 + * @deprecated since 9 + * @useinstead ohos.multimedia.media/media.AVRecorder#prepare + */ + prepare(config: AudioRecorderConfig): void; + /** + * Starts audio recording. + * @syscap SystemCapability.Multimedia.Media.AudioRecorder + * @since 6 + * @deprecated since 9 + * @useinstead ohos.multimedia.media/media.AVRecorder#start + */ + start(): void; + /** + * Pauses audio recording. + * @syscap SystemCapability.Multimedia.Media.AudioRecorder + * @since 6 + * @deprecated since 9 + * @useinstead ohos.multimedia.media/media.AVRecorder#pause + */ + pause(): void; + /** + * Resumes audio recording. + * @syscap SystemCapability.Multimedia.Media.AudioRecorder + * @since 6 + * @deprecated since 9 + * @useinstead ohos.multimedia.media/media.AVRecorder#resume + */ + resume(): void; + /** + * Stops audio recording. + * @syscap SystemCapability.Multimedia.Media.AudioRecorder + * @since 6 + * @deprecated since 9 + * @useinstead ohos.multimedia.media/media.AVRecorder#stop + */ + stop(): void; + /** + * Releases resources used for audio recording. + * @syscap SystemCapability.Multimedia.Media.AudioRecorder + * @since 6 + * @deprecated since 9 + * @useinstead ohos.multimedia.media/media.AVRecorder#release + */ + release(): void; + /** + * Resets audio recording. + * Before resetting audio recording, you must call stop() to stop recording. After audio recording is reset, + * you must call prepare() to set the recording configurations for another recording. + * @syscap SystemCapability.Multimedia.Media.AudioRecorder + * @since 6 + * @deprecated since 9 + * @useinstead ohos.multimedia.media/media.AVRecorder#reset + */ + reset(): void; + /** + * Listens for audio recording events. + * @param { 'prepare' | 'start' | 'pause' | 'resume' | 'stop' | 'release' | 'reset' } type - Type of the audio recording event to listen for. + * @param { function } callback - Callback used to listen for the audio recording event. + * @syscap SystemCapability.Multimedia.Media.AudioRecorder + * @since 6 + * @deprecated since 9 + * @useinstead ohos.multimedia.media/media.AVRecorder#on + */ + on(type: 'prepare' | 'start' | 'pause' | 'resume' | 'stop' | 'release' | 'reset', callback: () => void): void; + /** + * Listens for audio recording error events. + * @param { 'error' } type - Type of the audio recording error event to listen for. + * @param { ErrorCallback } callback - Callback used to listen for the audio recording error event. + * @syscap SystemCapability.Multimedia.Media.AudioRecorder + * @since 6 + * @deprecated since 9 + * @useinstead ohos.multimedia.media/media.AVRecorder#on + */ + on(type: 'error', callback: ErrorCallback): void; + } + /** + * Describes video playback states. + * @syscap SystemCapability.Multimedia.Media.VideoPlayer + * @since 8 + * @deprecated since 9 + * @useinstead ohos.multimedia.media/media.AVPlayerState + */ + type VideoPlayState = 'idle' | 'prepared' | 'playing' | 'paused' | 'stopped' | 'error'; + /** + * Enumerates playback speed. + * + * @enum { number } + * @syscap SystemCapability.Multimedia.Media.VideoPlayer + * @since 8 + */ + /** + * Enumerates playback speed. + * + * @enum { number } + * @syscap SystemCapability.Multimedia.Media.VideoPlayer + * @atomicservice + * @since 12 + */ + enum PlaybackSpeed { + /** + * playback at 0.75x normal speed + * @syscap SystemCapability.Multimedia.Media.VideoPlayer + * @since 8 + */ + /** + * playback at 0.75x normal speed + * @syscap SystemCapability.Multimedia.Media.VideoPlayer + * @atomicservice + * @since 12 + */ + SPEED_FORWARD_0_75_X = 0, + /** + * playback at normal speed + * @syscap SystemCapability.Multimedia.Media.VideoPlayer + * @since 8 + */ + /** + * playback at normal speed + * @syscap SystemCapability.Multimedia.Media.VideoPlayer + * @atomicservice + * @since 12 + */ + SPEED_FORWARD_1_00_X = 1, + /** + * playback at 1.25x normal speed + * @syscap SystemCapability.Multimedia.Media.VideoPlayer + * @since 8 + */ + /** + * playback at 1.25x normal speed + * @syscap SystemCapability.Multimedia.Media.VideoPlayer + * @atomicservice + * @since 12 + */ + SPEED_FORWARD_1_25_X = 2, + /** + * playback at 1.75x normal speed + * @syscap SystemCapability.Multimedia.Media.VideoPlayer + * @since 8 + */ + /** + * playback at 1.75x normal speed + * @syscap SystemCapability.Multimedia.Media.VideoPlayer + * @atomicservice + * @since 12 + */ + SPEED_FORWARD_1_75_X = 3, + /** + * playback at 2.0x normal speed + * @syscap SystemCapability.Multimedia.Media.VideoPlayer + * @since 8 + */ + /** + * playback at 2.0x normal speed + * @syscap SystemCapability.Multimedia.Media.VideoPlayer + * @atomicservice + * @since 12 + */ + SPEED_FORWARD_2_00_X = 4, + /** + * playback at 0.5x normal speed + * @syscap SystemCapability.Multimedia.Media.VideoPlayer + * @since 12 + */ + /** + * playback at 0.5x normal speed + * @syscap SystemCapability.Multimedia.Media.VideoPlayer + * @atomicservice + * @since 12 + */ + SPEED_FORWARD_0_50_X = 5, + /** + * playback at 1.5x normal speed + * @syscap SystemCapability.Multimedia.Media.VideoPlayer + * @since 12 + */ + /** + * playback at 1.5x normal speed + * @syscap SystemCapability.Multimedia.Media.VideoPlayer + * @atomicservice + * @since 12 + */ + SPEED_FORWARD_1_50_X = 6, + /** + * playback at 0.25x normal speed + * @syscap SystemCapability.Multimedia.Media.VideoPlayer + * @since 12 + */ + /** + * playback at 0.25x normal speed + * @syscap SystemCapability.Multimedia.Media.VideoPlayer + * @atomicservice + * @since 12 + */ + SPEED_FORWARD_0_25_X = 8, + /** + * playback at 0.125x normal speed + * @syscap SystemCapability.Multimedia.Media.VideoPlayer + * @since 12 + */ + /** + * playback at 0.125x normal speed + * @syscap SystemCapability.Multimedia.Media.VideoPlayer + * @atomicservice + * @since 12 + */ + SPEED_FORWARD_0_125_X = 9 + } + /** + * Manages and plays video. Before calling an video method, you must use createVideoPlayer() to create an VideoPlayer + * instance. + * + * @typedef VideoPlayer + * @syscap SystemCapability.Multimedia.Media.VideoPlayer + * @since 8 + * @deprecated since 9 + * @useinstead ohos.multimedia.media/media.AVPlayer + */ + interface VideoPlayer { + /** + * Set display surface. + * @param {string} surfaceId - surface id, video player will use this id get a surface instance. + * @param { AsyncCallback } callback - A callback instance used to return when release output buffer completed. + * @syscap SystemCapability.Multimedia.Media.VideoPlayer + * @since 8 + * @deprecated since 9 + * @useinstead ohos.multimedia.media/media.AVPlayer#surfaceId + */ + setDisplaySurface(surfaceId: string, callback: AsyncCallback): void; + /** + * Set display surface. + * @param {string} surfaceId - surface id, video player will use this id get a surface instance. + * @returns { Promise } A Promise instance used to return when release output buffer completed. + * @syscap SystemCapability.Multimedia.Media.VideoPlayer + * @since 8 + * @deprecated since 9 + * @useinstead ohos.multimedia.media/media.AVPlayer#surfaceId + */ + setDisplaySurface(surfaceId: string): Promise; + /** + * Prepare video playback, it will request resource for playing. + * @param { AsyncCallback } callback - A callback instance used to return when prepare completed. + * @syscap SystemCapability.Multimedia.Media.VideoPlayer + * @since 8 + * @deprecated since 9 + * @useinstead ohos.multimedia.media/media.AVPlayer#prepare + */ + prepare(callback: AsyncCallback): void; + /** + * Prepare video playback, it will request resource for playing. + * @returns { Promise } A Promise instance used to return when prepare completed. + * @syscap SystemCapability.Multimedia.Media.VideoPlayer + * @since 8 + * @deprecated since 9 + * @useinstead ohos.multimedia.media/media.AVPlayer#prepare + */ + prepare(): Promise; + /** + * Starts video playback. + * @param { AsyncCallback } callback - A callback instance used to return when start completed. + * @syscap SystemCapability.Multimedia.Media.VideoPlayer + * @since 8 + * @deprecated since 9 + * @useinstead ohos.multimedia.media/media.AVPlayer#play + */ + play(callback: AsyncCallback): void; + /** + * Starts video playback. + * @returns { Promise } A Promise instance used to return when start completed. + * @syscap SystemCapability.Multimedia.Media.VideoPlayer + * @since 8 + * @deprecated since 9 + * @useinstead ohos.multimedia.media/media.AVPlayer#play + */ + play(): Promise; + /** + * Pauses video playback. + * @param { AsyncCallback } callback - A callback instance used to return when pause completed. + * @syscap SystemCapability.Multimedia.Media.VideoPlayer + * @since 8 + * @deprecated since 9 + * @useinstead ohos.multimedia.media/media.AVPlayer#pause + */ + pause(callback: AsyncCallback): void; + /** + * Pauses video playback. + * @returns { Promise } A Promise instance used to return when pause completed. + * @syscap SystemCapability.Multimedia.Media.VideoPlayer + * @since 8 + * @deprecated since 9 + * @useinstead ohos.multimedia.media/media.AVPlayer#pause + */ + pause(): Promise; + /** + * Stops video playback. + * @param { AsyncCallback } callback - A callback instance used to return when stop completed. + * @syscap SystemCapability.Multimedia.Media.VideoPlayer + * @since 8 + * @deprecated since 9 + * @useinstead ohos.multimedia.media/media.AVPlayer#stop + */ + stop(callback: AsyncCallback): void; + /** + * Stops video playback. + * @returns { Promise } A Promise instance used to return when stop completed. + * @syscap SystemCapability.Multimedia.Media.VideoPlayer + * @since 8 + * @deprecated since 9 + * @useinstead ohos.multimedia.media/media.AVPlayer#stop + */ + stop(): Promise; + /** + * Resets video playback, it will release the resource. + * @param { AsyncCallback } callback - A callback instance used to return when reset completed. + * @syscap SystemCapability.Multimedia.Media.VideoPlayer + * @since 8 + * @deprecated since 9 + * @useinstead ohos.multimedia.media/media.AVPlayer#reset + */ + reset(callback: AsyncCallback): void; + /** + * Resets video playback, it will release the resource. + * @returns { Promise } A Promise instance used to return when reset completed. + * @syscap SystemCapability.Multimedia.Media.VideoPlayer + * @since 8 + * @deprecated since 9 + * @useinstead ohos.multimedia.media/media.AVPlayer#reset + */ + reset(): Promise; + /** + * Jumps to the specified playback position by default SeekMode(SEEK_PREV_SYNC), + * the performance may be not the best. + * @param { number } timeMs - Playback position to jump + * @param { AsyncCallback } callback - A callback instance used to return when seek completed + * and return the seeking position result. + * @syscap SystemCapability.Multimedia.Media.VideoPlayer + * @since 8 + * @deprecated since 9 + * @useinstead ohos.multimedia.media/media.AVPlayer#seek + */ + seek(timeMs: number, callback: AsyncCallback): void; + /** + * Jumps to the specified playback position. + * @param { number } timeMs - Playback position to jump + * @param { SeekMode } mode - seek mode, see @SeekMode . + * @param { AsyncCallback } callback - A callback instance used to return when seek completed + * and return the seeking position result. + * @syscap SystemCapability.Multimedia.Media.VideoPlayer + * @since 8 + * @deprecated since 9 + * @useinstead ohos.multimedia.media/media.AVPlayer#seek + */ + seek(timeMs: number, mode: SeekMode, callback: AsyncCallback): void; + /** + * Jumps to the specified playback position. + * @param { number } timeMs - Playback position to jump + * @param { SeekMode } mode - seek mode, see @SeekMode . + * @returns { Promise } A Promise instance used to return when seek completed + * and return the seeking position result. + * @syscap SystemCapability.Multimedia.Media.VideoPlayer + * @since 8 + * @deprecated since 9 + * @useinstead ohos.multimedia.media/media.AVPlayer#seek + */ + seek(timeMs: number, mode?: SeekMode): Promise; + /** + * Sets the volume. + * @param { number } vol - Relative volume. The value ranges from 0.00 to 1.00. The value 1 indicates the maximum volume (100%). + * @param { AsyncCallback } callback - A callback instance used to return when set volume completed. + * @syscap SystemCapability.Multimedia.Media.VideoPlayer + * @since 8 + * @deprecated since 9 + * @useinstead ohos.multimedia.media/media.AVPlayer#setVolume + */ + setVolume(vol: number, callback: AsyncCallback): void; + /** + * Sets the volume. + * @param { number } vol - Relative volume. The value ranges from 0.00 to 1.00. The value 1 indicates the maximum volume (100%). + * @returns { Promise } A Promise instance used to return when set volume completed. + * @syscap SystemCapability.Multimedia.Media.VideoPlayer + * @since 8 + * @deprecated since 9 + * @useinstead ohos.multimedia.media/media.AVPlayer#setVolume + */ + setVolume(vol: number): Promise; + /** + * Releases resources used for video playback. + * @param { AsyncCallback } callback - A callback instance used to return when release completed. + * @syscap SystemCapability.Multimedia.Media.VideoPlayer + * @since 8 + * @deprecated since 9 + * @useinstead ohos.multimedia.media/media.AVPlayer#release + */ + release(callback: AsyncCallback): void; + /** + * Releases resources used for video playback. + * @returns { Promise } A Promise instance used to return when release completed. + * @syscap SystemCapability.Multimedia.Media.VideoPlayer + * @since 8 + * @deprecated since 9 + * @useinstead ohos.multimedia.media/media.AVPlayer#release + */ + release(): Promise; + /** + * Get all track infos in MediaDescription, should be called after data loaded callback. + * @param { AsyncCallback> } callback - async callback return track info in MediaDescription. + * @syscap SystemCapability.Multimedia.Media.VideoPlayer + * @since 8 + * @deprecated since 9 + * @useinstead ohos.multimedia.media/media.AVPlayer#getTrackDescription + */ + getTrackDescription(callback: AsyncCallback>): void; + /** + * Get all track infos in MediaDescription, should be called after data loaded callback. + * @returns { Promise> } A Promise instance used to return the track info in MediaDescription. + * @syscap SystemCapability.Multimedia.Media.VideoPlayer + * @since 8 + * @deprecated since 9 + * @useinstead ohos.multimedia.media/media.AVPlayer#getTrackDescription + */ + getTrackDescription(): Promise>; + /** + * media url. Mainstream video formats are supported. + * local:fd://XXX, file://XXX. network:http://xxx + * @syscap SystemCapability.Multimedia.Media.VideoPlayer + * @since 8 + * @deprecated since 9 + * @useinstead ohos.multimedia.media/media.AVPlayer#url + */ + url: string; + /** + * Video file descriptor. Mainstream video formats are supported. + * @syscap SystemCapability.Multimedia.Media.VideoPlayer + * @since 9 + * @deprecated since 9 + * @useinstead ohos.multimedia.media/media.AVPlayer#fdSrc + */ + fdSrc: AVFileDescriptor; + /** + * Whether to loop video playback. The value true means to loop playback. + * @syscap SystemCapability.Multimedia.Media.VideoPlayer + * @since 8 + * @deprecated since 9 + * @useinstead ohos.multimedia.media/media.AVPlayer#loop + */ + loop: boolean; + /** + * Current playback position. + * @syscap SystemCapability.Multimedia.Media.VideoPlayer + * @since 8 + * @deprecated since 9 + * @useinstead ohos.multimedia.media/media.AVPlayer#currentTime + */ + readonly currentTime: number; + /** + * Playback duration, if -1 means cannot seek. + * @syscap SystemCapability.Multimedia.Media.VideoPlayer + * @since 8 + * @deprecated since 9 + * @useinstead ohos.multimedia.media/media.AVPlayer#duration + */ + readonly duration: number; + /** + * Playback state. + * @syscap SystemCapability.Multimedia.Media.VideoPlayer + * @since 8 + * @deprecated since 9 + * @useinstead ohos.multimedia.media/media.AVPlayer#state + */ + readonly state: VideoPlayState; + /** + * video width, valid after prepared. + * @syscap SystemCapability.Multimedia.Media.VideoPlayer + * @since 8 + * @deprecated since 9 + * @useinstead ohos.multimedia.media/media.AVPlayer#width + */ + readonly width: number; + /** + * video height, valid after prepared. + * @syscap SystemCapability.Multimedia.Media.VideoPlayer + * @since 8 + * @deprecated since 9 + * @useinstead ohos.multimedia.media/media.AVPlayer#height + */ + readonly height: number; + /** + * Describes audio interrupt mode, refer to {@link #audio.InterruptMode}. If it is not + * set, the default mode will be used. Set it before calling the {@link #play()} in the + * first time in order for the interrupt mode to become effective thereafter. + * @syscap SystemCapability.Multimedia.Media.VideoPlayer + * @since 9 + * @deprecated since 9 + * @useinstead ohos.multimedia.media/media.AVPlayer#audioInterruptMode + */ + audioInterruptMode?: audio.InterruptMode; + /** + * video scale type. By default, the {@link #VIDEO_SCALE_TYPE_FIT} will be used, for more + * information, refer to {@link #VideoScaleType} + * @syscap SystemCapability.Multimedia.Media.VideoPlayer + * @since 9 + * @deprecated since 9 + * @useinstead ohos.multimedia.media/media.AVPlayer#videoScaleType + */ + videoScaleType?: VideoScaleType; + /** + * set payback speed. + * @param { number } speed - playback speed, see @PlaybackSpeed . + * @param { AsyncCallback } callback Callback used to return actually speed. + * @syscap SystemCapability.Multimedia.Media.VideoPlayer + * @since 8 + * @deprecated since 9 + * @useinstead ohos.multimedia.media/media.AVPlayer#setSpeed + */ + setSpeed(speed: number, callback: AsyncCallback): void; + /** + * set output surface. + * @param { number } speed - playback speed, see @PlaybackSpeed . + * @returns { Promise } A Promise instance used to return actually speed. + * @syscap SystemCapability.Multimedia.Media.VideoPlayer + * @since 8 + * @deprecated since 9 + * @useinstead ohos.multimedia.media/media.AVPlayer#setSpeed + */ + setSpeed(speed: number): Promise; + /** + * Listens for video playback completed events. + * @param { 'playbackCompleted' } type - Type of the playback event to listen for. + * @param { Callback } callback - Callback used to listen for the playback event return. + * @syscap SystemCapability.Multimedia.Media.VideoPlayer + * @since 8 + * @deprecated since 9 + * @useinstead ohos.multimedia.media/media.AVPlayer#event:stateChange + */ + on(type: 'playbackCompleted', callback: Callback): void; + /** + * Listens for video playback buffering events. + * @param { 'bufferingUpdate' } type - Type of the playback buffering update event to listen for. + * @param { function } callback - Callback used to listen for the buffering update event, + * return BufferingInfoType and the value. + * @syscap SystemCapability.Multimedia.Media.VideoPlayer + * @since 8 + * @deprecated since 9 + * @useinstead ohos.multimedia.media/media.AVPlayer#event:bufferingUpdate + */ + on(type: 'bufferingUpdate', callback: (infoType: BufferingInfoType, value: number) => void): void; + /** + * Listens for start render video frame events. + * @param { 'startRenderFrame' } type - Type of the playback event to listen for. + * @param { Callback } callback - Callback used to listen for the playback event return. + * @syscap SystemCapability.Multimedia.Media.VideoPlayer + * @since 8 + * @deprecated since 9 + * @useinstead ohos.multimedia.media/media.AVPlayer#event:startRenderFrame + */ + on(type: 'startRenderFrame', callback: Callback): void; + /** + * Listens for video size changed event. + * @param { 'videoSizeChanged' } type - Type of the playback event to listen for. + * @param { function } callback - Callback used to listen for the playback event return video size. + * @syscap SystemCapability.Multimedia.Media.VideoPlayer + * @since 8 + * @deprecated since 9 + * @useinstead ohos.multimedia.media/media.AVPlayer#event:videoSizeChange + */ + on(type: 'videoSizeChanged', callback: (width: number, height: number) => void): void; + /** + * Listens for audio interrupt event, refer to {@link #audio.InterruptEvent} + * @param { 'audioInterrupt' } type - Type of the playback event to listen for. + * @param { function } callback - Callback used to listen for the playback event return audio interrupt info. + * @syscap SystemCapability.Multimedia.Media.VideoPlayer + * @since 9 + * @deprecated since 9 + * @useinstead ohos.multimedia.media/media.AVPlayer#event:audioInterrupt + */ + on(type: 'audioInterrupt', callback: (info: audio.InterruptEvent) => void): void; + /** + * Listens for playback error events. + * @param { 'error' } type - Type of the playback error event to listen for. + * @param { ErrorCallback } callback - Callback used to listen for the playback error event. + * @syscap SystemCapability.Multimedia.Media.VideoPlayer + * @since 8 + * @deprecated since 9 + * @useinstead ohos.multimedia.media/media.AVPlayer#event:error + */ + on(type: 'error', callback: ErrorCallback): void; + } + /** + * Enumerates video scale type. + * + * @enum { number } + * @syscap SystemCapability.Multimedia.Media.VideoPlayer + * @since 9 + */ + /** + * Enumerates video scale type. + * + * @enum { number } + * @syscap SystemCapability.Multimedia.Media.VideoPlayer + * @atomicservice + * @since 12 + */ + enum VideoScaleType { + /** + * The content is stretched to the fit the display surface rendering area. When + * the aspect ratio of the content is not same as the display surface, the aspect + * of the content is not maintained. This is the default scale type. + * @syscap SystemCapability.Multimedia.Media.VideoPlayer + * @since 9 + */ + /** + * The content is stretched to the fit the display surface rendering area. When + * the aspect ratio of the content is not same as the display surface, the aspect + * of the content is not maintained. This is the default scale type. + * @syscap SystemCapability.Multimedia.Media.VideoPlayer + * @atomicservice + * @since 12 + */ + VIDEO_SCALE_TYPE_FIT = 0, + /** + * The content is stretched to the fit the display surface rendering area. When + * the aspect ratio of the content is not the same as the display surface, content's + * aspect ratio is maintained and the content is cropped to fit the display surface. + * @syscap SystemCapability.Multimedia.Media.VideoPlayer + * @since 9 + */ + /** + * The content is stretched to the fit the display surface rendering area. When + * the aspect ratio of the content is not the same as the display surface, content's + * aspect ratio is maintained and the content is cropped to fit the display surface. + * @syscap SystemCapability.Multimedia.Media.VideoPlayer + * @atomicservice + * @since 12 + */ + VIDEO_SCALE_TYPE_FIT_CROP = 1 + } + /** + * Enumerates container format type(The abbreviation for 'container format type' is CFT). + * + * @enum { number } + * @syscap SystemCapability.Multimedia.Media.Core + * @since 8 + */ + /** + * Enumerates container format type(The abbreviation for 'container format type' is CFT). + * + * @enum { number } + * @syscap SystemCapability.Multimedia.Media.Core + * @atomicservice + * @since 12 + */ + enum ContainerFormatType { + /** + * A video container format type mp4. + * @syscap SystemCapability.Multimedia.Media.Core + * @since 8 + */ + CFT_MPEG_4 = 'mp4', + /** + * A audio container format type m4a. + * @syscap SystemCapability.Multimedia.Media.Core + * @since 8 + */ + /** + * A audio container format type m4a. + * @syscap SystemCapability.Multimedia.Media.Core + * @atomicservice + * @since 12 + */ + CFT_MPEG_4A = 'm4a' + } + /** + * Enumerates media data type. + * + * @enum { number } + * @syscap SystemCapability.Multimedia.Media.Core + * @since 8 + */ + /** + * Enumerates media data type. + * + * @enum { number } + * @syscap SystemCapability.Multimedia.Media.Core + * @atomicservice + * @since 11 + */ + enum MediaType { + /** + * track is audio. + * @syscap SystemCapability.Multimedia.Media.Core + * @since 8 + */ + /** + * track is audio. + * @syscap SystemCapability.Multimedia.Media.Core + * @atomicservice + * @since 11 + */ + MEDIA_TYPE_AUD = 0, + /** + * track is video. + * @syscap SystemCapability.Multimedia.Media.Core + * @since 8 + */ + /** + * track is video. + * @syscap SystemCapability.Multimedia.Media.Core + * @atomicservice + * @since 11 + */ + MEDIA_TYPE_VID = 1 + } + /** + * Enumerates media description key. + * + * @enum { number } + * @syscap SystemCapability.Multimedia.Media.Core + * @since 8 + */ + /** + * Enumerates media description key. + * + * @enum { number } + * @syscap SystemCapability.Multimedia.Media.Core + * @atomicservice + * @since 11 + */ + enum MediaDescriptionKey { + /** + * key for track index, value type is number. + * @syscap SystemCapability.Multimedia.Media.Core + * @since 8 + */ + /** + * key for track index, value type is number. + * @syscap SystemCapability.Multimedia.Media.Core + * @atomicservice + * @since 11 + */ + MD_KEY_TRACK_INDEX = 'track_index', + /** + * key for track type, value type is number, see @MediaType. + * @syscap SystemCapability.Multimedia.Media.Core + * @since 8 + */ + /** + * key for track type, value type is number, see @MediaType. + * @syscap SystemCapability.Multimedia.Media.Core + * @atomicservice + * @since 11 + */ + MD_KEY_TRACK_TYPE = 'track_type', + /** + * key for codec mime type, value type is string. + * @syscap SystemCapability.Multimedia.Media.Core + * @since 8 + */ + /** + * key for codec mime type, value type is string. + * @syscap SystemCapability.Multimedia.Media.Core + * @atomicservice + * @since 11 + */ + MD_KEY_CODEC_MIME = 'codec_mime', + /** + * key for duration, value type is number. + * @syscap SystemCapability.Multimedia.Media.Core + * @since 8 + */ + /** + * key for duration, value type is number. + * @syscap SystemCapability.Multimedia.Media.Core + * @atomicservice + * @since 11 + */ + MD_KEY_DURATION = 'duration', + /** + * key for bitrate, value type is number. + * @syscap SystemCapability.Multimedia.Media.Core + * @since 8 + */ + /** + * key for bitrate, value type is number. + * @syscap SystemCapability.Multimedia.Media.Core + * @atomicservice + * @since 11 + */ + MD_KEY_BITRATE = 'bitrate', + /** + * key for video width, value type is number. + * @syscap SystemCapability.Multimedia.Media.Core + * @since 8 + */ + /** + * key for video width, value type is number. + * @syscap SystemCapability.Multimedia.Media.Core + * @atomicservice + * @since 11 + */ + MD_KEY_WIDTH = 'width', + /** + * key for video height, value type is number. + * @syscap SystemCapability.Multimedia.Media.Core + * @since 8 + */ + /** + * key for video height, value type is number. + * @syscap SystemCapability.Multimedia.Media.Core + * @atomicservice + * @since 11 + */ + MD_KEY_HEIGHT = 'height', + /** + * key for video frame rate, value type is number. + * @syscap SystemCapability.Multimedia.Media.Core + * @since 8 + */ + /** + * key for video frame rate, value type is number. + * @syscap SystemCapability.Multimedia.Media.Core + * @atomicservice + * @since 11 + */ + MD_KEY_FRAME_RATE = 'frame_rate', + /** + * key for audio channel count, value type is number + * @syscap SystemCapability.Multimedia.Media.Core + * @since 8 + */ + /** + * key for audio channel count, value type is number + * @syscap SystemCapability.Multimedia.Media.Core + * @atomicservice + * @since 11 + */ + MD_KEY_AUD_CHANNEL_COUNT = 'channel_count', + /** + * key for audio sample rate, value type is number + * @syscap SystemCapability.Multimedia.Media.Core + * @since 8 + */ + /** + * key for audio sample rate, value type is number + * @syscap SystemCapability.Multimedia.Media.Core + * @atomicservice + * @since 11 + */ + MD_KEY_AUD_SAMPLE_RATE = 'sample_rate', + /** + * key for audio bit depth, value type is number + * @syscap SystemCapability.Multimedia.Media.Core + * @atomicservice + * @since 12 + */ + MD_KEY_AUD_SAMPLE_DEPTH = 'sample_depth' + } + /** + * Enumerates audio source type for recorder. + * + * @enum { number } + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @since 9 + */ + /** + * Enumerates audio source type for recorder. + * + * @enum { number } + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @atomicservice + * @since 12 + */ + enum AudioSourceType { + /** + * Default audio source type. + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @since 9 + */ + AUDIO_SOURCE_TYPE_DEFAULT = 0, + /** + * Source type mic. + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @since 9 + */ + /** + * Source type mic. + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @atomicservice + * @since 12 + */ + AUDIO_SOURCE_TYPE_MIC = 1 + } + /** + * Enumerates video source type for recorder. + * + * @enum { number } + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @since 9 + */ + enum VideoSourceType { + /** + * Surface raw data. + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @since 9 + */ + VIDEO_SOURCE_TYPE_SURFACE_YUV = 0, + /** + * Surface ES data. + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @since 9 + */ + VIDEO_SOURCE_TYPE_SURFACE_ES = 1 + } + /** + * Provides encoder info. + * + * @typedef EncoderInfo + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @since 11 + */ + interface EncoderInfo { + /** + * encoder format MIME + * @type { CodecMimeType } + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @since 11 + */ + mimeType: CodecMimeType; + /** + * encoder type, audio or video + * @type { string } + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @since 11 + */ + type: string; + /** + * audio or video encoder bitRate range + * @type { ?Range } + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @since 11 + */ + bitRate?: Range; + /** + * video encoder frame rate range + * @type { ?Range } + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @since 11 + */ + frameRate?: Range; + /** + * video encoder width range + * @type { ?Range } + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @since 11 + */ + width?: Range; + /** + * video encoder height range + * @type { ?Range } + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @since 11 + */ + height?: Range; + /** + * audio encoder channel range + * @type { ?Range } + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @since 11 + */ + channels?: Range; + /** + * audio encoder sample rate collection + * @type { ?Array } + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @since 11 + */ + sampleRate?: Array; + } + /** + * Provides Range with lower and upper limit. + * + * @typedef Range + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @since 11 + */ + interface Range { + /** + * lower limit of the range + * @type { number } + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @since 11 + */ + min: number; + /** + * upper limit of the range + * @type { number } + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @since 11 + */ + max: number; + } + /** + * Provides the media recorder profile definitions. + * + * @typedef AVRecorderProfile + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @since 9 + */ + /** + * Provides the media recorder profile definitions. + * + * @typedef AVRecorderProfile + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @atomicservice + * @since 12 + */ + interface AVRecorderProfile { + /** + * Indicates the audio bitrate. + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @since 9 + */ + /** + * Indicates the audio bitrate. + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @atomicservice + * @since 12 + */ + audioBitrate?: number; + /** + * Indicates the number of audio channels. + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @since 9 + */ + /** + * Indicates the number of audio channels. + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @atomicservice + * @since 12 + */ + audioChannels?: number; + /** + * Indicates the audio encoding format. + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @since 9 + */ + /** + * Indicates the audio encoding format. + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @atomicservice + * @since 12 + */ + audioCodec?: CodecMimeType; + /** + * Indicates the audio sampling rate. + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @since 9 + */ + /** + * Indicates the audio sampling rate. + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @atomicservice + * @since 12 + */ + audioSampleRate?: number; + /** + * Indicates the output file format. + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @since 9 + */ + /** + * Indicates the output file format. + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @atomicservice + * @since 12 + */ + fileFormat: ContainerFormatType; + /** + * Indicates the video bitrate. + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @since 9 + */ + videoBitrate?: number; + /** + * Indicates the video encoding format. + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @since 9 + */ + videoCodec?: CodecMimeType; + /** + * Indicates the video width. + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @since 9 + */ + videoFrameWidth?: number; + /** + * Indicates the video height. + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @since 9 + */ + videoFrameHeight?: number; + /** + * Indicates the video frame rate. + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @since 9 + */ + videoFrameRate?: number; + /** + * Whether to record HDR video. + * @type { ?boolean } + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @since 11 + */ + isHdr?: boolean; + /** + * Whether to encode the video in temporal scale mode. + * @type { ?boolean } + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @since 12 + */ + enableTemporalScale?: boolean; + } + /** + * Provides the media recorder configuration definitions. + * + * @typedef AVRecorderConfig + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @since 9 + */ + /** + * Provides the media recorder configuration definitions. + * + * @typedef AVRecorderConfig + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @atomicservice + * @since 12 + */ + interface AVRecorderConfig { + /** + * Audio source type, details see @AudioSourceType . + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @since 9 + */ + /** + * Audio source type, details see @AudioSourceType . + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @atomicservice + * @since 12 + */ + audioSourceType?: AudioSourceType; + /** + * Video source type, details see @VideoSourceType . + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @since 9 + */ + videoSourceType?: VideoSourceType; + /** + * Video recorder profile, details see @AVRecorderProfile . + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @since 9 + */ + /** + * Video recorder profile, details see @AVRecorderProfile . + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @atomicservice + * @since 12 + */ + profile: AVRecorderProfile; + /** + * File output uri, support a kind of uri now. + * format like: "fd://" + "context". + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @since 9 + */ + /** + * File output uri, support a kind of uri now. + * format like: "fd://" + "context". + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @atomicservice + * @since 12 + */ + url: string; + /** + * Sets the video rotation angle in output file, and for the file to playback, mp4 support + * the range of rotation angle should be {0, 90, 180, 270}, default is 0. + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @since 9 + * @deprecated since 12 + * @useinstead ohos.multimedia.media/media.AVMetadata#videoOrientation + */ + rotation?: number; + /** + * Geographical location information. + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @since 9 + * @deprecated since 12 + * @useinstead ohos.multimedia.media/media.AVMetadata#location + */ + location?: Location; + /** + * Set global metadata info. Details see @AVMetadata + * @type { ?AVMetadata } + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @since 12 + */ + metadata?: AVMetadata; + } + /** + * Provides the container definition for media description key-value pairs. + * + * @typedef MediaDescription + * @syscap SystemCapability.Multimedia.Media.Core + * @since 8 + */ + /** + * Provides the container definition for media description key-value pairs. + * + * @typedef MediaDescription + * @syscap SystemCapability.Multimedia.Media.Core + * @atomicservice + * @since 11 + */ + interface MediaDescription { + /** + * key:value pair, key see @MediaDescriptionKey . + * @syscap SystemCapability.Multimedia.Media.Core + * @since 8 + */ + /** + * key:value pair, key see @MediaDescriptionKey . + * @syscap SystemCapability.Multimedia.Media.Core + * @atomicservice + * @since 11 + */ + [key: string]: Object; + } + /** + * Enumerates seek mode. + * + * @enum { number } + * @syscap SystemCapability.Multimedia.Media.Core + * @since 8 + */ + /** + * Enumerates seek mode. + * + * @enum { number } + * @syscap SystemCapability.Multimedia.Media.Core + * @atomicservice + * @since 11 + */ + enum SeekMode { + /** + * seek to the next sync frame of the given timestamp + * @syscap SystemCapability.Multimedia.Media.Core + * @since 8 + */ + /** + * seek to the next sync frame of the given timestamp + * @syscap SystemCapability.Multimedia.Media.Core + * @atomicservice + * @since 11 + */ + SEEK_NEXT_SYNC = 0, + /** + * seek to the previous sync frame of the given timestamp + * @syscap SystemCapability.Multimedia.Media.Core + * @since 8 + */ + /** + * seek to the previous sync frame of the given timestamp + * @syscap SystemCapability.Multimedia.Media.Core + * @atomicservice + * @since 11 + */ + SEEK_PREV_SYNC = 1, + /** + * Seek to the closest frame of the given timestamp. + * @syscap SystemCapability.Multimedia.Media.Core + * @atomicservice + * @since 12 + */ + SEEK_CLOSEST = 2 + } + /** + * Enumerates Codec MIME types. + * + * @enum { string } + * @syscap SystemCapability.Multimedia.Media.Core + * @since 8 + */ + /** + * Enumerates Codec MIME types. + * + * @enum { string } + * @syscap SystemCapability.Multimedia.Media.Core + * @atomicservice + * @since 12 + */ + enum CodecMimeType { + /** + * H.263 codec MIME type. + * @syscap SystemCapability.Multimedia.Media.Core + * @since 8 + */ + VIDEO_H263 = 'video/h263', + /** + * H.264 codec MIME type. + * @syscap SystemCapability.Multimedia.Media.Core + * @since 8 + */ + VIDEO_AVC = 'video/avc', + /** + * MPEG2 codec MIME type. + * @syscap SystemCapability.Multimedia.Media.Core + * @since 8 + */ + VIDEO_MPEG2 = 'video/mpeg2', + /** + * MPEG4 codec MIME type + * @syscap SystemCapability.Multimedia.Media.Core + * @since 8 + */ + VIDEO_MPEG4 = 'video/mp4v-es', + /** + * VP8 codec MIME type + * @syscap SystemCapability.Multimedia.Media.Core + * @since 8 + */ + VIDEO_VP8 = 'video/x-vnd.on2.vp8', + /** + * AAC codec MIME type. + * @syscap SystemCapability.Multimedia.Media.Core + * @since 8 + */ + /** + * AAC codec MIME type. + * @syscap SystemCapability.Multimedia.Media.Core + * @atomicservice + * @since 12 + */ + AUDIO_AAC = 'audio/mp4a-latm', + /** + * vorbis codec MIME type. + * @syscap SystemCapability.Multimedia.Media.Core + * @since 8 + */ + AUDIO_VORBIS = 'audio/vorbis', + /** + * flac codec MIME type. + * @syscap SystemCapability.Multimedia.Media.Core + * @since 8 + */ + AUDIO_FLAC = 'audio/flac', + /** + * H.265 codec MIME type. + * @syscap SystemCapability.Multimedia.Media.Core + * @since 11 + */ + VIDEO_HEVC = 'video/hevc' + } + /** + * Enumerates AVScreenCaptureRecord preset types. + * + * @enum { number } + * @syscap SystemCapability.Multimedia.Media.AVScreenCapture + * @since 12 + */ + enum AVScreenCaptureRecordPreset { + /** + * Screen record normal type, h264/aac mp4 + * @syscap SystemCapability.Multimedia.Media.AVScreenCapture + * @since 12 + */ + SCREEN_RECORD_PRESET_H264_AAC_MP4 = 0, + /** + * Screen record high efficient type, h265/aac mp4 + * @syscap SystemCapability.Multimedia.Media.AVScreenCapture + * @since 12 + */ + SCREEN_RECORD_PRESET_H265_AAC_MP4 = 1 + } + /** + * Enumerates AVScreenCapture callback state type. + * + * @enum { number } + * @syscap SystemCapability.Multimedia.Media.AVScreenCapture + * @since 12 + */ + enum AVScreenCaptureStateCode { + /** + * Screen capture started + * @syscap SystemCapability.Multimedia.Media.AVScreenCapture + * @since 12 + */ + SCREENCAPTURE_STATE_STARTED = 0, + /** + * Screen capture canceled + * @syscap SystemCapability.Multimedia.Media.AVScreenCapture + * @since 12 + */ + SCREENCAPTURE_STATE_CANCELED = 1, + /** + * Screen capture stopped by user + * @syscap SystemCapability.Multimedia.Media.AVScreenCapture + * @since 12 + */ + SCREENCAPTURE_STATE_STOPPED_BY_USER = 2, + /** + * Screen capture stopped by interrupt + * @syscap SystemCapability.Multimedia.Media.AVScreenCapture + * @since 12 + */ + SCREENCAPTURE_STATE_INTERRUPTED_BY_OTHER = 3, + /** + * Screen capture stopped by phone call + * @syscap SystemCapability.Multimedia.Media.AVScreenCapture + * @since 12 + */ + SCREENCAPTURE_STATE_STOPPED_BY_CALL = 4, + /** + * Screen capture microphone not available + * @syscap SystemCapability.Multimedia.Media.AVScreenCapture + * @since 12 + */ + SCREENCAPTURE_STATE_MIC_UNAVAILABLE = 5, + /** + * Screen capture microphone is muted by user + * @syscap SystemCapability.Multimedia.Media.AVScreenCapture + * @since 12 + */ + SCREENCAPTURE_STATE_MIC_MUTED_BY_USER = 6, + /** + * Screen capture microphone is unmuted by user + * @syscap SystemCapability.Multimedia.Media.AVScreenCapture + * @since 12 + */ + SCREENCAPTURE_STATE_MIC_UNMUTED_BY_USER = 7, + /** + * Screen capture enter private scene + * @syscap SystemCapability.Multimedia.Media.AVScreenCapture + * @since 12 + */ + SCREENCAPTURE_STATE_ENTER_PRIVATE_SCENE = 8, + /** + * Screen capture exit private scene + * @syscap SystemCapability.Multimedia.Media.AVScreenCapture + * @since 12 + */ + SCREENCAPTURE_STATE_EXIT_PRIVATE_SCENE = 9 + } + /** + * Provides the media AVScreenCaptureRecord config definition. + * + * @typedef AVScreenCaptureRecordConfig + * @syscap SystemCapability.Multimedia.Media.AVScreenCapture + * @since 12 + */ + interface AVScreenCaptureRecordConfig { + /** + * Indicates record file descriptor. + * @syscap SystemCapability.Multimedia.Media.AVScreenCapture + * @since 12 + */ + fd: number; + /** + * Indicates video frame width. + * @syscap SystemCapability.Multimedia.Media.AVScreenCapture + * @since 12 + */ + frameWidth?: number; + /** + * Indicates video frame height. + * @syscap SystemCapability.Multimedia.Media.AVScreenCapture + * @since 12 + */ + frameHeight?: number; + /** + * Indicates video bitrate. + * @syscap SystemCapability.Multimedia.Media.AVScreenCapture + * @since 12 + */ + videoBitrate?: number; + /** + * Indicates audio sample rate. + * @syscap SystemCapability.Multimedia.Media.AVScreenCapture + * @since 12 + */ + audioSampleRate?: number; + /** + * Indicates audio channel count. + * @syscap SystemCapability.Multimedia.Media.AVScreenCapture + * @since 12 + */ + audioChannelCount?: number; + /** + * Indicates audio bitrate. + * @syscap SystemCapability.Multimedia.Media.AVScreenCapture + * @since 12 + */ + audioBitrate?: number; + /** + * Indicates AVScreenCaptureRecordPreset, details see @AVScreenCaptureRecordPreset + * @syscap SystemCapability.Multimedia.Media.AVScreenCapture + * @since 12 + */ + preset?: AVScreenCaptureRecordPreset; + } + /** + * Provides screen capture record. Before calling an AVScreenCaptureRecorder method, you must use createAVScreenCaptureRecorder() + * to create an AVScreenCaptureRecorder instance. + * + * @typedef AVScreenCaptureRecorder + * @syscap SystemCapability.Multimedia.Media.AVScreenCapture + * @since 12 + */ + interface AVScreenCaptureRecorder { + /** + * Init AVScreenCaptureRecorder. + * @param { AVScreenCaptureRecordConfig } config - AVScreenCaptureRecorder config. + * @returns { Promise } A Promise instance used to return when init completed. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3.Parameter verification failed. + * @throws { BusinessError } 5400103 - IO error. Return by promise. + * @throws { BusinessError } 5400105 - Service died. Return by promise. + * @syscap SystemCapability.Multimedia.Media.AVScreenCapture + * @since 12 + */ + init(config: AVScreenCaptureRecordConfig): Promise; + /** + * Start screen capture recording. + * @returns { Promise } A Promise instance used to return when startRecording completed. + * @throws { BusinessError } 5400103 - IO error. Return by promise. + * @throws { BusinessError } 5400105 - Service died. Return by promise. + * @syscap SystemCapability.Multimedia.Media.AVScreenCapture + * @since 12 + */ + startRecording(): Promise; + /** + * Stop screen capture recording. + * @returns { Promise } A Promise instance used to return when stopRecording completed. + * @throws { BusinessError } 5400103 - IO error. Return by promise. + * @throws { BusinessError } 5400105 - Service died. Return by promise. + * @syscap SystemCapability.Multimedia.Media.AVScreenCapture + * @since 12 + */ + stopRecording(): Promise; + /** + * Set microphone enable or disable. + * @param { boolean } enable - Set microphone enable or disable during recording. + * @returns { Promise } A Promise instance used to return when setMicEnabled completed. + * @throws { BusinessError } 5400103 - IO error. Return by promise. + * @throws { BusinessError } 5400105 - Service died. Return by promise. + * @syscap SystemCapability.Multimedia.Media.AVScreenCapture + * @since 12 + */ + setMicEnabled(enable: boolean): Promise; + /** + * Release screen capture recording. + * @returns { Promise } A Promise instance used to return when release completed. + * @throws { BusinessError } 5400103 - IO error. Return by promise. + * @throws { BusinessError } 5400105 - Service died. Return by promise. + * @syscap SystemCapability.Multimedia.Media.AVScreenCapture + * @since 12 + */ + release(): Promise; + /** + * Listens for AVScreenCaptureRecord info callback. + * @param { 'stateChange' } type - Type of the AVScreenCaptureRecord event to listen for. + * @param { Callback } callback - Callback used to listen for the AVScreenCaptureRecord info return. + * @syscap SystemCapability.Multimedia.Media.AVScreenCapture + * @since 12 + */ + on(type: 'stateChange', callback: Callback): void; + /** + * Listens for AVScreenCaptureRecord info callback. + * @param { 'error' } type - Type of the AVScreenCaptureRecord event to listen for. + * @param { ErrorCallback } callback - Callback used to listen for the AVScreenCaptureRecord error return. + * @throws { BusinessError } 5400103 - IO error. Return by ErrorCallback. + * @throws { BusinessError } 5400105 - Service died. Return by ErrorCallback. + * @syscap SystemCapability.Multimedia.Media.AVScreenCapture + * @since 12 + */ + on(type: 'error', callback: ErrorCallback): void; + /** + * Unregister listens for AVScreenCaptureRecord info callback. + * @param { 'stateChange' } type - Type of the AVScreenCaptureRecord event to listen for. + * @param { Callback } callback - Callback used to listen for the AVScreenCaptureRecord info return. + * @syscap SystemCapability.Multimedia.Media.AVScreenCapture + * @since 12 + */ + off(type: 'stateChange', callback?: Callback): void; + /** + * Unregister listens for AVScreenCaptureRecord error callback. + * @param { 'error' } type - Type of the AVScreenCaptureRecord event to listen for. + * @param { ErrorCallback } callback - Callback used to listen for the AVScreenCaptureRecord error return. + * @syscap SystemCapability.Multimedia.Media.AVScreenCapture + * @since 12 + */ + off(type: 'error', callback?: ErrorCallback): void; + } +} +export default media; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.multimedia.mediaLibrary.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.multimedia.mediaLibrary.d.ts new file mode 100755 index 00000000..65b94b79 --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.multimedia.mediaLibrary.d.ts @@ -0,0 +1,1282 @@ +/* + * Copyright (C) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit MediaLibraryKit + */ +import { AsyncCallback, Callback } from './@ohos.base'; +import Context from './application/Context'; +import image from './@ohos.multimedia.image'; +/** + * @name mediaLibrary + * @since 6 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @deprecated since 9 + * @useinstead ohos.file.picker + */ +declare namespace mediaLibrary { + /** + * Obtains a MediaLibrary instance. + * @since 6 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @FAModelOnly + * @returns Returns a MediaLibrary instance if the operation is successful; returns null otherwise. + * @deprecated since 9 + * @useinstead ohos.file.picker + */ + function getMediaLibrary(): MediaLibrary; + /** + * Returns an instance of MediaLibrary + * @since 8 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @StageModelOnly + * @param context hap context information + * @returns Instance of MediaLibrary + * @deprecated since 9 + * @useinstead ohos.file.picker + */ + function getMediaLibrary(context: Context): MediaLibrary; + /** + * Enumeration types for different kind of Media Files + * @since 8 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @deprecated since 9 + * @useinstead ohos.file.picker + */ + enum MediaType { + /** + * File media type + * @since 8 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @deprecated since 9 + * @useinstead ohos.file.picker + */ + FILE = 0, + /** + * Image media type + * @since 8 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @deprecated since 9 + * @useinstead ohos.file.picker + */ + IMAGE, + /** + * Video media type + * @since 8 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @deprecated since 9 + * @useinstead ohos.file.picker + */ + VIDEO, + /** + * Audio media type + * @since 8 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @deprecated since 9 + * @useinstead ohos.file.picker + */ + AUDIO + } + /** + * Describes media resource options. + * @since 6 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @deprecated since 9 + */ + interface MediaAssetOption { + /** + * URI of the media source. + * @since 6 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @deprecated since 9 + */ + src: string; + /** + * Multipurpose Internet Mail Extensions (MIME) type of the media. + * @since 6 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @deprecated since 9 + */ + mimeType: string; + /** + * Relative path for storing media resources. + * @since 6 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @deprecated since 9 + */ + relativePath?: string; + } + /** + * Describes media selection options. + * @since 6 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @deprecated since 9 + */ + interface MediaSelectOption { + /** + * Media type, which can be image, video, or media (indicating both image and video). + * @since 6 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @deprecated since 9 + */ + type: 'image' | 'video' | 'media'; + /** + * Maximum number of media items that can be selected + * @since 6 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @deprecated since 9 + */ + count: number; + } + /** + * Provides methods to encapsulate file attributes. + * @since 7 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @deprecated since 9 + * @useinstead ohos.file.picker + */ + interface FileAsset { + /** + * File ID. + * @since 7 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @deprecated since 9 + * @useinstead ohos.file.picker + */ + readonly id: number; + /** + * URI of the file. + * @since 7 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @deprecated since 9 + * @useinstead ohos.file.picker + */ + readonly uri: string; + /** + * MIME type, for example, video/mp4, audio/mp4, or audio/amr-wb. + * @since 7 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @deprecated since 9 + * @useinstead ohos.file.picker + */ + readonly mimeType: string; + /** + * Media type, for example, IMAGE, VIDEO, FILE, AUDIO + * @since 8 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @deprecated since 9 + * @useinstead ohos.file.picker + */ + readonly mediaType: MediaType; + /** + * Display name (with a file name extension) of the file. + * @since 7 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @deprecated since 9 + * @useinstead ohos.file.picker + */ + displayName: string; + /** + * File name title (without the file name extension). + * @since 7 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @deprecated since 9 + * @useinstead ohos.file.picker + */ + title: string; + /** + * Relative Path of the file. + * @since 8 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @deprecated since 9 + * @useinstead ohos.file.picker + */ + relativePath: string; + /** + * Parent folder's file_id of the file. + * @since 8 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @deprecated since 9 + * @useinstead ohos.file.picker + */ + readonly parent: number; + /** + * Data size of the file. + * @since 7 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @deprecated since 9 + * @useinstead ohos.file.picker + */ + readonly size: number; + /** + * Date (timestamp) when the file was added. + * @since 7 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @deprecated since 9 + * @useinstead ohos.file.picker + */ + readonly dateAdded: number; + /** + * Date (timestamp) when the file was modified. + * @since 7 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @deprecated since 9 + * @useinstead ohos.file.picker + */ + readonly dateModified: number; + /** + * Date (timestamp) when the file was taken. + * @since 7 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @deprecated since 9 + * @useinstead ohos.file.picker + */ + readonly dateTaken: number; + /** + * Artist of the audio file. + * @since 8 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @deprecated since 9 + * @useinstead ohos.file.picker + */ + readonly artist: string; + /** + * audioAlbum of the audio file. + * @since 8 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @deprecated since 9 + * @useinstead ohos.file.picker + */ + readonly audioAlbum: string; + /** + * Display width of the file. This is valid only for videos and images. + * @since 7 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @deprecated since 9 + * @useinstead ohos.file.picker + */ + readonly width: number; + /** + * Display height of the file. This is valid only for videos and images. + * @since 7 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @deprecated since 9 + * @useinstead ohos.file.picker + */ + readonly height: number; + /** + * Rotation angle of the file, in degrees. + * The rotation angle can be 0, 90, 180, or 270 degrees. This is valid only for videos. + * @since 7 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @deprecated since 9 + * @useinstead ohos.file.picker + */ + orientation: number; + /** + * duration of the audio and video file. + * @since 8 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @deprecated since 9 + * @useinstead ohos.file.picker + */ + readonly duration: number; + /** + * ID of the album where the file is located. + * @since 7 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @deprecated since 9 + * @useinstead ohos.file.picker + */ + readonly albumId: number; + /** + * URI of the album where the file is located. + * @since 8 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @deprecated since 9 + * @useinstead ohos.file.picker + */ + readonly albumUri: string; + /** + * Name of the album where the file is located. + * @since 7 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @deprecated since 9 + * @useinstead ohos.file.picker + */ + readonly albumName: string; + /** + * If it is a directory where the file is located. + * @since 8 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @permission ohos.permission.READ_MEDIA + * @param callback Callback return the result of isDirectory. + * @deprecated since 9 + * @useinstead ohos.file.picker + */ + isDirectory(callback: AsyncCallback): void; + /** + * If it is a directory where the file is located. + * @since 8 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @permission ohos.permission.READ_MEDIA + * @deprecated since 9 + * @useinstead ohos.file.picker + */ + isDirectory(): Promise; + /** + * Modify meta data where the file is located. + * @since 8 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @permission ohos.permission.READ_MEDIA and ohos.permission.WRITE_MEDIA + * @param callback no value will be returned. + * @deprecated since 9 + * @useinstead ohos.file.picker + */ + commitModify(callback: AsyncCallback): void; + /** + * Modify meta data where the file is located. + * @since 8 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @permission ohos.permission.READ_MEDIA and ohos.permission.WRITE_MEDIA + * @deprecated since 9 + * @useinstead ohos.file.picker + */ + commitModify(): Promise; + /** + * Open the file is located. + * @since 8 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @permission ohos.permission.READ_MEDIA or ohos.permission.WRITE_MEDIA + * @param mode mode for open, for example: rw, r, w. + * @param callback Callback return the fd of the file. + * @deprecated since 9 + * @useinstead ohos.file.picker + */ + open(mode: string, callback: AsyncCallback): void; + /** + * Open the file is located. + * @since 8 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @permission ohos.permission.READ_MEDIA or ohos.permission.WRITE_MEDIA + * @param mode mode for open, for example: rw, r, w. + * @deprecated since 9 + * @useinstead ohos.file.picker + */ + open(mode: string): Promise; + /** + * Close the file is located. + * @since 8 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @permission ohos.permission.READ_MEDIA or ohos.permission.WRITE_MEDIA + * @param fd fd of the file which had been opened + * @param callback no value will be returned. + * @deprecated since 9 + * @useinstead ohos.file.picker + */ + close(fd: number, callback: AsyncCallback): void; + /** + * Close the file is located. + * @since 8 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @permission ohos.permission.READ_MEDIA or ohos.permission.WRITE_MEDIA + * @param fd fd of the file which had been opened + * @deprecated since 9 + * @useinstead ohos.file.picker + */ + close(fd: number): Promise; + /** + * Get thumbnail of the file when the file is located. + * @since 8 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @permission ohos.permission.READ_MEDIA + * @param callback Callback used to return the thumbnail's pixelmap. + * @deprecated since 9 + * @useinstead ohos.file.picker + */ + getThumbnail(callback: AsyncCallback): void; + /** + * Get thumbnail of the file when the file is located. + * @since 8 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @permission ohos.permission.READ_MEDIA + * @param size thumbnail's size + * @param callback Callback used to return the thumbnail's pixelmap. + * @deprecated since 9 + * @useinstead ohos.file.picker + */ + getThumbnail(size: Size, callback: AsyncCallback): void; + /** + * Get thumbnail of the file when the file is located. + * @since 8 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @permission ohos.permission.READ_MEDIA + * @param size thumbnail's size + * @deprecated since 9 + * @useinstead ohos.file.picker + */ + getThumbnail(size?: Size): Promise; + /** + * Set favorite for the file when the file is located. + * @since 8 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @permission ohos.permission.READ_MEDIA and ohos.permission.WRITE_MEDIA + * @param isFavorite true is favorite file, false is not favorite file + * @param callback Callback used to return, No value is returned. + * @deprecated since 9 + * @useinstead ohos.file.picker + */ + favorite(isFavorite: boolean, callback: AsyncCallback): void; + /** + * Set favorite for the file when the file is located. + * @since 8 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @permission ohos.permission.READ_MEDIA and ohos.permission.WRITE_MEDIA + * @param isFavorite true is favorite file, false is not favorite file + * @deprecated since 9 + * @useinstead ohos.file.picker + */ + favorite(isFavorite: boolean): Promise; + /** + * If the file is favorite when the file is located. + * @since 8 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @permission ohos.permission.READ_MEDIA + * @param callback Callback used to return true or false. + * @deprecated since 9 + * @useinstead ohos.file.picker + */ + isFavorite(callback: AsyncCallback): void; + /** + * If the file is favorite when the file is located. + * @since 8 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @permission ohos.permission.READ_MEDIA + * @deprecated since 9 + * @useinstead ohos.file.picker + */ + isFavorite(): Promise; + /** + * Set trash for the file when the file is located. + * @since 8 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @permission ohos.permission.READ_MEDIA and ohos.permission.WRITE_MEDIA + * @param isTrash true is trashed file, false is not trashed file + * @param callback Callback used to return, No value is returned. + * @deprecated since 9 + * @useinstead ohos.file.picker + */ + trash(isTrash: boolean, callback: AsyncCallback): void; + /** + * Set trash for the file when the file is located. + * @since 8 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @permission ohos.permission.READ_MEDIA and ohos.permission.WRITE_MEDIA + * @param isTrash true is trashed file, false is not trashed file + * @deprecated since 9 + * @useinstead ohos.file.picker + */ + trash(isTrash: boolean): Promise; + /** + * If the file is in trash when the file is located. + * @since 8 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @permission ohos.permission.READ_MEDIA + * @param callback Callback used to return true or false. + * @deprecated since 9 + * @useinstead ohos.file.picker + */ + isTrash(callback: AsyncCallback): void; + /** + * If the file is in trash when the file is located. + * @since 8 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @permission ohos.permission.READ_MEDIA + * @deprecated since 9 + * @useinstead ohos.file.picker + */ + isTrash(): Promise; + } + /** + * Describes MediaFetchOptions's selection + * @since 8 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @deprecated since 9 + * @useinstead ohos.file.picker + */ + enum FileKey { + /** + * File ID + * @since 8 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @deprecated since 9 + * @useinstead ohos.file.picker + */ + ID = "file_id", + /** + * Relative Path + * @since 8 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @deprecated since 9 + * @useinstead ohos.file.picker + */ + RELATIVE_PATH = "relative_path", + /** + * File name + * @since 8 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @deprecated since 9 + * @useinstead ohos.file.picker + */ + DISPLAY_NAME = "display_name", + /** + * Parent folder file id + * @since 8 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @deprecated since 9 + * @useinstead ohos.file.picker + */ + PARENT = "parent", + /** + * Mime type of the file + * @since 8 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @deprecated since 9 + * @useinstead ohos.file.picker + */ + MIME_TYPE = "mime_type", + /** + * Media type of the file + * @since 8 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @deprecated since 9 + * @useinstead ohos.file.picker + */ + MEDIA_TYPE = "media_type", + /** + * Size of the file + * @since 8 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @deprecated since 9 + * @useinstead ohos.file.picker + */ + SIZE = "size", + /** + * Date of the file creation + * @since 8 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @deprecated since 9 + * @useinstead ohos.file.picker + */ + DATE_ADDED = "date_added", + /** + * Modify date of the file + * @since 8 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @deprecated since 9 + * @useinstead ohos.file.picker + */ + DATE_MODIFIED = "date_modified", + /** + * Date taken of the file + * @since 8 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @deprecated since 9 + * @useinstead ohos.file.picker + */ + DATE_TAKEN = "date_taken", + /** + * Title of the file + * @since 8 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @deprecated since 9 + * @useinstead ohos.file.picker + */ + TITLE = "title", + /** + * Artist of the audio file + * @since 8 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @deprecated since 9 + * @useinstead ohos.file.picker + */ + ARTIST = "artist", + /** + * Audio album of the audio file + * @since 8 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @deprecated since 9 + * @useinstead ohos.file.picker + */ + AUDIOALBUM = "audio_album", + /** + * Duration of the audio and video file + * @since 8 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @deprecated since 9 + * @useinstead ohos.file.picker + */ + DURATION = "duration", + /** + * Width of the image file + * @since 8 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @deprecated since 9 + * @useinstead ohos.file.picker + */ + WIDTH = "width", + /** + * Height of the image file + * @since 8 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @deprecated since 9 + * @useinstead ohos.file.picker + */ + HEIGHT = "height", + /** + * Orientation of the image file + * @since 8 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @deprecated since 9 + * @useinstead ohos.file.picker + */ + ORIENTATION = "orientation", + /** + * Album id of the file + * @since 8 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @deprecated since 9 + * @useinstead ohos.file.picker + */ + ALBUM_ID = "bucket_id", + /** + * Album name of the file + * @since 8 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @deprecated since 9 + * @useinstead ohos.file.picker + */ + ALBUM_NAME = "bucket_display_name" + } + /** + * Fetch parameters applicable on images, videos, audios, albums and other media + * @since 7 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @deprecated since 9 + * @useinstead ohos.file.picker + */ + interface MediaFetchOptions { + /** + * Fields to retrieve, for example, selections: "media_type =? OR media_type =?". + * @since 7 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @deprecated since 9 + * @useinstead ohos.file.picker + */ + selections: string; + /** + * Conditions for retrieval, for example, selectionArgs: [IMAGE, VIDEO]. + * @since 7 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @deprecated since 9 + * @useinstead ohos.file.picker + */ + selectionArgs: Array; + /** + * Sorting criterion of the retrieval results, for example, order: "dateTaken DESC,display_name DESC, file_id DESC". + * @since 7 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @deprecated since 9 + * @useinstead ohos.file.picker + */ + order?: string; + /** + * uri for retrieval + * @since 8 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @deprecated since 9 + * @useinstead ohos.file.picker + */ + uri?: string; + /** + * networkId for retrieval + * @since 8 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @deprecated since 9 + * @useinstead ohos.file.picker + */ + networkId?: string; + /** + * extendArgs for retrieval + * @since 8 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @deprecated since 9 + * @useinstead ohos.file.picker + */ + extendArgs?: string; + } + /** + * Implements file retrieval. + * @since 7 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @deprecated since 9 + * @useinstead ohos.file.picker + */ + interface FetchFileResult { + /** + * Obtains the total number of files in the file retrieval result. + * @since 7 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @returns Total number of files. + * @deprecated since 9 + * @useinstead ohos.file.picker + */ + getCount(): number; + /** + * Checks whether the result set points to the last row. + * @since 7 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @returns Whether the file is the last one. + * @deprecated since 9 + * @useinstead ohos.file.picker + * You need to check whether the file is the last one before calling getNextObject, + * which returns the next file only when False is returned for this method. + */ + isAfterLast(): boolean; + /** + * Releases the FetchFileResult instance and invalidates it. Other methods cannot be called. + * @since 7 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @deprecated since 9 + * @useinstead ohos.file.picker + */ + close(): void; + /** + * Obtains the first FileAsset in the file retrieval result. This method uses a callback to return the file. + * @since 7 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @param callback Callback used to return the file in the format of a FileAsset instance. + * @deprecated since 9 + * @useinstead ohos.file.picker + */ + getFirstObject(callback: AsyncCallback): void; + /** + * Obtains the first FileAsset in the file retrieval result. This method uses a promise to return the file. + * @since 7 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @returns A Promise instance used to return the file in the format of a FileAsset instance. + * @deprecated since 9 + * @useinstead ohos.file.picker + */ + getFirstObject(): Promise; + /** + * Obtains the next FileAsset in the file retrieval result. + * This method uses a callback to return the file. + * Before calling this method, you must use isAfterLast() to check whether the result set points to the last row. + * This method returns the next file only when False is returned for isAfterLast(). + * @since 7 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @param callback Callback used to return the file in the format of a FileAsset instance. + * @deprecated since 9 + * @useinstead ohos.file.picker + */ + getNextObject(callback: AsyncCallback): void; + /** + * Obtains the next FileAsset in the file retrieval result. + * This method uses a promise to return the file. + * Before calling this method, you must use isAfterLast() to check whether the result set points to the last row. + * This method returns the next file only when False is returned for isAfterLast(). + * @since 7 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @returns A Promise instance used to return the file in the format of a FileAsset instance. + * @deprecated since 9 + * @useinstead ohos.file.picker + */ + getNextObject(): Promise; + /** + * Obtains the last FileAsset in the file retrieval result. This method uses a callback to return the file. + * @since 7 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @param callback Callback used to return the file in the format of a FileAsset instance. + * @deprecated since 9 + * @useinstead ohos.file.picker + */ + getLastObject(callback: AsyncCallback): void; + /** + * Obtains the last FileAsset in the file retrieval result. This method uses a promise to return the file. + * @since 7 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @returns A Promise instance used to return the file in the format of a FileAsset instance. + * @deprecated since 9 + * @useinstead ohos.file.picker + */ + getLastObject(): Promise; + /** + * Obtains the FileAsset with the specified index in the file retrieval result. + * This method uses a callback to return the file. + * @since 7 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @param index Index of the file to obtain. + * @param callback Callback used to return the file in the format of a FileAsset instance. + * @deprecated since 9 + * @useinstead ohos.file.picker + */ + getPositionObject(index: number, callback: AsyncCallback): void; + /** + * Obtains the FileAsset with the specified index in the file retrieval result. + * This method uses a promise to return the file. + * @since 7 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @param index Index of the file to obtain. + * @returns A Promise instance used to return the file in the format of a FileAsset instance. + * @deprecated since 9 + * @useinstead ohos.file.picker + */ + getPositionObject(index: number): Promise; + /** + * Obtains all FileAssets in the file retrieval result. + * This method uses a callback to return the result. After this method is called, + * close() is automatically called to release the FetchFileResult instance and invalidate it. + * In this case, other methods cannot be called. + * @since 7 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @param callback Callback used to return a FileAsset array. + * @deprecated since 9 + * @useinstead ohos.file.picker + */ + getAllObject(callback: AsyncCallback>): void; + /** + * Obtains all FileAssets in the file retrieval result. + * This method uses a promise to return the result. that store the selected media resources. + * close() is automatically called to release the FetchFileResult instance and invalidate it. + * In this case, other methods cannot be called. + * @since 7 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @returns A Promise instance used to return a FileAsset array. + * @deprecated since 9 + * @useinstead ohos.file.picker + */ + getAllObject(): Promise>; + } + /** + * Defines the album. + * + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.file.picker + */ + interface Album { + /** + * Album ID. + * @since 7 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @deprecated since 9 + * @useinstead ohos.file.picker + */ + readonly albumId: number; + /** + * Album name. + * @since 7 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @deprecated since 9 + * @useinstead ohos.file.picker + */ + albumName: string; + /** + * Album uri. + * @since 8 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @deprecated since 9 + * @useinstead ohos.file.picker + */ + readonly albumUri: string; + /** + * Date (timestamp) when the album was last modified. + * @since 7 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @deprecated since 9 + * @useinstead ohos.file.picker + */ + readonly dateModified: number; + /** + * File count for the album + * @since 8 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @deprecated since 9 + * @useinstead ohos.file.picker + */ + readonly count: number; + /** + * Relative path for the album + * @since 8 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @deprecated since 9 + * @useinstead ohos.file.picker + */ + readonly relativePath: string; + /** + * coverUri for the album + * @since 8 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @deprecated since 9 + * @useinstead ohos.file.picker + */ + readonly coverUri: string; + /** + * Modify the meta data for the album + * @since 8 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @permission ohos.permission.READ_MEDIA and ohos.permission.WRITE_MEDIA + * @param callback, no value will be returned. + * @deprecated since 9 + * @useinstead ohos.file.picker + */ + commitModify(callback: AsyncCallback): void; + /** + * Modify the meta data for the album + * @since 8 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @permission ohos.permission.READ_MEDIA and ohos.permission.WRITE_MEDIA + * @deprecated since 9 + * @useinstead ohos.file.picker + */ + commitModify(): Promise; + /** + * SObtains files in an album. This method uses an asynchronous callback to return the files. + * @since 7 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @permission ohos.permission.READ_MEDIA + * @param callback Callback used to return the files in the format of a FetchFileResult instance. + * @deprecated since 9 + * @useinstead ohos.file.picker + */ + getFileAssets(callback: AsyncCallback): void; + /** + * SObtains files in an album. This method uses an asynchronous callback to return the files. + * @since 7 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @permission ohos.permission.READ_MEDIA + * @param option Media retrieval options. + * @param callback Callback used to return the files in the format of a FetchFileResult instance. + * @deprecated since 9 + * @useinstead ohos.file.picker + */ + getFileAssets(options: MediaFetchOptions, callback: AsyncCallback): void; + /** + * Obtains files in an album. This method uses a promise to return the files. + * @since 7 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @permission ohos.permission.READ_MEDIA + * @param option Media retrieval options. + * @returns A Promise instance used to return the files in the format of a FetchFileResult instance. + * @deprecated since 9 + * @useinstead ohos.file.picker + */ + getFileAssets(options?: MediaFetchOptions): Promise; + } + /** + * Enumeration public directory that predefined + * @since 8 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @deprecated since 9 + * @useinstead ohos.file.picker + */ + enum DirectoryType { + /** + * predefined public directory for files token by Camera. + * @since 8 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @deprecated since 9 + * @useinstead ohos.file.picker + */ + DIR_CAMERA = 0, + /** + * predefined public directory for VIDEO files. + * @since 8 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @deprecated since 9 + * @useinstead ohos.file.picker + */ + DIR_VIDEO, + /** + * predefined public directory for IMAGE files. + * @since 8 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @deprecated since 9 + * @useinstead ohos.file.picker + */ + DIR_IMAGE, + /** + * predefined public directory for AUDIO files. + * @since 8 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @deprecated since 9 + * @useinstead ohos.file.picker + */ + DIR_AUDIO, + /** + * predefined public directory for DOCUMENTS files. + * @since 8 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @deprecated since 9 + * @useinstead ohos.file.picker + */ + DIR_DOCUMENTS, + /** + * predefined public directory for DOWNLOAD files. + * @since 8 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @deprecated since 9 + * @useinstead ohos.file.picker + */ + DIR_DOWNLOAD + } + /** + * Defines the MediaLibrary class and provides functions to access the data in media storage. + * + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @since 6 + * @deprecated since 9 + * @useinstead ohos.file.picker + */ + interface MediaLibrary { + /** + * get system predefined root dir, use to create file asset by relative path + * @since 8 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @param type, public directory predefined in DirectoryType. + * @param callback Callback return the FetchFileResult. + * @deprecated since 9 + * @useinstead ohos.file.picker + */ + getPublicDirectory(type: DirectoryType, callback: AsyncCallback): void; + /** + * get system predefined root dir, use to create file asset by relative path + * @since 8 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @param type public directory predefined in DirectoryType. + * @returns A promise instance used to return the public directory in the format of string + * @deprecated since 9 + * @useinstead ohos.file.picker + */ + getPublicDirectory(type: DirectoryType): Promise; + /** + * query all assets just for count & first cover + * if need all data, getAllObject from FetchFileResult + * @since 7 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @permission ohos.permission.READ_MEDIA + * @param options, Media retrieval options. + * @param callback, Callback return the FetchFileResult. + * @deprecated since 9 + * @useinstead ohos.file.picker + */ + getFileAssets(options: MediaFetchOptions, callback: AsyncCallback): void; + /** + * query all assets just for count & first cover + * if need all data, getAllObject from FetchFileResult + * @since 7 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @permission ohos.permission.READ_MEDIA + * @param options Media retrieval options. + * @returns A promise instance used to return the files in the format of a FetchFileResult instance + * @deprecated since 9 + * @useinstead ohos.file.picker + */ + getFileAssets(options: MediaFetchOptions): Promise; + /** + * Turn on monitor the data changes by media type + * @since 8 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @param type one of 'deviceChange','albumChange','imageChange','audioChange','videoChange','fileChange','remoteFileChange' + * @param callback no value returned + * @deprecated since 9 + * @useinstead ohos.file.picker + */ + on(type: 'deviceChange' | 'albumChange' | 'imageChange' | 'audioChange' | 'videoChange' | 'fileChange' | 'remoteFileChange', callback: Callback): void; + /** + * Turn off monitor the data changes by media type + * @since 8 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @param type one of 'deviceChange','albumChange','imageChange','audioChange','videoChange','fileChange','remoteFileChange' + * @param callback no value returned + * @deprecated since 9 + * @useinstead ohos.file.picker + */ + off(type: 'deviceChange' | 'albumChange' | 'imageChange' | 'audioChange' | 'videoChange' | 'fileChange' | 'remoteFileChange', callback?: Callback): void; + /** + * Create File Asset + * @since 8 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @permission ohos.permission.READ_MEDIA and ohos.permission.WRITE_MEDIA + * @param mediaType mediaType for example:IMAGE, VIDEO, AUDIO, FILE + * @param displayName file name + * @param relativePath relative path + * @param callback Callback used to return the FileAsset + * @deprecated since 9 + * @useinstead ohos.file.picker + */ + createAsset(mediaType: MediaType, displayName: string, relativePath: string, callback: AsyncCallback): void; + /** + * Create File Asset + * @since 8 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @permission ohos.permission.READ_MEDIA and ohos.permission.WRITE_MEDIA + * @param mediaType mediaType for example:IMAGE, VIDEO, AUDIO, FILE + * @param displayName file name + * @param relativePath relative path + * @returns A Promise instance used to return the FileAsset + * @deprecated since 9 + * @useinstead ohos.file.picker + */ + createAsset(mediaType: MediaType, displayName: string, relativePath: string): Promise; + /** + * Obtains albums based on the media retrieval options. This method uses an asynchronous callback to return. + * @since 7 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @permission ohos.permission.READ_MEDIA + * @param option Media retrieval options. + * @param callback Callback used to return an album array. + * @deprecated since 9 + * @useinstead ohos.file.picker + */ + getAlbums(options: MediaFetchOptions, callback: AsyncCallback>): void; + /** + * Obtains albums based on the media retrieval options. This method uses a promise to return the albums. + * @since 7 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @permission ohos.permission.READ_MEDIA + * @param option Media retrieval options. + * @returns A Promise instance used to return an album array. + * @deprecated since 9 + * @useinstead ohos.file.picker + */ + getAlbums(options: MediaFetchOptions): Promise>; + /** + * Stores media resources. This method uses an asynchronous callback to return the URI that stores + * the media resources. + * @since 6 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @param option Media resource option. + * @param callback Callback used to return the URI that stores the media resources. + * @deprecated since 9 + */ + storeMediaAsset(option: MediaAssetOption, callback: AsyncCallback): void; + /** + * Stores media resources. This method uses a promise to return the URI that stores the media resources. + * @since 6 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @param option Media resource option. + * @returns Promise used to return the URI that stores the media resources. + * @deprecated since 9 + */ + storeMediaAsset(option: MediaAssetOption): Promise; + /** + * Starts image preview, with the first image to preview specified. This method uses an asynchronous callback + * to receive the execution result. + * @since 6 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @param images List of images to preview. + * @param index Sequence number of the first image to preview. + * @param callback Callback used for image preview. No value is returned. + * @deprecated since 9 + */ + startImagePreview(images: Array, index: number, callback: AsyncCallback): void; + /** + * Starts image preview. This method uses an asynchronous callback to receive the execution result. + * @since 6 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @param images List of images to preview. + * @param callback Callback used for image preview. No value is returned. + * @deprecated since 9 + */ + startImagePreview(images: Array, callback: AsyncCallback): void; + /** + * Starts image preview, with the first image to preview specified. + * This method uses a promise to return the execution result. + * @since 6 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @param images List of images to preview. + * @param index Sequence number of the first image to preview. + * @returns Promise used to return whether the operation is successful. + * @deprecated since 9 + */ + startImagePreview(images: Array, index?: number): Promise; + /** + * Starts media selection. This method uses an asynchronous callback to + * return the list of URIs that store the selected media resources. + * @since 6 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @param option Media selection option. + * @param callback Callback used to return the list of URIs that store the selected media resources. + * @deprecated since 9 + */ + startMediaSelect(option: MediaSelectOption, callback: AsyncCallback>): void; + /** + * Starts media selection. This method uses a promise to return the list of URIs + * that store the selected media resources. + * @since 6 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @param option Media selection option. + * @returns Promise used to return the list of URIs that store the selected media resources. + * @deprecated since 9 + */ + startMediaSelect(option: MediaSelectOption): Promise>; + /** + * Release MediaLibrary instance + * @since 8 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @param callback no value returned + * @deprecated since 9 + * @useinstead ohos.file.picker + */ + release(callback: AsyncCallback): void; + /** + * Release MediaLibrary instance + * @since 8 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @deprecated since 9 + * @useinstead ohos.file.picker + */ + release(): Promise; + } + /** + * thumbnail's size which have width and height + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.file.picker + */ + interface Size { + /** + * Width of image file + * @since 8 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @deprecated since 9 + * @useinstead ohos.file.picker + */ + width: number; + /** + * Height of image file + * @since 8 + * @syscap SystemCapability.Multimedia.MediaLibrary.Core + * @deprecated since 9 + * @useinstead ohos.file.picker + */ + height: number; + } +} +export default mediaLibrary; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.multimedia.movingphotoview.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.multimedia.movingphotoview.d.ts new file mode 100755 index 00000000..fe2ef185 --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.multimedia.movingphotoview.d.ts @@ -0,0 +1,213 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file A component which support applications to show moving photo data + * @kit MediaLibraryKit + */ +import photoAccessHelper from './@ohos.file.photoAccessHelper'; +/** + * Defines the moving photo view options. + * + * @interface MovingPhotoViewOptions + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ +declare interface MovingPhotoViewOptions { + /** + * moving photo data. + * + * @type { photoAccessHelper.MovingPhoto } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + movingPhoto: photoAccessHelper.MovingPhoto; + /** + * controller of MovingPhotoView. + * + * @type { ?MovingPhotoViewController } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + controller?: MovingPhotoViewController; +} +/** + * Defines the moving photo view interface. + * + * @interface MovingPhotoViewInterface + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ +interface MovingPhotoViewInterface { + /** + * Set the options. + * + * @param { MovingPhotoViewOptions } options + * @returns { MovingPhotoViewAttribute } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + (options: MovingPhotoViewOptions): MovingPhotoViewAttribute; +} +/** + * function that moving photo view media events callback. + * + * @typedef { function } MovingPhotoViewEventCallback + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + */ +declare type MovingPhotoViewEventCallback = () => void; +/** + * Defines the moving photo view attribute functions. + * + * @extends CommonMethod + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ +declare class MovingPhotoViewAttribute extends CommonMethod { + /** + * Called when judging whether the video is muted. + * + * @param { boolean } isMuted + * @returns { MovingPhotoViewAttribute } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + muted(isMuted: boolean): MovingPhotoViewAttribute; + /** + * Called when determining the zoom type of the view. + * + * @param { ImageFit } value + * @returns { MovingPhotoViewAttribute } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + objectFit(value: ImageFit): MovingPhotoViewAttribute; + /** + * Called when the video is played. + * + * @param { MovingPhotoViewEventCallback } callback + * @returns { MovingPhotoViewAttribute } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + onStart(callback: MovingPhotoViewEventCallback): MovingPhotoViewAttribute; + /** + * Called when the video playback stopped. + * + * @param { MovingPhotoViewEventCallback } callback + * @returns { MovingPhotoViewAttribute } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + onStop(callback: MovingPhotoViewEventCallback): MovingPhotoViewAttribute; + /** + * Called when the video playback ends. + * + * @param { MovingPhotoViewEventCallback } callback + * @returns { MovingPhotoViewAttribute } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + onFinish(callback: MovingPhotoViewEventCallback): MovingPhotoViewAttribute; + /** + * Called when playback fails. + * + * @param { MovingPhotoViewEventCallback } callback + * @returns { MovingPhotoViewAttribute } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + onError(callback: MovingPhotoViewEventCallback): MovingPhotoViewAttribute; +} +/** + * Defines the MovingPhotoView controller. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 11 + */ +export class MovingPhotoViewController { + /** + * constructor. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + constructor(); + /** + * Start play moving photo. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + startPlayback(); + /** + * Stop play moving photo. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + stopPlayback(); +} +/** + * Defines MovingPhotoView Component. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ +declare const MovingPhotoView: MovingPhotoViewInterface; +/** + * Defines MovingPhotoView Component instance. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ +declare const MovingPhotoViewInstance: MovingPhotoViewAttribute; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.multimedia.sendableImage.d.ets b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.multimedia.sendableImage.d.ets new file mode 100755 index 00000000..5fc776e7 --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.multimedia.sendableImage.d.ets @@ -0,0 +1,859 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit ImageKit + */ +import { AsyncCallback } from './@ohos.base'; +import type colorSpaceManager from './@ohos.graphics.colorSpaceManager'; +import type image from './@ohos.multimedia.image'; +import type rpc from './@ohos.rpc'; +import lang from '../arkts/@arkts.lang'; +/** +* This module provides the capability of image codec and access +* @namespace sendableImage +* @syscap SystemCapability.Multimedia.Image.Core +* @crossplatform +* @atomicservice +* @since 12 +*/ +declare namespace sendableImage { + /** + * Describes the size of an image. + * + * @typedef Size + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @form + * @atomicservice + * @since 12 + */ + interface Size extends lang.ISendable { + /** + * Height + * + * @type { number } + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @form + * @atomicservice + * @since 12 + */ + height: number; + /** + * Width + * + * @type { number } + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @form + * @atomicservice + * @since 12 + */ + width: number; + } + /** + * Describes region information. + * + * @typedef Region + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @form + * @atomicservice + * @since 12 + */ + interface Region extends lang.ISendable { + /** + * Image size. + * + * @type { Size } + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @form + * @atomicservice + * @since 12 + */ + size: Size; + /** + * x-coordinate at the upper left corner of the image. + * + * @type { number } + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @form + * @atomicservice + * @since 12 + */ + x: number; + /** + * y-coordinate at the upper left corner of the image. + * + * @type { number } + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @form + * @atomicservice + * @since 12 + */ + y: number; + } + /** + * Creates an ImageSource instance based on the URI. + * + * @param { string } uri Image source URI. + * @returns { ImageSource } returns the ImageSource instance if the operation is successful; returns null otherwise. + * @syscap SystemCapability.Multimedia.Image.ImageSource + * @crossplatform + * @atomicservice + * @since 12 + */ + function createImageSource(uri: string): ImageSource; + /** + * Creates an ImageSource instance based on the file descriptor. + * + * @param { number } fd ID of a file descriptor. + * @returns { ImageSource } Returns the ImageSource instance if the operation is successful; returns null otherwise. + * @syscap SystemCapability.Multimedia.Image.ImageSource + * @crossplatform + * @atomicservice + * @since 12 + */ + function createImageSource(fd: number): ImageSource; + /** + * Creates an ImageSource instance based on the buffer. + * + * @param { ArrayBuffer } buf The buffer of the image. + * @returns { ImageSource } Returns the ImageSource instance if the operation is successful; returns null otherwise. + * @syscap SystemCapability.Multimedia.Image.ImageSource + * @crossplatform + * @form + * @atomicservice + * @since 12 + */ + function createImageSource(buf: ArrayBuffer): ImageSource; + /** + * Creates an ImageReceiver instance. + * + * @param { Size } size - The default {@link Size} in pixels of the Images that this receiver will produce. + * @param { ImageFormat } format - The format of the Image that this receiver will produce. This must be one of the + * {@link ImageFormat} constants. + * @param { number } capacity - The maximum number of images the user will want to access simultaneously. + * @returns { ImageReceiver } Returns the ImageReceiver instance if the operation is successful; returns null otherwise. + * @throws { BusinessError } 401 - The parameter check failed. + * @syscap SystemCapability.Multimedia.Image.ImageReceiver + * @since 12 + */ + function createImageReceiver(size: image.Size, format: image.ImageFormat, capacity: number): ImageReceiver; + type ISendable = lang.ISendable; + /** + * Create PixelMap by data buffer. + * + * @param { ArrayBuffer } colors The image color buffer. + * @param { InitializationOptions } options Initialization options for PixelMap. + * @returns { Promise } A Promise instance used to return the PixelMap object. + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 12 + */ + function createPixelMap(colors: ArrayBuffer, options: image.InitializationOptions): Promise; + /** + * Create PixelMap by data buffer. + * + * @param { ArrayBuffer } colors The image color buffer. + * @param { InitializationOptions } options Initialization options for PixelMap. + * @returns { PixelMap } Returns the instance if the operation is successful;Otherwise, return undefined. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. 3.Parameter verification failed. + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 12 + */ + function createPixelMapSync(colors: ArrayBuffer, options: image.InitializationOptions): PixelMap; + /** + * Creates a PixelMap object based on MessageSequence parameter. + * + * @param { rpc.MessageSequence } sequence - rpc.MessageSequence parameter. + * @returns { PixelMap } Returns the instance if the operation is successful. + * Otherwise, an exception will be thrown. + * @throws { BusinessError } 62980096 - Operation failed. + * @throws { BusinessError } 62980097 - IPC error. + * @throws { BusinessError } 62980115 - Invalid input parameter. + * @throws { BusinessError } 62980105 - Failed to get the data. + * @throws { BusinessError } 62980177 - Abnormal API environment. + * @throws { BusinessError } 62980178 - Failed to create the PixelMap. + * @throws { BusinessError } 62980179 - Abnormal buffer size. + * @throws { BusinessError } 62980180 - FD mapping failed. + * @throws { BusinessError } 62980246 - Failed to read the PixelMap. + * @syscap SystemCapability.Multimedia.Image.Core + * @since 12 + */ + function createPixelMapFromParcel(sequence: rpc.MessageSequence): PixelMap; + /** + * Creates a PixelMap object from surface id. + * + * @param { string } surfaceId - surface id. + * @param { Region } region - The region to surface. + * @returns { Promise } Returns the instance if the operation is successful. + * Otherwise, an exception will be thrown. + * @throws { BusinessError } 62980115 - If the image parameter invalid. + * @throws { BusinessError } 62980105 - Failed to get the data. + * @throws { BusinessError } 62980178 - Failed to create the PixelMap. + * @syscap SystemCapability.Multimedia.Image.Core + * @since 12 + */ + function createPixelMapFromSurface(surfaceId: string, region: image.Region): Promise; + /** + * Creates a sendable image PixelMap from image PixelMap. + * + * @param { image.PixelMap } pixelmap - the src pixelmap. + * @returns { PixelMap } Returns the instance if the operation is successful. + * Otherwise, an exception will be thrown. + * @throws { BusinessError } 401 - If the image parameter invalid. Possible causes: + * 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types. 3.Parameter verification failed. + * @throws { BusinessError } 62980104 - Failed to initialize the internal object. + * @syscap SystemCapability.Multimedia.Image.Core + * @since 12 + */ + function convertFromPixelMap(pixelmap: image.PixelMap): PixelMap; + /** + * Creates a image PixelMap from sendable image PixelMap. + * + * @param { PixelMap } pixelmap - the src pixelmap. + * @returns { image.PixelMap } Returns the instance if the operation is successful. + * Otherwise, an exception will be thrown. + * @throws { BusinessError } 401 - If the image parameter invalid. Possible causes: + * 1.Mandatory parameters are left unspecified. 2.Incorrect parameter types. 3.Parameter verification failed. + * @throws { BusinessError } 62980104 - Failed to initialize the internal object. + * @syscap SystemCapability.Multimedia.Image.Core + * @since 12 + */ + function convertToPixelMap(pixelmap: PixelMap): image.PixelMap; + /** + * Sendable PixelMap instance. + * + * @typedef PixelMap + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @atomicservice + * @since 12 + */ + interface PixelMap extends ISendable { + /** + * Whether the image pixelmap can be edited. + * + * @type { boolean } + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @atomicservice + * @since 12 + */ + readonly isEditable: boolean; + /** + * Reads image pixelmap data and writes the data to an ArrayBuffer. This method uses + * a promise to return the result. + * + * @param { ArrayBuffer } dst A buffer to which the image pixelmap data will be written. + * @returns { Promise } A Promise instance used to return the operation result. + * If the operation fails, an error message is returned. + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @atomicservice + * @since 12 + */ + readPixelsToBuffer(dst: ArrayBuffer): Promise; + /** + * Reads image pixelmap data and writes the data to an ArrayBuffer. + * + * @param { ArrayBuffer } dst A buffer to which the image pixelmap data will be written. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. 3.Parameter verification failed. + * @throws { BusinessError } 501 - Resource Unavailable. + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @atomicservice + * @since 12 + */ + readPixelsToBufferSync(dst: ArrayBuffer): void; + /** + * Reads image pixelmap data in an area. This method uses a promise to return the data read. + * + * @param { PositionArea } area Area from which the image pixelmap data will be read. + * @returns { Promise } A Promise instance used to return the operation result. + * If the operation fails, an error message is returned. + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @atomicservice + * @since 12 + */ + readPixels(area: image.PositionArea): Promise; + /** + * Reads image pixelmap data in an area. + * + * @param { PositionArea } area Area from which the image pixelmap data will be read. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. 3.Parameter verification failed. + * @throws { BusinessError } 501 - Resource Unavailable. + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @atomicservice + * @since 12 + */ + readPixelsSync(area: image.PositionArea): void; + /** + * Writes image pixelmap data to the specified area. This method uses a promise to return + * the operation result. + * + * @param { PositionArea } area Area to which the image pixelmap data will be written. + * @returns { Promise } A Promise instance used to return the operation result. + * If the operation fails, an error message is returned. + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @atomicservice + * @since 12 + */ + writePixels(area: image.PositionArea): Promise; + /** + * Writes image pixelmap data to the specified area. + * + * @param { PositionArea } area Area to which the image pixelmap data will be written. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. 3.Parameter verification failed. + * @throws { BusinessError } 501 - Resource Unavailable. + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @atomicservice + * @since 12 + */ + writePixelsSync(area: image.PositionArea): void; + /** + * Reads image data in an ArrayBuffer and writes the data to a PixelMap object. This method + * uses a promise to return the result. + * + * @param { ArrayBuffer } src A buffer from which the image data will be read. + * @returns { Promise } A Promise instance used to return the operation result. + * If the operation fails, an error message is returned. + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @atomicservice + * @since 12 + */ + writeBufferToPixels(src: ArrayBuffer): Promise; + /** + * Reads image data in an ArrayBuffer and writes the data to a PixelMap object. + * + * @param { ArrayBuffer } src A buffer from which the image data will be read. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. 3.Parameter verification failed. + * @throws { BusinessError } 501 - Resource Unavailable. + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @atomicservice + * @since 12 + */ + writeBufferToPixelsSync(src: ArrayBuffer): void; + /** + * Obtains pixelmap information about this image. This method uses a promise to return the information. + * + * @returns { Promise } A Promise instance used to return the image pixelmap information. + * If the operation fails, an error message is returned. + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @atomicservice + * @since 12 + */ + getImageInfo(): Promise; + /** + * Get image information from image source. + * + * @returns { ImageInfo } the image information. + * @throws { BusinessError } 501 - Resource Unavailable. + * @syscap SystemCapability.Multimedia.Image.ImageSource + * @crossplatform + * @atomicservice + * @since 12 + */ + getImageInfoSync(): image.ImageInfo; + /** + * Obtains the number of bytes in each line of the image pixelmap. + * + * @returns { number } Number of bytes in each line. + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @atomicservice + * @since 12 + */ + getBytesNumberPerRow(): number; + /** + * Obtains the total number of bytes of the image pixelmap. + * + * @returns { number } Total number of bytes. + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @atomicservice + * @since 12 + */ + getPixelBytesNumber(): number; + /** + * Obtains the density of the image pixelmap. + * + * @returns { number } The number of density. + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @atomicservice + * @since 12 + */ + getDensity(): number; + /** + * Set the transparent rate of pixelmap. This method uses a promise to return the result. + * + * @param { number } rate The value of transparent rate. + * @returns { Promise } A Promise instance used to return the operation result. + * If the operation fails, an error message is returned. + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @atomicservice + * @since 12 + */ + opacity(rate: number): Promise; + /** + * Set the transparent rate of pixelmap. + * + * @param { number } rate The value of transparent rate. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. 3.Parameter verification failed. + * @throws { BusinessError } 501 - Resource Unavailable. + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @atomicservice + * @since 12 + */ + opacitySync(rate: number): void; + /** + * Obtains new pixelmap with alpha information. This method uses a promise to return the information. + * + * @returns { Promise } A Promise instance used to return the new image pixelmap. + * If the operation fails, an error message is returned. + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @atomicservice + * @since 12 + */ + createAlphaPixelmap(): Promise; + /** + * Obtains new pixelmap with alpha information. + * + * @returns { PixelMap } return the new image pixelmap. + * If the operation fails, an error message is returned. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Parameter verification failed. + * @throws { BusinessError } 501 - Resource Unavailable. + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @atomicservice + * @since 12 + */ + createAlphaPixelmapSync(): PixelMap; + /** + * Image zoom in width and height. This method uses a promise to return the result. + * + * @param { number } x The zoom value of width. + * @param { number } y The zoom value of height. + * @returns { Promise } A Promise instance used to return the operation result. + * If the operation fails, an error message is returned. + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @atomicservice + * @since 12 + */ + scale(x: number, y: number): Promise; + /** + * Image zoom in width and height. + * + * @param { number } x The zoom value of width. + * @param { number } y The zoom value of height. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. 3.Parameter verification failed. + * @throws { BusinessError } 501 - Resource Unavailable. + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @atomicservice + * @since 12 + */ + scaleSync(x: number, y: number): void; + /** + * Image position transformation. This method uses a promise to return the result. + * + * @param { number } x The position value of width. + * @param { number } y The position value of height. + * @returns { Promise } A Promise instance used to return the operation result. + * If the operation fails, an error message is returned. + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @atomicservice + * @since 12 + */ + translate(x: number, y: number): Promise; + /** + * Image position transformation. + * + * @param { number } x The position value of width. + * @param { number } y The position value of height. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. 3.Parameter verification failed. + * @throws { BusinessError } 501 - Resource Unavailable. + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @atomicservice + * @since 12 + */ + translateSync(x: number, y: number): void; + /** + * Image rotation. This method uses a promise to return the result. + * + * @param { number } angle The rotation angle. + * @returns { Promise } A Promise instance used to return the operation result. + * If the operation fails, an error message is returned. + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @atomicservice + * @since 12 + */ + rotate(angle: number): Promise; + /** + * Image rotation. + * + * @param { number } angle The rotation angle. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. 3.Parameter verification failed. + * @throws { BusinessError } 501 - Resource Unavailable. + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @atomicservice + * @since 12 + */ + rotateSync(angle: number): void; + /** + * Image flipping. This method uses a promise to return the result. + * + * @param { boolean } horizontal Is flip in horizontal. + * @param { boolean } vertical Is flip in vertical. + * @returns { Promise } A Promise instance used to return the operation result. + * If the operation fails, an error message is returned. + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @atomicservice + * @since 12 + */ + flip(horizontal: boolean, vertical: boolean): Promise; + /** + * Image flipping. + * + * @param { boolean } horizontal Is flip in horizontal. + * @param { boolean } vertical Is flip in vertical. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. 3.Parameter verification failed. + * @throws { BusinessError } 501 - Resource Unavailable. + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @atomicservice + * @since 12 + */ + flipSync(horizontal: boolean, vertical: boolean): void; + /** + * Crop the image. This method uses a promise to return the result. + * + * @param { Region } region The region to crop. + * @returns { Promise } A Promise instance used to return the operation result. + * If the operation fails, an error message is returned. + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @atomicservice + * @since 12 + */ + crop(region: image.Region): Promise; + /** + * Crop the image. + * + * @param { Region } region The region to crop. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. 3.Parameter verification failed. + * @throws { BusinessError } 501 - Resource Unavailable. + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @atomicservice + * @since 12 + */ + cropSync(region: image.Region): void; + /** + * Get color space of pixelmap. + * + * @returns { colorSpaceManager.ColorSpaceManager } If the operation fails, an error message is returned. + * @throws { BusinessError } 62980101 - If the image data abnormal. + * @throws { BusinessError } 62980103 - If the image data unsupport. + * @throws { BusinessError } 62980115 - If the image parameter invalid. + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 12 + */ + getColorSpace(): colorSpaceManager.ColorSpaceManager; + /** + * Set color space of pixelmap. + * + * This method is only used to set the colorspace property of PixelMap, + * while all pixel data remains the same after calling this method. + * If you want to change colorspace for all pixels, use method + * {@Link #applyColorSpace(colorSpaceManager.ColorSpaceManager)}. + * + * @param { colorSpaceManager.ColorSpaceManager } colorSpace The color space for pixelmap. + * @throws { BusinessError } 62980111 - If the operation invalid. + * @throws { BusinessError } 62980115 - If the image parameter invalid. + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 12 + */ + setColorSpace(colorSpace: colorSpaceManager.ColorSpaceManager): void; + /** + * Is it stride Alignment + * + * @type { boolean } + * @readonly + * @syscap SystemCapability.Multimedia.Image.Core + * @since 12 + */ + readonly isStrideAlignment: boolean; + /** + * Apply color space of pixelmap, the pixels will be changed by input color space. + * This method uses a promise to return the result. + * + * This method is used to change color space of PixelMap. + * Pixel data will be changed by calling this method. + * If you want to set the colorspace property of PixelMap only, + * use method {@Link #setColorSpace(colorSpaceManager.ColorSpaceManager)}. + * + * @param { colorSpaceManager.ColorSpaceManager } targetColorSpace - The color space for pixelmap. + * @returns { Promise } A Promise instance used to return the operation result. + * If the operation fails, an error message is returned. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. 3.Parameter verification failed. + * @throws { BusinessError } 62980104 - Failed to initialize the internal object. + * @throws { BusinessError } 62980108 - Failed to convert the color space. + * @throws { BusinessError } 62980115 - Invalid image parameter. + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @since 12 + */ + applyColorSpace(targetColorSpace: colorSpaceManager.ColorSpaceManager): Promise; + /** + * Releases this PixelMap object. This method uses a promise to return the result. + * + * @returns { Promise } A Promise instance used to return the instance release result. + * If the operation fails, an error message is returned. + * @syscap SystemCapability.Multimedia.Image.Core + * @crossplatform + * @atomicservice + * @since 12 + */ + release(): Promise; + /** + * Marshalling PixelMap and write into MessageSequence. + * + * @param { rpc.MessageSequence } sequence rpc.MessageSequence parameter. + * @throws { BusinessError } 62980115 - Invalid image parameter. + * @throws { BusinessError } 62980097 - IPC error. + * @syscap SystemCapability.Multimedia.Image.Core + * @since 12 + */ + marshalling(sequence: rpc.MessageSequence): void; + /** + * Creates a PixelMap object based on MessageSequence parameter. + * + * @param { rpc.MessageSequence } sequence rpc.MessageSequence parameter. + * @returns { Promise } A Promise instance used to return the PixelMap object. + * @throws { BusinessError } 62980115 - Invalid image parameter. + * @throws { BusinessError } 62980097 - IPC error. + * @throws { BusinessError } 62980096 - The operation failed. + * @syscap SystemCapability.Multimedia.Image.Core + * @since 12 + */ + unmarshalling(sequence: rpc.MessageSequence): Promise; + } + /** + * ImageSource instance. + * + * @typedef ImageSource + * @syscap SystemCapability.Multimedia.Image.ImageSource + * @crossplatform + * @form + * @atomicservice + * @since 12 + */ + interface ImageSource { + /** + * Creates a PixelMap object based on image decoding parameters. This method uses a promise to + * return the object. + * + * @param { DecodingOptions } options Image decoding parameters. + * @returns { Promise } A Promise instance used to return the PixelMap object. + * @syscap SystemCapability.Multimedia.Image.ImageSource + * @crossplatform + * @form + * @atomicservice + * @since 12 + */ + createPixelMap(options?: image.DecodingOptions): Promise; + /** + * Releases an ImageSource instance and uses a promise to return the result. + * + * @returns { Promise } A Promise instance used to return the operation result. + * @syscap SystemCapability.Multimedia.Image.ImageSource + * @crossplatform + * @since 12 + */ + release(): Promise; + } + /** + * Provides basic image operations, including obtaining image information, and reading and writing image data. + * + * @typedef Image + * @syscap SystemCapability.Multimedia.Image.Core + * @since 12 + */ + interface Image extends lang.ISendable { + /** + * Sets or gets the image area to crop, default is size. + * + * @type { Region } + * @syscap SystemCapability.Multimedia.Image.Core + * @since 12 + */ + clipRect: Region; + /** + * Image size. + * + * @type { Size } + * @syscap SystemCapability.Multimedia.Image.Core + * @since 12 + */ + readonly size: Size; + /** + * Image format. + * + * @type { number } + * @syscap SystemCapability.Multimedia.Image.Core + * @since 12 + */ + readonly format: number; + /** + * Image timestamp. + * + * @type { number } + * @syscap SystemCapability.Multimedia.Image.Core + * @since 12 + */ + readonly timestamp: number; + /** + * Get component buffer from image and uses a promise to return the result. + * + * @param { ComponentType } componentType The component type of image. + * @returns { Promise } A Promise instance used to return the component buffer. + * @syscap SystemCapability.Multimedia.Image.Core + * @since 12 + */ + getComponent(componentType: image.ComponentType): Promise; + /** + * Release current image to receive another and uses a promise to return the result. + * + * @returns { Promise } A Promise instance used to return the operation result. + * @syscap SystemCapability.Multimedia.Image.Core + * @since 12 + */ + release(): Promise; + } + /** + * Image receiver object. + * + * @typedef ImageReceiver + * @syscap SystemCapability.Multimedia.Image.ImageReceiver + * @since 12 + */ + interface ImageReceiver { + /** + * Image size. + * + * @type { Size } + * @syscap SystemCapability.Multimedia.Image.ImageReceiver + * @since 12 + */ + readonly size: image.Size; + /** + * Image capacity. + * + * @type { number } + * @syscap SystemCapability.Multimedia.Image.ImageReceiver + * @since 12 + */ + readonly capacity: number; + /** + * Image format. + * + * @type { ImageFormat } + * @syscap SystemCapability.Multimedia.Image.ImageReceiver + * @since 12 + */ + readonly format: image.ImageFormat; + /** + * Get an id which indicates a surface and can be used to set to Camera or other component can receive a surface + * and uses a promise to return the result. + * + * @returns { Promise } A Promise instance used to return the surface id. + * @syscap SystemCapability.Multimedia.Image.ImageReceiver + * @since 12 + */ + getReceivingSurfaceId(): Promise; + /** + * Get lasted image from receiver and uses a promise to return the result. + * + * @returns { Promise } A Promise instance used to return the latest image. + * @syscap SystemCapability.Multimedia.Image.ImageReceiver + * @since 12 + */ + readLatestImage(): Promise; + /** + * Get next image from receiver and uses a promise to return the result. + * + * @returns { Promise } A Promise instance used to return the next image. + * @syscap SystemCapability.Multimedia.Image.ImageReceiver + * @since 12 + */ + readNextImage(): Promise; + /** + * Subscribe callback when receiving an image + * + * @param { 'imageArrival' } type Callback used to return the next image. + * @param { AsyncCallback } callback Callback used to return image. + * @syscap SystemCapability.Multimedia.Image.ImageReceiver + * @since 12 + */ + on(type: 'imageArrival', callback: AsyncCallback): void; + /** + * Release image receiver instance and uses a promise to return the result. + * + * @returns { Promise } A Promise instance used to return the operation result. + * @syscap SystemCapability.Multimedia.Image.ImageReceiver + * @since 12 + */ + release(): Promise; + } +} +export default sendableImage; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.multimodalInput.gestureEvent.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.multimodalInput.gestureEvent.d.ts new file mode 100755 index 00000000..8ca96cde --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.multimodalInput.gestureEvent.d.ts @@ -0,0 +1,180 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit InputKit + */ +/** + * Pinch event on touchPad + * + * @interface Pinch + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 10 + */ +export declare interface Pinch { + /** + * Action type + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 10 + */ + type: ActionType; + /** + * scale + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 10 + */ + scale: number; +} +/** + * Rotate event on touchPad + * + * @interface Rotate + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 11 + */ +export declare interface Rotate { + /** + * Action type + * + * @type { ActionType } + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 11 + */ + type: ActionType; + /** + * Rotate angle + * + * @type { number } + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 11 + */ + angle: number; +} +/** + * Three fingers swipe event on touchPad + * + * @interface ThreeFingersSwipe + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 10 + */ +export declare interface ThreeFingersSwipe { + /** + * Action type + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 10 + */ + type: ActionType; + /** + * Coordinate x + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 10 + */ + x: number; + /** + * Coordinate y + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 10 + */ + y: number; +} +/** + * Four fingers swipe event on touchPad + * + * @interface FourFingersSwipe + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 10 + */ +export declare interface FourFingersSwipe { + /** + * Action type + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 10 + */ + type: ActionType; + /** + * Coordinate x + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 10 + */ + x: number; + /** + * Coordinate y + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 10 + */ + y: number; +} +/** + * Three fingers tap event on touchPad + * + * @interface ThreeFingersTap + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 11 + */ +export declare interface ThreeFingersTap { + /** + * Action type + * + * @type { ActionType } + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 11 + */ + type: ActionType; +} +/** + * Gesture action type + * + * @enum { number } + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 10 + */ +export declare enum ActionType { + /** + * Cancel of the gesture + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 10 + */ + CANCEL = 0, + /** + * Begin of the gesture + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 10 + */ + BEGIN = 1, + /** + * Update of the gesture + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 10 + */ + UPDATE = 2, + /** + * End of the gesture + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 10 + */ + END = 3 +} diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.multimodalInput.infraredEmitter.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.multimodalInput.infraredEmitter.d.ts new file mode 100755 index 00000000..2c388f4e --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.multimodalInput.infraredEmitter.d.ts @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit InputKit + */ +/** + * Declares the APIs for configuring attributes of the IR emitter. + * + * @namespace infraredEmitter + * @syscap SystemCapability.MultimodalInput.Input.InfraredEmitter + * @since 12 + */ +declare namespace infraredEmitter { +} +export default infraredEmitter; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.multimodalInput.inputDevice.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.multimodalInput.inputDevice.d.ts new file mode 100755 index 00000000..58482382 --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.multimodalInput.inputDevice.d.ts @@ -0,0 +1,467 @@ +/* + * Copyright (c) 2021-2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit InputKit + */ +import type { Callback, AsyncCallback } from './@ohos.base'; +import type { KeyCode } from './@ohos.multimodalInput.keyCode'; +/** + * The input device management module is configured to obtain an ID and device information of an input device. + * + * @namespace inputDevice + * @syscap SystemCapability.MultimodalInput.Input.InputDevice + * @since 8 + */ +declare namespace inputDevice { + /** + * Add or remove device + * + * @syscap SystemCapability.MultimodalInput.Input.InputDevice + * @since 9 + */ + type ChangedType = 'add' | 'remove'; + /** + * The type of input device + * + * @syscap SystemCapability.MultimodalInput.Input.InputDevice + * @since 9 + */ + type SourceType = 'keyboard' | 'mouse' | 'touchpad' | 'touchscreen' | 'joystick' | 'trackball'; + /** + * Axis Type of the input event + * + * @syscap SystemCapability.MultimodalInput.Input.InputDevice + * @since 9 + */ + type AxisType = 'touchmajor' | 'touchminor' | 'orientation' | 'x' | 'y' | 'pressure' | 'toolminor' | 'toolmajor' | 'null'; + /** + * @enum { number } + * @syscap SystemCapability.MultimodalInput.Input.InputDevice + * @since 9 + */ + enum KeyboardType { + /** + * None + * + * @syscap SystemCapability.MultimodalInput.Input.InputDevice + * @since 9 + */ + NONE = 0, + /** + * Unknown key + * + * @syscap SystemCapability.MultimodalInput.Input.InputDevice + * @since 9 + */ + UNKNOWN = 1, + /** + * Alphabetical keyboard + * + * @syscap SystemCapability.MultimodalInput.Input.InputDevice + * @since 9 + */ + ALPHABETIC_KEYBOARD = 2, + /** + * Digital keyboard + * + * @syscap SystemCapability.MultimodalInput.Input.InputDevice + * @since 9 + */ + DIGITAL_KEYBOARD = 3, + /** + * Stylus + * + * @syscap SystemCapability.MultimodalInput.Input.InputDevice + * @since 9 + */ + HANDWRITING_PEN = 4, + /** + * Remote control + * + * @syscap SystemCapability.MultimodalInput.Input.InputDevice + * @since 9 + */ + REMOTE_CONTROL = 5 + } + /** + * Defines the listener for input device events. + * + * @interface DeviceListener + * @syscap SystemCapability.MultimodalInput.Input.InputDevice + * @since 9 + */ + interface DeviceListener { + /** + * Type of the input device event. The options are add and remove. + * + * @type { ChangedType } + * @syscap SystemCapability.MultimodalInput.Input.InputDevice + * @since 9 + */ + type: ChangedType; + /** + * ID of the input device for the reported input device event. + * + * @type { number } + * @syscap SystemCapability.MultimodalInput.Input.InputDevice + * @since 9 + */ + deviceId: number; + } + /** + * Starts listening for an input device event. + * + * @param { 'change' } type - Type of the input device event, which is **change**. + * @param { Callback } listener - Callback for the input device event. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types; 3. Parameter verification failed. + * @syscap SystemCapability.MultimodalInput.Input.InputDevice + * @since 9 + */ + function on(type: 'change', listener: Callback): void; + /** + * Stops listening for an input device event. + * + * @param { 'change' } type - Type of the input device event, which is **change**. + * @param { Callback } listener - Callback for the input device event. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types; 3. Parameter verification failed. + * @syscap SystemCapability.MultimodalInput.Input.InputDevice + * @since 9 + */ + function off(type: 'change', listener?: Callback): void; + /** + * Defines axis information about events that can be reported by an input device. + * For example, a touchscreen may report information such as x, y, and pressure, + * which indicate the x-axis coordinate, y-axis coordinate, and pressure, respectively. + * + * @interface AxisRange + * @syscap SystemCapability.MultimodalInput.Input.InputDevice + * @since 8 + */ + interface AxisRange { + /** + * Input source type of the axis. For example, if a mouse reports an x-axis event, + * the source of the x-axis is the mouse. + * + * @type { SourceType } + * @syscap SystemCapability.MultimodalInput.Input.InputDevice + * @since 8 + */ + source: SourceType; + /** + * Type of the axis. for example, the x-axis, y-axis, and pressure axis. + * + * @type { AxisType } + * @syscap SystemCapability.MultimodalInput.Input.InputDevice + * @since 8 + */ + axis: AxisType; + /** + * Maximum value of the data reported on this axis. + * + * @type { number } + * @syscap SystemCapability.MultimodalInput.Input.InputDevice + * @since 8 + */ + max: number; + /** + * Minimum value of the data reported on this axis. + * + * @type { number } + * @syscap SystemCapability.MultimodalInput.Input.InputDevice + * @since 8 + */ + min: number; + /** + * Fuzz value of the data reported on this axis. + * + * @type { number } + * @syscap SystemCapability.MultimodalInput.Input.InputDevice + * @since 9 + */ + fuzz: number; + /** + * Flat value of the data reported on this axis. + * + * @type { number } + * @syscap SystemCapability.MultimodalInput.Input.InputDevice + * @since 9 + */ + flat: number; + /** + * Resolution value of the data reported on this axis. + * + * @type { number } + * @syscap SystemCapability.MultimodalInput.Input.InputDevice + * @since 9 + */ + resolution: number; + } + /** + * Defines the information about an input device. + * + * @interface InputDeviceData + * @syscap SystemCapability.MultimodalInput.Input.InputDevice + * @since 8 + */ + interface InputDeviceData { + /** + * Id of the input device. + * + * @type { number } + * @syscap SystemCapability.MultimodalInput.Input.InputDevice + * @since 8 + */ + id: number; + /** + * Name of the input device. + * + * @type { string } + * @syscap SystemCapability.MultimodalInput.Input.InputDevice + * @since 8 + */ + name: string; + /** + * Source type supported by the input device. For example, if a keyboard is attached with a touchpad, + * the device has two input sources: keyboard and touchpad. + * + * @type { Array } + * @syscap SystemCapability.MultimodalInput.Input.InputDevice + * @since 8 + */ + sources: Array; + /** + * Axis range of the input device. + * + * @type { Array } + * @syscap SystemCapability.MultimodalInput.Input.InputDevice + * @since 8 + */ + axisRanges: Array; + /** + * Bus of the input device. + * + * @type { number } + * @syscap SystemCapability.MultimodalInput.Input.InputDevice + * @since 9 + */ + bus: number; + /** + * Product of the input device. + * + * @type { number } + * @syscap SystemCapability.MultimodalInput.Input.InputDevice + * @since 9 + */ + product: number; + /** + * Vendor of the input device. + * + * @type { number } + * @syscap SystemCapability.MultimodalInput.Input.InputDevice + * @since 9 + */ + vendor: number; + /** + * Version of the input device. + * + * @type { number } + * @syscap SystemCapability.MultimodalInput.Input.InputDevice + * @since 9 + */ + version: number; + /** + * Physical path of the input device. + * + * @type { string } + * @syscap SystemCapability.MultimodalInput.Input.InputDevice + * @since 9 + */ + phys: string; + /** + * Unique identifier of the input device. + * + * @type { string } + * @syscap SystemCapability.MultimodalInput.Input.InputDevice + * @since 9 + */ + uniq: string; + } + /** + * Obtains the IDs of all input devices. + * + * @param { AsyncCallback> } callback - Callback function, receive reported data + * @syscap SystemCapability.MultimodalInput.Input.InputDevice + * @since 8 + * @deprecated since 9 + * @useinstead ohos.multimodalInput.inputDevice#getDeviceList + */ + function getDeviceIds(callback: AsyncCallback>): void; + /** + * Obtains the IDs of all input devices. + * + * @returns { Promise> } + * @syscap SystemCapability.MultimodalInput.Input.InputDevice + * @since 8 + * @deprecated since 9 + * @useinstead ohos.multimodalInput.inputDevice#getDeviceList + */ + function getDeviceIds(): Promise>; + /** + * Obtain the information about an input device. + * + * @param { number } deviceId - ID of the input device whose information is to be obtained. + * @param { AsyncCallback } callback - Callback function, receive reported data + * @syscap SystemCapability.MultimodalInput.Input.InputDevice + * @since 8 + * @deprecated since 9 + * @useinstead ohos.multimodalInput.inputDevice#getDeviceInfo + */ + function getDevice(deviceId: number, callback: AsyncCallback): void; + /** + * Obtain the information about an input device. + * + * @param { number } deviceId - ID of the input device whose information is to be obtained. + * @returns { Promise } + * @syscap SystemCapability.MultimodalInput.Input.InputDevice + * @since 8 + * @deprecated since 9 + * @useinstead ohos.multimodalInput.inputDevice#getDeviceInfo + */ + function getDevice(deviceId: number): Promise; + /** + * Obtains the IDs of all input devices. + * + * @param { AsyncCallback> } callback - Callback function, receive reported data + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types; 3. Parameter verification failed. + * @syscap SystemCapability.MultimodalInput.Input.InputDevice + * @since 9 + */ + function getDeviceList(callback: AsyncCallback>): void; + /** + * Obtains the IDs of all input devices. + * + * @returns { Promise> } + * @syscap SystemCapability.MultimodalInput.Input.InputDevice + * @since 9 + */ + function getDeviceList(): Promise>; + /** + * Obtain the information about an input device. + * + * @param { number } deviceId - ID of the input device whose information is to be obtained. + * @param { AsyncCallback } callback - Callback function, receive reported data + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types; 3. Parameter verification failed. + * @syscap SystemCapability.MultimodalInput.Input.InputDevice + * @since 9 + */ + function getDeviceInfo(deviceId: number, callback: AsyncCallback): void; + /** + * Obtain the information about an input device. + * + * @param { number } deviceId - ID of the input device whose information is to be obtained. + * @returns { Promise } + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types; 3. Parameter verification failed. + * @syscap SystemCapability.MultimodalInput.Input.InputDevice + * @since 9 + */ + function getDeviceInfo(deviceId: number): Promise; + /** + * Obtain the information about an input device. + * + * @param { number } deviceId - ID of the input device whose information is to be obtained. + * @returns { InputDeviceData } + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types; 3. Parameter verification failed. + * @syscap SystemCapability.MultimodalInput.Input.InputDevice + * @since 10 + */ + function getDeviceInfoSync(deviceId: number): InputDeviceData; + /** + * Checks whether the specified key codes of an input device are supported. + * + * @param { number } deviceId - ID of the input device. + * @param { Array } keys - Key codes of the input device, You can query maximum of five key codes at a time. + * @param { AsyncCallback> } callback -Indicates whether the specified key codes are supported. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types; 3. Parameter verification failed. + * @syscap SystemCapability.MultimodalInput.Input.InputDevice + * @since 9 + */ + function supportKeys(deviceId: number, keys: Array, callback: AsyncCallback>): void; + /** + * Checks whether the specified key codes of an input device are supported. + * + * @param { number } deviceId - ID of the input device. + * @param { Array } keys - Key codes of the input device, You can query maximum of five key codes at a time. + * @returns { Promise> } Returns a result indicating whether the specified key codes are supported. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types; 3. Parameter verification failed. + * @syscap SystemCapability.MultimodalInput.Input.InputDevice + * @since 9 + */ + function supportKeys(deviceId: number, keys: Array): Promise>; + /** + * Checks whether the specified key codes of an input device are supported. + * + * @param { number } deviceId - ID of the input device. + * @param { Array } keys - Key codes of the input device, You can query maximum of five key codes at a time. + * @returns { Array } Returns a result indicating whether the specified key codes are supported. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types; 3. Parameter verification failed. + * @syscap SystemCapability.MultimodalInput.Input.InputDevice + * @since 10 + */ + function supportKeysSync(deviceId: number, keys: Array): Array; + /** + * Query the keyboard type of the input device. + * + * @param { number } deviceId - ID of the specified input device. + * @param { AsyncCallback } callback - Returns the keyboard type. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types; 3. Parameter verification failed. + * @syscap SystemCapability.MultimodalInput.Input.InputDevice + * @since 9 + */ + function getKeyboardType(deviceId: number, callback: AsyncCallback): void; + /** + * Query the keyboard type of the input device. + * + * @param { number } deviceId - ID of the specified input device. + * @returns { Promise } Returns the keyboard type. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types; 3. Parameter verification failed. + * @syscap SystemCapability.MultimodalInput.Input.InputDevice + * @since 9 + */ + function getKeyboardType(deviceId: number): Promise; + /** + * Query the keyboard type of the input device. + * + * @param { number } deviceId - ID of the specified input device. + * @returns { KeyboardType } Returns the keyboard type. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types; 3. Parameter verification failed. + * @syscap SystemCapability.MultimodalInput.Input.InputDevice + * @since 10 + */ + function getKeyboardTypeSync(deviceId: number): KeyboardType; +} +export default inputDevice; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.multimodalInput.inputDeviceCooperate.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.multimodalInput.inputDeviceCooperate.d.ts new file mode 100755 index 00000000..23da8106 --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.multimodalInput.inputDeviceCooperate.d.ts @@ -0,0 +1,28 @@ +/* +* Copyright (c) 2022-2023 Huawei Device Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +/** + * @file + * @kit InputKit + */ + +/** + * Events for input devices + * + * @since 9 + * @syscap SystemCapability.MultimodalInput.Input.Cooperator + */ +declare namespace inputDeviceCooperate { +} +export default inputDeviceCooperate; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.multimodalInput.inputEvent.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.multimodalInput.inputEvent.d.ts new file mode 100755 index 00000000..613b577c --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.multimodalInput.inputEvent.d.ts @@ -0,0 +1,62 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit InputKit + */ +/** + * InputEvent + * + * @interface InputEvent + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ +export declare interface InputEvent { + /** + * Unique event ID generated by the server + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + id: number; + /** + * ID of the device that reports the input event + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + deviceId: number; + /** + * Occurrence time of the input event + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + actionTime: number; + /** + * ID of the target screen + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + screenId: number; + /** + * ID of the target window + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + windowId: number; +} diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.multimodalInput.intentionCode.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.multimodalInput.intentionCode.d.ts new file mode 100755 index 00000000..992b07eb --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.multimodalInput.intentionCode.d.ts @@ -0,0 +1,231 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS; + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit InputKit + */ +/** + * IntentionCode + * + * @enum { number } + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 10 + */ +/** + * IntentionCode + * + * @enum { number } + * @syscap SystemCapability.MultimodalInput.Input.Core + * @atomicservice + * @since 12 + */ +export declare enum IntentionCode { + /** + * INTENTION_UNKNOWN + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 10 + */ + /** + * INTENTION_UNKNOWN + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @atomicservice + * @since 12 + */ + INTENTION_UNKNOWN = -1, + /** + * INTENTION_UP + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 10 + */ + /** + * INTENTION_UP + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @atomicservice + * @since 12 + */ + INTENTION_UP = 1, + /** + * INTENTION_DOWN + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 10 + */ + /** + * INTENTION_DOWN + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @atomicservice + * @since 12 + */ + INTENTION_DOWN = 2, + /** + * INTENTION_LEFT + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 10 + */ + /** + * INTENTION_LEFT + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @atomicservice + * @since 12 + */ + INTENTION_LEFT = 3, + /** + * INTENTION_RIGHT + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 10 + */ + /** + * INTENTION_RIGHT + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @atomicservice + * @since 12 + */ + INTENTION_RIGHT = 4, + /** + * INTENTION_SELECT + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 10 + */ + /** + * INTENTION_SELECT + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @atomicservice + * @since 12 + */ + INTENTION_SELECT = 5, + /** + * INTENTION_ESCAPE + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 10 + */ + /** + * INTENTION_ESCAPE + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @atomicservice + * @since 12 + */ + INTENTION_ESCAPE = 6, + /** + * INTENTION_BACK + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 10 + */ + /** + * INTENTION_BACK + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @atomicservice + * @since 12 + */ + INTENTION_BACK = 7, + /** + * INTENTION_FORWARD + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 10 + */ + /** + * INTENTION_FORWARD + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @atomicservice + * @since 12 + */ + INTENTION_FORWARD = 8, + /** + * INTENTION_MENU + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 10 + */ + /** + * INTENTION_MENU + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @atomicservice + * @since 12 + */ + INTENTION_MENU = 9, + /** + * INTENTION_PAGE_UP + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 10 + */ + /** + * INTENTION_PAGE_UP + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @atomicservice + * @since 12 + */ + INTENTION_PAGE_UP = 11, + /** + * INTENTION_PAGE_DOWN + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 10 + */ + /** + * INTENTION_PAGE_DOWN + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @atomicservice + * @since 12 + */ + INTENTION_PAGE_DOWN = 12, + /** + * INTENTION_ZOOM_OUT + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 10 + */ + /** + * INTENTION_ZOOM_OUT + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @atomicservice + * @since 12 + */ + INTENTION_ZOOM_OUT = 13, + /** + * INTENTION_ZOOM_IN + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 10 + */ + /** + * INTENTION_ZOOM_IN + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @atomicservice + * @since 12 + */ + INTENTION_ZOOM_IN = 14 +} diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.multimodalInput.keyCode.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.multimodalInput.keyCode.d.ts new file mode 100755 index 00000000..958cfddf --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.multimodalInput.keyCode.d.ts @@ -0,0 +1,2337 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS; + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit InputKit + */ +/** + * KeyCode + * + * @enum { number } + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ +export declare enum KeyCode { + /** + * KEYCODE_FN + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_FN = 0, + /** + * KEYCODE_UNKNOWN + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_UNKNOWN = -1, + /** + * KEYCODE_HOME + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_HOME = 1, + /** + * KEYCODE_BACK + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_BACK = 2, + /** + * KEYCODE_MEDIA_PLAY_PAUSE + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_MEDIA_PLAY_PAUSE = 10, + /** + * KEYCODE_MEDIA_STOP + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_MEDIA_STOP = 11, + /** + * KEYCODE_MEDIA_NEXT + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_MEDIA_NEXT = 12, + /** + * KEYCODE_MEDIA_PREVIOUS + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_MEDIA_PREVIOUS = 13, + /** + * KEYCODE_MEDIA_REWIND + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_MEDIA_REWIND = 14, + /** + * KEYCODE_MEDIA_FAST_FORWARD + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_MEDIA_FAST_FORWARD = 15, + /** + * KEYCODE_VOLUME_UP + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_VOLUME_UP = 16, + /** + * KEYCODE_VOLUME_DOWN + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_VOLUME_DOWN = 17, + /** + * KEYCODE_POWER + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_POWER = 18, + /** + * KEYCODE_CAMERA + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_CAMERA = 19, + /** + * KEYCODE_VOLUME_MUTE + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_VOLUME_MUTE = 22, + /** + * KEYCODE_MUTE + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_MUTE = 23, + /** + * KEYCODE_BRIGHTNESS_UP + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_BRIGHTNESS_UP = 40, + /** + * KEYCODE_BRIGHTNESS_DOWN + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_BRIGHTNESS_DOWN = 41, + /** + * KEYCODE_0 + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_0 = 2000, + /** + * KEYCODE_1 + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_1 = 2001, + /** + * KEYCODE_2 + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_2 = 2002, + /** + * KEYCODE_3 + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_3 = 2003, + /** + * KEYCODE_4 + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_4 = 2004, + /** + * KEYCODE_5 + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_5 = 2005, + /** + * KEYCODE_6 + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_6 = 2006, + /** + * KEYCODE_7 + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_7 = 2007, + /** + * KEYCODE_8 + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_8 = 2008, + /** + * KEYCODE_9 + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_9 = 2009, + /** + * KEYCODE_STAR + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_STAR = 2010, + /** + * KEYCODE_POUND + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_POUND = 2011, + /** + * KEYCODE_DPAD_UP + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_DPAD_UP = 2012, + /** + * KEYCODE_DPAD_DOWN + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_DPAD_DOWN = 2013, + /** + * KEYCODE_DPAD_LEFT + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_DPAD_LEFT = 2014, + /** + * KEYCODE_DPAD_RIGHT + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_DPAD_RIGHT = 2015, + /** + * KEYCODE_DPAD_CENTER + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_DPAD_CENTER = 2016, + /** + * KEYCODE_A + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_A = 2017, + /** + * KEYCODE_B + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_B = 2018, + /** + * KEYCODE_C + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_C = 2019, + /** + * KEYCODE_D + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_D = 2020, + /** + * KEYCODE_E + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_E = 2021, + /** + * KEYCODE_F + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_F = 2022, + /** + * KEYCODE_G + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_G = 2023, + /** + * KEYCODE_H + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_H = 2024, + /** + * KEYCODE_I + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_I = 2025, + /** + * KEYCODE_J + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_J = 2026, + /** + * KEYCODE_K + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_K = 2027, + /** + * KEYCODE_L + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_L = 2028, + /** + * KEYCODE_M + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_M = 2029, + /** + * KEYCODE_N + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_N = 2030, + /** + * KEYCODE_O + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_O = 2031, + /** + * KEYCODE_P + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_P = 2032, + /** + * KEYCODE_Q + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_Q = 2033, + /** + * KEYCODE_R + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_R = 2034, + /** + * KEYCODE_S + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_S = 2035, + /** + * KEYCODE_T + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_T = 2036, + /** + * KEYCODE_U + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_U = 2037, + /** + * KEYCODE_V + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_V = 2038, + /** + * KEYCODE_W + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_W = 2039, + /** + * KEYCODE_X + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_X = 2040, + /** + * KEYCODE_Y + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_Y = 2041, + /** + * KEYCODE_Z + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_Z = 2042, + /** + * KEYCODE_COMMA + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_COMMA = 2043, + /** + * KEYCODE_PERIOD + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_PERIOD = 2044, + /** + * KEYCODE_ALT_LEFT + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_ALT_LEFT = 2045, + /** + * KEYCODE_ALT_RIGHT + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_ALT_RIGHT = 2046, + /** + * KEYCODE_SHIFT_LEFT + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_SHIFT_LEFT = 2047, + /** + * KEYCODE_SHIFT_RIGHT + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_SHIFT_RIGHT = 2048, + /** + * KEYCODE_TAB + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_TAB = 2049, + /** + * KEYCODE_SPACE + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_SPACE = 2050, + /** + * KEYCODE_SYM + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_SYM = 2051, + /** + * KEYCODE_EXPLORER + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_EXPLORER = 2052, + /** + * KEYCODE_ENVELOPE + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_ENVELOPE = 2053, + /** + * KEYCODE_ENTER + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_ENTER = 2054, + /** + * KEYCODE_DEL + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_DEL = 2055, + /** + * KEYCODE_GRAVE + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_GRAVE = 2056, + /** + * KEYCODE_MINUS + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_MINUS = 2057, + /** + * KEYCODE_EQUALS + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_EQUALS = 2058, + /** + * KEYCODE_LEFT_BRACKET + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_LEFT_BRACKET = 2059, + /** + * KEYCODE_RIGHT_BRACKET + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_RIGHT_BRACKET = 2060, + /** + * KEYCODE_BACKSLASH + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_BACKSLASH = 2061, + /** + * KEYCODE_SEMICOLON + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_SEMICOLON = 2062, + /** + * KEYCODE_APOSTROPHE + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_APOSTROPHE = 2063, + /** + * KEYCODE_SLASH + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_SLASH = 2064, + /** + * KEYCODE_AT + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_AT = 2065, + /** + * KEYCODE_PLUS + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_PLUS = 2066, + /** + * KEYCODE_MENU + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_MENU = 2067, + /** + * KEYCODE_PAGE_UP + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_PAGE_UP = 2068, + /** + * KEYCODE_PAGE_DOWN + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_PAGE_DOWN = 2069, + /** + * KEYCODE_ESCAPE + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_ESCAPE = 2070, + /** + * KEYCODE_FORWARD_DEL + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_FORWARD_DEL = 2071, + /** + * KEYCODE_CTRL_LEFT + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_CTRL_LEFT = 2072, + /** + * KEYCODE_CTRL_RIGHT + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_CTRL_RIGHT = 2073, + /** + * KEYCODE_CAPS_LOCK + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_CAPS_LOCK = 2074, + /** + * KEYCODE_SCROLL_LOCK + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_SCROLL_LOCK = 2075, + /** + * KEYCODE_META_LEFT + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_META_LEFT = 2076, + /** + * KEYCODE_META_RIGHT + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_META_RIGHT = 2077, + /** + * KEYCODE_FUNCTION + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_FUNCTION = 2078, + /** + * KEYCODE_SYSRQ + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_SYSRQ = 2079, + /** + * KEYCODE_BREAK + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_BREAK = 2080, + /** + * KEYCODE_MOVE_HOME + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_MOVE_HOME = 2081, + /** + * KEYCODE_MOVE_END + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_MOVE_END = 2082, + /** + * KEYCODE_INSERT + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_INSERT = 2083, + /** + * KEYCODE_FORWARD + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_FORWARD = 2084, + /** + * KEYCODE_MEDIA_PLAY + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_MEDIA_PLAY = 2085, + /** + * KEYCODE_MEDIA_PAUSE + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_MEDIA_PAUSE = 2086, + /** + * KEYCODE_MEDIA_CLOSE + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_MEDIA_CLOSE = 2087, + /** + * KEYCODE_MEDIA_EJECT + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_MEDIA_EJECT = 2088, + /** + * KEYCODE_MEDIA_RECORD + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_MEDIA_RECORD = 2089, + /** + * KEYCODE_F1 + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_F1 = 2090, + /** + * KEYCODE_F2 + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_F2 = 2091, + /** + * KEYCODE_F3 + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_F3 = 2092, + /** + * KEYCODE_F4 + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_F4 = 2093, + /** + * KEYCODE_F5 + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_F5 = 2094, + /** + * KEYCODE_F6 + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_F6 = 2095, + /** + * KEYCODE_F7 + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_F7 = 2096, + /** + * KEYCODE_F8 + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_F8 = 2097, + /** + * KEYCODE_F9 + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_F9 = 2098, + /** + * KEYCODE_F10 + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_F10 = 2099, + /** + * KEYCODE_F11 + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_F11 = 2100, + /** + * KEYCODE_F12 + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_F12 = 2101, + /** + * KEYCODE_NUM_LOCK + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_NUM_LOCK = 2102, + /** + * KEYCODE_NUMPAD_0 + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_NUMPAD_0 = 2103, + /** + * KEYCODE_NUMPAD_1 + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_NUMPAD_1 = 2104, + /** + * KEYCODE_NUMPAD_2 + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_NUMPAD_2 = 2105, + /** + * KEYCODE_NUMPAD_3 + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_NUMPAD_3 = 2106, + /** + * KEYCODE_NUMPAD_4 + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_NUMPAD_4 = 2107, + /** + * KEYCODE_NUMPAD_5 + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_NUMPAD_5 = 2108, + /** + * KEYCODE_NUMPAD_6 + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_NUMPAD_6 = 2109, + /** + * KEYCODE_NUMPAD_7 + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_NUMPAD_7 = 2110, + /** + * KEYCODE_NUMPAD_8 + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_NUMPAD_8 = 2111, + /** + * KEYCODE_NUMPAD_9 + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_NUMPAD_9 = 2112, + /** + * KEYCODE_NUMPAD_DIVIDE + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_NUMPAD_DIVIDE = 2113, + /** + * KEYCODE_NUMPAD_MULTIPLY + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_NUMPAD_MULTIPLY = 2114, + /** + * KEYCODE_NUMPAD_SUBTRACT + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_NUMPAD_SUBTRACT = 2115, + /** + * KEYCODE_NUMPAD_ADD + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_NUMPAD_ADD = 2116, + /** + * KEYCODE_NUMPAD_DOT + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_NUMPAD_DOT = 2117, + /** + * KEYCODE_NUMPAD_COMMA + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_NUMPAD_COMMA = 2118, + /** + * KEYCODE_NUMPAD_ENTER + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_NUMPAD_ENTER = 2119, + /** + * KEYCODE_NUMPAD_EQUALS + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_NUMPAD_EQUALS = 2120, + /** + * KEYCODE_NUMPAD_LEFT_PAREN + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_NUMPAD_LEFT_PAREN = 2121, + /** + * KEYCODE_NUMPAD_RIGHT_PAREN + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_NUMPAD_RIGHT_PAREN = 2122, + /** + * KEYCODE_VIRTUAL_MULTITASK + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_VIRTUAL_MULTITASK = 2210, + /** + * KEYCODE_SLEEP + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_SLEEP = 2600, + /** + * KEYCODE_ZENKAKU_HANKAKU + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_ZENKAKU_HANKAKU = 2601, + /** + * KEYCODE_102ND + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_102ND = 2602, + /** + * KEYCODE_RO + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_RO = 2603, + /** + * KEYCODE_KATAKANA + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_KATAKANA = 2604, + /** + * KEYCODE_HIRAGANA + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_HIRAGANA = 2605, + /** + * KEYCODE_HENKAN + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_HENKAN = 2606, + /** + * KEYCODE_KATAKANA_HIRAGANA + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_KATAKANA_HIRAGANA = 2607, + /** + * KEYCODE_MUHENKAN + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_MUHENKAN = 2608, + /** + * KEYCODE_LINEFEED + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_LINEFEED = 2609, + /** + * KEYCODE_MACRO + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_MACRO = 2610, + /** + * KEYCODE_NUMPAD_PLUSMINUS + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_NUMPAD_PLUSMINUS = 2611, + /** + * KEYCODE_SCALE + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_SCALE = 2612, + /** + * KEYCODE_HANGUEL + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_HANGUEL = 2613, + /** + * KEYCODE_HANJA + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_HANJA = 2614, + /** + * KEYCODE_YEN + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_YEN = 2615, + /** + * KEYCODE_STOP + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_STOP = 2616, + /** + * KEYCODE_AGAIN + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_AGAIN = 2617, + /** + * KEYCODE_PROPS + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_PROPS = 2618, + /** + * KEYCODE_UNDO + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_UNDO = 2619, + /** + * KEYCODE_COPY + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_COPY = 2620, + /** + * KEYCODE_OPEN + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_OPEN = 2621, + /** + * KEYCODE_PASTE + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_PASTE = 2622, + /** + * KEYCODE_FIND + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_FIND = 2623, + /** + * KEYCODE_CUT + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_CUT = 2624, + /** + * KEYCODE_HELP + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_HELP = 2625, + /** + * KEYCODE_CALC + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_CALC = 2626, + /** + * KEYCODE_FILE + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_FILE = 2627, + /** + * KEYCODE_BOOKMARKS + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_BOOKMARKS = 2628, + /** + * KEYCODE_NEXT + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_NEXT = 2629, + /** + * KEYCODE_PLAYPAUSE + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_PLAYPAUSE = 2630, + /** + * KEYCODE_PREVIOUS + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_PREVIOUS = 2631, + /** + * KEYCODE_STOPCD + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_STOPCD = 2632, + /** + * KEYCODE_CONFIG + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_CONFIG = 2634, + /** + * KEYCODE_REFRESH + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_REFRESH = 2635, + /** + * KEYCODE_EXIT + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_EXIT = 2636, + /** + * KEYCODE_EDIT + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_EDIT = 2637, + /** + * KEYCODE_SCROLLUP + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_SCROLLUP = 2638, + /** + * KEYCODE_SCROLLDOWN + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_SCROLLDOWN = 2639, + /** + * KEYCODE_NEW + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_NEW = 2640, + /** + * KEYCODE_REDO + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_REDO = 2641, + /** + * KEYCODE_CLOSE + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_CLOSE = 2642, + /** + * KEYCODE_PLAY + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_PLAY = 2643, + /** + * KEYCODE_BASSBOOST + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_BASSBOOST = 2644, + /** + * KEYCODE_PRINT + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_PRINT = 2645, + /** + * KEYCODE_CHAT + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_CHAT = 2646, + /** + * KEYCODE_FINANCE + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_FINANCE = 2647, + /** + * KEYCODE_CANCEL + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_CANCEL = 2648, + /** + * KEYCODE_KBDILLUM_TOGGLE + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_KBDILLUM_TOGGLE = 2649, + /** + * KEYCODE_KBDILLUM_DOWN + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_KBDILLUM_DOWN = 2650, + /** + * KEYCODE_KBDILLUM_UP + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_KBDILLUM_UP = 2651, + /** + * KEYCODE_SEND + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_SEND = 2652, + /** + * KEYCODE_REPLY + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_REPLY = 2653, + /** + * KEYCODE_FORWARDMAIL + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_FORWARDMAIL = 2654, + /** + * KEYCODE_SAVE + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_SAVE = 2655, + /** + * KEYCODE_DOCUMENTS + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_DOCUMENTS = 2656, + /** + * KEYCODE_VIDEO_NEXT + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_VIDEO_NEXT = 2657, + /** + * KEYCODE_VIDEO_PREV + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_VIDEO_PREV = 2658, + /** + * KEYCODE_BRIGHTNESS_CYCLE + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_BRIGHTNESS_CYCLE = 2659, + /** + * KEYCODE_BRIGHTNESS_ZERO + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_BRIGHTNESS_ZERO = 2660, + /** + * KEYCODE_DISPLAY_OFF + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_DISPLAY_OFF = 2661, + /** + * KEYCODE_BTN_MISC + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_BTN_MISC = 2662, + /** + * KEYCODE_GOTO + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_GOTO = 2663, + /** + * KEYCODE_INFO + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_INFO = 2664, + /** + * KEYCODE_PROGRAM + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_PROGRAM = 2665, + /** + * KEYCODE_PVR + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_PVR = 2666, + /** + * KEYCODE_SUBTITLE + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_SUBTITLE = 2667, + /** + * KEYCODE_FULL_SCREEN + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_FULL_SCREEN = 2668, + /** + * KEYCODE_KEYBOARD + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_KEYBOARD = 2669, + /** + * KEYCODE_ASPECT_RATIO + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_ASPECT_RATIO = 2670, + /** + * KEYCODE_PC + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_PC = 2671, + /** + * KEYCODE_TV + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_TV = 2672, + /** + * KEYCODE_TV2 + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_TV2 = 2673, + /** + * KEYCODE_VCR + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_VCR = 2674, + /** + * KEYCODE_VCR2 + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_VCR2 = 2675, + /** + * KEYCODE_SAT + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_SAT = 2676, + /** + * KEYCODE_CD + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_CD = 2677, + /** + * KEYCODE_TAPE + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_TAPE = 2678, + /** + * KEYCODE_TUNER + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_TUNER = 2679, + /** + * KEYCODE_PLAYER + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_PLAYER = 2680, + /** + * KEYCODE_DVD + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_DVD = 2681, + /** + * KEYCODE_AUDIO + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_AUDIO = 2682, + /** + * KEYCODE_VIDEO + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_VIDEO = 2683, + /** + * KEYCODE_MEMO + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_MEMO = 2684, + /** + * KEYCODE_CALENDAR + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_CALENDAR = 2685, + /** + * KEYCODE_RED + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_RED = 2686, + /** + * KEYCODE_GREEN + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_GREEN = 2687, + /** + * KEYCODE_YELLOW + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_YELLOW = 2688, + /** + * KEYCODE_BLUE + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_BLUE = 2689, + /** + * KEYCODE_CHANNELUP + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_CHANNELUP = 2690, + /** + * KEYCODE_CHANNELDOWN + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_CHANNELDOWN = 2691, + /** + * KEYCODE_LAST + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_LAST = 2692, + /** + * KEYCODE_RESTART + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_RESTART = 2693, + /** + * KEYCODE_SLOW + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_SLOW = 2694, + /** + * KEYCODE_SHUFFLE + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_SHUFFLE = 2695, + /** + * KEYCODE_VIDEOPHONE + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_VIDEOPHONE = 2696, + /** + * KEYCODE_GAMES + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_GAMES = 2697, + /** + * KEYCODE_ZOOMIN + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_ZOOMIN = 2698, + /** + * KEYCODE_ZOOMOUT + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_ZOOMOUT = 2699, + /** + * KEYCODE_ZOOMRESET + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_ZOOMRESET = 2700, + /** + * KEYCODE_WORDPROCESSOR + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_WORDPROCESSOR = 2701, + /** + * KEYCODE_EDITOR + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_EDITOR = 2702, + /** + * KEYCODE_SPREADSHEET + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_SPREADSHEET = 2703, + /** + * KEYCODE_GRAPHICSEDITOR + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_GRAPHICSEDITOR = 2704, + /** + * KEYCODE_PRESENTATION + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_PRESENTATION = 2705, + /** + * KEYCODE_DATABASE + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_DATABASE = 2706, + /** + * KEYCODE_NEWS + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_NEWS = 2707, + /** + * KEYCODE_VOICEMAIL + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_VOICEMAIL = 2708, + /** + * KEYCODE_ADDRESSBOOK + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_ADDRESSBOOK = 2709, + /** + * KEYCODE_MESSENGER + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_MESSENGER = 2710, + /** + * KEYCODE_BRIGHTNESS_TOGGLE + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_BRIGHTNESS_TOGGLE = 2711, + /** + * KEYCODE_SPELLCHECK + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_SPELLCHECK = 2712, + /** + * KEYCODE_COFFEE + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_COFFEE = 2713, + /** + * KEYCODE_MEDIA_REPEAT + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_MEDIA_REPEAT = 2714, + /** + * KEYCODE_IMAGES + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_IMAGES = 2715, + /** + * KEYCODE_BUTTONCONFIG + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_BUTTONCONFIG = 2716, + /** + * KEYCODE_TASKMANAGER + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_TASKMANAGER = 2717, + /** + * KEYCODE_JOURNAL + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_JOURNAL = 2718, + /** + * KEYCODE_CONTROLPANEL + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_CONTROLPANEL = 2719, + /** + * KEYCODE_APPSELECT + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_APPSELECT = 2720, + /** + * KEYCODE_SCREENSAVER + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_SCREENSAVER = 2721, + /** + * KEYCODE_ASSISTANT + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_ASSISTANT = 2722, + /** + * KEYCODE_KBD_LAYOUT_NEXT + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_KBD_LAYOUT_NEXT = 2723, + /** + * KEYCODE_BRIGHTNESS_MIN + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_BRIGHTNESS_MIN = 2724, + /** + * KEYCODE_BRIGHTNESS_MAX + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_BRIGHTNESS_MAX = 2725, + /** + * KEYCODE_KBDINPUTASSIST_PREV + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_KBDINPUTASSIST_PREV = 2726, + /** + * KEYCODE_KBDINPUTASSIST_NEXT + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_KBDINPUTASSIST_NEXT = 2727, + /** + * KEYCODE_KBDINPUTASSIST_PREVGROUP + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_KBDINPUTASSIST_PREVGROUP = 2728, + /** + * KEYCODE_KBDINPUTASSIST_NEXTGROUP + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_KBDINPUTASSIST_NEXTGROUP = 2729, + /** + * KEYCODE_KBDINPUTASSIST_ACCEPT + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_KBDINPUTASSIST_ACCEPT = 2730, + /** + * KEYCODE_KBDINPUTASSIST_CANCEL + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_KBDINPUTASSIST_CANCEL = 2731, + /** + * KEYCODE_FRONT + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_FRONT = 2800, + /** + * KEYCODE_SETUP + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_SETUP = 2801, + /** + * KEYCODE_WAKEUP + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_WAKEUP = 2802, + /** + * KEYCODE_SENDFILE + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_SENDFILE = 2803, + /** + * KEYCODE_DELETEFILE + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_DELETEFILE = 2804, + /** + * KEYCODE_XFER + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_XFER = 2805, + /** + * KEYCODE_PROG1 + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_PROG1 = 2806, + /** + * KEYCODE_PROG2 + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_PROG2 = 2807, + /** + * KEYCODE_MSDOS + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_MSDOS = 2808, + /** + * KEYCODE_SCREENLOCK + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_SCREENLOCK = 2809, + /** + * KEYCODE_DIRECTION_ROTATE_DISPLAY + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_DIRECTION_ROTATE_DISPLAY = 2810, + /** + * KEYCODE_CYCLEWINDOWS + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_CYCLEWINDOWS = 2811, + /** + * KEYCODE_COMPUTER + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_COMPUTER = 2812, + /** + * KEYCODE_EJECTCLOSECD + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_EJECTCLOSECD = 2813, + /** + * KEYCODE_ISO + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_ISO = 2814, + /** + * KEYCODE_MOVE + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_MOVE = 2815, + /** + * KEYCODE_F13 + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_F13 = 2816, + /** + * KEYCODE_F14 + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_F14 = 2817, + /** + * KEYCODE_F15 + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_F15 = 2818, + /** + * KEYCODE_F16 + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_F16 = 2819, + /** + * KEYCODE_F17 + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_F17 = 2820, + /** + * KEYCODE_F18 + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_F18 = 2821, + /** + * KEYCODE_F19 + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_F19 = 2822, + /** + * KEYCODE_F20 + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_F20 = 2823, + /** + * KEYCODE_F21 + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_F21 = 2824, + /** + * KEYCODE_F22 + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_F22 = 2825, + /** + * KEYCODE_F23 + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_F23 = 2826, + /** + * KEYCODE_F24 + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_F24 = 2827, + /** + * KEYCODE_PROG3 + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_PROG3 = 2828, + /** + * KEYCODE_PROG4 + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_PROG4 = 2829, + /** + * KEYCODE_DASHBOARD + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_DASHBOARD = 2830, + /** + * KEYCODE_SUSPEND + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_SUSPEND = 2831, + /** + * KEYCODE_HP + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_HP = 2832, + /** + * KEYCODE_SOUND + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_SOUND = 2833, + /** + * KEYCODE_QUESTION + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_QUESTION = 2834, + /** + * KEYCODE_CONNECT + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_CONNECT = 2836, + /** + * KEYCODE_SPORT + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_SPORT = 2837, + /** + * KEYCODE_SHOP + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_SHOP = 2838, + /** + * KEYCODE_ALTERASE + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_ALTERASE = 2839, + /** + * KEYCODE_SWITCHVIDEOMODE + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_SWITCHVIDEOMODE = 2841, + /** + * KEYCODE_BATTERY + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_BATTERY = 2842, + /** + * KEYCODE_BLUETOOTH + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_BLUETOOTH = 2843, + /** + * KEYCODE_WLAN + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_WLAN = 2844, + /** + * KEYCODE_UWB + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_UWB = 2845, + /** + * KEYCODE_WWAN_WIMAX + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_WWAN_WIMAX = 2846, + /** + * KEYCODE_RFKILL + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_RFKILL = 2847, + /** + * KEYCODE_CHANNEL + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_CHANNEL = 3001, + /** + * KEYCODE_BTN_0 + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_BTN_0 = 3100, + /** + * KEYCODE_BTN_1 + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_BTN_1 = 3101, + /** + * KEYCODE_BTN_2 + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_BTN_2 = 3102, + /** + * KEYCODE_BTN_3 + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_BTN_3 = 3103, + /** + * KEYCODE_BTN_4 + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_BTN_4 = 3104, + /** + * KEYCODE_BTN_5 + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_BTN_5 = 3105, + /** + * KEYCODE_BTN_6 + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_BTN_6 = 3106, + /** + * KEYCODE_BTN_7 + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_BTN_7 = 3107, + /** + * KEYCODE_BTN_8 + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_BTN_8 = 3108, + /** + * KEYCODE_BTN_9 + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + KEYCODE_BTN_9 = 3109 +} diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.multimodalInput.keyEvent.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.multimodalInput.keyEvent.d.ts new file mode 100755 index 00000000..418d22b2 --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.multimodalInput.keyEvent.d.ts @@ -0,0 +1,173 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit InputKit + */ +import type { InputEvent } from './@ohos.multimodalInput.inputEvent'; +import type { KeyCode } from './@ohos.multimodalInput.keyCode'; +/** + * Action + * + * @enum { number } + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ +export declare enum Action { + /** + * Cancel key + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + CANCEL = 0, + /** + * Down key + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + DOWN = 1, + /** + * Up key + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + UP = 2 +} +/** + * Key + * + * @interface Key + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ +export declare interface Key { + /** + * Key code + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + code: KeyCode; + /** + * Time when the key is pressed + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + pressedTime: number; + /** + * Device to which the key belongs + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + deviceId: number; +} +/** + * KeyEvent + * + * @interface KeyEvent + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ +export declare interface KeyEvent extends InputEvent { + /** + * Key action + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + action: Action; + /** + * Key that has changed + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + key: Key; + /** + * Unicode character corresponding to the key + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + unicodeChar: number; + /** + * List of pressed keys + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + keys: Key[]; + /** + * Whether ctrlKey is being pressed + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + ctrlKey: boolean; + /** + * Whether altKey is being pressed + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + altKey: boolean; + /** + * Whether shiftKey is being pressed + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + shiftKey: boolean; + /** + * Whether logoKey is being pressed + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + logoKey: boolean; + /** + * Whether fnKey is being pressed + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + fnKey: boolean; + /** + * Whether capsLock is active + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + capsLock: boolean; + /** + * Whether numLock is active + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + numLock: boolean; + /** + * Whether scrollLock is active + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + scrollLock: boolean; +} diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.multimodalInput.mouseEvent.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.multimodalInput.mouseEvent.d.ts new file mode 100755 index 00000000..71672944 --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.multimodalInput.mouseEvent.d.ts @@ -0,0 +1,398 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit InputKit + */ +import type { InputEvent } from './@ohos.multimodalInput.inputEvent'; +import type { KeyCode } from './@ohos.multimodalInput.keyCode'; +/** + * Action + * + * @enum { number } + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ +export declare enum Action { + /** + * Cancel + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + CANCEL = 0, + /** + * Moving of the mouse pointer + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + MOVE = 1, + /** + * Pressing down of the mouse + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + BUTTON_DOWN = 2, + /** + * Lifting of the mouse button + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + BUTTON_UP = 3, + /** + * Beginning of the axis event associated with the mouse + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + AXIS_BEGIN = 4, + /** + * Updating of the axis event associated with the mouse + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + AXIS_UPDATE = 5, + /** + * Ending of the axis event associated with the mouse + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + AXIS_END = 6, + /** + * Indicates a pointer action representing that a finger is pressed on touchpad. + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 11 + */ + ACTION_DOWN = 7, + /** + * Indicates a pointer action representing that a finger leaves touchpad. + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 11 + */ + ACTION_UP = 8 +} +/** + * Mouse button + * + * @enum { number } + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ +export declare enum Button { + /** + * Left button on the mouse + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + LEFT = 0, + /** + * Middle button on the mouse + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + MIDDLE = 1, + /** + * Right button on the mouse + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + RIGHT = 2, + /** + * Side button on the mouse + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + SIDE = 3, + /** + * Extended button on the mouse + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + EXTRA = 4, + /** + * Forward button on the mouse + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + FORWARD = 5, + /** + * Back button on the mouse + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + BACK = 6, + /** + * Task key on the mouse + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + TASK = 7 +} +/** + * Axis + * + * @enum { number } + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ +export declare enum Axis { + /** + * Vertical scroll axis + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + SCROLL_VERTICAL = 0, + /** + * Horizontal scroll axis + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + SCROLL_HORIZONTAL = 1, + /** + * Pinch axis + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + PINCH = 2 +} +/** + * AxisValue + * + * @interface AxisValue + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ +export declare interface AxisValue { + /** + * Axis type + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + axis: Axis; + /** + * Axis value + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + value: number; +} +/** + * ToolType + * + * @enum { number } + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 11 + */ +export declare enum ToolType { + /** + * Unknown type + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 11 + */ + UNKNOWN = 0, + /** + * Mouse + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 11 + */ + MOUSE = 1, + /** + * Joystick + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 11 + */ + JOYSTICK = 2, + /** + * Touch pad + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 11 + */ + TOUCHPAD = 3 +} +/** + * MouseEvent + * + * @interface MouseEvent + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ +export declare interface MouseEvent extends InputEvent { + /** + * Mouse event action + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + action: Action; + /** + * X coordinate of the mouse pointer on the screen + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + screenX: number; + /** + * Y coordinate of the mouse pointer on the screen + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + screenY: number; + /** + * X coordinate of the mouse pointer in the window + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + windowX: number; + /** + * Y coordinate of the mouse pointer in the window + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + windowY: number; + /** + * X axis offset relative to the previous reported mouse pointer position. When the mouse pointer is at + * the edge of the screen, the value may be less than the difference of the X coordinate reported twice. + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + rawDeltaX: number; + /** + * Y axis offset relative to the previous reported mouse pointer position + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + rawDeltaY: number; + /** + * Button that is currently pressed or released + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + button: Button; + /** + * Button that is being pressed + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + pressedButtons: Button[]; + /** + * All axis data contained in the event + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + axes: AxisValue[]; + /** + * List of pressed keys + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + pressedKeys: KeyCode[]; + /** + * Whether ctrlKey is being pressed + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + ctrlKey: boolean; + /** + * Whether altKey is being pressed + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + altKey: boolean; + /** + * Whether shiftKey is being pressed + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + shiftKey: boolean; + /** + * Whether logoKey is being pressed + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + logoKey: boolean; + /** + * Whether fnKey is being pressed + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + fnKey: boolean; + /** + * Whether capsLock is active + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + capsLock: boolean; + /** + * Whether numLock is active + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + numLock: boolean; + /** + * Whether scrollLock is active + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + scrollLock: boolean; + /** + * Tool type + * + * @type { ToolType } + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 11 + */ + toolType: ToolType; +} diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.multimodalInput.pointer.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.multimodalInput.pointer.d.ts new file mode 100755 index 00000000..a537cea6 --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.multimodalInput.pointer.d.ts @@ -0,0 +1,587 @@ +/* + * Copyright (c) 2022-2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit InputKit + */ +import type { AsyncCallback } from './@ohos.base'; +import type image from './@ohos.multimedia.image'; +/** + * Declares interfaces related to mouse pointer attributes. + * + * @namespace pointer + * @syscap SystemCapability.MultimodalInput.Input.Pointer + * @since 9 + */ +/** + * Declares interfaces related to mouse pointer attributes. + * + * @namespace pointer + * @syscap SystemCapability.MultimodalInput.Input.Pointer + * @atomicservice + * @since 12 + */ +declare namespace pointer { + /** + * Pointer style. + * + * @enum { number } + * @syscap SystemCapability.MultimodalInput.Input.Pointer + * @since 9 + */ + /** + * Pointer style. + * + * @enum { number } + * @syscap SystemCapability.MultimodalInput.Input.Pointer + * @atomicservice + * @since 12 + */ + enum PointerStyle { + /** + * Default + * + * @syscap SystemCapability.MultimodalInput.Input.Pointer + * @since 9 + */ + DEFAULT, + /** + * East arrow + * + * @syscap SystemCapability.MultimodalInput.Input.Pointer + * @since 9 + */ + EAST, + /** + * West arrow + * + * @syscap SystemCapability.MultimodalInput.Input.Pointer + * @since 9 + */ + WEST, + /** + * South arrow + * + * @syscap SystemCapability.MultimodalInput.Input.Pointer + * @since 9 + */ + SOUTH, + /** + * North arrow + * + * @syscap SystemCapability.MultimodalInput.Input.Pointer + * @since 9 + */ + NORTH, + /** + * East-west arrow + * + * @syscap SystemCapability.MultimodalInput.Input.Pointer + * @since 9 + */ + WEST_EAST, + /** + * North-south arrow + * + * @syscap SystemCapability.MultimodalInput.Input.Pointer + * @since 9 + */ + NORTH_SOUTH, + /** + * North-east arrow + * + * @syscap SystemCapability.MultimodalInput.Input.Pointer + * @since 9 + */ + NORTH_EAST, + /** + * North-west arrow + * + * @syscap SystemCapability.MultimodalInput.Input.Pointer + * @since 9 + */ + NORTH_WEST, + /** + * South-east arrow + * + * @syscap SystemCapability.MultimodalInput.Input.Pointer + * @since 9 + */ + SOUTH_EAST, + /** + * South-west arrow + * + * @syscap SystemCapability.MultimodalInput.Input.Pointer + * @since 9 + */ + SOUTH_WEST, + /** + * Northeast and southwest adjustment + * + * @syscap SystemCapability.MultimodalInput.Input.Pointer + * @since 9 + */ + NORTH_EAST_SOUTH_WEST, + /** + * Northwest and southeast adjustment + * + * @syscap SystemCapability.MultimodalInput.Input.Pointer + * @since 9 + */ + NORTH_WEST_SOUTH_EAST, + /** + * Cross (accurate selection) + * + * @syscap SystemCapability.MultimodalInput.Input.Pointer + * @since 9 + */ + CROSS, + /** + * Copy + * + * @syscap SystemCapability.MultimodalInput.Input.Pointer + * @since 9 + */ + CURSOR_COPY, + /** + * Forbid + * + * @syscap SystemCapability.MultimodalInput.Input.Pointer + * @since 9 + */ + CURSOR_FORBID, + /** + * Sucker + * + * @syscap SystemCapability.MultimodalInput.Input.Pointer + * @since 9 + */ + COLOR_SUCKER, + /** + * Grabbing hand + * + * @syscap SystemCapability.MultimodalInput.Input.Pointer + * @since 9 + */ + HAND_GRABBING, + /** + * Opening hand + * + * @syscap SystemCapability.MultimodalInput.Input.Pointer + * @since 9 + */ + HAND_OPEN, + /** + * Hand-shaped pointer + * + * @syscap SystemCapability.MultimodalInput.Input.Pointer + * @since 9 + */ + HAND_POINTING, + /** + * Help + * + * @syscap SystemCapability.MultimodalInput.Input.Pointer + * @since 9 + */ + HELP, + /** + * Move + * + * @syscap SystemCapability.MultimodalInput.Input.Pointer + * @since 9 + */ + MOVE, + /** + * Left and right resizing + * + * @syscap SystemCapability.MultimodalInput.Input.Pointer + * @since 9 + */ + RESIZE_LEFT_RIGHT, + /** + * Up and down resizing + * + * @syscap SystemCapability.MultimodalInput.Input.Pointer + * @since 9 + */ + RESIZE_UP_DOWN, + /** + * Screenshot crosshair + * + * @syscap SystemCapability.MultimodalInput.Input.Pointer + * @since 9 + */ + SCREENSHOT_CHOOSE, + /** + * Screenshot + * + * @syscap SystemCapability.MultimodalInput.Input.Pointer + * @since 9 + */ + SCREENSHOT_CURSOR, + /** + * Text selection + * + * @syscap SystemCapability.MultimodalInput.Input.Pointer + * @since 9 + */ + TEXT_CURSOR, + /** + * Zoom in + * + * @syscap SystemCapability.MultimodalInput.Input.Pointer + * @since 9 + */ + ZOOM_IN, + /** + * Zoom out + * + * @syscap SystemCapability.MultimodalInput.Input.Pointer + * @since 9 + */ + ZOOM_OUT, + /** + * Scrolling east + * + * @syscap SystemCapability.MultimodalInput.Input.Pointer + * @since 9 + */ + MIDDLE_BTN_EAST, + /** + * Scrolling west + * + * @syscap SystemCapability.MultimodalInput.Input.Pointer + * @since 9 + */ + MIDDLE_BTN_WEST, + /** + * Scrolling south + * + * @syscap SystemCapability.MultimodalInput.Input.Pointer + * @since 9 + */ + MIDDLE_BTN_SOUTH, + /** + * Scrolling north + * + * @syscap SystemCapability.MultimodalInput.Input.Pointer + * @since 9 + */ + MIDDLE_BTN_NORTH, + /** + * Scrolling north and south + * + * @syscap SystemCapability.MultimodalInput.Input.Pointer + * @since 9 + */ + MIDDLE_BTN_NORTH_SOUTH, + /** + * Scrolling northeast + * + * @syscap SystemCapability.MultimodalInput.Input.Pointer + * @since 9 + */ + MIDDLE_BTN_NORTH_EAST, + /** + * Scrolling northwest + * + * @syscap SystemCapability.MultimodalInput.Input.Pointer + * @since 9 + */ + MIDDLE_BTN_NORTH_WEST, + /** + * Scrolling southeast + * + * @syscap SystemCapability.MultimodalInput.Input.Pointer + * @since 9 + */ + MIDDLE_BTN_SOUTH_EAST, + /** + * Scrolling southwest + * + * @syscap SystemCapability.MultimodalInput.Input.Pointer + * @since 9 + */ + MIDDLE_BTN_SOUTH_WEST, + /** + * Moving as a cone in four directions + * + * @syscap SystemCapability.MultimodalInput.Input.Pointer + * @since 9 + */ + MIDDLE_BTN_NORTH_SOUTH_WEST_EAST, + /** + * Horizontal text selection + * + * @syscap SystemCapability.MultimodalInput.Input.Pointer + * @since 10 + */ + HORIZONTAL_TEXT_CURSOR, + /** + * Precise selection + * + * @syscap SystemCapability.MultimodalInput.Input.Pointer + * @since 10 + */ + CURSOR_CROSS, + /** + * Cursor with circle style + * + * @syscap SystemCapability.MultimodalInput.Input.Pointer + * @since 10 + */ + CURSOR_CIRCLE, + /** + * Loading state with dynamic cursor + * + * @syscap SystemCapability.MultimodalInput.Input.Pointer + * @since 10 + */ + /** + * Loading state with dynamic cursor + * + * @syscap SystemCapability.MultimodalInput.Input.Pointer + * @atomicservice + * @since 12 + */ + LOADING, + /** + * Running state with dynamic cursor + * + * @syscap SystemCapability.MultimodalInput.Input.Pointer + * @since 10 + */ + /** + * Running state with dynamic cursor + * + * @syscap SystemCapability.MultimodalInput.Input.Pointer + * @atomicservice + * @since 12 + */ + RUNNING + } + /** + * Mouse button. + * + * @enum { number } + * @syscap SystemCapability.MultimodalInput.Input.Pointer + * @since 10 + */ + enum PrimaryButton { + /** + * Left mouse button + * + * @syscap SystemCapability.MultimodalInput.Input.Pointer + * @since 10 + */ + LEFT = 0, + /** + * Right mouse button + * + * @syscap SystemCapability.MultimodalInput.Input.Pointer + * @since 10 + */ + RIGHT = 1 + } + /** + * Device right menu type. + * + * @enum { number } + * @syscap SystemCapability.MultimodalInput.Input.Pointer + * @since 10 + */ + enum RightClickType { + /** + * Touchpad right button + * + * @syscap SystemCapability.MultimodalInput.Input.Pointer + * @since 10 + */ + TOUCHPAD_RIGHT_BUTTON = 1, + /** + * Touchpad left button + * + * @syscap SystemCapability.MultimodalInput.Input.Pointer + * @since 10 + */ + TOUCHPAD_LEFT_BUTTON = 2, + /** + * Touchpad two fingers tap + * + * @syscap SystemCapability.MultimodalInput.Input.Pointer + * @since 10 + */ + TOUCHPAD_TWO_FINGER_TAP = 3 + } + /** + * Sets the pointer style. + * + * @param { number } windowId - Window ID. + * @param { PointerStyle } pointerStyle - Pointer style. + * @param { AsyncCallback } callback - Callback used to return the result. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types; 3. Parameter verification failed. + * @syscap SystemCapability.MultimodalInput.Input.Pointer + * @since 9 + */ + function setPointerStyle(windowId: number, pointerStyle: PointerStyle, callback: AsyncCallback): void; + /** + * Sets the pointer style. + * + * @param { number } windowId - Window ID. + * @param { PointerStyle } pointerStyle - Pointer style. + * @returns { Promise } Returns the result through a promise. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types; 3. Parameter verification failed. + * @syscap SystemCapability.MultimodalInput.Input.Pointer + * @since 9 + */ + function setPointerStyle(windowId: number, pointerStyle: PointerStyle): Promise; + /** + * Sets the pointer style through sync mode. + * + * @param { number } windowId - Window ID. + * @param { PointerStyle } pointerStyle - Pointer style. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types; 3. Parameter verification failed. + * @syscap SystemCapability.MultimodalInput.Input.Pointer + * @since 10 + */ + function setPointerStyleSync(windowId: number, pointerStyle: PointerStyle): void; + /** + * Queries the pointer style. + * + * @param { number } windowId - Window ID. + * @param { AsyncCallback } callback - Callback used to return the result. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types; 3. Parameter verification failed. + * @syscap SystemCapability.MultimodalInput.Input.Pointer + * @since 9 + */ + function getPointerStyle(windowId: number, callback: AsyncCallback): void; + /** + * Queries the pointer style. + * + * @param { number } windowId - Window ID. + * @returns { Promise } Returns the result through a promise. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types; 3. Parameter verification failed. + * @syscap SystemCapability.MultimodalInput.Input.Pointer + * @since 9 + */ + function getPointerStyle(windowId: number): Promise; + /** + * Queries the pointer style through sync mode. + * + * @param { number } windowId - Window ID. + * @returns { PointerStyle } Returns the pointerStyle. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types; 3. Parameter verification failed. + * @syscap SystemCapability.MultimodalInput.Input.Pointer + * @since 10 + */ + function getPointerStyleSync(windowId: number): PointerStyle; + /** + * Sets whether the pointer icon is visible. + * + * @param { boolean } visible Whether the pointer icon is visible. The value true indicates that the pointer + * icon is visible, and the value false indicates the opposite. + * @param { AsyncCallback } callback - Callback for the input device event. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types; 3. Parameter verification failed. + * @syscap SystemCapability.MultimodalInput.Input.Pointer + * @since 9 + */ + function setPointerVisible(visible: boolean, callback: AsyncCallback): void; + /** + * Sets whether the pointer icon is visible. + * + * @param { boolean } visible Whether the pointer icon is visible. The value true indicates that the pointer + * icon is visible, and the value false indicates the opposite. + * @returns { Promise } Returns the result through a promise. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types; 3. Parameter verification failed. + * @syscap SystemCapability.MultimodalInput.Input.Pointer + * @since 9 + */ + function setPointerVisible(visible: boolean): Promise; + /** + * Sets whether the pointer icon is visible through sync mode. + * + * @param { boolean } visible Whether the pointer icon is visible. The value true indicates that the pointer + * icon is visible, and the value false indicates the opposite. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types; 3. Parameter verification failed. + * @syscap SystemCapability.MultimodalInput.Input.Pointer + * @since 10 + */ + function setPointerVisibleSync(visible: boolean): void; + /** + * Checks whether the pointer icon is visible. + * + * @param { AsyncCallback } callback - Returns true if the pointer icon is visible, + * returns false otherwise. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types; 3. Parameter verification failed. + * @syscap SystemCapability.MultimodalInput.Input.Pointer + * @since 9 + */ + function isPointerVisible(callback: AsyncCallback): void; + /** + * Checks whether the pointer icon is visible. + * + * @returns { Promise } Returns true if the pointer icon is visible; returns false otherwise. + * @syscap SystemCapability.MultimodalInput.Input.Pointer + * @since 9 + */ + function isPointerVisible(): Promise; + /** + * Checks whether the pointer icon is visible through sync mode. + * + * @returns { boolean } Returns true if the pointer icon is visible, returns false otherwise. + * @syscap SystemCapability.MultimodalInput.Input.Pointer + * @since 10 + */ + function isPointerVisibleSync(): boolean; + /** + * Sets the custom cursor. + * + * @param { number } windowId - Window ID. + * @param { image.PixelMap } pixelMap - the cursor of pixelMap. + * @param { number } focusX - focus x. + * @param { number } focusY - focus y. + * @returns { Promise } Returns the result through a promise. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types; 3. Parameter verification failed. + * @syscap SystemCapability.MultimodalInput.Input.Pointer + * @since 11 + */ + function setCustomCursor(windowId: number, pixelMap: image.PixelMap, focusX?: number, focusY?: number): Promise; + /** + * Sets the custom cursor through sync mode. + * + * @param { number } windowId - Window ID. + * @param { image.PixelMap } pixelMap - the cursor of pixelMap. + * @param { number } focusX - focus x. + * @param { number } focusY - focus y. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types; 3. Parameter verification failed. + * @syscap SystemCapability.MultimodalInput.Input.Pointer + * @since 11 + */ + function setCustomCursorSync(windowId: number, pixelMap: image.PixelMap, focusX?: number, focusY?: number): void; +} +export default pointer; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.multimodalInput.touchEvent.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.multimodalInput.touchEvent.d.ts new file mode 100755 index 00000000..1fc5d15e --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.multimodalInput.touchEvent.d.ts @@ -0,0 +1,323 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit InputKit + */ +import type { InputEvent } from './@ohos.multimodalInput.inputEvent'; +/** + * Action + * + * @enum { number } + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ +export declare enum Action { + /** + * Touch cancelled + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + CANCEL = 0, + /** + * Touch pressed + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + DOWN = 1, + /** + * Touch moved + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + MOVE = 2, + /** + * Touch lifted + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + UP = 3 +} +/** + * ToolType + * + * @enum { number } + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ +export declare enum ToolType { + /** + * Finger + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + FINGER = 0, + /** + * Stylus + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + PEN = 1, + /** + * Rubber + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + RUBBER = 2, + /** + * Brush + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + BRUSH = 3, + /** + * Pencil + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + PENCIL = 4, + /** + * Air brush + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + AIRBRUSH = 5, + /** + * Mouse + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + MOUSE = 6, + /** + * lens + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + LENS = 7 +} +/** + * SourceType + * + * @enum { number } + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ +export declare enum SourceType { + /** + * Touchscreen + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + TOUCH_SCREEN = 0, + /** + * Stylus + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + PEN = 1, + /** + * Touchpad + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + TOUCH_PAD = 2 +} +/** + * Touch + * + * @interface Touch + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ +export declare interface Touch { + /** + * Pointer identifier + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + id: number; + /** + * Time stamp when touch is pressed + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + pressedTime: number; + /** + * X coordinate of the touch position on the screen + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + screenX: number; + /** + * Y coordinate of the touch position on the screen + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + screenY: number; + /** + * X coordinate of the touch position in the window + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + windowX: number; + /** + * Y coordinate of the touch position in the window + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + windowY: number; + /** + * Pressure value. The value range is [0.0, 1.0]. The value 0.0 indicates that the pressure is not supported. + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + pressure: number; + /** + * Width of the contact area when touch is pressed + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + width: number; + /** + * Height of the contact area when touch is pressed + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + height: number; + /** + * Angle relative to the YZ plane. The value range is [-90, 90]. A positive value indicates a rightward tilt. + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + tiltX: number; + /** + * Angle relative to the XZ plane. The value range is [-90, 90]. A positive value indicates a downward tilt. + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + tiltY: number; + /** + * Center point X of the tool area + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + toolX: number; + /** + * Center point Y of the tool area + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + toolY: number; + /** + * Width of the tool area + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + toolWidth: number; + /** + * Height of the tool area + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + toolHeight: number; + /** + * X coordinate of the input device + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + rawX: number; + /** + * Y coordinate of the input device + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + rawY: number; + /** + * Tool type + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + toolType: ToolType; +} +/** + * TouchEvent + * + * @interface TouchEvent + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ +export declare interface TouchEvent extends InputEvent { + /** + * Touch action + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + action: Action; + /** + * Current touch point + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + touch: Touch; + /** + * All touch points + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + touches: Touch[]; + /** + * Device type of the touch source + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @since 9 + */ + sourceType: SourceType; +} diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.net.connection.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.net.connection.d.ts new file mode 100755 index 00000000..6f3a006f --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.net.connection.d.ts @@ -0,0 +1,1688 @@ +/* + * Copyright (C) 2022-2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit NetworkKit + */ +import type { AsyncCallback, Callback } from './@ohos.base'; +import type http from './@ohos.net.http'; +import type socket from './@ohos.net.socket'; +/** + * Provides interfaces to manage and use data networks. + * @namespace connection + * @syscap SystemCapability.Communication.NetManager.Core + * @since 8 + */ +/** + * Provides interfaces to manage and use data networks. + * @namespace connection + * @syscap SystemCapability.Communication.NetManager.Core + * @crossplatform + * @since 10 + */ +/** + * Provides interfaces to manage and use data networks. + * @namespace connection + * @syscap SystemCapability.Communication.NetManager.Core + * @crossplatform + * @atomicservice + * @since 11 + */ +declare namespace connection { + /** + * Get an HTTP request task. + * @syscap SystemCapability.Communication.NetStack + * @since 8 + */ + /** + * Get an HTTP request task. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + /** + * Get an HTTP request task. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @atomicservice + * @since 11 + */ + type HttpRequest = http.HttpRequest; + /** + * Get a TCPSocket object. + * @syscap SystemCapability.Communication.NetStack + * @since 8 + */ + /** + * Get a TCPSocket object. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + type TCPSocket = socket.TCPSocket; + /** + * Get a UDPSocket object. + * @syscap SystemCapability.Communication.NetStack + * @since 8 + */ + /** + * Get a UDPSocket object. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + type UDPSocket = socket.UDPSocket; + /** + * Create a network connection with optional netSpecifier and timeout. + * @param { NetSpecifier } [netSpecifier] - Indicates the network specifier. See {@link NetSpecifier}. + * @param { number } [timeout] - The time in milliseconds to attempt looking for a suitable network before + * {@link NetConnection#netUnavailable} is called. + * @returns { NetConnection } the NetConnection of the NetSpecifier. + * @syscap SystemCapability.Communication.NetManager.Core + * @since 8 + */ + /** + * Create a network connection with optional netSpecifier and timeout. + * @param { NetSpecifier } [netSpecifier] - Indicates the network specifier. See {@link NetSpecifier}. + * @param { number } [timeout] - The time in milliseconds to attempt looking for a suitable network before + * {@link NetConnection#netUnavailable} is called. + * @returns { NetConnection } the NetConnection of the NetSpecifier. + * @syscap SystemCapability.Communication.NetManager.Core + * @crossplatform + * @since 10 + */ + /** + * Create a network connection with optional netSpecifier and timeout. + * @param { NetSpecifier } [netSpecifier] - Indicates the network specifier. See {@link NetSpecifier}. + * @param { number } [timeout] - The time in milliseconds to attempt looking for a suitable network before + * {@link NetConnection#netUnavailable} is called. + * @returns { NetConnection } the NetConnection of the NetSpecifier. + * @syscap SystemCapability.Communication.NetManager.Core + * @crossplatform + * @atomicservice + * @since 11 + */ + function createNetConnection(netSpecifier?: NetSpecifier, timeout?: number): NetConnection; + /** + * Obtains the data network that is activated by default. + * To call this method, you must have the {@code ohos.permission.GET_NETWORK_INFO} permission. + * @permission ohos.permission.GET_NETWORK_INFO + * @param { AsyncCallback } callback - the callback of getDefaultNet. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 2100002 - Failed to connect to the service. + * @throws { BusinessError } 2100003 - System internal error. + * @syscap SystemCapability.Communication.NetManager.Core + * @since 8 + */ + /** + * Obtains the data network that is activated by default. + * To call this method, you must have the {@code ohos.permission.GET_NETWORK_INFO} permission. + * @permission ohos.permission.GET_NETWORK_INFO + * @param { AsyncCallback } callback - the callback of getDefaultNet. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 2100002 - Failed to connect to the service. + * @throws { BusinessError } 2100003 - System internal error. + * @syscap SystemCapability.Communication.NetManager.Core + * @atomicservice + * @since 11 + */ + function getDefaultNet(callback: AsyncCallback): void; + /** + * Obtains the data network that is activated by default. + * To call this method, you must have the {@code ohos.permission.GET_NETWORK_INFO} permission. + * @permission ohos.permission.GET_NETWORK_INFO + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 2100002 - Failed to connect to the service. + * @throws { BusinessError } 2100003 - System internal error. + * @syscap SystemCapability.Communication.NetManager.Core + * @since 8 + */ + /** + * Obtains the data network that is activated by default. + * To call this method, you must have the {@code ohos.permission.GET_NETWORK_INFO} permission. + * @permission ohos.permission.GET_NETWORK_INFO + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 2100002 - Failed to connect to the service. + * @throws { BusinessError } 2100003 - System internal error. + * @syscap SystemCapability.Communication.NetManager.Core + * @atomicservice + * @since 11 + */ + function getDefaultNet(): Promise; + /** + * Obtains the data network that is activated by default. + * To call this method, you must have the {@code ohos.permission.GET_NETWORK_INFO} permission. + * @permission ohos.permission.GET_NETWORK_INFO + * @returns { NetHandle } if the default network is not activated. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 2100002 - Failed to connect to the service. + * @throws { BusinessError } 2100003 - System internal error. + * @syscap SystemCapability.Communication.NetManager.Core + * @since 9 + */ + /** + * Obtains the data network that is activated by default. + * To call this method, you must have the {@code ohos.permission.GET_NETWORK_INFO} permission. + * @permission ohos.permission.GET_NETWORK_INFO + * @returns { NetHandle } if the default network is not activated. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 2100002 - Failed to connect to the service. + * @throws { BusinessError } 2100003 - System internal error. + * @syscap SystemCapability.Communication.NetManager.Core + * @atomicservice + * @since 11 + */ + function getDefaultNetSync(): NetHandle; + /** + * Obtains the list of data networks that are activated. + * To invoke this method, you must have the {@code ohos.permission.GET_NETWORK_INFO} permission. + * @permission ohos.permission.GET_NETWORK_INFO + * @param { AsyncCallback> } callback - the callback of getAllNets. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 2100002 - Failed to connect to the service. + * @throws { BusinessError } 2100003 - System internal error. + * @syscap SystemCapability.Communication.NetManager.Core + * @since 8 + */ + function getAllNets(callback: AsyncCallback>): void; + /** + * Obtains the list of data networks that are activated. + * To invoke this method, you must have the {@code ohos.permission.GET_NETWORK_INFO} permission. + * @permission ohos.permission.GET_NETWORK_INFO + * @returns { Promise> } The promise returned by the function. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 2100002 - Failed to connect to the service. + * @throws { BusinessError } 2100003 - System internal error. + * @syscap SystemCapability.Communication.NetManager.Core + * @since 8 + */ + function getAllNets(): Promise>; + /** + * Obtains the list of data networks that are activated. + * To call this method, you must have the {@code ohos.permission.GET_NETWORK_INFO} permission. + * @permission ohos.permission.GET_NETWORK_INFO + * @returns { Array } Returns data networks that are activated. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 2100002 - Failed to connect to the service. + * @throws { BusinessError } 2100003 - System internal error. + * @syscap SystemCapability.Communication.NetManager.Core + * @since 10 + */ + function getAllNetsSync(): Array; + /** + * Queries the connection properties of a network. + * This method requires the {@code ohos.permission.GET_NETWORK_INFO} permission. + * @permission ohos.permission.GET_NETWORK_INFO + * @param { NetHandle } netHandle - Indicates the network to be queried. + * @param { AsyncCallback } callback - the callback of getConnectionProperties.{@link ConnectionProperties}. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 2100001 - Invalid parameter value. + * @throws { BusinessError } 2100002 - Failed to connect to the service. + * @throws { BusinessError } 2100003 - System internal error. + * @syscap SystemCapability.Communication.NetManager.Core + * @since 8 + */ + function getConnectionProperties(netHandle: NetHandle, callback: AsyncCallback): void; + /** + * Queries the connection properties of a network. + * This method requires the {@code ohos.permission.GET_NETWORK_INFO} permission. + * @permission ohos.permission.GET_NETWORK_INFO + * @param { NetHandle } netHandle - Indicates the network to be queried. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 2100001 - Invalid parameter value. + * @throws { BusinessError } 2100002 - Failed to connect to the service. + * @throws { BusinessError } 2100003 - System internal error. + * @syscap SystemCapability.Communication.NetManager.Core + * @since 8 + */ + function getConnectionProperties(netHandle: NetHandle): Promise; + /** + * Queries the connection properties of a network. + * This method requires the {@code ohos.permission.GET_NETWORK_INFO} permission. + * @permission ohos.permission.GET_NETWORK_INFO + * @param { NetHandle } netHandle - Indicates the network to be queried. + * @returns { ConnectionProperties } Returns the connection properties of a network. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 2100001 - Invalid parameter value. + * @throws { BusinessError } 2100002 - Failed to connect to the service. + * @throws { BusinessError } 2100003 - System internal error. + * @syscap SystemCapability.Communication.NetManager.Core + * @since 10 + */ + function getConnectionPropertiesSync(netHandle: NetHandle): ConnectionProperties; + /** + * Obtains {@link NetCapabilities} of a {@link NetHandle} object. + * To invoke this method, you must have the {@code ohos.permission.GET_NETWORK_INFO} permission. + * @permission ohos.permission.GET_NETWORK_INFO + * @param { NetHandle } netHandle - Indicates the handle. See {@link NetHandle}. + * @param { AsyncCallback } callback - the callback of getNetCapabilities.{@link NetCapabilities}. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 2100001 - Invalid parameter value. + * @throws { BusinessError } 2100002 - Failed to connect to the service. + * @throws { BusinessError } 2100003 - System internal error. + * @syscap SystemCapability.Communication.NetManager.Core + * @since 8 + */ + /** + * Obtains {@link NetCapabilities} of a {@link NetHandle} object. + * To invoke this method, you must have the {@code ohos.permission.GET_NETWORK_INFO} permission. + * @permission ohos.permission.GET_NETWORK_INFO + * @param { NetHandle } netHandle - Indicates the handle. See {@link NetHandle}. + * @param { AsyncCallback } callback - the callback of getNetCapabilities.{@link NetCapabilities}. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 2100001 - Invalid parameter value. + * @throws { BusinessError } 2100002 - Failed to connect to the service. + * @throws { BusinessError } 2100003 - System internal error. + * @syscap SystemCapability.Communication.NetManager.Core + * @atomicservice + * @since 11 + */ + function getNetCapabilities(netHandle: NetHandle, callback: AsyncCallback): void; + /** + * Obtains {@link NetCapabilities} of a {@link NetHandle} object. + * To invoke this method, you must have the {@code ohos.permission.GET_NETWORK_INFO} permission. + * @permission ohos.permission.GET_NETWORK_INFO + * @param { NetHandle } netHandle - Indicates the handle. See {@link NetHandle}. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 2100001 - Invalid parameter value. + * @throws { BusinessError } 2100002 - Failed to connect to the service. + * @throws { BusinessError } 2100003 - System internal error. + * @syscap SystemCapability.Communication.NetManager.Core + * @since 8 + */ + /** + * Obtains {@link NetCapabilities} of a {@link NetHandle} object. + * To invoke this method, you must have the {@code ohos.permission.GET_NETWORK_INFO} permission. + * @permission ohos.permission.GET_NETWORK_INFO + * @param { NetHandle } netHandle - Indicates the handle. See {@link NetHandle}. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 2100001 - Invalid parameter value. + * @throws { BusinessError } 2100002 - Failed to connect to the service. + * @throws { BusinessError } 2100003 - System internal error. + * @syscap SystemCapability.Communication.NetManager.Core + * @atomicservice + * @since 11 + */ + function getNetCapabilities(netHandle: NetHandle): Promise; + /** + * Obtains {@link NetCapabilities} of a {@link NetHandle} object. + * To invoke this method, you must have the {@code ohos.permission.GET_NETWORK_INFO} permission. + * @permission ohos.permission.GET_NETWORK_INFO + * @param { NetHandle } netHandle - Indicates the handle. See {@link NetHandle}. + * @returns { NetCapabilities } Returns the connection capabilities of a network. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 2100001 - Invalid parameter value. + * @throws { BusinessError } 2100002 - Failed to connect to the service. + * @throws { BusinessError } 2100003 - System internal error. + * @syscap SystemCapability.Communication.NetManager.Core + * @since 10 + */ + /** + * Obtains {@link NetCapabilities} of a {@link NetHandle} object. + * To invoke this method, you must have the {@code ohos.permission.GET_NETWORK_INFO} permission. + * @permission ohos.permission.GET_NETWORK_INFO + * @param { NetHandle } netHandle - Indicates the handle. See {@link NetHandle}. + * @returns { NetCapabilities } Returns the connection capabilities of a network. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 2100001 - Invalid parameter value. + * @throws { BusinessError } 2100002 - Failed to connect to the service. + * @throws { BusinessError } 2100003 - System internal error. + * @syscap SystemCapability.Communication.NetManager.Core + * @atomicservice + * @since 11 + */ + function getNetCapabilitiesSync(netHandle: NetHandle): NetCapabilities; + /** + * Checks whether data traffic usage on the current network is metered. + * @permission ohos.permission.GET_NETWORK_INFO + * @param { AsyncCallback } callback - Returns {@code true} if data traffic usage on the current network is metered; + * returns {@code false} otherwise. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 2100002 - Failed to connect to the service. + * @throws { BusinessError } 2100003 - System internal error. + * @syscap SystemCapability.Communication.NetManager.Core + * @since 9 + */ + function isDefaultNetMetered(callback: AsyncCallback): void; + /** + * Checks whether data traffic usage on the current network is metered. + * @permission ohos.permission.GET_NETWORK_INFO + * @returns { Promise } the promise returned by the function. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 2100002 - Failed to connect to the service. + * @throws { BusinessError } 2100003 - System internal error. + * @syscap SystemCapability.Communication.NetManager.Core + * @since 9 + */ + function isDefaultNetMetered(): Promise; + /** + * Checks whether data traffic usage on the current network is metered. + * @permission ohos.permission.GET_NETWORK_INFO + * @returns { boolean } Returns true if the current network is metered, else returns false. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 2100002 - Failed to connect to the service. + * @throws { BusinessError } 2100003 - System internal error. + * @syscap SystemCapability.Communication.NetManager.Core + * @since 10 + */ + function isDefaultNetMeteredSync(): boolean; + /** + * Checks whether the default data network is activated. + * @permission ohos.permission.GET_NETWORK_INFO + * @param { AsyncCallback } callback - Returns {@code true} if the default data network is activated; + * returns {@code false} otherwise. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 2100002 - Failed to connect to the service. + * @throws { BusinessError } 2100003 - System internal error. + * @syscap SystemCapability.Communication.NetManager.Core + * @since 8 + */ + /** + * Checks whether the default data network is activated. + * @permission ohos.permission.GET_NETWORK_INFO + * @param { AsyncCallback } callback - Returns {@code true} if the default data network is activated; + * returns {@code false} otherwise. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 2100002 - Failed to connect to the service. + * @throws { BusinessError } 2100003 - System internal error. + * @syscap SystemCapability.Communication.NetManager.Core + * @crossplatform + * @since 10 + */ + function hasDefaultNet(callback: AsyncCallback): void; + /** + * Checks whether the default data network is activated. + * @permission ohos.permission.GET_NETWORK_INFO + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 2100002 - Failed to connect to the service. + * @throws { BusinessError } 2100003 - System internal error. + * @syscap SystemCapability.Communication.NetManager.Core + * @since 8 + */ + /** + * Checks whether the default data network is activated. + * @permission ohos.permission.GET_NETWORK_INFO + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 2100002 - Failed to connect to the service. + * @throws { BusinessError } 2100003 - System internal error. + * @syscap SystemCapability.Communication.NetManager.Core + * @crossplatform + * @since 10 + */ + function hasDefaultNet(): Promise; + /** + * Checks whether the default data network is activated. + * @permission ohos.permission.GET_NETWORK_INFO + * @returns { boolean } Returns true if the default data network is activated, else returns false. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 2100002 - Failed to connect to the service. + * @throws { BusinessError } 2100003 - System internal error. + * @syscap SystemCapability.Communication.NetManager.Core + * @since 10 + */ + function hasDefaultNetSync(): boolean; + /** + * Reports the network state is connected. + * @permission ohos.permission.GET_NETWORK_INFO and ohos.permission.INTERNET + * @param { NetHandle } netHandle - Indicates the network whose state is to be reported. + * @param { AsyncCallback } callback - the callback of reportNetConnected. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 2100001 - Invalid parameter value. + * @throws { BusinessError } 2100002 - Failed to connect to the service. + * @throws { BusinessError } 2100003 - System internal error. + * @syscap SystemCapability.Communication.NetManager.Core + * @since 8 + */ + function reportNetConnected(netHandle: NetHandle, callback: AsyncCallback): void; + /** + * Reports the network state is connected. + * @permission ohos.permission.GET_NETWORK_INFO and ohos.permission.INTERNET + * @param { NetHandle } netHandle - Indicates the network whose state is to be reported. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 2100001 - Invalid parameter value. + * @throws { BusinessError } 2100002 - Failed to connect to the service. + * @throws { BusinessError } 2100003 - System internal error. + * @syscap SystemCapability.Communication.NetManager.Core + * @since 8 + */ + function reportNetConnected(netHandle: NetHandle): Promise; + /** + * Reports the network state is disconnected. + * @permission ohos.permission.GET_NETWORK_INFO and ohos.permission.INTERNET + * @param { NetHandle } netHandle - Indicates the network whose state is to be reported. + * @param { AsyncCallback } callback - the callback of reportNetDisconnected. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 2100001 - Invalid parameter value. + * @throws { BusinessError } 2100002 - Failed to connect to the service. + * @throws { BusinessError } 2100003 - System internal error. + * @syscap SystemCapability.Communication.NetManager.Core + * @since 8 + */ + function reportNetDisconnected(netHandle: NetHandle, callback: AsyncCallback): void; + /** + * Reports the network state is disconnected. + * @permission ohos.permission.GET_NETWORK_INFO and ohos.permission.INTERNET + * @param { NetHandle } netHandle - Indicates the network whose state is to be reported. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 2100001 - Invalid parameter value. + * @throws { BusinessError } 2100002 - Failed to connect to the service. + * @throws { BusinessError } 2100003 - System internal error. + * @syscap SystemCapability.Communication.NetManager.Core + * @since 8 + */ + function reportNetDisconnected(netHandle: NetHandle): Promise; + /** + * Resolves the host name to obtain all IP addresses based on the default data network. + * @permission ohos.permission.INTERNET + * @param { string } host - Indicates the host name or the domain. + * @param { AsyncCallback> } callback - Returns the NetAddress list. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 2100001 - Invalid parameter value. + * @throws { BusinessError } 2100002 - Failed to connect to the service. + * @throws { BusinessError } 2100003 - System internal error. + * @syscap SystemCapability.Communication.NetManager.Core + * @since 8 + */ + function getAddressesByName(host: string, callback: AsyncCallback>): void; + /** + * Resolves the host name to obtain all IP addresses based on the default data network. + * @permission ohos.permission.INTERNET + * @param { string } host - Indicates the host name or the domain. + * @returns { Promise> } The promise returned by the function. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 2100001 - Invalid parameter value. + * @throws { BusinessError } 2100002 - Failed to connect to the service. + * @throws { BusinessError } 2100003 - System internal error. + * @syscap SystemCapability.Communication.NetManager.Core + * @since 8 + */ + function getAddressesByName(host: string): Promise>; + /** + * Obtains the {@link NetHandle} bound to a process using {@link setAppNet}. + * @param { AsyncCallback } callback - Returns the {@link NetHandle} bound to the process; + * returns {@code null} if no {@link NetHandle} is bound to the process.For details, see {@link NetHandle}. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 2100002 - Failed to connect to the service. + * @throws { BusinessError } 2100003 - System internal error. + * @syscap SystemCapability.Communication.NetManager.Core + * @since 9 + */ + function getAppNet(callback: AsyncCallback): void; + /** + * Obtains the {@link NetHandle} bound to a process using {@link setAppNet}. + * @returns { Promise } the promise returned by the function. + * @throws { BusinessError } 2100002 - Failed to connect to the service. + * @throws { BusinessError } 2100003 - System internal error. + * @syscap SystemCapability.Communication.NetManager.Core + * @since 9 + */ + function getAppNet(): Promise; + /** + * Obtains the {@link NetHandle} bound to a process using {@link setAppNet}. + * @returns { NetHandle } Returns the {@link NetHandle} bound to a process using {@link setAppNet}. + * @throws { BusinessError } 2100002 - Failed to connect to the service. + * @throws { BusinessError } 2100003 - System internal error. + * @syscap SystemCapability.Communication.NetManager.Core + * @since 10 + */ + function getAppNetSync(): NetHandle; + /** + * Binds a process to {@code NetHandle}. + *

All the sockets created from the process will be bound to the {@code NetHandle}, + * and the resolution of all host names will be managed by the {@code NetHandle}.

+ * @permission ohos.permission.INTERNET + * @param { NetHandle } netHandle - Indicates the handle. For details, see {@link NetHandle}. + * @param { AsyncCallback } callback - the callback of setAppNet. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 2100001 - Invalid parameter value. + * @throws { BusinessError } 2100002 - Failed to connect to the service. + * @throws { BusinessError } 2100003 - System internal error. + * @syscap SystemCapability.Communication.NetManager.Core + * @since 9 + */ + function setAppNet(netHandle: NetHandle, callback: AsyncCallback): void; + /** + * Binds a process to {@code NetHandle}. + *

All the sockets created from the process will be bound to the {@code NetHandle}, + * and the resolution of all host names will be managed by the {@code NetHandle}.

+ * @permission ohos.permission.INTERNET + * @param { NetHandle } netHandle - Indicates the handle. For details, see {@link NetHandle}. + * @returns { Promise } the promise returned by the function. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 2100001 - Invalid parameter value. + * @throws { BusinessError } 2100002 - Failed to connect to the service. + * @throws { BusinessError } 2100003 - System internal error. + * @syscap SystemCapability.Communication.NetManager.Core + * @since 9 + */ + function setAppNet(netHandle: NetHandle): Promise; + /** + * Obtains the default {@link HttpProxy} proxy settings. + * + * If an application level proxy is set, the application level proxy parameters are returned. + * If a global proxy is set, the global proxy parameters are returned. + * If the process is bound to a {@link NetHandle} using {@link setAppNet}, the {@link NetHandle} proxy settings are returned. + * In other cases, the proxy settings of default network are returned. + * + * @param { AsyncCallback } callback - Returns the default {@link HttpProxy} settings. + * @throws { BusinessError } 2100002 - Failed to connect to the service. + * @throws { BusinessError } 2100003 - System internal error. + * @syscap SystemCapability.Communication.NetManager.Core + * @since 10 + */ + function getDefaultHttpProxy(callback: AsyncCallback): void; + /** + * Obtains the default {@link HttpProxy} proxy settings. + * + * If an application level proxy is set, the application level proxy parameters are returned. + * If a global proxy is set, the global proxy parameters are returned. + * If the process is bound to a {@link NetHandle} using {@link setAppNet}, the {@link NetHandle} proxy settings are returned. + * In other cases, the proxy settings of default network are returned. + * + * @returns { Promise } the promise returned by the function. + * @throws { BusinessError } 2100002 - Failed to connect to the service. + * @throws { BusinessError } 2100003 - System internal error. + * @syscap SystemCapability.Communication.NetManager.Core + * @since 10 + */ + function getDefaultHttpProxy(): Promise; + /** + * Set application level http proxy {@link HttpProxy}. + * @param { HttpProxy } httpProxy - Indicates the application level proxy settings. For details, see {@link HttpProxy}. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 2100001 - Invalid http proxy. + * @syscap SystemCapability.Communication.NetManager.Core + * @since 11 + */ + function setAppHttpProxy(httpProxy: HttpProxy): void; + /** + * Add a custom {@link host} and corresponding {@link ip} mapping for current application. + * @permission ohos.permission.INTERNET + * @param { string } host - Indicates the host name or the domain. + * @param { Array } ip - List of IP addresses mapped to the host name. + * @param { AsyncCallback } callback - Returns the callback of addCustomDnsRule. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 2100001 - Invalid parameter value. + * @throws { BusinessError } 2100002 - Failed to connect to the service. + * @throws { BusinessError } 2100003 - System internal error. + * @syscap SystemCapability.Communication.NetManager.Core + * @since 11 + */ + function addCustomDnsRule(host: string, ip: Array, callback: AsyncCallback): void; + /** + * Add a custom {@link host} and corresponding {@link ip} mapping for current application. + * @permission ohos.permission.INTERNET + * @param { string } host - Indicates the host name or the domain. + * @param { Array } ip - List of IP addresses mapped to the host name. + * @returns { Promise } the promise returned by the function. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 2100001 - Invalid parameter value. + * @throws { BusinessError } 2100002 - Failed to connect to the service. + * @throws { BusinessError } 2100003 - System internal error. + * @syscap SystemCapability.Communication.NetManager.Core + * @since 11 + */ + function addCustomDnsRule(host: string, ip: Array): Promise; + /** + * Remove the custom DNS rule of the {@link host} for current application. + * @permission ohos.permission.INTERNET + * @param { string } host - Indicates the host name or the domain. + * @param { AsyncCallback } callback - Returns the callback of removeCustomDnsRule. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 2100001 - Invalid parameter value. + * @throws { BusinessError } 2100002 - Failed to connect to the service. + * @throws { BusinessError } 2100003 - System internal error. + * @syscap SystemCapability.Communication.NetManager.Core + * @since 11 + */ + function removeCustomDnsRule(host: string, callback: AsyncCallback): void; + /** + * Remove the custom DNS rule of the {@link host} for current application. + * @permission ohos.permission.INTERNET + * @param { string } host - Indicates the host name or the domain. + * @returns { Promise } the promise returned by the function. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 2100001 - Invalid parameter value. + * @throws { BusinessError } 2100002 - Failed to connect to the service. + * @throws { BusinessError } 2100003 - System internal error. + * @syscap SystemCapability.Communication.NetManager.Core + * @since 11 + */ + function removeCustomDnsRule(host: string): Promise; + /** + * Clear all custom DNS rules for current application. + * @permission ohos.permission.INTERNET + * @param { AsyncCallback } callback - Returns the callback of clearCustomDnsRules. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 2100001 - Invalid parameter value. + * @throws { BusinessError } 2100002 - Failed to connect to the service. + * @throws { BusinessError } 2100003 - System internal error. + * @syscap SystemCapability.Communication.NetManager.Core + * @since 11 + */ + function clearCustomDnsRules(callback: AsyncCallback): void; + /** + * Clear all custom DNS rules for current application. + * @permission ohos.permission.INTERNET + * @returns { Promise } the promise returned by the function. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 2100001 - Invalid parameter value. + * @throws { BusinessError } 2100002 - Failed to connect to the service. + * @throws { BusinessError } 2100003 - System internal error. + * @syscap SystemCapability.Communication.NetManager.Core + * @since 11 + */ + function clearCustomDnsRules(): Promise; + /** + * Represents the network connection handle. + * @interface NetConnection + * @syscap SystemCapability.Communication.NetManager.Core + * @since 8 + */ + /** + * Represents the network connection handle. + * @interface NetConnection + * @syscap SystemCapability.Communication.NetManager.Core + * @crossplatform + * @since 10 + */ + /** + * Represents the network connection handle. + * @interface NetConnection + * @syscap SystemCapability.Communication.NetManager.Core + * @crossplatform + * @atomicservice + * @since 11 + */ + export interface NetConnection { + /** + * Registers a listener for netAvailable events. + * @param { 'netAvailable' } type - Indicates Event name. + * @param { Callback } callback - the callback used to return the result. + * @syscap SystemCapability.Communication.NetManager.Core + * @since 8 + */ + /** + * Registers a listener for netAvailable events. + * @param { 'netAvailable' } type - Indicates Event name. + * @param { Callback } callback - the callback used to return the result. + * @syscap SystemCapability.Communication.NetManager.Core + * @crossplatform + * @since 10 + */ + /** + * Registers a listener for netAvailable events. + * @param { 'netAvailable' } type - Indicates Event name. + * @param { Callback } callback - the callback used to return the result. + * @syscap SystemCapability.Communication.NetManager.Core + * @crossplatform + * @atomicservice + * @since 11 + */ + on(type: 'netAvailable', callback: Callback): void; + /** + * Registers a listener for netBlockStatusChange events. + * @param { 'netBlockStatusChange' } type - Indicates Event name. + * @param { Callback<{ netHandle: NetHandle, blocked: boolean }> } callback - the callback used to return the result. + * @syscap SystemCapability.Communication.NetManager.Core + * @since 8 + */ + /** + * Registers a listener for netBlockStatusChange events. + * @param { 'netBlockStatusChange' } type - Indicates Event name. + * @param { Callback } callback - the callback used to return the result. + * @syscap SystemCapability.Communication.NetManager.Core + * @since 11 + */ + on(type: 'netBlockStatusChange', callback: Callback): void; + /** + * Registers a listener for **netCapabilitiesChange** events. + * @param { 'netCapabilitiesChange' } type - Indicates Event name. + * @param { Callback } callback - the callback used to return the result. + * @syscap SystemCapability.Communication.NetManager.Core + * @since 8 + */ + /** + * Registers a listener for **netCapabilitiesChange** events. + * @param { 'netCapabilitiesChange' } type - Indicates Event name. + * @param { Callback } callback - the callback used to return the result. + * @syscap SystemCapability.Communication.NetManager.Core + * @crossplatform + * @since 10 + */ + /** + * Registers a listener for **netCapabilitiesChange** events. + * @param { 'netCapabilitiesChange' } type - Indicates Event name. + * @param { Callback } callback - the callback used to return the result. + * @syscap SystemCapability.Communication.NetManager.Core + * @crossplatform + * @atomicservice + * @since 11 + */ + on(type: 'netCapabilitiesChange', callback: Callback): void; + /** + * Registers a listener for netConnectionPropertiesChange events. + * @param { 'netConnectionPropertiesChange' } type - Indicates Event name. + * @param { Callback<{ netHandle: NetHandle, connectionProperties: ConnectionProperties }> } callback - the callback used to return the result. + * @syscap SystemCapability.Communication.NetManager.Core + * @since 8 + */ + /** + * Registers a listener for netConnectionPropertiesChange events. + * @param { 'netConnectionPropertiesChange' } type - Indicates Event name. + * @param { Callback } callback - the callback used to return the result. + * @syscap SystemCapability.Communication.NetManager.Core + * @since 11 + */ + on(type: 'netConnectionPropertiesChange', callback: Callback): void; + /** + * Registers a listener for **netLost** events. + * @param { 'netLost' } type - Indicates Event name. + * @param { Callback } callback - the callback used to return the result. + * @syscap SystemCapability.Communication.NetManager.Core + * @since 8 + */ + /** + * Registers a listener for **netLost** events. + * @param { 'netLost' } type - Indicates Event name. + * @param { Callback } callback - the callback used to return the result. + * @syscap SystemCapability.Communication.NetManager.Core + * @crossplatform + * @since 10 + */ + /** + * Registers a listener for **netLost** events. + * @param { 'netLost' } type - Indicates Event name. + * @param { Callback } callback - the callback used to return the result. + * @syscap SystemCapability.Communication.NetManager.Core + * @crossplatform + * @atomicservice + * @since 11 + */ + on(type: 'netLost', callback: Callback): void; + /** + * Registers a listener for netUnavailable events. + * @param { 'netUnavailable' } type - Indicates Event name. + * @param { Callback } callback - the callback used to return the result. + * @syscap SystemCapability.Communication.NetManager.Core + * @since 8 + */ + /** + * Registers a listener for netUnavailable events. + * @param { 'netUnavailable' } type - Indicates Event name. + * @param { Callback } callback - the callback used to return the result. + * @syscap SystemCapability.Communication.NetManager.Core + * @crossplatform + * @since 10 + */ + /** + * Registers a listener for netUnavailable events. + * @param { 'netUnavailable' } type - Indicates Event name. + * @param { Callback } callback - the callback used to return the result. + * @syscap SystemCapability.Communication.NetManager.Core + * @crossplatform + * @atomicservice + * @since 11 + */ + on(type: 'netUnavailable', callback: Callback): void; + /** + * Receives status change notifications of a specified network. + * @permission ohos.permission.GET_NETWORK_INFO + * @param { AsyncCallback } callback - the callback of register. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 2100002 - Failed to connect to the service. + * @throws { BusinessError } 2100003 - System internal error. + * @throws { BusinessError } 2101008 - The callback does not exist. + * @throws { BusinessError } 2101022 - The number of requests exceeded the maximum allowed. + * @syscap SystemCapability.Communication.NetManager.Core + * @since 8 + */ + /** + * Receives status change notifications of a specified network. + * @permission ohos.permission.GET_NETWORK_INFO + * @param { AsyncCallback } callback - the callback of register. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 2100002 - Failed to connect to the service. + * @throws { BusinessError } 2100003 - System internal error. + * @throws { BusinessError } 2101008 - The callback does not exist. + * @throws { BusinessError } 2101022 - The number of requests exceeded the maximum allowed. + * @syscap SystemCapability.Communication.NetManager.Core + * @crossplatform + * @since 10 + */ + /** + * Receives status change notifications of a specified network. + * @permission ohos.permission.GET_NETWORK_INFO + * @param { AsyncCallback } callback - the callback of register. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 2100002 - Failed to connect to the service. + * @throws { BusinessError } 2100003 - System internal error. + * @throws { BusinessError } 2101008 - The callback does not exist. + * @throws { BusinessError } 2101022 - The number of requests exceeded the maximum allowed. + * @syscap SystemCapability.Communication.NetManager.Core + * @crossplatform + * @atomicservice + * @since 11 + */ + register(callback: AsyncCallback): void; + /** + * Cancels listening for network status changes. + * @param { AsyncCallback } callback - the callback of unregister. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 2100002 - Failed to connect to the service. + * @throws { BusinessError } 2100003 - System internal error. + * @throws { BusinessError } 2101007 - The callback is not exists. + * @syscap SystemCapability.Communication.NetManager.Core + * @since 8 + */ + /** + * Cancels listening for network status changes. + * @param { AsyncCallback } callback - the callback of unregister. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 2100002 - Failed to connect to the service. + * @throws { BusinessError } 2100003 - System internal error. + * @throws { BusinessError } 2101007 - The callback is not exists. + * @syscap SystemCapability.Communication.NetManager.Core + * @crossplatform + * @since 10 + */ + /** + * Cancels listening for network status changes. + * @param { AsyncCallback } callback - the callback of unregister. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 2100002 - Failed to connect to the service. + * @throws { BusinessError } 2100003 - System internal error. + * @throws { BusinessError } 2101007 - The callback is not exists. + * @syscap SystemCapability.Communication.NetManager.Core + * @crossplatform + * @atomicservice + * @since 11 + */ + /** + * Cancels listening for network status changes. + * @param { AsyncCallback } callback - the callback of unregister. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 2100002 - Failed to connect to the service. + * @throws { BusinessError } 2100003 - System internal error. + * @throws { BusinessError } 2101007 - The callback is not exists. + * @syscap SystemCapability.Communication.NetManager.Core + * @crossplatform + * @atomicservice + * @since 12 + */ + unregister(callback: AsyncCallback): void; + } + /** + * Provides an instance that bear data network capabilities. + * @interface NetSpecifier + * @syscap SystemCapability.Communication.NetManager.Core + * @since 8 + */ + /** + * Provides an instance that bear data network capabilities. + * @interface NetSpecifier + * @syscap SystemCapability.Communication.NetManager.Core + * @atomicservice + * @since 11 + */ + export interface NetSpecifier { + /** + * The transmission capacity and support of the network's global proxy storage data network. + * @type {NetCapabilities} + * @syscap SystemCapability.Communication.NetManager.Core + * @since 8 + */ + /** + * The transmission capacity and support of the network's global proxy storage data network. + * @type {NetCapabilities} + * @syscap SystemCapability.Communication.NetManager.Core + * @atomicservice + * @since 11 + */ + netCapabilities: NetCapabilities; + /** + * Network identifier, the identifier for Wi Fi networks is "wifi", and the identifier for cellular networks is "simId1" (corresponding to SIM card 1). + * @type {?string} + * @syscap SystemCapability.Communication.NetManager.Core + * @since 8 + */ + /** + * Network identifier, the identifier for Wi Fi networks is "wifi", and the identifier for cellular networks is "simId1" (corresponding to SIM card 1). + * @type {?string} + * @syscap SystemCapability.Communication.NetManager.Core + * @atomicservice + * @since 11 + */ + bearerPrivateIdentifier?: string; + } + /** + * Receive information about changes in network capabilities. + * @interface NetCapabilityInfo + * @syscap SystemCapability.Communication.NetManager.Core + * @crossplatform + * @since 10 + */ + /** + * Receive information about changes in network capabilities. + * @interface NetCapabilityInfo + * @syscap SystemCapability.Communication.NetManager.Core + * @crossplatform + * @atomicservice + * @since 11 + */ + export interface NetCapabilityInfo { + /** + * Defines the handle of the data network. + * @type { NetHandle } + * @syscap SystemCapability.Communication.NetManager.Core + * @crossplatform + * @since 10 + */ + /** + * Defines the handle of the data network. + * @type { NetHandle } + * @syscap SystemCapability.Communication.NetManager.Core + * @crossplatform + * @atomicservice + * @since 11 + */ + netHandle: NetHandle; + /** + * Defines the network capability set. + * @type { NetCapabilities } + * @syscap SystemCapability.Communication.NetManager.Core + * @crossplatform + * @since 10 + */ + /** + * Defines the network capability set. + * @type { NetCapabilities } + * @syscap SystemCapability.Communication.NetManager.Core + * @crossplatform + * @atomicservice + * @since 11 + */ + netCap: NetCapabilities; + } + /** + * Defines the handle of the data network. + * @interface NetHandle + * @syscap SystemCapability.Communication.NetManager.Core + * @since 8 + */ + /** + * Defines the handle of the data network. + * @interface NetHandle + * @syscap SystemCapability.Communication.NetManager.Core + * @crossplatform + * @since 10 + */ + /** + * Defines the handle of the data network. + * @interface NetHandle + * @syscap SystemCapability.Communication.NetManager.Core + * @crossplatform + * @atomicservice + * @since 11 + */ + export interface NetHandle { + /** + * Network ID, a value of 0 means that there is no default network, and the other values must be greater than or equal to 100. + * @type {number} + * @syscap SystemCapability.Communication.NetManager.Core + * @since 8 + */ + /** + * Network ID, a value of 0 means that there is no default network, and the other values must be greater than or equal to 100. + * @type {number} + * @syscap SystemCapability.Communication.NetManager.Core + * @crossplatform + * @since 10 + */ + /** + * Network ID, a value of 0 means that there is no default network, and the other values must be greater than or equal to 100. + * @type {number} + * @syscap SystemCapability.Communication.NetManager.Core + * @crossplatform + * @atomicservice + * @since 11 + */ + netId: number; + /** + *

Binds a TCPSocket or UDPSocket to the current network. All data flows from + * the socket will use this network, without being subject to {@link setAppNet}.

+ * Before using this method, ensure that the socket is disconnected. + * @param { TCPSocket | UDPSocket } socketParam - Indicates the TCPSocket or UDPSocket object. + * @param { AsyncCallback } callback - the callback of bindSocket. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 2100001 - Invalid parameter value. + * @throws { BusinessError } 2100002 - Failed to connect to the service. + * @throws { BusinessError } 2100003 - System internal error. + * @syscap SystemCapability.Communication.NetManager.Core + * @since 9 + */ + bindSocket(socketParam: TCPSocket | UDPSocket, callback: AsyncCallback): void; + /** + *

Binds a TCPSocket or UDPSocket to the current network. All data flows from + * the socket will use this network, without being subject to {@link setAppNet}.

+ * Before using this method, ensure that the socket is disconnected. + * @param { TCPSocket | UDPSocket } socketParam - Indicates the TCPSocket or UDPSocket object. + * @returns { Promise } the promise returned by the function. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 2100001 - Invalid parameter value. + * @throws { BusinessError } 2100002 - Failed to connect to the service. + * @throws { BusinessError } 2100003 - System internal error. + * @syscap SystemCapability.Communication.NetManager.Core + * @since 9 + */ + bindSocket(socketParam: TCPSocket | UDPSocket): Promise; + /** + * Resolves a host name to obtain all IP addresses based on the specified NetHandle. + * @permission ohos.permission.INTERNET + * @param { string } host - Indicates the host name or the domain. + * @param { AsyncCallback> } callback - the callback of getAddressesByName. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 2100001 - Invalid parameter value. + * @throws { BusinessError } 2100002 - Failed to connect to the service. + * @throws { BusinessError } 2100003 - System internal error. + * @syscap SystemCapability.Communication.NetManager.Core + * @since 8 + */ + getAddressesByName(host: string, callback: AsyncCallback>): void; + /** + * Resolves a host name to obtain all IP addresses based on the specified NetHandle. + * @permission ohos.permission.INTERNET + * @param { string } host - Indicates the host name or the domain. + * @returns { Promise> } The promise returned by the function. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 2100001 - Invalid parameter value. + * @throws { BusinessError } 2100002 - Failed to connect to the service. + * @throws { BusinessError } 2100003 - System internal error. + * @syscap SystemCapability.Communication.NetManager.Core + * @since 8 + */ + getAddressesByName(host: string): Promise>; + /** + * Resolves a host name to obtain the first IP address based on the specified NetHandle. + * @permission ohos.permission.INTERNET + * @param { string } host - Indicates the host name or the domain. + * @param { AsyncCallback } callback - the callback of getAddressByName. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 2100001 - Invalid parameter value. + * @throws { BusinessError } 2100002 - Failed to connect to the service. + * @throws { BusinessError } 2100003 - System internal error. + * @syscap SystemCapability.Communication.NetManager.Core + * @since 8 + */ + getAddressByName(host: string, callback: AsyncCallback): void; + /** + * Resolves a host name to obtain the first IP address based on the specified NetHandle. + * @permission ohos.permission.INTERNET + * @param { string } host - Indicates the host name or the domain. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 2100001 - Invalid parameter value. + * @throws { BusinessError } 2100002 - Failed to connect to the service. + * @throws { BusinessError } 2100003 - System internal error. + * @syscap SystemCapability.Communication.NetManager.Core + * @since 8 + */ + getAddressByName(host: string): Promise; + } + /** + * Defines the network capability set. + * @interface NetCapabilities + * @syscap SystemCapability.Communication.NetManager.Core + * @since 8 + */ + /** + * Defines the network capability set. + * @interface NetCapabilities + * @syscap SystemCapability.Communication.NetManager.Core + * @crossplatform + * @since 10 + */ + /** + * Defines the network capability set. + * @interface NetCapabilities + * @syscap SystemCapability.Communication.NetManager.Core + * @crossplatform + * @atomicservice + * @since 11 + */ + export interface NetCapabilities { + /** + * Uplink (device-to-network) bandwidth. + * @type {?number} + * @syscap SystemCapability.Communication.NetManager.Core + * @since 8 + */ + linkUpBandwidthKbps?: number; + /** + * Downstream (network-to-device) bandwidth. + * @type {?number} + * @syscap SystemCapability.Communication.NetManager.Core + * @since 8 + */ + linkDownBandwidthKbps?: number; + /** + * Network-specific capabilities. + * @type {?Array} + * @syscap SystemCapability.Communication.NetManager.Core + * @since 8 + */ + /** + * Network-specific capabilities. + * @type {?Array} + * @syscap SystemCapability.Communication.NetManager.Core + * @atomicservice + * @since 11 + */ + networkCap?: Array; + /** + * Network type. + * @type {Array} + * @syscap SystemCapability.Communication.NetManager.Core + * @since 8 + */ + /** + * Network type. + * @type {Array} + * @syscap SystemCapability.Communication.NetManager.Core + * @crossplatform + * @since 10 + */ + /** + * Network type. + * @type {Array} + * @syscap SystemCapability.Communication.NetManager.Core + * @crossplatform + * @atomicservice + * @since 11 + */ + bearerTypes: Array; + } + /** + * Get information about network connections. + * @interface NetConnectionPropertyInfo + * @syscap SystemCapability.Communication.NetManager.Core + * @since 11 + */ + export interface NetConnectionPropertyInfo { + /** + * Defines the handle of the data network. + * @type { NetHandle } + * @syscap SystemCapability.Communication.NetManager.Core + * @since 11 + */ + netHandle: NetHandle; + /** + * Defines the network connection properties. + * @type { ConnectionProperties } + * @syscap SystemCapability.Communication.NetManager.Core + * @since 11 + */ + connectionProperties: ConnectionProperties; + } + /** + * Get network status information. + * @interface NetBlockStatusInfo + * @syscap SystemCapability.Communication.NetManager.Core + * @since 11 + */ + export interface NetBlockStatusInfo { + /** + * Defines the handle of the data network. + * @type { NetHandle } + * @syscap SystemCapability.Communication.NetManager.Core + * @since 11 + */ + netHandle: NetHandle; + /** + * Check whether the current state is blocked. + * @type { boolean } + * @syscap SystemCapability.Communication.NetManager.Core + * @since 11 + */ + blocked: boolean; + } + /** + * Defines the network capability. + * @enum {number} + * @syscap SystemCapability.Communication.NetManager.Core + * @since 8 + */ + /** + * Defines the network capability. + * @enum {number} + * @syscap SystemCapability.Communication.NetManager.Core + * @atomicservice + * @since 11 + */ + export enum NetCap { + /** + * Indicates that the network can access the carrier's MMSC to send and receive multimedia messages. + * @syscap SystemCapability.Communication.NetManager.Core + * @since 8 + */ + /** + * Indicates that the network can access the carrier's MMSC to send and receive multimedia messages. + * @syscap SystemCapability.Communication.NetManager.Core + * @atomicservice + * @since 11 + */ + NET_CAPABILITY_MMS = 0, + /** + * Indicates that the network traffic is not metered. + * @syscap SystemCapability.Communication.NetManager.Core + * @since 8 + */ + /** + * Indicates that the network traffic is not metered. + * @syscap SystemCapability.Communication.NetManager.Core + * @atomicservice + * @since 11 + */ + NET_CAPABILITY_NOT_METERED = 11, + /** + * Indicates that the network can access the Internet. + * @syscap SystemCapability.Communication.NetManager.Core + * @since 8 + */ + /** + * Indicates that the network can access the Internet. + * @syscap SystemCapability.Communication.NetManager.Core + * @atomicservice + * @since 11 + */ + NET_CAPABILITY_INTERNET = 12, + /** + * Indicates that the network does not use a VPN. + * @syscap SystemCapability.Communication.NetManager.Core + * @since 8 + */ + /** + * Indicates that the network does not use a VPN. + * @syscap SystemCapability.Communication.NetManager.Core + * @atomicservice + * @since 11 + */ + NET_CAPABILITY_NOT_VPN = 15, + /** + * Indicates that the network is available. + * @syscap SystemCapability.Communication.NetManager.Core + * @since 8 + */ + /** + * Indicates that the network is available. + * @syscap SystemCapability.Communication.NetManager.Core + * @atomicservice + * @since 11 + */ + NET_CAPABILITY_VALIDATED = 16, + /** + * Indicates that the network is portal. + * @syscap SystemCapability.Communication.NetManager.Core + * @atomicservice + * @since 12 + */ + NET_CAPABILITY_PORTAL = 17 + } + /** + * Enumerates network types. + * @enum {number} + * @syscap SystemCapability.Communication.NetManager.Core + * @since 8 + */ + /** + * Enumerates network types. + * @enum {number} + * @syscap SystemCapability.Communication.NetManager.Core + * @crossplatform + * @since 10 + */ + /** + * Enumerates network types. + * @enum {number} + * @syscap SystemCapability.Communication.NetManager.Core + * @crossplatform + * @atomicservice + * @since 11 + */ + export enum NetBearType { + /** + * Indicates that the network is based on a cellular network. + * @syscap SystemCapability.Communication.NetManager.Core + * @since 8 + */ + /** + * Indicates that the network is based on a cellular network. + * @syscap SystemCapability.Communication.NetManager.Core + * @crossplatform + * @since 10 + */ + /** + * Indicates that the network is based on a cellular network. + * @syscap SystemCapability.Communication.NetManager.Core + * @crossplatform + * @atomicservice + * @since 11 + */ + BEARER_CELLULAR = 0, + /** + * Indicates that the network is based on a Wi-Fi network. + * @syscap SystemCapability.Communication.NetManager.Core + * @since 8 + */ + /** + * Indicates that the network is based on a Wi-Fi network. + * @syscap SystemCapability.Communication.NetManager.Core + * @crossplatform + * @since 10 + */ + /** + * Indicates that the network is based on a Wi-Fi network. + * @syscap SystemCapability.Communication.NetManager.Core + * @crossplatform + * @atomicservice + * @since 11 + */ + BEARER_WIFI = 1, + /** + * Indicates that the network is an Ethernet network. + * @syscap SystemCapability.Communication.NetManager.Core + * @since 8 + */ + /** + * Indicates that the network is an Ethernet network. + * @syscap SystemCapability.Communication.NetManager.Core + * @atomicservice + * @since 11 + */ + BEARER_ETHERNET = 3, + /** + * Indicates that the network is based on a VPN network. + * @syscap SystemCapability.Communication.NetManager.Core + * @since 12 + */ + BEARER_VPN = 4 + } + /** + * Defines the network connection properties. + * @interface ConnectionProperties + * @syscap SystemCapability.Communication.NetManager.Core + * @since 8 + */ + export interface ConnectionProperties { + /** + * Network card name. + * @type {string} + * @syscap SystemCapability.Communication.NetManager.Core + * @since 8 + */ + interfaceName: string; + /** + * Domain. The default value is "". + * @type {string} + * @syscap SystemCapability.Communication.NetManager.Core + * @since 8 + */ + domains: string; + /** + * Link information. + * @type {Array} + * @syscap SystemCapability.Communication.NetManager.Core + * @since 8 + */ + linkAddresses: Array; + /** + * Network address, refer to [NetAddress]. + * @type {Array} + * @syscap SystemCapability.Communication.NetManager.Core + * @since 8 + */ + dnses: Array; + /** + * Routing information. + * @type {Array} + * @syscap SystemCapability.Communication.NetManager.Core + * @since 8 + */ + routes: Array; + /** + * Maximum transmission unit. + * @type {number} + * @syscap SystemCapability.Communication.NetManager.Core + * @since 8 + */ + mtu: number; + } + /** + * Defines network route information. + * @interface RouteInfo + * @syscap SystemCapability.Communication.NetManager.Core + * @since 8 + */ + export interface RouteInfo { + /** + * Network card name. + * @type {string} + * @syscap SystemCapability.Communication.NetManager.Core + * @since 8 + */ + interface: string; + /** + * Destination Address + * @type {LinkAddress} + * @syscap SystemCapability.Communication.NetManager.Core + * @since 8 + */ + destination: LinkAddress; + /** + * Gateway address. + * @type {NetAddress} + * @syscap SystemCapability.Communication.NetManager.Core + * @since 8 + */ + gateway: NetAddress; + /** + * Whether a gateway is present. + * @type {boolean} + * @syscap SystemCapability.Communication.NetManager.Core + * @since 8 + */ + hasGateway: boolean; + /** + * Whether the route is the default route. + * @type {boolean} + * @syscap SystemCapability.Communication.NetManager.Core + * @since 8 + */ + isDefaultRoute: boolean; + } + /** + * Defines network link information. + * @interface LinkAddress + * @syscap SystemCapability.Communication.NetManager.Core + * @since 8 + */ + export interface LinkAddress { + /** + * Link address. + * @type {NetAddress} + * @syscap SystemCapability.Communication.NetManager.Core + * @since 8 + */ + address: NetAddress; + /** + * The length of the link address prefix. + * @type {number} + * @syscap SystemCapability.Communication.NetManager.Core + * @since 8 + */ + prefixLength: number; + } + /** + * Defines a network address. + * @interface NetAddress + * @syscap SystemCapability.Communication.NetManager.Core + * @since 8 + */ + export interface NetAddress { + /** + * Network address. + * @type {string} + * @syscap SystemCapability.Communication.NetManager.Core + * @since 8 + */ + address: string; + /** + * Address family identifier. The value is 1 for IPv4 and 2 for IPv6. The default value is 1. + * @type {?number} + * @syscap SystemCapability.Communication.NetManager.Core + * @since 8 + */ + family?: number; + /** + * Port number. The value ranges from 0 to 65535. + * @type {?number} + * @syscap SystemCapability.Communication.NetManager.Core + * @since 8 + */ + port?: number; + } + /** + * Network Global Proxy Configuration Information. + * @interface HttpProxy + * @syscap SystemCapability.Communication.NetManager.Core + * @since 10 + */ + /** + * Network Global Proxy Configuration Information. + * @interface HttpProxy + * @syscap SystemCapability.Communication.NetManager.Core + * @atomicservice + * @since 11 + */ + export interface HttpProxy { + /** + * Proxy server host name. + * @type {string} + * @syscap SystemCapability.Communication.NetManager.Core + * @since 10 + */ + /** + * Proxy server host name. + * @type {string} + * @syscap SystemCapability.Communication.NetManager.Core + * @atomicservice + * @since 11 + */ + host: string; + /** + * Host port. + * @type {number} + * @syscap SystemCapability.Communication.NetManager.Core + * @since 10 + */ + /** + * Host port. + * @type {number} + * @syscap SystemCapability.Communication.NetManager.Core + * @atomicservice + * @since 11 + */ + port: number; + /** + * Http proxy username. + * @type {?string} + * @syscap SystemCapability.Communication.NetManager.Core + * @since 12 + */ + username?: string; + /** + * Http proxy password. + * @type {?string} + * @syscap SystemCapability.Communication.NetManager.Core + * @since 12 + */ + password?: string; + /** + * Do not use a blocking list for proxy servers. + * @type {Array} + * @syscap SystemCapability.Communication.NetManager.Core + * @since 10 + */ + /** + * Do not use a blocking list for proxy servers. + * @type {Array} + * @syscap SystemCapability.Communication.NetManager.Core + * @atomicservice + * @since 11 + */ + exclusionList: Array; + } +} +export default connection; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.net.ethernet.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.net.ethernet.d.ts new file mode 100755 index 00000000..2b27460a --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.net.ethernet.d.ts @@ -0,0 +1,34 @@ +/* + * Copyright (C) 2022-2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit NetworkKit + */ + +import type connection from './@ohos.net.connection'; +/** + * Provides interfaces to manage ethernet. + * @namespace ethernet + * @syscap SystemCapability.Communication.NetManager.Ethernet + * @since 9 + */ +declare namespace ethernet { + /** + * @syscap SystemCapability.Communication.NetManager.Ethernet + * @since 10 + */ + type HttpProxy = connection.HttpProxy; +} +export default ethernet; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.net.http.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.net.http.d.ts new file mode 100755 index 00000000..e367a26f --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.net.http.d.ts @@ -0,0 +1,2633 @@ +/* + * Copyright (c) 2021-2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit NetworkKit + */ +import type { AsyncCallback, Callback } from './@ohos.base'; +import type connection from './@ohos.net.connection'; +/** + * Provides http related APIs. + * @namespace http + * @syscap SystemCapability.Communication.NetStack + * @since 6 + */ +/** + * Provides http related APIs. + * @namespace http + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ +/** + * Provides http related APIs. + * @namespace http + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @atomicservice + * @since 11 + */ +declare namespace http { + /** + * @syscap SystemCapability.Communication.NetStack + * @since 10 + */ + /** + * @syscap SystemCapability.Communication.NetStack + * @atomicservice + * @since 11 + */ + type HttpProxy = connection.HttpProxy; + /** + * Creates an HTTP request task. + * @returns { HttpRequest } the HttpRequest of the createHttp. + * @syscap SystemCapability.Communication.NetStack + * @since 6 + */ + /** + * Creates an HTTP request task. + * @returns { HttpRequest } the HttpRequest of the createHttp. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + /** + * Creates an HTTP request task. + * @returns { HttpRequest } the HttpRequest of the createHttp. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @atomicservice + * @since 11 + */ + function createHttp(): HttpRequest; + /** + * Specifies the type and value range of the optional parameters in the HTTP request. + * @interface HttpRequestOptions + * @syscap SystemCapability.Communication.NetStack + * @since 6 + */ + /** + * Specifies the type and value range of the optional parameters in the HTTP request. + * @interface HttpRequestOptions + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + /** + * Specifies the type and value range of the optional parameters in the HTTP request. + * @interface HttpRequestOptions + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @atomicservice + * @since 11 + */ + export interface HttpRequestOptions { + /** + * Request method,default is GET. + * @type {?RequestMethod} + * @syscap SystemCapability.Communication.NetStack + * @since 6 + */ + /** + * Request method,default is GET. + * @type {?RequestMethod} + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + /** + * Request method,default is GET. + * @type {?RequestMethod} + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @atomicservice + * @since 11 + */ + method?: RequestMethod; + /** + * Additional data of the request. + * extraData can be a string or an Object (API 6) or an ArrayBuffer(API 8). + * @type {?string | Object | ArrayBuffer} + * @syscap SystemCapability.Communication.NetStack + * @since 6 + */ + /** + * Additional data of the request. + * extraData can be a string or an Object (API 6) or an ArrayBuffer(API 8). + * @type {?string | Object | ArrayBuffer} + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + /** + * Additional data of the request. + * extraData can be a string or an Object (API 6) or an ArrayBuffer(API 8). + * @type { ?(string | Object | ArrayBuffer) } + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @atomicservice + * @since 11 + */ + extraData?: string | Object | ArrayBuffer; + /** + * Data type to be returned. If this parameter is set, the system preferentially returns the specified type. + * @type {?HttpDataType} + * @syscap SystemCapability.Communication.NetStack + * @since 9 + */ + /** + * Data type to be returned. If this parameter is set, the system preferentially returns the specified type. + * @type {?HttpDataType} + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + /** + * Data type to be returned. If this parameter is set, the system preferentially returns the specified type. + * @type {?HttpDataType} + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @atomicservice + * @since 11 + */ + expectDataType?: HttpDataType; + /** + * default is true + * @type {?boolean} + * @syscap SystemCapability.Communication.NetStack + * @since 9 + */ + /** + * default is true + * @type {?boolean} + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + /** + * default is true + * @type {?boolean} + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @atomicservice + * @since 11 + */ + usingCache?: boolean; + /** + * [1, 1000], default is 1. + * @type {?number} + * @syscap SystemCapability.Communication.NetStack + * @since 9 + */ + /** + * [1, 1000], default is 1. + * @type {?number} + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + /** + * [1, 1000], default is 1. + * @type {?number} + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @atomicservice + * @since 11 + */ + priority?: number; + /** + * HTTP request header. default is 'content-type': 'application/json' + * @type {?Object} + * @syscap SystemCapability.Communication.NetStack + * @since 6 + */ + /** + * HTTP request header. default is 'content-type': 'application/json' + * @type {?Object} + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + /** + * HTTP request header. default is 'content-type': 'application/json' + * @type {?Object} + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @atomicservice + * @since 11 + */ + header?: Object; + /** + * Read timeout period. The default value is 60,000, in ms. + * @type {?number} + * @syscap SystemCapability.Communication.NetStack + * @since 6 + */ + /** + * Read timeout period. The default value is 60,000, in ms. + * @type {?number} + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + /** + * Read timeout period. The default value is 60,000, in ms. + * @type {?number} + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @atomicservice + * @since 11 + */ + readTimeout?: number; + /** + * Connection timeout interval. The default value is 60,000, in ms. + * @type {?number} + * @syscap SystemCapability.Communication.NetStack + * @since 6 + */ + /** + * Connection timeout interval. The default value is 60,000, in ms. + * @type {?number} + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + /** + * Connection timeout interval. The default value is 60,000, in ms. + * @type {?number} + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @atomicservice + * @since 11 + */ + connectTimeout?: number; + /** + * default is automatically specified by the system. + * @type {?HttpProtocol} + * @syscap SystemCapability.Communication.NetStack + * @since 9 + */ + /** + * default is automatically specified by the system. + * @type {?HttpProtocol} + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + /** + * default is automatically specified by the system. + * @type {?HttpProtocol} + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @atomicservice + * @since 11 + */ + usingProtocol?: HttpProtocol; + /** + * If this parameter is set as type of boolean, the system will use default proxy or not use proxy. + * If this parameter is set as type of HttpProxy, the system will use the specified HttpProxy. + * @type {?boolean | HttpProxy} + * @syscap SystemCapability.Communication.NetStack + * @since 10 + */ + /** + * If this parameter is set as type of boolean, the system will use default proxy or not use proxy. + * If this parameter is set as type of HttpProxy, the system will use the specified HttpProxy. + * @type { ?(boolean | HttpProxy) } + * @syscap SystemCapability.Communication.NetStack + * @atomicservice + * @since 11 + */ + usingProxy?: boolean | HttpProxy; + /** + * If this parameter is set, the system will use ca path specified by user, or else use preset ca by the system. + * @type {?string} + * @syscap SystemCapability.Communication.NetStack + * @since 10 + */ + /** + * If this parameter is set, the system will use ca path specified by user, or else use preset ca by the system. + * @type {?string} + * @syscap SystemCapability.Communication.NetStack + * @atomicservice + * @since 11 + */ + caPath?: string; + /** + * Used to set to uploading or downloading the start bytes. The default value is 0. + * HTTP standard (RFC 7233 section 3.1) allows servers to ignore range requests. + * For HTTP PUT uploads this option should not be used, since it may conflict with other options. + * @type {?number} + * @syscap SystemCapability.Communication.NetStack + * @since 11 + */ + resumeFrom?: number; + /** + * Used to set to uploading or downloading the end bytes. Translate to the end if not set. + * HTTP standard (RFC 7233 section 3.1) allows servers to ignore range requests. + * For HTTP PUT uploads this option should not be used, since it may conflict with other options. + * @type {?number} + * @syscap SystemCapability.Communication.NetStack + * @since 11 + */ + resumeTo?: number; + /** + * Support the application to pass in client certificates, allowing the server to verify the client's identity. + * @type {?ClientCert} + * @syscap SystemCapability.Communication.NetStack + * @since 11 + */ + clientCert?: ClientCert; + /** + * If this parameter is set, incoming DNS resolution server URL for the DoH server to use for name resolving. + * The parameter must be URL-encoded in the following format: "https://host:port/path". + * It MUST specify an HTTPS URL. + * @type {?string} + * @syscap SystemCapability.Communication.NetStack + * @since 11 + */ + dnsOverHttps?: string; + /** + * If this parameter is set, use the specified DNS server for DNS resolution. + * Multiple DNS resolution servers can be set up, with a maximum of 3 servers. + * Only take the first three if there are more than three. + * @type {?Array} + * @syscap SystemCapability.Communication.NetStack + * @since 11 + */ + dnsServers?: Array; + /** + * The maximum limit of the response body. The default value is 5 * 1024 * 1024, in Byte. + * The maximum value is 100 * 1024 *1024, in Byte. + * @type {?number} + * @syscap SystemCapability.Communication.NetStack + * @since 11 + */ + maxLimit?: number; + /** + * The data fields which is supported by the HTTP protocol to post + * forms and by the SMTP and IMAP protocols to provide + * the email data to send/upload. + * @type {?Array} + * @syscap SystemCapability.Communication.NetStack + * @since 11 + */ + multiFormDataList?: Array; + } + /** + * Represents the properties of a form object. + * @interface MultiFormData + * @syscap SystemCapability.Communication.NetStack + * @since 11 + */ + export interface MultiFormData { + /** + * MIME name for the data field. + * @type {string} + * @syscap SystemCapability.Communication.NetStack + * @since 11 + */ + name: string; + /** + * Content type of the data field. + * @type {string} + * @syscap SystemCapability.Communication.NetStack + * @since 11 + */ + contentType: string; + /** + * Remote file name for the data field. + * @type {?string} + * @syscap SystemCapability.Communication.NetStack + * @since 11 + */ + remoteFileName?: string; + /** + * This parameter sets a mime part's body content from memory data. + * @type {?(string | Object | ArrayBuffer)} + * @syscap SystemCapability.Communication.NetStack + * @since 11 + */ + data?: string | Object | ArrayBuffer; + /** + * This parameter sets a mime part's body content from the file's contents. + * This is an alternative to curl_mime_data for setting data to a mime part. + * If data is empty, filePath must be set. + * If data has a value, filePath does not take effect. + * @type {?string} + * @syscap SystemCapability.Communication.NetStack + * @since 11 + */ + filePath?: string; + } + /** + * Enum for certificate types + * @enum {string} + * @syscap SystemCapability.Communication.NetStack + * @since 11 + */ + export enum CertType { + /** + * PEM format certificate + * @syscap SystemCapability.Communication.NetStack + * @since 11 + */ + PEM = 'PEM', + /** + * DER format certificate + * @syscap SystemCapability.Communication.NetStack + * @since 11 + */ + DER = 'DER', + /** + * P12 format certificate + * @syscap SystemCapability.Communication.NetStack + * @since 11 + */ + P12 = 'P12' + } + /** + * The clientCert field of the client certificate, which includes 4 attributes: + * client certificate (cert), client certificate type (certType), certificate private key (key), and passphrase (keyPassword). + * @interface ClientCert + * @syscap SystemCapability.Communication.NetStack + * @since 11 + */ + export interface ClientCert { + /** + * The path to the client certificate file. + * @type {string} + * @syscap SystemCapability.Communication.NetStack + * @since 11 + */ + certPath: string; + /** + * The type of the client certificate. + * @type {?CertType} + * @syscap SystemCapability.Communication.NetStack + * @since 11 + */ + certType?: CertType; + /** + * The path of the client certificate private key file. + * @type {string} + * @syscap SystemCapability.Communication.NetStack + * @since 11 + */ + keyPath: string; + /** + * Password required to use the client certificate private key. + * @type {?string} + * @syscap SystemCapability.Communication.NetStack + * @since 11 + */ + keyPassword?: string; + } + /** + *

Defines an HTTP request task. Before invoking APIs provided by HttpRequest, + * you must call createHttp() to create an HttpRequestTask object.

+ * @interface HttpRequest + * @syscap SystemCapability.Communication.NetStack + * @since 6 + */ + /** + *

Defines an HTTP request task. Before invoking APIs provided by HttpRequest, + * you must call createHttp() to create an HttpRequestTask object.

+ * @interface HttpRequest + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + /** + *

Defines an HTTP request task. Before invoking APIs provided by HttpRequest, + * you must call createHttp() to create an HttpRequestTask object.

+ * @interface HttpRequest + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @atomicservice + * @since 11 + */ + export interface HttpRequest { + /** + * Initiates an HTTP request to a given URL. + * @permission ohos.permission.INTERNET + * @param { string } url - URL for initiating an HTTP request. + * @param { AsyncCallback } callback - the callback of request. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 2300001 - Unsupported protocol. + * @throws { BusinessError } 2300003 - Invalid URL format or missing URL. + * @throws { BusinessError } 2300005 - Failed to resolve the proxy name. + * @throws { BusinessError } 2300006 - Failed to resolve the host name. + * @throws { BusinessError } 2300007 - Failed to connect to the server. + * @throws { BusinessError } 2300008 - Invalid server response. + * @throws { BusinessError } 2300009 - Access to the remote resource denied. + * @throws { BusinessError } 2300016 - Error in the HTTP2 framing layer. + * @throws { BusinessError } 2300018 - Transferred a partial file. + * @throws { BusinessError } 2300023 - Failed to write the received data to the disk or application. + * @throws { BusinessError } 2300025 - Upload failed. + * @throws { BusinessError } 2300026 - Failed to open or read local data from the file or application. + * @throws { BusinessError } 2300027 - Out of memory. + * @throws { BusinessError } 2300028 - Operation timeout. + * @throws { BusinessError } 2300047 - The number of redirections reaches the maximum allowed. + * @throws { BusinessError } 2300052 - The server returned nothing (no header or data). + * @throws { BusinessError } 2300055 - Failed to send data to the peer. + * @throws { BusinessError } 2300056 - Failed to receive data from the peer. + * @throws { BusinessError } 2300058 - Local SSL certificate error. + * @throws { BusinessError } 2300059 - The specified SSL cipher cannot be used. + * @throws { BusinessError } 2300060 - Invalid SSL peer certificate or SSH remote key. + * @throws { BusinessError } 2300061 - Invalid HTTP encoding format. + * @throws { BusinessError } 2300063 - Maximum file size exceeded. + * @throws { BusinessError } 2300070 - Remote disk full. + * @throws { BusinessError } 2300073 - Remote file already exists. + * @throws { BusinessError } 2300077 - The SSL CA certificate does not exist or is unaccessible. + * @throws { BusinessError } 2300078 - Remote file not found. + * @throws { BusinessError } 2300094 - Authentication error. + * @throws { BusinessError } 2300999 - Unknown error. + * @syscap SystemCapability.Communication.NetStack + * @since 6 + */ + /** + * Initiates an HTTP request to a given URL. + * @permission ohos.permission.INTERNET + * @param { string } url - URL for initiating an HTTP request. + * @param { AsyncCallback } callback - the callback of request. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 2300001 - Unsupported protocol. + * @throws { BusinessError } 2300003 - Invalid URL format or missing URL. + * @throws { BusinessError } 2300005 - Failed to resolve the proxy name. + * @throws { BusinessError } 2300006 - Failed to resolve the host name. + * @throws { BusinessError } 2300007 - Failed to connect to the server. + * @throws { BusinessError } 2300008 - Invalid server response. + * @throws { BusinessError } 2300009 - Access to the remote resource denied. + * @throws { BusinessError } 2300016 - Error in the HTTP2 framing layer. + * @throws { BusinessError } 2300018 - Transferred a partial file. + * @throws { BusinessError } 2300023 - Failed to write the received data to the disk or application. + * @throws { BusinessError } 2300025 - Upload failed. + * @throws { BusinessError } 2300026 - Failed to open or read local data from the file or application. + * @throws { BusinessError } 2300027 - Out of memory. + * @throws { BusinessError } 2300028 - Operation timeout. + * @throws { BusinessError } 2300047 - The number of redirections reaches the maximum allowed. + * @throws { BusinessError } 2300052 - The server returned nothing (no header or data). + * @throws { BusinessError } 2300055 - Failed to send data to the peer. + * @throws { BusinessError } 2300056 - Failed to receive data from the peer. + * @throws { BusinessError } 2300058 - Local SSL certificate error. + * @throws { BusinessError } 2300059 - The specified SSL cipher cannot be used. + * @throws { BusinessError } 2300060 - Invalid SSL peer certificate or SSH remote key. + * @throws { BusinessError } 2300061 - Invalid HTTP encoding format. + * @throws { BusinessError } 2300063 - Maximum file size exceeded. + * @throws { BusinessError } 2300070 - Remote disk full. + * @throws { BusinessError } 2300073 - Remote file already exists. + * @throws { BusinessError } 2300077 - The SSL CA certificate does not exist or is unaccessible. + * @throws { BusinessError } 2300078 - Remote file not found. + * @throws { BusinessError } 2300094 - Authentication error. + * @throws { BusinessError } 2300999 - Unknown error. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + /** + * Initiates an HTTP request to a given URL. + * @permission ohos.permission.INTERNET + * @param { string } url - URL for initiating an HTTP request. + * @param { AsyncCallback } callback - the callback of request. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 2300001 - Unsupported protocol. + * @throws { BusinessError } 2300003 - Invalid URL format or missing URL. + * @throws { BusinessError } 2300005 - Failed to resolve the proxy name. + * @throws { BusinessError } 2300006 - Failed to resolve the host name. + * @throws { BusinessError } 2300007 - Failed to connect to the server. + * @throws { BusinessError } 2300008 - Invalid server response. + * @throws { BusinessError } 2300009 - Access to the remote resource denied. + * @throws { BusinessError } 2300016 - Error in the HTTP2 framing layer. + * @throws { BusinessError } 2300018 - Transferred a partial file. + * @throws { BusinessError } 2300023 - Failed to write the received data to the disk or application. + * @throws { BusinessError } 2300025 - Upload failed. + * @throws { BusinessError } 2300026 - Failed to open or read local data from the file or application. + * @throws { BusinessError } 2300027 - Out of memory. + * @throws { BusinessError } 2300028 - Operation timeout. + * @throws { BusinessError } 2300047 - The number of redirections reaches the maximum allowed. + * @throws { BusinessError } 2300052 - The server returned nothing (no header or data). + * @throws { BusinessError } 2300055 - Failed to send data to the peer. + * @throws { BusinessError } 2300056 - Failed to receive data from the peer. + * @throws { BusinessError } 2300058 - Local SSL certificate error. + * @throws { BusinessError } 2300059 - The specified SSL cipher cannot be used. + * @throws { BusinessError } 2300060 - Invalid SSL peer certificate or SSH remote key. + * @throws { BusinessError } 2300061 - Invalid HTTP encoding format. + * @throws { BusinessError } 2300063 - Maximum file size exceeded. + * @throws { BusinessError } 2300070 - Remote disk full. + * @throws { BusinessError } 2300073 - Remote file already exists. + * @throws { BusinessError } 2300077 - The SSL CA certificate does not exist or is unaccessible. + * @throws { BusinessError } 2300078 - Remote file not found. + * @throws { BusinessError } 2300094 - Authentication error. + * @throws { BusinessError } 2300999 - Unknown error. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @atomicservice + * @since 11 + */ + request(url: string, callback: AsyncCallback): void; + /** + * Initiates an HTTP request to a given URL. + * @permission ohos.permission.INTERNET + * @param { string } url - URL for initiating an HTTP request. + * @param { HttpRequestOptions } options - Optional parameters {@link HttpRequestOptions}. + * @param { AsyncCallback } callback - the callback of request.. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 2300001 - Unsupported protocol. + * @throws { BusinessError } 2300003 - Invalid URL format or missing URL. + * @throws { BusinessError } 2300005 - Failed to resolve the proxy name. + * @throws { BusinessError } 2300006 - Failed to resolve the host name. + * @throws { BusinessError } 2300007 - Failed to connect to the server. + * @throws { BusinessError } 2300008 - Invalid server response. + * @throws { BusinessError } 2300009 - Access to the remote resource denied. + * @throws { BusinessError } 2300016 - Error in the HTTP2 framing layer. + * @throws { BusinessError } 2300018 - Transferred a partial file. + * @throws { BusinessError } 2300023 - Failed to write the received data to the disk or application. + * @throws { BusinessError } 2300025 - Upload failed. + * @throws { BusinessError } 2300026 - Failed to open or read local data from the file or application. + * @throws { BusinessError } 2300027 - Out of memory. + * @throws { BusinessError } 2300028 - Operation timeout. + * @throws { BusinessError } 2300047 - The number of redirections reaches the maximum allowed. + * @throws { BusinessError } 2300052 - The server returned nothing (no header or data). + * @throws { BusinessError } 2300055 - Failed to send data to the peer. + * @throws { BusinessError } 2300056 - Failed to receive data from the peer. + * @throws { BusinessError } 2300058 - Local SSL certificate error. + * @throws { BusinessError } 2300059 - The specified SSL cipher cannot be used. + * @throws { BusinessError } 2300060 - Invalid SSL peer certificate or SSH remote key. + * @throws { BusinessError } 2300061 - Invalid HTTP encoding format. + * @throws { BusinessError } 2300063 - Maximum file size exceeded. + * @throws { BusinessError } 2300070 - Remote disk full. + * @throws { BusinessError } 2300073 - Remote file already exists. + * @throws { BusinessError } 2300077 - The SSL CA certificate does not exist or is unaccessible. + * @throws { BusinessError } 2300078 - Remote file not found. + * @throws { BusinessError } 2300094 - Authentication error. + * @throws { BusinessError } 2300999 - Unknown error. + * @syscap SystemCapability.Communication.NetStack + * @since 6 + */ + /** + * Initiates an HTTP request to a given URL. + * @permission ohos.permission.INTERNET + * @param { string } url - URL for initiating an HTTP request. + * @param { HttpRequestOptions } options - Optional parameters {@link HttpRequestOptions}. + * @param { AsyncCallback } callback - the callback of request. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 2300001 - Unsupported protocol. + * @throws { BusinessError } 2300003 - Invalid URL format or missing URL. + * @throws { BusinessError } 2300005 - Failed to resolve the proxy name. + * @throws { BusinessError } 2300006 - Failed to resolve the host name. + * @throws { BusinessError } 2300007 - Failed to connect to the server. + * @throws { BusinessError } 2300008 - Invalid server response. + * @throws { BusinessError } 2300009 - Access to the remote resource denied. + * @throws { BusinessError } 2300016 - Error in the HTTP2 framing layer. + * @throws { BusinessError } 2300018 - Transferred a partial file. + * @throws { BusinessError } 2300023 - Failed to write the received data to the disk or application. + * @throws { BusinessError } 2300025 - Upload failed. + * @throws { BusinessError } 2300026 - Failed to open or read local data from the file or application. + * @throws { BusinessError } 2300027 - Out of memory. + * @throws { BusinessError } 2300028 - Operation timeout. + * @throws { BusinessError } 2300047 - The number of redirections reaches the maximum allowed. + * @throws { BusinessError } 2300052 - The server returned nothing (no header or data). + * @throws { BusinessError } 2300055 - Failed to send data to the peer. + * @throws { BusinessError } 2300056 - Failed to receive data from the peer. + * @throws { BusinessError } 2300058 - Local SSL certificate error. + * @throws { BusinessError } 2300059 - The specified SSL cipher cannot be used. + * @throws { BusinessError } 2300060 - Invalid SSL peer certificate or SSH remote key. + * @throws { BusinessError } 2300061 - Invalid HTTP encoding format. + * @throws { BusinessError } 2300063 - Maximum file size exceeded. + * @throws { BusinessError } 2300070 - Remote disk full. + * @throws { BusinessError } 2300073 - Remote file already exists. + * @throws { BusinessError } 2300077 - The SSL CA certificate does not exist or is unaccessible. + * @throws { BusinessError } 2300078 - Remote file not found. + * @throws { BusinessError } 2300094 - Authentication error. + * @throws { BusinessError } 2300999 - Unknown error. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + /** + * Initiates an HTTP request to a given URL. + * @permission ohos.permission.INTERNET + * @param { string } url - URL for initiating an HTTP request. + * @param { HttpRequestOptions } options - Optional parameters {@link HttpRequestOptions}. + * @param { AsyncCallback } callback - the callback of request. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 2300001 - Unsupported protocol. + * @throws { BusinessError } 2300003 - Invalid URL format or missing URL. + * @throws { BusinessError } 2300005 - Failed to resolve the proxy name. + * @throws { BusinessError } 2300006 - Failed to resolve the host name. + * @throws { BusinessError } 2300007 - Failed to connect to the server. + * @throws { BusinessError } 2300008 - Invalid server response. + * @throws { BusinessError } 2300009 - Access to the remote resource denied. + * @throws { BusinessError } 2300016 - Error in the HTTP2 framing layer. + * @throws { BusinessError } 2300018 - Transferred a partial file. + * @throws { BusinessError } 2300023 - Failed to write the received data to the disk or application. + * @throws { BusinessError } 2300025 - Upload failed. + * @throws { BusinessError } 2300026 - Failed to open or read local data from the file or application. + * @throws { BusinessError } 2300027 - Out of memory. + * @throws { BusinessError } 2300028 - Operation timeout. + * @throws { BusinessError } 2300047 - The number of redirections reaches the maximum allowed. + * @throws { BusinessError } 2300052 - The server returned nothing (no header or data). + * @throws { BusinessError } 2300055 - Failed to send data to the peer. + * @throws { BusinessError } 2300056 - Failed to receive data from the peer. + * @throws { BusinessError } 2300058 - Local SSL certificate error. + * @throws { BusinessError } 2300059 - The specified SSL cipher cannot be used. + * @throws { BusinessError } 2300060 - Invalid SSL peer certificate or SSH remote key. + * @throws { BusinessError } 2300061 - Invalid HTTP encoding format. + * @throws { BusinessError } 2300063 - Maximum file size exceeded. + * @throws { BusinessError } 2300070 - Remote disk full. + * @throws { BusinessError } 2300073 - Remote file already exists. + * @throws { BusinessError } 2300077 - The SSL CA certificate does not exist or is unaccessible. + * @throws { BusinessError } 2300078 - Remote file not found. + * @throws { BusinessError } 2300094 - Authentication error. + * @throws { BusinessError } 2300999 - Unknown error. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @atomicservice + * @since 11 + */ + request(url: string, options: HttpRequestOptions, callback: AsyncCallback): void; + /** + * Initiates an HTTP request to a given URL. + * @permission ohos.permission.INTERNET + * @param { string } url - URL for initiating an HTTP request. + * @param { HttpRequestOptions } [options] - Optional parameters {@link HttpRequestOptions}. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 2300001 - Unsupported protocol. + * @throws { BusinessError } 2300003 - Invalid URL format or missing URL. + * @throws { BusinessError } 2300005 - Failed to resolve the proxy name. + * @throws { BusinessError } 2300006 - Failed to resolve the host name. + * @throws { BusinessError } 2300007 - Failed to connect to the server. + * @throws { BusinessError } 2300008 - Invalid server response. + * @throws { BusinessError } 2300009 - Access to the remote resource denied. + * @throws { BusinessError } 2300016 - Error in the HTTP2 framing layer. + * @throws { BusinessError } 2300018 - Transferred a partial file. + * @throws { BusinessError } 2300023 - Failed to write the received data to the disk or application. + * @throws { BusinessError } 2300025 - Upload failed. + * @throws { BusinessError } 2300026 - Failed to open or read local data from the file or application. + * @throws { BusinessError } 2300027 - Out of memory. + * @throws { BusinessError } 2300028 - Operation timeout. + * @throws { BusinessError } 2300047 - The number of redirections reaches the maximum allowed. + * @throws { BusinessError } 2300052 - The server returned nothing (no header or data). + * @throws { BusinessError } 2300055 - Failed to send data to the peer. + * @throws { BusinessError } 2300056 - Failed to receive data from the peer. + * @throws { BusinessError } 2300058 - Local SSL certificate error. + * @throws { BusinessError } 2300059 - The specified SSL cipher cannot be used. + * @throws { BusinessError } 2300060 - Invalid SSL peer certificate or SSH remote key. + * @throws { BusinessError } 2300061 - Invalid HTTP encoding format. + * @throws { BusinessError } 2300063 - Maximum file size exceeded. + * @throws { BusinessError } 2300070 - Remote disk full. + * @throws { BusinessError } 2300073 - Remote file already exists. + * @throws { BusinessError } 2300077 - The SSL CA certificate does not exist or is unaccessible. + * @throws { BusinessError } 2300078 - Remote file not found. + * @throws { BusinessError } 2300094 - Authentication error. + * @throws { BusinessError } 2300999 - Unknown error. + * @syscap SystemCapability.Communication.NetStack + * @since 6 + */ + /** + * Initiates an HTTP request to a given URL. + * @permission ohos.permission.INTERNET + * @param { string } url - URL for initiating an HTTP request. + * @param { HttpRequestOptions } [options] - Optional parameters {@link HttpRequestOptions}. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 2300001 - Unsupported protocol. + * @throws { BusinessError } 2300003 - Invalid URL format or missing URL. + * @throws { BusinessError } 2300005 - Failed to resolve the proxy name. + * @throws { BusinessError } 2300006 - Failed to resolve the host name. + * @throws { BusinessError } 2300007 - Failed to connect to the server. + * @throws { BusinessError } 2300008 - Invalid server response. + * @throws { BusinessError } 2300009 - Access to the remote resource denied. + * @throws { BusinessError } 2300016 - Error in the HTTP2 framing layer. + * @throws { BusinessError } 2300018 - Transferred a partial file. + * @throws { BusinessError } 2300023 - Failed to write the received data to the disk or application. + * @throws { BusinessError } 2300025 - Upload failed. + * @throws { BusinessError } 2300026 - Failed to open or read local data from the file or application. + * @throws { BusinessError } 2300027 - Out of memory. + * @throws { BusinessError } 2300028 - Operation timeout. + * @throws { BusinessError } 2300047 - The number of redirections reaches the maximum allowed. + * @throws { BusinessError } 2300052 - The server returned nothing (no header or data). + * @throws { BusinessError } 2300055 - Failed to send data to the peer. + * @throws { BusinessError } 2300056 - Failed to receive data from the peer. + * @throws { BusinessError } 2300058 - Local SSL certificate error. + * @throws { BusinessError } 2300059 - The specified SSL cipher cannot be used. + * @throws { BusinessError } 2300060 - Invalid SSL peer certificate or SSH remote key. + * @throws { BusinessError } 2300061 - Invalid HTTP encoding format. + * @throws { BusinessError } 2300063 - Maximum file size exceeded. + * @throws { BusinessError } 2300070 - Remote disk full. + * @throws { BusinessError } 2300073 - Remote file already exists. + * @throws { BusinessError } 2300077 - The SSL CA certificate does not exist or is unaccessible. + * @throws { BusinessError } 2300078 - Remote file not found. + * @throws { BusinessError } 2300094 - Authentication error. + * @throws { BusinessError } 2300999 - Unknown error. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + /** + * Initiates an HTTP request to a given URL. + * @permission ohos.permission.INTERNET + * @param { string } url - URL for initiating an HTTP request. + * @param { HttpRequestOptions } [options] - Optional parameters {@link HttpRequestOptions}. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 2300001 - Unsupported protocol. + * @throws { BusinessError } 2300003 - Invalid URL format or missing URL. + * @throws { BusinessError } 2300005 - Failed to resolve the proxy name. + * @throws { BusinessError } 2300006 - Failed to resolve the host name. + * @throws { BusinessError } 2300007 - Failed to connect to the server. + * @throws { BusinessError } 2300008 - Invalid server response. + * @throws { BusinessError } 2300009 - Access to the remote resource denied. + * @throws { BusinessError } 2300016 - Error in the HTTP2 framing layer. + * @throws { BusinessError } 2300018 - Transferred a partial file. + * @throws { BusinessError } 2300023 - Failed to write the received data to the disk or application. + * @throws { BusinessError } 2300025 - Upload failed. + * @throws { BusinessError } 2300026 - Failed to open or read local data from the file or application. + * @throws { BusinessError } 2300027 - Out of memory. + * @throws { BusinessError } 2300028 - Operation timeout. + * @throws { BusinessError } 2300047 - The number of redirections reaches the maximum allowed. + * @throws { BusinessError } 2300052 - The server returned nothing (no header or data). + * @throws { BusinessError } 2300055 - Failed to send data to the peer. + * @throws { BusinessError } 2300056 - Failed to receive data from the peer. + * @throws { BusinessError } 2300058 - Local SSL certificate error. + * @throws { BusinessError } 2300059 - The specified SSL cipher cannot be used. + * @throws { BusinessError } 2300060 - Invalid SSL peer certificate or SSH remote key. + * @throws { BusinessError } 2300061 - Invalid HTTP encoding format. + * @throws { BusinessError } 2300063 - Maximum file size exceeded. + * @throws { BusinessError } 2300070 - Remote disk full. + * @throws { BusinessError } 2300073 - Remote file already exists. + * @throws { BusinessError } 2300077 - The SSL CA certificate does not exist or is unaccessible. + * @throws { BusinessError } 2300078 - Remote file not found. + * @throws { BusinessError } 2300094 - Authentication error. + * @throws { BusinessError } 2300999 - Unknown error. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @atomicservice + * @since 11 + */ + request(url: string, options?: HttpRequestOptions): Promise; + /** + * Initiates an HTTP request to a given URL, applicable to scenarios where http response supports streaming. + * @permission ohos.permission.INTERNET + * @param { string } url - URL for initiating an HTTP request. + * @param { AsyncCallback } callback - Returns the callback of requestInStream {@link ResponseCode}, + * should use on_headersReceive and on_dataReceive to get http response. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 2300001 - Unsupported protocol. + * @throws { BusinessError } 2300003 - Invalid URL format or missing URL. + * @throws { BusinessError } 2300005 - Failed to resolve the proxy name. + * @throws { BusinessError } 2300006 - Failed to resolve the host name. + * @throws { BusinessError } 2300007 - Failed to connect to the server. + * @throws { BusinessError } 2300008 - Invalid server response. + * @throws { BusinessError } 2300009 - Access to the remote resource denied. + * @throws { BusinessError } 2300016 - Error in the HTTP2 framing layer. + * @throws { BusinessError } 2300018 - Transferred a partial file. + * @throws { BusinessError } 2300023 - Failed to write the received data to the disk or application. + * @throws { BusinessError } 2300025 - Upload failed. + * @throws { BusinessError } 2300026 - Failed to open or read local data from the file or application. + * @throws { BusinessError } 2300027 - Out of memory. + * @throws { BusinessError } 2300028 - Operation timeout. + * @throws { BusinessError } 2300047 - The number of redirections reaches the maximum allowed. + * @throws { BusinessError } 2300052 - The server returned nothing (no header or data). + * @throws { BusinessError } 2300055 - Failed to send data to the peer. + * @throws { BusinessError } 2300056 - Failed to receive data from the peer. + * @throws { BusinessError } 2300058 - Local SSL certificate error. + * @throws { BusinessError } 2300059 - The specified SSL cipher cannot be used. + * @throws { BusinessError } 2300060 - Invalid SSL peer certificate or SSH remote key. + * @throws { BusinessError } 2300061 - Invalid HTTP encoding format. + * @throws { BusinessError } 2300063 - Maximum file size exceeded. + * @throws { BusinessError } 2300070 - Remote disk full. + * @throws { BusinessError } 2300073 - Remote file already exists. + * @throws { BusinessError } 2300077 - The SSL CA certificate does not exist or is unaccessible. + * @throws { BusinessError } 2300078 - Remote file not found. + * @throws { BusinessError } 2300094 - Authentication error. + * @throws { BusinessError } 2300999 - Unknown error. + * @syscap SystemCapability.Communication.NetStack + * @since 10 + */ + requestInStream(url: string, callback: AsyncCallback): void; + /** + * Initiates an HTTP request to a given URL, applicable to scenarios where http response supports streaming. + * @permission ohos.permission.INTERNET + * @param { string } url - URL for initiating an HTTP request. + * @param { HttpRequestOptions } options - Optional parameters {@link HttpRequestOptions}. + * @param { AsyncCallback } callback - the callback of requestInStream. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 2300001 - Unsupported protocol. + * @throws { BusinessError } 2300003 - Invalid URL format or missing URL. + * @throws { BusinessError } 2300005 - Failed to resolve the proxy name. + * @throws { BusinessError } 2300006 - Failed to resolve the host name. + * @throws { BusinessError } 2300007 - Failed to connect to the server. + * @throws { BusinessError } 2300008 - Invalid server response. + * @throws { BusinessError } 2300009 - Access to the remote resource denied. + * @throws { BusinessError } 2300016 - Error in the HTTP2 framing layer. + * @throws { BusinessError } 2300018 - Transferred a partial file. + * @throws { BusinessError } 2300023 - Failed to write the received data to the disk or application. + * @throws { BusinessError } 2300025 - Upload failed. + * @throws { BusinessError } 2300026 - Failed to open or read local data from the file or application. + * @throws { BusinessError } 2300027 - Out of memory. + * @throws { BusinessError } 2300028 - Operation timeout. + * @throws { BusinessError } 2300047 - The number of redirections reaches the maximum allowed. + * @throws { BusinessError } 2300052 - The server returned nothing (no header or data). + * @throws { BusinessError } 2300055 - Failed to send data to the peer. + * @throws { BusinessError } 2300056 - Failed to receive data from the peer. + * @throws { BusinessError } 2300058 - Local SSL certificate error. + * @throws { BusinessError } 2300059 - The specified SSL cipher cannot be used. + * @throws { BusinessError } 2300060 - Invalid SSL peer certificate or SSH remote key. + * @throws { BusinessError } 2300061 - Invalid HTTP encoding format. + * @throws { BusinessError } 2300063 - Maximum file size exceeded. + * @throws { BusinessError } 2300070 - Remote disk full. + * @throws { BusinessError } 2300073 - Remote file already exists. + * @throws { BusinessError } 2300077 - The SSL CA certificate does not exist or is unaccessible. + * @throws { BusinessError } 2300078 - Remote file not found. + * @throws { BusinessError } 2300094 - Authentication error. + * @throws { BusinessError } 2300999 - Unknown error. + * @syscap SystemCapability.Communication.NetStack + * @since 10 + */ + requestInStream(url: string, options: HttpRequestOptions, callback: AsyncCallback): void; + /** + * Initiates an HTTP request to a given URL, applicable to scenarios where http response supports streaming. + * @permission ohos.permission.INTERNET + * @param { string } url - URL for initiating an HTTP request. + * @param { HttpRequestOptions } [options] - Optional parameters {@link HttpRequestOptions}. + * @returns { Promise } the promise returned by the function. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 2300001 - Unsupported protocol. + * @throws { BusinessError } 2300003 - Invalid URL format or missing URL. + * @throws { BusinessError } 2300005 - Failed to resolve the proxy name. + * @throws { BusinessError } 2300006 - Failed to resolve the host name. + * @throws { BusinessError } 2300007 - Failed to connect to the server. + * @throws { BusinessError } 2300008 - Invalid server response. + * @throws { BusinessError } 2300009 - Access to the remote resource denied. + * @throws { BusinessError } 2300016 - Error in the HTTP2 framing layer. + * @throws { BusinessError } 2300018 - Transferred a partial file. + * @throws { BusinessError } 2300023 - Failed to write the received data to the disk or application. + * @throws { BusinessError } 2300025 - Upload failed. + * @throws { BusinessError } 2300026 - Failed to open or read local data from the file or application. + * @throws { BusinessError } 2300027 - Out of memory. + * @throws { BusinessError } 2300028 - Operation timeout. + * @throws { BusinessError } 2300047 - The number of redirections reaches the maximum allowed. + * @throws { BusinessError } 2300052 - The server returned nothing (no header or data). + * @throws { BusinessError } 2300055 - Failed to send data to the peer. + * @throws { BusinessError } 2300056 - Failed to receive data from the peer. + * @throws { BusinessError } 2300058 - Local SSL certificate error. + * @throws { BusinessError } 2300059 - The specified SSL cipher cannot be used. + * @throws { BusinessError } 2300060 - Invalid SSL peer certificate or SSH remote key. + * @throws { BusinessError } 2300061 - Invalid HTTP encoding format. + * @throws { BusinessError } 2300063 - Maximum file size exceeded. + * @throws { BusinessError } 2300070 - Remote disk full. + * @throws { BusinessError } 2300073 - Remote file already exists. + * @throws { BusinessError } 2300077 - The SSL CA certificate does not exist or is unaccessible. + * @throws { BusinessError } 2300078 - Remote file not found. + * @throws { BusinessError } 2300094 - Authentication error. + * @throws { BusinessError } 2300999 - Unknown error. + * @syscap SystemCapability.Communication.NetStack + * @since 10 + */ + requestInStream(url: string, options?: HttpRequestOptions): Promise; + /** + * Destroys an HTTP request. + * @syscap SystemCapability.Communication.NetStack + * @since 6 + */ + /** + * Destroys an HTTP request. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + /** + * Destroys an HTTP request. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @atomicservice + * @since 11 + */ + destroy(): void; + /** + * Registers an observer for HTTP Response Header events. + * @param { "headerReceive" } type - Indicates Event name. + * @param { AsyncCallback } callback - the callback used to return the result. + * @syscap SystemCapability.Communication.NetStack + * @since 6 + * @deprecated since 8 + * @useinstead on_headersReceive + */ + on(type: "headerReceive", callback: AsyncCallback): void; + /** + * Unregisters the observer for HTTP Response Header events. + * @param { "headerReceive" } type - Indicates Event name. + * @param { AsyncCallback } [callback] - the callback used to return the result. + * @syscap SystemCapability.Communication.NetStack + * @since 6 + * @deprecated since 8 + * @useinstead off_headersReceive + */ + off(type: "headerReceive", callback?: AsyncCallback): void; + /** + * Registers an observer for HTTP Response Header events. + * @param { "headersReceive" } type - Indicates Event name. + * @param { Callback } callback - the callback used to return the result. + * @syscap SystemCapability.Communication.NetStack + * @since 8 + */ + /** + * Registers an observer for HTTP Response Header events. + * @param { "headersReceive" } type - Indicates Event name. + * @param { Callback } callback - the callback used to return the result. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + /** + * Registers an observer for HTTP Response Header events. + * @param { "headersReceive" } type - Indicates Event name. + * @param { Callback } callback - the callback used to return the result. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @atomicservice + * @since 11 + */ + on(type: "headersReceive", callback: Callback): void; + /** + * Unregisters the observer for HTTP Response Header events. + * @param { "headersReceive" } type - Indicates Event name. + * @param { Callback } callback - the callback used to return the result. + * @syscap SystemCapability.Communication.NetStack + * @since 8 + */ + /** + * Unregisters the observer for HTTP Response Header events. + * @param { "headersReceive" } type - Indicates Event name. + * @param { Callback } callback - the callback used to return the result. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + /** + * Unregisters the observer for HTTP Response Header events. + * @param { "headersReceive" } type - Indicates Event name. + * @param { Callback } [callback] - the callback used to return the result. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @atomicservice + * @since 11 + */ + off(type: "headersReceive", callback?: Callback): void; + /** + * Registers a one-time observer for HTTP Response Header events. + * @param { "headersReceive" } type - Indicates Event name. + * @param { Callback } callback - the callback used to return the result. + * @syscap SystemCapability.Communication.NetStack + * @since 8 + */ + /** + * Registers a one-time observer for HTTP Response Header events. + * @param { "headersReceive" } type - Indicates Event name. + * @param { Callback } callback - the callback used to return the result. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + once(type: "headersReceive", callback: Callback): void; + /** + * Registers an observer for receiving HTTP Response data events continuously. + * @param { "dataReceive" } type - Indicates Event name. + * @param { Callback } callback - the callback used to return the result. + * @syscap SystemCapability.Communication.NetStack + * @since 10 + */ + on(type: "dataReceive", callback: Callback): void; + /** + * Unregisters an observer for receiving HTTP Response data events continuously. + * @param { "dataReceive" } type - Indicates Event name. + * @param { Callback } [callback] - the callback used to return the result. + * @syscap SystemCapability.Communication.NetStack + * @since 10 + */ + off(type: "dataReceive", callback?: Callback): void; + /** + * Registers an observer for receiving HTTP Response data ends events. + * @param { "dataEnd" } type - Indicates Event name. + * @param { Callback } callback - the callback used to return the result. + * @syscap SystemCapability.Communication.NetStack + * @since 10 + */ + on(type: "dataEnd", callback: Callback): void; + /** + * Unregisters an observer for receiving HTTP Response data ends events. + * @param { "dataEnd" } type - Indicates Event name. + * @param { Callback } [callback] - the callback used to return the result. + * @syscap SystemCapability.Communication.NetStack + * @since 10 + */ + off(type: "dataEnd", callback?: Callback): void; + /** + * Registers an observer for progress of receiving HTTP Response data events. + * @param { 'dataReceiveProgress' } type - Indicates Event name. + * @param { Callback<{ receiveSize: number, totalSize: number }> } callback - the callback used to return the result. + * @syscap SystemCapability.Communication.NetStack + * @since 10 + */ + /** + * Registers an observer for progress of receiving HTTP Response data events. + * @param { 'dataReceiveProgress' } type - Indicates Event name. + * @param { Callback } callback - the callback used to return the result. + * @syscap SystemCapability.Communication.NetStack + * @since 11 + */ + on(type: 'dataReceiveProgress', callback: Callback): void; + /** + * Unregisters an observer for progress of receiving HTTP Response data events. + * @param { 'dataReceiveProgress' } type - Indicates Event name. + * @param { Callback<{ receiveSize: number, totalSize: number }> } [callback] - the callback used to return the result. + * @syscap SystemCapability.Communication.NetStack + * @since 10 + */ + /** + * Unregisters an observer for progress of receiving HTTP Response data events. + * @param { 'dataReceiveProgress' } type - Indicates Event name. + * @param { Callback } callback - the callback used to return the result. + * @syscap SystemCapability.Communication.NetStack + * @since 11 + */ + off(type: 'dataReceiveProgress', callback?: Callback): void; + /** + * Registers an observer for progress of sendSize HTTP Response data events. + * @param { 'dataSendProgress' } type - Indicates Event name. + * @param { Callback } callback - the callback of on. + * @syscap SystemCapability.Communication.NetStack + * @since 11 + */ + on(type: 'dataSendProgress', callback: Callback): void; + /** + * Unregisters an observer for progress of sendSize HTTP Response data events. + * @param { 'dataSendProgress' } type - Indicates Event name. + * @param { Callback } [callback] - the callback of off. + * @syscap SystemCapability.Communication.NetStack + * @since 11 + */ + off(type: 'dataSendProgress', callback?: Callback): void; + } + /** + * Defines an HTTP request method. + * @enum {string} + * @syscap SystemCapability.Communication.NetStack + * @since 6 + */ + /** + * Defines an HTTP request method. + * @enum {string} + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + /** + * Defines an HTTP request method. + * @enum {string} + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @atomicservice + * @since 11 + */ + export enum RequestMethod { + /** + * OPTIONS method. + * @syscap SystemCapability.Communication.NetStack + * @since 6 + */ + /** + * OPTIONS method. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + /** + * OPTIONS method. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @atomicservice + * @since 11 + */ + OPTIONS = "OPTIONS", + /** + * GET method. + * @syscap SystemCapability.Communication.NetStack + * @since 6 + */ + /** + * GET method. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + /** + * GET method. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @atomicservice + * @since 11 + */ + GET = "GET", + /** + * HEAD method. + * @syscap SystemCapability.Communication.NetStack + * @since 6 + */ + /** + * HEAD method. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + /** + * HEAD method. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @atomicservice + * @since 11 + */ + HEAD = "HEAD", + /** + * POST method. + * @syscap SystemCapability.Communication.NetStack + * @since 6 + */ + /** + * POST method. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + /** + * POST method. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @atomicservice + * @since 11 + */ + POST = "POST", + /** + * PUT method. + * @syscap SystemCapability.Communication.NetStack + * @since 6 + */ + /** + * PUT method. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + /** + * PUT method. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @atomicservice + * @since 11 + */ + PUT = "PUT", + /** + * DELETE method. + * @syscap SystemCapability.Communication.NetStack + * @since 6 + */ + /** + * DELETE method. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + /** + * DELETE method. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @atomicservice + * @since 11 + */ + DELETE = "DELETE", + /** + * TRACE method. + * @syscap SystemCapability.Communication.NetStack + * @since 6 + */ + /** + * TRACE method. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + /** + * TRACE method. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @atomicservice + * @since 11 + */ + TRACE = "TRACE", + /** + * CONNECT method. + * @syscap SystemCapability.Communication.NetStack + * @since 6 + */ + /** + * CONNECT method. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + /** + * CONNECT method. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @atomicservice + * @since 11 + */ + CONNECT = "CONNECT" + } + /** + * Enumerates the response codes for an HTTP request. + * @enum {number} + * @syscap SystemCapability.Communication.NetStack + * @since 6 + */ + /** + * Enumerates the response codes for an HTTP request. + * @enum {number} + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + /** + * Enumerates the response codes for an HTTP request. + * @enum {number} + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @atomicservice + * @since 11 + */ + export enum ResponseCode { + /** + * The request was successful. Typically used for GET and POST requests. + * @syscap SystemCapability.Communication.NetStack + * @since 6 + */ + /** + * The request was successful. Typically used for GET and POST requests. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + /** + * The request was successful. Typically used for GET and POST requests. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @atomicservice + * @since 11 + */ + OK = 200, + /** + * Successfully requested and created a new resource. + * @syscap SystemCapability.Communication.NetStack + * @since 6 + */ + /** + * Successfully requested and created a new resource. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + /** + * Successfully requested and created a new resource. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @atomicservice + * @since 11 + */ + CREATED, + /** + * The request has been accepted but has not been processed completely. + * @syscap SystemCapability.Communication.NetStack + * @since 6 + */ + /** + * The request has been accepted but has not been processed completely. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + /** + * The request has been accepted but has not been processed completely. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @atomicservice + * @since 11 + */ + ACCEPTED, + /** + * Unauthorized information. The request was successful. + * @syscap SystemCapability.Communication.NetStack + * @since 6 + */ + /** + * Unauthorized information. The request was successful. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + /** + * Unauthorized information. The request was successful. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @atomicservice + * @since 11 + */ + NOT_AUTHORITATIVE, + /** + * No content. The server successfully processed, but did not return content. + * @syscap SystemCapability.Communication.NetStack + * @since 6 + */ + /** + * No content. The server successfully processed, but did not return content. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + /** + * No content. The server successfully processed, but did not return content. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @atomicservice + * @since 11 + */ + NO_CONTENT, + /** + * Reset the content. + * @syscap SystemCapability.Communication.NetStack + * @since 6 + */ + /** + * Reset the content. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + /** + * Reset the content. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @atomicservice + * @since 11 + */ + RESET, + /** + * Partial content. The server successfully processed some GET requests. + * @syscap SystemCapability.Communication.NetStack + * @since 6 + */ + /** + * Partial content. The server successfully processed some GET requests. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + /** + * Partial content. The server successfully processed some GET requests. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @atomicservice + * @since 11 + */ + PARTIAL, + /** + * Multiple options. + * @syscap SystemCapability.Communication.NetStack + * @since 6 + */ + /** + * Multiple options. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + /** + * Multiple options. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @atomicservice + * @since 11 + */ + MULT_CHOICE = 300, + /** + *

Permanently move. The requested resource has been permanently moved to a new URI, + * and the returned information will include the new URI. The browser will automatically redirect to the new URI.

+ * @syscap SystemCapability.Communication.NetStack + * @since 6 + */ + /** + *

Permanently move. The requested resource has been permanently moved to a new URI, + * and the returned information will include the new URI. The browser will automatically redirect to the new URI.

+ * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + /** + *

Permanently move. The requested resource has been permanently moved to a new URI, + * and the returned information will include the new URI. The browser will automatically redirect to the new URI.

+ * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @atomicservice + * @since 11 + */ + MOVED_PERM, + /** + * Temporary movement. + * @syscap SystemCapability.Communication.NetStack + * @since 6 + */ + /** + * Temporary movement. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + /** + * Temporary movement. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @atomicservice + * @since 11 + */ + MOVED_TEMP, + /** + * View other addresses. + * @syscap SystemCapability.Communication.NetStack + * @since 6 + */ + /** + * View other addresses. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + /** + * View other addresses. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @atomicservice + * @since 11 + */ + SEE_OTHER, + /** + * Not modified. + * @syscap SystemCapability.Communication.NetStack + * @since 6 + */ + /** + * Not modified. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + /** + * Not modified. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @atomicservice + * @since 11 + */ + NOT_MODIFIED, + /** + * Using proxies. + * @syscap SystemCapability.Communication.NetStack + * @since 6 + */ + /** + * Using proxies. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + /** + * Using proxies. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @atomicservice + * @since 11 + */ + USE_PROXY, + /** + * The server cannot understand the syntax error error requested by the client. + * @syscap SystemCapability.Communication.NetStack + * @since 6 + */ + /** + * The server cannot understand the syntax error error requested by the client. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + /** + * The server cannot understand the syntax error error requested by the client. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @atomicservice + * @since 11 + */ + BAD_REQUEST = 400, + /** + * Request for user authentication. + * @syscap SystemCapability.Communication.NetStack + * @since 6 + */ + /** + * Request for user authentication. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + /** + * Request for user authentication. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @atomicservice + * @since 11 + */ + UNAUTHORIZED, + /** + * Reserved for future use. + * @syscap SystemCapability.Communication.NetStack + * @since 6 + */ + /** + * Reserved for future use. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + /** + * Reserved for future use. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @atomicservice + * @since 11 + */ + PAYMENT_REQUIRED, + /** + * The server understands the request from the requesting client, but refuses to execute it. + * @syscap SystemCapability.Communication.NetStack + * @since 6 + */ + /** + * The server understands the request from the requesting client, but refuses to execute it. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + /** + * The server understands the request from the requesting client, but refuses to execute it. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @atomicservice + * @since 11 + */ + FORBIDDEN, + /** + * The server was unable to find resources (web pages) based on the client's request. + * @syscap SystemCapability.Communication.NetStack + * @since 6 + */ + /** + * The server was unable to find resources (web pages) based on the client's request. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + /** + * The server was unable to find resources (web pages) based on the client's request. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @atomicservice + * @since 11 + */ + NOT_FOUND, + /** + * The method in the client request is prohibited. + * @syscap SystemCapability.Communication.NetStack + * @since 6 + */ + /** + * The method in the client request is prohibited. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + /** + * The method in the client request is prohibited. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @atomicservice + * @since 11 + */ + BAD_METHOD, + /** + * The server is unable to complete the request based on the content characteristics requested by the client. + * @syscap SystemCapability.Communication.NetStack + * @since 6 + */ + /** + * The server is unable to complete the request based on the content characteristics requested by the client. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + /** + * The server is unable to complete the request based on the content characteristics requested by the client. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @atomicservice + * @since 11 + */ + NOT_ACCEPTABLE, + /** + * Request authentication of the proxy's identity. + * @syscap SystemCapability.Communication.NetStack + * @since 6 + */ + /** + * Request authentication of the proxy's identity. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + /** + * Request authentication of the proxy's identity. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @atomicservice + * @since 11 + */ + PROXY_AUTH, + /** + * The request took too long and timed out. + * @syscap SystemCapability.Communication.NetStack + * @since 6 + */ + /** + * The request took too long and timed out. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + /** + * The request took too long and timed out. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @atomicservice + * @since 11 + */ + CLIENT_TIMEOUT, + /** + *

The server may have returned this code when completing the client's PUT request, + * as there was a conflict when the server was processing the request.

+ * @syscap SystemCapability.Communication.NetStack + * @since 6 + */ + /** + *

The server may have returned this code when completing the client's PUT request, + * as there was a conflict when the server was processing the request.

+ * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + /** + *

The server may have returned this code when completing the client's PUT request, + * as there was a conflict when the server was processing the request.

+ * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @atomicservice + * @since 11 + */ + CONFLICT, + /** + * The resource requested by the client no longer exists. + * @syscap SystemCapability.Communication.NetStack + * @since 6 + */ + /** + * The resource requested by the client no longer exists. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + /** + * The resource requested by the client no longer exists. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @atomicservice + * @since 11 + */ + GONE, + /** + * The server is unable to process request information sent by the client without Content Length. + * @syscap SystemCapability.Communication.NetStack + * @since 6 + */ + /** + * The server is unable to process request information sent by the client without Content Length. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + /** + * The server is unable to process request information sent by the client without Content Length. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @atomicservice + * @since 11 + */ + LENGTH_REQUIRED, + /** + * The prerequisite for requesting information from the client is incorrect. + * @syscap SystemCapability.Communication.NetStack + * @since 6 + */ + /** + * The prerequisite for requesting information from the client is incorrect. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + /** + * The prerequisite for requesting information from the client is incorrect. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @atomicservice + * @since 11 + */ + PRECON_FAILED, + /** + * The request was rejected because the requested entity was too large for the server to process. + * @syscap SystemCapability.Communication.NetStack + * @since 6 + */ + /** + * The request was rejected because the requested entity was too large for the server to process. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + /** + * The request was rejected because the requested entity was too large for the server to process. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @atomicservice + * @since 11 + */ + ENTITY_TOO_LARGE, + /** + * The requested URI is too long (usually a URL) and the server cannot process it. + * @syscap SystemCapability.Communication.NetStack + * @since 6 + */ + /** + * The requested URI is too long (usually a URL) and the server cannot process it. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + /** + * The requested URI is too long (usually a URL) and the server cannot process it. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @atomicservice + * @since 11 + */ + REQ_TOO_LONG, + /** + * The server is unable to process the requested format. + * @syscap SystemCapability.Communication.NetStack + * @since 6 + */ + /** + * The server is unable to process the requested format. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + /** + * The server is unable to process the requested format. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @atomicservice + * @since 11 + */ + UNSUPPORTED_TYPE, + /** + * The server cannot process the requested data range. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @atomicservice + * @since 12 + */ + RANGE_NOT_SATISFIABLE, + /** + * Internal server error, unable to complete the request. + * @syscap SystemCapability.Communication.NetStack + * @since 6 + */ + /** + * Internal server error, unable to complete the request. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + /** + * Internal server error, unable to complete the request. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @atomicservice + * @since 11 + */ + INTERNAL_ERROR = 500, + /** + * The server does not support the requested functionality and cannot complete the request. + * @syscap SystemCapability.Communication.NetStack + * @since 6 + */ + /** + * The server does not support the requested functionality and cannot complete the request. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + /** + * The server does not support the requested functionality and cannot complete the request. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @atomicservice + * @since 11 + */ + NOT_IMPLEMENTED, + /** + * The server acting as a gateway or proxy received an invalid request from the remote server. + * @syscap SystemCapability.Communication.NetStack + * @since 6 + */ + /** + * The server acting as a gateway or proxy received an invalid request from the remote server. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + /** + * The server acting as a gateway or proxy received an invalid request from the remote server. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @atomicservice + * @since 11 + */ + BAD_GATEWAY, + /** + * Due to overload or system maintenance, the server is temporarily unable to process client requests. + * @syscap SystemCapability.Communication.NetStack + * @since 6 + */ + /** + * Due to overload or system maintenance, the server is temporarily unable to process client requests. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + /** + * Due to overload or system maintenance, the server is temporarily unable to process client requests. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @atomicservice + * @since 11 + */ + UNAVAILABLE, + /** + * The server acting as a gateway or proxy did not obtain requests from the remote server in a timely manner. + * @syscap SystemCapability.Communication.NetStack + * @since 6 + */ + /** + * The server acting as a gateway or proxy did not obtain requests from the remote server in a timely manner. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + /** + * The server acting as a gateway or proxy did not obtain requests from the remote server in a timely manner. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @atomicservice + * @since 11 + */ + GATEWAY_TIMEOUT, + /** + * The version of the HTTP protocol requested by the server. + * @syscap SystemCapability.Communication.NetStack + * @since 6 + */ + /** + * The version of the HTTP protocol requested by the server. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + /** + * The version of the HTTP protocol requested by the server. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @atomicservice + * @since 11 + */ + VERSION + } + /** + * Supported protocols. + * @enum {string} + * @syscap SystemCapability.Communication.NetStack + * @since 9 + */ + /** + * Supported protocols. + * @enum {string} + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + /** + * Supported protocols. + * @enum {string} + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @atomicservice + * @since 11 + */ + export enum HttpProtocol { + /** + * Protocol http1.1 + * @syscap SystemCapability.Communication.NetStack + * @since 9 + */ + /** + * Protocol http1.1 + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + /** + * Protocol http1.1 + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @atomicservice + * @since 11 + */ + HTTP1_1, + /** + * Protocol http2 + * @syscap SystemCapability.Communication.NetStack + * @since 9 + */ + /** + * Protocol http2 + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + /** + * Protocol http2 + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @atomicservice + * @since 11 + */ + HTTP2, + /** + * Protocol http3 for https only. + * Cause error if using http only or not supporting http3 on this device. + * Fallback to http2 or http1.1 if needed. + * @syscap SystemCapability.Communication.NetStack + * @since 11 + */ + HTTP3 + } + /** + * Indicates the type of the returned data. + * @enum {number} + * @syscap SystemCapability.Communication.NetStack + * @since 9 + */ + /** + * Indicates the type of the returned data. + * @enum {number} + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + /** + * Indicates the type of the returned data. + * @enum {number} + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @atomicservice + * @since 11 + */ + export enum HttpDataType { + /** + * The returned type is string. + * @syscap SystemCapability.Communication.NetStack + * @since 9 + */ + /** + * The returned type is string. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + /** + * The returned type is string. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @atomicservice + * @since 11 + */ + STRING, + /** + * The returned type is Object. + * @syscap SystemCapability.Communication.NetStack + * @since 9 + */ + /** + * The returned type is Object. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + /** + * The returned type is Object. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @atomicservice + * @since 11 + */ + OBJECT = 1, + /** + * The returned type is ArrayBuffer. + * @syscap SystemCapability.Communication.NetStack + * @since 9 + */ + /** + * The returned type is ArrayBuffer. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + /** + * The returned type is ArrayBuffer. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @atomicservice + * @since 11 + */ + ARRAY_BUFFER = 2 + } + /** + * Defines the response to an HTTP request. + * @interface HttpResponse + * @syscap SystemCapability.Communication.NetStack + * @since 6 + */ + /** + * Defines the response to an HTTP request. + * @interface HttpResponse + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + /** + * Defines the response to an HTTP request. + * @interface HttpResponse + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @atomicservice + * @since 11 + */ + export interface HttpResponse { + /** + * result can be a string (API 6) or an ArrayBuffer(API 8). Object is deprecated from API 8. + * If {@link HttpRequestOptions#expectDataType} is set, the system preferentially returns this parameter. + * @type {string | Object | ArrayBuffer} + * @syscap SystemCapability.Communication.NetStack + * @since 6 + */ + /** + * result can be a string (API 6) or an ArrayBuffer(API 8). Object is deprecated from API 8. + * If {@link HttpRequestOptions#expectDataType} is set, the system preferentially returns this parameter. + * @type {string | Object | ArrayBuffer} + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + /** + * result can be a string (API 6) or an ArrayBuffer(API 8). Object is deprecated from API 8. + * If {@link HttpRequestOptions#expectDataType} is set, the system preferentially returns this parameter. + * @type {string | Object | ArrayBuffer} + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @atomicservice + * @since 11 + */ + result: string | Object | ArrayBuffer; + /** + * If the resultType is string, you can get result directly. + * If the resultType is Object, you can get result such as this: result['key']. + * If the resultType is ArrayBuffer, you can use ArrayBuffer to create the binary objects. + * @type {HttpDataType} + * @syscap SystemCapability.Communication.NetStack + * @since 9 + */ + /** + * If the resultType is string, you can get result directly. + * If the resultType is Object, you can get result such as this: result['key']. + * If the resultType is ArrayBuffer, you can use ArrayBuffer to create the binary objects. + * @type {HttpDataType} + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + /** + * If the resultType is string, you can get result directly. + * If the resultType is Object, you can get result such as this: result['key']. + * If the resultType is ArrayBuffer, you can use ArrayBuffer to create the binary objects. + * @type {HttpDataType} + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @atomicservice + * @since 11 + */ + resultType: HttpDataType; + /** + * Server status code. + * @type {ResponseCode | number} + * @syscap SystemCapability.Communication.NetStack + * @since 6 + */ + /** + * Server status code. + * @type {ResponseCode | number} + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + /** + * Server status code. + * @type {ResponseCode | number} + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @atomicservice + * @since 11 + */ + responseCode: ResponseCode | number; + /** + * All headers in the response from the server. + * @type {Object} + * @syscap SystemCapability.Communication.NetStack + * @since 6 + */ + /** + * All headers in the response from the server. + * @type {Object} + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + /** + * All headers in the response from the server. + * @type {Object} + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @atomicservice + * @since 11 + */ + header: Object; + /** + * Cookies returned by the server. + * @type {string} + * @syscap SystemCapability.Communication.NetStack + * @since 8 + */ + /** + * Cookies returned by the server. + * @type {string} + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + /** + * Cookies returned by the server. + * @type {string} + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @atomicservice + * @since 11 + */ + cookies: string; + /** + * The time taken of various stages of HTTP request. + * @type {PerformanceTiming} + * @syscap SystemCapability.Communication.NetStack + * @since 11 + */ + performanceTiming: PerformanceTiming; + } + /** + * Counting the time taken of various stages of HTTP request. + * @interface PerformanceTiming + * @syscap SystemCapability.Communication.NetStack + * @since 11 + */ + export interface PerformanceTiming { + /** + * Time taken from startup to DNS resolution completion, in milliseconds. + * @type {number} + * @syscap SystemCapability.Communication.NetStack + * @since 11 + */ + dnsTiming: number; + /** + * Time taken from startup to TCP connection completion, in milliseconds. + * @type {number} + * @syscap SystemCapability.Communication.NetStack + * @since 11 + */ + tcpTiming: number; + /** + * Time taken from startup to TLS connection completion, in milliseconds. + * @type {number} + * @syscap SystemCapability.Communication.NetStack + * @since 11 + */ + tlsTiming: number; + /** + * Time taken from startup to start sending the first byte, in milliseconds. + * @type {number} + * @syscap SystemCapability.Communication.NetStack + * @since 11 + */ + firstSendTiming: number; + /** + * Time taken from startup to receiving the first byte, in milliseconds. + * @type {number} + * @syscap SystemCapability.Communication.NetStack + * @since 11 + */ + firstReceiveTiming: number; + /** + * Time taken from startup to the completion of the request, in milliseconds. + * @type {number} + * @syscap SystemCapability.Communication.NetStack + * @since 11 + */ + totalFinishTiming: number; + /** + * Time taken from startup to completion of all redirection steps, in milliseconds. + * @type {number} + * @syscap SystemCapability.Communication.NetStack + * @since 11 + */ + redirectTiming: number; + /** + * Time taken from HTTP request to header completion, in milliseconds. + * @type {number} + * @syscap SystemCapability.Communication.NetStack + * @since 11 + */ + responseHeaderTiming: number; + /** + * Time taken from HTTP Request to body completion, in milliseconds. + * @type {number} + * @syscap SystemCapability.Communication.NetStack + * @since 11 + */ + responseBodyTiming: number; + /** + * Time taken from HTTP Request to callback to the application, in milliseconds. + * @type {number} + * @syscap SystemCapability.Communication.NetStack + * @since 11 + */ + totalTiming: number; + } + /** + * This interface is used to obtain the progress information of file upload or download. + * @interface DataReceiveProgressInfo + * @syscap SystemCapability.Communication.NetStack + * @since 11 + */ + export interface DataReceiveProgressInfo { + /** + * Number of data bytes received. + * @type { number } + * @syscap SystemCapability.Communication.NetStack + * @since 11 + */ + receiveSize: number; + /** + * Total number of bytes to receive. + * @type { number } + * @syscap SystemCapability.Communication.NetStack + * @since 11 + */ + totalSize: number; + } + /** + * This interface is used to monitor the progress of sending data. + * @interface DataSendProgressInfo + * @syscap SystemCapability.Communication.NetStack + * @since 11 + */ + export interface DataSendProgressInfo { + /** + * Used to specify the data size to be sent. + * @type { number } + * @syscap SystemCapability.Communication.NetStack + * @since 11 + */ + sendSize: number; + /** + * Total number of bytes to receive. + * @type { number } + * @syscap SystemCapability.Communication.NetStack + * @since 11 + */ + totalSize: number; + } + /** + * Creates a default {@code HttpResponseCache} object to store the responses of HTTP access requests. + * @param { number } cacheSize - the size of cache(max value is 10MB), default is 10*1024*1024(10MB). + * @returns { HttpResponseCache } the HttpResponseCache of the createHttpResponseCache. + * @syscap SystemCapability.Communication.NetStack + * @since 9 + */ + /** + * Creates a default {@code HttpResponseCache} object to store the responses of HTTP access requests. + * @param { number } cacheSize - the size of cache(max value is 10MB), default is 10*1024*1024(10MB). + * @returns { HttpResponseCache } the HttpResponseCache of the createHttpResponseCache. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + /** + * Creates a default {@code HttpResponseCache} object to store the responses of HTTP access requests. + * @param { number } cacheSize - the size of cache(max value is 10MB), default is 10*1024*1024(10MB). + * @returns { HttpResponseCache } the HttpResponseCache of the createHttpResponseCache. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @atomicservice + * @since 11 + */ + function createHttpResponseCache(cacheSize?: number): HttpResponseCache; + /** + * Defines an object that stores the response to an HTTP request. + * @interface HttpResponseCache + * @syscap SystemCapability.Communication.NetStack + * @since 9 + */ + /** + * Defines an object that stores the response to an HTTP request. + * @interface HttpResponseCache + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + /** + * Defines an object that stores the response to an HTTP request. + * @interface HttpResponseCache + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @atomicservice + * @since 11 + */ + export interface HttpResponseCache { + /** + * Writes data in the cache to the file system so that all the cached data can be accessed in the next HTTP request. + * @param { AsyncCallback } callback - the callback of flush. + * @syscap SystemCapability.Communication.NetStack + * @since 9 + */ + /** + * Writes data in the cache to the file system so that all the cached data can be accessed in the next HTTP request. + * @param { AsyncCallback } callback - the callback of flush. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + /** + * Writes data in the cache to the file system so that all the cached data can be accessed in the next HTTP request. + * @param { AsyncCallback } callback - the callback of flush. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @atomicservice + * @since 11 + */ + flush(callback: AsyncCallback): void; + /** + * Writes data in the cache to the file system so that all the cached data can be accessed in the next HTTP request. + * @returns { Promise } The promise returned by the flush. + * @syscap SystemCapability.Communication.NetStack + * @since 9 + */ + /** + * Writes data in the cache to the file system so that all the cached data can be accessed in the next HTTP request. + * @returns { Promise } The promise returned by the flush. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + /** + * Writes data in the cache to the file system so that all the cached data can be accessed in the next HTTP request. + * @returns { Promise } The promise returned by the flush. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @atomicservice + * @since 11 + */ + flush(): Promise; + /** + * Disables a cache and deletes the data in it. + * @param { AsyncCallback } callback - the callback of delete. + * @syscap SystemCapability.Communication.NetStack + * @since 9 + */ + /** + * Disables a cache and deletes the data in it. + * @param { AsyncCallback } callback - the callback of delete. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + /** + * Disables a cache and deletes the data in it. + * @param { AsyncCallback } callback - the callback of delete. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @atomicservice + * @since 11 + */ + delete(callback: AsyncCallback): void; + /** + * Disables a cache and deletes the data in it. + * @returns { Promise } The promise returned by the delete. + * @syscap SystemCapability.Communication.NetStack + * @since 9 + */ + /** + * Disables a cache and deletes the data in it. + * @returns { Promise } The promise returned by the delete. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + /** + * Disables a cache and deletes the data in it. + * @returns { Promise } The promise returned by the delete. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @atomicservice + * @since 11 + */ + delete(): Promise; + } +} +export default http; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.net.mdns.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.net.mdns.d.ts new file mode 100755 index 00000000..78e571e1 --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.net.mdns.d.ts @@ -0,0 +1,619 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit NetworkKit + */ +import { AsyncCallback, Callback } from "./@ohos.base"; +import connection from "./@ohos.net.connection"; +import Context from "./application/Context"; +/** + * Provides interfaces to discover DNS based services on a local network over Multicast DNS. + * @namespace mdns + * @syscap SystemCapability.Communication.NetManager.MDNS + * @since 10 + */ +/** + * Provides interfaces to discover DNS based services on a local network over Multicast DNS. + * @namespace mdns + * @syscap SystemCapability.Communication.NetManager.MDNS + * @atomicservice + * @since 11 + */ +declare namespace mdns { + /** + * Get a network address. + * @syscap SystemCapability.Communication.NetManager.Core + * @since 10 + */ + type NetAddress = connection.NetAddress; + /** + * Adds an mDNS service. + * @param { Context } context - Indicates the context of application or capability. + * @param { LocalServiceInfo } serviceInfo - Information about the mDNS service. {@link LocalServiceInfo} + * @param { AsyncCallback } callback - the callback of addLocalService. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 2100002 - Failed to connect to the service. + * @throws { BusinessError } 2100003 - System internal error. + * @throws { BusinessError } 2204003 - Callback duplicated. + * @throws { BusinessError } 2204008 - Failed to delete the service instance. + * @throws { BusinessError } 2204010 - Failed to send the message. + * @syscap SystemCapability.Communication.NetManager.MDNS + * @since 10 + */ + /** + * Adds an mDNS service. + * @param { Context } context - Indicates the context of application or capability. + * @param { LocalServiceInfo } serviceInfo - Information about the mDNS service. {@link LocalServiceInfo} + * @param { AsyncCallback } callback - the callback of addLocalService. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 2100002 - Failed to connect to the service. + * @throws { BusinessError } 2100003 - System internal error. + * @throws { BusinessError } 2204003 - Callback duplicated. + * @throws { BusinessError } 2204008 - Failed to delete the service instance. + * @throws { BusinessError } 2204010 - Failed to send the message. + * @syscap SystemCapability.Communication.NetManager.MDNS + * @atomicservice + * @since 11 + */ + function addLocalService(context: Context, serviceInfo: LocalServiceInfo, callback: AsyncCallback): void; + /** + * Adds an mDNS service. + * @param { Context } context - Indicates the context of application or capability. + * @param { LocalServiceInfo } serviceInfo - Information about the mDNS service. {@link LocalServiceInfo} + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 2100002 - Failed to connect to the service. + * @throws { BusinessError } 2100003 - System internal error. + * @throws { BusinessError } 2204003 - Callback duplicated. + * @throws { BusinessError } 2204008 - Failed to delete the service instance. + * @throws { BusinessError } 2204010 - Failed to send the message. + * @syscap SystemCapability.Communication.NetManager.MDNS + * @since 10 + */ + /** + * Adds an mDNS service. + * @param { Context } context - Indicates the context of application or capability. + * @param { LocalServiceInfo } serviceInfo - Information about the mDNS service. {@link LocalServiceInfo} + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 2100002 - Failed to connect to the service. + * @throws { BusinessError } 2100003 - System internal error. + * @throws { BusinessError } 2204003 - Callback duplicated. + * @throws { BusinessError } 2204008 - Failed to delete the service instance. + * @throws { BusinessError } 2204010 - Failed to send the message. + * @syscap SystemCapability.Communication.NetManager.MDNS + * @atomicservice + * @since 11 + */ + function addLocalService(context: Context, serviceInfo: LocalServiceInfo): Promise; + /** + * Removes an mDNS service. + * @param { Context } context - Indicates the context of application or capability. + * @param { LocalServiceInfo } serviceInfo - Information about the mDNS service. {@link LocalServiceInfo} + * @param { AsyncCallback } callback - the callback of removeLocalService. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 2100002 - Failed to connect to the service. + * @throws { BusinessError } 2100003 - System internal error. + * @throws { BusinessError } 2204002 - Callback not found. + * @throws { BusinessError } 2204008 - Failed to delete the service instance. + * @throws { BusinessError } 2204010 - Failed to send the message. + * @syscap SystemCapability.Communication.NetManager.MDNS + * @since 10 + */ + /** + * Removes an mDNS service. + * @param { Context } context - Indicates the context of application or capability. + * @param { LocalServiceInfo } serviceInfo - Information about the mDNS service. {@link LocalServiceInfo} + * @param { AsyncCallback } callback - the callback of removeLocalService. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 2100002 - Failed to connect to the service. + * @throws { BusinessError } 2100003 - System internal error. + * @throws { BusinessError } 2204002 - Callback not found. + * @throws { BusinessError } 2204008 - Failed to delete the service instance. + * @throws { BusinessError } 2204010 - Failed to send the message. + * @syscap SystemCapability.Communication.NetManager.MDNS + * @atomicservice + * @since 11 + */ + function removeLocalService(context: Context, serviceInfo: LocalServiceInfo, callback: AsyncCallback): void; + /** + * Removes an mDNS service. + * @param { Context } context - Indicates the context of application or capability. + * @param { LocalServiceInfo } serviceInfo - Information about the mDNS service. {@link LocalServiceInfo} + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 2100002 - Failed to connect to the service. + * @throws { BusinessError } 2100003 - System internal error. + * @throws { BusinessError } 2204002 - Callback not found. + * @throws { BusinessError } 2204008 - Failed to delete the service instance. + * @throws { BusinessError } 2204010 - Failed to send the message. + * @syscap SystemCapability.Communication.NetManager.MDNS + * @since 10 + */ + /** + * Removes an mDNS service. + * @param { Context } context - Indicates the context of application or capability. + * @param { LocalServiceInfo } serviceInfo - Information about the mDNS service. {@link LocalServiceInfo} + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 2100002 - Failed to connect to the service. + * @throws { BusinessError } 2100003 - System internal error. + * @throws { BusinessError } 2204002 - Callback not found. + * @throws { BusinessError } 2204008 - Failed to delete the service instance. + * @throws { BusinessError } 2204010 - Failed to send the message. + * @syscap SystemCapability.Communication.NetManager.MDNS + * @atomicservice + * @since 11 + */ + function removeLocalService(context: Context, serviceInfo: LocalServiceInfo): Promise; + /** + * Create an mDNS based discovery service with context and serviceType. + * @param { Context } context - Indicates the context of application or capability. + * @param { string } serviceType - The service type being discovered. + * @returns { DiscoveryService } the DiscoveryService of the createDiscoveryService. + * @throws { BusinessError } 401 - Parameter error. + * @syscap SystemCapability.Communication.NetManager.MDNS + * @since 10 + */ + /** + * Create an mDNS based discovery service with context and serviceType. + * @param { Context } context - Indicates the context of application or capability. + * @param { string } serviceType - The service type being discovered. + * @returns { DiscoveryService } the DiscoveryService of the createDiscoveryService. + * @throws { BusinessError } 401 - Parameter error. + * @syscap SystemCapability.Communication.NetManager.MDNS + * @atomicservice + * @since 11 + */ + function createDiscoveryService(context: Context, serviceType: string): DiscoveryService; + /** + * Resolves an mDNS service. + * @param { Context } context - Indicates the context of application or capability. + * @param { LocalServiceInfo } serviceInfo - Information about the mDNS service. {@link LocalServiceInfo} + * @param { AsyncCallback } callback - the callback of resolveLocalService. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 2100002 - Failed to connect to the service. + * @throws { BusinessError } 2100003 - System internal error. + * @throws { BusinessError } 2204003 - Callback duplicated. + * @throws { BusinessError } 2204006 - Request timeout. + * @throws { BusinessError } 2204010 - Failed to send the message. + * @syscap SystemCapability.Communication.NetManager.MDNS + * @since 10 + */ + /** + * Resolves an mDNS service. + * @param { Context } context - Indicates the context of application or capability. + * @param { LocalServiceInfo } serviceInfo - Information about the mDNS service. {@link LocalServiceInfo} + * @param { AsyncCallback } callback - the callback of resolveLocalService. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 2100002 - Failed to connect to the service. + * @throws { BusinessError } 2100003 - System internal error. + * @throws { BusinessError } 2204003 - Callback duplicated. + * @throws { BusinessError } 2204006 - Request timeout. + * @throws { BusinessError } 2204010 - Failed to send the message. + * @syscap SystemCapability.Communication.NetManager.MDNS + * @atomicservice + * @since 11 + */ + function resolveLocalService(context: Context, serviceInfo: LocalServiceInfo, callback: AsyncCallback): void; + /** + * Resolves an mDNS service. + * @param { Context } context - Indicates the context of application or capability. + * @param { LocalServiceInfo } serviceInfo - Information about the mDNS service. {@link LocalServiceInfo} + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 2100002 - Failed to connect to the service. + * @throws { BusinessError } 2100003 - System internal error. + * @throws { BusinessError } 2204003 - Callback duplicated. + * @throws { BusinessError } 2204006 - Request timeout. + * @throws { BusinessError } 2204010 - Failed to send the message. + * @syscap SystemCapability.Communication.NetManager.MDNS + * @since 10 + */ + /** + * Resolves an mDNS service. + * @param { Context } context - Indicates the context of application or capability. + * @param { LocalServiceInfo } serviceInfo - Information about the mDNS service. {@link LocalServiceInfo} + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 2100002 - Failed to connect to the service. + * @throws { BusinessError } 2100003 - System internal error. + * @throws { BusinessError } 2204003 - Callback duplicated. + * @throws { BusinessError } 2204006 - Request timeout. + * @throws { BusinessError } 2204010 - Failed to send the message. + * @syscap SystemCapability.Communication.NetManager.MDNS + * @atomicservice + * @since 11 + */ + function resolveLocalService(context: Context, serviceInfo: LocalServiceInfo): Promise; + /** + * Defines a DiscoveryService object for discovering mDNS services of the specified type. + * @interface DiscoveryService + * @syscap SystemCapability.Communication.NetManager.MDNS + * @since 10 + */ + /** + * Defines a DiscoveryService object for discovering mDNS services of the specified type. + * @interface DiscoveryService + * @syscap SystemCapability.Communication.NetManager.MDNS + * @atomicservice + * @since 11 + */ + export interface DiscoveryService { + /** + * Enables listening for discoveryStart events of mDNS services. + * @param { 'discoveryStart' } type - Indicates Event name. + * @param { Callback<{ serviceInfo: LocalServiceInfo, errorCode?: MdnsError }> } callback - the callback used to return the result. + * @syscap SystemCapability.Communication.NetManager.MDNS + * @since 10 + */ + /** + * Enables listening for discoveryStart events of mDNS services. + * @param { 'discoveryStart' } type - Indicates Event name. + * @param { Callback } callback - the callback used to return the result. + * @syscap SystemCapability.Communication.NetManager.MDNS + * @atomicservice + * @since 11 + */ + on(type: 'discoveryStart', callback: Callback): void; + /** + * Cancels listening for discoveryStart events of mDNS services. + * @param { 'discoveryStart' } type - Indicates Event name. + * @param { Callback<{ serviceInfo: LocalServiceInfo, errorCode?: MdnsError }> } callback - the callback used to return the result. + * @syscap SystemCapability.Communication.NetManager.MDNS + * @since 10 + */ + /** + * Cancels listening for discoveryStart events of mDNS services. + * @param { 'discoveryStart' } type - Indicates Event name. + * @param { Callback } callback - the callback used to return the result. + * @syscap SystemCapability.Communication.NetManager.MDNS + * @atomicservice + * @since 11 + */ + off(type: 'discoveryStart', callback?: Callback): void; + /** + * Enables listening for discoveryStop events of mDNS services. + * @param { 'discoveryStop' } type - Indicates Event name. + * @param { Callback<{ serviceInfo: LocalServiceInfo, errorCode?: MdnsError }> } callback - the callback used to return the result. + * @syscap SystemCapability.Communication.NetManager.MDNS + * @since 10 + */ + /** + * Enables listening for discoveryStop events of mDNS services. + * @param { 'discoveryStop' } type - Indicates Event name. + * @param { Callback } callback - the callback used to return the result. + * @syscap SystemCapability.Communication.NetManager.MDNS + * @atomicservice + * @since 11 + */ + on(type: 'discoveryStop', callback: Callback): void; + /** + * Cancels listening for discoveryStop events of mDNS services. + * @param { 'discoveryStop' } type - Indicates Event name. + * @param { Callback<{ serviceInfo: LocalServiceInfo, errorCode?: MdnsError }> } callback - the callback used to return the result. + * @syscap SystemCapability.Communication.NetManager.MDNS + * @since 10 + */ + /** + * Cancels listening for discoveryStop events of mDNS services. + * @param { 'discoveryStop' } type - Indicates Event name. + * @param { Callback } callback - the callback used to return the result. + * @syscap SystemCapability.Communication.NetManager.MDNS + * @atomicservice + * @since 11 + */ + off(type: 'discoveryStop', callback?: Callback): void; + /** + * Enables listening for serviceFound events of mDNS services. + * @param { 'serviceFound' } type - Indicates Event name. + * @param { Callback } callback - the callback used to return the result. + * @syscap SystemCapability.Communication.NetManager.MDNS + * @since 10 + */ + /** + * Enables listening for serviceFound events of mDNS services. + * @param { 'serviceFound' } type - Indicates Event name. + * @param { Callback } callback - the callback used to return the result. + * @syscap SystemCapability.Communication.NetManager.MDNS + * @atomicservice + * @since 11 + */ + on(type: 'serviceFound', callback: Callback): void; + /** + * Cancels listening for serviceFound events of mDNS services. + * @param { 'serviceFound' } type - Indicates Event name. + * @param { Callback } callback - the callback used to return the result. + * @syscap SystemCapability.Communication.NetManager.MDNS + * @since 10 + */ + /** + * Cancels listening for serviceFound events of mDNS services. + * @param { 'serviceFound' } type - Indicates Event name. + * @param { Callback } callback - the callback used to return the result. + * @syscap SystemCapability.Communication.NetManager.MDNS + * @atomicservice + * @since 11 + */ + off(type: 'serviceFound', callback?: Callback): void; + /** + * Enables listening for serviceLost events of mDNS services. + * @param { 'serviceLost' } type - Indicates Event name. + * @param { Callback } callback - the callback used to return the result. + * @syscap SystemCapability.Communication.NetManager.MDNS + * @since 10 + */ + /** + * Enables listening for serviceLost events of mDNS services. + * @param { 'serviceLost' } type - Indicates Event name. + * @param { Callback } callback - the callback used to return the result. + * @syscap SystemCapability.Communication.NetManager.MDNS + * @atomicservice + * @since 11 + */ + on(type: 'serviceLost', callback: Callback): void; + /** + * Cancels listening for serviceLost events of mDNS services. + * @param { 'serviceLost' } type - Indicates Event name. + * @param { Callback } callback - the callback used to return the result. + * @syscap SystemCapability.Communication.NetManager.MDNS + * @since 10 + */ + /** + * Cancels listening for serviceLost events of mDNS services. + * @param { 'serviceLost' } type - Indicates Event name. + * @param { Callback } callback - the callback used to return the result. + * @syscap SystemCapability.Communication.NetManager.MDNS + * @atomicservice + * @since 11 + */ + off(type: 'serviceLost', callback?: Callback): void; + /** + * Starts searching for mDNS services on the LAN. + * @syscap SystemCapability.Communication.NetManager.MDNS + * @since 10 + */ + /** + * Starts searching for mDNS services on the LAN. + * @syscap SystemCapability.Communication.NetManager.MDNS + * @atomicservice + * @since 11 + */ + startSearchingMDNS(): void; + /** + * Stops searching for mDNS services on the LAN. + * @syscap SystemCapability.Communication.NetManager.MDNS + * @since 10 + */ + /** + * Stops searching for mDNS services on the LAN. + * @syscap SystemCapability.Communication.NetManager.MDNS + * @atomicservice + * @since 11 + */ + stopSearchingMDNS(): void; + } + /** + * Defines the mDNS service information. + * @interface LocalServiceInfo + * @syscap SystemCapability.Communication.NetManager.MDNS + * @since 10 + */ + /** + * Defines the mDNS service information. + * @interface LocalServiceInfo + * @syscap SystemCapability.Communication.NetManager.MDNS + * @atomicservice + * @since 11 + */ + export interface LocalServiceInfo { + /** + * Service type. Use an underscore (_) as the prefix, for example, _http._tcp. + * @type {string} + * @syscap SystemCapability.Communication.NetManager.MDNS + * @since 10 + */ + /** + * Service type. Use an underscore (_) as the prefix, for example, _http._tcp. + * @type {string} + * @syscap SystemCapability.Communication.NetManager.MDNS + * @atomicservice + * @since 11 + */ + serviceType: string; + /** + * Service name. + * @type {string} + * @syscap SystemCapability.Communication.NetManager.MDNS + * @since 10 + */ + /** + * Service name. + * @type {string} + * @syscap SystemCapability.Communication.NetManager.MDNS + * @atomicservice + * @since 11 + */ + serviceName: string; + /** + * Port number. + * @type {?number} + * @syscap SystemCapability.Communication.NetManager.MDNS + * @since 10 + */ + /** + * Port number. + * @type {?number} + * @syscap SystemCapability.Communication.NetManager.MDNS + * @atomicservice + * @since 11 + */ + port?: number; + /** + * IP address of the host. + * @type {?NetAddress} + * @syscap SystemCapability.Communication.NetManager.MDNS + * @since 10 + */ + /** + * IP address of the host. + * @type {?NetAddress} + * @syscap SystemCapability.Communication.NetManager.MDNS + * @atomicservice + * @since 11 + */ + host?: NetAddress; + /** + * DNS-SD TXT record pairs. + * @type {?Array} + * @syscap SystemCapability.Communication.NetManager.MDNS + * @since 10 + */ + /** + * DNS-SD TXT record pairs. + * @type {?Array} + * @syscap SystemCapability.Communication.NetManager.MDNS + * @atomicservice + * @since 11 + */ + serviceAttribute?: Array; + } + /** + * Defines the mDNS service attribute information. + * @interface ServiceAttribute + * @syscap SystemCapability.Communication.NetManager.MDNS + * @since 10 + */ + /** + * Defines the mDNS service attribute information. + * @interface ServiceAttribute + * @syscap SystemCapability.Communication.NetManager.MDNS + * @atomicservice + * @since 11 + */ + export interface ServiceAttribute { + /** + * TXT record key. + * @type {string} + * @syscap SystemCapability.Communication.NetManager.MDNS + * @since 10 + */ + /** + * TXT record key. + * @type {string} + * @syscap SystemCapability.Communication.NetManager.MDNS + * @atomicservice + * @since 11 + */ + key: string; + /** + * TXT record value. + * @type {Array} + * @syscap SystemCapability.Communication.NetManager.MDNS + * @since 10 + */ + /** + * TXT record value. + * @type {Array} + * @syscap SystemCapability.Communication.NetManager.MDNS + * @atomicservice + * @since 11 + */ + value: Array; + } + /** + * Defines the discovery events information of mDNS services. + * @interface DiscoveryEventInfo + * @syscap SystemCapability.Communication.NetManager.MDNS + * @atomicservice + * @since 11 + */ + export interface DiscoveryEventInfo { + /** + * Information about the mDNS service. + * @type {LocalServiceInfo} + * @syscap SystemCapability.Communication.NetManager.MDNS + * @atomicservice + * @since 11 + */ + serviceInfo: LocalServiceInfo; + /** + * The mDNS error information. + * @type {?MdnsError} + * @syscap SystemCapability.Communication.NetManager.MDNS + * @atomicservice + * @since 11 + */ + errorCode?: MdnsError; + } + /** + * Defines the mDNS error information. + * @enum {number} + * @syscap SystemCapability.Communication.NetManager.MDNS + * @since 10 + */ + /** + * Defines the mDNS error information. + * @enum {number} + * @syscap SystemCapability.Communication.NetManager.MDNS + * @atomicservice + * @since 11 + */ + export enum MdnsError { + /** + * Indicates that the operation failed due to internal error. + * @syscap SystemCapability.Communication.NetManager.MDNS + * @since 10 + */ + /** + * Indicates that the operation failed due to internal error. + * @syscap SystemCapability.Communication.NetManager.MDNS + * @atomicservice + * @since 11 + */ + INTERNAL_ERROR = 0, + /** + * Indicates that the operation failed because it is already active. + * @syscap SystemCapability.Communication.NetManager.MDNS + * @since 10 + */ + /** + * Indicates that the operation failed because it is already active. + * @syscap SystemCapability.Communication.NetManager.MDNS + * @atomicservice + * @since 11 + */ + ALREADY_ACTIVE = 1, + /** + *

Indicates that the operation failed because the maximum outstanding + * requests from the applications have reached.

+ * @syscap SystemCapability.Communication.NetManager.MDNS + * @since 10 + */ + /** + *

Indicates that the operation failed because the maximum outstanding + * requests from the applications have reached.

+ * @syscap SystemCapability.Communication.NetManager.MDNS + * @atomicservice + * @since 11 + */ + MAX_LIMIT = 2 + } +} +/** + * @since 10 + */ +export default mdns; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.net.networkSecurity.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.net.networkSecurity.d.ts new file mode 100755 index 00000000..51d5f699 --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.net.networkSecurity.d.ts @@ -0,0 +1,121 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit NetworkKit + */ + +/** + * Provides networkSecurity related APIs. + * @namespace networkSecurity + * @syscap SystemCapability.Communication.NetStack + * @since 11 + */ +declare namespace networkSecurity { + /** + * Defines the certificate type. + * @enum {number} + * @syscap SystemCapability.Communication.NetStack + * @since 11 + */ + export enum CertType { + /** + * PEM type certificate. + * @syscap SystemCapability.Communication.NetStack + * @since 11 + */ + CERT_TYPE_PEM = 0, + /** + * DER type certificate. + * @syscap SystemCapability.Communication.NetStack + * @since 11 + */ + CERT_TYPE_DER = 1 + } + /** + * Define the certificate content. + * @interface CertBlob + * @syscap SystemCapability.Communication.NetStack + * @since 11 + */ + export interface CertBlob { + /** + * Certificate type. + * @type { CertType } + * @syscap SystemCapability.Communication.NetStack + * @since 11 + */ + type: CertType; + /** + * Certificate data. + * @type {string | ArrayBuffer} + * @syscap SystemCapability.Communication.NetStack + * @since 11 + */ + data: string | ArrayBuffer; + } + /** + * Certificate verification to the server. + * @param { CertBlob } cert - Certificates to be verified. + * @param { CertBlob } [caCert] - Incoming custom CA cert. + * @returns { Promise } The promise returned by the function. + * Number equals 0 if verify of certification from server succeed, else verify failed. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 2305001 - Unspecified error. + * @throws { BusinessError } 2305002 - Unable to get issuer certificate. + * @throws { BusinessError } 2305003 - Unable to get certificate revocation list (CRL). + * @throws { BusinessError } 2305004 - Unable to decrypt certificate signature. + * @throws { BusinessError } 2305005 - Unable to decrypt CRL signature. + * @throws { BusinessError } 2305006 - Unable to decode issuer public key. + * @throws { BusinessError } 2305007 - Certificate signature failure. + * @throws { BusinessError } 2305008 - CRL signature failure. + * @throws { BusinessError } 2305009 - Certificate is not yet valid. + * @throws { BusinessError } 2305010 - Certificate has expired. + * @throws { BusinessError } 2305011 - CRL is not yet valid. + * @throws { BusinessError } 2305012 - CRL has expired. + * @throws { BusinessError } 2305023 - Certificate has been revoked. + * @throws { BusinessError } 2305024 - Invalid certificate authority (CA). + * @throws { BusinessError } 2305027 - Certificate is untrusted. + * @syscap SystemCapability.Communication.NetStack + * @since 11 + */ + export function certVerification(cert: CertBlob, caCert?: CertBlob): Promise; + /** + * Certificate verification to the server. + * @param { CertBlob } cert - Certificates to be verified. + * @param { CertBlob } [caCert] - Incoming custom CA cert. + * @returns { number } Returns 0 if verify of certification from server succeed, else verify failed. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 2305001 - Unspecified error. + * @throws { BusinessError } 2305002 - Unable to get issuer certificate. + * @throws { BusinessError } 2305003 - Unable to get certificate revocation list (CRL). + * @throws { BusinessError } 2305004 - Unable to decrypt certificate signature. + * @throws { BusinessError } 2305005 - Unable to decrypt CRL signature. + * @throws { BusinessError } 2305006 - Unable to decode issuer public key. + * @throws { BusinessError } 2305007 - Certificate signature failure. + * @throws { BusinessError } 2305008 - CRL signature failure. + * @throws { BusinessError } 2305009 - Certificate is not yet valid. + * @throws { BusinessError } 2305010 - Certificate has expired. + * @throws { BusinessError } 2305011 - CRL is not yet valid. + * @throws { BusinessError } 2305012 - CRL has expired. + * @throws { BusinessError } 2305023 - Certificate has been revoked. + * @throws { BusinessError } 2305024 - Invalid certificate authority (CA). + * @throws { BusinessError } 2305027 - Certificate is untrusted. + * @syscap SystemCapability.Communication.NetStack + * @since 11 + */ + export function certVerificationSync(cert: CertBlob, caCert?: CertBlob): number; +} +export default networkSecurity; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.net.policy.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.net.policy.d.ts new file mode 100755 index 00000000..03ed6dcf --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.net.policy.d.ts @@ -0,0 +1,35 @@ +/* + * Copyright (C) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit NetworkKit + */ + +import type connection from './@ohos.net.connection'; +/** + * Provides interfaces to manage network policy rules. + * @namespace policy + * @syscap SystemCapability.Communication.NetManager.Core + * @since 10 + */ +declare namespace policy { + /** + * Get network bear type. + * @syscap SystemCapability.Communication.NetManager.Core + * @since 10 + */ + type NetBearType = connection.NetBearType; +} +export default policy; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.net.sharing.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.net.sharing.d.ts new file mode 100755 index 00000000..8ee5fa07 --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.net.sharing.d.ts @@ -0,0 +1,35 @@ +/* + * Copyright (C) 2022-2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit NetworkKit + */ + +import type connection from './@ohos.net.connection'; +/** + * Provides network sharing related interfaces. + * @namespace sharing + * @syscap SystemCapability.Communication.NetManager.NetSharing + * @since 9 + */ +declare namespace sharing { + /** + * Get the handle of the data network. + * @syscap SystemCapability.Communication.NetManager.Core + * @since 9 + */ + type NetHandle = connection.NetHandle; +} +export default sharing; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.net.socket.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.net.socket.d.ts new file mode 100755 index 00000000..54b005ae --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.net.socket.d.ts @@ -0,0 +1,3589 @@ +/* + * Copyright (c) 2021-2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit NetworkKit + */ +import type { AsyncCallback, Callback, ErrorCallback } from './@ohos.base'; +import connection from "./@ohos.net.connection"; +import type cert from './@ohos.security.cert'; +/** + * Provides TCP and UDP Socket APIs. + * @namespace socket + * @syscap SystemCapability.Communication.NetStack + * @since 7 + */ +/** + * Provides TCP and UDP Socket APIs. + * @namespace socket + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ +declare namespace socket { + export import NetAddress = connection.NetAddress; + /** + * Deposit certificate + * @syscap SystemCapability.Communication.NetStack + * @since 9 + */ + /** + * Deposit certificate + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + export type X509CertRawData = cert.EncodingBlob; + /** + * Creates a UDPSocket object. + * @returns { UDPSocket } the UDPSocket of the constructUDPSocketInstance. + * @syscap SystemCapability.Communication.NetStack + * @since 7 + */ + /** + * Creates a UDPSocket object. + * @returns { UDPSocket } the UDPSocket of the constructUDPSocketInstance. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + function constructUDPSocketInstance(): UDPSocket; + /** + * Creates a MulticastSocket object. + * @returns { MulticastSocket } the MulticastSocket of the constructMulticastSocketInstance. + * @syscap SystemCapability.Communication.NetStack + * @since 11 + */ + function constructMulticastSocketInstance(): MulticastSocket; + /** + * Creates a TCPSocket object. + * @returns { TCPSocket } the TCPSocket of the constructTCPSocketInstance. + * @syscap SystemCapability.Communication.NetStack + * @since 7 + */ + /** + * Creates a TCPSocket object. + * @returns { TCPSocket } the TCPSocket of the constructTCPSocketInstance. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + function constructTCPSocketInstance(): TCPSocket; + /** + * Creates a TLSSocket object. + * @returns { TLSSocket } the TLSSocket of the constructTLSSocketInstance. + * @syscap SystemCapability.Communication.NetStack + * @since 9 + */ + /** + * Creates a TLSSocket object. + * @returns { TLSSocket } the TLSSocket of the constructTLSSocketInstance. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + function constructTLSSocketInstance(): TLSSocket; + /** + * Creates a TCPSocketServer object. + * @returns { TCPSocketServer } the TCPSocketServer of the constructTCPSocketServerInstance. + * @syscap SystemCapability.Communication.NetStack + * @since 10 + */ + function constructTCPSocketServerInstance(): TCPSocketServer; + /** + * Creates a TLSSocketServer object. + * @returns { TLSSocketServer } the TLSSocketServer of the constructTLSSocketServerInstance. + * @syscap SystemCapability.Communication.NetStack + * @since 10 + */ + function constructTLSSocketServerInstance(): TLSSocketServer; + /** + * Creates a LocalSocket object. + * @returns { LocalSocket } the LocalSocket of the constructLocalSocketInstance. + * @syscap SystemCapability.Communication.NetStack + * @since 11 + */ + function constructLocalSocketInstance(): LocalSocket; + /** + * Creates a LocalSocketServer object. + * @returns { LocalSocketServer } the LocalSocketServer of the constructLocalSocketServerInstance. + * @syscap SystemCapability.Communication.NetStack + * @since 11 + */ + function constructLocalSocketServerInstance(): LocalSocketServer; + /** + * Defines the parameters for sending data over the UDPSocket connection. + * @interface UDPSendOptions + * @syscap SystemCapability.Communication.NetStack + * @since 7 + */ + /** + * Defines the parameters for sending data over the UDPSocket connection. + * @interface UDPSendOptions + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + export interface UDPSendOptions { + /** + * Data to send. + * @type {string | ArrayBuffer} + * @syscap SystemCapability.Communication.NetStack + * @since 7 + */ + /** + * Data to send. + * @type {string | ArrayBuffer} + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + data: string | ArrayBuffer; + /** + * Destination address. + * @type {NetAddress} + * @syscap SystemCapability.Communication.NetStack + * @since 7 + */ + /** + * Destination address. + * @type {NetAddress} + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + address: NetAddress; + } + /** + * @interface ExtraOptionsBase + * @syscap SystemCapability.Communication.NetStack + * @since 7 + */ + /** + * @interface ExtraOptionsBase + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + export interface ExtraOptionsBase { + /** + * Size of the receive buffer, in MBS. + * @type {?number} + * @syscap SystemCapability.Communication.NetStack + * @since 7 + */ + /** + * Size of the receive buffer, in MBS. + * @type {?number} + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + receiveBufferSize?: number; + /** + * Size of the send buffer, in MBS. + * @type {?number} + * @syscap SystemCapability.Communication.NetStack + * @since 7 + */ + /** + * Size of the send buffer, in MBS. + * @type {?number} + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + sendBufferSize?: number; + /** + * Whether to reuse addresses. The default value is false. + * @type {?boolean} + * @syscap SystemCapability.Communication.NetStack + * @since 7 + */ + /** + * Whether to reuse addresses. The default value is false. + * @type {?boolean} + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + reuseAddress?: boolean; + /** + * Timeout duration of the UDPSocket connection, in milliseconds. + * @type {?number} + * @syscap SystemCapability.Communication.NetStack + * @since 7 + */ + /** + * Timeout duration of the UDPSocket connection, in milliseconds. + * @type {?number} + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + socketTimeout?: number; + } + /** + * Defines other properties of the UDPSocket connection. + * @interface UDPExtraOptions + * @syscap SystemCapability.Communication.NetStack + * @since 7 + */ + /** + * Defines other properties of the UDPSocket connection. + * @interface UDPExtraOptions + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + export interface UDPExtraOptions extends ExtraOptionsBase { + /** + * Whether to send broadcast messages. The default value is false. + * @type {?boolean} + * @syscap SystemCapability.Communication.NetStack + * @since 7 + */ + /** + * Whether to send broadcast messages. The default value is false. + * @type {?boolean} + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + broadcast?: boolean; + } + /** + * Defines the status of the socket connection. + * @interface SocketStateBase + * @syscap SystemCapability.Communication.NetStack + * @since 7 + */ + /** + * Defines the status of the socket connection. + * @interface SocketStateBase + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + export interface SocketStateBase { + /** + * Whether the connection is in the bound state. + * @type {boolean} + * @syscap SystemCapability.Communication.NetStack + * @since 7 + */ + /** + * Whether the connection is in the bound state. + * @type {boolean} + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + isBound: boolean; + /** + * Whether the connection is in the closed state. + * @type {boolean} + * @syscap SystemCapability.Communication.NetStack + * @since 7 + */ + /** + * Whether the connection is in the closed state. + * @type {boolean} + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + isClose: boolean; + /** + * Whether the connection is in the connected state. + * @type {boolean} + * @syscap SystemCapability.Communication.NetStack + * @since 7 + */ + /** + * Whether the connection is in the connected state. + * @type {boolean} + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + isConnected: boolean; + } + /** + * Defines information about the socket connection. + * @interface SocketRemoteInfo + * @syscap SystemCapability.Communication.NetStack + * @since 7 + */ + /** + * Defines information about the socket connection. + * @interface SocketRemoteInfo + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + export interface SocketRemoteInfo { + /** + * Bound IP address. + * @type {string} + * @syscap SystemCapability.Communication.NetStack + * @since 7 + */ + /** + * Bound IP address. + * @type {string} + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + address: string; + /** + * Network protocol type. The options are as follows: IPv4, IPv6. + * @type {'IPv4' | 'IPv6'} + * @syscap SystemCapability.Communication.NetStack + * @since 7 + */ + /** + * Network protocol type. The options are as follows: IPv4, IPv6. + * @type {'IPv4' | 'IPv6'} + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + family: 'IPv4' | 'IPv6'; + /** + * Port number. The value ranges from 0 to 65535. + * @type {number} + * @syscap SystemCapability.Communication.NetStack + * @since 7 + */ + /** + * Port number. The value ranges from 0 to 65535. + * @type {number} + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + port: number; + /** + * Length of the server response message, in bytes. + * @type {number} + * @syscap SystemCapability.Communication.NetStack + * @since 7 + */ + /** + * Length of the server response message, in bytes. + * @type {number} + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + size: number; + } + /** + * Defines the local socket connection information. + * @interface LocalSocketMessageInfo + * @syscap SystemCapability.Communication.NetStack + * @since 11 + */ + export interface LocalSocketMessageInfo { + /** + * Message data. + * @type {ArrayBuffer} + * @syscap SystemCapability.Communication.NetStack + * @since 11 + */ + message: ArrayBuffer; + /** + * Bound local socket address. + * @type {string} + * @syscap SystemCapability.Communication.NetStack + * @since 11 + */ + address: string; + /** + * Length of the message, in bytes. + * @type {number} + * @syscap SystemCapability.Communication.NetStack + * @since 11 + */ + size: number; + } + /** + * Defines a local address. + * @interface LocalAddress + * @syscap SystemCapability.Communication.NetStack + * @since 11 + */ + export interface LocalAddress { + /** + * LocalAddress address. + * @type {string} + * @syscap SystemCapability.Communication.NetStack + * @since 11 + */ + address: string; + } + /** + * Defines LocalSocket connection parameters. + * @interface LocalConnectOptions + * @syscap SystemCapability.Communication.NetStack + * @since 11 + */ + export interface LocalConnectOptions { + /** + * Bound Local address. + * @type {LocalAddress} + * @syscap SystemCapability.Communication.NetStack + * @since 11 + */ + address: LocalAddress; + /** + * Timeout duration of the LocalSocket connection, in milliseconds. + * @type {?number} + * @syscap SystemCapability.Communication.NetStack + * @since 11 + */ + timeout?: number; + } + /** + * Defines the parameters for sending data over the LocalSocket connection. + * @interface LocalSendOptions + * @syscap SystemCapability.Communication.NetStack + * @since 11 + */ + export interface LocalSendOptions { + /** + * Data to send. + * @type {string | ArrayBuffer} + * @syscap SystemCapability.Communication.NetStack + * @since 11 + */ + data: string | ArrayBuffer; + /** + * Character encoding format. + * @type {?string} + * @syscap SystemCapability.Communication.NetStack + * @since 11 + */ + encoding?: string; + } + /** + * Defines a UDPSocket connection. + * @interface UDPSocket + * @syscap SystemCapability.Communication.NetStack + * @since 7 + */ + /** + * Defines a UDPSocket connection. + * @interface UDPSocket + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + export interface UDPSocket { + /** + * Binds the IP address and port number. The port number can be specified or randomly allocated by the system. + * @permission ohos.permission.INTERNET + * @param { NetAddress } address - Destination address. {@link NetAddress} + * @param { AsyncCallback } callback - the callback of bind. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 201 - Permission denied. + * @syscap SystemCapability.Communication.NetStack + * @since 7 + */ + /** + * Binds the IP address and port number. The port number can be specified or randomly allocated by the system. + * @permission ohos.permission.INTERNET + * @param { NetAddress } address - Destination address. {@link NetAddress} + * @param { AsyncCallback } callback - the callback of bind. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 201 - Permission denied. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + bind(address: NetAddress, callback: AsyncCallback): void; + /** + * Binds the IP address and port number. The port number can be specified or randomly allocated by the system. + * @permission ohos.permission.INTERNET + * @param { NetAddress } address - Destination address. {@link NetAddress} + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 201 - Permission denied. + * @syscap SystemCapability.Communication.NetStack + * @since 7 + */ + /** + * Binds the IP address and port number. The port number can be specified or randomly allocated by the system. + * @permission ohos.permission.INTERNET + * @param { NetAddress } address - Destination address. {@link NetAddress} + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 201 - Permission denied. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + bind(address: NetAddress): Promise; + /** + * Sends data over a UDPSocket connection. + * @permission ohos.permission.INTERNET + * @param { UDPSendOptions } options - Optional parameters {@link UDPSendOptions}. + * @param { AsyncCallback } callback - the callback of send. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 201 - Permission denied. + * @syscap SystemCapability.Communication.NetStack + * @since 7 + */ + /** + * Sends data over a UDPSocket connection. + * @permission ohos.permission.INTERNET + * @param { UDPSendOptions } options - Optional parameters {@link UDPSendOptions}. + * @param { AsyncCallback } callback - the callback of send. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 201 - Permission denied. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + send(options: UDPSendOptions, callback: AsyncCallback): void; + /** + * Sends data over a UDPSocket connection. + * @permission ohos.permission.INTERNET + * @param { UDPSendOptions } options - Optional parameters {@link UDPSendOptions}. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 201 - Permission denied. + * @syscap SystemCapability.Communication.NetStack + * @since 7 + */ + /** + * Sends data over a UDPSocket connection. + * @permission ohos.permission.INTERNET + * @param { UDPSendOptions } options - Optional parameters {@link UDPSendOptions}. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 201 - Permission denied. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + send(options: UDPSendOptions): Promise; + /** + * Closes a UDPSocket connection. + * @permission ohos.permission.INTERNET + * @param { AsyncCallback } callback - the callback of close. + * @throws { BusinessError } 201 - Permission denied. + * @syscap SystemCapability.Communication.NetStack + * @since 7 + */ + /** + * Closes a UDPSocket connection. + * @permission ohos.permission.INTERNET + * @param { AsyncCallback } callback - the callback of close. + * @throws { BusinessError } 201 - Permission denied. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + close(callback: AsyncCallback): void; + /** + * Closes a UDPSocket connection. + * @permission ohos.permission.INTERNET + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 201 - Permission denied. + * @syscap SystemCapability.Communication.NetStack + * @since 7 + */ + /** + * Closes a UDPSocket connection. + * @permission ohos.permission.INTERNET + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 201 - Permission denied. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + close(): Promise; + /** + * Obtains the status of the UDPSocket connection. + * @permission ohos.permission.INTERNET + * @param { AsyncCallback } callback - the callback of getState. {@link SocketStateBase}. + * @throws { BusinessError } 201 - Permission denied. + * @syscap SystemCapability.Communication.NetStack + * @since 7 + */ + /** + * Obtains the status of the UDPSocket connection. + * @permission ohos.permission.INTERNET + * @param { AsyncCallback } callback - the callback of getState. {@link SocketStateBase}. + * @throws { BusinessError } 201 - Permission denied. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + getState(callback: AsyncCallback): void; + /** + * Obtains the status of the UDPSocket connection. + * @permission ohos.permission.INTERNET + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 201 - Permission denied. + * @syscap SystemCapability.Communication.NetStack + * @since 7 + */ + /** + * Obtains the status of the UDPSocket connection. + * @permission ohos.permission.INTERNET + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 201 - Permission denied. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + getState(): Promise; + /** + * Sets other attributes of the UDPSocket connection. + * @permission ohos.permission.INTERNET + * @param { UDPExtraOptions } options - Optional parameters {@link UDPExtraOptions}. + * @param { AsyncCallback }callback - the callback of setExtraOptions. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 201 - Permission denied. + * @syscap SystemCapability.Communication.NetStack + * @since 7 + */ + /** + * Sets other attributes of the UDPSocket connection. + * @permission ohos.permission.INTERNET + * @param { UDPExtraOptions } options - Optional parameters {@link UDPExtraOptions}. + * @param { AsyncCallback }callback - the callback of setExtraOptions. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 201 - Permission denied. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + setExtraOptions(options: UDPExtraOptions, callback: AsyncCallback): void; + /** + * Sets other attributes of the UDPSocket connection. + * @permission ohos.permission.INTERNET + * @param { UDPExtraOptions } options - Optional parameters {@link UDPExtraOptions}. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 201 - Permission denied. + * @syscap SystemCapability.Communication.NetStack + * @since 7 + */ + /** + * Sets other attributes of the UDPSocket connection. + * @permission ohos.permission.INTERNET + * @param { UDPExtraOptions } options - Optional parameters {@link UDPExtraOptions}. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 201 - Permission denied. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + setExtraOptions(options: UDPExtraOptions): Promise; + /** + * Listens for message receiving events of the UDPSocket connection. + * @param { 'message' } type - Indicates Event name. + * @param { Callback<{ message: ArrayBuffer, remoteInfo: SocketRemoteInfo }> } callback - the callback used to return the result. + * @syscap SystemCapability.Communication.NetStack + * @since 7 + */ + /** + * Listens for message receiving events of the UDPSocket connection. + * @param { 'message' } type - Indicates Event name. + * @param { Callback<{ message: ArrayBuffer, remoteInfo: SocketRemoteInfo }> } callback - the callback used to return the result. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + /** + * Listens for message receiving events of the UDPSocket connection. + * @param { 'message' } type - Indicates Event name. + * @param { Callback } callback - the callback used to return the result. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 11 + */ + on(type: 'message', callback: Callback): void; + /** + * Cancels listening for message receiving events of the UDPSocket connection. + * @param { 'message' } type - Indicates Event name. + * @param { Callback<{ message: ArrayBuffer, remoteInfo: SocketRemoteInfo }> } callback - the callback used to return the result. + * @syscap SystemCapability.Communication.NetStack + * @since 7 + */ + /** + * Cancels listening for message receiving events of the UDPSocket connection. + * @param { 'message' } type - Indicates Event name. + * @param { Callback<{ message: ArrayBuffer, remoteInfo: SocketRemoteInfo }> } callback - the callback used to return the result. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + /** + * Cancels listening for message receiving events of the UDPSocket connection. + * @param { 'message' } type - Indicates Event name. + * @param { Callback } callback - the callback used to return the result. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 11 + */ + off(type: 'message', callback?: Callback): void; + /** + * Listens for data packet message events or close events of the UDPSocket connection. + * @param { 'listening' | 'close' } type - Indicates Event name. + * @param { Callback } callback - the callback used to return the result. + * @syscap SystemCapability.Communication.NetStack + * @since 7 + */ + /** + * Listens for data packet message events or close events of the UDPSocket connection. + * @param { 'listening' | 'close' } type - Indicates Event name. + * @param { Callback } callback - the callback used to return the result. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + on(type: 'listening' | 'close', callback: Callback): void; + /** + * Cancels listening for data packet message events or close events of the UDPSocket connection. + * @param { 'listening' | 'close' } type - Indicates Event name. + * @param { Callback } callback - the callback used to return the result. + * @syscap SystemCapability.Communication.NetStack + * @since 7 + */ + /** + * Cancels listening for data packet message events or close events of the UDPSocket connection. + * @param { 'listening' | 'close' } type - Indicates Event name. + * @param { Callback } callback - the callback used to return the result. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + off(type: 'listening' | 'close', callback?: Callback): void; + /** + * Listens for error events of the UDPSocket connection. + * @param { 'error' } type - Indicates Event name. + * @param { ErrorCallback } callback - the callback used to return the result. + * @syscap SystemCapability.Communication.NetStack + * @since 7 + */ + /** + * Listens for error events of the UDPSocket connection. + * @param { 'error' } type - Indicates Event name. + * @param { ErrorCallback } callback - the callback used to return the result. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + on(type: 'error', callback: ErrorCallback): void; + /** + * Cancels listening for error events of the UDPSocket connection. + * @param { 'error' } type - Indicates Event name. + * @param { ErrorCallback } callback - the callback used to return the result. + * @syscap SystemCapability.Communication.NetStack + * @since 7 + */ + /** + * Cancels listening for error events of the UDPSocket connection. + * @param { 'error' } type - Indicates Event name. + * @param { ErrorCallback } callback - the callback used to return the result. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + off(type: 'error', callback?: ErrorCallback): void; + } + /** + * Defines a UDP MulticastSocket connection. + * @interface MulticastSocket + * @syscap SystemCapability.Communication.NetStack + * @since 11 + */ + export interface MulticastSocket extends UDPSocket { + /** + * Add the socket to the multicast group. + * @permission ohos.permission.INTERNET + * @param { NetAddress } multicastAddress - Multicast address information. {@link NetAddress}. + * @param { AsyncCallback } callback - The callback of addMembership. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 2301022 - Invalid argument. + * @throws { BusinessError } 2301088 - Not a socket. + * @throws { BusinessError } 2301098 - Address in use. + * @syscap SystemCapability.Communication.NetStack + * @since 11 + */ + addMembership(multicastAddress: NetAddress, callback: AsyncCallback): void; + /** + * Add the socket to the multicast group. + * @permission ohos.permission.INTERNET + * @param { NetAddress } multicastAddress - Multicast address information. {@link NetAddress}. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 2301088 - Not a socket. + * @throws { BusinessError } 2301098 - Address in use. + * @syscap SystemCapability.Communication.NetStack + * @since 11 + */ + addMembership(multicastAddress: NetAddress): Promise; + /** + * Drop the socket from the multicast group. + * @permission ohos.permission.INTERNET + * @param { NetAddress } multicastAddress - Multicast address information. {@link NetAddress}. + * @param { AsyncCallback } callback - The callback of dropMembership. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 2301088 - Not a socket. + * @throws { BusinessError } 2301098 - Address in use. + * @syscap SystemCapability.Communication.NetStack + * @since 11 + */ + dropMembership(multicastAddress: NetAddress, callback: AsyncCallback): void; + /** + * Drop the socket from the multicast group. + * @permission ohos.permission.INTERNET + * @param { NetAddress } multicastAddress - Multicast address information. {@link NetAddress}. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 2301088 - Not a socket. + * @throws { BusinessError } 2301098 - Address in use. + * @syscap SystemCapability.Communication.NetStack + * @since 11 + */ + dropMembership(multicastAddress: NetAddress): Promise; + /** + * Set the TTL value for socket multicast packets. + * @param { number } ttl - The TTL value to set. Valid range is typically 0 to 255. + * @param { AsyncCallback } callback - The callback of setMulticastTTL. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 2301022 - Invalid argument. + * @throws { BusinessError } 2301088 - Not a socket. + * @syscap SystemCapability.Communication.NetStack + * @since 11 + */ + setMulticastTTL(ttl: number, callback: AsyncCallback): void; + /** + * Set the TTL value for socket multicast packet. + * @param { number } ttl - The TTL value to set. Valid range is typically 0 to 255. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 2301022 - Invalid argument. + * @throws { BusinessError } 2301088 - Not a socket. + * @syscap SystemCapability.Communication.NetStack + * @since 11 + */ + setMulticastTTL(ttl: number): Promise; + /** + * Get the TTL value of socket multicast packet. + * @param { AsyncCallback } callback - The callback of getMulticastTTL. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 2301088 - Not a socket. + * @syscap SystemCapability.Communication.NetStack + * @since 11 + */ + getMulticastTTL(callback: AsyncCallback): void; + /** + * Get the TTL value of socket multicast packet. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 2301088 - Not a socket. + * @syscap SystemCapability.Communication.NetStack + * @since 11 + */ + getMulticastTTL(): Promise; + /** + * Set the loopback mode for the socket. + * @param { boolean } flag - Whether to enable loopback mode. + * @param { AsyncCallback } callback - The callback of setLoopbackMode. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 2301088 - Not a socket. + * @syscap SystemCapability.Communication.NetStack + * @since 11 + */ + setLoopbackMode(flag: boolean, callback: AsyncCallback): void; + /** + * Set the loopback mode for the socket. + * @param { boolean } flag - Whether to enable loopback mode. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 2301088 - Not a socket. + * @syscap SystemCapability.Communication.NetStack + * @since 11 + */ + setLoopbackMode(flag: boolean): Promise; + /** + * Get the loopback mode of the socket. + * @param { AsyncCallback } callback - The callback of getLoopbackMode. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 2301088 - Not a socket. + * @syscap SystemCapability.Communication.NetStack + * @since 11 + */ + getLoopbackMode(callback: AsyncCallback): void; + /** + * Get the loopback mode of the socket. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 2301088 - Not a socket. + * @syscap SystemCapability.Communication.NetStack + * @since 11 + */ + getLoopbackMode(): Promise; + } + /** + * Defines a LocalSocket connection. + * @interface LocalSocket + * @syscap SystemCapability.Communication.NetStack + * @since 11 + */ + export interface LocalSocket { + /** + * Binds the Local address. + * @param { LocalAddress } address - Destination address. {@link LocalAddress} + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 2301013 - Insufficient permissions. + * @throws { BusinessError } 2301022 - Invalid argument. + * @throws { BusinessError } 2301098 - Address already in use. + * @syscap SystemCapability.Communication.NetStack + * @since 11 + */ + bind(address: LocalAddress): Promise; + /** + * Sets up a connection to the specified Local address . + * @param { LocalConnectOptions } options - Optional parameters {@link LocalConnectOptions}. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 2301013 - Insufficient permissions. + * @throws { BusinessError } 2301022 - Invalid argument. + * @throws { BusinessError } 2301111 - Connection refused. + * @throws { BusinessError } 2301099 - Cannot assign requested address. + * @syscap SystemCapability.Communication.NetStack + * @since 11 + */ + connect(options: LocalConnectOptions): Promise; + /** + * Sends data over a LocalSocket connection. + * @param { LocalSendOptions } options - Optional parameters {@link LocalSendOptions}. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 2301011 - Operation would block. + * @syscap SystemCapability.Communication.NetStack + * @since 11 + */ + send(options: LocalSendOptions): Promise; + /** + * Closes a LocalSocket connection. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 2301009 - Bad file descriptor. + * @syscap SystemCapability.Communication.NetStack + * @since 11 + */ + close(): Promise; + /** + * Obtains the status of the LocalSocket connection. + * @returns { Promise } The promise returned by the function. + * @syscap SystemCapability.Communication.NetStack + * @since 11 + */ + getState(): Promise; + /** + * Obtains the file descriptor of the LocalSocket connection. + * @returns { Promise } The promise returns the file descriptor of the LocalSocket connection. + * @syscap SystemCapability.Communication.NetStack + * @since 11 + */ + getSocketFd(): Promise; + /** + * Sets other attributes of the LocalSocket connection. + * @param { ExtraOptionsBase } options - Optional parameters {@link ExtraOptionsBase}. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 2301009 - Bad file descriptor. + * @syscap SystemCapability.Communication.NetStack + * @since 11 + */ + setExtraOptions(options: ExtraOptionsBase): Promise; + /** + * Gets other attributes of the LocalSocket connection. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 2301009 - Bad file descriptor. + * @syscap SystemCapability.Communication.NetStack + * @since 11 + */ + getExtraOptions(): Promise; + /** + * Listens for message receiving events of the LocalSocket connection. + * @param { 'message' } type Indicates Event name. + * @param { Callback } callback - the callback used to return the result. + * @throws { BusinessError } 401 - Parameter error. + * @syscap SystemCapability.Communication.NetStack + * @since 11 + */ + on(type: 'message', callback: Callback): void; + /** + * Cancels listening for message receiving events of the LocalSocket connection. + * @param { 'message' } type Indicates Event name. + * @param { Callback } callback - the callback used to return the result. + * @throws { BusinessError } 401 - Parameter error. + * @syscap SystemCapability.Communication.NetStack + * @since 11 + */ + off(type: 'message', callback?: Callback): void; + /** + * Listens for connection events of the LocalSocket connection. + * @param { 'connect' } type - Indicates Event name. + * @param { Callback } callback - the callback used to return the result. + * @throws { BusinessError } 401 - Parameter error. + * @syscap SystemCapability.Communication.NetStack + * @since 11 + */ + on(type: 'connect', callback: Callback): void; + /** + * Cancels listening for connection events of the LocalSocket connection. + * @param { 'connect' } type - Indicates Event name. + * @param { Callback } callback - the callback used to return the result. + * @throws { BusinessError } 401 - Parameter error. + * @syscap SystemCapability.Communication.NetStack + * @since 11 + */ + off(type: 'connect', callback?: Callback): void; + /** + * Listens for close events of the LocalSocket connection. + * @param { 'close' } type - Indicates Event name. + * @param { Callback } callback - the callback used to return the result. + * @throws { BusinessError } 401 - Parameter error. + * @syscap SystemCapability.Communication.NetStack + * @since 11 + */ + on(type: 'close', callback: Callback): void; + /** + * Cancels listening for close events of the LocalSocket connection. + * @param { 'close' } type - Indicates Event name. + * @param { Callback } callback - the callback used to return the result. + * @throws { BusinessError } 401 - Parameter error. + * @syscap SystemCapability.Communication.NetStack + * @since 11 + */ + off(type: 'close', callback?: Callback): void; + /** + * Listens for error events of the LocalSocket connection. + * @param { 'error' } type - Indicates Event name. + * @param { ErrorCallback } callback - the callback used to return the result. + * @throws { BusinessError } 401 - Parameter error. + * @syscap SystemCapability.Communication.NetStack + * @since 11 + */ + on(type: 'error', callback: ErrorCallback): void; + /** + * Cancels listening for error events of the LocalSocket connection. + * @param { 'error' } type - Indicates Event name. + * @param { ErrorCallback } callback - the callback used to return the result. + * @throws { BusinessError } 401 - Parameter error. + * @syscap SystemCapability.Communication.NetStack + * @since 11 + */ + off(type: 'error', callback?: ErrorCallback): void; + } + /** + * Defines the connection of the LocalSocket client and server. + * @interface LocalSocketConnection + * @syscap SystemCapability.Communication.NetStack + * @since 11 + */ + export interface LocalSocketConnection { + /** + * The id of a client connects to the LocalSocketServer. + * @type {number} + * @syscap SystemCapability.Communication.NetStack + * @since 11 + */ + clientId: number; + /** + * Sends data over a LocalSocketServer connection to client. + * @param { LocalSendOptions } options - Parameters for sending data {@link LocalSendOptions}. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 2301011 - Operation would block. + * @syscap SystemCapability.Communication.NetStack + * @since 11 + */ + send(options: LocalSendOptions): Promise; + /** + * Closes a LocalSocket client connection. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 2301009 - Bad file descriptor. + * @syscap SystemCapability.Communication.NetStack + * @since 11 + */ + close(): Promise; + /** + * Listens for message receiving events of the LocalSocketConnection. + * @param { 'message' } type - Indicates Event name. + * @param { Callback } callback - The callback of on. + * @throws { BusinessError } 401 - Parameter error. + * @syscap SystemCapability.Communication.NetStack + * @since 11 + */ + on(type: 'message', callback: Callback): void; + /** + * Cancels listening for message receiving events of the LocalSocketConnection. + * @param { 'message' } type - Indicates Event name. + * @param { Callback } callback - The callback of off. + * @throws { BusinessError } 401 - Parameter error. + * @syscap SystemCapability.Communication.NetStack + * @since 11 + */ + off(type: 'message', callback?: Callback): void; + /** + * Listens for close events of the LocalSocketConnection. + * @param { 'close' } type - Indicates Event name. + * @param { Callback } callback - The callback of on. + * @throws { BusinessError } 401 - Parameter error. + * @syscap SystemCapability.Communication.NetStack + * @since 11 + */ + on(type: 'close', callback: Callback): void; + /** + * Cancels listening for close events of the LocalSocketConnection. + * @param { 'close' } type - Indicates Event name. + * @param { Callback } callback - The callback of off. + * @throws { BusinessError } 401 - Parameter error. + * @syscap SystemCapability.Communication.NetStack + * @since 11 + */ + off(type: 'close', callback?: Callback): void; + /** + * Listens for error events of the LocalSocketConnection. + * @param { 'error' } type - Indicates Event name. + * @param { ErrorCallback } callback - The callback of on. + * @throws { BusinessError } 401 - Parameter error. + * @syscap SystemCapability.Communication.NetStack + * @since 11 + */ + on(type: 'error', callback: ErrorCallback): void; + /** + * Cancels listening for error events of the LocalSocketConnection. + * @param { 'error' } type - Indicates Event name. + * @param { ErrorCallback } callback - The callback of off. + * @throws { BusinessError } 401 - Parameter error. + * @syscap SystemCapability.Communication.NetStack + * @since 11 + */ + off(type: 'error', callback?: ErrorCallback): void; + } + /** + * Defines a LocalSocket server connection. + * @interface LocalSocketServer + * @syscap SystemCapability.Communication.NetStack + * @since 11 + */ + export interface LocalSocketServer { + /** + * Binds the Local address. + *

Listens for a LocalSocket connection to be made to this socket and accepts it. This interface uses multiple threads + * for accept processing and uses poll multiplex to process client connections.

+ * @param { LocalAddress } address - Network address information {@link LocalAddress}. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 2303109 - Bad file number. + * @throws { BusinessError } 2301013 - Insufficient permissions. + * @throws { BusinessError } 2301022 - Invalid argument. + * @throws { BusinessError } 2301098 - Address already in use. + * @syscap SystemCapability.Communication.NetStack + * @since 11 + */ + listen(address: LocalAddress): Promise; + /** + * Obtains the status of the LocalSocketServer connection. + * @returns { Promise } The promise returned by the function. + * @syscap SystemCapability.Communication.NetStack + * @since 11 + */ + getState(): Promise; + /** + * Sets other attributes of the LocalSocketServer connection. + * @param { ExtraOptionsBase } options - Parameters of the attributes {@link ExtraOptionsBase}. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 2301009 - Bad file descriptor. + * @syscap SystemCapability.Communication.NetStack + * @since 11 + */ + setExtraOptions(options: ExtraOptionsBase): Promise; + /** + * Gets other attributes of the LocalSocket connection. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - Parameter error. + * @syscap SystemCapability.Communication.NetStack + * @since 11 + */ + getExtraOptions(): Promise; + /** + * Listens for connect events of the LocalSocketServer connection. + * @param { 'connect' } type - Indicates Event name. + * @param { Callback } callback - The callback of on. + * @throws { BusinessError } 401 - Parameter error. + * @syscap SystemCapability.Communication.NetStack + * @since 11 + */ + on(type: 'connect', callback: Callback): void; + /** + * Cancels listening for connect events of the LocalSocketServer connection. + * @param { 'connect' } type - Indicates Event name. + * @param { Callback } callback - The callback of off. + * @throws { BusinessError } 401 - Parameter error. + * @syscap SystemCapability.Communication.NetStack + * @since 11 + */ + off(type: 'connect', callback?: Callback): void; + /** + * Listens for error events of the LocalSocketServer connection. + * @param { 'error' } type - Indicates Event name. + * @param { ErrorCallback } callback - The callback of on. + * @throws { BusinessError } 401 - Parameter error. + * @syscap SystemCapability.Communication.NetStack + * @since 11 + */ + on(type: 'error', callback: ErrorCallback): void; + /** + * Cancels listening for error events of the LocalSocketServer connection. + * @param { 'error' } type - Indicates Event name. + * @param { ErrorCallback } callback - The callback of off. + * @throws { BusinessError } 401 - Parameter error. + * @syscap SystemCapability.Communication.NetStack + * @since 11 + */ + off(type: 'error', callback?: ErrorCallback): void; + } + /** + * Defines TCPSocket connection parameters. + * @interface TCPConnectOptions + * @syscap SystemCapability.Communication.NetStack + * @since 7 + */ + /** + * Defines TCPSocket connection parameters. + * @interface TCPConnectOptions + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + export interface TCPConnectOptions { + /** + * Bound IP address and port number. + * @type { NetAddress } + * @syscap SystemCapability.Communication.NetStack + * @since 7 + */ + /** + * Bound IP address and port number. + * @type { NetAddress } + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + address: NetAddress; + /** + * Timeout duration of the TCPSocket connection, in milliseconds. + * @type { ?number } + * @syscap SystemCapability.Communication.NetStack + * @since 7 + */ + /** + * Timeout duration of the TCPSocket connection, in milliseconds. + * @type { ?number } + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + timeout?: number; + } + /** + * Defines the parameters for sending data over the TCPSocket connection. + * @interface TCPSendOptions + * @syscap SystemCapability.Communication.NetStack + * @since 7 + */ + /** + * Defines the parameters for sending data over the TCPSocket connection. + * @interface TCPSendOptions + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + export interface TCPSendOptions { + /** + * Data to send. + * @type { string | ArrayBuffer } + * @syscap SystemCapability.Communication.NetStack + * @since 7 + */ + /** + * Data to send. + * @type { string | ArrayBuffer } + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + data: string | ArrayBuffer; + /** + * Character encoding format. + * @type { ?string } + * @syscap SystemCapability.Communication.NetStack + * @since 7 + */ + /** + * Character encoding format. + * @type { ?string } + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + encoding?: string; + } + /** + * Defines other properties of the TCPSocket connection. + * @interface TCPExtraOptions + * @syscap SystemCapability.Communication.NetStack + * @since 7 + */ + /** + * Defines other properties of the TCPSocket connection. + * @interface TCPExtraOptions + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + export interface TCPExtraOptions extends ExtraOptionsBase { + /** + * Whether to keep the connection alive. The default value is false. + * @type { ?boolean } + * @syscap SystemCapability.Communication.NetStack + * @since 7 + */ + /** + * Whether to keep the connection alive. The default value is false. + * @type { ?boolean } + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + keepAlive?: boolean; + /** + * Whether to enable OOBInline. The default value is false. + * @type { ?boolean } + * @syscap SystemCapability.Communication.NetStack + * @since 7 + */ + /** + * Whether to enable OOBInline. The default value is false. + * @type { ?boolean } + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + OOBInline?: boolean; + /** + * Whether to enable no-delay on the TCPSocket connection. The default value is false. + * @type { ?boolean } + * @syscap SystemCapability.Communication.NetStack + * @since 7 + */ + /** + * Whether to enable no-delay on the TCPSocket connection. The default value is false. + * @type { ?boolean } + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + TCPNoDelay?: boolean; + /** + * Socket linger. + * @type { ?object } + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 7 + */ + /** + * Socket linger. + * @type { ?object } + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + socketLinger?: { + on: boolean; + linger: number; + }; + } + /** + * Defines a TCPSocket connection. + * @interface TCPSocket + * @syscap SystemCapability.Communication.NetStack + * @since 7 + */ + /** + * Defines a TCPSocket connection. + * @interface TCPSocket + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + export interface TCPSocket { + /** + * Binds the IP address and port number. The port number can be specified or randomly allocated by the system. + * @permission ohos.permission.INTERNET + * @param { NetAddress } address - Destination address. {@link NetAddress} + * @param { AsyncCallback } callback - Return the callback of bind. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 201 - Permission denied. + * @syscap SystemCapability.Communication.NetStack + * @since 7 + */ + /** + * Binds the IP address and port number. The port number can be specified or randomly allocated by the system. + * @permission ohos.permission.INTERNET + * @param { NetAddress } address - Destination address. {@link NetAddress} + * @param { AsyncCallback } callback - the callback of bind. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 201 - Permission denied. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + bind(address: NetAddress, callback: AsyncCallback): void; + /** + * Binds the IP address and port number. The port number can be specified or randomly allocated by the system. + * @permission ohos.permission.INTERNET + * @param { NetAddress } address - Destination address. {@link NetAddress} + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 201 - Permission denied. + * @syscap SystemCapability.Communication.NetStack + * @since 7 + */ + /** + * Binds the IP address and port number. The port number can be specified or randomly allocated by the system. + * @permission ohos.permission.INTERNET + * @param { NetAddress } address - Destination address. {@link NetAddress} + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 201 - Permission denied. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + bind(address: NetAddress): Promise; + /** + * Sets up a connection to the specified IP address and port number. + * @permission ohos.permission.INTERNET + * @param { TCPConnectOptions } options - Optional parameters {@link TCPConnectOptions}. + * @param { AsyncCallback } callback - the callback of connect. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 201 - Permission denied. + * @syscap SystemCapability.Communication.NetStack + * @since 7 + */ + /** + * Sets up a connection to the specified IP address and port number. + * @permission ohos.permission.INTERNET + * @param { TCPConnectOptions } options - Optional parameters {@link TCPConnectOptions}. + * @param { AsyncCallback } callback - the callback of connect. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 201 - Permission denied. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + connect(options: TCPConnectOptions, callback: AsyncCallback): void; + /** + * Sets up a connection to the specified IP address and port number. + * @permission ohos.permission.INTERNET + * @param { TCPConnectOptions } options - Optional parameters {@link TCPConnectOptions}. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 201 - Permission denied. + * @syscap SystemCapability.Communication.NetStack + * @since 7 + */ + /** + * Sets up a connection to the specified IP address and port number. + * @permission ohos.permission.INTERNET + * @param { TCPConnectOptions } options - Optional parameters {@link TCPConnectOptions}. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 201 - Permission denied. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + connect(options: TCPConnectOptions): Promise; + /** + * Sends data over a TCPSocket connection. + * @permission ohos.permission.INTERNET + * @param { TCPSendOptions } options - Optional parameters {@link TCPSendOptions}. + * @param { AsyncCallback } callback - the callback of send. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 201 - Permission denied. + * @syscap SystemCapability.Communication.NetStack + * @since 7 + */ + /** + * Sends data over a TCPSocket connection. + * @permission ohos.permission.INTERNET + * @param { TCPSendOptions } options - Optional parameters {@link TCPSendOptions}. + * @param { AsyncCallback } callback - the callback of send. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 201 - Permission denied. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + send(options: TCPSendOptions, callback: AsyncCallback): void; + /** + * Sends data over a TCPSocket connection. + * @permission ohos.permission.INTERNET + * @param { TCPSendOptions } options - Optional parameters {@link TCPSendOptions}. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 201 - Permission denied. + * @syscap SystemCapability.Communication.NetStack + * @since 7 + */ + /** + * Sends data over a TCPSocket connection. + * @permission ohos.permission.INTERNET + * @param { TCPSendOptions } options - Optional parameters {@link TCPSendOptions}. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 201 - Permission denied. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + send(options: TCPSendOptions): Promise; + /** + * Closes a TCPSocket connection. + * @permission ohos.permission.INTERNET + * @param { AsyncCallback } callback - the callback of close. + * @throws { BusinessError } 201 - Permission denied. + * @syscap SystemCapability.Communication.NetStack + * @since 7 + */ + /** + * Closes a TCPSocket connection. + * @permission ohos.permission.INTERNET + * @param { AsyncCallback } callback - the callback of close. + * @throws { BusinessError } 201 - Permission denied. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + close(callback: AsyncCallback): void; + /** + * Closes a TCPSocket connection. + * @permission ohos.permission.INTERNET + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 201 - Permission denied. + * @syscap SystemCapability.Communication.NetStack + * @since 7 + */ + /** + * Closes a TCPSocket connection. + * @permission ohos.permission.INTERNET + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 201 - Permission denied. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + close(): Promise; + /** + * Obtains the peer address of a TCPSocket connection. + * @permission ohos.permission.INTERNET + * @param { AsyncCallback } callback - the callback of getRemoteAddress. {@link NetAddress} + * @throws { BusinessError } 201 - Permission denied. + * @syscap SystemCapability.Communication.NetStack + * @since 7 + */ + /** + * Obtains the peer address of a TCPSocket connection. + * @permission ohos.permission.INTERNET + * @param { AsyncCallback } callback - the callback of getRemoteAddress. {@link NetAddress} + * @throws { BusinessError } 201 - Permission denied. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + getRemoteAddress(callback: AsyncCallback): void; + /** + * Obtains the peer address of a TCPSocket connection. + * @permission ohos.permission.INTERNET + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 201 - Permission denied. + * @syscap SystemCapability.Communication.NetStack + * @since 7 + */ + /** + * Obtains the peer address of a TCPSocket connection. + * @permission ohos.permission.INTERNET + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 201 - Permission denied. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + getRemoteAddress(): Promise; + /** + * Obtains the status of the TCPSocket connection. + * @permission ohos.permission.INTERNET + * @param { AsyncCallback } callback - the callback of getState. {@link SocketStateBase} + * @throws { BusinessError } 201 - Permission denied. + * @syscap SystemCapability.Communication.NetStack + * @since 7 + */ + /** + * Obtains the status of the TCPSocket connection. + * @permission ohos.permission.INTERNET + * @param { AsyncCallback } callback - the callback of getState. {@link SocketStateBase} + * @throws { BusinessError } 201 - Permission denied. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + getState(callback: AsyncCallback): void; + /** + * Obtains the status of the TCPSocket connection. + * @permission ohos.permission.INTERNET + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 201 - Permission denied. + * @syscap SystemCapability.Communication.NetStack + * @since 7 + */ + /** + * Obtains the status of the TCPSocket connection. + * @permission ohos.permission.INTERNET + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 201 - Permission denied. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + getState(): Promise; + /** + * Obtains the file descriptor of the TCPSocket connection. + * @param { AsyncCallback } callback - The callback returns the file descriptor of the TCPSocket connection. + * @syscap SystemCapability.Communication.NetStack + * @since 10 + */ + getSocketFd(callback: AsyncCallback): void; + /** + * Obtains the file descriptor of the TCPSocket connection. + * @returns { Promise } The promise returns the file descriptor of the TCPSocket connection. + * @syscap SystemCapability.Communication.NetStack + * @since 10 + */ + getSocketFd(): Promise; + /** + * Sets other attributes of the TCPSocket connection. + * @permission ohos.permission.INTERNET + * @param { TCPExtraOptions } options - Optional parameters {@link TCPExtraOptions}. + * @param { AsyncCallback } callback - the callback of setExtraOptions. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 201 - Permission denied. + * @syscap SystemCapability.Communication.NetStack + * @since 7 + */ + /** + * Sets other attributes of the TCPSocket connection. + * @permission ohos.permission.INTERNET + * @param { TCPExtraOptions } options - Optional parameters {@link TCPExtraOptions}. + * @param { AsyncCallback } callback - the callback of setExtraOptions. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 201 - Permission denied. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + setExtraOptions(options: TCPExtraOptions, callback: AsyncCallback): void; + /** + * Sets other attributes of the TCPSocket connection. + * @permission ohos.permission.INTERNET + * @param { TCPExtraOptions } options - Optional parameters {@link TCPExtraOptions}. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 201 - Permission denied. + * @syscap SystemCapability.Communication.NetStack + * @since 7 + */ + /** + * Sets other attributes of the TCPSocket connection. + * @permission ohos.permission.INTERNET + * @param { TCPExtraOptions } options - Optional parameters {@link TCPExtraOptions}. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 201 - Permission denied. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + setExtraOptions(options: TCPExtraOptions): Promise; + /** + * Listens for message receiving events of the TCPSocket connection. + * @param { 'message' } type - Indicates Event name. + * @param { Callback<{ message: ArrayBuffer, remoteInfo: SocketRemoteInfo }> } callback - the callback used to return the result. + * @syscap SystemCapability.Communication.NetStack + * @since 7 + */ + /** + * Listens for message receiving events of the TCPSocket connection. + * @param { 'message' } type Indicates Event name. + * @param { Callback<{ message: ArrayBuffer, remoteInfo: SocketRemoteInfo }> } callback - the callback used to return the result. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + /** + * Listens for message receiving events of the TCPSocket connection. + * @param { 'message' } type Indicates Event name. + * @param { Callback } callback - the callback used to return the result. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 11 + */ + on(type: 'message', callback: Callback): void; + /** + * Cancels listening for message receiving events of the TCPSocket connection. + * @param { 'message' } type Indicates Event name. + * @param { Callback<{ message: ArrayBuffer, remoteInfo: SocketRemoteInfo }> } callback - the callback used to return the result. + * @syscap SystemCapability.Communication.NetStack + * @since 7 + */ + /** + * Cancels listening for message receiving events of the TCPSocket connection. + * @param { 'message' } type Indicates Event name. + * @param { Callback<{ message: ArrayBuffer, remoteInfo: SocketRemoteInfo }> } callback - the callback used to return the result. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + /** + * Cancels listening for message receiving events of the TCPSocket connection. + * @param { 'message' } type Indicates Event name. + * @param { Callback } callback - the callback used to return the result. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 11 + */ + off(type: 'message', callback?: Callback): void; + /** + * Listens for connection or close events of the TCPSocket connection. + * @param { 'connect' | 'close' } type - Indicates Event name. + * @param { Callback } callback - the callback used to return the result. + * @syscap SystemCapability.Communication.NetStack + * @since 7 + */ + /** + * Listens for connection or close events of the TCPSocket connection. + * @param { 'connect' | 'close' } type - Indicates Event name. + * @param { Callback } callback - the callback used to return the result. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + on(type: 'connect' | 'close', callback: Callback): void; + /** + * Cancels listening for connection or close events of the TCPSocket connection. + * @param { 'connect' | 'close' } type - Indicates Event name. + * @param { Callback } callback - the callback used to return the result. + * @syscap SystemCapability.Communication.NetStack + * @since 7 + */ + /** + * Cancels listening for connection or close events of the TCPSocket connection. + * @param { 'connect' | 'close' } type - Indicates Event name. + * @param { Callback } callback - the callback used to return the result. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + off(type: 'connect' | 'close', callback?: Callback): void; + /** + * Listens for error events of the TCPSocket connection. + * @param { 'error' } type - Indicates Event name. + * @param { ErrorCallback } callback - the callback used to return the result. + * @syscap SystemCapability.Communication.NetStack + * @since 7 + */ + /** + * Listens for error events of the TCPSocket connection. + * @param { 'error' } type - Indicates Event name. + * @param { ErrorCallback } callback - the callback used to return the result. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + on(type: 'error', callback: ErrorCallback): void; + /** + * Cancels listening for error events of the TCPSocket connection. + * @param { 'error' } type - Indicates Event name. + * @param { ErrorCallback } callback - the callback used to return the result. + * @syscap SystemCapability.Communication.NetStack + * @since 7 + */ + /** + * Cancels listening for error events of the TCPSocket connection. + * @param { 'error' } type - Indicates Event name. + * @param { ErrorCallback } callback - the callback used to return the result. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + off(type: 'error', callback?: ErrorCallback): void; + } + /** + * Defines a TLSSocket connection. + * @interface TLSSocket + * @syscap SystemCapability.Communication.NetStack + * @since 9 + */ + /** + * Defines a TLSSocket connection. + * @interface TLSSocket + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + export interface TLSSocket { + /** + * Binds the IP address and port number. The port number can be specified or randomly allocated by the system. + * @permission ohos.permission.INTERNET + * @param { NetAddress } address - Destination address. {@link NetAddress} + * @param { AsyncCallback } callback - the callback of bind. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 2303198 - Address already in use. + * @throws { BusinessError } 2300002 - System internal error. + * @syscap SystemCapability.Communication.NetStack + * @since 9 + */ + /** + * Binds the IP address and port number. The port number can be specified or randomly allocated by the system. + * @permission ohos.permission.INTERNET + * @param { NetAddress } address - Destination address. {@link NetAddress} + * @param { AsyncCallback } callback - the callback of bind. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 2303198 - Address already in use. + * @throws { BusinessError } 2300002 - System internal error. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + bind(address: NetAddress, callback: AsyncCallback): void; + /** + * Binds the IP address and port number. The port number can be specified or randomly allocated by the system. + * @permission ohos.permission.INTERNET + * @param { NetAddress } address - Destination address. {@link NetAddress} + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 2303198 - Address already in use. + * @throws { BusinessError } 2300002 - System internal error. + * @syscap SystemCapability.Communication.NetStack + * @since 9 + */ + /** + * Binds the IP address and port number. The port number can be specified or randomly allocated by the system. + * @permission ohos.permission.INTERNET + * @param { NetAddress } address - Destination address. {@link NetAddress} + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 2303198 - Address already in use. + * @throws { BusinessError } 2300002 - System internal error. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + bind(address: NetAddress): Promise; + /** + * Obtains the peer address of a TLSSocket connection. + * @param { AsyncCallback } callback - the callback of getRemoteAddress. + * @throws { BusinessError } 2303188 - Socket operation on non-socket. + * @throws { BusinessError } 2300002 - System internal error. + * @syscap SystemCapability.Communication.NetStack + * @since 9 + */ + /** + * Obtains the peer address of a TLSSocket connection. + * @param { AsyncCallback } callback - the callback of getRemoteAddress. + * @throws { BusinessError } 2303188 - Socket operation on non-socket. + * @throws { BusinessError } 2300002 - System internal error. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + getRemoteAddress(callback: AsyncCallback): void; + /** + * Obtains the peer address of a TLSSocket connection. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 2303188 - Socket operation on non-socket. + * @throws { BusinessError } 2300002 - System internal error. + * @syscap SystemCapability.Communication.NetStack + * @since 9 + */ + /** + * Obtains the peer address of a TLSSocket connection. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 2303188 - Socket operation on non-socket. + * @throws { BusinessError } 2300002 - System internal error. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + getRemoteAddress(): Promise; + /** + * Obtains the status of the TLSSocket connection. + * @param { AsyncCallback } callback - the callback of getState. + * @throws { BusinessError } 2303188 - Socket operation on non-socket. + * @throws { BusinessError } 2300002 - System internal error. + * @syscap SystemCapability.Communication.NetStack + * @since 9 + */ + /** + * Obtains the status of the TLSSocket connection. + * @param { AsyncCallback } callback - the callback of getState. + * @throws { BusinessError } 2303188 - Socket operation on non-socket. + * @throws { BusinessError } 2300002 - System internal error. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + getState(callback: AsyncCallback): void; + /** + * Obtains the status of the TLSSocket connection. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 2303188 - Socket operation on non-socket. + * @throws { BusinessError } 2300002 - System internal error. + * @syscap SystemCapability.Communication.NetStack + * @since 9 + */ + /** + * Obtains the status of the TLSSocket connection. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 2303188 - Socket operation on non-socket. + * @throws { BusinessError } 2300002 - System internal error. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + getState(): Promise; + /** + * Sets other attributes of the TLSSocket connection. + * @param { TCPExtraOptions } options - Optional parameters {@link TCPExtraOptions}. + * @param { AsyncCallback } callback - the callback of setExtraOptions. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 2303188 - Socket operation on non-socket. + * @throws { BusinessError } 2300002 - System internal error. + * @syscap SystemCapability.Communication.NetStack + * @since 9 + */ + /** + * Sets other attributes of the TLSSocket connection. + * @param { TCPExtraOptions } options - Optional parameters {@link TCPExtraOptions}. + * @param { AsyncCallback } callback - the callback of setExtraOptions. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 2303188 - Socket operation on non-socket. + * @throws { BusinessError } 2300002 - System internal error. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + setExtraOptions(options: TCPExtraOptions, callback: AsyncCallback): void; + /** + * Sets other attributes of the TLSSocket connection. + * @param { TCPExtraOptions } options - Optional parameters {@link TCPExtraOptions}. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 2303188 - Socket operation on non-socket. + * @throws { BusinessError } 2300002 - System internal error. + * @syscap SystemCapability.Communication.NetStack + * @since 9 + */ + /** + * Sets other attributes of the TLSSocket connection. + * @param { TCPExtraOptions } options - Optional parameters {@link TCPExtraOptions}. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 2303188 - Socket operation on non-socket. + * @throws { BusinessError } 2300002 - System internal error. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + setExtraOptions(options: TCPExtraOptions): Promise; + /** + * Listens for message receiving events of the TLSSocket connection. + * @param { 'message' } type - Indicates Event name. + * @param { Callback<{ message: ArrayBuffer, remoteInfo: SocketRemoteInfo }> } callback - the callback used to return the result. + * @throws { BusinessError } 401 - Parameter error. + * @syscap SystemCapability.Communication.NetStack + * @since 9 + */ + /** + * Listens for message receiving events of the TLSSocket connection. + * @param { 'message' } type Indicates Event name. + * @param { Callback<{ message: ArrayBuffer, remoteInfo: SocketRemoteInfo }> } callback - the callback used to return the result. + * @throws { BusinessError } 401 - Parameter error. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + /** + * Listens for message receiving events of the TLSSocket connection. + * @param { 'message' } type Indicates Event name. + * @param { Callback } callback - the callback used to return the result. + * @throws { BusinessError } 401 - Parameter error. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 11 + */ + on(type: 'message', callback: Callback): void; + /** + * Cancels listening for message receiving events of the TLSSocket connection. + * @param { 'message' } type - Indicates Event name. + * @param { Callback<{ message: ArrayBuffer, remoteInfo: SocketRemoteInfo }> } callback - the callback used to return the result. + * @throws { BusinessError } 401 - Parameter error. + * @syscap SystemCapability.Communication.NetStack + * @since 9 + */ + /** + * Cancels listening for message receiving events of the TLSSocket connection. + * @param { 'message' } type Indicates Event name. + * @param { Callback<{ message: ArrayBuffer, remoteInfo: SocketRemoteInfo }> } callback - the callback used to return the result. + * @throws { BusinessError } 401 - Parameter error. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + /** + * Cancels listening for message receiving events of the TLSSocket connection. + * @param { 'message' } type Indicates Event name. + * @param { Callback } callback - the callback used to return the result. + * @throws { BusinessError } 401 - Parameter error. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 11 + */ + off(type: 'message', callback?: Callback): void; + /** + * Listens for connection or close events of the TLSSocket connection. + * @param { 'connect' | 'close' } type - Indicates Event name. + * @param {Callback } callback - the callback used to return the result. + * @throws { BusinessError } 401 - Parameter error. + * @syscap SystemCapability.Communication.NetStack + * @since 9 + */ + /** + * Listens for connection or close events of the TLSSocket connection. + * @param { 'connect' | 'close' } type - Indicates Event name. + * @param {Callback } callback - the callback used to return the result. + * @throws { BusinessError } 401 - Parameter error. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + on(type: 'connect' | 'close', callback: Callback): void; + /** + * Cancels listening for connection or close events of the TLSSocket connection. + * @param { 'connect' | 'close' } type - Indicates Event name. + * @param {Callback } callback - the callback used to return the result. + * @throws { BusinessError } 401 - Parameter error. + * @syscap SystemCapability.Communication.NetStack + * @since 9 + */ + /** + * Cancels listening for connection or close events of the TLSSocket connection. + * @param { 'connect' | 'close' } type - Indicates Event name. + * @param {Callback } callback - the callback used to return the result. + * @throws { BusinessError } 401 - Parameter error. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + off(type: 'connect' | 'close', callback?: Callback): void; + /** + * Listens for error events of the TLSSocket connection. + * @param { 'error' } type - Indicates Event name. + * @param { ErrorCallback } callback - the callback used to return the result. + * @throws { BusinessError } 401 - Parameter error. + * @syscap SystemCapability.Communication.NetStack + * @since 9 + */ + /** + * Listens for error events of the TLSSocket connection. + * @param { 'error' } type - Indicates Event name. + * @param { ErrorCallback } callback - the callback used to return the result. + * @throws { BusinessError } 401 - Parameter error. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + on(type: 'error', callback: ErrorCallback): void; + /** + * Cancels listening for error events of the TLSSocket connection. + * @param { 'error' } type - Indicates Event name. + * @param { ErrorCallback } callback - the callback used to return the result. + * @throws { BusinessError } 401 - Parameter error. + * @syscap SystemCapability.Communication.NetStack + * @since 9 + */ + /** + * Cancels listening for error events of the TLSSocket connection. + * @param { 'error' } type - Indicates Event name. + * @param { ErrorCallback } callback - the callback used to return the result. + * @throws { BusinessError } 401 - Parameter error. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + off(type: 'error', callback?: ErrorCallback): void; + /** + * Returns an object representing a local certificate. + * @param { AsyncCallback } callback - the callback of getCertificate. + * @throws { BusinessError } 2303501 - SSL is null. + * @throws { BusinessError } 2303504 - An error occurred when verifying the X.509 certificate. + * @throws { BusinessError } 2300002 - System internal error. + * @syscap SystemCapability.Communication.NetStack + * @since 9 + */ + /** + * Returns an object representing a local certificate. + * @param { AsyncCallback } callback - the callback of getCertificate. + * @throws { BusinessError } 2303501 - SSL is null. + * @throws { BusinessError } 2303504 - An error occurred when verifying the X.509 certificate. + * @throws { BusinessError } 2300002 - System internal error. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + getCertificate(callback: AsyncCallback): void; + /** + * Returns an object representing a local certificate. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 2303501 - SSL is null. + * @throws { BusinessError } 2303504 - An error occurred when verifying the X.509 certificate. + * @throws { BusinessError } 2300002 - System internal error. + * @syscap SystemCapability.Communication.NetStack + * @since 9 + */ + /** + * Returns an object representing a local certificate. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 2303501 - SSL is null. + * @throws { BusinessError } 2303504 - An error occurred when verifying the X.509 certificate. + * @throws { BusinessError } 2300002 - System internal error. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + getCertificate(): Promise; + /** + *

Returns an object representing the peer certificate. If the peer does not provide a certificate, + *

an empty object will be returned. If the socket is destroyed, null is returned.

+ * It only contains the peer's certificate. + * @param { AsyncCallback } callback - the callback of getRemoteCertificate. + * @throws { BusinessError } 2303501 - SSL is null. + * @throws { BusinessError } 2300002 - System internal error. + * @syscap SystemCapability.Communication.NetStack + * @since 9 + */ + /** + *

Returns an object representing the peer certificate. If the peer does not provide a certificate, + *

an empty object will be returned. If the socket is destroyed, null is returned.

+ * It only contains the peer's certificate. + * @param { AsyncCallback } callback - the callback of getRemoteCertificate. + * @throws { BusinessError } 2303501 - SSL is null. + * @throws { BusinessError } 2300002 - System internal error. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + getRemoteCertificate(callback: AsyncCallback): void; + /** + *

Returns an object representing the peer certificate. If the peer does not provide a certificate, + *

an empty object will be returned. If the socket is destroyed, null is returned.

+ * It only contains the peer's certificate. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 2303501 - SSL is null. + * @throws { BusinessError } 2300002 - System internal error. + * @syscap SystemCapability.Communication.NetStack + * @since 9 + */ + /** + *

Returns an object representing the peer certificate. If the peer does not provide a certificate, + *

an empty object will be returned. If the socket is destroyed, null is returned.

+ * It only contains the peer's certificate. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 2303501 - SSL is null. + * @throws { BusinessError } 2300002 - System internal error. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + getRemoteCertificate(): Promise; + /** + * Returns a string containing the negotiated SSL/TLS protocol version of the current connection. + * For connected sockets that have not completed the handshake process, the value 'unknown' will be returned. + * Server sockets or disconnected client sockets will return a value of null. + * @param { AsyncCallback } callback - the callback of getProtocol. + * @throws { BusinessError } 2303501 - SSL is null. + * @throws { BusinessError } 2303505 - An error occurred in the TLS system call. + * @throws { BusinessError } 2300002 - System internal error. + * @syscap SystemCapability.Communication.NetStack + * @since 9 + */ + /** + * Returns a string containing the negotiated SSL/TLS protocol version of the current connection. + * For connected sockets that have not completed the handshake process, the value 'unknown' will be returned. + * Server sockets or disconnected client sockets will return a value of null. + * @param { AsyncCallback } callback - the callback of getProtocol. + * @throws { BusinessError } 2303501 - SSL is null. + * @throws { BusinessError } 2303505 - An error occurred in the TLS system call. + * @throws { BusinessError } 2300002 - System internal error. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + getProtocol(callback: AsyncCallback): void; + /** + * Returns a string containing the negotiated SSL/TLS protocol version of the current connection. + * For connected sockets that have not completed the handshake process, the value 'unknown' will be returned. + * Server sockets or disconnected client sockets will return a value of null. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 2303501 - SSL is null. + * @throws { BusinessError } 2303505 - An error occurred in the TLS system call. + * @throws { BusinessError } 2300002 - System internal error. + * @syscap SystemCapability.Communication.NetStack + * @since 9 + */ + /** + * Returns a string containing the negotiated SSL/TLS protocol version of the current connection. + * For connected sockets that have not completed the handshake process, the value 'unknown' will be returned. + * Server sockets or disconnected client sockets will return a value of null. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 2303501 - SSL is null. + * @throws { BusinessError } 2303505 - An error occurred in the TLS system call. + * @throws { BusinessError } 2300002 - System internal error. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + getProtocol(): Promise; + /** + * Returns a list containing the negotiated cipher suite information. + * For example:{"TLS_RSA_WITH_AES_128_CBC_SHA256", "TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256"} + * @param { AsyncCallback> } callback - the callback of getCipherSuite. + * @throws { BusinessError } 2303501 - SSL is null. + * @throws { BusinessError } 2303502 - An error occurred when reading data on the TLS socket. + * @throws { BusinessError } 2303505 - An error occurred in the TLS system call. + * @throws { BusinessError } 2300002 - System internal error. + * @syscap SystemCapability.Communication.NetStack + * @since 9 + */ + /** + * Returns a list containing the negotiated cipher suite information. + * For example:{"TLS_RSA_WITH_AES_128_CBC_SHA256", "TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256"} + * @param { AsyncCallback> } callback - the callback of getCipherSuite. + * @throws { BusinessError } 2303501 - SSL is null. + * @throws { BusinessError } 2303502 - An error occurred when reading data on the TLS socket. + * @throws { BusinessError } 2303505 - An error occurred in the TLS system call. + * @throws { BusinessError } 2300002 - System internal error. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + getCipherSuite(callback: AsyncCallback>): void; + /** + * Returns a list containing the negotiated cipher suite information. + * For example:{"TLS_RSA_WITH_AES_128_CBC_SHA256", "TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256"} + * @returns { Promise> } The promise returned by the function. + * @throws { BusinessError } 2303501 - SSL is null. + * @throws { BusinessError } 2303502 - An error occurred when reading data on the TLS socket. + * @throws { BusinessError } 2303505 - An error occurred in the TLS system call. + * @throws { BusinessError } 2300002 - System internal error. + * @syscap SystemCapability.Communication.NetStack + * @since 9 + */ + /** + * Returns a list containing the negotiated cipher suite information. + * For example:{"TLS_RSA_WITH_AES_128_CBC_SHA256", "TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256"} + * @returns { Promise> } The promise returned by the function. + * @throws { BusinessError } 2303501 - SSL is null. + * @throws { BusinessError } 2303502 - An error occurred when reading data on the TLS socket. + * @throws { BusinessError } 2303505 - An error occurred in the TLS system call. + * @throws { BusinessError } 2300002 - System internal error. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + getCipherSuite(): Promise>; + /** + *

The list of signature algorithms shared between the server and the client, + * in descending order of priority.

+ * @param { AsyncCallback> } callback - the callback of getSignatureAlgorithms.@see https://www.openssl.org/docs/man1.1.1/man3/SSL_get_shared_sigalgs.html + * @throws { BusinessError } 2303501 - SSL is null. + * @throws { BusinessError } 2300002 - System internal error. + * @syscap SystemCapability.Communication.NetStack + * @since 9 + */ + /** + *

The list of signature algorithms shared between the server and the client, + * in descending order of priority.

+ * @param { AsyncCallback> } callback - the callback of getSignatureAlgorithms.@see https://www.openssl.org/docs/man1.1.1/man3/SSL_get_shared_sigalgs.html + * @throws { BusinessError } 2303501 - SSL is null. + * @throws { BusinessError } 2300002 - System internal error. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + getSignatureAlgorithms(callback: AsyncCallback>): void; + /** + *

The list of signature algorithms shared between the server and the client, + * in descending order of priority.

+ * @returns { Promise> } The promise returned by the function.@see https://www.openssl.org/docs/man1.1.1/man3/SSL_get_shared_sigalgs.html + * @throws { BusinessError } 2303501 - SSL is null. + * @throws { BusinessError } 2300002 - System internal error. + * @syscap SystemCapability.Communication.NetStack + * @since 9 + */ + /** + *

The list of signature algorithms shared between the server and the client, + * in descending order of priority.

+ * @returns { Promise> } The promise returned by the function.@see https://www.openssl.org/docs/man1.1.1/man3/SSL_get_shared_sigalgs.html + * @throws { BusinessError } 2303501 - SSL is null. + * @throws { BusinessError } 2300002 - System internal error. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + getSignatureAlgorithms(): Promise>; + /** + * Sets up a connection to the specified IP address and port number. + * Only TCP is supported. + * @param { TLSConnectOptions } options - Optional parameters {@link TLSConnectOptions}. + * @param { AsyncCallback } callback - the callback of connect. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 2303104 - Interrupted system call. + * @throws { BusinessError } 2303109 - Bad file number. + * @throws { BusinessError } 2303111 - Resource temporarily unavailable. Try again. + * @throws { BusinessError } 2303188 - Socket operation on non-socket. + * @throws { BusinessError } 2303191 - Incorrect socket protocol type. + * @throws { BusinessError } 2303198 - Address already in use. + * @throws { BusinessError } 2303199 - Cannot assign requested address. + * @throws { BusinessError } 2303210 - Connection timed out. + * @throws { BusinessError } 2303501 - SSL is null. + * @throws { BusinessError } 2303502 - An error occurred when reading data on the TLS socket. + * @throws { BusinessError } 2303503 - An error occurred when writing data on the TLS socket. + * @throws { BusinessError } 2303505 - An error occurred in the TLS system call. + * @throws { BusinessError } 2303506 - Failed to close the TLS connection. + * @throws { BusinessError } 2300002 - System internal error. + * @syscap SystemCapability.Communication.NetStack + * @since 9 + */ + /** + * Sets up a connection to the specified IP address and port number. + * Only TCP is supported. + * @param { TLSConnectOptions } options - Optional parameters {@link TLSConnectOptions}. + * @param { AsyncCallback } callback - the callback of connect. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 2303104 - Interrupted system call. + * @throws { BusinessError } 2303109 - Bad file number. + * @throws { BusinessError } 2303111 - Resource temporarily unavailable. Try again. + * @throws { BusinessError } 2303188 - Socket operation on non-socket. + * @throws { BusinessError } 2303191 - Incorrect socket protocol type. + * @throws { BusinessError } 2303198 - Address already in use. + * @throws { BusinessError } 2303199 - Cannot assign requested address. + * @throws { BusinessError } 2303210 - Connection timed out. + * @throws { BusinessError } 2303501 - SSL is null. + * @throws { BusinessError } 2303502 - An error occurred when reading data on the TLS socket. + * @throws { BusinessError } 2303503 - An error occurred when writing data on the TLS socket. + * @throws { BusinessError } 2303505 - An error occurred in the TLS system call. + * @throws { BusinessError } 2303506 - Failed to close the TLS connection. + * @throws { BusinessError } 2300002 - System internal error. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + connect(options: TLSConnectOptions, callback: AsyncCallback): void; + /** + * Sets up a connection to the specified IP address and port number. + * Only TCP is supported. + * @param { TLSConnectOptions } options - Optional parameters {@link TLSConnectOptions}. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 2303104 - Interrupted system call. + * @throws { BusinessError } 2303109 - Bad file number. + * @throws { BusinessError } 2303111 - Resource temporarily unavailable. Try again. + * @throws { BusinessError } 2303188 - Socket operation on non-socket. + * @throws { BusinessError } 2303191 - Incorrect socket protocol type. + * @throws { BusinessError } 2303198 - Address already in use. + * @throws { BusinessError } 2303199 - Cannot assign requested address. + * @throws { BusinessError } 2303210 - Connection timed out. + * @throws { BusinessError } 2303501 - SSL is null. + * @throws { BusinessError } 2303502 - An error occurred when reading data on the TLS socket. + * @throws { BusinessError } 2303503 - An error occurred when writing data on the TLS socket. + * @throws { BusinessError } 2303505 - An error occurred in the TLS system call. + * @throws { BusinessError } 2303506 - Failed to close the TLS connection. + * @throws { BusinessError } 2300002 - System internal error. + * @syscap SystemCapability.Communication.NetStack + * @since 9 + */ + /** + * Sets up a connection to the specified IP address and port number. + * Only TCP is supported. + * @param { TLSConnectOptions } options - Optional parameters {@link TLSConnectOptions}. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 2303104 - Interrupted system call. + * @throws { BusinessError } 2303109 - Bad file number. + * @throws { BusinessError } 2303111 - Resource temporarily unavailable. Try again. + * @throws { BusinessError } 2303188 - Socket operation on non-socket. + * @throws { BusinessError } 2303191 - Incorrect socket protocol type. + * @throws { BusinessError } 2303198 - Address already in use. + * @throws { BusinessError } 2303199 - Cannot assign requested address. + * @throws { BusinessError } 2303210 - Connection timed out. + * @throws { BusinessError } 2303501 - SSL is null. + * @throws { BusinessError } 2303502 - An error occurred when reading data on the TLS socket. + * @throws { BusinessError } 2303503 - An error occurred when writing data on the TLS socket. + * @throws { BusinessError } 2303505 - An error occurred in the TLS system call. + * @throws { BusinessError } 2303506 - Failed to close the TLS connection. + * @throws { BusinessError } 2300002 - System internal error. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + connect(options: TLSConnectOptions): Promise; + /** + * Sends data over a TLSSocket connection. + * @param { string } data - Parameters for sending data {@link string}. + * @param { AsyncCallback } callback - the callback of send. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 2303501 - SSL is null. + * @throws { BusinessError } 2303503 - An error occurred when writing data on the TLS socket. + * @throws { BusinessError } 2303505 - An error occurred in the TLS system call. + * @throws { BusinessError } 2303506 - Failed to close the TLS connection. + * @throws { BusinessError } 2300002 - System internal error. + * @syscap SystemCapability.Communication.NetStack + * @since 9 + */ + /** + * Sends data over a TLSSocket connection. + * @param { string } data - Parameters for sending data {@link string}. + * @param { AsyncCallback } callback - the callback of send. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 2303501 - SSL is null. + * @throws { BusinessError } 2303503 - An error occurred when writing data on the TLS socket. + * @throws { BusinessError } 2303505 - An error occurred in the TLS system call. + * @throws { BusinessError } 2303506 - Failed to close the TLS connection. + * @throws { BusinessError } 2300002 - System internal error. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + /** + * Sends data over a TLSSocket connection. + * @param { string | ArrayBuffer } data - Parameters for sending data. + * @param { AsyncCallback } callback - the callback of send. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 2303501 - SSL is null. + * @throws { BusinessError } 2303503 - An error occurred when writing data on the TLS socket. + * @throws { BusinessError } 2303505 - An error occurred in the TLS system call. + * @throws { BusinessError } 2303506 - Failed to close the TLS connection. + * @throws { BusinessError } 2300002 - System internal error. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 12 + */ + send(data: string | ArrayBuffer, callback: AsyncCallback): void; + /** + * Sends data over a TLSSocket connection. + * @param { string } data - Parameters for sending data {@link string}. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 2303501 - SSL is null. + * @throws { BusinessError } 2303503 - An error occurred when writing data on the TLS socket. + * @throws { BusinessError } 2303505 - An error occurred in the TLS system call. + * @throws { BusinessError } 2303506 - Failed to close the TLS connection. + * @throws { BusinessError } 2300002 - System internal error. + * @syscap SystemCapability.Communication.NetStack + * @since 9 + */ + /** + * Sends data over a TLSSocket connection. + * @param { string } data - Parameters for sending data {@link string}. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 2303501 - SSL is null. + * @throws { BusinessError } 2303503 - An error occurred when writing data on the TLS socket. + * @throws { BusinessError } 2303505 - An error occurred in the TLS system call. + * @throws { BusinessError } 2303506 - Failed to close the TLS connection. + * @throws { BusinessError } 2300002 - System internal error. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + /** + * Sends data over a TLSSocket connection. + * @param { string | ArrayBuffer } data - Parameters for sending data. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 2303501 - SSL is null. + * @throws { BusinessError } 2303503 - An error occurred when writing data on the TLS socket. + * @throws { BusinessError } 2303505 - An error occurred in the TLS system call. + * @throws { BusinessError } 2303506 - Failed to close the TLS connection. + * @throws { BusinessError } 2300002 - System internal error. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 12 + */ + send(data: string | ArrayBuffer): Promise; + /** + * Closes a TLSSocket connection + * @param { AsyncCallback } callback - the callback of close. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 2303501 - SSL is null. + * @throws { BusinessError } 2303505 - An error occurred in the TLS system call. + * @throws { BusinessError } 2303506 - Failed to close the TLS connection. + * @throws { BusinessError } 2300002 - System internal error. + * @syscap SystemCapability.Communication.NetStack + * @since 9 + */ + /** + * Closes a TLSSocket connection + * @param { AsyncCallback } callback - the callback of close. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 2303501 - SSL is null. + * @throws { BusinessError } 2303505 - An error occurred in the TLS system call. + * @throws { BusinessError } 2303506 - Failed to close the TLS connection. + * @throws { BusinessError } 2300002 - System internal error. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + close(callback: AsyncCallback): void; + /** + * Closes a TLSSocket connection + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 2303501 - SSL is null. + * @throws { BusinessError } 2303505 - An error occurred in the TLS system call. + * @throws { BusinessError } 2303506 - Failed to close the TLS connection. + * @throws { BusinessError } 2300002 - System internal error. + * @syscap SystemCapability.Communication.NetStack + * @since 9 + */ + /** + * Closes a TLSSocket connection + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 2303501 - SSL is null. + * @throws { BusinessError } 2303505 - An error occurred in the TLS system call. + * @throws { BusinessError } 2303506 - Failed to close the TLS connection. + * @throws { BusinessError } 2300002 - System internal error. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + close(): Promise; + } + /** + * Defines TLS security options. The CA certificate is mandatory, and other parameters are optional. + * @interface TLSSecureOptions + * @syscap SystemCapability.Communication.NetStack + * @since 9 + */ + /** + * Defines TLS security options. The CA certificate is mandatory, and other parameters are optional. + * @interface TLSSecureOptions + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + export interface TLSSecureOptions { + /** + * Certificate used to verify the identity of the server + * @type {string | Array} + * @syscap SystemCapability.Communication.NetStack + * @since 9 + */ + /** + * Certificate used to verify the identity of the server. + * @type {string | Array} + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + /** + * Certificate used to verify the identity of the server, if it is not set, use system ca. + * @type {?(string | Array)} + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 12 + */ + ca?: string | Array; + /** + * Certificate proving the identity of the client + * @type {?string} + * @syscap SystemCapability.Communication.NetStack + * @since 9 + */ + /** + * Certificate proving the identity of the client + * @type {?string} + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + cert?: string; + /** + * Private key of client certificate + * @type {?string} + * @syscap SystemCapability.Communication.NetStack + * @since 9 + */ + /** + * Private key of client certificate + * @type {?string} + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + key?: string; + /** + * Password of the private key + * @type {?string} + * @syscap SystemCapability.Communication.NetStack + * @since 9 + */ + /** + * Password of the private key + * @type {?string} + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + password?: string; + /** + * TLS protocol version + * @type {?Protocol | Array} + * @syscap SystemCapability.Communication.NetStack + * @since 9 + */ + /** + * TLS protocol version + * @type {?(Protocol | Array)} + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + protocols?: Protocol | Array; + /** + * default is false, use local cipher. + * @type {?boolean} + * @syscap SystemCapability.Communication.NetStack + * @since 9 + */ + /** + * default is false, use local cipher. + * @type {?boolean} + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + useRemoteCipherPrefer?: boolean; + /** + *

Supported signature algorithms. This string can contain summary algorithms(SHA256,MD5,etc),Public key algorithm(RSA-PSS,ECDSA,etc), + * Combination of the two(For example 'RSA+SHA384') or TLS v1.3 Scheme name(For example rsa_pss_pss_sha512)

+ * @type {?string} + * @syscap SystemCapability.Communication.NetStack + * @since 9 + */ + /** + *

Supported signature algorithms. This string can contain summary algorithms(SHA256,MD5,etc),Public key algorithm(RSA-PSS,ECDSA,etc), + * Combination of the two(For example 'RSA+SHA384') or TLS v1.3 Scheme name(For example rsa_pss_pss_sha512)

+ * @type {?string} + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + signatureAlgorithms?: string; + /** + * Crypto suite specification + * @type {?string} + * @syscap SystemCapability.Communication.NetStack + * @since 9 + */ + /** + * Crypto suite specification + * @type {?string} + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + cipherSuite?: string; + } + /** + * Defines TLS connection options. + * @interface TLSConnectOptions + * @syscap SystemCapability.Communication.NetStack + * @since 9 + */ + /** + * Defines TLS connection options. + * @interface TLSConnectOptions + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + export interface TLSConnectOptions { + /** + * Gateway address. + * @type {NetAddress} + * @syscap SystemCapability.Communication.NetStack + * @since 9 + */ + /** + * Gateway address. + * @type {NetAddress} + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + address: NetAddress; + /** + * Protocol http2TLS security related operations. + * @type {TLSSecureOptions} + * @syscap SystemCapability.Communication.NetStack + * @since 9 + */ + /** + * Protocol http2TLS security related operations. + * @type {TLSSecureOptions} + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + secureOptions: TLSSecureOptions; + /** + * Application layer protocol negotiation extension, such as "spdy/1", "http/1.1", "h2" + * @type {?Array} + * @syscap SystemCapability.Communication.NetStack + * @since 9 + */ + /** + * Application layer protocol negotiation extension, such as "spdy/1", "http/1.1", "h2" + * @type {?Array} + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + ALPNProtocols?: Array; + } + /** + * Enumerates TLS protocol versions. + * @enum {string} + * @syscap SystemCapability.Communication.NetStack + * @since 9 + */ + /** + * Enumerates TLS protocol versions. + * @enum {string} + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + export enum Protocol { + /** + * Use TLSv1.2 protocol for communication. + * @syscap SystemCapability.Communication.NetStack + * @since 9 + */ + /** + * Use TLSv1.2 protocol for communication. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + TLSv12 = "TLSv1.2", + /** + * Use TLSv1.3 protocol for communication. + * @syscap SystemCapability.Communication.NetStack + * @since 9 + */ + /** + * Use TLSv1.3 protocol for communication. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + TLSv13 = "TLSv1.3" + } + /** + * Defines the connection of the TCPSocket client and server. + * @interface TCPSocketConnection + * @syscap SystemCapability.Communication.NetStack + * @since 10 + */ + export interface TCPSocketConnection { + /** + * The id of a client connects to the TCPSocketServer. + * @type {number} + * @syscap SystemCapability.Communication.NetStack + * @since 10 + */ + clientId: number; + /** + * Sends data over a TCPSocketServer connection to client. + * @permission ohos.permission.INTERNET + * @param { TCPSendOptions } options - Parameters for sending data {@link TCPSendOptions}. + * @param { AsyncCallback } callback - The callback of send. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 2300002 - System internal error. + * @syscap SystemCapability.Communication.NetStack + * @since 10 + */ + send(options: TCPSendOptions, callback: AsyncCallback): void; + /** + * Sends data over a TCPSocketServer connection to client. + * @permission ohos.permission.INTERNET + * @param { TCPSendOptions } options - Parameters for sending data {@link TCPSendOptions}. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 2300002 - System internal error. + * @syscap SystemCapability.Communication.NetStack + * @since 10 + */ + send(options: TCPSendOptions): Promise; + /** + * Closes a TCPSocket client connection. + * @permission ohos.permission.INTERNET + * @param { AsyncCallback } callback - The callback of close. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 2300002 - System internal error. + * @syscap SystemCapability.Communication.NetStack + * @since 10 + */ + close(callback: AsyncCallback): void; + /** + * Closes a TCPSocket client connection. + * @permission ohos.permission.INTERNET + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 2300002 - System internal error. + * @syscap SystemCapability.Communication.NetStack + * @since 10 + */ + close(): Promise; + /** + * Obtains the peer address of a TCPSocketServer connection. + * @permission ohos.permission.INTERNET + * @param { AsyncCallback } callback - The callback of getRemoteAddress. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 2300002 - System internal error. + * @throws { BusinessError } 2303188 - Socket operation on non-socket. + * @syscap SystemCapability.Communication.NetStack + * @since 10 + */ + getRemoteAddress(callback: AsyncCallback): void; + /** + * Obtains the peer address of a TCPSocketServer connection. + * @permission ohos.permission.INTERNET + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 2300002 - System internal error. + * @throws { BusinessError } 2303188 - Socket operation on non-socket. + * @syscap SystemCapability.Communication.NetStack + * @since 10 + */ + getRemoteAddress(): Promise; + /** + * Listens for message receiving events of the TCPSocketConnection. + * @param { 'message' } type - Indicates Event name. + * @param { Callback<{ message: ArrayBuffer, remoteInfo: SocketRemoteInfo }> } callback - The callback of on. + * @throws { BusinessError } 401 - Parameter error. + * @syscap SystemCapability.Communication.NetStack + * @since 10 + */ + /** + * Listens for message receiving events of the TCPSocketConnection. + * @param { 'message' } type - Indicates Event name. + * @param { Callback } callback - The callback of on. + * @throws { BusinessError } 401 - Parameter error. + * @syscap SystemCapability.Communication.NetStack + * @since 11 + */ + on(type: 'message', callback: Callback): void; + /** + * Cancels listening for message receiving events of the TCPSocketConnection. + * @param { 'message' } type - Indicates Event name. + * @param { Callback<{ message: ArrayBuffer, remoteInfo: SocketRemoteInfo }> } callback - The callback of off. + * @throws { BusinessError } 401 - Parameter error. + * @syscap SystemCapability.Communication.NetStack + * @since 10 + */ + /** + * Cancels listening for message receiving events of the TCPSocketConnection. + * @param { 'message' } type - Indicates Event name. + * @param { Callback } callback - The callback of off. + * @throws { BusinessError } 401 - Parameter error. + * @syscap SystemCapability.Communication.NetStack + * @since 11 + */ + off(type: 'message', callback?: Callback): void; + /** + * Listens for close events of the TCPSocketConnection. + * @param { 'close' } type - Indicates Event name. + * @param { Callback } callback - The callback of on. + * @throws { BusinessError } 401 - Parameter error. + * @syscap SystemCapability.Communication.NetStack + * @since 10 + */ + on(type: 'close', callback: Callback): void; + /** + * Cancels listening for close events of the TCPSocketConnection. + * @param { 'close' } type - Indicates Event name. + * @param { Callback } callback - The callback of off. + * @throws { BusinessError } 401 - Parameter error. + * @syscap SystemCapability.Communication.NetStack + * @since 10 + */ + off(type: 'close', callback?: Callback): void; + /** + * Listens for error events of the TCPSocketConnection. + * @param { 'error' } type - Indicates Event name. + * @param { ErrorCallback } callback - The callback of on. + * @throws { BusinessError } 401 - Parameter error. + * @syscap SystemCapability.Communication.NetStack + * @since 10 + */ + on(type: 'error', callback: ErrorCallback): void; + /** + * Cancels listening for error events of the TCPSocketConnection. + * @param { 'error' } type - Indicates Event name. + * @param { ErrorCallback } callback - The callback of off. + * @throws { BusinessError } 401 - Parameter error. + * @syscap SystemCapability.Communication.NetStack + * @since 10 + */ + off(type: 'error', callback?: ErrorCallback): void; + } + /** + * Defines a TCPSocket server connection. + * @interface TCPSocketServer + * @syscap SystemCapability.Communication.NetStack + * @since 10 + */ + export interface TCPSocketServer { + /** + * Binds the IP address and port number, the port number can be specified or randomly allocated by the system. + *

Listens for a TCPSocket connection to be made to this socket and accepts it. This interface uses multiple threads + * for accept processing and uses poll multiplex to process client connections.

+ * @permission ohos.permission.INTERNET + * @param { NetAddress } address - Network address information {@link NetAddress}. + * @param { AsyncCallback } callback - The callback of listen. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 2300002 - System internal error. + * @throws { BusinessError } 2303109 - Bad file number. + * @throws { BusinessError } 2303111 - Resource temporarily unavailable. Try again. + * @throws { BusinessError } 2303198 - Address already in use. + * @throws { BusinessError } 2303199 - Cannot assign requested address. + * @syscap SystemCapability.Communication.NetStack + * @since 10 + */ + listen(address: NetAddress, callback: AsyncCallback): void; + /** + * Binds the IP address and port number, the port number can be specified or randomly allocated by the system. + *

Listens for a TCPSocket connection to be made to this socket and accepts it. This interface uses multiple threads + * for accept processing and uses poll multiplex to process client connections.

+ * @permission ohos.permission.INTERNET + * @param { NetAddress } address - Network address information {@link NetAddress}. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 2300002 - System internal error. + * @throws { BusinessError } 2303109 - Bad file number. + * @throws { BusinessError } 2303111 - Resource temporarily unavailable. Try again. + * @throws { BusinessError } 2303198 - Address already in use. + * @throws { BusinessError } 2303199 - Cannot assign requested address. + * @syscap SystemCapability.Communication.NetStack + * @since 10 + */ + listen(address: NetAddress): Promise; + /** + * Obtains the status of the TCPSocketServer connection. + * @permission ohos.permission.INTERNET + * @param { AsyncCallback } callback - The callback of getState. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 2300002 - System internal error. + * @throws { BusinessError } 2303188 - Socket operation on non-socket. + * @syscap SystemCapability.Communication.NetStack + * @since 10 + */ + getState(callback: AsyncCallback): void; + /** + * Obtains the status of the TCPSocketServer connection. + * @permission ohos.permission.INTERNET + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 2300002 - System internal error. + * @throws { BusinessError } 2303188 - Socket operation on non-socket. + * @syscap SystemCapability.Communication.NetStack + * @since 10 + */ + getState(): Promise; + /** + * Sets other attributes of the TCPSocketServer connection. + * @permission ohos.permission.INTERNET + * @param { TCPExtraOptions } options - Parameters of the attributes {@link TCPExtraOptions}. + * @param { AsyncCallback } callback - The callback of setExtraOptions. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 2300002 - System internal error. + * @throws { BusinessError } 2303188 - Socket operation on non-socket. + * @syscap SystemCapability.Communication.NetStack + * @since 10 + */ + setExtraOptions(options: TCPExtraOptions, callback: AsyncCallback): void; + /** + * Sets other attributes of the TCPSocketServer connection. + * @permission ohos.permission.INTERNET + * @param { TCPExtraOptions } options - Parameters of the attributes {@link TCPExtraOptions}. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 2300002 - System internal error. + * @throws { BusinessError } 2303188 - Socket operation on non-socket. + * @syscap SystemCapability.Communication.NetStack + * @since 10 + */ + setExtraOptions(options: TCPExtraOptions): Promise; + /** + * Listens for connect events of the TCPSocketServer connection. + * @param { 'connect' } type - Indicates Event name. + * @param { Callback } callback - The callback of on. + * @throws { BusinessError } 401 - Parameter error. + * @syscap SystemCapability.Communication.NetStack + * @since 10 + */ + on(type: 'connect', callback: Callback): void; + /** + * Cancels listening for connect events of the TCPSocketServer connection. + * @param { 'connect' } type - Indicates Event name. + * @param { Callback } callback - The callback of off. + * @throws { BusinessError } 401 - Parameter error. + * @syscap SystemCapability.Communication.NetStack + * @since 10 + */ + off(type: 'connect', callback?: Callback): void; + /** + * Listens for error events of the TCPSocketServer connection. + * @param { 'error' } type - Indicates Event name. + * @param { ErrorCallback } callback - The callback of on. + * @throws { BusinessError } 401 - Parameter error. + * @syscap SystemCapability.Communication.NetStack + * @since 10 + */ + on(type: 'error', callback: ErrorCallback): void; + /** + * Cancels listening for error events of the TCPSocketServer connection. + * @param { 'error' } type - Indicates Event name. + * @param { ErrorCallback } callback - The callback of off. + * @throws { BusinessError } 401 - Parameter error. + * @syscap SystemCapability.Communication.NetStack + * @since 10 + */ + off(type: 'error', callback?: ErrorCallback): void; + } + /** + * Defines the connection of the TLSSocket client and server. + * @interface TLSSocketConnection + * @syscap SystemCapability.Communication.NetStack + * @since 10 + */ + export interface TLSSocketConnection { + /** + * The id of a client connects to the TLSSocketServer. + * @type {number} + * @syscap SystemCapability.Communication.NetStack + * @since 10 + */ + clientId: number; + /** + * Sends data over a TLSSocketServer connection to client. + * @param { string } data - Parameters for sending data. + * @param { AsyncCallback } callback - The callback of send. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 2303501 - SSL is null. + * @throws { BusinessError } 2303503 - An error occurred when writing data on the TLS socket. + * @throws { BusinessError } 2303505 - An error occurred in the TLS system call. + * @throws { BusinessError } 2303506 - Failed to close the TLS connection. + * @throws { BusinessError } 2300002 - System internal error. + * @syscap SystemCapability.Communication.NetStack + * @since 10 + */ + /** + * Sends data over a TLSSocketServer connection to client. + * @param { string | ArrayBuffer } data - Parameters for sending data. + * @param { AsyncCallback } callback - The callback of send. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 2303501 - SSL is null. + * @throws { BusinessError } 2303503 - An error occurred when writing data on the TLS socket. + * @throws { BusinessError } 2303505 - An error occurred in the TLS system call. + * @throws { BusinessError } 2303506 - Failed to close the TLS connection. + * @throws { BusinessError } 2300002 - System internal error. + * @syscap SystemCapability.Communication.NetStack + * @since 12 + */ + send(data: string | ArrayBuffer, callback: AsyncCallback): void; + /** + * Sends data over a TLSSocketServer connection to client. + * @param { string } data - Parameters for sending data. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 2303501 - SSL is null. + * @throws { BusinessError } 2303503 - An error occurred when writing data on the TLS socket. + * @throws { BusinessError } 2303505 - An error occurred in the TLS system call. + * @throws { BusinessError } 2303506 - Failed to close the TLS connection. + * @throws { BusinessError } 2300002 - System internal error. + * @syscap SystemCapability.Communication.NetStack + * @since 10 + */ + /** + * Sends data over a TLSSocketServer connection to client. + * @param { string | ArrayBuffer } data - Parameters for sending data. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 2303501 - SSL is null. + * @throws { BusinessError } 2303503 - An error occurred when writing data on the TLS socket. + * @throws { BusinessError } 2303505 - An error occurred in the TLS system call. + * @throws { BusinessError } 2303506 - Failed to close the TLS connection. + * @throws { BusinessError } 2300002 - System internal error. + * @syscap SystemCapability.Communication.NetStack + * @since 12 + */ + send(data: string | ArrayBuffer): Promise; + /** + * Closes a TLSSocket client connection. + * @param { AsyncCallback } callback - The callback of close. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 2303501 - SSL is null. + * @throws { BusinessError } 2303505 - An error occurred in the TLS system call. + * @throws { BusinessError } 2303506 - Failed to close the TLS connection. + * @throws { BusinessError } 2300002 - System internal error. + * @syscap SystemCapability.Communication.NetStack + * @since 10 + */ + close(callback: AsyncCallback): void; + /** + * Closes a TLSSocket client connection. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 2303501 - SSL is null. + * @throws { BusinessError } 2303505 - An error occurred in the TLS system call. + * @throws { BusinessError } 2303506 - Failed to close the TLS connection. + * @throws { BusinessError } 2300002 - System internal error. + * @syscap SystemCapability.Communication.NetStack + * @since 10 + */ + close(): Promise; + /** + * Obtains the peer address of a TLSSocketServer connection. + * @param { AsyncCallback } callback - The callback of getRemoteAddress. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 2300002 - System internal error. + * @throws { BusinessError } 2303188 - Socket operation on non-socket. + * @syscap SystemCapability.Communication.NetStack + * @since 10 + */ + getRemoteAddress(callback: AsyncCallback): void; + /** + * Obtains the peer address of a TLSSocketServer connection. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 2300002 - System internal error. + * @throws { BusinessError } 2303188 - Socket operation on non-socket. + * @syscap SystemCapability.Communication.NetStack + * @since 10 + */ + getRemoteAddress(): Promise; + /** + *

Returns an object representing the peer certificate. If the peer does not provide a certificate, + * an empty object will be returned. If the socket is destroyed, null is returned.

+ * It only contains the peer's certificate. + * @param { AsyncCallback } callback - The callback of getRemoteCertificate. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 2303501 - SSL is null. + * @throws { BusinessError } 2300002 - System internal error. + * @syscap SystemCapability.Communication.NetStack + * @since 10 + */ + getRemoteCertificate(callback: AsyncCallback): void; + /** + *

Returns an object representing the peer certificate. If the peer does not provide a certificate, + * an empty object will be returned. If the socket is destroyed, null is returned.

+ * It only contains the peer's certificate. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 2303501 - SSL is null. + * @throws { BusinessError } 2300002 - System internal error. + * @syscap SystemCapability.Communication.NetStack + * @since 10 + */ + getRemoteCertificate(): Promise; + /** + * Returns a list containing the negotiated cipher suite information. + * For example:{"TLS_RSA_WITH_AES_128_CBC_SHA256", "TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256"} + * @param { AsyncCallback> } callback - The callback of getCipherSuite. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 2303501 - SSL is null. + * @throws { BusinessError } 2303502 - An error occurred when reading data on the TLS socket. + * @throws { BusinessError } 2303505 - An error occurred in the TLS system call. + * @throws { BusinessError } 2300002 - System internal error. + * @syscap SystemCapability.Communication.NetStack + * @since 10 + */ + getCipherSuite(callback: AsyncCallback>): void; + /** + * Returns a list containing the negotiated cipher suite information. + * For example:{"TLS_RSA_WITH_AES_128_CBC_SHA256", "TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256"} + * @returns { Promise> } The promise returned by the function. + * @throws { BusinessError } 2303501 - SSL is null. + * @throws { BusinessError } 2303502 - An error occurred when reading data on the TLS socket. + * @throws { BusinessError } 2303505 - An error occurred in the TLS system call. + * @throws { BusinessError } 2300002 - System internal error. + * @syscap SystemCapability.Communication.NetStack + * @since 10 + */ + getCipherSuite(): Promise>; + /** + *

The list of signature algorithms shared between the server and the client, + * in descending order of priority.

+ * @param { AsyncCallback> } callback - The callback of getSignatureAlgorithms. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 2303501 - SSL is null. + * @throws { BusinessError } 2300002 - System internal error. + * @syscap SystemCapability.Communication.NetStack + * @since 10 + */ + getSignatureAlgorithms(callback: AsyncCallback>): void; + /** + *

The list of signature algorithms shared between the server and the client, + * in descending order of priority.

+ * @returns { Promise> } The promise returned by the function. + * @throws { BusinessError } 2303501 - SSL is null. + * @throws { BusinessError } 2300002 - System internal error. + * @syscap SystemCapability.Communication.NetStack + * @since 10 + */ + getSignatureAlgorithms(): Promise>; + /** + * Listens for message receiving events of the TLSSocketConnection. + * @param { 'message' } type - Indicates Event name. + * @param { Callback<{ message: ArrayBuffer, remoteInfo: SocketRemoteInfo }> } callback - The callback of on. + * @throws { BusinessError } 401 - Parameter error. + * @syscap SystemCapability.Communication.NetStack + * @since 10 + */ + /** + * Listens for message receiving events of the TLSSocketConnection. + * @param { 'message' } type - Indicates Event name. + * @param { Callback } callback - The callback of on. + * @throws { BusinessError } 401 - Parameter error. + * @syscap SystemCapability.Communication.NetStack + * @since 11 + */ + on(type: 'message', callback: Callback): void; + /** + * Cancels listening for message receiving events of the TLSSocketConnection. + * @param { 'message' } type - Indicates Event name. + * @param { Callback<{ message: ArrayBuffer, remoteInfo: SocketRemoteInfo }> } callback - The callback of off. + * @throws { BusinessError } 401 - Parameter error. + * @syscap SystemCapability.Communication.NetStack + * @since 10 + */ + /** + * Cancels listening for message receiving events of the TLSSocketConnection. + * @param { 'message' } type - Indicates Event name. + * @param { Callback } callback - The callback of off. + * @throws { BusinessError } 401 - Parameter error. + * @syscap SystemCapability.Communication.NetStack + * @since 11 + */ + off(type: 'message', callback?: Callback): void; + /** + * Listens for close events of the TLSSocketConnection. + * @param { 'close' } type - Indicates Event name. + * @param { Callback } callback - The callback of on. + * @throws { BusinessError } 401 - Parameter error. + * @syscap SystemCapability.Communication.NetStack + * @since 10 + */ + on(type: 'close', callback: Callback): void; + /** + * Cancels listening for close events of the TLSSocketConnection. + * @param { 'close' } type - Indicates Event name. + * @param { Callback } callback - The callback of off. + * @throws { BusinessError } 401 - Parameter error. + * @syscap SystemCapability.Communication.NetStack + * @since 10 + */ + off(type: 'close', callback?: Callback): void; + /** + * Listens for error events of the TLSSocketConnection. + * @param { 'error' } type - Indicates Event name. + * @param { ErrorCallback } callback - The callback of on. + * @throws { BusinessError } 401 - Parameter error. + * @syscap SystemCapability.Communication.NetStack + * @since 10 + */ + on(type: 'error', callback: ErrorCallback): void; + /** + * Cancels listening for error events of the TLSSocketConnection. + * @param { 'error' } type - Indicates Event name. + * @param { ErrorCallback } callback - The callback of off. + * @throws { BusinessError } 401 - Parameter error. + * @syscap SystemCapability.Communication.NetStack + * @since 10 + */ + off(type: 'error', callback?: ErrorCallback): void; + } + /** + * Defines the socket connection information. + * @interface SocketMessageInfo + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 11 + */ + export interface SocketMessageInfo { + /** + * Receive the message event. + * @type { ArrayBuffer } + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 11 + */ + message: ArrayBuffer; + /** + * Socket connection information. + * @type { SocketRemoteInfo } + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 11 + */ + remoteInfo: SocketRemoteInfo; + } + /** + * Defines a TLSSocketServer server connection. + * @interface TLSSocketServer + * @syscap SystemCapability.Communication.NetStack + * @since 10 + */ + export interface TLSSocketServer { + /** + * Binds the IP address and port number, the port number can be specified or randomly allocated by the system. + *

Listens for a TCPSocket connection to be made to this socket and accepts it. This interface uses multiple threads + * for accept processing and uses poll multiplex to process client connections.

+ * @permission ohos.permission.INTERNET + * @param { TLSConnectOptions } options - TLS connection options {@link TLSConnectOptions}. + * @param { AsyncCallback } callback - The callback of listen. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 2300002 - System internal error. + * @throws { BusinessError } 2303109 - Bad file number. + * @throws { BusinessError } 2303111 - Resource temporarily unavailable. Try again. + * @throws { BusinessError } 2303198 - Address already in use. + * @throws { BusinessError } 2303199 - Cannot assign requested address. + * @throws { BusinessError } 2303501 - SSL is null. + * @throws { BusinessError } 2303502 - An error occurred when reading data on the TLS socket. + * @throws { BusinessError } 2303503 - An error occurred when writing data on the TLS socket. + * @throws { BusinessError } 2303505 - An error occurred in the TLS system call. + * @throws { BusinessError } 2303506 - Failed to close the TLS connection. + * @syscap SystemCapability.Communication.NetStack + * @since 10 + */ + listen(options: TLSConnectOptions, callback: AsyncCallback): void; + /** + * Binds the IP address and port number, the port number can be specified or randomly allocated by the system. + *

Listens for a TCPSocket connection to be made to this socket and accepts it. This interface uses multiple threads + * for accept processing and uses poll multiplex to process client connections.

+ * @permission ohos.permission.INTERNET + * @param { TLSConnectOptions } options - TLS connection options {@link TLSConnectOptions}. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 2300002 - System internal error. + * @throws { BusinessError } 2303109 - Bad file number. + * @throws { BusinessError } 2303111 - Resource temporarily unavailable. Try again. + * @throws { BusinessError } 2303198 - Address already in use. + * @throws { BusinessError } 2303199 - Cannot assign requested address. + * @throws { BusinessError } 2303501 - SSL is null. + * @throws { BusinessError } 2303502 - An error occurred when reading data on the TLS socket. + * @throws { BusinessError } 2303503 - An error occurred when writing data on the TLS socket. + * @throws { BusinessError } 2303505 - An error occurred in the TLS system call. + * @throws { BusinessError } 2303506 - Failed to close the TLS connection. + * @syscap SystemCapability.Communication.NetStack + * @since 10 + */ + listen(options: TLSConnectOptions): Promise; + /** + * Obtains the status of the TLSSocketServer connection. + * @param { AsyncCallback } callback - The callback of getState. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 2303188 - Socket operation on non-socket. + * @throws { BusinessError } 2300002 - System internal error. + * @syscap SystemCapability.Communication.NetStack + * @since 10 + */ + getState(callback: AsyncCallback): void; + /** + * Obtains the status of the TLSSocketServer connection. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 2303188 - Socket operation on non-socket. + * @throws { BusinessError } 2300002 - System internal error. + * @syscap SystemCapability.Communication.NetStack + * @since 10 + */ + getState(): Promise; + /** + * Sets other attributes of the TLSSocketServer connection. + * @param { TCPExtraOptions } options - Parameters of the attributes {@link TCPExtraOptions}. + * @param { AsyncCallback } callback - The callback of setExtraOptions. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 2303188 - Socket operation on non-socket. + * @throws { BusinessError } 2300002 - System internal error. + * @syscap SystemCapability.Communication.NetStack + * @since 10 + */ + setExtraOptions(options: TCPExtraOptions, callback: AsyncCallback): void; + /** + * Sets other attributes of the TLSSocketServer connection. + * @param { TCPExtraOptions } options - Parameters of the attributes {@link TCPExtraOptions}. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 2303188 - Socket operation on non-socket. + * @throws { BusinessError } 2300002 - System internal error. + * @syscap SystemCapability.Communication.NetStack + * @since 10 + */ + setExtraOptions(options: TCPExtraOptions): Promise; + /** + * Returns an object representing a local certificate. + * @param { AsyncCallback } callback - The callback of getCertificate. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 2303501 - SSL is null. + * @throws { BusinessError } 2303504 - An error occurred when verifying the X.509 certificate. + * @throws { BusinessError } 2300002 - System internal error. + * @syscap SystemCapability.Communication.NetStack + * @since 10 + */ + getCertificate(callback: AsyncCallback): void; + /** + * Returns an object representing a local certificate. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 2303501 - SSL is null. + * @throws { BusinessError } 2303504 - An error occurred when verifying the X.509 certificate. + * @throws { BusinessError } 2300002 - System internal error. + * @syscap SystemCapability.Communication.NetStack + * @since 10 + */ + getCertificate(): Promise; + /** + * Returns a string containing the negotiated SSL/TLS protocol version of the current connection. + * For connected sockets that have not completed the handshake process, the value 'unknown' will be returned. + * Server sockets or disconnected client sockets will return a value of null. + * @param { AsyncCallback } callback - The callback of getProtocol. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 2303501 - SSL is null. + * @throws { BusinessError } 2303505 - An error occurred in the TLS system call. + * @throws { BusinessError } 2300002 - System internal error. + * @syscap SystemCapability.Communication.NetStack + * @since 10 + */ + getProtocol(callback: AsyncCallback): void; + /** + * Returns a string containing the negotiated SSL/TLS protocol version of the current connection. + * For connected sockets that have not completed the handshake process, the value 'unknown' will be returned. + * Server sockets or disconnected client sockets will return a value of null. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 2303501 - SSL is null. + * @throws { BusinessError } 2303505 - An error occurred in the TLS system call. + * @throws { BusinessError } 2300002 - System internal error. + * @syscap SystemCapability.Communication.NetStack + * @since 10 + */ + getProtocol(): Promise; + /** + * Listens for connect events of the TLSSocketServer connection. + * @param { 'connect' } type - Indicates Event name. + * @param { Callback } callback - The callback of on. + * @throws { BusinessError } 401 - Parameter error. + * @syscap SystemCapability.Communication.NetStack + * @since 10 + */ + on(type: 'connect', callback: Callback): void; + /** + * Cancels listening for connect events of the TLSSocketServer connection. + * @param { 'connect' } type - Indicates Event name. + * @param { Callback } callback - The callback of off. + * @throws { BusinessError } 401 - Parameter error. + * @syscap SystemCapability.Communication.NetStack + * @since 10 + */ + off(type: 'connect', callback?: Callback): void; + /** + * Listens for error events of the TLSSocketServer connection. + * @param { 'error' } type - Indicates Event name. + * @param { ErrorCallback } callback - The callback of on. + * @throws { BusinessError } 401 - Parameter error. + * @syscap SystemCapability.Communication.NetStack + * @since 10 + */ + on(type: 'error', callback: ErrorCallback): void; + /** + * Cancels listening for error events of the TLSSocketServer connection. + * @param { 'error' } type - Indicates Event name. + * @param { ErrorCallback } callback - The callback of off. + * @throws { BusinessError } 401 - Parameter error. + * @syscap SystemCapability.Communication.NetStack + * @since 10 + */ + off(type: 'error', callback?: ErrorCallback): void; + } +} +export default socket; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.net.statistics.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.net.statistics.d.ts new file mode 100755 index 00000000..67e2816c --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.net.statistics.d.ts @@ -0,0 +1,283 @@ +/* + * Copyright (C) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit NetworkKit + */ +import type { AsyncCallback } from './@ohos.base'; +import type connection from './@ohos.net.connection'; +/** + * Obtains traffic statistics. + * @namespace statistics + * @syscap SystemCapability.Communication.NetManager.Core + * @since 10 + */ +declare namespace statistics { + /** + * @typedef NetBearType + * @syscap SystemCapability.Communication.NetManager.Core + * @since 12 + */ + type NetBearType = connection.NetBearType; + /** + * Queries the data traffic (including all TCP and UDP data packets) received through a specified NIC. + * @param { string } nic - Network interface card. + * @param { AsyncCallback } callback - Returns the data traffic received through the specified NIC. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 2100002 - Failed to connect to the service. + * @throws { BusinessError } 2100003 - System internal error. + * @throws { BusinessError } 2103005 - Failed to read the system map. + * @throws { BusinessError } 2103011 - Failed to create a system map. + * @throws { BusinessError } 2103012 - Failed to obtain the NIC name. + * @syscap SystemCapability.Communication.NetManager.Core + * @since 10 + */ + function getIfaceRxBytes(nic: string, callback: AsyncCallback): void; + /** + * Queries the data traffic (including all TCP and UDP data packets) received through a specified NIC. + * @param { string } nic - Network interface card. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 2100002 - Failed to connect to the service. + * @throws { BusinessError } 2100003 - System internal error. + * @throws { BusinessError } 2103005 - Failed to read the system map. + * @throws { BusinessError } 2103011 - Failed to create a system map. + * @throws { BusinessError } 2103012 - Failed to obtain the NIC name. + * @syscap SystemCapability.Communication.NetManager.Core + * @since 10 + */ + function getIfaceRxBytes(nic: string): Promise; + /** + * Queries the data traffic (including all TCP and UDP data packets) sent through a specified NIC. + * @param { string } nic - Network interface card. + * @param { AsyncCallback } callback - Returns the data traffic sent through the specified NIC. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 2100002 - Failed to connect to the service. + * @throws { BusinessError } 2100003 - System internal error. + * @throws { BusinessError } 2103005 - Failed to read the system map. + * @throws { BusinessError } 2103011 - Failed to create a system map. + * @throws { BusinessError } 2103012 - Failed to obtain the NIC name. + * @syscap SystemCapability.Communication.NetManager.Core + * @since 10 + */ + function getIfaceTxBytes(nic: string, callback: AsyncCallback): void; + /** + * Queries the data traffic (including all TCP and UDP data packets) sent through a specified NIC. + * @param { string } nic - Network interface card. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 2100002 - Failed to connect to the service. + * @throws { BusinessError } 2100003 - System internal error. + * @throws { BusinessError } 2103005 - Failed to read the system map. + * @throws { BusinessError } 2103011 - Failed to create a system map. + * @throws { BusinessError } 2103012 - Failed to obtain the NIC name. + * @syscap SystemCapability.Communication.NetManager.Core + * @since 10 + */ + function getIfaceTxBytes(nic: string): Promise; + /** + * Queries the data traffic (including all TCP and UDP data packets) received through the cellular network. + * @param { AsyncCallback } callback - Returns the data traffic received through the cellular network. + * @throws { BusinessError } 2100002 - Failed to connect to the service. + * @throws { BusinessError } 2100003 - System internal error. + * @throws { BusinessError } 2103005 - Failed to read the system map. + * @throws { BusinessError } 2103011 - Failed to create a system map. + * @throws { BusinessError } 2103012 - Failed to obtain the NIC name. + * @syscap SystemCapability.Communication.NetManager.Core + * @since 10 + */ + function getCellularRxBytes(callback: AsyncCallback): void; + /** + * Queries the data traffic (including all TCP and UDP data packets) received through the cellular network. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 2100002 - Failed to connect to the service. + * @throws { BusinessError } 2100003 - System internal error. + * @throws { BusinessError } 2103005 - Failed to read the system map. + * @throws { BusinessError } 2103011 - Failed to create a system map. + * @throws { BusinessError } 2103012 - Failed to obtain the NIC name. + * @syscap SystemCapability.Communication.NetManager.Core + * @since 10 + */ + function getCellularRxBytes(): Promise; + /** + * Queries the data traffic (including all TCP and UDP data packets) sent through the cellular network. + * @param { AsyncCallback } callback - Returns the data traffic sent through the cellular network. + * @throws { BusinessError } 2100002 - Failed to connect to the service. + * @throws { BusinessError } 2100003 - System internal error. + * @throws { BusinessError } 2103005 - Failed to read the system map. + * @throws { BusinessError } 2103011 - Failed to create a system map. + * @throws { BusinessError } 2103012 - Failed to obtain the NIC name. + * @syscap SystemCapability.Communication.NetManager.Core + * @since 10 + */ + function getCellularTxBytes(callback: AsyncCallback): void; + /** + * Queries the data traffic (including all TCP and UDP data packets) sent through the cellular network. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 2100002 - Failed to connect to the service. + * @throws { BusinessError } 2100003 - System internal error. + * @throws { BusinessError } 2103005 - Failed to read the system map. + * @throws { BusinessError } 2103011 - Failed to create a system map. + * @throws { BusinessError } 2103012 - Failed to obtain the NIC name. + * @syscap SystemCapability.Communication.NetManager.Core + * @since 10 + */ + function getCellularTxBytes(): Promise; + /** + * Queries the data traffic (including all TCP and UDP data packets) received through all NICs. + * @param { AsyncCallback } callback - Returns the data traffic received through all NICs. + * @throws { BusinessError } 2100002 - Failed to connect to the service. + * @throws { BusinessError } 2100003 - System internal error. + * @throws { BusinessError } 2103005 - Failed to read the system map. + * @throws { BusinessError } 2103011 - Failed to create a system map. + * @syscap SystemCapability.Communication.NetManager.Core + * @since 10 + */ + function getAllRxBytes(callback: AsyncCallback): void; + /** + * Queries the data traffic (including all TCP and UDP data packets) received through all NICs. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 2100002 - Failed to connect to the service. + * @throws { BusinessError } 2100003 - System internal error. + * @throws { BusinessError } 2103005 - Failed to read the system map. + * @throws { BusinessError } 2103011 - Failed to create a system map. + * @syscap SystemCapability.Communication.NetManager.Core + * @since 10 + */ + function getAllRxBytes(): Promise; + /** + * Queries the data traffic (including all TCP and UDP data packets) sent through all NICs. + * @param { AsyncCallback } callback - Returns the data traffic sent through all NICs. + * @throws { BusinessError } 2100002 - Failed to connect to the service. + * @throws { BusinessError } 2100003 - System internal error. + * @throws { BusinessError } 2103005 - Failed to read the system map. + * @throws { BusinessError } 2103011 - Failed to create a system map. + * @syscap SystemCapability.Communication.NetManager.Core + * @since 10 + */ + function getAllTxBytes(callback: AsyncCallback): void; + /** + * Queries the data traffic (including all TCP and UDP data packets) sent through all NICs. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 2100002 - Failed to connect to the service. + * @throws { BusinessError } 2100003 - System internal error. + * @throws { BusinessError } 2103005 - Failed to read the system map. + * @throws { BusinessError } 2103011 - Failed to create a system map. + * @syscap SystemCapability.Communication.NetManager.Core + * @since 10 + */ + function getAllTxBytes(): Promise; + /** + * Queries the data traffic (including all TCP and UDP data packets) received by a specified application. + * @param { number } uid - Indicates the process ID of the application. + * @param { AsyncCallback } callback - Returns the data traffic received by the specified application. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 2100002 - Failed to connect to the service. + * @throws { BusinessError } 2100003 - System internal error. + * @throws { BusinessError } 2103005 - Failed to read the system map. + * @throws { BusinessError } 2103011 - Failed to create a system map. + * @syscap SystemCapability.Communication.NetManager.Core + * @since 10 + */ + function getUidRxBytes(uid: number, callback: AsyncCallback): void; + /** + * Queries the data traffic (including all TCP and UDP data packets) received by a specified application. + * @param { number } uid - Indicates the process ID of the application. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 2100002 - Failed to connect to the service. + * @throws { BusinessError } 2100003 - System internal error. + * @throws { BusinessError } 2103005 - Failed to read the system map. + * @throws { BusinessError } 2103011 - Failed to create a system map. + * @syscap SystemCapability.Communication.NetManager.Core + * @since 10 + */ + function getUidRxBytes(uid: number): Promise; + /** + * Queries the data traffic (including all TCP and UDP data packets) sent by a specified application. + * @param { number } uid - Indicates the process ID of the application. + * @param { AsyncCallback } callback - Returns the data traffic sent by the specified application. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 2100002 - Failed to connect to the service. + * @throws { BusinessError } 2100003 - System internal error. + * @throws { BusinessError } 2103005 - Failed to read the system map. + * @throws { BusinessError } 2103011 - Failed to create a system map. + * @syscap SystemCapability.Communication.NetManager.Core + * @since 10 + */ + function getUidTxBytes(uid: number, callback: AsyncCallback): void; + /** + * Queries the data traffic (including all TCP and UDP data packets) sent by a specified application. + * @param { number } uid - Indicates the process ID of the application. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 2100002 - Failed to connect to the service. + * @throws { BusinessError } 2100003 - System internal error. + * @throws { BusinessError } 2103005 - Failed to read the system map. + * @throws { BusinessError } 2103011 - Failed to create a system map. + * @syscap SystemCapability.Communication.NetManager.Core + * @since 10 + */ + function getUidTxBytes(uid: number): Promise; + /** + * Queries the data traffic (including all TCP and UDP data packets) received through a specified sockfd. + * @param { number } sockfd - Indicates the file descriptor of the given socket. + * @param { AsyncCallback } callback - Returns the data traffic bytes received by the specified sockfd. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 2100001 - Invalid parameter value. + * @throws { BusinessError } 2100002 - Failed to connect to the service. + * @throws { BusinessError } 2100003 - System internal error. + * @syscap SystemCapability.Communication.NetManager.Core + * @since 11 + */ + function getSockfdRxBytes(sockfd: number, callback: AsyncCallback): void; + /** + * Queries the data traffic (including all TCP and UDP data packets) received through a specified sockfd. + * @param { number } sockfd - Indicates the file descriptor of the given socket. + * @returns { Promise } Returns the data traffic bytes received by the specified sockfd. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 2100001 - Invalid parameter value. + * @throws { BusinessError } 2100002 - Failed to connect to the service. + * @throws { BusinessError } 2100003 - System internal error. + * @syscap SystemCapability.Communication.NetManager.Core + * @since 11 + */ + function getSockfdRxBytes(sockfd: number): Promise; + /** + * Queries the data traffic (including all TCP and UDP data packets) sent through a specified sockfd. + * @param { number } sockfd - Indicates the file descriptor of the given socket. + * @param { AsyncCallback } callback - Returns the data traffic bytes sent by the specified sockfd. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 2100001 - Invalid parameter value + * @throws { BusinessError } 2100002 - Failed to connect to the service. + * @throws { BusinessError } 2100003 - System internal error. + * @syscap SystemCapability.Communication.NetManager.Core + * @since 11 + */ + function getSockfdTxBytes(sockfd: number, callback: AsyncCallback): void; + /** + * Queries the data traffic (including all TCP and UDP data packets) sent through a specified sockfd. + * @param { number } sockfd - Indicates the file descriptor of the given socket. + * @returns { Promise } Returns the data traffic bytes sent by the specified sockfd. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 2100001 - Invalid parameter value + * @throws { BusinessError } 2100002 - Failed to connect to the service. + * @throws { BusinessError } 2100003 - System internal error. + * @syscap SystemCapability.Communication.NetManager.Core + * @since 11 + */ + function getSockfdTxBytes(sockfd: number): Promise; +} +export default statistics; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.net.vpn.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.net.vpn.d.ts new file mode 100755 index 00000000..c9f63996 --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.net.vpn.d.ts @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit NetworkKit + */ + +import type connection from './@ohos.net.connection'; +import type _AbilityContext from './application/UIAbilityContext'; +/** + * Provides VPN related interfaces. + * @namespace vpn + * @syscap SystemCapability.Communication.NetManager.Vpn + * @since 10 + */ +declare namespace vpn { + /** + * Get network link information. + * @syscap SystemCapability.Communication.NetManager.Core + * @since 10 + */ + export type LinkAddress = connection.LinkAddress; + /** + * Get network route information. + * @syscap SystemCapability.Communication.NetManager.Core + * @since 10 + */ + export type RouteInfo = connection.RouteInfo; + /** + * The context of an ability. It allows access to ability-specific resources. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 10 + */ + export type AbilityContext = _AbilityContext; +} +export default vpn; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.net.vpnExtension.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.net.vpnExtension.d.ts new file mode 100755 index 00000000..e8ec3b21 --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.net.vpnExtension.d.ts @@ -0,0 +1,243 @@ +/* + * Copyright (C) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit NetworkKit + */ +import type connection from './@ohos.net.connection'; +import type _VpnExtensionContext from './application/VpnExtensionContext'; +import type Want from './@ohos.app.ability.Want'; +/** + * Provides VPN related interfaces. + * @namespace vpnExtension + * @syscap SystemCapability.Communication.NetManager.Vpn + * @since 11 + */ +declare namespace vpnExtension { + /** + * Get network link information. + * @syscap SystemCapability.Communication.NetManager.Core + * @since 11 + */ + export type LinkAddress = connection.LinkAddress; + /** + * Get network route information. + * @syscap SystemCapability.Communication.NetManager.Core + * @since 11 + */ + export type RouteInfo = connection.RouteInfo; + /** + * The context of vpn extension. It allows access to + * serviceExtension-specific resources. + * + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 11 + */ + export type VpnExtensionContext = _VpnExtensionContext; + /** + * Starts a new vpn extension ability. + * + * @param { Want } want - Indicates the want info to start. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @throws { BusinessError } 16000001 - The specified ability does not exist. + * @throws { BusinessError } 16000002 - Incorrect ability type. + * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. + * @throws { BusinessError } 16000008 - The crowdtesting application expires. + * @throws { BusinessError } 16000011 - The context does not exist. + * @throws { BusinessError } 16000050 - Internal error. + * @throws { BusinessError } 16200001 - The caller has been released. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @since 11 + */ + function startVpnExtensionAbility(want: Want): Promise; + /** + * Stops a service within the same application. + * + * @param { Want } want - Indicates the want info to start. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @throws { BusinessError } 16000001 - The specified ability does not exist. + * @throws { BusinessError } 16000002 - Incorrect ability type. + * @throws { BusinessError } 16000006 - Cross-user operations are not allowed. + * @throws { BusinessError } 16000011 - The context does not exist. + * @throws { BusinessError } 16000050 - Internal error. + * @throws { BusinessError } 16200001 - The caller has been released. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @since 11 + */ + function stopVpnExtensionAbility(want: Want): Promise; + /** + * Create a VPN connection using the VpnExtensionContext. + * + * @param { VpnExtensionContext } context - Indicates the context of application or capability. + * @returns { VpnConnection } the VpnConnection of the construct VpnConnection instance. + * @throws { BusinessError } 401 - Parameter error. + * @syscap SystemCapability.Communication.NetManager.Vpn + * @stagemodelonly + * @since 11 + */ + function createVpnConnection(context: VpnExtensionContext): VpnConnection; + /** + * Defines a VPN connection. + * + * @interface VpnConnection + * @syscap SystemCapability.Communication.NetManager.Vpn + * @since 11 + */ + export interface VpnConnection { + /** + * Create a VPN network using the VpnConfig. + * + * @param { VpnConfig } config - Indicates the {@link VpnConfig} configuration of the VPN network. + * @returns { Promise } The promise returns file descriptor of VPN interface. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 2200001 - Invalid parameter value. + * @throws { BusinessError } 2200002 - Operation failed. Cannot connect to service. + * @throws { BusinessError } 2200003 - System internal error. + * @throws { BusinessError } 2203001 - VPN creation denied, please check the user type. + * @throws { BusinessError } 2203002 - VPN exist already, please execute destroy first. + * @syscap SystemCapability.Communication.NetManager.Vpn + * @since 11 + */ + create(config: VpnConfig): Promise; + /** + * Protect a socket from VPN connections. After protecting, data sent through this socket will go directly to the + * underlying network so its traffic will not be forwarded through the VPN. + * + * @param { number } socketFd - File descriptor of socket, this socket from @ohos.net.socket. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 2200001 - Invalid parameter value. + * @throws { BusinessError } 2200002 - Operation failed. Cannot connect to service. + * @throws { BusinessError } 2200003 - System internal error. + * @throws { BusinessError } 2203004 - Invalid socket file descriptor. + * @syscap SystemCapability.Communication.NetManager.Vpn + * @since 11 + */ + protect(socketFd: number): Promise; + /** + * Destroy the VPN network. + * + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 2200002 - Operation failed. Cannot connect to service. + * @throws { BusinessError } 2200003 - System internal error. + * @syscap SystemCapability.Communication.NetManager.Vpn + * @since 11 + */ + destroy(): Promise; + } + /** + * Define configuration of the VPN network. + * + * @interface VpnConfig + * @syscap SystemCapability.Communication.NetManager.Vpn + * @since 11 + */ + export interface VpnConfig { + /** + * The array of addresses for VPN interface. + * + * @type {Array} + * @syscap SystemCapability.Communication.NetManager.Vpn + * @since 11 + */ + addresses: Array; + /** + * The array of routes for VPN interface. + * + * @type {?Array} + * @syscap SystemCapability.Communication.NetManager.Vpn + * @since 11 + */ + routes?: Array; + /** + * The array of DNS servers for the VPN network. + * + * @type {?Array} + * @syscap SystemCapability.Communication.NetManager.Vpn + * @since 11 + */ + dnsAddresses?: Array; + /** + * The array of search domains for the DNS resolver. + * + * @type {?Array} + * @syscap SystemCapability.Communication.NetManager.Vpn + * @since 11 + */ + searchDomains?: Array; + /** + * The maximum transmission unit (MTU) for the VPN interface. + * + * @type {?number} + * @syscap SystemCapability.Communication.NetManager.Vpn + * @since 11 + */ + mtu?: number; + /** + * Whether ipv4 is supported. The default value is true. + * + * @type {?boolean} + * @syscap SystemCapability.Communication.NetManager.Vpn + * @since 11 + */ + isIPv4Accepted?: boolean; + /** + * Whether ipv6 is supported. The default value is false. + * + * @type {?boolean} + * @syscap SystemCapability.Communication.NetManager.Vpn + * @since 11 + */ + isIPv6Accepted?: boolean; + /** + * Whether to use the built-in VPN. The default value is false. + * + * @type {?boolean} + * @syscap SystemCapability.Communication.NetManager.Vpn + * @since 11 + */ + isInternal?: boolean; + /** + * Whether the VPN interface's file descriptor is in blocking/non-blocking mode. The default value is false. + * + * @type {?boolean} + * @syscap SystemCapability.Communication.NetManager.Vpn + * @since 11 + */ + isBlocking?: boolean; + /** + * The array of trustlist for the VPN network. The string indicates package name. + * + * @type {?Array} + * @syscap SystemCapability.Communication.NetManager.Vpn + * @since 11 + */ + trustedApplications?: Array; + /** + * The array of blocklist for the VPN network. The string indicates package name. + * + * @type {?Array} + * @syscap SystemCapability.Communication.NetManager.Vpn + * @since 11 + */ + blockedApplications?: Array; + } +} +export default vpnExtension; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.net.webSocket.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.net.webSocket.d.ts new file mode 100755 index 00000000..ad73eb34 --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.net.webSocket.d.ts @@ -0,0 +1,854 @@ +/* + * Copyright (c) 2022-2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit NetworkKit + */ +import type { AsyncCallback, ErrorCallback, Callback } from './@ohos.base'; +import type connection from './@ohos.net.connection'; +/** + * Provides WebSocket APIs. + * @namespace webSocket + * @syscap SystemCapability.Communication.NetStack + * @since 6 + */ +/** + * Provides WebSocket APIs. + * @namespace webSocket + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ +/** + * Provides WebSocket APIs. + * @namespace webSocket + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @atomicservice + * @since 11 + */ +declare namespace webSocket { + /** + * @typedef HttpProxy + * @syscap SystemCapability.Communication.NetManager.Core + * @since 12 + */ + type HttpProxy = connection.HttpProxy; + /** + * Creates a web socket connection. + * @returns { WebSocket } the WebSocket of the createWebSocket. + * @syscap SystemCapability.Communication.NetStack + * @since 6 + */ + /** + * Creates a web socket connection. + * @returns { WebSocket } the WebSocket of the createWebSocket. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + /** + * Creates a web socket connection. + * @returns { WebSocket } the WebSocket of the createWebSocket. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @atomicservice + * @since 11 + */ + function createWebSocket(): WebSocket; + /** + * Defines the optional parameters carried in the request for establishing a WebSocket connection. + * @interface WebSocketRequestOptions + * @syscap SystemCapability.Communication.NetStack + * @since 6 + */ + /** + * Defines the optional parameters carried in the request for establishing a WebSocket connection. + * @interface WebSocketRequestOptions + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + /** + * Defines the optional parameters carried in the request for establishing a WebSocket connection. + * @interface WebSocketRequestOptions + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @atomicservice + * @since 11 + */ + export interface WebSocketRequestOptions { + /** + * HTTP request header. + * @type {?Object} + * @syscap SystemCapability.Communication.NetStack + * @since 6 + */ + /** + * HTTP request header. + * @type {?Object} + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + /** + * HTTP request header. + * @type {?Object} + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @atomicservice + * @since 11 + */ + header?: Object; + /** + * File path for client cert. + * @type {?string} + * @syscap SystemCapability.Communication.NetStack + * @since 11 + */ + caPath?: string; + /** + * Client cert. + * @type {?ClientCert} + * @syscap SystemCapability.Communication.NetStack + * @since 11 + */ + clientCert?: ClientCert; + /** + * HTTP proxy configuration. Use 'system' if this filed is not set. + * @type {?ProxyConfiguration} + * @syscap SystemCapability.Communication.NetStack + * @since 12 + */ + proxy?: ProxyConfiguration; + /** + * Self defined protocol. + * @type {?string} + * @syscap SystemCapability.Communication.NetStack + * @since 12 + */ + protocol?: string; + } + /** + * HTTP proxy configuration. + * system: means that use system proxy configuration. + * no-proxy: means do not use proxy. + * object of @type {connection.HttpProxy} means providing custom proxy settings + * @syscap SystemCapability.Communication.NetStack + * @since 12 + */ + export type ProxyConfiguration = 'system' | 'no-proxy' | HttpProxy; + /** + * The clientCert field of the client certificate, which includes three attributes: + * client certificate (certPath) and only support PEM format, certificate private key (keyPath), + * and passphrase (keyPassword). + * @interface ClientCert + * @syscap SystemCapability.Communication.NetStack + * @since 11 + */ + export interface ClientCert { + /** + * The path to the client certificate file. + * @type {string} + * @syscap SystemCapability.Communication.NetStack + * @since 11 + */ + certPath: string; + /** + * The path of the client certificate private key file. + * @type {string} + * @syscap SystemCapability.Communication.NetStack + * @since 11 + */ + keyPath: string; + /** + * Client certificate password. + * @type {?string} + * @syscap SystemCapability.Communication.NetStack + * @since 11 + */ + keyPassword?: string; + } + /** + * Defines the optional parameters carried in the request for closing a WebSocket connection. + * @interface WebSocketCloseOptions + * @syscap SystemCapability.Communication.NetStack + * @since 6 + */ + /** + * Defines the optional parameters carried in the request for closing a WebSocket connection. + * @interface WebSocketCloseOptions + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + /** + * Defines the optional parameters carried in the request for closing a WebSocket connection. + * @interface WebSocketCloseOptions + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @atomicservice + * @since 11 + */ + export interface WebSocketCloseOptions { + /** + * Error code. + * @type {?number} + * @syscap SystemCapability.Communication.NetStack + * @since 6 + */ + /** + * Error code. + * @type {?number} + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + /** + * Error code. + * @type {?number} + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @atomicservice + * @since 11 + */ + code?: number; + /** + * Error cause. + * @type {?string} + * @syscap SystemCapability.Communication.NetStack + * @since 6 + */ + /** + * Error cause. + * @type {?string} + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + /** + * Error cause. + * @type {?string} + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @atomicservice + * @since 11 + */ + reason?: string; + } + /** + * The result for closing a WebSocket connection. + * @interface CloseResult + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + /** + * The result for closing a WebSocket connection. + * @interface CloseResult + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @atomicservice + * @since 11 + */ + export interface CloseResult { + /** + * Error code. + * @type {number} + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + /** + * Error code. + * @type {number} + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @atomicservice + * @since 11 + */ + code: number; + /** + * Error cause. + * @type {string} + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + /** + * Error cause. + * @type {string} + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @atomicservice + * @since 11 + */ + reason: string; + } + /** + * HTTP response headers. + * @syscap SystemCapability.Communication.NetStack + * @since 12 + */ + export type ResponseHeaders = { + [k: string]: string | string[] | undefined; + }; + /** + *

Defines a WebSocket object. Before invoking WebSocket APIs, + * you need to call webSocket.createWebSocket to create a WebSocket object.

+ * @interface WebSocket + * @syscap SystemCapability.Communication.NetStack + * @since 6 + */ + /** + *

Defines a WebSocket object. Before invoking WebSocket APIs, + * you need to call webSocket.createWebSocket to create a WebSocket object.

+ * @interface WebSocket + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + /** + *

Defines a WebSocket object. Before invoking WebSocket APIs, + * you need to call webSocket.createWebSocket to create a WebSocket object.

+ * @interface WebSocket + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @atomicservice + * @since 11 + */ + export interface WebSocket { + /** + * Initiates a WebSocket request to establish a WebSocket connection to a given URL. + * @permission ohos.permission.INTERNET + * @param { string } url - URL for establishing a WebSocket connection. + * @param { AsyncCallback } callback - the callback of connect. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 201 - Permission denied. + * @syscap SystemCapability.Communication.NetStack + * @since 6 + */ + /** + * Initiates a WebSocket request to establish a WebSocket connection to a given URL. + * @permission ohos.permission.INTERNET + * @param { string } url URL for establishing a WebSocket connection. + * @param { AsyncCallback } callback - the callback of connect. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 201 - Permission denied. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + /** + * Initiates a WebSocket request to establish a WebSocket connection to a given URL. + * @permission ohos.permission.INTERNET + * @param { string } url URL for establishing a WebSocket connection. + * @param { AsyncCallback } callback - the callback of connect. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 201 - Permission denied. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @atomicservice + * @since 11 + */ + connect(url: string, callback: AsyncCallback): void; + /** + * Initiates a WebSocket request to establish a WebSocket connection to a given URL. + * @permission ohos.permission.INTERNET + * @param { string } url URL for establishing a WebSocket connection. + * @param { WebSocketRequestOptions } options - Optional parameters {@link WebSocketRequestOptions}. + * @param { AsyncCallback } callback - the callback of connect. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 201 - Permission denied. + * @syscap SystemCapability.Communication.NetStack + * @since 6 + */ + /** + * Initiates a WebSocket request to establish a WebSocket connection to a given URL. + * @permission ohos.permission.INTERNET + * @param { string } url URL for establishing a WebSocket connection. + * @param { WebSocketRequestOptions } options - Optional parameters {@link WebSocketRequestOptions}. + * @param { AsyncCallback } callback - the callback of connect. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 201 - Permission denied. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + /** + * Initiates a WebSocket request to establish a WebSocket connection to a given URL. + * @permission ohos.permission.INTERNET + * @param { string } url URL for establishing a WebSocket connection. + * @param { WebSocketRequestOptions } options - Optional parameters {@link WebSocketRequestOptions}. + * @param { AsyncCallback } callback - the callback of connect. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 201 - Permission denied. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @atomicservice + * @since 11 + */ + connect(url: string, options: WebSocketRequestOptions, callback: AsyncCallback): void; + /** + * Initiates a WebSocket request to establish a WebSocket connection to a given URL. + * @permission ohos.permission.INTERNET + * @param { string } url URL for establishing a WebSocket connection. + * @param { WebSocketRequestOptions } options - Optional parameters {@link WebSocketRequestOptions}. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 201 - Permission denied. + * @syscap SystemCapability.Communication.NetStack + * @since 6 + */ + /** + * Initiates a WebSocket request to establish a WebSocket connection to a given URL. + * @permission ohos.permission.INTERNET + * @param { string } url URL for establishing a WebSocket connection. + * @param { WebSocketRequestOptions } options - Optional parameters {@link WebSocketRequestOptions}. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 201 - Permission denied. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + /** + * Initiates a WebSocket request to establish a WebSocket connection to a given URL. + * @permission ohos.permission.INTERNET + * @param { string } url URL for establishing a WebSocket connection. + * @param { WebSocketRequestOptions } options - Optional parameters {@link WebSocketRequestOptions}. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 201 - Permission denied. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @atomicservice + * @since 11 + */ + connect(url: string, options?: WebSocketRequestOptions): Promise; + /** + * Sends data through a WebSocket connection. + * @permission ohos.permission.INTERNET + * @param { string | ArrayBuffer } data - Data to send. It can be a string(API 6) or an ArrayBuffer(API 8). + * @param { AsyncCallback } callback - the callback of send. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 201 - Permission denied. + * @syscap SystemCapability.Communication.NetStack + * @since 6 + */ + /** + * Sends data through a WebSocket connection. + * @permission ohos.permission.INTERNET + * @param { string | ArrayBuffer } data - Data to send. It can be a string(API 6) or an ArrayBuffer(API 8). + * @param { AsyncCallback } callback - the callback of send. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 201 - Permission denied. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + /** + * Sends data through a WebSocket connection. + * @permission ohos.permission.INTERNET + * @param { string | ArrayBuffer } data - Data to send. It can be a string(API 6) or an ArrayBuffer(API 8). + * @param { AsyncCallback } callback - the callback of send. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 201 - Permission denied. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @atomicservice + * @since 11 + */ + send(data: string | ArrayBuffer, callback: AsyncCallback): void; + /** + * Sends data through a WebSocket connection. + * @permission ohos.permission.INTERNET + * @param { string | ArrayBuffer } data - Data to send. It can be a string(API 6) or an ArrayBuffer(API 8). + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 201 - Permission denied. + * @syscap SystemCapability.Communication.NetStack + * @since 6 + */ + /** + * Sends data through a WebSocket connection. + * @permission ohos.permission.INTERNET + * @param { string | ArrayBuffer } data - Data to send. It can be a string(API 6) or an ArrayBuffer(API 8). + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 201 - Permission denied. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + /** + * Sends data through a WebSocket connection. + * @permission ohos.permission.INTERNET + * @param { string | ArrayBuffer } data - Data to send. It can be a string(API 6) or an ArrayBuffer(API 8). + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 201 - Permission denied. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @atomicservice + * @since 11 + */ + send(data: string | ArrayBuffer): Promise; + /** + * Closes a WebSocket connection. + * @permission ohos.permission.INTERNET + * @param { AsyncCallback } callback - the callback of close. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 201 - Permission denied. + * @syscap SystemCapability.Communication.NetStack + * @since 6 + */ + /** + * Closes a WebSocket connection. + * @permission ohos.permission.INTERNET + * @param { AsyncCallback } callback - the callback of close. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 201 - Permission denied. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + /** + * Closes a WebSocket connection. + * @permission ohos.permission.INTERNET + * @param { AsyncCallback } callback - the callback of close. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 201 - Permission denied. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @atomicservice + * @since 11 + */ + close(callback: AsyncCallback): void; + /** + * Closes a WebSocket connection. + * @permission ohos.permission.INTERNET + * @param { WebSocketCloseOptions } options - Optional parameters {@link WebSocketCloseOptions}. + * @param { AsyncCallback } callback - the callback of close. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 201 - Permission denied. + * @syscap SystemCapability.Communication.NetStack + * @since 6 + */ + /** + * Closes a WebSocket connection. + * @permission ohos.permission.INTERNET + * @param { WebSocketCloseOptions } options - Optional parameters {@link WebSocketCloseOptions}. + * @param { AsyncCallback } callback - the callback of close. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 201 - Permission denied. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + /** + * Closes a WebSocket connection. + * @permission ohos.permission.INTERNET + * @param { WebSocketCloseOptions } options - Optional parameters {@link WebSocketCloseOptions}. + * @param { AsyncCallback } callback - the callback of close. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 201 - Permission denied. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @atomicservice + * @since 11 + */ + close(options: WebSocketCloseOptions, callback: AsyncCallback): void; + /** + * Closes a WebSocket connection. + * @permission ohos.permission.INTERNET + * @param { WebSocketCloseOptions } options - Optional parameters {@link WebSocketCloseOptions}. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 201 - Permission denied. + * @syscap SystemCapability.Communication.NetStack + * @since 6 + */ + /** + * Closes a WebSocket connection. + * @permission ohos.permission.INTERNET + * @param { WebSocketCloseOptions } options - Optional parameters {@link WebSocketCloseOptions}. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 201 - Permission denied. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + /** + * Closes a WebSocket connection. + * @permission ohos.permission.INTERNET + * @param { WebSocketCloseOptions } options - Optional parameters {@link WebSocketCloseOptions}. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 201 - Permission denied. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @atomicservice + * @since 11 + */ + close(options?: WebSocketCloseOptions): Promise; + /** + * Enables listening for the open events of a WebSocket connection. + * @param { 'open' } type - event indicating that a WebSocket connection has been opened. + * @param { AsyncCallback } callback - the callback used to return the result. + * @syscap SystemCapability.Communication.NetStack + * @since 6 + */ + /** + * Enables listening for the open events of a WebSocket connection. + * @param { 'open' } type - event indicating that a WebSocket connection has been opened. + * @param { AsyncCallback } callback - the callback used to return the result. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + /** + * Enables listening for the open events of a WebSocket connection. + * @param { 'open' } type - event indicating that a WebSocket connection has been opened. + * @param { AsyncCallback } callback - the callback used to return the result. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @atomicservice + * @since 11 + */ + on(type: 'open', callback: AsyncCallback): void; + /** + * Cancels listening for the open events of a WebSocket connection. + * @param { 'open' } type - event indicating that a WebSocket connection has been opened. + * @param { AsyncCallback } callback - the callback used to return the result. + * @syscap SystemCapability.Communication.NetStack + * @since 6 + */ + /** + * Cancels listening for the open events of a WebSocket connection. + * @param { 'open' } type - event indicating that a WebSocket connection has been opened. + * @param { AsyncCallback } callback the callback used to return the result. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + /** + * Cancels listening for the open events of a WebSocket connection. + * @param { 'open' } type - event indicating that a WebSocket connection has been opened. + * @param { AsyncCallback } callback the callback used to return the result. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @atomicservice + * @since 11 + */ + off(type: 'open', callback?: AsyncCallback): void; + /** + * Enables listening for the message events of a WebSocket connection. + * data in AsyncCallback can be a string(API 6) or an ArrayBuffer(API 8). + * @param { 'message' } type - event indicating that a message has been received from the server. + * @param { AsyncCallback } callback - the callback used to return the result. + * @syscap SystemCapability.Communication.NetStack + * @since 6 + */ + /** + * Enables listening for the message events of a WebSocket connection. + * data in AsyncCallback can be a string(API 6) or an ArrayBuffer(API 8). + * @param { 'message' } type - event indicating that a message has been received from the server. + * @param { AsyncCallback } callback - the callback used to return the result. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + /** + * Enables listening for the message events of a WebSocket connection. + * data in AsyncCallback can be a string(API 6) or an ArrayBuffer(API 8). + * @param { 'message' } type - event indicating that a message has been received from the server. + * @param { AsyncCallback } callback - the callback used to return the result. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @atomicservice + * @since 11 + */ + on(type: 'message', callback: AsyncCallback): void; + /** + * Cancels listening for the message events of a WebSocket connection. + * data in AsyncCallback can be a string(API 6) or an ArrayBuffer(API 8). + * @param { 'message' } type - event indicating that a message has been received from the server. + * @param { AsyncCallback } callback - the callback used to return the result. + * @syscap SystemCapability.Communication.NetStack + * @since 6 + */ + /** + * Cancels listening for the message events of a WebSocket connection. + * data in AsyncCallback can be a string(API 6) or an ArrayBuffer(API 8). + * @param { 'message' } type - event indicating that a message has been received from the server. + * @param { AsyncCallback } callback - the callback used to return the result. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + /** + * Cancels listening for the message events of a WebSocket connection. + * data in AsyncCallback can be a string(API 6) or an ArrayBuffer(API 8). + * @param { 'message' } type - event indicating that a message has been received from the server. + * @param { AsyncCallback } callback - the callback used to return the result. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @atomicservice + * @since 11 + */ + off(type: 'message', callback?: AsyncCallback): void; + /** + * Enables listening for the close events of a WebSocket connection. + * @param { 'close' } type - event indicating that a WebSocket connection has been closed. + * @param { AsyncCallback } callback - the callback used to return the result. + *
close indicates the close error code and reason indicates the error code description. + * @syscap SystemCapability.Communication.NetStack + * @since 6 + */ + /** + * Enables listening for the close events of a WebSocket connection. + * @param { 'close' } type - event indicating that a WebSocket connection has been closed. + * @param { AsyncCallback } callback - the callback used to return the result. + *
close indicates the close error code and reason indicates the error code description. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + /** + * Enables listening for the close events of a WebSocket connection. + * @param { 'close' } type - event indicating that a WebSocket connection has been closed. + * @param { AsyncCallback } callback - the callback used to return the result. + *
close indicates the close error code and reason indicates the error code description. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @atomicservice + * @since 11 + */ + on(type: 'close', callback: AsyncCallback): void; + /** + * Cancels listening for the close events of a WebSocket connection. + * @param { 'close' } type - event indicating that a WebSocket connection has been closed. + * @param { AsyncCallback } callback - the callback used to return the result. + *
close indicates the close error code and reason indicates the error code description. + * @syscap SystemCapability.Communication.NetStack + * @since 6 + */ + /** + * Cancels listening for the close events of a WebSocket connection. + * @param { 'close' } type - event indicating that a WebSocket connection has been closed. + * @param { AsyncCallback } callback - the callback used to return the result. + *
close indicates the close error code and reason indicates the error code description. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + /** + * Cancels listening for the close events of a WebSocket connection. + * @param { 'close' } type - event indicating that a WebSocket connection has been closed. + * @param { AsyncCallback } callback - the callback used to return the result. + *
close indicates the close error code and reason indicates the error code description. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @atomicservice + * @since 11 + */ + off(type: 'close', callback?: AsyncCallback): void; + /** + * Enables listening for the error events of a WebSocket connection. + * @param { 'error' } type - event indicating the WebSocket connection has encountered an error. + * @param { ErrorCallback } callback - the callback used to return the result. + * @syscap SystemCapability.Communication.NetStack + * @since 6 + */ + /** + * Enables listening for the error events of a WebSocket connection. + * @param { 'error' } type - event indicating the WebSocket connection has encountered an error. + * @param { ErrorCallback } callback - the callback used to return the result. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + /** + * Enables listening for the error events of a WebSocket connection. + * @param { 'error' } type - event indicating the WebSocket connection has encountered an error. + * @param { ErrorCallback } callback - the callback used to return the result. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @atomicservice + * @since 11 + */ + on(type: 'error', callback: ErrorCallback): void; + /** + * Cancels listening for the error events of a WebSocket connection. + * @param { 'error' } type - event indicating the WebSocket connection has encountered an error. + * @param { ErrorCallback } callback - the callback used to return the result. + * @syscap SystemCapability.Communication.NetStack + * @since 6 + */ + /** + * Cancels listening for the error events of a WebSocket connection. + * @param { 'error' } type - event indicating the WebSocket connection has encountered an error. + * @param { ErrorCallback } callback - the callback used to return the result. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @since 10 + */ + /** + * Cancels listening for the error events of a WebSocket connection. + * @param { 'error' } type - event indicating the WebSocket connection has encountered an error. + * @param { ErrorCallback } callback - the callback used to return the result. + * @syscap SystemCapability.Communication.NetStack + * @crossplatform + * @atomicservice + * @since 11 + */ + off(type: 'error', callback?: ErrorCallback): void; + /** + * Enables listening for receiving data ends events of a WebSocket connection. + * @param { 'dataEnd' } type - event indicating the WebSocket connection has received data ends. + * @param { Callback } callback - the callback used to return the result. + * @syscap SystemCapability.Communication.NetStack + * @since 11 + */ + on(type: 'dataEnd', callback: Callback): void; + /** + * Cancels listening for receiving data ends events of a WebSocket connection. + * @param { 'dataEnd' } type - event indicating the WebSocket connection has received data ends. + * @param { Callback } [ callback ] - the callback used to return the result. + * @syscap SystemCapability.Communication.NetStack + * @since 11 + */ + off(type: 'dataEnd', callback?: Callback): void; + /** + * Registers an observer for HTTP Response Header events. + * @param { 'headerReceive'} type - Indicates Event name. + * @param { Callback } callback - the callback used to return the result. + * @syscap SystemCapability.Communication.NetStack + * @since 12 + */ + on(type: 'headerReceive', callback: Callback): void; + /** + * Unregisters the observer for HTTP Response Header events. + * @param { 'headerReceive' } type - Indicates Event name. + * @param { Callback } [callback] - the callback used to return the result. + * @syscap SystemCapability.Communication.NetStack + * @since 12 + */ + off(type: 'headerReceive', callback?: Callback): void; + } +} +export default webSocket; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.nfc.cardEmulation.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.nfc.cardEmulation.d.ts new file mode 100755 index 00000000..be5d0a91 --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.nfc.cardEmulation.d.ts @@ -0,0 +1,394 @@ +/* + * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit ConnectivityKit + */ +import { AsyncCallback } from './@ohos.base'; +import { ElementName } from './bundleManager/ElementName'; +/** + * Provides methods to operate or manage NFC card emulation. + * + * @namespace cardEmulation + * @syscap SystemCapability.Communication.NFC.CardEmulation + * @since 6 + */ +/** + * Provides methods to operate or manage NFC card emulation. + * + * @namespace cardEmulation + * @syscap SystemCapability.Communication.NFC.CardEmulation + * @atomicservice + * @since 12 + */ +declare namespace cardEmulation { + /** + * Defines the capability type. + * + * @enum { number } + * @syscap SystemCapability.Communication.NFC.CardEmulation + * @since 6 + * @deprecated since 9 + * @useinstead ohos.nfc.cardEmulation/cardEmulation#hasHceCapability + */ + enum FeatureType { + /** + * This constant is used to check whether HCE card emulation is supported. + * + * @syscap SystemCapability.Communication.NFC.CardEmulation + * @since 6 + * @deprecated since 9 + */ + HCE = 0, + /** + * This constant is used to check whether SIM card emulation is supported. + * + * @syscap SystemCapability.Communication.NFC.CardEmulation + * @since 6 + * @deprecated since 9 + */ + UICC = 1, + /** + * This constant is used to check whether eSE card emulation is supported. + * + * @syscap SystemCapability.Communication.NFC.CardEmulation + * @since 6 + * @deprecated since 9 + */ + ESE = 2 + } + /** + * Define the card emulation type, payment or other. + * + * @enum { string } + * @syscap SystemCapability.Communication.NFC.CardEmulation + * @since 9 + */ + /** + * Define the card emulation type, payment or other. + * + * @enum { string } + * @syscap SystemCapability.Communication.NFC.CardEmulation + * @atomicservice + * @since 12 + */ + enum CardType { + /** + * Payment type of card emulation + * + * @syscap SystemCapability.Communication.NFC.CardEmulation + * @since 9 + */ + /** + * Payment type of card emulation + * + * @syscap SystemCapability.Communication.NFC.CardEmulation + * @atomicservice + * @since 12 + */ + PAYMENT = 'payment', + /** + * Other type of card emulation + * + * @syscap SystemCapability.Communication.NFC.CardEmulation + * @since 9 + */ + /** + * Other type of card emulation + * + * @syscap SystemCapability.Communication.NFC.CardEmulation + * @atomicservice + * @since 12 + */ + OTHER = 'other' + } + /** + * Checks whether a specified type of card emulation is supported. + *

This method is used to check Whether the host or secure element supports card emulation. + * + * @param { number } feature Indicates the card emulation type, {@code HCE}, {@code UICC}, or {@code ESE}. + * @returns { boolean } Returns true if the specified type of card emulation is supported; returns false otherwise. + * @syscap SystemCapability.Communication.NFC.CardEmulation + * @since 6 + * @deprecated since 9 + * @useinstead ohos.nfc.cardEmulation/cardEmulation#hasHceCapability + */ + function isSupported(feature: number): boolean; + /** + * Checks whether Host Card Emulation(HCE) capability is supported. + * + * @permission ohos.permission.NFC_CARD_EMULATION + * @returns { boolean } Returns true if HCE is supported, otherwise false. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.Communication.NFC.CardEmulation + * @since 9 + */ + /** + * Checks whether Host Card Emulation(HCE) capability is supported. + * + * @permission ohos.permission.NFC_CARD_EMULATION + * @returns { boolean } Returns true if HCE is supported, otherwise false. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.Communication.NFC.CardEmulation + * @atomicservice + * @since 12 + */ + function hasHceCapability(): boolean; + /** + * Checks whether a service is default for given type. + * + * @permission ohos.permission.NFC_CARD_EMULATION + * @param { ElementName } elementName - The element name of the service ability + * @param { CardType } type - The type to query, payment or other. + * @returns { boolean } Returns true if the service is default, otherwise false. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - The parameter check failed. Possible causes: + *
1. Mandatory parameters are left unspecified. + *
2. Incorrect parameters types. + *
3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.Communication.NFC.CardEmulation + * @since 9 + */ + /** + * Checks whether a service is default for given type. + * + * @permission ohos.permission.NFC_CARD_EMULATION + * @param { ElementName } elementName - The element name of the service ability + * @param { CardType } type - The type to query, payment or other. + * @returns { boolean } Returns true if the service is default, otherwise false. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - The parameter check failed. Possible causes: + *
1. Mandatory parameters are left unspecified. + *
2. Incorrect parameters types. + *
3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.Communication.NFC.CardEmulation + * @atomicservice + * @since 12 + */ + function isDefaultService(elementName: ElementName, type: CardType): boolean; + /** + * A class for NFC host application. + *

The NFC host application use this class, then Nfc service can access the application + * installation information and connect to services of the application. + * + * @syscap SystemCapability.Communication.NFC.CardEmulation + * @since 8 + */ + /** + * A class for NFC host application. + *

The NFC host application use this class, then Nfc service can access the application + * installation information and connect to services of the application. + * + * @syscap SystemCapability.Communication.NFC.CardEmulation + * @atomicservice + * @since 12 + */ + export class HceService { + /** + * start HCE + * + * @permission ohos.permission.NFC_CARD_EMULATION + * @param { string[] } aidList - The aid list to be registered by this service + * @returns { boolean } Returns true if HCE is enabled or has been enabled; returns false otherwise. + * @syscap SystemCapability.Communication.NFC.CardEmulation + * @since 8 + * @deprecated since 9 + * @useinstead ohos.nfc.cardEmulation/cardEmulation.HceService#start + */ + startHCE(aidList: string[]): boolean; + /** + * Starts the HCE, register more aids and allows this application to be preferred while in foreground. + * + * @permission ohos.permission.NFC_CARD_EMULATION + * @param { ElementName } elementName - The element name of the service ability + * @param { string[] } aidList - The aid list to be registered by this service, allowed to be empty. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - The parameter check failed. Possible causes: + *
1. Mandatory parameters are left unspecified. + *
2. Incorrect parameters types. + *
3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 3100301 - Card emulation running state is abnormal in service. + * @syscap SystemCapability.Communication.NFC.CardEmulation + * @since 9 + */ + /** + * Starts the HCE, register more aids and allows this application to be preferred while in foreground. + * + * @permission ohos.permission.NFC_CARD_EMULATION + * @param { ElementName } elementName - The element name of the service ability + * @param { string[] } aidList - The aid list to be registered by this service, allowed to be empty. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - The parameter check failed. Possible causes: + *
1. Mandatory parameters are left unspecified. + *
2. Incorrect parameters types. + *
3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 3100301 - Card emulation running state is abnormal in service. + * @syscap SystemCapability.Communication.NFC.CardEmulation + * @atomicservice + * @since 12 + */ + start(elementName: ElementName, aidList: string[]): void; + /** + * stop HCE + * + * @permission ohos.permission.NFC_CARD_EMULATION + * @returns { boolean } Returns true if HCE is disabled or has been disabled; returns false otherwise. + * @syscap SystemCapability.Communication.NFC.CardEmulation + * @since 8 + * @deprecated since 9 + * @useinstead ohos.nfc.cardEmulation/cardEmulation.HceService#stop + */ + stopHCE(): boolean; + /** + * Stops the HCE, and unset the preferred service while in foreground. + * + * @permission ohos.permission.NFC_CARD_EMULATION + * @param { ElementName } elementName - The element name of the service ability + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - The parameter check failed. Possible causes: + *
1. Mandatory parameters are left unspecified. + *
2. Incorrect parameters types. + *
3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 3100301 - Card emulation running state is abnormal in service. + * @syscap SystemCapability.Communication.NFC.CardEmulation + * @since 9 + */ + /** + * Stops the HCE, and unset the preferred service while in foreground. + * + * @permission ohos.permission.NFC_CARD_EMULATION + * @param { ElementName } elementName - The element name of the service ability + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - The parameter check failed. Possible causes: + *
1. Mandatory parameters are left unspecified. + *
2. Incorrect parameters types. + *
3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 3100301 - Card emulation running state is abnormal in service. + * @syscap SystemCapability.Communication.NFC.CardEmulation + * @atomicservice + * @since 12 + */ + stop(elementName: ElementName): void; + /** + * register HCE event to receive the APDU data. + * + * @permission ohos.permission.NFC_CARD_EMULATION + * @param { 'hceCmd' } type The type to register. + * @param { AsyncCallback } callback Callback used to listen to HCE data that local device received. + * @syscap SystemCapability.Communication.NFC.CardEmulation + * @since 8 + */ + /** + * register HCE event to receive the APDU data. + * + * @permission ohos.permission.NFC_CARD_EMULATION + * @param { 'hceCmd' } type The type to register. + * @param { AsyncCallback } callback Callback used to listen to HCE data that local device received. + * @syscap SystemCapability.Communication.NFC.CardEmulation + * @atomicservice + * @since 12 + */ + on(type: 'hceCmd', callback: AsyncCallback): void; + /** + * Sends a response APDU to the remote device. + *

This method is used by a host application when swiping card. + * + * @permission ohos.permission.NFC_CARD_EMULATION + * @param { number[] } responseApdu Indicates the response, which is a byte array. + * @syscap SystemCapability.Communication.NFC.CardEmulation + * @since 8 + * @deprecated since 9 + * @useinstead ohos.nfc.cardEmulation/cardEmulation.HceService#transmit + */ + sendResponse(responseApdu: number[]): void; + /** + * Sends a response APDU to the remote device. + * + * @permission ohos.permission.NFC_CARD_EMULATION + * @param { number[] } response Indicates the response to send, which is a byte array. + * @returns { Promise } The void + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - The parameter check failed. Possible causes: + *
1. Mandatory parameters are left unspecified. + *
2. Incorrect parameters types. + *
3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 3100301 - Card emulation running state is abnormal in service. + * @syscap SystemCapability.Communication.NFC.CardEmulation + * @since 9 + */ + /** + * Sends a response APDU to the remote device. + * + * @permission ohos.permission.NFC_CARD_EMULATION + * @param { number[] } response Indicates the response to send, which is a byte array. + * @returns { Promise } The void + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - The parameter check failed. Possible causes: + *
1. Mandatory parameters are left unspecified. + *
2. Incorrect parameters types. + *
3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 3100301 - Card emulation running state is abnormal in service. + * @syscap SystemCapability.Communication.NFC.CardEmulation + * @atomicservice + * @since 12 + */ + transmit(response: number[]): Promise; + /** + * Sends a response APDU to the remote device. + * + * @permission ohos.permission.NFC_CARD_EMULATION + * @param { number[] } response Indicates the response to send, which is a byte array. + * @param { AsyncCallback } callback The callback + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - The parameter check failed. Possible causes: + *
1. Mandatory parameters are left unspecified. + *
2. Incorrect parameters types. + *
3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 3100301 - Card emulation running state is abnormal in service. + * @syscap SystemCapability.Communication.NFC.CardEmulation + * @since 9 + */ + /** + * Sends a response APDU to the remote device. + * + * @permission ohos.permission.NFC_CARD_EMULATION + * @param { number[] } response Indicates the response to send, which is a byte array. + * @param { AsyncCallback } callback The callback + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - The parameter check failed. Possible causes: + *
1. Mandatory parameters are left unspecified. + *
2. Incorrect parameters types. + *
3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 3100301 - Card emulation running state is abnormal in service. + * @syscap SystemCapability.Communication.NFC.CardEmulation + * @atomicservice + * @since 12 + */ + transmit(response: number[], callback: AsyncCallback): void; + } +} +export default cardEmulation; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.nfc.controller.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.nfc.controller.d.ts new file mode 100755 index 00000000..180a70e9 --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.nfc.controller.d.ts @@ -0,0 +1,240 @@ +/* + * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit ConnectivityKit + */ +import { Callback } from './@ohos.base'; +/** + * Provides methods to operate or manage NFC. + * + * @namespace nfcController + * @syscap SystemCapability.Communication.NFC.Core + * @since 7 + */ +/** + * Provides methods to operate or manage NFC. + * + * @namespace nfcController + * @syscap SystemCapability.Communication.NFC.Core + * @atomicservice + * @since 12 + */ +declare namespace nfcController { + /** + * NFC changed states. + * + * @enum { number } + * @syscap SystemCapability.Communication.NFC.Core + * @since 7 + */ + /** + * NFC changed states. + * + * @enum { number } + * @syscap SystemCapability.Communication.NFC.Core + * @atomicservice + * @since 12 + */ + enum NfcState { + /** + * Indicates that NFC is disabled. + * + * @syscap SystemCapability.Communication.NFC.Core + * @since 7 + */ + /** + * Indicates that NFC is disabled. + * + * @syscap SystemCapability.Communication.NFC.Core + * @atomicservice + * @since 12 + */ + STATE_OFF = 1, + /** + * Indicates that NFC is being enabled. + * + * @syscap SystemCapability.Communication.NFC.Core + * @since 7 + */ + /** + * Indicates that NFC is being enabled. + * + * @syscap SystemCapability.Communication.NFC.Core + * @atomicservice + * @since 12 + */ + STATE_TURNING_ON = 2, + /** + * Indicates that NFC is enabled. + * + * @syscap SystemCapability.Communication.NFC.Core + * @since 7 + */ + /** + * Indicates that NFC is enabled. + * + * @syscap SystemCapability.Communication.NFC.Core + * @atomicservice + * @since 12 + */ + STATE_ON = 3, + /** + * Indicates that NFC is being disabled. + * + * @syscap SystemCapability.Communication.NFC.Core + * @since 7 + */ + /** + * Indicates that NFC is being disabled. + * + * @syscap SystemCapability.Communication.NFC.Core + * @atomicservice + * @since 12 + */ + STATE_TURNING_OFF = 4 + } + /** + * Checks whether a device supports NFC. + * + * @returns { boolean } Returns {@code true} if the device supports NFC; returns {@code false} otherwise. + * @syscap SystemCapability.Communication.NFC.Core + * @since 7 + * @deprecated since 9 + * @useinstead global#canIUse("SystemCapability.Communication.NFC.Core") + */ + function isNfcAvailable(): boolean; + /** + * register nfc state changed event. + * + * @param { 'nfcStateChange' } type The type to register. + * @param { Callback } callback Callback used to listen to the nfc state changed event. + * @syscap SystemCapability.Communication.NFC.Core + * @since 7 + */ + /** + * register nfc state changed event. + * + * @param { 'nfcStateChange' } type The type to register. + * @param { Callback } callback Callback used to listen to the nfc state changed event. + * @syscap SystemCapability.Communication.NFC.Core + * @atomicservice + * @since 12 + */ + function on(type: 'nfcStateChange', callback: Callback): void; + /** + * unregister nfc state changed event. + * + * @param { 'nfcStateChange' } type The type to unregister. + * @param { Callback } callback Callback used to listen to the nfc state changed event. + * @syscap SystemCapability.Communication.NFC.Core + * @since 7 + */ + /** + * unregister nfc state changed event. + * + * @param { 'nfcStateChange' } type The type to unregister. + * @param { Callback } callback Callback used to listen to the nfc state changed event. + * @syscap SystemCapability.Communication.NFC.Core + * @atomicservice + * @since 12 + */ + function off(type: 'nfcStateChange', callback?: Callback): void; + /** + * Enables NFC. + * + * @permission ohos.permission.MANAGE_SECURE_SETTINGS + * @returns { boolean } Returns {@code true} if NFC is enabled or has been enabled; returns {@code false} otherwise. + * @syscap SystemCapability.Communication.NFC.Core + * @since 7 + * @deprecated since 9 + * @useinstead @ohos.nfc.controller.nfcController#enableNfc + */ + function openNfc(): boolean; + /** + * Enables NFC. + * + * @permission ohos.permission.MANAGE_SECURE_SETTINGS + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 3100101 - NFC state is abnormal in service. + * @syscap SystemCapability.Communication.NFC.Core + * @since 9 + */ + function enableNfc(): void; + /** + * Disables NFC. + * + * @permission ohos.permission.MANAGE_SECURE_SETTINGS + * @returns { boolean } Returns {@code true} if NFC is disabled or has been disabled; returns {@code false} otherwise. + * @syscap SystemCapability.Communication.NFC.Core + * @since 7 + * @deprecated since 9 + * @useinstead @ohos.nfc.controller.nfcController#disableNfc + */ + function closeNfc(): boolean; + /** + * Disables NFC. + * + * @permission ohos.permission.MANAGE_SECURE_SETTINGS + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 3100101 - NFC state is abnormal in service. + * @syscap SystemCapability.Communication.NFC.Core + * @since 9 + */ + function disableNfc(): void; + /** + * Checks whether NFC is enabled. + * + * @returns { boolean } Returns {@code true} if NFC is enabled; returns {@code false} otherwise. + * @syscap SystemCapability.Communication.NFC.Core + * @since 7 + */ + /** + * Checks whether NFC is enabled. + * + * @returns { boolean } Returns {@code true} if NFC is enabled; returns {@code false} otherwise. + * @syscap SystemCapability.Communication.NFC.Core + * @atomicservice + * @since 12 + */ + function isNfcOpen(): boolean; + /** + * Obtains the NFC status. + *

The NFC status can be any of the following:

  • {@link #STATE_OFF}: Indicates that NFC + * is disabled.
  • {@link #STATE_TURNING_ON}: Indicates that NFC is being enabled. + *
  • {@link #STATE_ON}: Indicates that NFC is enabled.
  • {@link #STATE_TURNING_OFF}: Indicates + * that NFC is being disabled.
+ * + * @returns { NfcState } Returns the NFC status. + * @syscap SystemCapability.Communication.NFC.Core + * @since 7 + */ + /** + * Obtains the NFC status. + *

The NFC status can be any of the following:

  • {@link #STATE_OFF}: Indicates that NFC + * is disabled.
  • {@link #STATE_TURNING_ON}: Indicates that NFC is being enabled. + *
  • {@link #STATE_ON}: Indicates that NFC is enabled.
  • {@link #STATE_TURNING_OFF}: Indicates + * that NFC is being disabled.
+ * + * @returns { NfcState } Returns the NFC status. + * @syscap SystemCapability.Communication.NFC.Core + * @atomicservice + * @since 12 + */ + function getNfcState(): NfcState; +} +export default nfcController; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.nfc.tag.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.nfc.tag.d.ts new file mode 100755 index 00000000..38357f75 --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.nfc.tag.d.ts @@ -0,0 +1,1647 @@ +/* + * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit ConnectivityKit + */ +import type { NfcATag as _NfcATag, NfcBTag as _NfcBTag, NfcFTag as _NfcFTag, NfcVTag as _NfcVTag } from './tag/nfctech'; +import { IsoDepTag as _IsoDepTag, NdefTag as _NdefTag, MifareClassicTag as _MifareClassicTag, MifareUltralightTag as _MifareUltralightTag, NdefFormatableTag as _NdefFormatableTag } from './tag/nfctech'; +import { NdefMessage as _NdefMessage } from './tag/nfctech'; +import { TagSession as _TagSession } from './tag/tagSession'; +import type { AsyncCallback } from './@ohos.base'; +import Want from './@ohos.app.ability.Want'; +import type { ElementName } from './bundleManager/ElementName'; +/** + * Provides methods to operate or manage NFC tag. + * + * @namespace tag + * @syscap SystemCapability.Communication.NFC.Tag + * @since 7 + */ +/** + * Provides methods to operate or manage NFC tag. + * + * @namespace tag + * @syscap SystemCapability.Communication.NFC.Tag + * @atomicservice + * @since 12 + */ +declare namespace tag { + /** + * Indicates an NFC-A tag. + * + * @constant + * @syscap SystemCapability.Communication.NFC.Tag + * @since 7 + */ + /** + * Indicates an NFC-A tag. + * + * @constant + * @syscap SystemCapability.Communication.NFC.Tag + * @atomicservice + * @since 12 + */ + const NFC_A = 1; + /** + * Indicates an NFC-B tag. + * + * @constant + * @syscap SystemCapability.Communication.NFC.Tag + * @since 7 + */ + /** + * Indicates an NFC-B tag. + * + * @constant + * @syscap SystemCapability.Communication.NFC.Tag + * @atomicservice + * @since 12 + */ + const NFC_B = 2; + /** + * Indicates an ISO_DEP tag. + * + * @constant + * @syscap SystemCapability.Communication.NFC.Tag + * @since 7 + */ + /** + * Indicates an ISO_DEP tag. + * + * @constant + * @syscap SystemCapability.Communication.NFC.Tag + * @atomicservice + * @since 12 + */ + const ISO_DEP = 3; + /** + * Indicates an NFC-F tag. + * + * @constant + * @syscap SystemCapability.Communication.NFC.Tag + * @since 7 + */ + /** + * Indicates an NFC-F tag. + * + * @constant + * @syscap SystemCapability.Communication.NFC.Tag + * @atomicservice + * @since 12 + */ + const NFC_F = 4; + /** + * Indicates an NFC-V tag. + * + * @constant + * @syscap SystemCapability.Communication.NFC.Tag + * @since 7 + */ + /** + * Indicates an NFC-V tag. + * + * @constant + * @syscap SystemCapability.Communication.NFC.Tag + * @atomicservice + * @since 12 + */ + const NFC_V = 5; + /** + * Indicates an NDEF tag. + * + * @constant + * @syscap SystemCapability.Communication.NFC.Tag + * @since 7 + */ + /** + * Indicates an NDEF tag. + * + * @constant + * @syscap SystemCapability.Communication.NFC.Tag + * @atomicservice + * @since 12 + */ + const NDEF = 6; + /** + * Indicates an NDEF Formatable tag. + * + * @constant + * @syscap SystemCapability.Communication.NFC.Tag + * @since 9 + */ + /** + * Indicates an NDEF Formatable tag. + * + * @constant + * @syscap SystemCapability.Communication.NFC.Tag + * @atomicservice + * @since 12 + */ + const NDEF_FORMATABLE = 7; + /** + * Indicates an MIFARE CLASSIC tag. + * + * @constant + * @syscap SystemCapability.Communication.NFC.Tag + * @since 7 + */ + /** + * Indicates an MIFARE CLASSIC tag. + * + * @constant + * @syscap SystemCapability.Communication.NFC.Tag + * @atomicservice + * @since 12 + */ + const MIFARE_CLASSIC = 8; + /** + * Indicates an MIFARE ULTRALIGHT tag. + * + * @constant + * @syscap SystemCapability.Communication.NFC.Tag + * @since 7 + */ + /** + * Indicates an MIFARE ULTRALIGHT tag. + * + * @constant + * @syscap SystemCapability.Communication.NFC.Tag + * @atomicservice + * @since 12 + */ + const MIFARE_ULTRALIGHT = 9; + /** + * TNF types definitions, see NFCForum-TS-NDEF_1.0. + * + * @enum { number } + * @syscap SystemCapability.Communication.NFC.Tag + * @since 9 + */ + /** + * TNF types definitions, see NFCForum-TS-NDEF_1.0. + * + * @enum { number } + * @syscap SystemCapability.Communication.NFC.Tag + * @atomicservice + * @since 12 + */ + enum TnfType { + /** + * Empty + * + * @syscap SystemCapability.Communication.NFC.Tag + * @since 9 + */ + /** + * Empty + * + * @syscap SystemCapability.Communication.NFC.Tag + * @atomicservice + * @since 12 + */ + TNF_EMPTY = 0x0, + /** + * NFC Forum well-known type [NFC RTD] + * + * @syscap SystemCapability.Communication.NFC.Tag + * @since 9 + */ + /** + * NFC Forum well-known type [NFC RTD] + * + * @syscap SystemCapability.Communication.NFC.Tag + * @atomicservice + * @since 12 + */ + TNF_WELL_KNOWN = 0x1, + /** + * Media-type as defined in RFC 2046 [RFC 2046] + * + * @syscap SystemCapability.Communication.NFC.Tag + * @since 9 + */ + /** + * Media-type as defined in RFC 2046 [RFC 2046] + * + * @syscap SystemCapability.Communication.NFC.Tag + * @atomicservice + * @since 12 + */ + TNF_MEDIA = 0x2, + /** + * Absolute URI as defined in RFC 3986 [RFC 3986] + * + * @syscap SystemCapability.Communication.NFC.Tag + * @since 9 + */ + /** + * Absolute URI as defined in RFC 3986 [RFC 3986] + * + * @syscap SystemCapability.Communication.NFC.Tag + * @atomicservice + * @since 12 + */ + TNF_ABSOLUTE_URI = 0x3, + /** + * NFC Forum external type [NFC RTD] + * + * @syscap SystemCapability.Communication.NFC.Tag + * @since 9 + */ + /** + * NFC Forum external type [NFC RTD] + * + * @syscap SystemCapability.Communication.NFC.Tag + * @atomicservice + * @since 12 + */ + TNF_EXT_APP = 0x4, + /** + * Unknown + * + * @syscap SystemCapability.Communication.NFC.Tag + * @since 9 + */ + /** + * Unknown + * + * @syscap SystemCapability.Communication.NFC.Tag + * @atomicservice + * @since 12 + */ + TNF_UNKNOWN = 0x5, + /** + * Unchanged (see section 2.3.3) + * + * @syscap SystemCapability.Communication.NFC.Tag + * @since 9 + */ + /** + * Unchanged (see section 2.3.3) + * + * @syscap SystemCapability.Communication.NFC.Tag + * @atomicservice + * @since 12 + */ + TNF_UNCHANGED = 0x6 + } + /** + * NfcForum Type definition. The NDEF tag may use one of them. + * + * @enum { number } + * @syscap SystemCapability.Communication.NFC.Tag + * @since 9 + */ + /** + * NfcForum Type definition. The NDEF tag may use one of them. + * + * @enum { number } + * @syscap SystemCapability.Communication.NFC.Tag + * @atomicservice + * @since 12 + */ + enum NfcForumType { + /** + * NFC FORUM TYPE 1 + * + * @syscap SystemCapability.Communication.NFC.Tag + * @since 9 + */ + /** + * NFC FORUM TYPE 1 + * + * @syscap SystemCapability.Communication.NFC.Tag + * @atomicservice + * @since 12 + */ + NFC_FORUM_TYPE_1 = 1, + /** + * NFC FORUM TYPE 2 + * + * @syscap SystemCapability.Communication.NFC.Tag + * @since 9 + */ + /** + * NFC FORUM TYPE 2 + * + * @syscap SystemCapability.Communication.NFC.Tag + * @atomicservice + * @since 12 + */ + NFC_FORUM_TYPE_2 = 2, + /** + * NFC FORUM TYPE 3 + * + * @syscap SystemCapability.Communication.NFC.Tag + * @since 9 + */ + /** + * NFC FORUM TYPE 3 + * + * @syscap SystemCapability.Communication.NFC.Tag + * @atomicservice + * @since 12 + */ + NFC_FORUM_TYPE_3 = 3, + /** + * NFC FORUM TYPE 4 + * + * @syscap SystemCapability.Communication.NFC.Tag + * @since 9 + */ + /** + * NFC FORUM TYPE 4 + * + * @syscap SystemCapability.Communication.NFC.Tag + * @atomicservice + * @since 12 + */ + NFC_FORUM_TYPE_4 = 4, + /** + * Mifare Classic + * + * @syscap SystemCapability.Communication.NFC.Tag + * @since 9 + */ + /** + * Mifare Classic + * + * @syscap SystemCapability.Communication.NFC.Tag + * @atomicservice + * @since 12 + */ + MIFARE_CLASSIC = 101 + } + /** + * RTD type TEXT, see NFC Record Type Definition (RTD) Specification. + * + * @constant + * @syscap SystemCapability.Communication.NFC.Tag + * @since 9 + */ + /** + * RTD type TEXT, see NFC Record Type Definition (RTD) Specification. + * + * @constant + * @syscap SystemCapability.Communication.NFC.Tag + * @atomicservice + * @since 12 + */ + const RTD_TEXT: number[]; + /** + * RTD type URI, see NFC Record Type Definition (RTD) Specification. + * + * @constant + * @syscap SystemCapability.Communication.NFC.Tag + * @since 9 + */ + /** + * RTD type URI, see NFC Record Type Definition (RTD) Specification. + * + * @constant + * @syscap SystemCapability.Communication.NFC.Tag + * @atomicservice + * @since 12 + */ + const RTD_URI: number[]; + /** + * MifareClassic Type definition + * + * @enum { number } + * @syscap SystemCapability.Communication.NFC.Tag + * @since 9 + */ + /** + * MifareClassic Type definition + * + * @enum { number } + * @syscap SystemCapability.Communication.NFC.Tag + * @atomicservice + * @since 12 + */ + enum MifareClassicType { + /** + * Mifare Type unknown + * + * @syscap SystemCapability.Communication.NFC.Tag + * @since 9 + */ + /** + * Mifare Type unknown + * + * @syscap SystemCapability.Communication.NFC.Tag + * @atomicservice + * @since 12 + */ + TYPE_UNKNOWN = 0, + /** + * Mifare Classic + * + * @syscap SystemCapability.Communication.NFC.Tag + * @since 9 + */ + /** + * Mifare Classic + * + * @syscap SystemCapability.Communication.NFC.Tag + * @atomicservice + * @since 12 + */ + TYPE_CLASSIC = 1, + /** + * Mifare Plus + * + * @syscap SystemCapability.Communication.NFC.Tag + * @since 9 + */ + /** + * Mifare Plus + * + * @syscap SystemCapability.Communication.NFC.Tag + * @atomicservice + * @since 12 + */ + TYPE_PLUS = 2, + /** + * Mifare Pro + * + * @syscap SystemCapability.Communication.NFC.Tag + * @since 9 + */ + /** + * Mifare Pro + * + * @syscap SystemCapability.Communication.NFC.Tag + * @atomicservice + * @since 12 + */ + TYPE_PRO = 3 + } + /** + * MifareClassic Tag size. + * + * @enum { number } + * @syscap SystemCapability.Communication.NFC.Tag + * @since 9 + */ + /** + * MifareClassic Tag size. + * + * @enum { number } + * @syscap SystemCapability.Communication.NFC.Tag + * @atomicservice + * @since 12 + */ + enum MifareClassicSize { + /** + * 5 sectors per tag, 4 blocks per sector + * + * @syscap SystemCapability.Communication.NFC.Tag + * @since 9 + */ + /** + * 5 sectors per tag, 4 blocks per sector + * + * @syscap SystemCapability.Communication.NFC.Tag + * @atomicservice + * @since 12 + */ + MC_SIZE_MINI = 320, + /** + * 16 sectors per tag, 4 blocks per sector + * + * @syscap SystemCapability.Communication.NFC.Tag + * @since 9 + */ + /** + * 16 sectors per tag, 4 blocks per sector + * + * @syscap SystemCapability.Communication.NFC.Tag + * @atomicservice + * @since 12 + */ + MC_SIZE_1K = 1024, + /** + * 32 sectors per tag, 4 blocks per sector + * + * @syscap SystemCapability.Communication.NFC.Tag + * @since 9 + */ + /** + * 32 sectors per tag, 4 blocks per sector + * + * @syscap SystemCapability.Communication.NFC.Tag + * @atomicservice + * @since 12 + */ + MC_SIZE_2K = 2048, + /** + * 40 sectors per tag, 4 blocks per sector + * + * @syscap SystemCapability.Communication.NFC.Tag + * @since 9 + */ + /** + * 40 sectors per tag, 4 blocks per sector + * + * @syscap SystemCapability.Communication.NFC.Tag + * @atomicservice + * @since 12 + */ + MC_SIZE_4K = 4096 + } + /** + * MifareUltralight Type definition + * + * @enum { number } + * @syscap SystemCapability.Communication.NFC.Tag + * @since 9 + */ + /** + * MifareUltralight Type definition + * + * @enum { number } + * @syscap SystemCapability.Communication.NFC.Tag + * @atomicservice + * @since 12 + */ + enum MifareUltralightType { + /** + * Mifare Type unknown + * + * @syscap SystemCapability.Communication.NFC.Tag + * @since 9 + */ + /** + * Mifare Type unknown + * + * @syscap SystemCapability.Communication.NFC.Tag + * @atomicservice + * @since 12 + */ + TYPE_UNKNOWN = 0, + /** + * Mifare Ultralight + * + * @syscap SystemCapability.Communication.NFC.Tag + * @since 9 + */ + /** + * Mifare Ultralight + * + * @syscap SystemCapability.Communication.NFC.Tag + * @atomicservice + * @since 12 + */ + TYPE_ULTRALIGHT = 1, + /** + * Mifare UltralightC + * + * @syscap SystemCapability.Communication.NFC.Tag + * @since 9 + */ + /** + * Mifare UltralightC + * + * @syscap SystemCapability.Communication.NFC.Tag + * @atomicservice + * @since 12 + */ + TYPE_ULTRALIGHT_C = 2 + } + /** + * Obtains an {@link NfcATag} object based on the tag information. + *

During tag reading, if the tag supports the NFC-A technology, an {@link NfcATag} object + * will be created based on the tag information. + * + * @param { TagInfo } tagInfo Indicates the tag information. + * @returns { NfcATag } The {@link NfcATag} object. + * @syscap SystemCapability.Communication.NFC.Tag + * @since 7 + * @deprecated since 9 + * @useinstead ohos.nfc.tag/tag#getNfcA + */ + function getNfcATag(tagInfo: TagInfo): NfcATag; + /** + * Obtains an {@link NfcATag} object based on the tag information. + * During tag reading, if the tag supports the NFC-A technology, an {@link NfcATag} object + * will be created based on the tag information. + * + * @param { TagInfo } tagInfo - Indicates the dispatched tag information. + * @returns { NfcATag } {@link NfcATag} object. + * @throws { BusinessError } 401 - The parameter check failed. Possible causes: + *
1. Mandatory parameters are left unspecified. + *
2. Incorrect parameters types. + *
3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 3100201 - Tag running state is abnormal in service. + * @syscap SystemCapability.Communication.NFC.Tag + * @since 9 + */ + /** + * Obtains an {@link NfcATag} object based on the tag information. + * During tag reading, if the tag supports the NFC-A technology, an {@link NfcATag} object + * will be created based on the tag information. + * + * @param { TagInfo } tagInfo - Indicates the dispatched tag information. + * @returns { NfcATag } {@link NfcATag} object. + * @throws { BusinessError } 401 - The parameter check failed. Possible causes: + *
1. Mandatory parameters are left unspecified. + *
2. Incorrect parameters types. + *
3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 3100201 - Tag running state is abnormal in service. + * @syscap SystemCapability.Communication.NFC.Tag + * @atomicservice + * @since 12 + */ + function getNfcA(tagInfo: TagInfo): NfcATag; + /** + * Obtains an {@link NfcBTag} object based on the tag information. + *

During tag reading, if the tag supports the NFC-B technology, an {@link NfcBTag} object + * will be created based on the tag information. + * + * @param { TagInfo } tagInfo Indicates the tag information. + * @returns { NfcBTag } The {@link NfcBTag} object. + * @syscap SystemCapability.Communication.NFC.Tag + * @since 7 + * @deprecated since 9 + * @useinstead ohos.nfc.tag/tag#getNfcB + */ + function getNfcBTag(tagInfo: TagInfo): NfcBTag; + /** + * Obtains an {@link NfcBTag} object based on the tag information. + * During tag reading, if the tag supports the NFC-B technology, an {@link NfcBTag} object + * will be created based on the tag information. + * + * @param { TagInfo } tagInfo - Indicates the dispatched tag information. + * @returns { NfcBTag } The {@link NfcBTag} object. + * @throws { BusinessError } 401 - The parameter check failed. Possible causes: + *
1. Mandatory parameters are left unspecified. + *
2. Incorrect parameters types. + *
3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 3100201 - Tag running state is abnormal in service. + * @syscap SystemCapability.Communication.NFC.Tag + * @since 9 + */ + /** + * Obtains an {@link NfcBTag} object based on the tag information. + * During tag reading, if the tag supports the NFC-B technology, an {@link NfcBTag} object + * will be created based on the tag information. + * + * @param { TagInfo } tagInfo - Indicates the dispatched tag information. + * @returns { NfcBTag } The {@link NfcBTag} object. + * @throws { BusinessError } 401 - The parameter check failed. Possible causes: + *
1. Mandatory parameters are left unspecified. + *
2. Incorrect parameters types. + *
3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 3100201 - Tag running state is abnormal in service. + * @syscap SystemCapability.Communication.NFC.Tag + * @atomicservice + * @since 12 + */ + function getNfcB(tagInfo: TagInfo): NfcBTag; + /** + * Obtains an {@link NfcFTag} object based on the tag information. + *

During tag reading, if the tag supports the NFC-F technology, an {@link NfcFTag} object + * will be created based on the tag information. + * + * @param { TagInfo } tagInfo Indicates the tag information. + * @returns { NfcFTag } The {@link NfcFTag} object. + * @syscap SystemCapability.Communication.NFC.Tag + * @since 7 + * @deprecated since 9 + * @useinstead ohos.nfc.tag/tag#getNfcF + */ + function getNfcFTag(tagInfo: TagInfo): NfcFTag; + /** + * Obtains an {@link NfcFTag} object based on the tag information. + * During tag reading, if the tag supports the NFC-F technology, an {@link NfcFTag} object + * will be created based on the tag information. + * + * @param { TagInfo } tagInfo - Indicates the dispatched tag information. + * @returns { NfcFTag } The {@link NfcFTag} object. + * @throws { BusinessError } 401 - The parameter check failed. Possible causes: + *
1. Mandatory parameters are left unspecified. + *
2. Incorrect parameters types. + *
3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 3100201 - Tag running state is abnormal in service. + * @syscap SystemCapability.Communication.NFC.Tag + * @since 9 + */ + /** + * Obtains an {@link NfcFTag} object based on the tag information. + * During tag reading, if the tag supports the NFC-F technology, an {@link NfcFTag} object + * will be created based on the tag information. + * + * @param { TagInfo } tagInfo - Indicates the dispatched tag information. + * @returns { NfcFTag } The {@link NfcFTag} object. + * @throws { BusinessError } 401 - The parameter check failed. Possible causes: + *
1. Mandatory parameters are left unspecified. + *
2. Incorrect parameters types. + *
3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 3100201 - Tag running state is abnormal in service. + * @syscap SystemCapability.Communication.NFC.Tag + * @atomicservice + * @since 12 + */ + function getNfcF(tagInfo: TagInfo): NfcFTag; + /** + * Obtains an {@link NfcVTag} object based on the tag information. + *

During tag reading, if the tag supports the NFC-V technology, an {@link NfcVTag} object + * will be created based on the tag information. + * + * @param { TagInfo } tagInfo Indicates the tag information. + * @returns { NfcVTag } The {@link NfcVTag} object. + * @syscap SystemCapability.Communication.NFC.Tag + * @since 7 + * @deprecated since 9 + * @useinstead ohos.nfc.tag/tag#getNfcV + */ + function getNfcVTag(tagInfo: TagInfo): NfcVTag; + /** + * Obtains an {@link NfcVTag} object based on the tag information. + * During tag reading, if the tag supports the NFC-V technology, an {@link NfcVTag} object + * will be created based on the tag information. + * + * @param { TagInfo } tagInfo - Indicates the dispatched tag information. + * @returns { NfcVTag } The {@link NfcVTag} object. + * @throws { BusinessError } 401 - The parameter check failed. Possible causes: + *
1. Mandatory parameters are left unspecified. + *
2. Incorrect parameters types. + *
3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 3100201 - Tag running state is abnormal in service. + * @syscap SystemCapability.Communication.NFC.Tag + * @since 9 + */ + /** + * Obtains an {@link NfcVTag} object based on the tag information. + * During tag reading, if the tag supports the NFC-V technology, an {@link NfcVTag} object + * will be created based on the tag information. + * + * @param { TagInfo } tagInfo - Indicates the dispatched tag information. + * @returns { NfcVTag } The {@link NfcVTag} object. + * @throws { BusinessError } 401 - The parameter check failed. Possible causes: + *
1. Mandatory parameters are left unspecified. + *
2. Incorrect parameters types. + *
3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 3100201 - Tag running state is abnormal in service. + * @syscap SystemCapability.Communication.NFC.Tag + * @atomicservice + * @since 12 + */ + function getNfcV(tagInfo: TagInfo): NfcVTag; + /** + * Obtains an {@link IsoDepTag} object based on the tag information. + * During tag reading, if the tag supports the IsoDep technology, an {@link IsoDepTag} object + * will be created based on the tag information. + * + * @param { TagInfo } tagInfo - Indicates the dispatched tag information. + * @returns { IsoDepTag } The {@link IsoDepTag} object. + * @throws { BusinessError } 401 - The parameter check failed. Possible causes: + *
1. Mandatory parameters are left unspecified. + *
2. Incorrect parameters types. + *
3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 3100201 - Tag running state is abnormal in service. + * @syscap SystemCapability.Communication.NFC.Tag + * @since 9 + */ + /** + * Obtains an {@link IsoDepTag} object based on the tag information. + * During tag reading, if the tag supports the IsoDep technology, an {@link IsoDepTag} object + * will be created based on the tag information. + * + * @param { TagInfo } tagInfo - Indicates the dispatched tag information. + * @returns { IsoDepTag } The {@link IsoDepTag} object. + * @throws { BusinessError } 401 - The parameter check failed. Possible causes: + *
1. Mandatory parameters are left unspecified. + *
2. Incorrect parameters types. + *
3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 3100201 - Tag running state is abnormal in service. + * @syscap SystemCapability.Communication.NFC.Tag + * @atomicservice + * @since 12 + */ + function getIsoDep(tagInfo: TagInfo): IsoDepTag; + /** + * Obtains an {@link NdefTag} object based on the tag information. + * During tag reading, if the tag supports the NDEF technology, an {@link NdefTag} object + * will be created based on the tag information. + * + * @param { TagInfo } tagInfo - Indicates the dispatched tag information. + * @returns { NdefTag } The {@link NdefTag} object. + * @throws { BusinessError } 401 - The parameter check failed. Possible causes: + *
1. Mandatory parameters are left unspecified. + *
2. Incorrect parameters types. + *
3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 3100201 - Tag running state is abnormal in service. + * @syscap SystemCapability.Communication.NFC.Tag + * @since 9 + */ + /** + * Obtains an {@link NdefTag} object based on the tag information. + * During tag reading, if the tag supports the NDEF technology, an {@link NdefTag} object + * will be created based on the tag information. + * + * @param { TagInfo } tagInfo - Indicates the dispatched tag information. + * @returns { NdefTag } The {@link NdefTag} object. + * @throws { BusinessError } 401 - The parameter check failed. Possible causes: + *
1. Mandatory parameters are left unspecified. + *
2. Incorrect parameters types. + *
3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 3100201 - Tag running state is abnormal in service. + * @syscap SystemCapability.Communication.NFC.Tag + * @atomicservice + * @since 12 + */ + function getNdef(tagInfo: TagInfo): NdefTag; + /** + * Obtains an {@link MifareClassicTag} object based on the tag information. + * During tag reading, if the tag supports the MIFARE Classic technology, + * an {@link MifareClassicTag} object will be created based on the tag information. + * + * @param { TagInfo } tagInfo - Indicates the dispatched tag information. + * @returns { MifareClassicTag } The {@link MifareClassicTag} object. + * @throws { BusinessError } 401 - The parameter check failed. Possible causes: + *
1. Mandatory parameters are left unspecified. + *
2. Incorrect parameters types. + *
3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 3100201 - Tag running state is abnormal in service. + * @syscap SystemCapability.Communication.NFC.Tag + * @since 9 + */ + /** + * Obtains an {@link MifareClassicTag} object based on the tag information. + * During tag reading, if the tag supports the MIFARE Classic technology, + * an {@link MifareClassicTag} object will be created based on the tag information. + * + * @param { TagInfo } tagInfo - Indicates the dispatched tag information. + * @returns { MifareClassicTag } The {@link MifareClassicTag} object. + * @throws { BusinessError } 401 - The parameter check failed. Possible causes: + *
1. Mandatory parameters are left unspecified. + *
2. Incorrect parameters types. + *
3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 3100201 - Tag running state is abnormal in service. + * @syscap SystemCapability.Communication.NFC.Tag + * @atomicservice + * @since 12 + */ + function getMifareClassic(tagInfo: TagInfo): MifareClassicTag; + /** + * Obtains an {@link MifareUltralightTag} object based on the tag information. + * During tag reading, if the tag supports the MIFARE Ultralight technology, + * an {@link MifareUltralightTag} object will be created based on the tag information. + * + * @param { TagInfo } tagInfo - Indicates the dispatched tag information. + * @returns { MifareUltralightTag } The {@link MifareUltralightTag} object. + * @throws { BusinessError } 401 - The parameter check failed. Possible causes: + *
1. Mandatory parameters are left unspecified. + *
2. Incorrect parameters types. + *
3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 3100201 - Tag running state is abnormal in service. + * @syscap SystemCapability.Communication.NFC.Tag + * @since 9 + */ + /** + * Obtains an {@link MifareUltralightTag} object based on the tag information. + * During tag reading, if the tag supports the MIFARE Ultralight technology, + * an {@link MifareUltralightTag} object will be created based on the tag information. + * + * @param { TagInfo } tagInfo - Indicates the dispatched tag information. + * @returns { MifareUltralightTag } The {@link MifareUltralightTag} object. + * @throws { BusinessError } 401 - The parameter check failed. Possible causes: + *
1. Mandatory parameters are left unspecified. + *
2. Incorrect parameters types. + *
3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 3100201 - Tag running state is abnormal in service. + * @syscap SystemCapability.Communication.NFC.Tag + * @atomicservice + * @since 12 + */ + function getMifareUltralight(tagInfo: TagInfo): MifareUltralightTag; + /** + * Obtains an {@link NdefFormatableTag} object based on the tag information. + * During tag reading, if the tag supports the NDEF Formatable technology, + * an {@link NdefFormatableTag} object will be created based on the tag information. + * + * @param { TagInfo } tagInfo - Indicates the dispatched tag information. + * @returns { NdefFormatableTag } The {@link NdefFormatableTag} object. + * @throws { BusinessError } 401 - The parameter check failed. Possible causes: + *
1. Mandatory parameters are left unspecified. + *
2. Incorrect parameters types. + *
3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 3100201 - Tag running state is abnormal in service. + * @syscap SystemCapability.Communication.NFC.Tag + * @since 9 + */ + /** + * Obtains an {@link NdefFormatableTag} object based on the tag information. + * During tag reading, if the tag supports the NDEF Formatable technology, + * an {@link NdefFormatableTag} object will be created based on the tag information. + * + * @param { TagInfo } tagInfo - Indicates the dispatched tag information. + * @returns { NdefFormatableTag } The {@link NdefFormatableTag} object. + * @throws { BusinessError } 401 - The parameter check failed. Possible causes: + *
1. Mandatory parameters are left unspecified. + *
2. Incorrect parameters types. + *
3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 3100201 - Tag running state is abnormal in service. + * @syscap SystemCapability.Communication.NFC.Tag + * @atomicservice + * @since 12 + */ + function getNdefFormatable(tagInfo: TagInfo): NdefFormatableTag; + /** + * Parse a {@link TagInfo} object from Want. + * + * @param { Want } want - The want object that contains the values of TagInfo. + * @returns { TagInfo } The {@link TagInfo} object. + * @throws { BusinessError } 401 - The parameter check failed. Possible causes: + *
1. Mandatory parameters are left unspecified. + *
2. Incorrect parameters types. + *
3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.Communication.NFC.Tag + * @since 9 + */ + /** + * Parse a {@link TagInfo} object from Want. + * + * @param { Want } want - The want object that contains the values of TagInfo. + * @returns { TagInfo } The {@link TagInfo} object. + * @throws { BusinessError } 401 - The parameter check failed. Possible causes: + *
1. Mandatory parameters are left unspecified. + *
2. Incorrect parameters types. + *
3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.Communication.NFC.Tag + * @atomicservice + * @since 12 + */ + function getTagInfo(want: Want): TagInfo; + /** + * Register tag foreground dispatch. Dispatches to this application only if a tag discovered. + * + * @permission ohos.permission.NFC_TAG + * @param { ElementName } elementName - The element name of application, must include the bundleName and abilityName. + * @param { number[] } discTech - The technologies list to set for discovering. From {@link NFC_A} to {@link MIFARE_ULTRALIGHT}. + * @param { AsyncCallback } callback - The callback to dispatched the TagInfo object for application. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - The parameter check failed. Possible causes: + *
1. Mandatory parameters are left unspecified. + *
2. Incorrect parameters types. + *
3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.Communication.NFC.Tag + * @since 10 + */ + /** + * Register tag foreground dispatch. Dispatches to this application only if a tag discovered. + * + * @permission ohos.permission.NFC_TAG + * @param { ElementName } elementName - The element name of application, must include the bundleName and abilityName. + * @param { number[] } discTech - The technologies list to set for discovering. From {@link NFC_A} to {@link MIFARE_ULTRALIGHT}. + * @param { AsyncCallback } callback - The callback to dispatched the TagInfo object for application. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - The parameter check failed. Possible causes: + *
1. Mandatory parameters are left unspecified. + *
2. Incorrect parameters types. + *
3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 3100202 - The element state is invalid. + * @syscap SystemCapability.Communication.NFC.Tag + * @atomicservice + * @since 12 + */ + function registerForegroundDispatch(elementName: ElementName, discTech: number[], callback: AsyncCallback): void; + /** + * Unregister tag foreground dispatch. + * + * @permission ohos.permission.NFC_TAG + * @param { ElementName } elementName - The element name of application, must include the bundleName and abilityName. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - The parameter check failed. Possible causes: + *
1. Mandatory parameters are left unspecified. + *
2. Incorrect parameters types. + *
3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.Communication.NFC.Tag + * @since 10 + */ + /** + * Unregister tag foreground dispatch. + * + * @permission ohos.permission.NFC_TAG + * @param { ElementName } elementName - The element name of application, must include the bundleName and abilityName. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - The parameter check failed. Possible causes: + *
1. Mandatory parameters are left unspecified. + *
2. Incorrect parameters types. + *
3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.Communication.NFC.Tag + * @atomicservice + * @since 12 + */ + function unregisterForegroundDispatch(elementName: ElementName): void; + /** + * Set reader mode enabled when the specific application is foreground. Dispatches to this application only if a tag discovered. + * + * @permission ohos.permission.NFC_TAG + * @param { 'readerMode' } type - The callback type to be registered. + * @param { ElementName } elementName - The element name of application, must include the bundleName and abilityName. + * @param { number[] } discTech - The technologies list to set for discovering. From {@link NFC_A} to {@link MIFARE_ULTRALIGHT}. + * @param { AsyncCallback } callback - The callback to dispatched the TagInfo object for application. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - The parameter check failed. Possible causes: + *
1. Mandatory parameters are left unspecified. + *
2. Incorrect parameters types. + *
3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 3100202 - The element state is invalid. + * @syscap SystemCapability.Communication.NFC.Tag + * @since 11 + */ + /** + * Set reader mode enabled when the specific application is foreground. Dispatches to this application only if a tag discovered. + * + * @permission ohos.permission.NFC_TAG + * @param { 'readerMode' } type - The callback type to be registered. + * @param { ElementName } elementName - The element name of application, must include the bundleName and abilityName. + * @param { number[] } discTech - The technologies list to set for discovering. From {@link NFC_A} to {@link MIFARE_ULTRALIGHT}. + * @param { AsyncCallback } callback - The callback to dispatched the TagInfo object for application. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - The parameter check failed. Possible causes: + *
1. Mandatory parameters are left unspecified. + *
2. Incorrect parameters types. + *
3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 3100202 - The element state is invalid. + * @syscap SystemCapability.Communication.NFC.Tag + * @atomicservice + * @since 12 + */ + function on(type: 'readerMode', elementName: ElementName, discTech: number[], callback: AsyncCallback): void; + /** + * Disable foreground reader mode settings explicitly. + * + * @permission ohos.permission.NFC_TAG + * @param { 'readerMode' } type - The callback type to be unregistered. + * @param { ElementName } elementName - The element name of application, must include the bundleName and abilityName. + * @param { AsyncCallback } [callback] - The callback to dispatched the TagInfo object for application. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - The parameter check failed. Possible causes: + *
1. Mandatory parameters are left unspecified. + *
2. Incorrect parameters types. + *
3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 3100203 - The off() can be called only when the on() has been called. + * @syscap SystemCapability.Communication.NFC.Tag + * @since 11 + */ + /** + * Disable foreground reader mode settings explicitly. + * + * @permission ohos.permission.NFC_TAG + * @param { 'readerMode' } type - The callback type to be unregistered. + * @param { ElementName } elementName - The element name of application, must include the bundleName and abilityName. + * @param { AsyncCallback } [callback] - The callback to dispatched the TagInfo object for application. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - The parameter check failed. Possible causes: + *
1. Mandatory parameters are left unspecified. + *
2. Incorrect parameters types. + *
3. Parameter verification failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 3100203 - The off() can be called only when the on() has been called. + * @syscap SystemCapability.Communication.NFC.Tag + * @atomicservice + * @since 12 + */ + function off(type: 'readerMode', elementName: ElementName, callback?: AsyncCallback): void; + /** + * Provides tag information. + *

This class provides the technology a tag supports, for example, NFC-A. Applications can create + * different tags based on the supported technology. + * + * @typedef TagInfo + * @permission ohos.permission.NFC_TAG + * @syscap SystemCapability.Communication.NFC.Tag + * @since 7 + */ + /** + * Provides tag information. + *

This class provides the technology a tag supports, for example, NFC-A. Applications can create + * different tags based on the supported technology. + * + * @typedef TagInfo + * @permission ohos.permission.NFC_TAG + * @syscap SystemCapability.Communication.NFC.Tag + * @atomicservice + * @since 12 + */ + export interface TagInfo { + /** + * The uid of this tag, it. + * + * @permission ohos.permission.NFC_TAG + * @syscap SystemCapability.Communication.NFC.Tag + * @since 9 + */ + /** + * The uid of this tag, it. + * + * @permission ohos.permission.NFC_TAG + * @syscap SystemCapability.Communication.NFC.Tag + * @atomicservice + * @since 12 + */ + uid: number[]; + /** + * The supported technology list of this tag. + * + * @permission ohos.permission.NFC_TAG + * @syscap SystemCapability.Communication.NFC.Tag + * @since 9 + */ + /** + * The supported technology list of this tag. + * + * @permission ohos.permission.NFC_TAG + * @syscap SystemCapability.Communication.NFC.Tag + * @atomicservice + * @since 12 + */ + technology: number[]; + /** + * The supported technology list of this tag. + * + * @permission ohos.permission.NFC_TAG + * @syscap SystemCapability.Communication.NFC.Tag + * @since 7 + * @deprecated since 9 + * @useinstead ohos.nfc.tag/tag.TagInfo#technology + */ + supportedProfiles: number[]; + } + /** + * NDEF records definition, see NFCForum-TS-NDEF_1.0. + * + * @typedef NdefRecord + * @syscap SystemCapability.Communication.NFC.Tag + * @since 9 + */ + /** + * NDEF records definition, see NFCForum-TS-NDEF_1.0. + * + * @typedef NdefRecord + * @syscap SystemCapability.Communication.NFC.Tag + * @atomicservice + * @since 12 + */ + export interface NdefRecord { + /** + * tnf of NdefRecord + * + * @syscap SystemCapability.Communication.NFC.Tag + * @since 9 + */ + /** + * tnf of NdefRecord + * + * @syscap SystemCapability.Communication.NFC.Tag + * @atomicservice + * @since 12 + */ + tnf: number; + /** + * RTD type of NdefRecord + * + * @syscap SystemCapability.Communication.NFC.Tag + * @since 9 + */ + /** + * RTD type of NdefRecord + * + * @syscap SystemCapability.Communication.NFC.Tag + * @atomicservice + * @since 12 + */ + rtdType: number[]; + /** + * id of NdefRecord + * + * @syscap SystemCapability.Communication.NFC.Tag + * @since 9 + */ + /** + * id of NdefRecord + * + * @syscap SystemCapability.Communication.NFC.Tag + * @atomicservice + * @since 12 + */ + id: number[]; + /** + * payload of NdefRecord + * + * @syscap SystemCapability.Communication.NFC.Tag + * @since 9 + */ + /** + * payload of NdefRecord + * + * @syscap SystemCapability.Communication.NFC.Tag + * @atomicservice + * @since 12 + */ + payload: number[]; + } + /** + * Provides methods for accessing NDEF tag. + * + * @namespace ndef + * @syscap SystemCapability.Communication.NFC.Tag + * @since 9 + */ + /** + * Provides methods for accessing NDEF tag. + * + * @namespace ndef + * @syscap SystemCapability.Communication.NFC.Tag + * @atomicservice + * @since 12 + */ + namespace ndef { + /** + * Creates an NDEF record with uri data. + * + * @param { string } uri - Uri data for new NDEF record. + * @returns { NdefRecord } The instance of NdefRecord. + * @throws { BusinessError } 401 - The parameter check failed. Possible causes: + *
1. Mandatory parameters are left unspecified. + *
2. Incorrect parameters types. + *
3. Parameter verification failed. + * @syscap SystemCapability.Communication.NFC.Tag + * @since 9 + */ + /** + * Creates an NDEF record with uri data. + * + * @param { string } uri - Uri data for new NDEF record. + * @returns { NdefRecord } The instance of NdefRecord. + * @throws { BusinessError } 401 - The parameter check failed. Possible causes: + *
1. Mandatory parameters are left unspecified. + *
2. Incorrect parameters types. + *
3. Parameter verification failed. + * @syscap SystemCapability.Communication.NFC.Tag + * @atomicservice + * @since 12 + */ + function makeUriRecord(uri: string): NdefRecord; + /** + * Creates an NDEF record with text data. + * + * @param { string } text - Text data for new an NDEF record. + * @param { string } locale - Language code for the NDEF record. if locale is null, use default locale. + * @returns { NdefRecord } The instance of NdefRecord. + * @throws { BusinessError } 401 - The parameter check failed. Possible causes: + *
1. Mandatory parameters are left unspecified. + *
2. Incorrect parameters types. + *
3. Parameter verification failed. + * @syscap SystemCapability.Communication.NFC.Tag + * @since 9 + */ + /** + * Creates an NDEF record with text data. + * + * @param { string } text - Text data for new an NDEF record. + * @param { string } locale - Language code for the NDEF record. if locale is null, use default locale. + * @returns { NdefRecord } The instance of NdefRecord. + * @throws { BusinessError } 401 - The parameter check failed. Possible causes: + *
1. Mandatory parameters are left unspecified. + *
2. Incorrect parameters types. + *
3. Parameter verification failed. + * @syscap SystemCapability.Communication.NFC.Tag + * @atomicservice + * @since 12 + */ + function makeTextRecord(text: string, locale: string): NdefRecord; + /** + * Creates an NDEF record with mime data. + * + * @param { string } mimeType type of mime data for new an NDEF record. + * @param { number[] } mimeData mime data for new an NDEF record. + * @returns { NdefRecord } The instance of NdefRecord. + * @throws { BusinessError } 401 - The parameter check failed. Possible causes: + *
1. Mandatory parameters are left unspecified. + *
2. Incorrect parameters types. + *
3. Parameter verification failed. + * @syscap SystemCapability.Communication.NFC.Tag + * @since 9 + */ + /** + * Creates an NDEF record with mime data. + * + * @param { string } mimeType type of mime data for new an NDEF record. + * @param { number[] } mimeData mime data for new an NDEF record. + * @returns { NdefRecord } The instance of NdefRecord. + * @throws { BusinessError } 401 - The parameter check failed. Possible causes: + *
1. Mandatory parameters are left unspecified. + *
2. Incorrect parameters types. + *
3. Parameter verification failed. + * @syscap SystemCapability.Communication.NFC.Tag + * @atomicservice + * @since 12 + */ + function makeMimeRecord(mimeType: string, mimeData: number[]): NdefRecord; + /** + * Creates an NDEF record with external data. + * + * @param { string } domainName - Domain name of issuing organization for the external data. + * @param { string } type - Domain specific type of data for the external data. + * @param { number[] } externalData - Data payload of an NDEF record. + * @returns { NdefRecord } The instance of NdefRecord. + * @throws { BusinessError } 401 - The parameter check failed. Possible causes: + *
1. Mandatory parameters are left unspecified. + *
2. Incorrect parameters types. + *
3. Parameter verification failed. + * @syscap SystemCapability.Communication.NFC.Tag + * @since 9 + */ + /** + * Creates an NDEF record with external data. + * + * @param { string } domainName - Domain name of issuing organization for the external data. + * @param { string } type - Domain specific type of data for the external data. + * @param { number[] } externalData - Data payload of an NDEF record. + * @returns { NdefRecord } The instance of NdefRecord. + * @throws { BusinessError } 401 - The parameter check failed. Possible causes: + *
1. Mandatory parameters are left unspecified. + *
2. Incorrect parameters types. + *
3. Parameter verification failed. + * @syscap SystemCapability.Communication.NFC.Tag + * @atomicservice + * @since 12 + */ + function makeExternalRecord(domainName: string, type: string, externalData: number[]): NdefRecord; + /** + * Creates an NDEF message with raw bytes. + * + * @param { number[] } data - The raw bytes to parse NDEF message. + * @returns { NdefMessage } The instance of NdefMessage. + * @throws { BusinessError } 401 - The parameter check failed. Possible causes: + *
1. Mandatory parameters are left unspecified. + *
2. Incorrect parameters types. + *
3. Parameter verification failed. + * @syscap SystemCapability.Communication.NFC.Tag + * @since 9 + */ + /** + * Creates an NDEF message with raw bytes. + * + * @param { number[] } data - The raw bytes to parse NDEF message. + * @returns { NdefMessage } The instance of NdefMessage. + * @throws { BusinessError } 401 - The parameter check failed. Possible causes: + *
1. Mandatory parameters are left unspecified. + *
2. Incorrect parameters types. + *
3. Parameter verification failed. + * @syscap SystemCapability.Communication.NFC.Tag + * @atomicservice + * @since 12 + */ + function createNdefMessage(data: number[]): NdefMessage; + /** + * Creates an NDEF message with record list. + * + * @param { NdefRecord[] } ndefRecords - The NDEF records to parse NDEF message. + * @returns { NdefMessage } The instance of NdefMessage. + * @throws { BusinessError } 401 - The parameter check failed. Possible causes: + *
1. Mandatory parameters are left unspecified. + *
2. Incorrect parameters types. + *
3. Parameter verification failed. + * @syscap SystemCapability.Communication.NFC.Tag + * @since 9 + */ + /** + * Creates an NDEF message with record list. + * + * @param { NdefRecord[] } ndefRecords - The NDEF records to parse NDEF message. + * @returns { NdefMessage } The instance of NdefMessage. + * @throws { BusinessError } 401 - The parameter check failed. Possible causes: + *
1. Mandatory parameters are left unspecified. + *
2. Incorrect parameters types. + *
3. Parameter verification failed. + * @syscap SystemCapability.Communication.NFC.Tag + * @atomicservice + * @since 12 + */ + function createNdefMessage(ndefRecords: NdefRecord[]): NdefMessage; + /** + * Parses an NDEF message into raw bytes. + * + * @param { NdefMessage } ndefMessage - An NDEF message to parse. + * @returns { number[] } Returns the raw bytes of an NDEF message. + * @throws { BusinessError } 401 - The parameter check failed. + * @syscap SystemCapability.Communication.NFC.Tag + * @since 9 + */ + /** + * Parses an NDEF message into raw bytes. + * + * @param { NdefMessage } ndefMessage - An NDEF message to parse. + * @returns { number[] } Returns the raw bytes of an NDEF message. + * @throws { BusinessError } 401 - The parameter check failed. Possible causes: + *
1. Mandatory parameters are left unspecified. + *
2. Incorrect parameters types. + *
3. Parameter verification failed. + * @syscap SystemCapability.Communication.NFC.Tag + * @atomicservice + * @since 12 + */ + function messageToBytes(ndefMessage: NdefMessage): number[]; + } + /** + * Exports type NfcATag. + * + * @syscap SystemCapability.Communication.NFC.Tag + * @since 7 + */ + /** + * Exports type NfcATag. + * + * @syscap SystemCapability.Communication.NFC.Tag + * @atomicservice + * @since 12 + */ + export type NfcATag = _NfcATag; + /** + * Exports type NfcBTag. + * + * @syscap SystemCapability.Communication.NFC.Tag + * @since 7 + */ + /** + * Exports type NfcBTag. + * + * @syscap SystemCapability.Communication.NFC.Tag + * @atomicservice + * @since 12 + */ + export type NfcBTag = _NfcBTag; + /** + * Exports type NfcFTag. + * + * @syscap SystemCapability.Communication.NFC.Tag + * @since 7 + */ + /** + * Exports type NfcFTag. + * + * @syscap SystemCapability.Communication.NFC.Tag + * @atomicservice + * @since 12 + */ + export type NfcFTag = _NfcFTag; + /** + * Exports type NfcVTag. + * + * @syscap SystemCapability.Communication.NFC.Tag + * @since 7 + */ + /** + * Exports type NfcVTag. + * + * @syscap SystemCapability.Communication.NFC.Tag + * @atomicservice + * @since 12 + */ + export type NfcVTag = _NfcVTag; + /** + * Exports type IsoDepTag. + * + * @syscap SystemCapability.Communication.NFC.Tag + * @since 9 + */ + /** + * Exports type IsoDepTag. + * + * @syscap SystemCapability.Communication.NFC.Tag + * @atomicservice + * @since 12 + */ + export type IsoDepTag = _IsoDepTag; + /** + * Exports type NdefTag. + * + * @syscap SystemCapability.Communication.NFC.Tag + * @since 9 + */ + /** + * Exports type NdefTag. + * + * @syscap SystemCapability.Communication.NFC.Tag + * @atomicservice + * @since 12 + */ + export type NdefTag = _NdefTag; + /** + * Exports type MifareClassicTag. + * + * @syscap SystemCapability.Communication.NFC.Tag + * @since 9 + */ + /** + * Exports type MifareClassicTag. + * + * @syscap SystemCapability.Communication.NFC.Tag + * @atomicservice + * @since 12 + */ + export type MifareClassicTag = _MifareClassicTag; + /** + * Exports type MifareUltralightTag. + * + * @syscap SystemCapability.Communication.NFC.Tag + * @since 9 + */ + /** + * Exports type MifareUltralightTag. + * + * @syscap SystemCapability.Communication.NFC.Tag + * @atomicservice + * @since 12 + */ + export type MifareUltralightTag = _MifareUltralightTag; + /** + * Exports type NdefFormatableTag. + * + * @syscap SystemCapability.Communication.NFC.Tag + * @since 9 + */ + /** + * Exports type NdefFormatableTag. + * + * @syscap SystemCapability.Communication.NFC.Tag + * @atomicservice + * @since 12 + */ + export type NdefFormatableTag = _NdefFormatableTag; + /** + * Exports type NdefMessage. + * + * @syscap SystemCapability.Communication.NFC.Tag + * @since 9 + */ + /** + * Exports type NdefMessage. + * + * @syscap SystemCapability.Communication.NFC.Tag + * @atomicservice + * @since 12 + */ + export type NdefMessage = _NdefMessage; + /** + * Exports type TagSession. + * + * @syscap SystemCapability.Communication.NFC.Tag + * @since 7 + */ + /** + * Exports type TagSession. + * + * @syscap SystemCapability.Communication.NFC.Tag + * @atomicservice + * @since 12 + */ + export type TagSession = _TagSession; +} +export default tag; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.notification.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.notification.d.ts new file mode 100755 index 00000000..0e68ec14 --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.notification.d.ts @@ -0,0 +1,588 @@ +/* + * Copyright (c) 2021-2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"), + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { AsyncCallback } from './@ohos.base'; +import { NotificationRequest } from './notification/notificationRequest'; +import { NotificationSlot } from './notification/notificationSlot'; +/** + * Manages notifications. + *

Generally, only system applications have permissions on notification subscription and unsubscribe. + * You can specify the content of a notification to be published and the content is carried by + * {@link NotificationRequest}. A notification ID is unique in an application and must be specified + * when using {@link NotificationRequest} to carry the notification content. If a notification + * with this ID has been published and you need to use this ID to publish another notification, + * the original notification will be updated. In addition, the notification ID can be used to cancel + * a notification by calling the {@link #cancel(int)} method. + * + * @namespace notification + * @syscap SystemCapability.Notification.Notification + * @since 7 + * @deprecated since 9 + * @useinstead ohos.notificationManager/notificationManager and ohos.notificationSubscribe/notificationSubscribe + */ +declare namespace notification { + /** + * Publishes a notification. + *

If a notification with the same ID has been published by the current application and has not been deleted, + * this method will update the notification. + * + * @param { NotificationRequest } request - notification request + * @param { AsyncCallback } callback - callback function + * @syscap SystemCapability.Notification.Notification + * @since 7 + * @deprecated since 9 + * @useinstead ohos.notificationManager/notificationManager#publish + */ + function publish(request: NotificationRequest, callback: AsyncCallback): void; + /** + * Publishes a notification. + *

If a notification with the same ID has been published by the current application and has not been deleted, + * this method will update the notification. + * + * @param { NotificationRequest } request - notification request + * @returns { Promise } the promise returned by the function. + * @syscap SystemCapability.Notification.Notification + * @since 7 + * @deprecated since 9 + * @useinstead ohos.notificationManager/notificationManager#publish + */ + function publish(request: NotificationRequest): Promise; + /** + * Cancel a notification with the specified ID. + * + * @param { number } id - of the notification to cancel, which must be unique in the application. + * @param { AsyncCallback } callback - callback function + * @syscap SystemCapability.Notification.Notification + * @since 7 + * @deprecated since 9 + * @useinstead ohos.notificationManager/notificationManager#cancel + */ + function cancel(id: number, callback: AsyncCallback): void; + /** + * Cancel a notification with the specified label and ID. + * + * @param { number } id - ID of the notification to cancel, which must be unique in the application. + * @param { string } label - Label of the notification to cancel. + * @param { AsyncCallback } callback - callback function + * @syscap SystemCapability.Notification.Notification + * @since 7 + * @deprecated since 9 + * @useinstead ohos.notificationManager/notificationManager#cancel + */ + function cancel(id: number, label: string, callback: AsyncCallback): void; + /** + * Cancel a notification with the specified label and ID. + * + * @param { number } id - ID of the notification to cancel, which must be unique in the application. + * @param { string } [label] - Label of the notification to cancel. + * @returns { Promise } the promise returned by the function. + * @syscap SystemCapability.Notification.Notification + * @since 7 + * @deprecated since 9 + * @useinstead ohos.notificationManager/notificationManager#cancel + */ + function cancel(id: number, label?: string): Promise; + /** + * Cancels all notifications of the current application. + * + * @param { AsyncCallback } callback - The specified callback method. + * @syscap SystemCapability.Notification.Notification + * @since 7 + * @deprecated since 9 + * @useinstead ohos.notificationManager/notificationManager#cancelAll + */ + function cancelAll(callback: AsyncCallback): void; + /** + * Cancels all notifications of the current application. + * + * @returns { Promise } the promise returned by the function. + * @syscap SystemCapability.Notification.Notification + * @since 7 + * @deprecated since 9 + * @useinstead ohos.notificationManager/notificationManager#cancelAll + */ + function cancelAll(): Promise; + /** + * Adds a slot type. + * + * @param { SlotType } type - Slot type to add. + * @param { AsyncCallback } callback - callback function + * @syscap SystemCapability.Notification.Notification + * @since 7 + * @deprecated since 9 + * @useinstead ohos.notificationManager/notificationManager#addSlot + */ + function addSlot(type: SlotType, callback: AsyncCallback): void; + /** + * Adds a slot type. + * + * @param { SlotType } type - Slot type to add. + * @returns { Promise } the promise returned by the function. + * @syscap SystemCapability.Notification.Notification + * @since 7 + * @deprecated since 9 + * @useinstead ohos.notificationManager/notificationManager#addSlot + */ + function addSlot(type: SlotType): Promise; + /** + * Obtains a notification slot of the specified slot type. + * + * @param { SlotType } slotType - Type of the notification slot to obtain. + * @param { AsyncCallback } callback - callback function + * @syscap SystemCapability.Notification.Notification + * @since 7 + * @deprecated since 9 + * @useinstead ohos.notificationManager/notificationManager#getSlot + */ + function getSlot(slotType: SlotType, callback: AsyncCallback): void; + /** + * Obtains a notification slot of the specified slot type. + * + * @param { SlotType } slotType - Type of the notification slot to obtain. + * @returns { Promise } Returns the created {@link NotificationSlot}. + * @syscap SystemCapability.Notification.Notification + * @since 7 + * @deprecated since 9 + * @useinstead ohos.notificationManager/notificationManager#getSlot + */ + function getSlot(slotType: SlotType): Promise; + /** + * Obtains all NotificationSlot objects created by the current application. + * + * @param { AsyncCallback> } callback - Returns the result of obtaining all notification + * channels for this application in the form of callback. + * @syscap SystemCapability.Notification.Notification + * @since 7 + * @deprecated since 9 + * @useinstead ohos.notificationManager/notificationManager#getSlots + */ + function getSlots(callback: AsyncCallback>): void; + /** + * Obtains all NotificationSlot objects created by the current application. + * + * @returns { Promise> } Returns all notification slots of this application. + * @syscap SystemCapability.Notification.Notification + * @since 7 + * @deprecated since 9 + * @useinstead ohos.notificationManager/notificationManager#getSlots + */ + function getSlots(): Promise>; + /** + * Removes a NotificationSlot of the specified SlotType created by the current application. + * + * @param { SlotType } slotType - Type of the NotificationSlot to remove. + * @param { AsyncCallback } callback - callback function + * @syscap SystemCapability.Notification.Notification + * @since 7 + * @deprecated since 9 + * @useinstead ohos.notificationManager/notificationManager#removeSlot + */ + function removeSlot(slotType: SlotType, callback: AsyncCallback): void; + /** + * Removes a NotificationSlot of the specified SlotType created by the current application. + * + * @param { SlotType } slotType - The types of notification channels are currently divided into social communication, + * service reminders, content consulting, and other types + * @returns { Promise } Returns all notification slots of this application. + * @syscap SystemCapability.Notification.Notification + * @since 7 + * @deprecated since 9 + * @useinstead ohos.notificationManager/notificationManager#removeSlot + */ + function removeSlot(slotType: SlotType): Promise; + /** + * Removes all NotificationSlot objects created by the current application. + * + * @param { AsyncCallback } callback - Represents the specified callback method. + * @syscap SystemCapability.Notification.Notification + * @since 7 + * @deprecated since 9 + * @useinstead ohos.notificationManager/notificationManager#removeAllSlots + */ + function removeAllSlots(callback: AsyncCallback): void; + /** + * Removes all NotificationSlot objects created by the current application. + * + * @returns { Promise } Returns all notification slots of this application. + * @syscap SystemCapability.Notification.Notification + * @since 7 + * @deprecated since 9 + * @useinstead ohos.notificationManager/notificationManager#removeAllSlots + */ + function removeAllSlots(): Promise; + /** + * Describes NotificationSlot types. + * + * @enum { number } + * @syscap SystemCapability.Notification.Notification + * @since 7 + * @deprecated since 9 + * @useinstead ohos.notificationManager/notificationManager#SlotType + */ + export enum SlotType { + /** + * NotificationSlot of an unknown type. + * + * @syscap SystemCapability.Notification.Notification + * @since 7 + * @deprecated since 9 + * @useinstead ohos.notificationManager/notificationManager.SlotType#UNKNOWN_TYPE + */ + UNKNOWN_TYPE = 0, + /** + * NotificationSlot for social communication. + * + * @syscap SystemCapability.Notification.Notification + * @since 7 + * @deprecated since 9 + * @useinstead ohos.notificationManager/notificationManager.SlotType#SOCIAL_COMMUNICATION + */ + SOCIAL_COMMUNICATION = 1, + /** + * NotificationSlot for service information. + * + * @syscap SystemCapability.Notification.Notification + * @since 7 + * @deprecated since 9 + * @useinstead ohos.notificationManager/notificationManager.SlotType#SERVICE_INFORMATION + */ + SERVICE_INFORMATION = 2, + /** + * NotificationSlot for content information. + * + * @syscap SystemCapability.Notification.Notification + * @since 7 + * @deprecated since 9 + * @useinstead ohos.notificationManager/notificationManager.SlotType#CONTENT_INFORMATION + */ + CONTENT_INFORMATION = 3, + /** + * NotificationSlot for other purposes. + * + * @syscap SystemCapability.Notification.Notification + * @since 7 + * @deprecated since 9 + * @useinstead ohos.notificationManager/notificationManager.SlotType#OTHER_TYPES + */ + OTHER_TYPES = 0xFFFF + } + /** + * Describes notification content types. + * + * @enum { string } + * @syscap SystemCapability.Notification.Notification + * @since 7 + * @deprecated since 9 + * @useinstead ohos.notificationManager/notificationManager.SlotType#ContentType + */ + export enum ContentType { + /** + * Normal text notification. + * + * @syscap SystemCapability.Notification.Notification + * @since 7 + * @deprecated since 9 + * @useinstead ohos.notificationManager/notificationManager.ContentType#NOTIFICATION_CONTENT_BASIC_TEXT + */ + NOTIFICATION_CONTENT_BASIC_TEXT, + /** + * Long text notification. + * + * @syscap SystemCapability.Notification.Notification + * @since 7 + * @deprecated since 9 + * @useinstead ohos.notificationManager/notificationManager.ContentType#NOTIFICATION_CONTENT_LONG_TEXT + */ + NOTIFICATION_CONTENT_LONG_TEXT, + /** + * Picture-attached notification. + * + * @syscap SystemCapability.Notification.Notification + * @since 7 + * @deprecated since 9 + * @useinstead ohos.notificationManager/notificationManager.ContentType#NOTIFICATION_CONTENT_PICTURE + */ + NOTIFICATION_CONTENT_PICTURE, + /** + * Conversation notification. + * + * @syscap SystemCapability.Notification.Notification + * @since 7 + * @deprecated since 9 + * @useinstead ohos.notificationManager/notificationManager.ContentType#NOTIFICATION_CONTENT_CONVERSATION + */ + NOTIFICATION_CONTENT_CONVERSATION, + /** + * Multi-line text notification. + * + * @syscap SystemCapability.Notification.Notification + * @since 7 + * @deprecated since 9 + * @useinstead ohos.notificationManager/notificationManager.ContentType#NOTIFICATION_CONTENT_MULTILINE + */ + NOTIFICATION_CONTENT_MULTILINE + } + /** + * Indicates the level of the slot + * + * @enum { number } + * @syscap SystemCapability.Notification.Notification + * @since 7 + * @deprecated since 9 + * @useinstead ohos.notificationManager/notificationManager#SlotLevel + */ + export enum SlotLevel { + /** + * Indicates that the notification function is disabled. + * + * @syscap SystemCapability.Notification.Notification + * @since 7 + * @deprecated since 9 + * @useinstead ohos.notificationManager/notificationManager.SlotLevel#LEVEL_NONE + */ + LEVEL_NONE = 0, + /** + * Indicates that the notification function is enabled but notification + * icons are not displayed in the status bar, with no banner or prompt tone. + * + * @syscap SystemCapability.Notification.Notification + * @since 7 + * @deprecated since 9 + * @useinstead ohos.notificationManager/notificationManager.SlotLevel#LEVEL_MIN + */ + LEVEL_MIN = 1, + /** + * Indicates that the notification function is enabled and notification + * icons are displayed in the status bar, with no banner or prompt tone. + * + * @syscap SystemCapability.Notification.Notification + * @since 7 + * @deprecated since 9 + * @useinstead ohos.notificationManager/notificationManager.SlotLevel#LEVEL_LOW + */ + LEVEL_LOW = 2, + /** + * Indicates that the notification function is enabled and notification + * icons are displayed in the status bar, with no banner but with a prompt tone. + * + * @syscap SystemCapability.Notification.Notification + * @since 7 + * @deprecated since 9 + * @useinstead ohos.notificationManager/notificationManager.SlotLevel#LEVEL_DEFAULT + */ + LEVEL_DEFAULT = 3, + /** + * Indicates that the notification function is enabled and notification + * icons are displayed in the status bar, with a banner and a prompt tone. + * + * @syscap SystemCapability.Notification.Notification + * @since 7 + * @deprecated since 9 + * @useinstead ohos.notificationManager/notificationManager.SlotLevel#LEVEL_HIGH + */ + LEVEL_HIGH = 4 + } + /** + * Obtains the number of all active notifications. + * + * @param { AsyncCallback } callback - Callback function to obtain the number of undelete notifications. + * @syscap SystemCapability.Notification.Notification + * @since 7 + * @deprecated since 9 + * @useinstead ohos.notificationManager/notificationManager#getActiveNotificationCount + */ + function getActiveNotificationCount(callback: AsyncCallback): void; + /** + * Obtains the number of all active notifications. + * + * @returns { Promise } Returns the number of undelete notifications for the current application as promise. + * @syscap SystemCapability.Notification.Notification + * @since 7 + * @deprecated since 9 + * @useinstead ohos.notificationManager/notificationManager#getActiveNotificationCount + */ + function getActiveNotificationCount(): Promise; + /** + * Obtains an array of active notifications. + * + * @param { AsyncCallback> } callback - Retrieve the callback function for the current + * application notification list. + * @syscap SystemCapability.Notification.Notification + * @since 7 + * @deprecated since 9 + * @useinstead ohos.notificationManager/notificationManager#getActiveNotifications + */ + function getActiveNotifications(callback: AsyncCallback>): void; + /** + * Obtains an array of active notifications. + * + * @returns { Promise> } Return to obtain the current application in the form of Promise. + * @syscap SystemCapability.Notification.Notification + * @since 7 + * @deprecated since 9 + * @useinstead ohos.notificationManager/notificationManager#getActiveNotifications + */ + function getActiveNotifications(): Promise>; + /** + * Cancel the notification of a specified group for this application. + * + * @param { string } groupName - Notification group name, which needs to be specified through the NotificationRequest + * object when publishing notifications. + * @param { AsyncCallback } callback - Cancel the callback function for notifications under the specified group + * of this application. + * @syscap SystemCapability.Notification.Notification + * @since 8 + * @deprecated since 9 + * @useinstead ohos.notificationManager/notificationManager#cancelGroup + */ + function cancelGroup(groupName: string, callback: AsyncCallback): void; + /** + * Cancel the notification of a specified group for this application. + * + * @param { string } groupName - Notification group name. + * @returns { Promise } the promise returned by the function. + * @syscap SystemCapability.Notification.Notification + * @since 8 + * @deprecated since 9 + * @useinstead ohos.notificationManager/notificationManager#cancelGroup + */ + function cancelGroup(groupName: string): Promise; + /** + * Obtains whether the template is supported by the system. + * + * @param { string } templateName - Name of template to be Obtained + * @param { AsyncCallback } callback - callback function + * @syscap SystemCapability.Notification.Notification + * @since 8 + * @deprecated since 9 + * @useinstead ohos.notificationManager/notificationManager#isSupportTemplate + */ + function isSupportTemplate(templateName: string, callback: AsyncCallback): void; + /** + * Obtains whether the template is supported by the system. + * + * @param { string } templateName - Name of template to be Obtained + * @returns { Promise } The Promise method returns the result of whether the template exists. + * @syscap SystemCapability.Notification.Notification + * @since 8 + * @deprecated since 9 + * @useinstead ohos.notificationManager/notificationManager#isSupportTemplate + */ + function isSupportTemplate(templateName: string): Promise; + /** + * Request permission to send notification. + * + * @param { AsyncCallback } callback - Application Request Notification Enable Callback Function. + * @syscap SystemCapability.Notification.Notification + * @since 8 + * @deprecated since 9 + * @useinstead ohos.notificationManager/notificationManager#requestEnableNotification + */ + function requestEnableNotification(callback: AsyncCallback): void; + /** + * Request permission to send notification. + * + * @returns { Promise } the promise returned by the function. + * @syscap SystemCapability.Notification.Notification + * @since 8 + * @deprecated since 9 + * @useinstead ohos.notificationManager/notificationManager#requestEnableNotification + */ + function requestEnableNotification(): Promise; + /** + * Obtains whether the device supports distributed notification. + * + * @param { AsyncCallback } callback - Set whether the device supports callback functions for distributed + * notifications. + * @syscap SystemCapability.Notification.Notification + * @since 8 + * @deprecated since 9 + * @useinstead ohos.notificationManager/notificationManager#isDistributedEnabled + */ + function isDistributedEnabled(callback: AsyncCallback): void; + /** + * Obtains whether the device supports distributed notification. + * + * @returns { Promise } Returns the result of obtaining whether distributed notifications are supported in + * the form of Promise. + * @syscap SystemCapability.Notification.Notification + * @since 8 + * @deprecated since 9 + * @useinstead ohos.notificationManager/notificationManager#isDistributedEnabled + */ + function isDistributedEnabled(): Promise; + /** + * Describes a BundleOption. + * + * @typedef BundleOption + * @syscap SystemCapability.Notification.Notification + * @since 7 + * @deprecated since 9 + * @useinstead ohos.notificationManager/notificationManager#BundleOption + */ + export interface BundleOption { + /** + * bundle name. + * + * @type { string } + * @syscap SystemCapability.Notification.Notification + * @since 7 + * @deprecated since 9 + * @useinstead ohos.notificationManager/notificationManager#BundleOption + */ + bundle: string; + /** + * user id. + * + * @type { ?number } + * @syscap SystemCapability.Notification.Notification + * @since 7 + * @deprecated since 9 + * @useinstead ohos.notificationManager/notificationManager#BundleOption + */ + uid?: number; + } + /** + * Describes a NotificationKey, which can be used to identify a notification. + * + * @typedef NotificationKey + * @syscap SystemCapability.Notification.Notification + * @since 7 + * @deprecated since 9 + * @useinstead ohos.notificationManager/notificationManager#NotificationKey + */ + export interface NotificationKey { + /** + * Notify ID. + * + * @type { number } + * @syscap SystemCapability.Notification.Notification + * @since 7 + * @deprecated since 9 + * @useinstead ohos.notificationManager/notificationManager#NotificationKey + */ + id: number; + /** + * Notification label. + * + * @type { ?string } + * @syscap SystemCapability.Notification.Notification + * @since 7 + * @deprecated since 9 + * @useinstead ohos.notificationManager/notificationManager#NotificationKey + */ + label?: string; + } +} +export default notification; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.notificationManager.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.notificationManager.d.ts new file mode 100755 index 00000000..81a764f7 --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.notificationManager.d.ts @@ -0,0 +1,1163 @@ +/* + * Copyright (c) 2022-2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"), + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit NotificationKit + */ +import { AsyncCallback } from './@ohos.base'; +import { BundleOption as _BundleOption } from './notification/NotificationCommonDef'; +import { NotificationActionButton as _NotificationActionButton } from './notification/notificationActionButton'; +import { NotificationBasicContent as _NotificationBasicContent } from './notification/notificationContent'; +import { NotificationContent as _NotificationContent } from './notification/notificationContent'; +import { NotificationLongTextContent as _NotificationLongTextContent } from './notification/notificationContent'; +import { NotificationMultiLineContent as _NotificationMultiLineContent } from './notification/notificationContent'; +import { NotificationPictureContent as _NotificationPictureContent } from './notification/notificationContent'; +import { NotificationSystemLiveViewContent as _NotificationSystemLiveViewContent } from './notification/notificationContent'; +import { NotificationCapsule as _NotificationCapsule } from './notification/notificationContent'; +import { NotificationButton as _NotificationButton } from './notification/notificationContent'; +import { NotificationTime as _NotificationTime } from './notification/notificationContent'; +import { NotificationProgress as _NotificationProgress } from './notification/notificationContent'; +import { NotificationRequest as _NotificationRequest } from './notification/notificationRequest'; +import { DistributedOptions as _DistributedOptions } from './notification/notificationRequest'; +import { NotificationSlot as _NotificationSlot } from './notification/notificationSlot'; +import { NotificationTemplate as _NotificationTemplate } from './notification/notificationTemplate'; +import { NotificationUserInput as _NotificationUserInput } from './notification/notificationUserInput'; +import type UIAbilityContext from './application/UIAbilityContext'; +/** + * Manages notifications. + *

Generally, only system applications have permissions on notification subscription and unsubscribe. + * You can specify the content of a notification to be published and the content is carried by + * {@link NotificationRequest}. A notification ID is unique in an application and must be specified + * when using {@link NotificationRequest} to carry the notification content. If a notification + * with this ID has been published and you need to use this ID to publish another notification, + * the original notification will be updated. In addition, the notification ID can be used to cancel + * a notification by calling the {@link #cancel(int)} method. + * + * @namespace notificationManager + * @syscap SystemCapability.Notification.Notification + * @since 9 + */ +declare namespace notificationManager { + /** + * Publishes a notification. + *

If a notification with the same ID has been published by the current application and has not been deleted, + * this method will update the notification. + * + * @param { NotificationRequest } request - notification request + * @param { AsyncCallback } callback - The callback of publish. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 1600001 - Internal error. + * @throws { BusinessError } 1600002 - Marshalling or unmarshalling error. + * @throws { BusinessError } 1600003 - Failed to connect service. + * @throws { BusinessError } 1600004 - Notification is not enabled. + * @throws { BusinessError } 1600005 - Notification slot is not enabled. + * @throws { BusinessError } 1600009 - Over max number notifications per second. + * @throws { BusinessError } 1600012 - No memory space. + * @syscap SystemCapability.Notification.Notification + * @since 9 + */ + /** + * Publishes a notification. + *

If a notification with the same ID has been published by the current application and has not been deleted, + * this method will update the notification. + * + * @param { NotificationRequest } request - notification request + * @param { AsyncCallback } callback - The callback of publish. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 1600001 - Internal error. + * @throws { BusinessError } 1600002 - Marshalling or unmarshalling error. + * @throws { BusinessError } 1600003 - Failed to connect service. + * @throws { BusinessError } 1600004 - Notification is not enabled. + * @throws { BusinessError } 1600005 - Notification slot is not enabled. + * @throws { BusinessError } 1600007 - The notification is not exist. + * @throws { BusinessError } 1600009 - Over max number notifications per second. + * @throws { BusinessError } 1600012 - No memory space. + * @throws { BusinessError } 1600014 - No relevant right. + * @throws { BusinessError } 1600015 - The current notification status does not support duplicate configurations. + * @throws { BusinessError } 1600016 - The notification version for this update is too low. + * @throws { BusinessError } 2300007 - Network is unreachable. + * @syscap SystemCapability.Notification.Notification + * @since 11 + */ + /** + * Publishes a notification. + *

If a notification with the same ID has been published by the current application and has not been deleted, + * this method will update the notification. + * + * @param { NotificationRequest } request - notification request + * @param { AsyncCallback } callback - The callback of publish. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 1600001 - Internal error. + * @throws { BusinessError } 1600002 - Marshalling or unmarshalling error. + * @throws { BusinessError } 1600003 - Failed to connect to the service. + * @throws { BusinessError } 1600004 - Notification disabled. + * @throws { BusinessError } 1600005 - Notification slot disabled. + * @throws { BusinessError } 1600007 - The notification does not exist. + * @throws { BusinessError } 1600009 - The notification sending frequency reaches the upper limit. + * @throws { BusinessError } 1600012 - No memory space. + * @throws { BusinessError } 1600014 - No relevant right. + * @throws { BusinessError } 1600015 - The current notification status does not support duplicate configurations. + * @throws { BusinessError } 1600016 - The notification version for this update is too low. + * @throws { BusinessError } 2300007 - Network is unreachable. + * @syscap SystemCapability.Notification.Notification + * @crossplatform + * @since 12 + */ + function publish(request: NotificationRequest, callback: AsyncCallback): void; + /** + * Publishes a notification. + *

If a notification with the same ID has been published by the current application and has not been deleted, + * this method will update the notification. + * + * @param { NotificationRequest } request - notification request + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 1600001 - Internal error. + * @throws { BusinessError } 1600002 - Marshalling or unmarshalling error. + * @throws { BusinessError } 1600003 - Failed to connect service. + * @throws { BusinessError } 1600004 - Notification is not enabled. + * @throws { BusinessError } 1600005 - Notification slot is not enabled. + * @throws { BusinessError } 1600009 - Over max number notifications per second. + * @throws { BusinessError } 1600012 - No memory space. + * @syscap SystemCapability.Notification.Notification + * @since 9 + */ + /** + * Publishes a notification. + *

If a notification with the same ID has been published by the current application and has not been deleted, + * this method will update the notification. + * + * @param { NotificationRequest } request - notification request + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 1600001 - Internal error. + * @throws { BusinessError } 1600002 - Marshalling or unmarshalling error. + * @throws { BusinessError } 1600003 - Failed to connect service. + * @throws { BusinessError } 1600004 - Notification is not enabled. + * @throws { BusinessError } 1600005 - Notification slot is not enabled. + * @throws { BusinessError } 1600007 - The notification is not exist. + * @throws { BusinessError } 1600009 - Over max number notifications per second. + * @throws { BusinessError } 1600012 - No memory space. + * @throws { BusinessError } 1600014 - No relevant right. + * @throws { BusinessError } 1600015 - The current notification status does not support duplicate configurations. + * @throws { BusinessError } 1600016 - The notification version for this update is too low. + * @throws { BusinessError } 2300007 - Network is unreachable. + * @syscap SystemCapability.Notification.Notification + * @since 11 + */ + /** + * Publishes a notification. + *

If a notification with the same ID has been published by the current application and has not been deleted, + * this method will update the notification. + * + * @param { NotificationRequest } request - notification request + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 1600001 - Internal error. + * @throws { BusinessError } 1600002 - Marshalling or unmarshalling error. + * @throws { BusinessError } 1600003 - Failed to connect to the service. + * @throws { BusinessError } 1600004 - Notification disabled. + * @throws { BusinessError } 1600005 - Notification slot disabled. + * @throws { BusinessError } 1600007 - The notification does not exist. + * @throws { BusinessError } 1600009 - The notification sending frequency reaches the upper limit. + * @throws { BusinessError } 1600012 - No memory space. + * @throws { BusinessError } 1600014 - No relevant right. + * @throws { BusinessError } 1600015 - The current notification status does not support duplicate configurations. + * @throws { BusinessError } 1600016 - The notification version for this update is too low. + * @throws { BusinessError } 2300007 - Network is unreachable. + * @syscap SystemCapability.Notification.Notification + * @crossplatform + * @since 12 + */ + function publish(request: NotificationRequest): Promise; + /** + * Cancel a notification with the specified ID. + * + * @param { number } id - ID of the notification to cancel, which must be unique in the application. + * @param { AsyncCallback } callback - The callback of cancel. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 1600001 - Internal error. + * @throws { BusinessError } 1600002 - Marshalling or unmarshalling error. + * @throws { BusinessError } 1600003 - Failed to connect service. + * @throws { BusinessError } 1600007 - The notification is not exist. + * @syscap SystemCapability.Notification.Notification + * @since 9 + */ + /** + * Cancel a notification with the specified ID. + * + * @param { number } id - ID of the notification to cancel, which must be unique in the application. + * @param { AsyncCallback } callback - The callback of cancel. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 1600001 - Internal error. + * @throws { BusinessError } 1600002 - Marshalling or unmarshalling error. + * @throws { BusinessError } 1600003 - Failed to connect to the service. + * @throws { BusinessError } 1600007 - The notification does not exist. + * @syscap SystemCapability.Notification.Notification + * @crossplatform + * @since 12 + */ + function cancel(id: number, callback: AsyncCallback): void; + /** + * Cancel a notification with the specified label and ID. + * + * @param { number } id - ID of the notification to cancel, which must be unique in the application. + * @param { string } label - Label of the notification to cancel. + * @param { AsyncCallback } callback - The callback of cancel. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 1600001 - Internal error. + * @throws { BusinessError } 1600002 - Marshalling or unmarshalling error. + * @throws { BusinessError } 1600003 - Failed to connect service. + * @throws { BusinessError } 1600007 - The notification is not exist. + * @syscap SystemCapability.Notification.Notification + * @since 9 + */ + function cancel(id: number, label: string, callback: AsyncCallback): void; + /** + * Cancel a notification with the specified label and ID. + * + * @param { number } id - ID of the notification to cancel, which must be unique in the application. + * @param { string } [label] - Label of the notification to cancel. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 1600001 - Internal error. + * @throws { BusinessError } 1600002 - Marshalling or unmarshalling error. + * @throws { BusinessError } 1600003 - Failed to connect service. + * @throws { BusinessError } 1600007 - The notification is not exist. + * @syscap SystemCapability.Notification.Notification + * @since 9 + */ + function cancel(id: number, label?: string): Promise; + /** + * Cancel all notifications of the current application. + * + * @param { AsyncCallback } callback - The callback of cancelAll. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 1600001 - Internal error. + * @throws { BusinessError } 1600002 - Marshalling or unmarshalling error. + * @throws { BusinessError } 1600003 - Failed to connect service. + * @syscap SystemCapability.Notification.Notification + * @since 9 + */ + /** + * Cancel all notifications of the current application. + * + * @param { AsyncCallback } callback - The callback of cancelAll. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 1600001 - Internal error. + * @throws { BusinessError } 1600002 - Marshalling or unmarshalling error. + * @throws { BusinessError } 1600003 - Failed to connect to the service. + * @syscap SystemCapability.Notification.Notification + * @crossplatform + * @since 12 + */ + function cancelAll(callback: AsyncCallback): void; + /** + * Cancel all notifications of the current application. + * + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 1600001 - Internal error. + * @throws { BusinessError } 1600002 - Marshalling or unmarshalling error. + * @throws { BusinessError } 1600003 - Failed to connect service. + * @syscap SystemCapability.Notification.Notification + * @since 9 + */ + /** + * Cancel all notifications of the current application. + * + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 1600001 - Internal error. + * @throws { BusinessError } 1600002 - Marshalling or unmarshalling error. + * @throws { BusinessError } 1600003 - Failed to connect to the service. + * @syscap SystemCapability.Notification.Notification + * @crossplatform + * @since 12 + */ + function cancelAll(): Promise; + /** + * Adds a slot type. + * + * @param { SlotType } type - Slot type to add. + * @param { AsyncCallback } callback - The callback of addSlot. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 1600001 - Internal error. + * @throws { BusinessError } 1600002 - Marshalling or unmarshalling error. + * @throws { BusinessError } 1600003 - Failed to connect service. + * @throws { BusinessError } 1600012 - No memory space. + * @syscap SystemCapability.Notification.Notification + * @since 9 + */ + function addSlot(type: SlotType, callback: AsyncCallback): void; + /** + * Adds a slot type. + * + * @param { SlotType } type - Slot type to add. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 1600001 - Internal error. + * @throws { BusinessError } 1600002 - Marshalling or unmarshalling error. + * @throws { BusinessError } 1600003 - Failed to connect service. + * @throws { BusinessError } 1600012 - No memory space. + * @syscap SystemCapability.Notification.Notification + * @since 9 + */ + function addSlot(type: SlotType): Promise; + /** + * Obtains a notification slot of the specified slot type. + * + * @param { SlotType } slotType - Type of the notification slot to obtain. + * @param { AsyncCallback } callback - The callback is used to return the NotificationSlot. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 1600001 - Internal error. + * @throws { BusinessError } 1600002 - Marshalling or unmarshalling error. + * @throws { BusinessError } 1600003 - Failed to connect service. + * @syscap SystemCapability.Notification.Notification + * @since 9 + */ + function getSlot(slotType: SlotType, callback: AsyncCallback): void; + /** + * Obtains a notification slot of the specified slot type. + * + * @param { SlotType } slotType - Type of the notification slot to obtain. + * @returns { Promise } Returns the NotificationSlot. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 1600001 - Internal error. + * @throws { BusinessError } 1600002 - Marshalling or unmarshalling error. + * @throws { BusinessError } 1600003 - Failed to connect service. + * @syscap SystemCapability.Notification.Notification + * @since 9 + */ + function getSlot(slotType: SlotType): Promise; + /** + * Obtains all NotificationSlot objects created by the current application. + * + * @param { AsyncCallback> } callback - The callback is used to return all notification slots + * of this application. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 1600001 - Internal error. + * @throws { BusinessError } 1600002 - Marshalling or unmarshalling error. + * @throws { BusinessError } 1600003 - Failed to connect service. + * @syscap SystemCapability.Notification.Notification + * @since 9 + */ + function getSlots(callback: AsyncCallback>): void; + /** + * Obtains all NotificationSlot objects created by the current application. + * + * @returns { Promise> } Returns all notification slots of this application. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 1600001 - Internal error. + * @throws { BusinessError } 1600002 - Marshalling or unmarshalling error. + * @throws { BusinessError } 1600003 - Failed to connect service. + * @syscap SystemCapability.Notification.Notification + * @since 9 + */ + function getSlots(): Promise>; + /** + * Removes a NotificationSlot of the specified SlotType created by the current application. + * + * @param { SlotType } slotType - Type of the NotificationSlot to remove. + * @param { AsyncCallback } callback - The callback of removeSlot. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 1600001 - Internal error. + * @throws { BusinessError } 1600002 - Marshalling or unmarshalling error. + * @throws { BusinessError } 1600003 - Failed to connect service. + * @syscap SystemCapability.Notification.Notification + * @since 9 + */ + function removeSlot(slotType: SlotType, callback: AsyncCallback): void; + /** + * Removes a NotificationSlot of the specified SlotType created by the current application. + * + * @param { SlotType } slotType - Type of the NotificationSlot to remove. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 1600001 - Internal error. + * @throws { BusinessError } 1600002 - Marshalling or unmarshalling error. + * @throws { BusinessError } 1600003 - Failed to connect service. + * @syscap SystemCapability.Notification.Notification + * @since 9 + */ + function removeSlot(slotType: SlotType): Promise; + /** + * Removes all NotificationSlot objects created by the current application. + * + * @param { AsyncCallback } callback - The callback of removeAllSlots. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 1600001 - Internal error. + * @throws { BusinessError } 1600002 - Marshalling or unmarshalling error. + * @throws { BusinessError } 1600003 - Failed to connect service. + * @syscap SystemCapability.Notification.Notification + * @since 9 + */ + function removeAllSlots(callback: AsyncCallback): void; + /** + * Removes all NotificationSlot objects created by the current application. + * + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 1600001 - Internal error. + * @throws { BusinessError } 1600002 - Marshalling or unmarshalling error. + * @throws { BusinessError } 1600003 - Failed to connect service. + * @syscap SystemCapability.Notification.Notification + * @since 9 + */ + function removeAllSlots(): Promise; + /** + * Checks whether this application allows to publish notifications. + * + * @permission ohos.permission.NOTIFICATION_CONTROLLER + * @param { AsyncCallback } callback - The callback of isNotificationEnabled. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 202 - Not system application to call the interface. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 1600001 - Internal error. + * @throws { BusinessError } 1600002 - Marshalling or unmarshalling error. + * @throws { BusinessError } 1600003 - Failed to connect service. + * @syscap SystemCapability.Notification.Notification + * @systemapi + * @since 9 + */ + /** + * Checks whether this application allows to publish notifications. + * + * @param { AsyncCallback } callback - The callback of isNotificationEnabled. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 1600001 - Internal error. + * @throws { BusinessError } 1600002 - Marshalling or unmarshalling error. + * @throws { BusinessError } 1600003 - Failed to connect service. + * @throws { BusinessError } 1600008 - The user does not exist. + * @throws { BusinessError } 17700001 - The specified bundle name was not found. + * @syscap SystemCapability.Notification.Notification + * @since 11 + */ + /** + * Checks whether this application allows to publish notifications. + * + * @param { AsyncCallback } callback - The callback of isNotificationEnabled. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 1600001 - Internal error. + * @throws { BusinessError } 1600002 - Marshalling or unmarshalling error. + * @throws { BusinessError } 1600003 - Failed to connect to the service. + * @throws { BusinessError } 1600008 - The user does not exist. + * @throws { BusinessError } 17700001 - The specified bundle name was not found. + * @syscap SystemCapability.Notification.Notification + * @crossplatform + * @since 12 + */ + function isNotificationEnabled(callback: AsyncCallback): void; + /** + * Checks whether this application allows to publish notifications. + * + * @permission ohos.permission.NOTIFICATION_CONTROLLER + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 202 - Not system application to call the interface. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 1600001 - Internal error. + * @throws { BusinessError } 1600002 - Marshalling or unmarshalling error. + * @throws { BusinessError } 1600003 - Failed to connect service. + * @syscap SystemCapability.Notification.Notification + * @systemapi + * @since 9 + */ + /** + * Checks whether this application allows to publish notifications. + * + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 1600001 - Internal error. + * @throws { BusinessError } 1600002 - Marshalling or unmarshalling error. + * @throws { BusinessError } 1600003 - Failed to connect service. + * @throws { BusinessError } 1600008 - The user does not exist. + * @throws { BusinessError } 17700001 - The specified bundle name was not found. + * @syscap SystemCapability.Notification.Notification + * @since 11 + */ + /** + * Checks whether this application allows to publish notifications. + * + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 1600001 - Internal error. + * @throws { BusinessError } 1600002 - Marshalling or unmarshalling error. + * @throws { BusinessError } 1600003 - Failed to connect to the service. + * @throws { BusinessError } 1600008 - The user does not exist. + * @throws { BusinessError } 17700001 - The specified bundle name was not found. + * @syscap SystemCapability.Notification.Notification + * @crossplatform + * @since 12 + */ + function isNotificationEnabled(): Promise; + /** + * Obtains the number of all active notifications. + * + * @param { AsyncCallback } callback - The callback of getActiveNotificationCount. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 1600001 - Internal error. + * @throws { BusinessError } 1600002 - Marshalling or unmarshalling error. + * @throws { BusinessError } 1600003 - Failed to connect service. + * @syscap SystemCapability.Notification.Notification + * @since 9 + */ + function getActiveNotificationCount(callback: AsyncCallback): void; + /** + * Obtains the number of all active notifications. + * + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 1600001 - Internal error. + * @throws { BusinessError } 1600002 - Marshalling or unmarshalling error. + * @throws { BusinessError } 1600003 - Failed to connect service. + * @syscap SystemCapability.Notification.Notification + * @since 9 + */ + function getActiveNotificationCount(): Promise; + /** + * Obtains an array of active notifications. + * + * @param { AsyncCallback> } callback - The callback of getActiveNotifications. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 1600001 - Internal error. + * @throws { BusinessError } 1600002 - Marshalling or unmarshalling error. + * @throws { BusinessError } 1600003 - Failed to connect service. + * @syscap SystemCapability.Notification.Notification + * @since 9 + */ + function getActiveNotifications(callback: AsyncCallback>): void; + /** + * Obtains an array of active notifications. + * + * @returns { Promise> } The promise returned by the function. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 1600001 - Internal error. + * @throws { BusinessError } 1600002 - Marshalling or unmarshalling error. + * @throws { BusinessError } 1600003 - Failed to connect service. + * @syscap SystemCapability.Notification.Notification + * @since 9 + */ + function getActiveNotifications(): Promise>; + /** + * Cancel the notification of a specified group for this application. + * + * @param { string } groupName - The name of the group. + * @param { AsyncCallback } callback - The callback of cancelGroup. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 1600001 - Internal error. + * @throws { BusinessError } 1600002 - Marshalling or unmarshalling error. + * @throws { BusinessError } 1600003 - Failed to connect service. + * @syscap SystemCapability.Notification.Notification + * @since 9 + */ + function cancelGroup(groupName: string, callback: AsyncCallback): void; + /** + * Cancel the notification of a specified group for this application. + * + * @param { string } groupName - The name of the group. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 1600001 - Internal error. + * @throws { BusinessError } 1600002 - Marshalling or unmarshalling error. + * @throws { BusinessError } 1600003 - Failed to connect service. + * @syscap SystemCapability.Notification.Notification + * @since 9 + */ + function cancelGroup(groupName: string): Promise; + /** + * Obtains whether the template is supported by the system. + * + * @param { string } templateName - Name of template to be Obtained. + * @param { AsyncCallback } callback - The callback is used to return whether the template is supported. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 1600001 - Internal error. + * @throws { BusinessError } 1600002 - Marshalling or unmarshalling error. + * @throws { BusinessError } 1600003 - Failed to connect service. + * @syscap SystemCapability.Notification.Notification + * @since 9 + */ + function isSupportTemplate(templateName: string, callback: AsyncCallback): void; + /** + * Obtains whether the template is supported by the system. + * + * @param { string } templateName - Name of template to be Obtained. + * @returns { Promise } Returns whether the template is supported. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 1600001 - Internal error. + * @throws { BusinessError } 1600002 - Marshalling or unmarshalling error. + * @throws { BusinessError } 1600003 - Failed to connect service. + * @syscap SystemCapability.Notification.Notification + * @since 9 + */ + function isSupportTemplate(templateName: string): Promise; + /** + * Request permission to send notification. + * + * @param { AsyncCallback } callback - The callback of requestEnableNotification. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 1600001 - Internal error. + * @throws { BusinessError } 1600002 - Marshalling or unmarshalling error. + * @throws { BusinessError } 1600003 - Failed to connect service. + * @syscap SystemCapability.Notification.Notification + * @since 9 + */ + /** + * Request permission to send notification. + * + * @param { AsyncCallback } callback - The callback of requestEnableNotification. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 1600001 - Internal error. + * @throws { BusinessError } 1600002 - Marshalling or unmarshalling error. + * @throws { BusinessError } 1600003 - Failed to connect service. + * @throws { BusinessError } 1600004 - Notification is not enabled. + * @throws { BusinessError } 1600013 - Enable Notification Dialog has been popping already. + * @syscap SystemCapability.Notification.Notification + * @since 11 + */ + /** + * Request permission to send notification. + * + * @param { AsyncCallback } callback - The callback of requestEnableNotification. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 1600001 - Internal error. + * @throws { BusinessError } 1600002 - Marshalling or unmarshalling error. + * @throws { BusinessError } 1600003 - Failed to connect to the service. + * @throws { BusinessError } 1600004 - Notification disabled. + * @throws { BusinessError } 1600013 - Enable Notification Dialog has been popping already. + * @syscap SystemCapability.Notification.Notification + * @crossplatform + * @since 12 + */ + function requestEnableNotification(callback: AsyncCallback): void; + /** + * Request permission to send notification. + * + * @param { UIAbilityContext } context - The context indicates the ability context you want to bind; + * @param { AsyncCallback } callback - The callback of requestEnableNotification. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 1600001 - Internal error. + * @throws { BusinessError } 1600002 - Marshalling or unmarshalling error. + * @throws { BusinessError } 1600003 - Failed to connect service. + * @syscap SystemCapability.Notification.Notification + * @StageModelOnly + * @since 10 + */ + /** + * Request permission to send notification. + * + * @param { UIAbilityContext } context - The context indicates the ability context you want to bind; + * @param { AsyncCallback } callback - The callback of requestEnableNotification. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 1600001 - Internal error. + * @throws { BusinessError } 1600002 - Marshalling or unmarshalling error. + * @throws { BusinessError } 1600003 - Failed to connect service. + * @throws { BusinessError } 1600004 - Notification is not enabled. + * @throws { BusinessError } 1600013 - Enable Notification Dialog has been popping already. + * @syscap SystemCapability.Notification.Notification + * @StageModelOnly + * @since 11 + */ + function requestEnableNotification(context: UIAbilityContext, callback: AsyncCallback): void; + /** + * Request permission to send notification. + * + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 1600001 - Internal error. + * @throws { BusinessError } 1600002 - Marshalling or unmarshalling error. + * @throws { BusinessError } 1600003 - Failed to connect service. + * @syscap SystemCapability.Notification.Notification + * @since 9 + */ + /** + * Request permission to send notification. + * + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 1600001 - Internal error. + * @throws { BusinessError } 1600002 - Marshalling or unmarshalling error. + * @throws { BusinessError } 1600003 - Failed to connect service. + * @throws { BusinessError } 1600004 - Notification is not enabled. + * @throws { BusinessError } 1600013 - Enable Notification Dialog has been popping already. + * @syscap SystemCapability.Notification.Notification + * @since 11 + */ + /** + * Request permission to send notification. + * + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 1600001 - Internal error. + * @throws { BusinessError } 1600002 - Marshalling or unmarshalling error. + * @throws { BusinessError } 1600003 - Failed to connect to the service. + * @throws { BusinessError } 1600004 - Notification disabled. + * @throws { BusinessError } 1600013 - Enable Notification Dialog has been popping already. + * @syscap SystemCapability.Notification.Notification + * @crossplatform + * @since 12 + */ + function requestEnableNotification(): Promise; + /** + * Request permission to send notification. + * + * @param { UIAbilityContext } context - The context indicates the ability context you want to bind; + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 1600001 - Internal error. + * @throws { BusinessError } 1600002 - Marshalling or unmarshalling error. + * @throws { BusinessError } 1600003 - Failed to connect service. + * @syscap SystemCapability.Notification.Notification + * @StageModelOnly + * @since 10 + */ + /** + * Request permission to send notification. + * + * @param { UIAbilityContext } context - The context indicates the ability context you want to bind; + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 1600001 - Internal error. + * @throws { BusinessError } 1600002 - Marshalling or unmarshalling error. + * @throws { BusinessError } 1600003 - Failed to connect service. + * @throws { BusinessError } 1600004 - Notification is not enabled. + * @throws { BusinessError } 1600013 - Enable Notification Dialog has been popping already. + * @syscap SystemCapability.Notification.Notification + * @StageModelOnly + * @since 11 + */ + function requestEnableNotification(context: UIAbilityContext): Promise; + /** + * Obtains whether the device supports distributed notification. + * + * @param { AsyncCallback } callback - The callback is used to return whether the distributed + * notification is supported. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 1600001 - Internal error. + * @throws { BusinessError } 1600002 - Marshalling or unmarshalling error. + * @throws { BusinessError } 1600003 - Failed to connect service. + * @throws { BusinessError } 1600010 - Distributed operation failed. + * @syscap SystemCapability.Notification.Notification + * @since 9 + */ + function isDistributedEnabled(callback: AsyncCallback): void; + /** + * Obtains whether the device supports distributed notification. + * + * @returns { Promise } Returns whether the distributed notification is supported. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 1600001 - Internal error. + * @throws { BusinessError } 1600002 - Marshalling or unmarshalling error. + * @throws { BusinessError } 1600003 - Failed to connect service. + * @throws { BusinessError } 1600010 - Distributed operation failed. + * @syscap SystemCapability.Notification.Notification + * @since 9 + */ + function isDistributedEnabled(): Promise; + /** + * Set badge number. + * + * @param { number } badgeNumber - Badge number. + * @param { AsyncCallback } callback - callback - The callback of setBadgeNumber.. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 1600001 - Internal error. + * @throws { BusinessError } 1600002 - Marshalling or unmarshalling error. + * @throws { BusinessError } 1600003 - Failed to connect service. + * @throws { BusinessError } 1600012 - No memory space. + * @syscap SystemCapability.Notification.Notification + * @since 10 + */ + /** + * Set badge number. + * + * @param { number } badgeNumber - Badge number. + * @param { AsyncCallback } callback - callback - The callback of setBadgeNumber.. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 1600001 - Internal error. + * @throws { BusinessError } 1600002 - Marshalling or unmarshalling error. + * @throws { BusinessError } 1600003 - Failed to connect to the service. + * @throws { BusinessError } 1600012 - No memory space. + * @syscap SystemCapability.Notification.Notification + * @crossplatform + * @since 12 + */ + function setBadgeNumber(badgeNumber: number, callback: AsyncCallback): void; + /** + * Set badge number. + * + * @param { number } badgeNumber - Badge number. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 1600001 - Internal error. + * @throws { BusinessError } 1600002 - Marshalling or unmarshalling error. + * @throws { BusinessError } 1600003 - Failed to connect service. + * @throws { BusinessError } 1600012 - No memory space. + * @syscap SystemCapability.Notification.Notification + * @since 10 + */ + /** + * Set badge number. + * + * @param { number } badgeNumber - Badge number. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3. Parameter verification failed. + * @throws { BusinessError } 1600001 - Internal error. + * @throws { BusinessError } 1600002 - Marshalling or unmarshalling error. + * @throws { BusinessError } 1600003 - Failed to connect to the service. + * @throws { BusinessError } 1600012 - No memory space. + * @syscap SystemCapability.Notification.Notification + * @crossplatform + * @since 12 + */ + function setBadgeNumber(badgeNumber: number): Promise; + /** + * Describes NotificationSlot types. + * + * @enum { number } + * @syscap SystemCapability.Notification.Notification + * @since 9 + */ + export enum SlotType { + /** + * NotificationSlot of an unknown type. + * + * @syscap SystemCapability.Notification.Notification + * @since 9 + */ + UNKNOWN_TYPE = 0, + /** + * NotificationSlot for social communication. + * + * @syscap SystemCapability.Notification.Notification + * @since 9 + */ + SOCIAL_COMMUNICATION = 1, + /** + * NotificationSlot for service information. + * + * @syscap SystemCapability.Notification.Notification + * @since 9 + */ + SERVICE_INFORMATION = 2, + /** + * NotificationSlot for content information. + * + * @syscap SystemCapability.Notification.Notification + * @since 9 + */ + CONTENT_INFORMATION = 3, + /** + * NotificationSlot for live view. + * + * @syscap SystemCapability.Notification.Notification + * @since 11 + */ + LIVE_VIEW = 4, + /** + * NotificationSlot for customer service. + * + * @syscap SystemCapability.Notification.Notification + * @since 11 + */ + CUSTOMER_SERVICE = 5, + /** + * NotificationSlot for other purposes. + * + * @syscap SystemCapability.Notification.Notification + * @since 9 + */ + OTHER_TYPES = 0xFFFF + } + /** + * Describes notification content types. + * + * @enum { number } + * @syscap SystemCapability.Notification.Notification + * @since 9 + */ + export enum ContentType { + /** + * Normal text notification. + * + * @syscap SystemCapability.Notification.Notification + * @since 9 + */ + NOTIFICATION_CONTENT_BASIC_TEXT, + /** + * Long text notification. + * + * @syscap SystemCapability.Notification.Notification + * @since 9 + */ + NOTIFICATION_CONTENT_LONG_TEXT, + /** + * Picture-attached notification. + * + * @syscap SystemCapability.Notification.Notification + * @since 9 + */ + NOTIFICATION_CONTENT_PICTURE, + /** + * Conversation notification. + * + * @syscap SystemCapability.Notification.Notification + * @since 9 + */ + NOTIFICATION_CONTENT_CONVERSATION, + /** + * Multi-line text notification. + * + * @syscap SystemCapability.Notification.Notification + * @since 9 + */ + NOTIFICATION_CONTENT_MULTILINE, + /** + * System local live view notification. + * + * @syscap SystemCapability.Notification.Notification + * @since 11 + */ + NOTIFICATION_CONTENT_SYSTEM_LIVE_VIEW, + /** + * Common live view notification. + * + * @syscap SystemCapability.Notification.Notification + * @since 11 + */ + NOTIFICATION_CONTENT_LIVE_VIEW + } + /** + * Indicates the level of the slot + * + * @enum { number } + * @syscap SystemCapability.Notification.Notification + * @since 9 + */ + export enum SlotLevel { + /** + * Indicates that the notification function is disabled. + * + * @syscap SystemCapability.Notification.Notification + * @since 9 + */ + LEVEL_NONE = 0, + /** + * Indicates that the notification function is enabled but notification + * icons are not displayed in the status bar, with no banner or prompt tone. + * + * @syscap SystemCapability.Notification.Notification + * @since 9 + */ + LEVEL_MIN = 1, + /** + * Indicates that the notification function is enabled and notification + * icons are displayed in the status bar, with no banner or prompt tone. + * + * @syscap SystemCapability.Notification.Notification + * @since 9 + */ + LEVEL_LOW = 2, + /** + * Indicates that the notification function is enabled and notification + * icons are displayed in the status bar, with no banner but with a prompt tone. + * + * @syscap SystemCapability.Notification.Notification + * @since 9 + */ + LEVEL_DEFAULT = 3, + /** + * Indicates that the notification function is enabled and notification + * icons are displayed in the status bar, with a banner and a prompt tone. + * + * @syscap SystemCapability.Notification.Notification + * @since 9 + */ + LEVEL_HIGH = 4 + } + /** + * Describes a bundleOption in a notification. + * + * @syscap SystemCapability.Notification.Notification + * @since 9 + */ + export type BundleOption = _BundleOption; + /** + * Describes an action button displayed in a notification. + * + * @syscap SystemCapability.Notification.Notification + * @since 9 + */ + export type NotificationActionButton = _NotificationActionButton; + /** + * Describes a normal text notification. + * + * @syscap SystemCapability.Notification.Notification + * @since 9 + */ + export type NotificationBasicContent = _NotificationBasicContent; + /** + * Describes notification types. + * + * @syscap SystemCapability.Notification.Notification + * @since 9 + */ + export type NotificationContent = _NotificationContent; + /** + * Describes a long text notification. + * + * @syscap SystemCapability.Notification.Notification + * @since 9 + */ + export type NotificationLongTextContent = _NotificationLongTextContent; + /** + * Describes a multi-line text notification. + * + * @syscap SystemCapability.Notification.Notification + * @since 9 + */ + export type NotificationMultiLineContent = _NotificationMultiLineContent; + /** + * Describes a picture-attached notification. + * + * @syscap SystemCapability.Notification.Notification + * @since 9 + */ + export type NotificationPictureContent = _NotificationPictureContent; + /** + * Describes a system live view notification. + * + * @syscap SystemCapability.Notification.Notification + * @since 11 + */ + export type NotificationSystemLiveViewContent = _NotificationSystemLiveViewContent; + /** + * Defines a NotificationRequest instance. + * + * @syscap SystemCapability.Notification.Notification + * @since 9 + */ + export type NotificationRequest = _NotificationRequest; + /** + * Describes distributed options. + * + * @syscap SystemCapability.Notification.Notification + * @since 9 + */ + export type DistributedOptions = _DistributedOptions; + /** + * Describes a NotificationSlot instance. + * + * @syscap SystemCapability.Notification.Notification + * @since 9 + */ + export type NotificationSlot = _NotificationSlot; + /** + * Describes a NotificationTemplate instance. + * + * @syscap SystemCapability.Notification.Notification + * @since 9 + */ + export type NotificationTemplate = _NotificationTemplate; + /** + * Describes a NotificationUserInput instance. + * + * @syscap SystemCapability.Notification.Notification + * @since 9 + */ + export type NotificationUserInput = _NotificationUserInput; + /** + * Describes a system live view capsule type. + * + * @syscap SystemCapability.Notification.Notification + * @since 11 + */ + export type NotificationCapsule = _NotificationCapsule; + /** + * Describes a system live view button type. + * + * @syscap SystemCapability.Notification.Notification + * @since 11 + */ + export type NotificationButton = _NotificationButton; + /** + * Describes a system live view time type. + * + * @syscap SystemCapability.Notification.Notification + * @since 11 + */ + export type NotificationTime = _NotificationTime; + /** + * Describes a system live view progress type. + * + * @syscap SystemCapability.Notification.Notification + * @since 11 + */ + export type NotificationProgress = _NotificationProgress; +} +export default notificationManager; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.pasteboard.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.pasteboard.d.ts new file mode 100755 index 00000000..d48ba673 --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.pasteboard.d.ts @@ -0,0 +1,1377 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit BasicServicesKit + */ +import { AsyncCallback } from './@ohos.base'; +import Want from './@ohos.app.ability.Want'; +import image from './@ohos.multimedia.image'; +import unifiedDataChannel from './@ohos.data.unifiedDataChannel'; +/** + * systemPasteboard + * @namespace pasteboard + * @syscap SystemCapability.MiscServices.Pasteboard + * @since 6 + */ +/** + * systemPasteboard + * @namespace pasteboard + * @syscap SystemCapability.MiscServices.Pasteboard + * @atomicservice + * @since 11 + */ +declare namespace pasteboard { + /** + * Indicates the maximum number of records allowed in a PasteData object. + * @constant + * @syscap SystemCapability.MiscServices.Pasteboard + * @since 7 + */ + /** + * Indicates the maximum number of records allowed in a PasteData object. + * @constant + * @syscap SystemCapability.MiscServices.Pasteboard + * @atomicservice + * @since 11 + */ + const MAX_RECORD_NUM: number; + /** + * Indicates MIME types of HTML text. + * @constant + * @syscap SystemCapability.MiscServices.Pasteboard + * @since 7 + */ + /** + * Indicates MIME types of HTML text. + * @constant + * @syscap SystemCapability.MiscServices.Pasteboard + * @atomicservice + * @since 11 + */ + const MIMETYPE_TEXT_HTML: string; + /** + * Indicates MIME types of wants. + * @constant + * @syscap SystemCapability.MiscServices.Pasteboard + * @since 7 + */ + /** + * Indicates MIME types of wants. + * @constant + * @syscap SystemCapability.MiscServices.Pasteboard + * @atomicservice + * @since 11 + */ + const MIMETYPE_TEXT_WANT: string; + /** + * Indicates MIME types of plain text. + * @constant + * @syscap SystemCapability.MiscServices.Pasteboard + * @since 7 + */ + /** + * Indicates MIME types of plain text. + * @constant + * @syscap SystemCapability.MiscServices.Pasteboard + * @atomicservice + * @since 11 + */ + const MIMETYPE_TEXT_PLAIN: string; + /** + * Indicates MIME types of URIs. + * @constant + * @syscap SystemCapability.MiscServices.Pasteboard + * @since 7 + */ + /** + * Indicates MIME types of URIs. + * @constant + * @syscap SystemCapability.MiscServices.Pasteboard + * @atomicservice + * @since 11 + */ + const MIMETYPE_TEXT_URI: string; + /** + * Indicates MIME type of PixelMap. + * @constant + * @syscap SystemCapability.MiscServices.Pasteboard + * @since 9 + */ + /** + * Indicates MIME type of PixelMap. + * @constant + * @syscap SystemCapability.MiscServices.Pasteboard + * @atomicservice + * @since 11 + */ + const MIMETYPE_PIXELMAP: string; + /** + * Indicates type of value. + * @type { string | image.PixelMap | Want | ArrayBuffer } + * @syscap SystemCapability.MiscServices.Pasteboard + * @since 9 + */ + /** + * Indicates type of value. + * @syscap SystemCapability.MiscServices.Pasteboard + * @atomicservice + * @since 11 + */ + type ValueType = string | image.PixelMap | Want | ArrayBuffer; + /** + * Creates a PasteData object for PasteData#MIMETYPE_TEXT_HTML. + * @param { string } htmlText - To save the Html text content. + * @returns { PasteData } Containing the contents of the clipboard content object. + * @syscap SystemCapability.MiscServices.Pasteboard + * @since 7 + * @deprecated since 9 + * @useinstead ohos.pasteboard.pasteboard#createData + */ + function createHtmlData(htmlText: string): PasteData; + /** + * Creates a PasteData object for PasteData#MIMETYPE_TEXT_WANT. + * @param { Want } want - To save the want of content. + * @returns { PasteData } Containing the contents of the clipboard content object. + * @syscap SystemCapability.MiscServices.Pasteboard + * @since 7 + * @deprecated since 9 + * @useinstead ohos.pasteboard.pasteboard#createData + */ + function createWantData(want: Want): PasteData; + /** + * Creates a PasteData object for PasteData#MIMETYPE_TEXT_PLAIN. + * @param { string } text - To save the text of content. + * @returns { PasteData } Containing the contents of the clipboard content object. + * @syscap SystemCapability.MiscServices.Pasteboard + * @since 6 + * @deprecated since 9 + * @useinstead ohos.pasteboard.pasteboard#createData + */ + function createPlainTextData(text: string): PasteData; + /** + * Creates a PasteData object for PasteData#MIMETYPE_TEXT_URI. + * @param { string } uri - To save the uri of content. + * @returns { PasteData } Containing the contents of the clipboard content object. + * @syscap SystemCapability.MiscServices.Pasteboard + * @since 7 + * @deprecated since 9 + * @useinstead ohos.pasteboard.pasteboard#createData + */ + function createUriData(uri: string): PasteData; + /** + * Creates a PasteData object with MIME type and value. + * @param { string } mimeType - indicates MIME type of value, its size cannot be greater than 1024 bytes. + * @param { ValueType } value - indicates the content that is set to PasteData. + * @returns { PasteData } a new PasteData object which contains mimeType and value. + * @throws { BusinessError } 401 - Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameters types; + * 3. Parameter verification failed. + * @syscap SystemCapability.MiscServices.Pasteboard + * @since 9 + */ + /** + * Creates a PasteData object with MIME type and value. + * @param { string } mimeType - indicates MIME type of value, its size cannot be greater than 1024 bytes. + * @param { ValueType } value - indicates the content that is set to PasteData. + * @returns { PasteData } a new PasteData object which contains mimeType and value. + * @throws { BusinessError } 401 - Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameters types; + * 3. Parameter verification failed. + * @syscap SystemCapability.MiscServices.Pasteboard + * @atomicservice + * @since 11 + */ + function createData(mimeType: string, value: ValueType): PasteData; + /** + * Creates a Record object for PasteData#MIMETYPE_TEXT_HTML. + * @param { string } htmlText - To save the Html text content. + * @returns { PasteDataRecord } The content of a new record + * @syscap SystemCapability.MiscServices.Pasteboard + * @since 7 + * @deprecated since 9 + * @useinstead ohos.pasteboard.pasteboard#createRecord + */ + function createHtmlTextRecord(htmlText: string): PasteDataRecord; + /** + * Creates a Record object for PasteData#MIMETYPE_TEXT_WANT. + * @param { Want } want - To save the want of content. + * @returns { PasteDataRecord } The content of a new record + * @syscap SystemCapability.MiscServices.Pasteboard + * @since 7 + * @deprecated since 9 + * @useinstead ohos.pasteboard.pasteboard#createRecord + */ + function createWantRecord(want: Want): PasteDataRecord; + /** + * Creates a Record object for PasteData#MIMETYPE_TEXT_PLAIN. + * @param { string } text - To save the text of content. + * @returns { PasteDataRecord } The content of a new record + * @syscap SystemCapability.MiscServices.Pasteboard + * @since 7 + * @deprecated since 9 + * @useinstead ohos.pasteboard.pasteboard#createRecord + */ + function createPlainTextRecord(text: string): PasteDataRecord; + /** + * Creates a Record object for PasteData#MIMETYPE_TEXT_URI. + * @param { string } uri - To save the uri of content. + * @returns { PasteDataRecord } The content of a new record + * @syscap SystemCapability.MiscServices.Pasteboard + * @since 7 + * @deprecated since 9 + * @useinstead ohos.pasteboard.pasteboard#createRecord + */ + function createUriRecord(uri: string): PasteDataRecord; + /** + * Creates a record object with MIME type and value. + * @param { string } mimeType - indicates MIME type of value, its size cannot be greater than 1024 bytes. + * @param { ValueType } value - content to be saved. + * @returns { PasteDataRecord } a new PasteDataRecord object which contains mimeType and value. + * @throws { BusinessError } 401 - Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameters types; + * 3. Parameter verification failed. + * @syscap SystemCapability.MiscServices.Pasteboard + * @since 9 + */ + /** + * Creates a record object with MIME type and value. + * @param { string } mimeType - indicates MIME type of value, its size cannot be greater than 1024 bytes. + * @param { ValueType } value - content to be saved. + * @returns { PasteDataRecord } a new PasteDataRecord object which contains mimeType and value. + * @throws { BusinessError } 401 - Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameters types; + * 3. Parameter verification failed. + * @syscap SystemCapability.MiscServices.Pasteboard + * @atomicservice + * @since 11 + */ + function createRecord(mimeType: string, value: ValueType): PasteDataRecord; + /** + * get SystemPasteboard + * @returns { SystemPasteboard } The system clipboard object + * @syscap SystemCapability.MiscServices.Pasteboard + * @since 6 + */ + /** + * get SystemPasteboard + * @returns { SystemPasteboard } The system clipboard object + * @syscap SystemCapability.MiscServices.Pasteboard + * @atomicservice + * @since 11 + */ + function getSystemPasteboard(): SystemPasteboard; + /** + * Types of scope that PasteData can be pasted. + * @enum { number } + * @syscap SystemCapability.MiscServices.Pasteboard + * @since 9 + */ + /** + * Types of scope that PasteData can be pasted. + * @enum { number } + * @syscap SystemCapability.MiscServices.Pasteboard + * @atomicservice + * @since 11 + */ + enum ShareOption { + /** + * INAPP indicates that only paste in the same app is allowed. + * @syscap SystemCapability.MiscServices.Pasteboard + * @since 9 + */ + /** + * INAPP indicates that only paste in the same app is allowed. + * @syscap SystemCapability.MiscServices.Pasteboard + * @atomicservice + * @since 11 + */ + INAPP, + /** + * LOCALDEVICE indicates that paste in any app in this device is allowed. + * @syscap SystemCapability.MiscServices.Pasteboard + * @since 9 + */ + /** + * LOCALDEVICE indicates that paste in any app in this device is allowed. + * @syscap SystemCapability.MiscServices.Pasteboard + * @atomicservice + * @since 11 + */ + LOCALDEVICE, + /** + * CROSSDEVICE indicates that paste in any app across devices is allowed. + * @syscap SystemCapability.MiscServices.Pasteboard + * @since 9 + */ + /** + * CROSSDEVICE indicates that paste in any app across devices is allowed. + * @syscap SystemCapability.MiscServices.Pasteboard + * @atomicservice + * @since 11 + */ + CROSSDEVICE + } + /** + * Paste data property. + * @interface PasteDataProperty + * @syscap SystemCapability.MiscServices.Pasteboard + * @since 7 + */ + /** + * Paste data property. + * @interface PasteDataProperty + * @syscap SystemCapability.MiscServices.Pasteboard + * @atomicservice + * @since 11 + */ + interface PasteDataProperty { + /** + * additional property data. key-value pairs. + * @type { object } + * @syscap SystemCapability.MiscServices.Pasteboard + * @since 7 + */ + /** + * additional property data. key-value pairs. + * @type { object } + * @syscap SystemCapability.MiscServices.Pasteboard + * @atomicservice + * @since 11 + */ + additions: { + [key: string]: object; + }; + /** + * non-repeating MIME types of all records in PasteData. + * @type { Array } + * @readonly + * @syscap SystemCapability.MiscServices.Pasteboard + * @since 7 + */ + /** + * non-repeating MIME types of all records in PasteData. + * @type { Array } + * @readonly + * @syscap SystemCapability.MiscServices.Pasteboard + * @atomicservice + * @since 11 + */ + readonly mimeTypes: Array; + /** + * the user-defined tag of a PasteData object. + * @type { string } + * @syscap SystemCapability.MiscServices.Pasteboard + * @since 7 + */ + /** + * the user-defined tag of a PasteData object. + * @type { string } + * @syscap SystemCapability.MiscServices.Pasteboard + * @atomicservice + * @since 11 + */ + tag: string; + /** + * a timestamp, which indicates when data is written to the system pasteboard. + * @type { number } + * @readonly + * @syscap SystemCapability.MiscServices.Pasteboard + * @since 7 + */ + /** + * a timestamp, which indicates when data is written to the system pasteboard. + * @type { number } + * @readonly + * @syscap SystemCapability.MiscServices.Pasteboard + * @atomicservice + * @since 11 + */ + readonly timestamp: number; + /** + * Checks whether PasteData is set for local access only. + * @type { boolean } + * @syscap SystemCapability.MiscServices.Pasteboard + * @since 7 + */ + /** + * Checks whether PasteData is set for local access only. + * @type { boolean } + * @syscap SystemCapability.MiscServices.Pasteboard + * @atomicservice + * @since 11 + */ + localOnly: boolean; + /** + * Indicates the scope of clipboard data which can be pasted. + * If it is not set or is incorrectly set, The default value is CrossDevice. + * @type { ShareOption } + * @syscap SystemCapability.MiscServices.Pasteboard + * @since 9 + */ + /** + * Indicates the scope of clipboard data which can be pasted. + * If it is not set or is incorrectly set, The default value is CrossDevice. + * @type { ShareOption } + * @syscap SystemCapability.MiscServices.Pasteboard + * @atomicservice + * @since 11 + */ + shareOption: ShareOption; + } + /** + * Paste data record. + * @interface PasteDataRecord + * @syscap SystemCapability.MiscServices.Pasteboard + * @since 7 + */ + /** + * Paste data record. + * @interface PasteDataRecord + * @syscap SystemCapability.MiscServices.Pasteboard + * @atomicservice + * @since 11 + */ + interface PasteDataRecord { + /** + * HTML text in a record. + * @type { string } + * @syscap SystemCapability.MiscServices.Pasteboard + * @since 7 + */ + /** + * HTML text in a record. + * @type { string } + * @syscap SystemCapability.MiscServices.Pasteboard + * @atomicservice + * @since 11 + */ + htmlText: string; + /** + * an want in a record. + * @type { Want } + * @syscap SystemCapability.MiscServices.Pasteboard + * @since 7 + */ + /** + * an want in a record. + * @type { Want } + * @syscap SystemCapability.MiscServices.Pasteboard + * @atomicservice + * @since 11 + */ + want: Want; + /** + * MIME types of a record. + * @type { string } + * @syscap SystemCapability.MiscServices.Pasteboard + * @since 7 + */ + /** + * MIME types of a record. + * @type { string } + * @syscap SystemCapability.MiscServices.Pasteboard + * @atomicservice + * @since 11 + */ + mimeType: string; + /** + * plain text in a record. + * @type { string } + * @syscap SystemCapability.MiscServices.Pasteboard + * @since 7 + */ + /** + * plain text in a record. + * @type { string } + * @syscap SystemCapability.MiscServices.Pasteboard + * @atomicservice + * @since 11 + */ + plainText: string; + /** + * an URI in a record. + * @type { string } + * @syscap SystemCapability.MiscServices.Pasteboard + * @since 7 + */ + /** + * an URI in a record. + * @type { string } + * @syscap SystemCapability.MiscServices.Pasteboard + * @atomicservice + * @since 11 + */ + uri: string; + /** + * PixelMap in a record. + * @type { image.PixelMap } + * @syscap SystemCapability.MiscServices.Pasteboard + * @since 9 + */ + /** + * PixelMap in a record. + * @type { image.PixelMap } + * @syscap SystemCapability.MiscServices.Pasteboard + * @atomicservice + * @since 11 + */ + pixelMap: image.PixelMap; + /** + * Custom data in a record, mimeType indicates the MIME type of custom data, ArrayBuffer indicates the value of custom data. + * @type { object } + * @syscap SystemCapability.MiscServices.Pasteboard + * @since 9 + */ + /** + * Custom data in a record, mimeType indicates the MIME type of custom data, ArrayBuffer indicates the value of custom data. + * @type { object } + * @syscap SystemCapability.MiscServices.Pasteboard + * @atomicservice + * @since 11 + */ + data: { + [mimeType: string]: ArrayBuffer; + }; + /** + * Converts data in PasteData to text format. + * @param { AsyncCallback } callback - the callback of convertToText. + * @throws { BusinessError } 401 - Possible causes: Incorrect parameters types. + * @syscap SystemCapability.MiscServices.Pasteboard + * @since 7 + * @deprecated since 9 + * @useinstead ohos.pasteboard.pasteboard#convertToTextV9 + */ + convertToText(callback: AsyncCallback): void; + /** + * Converts data in PasteData to text format. + * @returns { Promise } the promise returned by the function. + * @syscap SystemCapability.MiscServices.Pasteboard + * @since 7 + * @deprecated since 9 + * @useinstead ohos.pasteboard.pasteboard#convertToTextV9 + */ + convertToText(): Promise; + /** + * Converts data in PasteData to text format. + * @returns { string } the string returned by the function. + * @syscap SystemCapability.MiscServices.Pasteboard + * @since 9 + */ + /** + * Converts data in PasteData to text format. + * @returns { string } the string returned by the function. + * @syscap SystemCapability.MiscServices.Pasteboard + * @atomicservice + * @since 11 + */ + toPlainText(): string; + } + /** + * Classes for paste data. + * @interface PasteData + * @syscap SystemCapability.MiscServices.Pasteboard + * @since 6 + */ + /** + * Classes for paste data. + * @interface PasteData + * @syscap SystemCapability.MiscServices.Pasteboard + * @atomicservice + * @since 11 + */ + interface PasteData { + /** + * Adds a Record for HTML text to a PasteData object, and updates the MIME type to PasteData#MIMETYPE_TEXT_HTML in DataProperty. + * @param { string } htmlText - To save the Html text content. + * @syscap SystemCapability.MiscServices.Pasteboard + * @since 7 + * @deprecated since 9 + * @useinstead ohos.pasteboard.pasteboard#addRecord + */ + addHtmlRecord(htmlText: string): void; + /** + * Adds an want Record to a PasteData object, and updates the MIME type to PasteData#MIMETYPE_TEXT_WANT in DataProperty. + * @param { Want } want - To save the want content. + * @syscap SystemCapability.MiscServices.Pasteboard + * @since 7 + * @deprecated since 9 + * @useinstead ohos.pasteboard.pasteboard#addRecord + */ + addWantRecord(want: Want): void; + /** + * Adds a PasteRecord to a PasteData object and updates MIME types in DataProperty. + * @param { PasteDataRecord } record - The content of a new record. + * @syscap SystemCapability.MiscServices.Pasteboard + * @since 7 + */ + /** + * Adds a PasteRecord to a PasteData object and updates MIME types in DataProperty. + * @param { PasteDataRecord } record - The content of a new record. + * @syscap SystemCapability.MiscServices.Pasteboard + * @atomicservice + * @since 11 + */ + addRecord(record: PasteDataRecord): void; + /** + * Adds a Record for plain text to a PasteData object, and updates the MIME type to PasteData#MIMETYPE_TEXT_PLAIN in DataProperty. + * @param { string } text - To save the text of content. + * @syscap SystemCapability.MiscServices.Pasteboard + * @since 7 + * @deprecated since 9 + * @useinstead ohos.pasteboard.pasteboard#addRecord + */ + addTextRecord(text: string): void; + /** + * Adds a URI Record to a PasteData object, and updates the MIME type to PasteData#MIMETYPE_TEXT_URI in DataProperty. + * @param { string } uri - To save the uri of content. + * @syscap SystemCapability.MiscServices.Pasteboard + * @since 7 + * @deprecated since 9 + * @useinstead ohos.pasteboard.pasteboard#addRecord + */ + addUriRecord(uri: string): void; + /** + * Adds a record with mimeType and value to a PasteData object. + * @param { string } mimeType - indicates the MIME type of value, its size cannot be greater than 1024 bytes. + * @param { ValueType } value - content to be saved. + * @throws { BusinessError } 401 - Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameters types; + * 3. Parameter verification failed. + * @throws { BusinessError } 12900002 - The number of record exceeds the maximum limit. + * @syscap SystemCapability.MiscServices.Pasteboard + * @since 9 + */ + /** + * Adds a record with mimeType and value to a PasteData object. + * @param { string } mimeType - indicates the MIME type of value, its size cannot be greater than 1024 bytes. + * @param { ValueType } value - content to be saved. + * @throws { BusinessError } 401 - Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameters types; + * 3. Parameter verification failed. + * @syscap SystemCapability.MiscServices.Pasteboard + * @since 10 + */ + /** + * Adds a record with mimeType and value to a PasteData object. + * @param { string } mimeType - indicates the MIME type of value, its size cannot be greater than 1024 bytes. + * @param { ValueType } value - content to be saved. + * @throws { BusinessError } 401 - Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameters types; + * 3. Parameter verification failed. + * @syscap SystemCapability.MiscServices.Pasteboard + * @atomicservice + * @since 11 + */ + addRecord(mimeType: string, value: ValueType): void; + /** + * MIME types of all content on the pasteboard. + * @returns { Array } type of array + * @syscap SystemCapability.MiscServices.Pasteboard + * @since 7 + */ + /** + * MIME types of all content on the pasteboard. + * @returns { Array } type of array + * @syscap SystemCapability.MiscServices.Pasteboard + * @atomicservice + * @since 11 + */ + getMimeTypes(): Array; + /** + * HTML text of the primary record in a PasteData object. + * @returns { string } type of htmltext + * @syscap SystemCapability.MiscServices.Pasteboard + * @since 7 + */ + /** + * HTML text of the primary record in a PasteData object. + * @returns { string } type of htmltext + * @syscap SystemCapability.MiscServices.Pasteboard + * @atomicservice + * @since 11 + */ + getPrimaryHtml(): string; + /** + * the want of the primary record in a PasteData object. + * @returns { Want } type of want + * @syscap SystemCapability.MiscServices.Pasteboard + * @since 7 + */ + /** + * the want of the primary record in a PasteData object. + * @returns { Want } type of want + * @syscap SystemCapability.MiscServices.Pasteboard + * @atomicservice + * @since 11 + */ + getPrimaryWant(): Want; + /** + * the MIME type of the primary record in a PasteData object. + * @returns { string } type of mimetype + * @syscap SystemCapability.MiscServices.Pasteboard + * @since 7 + */ + /** + * the MIME type of the primary record in a PasteData object. + * @returns { string } type of mimetype + * @syscap SystemCapability.MiscServices.Pasteboard + * @atomicservice + * @since 11 + */ + getPrimaryMimeType(): string; + /** + * the plain text of the primary record in a PasteData object. + * @returns { string } type of text + * @syscap SystemCapability.MiscServices.Pasteboard + * @since 6 + */ + /** + * the plain text of the primary record in a PasteData object. + * @returns { string } type of text + * @syscap SystemCapability.MiscServices.Pasteboard + * @atomicservice + * @since 11 + */ + getPrimaryText(): string; + /** + * the URI of the primary record in a PasteData object. + * @returns { string } type of uri + * @syscap SystemCapability.MiscServices.Pasteboard + * @since 7 + */ + /** + * the URI of the primary record in a PasteData object. + * @returns { string } type of uri + * @syscap SystemCapability.MiscServices.Pasteboard + * @atomicservice + * @since 11 + */ + getPrimaryUri(): string; + /** + * Gets the primary PixelMap record in a PasteData object. + * @returns { image.PixelMap } pixelMap + * @syscap SystemCapability.MiscServices.Pasteboard + * @since 9 + */ + /** + * Gets the primary PixelMap record in a PasteData object. + * @returns { image.PixelMap } pixelMap + * @syscap SystemCapability.MiscServices.Pasteboard + * @atomicservice + * @since 11 + */ + getPrimaryPixelMap(): image.PixelMap; + /** + * DataProperty of a PasteData object. + * @returns { PasteDataProperty } PasteDataProperty type of PasteDataProperty + * @syscap SystemCapability.MiscServices.Pasteboard + * @since 7 + */ + /** + * DataProperty of a PasteData object. + * @returns { PasteDataProperty } PasteDataProperty type of PasteDataProperty + * @syscap SystemCapability.MiscServices.Pasteboard + * @atomicservice + * @since 11 + */ + getProperty(): PasteDataProperty; + /** + * Sets PasteDataProperty to a PasteData object, Modifying shareOption is supported only. + * @param { PasteDataProperty } property - save property to PasteData object. + * @throws { BusinessError } 401 - Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameters types. + * @syscap SystemCapability.MiscServices.Pasteboard + * @since 9 + */ + /** + * Sets PasteDataProperty to a PasteData object, Modifying shareOption is supported only. + * @param { PasteDataProperty } property - save property to PasteData object. + * @throws { BusinessError } 401 - Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameters types. + * @syscap SystemCapability.MiscServices.Pasteboard + * @atomicservice + * @since 11 + */ + setProperty(property: PasteDataProperty): void; + /** + * Gets record by index in PasteData. + * @param { number } index - indicates the record index in PasteData. + * @returns { PasteDataRecord } the record in PasteData with index. + * @throws { BusinessError } 401 - Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameters types. + * @syscap SystemCapability.MiscServices.Pasteboard + * @since 7 + * @deprecated since 9 + * @useinstead ohos.pasteboard.pasteboard#getRecord + */ + getRecordAt(index: number): PasteDataRecord; + /** + * Gets record by index in PasteData. + * @param { number } index - indicates the record index in PasteData. + * @returns { PasteDataRecord } the record in PasteData with index. + * @throws { BusinessError }401 - Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameters types. + * @throws { BusinessError } 12900001 - The index is out of the record. + * @syscap SystemCapability.MiscServices.Pasteboard + * @since 9 + */ + /** + * Gets record by index in PasteData. + * @param { number } index - indicates the record index in PasteData. + * @returns { PasteDataRecord } the record in PasteData with index. + * @throws { BusinessError } 401 - Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameters types. + * @throws { BusinessError } 12900001 - The index is out of the record. + * @syscap SystemCapability.MiscServices.Pasteboard + * @atomicservice + * @since 11 + */ + getRecord(index: number): PasteDataRecord; + /** + * the number of records in a PasteData object. + * @returns { number } The number of the clipboard contents + * @syscap SystemCapability.MiscServices.Pasteboard + * @since 7 + */ + /** + * the number of records in a PasteData object. + * @returns { number } The number of the clipboard contents + * @syscap SystemCapability.MiscServices.Pasteboard + * @atomicservice + * @since 11 + */ + getRecordCount(): number; + /** + * the user-defined tag of a PasteData object. + * @returns { string } type of tag + * @syscap SystemCapability.MiscServices.Pasteboard + * @since 7 + */ + /** + * the user-defined tag of a PasteData object. + * @returns { string } type of tag + * @syscap SystemCapability.MiscServices.Pasteboard + * @atomicservice + * @since 11 + */ + getTag(): string; + /** + * Checks whether there is a specified MIME type of data in DataProperty. + * @param { string } mimeType - indicates to query data type. + * @returns { boolean } if having mimeType in PasteData returns true, else returns false. + * @throws { BusinessError } 401 - Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameters types. + * @syscap SystemCapability.MiscServices.Pasteboard + * @since 7 + * @deprecated since 9 + * @useinstead ohos.pasteboard.pasteboard#hasType + */ + hasMimeType(mimeType: string): boolean; + /** + * Checks whether there is a specified MIME type of data in DataProperty. + * @param { string } mimeType - indicates to query data type. + * @returns { boolean } if having mimeType in PasteData returns true, else returns false. + * @throws { BusinessError } 401 - Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameters types. + * @syscap SystemCapability.MiscServices.Pasteboard + * @since 9 + */ + /** + * Checks whether there is a specified MIME type of data in DataProperty. + * @param { string } mimeType - indicates to query data type. + * @returns { boolean } if having mimeType in PasteData returns true, else returns false. + * @throws { BusinessError } 401 - Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameters types. + * @syscap SystemCapability.MiscServices.Pasteboard + * @atomicservice + * @since 11 + */ + hasType(mimeType: string): boolean; + /** + * Removes a Record based on a specified index. + * @param { number } index - indicates the record index in PasteData. + * @returns { boolean } The query returns True on success, or False on failure. + * @throws { BusinessError } 401 - Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameters types. + * @syscap SystemCapability.MiscServices.Pasteboard + * @since 7 + * @deprecated since 9 + * @useinstead ohos.pasteboard.pasteboard#removeRecord + */ + removeRecordAt(index: number): boolean; + /** + * Removes a Record based on a specified index. + * @param { number } index - indicates the record index in PasteData. + * @throws { BusinessError } 401 - Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameters types. + * @throws { BusinessError } 12900001 - The index is out of the record. + * @syscap SystemCapability.MiscServices.Pasteboard + * @since 9 + */ + /** + * Removes a Record based on a specified index. + * @param { number } index - indicates the record index in PasteData. + * @throws { BusinessError } 401 - Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameters types. + * @throws { BusinessError } 12900001 - The index is out of the record. + * @syscap SystemCapability.MiscServices.Pasteboard + * @atomicservice + * @since 11 + */ + removeRecord(index: number): void; + /** + * Replaces a specified record with a new one. + * @param { number } index - indicates the record index in PasteData. + * @param { PasteDataRecord } record - the content of a new record. + * @returns { boolean } The query returns True on success, or False on failure. + * @syscap SystemCapability.MiscServices.Pasteboard + * @since 7 + * @deprecated since 9 + * @useinstead ohos.pasteboard.pasteboard#replaceRecord + */ + replaceRecordAt(index: number, record: PasteDataRecord): boolean; + /** + * Replaces a specified record with a new one. + * @param { number } index - indicates the record index in PasteData. + * @param { PasteDataRecord } record - the content of a new record. + * @throws { BusinessError } 401 - Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameters types. + * @throws { BusinessError } 12900001 - The index is out of the record. + * @syscap SystemCapability.MiscServices.Pasteboard + * @since 9 + */ + /** + * Replaces a specified record with a new one. + * @param { number } index - indicates the record index in PasteData. + * @param { PasteDataRecord } record - the content of a new record. + * @throws { BusinessError } 401 - Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameters types. + * @throws { BusinessError } 12900001 - The index is out of the record. + * @syscap SystemCapability.MiscServices.Pasteboard + * @atomicservice + * @since 11 + */ + replaceRecord(index: number, record: PasteDataRecord): void; + } + /** + * Classes for system pasteboard. + * @interface SystemPasteboard + * @syscap SystemCapability.MiscServices.Pasteboard + * @since 6 + */ + /** + * Classes for system pasteboard. + * @interface SystemPasteboard + * @syscap SystemCapability.MiscServices.Pasteboard + * @atomicservice + * @since 11 + */ + interface SystemPasteboard { + /** + * Callback invoked when pasteboard content changes. + * @param { 'update' } type - indicates pasteboard content changed. + * @param { function } callback - the callback to add. + * @throws { BusinessError } 401 - Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameters types. + * @syscap SystemCapability.MiscServices.Pasteboard + * @since 7 + */ + on(type: 'update', callback: () => void): void; + /** + * Remove a callback invoked when pasteboard content changes. + * @param { 'update' } type - indicates pasteboard content changed. + * @param { function } [callback] - the callback to remove. If this parameter is not filled in, it indicates that all + * callbacks for this application will be cleared. Otherwise, it indicates that the specified callback will be cleared. + * @throws { BusinessError } 401 - Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameters types. + * @syscap SystemCapability.MiscServices.Pasteboard + * @since 7 + */ + off(type: 'update', callback?: () => void): void; + /** + * Checks whether the data is remote. + * @returns { boolean } True is remote data, else false. + * @throws { BusinessError } 12900005 - Request time out. + * @syscap SystemCapability.MiscServices.Pasteboard + * @atomicservice + * @since 11 + */ + isRemoteData(): boolean; + /** + * Gets source of data. + * @returns { string } data source. + * @throws { BusinessError } 12900005 - Request time out. + * @syscap SystemCapability.MiscServices.Pasteboard + * @atomicservice + * @since 11 + */ + getDataSource(): string; + /** + * Checks whether there is a specified MIME type of data in Data. + * @param { string } mimeType - indicates to query data type. + * @returns { boolean } if having mimeType in PasteData returns true, else returns false. + * @throws { BusinessError } 401 - Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameters types. + * @throws { BusinessError } 12900005 - Request time out. + * @syscap SystemCapability.MiscServices.Pasteboard + * @atomicservice + * @since 11 + */ + hasDataType(mimeType: string): boolean; + /** + * Clears the pasteboard. + * @param { AsyncCallback } callback - the callback of clearData. + * @syscap SystemCapability.MiscServices.Pasteboard + * @since 7 + * @deprecated since 9 + * @useinstead ohos.pasteboard.pasteboard#clearData + */ + clear(callback: AsyncCallback): void; + /** + * Clears the pasteboard. + * @returns { Promise } the promise returned by the clearData. + * @syscap SystemCapability.MiscServices.Pasteboard + * @since 7 + * @deprecated since 9 + * @useinstead ohos.pasteboard.pasteboard#clearData + */ + clear(): Promise; + /** + * Clears the pasteboard. + * @param { AsyncCallback } callback - the callback of clearData. + * @throws { BusinessError } 401 - Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameters types. + * @syscap SystemCapability.MiscServices.Pasteboard + * @since 9 + */ + /** + * Clears the pasteboard. + * @param { AsyncCallback } callback - the callback of clearData. + * @throws { BusinessError } 401 - Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameters types. + * @syscap SystemCapability.MiscServices.Pasteboard + * @atomicservice + * @since 11 + */ + clearData(callback: AsyncCallback): void; + /** + * Clears the pasteboard. + * @returns { Promise } the promise returned by the clearData. + * @syscap SystemCapability.MiscServices.Pasteboard + * @since 9 + */ + /** + * Clears the pasteboard. + * @returns { Promise } the promise returned by the clearData. + * @syscap SystemCapability.MiscServices.Pasteboard + * @atomicservice + * @since 11 + */ + clearData(): Promise; + /** + * Clears the pasteboard. + * @throws { BusinessError } 12900005 - Request time out. + * @syscap SystemCapability.MiscServices.Pasteboard + * @atomicservice + * @since 11 + */ + clearDataSync(): void; + /** + * Gets pastedata from the system pasteboard. + * @param { AsyncCallback } callback - the callback of getData. + * @syscap SystemCapability.MiscServices.Pasteboard + * @since 6 + * @deprecated since 9 + * @useinstead ohos.pasteboard.pasteboard#getData + */ + getPasteData(callback: AsyncCallback): void; + /** + * Gets pastedata from the system pasteboard. + * @returns { Promise } the promise returned by the getData. + * @syscap SystemCapability.MiscServices.Pasteboard + * @since 6 + * @deprecated since 9 + * @useinstead ohos.pasteboard.pasteboard#getData + */ + getPasteData(): Promise; + /** + * Gets pastedata from the system pasteboard. + * @param { AsyncCallback } callback - the callback of getData. + * @throws { BusinessError } 401 - Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameters types. + * @throws { BusinessError } 12900003 - Another copy or paste is in progress. + * @syscap SystemCapability.MiscServices.Pasteboard + * @since 9 + */ + /** + * Gets pastedata from the system pasteboard. + * @param { AsyncCallback } callback - the callback of getData. + * @throws { BusinessError } 401 - Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameters types. + * @throws { BusinessError } 12900003 - Another copy or paste is in progress. + * @syscap SystemCapability.MiscServices.Pasteboard + * @atomicservice + * @since 11 + */ + /** + * Gets pastedata from the system pasteboard. + * @permission ohos.permission.READ_PASTEBOARD + * @param { AsyncCallback } callback - the callback of getData. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameters types. + * @throws { BusinessError } 12900003 - Another copy or paste is in progress. + * @syscap SystemCapability.MiscServices.Pasteboard + * @atomicservice + * @since 12 + */ + getData(callback: AsyncCallback): void; + /** + * Gets pastedata from the system pasteboard. + * @returns { Promise } the promise returned by the getData. + * @throws { BusinessError } 12900003 - Another copy or paste is in progress. + * @syscap SystemCapability.MiscServices.Pasteboard + * @since 9 + */ + /** + * Gets pastedata from the system pasteboard. + * @returns { Promise } the promise returned by the getData. + * @throws { BusinessError } 12900003 - Another copy or paste is in progress. + * @syscap SystemCapability.MiscServices.Pasteboard + * @atomicservice + * @since 11 + */ + /** + * Gets pastedata from the system pasteboard. + * @permission ohos.permission.READ_PASTEBOARD + * @returns { Promise } the promise returned by the getData. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 12900003 - Another copy or paste is in progress. + * @syscap SystemCapability.MiscServices.Pasteboard + * @atomicservice + * @since 12 + */ + getData(): Promise; + /** + * Gets pasteData from the system pasteboard. + * @returns { PasteData } a new PasteData. + * @throws { BusinessError } 12900005 - Request time out. + * @syscap SystemCapability.MiscServices.Pasteboard + * @atomicservice + * @since 11 + */ + /** + * Gets pasteData from the system pasteboard. + * @permission ohos.permission.READ_PASTEBOARD + * @returns { PasteData } a new PasteData. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 12900005 - Request time out. + * @syscap SystemCapability.MiscServices.Pasteboard + * @atomicservice + * @since 12 + */ + getDataSync(): PasteData; + /** + * Checks whether there is content in the pasteboard. + * @param { AsyncCallback } callback - the callback of setPasteData. + * @throws { BusinessError } 401 - Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameters types. + * @syscap SystemCapability.MiscServices.Pasteboard + * @since 7 + * @deprecated since 9 + * @useinstead ohos.pasteboard.pasteboard#hasData + */ + hasPasteData(callback: AsyncCallback): void; + /** + * Checks whether there is content in the pasteboard. + * @returns { Promise } the promise returned by the function. + * @syscap SystemCapability.MiscServices.Pasteboard + * @since 7 + * @deprecated since 9 + * @useinstead ohos.pasteboard.pasteboard#hasData + */ + hasPasteData(): Promise; + /** + * Checks whether there is content in the system pasteboard. + * @param { AsyncCallback } callback - the callback of hasData. + * @throws { BusinessError } 401 - Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameters types. + * @syscap SystemCapability.MiscServices.Pasteboard + * @since 9 + */ + /** + * Checks whether there is content in the system pasteboard. + * @param { AsyncCallback } callback - the callback of hasData. + * @throws { BusinessError } 401 - Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameters types. + * @syscap SystemCapability.MiscServices.Pasteboard + * @atomicservice + * @since 11 + */ + hasData(callback: AsyncCallback): void; + /** + * Checks whether there is content in the system pasteboard. + * @returns { Promise } the promise returned by the function. + * @syscap SystemCapability.MiscServices.Pasteboard + * @since 9 + */ + /** + * Checks whether there is content in the system pasteboard. + * @returns { Promise } the promise returned by the function. + * @syscap SystemCapability.MiscServices.Pasteboard + * @atomicservice + * @since 11 + */ + hasData(): Promise; + /** + * Checks whether there is content in the system pasteboard. + * @returns { boolean } True exists, false does not exist. + * @throws { BusinessError } 12900005 - Request time out. + * @syscap SystemCapability.MiscServices.Pasteboard + * @atomicservice + * @since 11 + */ + hasDataSync(): boolean; + /** + * Writes PasteData to the pasteboard. + * @param { PasteData } data - PasteData will be written to the clipboard + * @param { AsyncCallback } callback - the callback of setPasteData. + * @throws { BusinessError } 401 - Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameters types. + * @syscap SystemCapability.MiscServices.Pasteboard + * @since 6 + * @deprecated since 9 + * @useinstead ohos.pasteboard.pasteboard#setData + */ + setPasteData(data: PasteData, callback: AsyncCallback): void; + /** + * Writes PasteData to the pasteboard. + * @param { PasteData } data - Containing the contents of the clipboard content object. + * @returns { Promise } the promise returned by the function. + * @syscap SystemCapability.MiscServices.Pasteboard + * @since 6 + * @deprecated since 9 + * @useinstead ohos.pasteboard.pasteboard#setData + */ + setPasteData(data: PasteData): Promise; + /** + * Writes PasteData to the system pasteboard. + * @param { PasteData } data - PasteData will be written to the clipboard + * @param { AsyncCallback } callback - the callback of setData. + * @throws { BusinessError } 401 - Possible causes: 1. Mandatory parameters are left unspecified. + * 2. Incorrect parameters types. + * @throws { BusinessError } 12900003 - Another copy or paste is in progress. + * @throws { BusinessError } 12900004 - Replication is prohibited. + * @syscap SystemCapability.MiscServices.Pasteboard + * @since 9 + */ + /** + * Writes PasteData to the system pasteboard. + * @param { PasteData } data - PasteData will be written to the clipboard + * @param { AsyncCallback } callback - the callback of setData. + * @throws { BusinessError } 401 - Possible causes: 1. Mandatory parameters are left unspecified. + * 2. Incorrect parameters types. + * @throws { BusinessError } 12900003 - Another copy or paste is in progress. + * @throws { BusinessError } 12900004 - Replication is prohibited. + * @syscap SystemCapability.MiscServices.Pasteboard + * @atomicservice + * @since 11 + */ + setData(data: PasteData, callback: AsyncCallback): void; + /** + * Writes PasteData to the system pasteboard. + * @param { PasteData } data - PasteData will be written to the clipboard. + * @returns { Promise } the promise returned by the function. + * @throws { BusinessError } 401 - Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameters types. + * @throws { BusinessError } 12900003 - Another copy or paste is in progress. + * @throws { BusinessError } 12900004 - Replication is prohibited. + * @syscap SystemCapability.MiscServices.Pasteboard + * @since 9 + */ + /** + * Writes PasteData to the system pasteboard. + * @param { PasteData } data - PasteData will be written to the clipboard. + * @returns { Promise } the promise returned by the function. + * @throws { BusinessError } 401 - Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameters types. + * @throws { BusinessError } 12900003 - Another copy or paste is in progress. + * @throws { BusinessError } 12900004 - Replication is prohibited. + * @syscap SystemCapability.MiscServices.Pasteboard + * @atomicservice + * @since 11 + */ + setData(data: PasteData): Promise; + /** + * Writes PasteData to the system pasteboard. + * @param { PasteData } data - PasteData will be written to the clipboard. + * @throws { BusinessError } 401 - Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameters types. + * @throws { BusinessError } 12900005 - Request time out. + * @syscap SystemCapability.MiscServices.Pasteboard + * @atomicservice + * @since 11 + */ + setDataSync(data: PasteData): void; + /** + * Gets unified data from the system pasteboard. + * @permission ohos.permission.READ_PASTEBOARD + * @returns { Promise } the promise returned by the getData. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 12900003 - Another copy or paste is in progress. + * @syscap SystemCapability.MiscServices.Pasteboard + * @atomicservice + * @since 12 + */ + getUnifiedData(): Promise; + /** + * Gets unified data from the system pasteboard. + * @permission ohos.permission.READ_PASTEBOARD + * @returns { unifiedDataChannel.UnifiedData } a new UnifiedData. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 12900005 - Request time out. + * @syscap SystemCapability.MiscServices.Pasteboard + * @atomicservice + * @since 12 + */ + getUnifiedDataSync(): unifiedDataChannel.UnifiedData; + /** + * Writes unified data to the system pasteboard. + * @param { unifiedDataChannel.UnifiedData } data - Unified data will be written to the pasteboard. + * @returns { Promise } the promise returned by the function. + * @throws { BusinessError } 401 - Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameters types. + * @throws { BusinessError } 12900003 - Another copy or paste is in progress. + * @throws { BusinessError } 12900004 - Replication is prohibited. + * @syscap SystemCapability.MiscServices.Pasteboard + * @atomicservice + * @since 12 + */ + setUnifiedData(data: unifiedDataChannel.UnifiedData): Promise; + /** + * Writes unified data to the system pasteboard. + * @param { unifiedDataChannel.UnifiedData } data - Unified data will be written to the pasteboard. + * @throws { BusinessError } 401 - Possible causes: 1. Mandatory parameters are left unspecified; + * 2. Incorrect parameters types. + * @throws { BusinessError } 12900005 - Request time out. + * @syscap SystemCapability.MiscServices.Pasteboard + * @atomicservice + * @since 12 + */ + setUnifiedDataSync(data: unifiedDataChannel.UnifiedData): void; + } +} +export default pasteboard; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.pluginComponent.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.pluginComponent.d.ts new file mode 100755 index 00000000..2aa205ce --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.pluginComponent.d.ts @@ -0,0 +1,263 @@ +/* + * Copyright (c) 2021-2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit ArkUI + */ +import { AsyncCallback } from './@ohos.base'; +import Want from './@ohos.app.ability.Want'; +/** + * Plugin component template property. + * + * @interface PluginComponentTemplate + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 8 + */ +interface PluginComponentTemplate { + /** + * Defines the source + * + * @type { string } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 8 + */ + source: string; + /** + * Defines the ability + * + * @type { string } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 8 + */ + ability: string; +} +/** + * Plugin component manager interface. + * + * @namespace pluginComponentManager + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 8 + */ +declare namespace pluginComponentManager { + /** + * Defines KVObject + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 8 + */ + type KVObject = { + [key: string]: number | string | boolean | [ + ] | KVObject; + }; + /** + * Plugin component push parameters. + * + * @interface PushParameters + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 8 + */ + interface PushParameters { + /** + * Defines want. + * + * @type { Want } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 8 + */ + want: Want; + /** + * Defines name. + * + * @type { string } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 8 + */ + name: string; + /** + * Defines data. + * + * @type { KVObject } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 8 + */ + data: KVObject; + /** + * Defines extraData. + * + * @type { KVObject } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 8 + */ + extraData: KVObject; + /** + * Defines jsonPath. + * + * @type { ?string } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 8 + */ + jsonPath?: string; + } + /** + * Plugin component request parameters. + * + * @interface RequestParameters + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 8 + */ + interface RequestParameters { + /** + * Defines want. + * + * @type { Want } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 8 + */ + want: Want; + /** + * Defines name. + * + * @type { string } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 8 + */ + name: string; + /** + * Defines data. + * + * @type { KVObject } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 8 + */ + data: KVObject; + /** + * Defines jsonPath. + * + * @type { ?string } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 8 + */ + jsonPath?: string; + } + /** + * Plugin component request callback parameters. + * + * @interface RequestCallbackParameters + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 8 + */ + interface RequestCallbackParameters { + /** + * Defines componentTemplate. + * + * @type { PluginComponentTemplate } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 8 + */ + componentTemplate: PluginComponentTemplate; + /** + * Defines data. + * + * @type { KVObject } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 8 + */ + data: KVObject; + /** + * Defines extraData. + * + * @type { KVObject } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 8 + */ + extraData: KVObject; + } + /** + * Plugin component request event result value. + * + * @interface RequestEventResult + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 8 + */ + interface RequestEventResult { + /** + * Defines template. + * + * @type { ?string } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 8 + */ + template?: string; + /** + * Defines data. + * + * @type { ?KVObject } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 8 + */ + data?: KVObject; + /** + * Defines extraData. + * + * @type { ?KVObject } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 8 + */ + extraData?: KVObject; + } + /** + * Plugin component push event callback. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 8 + */ + type OnPushEventCallback = (source: Want, template: PluginComponentTemplate, data: KVObject, extraData: KVObject) => void; + /** + * Plugin component request event callback. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 8 + */ + type OnRequestEventCallback = (source: Want, name: string, data: KVObject) => RequestEventResult; + /** + * Plugin component push method. + * + * @param { PushParameters } param + * @param { AsyncCallback } callback + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 8 + */ + function push(param: PushParameters, callback: AsyncCallback): void; + /** + * Plugin component request method. + * + * @param { RequestParameters } param + * @param { AsyncCallback } callback + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 8 + */ + function request(param: RequestParameters, callback: AsyncCallback): void; + /** + * Plugin component event listener. + * + * @param { string } eventType + * @param { OnPushEventCallback | OnRequestEventCallback } callback + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 8 + */ + function on(eventType: string, callback: OnPushEventCallback | OnRequestEventCallback): void; +} +export default pluginComponentManager; +export type { PluginComponentTemplate }; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.power.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.power.d.ts new file mode 100755 index 00000000..6a67576c --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.power.d.ts @@ -0,0 +1,128 @@ +/* + * Copyright (c) 2021-2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit BasicServicesKit + */ +import { AsyncCallback } from './@ohos.base'; +/** + * Provides interfaces to manage power. + * + * @namespace power + * @syscap SystemCapability.PowerManager.PowerManager.Core + * @since 7 + */ +declare namespace power { + /** + * Restarts the system. + *

This method requires the ohos.permission.REBOOT permission. + * + * @permission ohos.permission.REBOOT + * @param { string } reason Indicates the restart reason. For example, "updater" indicates entering the updater mode + * after the restart. If the parameter is not specified, the system enters the normal mode after the restart. + * @syscap SystemCapability.PowerManager.PowerManager.Core + * @since 7 + * @deprecated since 9 + * @useinstead power#reboot + */ + function rebootDevice(reason: string): void; + /** + * Checks whether the screen of a device is on or off. + * + * @param { AsyncCallback } callback Returns true if the screen is on; returns false otherwise. + * @syscap SystemCapability.PowerManager.PowerManager.Core + * @since 7 + * @deprecated since 9 + * @useinstead power#isActive + */ + function isScreenOn(callback: AsyncCallback): void; + /** + * Checks whether the screen of a device is on or off. + * + * @returns { Promise } Returns true if the screen is on; returns false otherwise. + * @syscap SystemCapability.PowerManager.PowerManager.Core + * @since 7 + * @deprecated since 9 + * @useinstead power#isActive + */ + function isScreenOn(): Promise; + /** + * Checks whether the device is active. + *

+ * The screen will be on if device is active, screen will be off otherwise. + * + * @returns { boolean } Returns true if the device is active; returns false otherwise. + * @throws { BusinessError } 4900101 - If connecting to the service failed. + * @syscap SystemCapability.PowerManager.PowerManager.Core + * @since 9 + */ + function isActive(): boolean; + /** + * Obtains the power mode of the current device. For details, see {@link DevicePowerMode}. + * + * @returns { DevicePowerMode } The power mode {@link DevicePowerMode} of current device . + * @throws { BusinessError } 4900101 - If connecting to the service failed. + * @syscap SystemCapability.PowerManager.PowerManager.Core + * @since 9 + */ + function getPowerMode(): DevicePowerMode; + /** + * Returns true if the device is currently in idle mode. + * + * @returns { boolean } Returns true if the device is in idle mode; returns false otherwise. + * @throws { BusinessError } 4900101 - If connecting to the service failed. + * @syscap SystemCapability.PowerManager.PowerManager.Core + * @since 10 + */ + function isStandby(): boolean; + /** + * Power mode of a device. + * + * @enum { number } + * @syscap SystemCapability.PowerManager.PowerManager.Core + * @since 9 + */ + export enum DevicePowerMode { + /** + * Normal power mode + * + * @syscap SystemCapability.PowerManager.PowerManager.Core + * @since 9 + */ + MODE_NORMAL = 600, + /** + * Power save mode + * + * @syscap SystemCapability.PowerManager.PowerManager.Core + * @since 9 + */ + MODE_POWER_SAVE, + /** + * Performance power mode + * + * @syscap SystemCapability.PowerManager.PowerManager.Core + * @since 9 + */ + MODE_PERFORMANCE, + /** + * Extreme power save mode + * + * @syscap SystemCapability.PowerManager.PowerManager.Core + * @since 9 + */ + MODE_EXTREME_POWER_SAVE + } +} +export default power; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.print.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.print.d.ts new file mode 100755 index 00000000..4b93794b --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.print.d.ts @@ -0,0 +1,550 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit BasicServicesKit + */ +import type { AsyncCallback, Callback } from './@ohos.base'; +import type Context from './application/Context'; +/** + * System print + * + * @namespace print + * @syscap SystemCapability.Print.PrintFramework + * @since 10 + */ +declare namespace print { + /** + * PrintTask provide event callback. + * @interface PrintTask + * @syscap SystemCapability.Print.PrintFramework + * @since 10 + */ + interface PrintTask { + /** + * Register event callback when the current print task is in process. + * @permission ohos.permission.PRINT + * @param { 'block' } type - Indicates the print task has been blocked. + * @param { Callback } callback - The callback function for print task change event + * @throws { BusinessError } 201 - the application does not have permission to call this function. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. + * @syscap SystemCapability.Print.PrintFramework + * @since 10 + */ + on(type: 'block', callback: Callback): void; + /** + * Register event callback when the current print task is in process. + * @permission ohos.permission.PRINT + * @param { 'succeed' } type - Indicates the print task succeed. + * @param { Callback } callback - The callback function for print task change event + * @throws { BusinessError } 201 - the application does not have permission to call this function. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. + * @syscap SystemCapability.Print.PrintFramework + * @since 10 + */ + on(type: 'succeed', callback: Callback): void; + /** + * Register event callback when the current print task is in process. + * @permission ohos.permission.PRINT + * @param { 'fail' } type - Indicates the print task has completed with failure. + * @param { Callback } callback - The callback function for print task change event + * @throws { BusinessError } 201 - the application does not have permission to call this function. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. + * @syscap SystemCapability.Print.PrintFramework + * @since 10 + */ + on(type: 'fail', callback: Callback): void; + /** + * Register event callback when the current print task is in process. + * @permission ohos.permission.PRINT + * @param { 'cancel' } type - Indicates the print task has been cancelled. + * @param { Callback } callback - The callback function for print task change event + * @throws { BusinessError } 201 - the application does not have permission to call this function. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. + * @syscap SystemCapability.Print.PrintFramework + * @since 10 + */ + on(type: 'cancel', callback: Callback): void; + /** + * Unregister event callback when the current print task is in process. + * @permission ohos.permission.PRINT + * @param { 'block' } type - Indicates the print task has been blocked. + * @param { Callback } callback - The callback function for print task change event + * @throws { BusinessError } 201 - the application does not have permission to call this function. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. + * @syscap SystemCapability.Print.PrintFramework + * @since 10 + */ + off(type: 'block', callback?: Callback): void; + /** + * Unregister event callback when the current print task is in process. + * @permission ohos.permission.PRINT + * @param { 'succeed' } type - Indicates the print task succeed. + * @param { Callback } callback - The callback function for print task change event + * @throws { BusinessError } 201 - the application does not have permission to call this function. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. + * @syscap SystemCapability.Print.PrintFramework + * @since 10 + */ + off(type: 'succeed', callback?: Callback): void; + /** + * Unregister event callback when the current print task is in process. + * @permission ohos.permission.PRINT + * @param { 'fail' } type - Indicates the print task has completed with failure. + * @param { Callback } callback - The callback function for print task change event + * @throws { BusinessError } 201 - the application does not have permission to call this function. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. + * @syscap SystemCapability.Print.PrintFramework + * @since 10 + */ + off(type: 'fail', callback?: Callback): void; + /** + * Unregister event callback when the current print task is in process. + * @permission ohos.permission.PRINT + * @param { 'cancel' } type - Indicates the print task has been cancelled. + * @param { Callback } callback - The callback function for print task change event + * @throws { BusinessError } 201 - the application does not have permission to call this function. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. + * @syscap SystemCapability.Print.PrintFramework + * @since 10 + */ + off(type: 'cancel', callback?: Callback): void; + } + /** + * Third-party application implement this interface to render files to be printed. + * @interface PrintDocumentAdapter + * @syscap SystemCapability.Print.PrintFramework + * @since 11 + */ + interface PrintDocumentAdapter { + /** + * Implement this function to update the print file. + * @permission ohos.permission.PRINT + * @param { string } jobId - Indicates print job id. + * @param { PrintAttributes } oldAttrs - Indicates old print attributes. + * @param { PrintAttributes } newAttrs - Indicates new print attributes. + * @param { number } fd - Indicates print file fd. + * @param { function } writeResultCallback - Indicates this function should execute after the file is updated. + * @throws { BusinessError } 201 - the application does not have permission to call this function. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. + * @syscap SystemCapability.Print.PrintFramework + * @since 11 + */ + onStartLayoutWrite(jobId: string, oldAttrs: PrintAttributes, newAttrs: PrintAttributes, fd: number, writeResultCallback: (jobId: string, writeResult: PrintFileCreationState) => void): void; + /** + * Implement this function to listen job status change. + * @permission ohos.permission.PRINT + * @param { string } jobId - Indicates print job id. + * @param { PrintDocumentAdapterState } state - Indicates job changes to this state. + * @throws { BusinessError } 201 - the application does not have permission to call this function. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. + * @syscap SystemCapability.Print.PrintFramework + * @since 11 + */ + onJobStateChanged(jobId: string, state: PrintDocumentAdapterState): void; + } + /** + * Start new print task for App. + * @permission ohos.permission.PRINT + * @param { Array } files - Indicates the filepath list to be printed. Only pdf and picture filetype are supported. + * @param { AsyncCallback } callback - The callback function for print task. + * @throws { BusinessError } 201 - the application does not have permission to call this function. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. + * @syscap SystemCapability.Print.PrintFramework + * @since 10 + */ + function print(files: Array, callback: AsyncCallback): void; + /** + * Start new print task for App. + * @permission ohos.permission.PRINT + * @param { Array } files - Indicates the filepath list to be printed. Only pdf and picture filetype are supported. + * @returns { Promise } the promise returned by the function. + * @throws { BusinessError } 201 - the application does not have permission to call this function. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. + * @syscap SystemCapability.Print.PrintFramework + * @since 10 + */ + function print(files: Array): Promise; + /** + * Start new print task for App. + * @permission ohos.permission.PRINT + * @param { Array } files - Indicates the filepath list to be printed. Only pdf and picture filetype are supported. + * @param { Context } context - The ability context that initiates the call print request. + * @param { AsyncCallback } callback - The callback function for print task. + * @throws { BusinessError } 201 - the application does not have permission to call this function. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. + * @syscap SystemCapability.Print.PrintFramework + * @since 11 + */ + function print(files: Array, context: Context, callback: AsyncCallback): void; + /** + * Start new print task for App. + * @permission ohos.permission.PRINT + * @param { Array } files - Indicates the filepath list to be printed. Only pdf and picture filetype are supported. + * @param { Context } context - The ability context that initiates the call print request. + * @returns { Promise } the promise returned by the function. + * @throws { BusinessError } 201 - the application does not have permission to call this function. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. + * @syscap SystemCapability.Print.PrintFramework + * @since 11 + */ + function print(files: Array, context: Context): Promise; + /** + * Start new print task for App And the App need update print file. + * @permission ohos.permission.PRINT + * @param { string } jobName - Indicates print file Name. + * @param { PrintDocumentAdapter } printAdapter - Indicates functions implemented by the cpp. + * @param { PrintAttributes } printAttributes - Indicates print attributes. + * @param { Context } context - The ability context that initiates the call print request. + * @returns { Promise } the promise returned by the function. + * @throws { BusinessError } 201 - the application does not have permission to call this function. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types. + * @syscap SystemCapability.Print.PrintFramework + * @since 11 + */ + function print(jobName: string, printAdapter: PrintDocumentAdapter, printAttributes: PrintAttributes, context: Context): Promise; + /** + * defines print attributes. + * @typedef PrintAttributes + * @syscap SystemCapability.Print.PrintFramework + * @since 11 + */ + interface PrintAttributes { + /** + * Copies of document list. + * @type { ?number } + * @syscap SystemCapability.Print.PrintFramework + * @since 11 + */ + copyNumber?: number; + /** + * Range size to be printed. + * @type { ?PrintPageRange } + * @syscap SystemCapability.Print.PrintFramework + * @since 11 + */ + pageRange?: PrintPageRange; + /** + * Page size. + * @type { ?(PrintPageSize | PrintPageType) } + * @syscap SystemCapability.Print.PrintFramework + * @since 11 + */ + pageSize?: PrintPageSize | PrintPageType; + /** + * Print direction. + * @type { ?PrintDirectionMode } + * @syscap SystemCapability.Print.PrintFramework + * @since 11 + */ + directionMode?: PrintDirectionMode; + /** + * Color mode. + * @type { ?PrintColorMode } + * @syscap SystemCapability.Print.PrintFramework + * @since 11 + */ + colorMode?: PrintColorMode; + /** + * Duplex mode. + * @type { ?PrintDuplexMode } + * @syscap SystemCapability.Print.PrintFramework + * @since 11 + */ + duplexMode?: PrintDuplexMode; + } + /** + * defines print page range. + * @typedef PrintPageRange + * @syscap SystemCapability.Print.PrintFramework + * @since 11 + */ + interface PrintPageRange { + /** + * Start page of sequence. + * @type { ?number } + * @syscap SystemCapability.Print.PrintFramework + * @since 11 + */ + startPage?: number; + /** + * End page of sequence. + * @type { ?number } + * @syscap SystemCapability.Print.PrintFramework + * @since 11 + */ + endPage?: number; + /** + * Discrete page of sequence. + * @type { ?Array } + * @syscap SystemCapability.Print.PrintFramework + * @since 11 + */ + pages?: Array; + } + /** + * defines print page size. + * @typedef PrintPageSize + * @syscap SystemCapability.Print.PrintFramework + * @since 11 + */ + interface PrintPageSize { + /** + * Page size id. + * @type { string } + * @syscap SystemCapability.Print.PrintFramework + * @since 11 + */ + id: string; + /** + * Page size name. + * @type { string } + * @syscap SystemCapability.Print.PrintFramework + * @since 11 + */ + name: string; + /** + * Unit: millimeter width. + * @type { number } + * @syscap SystemCapability.Print.PrintFramework + * @since 11 + */ + width: number; + /** + * Unit: millimeter height. + * @type { number } + * @syscap SystemCapability.Print.PrintFramework + * @since 11 + */ + height: number; + } + /** + * Enumeration of Print Direction Mode. + * @enum { number } PrintDirectionMode + * @syscap SystemCapability.Print.PrintFramework + * @since 11 + */ + enum PrintDirectionMode { + /** + * Automatically select direction. + * @syscap SystemCapability.Print.PrintFramework + * @since 11 + */ + DIRECTION_MODE_AUTO = 0, + /** + * Print portrait. + * @syscap SystemCapability.Print.PrintFramework + * @since 11 + */ + DIRECTION_MODE_PORTRAIT = 1, + /** + * Print landscape. + * @syscap SystemCapability.Print.PrintFramework + * @since 11 + */ + DIRECTION_MODE_LANDSCAPE = 2 + } + /** + * Enumeration of Print Color Mode. + * @enum { number } PrintColorMode + * @syscap SystemCapability.Print.PrintFramework + * @since 11 + */ + enum PrintColorMode { + /** + * Print monochrome. + * @syscap SystemCapability.Print.PrintFramework + * @since 11 + */ + COLOR_MODE_MONOCHROME = 0, + /** + * Color printing. + * @syscap SystemCapability.Print.PrintFramework + * @since 11 + */ + COLOR_MODE_COLOR = 1 + } + /** + * Enumeration of Print Duplex Mode. + * @enum { number } PrintDuplexMode + * @syscap SystemCapability.Print.PrintFramework + * @since 11 + */ + enum PrintDuplexMode { + /** + * Single side printing. + * @syscap SystemCapability.Print.PrintFramework + * @since 11 + */ + DUPLEX_MODE_NONE = 0, + /** + * Long-edge flip-up duplex printing. + * @syscap SystemCapability.Print.PrintFramework + * @since 11 + */ + DUPLEX_MODE_LONG_EDGE = 1, + /** + * Short-edge flip-up duplex printing. + * @syscap SystemCapability.Print.PrintFramework + * @since 11 + */ + DUPLEX_MODE_SHORT_EDGE = 2 + } + /** + * Enumeration of Print Page Type. + * @enum { number } PrintPageType + * @syscap SystemCapability.Print.PrintFramework + * @since 11 + */ + enum PrintPageType { + /** + * A3 page. + * @syscap SystemCapability.Print.PrintFramework + * @since 11 + */ + PAGE_ISO_A3 = 0, + /** + * A4 page. + * @syscap SystemCapability.Print.PrintFramework + * @since 11 + */ + PAGE_ISO_A4 = 1, + /** + * A5 page. + * @syscap SystemCapability.Print.PrintFramework + * @since 11 + */ + PAGE_ISO_A5 = 2, + /** + * B5 page. + * @syscap SystemCapability.Print.PrintFramework + * @since 11 + */ + PAGE_JIS_B5 = 3, + /** + * C5 page. + * @syscap SystemCapability.Print.PrintFramework + * @since 11 + */ + PAGE_ISO_C5 = 4, + /** + * DL Envelope. + * @syscap SystemCapability.Print.PrintFramework + * @since 11 + */ + PAGE_ISO_DL = 5, + /** + * Letter. + * @syscap SystemCapability.Print.PrintFramework + * @since 11 + */ + PAGE_LETTER = 6, + /** + * Legal. + * @syscap SystemCapability.Print.PrintFramework + * @since 11 + */ + PAGE_LEGAL = 7, + /** + * Photo 4x6. + * @syscap SystemCapability.Print.PrintFramework + * @since 11 + */ + PAGE_PHOTO_4X6 = 8, + /** + * Photo 5x7. + * @syscap SystemCapability.Print.PrintFramework + * @since 11 + */ + PAGE_PHOTO_5X7 = 9, + /** + * Envelope INT DL. + * @syscap SystemCapability.Print.PrintFramework + * @since 11 + */ + PAGE_INT_DL_ENVELOPE = 10, + /** + * Tabloid B. + * @syscap SystemCapability.Print.PrintFramework + * @since 11 + */ + PAGE_B_TABLOID = 11 + } + /** + * Enumeration of Print Document Adapter State. + * @enum { number } PrintDocumentAdapterState + * @syscap SystemCapability.Print.PrintFramework + * @since 11 + */ + enum PrintDocumentAdapterState { + /** + * Preview failed. + * @syscap SystemCapability.Print.PrintFramework + * @since 11 + */ + PREVIEW_DESTROY = 0, + /** + * Print state is succeed. + * @syscap SystemCapability.Print.PrintFramework + * @since 11 + */ + PRINT_TASK_SUCCEED = 1, + /** + * Print state is fail. + * @syscap SystemCapability.Print.PrintFramework + * @since 11 + */ + PRINT_TASK_FAIL = 2, + /** + * Print state is cancel. + * @syscap SystemCapability.Print.PrintFramework + * @since 11 + */ + PRINT_TASK_CANCEL = 3, + /** + * Print state is block. + * @syscap SystemCapability.Print.PrintFramework + * @since 11 + */ + PRINT_TASK_BLOCK = 4 + } + /** + * Enumeration of Print File Creation State. + * @enum { number } PrintFileCreationState + * @syscap SystemCapability.Print.PrintFramework + * @since 11 + */ + enum PrintFileCreationState { + /** + * Print file created success. + * @syscap SystemCapability.Print.PrintFramework + * @since 11 + */ + PRINT_FILE_CREATED = 0, + /** + * Print file created fail. + * @syscap SystemCapability.Print.PrintFramework + * @since 11 + */ + PRINT_FILE_CREATION_FAILED = 1, + /** + * Print file created success but unrendered. + * @syscap SystemCapability.Print.PrintFramework + * @since 11 + */ + PRINT_FILE_CREATED_UNRENDERED = 2 + } +} +export default print; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.privacyManager.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.privacyManager.d.ts new file mode 100755 index 00000000..08b6eacf --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.privacyManager.d.ts @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit AbilityKit + */ + +import { Permissions } from './permissions'; +/** + * @namespace privacyManager + * @syscap SystemCapability.Security.AccessToken + * @since 9 + */ +declare namespace privacyManager { +} +export default privacyManager; +export { Permissions }; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.process.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.process.d.ts new file mode 100755 index 00000000..129515a4 --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.process.d.ts @@ -0,0 +1,648 @@ +/* + * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit ArkTS + */ +/** + * The process is mainly used to obtain the relevant ID of the process, obtain and modify + * the working directory of the process, exit and close the process. + * + * @namespace process + * @syscap SystemCapability.Utils.Lang + * @since 7 + */ +/** + * The process is mainly used to obtain the relevant ID of the process, obtain and modify + * the working directory of the process, exit and close the process. + * + * @namespace process + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @since 10 + */ +/** + * The process is mainly used to obtain the relevant ID of the process, obtain and modify + * the working directory of the process, exit and close the process. + * + * @namespace process + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 11 + */ +declare namespace process { + /** + * Process is mainly used to obtain the relevant ID of the process, obtain and modify the + * working directory of the process, exit and close the process. + * + * @syscap SystemCapability.Utils.Lang + * @since 9 + * @name ProcessManager + */ + /** + * Process is mainly used to obtain the relevant ID of the process, obtain and modify the + * working directory of the process, exit and close the process. + * + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @since 10 + * @name ProcessManager + */ + /** + * Process is mainly used to obtain the relevant ID of the process, obtain and modify the + * working directory of the process, exit and close the process. + * + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 11 + * @name ProcessManager + */ + export class ProcessManager { + /** + * Returns a boolean whether the specified uid belongs to a particular application. + * + * @param { number } v - An id. + * @returns { boolean } Return a boolean whether the specified uid belongs to a particular application. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @syscap SystemCapability.Utils.Lang + * @since 9 + */ + /** + * Returns a boolean whether the specified uid belongs to a particular application. + * + * @param { number } v - An id. + * @returns { boolean } Return a boolean whether the specified uid belongs to a particular application. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @since 10 + */ + /** + * Returns a boolean whether the specified uid belongs to a particular application. + * + * @param { number } v - An id. + * @returns { boolean } Return a boolean whether the specified uid belongs to a particular application. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 11 + */ + isAppUid(v: number): boolean; + /** + * Returns the uid based on the specified user name. + * + * @param { string } v - Process name. + * @returns { number } Return the uid based on the specified user name. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @syscap SystemCapability.Utils.Lang + * @since 9 + */ + /** + * Returns the uid based on the specified user name. + * + * @param { string } v - Process name. + * @returns { number } Return the uid based on the specified user name. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @since 10 + */ + /** + * Returns the uid based on the specified user name. + * + * @param { string } v - Process name. + * @returns { number } Return the uid based on the specified user name. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 11 + */ + getUidForName(v: string): number; + /** + * Returns the thread priority based on the specified tid. + * + * @param { number } v - The tid of the process. + * @returns { number } Return the thread priority based on the specified tid. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @syscap SystemCapability.Utils.Lang + * @since 9 + */ + /** + * Returns the thread priority based on the specified tid. + * + * @param { number } v - The tid of the process. + * @returns { number } Return the thread priority based on the specified tid. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @since 10 + */ + /** + * Returns the thread priority based on the specified tid. + * + * @param { number } v - The tid of the process. + * @returns { number } Return the thread priority based on the specified tid. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 11 + */ + getThreadPriority(v: number): number; + /** + * Returns the system configuration at runtime. + * + * @param { number } name - Parameters defined by the system configuration. + * @returns { number } Return the system configuration at runtime. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @syscap SystemCapability.Utils.Lang + * @since 9 + */ + /** + * Returns the system configuration at runtime. + * + * @param { number } name - Parameters defined by the system configuration. + * @returns { number } Return the system configuration at runtime. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @since 10 + */ + /** + * Returns the system configuration at runtime. + * + * @param { number } name - Parameters defined by the system configuration. + * @returns { number } Return the system configuration at runtime. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 11 + */ + getSystemConfig(name: number): number; + /** + * Returns the system value for environment variables. + * + * @param { string } name - Parameters defined by the system environment variables. + * @returns { string } Return the system value for environment variables. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @syscap SystemCapability.Utils.Lang + * @since 9 + */ + /** + * Returns the system value for environment variables. + * + * @param { string } name - Parameters defined by the system environment variables. + * @returns { string } Return the system value for environment variables. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @since 10 + */ + /** + * Returns the system value for environment variables. + * + * @param { string } name - Parameters defined by the system environment variables. + * @returns { string } Return the system value for environment variables. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 11 + */ + getEnvironmentVar(name: string): string; + /** + * Process exit + * + * @param { number } code - Process exit code. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @syscap SystemCapability.Utils.Lang + * @since 9 + */ + /** + * Process exit + * + * @param { number } code - Process exit code. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @since 10 + */ + /** + * Process exit + * + * @param { number } code - Process exit code. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 11 + */ + exit(code: number): void; + /** + * Return whether the signal was sent successfully + * + * @param { number } signal - Signal sent. + * @param { number } pid - Send signal to target pid. + * @returns { boolean } Return the result of the signal. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @syscap SystemCapability.Utils.Lang + * @since 9 + */ + /** + * Return whether the signal was sent successfully + * + * @param { number } signal - Signal sent. + * @param { number } pid - Send signal to target pid. + * @returns { boolean } Return the result of the signal. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @since 10 + */ + /** + * Return whether the signal was sent successfully + * + * @param { number } signal - Signal sent. + * @param { number } pid - Send signal to target pid. + * @returns { boolean } Return the result of the signal. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 11 + */ + kill(signal: number, pid: number): boolean; + } + /** + * Returns the digital user id of the process + * + * @constant + * @syscap SystemCapability.Utils.Lang + * @since 7 + */ + /** + * Returns the digital user id of the process + * + * @constant + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @since 10 + */ + /** + * Returns the digital user id of the process + * + * @constant + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 11 + */ + const uid: number; + /** + * Return pid is The pid of the current process + * + * @constant + * @syscap SystemCapability.Utils.Lang + * @since 7 + */ + /** + * Return pid is The pid of the current process + * + * @constant + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @since 10 + */ + /** + * Return pid is The pid of the current process + * + * @constant + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 11 + */ + const pid: number; + /** + * Returns the tid of the current thread. + * + * @constant + * @syscap SystemCapability.Utils.Lang + * @since 8 + */ + /** + * Returns the tid of the current thread. + * + * @constant + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @since 10 + */ + /** + * Returns the tid of the current thread. + * + * @constant + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 11 + */ + const tid: number; + /** + * Returns a boolean whether the process is isolated. + * + * @returns { boolean } Return boolean whether the process is isolated. + * @syscap SystemCapability.Utils.Lang + * @since 8 + */ + /** + * Returns a boolean whether the process is isolated. + * + * @returns { boolean } Return boolean whether the process is isolated. + * @syscap SystemCapability.Utils.Lang + * @atomicservice + * @since 11 + */ + function isIsolatedProcess(): boolean; + /** + * Returns a boolean whether the specified uid belongs to a particular application. + * + * @param { number } v - An id. + * @returns { boolean } Return a boolean whether the specified uid belongs to a particular application. + * @syscap SystemCapability.Utils.Lang + * @since 8 + * @deprecated since 9 + * @useinstead ohos.process.ProcessManager.isAppUid + */ + function isAppUid(v: number): boolean; + /** + * Returns a boolean whether the process is running in a 64-bit environment. + * + * @returns { boolean } Return a boolean whether the process is running in a 64-bit environment. + * @syscap SystemCapability.Utils.Lang + * @since 8 + */ + /** + * Returns a boolean whether the process is running in a 64-bit environment. + * + * @returns { boolean } Return a boolean whether the process is running in a 64-bit environment. + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @since 10 + */ + /** + * Returns a boolean whether the process is running in a 64-bit environment. + * + * @returns { boolean } Return a boolean whether the process is running in a 64-bit environment. + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 11 + */ + function is64Bit(): boolean; + /** + * Returns the uid based on the specified user name. + * + * @param { string } v - Process name. + * @returns { number } Return the uid based on the specified user name. + * @syscap SystemCapability.Utils.Lang + * @since 8 + * @deprecated since 9 + * @useinstead ohos.process.ProcessManager.getUidForName + */ + function getUidForName(v: string): number; + /** + * Returns the thread priority based on the specified tid. + * + * @param { number } v - The tid of the process. + * @returns { number } Return the thread priority based on the specified tid. + * @syscap SystemCapability.Utils.Lang + * @since 8 + * @deprecated since 9 + * @useinstead ohos.process.ProcessManager.getThreadPriority + */ + function getThreadPriority(v: number): number; + /** + * Returns the elapsed real time (in milliseconds) taken from the start of the system to the start of the process. + * + * @returns { number } Return the start of the system to the start of the process. + * @syscap SystemCapability.Utils.Lang + * @since 8 + */ + /** + * Returns the elapsed real time (in milliseconds) taken from the start of the system to the start of the process. + * + * @returns { number } Return the start of the system to the start of the process. + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @since 10 + */ + /** + * Returns the elapsed real time (in milliseconds) taken from the start of the system to the start of the process. + * + * @returns { number } Return the start of the system to the start of the process. + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 11 + */ + function getStartRealtime(): number; + /** + * Returns the cpu time (in milliseconds) from the time when the process starts to the current time. + * + * @returns { number } Return the cpu time (in milliseconds) from the time when the process starts to the current time. + * @syscap SystemCapability.Utils.Lang + * @since 8 + */ + /** + * Returns the cpu time (in milliseconds) from the time when the process starts to the current time. + * + * @returns { number } Return the cpu time (in milliseconds) from the time when the process starts to the current time. + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @since 10 + */ + /** + * Returns the cpu time (in milliseconds) from the time when the process starts to the current time. + * + * @returns { number } Return the cpu time (in milliseconds) from the time when the process starts to the current time. + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 11 + */ + function getPastCpuTime(): number; + /** + * Returns the system configuration at runtime. + * + * @param { number } name - Parameters defined by the system configuration. + * @returns { number } Return the system configuration at runtime. + * @syscap SystemCapability.Utils.Lang + * @since 8 + * @deprecated since 9 + * @useinstead ohos.process.ProcessManager.getSystemConfig + */ + function getSystemConfig(name: number): number; + /** + * Returns the system value for environment variables. + * + * @param { string } name - Parameters defined by the system environment variables. + * @returns { string } Return the system value for environment variables. + * @syscap SystemCapability.Utils.Lang + * @since 8 + * @deprecated since 9 + * @useinstead ohos.process.ProcessManager.getEnvironmentVar + */ + function getEnvironmentVar(name: string): string; + /** + * User Stored Events + * + * @syscap SystemCapability.Utils.Lang + * @since 7 + */ + /** + * User Stored Events + * + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @since 10 + */ + /** + * User Stored Events + * + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 11 + */ + type EventListener = (evt: Object) => void; + /** + * Abort current process + * + * @syscap SystemCapability.Utils.Lang + * @since 7 + */ + /** + * Abort current process + * + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @since 10 + */ + /** + * Abort current process + * + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 11 + */ + function abort(): void; + /** + * Process exit + * + * @param { number } code - Process exit code. + * @syscap SystemCapability.Utils.Lang + * @since 7 + * @deprecated since 9 + * @useinstead ohos.process.ProcessManager.exit + */ + function exit(code: number): void; + /** + * Returns the running time of the system + * + * @returns { number } Return the running time of the system. + * @syscap SystemCapability.Utils.Lang + * @since 7 + */ + /** + * Returns the running time of the system + * + * @returns { number } Return the running time of the system. + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @since 10 + */ + /** + * Returns the running time of the system + * + * @returns { number } Return the running time of the system. + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 11 + */ + function uptime(): number; + /** + * Return whether the signal was sent successfully + * + * @param { number } signal - Signal sent. + * @param { number } pid - Send signal to target pid. + * @returns { boolean } Return the result of the signal. + * @syscap SystemCapability.Utils.Lang + * @since 7 + * @deprecated since 9 + * @useinstead ohos.process.ProcessManager.kill + */ + function kill(signal: number, pid: number): boolean; +} +export default process; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.prompt.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.prompt.d.ts new file mode 100755 index 00000000..b4f09071 --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.prompt.d.ts @@ -0,0 +1,242 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit ArkUI + */ +import { AsyncCallback } from './@ohos.base'; +/** + * @namespace prompt + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 8 + * @deprecated since 9 + * @useinstead ohos.promptAction + */ +declare namespace prompt { + /** + * @interface ShowToastOptions + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 8 + * @deprecated since 9 + */ + interface ShowToastOptions { + /** + * Text to display. + * + * @type { string } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 8 + * @deprecated since 9 + */ + message: string; + /** + * Duration of toast dialog box. The default value is 1500. + * The recommended value ranges from 1500 ms to 10000ms. + * NOTE: A value less than 1500 is automatically changed to 1500. The maximum value is 10000 ms. + * + * @type { ?number } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 8 + * @deprecated since 9 + */ + duration?: number; + /** + * The distance between toast dialog box and the bottom of screen. + * + * @type { ?(string | number) } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 8 + * @deprecated since 9 + */ + bottom?: string | number; + } + /** + * @interface Button + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 8 + * @deprecated since 9 + */ + interface Button { + /** + * @type { string } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 8 + * @deprecated since 9 + */ + text: string; + /** + * @type { string } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 8 + * @deprecated since 9 + */ + color: string; + } + /** + * @interface ShowDialogSuccessResponse + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 8 + * @deprecated since 9 + */ + interface ShowDialogSuccessResponse { + /** + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 8 + * @deprecated since 9 + */ + index: number; + } + /** + * @interface ShowDialogOptions + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 8 + * @deprecated since 9 + */ + interface ShowDialogOptions { + /** + * Title of the text to display. + * + * @type { ?string } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 8 + * @deprecated since 9 + */ + title?: string; + /** + * Text body. + * + * @type { ?string } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 8 + * @deprecated since 9 + */ + message?: string; + /** + * Array of buttons in the dialog box. + * The array structure is {text:'button', color: '#666666'}. + * One to three buttons are supported. The first button is of the positiveButton type, the second is of the negativeButton type, and the third is of the neutralButton type. + * + * @type { ?[Button, Button?, Button?] } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 8 + * @deprecated since 9 + */ + buttons?: [ + Button, + Button?, + Button? + ]; + } + /** + * @interface ActionMenuSuccessResponse + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 8 + * @deprecated since 9 + */ + interface ActionMenuSuccessResponse { + /** + * @type { number } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 8 + * @deprecated since 9 + */ + index: number; + } + /** + * @interface ActionMenuOptions + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 8 + * @deprecated since 9 + */ + interface ActionMenuOptions { + /** + * Title of the text to display. + * + * @type { ?string } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 8 + * @deprecated since 9 + */ + title?: string; + /** + * Array of buttons in the dialog box. + * The array structure is {text:'button', color: '#666666'}. + * One to six buttons are supported. + * + * @type { [Button, Button?, Button?, Button?, Button?, Button?] } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 8 + * @deprecated since 9 + */ + buttons: [ + Button, + Button?, + Button?, + Button?, + Button?, + Button? + ]; + } + /** + * Displays the notification text. + * + * @param { ShowToastOptions } options - Options. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 8 + * @deprecated since 9 + */ + function showToast(options: ShowToastOptions): void; + /** + * Displays the dialog box. + * + * @param { ShowDialogOptions } options - Options. + * @param { AsyncCallback } callback + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 8 + * @deprecated since 9 + */ + function showDialog(options: ShowDialogOptions, callback: AsyncCallback): void; + /** + * Displays the dialog box. + * + * @param { ShowDialogOptions } options - Options. + * @returns { Promise } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 8 + * @deprecated since 9 + */ + function showDialog(options: ShowDialogOptions): Promise; + /** + * Displays the menu. + * + * @param { ActionMenuOptions } options - Options. + * @param { AsyncCallback } callback + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 8 + * @deprecated since 9 + */ + function showActionMenu(options: ActionMenuOptions, callback: AsyncCallback): void; + /** + * Displays the menu. + * + * @param { ActionMenuOptions } options - Options. + * @returns { Promise } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 8 + * @deprecated since 9 + */ + function showActionMenu(options: ActionMenuOptions): Promise; +} +export default prompt; diff --git a/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.promptAction.d.ts b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.promptAction.d.ts new file mode 100755 index 00000000..e4b706bd --- /dev/null +++ b/language/arkts/extractor/sdk/openharmony/ets/api/@ohos.promptAction.d.ts @@ -0,0 +1,1318 @@ +/* + * Copyright (c) 2021-2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit ArkUI + */ + +/// +import { AsyncCallback } from './@ohos.base'; +import { Resource } from 'GlobalResource'; +/** + * @namespace promptAction + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 9 + */ +/** + * @namespace promptAction + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 10 + */ +/** + * @namespace promptAction + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 11 + */ +declare namespace promptAction { + /** + * @typedef ShowToastOptions + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 9 + */ + /** + * @typedef ShowToastOptions + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 10 + */ + /** + * @typedef ShowToastOptions + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 11 + */ + interface ShowToastOptions { + /** + * Text to display. + * + * @type { string | Resource } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 9 + */ + /** + * Text to display. + * + * @type { string | Resource } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 10 + */ + /** + * Text to display. + * + * @type { string | Resource } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 11 + */ + message: string | Resource; + /** + * Duration of toast dialog box. The default value is 1500. + * The recommended value ranges from 1500ms to 10000ms. + * NOTE: A value less than 1500 is automatically changed to 1500. The maximum value is 10000ms. + * + * @type { ?number } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 9 + */ + /** + * Duration of toast dialog box. The default value is 1500. + * The recommended value ranges from 1500ms to 10000ms. + * NOTE: A value less than 1500 is automatically changed to 1500. The maximum value is 10000ms. + * + * @type { ?number } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 10 + */ + /** + * Duration of toast dialog box. The default value is 1500. + * The recommended value ranges from 1500ms to 10000ms. + * NOTE: A value less than 1500 is automatically changed to 1500. The maximum value is 10000ms. + * + * @type { ?number } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 11 + */ + duration?: number; + /** + * The distance between toast dialog box and the bottom of screen. + * + * @type { ?(string | number) } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 9 + */ + /** + * The distance between toast dialog box and the bottom of screen. + * + * @type { ?(string | number) } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 10 + */ + /** + * The distance between toast dialog box and the bottom of screen. + * + * @type { ?(string | number) } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 11 + */ + bottom?: string | number; + /** + * Determine the show mode of the toast. + * + * @type { ?ToastShowMode } + * @default ToastShowMode.DEFAULT + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 11 + */ + /** + * Determine the show mode of the toast. + * + * @type { ?ToastShowMode } + * @default ToastShowMode.DEFAULT + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 12 + */ + showMode?: ToastShowMode; + /** + * Defines the toast alignment of the screen. + * + * @type { ?Alignment } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + */ + alignment?: Alignment; + /** + * Defines the toast offset. + * + * @type { ?Offset } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 12 + */ + offset?: Offset; + } + /** + * Enum for the toast showMode. + * + * @enum { number } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 11 + */ + /** + * Enum for the toast showMode. + * + * @enum { number } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 12 + */ + export enum ToastShowMode { + /** + * Toast shows in app. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 11 + */ + /** + * Toast shows in app. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 12 + */ + DEFAULT = 0, + /** + * Toast shows at the top. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 11 + */ + /** + * Toast shows at the top. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @atomicservice + * @since 12 + */ + TOP_MOST = 1 + } + /** + * @typedef Button + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 9 + */ + /** + * @typedef Button + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 10 + */ + /** + * @typedef Button + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 11 + */ + interface Button { + /** + * The text displayed in the button. + * + * @type { string | Resource } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 9 + */ + /** + * The text displayed in the button. + * + * @type { string | Resource } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 10 + */ + /** + * The text displayed in the button. + * + * @type { string | Resource } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 11 + */ + text: string | Resource; + /** + * The foreground color of button. + * + * @type { string | Resource } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 9 + */ + /** + * The foreground color of button. + * + * @type { string | Resource } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 10 + */ + /** + * The foreground color of button. + * + * @type { string | Resource } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 11 + */ + color: string | Resource; + /** + * Define whether the button responds to Enter/Space key by default. + * + * @type { ?boolean } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 12 + */ + primary?: boolean; + } + /** + * @typedef ShowDialogSuccessResponse + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 9 + */ + /** + * @typedef ShowDialogSuccessResponse + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 10 + */ + /** + * @typedef ShowDialogSuccessResponse + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 11 + */ + interface ShowDialogSuccessResponse { + /** + * Index of the selected button, starting from 0. + * + * @type { number } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 9 + */ + /** + * Index of the selected button, starting from 0. + * + * @type { number } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 10 + */ + /** + * Index of the selected button, starting from 0. + * + * @type { number } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 11 + */ + index: number; + } + /** + * @typedef ShowDialogOptions + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 9 + */ + /** + * @typedef ShowDialogOptions + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 10 + */ + /** + * @typedef ShowDialogOptions + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 11 + */ + interface ShowDialogOptions { + /** + * Title of the text to display. + * + * @type { ?(string | Resource) } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 9 + */ + /** + * Title of the text to display. + * + * @type { ?(string | Resource) } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 10 + */ + /** + * Title of the text to display. + * + * @type { ?(string | Resource) } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 11 + */ + title?: string | Resource; + /** + * Text body. + * + * @type { ?(string | Resource) } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 9 + */ + /** + * Text body. + * + * @type { ?(string | Resource) } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @since 10 + */ + /** + * Text body. + * + * @type { ?(string | Resource) } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @crossplatform + * @atomicservice + * @since 11 + */ + message?: string | Resource; + /** + * Array of buttons in the dialog box. + * The array structure is {text:'button', color: '#666666'}. + * One to three buttons are supported. + * The first button is of the positiveButton type, the second is of the negativeButton type, and the third is of the neutralButton type. + * + * @type { ?Array